summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorart <art@openbsd.org>2001-02-07 07:44:58 +0000
committerart <art@openbsd.org>2001-02-07 07:44:58 +0000
commit786b4b12872a106d27621423bc2252bcd6c94d87 (patch)
tree09bf398f28ecf763129839e46be3217a63420364
parentNow that niklas has fixed ddb to not barf on elf symbols, there (diff)
downloadwireguard-openbsd-786b4b12872a106d27621423bc2252bcd6c94d87.tar.xz
wireguard-openbsd-786b4b12872a106d27621423bc2252bcd6c94d87.zip
We need to loose some weight.
If someone feels very opposed to this, the code is left in the Attic. Just revive and _make_it_work_.
-rw-r--r--sys/arch/arc/Makefile35
-rw-r--r--sys/arch/arc/TODO20
-rw-r--r--sys/arch/arc/algor/algor.h151
-rw-r--r--sys/arch/arc/algor/algorbus.c485
-rw-r--r--sys/arch/arc/arc/autoconf.c495
-rw-r--r--sys/arch/arc/arc/clock_mc.c336
-rw-r--r--sys/arch/arc/arc/conf.c373
-rw-r--r--sys/arch/arc/arc/genassym.cf57
-rw-r--r--sys/arch/arc/arc/locore.S3063
-rw-r--r--sys/arch/arc/arc/machdep.c1373
-rw-r--r--sys/arch/arc/arc/pmap.c1824
-rw-r--r--sys/arch/arc/arc/swapgeneric.c61
-rw-r--r--sys/arch/arc/arc/trap.c1593
-rw-r--r--sys/arch/arc/compile/.cvsignore6
-rw-r--r--sys/arch/arc/conf/ARCTIC141
-rw-r--r--sys/arch/arc/conf/GENERIC99
-rw-r--r--sys/arch/arc/conf/IMP388
-rw-r--r--sys/arch/arc/conf/Makefile.arc185
-rw-r--r--sys/arch/arc/conf/NFSROOT126
-rw-r--r--sys/arch/arc/conf/P4032116
-rw-r--r--sys/arch/arc/conf/PICA104
-rw-r--r--sys/arch/arc/conf/RAMDISK174
-rw-r--r--sys/arch/arc/conf/files.arc176
-rw-r--r--sys/arch/arc/conf/ld.script74
-rw-r--r--sys/arch/arc/dev/asc.c2091
-rw-r--r--sys/arch/arc/dev/ascreg.h322
-rw-r--r--sys/arch/arc/dev/com_lbus.c194
-rw-r--r--sys/arch/arc/dev/dma.c397
-rw-r--r--sys/arch/arc/dev/dma.h157
-rw-r--r--sys/arch/arc/dev/fd.c1142
-rw-r--r--sys/arch/arc/dev/fdreg.h67
-rw-r--r--sys/arch/arc/dev/if_sn.c1252
-rw-r--r--sys/arch/arc/dev/if_sn.h347
-rw-r--r--sys/arch/arc/dev/lpt_lbus.c151
-rw-r--r--sys/arch/arc/dev/pccons.c2409
-rw-r--r--sys/arch/arc/dev/rd_root.c76
-rw-r--r--sys/arch/arc/dev/scsi.h551
-rw-r--r--sys/arch/arc/dti/btl.c1436
-rw-r--r--sys/arch/arc/dti/btlreg.h309
-rw-r--r--sys/arch/arc/dti/desktech.h81
-rw-r--r--sys/arch/arc/include/ansi.h5
-rw-r--r--sys/arch/arc/include/asm.h5
-rw-r--r--sys/arch/arc/include/autoconf.h81
-rw-r--r--sys/arch/arc/include/bus.h215
-rw-r--r--sys/arch/arc/include/cdefs.h5
-rw-r--r--sys/arch/arc/include/cpu.h5
-rw-r--r--sys/arch/arc/include/db_machdep.h5
-rw-r--r--sys/arch/arc/include/disklabel.h110
-rw-r--r--sys/arch/arc/include/display.h48
-rw-r--r--sys/arch/arc/include/dlfcn.h5
-rw-r--r--sys/arch/arc/include/ecoff.h5
-rw-r--r--sys/arch/arc/include/elf_abi.h5
-rw-r--r--sys/arch/arc/include/endian.h38
-rw-r--r--sys/arch/arc/include/exec.h58
-rw-r--r--sys/arch/arc/include/float.h5
-rw-r--r--sys/arch/arc/include/frame.h5
-rw-r--r--sys/arch/arc/include/ieeefp.h5
-rw-r--r--sys/arch/arc/include/intr.h78
-rw-r--r--sys/arch/arc/include/joystick.h23
-rw-r--r--sys/arch/arc/include/kbdreg.h82
-rw-r--r--sys/arch/arc/include/kcore.h5
-rw-r--r--sys/arch/arc/include/kdbparam.h5
-rw-r--r--sys/arch/arc/include/limits.h5
-rw-r--r--sys/arch/arc/include/link.h5
-rw-r--r--sys/arch/arc/include/memconf.h5
-rw-r--r--sys/arch/arc/include/mips_opcode.h5
-rw-r--r--sys/arch/arc/include/mouse.h52
-rw-r--r--sys/arch/arc/include/param.h195
-rw-r--r--sys/arch/arc/include/pcb.h5
-rw-r--r--sys/arch/arc/include/pccons.h45
-rw-r--r--sys/arch/arc/include/pio.h5
-rw-r--r--sys/arch/arc/include/pmap.h5
-rw-r--r--sys/arch/arc/include/proc.h5
-rw-r--r--sys/arch/arc/include/profile.h5
-rw-r--r--sys/arch/arc/include/psl.h73
-rw-r--r--sys/arch/arc/include/pte.h136
-rw-r--r--sys/arch/arc/include/ptrace.h5
-rw-r--r--sys/arch/arc/include/reg.h5
-rw-r--r--sys/arch/arc/include/regdef.h5
-rw-r--r--sys/arch/arc/include/regnum.h5
-rw-r--r--sys/arch/arc/include/reloc.h5
-rw-r--r--sys/arch/arc/include/setjmp.h5
-rw-r--r--sys/arch/arc/include/signal.h5
-rw-r--r--sys/arch/arc/include/spinlock.h3
-rw-r--r--sys/arch/arc/include/stdarg.h5
-rw-r--r--sys/arch/arc/include/trap.h5
-rw-r--r--sys/arch/arc/include/types.h5
-rw-r--r--sys/arch/arc/include/varargs.h5
-rw-r--r--sys/arch/arc/include/vmparam.h235
-rw-r--r--sys/arch/arc/isa/isa_machdep.h87
-rw-r--r--sys/arch/arc/isa/isabus.c528
-rw-r--r--sys/arch/arc/isa/isadma.c317
-rw-r--r--sys/arch/arc/isa/isadmareg.h22
-rw-r--r--sys/arch/arc/isa/isapnp_machdep.c153
-rw-r--r--sys/arch/arc/isa/isapnp_machdep.h76
-rw-r--r--sys/arch/arc/isa/joy.c256
-rw-r--r--sys/arch/arc/isa/spkrreg.h11
-rw-r--r--sys/arch/arc/isa/timerreg.h100
-rw-r--r--sys/arch/arc/pci/pbcpcibus.c534
-rw-r--r--sys/arch/arc/pci/pci_machdep.h98
-rw-r--r--sys/arch/arc/pci/pcibrvar.h48
-rw-r--r--sys/arch/arc/pci/v962pcbreg.h331
-rw-r--r--sys/arch/arc/pica/pica.h154
-rw-r--r--sys/arch/arc/pica/picabus.c318
-rw-r--r--sys/arch/arc/stand/Makefile5
-rw-r--r--sys/arch/arc/stand/libsa/Makefile14
-rw-r--r--sys/arch/arc/stand/libsa/devopen.c128
-rw-r--r--sys/arch/arc/stand/libsa/getenv.c45
-rw-r--r--sys/arch/arc/stand/libsa/getputchar.c69
-rw-r--r--sys/arch/arc/stand/mbr/Makefile18
-rw-r--r--sys/arch/arc/stand/mbr/mbr.uu15
-rw-r--r--sys/arch/arc/stand/mbr/msdos5mb.gz.uu208
-rw-r--r--sys/arch/arm32/Makefile32
-rw-r--r--sys/arch/arm32/arm32/ast.c169
-rw-r--r--sys/arch/arm32/arm32/autoconf.c281
-rw-r--r--sys/arch/arm32/arm32/bcopy.S113
-rw-r--r--sys/arch/arm32/arm32/bcopy_page.S150
-rw-r--r--sys/arch/arm32/arm32/bcopyinout.S132
-rw-r--r--sys/arch/arm32/arm32/blockio.S312
-rw-r--r--sys/arch/arm32/arm32/clock.c394
-rw-r--r--sys/arch/arm32/arm32/conf.c422
-rw-r--r--sys/arch/arm32/arm32/coproc15.S150
-rw-r--r--sys/arch/arm32/arm32/copystr.S132
-rw-r--r--sys/arch/arm32/arm32/cpuswitch.S786
-rw-r--r--sys/arch/arm32/arm32/db_disasm.c558
-rw-r--r--sys/arch/arm32/arm32/db_interface.c288
-rw-r--r--sys/arch/arm32/arm32/db_machdep.c163
-rw-r--r--sys/arch/arm32/arm32/db_trace.c101
-rw-r--r--sys/arch/arm32/arm32/debug.c251
-rw-r--r--sys/arch/arm32/arm32/disassem.c650
-rw-r--r--sys/arch/arm32/arm32/disksubr.c583
-rw-r--r--sys/arch/arm32/arm32/exception.S340
-rw-r--r--sys/arch/arm32/arm32/fault.c1240
-rw-r--r--sys/arch/arm32/arm32/fiq.S78
-rw-r--r--sys/arch/arm32/arm32/fusu.c224
-rw-r--r--sys/arch/arm32/arm32/genassym.c138
-rw-r--r--sys/arch/arm32/arm32/irq.S508
-rw-r--r--sys/arch/arm32/arm32/irqhandler.c576
-rw-r--r--sys/arch/arm32/arm32/kgdb_glue.c258
-rw-r--r--sys/arch/arm32/arm32/kgdb_step.c440
-rw-r--r--sys/arch/arm32/arm32/locore.S565
-rw-r--r--sys/arch/arm32/arm32/machdep.c2156
-rw-r--r--sys/arch/arm32/arm32/makemodes.c362
-rw-r--r--sys/arch/arm32/arm32/mcount.S47
-rw-r--r--sys/arch/arm32/arm32/mem.c218
-rw-r--r--sys/arch/arm32/arm32/memset.S136
-rw-r--r--sys/arch/arm32/arm32/pmap.c2571
-rw-r--r--sys/arch/arm32/arm32/postmortem.c336
-rw-r--r--sys/arch/arm32/arm32/process_machdep.c178
-rw-r--r--sys/arch/arm32/arm32/scratch.S263
-rw-r--r--sys/arch/arm32/arm32/setcpsr.S95
-rw-r--r--sys/arch/arm32/arm32/setstack.S104
-rw-r--r--sys/arch/arm32/arm32/spl.S126
-rw-r--r--sys/arch/arm32/arm32/strstr.c68
-rw-r--r--sys/arch/arm32/arm32/strtoul.c83
-rw-r--r--sys/arch/arm32/arm32/stubs.c618
-rw-r--r--sys/arch/arm32/arm32/swapgeneric.c60
-rw-r--r--sys/arch/arm32/arm32/sys_machdep.c75
-rw-r--r--sys/arch/arm32/arm32/syscall.c573
-rw-r--r--sys/arch/arm32/arm32/undefined.c326
-rw-r--r--sys/arch/arm32/arm32/vm_machdep.c577
-rw-r--r--sys/arch/arm32/boot/Makefile96
-rw-r--r--sys/arch/arm32/boot/Makefile.inc28
-rw-r--r--sys/arch/arm32/boot/README7
-rw-r--r--sys/arch/arm32/boot/_bsdboot.S55
-rw-r--r--sys/arch/arm32/boot/_main.S141
-rw-r--r--sys/arch/arm32/boot/areahand.S98
-rw-r--r--sys/arch/arm32/boot/arm6.h161
-rw-r--r--sys/arch/arm32/boot/bsdbooter.c777
-rw-r--r--sys/arch/arm32/boot/enteros.S65
-rw-r--r--sys/arch/arm32/boot/exit.S64
-rw-r--r--sys/arch/arm32/boot/exitos.S63
-rw-r--r--sys/arch/arm32/boot/memcpy.S113
-rw-r--r--sys/arch/arm32/boot/memset.S136
-rw-r--r--sys/arch/arm32/boot/regs.h52
-rw-r--r--sys/arch/arm32/boot/rmaouthdr4
-rw-r--r--sys/arch/arm32/boot/setcpsr.S95
-rw-r--r--sys/arch/arm32/boot/start.S54
-rw-r--r--sys/arch/arm32/boot/strstr.c70
-rw-r--r--sys/arch/arm32/boot/svc32.S66
-rw-r--r--sys/arch/arm32/boot/swis.h596
-rw-r--r--sys/arch/arm32/boot/swiv.S80
-rw-r--r--sys/arch/arm32/boot/swiv.h80
-rw-r--r--sys/arch/arm32/boot/vsprintf.c275
-rw-r--r--sys/arch/arm32/conf/BETA185
-rw-r--r--sys/arch/arm32/conf/CLAIRE184
-rw-r--r--sys/arch/arm32/conf/GENERIC201
-rw-r--r--sys/arch/arm32/conf/Makefile.arm32185
-rw-r--r--sys/arch/arm32/conf/PHARM193
-rw-r--r--sys/arch/arm32/conf/REMY328
-rw-r--r--sys/arch/arm32/conf/VOYAGER196
-rw-r--r--sys/arch/arm32/conf/files.arm32268
-rw-r--r--sys/arch/arm32/conf/monitors/AKF60360
-rw-r--r--sys/arch/arm32/conf/monitors/AKF85397
-rw-r--r--sys/arch/arm32/conf/monitors/Taxan875+LR412
-rw-r--r--sys/arch/arm32/conf/std.arm325
-rw-r--r--sys/arch/arm32/dev/console/console.c1220
-rw-r--r--sys/arch/arm32/dev/console/debugconsole.c88
-rw-r--r--sys/arch/arm32/dev/console/dumb.c146
-rw-r--r--sys/arch/arm32/dev/console/fonts/font_bold.h265
-rw-r--r--sys/arch/arm32/dev/console/fonts/font_italic.h265
-rw-r--r--sys/arch/arm32/dev/console/fonts/font_normal.h265
-rw-r--r--sys/arch/arm32/dev/console/fonts/font_wide.h259
-rw-r--r--sys/arch/arm32/dev/console/vidc.c255
-rw-r--r--sys/arch/arm32/dev/console/vidc_mc.S213
-rw-r--r--sys/arch/arm32/dev/console/vidcconsole.c1818
-rw-r--r--sys/arch/arm32/dev/console/vt220.c2008
-rw-r--r--sys/arch/arm32/dev/console/vt220.h117
-rw-r--r--sys/arch/arm32/dev/rd_hooks.c98
-rw-r--r--sys/arch/arm32/doc/bootloader12
-rw-r--r--sys/arch/arm32/doc/history451
-rw-r--r--sys/arch/arm32/doc/majors+minors246
-rw-r--r--sys/arch/arm32/doc/note.users13
-rw-r--r--sys/arch/arm32/fpe-arm/armfpe.h137
-rw-r--r--sys/arch/arm32/fpe-arm/armfpe.s7459
-rw-r--r--sys/arch/arm32/fpe-arm/armfpe_glue.S411
-rw-r--r--sys/arch/arm32/fpe-arm/armfpe_init.c333
-rw-r--r--sys/arch/arm32/fpe-sp/fpe.c1321
-rw-r--r--sys/arch/arm32/fpe-sp/fpeadd.S121
-rw-r--r--sys/arch/arm32/fpe-sp/fpecmf.S67
-rw-r--r--sys/arch/arm32/fpe-sp/fpediv.S99
-rw-r--r--sys/arch/arm32/fpe-sp/fpefix.S72
-rw-r--r--sys/arch/arm32/fpe-sp/fpemul.S99
-rw-r--r--sys/arch/arm32/fpe-sp/fpesub.S113
-rw-r--r--sys/arch/arm32/fpe-sp/fpetoe.S62
-rw-r--r--sys/arch/arm32/include/ansi.h83
-rw-r--r--sys/arch/arm32/include/asm.h73
-rw-r--r--sys/arch/arm32/include/beep.h43
-rw-r--r--sys/arch/arm32/include/bootconfig.h89
-rw-r--r--sys/arch/arm32/include/cdefs.h35
-rw-r--r--sys/arch/arm32/include/cpu.h204
-rw-r--r--sys/arch/arm32/include/cpus.h160
-rw-r--r--sys/arch/arm32/include/db_machdep.h85
-rw-r--r--sys/arch/arm32/include/disklabel.h131
-rw-r--r--sys/arch/arm32/include/endian.h38
-rw-r--r--sys/arch/arm32/include/exec.h69
-rw-r--r--sys/arch/arm32/include/float.h71
-rw-r--r--sys/arch/arm32/include/fp.h64
-rw-r--r--sys/arch/arm32/include/frame.h140
-rw-r--r--sys/arch/arm32/include/iic.h71
-rw-r--r--sys/arch/arm32/include/io.h120
-rw-r--r--sys/arch/arm32/include/iomd.h159
-rw-r--r--sys/arch/arm32/include/irqhandler.h212
-rw-r--r--sys/arch/arm32/include/katelib.h132
-rw-r--r--sys/arch/arm32/include/kbd.h66
-rw-r--r--sys/arch/arm32/include/kgdb.h45
-rw-r--r--sys/arch/arm32/include/limits.h81
-rw-r--r--sys/arch/arm32/include/mouse.h111
-rw-r--r--sys/arch/arm32/include/param.h184
-rw-r--r--sys/arch/arm32/include/pcb.h79
-rw-r--r--sys/arch/arm32/include/pmap.h132
-rw-r--r--sys/arch/arm32/include/podule.h88
-rw-r--r--sys/arch/arm32/include/proc.h45
-rw-r--r--sys/arch/arm32/include/profile.h65
-rw-r--r--sys/arch/arm32/include/psl.h84
-rw-r--r--sys/arch/arm32/include/pte.h107
-rw-r--r--sys/arch/arm32/include/ptrace.h41
-rw-r--r--sys/arch/arm32/include/qmouse.h75
-rw-r--r--sys/arch/arm32/include/reg.h58
-rw-r--r--sys/arch/arm32/include/rtc.h83
-rw-r--r--sys/arch/arm32/include/setjmp.h7
-rw-r--r--sys/arch/arm32/include/signal.h89
-rw-r--r--sys/arch/arm32/include/stdarg.h60
-rw-r--r--sys/arch/arm32/include/types.h80
-rw-r--r--sys/arch/arm32/include/undefined.h63
-rw-r--r--sys/arch/arm32/include/varargs.h64
-rw-r--r--sys/arch/arm32/include/vconsole.h294
-rw-r--r--sys/arch/arm32/include/vidc.h269
-rw-r--r--sys/arch/arm32/include/vmparam.h116
-rw-r--r--sys/arch/arm32/kshell/dumphex.c133
-rw-r--r--sys/arch/arm32/kshell/shell_disassem.c186
-rw-r--r--sys/arch/arm32/kshell/shell_input.c297
-rw-r--r--sys/arch/arm32/kshell/shell_shell.c662
-rw-r--r--sys/arch/arm32/kshell/strchr.c49
-rw-r--r--sys/arch/arm32/mainbus/beep.c369
-rw-r--r--sys/arch/arm32/mainbus/com.c1034
-rw-r--r--sys/arch/arm32/mainbus/comreg.h133
-rw-r--r--sys/arch/arm32/mainbus/cpu.c500
-rw-r--r--sys/arch/arm32/mainbus/fd.c1339
-rw-r--r--sys/arch/arm32/mainbus/fdreg.h102
-rw-r--r--sys/arch/arm32/mainbus/iic.c403
-rw-r--r--sys/arch/arm32/mainbus/iic_asm.S239
-rw-r--r--sys/arch/arm32/mainbus/kbd.c1357
-rw-r--r--sys/arch/arm32/mainbus/lpt.c1314
-rw-r--r--sys/arch/arm32/mainbus/lptreg.h64
-rw-r--r--sys/arch/arm32/mainbus/mainbus.c136
-rw-r--r--sys/arch/arm32/mainbus/mainbus.h62
-rw-r--r--sys/arch/arm32/mainbus/pms.c612
-rw-r--r--sys/arch/arm32/mainbus/qmouse.c440
-rw-r--r--sys/arch/arm32/mainbus/rtc.c384
-rw-r--r--sys/arch/arm32/mainbus/vidcaudio.c870
-rw-r--r--sys/arch/arm32/mainbus/waveform.h551
-rw-r--r--sys/arch/arm32/mainbus/wd.c1765
-rw-r--r--sys/arch/arm32/mainbus/wdreg.h161
-rw-r--r--sys/arch/arm32/podulebus/asc.c483
-rw-r--r--sys/arch/arm32/podulebus/ascreg.h279
-rw-r--r--sys/arch/arm32/podulebus/ascvar.h52
-rw-r--r--sys/arch/arm32/podulebus/if_ea.c1526
-rw-r--r--sys/arch/arm32/podulebus/if_eareg.h168
-rw-r--r--sys/arch/arm32/podulebus/if_eb.c1544
-rw-r--r--sys/arch/arm32/podulebus/if_ebreg.h154
-rw-r--r--sys/arch/arm32/podulebus/if_eh.c1213
-rw-r--r--sys/arch/arm32/podulebus/if_ehreg.h151
-rw-r--r--sys/arch/arm32/podulebus/if_ie.c1524
-rw-r--r--sys/arch/arm32/podulebus/if_iereg.h53
-rw-r--r--sys/arch/arm32/podulebus/ncr5380reg.h160
-rw-r--r--sys/arch/arm32/podulebus/ncr5380sbc.c2591
-rw-r--r--sys/arch/arm32/podulebus/ncr5380var.h178
-rw-r--r--sys/arch/arm32/podulebus/oak.c382
-rw-r--r--sys/arch/arm32/podulebus/podulebus.c627
-rw-r--r--sys/arch/arm32/podulebus/podulebus.h114
-rw-r--r--sys/arch/arm32/podulebus/ptsc.c485
-rw-r--r--sys/arch/arm32/podulebus/ptscreg.h77
-rw-r--r--sys/arch/arm32/podulebus/ptscvar.h52
-rw-r--r--sys/arch/arm32/podulebus/sbic.c2947
-rw-r--r--sys/arch/arm32/podulebus/sbicreg.h426
-rw-r--r--sys/arch/arm32/podulebus/sbicvar.h230
-rw-r--r--sys/arch/arm32/podulebus/sfas.c1621
-rw-r--r--sys/arch/arm32/podulebus/sfasreg.h158
-rw-r--r--sys/arch/arm32/podulebus/sfasvar.h263
-rw-r--r--sys/arch/atari/Makefile45
-rw-r--r--sys/arch/atari/atari/atari_init.c546
-rw-r--r--sys/arch/atari/atari/autoconf.c274
-rw-r--r--sys/arch/atari/atari/conf.c334
-rw-r--r--sys/arch/atari/atari/db_memrw.c161
-rw-r--r--sys/arch/atari/atari/device.h55
-rw-r--r--sys/arch/atari/atari/disksubr.c705
-rw-r--r--sys/arch/atari/atari/dkbad.c65
-rw-r--r--sys/arch/atari/atari/fpu.c136
-rw-r--r--sys/arch/atari/atari/genassym.c172
-rw-r--r--sys/arch/atari/atari/kdassert.h56
-rw-r--r--sys/arch/atari/atari/locore.s1904
-rw-r--r--sys/arch/atari/atari/machdep.c1429
-rw-r--r--sys/arch/atari/atari/mem.c214
-rw-r--r--sys/arch/atari/atari/misc.c222
-rw-r--r--sys/arch/atari/atari/misc.h55
-rw-r--r--sys/arch/atari/atari/pmap.c2241
-rw-r--r--sys/arch/atari/atari/swapgeneric.c308
-rw-r--r--sys/arch/atari/atari/sys_machdep.c229
-rw-r--r--sys/arch/atari/atari/trap.c1000
-rw-r--r--sys/arch/atari/atari/vectors.s205
-rw-r--r--sys/arch/atari/atari/vm_machdep.c401
-rw-r--r--sys/arch/atari/compile/.cvsignore4
-rw-r--r--sys/arch/atari/conf/ATARITT103
-rw-r--r--sys/arch/atari/conf/BOOT96
-rw-r--r--sys/arch/atari/conf/FALCON89
-rw-r--r--sys/arch/atari/conf/GENERIC117
-rw-r--r--sys/arch/atari/conf/Makefile.atari169
-rw-r--r--sys/arch/atari/conf/files.atari124
-rw-r--r--sys/arch/atari/conf/std.atari28
-rw-r--r--sys/arch/atari/dev/atari5380.c840
-rw-r--r--sys/arch/atari/dev/clock.c465
-rw-r--r--sys/arch/atari/dev/clockioctl.h47
-rw-r--r--sys/arch/atari/dev/clockreg.h63
-rw-r--r--sys/arch/atari/dev/dma.c278
-rw-r--r--sys/arch/atari/dev/event.c173
-rw-r--r--sys/arch/atari/dev/event_var.h89
-rw-r--r--sys/arch/atari/dev/fd.c1261
-rw-r--r--sys/arch/atari/dev/fdreg.h93
-rw-r--r--sys/arch/atari/dev/font.h48
-rw-r--r--sys/arch/atari/dev/font_8x16.c565
-rw-r--r--sys/arch/atari/dev/font_8x8.c307
-rw-r--r--sys/arch/atari/dev/grf.c567
-rw-r--r--sys/arch/atari/dev/grfabs.c229
-rw-r--r--sys/arch/atari/dev/grfabs_fal.c549
-rw-r--r--sys/arch/atari/dev/grfabs_fal.h65
-rw-r--r--sys/arch/atari/dev/grfabs_reg.h219
-rw-r--r--sys/arch/atari/dev/grfabs_tt.c402
-rw-r--r--sys/arch/atari/dev/grfioctl.h212
-rw-r--r--sys/arch/atari/dev/grfvar.h97
-rw-r--r--sys/arch/atari/dev/ite.c2348
-rw-r--r--sys/arch/atari/dev/ite_cc.c671
-rw-r--r--sys/arch/atari/dev/iteioctl.h83
-rw-r--r--sys/arch/atari/dev/itevar.h200
-rw-r--r--sys/arch/atari/dev/kbd.c563
-rw-r--r--sys/arch/atari/dev/kbdmap.c207
-rw-r--r--sys/arch/atari/dev/kbdmap.h144
-rw-r--r--sys/arch/atari/dev/kbdreg.h54
-rw-r--r--sys/arch/atari/dev/ms.c397
-rw-r--r--sys/arch/atari/dev/ncr5380.c2002
-rw-r--r--sys/arch/atari/dev/ncr5380reg.h259
-rw-r--r--sys/arch/atari/dev/nvram.c205
-rw-r--r--sys/arch/atari/dev/nvramvar.h57
-rw-r--r--sys/arch/atari/dev/ramd.c506
-rw-r--r--sys/arch/atari/dev/view.c420
-rw-r--r--sys/arch/atari/dev/viewioctl.h57
-rw-r--r--sys/arch/atari/dev/viewvar.h63
-rw-r--r--sys/arch/atari/dev/vuid_event.h87
-rw-r--r--sys/arch/atari/dev/zs.c1233
-rw-r--r--sys/arch/atari/dev/zsvar.h162
-rw-r--r--sys/arch/atari/include/acia.h86
-rw-r--r--sys/arch/atari/include/ansi.h8
-rw-r--r--sys/arch/atari/include/asm.h8
-rw-r--r--sys/arch/atari/include/cdefs.h8
-rw-r--r--sys/arch/atari/include/cpu.h214
-rw-r--r--sys/arch/atari/include/cpufunc.h8
-rw-r--r--sys/arch/atari/include/db_machdep.h8
-rw-r--r--sys/arch/atari/include/disklabel.h59
-rw-r--r--sys/arch/atari/include/dma.h105
-rw-r--r--sys/arch/atari/include/endian.h9
-rw-r--r--sys/arch/atari/include/exec.h63
-rw-r--r--sys/arch/atari/include/float.h8
-rw-r--r--sys/arch/atari/include/frame.h8
-rw-r--r--sys/arch/atari/include/ieeefp.h4
-rw-r--r--sys/arch/atari/include/iomap.h63
-rw-r--r--sys/arch/atari/include/limits.h9
-rw-r--r--sys/arch/atari/include/mfp.h177
-rw-r--r--sys/arch/atari/include/mtpr.h68
-rw-r--r--sys/arch/atari/include/param.h217
-rw-r--r--sys/arch/atari/include/pcb.h77
-rw-r--r--sys/arch/atari/include/pmap.h123
-rw-r--r--sys/arch/atari/include/proc.h52
-rw-r--r--sys/arch/atari/include/profile.h8
-rw-r--r--sys/arch/atari/include/psl.h8
-rw-r--r--sys/arch/atari/include/pte.h145
-rw-r--r--sys/arch/atari/include/ptrace.h8
-rw-r--r--sys/arch/atari/include/reg.h8
-rw-r--r--sys/arch/atari/include/scu.h106
-rw-r--r--sys/arch/atari/include/setjmp.h3
-rw-r--r--sys/arch/atari/include/signal.h8
-rw-r--r--sys/arch/atari/include/spinlock.h3
-rw-r--r--sys/arch/atari/include/stdarg.h4
-rw-r--r--sys/arch/atari/include/tospart.h93
-rw-r--r--sys/arch/atari/include/trap.h8
-rw-r--r--sys/arch/atari/include/types.h8
-rw-r--r--sys/arch/atari/include/varargs.h4
-rw-r--r--sys/arch/atari/include/video.h201
-rw-r--r--sys/arch/atari/include/vmparam.h168
-rw-r--r--sys/arch/atari/stand/binpatch/Makefile9
-rw-r--r--sys/arch/atari/stand/binpatch/binpatch.896
-rw-r--r--sys/arch/atari/stand/binpatch/binpatch.c241
-rw-r--r--sys/arch/atari/stand/loadkmap/ge-kbdmap.c208
-rw-r--r--sys/arch/atari/stand/loadkmap/loadkmap.c74
-rw-r--r--sys/arch/atari/stand/loadkmap/uk-kbdmap.c141
-rw-r--r--sys/arch/atari/stand/loadkmap/us-kbdmap.c157
-rw-r--r--sys/arch/atari/stand/tostools/Makefile20
-rw-r--r--sys/arch/atari/stand/tostools/Makefile.inc64
-rw-r--r--sys/arch/atari/stand/tostools/aptck/Makefile17
-rw-r--r--sys/arch/atari/stand/tostools/aptck/ahdilbl.h116
-rw-r--r--sys/arch/atari/stand/tostools/aptck/aptck.h105
-rw-r--r--sys/arch/atari/stand/tostools/aptck/aptck.in124
-rw-r--r--sys/arch/atari/stand/tostools/aptck/biosrw.s82
-rw-r--r--sys/arch/atari/stand/tostools/aptck/diskio.c338
-rw-r--r--sys/arch/atari/stand/tostools/aptck/disklbl.c345
-rw-r--r--sys/arch/atari/stand/tostools/aptck/disklbl.h140
-rw-r--r--sys/arch/atari/stand/tostools/aptck/setrev.awk39
-rw-r--r--sys/arch/atari/stand/tostools/chg_pid/Makefile11
-rw-r--r--sys/arch/atari/stand/tostools/chg_pid/chg_pid.c349
-rw-r--r--sys/arch/atari/stand/tostools/libtos/Makefile12
-rw-r--r--sys/arch/atari/stand/tostools/libtos/bsdstart.s111
-rw-r--r--sys/arch/atari/stand/tostools/libtos/eprintf.c82
-rw-r--r--sys/arch/atari/stand/tostools/libtos/error.c105
-rw-r--r--sys/arch/atari/stand/tostools/libtos/keywait.c68
-rw-r--r--sys/arch/atari/stand/tostools/libtos/kparamb.h75
-rw-r--r--sys/arch/atari/stand/tostools/libtos/libtos.h70
-rw-r--r--sys/arch/atari/stand/tostools/libtos/xalloc.c57
-rw-r--r--sys/arch/atari/stand/tostools/libtos/xexit.c60
-rw-r--r--sys/arch/atari/stand/tostools/loadbsd/Makefile11
-rw-r--r--sys/arch/atari/stand/tostools/loadbsd/loadbsd.c354
-rw-r--r--sys/arch/atari/stand/tostools/loadbsd/loader.h70
-rw-r--r--sys/arch/atari/stand/tostools/rawwrite/Makefile11
-rw-r--r--sys/arch/atari/stand/tostools/rawwrite/rawwrite.c168
-rw-r--r--sys/arch/kbus/Makefile32
-rw-r--r--sys/arch/kbus/README49
-rw-r--r--sys/arch/kbus/compile/.cvsignore4
-rw-r--r--sys/arch/kbus/conf/DEFAULT111
-rw-r--r--sys/arch/kbus/conf/DISKLESS112
-rw-r--r--sys/arch/kbus/conf/Makefile.kbus165
-rw-r--r--sys/arch/kbus/conf/files.kbus144
-rw-r--r--sys/arch/kbus/dev/am7990.c1096
-rw-r--r--sys/arch/kbus/dev/am7990reg.h179
-rw-r--r--sys/arch/kbus/dev/am7990var.h147
-rw-r--r--sys/arch/kbus/dev/dmavar.h47
-rw-r--r--sys/arch/kbus/dev/if_le.c184
-rw-r--r--sys/arch/kbus/dev/kbus.c110
-rw-r--r--sys/arch/kbus/dev/rd.c193
-rw-r--r--sys/arch/kbus/dev/sbic.c2914
-rw-r--r--sys/arch/kbus/dev/sbic.c.mvme2719
-rw-r--r--sys/arch/kbus/dev/sbicdma.c256
-rw-r--r--sys/arch/kbus/dev/sbicdma.h53
-rw-r--r--sys/arch/kbus/dev/sbicreg.h441
-rw-r--r--sys/arch/kbus/dev/sbicvar.h235
-rw-r--r--sys/arch/kbus/dev/sbicvar.h.mvme210
-rw-r--r--sys/arch/kbus/dev/vme.c321
-rw-r--r--sys/arch/kbus/dev/xd.c2380
-rw-r--r--sys/arch/kbus/dev/xdreg.h424
-rw-r--r--sys/arch/kbus/dev/xdvar.h167
-rw-r--r--sys/arch/kbus/dev/xio.h65
-rw-r--r--sys/arch/kbus/dev/zs.c745
-rw-r--r--sys/arch/kbus/dev/zs_cons.h9
-rw-r--r--sys/arch/kbus/dev/zs_kgdb.c279
-rw-r--r--sys/arch/kbus/fpu/fpu.c396
-rw-r--r--sys/arch/kbus/fpu/fpu_add.c216
-rw-r--r--sys/arch/kbus/fpu/fpu_arith.h96
-rw-r--r--sys/arch/kbus/fpu/fpu_compare.c164
-rw-r--r--sys/arch/kbus/fpu/fpu_div.c267
-rw-r--r--sys/arch/kbus/fpu/fpu_emu.h189
-rw-r--r--sys/arch/kbus/fpu/fpu_explode.c262
-rw-r--r--sys/arch/kbus/fpu/fpu_extern.h76
-rw-r--r--sys/arch/kbus/fpu/fpu_implode.c480
-rw-r--r--sys/arch/kbus/fpu/fpu_mul.c226
-rw-r--r--sys/arch/kbus/fpu/fpu_sqrt.c397
-rw-r--r--sys/arch/kbus/fpu/fpu_subr.c223
-rw-r--r--sys/arch/kbus/include/ansi.h84
-rw-r--r--sys/arch/kbus/include/asi.h61
-rw-r--r--sys/arch/kbus/include/asm.h167
-rw-r--r--sys/arch/kbus/include/autoconf.h73
-rw-r--r--sys/arch/kbus/include/cdefs.h38
-rw-r--r--sys/arch/kbus/include/conf.h67
-rw-r--r--sys/arch/kbus/include/cpu.h275
-rw-r--r--sys/arch/kbus/include/db_machdep.h82
-rw-r--r--sys/arch/kbus/include/disklabel.h46
-rw-r--r--sys/arch/kbus/include/dvma.h68
-rw-r--r--sys/arch/kbus/include/endian.h38
-rw-r--r--sys/arch/kbus/include/exec.h74
-rw-r--r--sys/arch/kbus/include/float.h89
-rw-r--r--sys/arch/kbus/include/frame.h72
-rw-r--r--sys/arch/kbus/include/fsr.h116
-rw-r--r--sys/arch/kbus/include/ieee.h141
-rw-r--r--sys/arch/kbus/include/ieeefp.h23
-rw-r--r--sys/arch/kbus/include/instr.h360
-rw-r--r--sys/arch/kbus/include/ioasic.h39
-rw-r--r--sys/arch/kbus/include/kbus.h96
-rw-r--r--sys/arch/kbus/include/led.h65
-rw-r--r--sys/arch/kbus/include/limits.h92
-rw-r--r--sys/arch/kbus/include/param.h178
-rw-r--r--sys/arch/kbus/include/pcb.h123
-rw-r--r--sys/arch/kbus/include/pmap.h302
-rw-r--r--sys/arch/kbus/include/proc.h54
-rw-r--r--sys/arch/kbus/include/profile.h79
-rw-r--r--sys/arch/kbus/include/prom.h28
-rw-r--r--sys/arch/kbus/include/psl.h208
-rw-r--r--sys/arch/kbus/include/ptrace.h53
-rw-r--r--sys/arch/kbus/include/reg.h126
-rw-r--r--sys/arch/kbus/include/setjmp.h7
-rw-r--r--sys/arch/kbus/include/sic.h48
-rw-r--r--sys/arch/kbus/include/signal.h100
-rw-r--r--sys/arch/kbus/include/stdarg.h106
-rw-r--r--sys/arch/kbus/include/sun_disklabel.h122
-rw-r--r--sys/arch/kbus/include/trap.h141
-rw-r--r--sys/arch/kbus/include/types.h91
-rw-r--r--sys/arch/kbus/include/varargs.h70
-rw-r--r--sys/arch/kbus/include/vmparam.h238
-rw-r--r--sys/arch/kbus/include/z8530var.h82
-rw-r--r--sys/arch/kbus/kbus/autoconf.c443
-rw-r--r--sys/arch/kbus/kbus/clock.c371
-rw-r--r--sys/arch/kbus/kbus/clockreg.h70
-rw-r--r--sys/arch/kbus/kbus/conf.c442
-rw-r--r--sys/arch/kbus/kbus/db_disasm.c1013
-rw-r--r--sys/arch/kbus/kbus/db_interface.c347
-rw-r--r--sys/arch/kbus/kbus/db_trace.c99
-rw-r--r--sys/arch/kbus/kbus/disksubr.c633
-rw-r--r--sys/arch/kbus/kbus/genassym.c158
-rw-r--r--sys/arch/kbus/kbus/in_cksum.c224
-rw-r--r--sys/arch/kbus/kbus/intr.c486
-rw-r--r--sys/arch/kbus/kbus/ldscript30
-rw-r--r--sys/arch/kbus/kbus/locore.s4722
-rw-r--r--sys/arch/kbus/kbus/locore2.c102
-rw-r--r--sys/arch/kbus/kbus/machdep.c1468
-rw-r--r--sys/arch/kbus/kbus/mainbus.c97
-rw-r--r--sys/arch/kbus/kbus/mem.c237
-rw-r--r--sys/arch/kbus/kbus/pmap.c1358
-rw-r--r--sys/arch/kbus/kbus/process_machdep.c142
-rw-r--r--sys/arch/kbus/kbus/sunos_machdep.c55
-rw-r--r--sys/arch/kbus/kbus/swapgeneric.c198
-rw-r--r--sys/arch/kbus/kbus/sys_machdep.c80
-rw-r--r--sys/arch/kbus/kbus/trap.c1005
-rw-r--r--sys/arch/kbus/kbus/umprintf.c125
-rw-r--r--sys/arch/kbus/kbus/vm_machdep.c490
-rw-r--r--sys/arch/kbus/stand/netboot/Makefile61
-rw-r--r--sys/arch/kbus/stand/netboot/boot.c274
-rw-r--r--sys/arch/kbus/stand/netboot/bug.c136
-rw-r--r--sys/arch/kbus/stand/netboot/clock.c121
-rw-r--r--sys/arch/kbus/stand/netboot/clock.h6
-rw-r--r--sys/arch/kbus/stand/netboot/clockreg.h70
-rw-r--r--sys/arch/kbus/stand/netboot/conf.c32
-rw-r--r--sys/arch/kbus/stand/netboot/config.h41
-rw-r--r--sys/arch/kbus/stand/netboot/crt0.S860
-rw-r--r--sys/arch/kbus/stand/netboot/dev_disk.c132
-rw-r--r--sys/arch/kbus/stand/netboot/dev_disk.h6
-rw-r--r--sys/arch/kbus/stand/netboot/dev_net.c231
-rw-r--r--sys/arch/kbus/stand/netboot/dev_net.h6
-rw-r--r--sys/arch/kbus/stand/netboot/devopen.c32
-rw-r--r--sys/arch/kbus/stand/netboot/dvma.c68
-rw-r--r--sys/arch/kbus/stand/netboot/dvma.h6
-rw-r--r--sys/arch/kbus/stand/netboot/exec_sun.c212
-rw-r--r--sys/arch/kbus/stand/netboot/gets.c141
-rw-r--r--sys/arch/kbus/stand/netboot/if_le.c500
-rw-r--r--sys/arch/kbus/stand/netboot/if_lereg.h176
-rw-r--r--sys/arch/kbus/stand/netboot/intr.c103
-rw-r--r--sys/arch/kbus/stand/netboot/panic.c16
-rw-r--r--sys/arch/kbus/stand/netboot/promboot.c95
-rw-r--r--sys/arch/kbus/stand/netboot/promboot.h5
-rw-r--r--sys/arch/kbus/stand/netboot/promcons.c71
-rw-r--r--sys/arch/kbus/stand/netboot/version.c9
-rw-r--r--sys/arch/kbus/stand/netboot/zs.c173
-rw-r--r--sys/arch/kbus/stand/sk/Makefile61
-rw-r--r--sys/arch/kbus/stand/sk/app.c111
-rw-r--r--sys/arch/kbus/stand/sk/boot.c208
-rw-r--r--sys/arch/kbus/stand/sk/clock.c121
-rw-r--r--sys/arch/kbus/stand/sk/clock.h6
-rw-r--r--sys/arch/kbus/stand/sk/clockreg.h70
-rw-r--r--sys/arch/kbus/stand/sk/conf.c32
-rw-r--r--sys/arch/kbus/stand/sk/config.h41
-rw-r--r--sys/arch/kbus/stand/sk/crt0.S860
-rw-r--r--sys/arch/kbus/stand/sk/dev_disk.c132
-rw-r--r--sys/arch/kbus/stand/sk/dev_disk.h6
-rw-r--r--sys/arch/kbus/stand/sk/dev_net.c231
-rw-r--r--sys/arch/kbus/stand/sk/dev_net.h6
-rw-r--r--sys/arch/kbus/stand/sk/devopen.c32
-rw-r--r--sys/arch/kbus/stand/sk/disp-asi.c644
-rw-r--r--sys/arch/kbus/stand/sk/dvma.c68
-rw-r--r--sys/arch/kbus/stand/sk/dvma.h6
-rw-r--r--sys/arch/kbus/stand/sk/eeprom.h6
-rw-r--r--sys/arch/kbus/stand/sk/exec_sun.c212
-rw-r--r--sys/arch/kbus/stand/sk/gets.c141
-rw-r--r--sys/arch/kbus/stand/sk/idprom.h90
-rw-r--r--sys/arch/kbus/stand/sk/if_le.c615
-rw-r--r--sys/arch/kbus/stand/sk/if_lereg.h176
-rw-r--r--sys/arch/kbus/stand/sk/intr.c173
-rw-r--r--sys/arch/kbus/stand/sk/main.c4
-rw-r--r--sys/arch/kbus/stand/sk/panic.c16
-rw-r--r--sys/arch/kbus/stand/sk/probe.c235
-rw-r--r--sys/arch/kbus/stand/sk/prom.h24
-rw-r--r--sys/arch/kbus/stand/sk/promboot.c95
-rw-r--r--sys/arch/kbus/stand/sk/promboot.h5
-rw-r--r--sys/arch/kbus/stand/sk/promcons.c71
-rw-r--r--sys/arch/kbus/stand/sk/version.c9
-rw-r--r--sys/arch/kbus/stand/sk/zs.c218
-rw-r--r--sys/arch/pc532/Makefile32
-rw-r--r--sys/arch/pc532/To.Do34
-rw-r--r--sys/arch/pc532/compile/.cvsignore4
-rw-r--r--sys/arch/pc532/conf/DEFAULT91
-rw-r--r--sys/arch/pc532/conf/INSTALL65
-rw-r--r--sys/arch/pc532/conf/KLONDIKE85
-rw-r--r--sys/arch/pc532/conf/Makefile.pc532156
-rw-r--r--sys/arch/pc532/conf/STEELHEAD86
-rw-r--r--sys/arch/pc532/conf/files.pc53282
-rw-r--r--sys/arch/pc532/dev/aic.c137
-rw-r--r--sys/arch/pc532/dev/device.h65
-rw-r--r--sys/arch/pc532/dev/dp.c1046
-rw-r--r--sys/arch/pc532/dev/dpreg.h128
-rw-r--r--sys/arch/pc532/dev/lpt.c878
-rw-r--r--sys/arch/pc532/dev/lptreg.h75
-rw-r--r--sys/arch/pc532/dev/ncr.c293
-rw-r--r--sys/arch/pc532/dev/ncr5380.c1947
-rw-r--r--sys/arch/pc532/dev/ncr5380reg.h258
-rw-r--r--sys/arch/pc532/dev/ncr_5380.h145
-rw-r--r--sys/arch/pc532/dev/ncr_defs.h57
-rw-r--r--sys/arch/pc532/dev/ncrreg.h63
-rw-r--r--sys/arch/pc532/dev/oldncr.c953
-rw-r--r--sys/arch/pc532/dev/rd.c193
-rw-r--r--sys/arch/pc532/dev/scn.c1127
-rw-r--r--sys/arch/pc532/dev/scnreg.h209
-rw-r--r--sys/arch/pc532/include/ansi.h83
-rw-r--r--sys/arch/pc532/include/asm.h108
-rw-r--r--sys/arch/pc532/include/cdefs.h37
-rw-r--r--sys/arch/pc532/include/cpu.h130
-rw-r--r--sys/arch/pc532/include/cpufunc.h103
-rw-r--r--sys/arch/pc532/include/db_machdep.h129
-rw-r--r--sys/arch/pc532/include/disklabel.h46
-rw-r--r--sys/arch/pc532/include/endian.h60
-rw-r--r--sys/arch/pc532/include/exec.h60
-rw-r--r--sys/arch/pc532/include/float.h80
-rw-r--r--sys/arch/pc532/include/frame.h110
-rw-r--r--sys/arch/pc532/include/icu.h134
-rw-r--r--sys/arch/pc532/include/ieeefp.h19
-rw-r--r--sys/arch/pc532/include/jmpbuf.h53
-rw-r--r--sys/arch/pc532/include/limits.h95
-rw-r--r--sys/arch/pc532/include/mtpr.h3
-rw-r--r--sys/arch/pc532/include/param.h172
-rw-r--r--sys/arch/pc532/include/pcb.h98
-rw-r--r--sys/arch/pc532/include/pmap.h241
-rw-r--r--sys/arch/pc532/include/proc.h48
-rw-r--r--sys/arch/pc532/include/profile.h70
-rw-r--r--sys/arch/pc532/include/psl.h241
-rw-r--r--sys/arch/pc532/include/pte.h97
-rw-r--r--sys/arch/pc532/include/ptrace.h40
-rw-r--r--sys/arch/pc532/include/reg.h96
-rw-r--r--sys/arch/pc532/include/setjmp.h7
-rw-r--r--sys/arch/pc532/include/signal.h68
-rw-r--r--sys/arch/pc532/include/stdarg.h56
-rw-r--r--sys/arch/pc532/include/trap.h91
-rw-r--r--sys/arch/pc532/include/types.h83
-rw-r--r--sys/arch/pc532/include/varargs.h61
-rw-r--r--sys/arch/pc532/include/vmparam.h230
-rw-r--r--sys/arch/pc532/pc532/autoconf.c228
-rw-r--r--sys/arch/pc532/pc532/bcopy.s83
-rw-r--r--sys/arch/pc532/pc532/bzero.s97
-rw-r--r--sys/arch/pc532/pc532/clock.c253
-rw-r--r--sys/arch/pc532/pc532/conf.c259
-rw-r--r--sys/arch/pc532/pc532/db_disasm.c1899
-rw-r--r--sys/arch/pc532/pc532/db_interface.c436
-rw-r--r--sys/arch/pc532/pc532/db_trace.c681
-rw-r--r--sys/arch/pc532/pc532/disksubr.c252
-rw-r--r--sys/arch/pc532/pc532/genassym.c124
-rw-r--r--sys/arch/pc532/pc532/icuinit.c86
-rw-r--r--sys/arch/pc532/pc532/in_cksum.c173
-rw-r--r--sys/arch/pc532/pc532/intr.c239
-rw-r--r--sys/arch/pc532/pc532/locore.s1193
-rw-r--r--sys/arch/pc532/pc532/machdep.c1142
-rw-r--r--sys/arch/pc532/pc532/mem.c294
-rw-r--r--sys/arch/pc532/pc532/ns_cksum.c206
-rw-r--r--sys/arch/pc532/pc532/ntoh.s47
-rw-r--r--sys/arch/pc532/pc532/oc_cksum.s67
-rw-r--r--sys/arch/pc532/pc532/pmap.c1945
-rw-r--r--sys/arch/pc532/pc532/process_machdep.c179
-rw-r--r--sys/arch/pc532/pc532/random.s76
-rw-r--r--sys/arch/pc532/pc532/swapgeneric.c199
-rw-r--r--sys/arch/pc532/pc532/sys_machdep.c41
-rw-r--r--sys/arch/pc532/pc532/trap.c571
-rw-r--r--sys/arch/pc532/pc532/umprintf.c105
-rw-r--r--sys/arch/pc532/pc532/vm_machdep.c351
-rw-r--r--sys/arch/pc532/stand/Makefile98
-rw-r--r--sys/arch/pc532/stand/README26
-rw-r--r--sys/arch/pc532/stand/boot.c280
-rw-r--r--sys/arch/pc532/stand/conf.c59
-rw-r--r--sys/arch/pc532/stand/cons.c93
-rw-r--r--sys/arch/pc532/stand/devopen.c203
-rw-r--r--sys/arch/pc532/stand/filesystem.c40
-rw-r--r--sys/arch/pc532/stand/inflate.c1433
-rw-r--r--sys/arch/pc532/stand/machdep.c98
-rw-r--r--sys/arch/pc532/stand/prf.c79
-rw-r--r--sys/arch/pc532/stand/rd.c29
-rw-r--r--sys/arch/pc532/stand/samachdep.h42
-rw-r--r--sys/arch/pc532/stand/scn.c103
-rw-r--r--sys/arch/pc532/stand/scsi_hi.c303
-rw-r--r--sys/arch/pc532/stand/scsi_low.c426
-rw-r--r--sys/arch/pc532/stand/sd.c196
-rw-r--r--sys/arch/pc532/stand/so.h67
-rw-r--r--sys/arch/pc532/stand/srt0.s91
-rw-r--r--sys/arch/pc532/stand/test.c191
-rw-r--r--sys/arch/pc532/stand/tgets.c89
-rw-r--r--sys/arch/wgrisc/Makefile30
-rw-r--r--sys/arch/wgrisc/compile/.cvsignore1
-rw-r--r--sys/arch/wgrisc/conf/DISKLESS77
-rw-r--r--sys/arch/wgrisc/conf/GENERIC129
-rw-r--r--sys/arch/wgrisc/conf/Makefile.wgrisc181
-rw-r--r--sys/arch/wgrisc/conf/files.wgrisc111
-rw-r--r--sys/arch/wgrisc/conf/ld.script74
-rw-r--r--sys/arch/wgrisc/dev/asc.c2101
-rw-r--r--sys/arch/wgrisc/dev/ascreg.h326
-rw-r--r--sys/arch/wgrisc/dev/com_risc.c201
-rw-r--r--sys/arch/wgrisc/dev/dma.h166
-rw-r--r--sys/arch/wgrisc/dev/flash.c852
-rw-r--r--sys/arch/wgrisc/dev/flashreg.h112
-rw-r--r--sys/arch/wgrisc/dev/if_sn.c1281
-rw-r--r--sys/arch/wgrisc/dev/if_sn.h347
-rw-r--r--sys/arch/wgrisc/dev/scsi.h559
-rw-r--r--sys/arch/wgrisc/include/ansi.h84
-rw-r--r--sys/arch/wgrisc/include/asm.h200
-rw-r--r--sys/arch/wgrisc/include/autoconf.h79
-rw-r--r--sys/arch/wgrisc/include/bus.h147
-rw-r--r--sys/arch/wgrisc/include/cdefs.h39
-rw-r--r--sys/arch/wgrisc/include/cpu.h417
-rw-r--r--sys/arch/wgrisc/include/disklabel.h86
-rw-r--r--sys/arch/wgrisc/include/dlfcn.h42
-rw-r--r--sys/arch/wgrisc/include/ecoff.h94
-rw-r--r--sys/arch/wgrisc/include/elf_abi.h58
-rw-r--r--sys/arch/wgrisc/include/endian.h38
-rw-r--r--sys/arch/wgrisc/include/exec.h64
-rw-r--r--sys/arch/wgrisc/include/float.h81
-rw-r--r--sys/arch/wgrisc/include/frame.h0
-rw-r--r--sys/arch/wgrisc/include/ieeefp.h25
-rw-r--r--sys/arch/wgrisc/include/intr.h165
-rw-r--r--sys/arch/wgrisc/include/kbdreg.h82
-rw-r--r--sys/arch/wgrisc/include/kcore.h45
-rw-r--r--sys/arch/wgrisc/include/kdbparam.h75
-rw-r--r--sys/arch/wgrisc/include/limits.h112
-rw-r--r--sys/arch/wgrisc/include/link.h125
-rw-r--r--sys/arch/wgrisc/include/memconf.h50
-rw-r--r--sys/arch/wgrisc/include/mips_opcode.h260
-rw-r--r--sys/arch/wgrisc/include/param.h167
-rw-r--r--sys/arch/wgrisc/include/pcb.h61
-rw-r--r--sys/arch/wgrisc/include/pio.h46
-rw-r--r--sys/arch/wgrisc/include/pmap.h109
-rw-r--r--sys/arch/wgrisc/include/proc.h54
-rw-r--r--sys/arch/wgrisc/include/profile.h81
-rw-r--r--sys/arch/wgrisc/include/psl.h61
-rw-r--r--sys/arch/wgrisc/include/pte.h176
-rw-r--r--sys/arch/wgrisc/include/ptrace.h45
-rw-r--r--sys/arch/wgrisc/include/reg.h62
-rw-r--r--sys/arch/wgrisc/include/regdef.h74
-rw-r--r--sys/arch/wgrisc/include/regnum.h136
-rw-r--r--sys/arch/wgrisc/include/reloc.h38
-rw-r--r--sys/arch/wgrisc/include/setjmp.h8
-rw-r--r--sys/arch/wgrisc/include/signal.h68
-rw-r--r--sys/arch/wgrisc/include/stdarg.h65
-rw-r--r--sys/arch/wgrisc/include/trap.h68
-rw-r--r--sys/arch/wgrisc/include/types.h87
-rw-r--r--sys/arch/wgrisc/include/varargs.h69
-rw-r--r--sys/arch/wgrisc/include/vmparam.h229
-rw-r--r--sys/arch/wgrisc/isa/isa_machdep.h86
-rw-r--r--sys/arch/wgrisc/isa/isabus.c350
-rw-r--r--sys/arch/wgrisc/riscbus/riscbus.c320
-rw-r--r--sys/arch/wgrisc/riscbus/riscbus.h120
-rw-r--r--sys/arch/wgrisc/stand/Makefile77
-rw-r--r--sys/arch/wgrisc/stand/Makefile.inc21
-rw-r--r--sys/arch/wgrisc/stand/boot/Makefile31
-rw-r--r--sys/arch/wgrisc/stand/boot/boot.c133
-rw-r--r--sys/arch/wgrisc/stand/boot/conf.c58
-rw-r--r--sys/arch/wgrisc/stand/boot/filesystem.c44
-rw-r--r--sys/arch/wgrisc/stand/boot/fl.c102
-rw-r--r--sys/arch/wgrisc/stand/boot/ld.script74
-rw-r--r--sys/arch/wgrisc/stand/boot/sd.c175
-rw-r--r--sys/arch/wgrisc/stand/boot/start.S238
-rw-r--r--sys/arch/wgrisc/stand/libsa/Makefile26
-rw-r--r--sys/arch/wgrisc/stand/libsa/devopen.c100
-rw-r--r--sys/arch/wgrisc/stand/libsa/getenv.c39
-rw-r--r--sys/arch/wgrisc/stand/libsa/gets.c68
-rw-r--r--sys/arch/wgrisc/stand/libsa/ufs.c762
-rw-r--r--sys/arch/wgrisc/wgrisc/autoconf.c476
-rw-r--r--sys/arch/wgrisc/wgrisc/clock.c327
-rw-r--r--sys/arch/wgrisc/wgrisc/clock_dp.c290
-rw-r--r--sys/arch/wgrisc/wgrisc/clockvar.h82
-rw-r--r--sys/arch/wgrisc/wgrisc/conf.c341
-rw-r--r--sys/arch/wgrisc/wgrisc/cpu.c192
-rw-r--r--sys/arch/wgrisc/wgrisc/cpu_exec.c104
-rw-r--r--sys/arch/wgrisc/wgrisc/disksubr.c538
-rw-r--r--sys/arch/wgrisc/wgrisc/fp.S3611
-rw-r--r--sys/arch/wgrisc/wgrisc/genassym.c74
-rw-r--r--sys/arch/wgrisc/wgrisc/locore.S4566
-rw-r--r--sys/arch/wgrisc/wgrisc/machdep.c1092
-rw-r--r--sys/arch/wgrisc/wgrisc/mainbus.c160
-rw-r--r--sys/arch/wgrisc/wgrisc/mem.c197
-rw-r--r--sys/arch/wgrisc/wgrisc/minidebug.c975
-rw-r--r--sys/arch/wgrisc/wgrisc/pmap.c1825
-rw-r--r--sys/arch/wgrisc/wgrisc/process_machdep.c114
-rw-r--r--sys/arch/wgrisc/wgrisc/swapgeneric.c61
-rw-r--r--sys/arch/wgrisc/wgrisc/sys_machdep.c74
-rw-r--r--sys/arch/wgrisc/wgrisc/trap.c1672
-rw-r--r--sys/arch/wgrisc/wgrisc/vm_machdep.c505
-rw-r--r--sys/arch/wgrisc/wgrisc/wgrisctype.h38
833 files changed, 0 insertions, 240188 deletions
diff --git a/sys/arch/arc/Makefile b/sys/arch/arc/Makefile
deleted file mode 100644
index 6bf5aeaf816..00000000000
--- a/sys/arch/arc/Makefile
+++ /dev/null
@@ -1,35 +0,0 @@
-# $OpenBSD: Makefile,v 1.6 2000/03/03 00:54:45 todd Exp $
-# from: @(#)Makefile 8.1 (Berkeley) 6/16/93
-
-# Makefile for arc links, tags file
-
-.include "../../kern/Make.tags.inc"
-
-SUBDIR= stand
-
-NOPROG= noprog
-NOOBJ= noman
-
-TARC= ../arc/tags
-SARC= ../arc/arc/*.[ch] ../arc/dev/*.[ch] ../arc/dti/*.[ch] \
- ../arc/include/*.h ../arc/isa/*.[ch] ../arc/pci/*.[ch] \
- ../arc/pica/*.[ch]
-AARC= ../arc/arc/*.S
-
-DARC= arc dev dti include isa pci pica
-
-tags:
- -ctags -wdtf ${TARC} ${COMM} ${SARC}
- egrep "^LEAF(.*)|^[AN]LEAF(.*)|^NON_LEAF(.*)" ${AARC} | \
- sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
- >> ${TARC}
- sort -o ${TARC} ${TARC}
-
-links:
- -for i in ${DARC}; do \
- cd $$i && rm -f tags; ln -s ../tags tags; done
-
-
-obj: _SUBDIRUSE
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/arc/TODO b/sys/arch/arc/TODO
deleted file mode 100644
index 2ccac3a01b5..00000000000
--- a/sys/arch/arc/TODO
+++ /dev/null
@@ -1,20 +0,0 @@
-To do list (not in any particular order).
-
- o Improve pmap_zero_page and pmap_copy_page. Speed and flushing.
-
- o Move the RO and WIRED attribute from the pte to the pv table.
- This saves four instructions in the tlb miss handler.
-InWork: Have a test version. The system hangs after a while. Not solved yet.
- Also, is it worth the effort to remove 4 instr. in TLB-miss handler?
-
- o Boot. Standalone boot program instead of booting the kernel directly?
-
- o Find out why bitmap load to S3-928 flashes screen. (X server)
-Know why (enable linear mode). Need S3 info.
-
- o Can we have 32 double registers?
-
- o New dynamic loader...
-
-
-Lots of other things.....
diff --git a/sys/arch/arc/algor/algor.h b/sys/arch/arc/algor/algor.h
deleted file mode 100644
index 31e6f896824..00000000000
--- a/sys/arch/arc/algor/algor.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/* $OpenBSD: algor.h,v 1.4 1998/03/16 09:38:23 pefo Exp $ */
-
-/*
- * Copyright (c) 1996 Per Fogelstrom
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#ifndef _ALGOR_H_
-#define _ALGOR_H_ 1
-
-/*
- * Physical address space
- */
-
-#define P4032_PHYS_MIN 0x00000000 /* 256 Meg */
-#define P4032_PHYS_MAX 0x0fffffff
-
-#define P5064_PHYS_MIN 0x00000000 /* 256 Meg */
-#define P5064_PHYS_MAX 0x0fffffff
-
-/*
- * Memory map
- */
-
-#define P4032_PHYS_MEMORY_START 0x00000000
-#define P4032_PHYS_MEMORY_END 0x0fffffff /* 256 Meg in 2 slots */
-
-#define P5064_PHYS_MEMORY_START 0x00000000
-#define P5064_PHYS_MEMORY_END 0x0fffffff /* 256 Meg in 2 slots */
-
-/*
- * I/O map P-4032
- */
-
-#define P4032_V96x 0xbef00000 /* PCI Bus bridge ctrlregs */
-
-#define P4032_CLOCK 0xbff00000 /* RTC clock ptr reg */
-#define P4032_KEYB 0xbff10000 /* PC Keyboard controller */
-#define P4032_LED 0xbff20010 /* 4 Char LED display */
-#define P4032_LCD 0xbff30000 /* LCD option display */
-#define P4032_GPIO 0xbff40000 /* General purpose I/O */
-#define P4032_GPIO_IACK 0xbff50000 /* General purpose I/O Iack */
-#define P4032_FPY 0xbff807c0 /* Floppy controller */
-#define P4032_COM1 0xbff80fe0 /* Serial port com1 */
-#define P4032_COM2 0xbff80be0 /* Serial port com2 */
-#define P4032_CENTR 0xbff80de0 /* Centronics paralell port */
-#define P4032_IMR 0xbff90000 /* Int mask reg (wr) */
-#define P4032_IRR 0xbff90000 /* Int request reg (rd) */
-#define P4032_EIRR 0xbff90004 /* Error int request reg (rd) */
-#define P4032_ICR 0xbff90004 /* Int clear register (wr) */
-#define P4032_PCIIMR 0xbff90008 /* PCI Int mask reg (wr) */
-#define P4032_PCIIRR 0xbff90008 /* PCI Int req reg (rd) */
-#define P4032_IXR0 0xbff9000c /* Int crossbar register 0 */
-#define P4032_IXR1 0xbff90010 /* Int crossbar register 0 */
-#define P4032_IXR2 0xbff90014 /* Int crossbar register 0 */
-
-/*
- * I/O map P-5064
- */
-
-#define P5064_V96x P4032_V96x /* PCI Bus bridge ctrlregs */
-
-#define P5064_CLOCK 0xbd000070 /* RTC clock ptr reg, data +1 */
-#define P5064_KEYB 0xbd000064 /* PC Keyboard controller */
-#define P5064_LED P4032_LED /* 4 Char LED display */
-#define P5064_LCD P4032_LCD /* LCD option display */
-#define P5064_GPIO P4032_GPIO /* General purpose I/O */
-#define P5064_GPIO_IACK P4032_GPIO_IACK /* General purpose I/O Iack */
-#define P5064_FPY 0xbd0003f0 /* Floppy controller */
-#define P5064_COM1 0xbd0003f8 /* Serial port com1 */
-#define P5064_COM2 0xbd0002f8 /* Serial port com2 */
-#define P5064_CENTR 0xbd000378 /* Centronics paralell port */
-#define P5064_IMR 0xbff90000 /* Int mask reg (wr) */
-#define P5064_IRR 0xbff90000 /* Int request reg (rd) */
-#define P5064_EIRR 0xbff90004 /* Error int request reg (rd) */
-#define P5064_ICR 0xbff90004 /* Int clear register (wr) */
-#define P5064_PCIIMR 0xbff90008 /* PCI Int mask reg (wr) */
-#define P5064_PCIIRR 0xbff90008 /* PCI Int req reg (rd) */
-#define P5064_IDEIMR 0xbff9000c /* IDE Int req reg (rd) */
-#define P5064_IDEIRR 0xbff9000c /* IDE Int req reg (rd) */
-#define P5064_IXR0 0xbff90010 /* Int crossbar register 0 */
-#define P5064_IXR1 0xbff90014 /* Int crossbar register 1 */
-#define P5064_IXR2 0xbff90018 /* Int crossbar register 2 */
-#define P5064_IXR3 0xbff9001c /* Int crossbar register 3 */
-#define P5064_IXR4 0xbff90020 /* Int crossbar register 4 */
-
-/*
- * Interrupt controller interrupt masks
- */
-
-#define P4032_IM_RTC 0x80 /* RT Clock */
-#define P4032_IM_GPIO 0x40 /* General purpose I/O */
-#define P4032_IM_CENTR 0x20 /* Centronics paralell port */
-#define P4032_IM_COM2 0x10 /* Serial port 2 */
-#define P4032_IM_COM1 0x08 /* Serial port 1 */
-#define P4032_IM_KEYB 0x04 /* PC Keyboard IFC */
-#define P4032_IM_FPY 0x02 /* Floppy disk */
-#define P4032_IM_PCI 0x01 /* PCI controller */
-
-#define P4032_IRR_BER 0x04 /* Bus error */
-#define P4032_IRR_PFAIL 0x02 /* Power fail */
-#define P4032_IRR_DBG 0x01 /* Debug switch */
-
-#define P4032_PCI_IRQ3 0x80 /* PCI interrupt request 3 */
-#define P4032_PCI_IRQ2 0x40 /* PCI interrupt request 2 */
-#define P4032_PCI_IRQ1 0x20 /* PCI interrupt request 1 */
-#define P4032_PCI_IRQ0 0x10 /* PCI interrupt request 0 */
-#define P4032_FPY_DMA 0x08 /* FPY "DMA" interrupt request */
-/*
- * Interrupt vector descriptor for device on pica bus.
- */
-struct algor_int_desc {
- int int_mask; /* Mask used in PICA_SYS_LB_IE */
- intr_handler_t int_hand; /* Interrupt handler */
- void *param; /* Parameter to send to handler */
- int spl_mask; /* Spl mask for interrupt */
-};
-
-int algor_intrnull __P((void *));
-void *algor_pci_intr_establish __P((int, int, intr_handler_t, void *, void *));
-void algor_pci_intr_disestablish __P((void *));
-
-
-#endif /* _ALGOR_H_ */
diff --git a/sys/arch/arc/algor/algorbus.c b/sys/arch/arc/algor/algorbus.c
deleted file mode 100644
index bcf53ac9323..00000000000
--- a/sys/arch/arc/algor/algorbus.c
+++ /dev/null
@@ -1,485 +0,0 @@
-/* $OpenBSD: algorbus.c,v 1.6 1999/01/11 05:11:09 millert Exp $ */
-
-/*
- * Copyright (c) 1996, 1997, 1998 Per Fogelstrom, Opsycon AB
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom, Opsycon AB.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/device.h>
-
-#include <machine/pte.h>
-#include <machine/cpu.h>
-#include <machine/pio.h>
-#include <machine/intr.h>
-#include <machine/autoconf.h>
-
-#include <mips/archtype.h>
-#include <arc/algor/algor.h>
-
-#include <dev/ic/mc146818reg.h>
-
-struct algor_softc {
- struct device sc_dv;
- struct abus sc_bus;
- struct algor_dev *sc_devs;
-};
-
-/* Definition of the driver for autoconfig. */
-int algormatch(struct device *, void *, void *);
-void algorattach(struct device *, struct device *, void *);
-int algorprint(void *, const char *);
-
-struct cfattach algor_ca = {
- sizeof(struct algor_softc), algormatch, algorattach
-};
-struct cfdriver algor_cd = {
- NULL, "algor", DV_DULL, NULL, 0
-};
-
-void algor_intr_establish __P((struct confargs *, int (*)(void *), void *));
-void algor_intr_disestablish __P((struct confargs *));
-caddr_t algor_cvtaddr __P((struct confargs *));
-int algor_matchname __P((struct confargs *, char *));
-int algor_iointr __P((unsigned, struct clockframe *));
-int algor_clkintr __P((unsigned, struct clockframe *));
-int algor_errintr __P((unsigned, struct clockframe *));
-
-int p4032_imask = 0;
-int p4032_ixr0 = 0; /* Routing for local and panic ints. */
-int p4032_ixr1 = 0; /* Routing for pci and ide ints. */
-
-/*
- * Interrupt dispatch table.
- */
-static struct algor_int_desc int_table[] = {
- {0, algor_intrnull, (void *)NULL, 0 }, /* 0 */
- {0, algor_intrnull, (void *)NULL, 0 }, /* 1 */
- {0, algor_intrnull, (void *)NULL, 0 }, /* 2 */
- {0, algor_intrnull, (void *)NULL, 0 }, /* 3 */
- {0, algor_intrnull, (void *)NULL, 0 }, /* 4 */
- {0, algor_intrnull, (void *)NULL, 0 }, /* 5 */
- {0, algor_intrnull, (void *)NULL, 0 }, /* 6 */
- {0, algor_intrnull, (void *)NULL, 0 }, /* 7 */
- {0, algor_intrnull, (void *)NULL, 0 }, /* 8 */
- {0, algor_intrnull, (void *)NULL, 0 }, /* 9 */
- {0, algor_intrnull, (void *)NULL, 0 }, /* 10 */
- {0, algor_intrnull, (void *)NULL, 0 }, /* 11 */
- {0, algor_intrnull, (void *)NULL, 0 }, /* 12 */
- {0, algor_intrnull, (void *)NULL, 0 }, /* 13 */
- {0, algor_intrnull, (void *)NULL, 0 }, /* 14 */
- {0, algor_intrnull, (void *)NULL, 0 }, /* 15 */
- {0, algor_intrnull, (void *)NULL, 0 }, /* 16 */
- {0, algor_intrnull, (void *)NULL, 0 }, /* 17 */
- {0, algor_intrnull, (void *)NULL, 0 }, /* 18 */
- {0, algor_intrnull, (void *)NULL, 0 }, /* 19 */
-};
-#define NUM_INT_SLOTS (sizeof(int_table) / sizeof(struct algor_int_desc))
-
-struct algor_dev {
- struct confargs ps_ca;
- u_int8_t ps_mask; /* Interrupt mask register value */
- u_int8_t ps_ipl; /* IPL to route int to */
- u_int16_t ps_route; /* int routing mask bits */
- intr_handler_t ps_handler;
- void *ps_base;
-};
-struct algor_dev algor_4032_cpu[] = {
- {{ "dallas_rtc", 0, 0, },
- P4032_IM_RTC, IPL_CLOCK, 0xc000, algor_intrnull, (void *)P4032_CLOCK, },
- {{ "com", 1, 0, },
- P4032_IM_COM1, IPL_TTY, 0x00c0, algor_intrnull, (void *)P4032_COM1, },
- {{ "com", 2, 0, },
- P4032_IM_COM2, IPL_TTY, 0x0300, algor_intrnull, (void *)P4032_COM2, },
- {{ "lpt", 3, 0, },
- P4032_IM_CENTR,IPL_TTY, 0x0c00, algor_intrnull, (void *)P4032_CENTR, },
- {{ NULL, -1, NULL, },
- 0, 0x0000, NULL, (void *)NULL, },
-};
-
-struct algor_dev algor_5064_cpu[] = {
- {{ "dallas_rtc", 0, 0, },
- P4032_IM_RTC, IPL_CLOCK, 0xc000, algor_intrnull, (void *)P5064_CLOCK, },
- {{ "com", 1, 0, },
- P4032_IM_COM1, IPL_TTY, 0x00c0, algor_intrnull, (void *)P5064_COM1, },
- {{ "com", 2, 0, },
- P4032_IM_COM2, IPL_TTY, 0x0300, algor_intrnull, (void *)P5064_COM2, },
- {{ "lpt", 3, 0, },
- P4032_IM_CENTR,IPL_TTY, 0x0c00, algor_intrnull, (void *)P5064_CENTR, },
- {{ NULL, -1, NULL, },
- 0, 0x0000, NULL, (void *)NULL, },
-};
-
-/* IPL routing values */
-static int ipxrtab[] = {
- 0x00000000, /* IPL_BIO */
- 0x55555555, /* IPL_NET */
- 0xaaaaaaaa, /* IPL_TTY */
- 0xffffffff, /* IPL_CLOCK */
-};
-
-
-
-struct algor_dev *algor_cpu_devs[] = {
- NULL, /* Unused */
- algor_4032_cpu, /* 0x21 = ALGORITHMICS P-4032 board */
- algor_5064_cpu, /* 0x22 = ALGORITHMICS P-5064 board */
-};
-int nalgor_cpu_devs = sizeof algor_cpu_devs / sizeof algor_cpu_devs[0];
-
-int
-algormatch(parent, cfdata, aux)
- struct device *parent;
- void *cfdata;
- void *aux;
-{
- struct cfdata *cf = cfdata;
- struct confargs *ca = aux;
-
- /* Make sure that we're looking for a ALGORITHMICS BUS */
- if (strcmp(ca->ca_name, algor_cd.cd_name) != 0)
- return (0);
-
- /* Make sure that unit exists. */
- if (cf->cf_unit != 0 || (system_type - ALGOR_CLASS) > nalgor_cpu_devs
- || algor_cpu_devs[system_type - ALGOR_CLASS] == NULL)
- return (0);
-
- return (1);
-}
-
-void
-algorattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct algor_softc *sc = (struct algor_softc *)self;
- struct confargs *nca;
- int i;
-
- printf("\n");
-
- /* keep our CPU device description handy */
- sc->sc_devs = algor_cpu_devs[system_type - ALGOR_CLASS];
-
- /* set up interrupt handlers */
- set_intr(INT_MASK_1, algor_iointr, 3);
- set_intr(INT_MASK_4, algor_errintr, 0);
-
- sc->sc_bus.ab_dv = (struct device *)sc;
- sc->sc_bus.ab_type = BUS_ALGOR;
- sc->sc_bus.ab_intr_establish = algor_intr_establish;
- sc->sc_bus.ab_intr_disestablish = algor_intr_disestablish;
- sc->sc_bus.ab_cvtaddr = algor_cvtaddr;
- sc->sc_bus.ab_matchname = algor_matchname;
-
- /* Try to configure each ALGOR attached device */
- for (i = 0; sc->sc_devs[i].ps_ca.ca_slot >= 0; i++) {
-
- if(sc->sc_devs[i].ps_ca.ca_name == NULL)
- continue; /* Empty slot */
-
- nca = &sc->sc_devs[i].ps_ca;
- nca->ca_bus = &sc->sc_bus;
-
- /* Tell the autoconfig machinery we've found the hardware. */
- config_found(self, nca, algorprint);
- }
-}
-
-int
-algorprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
- struct confargs *ca = aux;
-
- if (pnp)
- printf("%s at %s", ca->ca_name, pnp);
- printf(" slot %ld offset 0x%lx", ca->ca_slot, ca->ca_offset);
- return (UNCONF);
-}
-
-caddr_t
-algor_cvtaddr(ca)
- struct confargs *ca;
-{
- struct algor_softc *sc = algor_cd.cd_devs[0];
-
- return(sc->sc_devs[ca->ca_slot].ps_base + ca->ca_offset);
-
-}
-
-void
-algor_intr_establish(ca, handler, arg)
- struct confargs *ca;
- intr_handler_t handler;
- void *arg;
-{
- struct algor_softc *sc = algor_cd.cd_devs[0];
- int slot = ca->ca_slot;
- struct algor_dev *dev = &sc->sc_devs[slot];
- int ipl = dev->ps_ipl;
-
- if(int_table[slot].int_mask != 0) {
- panic("algor intr already set");
- }
- else {
- int_table[slot].int_mask = dev->ps_mask;
- int_table[slot].int_hand = handler;
- int_table[slot].param = arg;
- }
- p4032_ixr0 |= ipxrtab[ipl] & dev->ps_route;
- switch(system_type) {
- case ALGOR_P4032:
- outb(P4032_IXR0, p4032_ixr0);
- outb(P4032_IXR1, p4032_ixr0 >> 8);
- break;
- case ALGOR_P5064:
- outb(P5064_IXR0, p4032_ixr0);
- outb(P5064_IXR1, p4032_ixr0 >> 8);
- break;
- }
-
- if(slot == 0) { /* Slot 0 is special, clock */
- set_intr(INT_MASK_0 << ipl, algor_clkintr, ipl + 2);
- }
- else {
- set_intr(INT_MASK_0 << ipl, algor_iointr, ipl + 2);
- }
-
- p4032_imask |= dev->ps_mask;
- outb(P4032_IMR, p4032_imask);
-}
-
-void *
-algor_pci_intr_establish(ih, level, handler, arg, name)
- int ih;
- int level;
- intr_handler_t handler;
- void *arg;
- void *name;
-{
- int imask;
- int route;
- int slot;
-
- if(level < IPL_BIO || level >= IPL_CLOCK) {
- panic("pci intr: ipl level out of range");
- }
- if(ih < 0 || ih >= 12 || ih == 7 || ih == 8) {
- panic("pci intr: irq out of range");
- }
-
- switch(system_type) {
- case ALGOR_P4032:
- imask = (0x00001000 << ih);
- route = (0x3 << (ih+ih));
- break;
- case ALGOR_P5064:
- if(ih > 8) {
- imask = (0x00000100 << (ih - 8));
- }
- else {
- imask = (0x00001000 << ih);
- }
- route = (0x3 << (ih+ih));
- break;
- }
-
- slot = NUM_INT_SLOTS;
- while(slot > 0) {
- if(int_table[slot].int_mask == 0)
- break;
- slot--;
- }
- if(slot < 0) {
- panic("pci intr: out of int slots");
- }
-
- int_table[slot].int_mask = imask;
- int_table[slot].int_hand = handler;
- int_table[slot].param = arg;
-
- p4032_ixr1 |= ipxrtab[level] & route;
- switch(system_type) {
- case ALGOR_P4032:
- outb(P4032_IXR2, p4032_ixr1);
- break;
- case ALGOR_P5064:
- outb(P5064_IXR2, p4032_ixr1);
- outb(P5064_IXR3, p4032_ixr1 >> 8);
- outb(P5064_IXR4, p4032_ixr1 >> 16);
- break;
- }
-
- set_intr(INT_MASK_0 << level, algor_iointr, level + 2);
-
- p4032_imask |= imask;
- outb(P4032_IMR, p4032_imask);
- outb(P4032_PCIIMR, p4032_imask >> 8);
-
- return((void *)slot);
-}
-
-void
-algor_intr_disestablish(ca)
- struct confargs *ca;
-{
- int slot;
-
- slot = ca->ca_slot;
- p4032_imask &= ~int_table[slot].int_mask;
- outb(P4032_IMR, p4032_imask);
- outb(P4032_PCIIMR, p4032_imask >> 8);
-
- if(slot != 0) { /* Slot 0 is special, clock */
- int_table[slot].int_mask = 0;
- int_table[slot].int_hand = algor_intrnull;
- int_table[slot].param = (void *)NULL;
- }
-}
-
-void
-algor_pci_intr_disestablish(cookie)
- void *cookie;
-{
- int slot = (int)cookie;
-
- p4032_imask &= ~int_table[slot].int_mask;
- outb(P4032_IMR, p4032_imask);
- outb(P4032_PCIIMR, p4032_imask >> 8);
-
- int_table[slot].int_mask = 0;
- int_table[slot].int_hand = algor_intrnull;
- int_table[slot].param = (void *)NULL;
-}
-
-int
-algor_matchname(ca, name)
- struct confargs *ca;
- char *name;
-{
- return (strcmp(name, ca->ca_name) == 0);
-}
-
-int
-algor_intrnull(val)
- void *val;
-{
- panic("uncaught ALGOR intr for slot %d", val);
-}
-
-/*
- * Handle algor i/o interrupt.
- */
-int
-algor_iointr(mask, cf)
- unsigned mask;
- struct clockframe *cf;
-{
- int i;
- int pend;
-
- pend = inb(P4032_IRR);
- pend |= inb(P4032_PCIIRR) << 8;
- pend &= p4032_imask;
-
- for(i = 0; i < NUM_INT_SLOTS; i++) {
- if(pend & int_table[i].int_mask)
- (*int_table[i].int_hand)(int_table[i].param);
- }
- outb(P4032_ICR, pend & P4032_IM_CENTR); /* Ack any centronics int */
- return(~0); /* Dont reenable */
-}
-
-/*
- * Handle algor interval clock interrupt.
- */
-int
-algor_clkintr(mask, cf)
- unsigned mask;
- struct clockframe *cf;
-{
- /* Ack clock interrupt */
- if(system_type == ALGOR_P4032) {
- outb(P4032_CLOCK, MC_REGC);
- (void) inb(P4032_CLOCK + 4);
- }
- else {
- outb(P5064_CLOCK, MC_REGC);
- (void) inb(P5064_CLOCK + 1);
- }
-
- hardclock(cf);
-
- /* Re-enable clock interrupts */
- splx(INT_MASK_0 << IPL_CLOCK | SR_INT_ENAB);
-
- return(~(INT_MASK_0 << IPL_CLOCK)); /* Keep clock interrupts enabled */
-}
-
-/*
- * Handle algor error interrupt.
- */
-int
-algor_errintr(mask, cf)
- unsigned mask;
- struct clockframe *cf;
-{
- int why;
-
- why = inb(P4032_EIRR);
-
- if(why & P4032_IRR_BER) {
- printf("Bus error interrupt\n");
- outb(P4032_ICR, P4032_IRR_BER);
-#ifdef DDB
- Debugger();
-#endif
- }
- if(why & P4032_IRR_PFAIL) {
- printf("Power failure!\n");
- }
- if(why & P4032_IRR_DBG) {
- printf("Debug switch\n");
-#ifdef DDB
- Debugger();
-#else
- printf("Sorry, recompile kernel with DDB!\n");
-#endif
- outb(P4032_ICR, P4032_IRR_DBG);
- }
- return(~0);
-}
diff --git a/sys/arch/arc/arc/autoconf.c b/sys/arch/arc/arc/autoconf.c
deleted file mode 100644
index 2ce1d6fe692..00000000000
--- a/sys/arch/arc/arc/autoconf.c
+++ /dev/null
@@ -1,495 +0,0 @@
-/* $OpenBSD: autoconf.c,v 1.9 1997/05/18 13:45:20 pefo Exp $ */
-/*
- * Copyright (c) 1996 Per Fogelstrom
- * Copyright (c) 1995 Theo de Raadt
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: autoconf.c 1.31 91/01/21
- *
- * from: @(#)autoconf.c 8.1 (Berkeley) 6/10/93
- * $Id: autoconf.c,v 1.9 1997/05/18 13:45:20 pefo Exp $
- */
-
-/*
- * Setup the system to run on the current machine.
- *
- * Configure() is called at boot time. Available
- * devices are determined (from possibilities mentioned in ioconf.c),
- * and the drivers are initialized.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/disklabel.h>
-#include <sys/conf.h>
-#include <sys/reboot.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-
-struct device *parsedisk __P((char *, int, int, dev_t *));
-void setroot __P((void));
-void configure __P((void));
-void swapconf __P((void));
-extern void dumpconf __P((void));
-static int findblkmajor __P((struct device *));
-static struct device * getdisk __P((char *, int, int, dev_t *));
-struct device * getdevunit __P((char *, int));
-void makebootdev __P((char *cp));
-int getpno __P((char **));
-
-/*
- * The following several variables are related to
- * the configuration process, and are used in initializing
- * the machine.
- */
-int cold = 1; /* if 1, still working on cold-start */
-int cpuspeed = 150; /* approx # instr per usec. */
-char bootdev[16]; /* to hold boot dev name */
-struct device *bootdv = NULL;
-
-/*
- * Configure all devices found that we know about.
- * This is done at boot time.
- */
-void
-configure()
-{
- (void)splhigh(); /* To be really sure.. */
- if(config_rootfound("mainbus", "mainbus") == 0)
- panic("no mainbus found");
- (void)spl0();
-
- setroot();
- swapconf();
- cold = 0;
-}
-
-/*
- * Configure swap space and related parameters.
- */
-void
-swapconf()
-{
- register struct swdevt *swp;
- register int nblks;
-
- for (swp = swdevt; swp->sw_dev != NODEV; swp++) {
- if (bdevsw[major(swp->sw_dev)].d_psize) {
- nblks =
- (*bdevsw[major(swp->sw_dev)].d_psize)(swp->sw_dev);
- if (nblks != -1 &&
- (swp->sw_nblks == 0 || swp->sw_nblks > nblks))
- swp->sw_nblks = nblks;
- swp->sw_nblks = ctod(dtoc(swp->sw_nblks));
- }
- }
- dumpconf();
-}
-
-/*
- * the rest of this file was influenced/copied from Theo de Raadt's
- * code in the sparc port to nuke the "options GENERIC" stuff.
- */
-
-static struct nam2blk {
- char *name;
- int maj;
-} nam2blk[] = {
- { "sd", 0 }, /* 0 = sd */
- { "wd", 4 }, /* 4 = wd */
- { "fd", 7 }, /* 7 = floppy (ick!)*/
-};
-
-static int
-findblkmajor(dv)
- struct device *dv;
-{
- char *name = dv->dv_xname;
- register int i;
-
- for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); ++i)
- if (strncmp(name, nam2blk[i].name, strlen(nam2blk[0].name)) == 0)
- return (nam2blk[i].maj);
- return (-1);
-}
-
-static struct device *
-getdisk(str, len, defpart, devp)
- char *str;
- int len, defpart;
- dev_t *devp;
-{
- register struct device *dv;
-
- if ((dv = parsedisk(str, len, defpart, devp)) == NULL) {
- printf("use one of:");
- for (dv = alldevs.tqh_first; dv != NULL;
- dv = dv->dv_list.tqe_next) {
- if (dv->dv_class == DV_DISK)
- printf(" %s[a-h]", dv->dv_xname);
-#ifdef NFSCLIENT
- if (dv->dv_class == DV_IFNET)
- printf(" %s", dv->dv_xname);
-#endif
- }
- printf("\n");
- }
- return (dv);
-}
-
-struct device *
-parsedisk(str, len, defpart, devp)
- char *str;
- int len, defpart;
- dev_t *devp;
-{
- register struct device *dv;
- register char *cp, c;
- int majdev, part;
-
- if (len == 0)
- return (NULL);
- cp = str + len - 1;
- c = *cp;
- if (c >= 'a' && (c - 'a') < MAXPARTITIONS) {
- part = c - 'a';
- *cp = '\0';
- } else
- part = defpart;
-
- for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
- if (dv->dv_class == DV_DISK &&
- strcmp(str, dv->dv_xname) == 0) {
- majdev = findblkmajor(dv);
- if (majdev < 0)
- panic("parsedisk");
- *devp = MAKEDISKDEV(majdev, dv->dv_unit, part);
- break;
- }
-#ifdef NFSCLIENT
- if (dv->dv_class == DV_IFNET &&
- strcmp(str, dv->dv_xname) == 0) {
- *devp = NODEV;
- break;
- }
-#endif
- }
-
- *cp = c;
- return (dv);
-}
-
-/*
- * Attempt to find the device from which we were booted.
- * If we can do so, and not instructed not to do so,
- * change rootdev to correspond to the load device.
- */
-void
-setroot()
-{
- int majdev, mindev, unit, part, len;
- dev_t temp;
- struct swdevt *swp;
- struct device *dv;
- dev_t nrootdev, nswapdev = NODEV;
- char buf[128];
-
-#if defined(NFSCLIENT)
- extern char *nfsbootdevname;
-#endif
-
- if(boothowto & RB_DFLTROOT)
- return; /* Boot compiled in */
-
- /* Lookup boot device from boot if not set by configuration */
- if(bootdv == NULL) {
- bootdv = parsedisk(bootdev, strlen(bootdev), 0, &temp);
- }
- if(bootdv == NULL) {
- printf("boot device: lookup '%s' failed.\n", bootdev);
- boothowto |= RB_ASKNAME; /* Don't Panic :-) */
- }
- else {
- printf("boot device: %s.\n", bootdv->dv_xname);
- }
-
- if (boothowto & RB_ASKNAME) {
- for (;;) {
- printf("root device ");
- if (bootdv != NULL)
- printf("(default %s%c)",
- bootdv->dv_xname,
- bootdv->dv_class == DV_DISK
- ? 'a' : ' ');
- printf(": ");
- len = getsn(buf, sizeof(buf));
- if (len == 0 && bootdv != NULL) {
- strcpy(buf, bootdv->dv_xname);
- len = strlen(buf);
- }
- if (len > 0 && buf[len - 1] == '*') {
- buf[--len] = '\0';
- dv = getdisk(buf, len, 1, &nrootdev);
- if (dv != NULL) {
- bootdv = dv;
- nswapdev = nrootdev;
- goto gotswap;
- }
- }
- dv = getdisk(buf, len, 0, &nrootdev);
- if (dv != NULL) {
- bootdv = dv;
- break;
- }
- }
- /*
- * because swap must be on same device as root, for
- * network devices this is easy.
- */
- if (bootdv->dv_class == DV_IFNET) {
- goto gotswap;
- }
- for (;;) {
- printf("swap device ");
- if (bootdv != NULL)
- printf("(default %s%c)",
- bootdv->dv_xname,
- bootdv->dv_class == DV_DISK?'b':' ');
- printf(": ");
- len = getsn(buf, sizeof(buf));
- if (len == 0 && bootdv != NULL) {
- switch (bootdv->dv_class) {
- case DV_IFNET:
- nswapdev = NODEV;
- break;
- case DV_DISK:
- nswapdev = MAKEDISKDEV(major(nrootdev),
- DISKUNIT(nrootdev), 1);
- break;
- case DV_TAPE:
- case DV_TTY:
- case DV_DULL:
- case DV_CPU:
- break;
- }
- break;
- }
- dv = getdisk(buf, len, 1, &nswapdev);
- if (dv) {
- if (dv->dv_class == DV_IFNET)
- nswapdev = NODEV;
- break;
- }
- }
-
-gotswap:
- rootdev = nrootdev;
- dumpdev = nswapdev;
- swdevt[0].sw_dev = nswapdev;
- swdevt[1].sw_dev = NODEV;
- }
- else if(mountroot == NULL) {
- /*
- * `swap generic': Use the device the ROM told us to use.
- */
- if (bootdv == NULL)
- panic("boot device not known");
-
- majdev = findblkmajor(bootdv);
-
- if (majdev >= 0) {
- /*
- * Root and Swap are on disk.
- * Boot is always from partition 0.
- */
- rootdev = MAKEDISKDEV(majdev, bootdv->dv_unit, 0);
- nswapdev = MAKEDISKDEV(majdev, bootdv->dv_unit, 1);
- dumpdev = nswapdev;
- }
- else {
- /*
- * Root and Swap are on net.
- */
- nswapdev = dumpdev = NODEV;
- }
- swdevt[0].sw_dev = nswapdev;
- swdevt[1].sw_dev = NODEV;
-
- } else {
-
- /*
- * `root DEV swap DEV': honour rootdev/swdevt.
- * rootdev/swdevt/mountroot already properly set.
- */
- return;
- }
-
- switch (bootdv->dv_class) {
-#if defined(NFSCLIENT)
- case DV_IFNET:
- mountroot = nfs_mountroot;
- nfsbootdevname = bootdv->dv_xname;
- return;
-#endif
- case DV_DISK:
- mountroot = dk_mountroot;
- majdev = major(rootdev);
- mindev = minor(rootdev);
- unit = DISKUNIT(rootdev);
- part = DISKPART(rootdev);
- printf("root on %s%c\n", bootdv->dv_xname, part + 'a');
- break;
- default:
- printf("can't figure root, hope your kernel is right\n");
- return;
- }
-
- /*
- * XXX: What is this doing?
- */
- temp = NODEV;
- for (swp = swdevt; swp->sw_dev != NODEV; swp++) {
- if (majdev == major(swp->sw_dev) &&
- unit == DISKUNIT(swp->sw_dev)) {
- temp = swdevt[0].sw_dev;
- swdevt[0].sw_dev = swp->sw_dev;
- swp->sw_dev = temp;
- break;
- }
- }
- if (swp->sw_dev == NODEV)
- return;
-
- /*
- * If dumpdev was the same as the old primary swap device, move
- * it to the new primary swap device.
- */
- if (temp == dumpdev)
- dumpdev = swdevt[0].sw_dev;
-}
-
-/*
- * find a device matching "name" and unit number
- */
-struct device *
-getdevunit(name, unit)
- char *name;
- int unit;
-{
- struct device *dev = alldevs.tqh_first;
- char num[10], fullname[16];
- int lunit;
-
- /* compute length of name and decimal expansion of unit number */
- sprintf(num, "%d", unit);
- lunit = strlen(num);
- if (strlen(name) + lunit >= sizeof(fullname) - 1)
- panic("config_attach: device name too long");
-
- strcpy(fullname, name);
- strcat(fullname, num);
-
- while (strcmp(dev->dv_xname, fullname) != 0) {
- if ((dev = dev->dv_list.tqe_next) == NULL)
- return NULL;
- }
- return dev;
-}
-
-struct devmap {
- char *attachment;
- char *dev;
-};
-
-/*
- * Look at the string 'cp' and decode the boot device.
- * Boot names look like: scsi()disk(n)rdisk()partition(1)\bsd
- * (beware for empty scsi id's...)
- */
-void
-makebootdev(cp)
- char *cp;
-{
- int unit, part, ctrl;
- static struct devmap devmap[] = {
- { "multi", "fd" },
- { "eisa", "wd" },
- { "scsi", "sd" },
- { NULL, NULL }
- };
- struct devmap *dp = &devmap[0];
-
- while (dp->attachment) {
- if (strncmp (cp, dp->attachment, strlen(dp->attachment)) == 0)
- break;
- dp++;
- }
- if (!dp->attachment) {
- printf("Warning: boot device unrecognized: %s\n", cp);
- return;
- }
- ctrl = getpno(&cp);
- if(*cp++ == ')')
- unit = getpno(&cp);
- if(*cp++ == ')')
- getpno(&cp);
- if(*cp++ == ')')
- part = getpno(&cp) - 1;
- sprintf(bootdev, "%s%d%c", dp->dev, ctrl*16 + unit, 'a' + part);
-}
-
-int
-getpno(cp)
- char **cp;
-{
- int val = 0;
- char *cx = *cp;
-
- while(*cx && *cx != '(')
- cx++;
- if(*cx == '(') {
- cx++;
- while(*cx && *cx != ')') {
- val = val * 10 + *cx - '0';
- cx++;
- }
- }
- *cp = cx;
- return val;
-}
diff --git a/sys/arch/arc/arc/clock_mc.c b/sys/arch/arc/arc/clock_mc.c
deleted file mode 100644
index 430f158df79..00000000000
--- a/sys/arch/arc/arc/clock_mc.c
+++ /dev/null
@@ -1,336 +0,0 @@
-/* $OpenBSD: clock_mc.c,v 1.9 1998/03/16 09:38:26 pefo Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: clock.c 1.18 91/01/21
- *
- * @(#)clock.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/pio.h>
-
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
-#include <dev/ic/mc146818reg.h>
-
-#include <mips/archtype.h>
-
-#include <mips/dev/clockvar.h>
-
-#include <arc/pica/pica.h>
-#include <arc/algor/algor.h>
-#include <arc/isa/isa_machdep.h>
-#include <arc/isa/timerreg.h>
-
-extern int cpu_int_mask;
-extern int clock_started;
-
-int clockintr __P((void *cf));
-void md_clk_attach __P((struct device *parent,
- struct device *self, void *aux));
-static void mcclock_init_pica __P((struct clock_softc *csc));
-static void mcclock_init_tyne __P((struct clock_softc *csc));
-static void mcclock_init_algor __P((struct clock_softc *csc));
-static void mcclock_get __P((struct clock_softc *csc, time_t base,
- struct tod_time *ct));
-static void mcclock_set __P((struct clock_softc *csc,
- struct tod_time *ct));
-
-struct mcclockdata {
- void (*mc_write) __P((struct clock_softc *csc, u_int reg,
- u_int datum));
- u_int (*mc_read) __P((struct clock_softc *csc, u_int reg));
-};
-
-#define mc146818_write(sc, reg, datum) \
- (*((struct mcclockdata *)sc->sc_data)->mc_write)(sc, reg, datum)
-#define mc146818_read(sc, reg) \
- (*((struct mcclockdata *)sc->sc_data)->mc_read)(sc, reg)
-
-/* Acer Pica clock access code */
-static void mc_write_pica __P((struct clock_softc *csc, u_int reg,
- u_int datum));
-static u_int mc_read_pica __P((struct clock_softc *csc, u_int reg));
-static struct mcclockdata mcclockdata_pica = { mc_write_pica, mc_read_pica };
-
-/* Deskstation clock access code */
-static void mc_write_tyne __P((struct clock_softc *csc, u_int reg,
- u_int datum));
-static u_int mc_read_tyne __P((struct clock_softc *csc, u_int reg));
-static struct mcclockdata mcclockdata_tyne = { mc_write_tyne, mc_read_tyne };
-
-/* Algorithmics clock access code */
-static void mc_write_algor __P((struct clock_softc *csc, u_int reg,
- u_int datum));
-static u_int mc_read_algor __P((struct clock_softc *csc, u_int reg));
-static struct mcclockdata mcclockdata_algor = { mc_write_algor, mc_read_algor };
-
-void
-md_clk_attach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct clock_softc *csc = (struct clock_softc *)self;
-
- printf(": mc146818 or compatible");
-
- csc->sc_get = mcclock_get;
- csc->sc_set = mcclock_set;
-
- switch (system_type) {
-
- case ACER_PICA_61:
- case MAGNUM:
- csc->sc_init = mcclock_init_pica;
- csc->sc_data = &mcclockdata_pica;
- mc146818_write(csc, MC_REGB, MC_REGB_BINARY | MC_REGB_24HR);
- break;
-
- case DESKSTATION_RPC44:
- case DESKSTATION_TYNE:
- csc->sc_init = mcclock_init_tyne;
- csc->sc_data = &mcclockdata_tyne;
- mc146818_write(csc, MC_REGB, MC_REGB_BINARY | MC_REGB_24HR);
- break;
-
- case ALGOR_P4032:
- case ALGOR_P5064:
- csc->sc_init = mcclock_init_algor;
- csc->sc_data = &mcclockdata_algor;
- mc146818_write(csc, MC_REGB, MC_REGB_BINARY|MC_REGB_24HR|MC_REGB_SQWE);
- break;
-
- default:
- printf("\n");
- panic("don't know how to set up for other system types.");
- }
-}
-
-static void
-mcclock_init_pica(csc)
- struct clock_softc *csc;
-{
-/* XXX Does not really belong here but for the moment we don't care */
- out32(R4030_SYS_IT_VALUE, 9); /* 10ms - 1 */
- /* Enable periodic clock interrupt */
- out32(R4030_SYS_EXT_IMASK, cpu_int_mask);
-}
-
-static void
-mcclock_init_tyne(csc)
- struct clock_softc *csc;
-{
- isa_outb(TIMER_MODE, TIMER_SEL0 | TIMER_16BIT | TIMER_RATEGEN);
- isa_outb(TIMER_CNTR0, TIMER_DIV(hz) % 256);
- isa_outb(TIMER_CNTR0, TIMER_DIV(hz) / 256);
-}
-
-int
-clockintr(cf)
- void *cf;
-{
- if(clock_started)
- hardclock((struct clockframe *)cf);
- return(1);
-}
-
-static void
-mcclock_init_algor(csc)
- struct clock_softc *csc;
-{
- int s;
- char cv;
-
- hz = 256; /* NOTE! We are going at 256 Hz! */
- s = splclock();
- cv = mc146818_read(csc, MC_REGA) & ~MC_REGA_RSMASK;
- mc146818_write(csc, MC_REGA, cv | MC_RATE_256_Hz);
- cv = mc146818_read(csc, MC_REGB);
- mc146818_write(csc, MC_REGB, cv | MC_REGB_PIE);
- splx(s);
-}
-
-/*
- * Get the time of day, based on the clock's value and/or the base value.
- */
-static void
-mcclock_get(csc, base, ct)
- struct clock_softc *csc;
- time_t base;
- struct tod_time *ct;
-{
- mc_todregs regs;
- int s;
-
- s = splclock();
- MC146818_GETTOD(csc, &regs)
- splx(s);
-
- ct->sec = regs[MC_SEC];
- ct->min = regs[MC_MIN];
- ct->hour = regs[MC_HOUR];
- ct->dow = regs[MC_DOW];
- ct->day = regs[MC_DOM];
- ct->mon = regs[MC_MONTH];
- ct->year = regs[MC_YEAR];
- if(system_type == ALGOR_P4032 ||
- system_type == ALGOR_P5064) {
- ct->year -= 80;
- }
-}
-
-/*
- * Reset the TODR based on the time value.
- */
-static void
-mcclock_set(csc, ct)
- struct clock_softc *csc;
- struct tod_time *ct;
-{
- mc_todregs regs;
- int s;
-
- s = splclock();
- MC146818_GETTOD(csc, &regs);
-printf("%d-%d-%d, %d:%d:%d\n", regs[MC_YEAR], regs[MC_MONTH], regs[MC_DOM], regs[MC_HOUR], regs[MC_MIN], regs[MC_SEC]);
-
- regs[MC_SEC] = ct->sec;
- regs[MC_MIN] = ct->min;
- regs[MC_HOUR] = ct->hour;
- regs[MC_DOW] = ct->dow;
- regs[MC_DOM] = ct->day;
- regs[MC_MONTH] = ct->mon;
- if(system_type == ALGOR_P4032 ||
- system_type == ALGOR_P4032) {
- regs[MC_YEAR] = ct->year + 80;
- }
- else {
- regs[MC_YEAR] = ct->year;
- }
-
- MC146818_PUTTOD(csc, &regs);
- MC146818_GETTOD(csc, &regs);
-printf("%d-%d-%d, %d:%d:%d\n", regs[MC_YEAR], regs[MC_MONTH], regs[MC_DOM], regs[MC_HOUR], regs[MC_MIN], regs[MC_SEC]);
- splx(s);
-}
-
-static void
-mc_write_pica(csc, reg, datum)
- struct clock_softc *csc;
- u_int reg, datum;
-{
- int as;
-
- as = in32(PICA_SYS_ISA_AS) & 0x80;
- out32(PICA_SYS_ISA_AS, as | reg);
- outb(PICA_SYS_CLOCK, datum);
-}
-
-static u_int
-mc_read_pica(csc, reg)
- struct clock_softc *csc;
- u_int reg;
-{
- int i,as;
-
- as = in32(PICA_SYS_ISA_AS) & 0x80;
- out32(PICA_SYS_ISA_AS, as | reg);
- i = inb(PICA_SYS_CLOCK);
- return(i);
-}
-
-static void
-mc_write_tyne(csc, reg, datum)
- struct clock_softc *csc;
- u_int reg, datum;
-{
- isa_outb(IO_RTC, reg);
- isa_outb(IO_RTC+1, datum);
-}
-
-static u_int
-mc_read_tyne(csc, reg)
- struct clock_softc *csc;
- u_int reg;
-{
- int i;
-
- isa_outb(IO_RTC, reg);
- i = isa_inb(IO_RTC+1);
- return(i);
-}
-
-static void
-mc_write_algor(csc, reg, datum)
- struct clock_softc *csc;
- u_int reg, datum;
-{
- if(system_type == ALGOR_P4032) {
- outb(P4032_CLOCK, reg);
- outb(P4032_CLOCK+4, datum);
- }
- else {
- outb(P5064_CLOCK, reg);
- outb(P5064_CLOCK+1, datum);
- }
-}
-
-static u_int
-mc_read_algor(csc, reg)
- struct clock_softc *csc;
- u_int reg;
-{
- int i;
-
- if(system_type == ALGOR_P4032) {
- outb(P4032_CLOCK, reg);
- i = inb(P4032_CLOCK+4) & 0xff;
- }
- else {
- outb(P5064_CLOCK, reg);
- i = inb(P5064_CLOCK+1) & 0xff;
- }
- return(i);
-}
diff --git a/sys/arch/arc/arc/conf.c b/sys/arch/arc/arc/conf.c
deleted file mode 100644
index 41228683234..00000000000
--- a/sys/arch/arc/arc/conf.c
+++ /dev/null
@@ -1,373 +0,0 @@
-/* $OpenBSD: conf.c,v 1.28 2000/09/26 14:03:51 art Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)conf.c 8.2 (Berkeley) 11/14/93
- * $Id: conf.c,v 1.28 2000/09/26 14:03:51 art Exp $
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/vnode.h>
-#include <sys/tty.h>
-#include <sys/conf.h>
-
-int ttselect __P((dev_t, int, struct proc *));
-
-/*
- * Block devices.
- */
-
-#include "vnd.h"
-bdev_decl(vnd);
-bdev_decl(sw);
-#include "sd.h"
-bdev_decl(sd);
-#include "cd.h"
-bdev_decl(cd);
-#include "fdc.h"
-bdev_decl(fd);
-#include "wd.h"
-bdev_decl(wd);
-#include "ccd.h"
-#include "rd.h"
-bdev_decl(rd);
-
-struct bdevsw bdevsw[] =
-{
- bdev_disk_init(NSD,sd), /* 0: SCSI disk */
- bdev_swap_init(1,sw), /* 1: should be here swap pseudo-dev */
- bdev_disk_init(NVND,vnd), /* 2: vnode disk driver */
- bdev_disk_init(NCD,cd), /* 3: SCSI CD-ROM */
- bdev_disk_init(NWD,wd), /* 4: ST506/ESDI/IDE disk */
- bdev_notdef(), /* 5: */
- bdev_disk_init(NCCD,ccd), /* 6: concatenated disk driver */
- bdev_disk_init(NFDC,fd), /* 7: Floppy disk driver */
- bdev_disk_init(NRD,rd), /* 8: RAM disk (for install) */
- bdev_notdef(), /* 9: */
- bdev_notdef(), /* 10: */
- bdev_notdef(), /* 11: */
- bdev_notdef(), /* 12: */
- bdev_notdef(), /* 13: */
- bdev_notdef(), /* 14: */
- bdev_notdef(), /* 15: */
-};
-
-int nblkdev = sizeof (bdevsw) / sizeof (bdevsw[0]);
-
-/*
- * Character devices.
- */
-
-/* open, close, read, write, ioctl, tty, mmap */
-#define cdev_pc_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
- dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \
- dev_init(c,n,tty), ttselect, dev_init(c,n,mmap), D_TTY }
-
-/* open, close, write, ioctl */
-#define cdev_lpt_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
- dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
- 0, seltrue, (dev_type_mmap((*))) enodev }
-
-/* open, close, write, ioctl */
-#define cdev_spkr_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
- dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
- 0, seltrue, (dev_type_mmap((*))) enodev }
-
-/* open, close, read, ioctl */
-#define cdev_joy_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
- (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, seltrue, \
- (dev_type_mmap((*))) enodev }
-
-cdev_decl(cn);
-cdev_decl(sw);
-cdev_decl(ctty);
-cdev_decl(random);
-#define mmread mmrw
-#define mmwrite mmrw
-dev_type_read(mmrw);
-cdev_decl(mm);
-#include "pty.h"
-#define ptstty ptytty
-#define ptsioctl ptyioctl
-cdev_decl(pts);
-#define ptctty ptytty
-#define ptcioctl ptyioctl
-cdev_decl(ptc);
-cdev_decl(log);
-cdev_decl(fd);
-#include "st.h"
-cdev_decl(st);
-#include "fdc.h"
-bdev_decl(fd);
-cdev_decl(vnd);
-cdev_decl(rd);
-#include "bpfilter.h"
-cdev_decl(bpf);
-#include "com.h"
-cdev_decl(com);
-#include "lpt.h"
-cdev_decl(lpt);
-cdev_decl(sd);
-#include "pc.h"
-cdev_decl(pc);
-cdev_decl(pms);
-cdev_decl(cd);
-#include "ss.h"
-#include "uk.h"
-cdev_decl(uk);
-cdev_decl(wd);
-cdev_decl(acd);
-#include "joy.h"
-cdev_decl(joy);
-#ifdef XFS
-#include <xfs/nxfs.h>
-cdev_decl(xfs_dev);
-#endif
-#include "ksyms.h"
-cdev_decl(ksyms);
-#include "ch.h"
-
-#ifdef IPFILTER
-#define NIPF 1
-#else
-#define NIPF 0
-#endif
-
-struct cdevsw cdevsw[] =
-{
- cdev_cn_init(1,cn), /* 0: virtual console */
- cdev_swap_init(1,sw), /* 1: /dev/drum (swap pseudo-device) */
- cdev_ctty_init(1,ctty), /* 2: controlling terminal */
- cdev_mm_init(1,mm), /* 3: /dev/{null,mem,kmem,...} */
- cdev_tty_init(NPTY,pts), /* 4: pseudo-tty slave */
- cdev_ptc_init(NPTY,ptc), /* 5: pseudo-tty master */
- cdev_log_init(1,log), /* 6: /dev/klog */
- cdev_fd_init(1,filedesc), /* 7: file descriptor pseudo-dev */
- cdev_disk_init(NCD,cd), /* 8: SCSI CD */
- cdev_disk_init(NSD,sd), /* 9: SCSI disk */
- cdev_tape_init(NST,st), /* 10: SCSI tape */
- cdev_disk_init(NVND,vnd), /* 11: vnode disk */
- cdev_bpftun_init(NBPFILTER,bpf),/* 12: berkeley packet filter */
- cdev_disk_init(NFDC,fd), /* 13: Floppy disk */
- cdev_pc_init(NPC,pc), /* 14: builtin pc style console dev */
- cdev_mouse_init(NPC,pms), /* 15: builtin PS2 style mouse */
- cdev_lpt_init(NLPT,lpt), /* 16: Parallel printer interface */
- cdev_tty_init(NCOM,com), /* 17: 16C450 serial interface */
- cdev_disk_init(NWD,wd), /* 18: ST506/ESDI/IDE disk */
- cdev_notdef(), /* 19: */
- cdev_tty_init(NPTY,pts), /* 20: pseudo-tty slave */
- cdev_ptc_init(NPTY,ptc), /* 21: pseudo-tty master */
- cdev_disk_init(NRD,rd), /* 22: ramdisk device */
- cdev_disk_init(NCCD,ccd), /* 23: concatenated disk driver */
- cdev_notdef(), /* 24: */
- cdev_notdef(), /* 25: */
- cdev_joy_init(NJOY,joy), /* 26: joystick */
- cdev_notdef(), /* 27: */
- cdev_notdef(), /* 28: */
- cdev_notdef(), /* 29: */
- cdev_notdef(), /* 30: */
- cdev_gen_ipf(NIPF,ipl), /* 31: IP filter log */
- cdev_uk_init(NUK,uk), /* 32: unknown SCSI */
- cdev_random_init(1,random), /* 33: random data source */
- cdev_ss_init(NSS,ss), /* 34: SCSI scanner */
- cdev_ksyms_init(NKSYMS,ksyms), /* 35: Kernel symbols device */
- cdev_ch_init(NCH,ch), /* 36: SCSI autochanger */
- cdev_notdef(), /* 37: */
- cdev_notdef(), /* 38: */
- cdev_notdef(), /* 39: */
- cdev_notdef(), /* 40: */
- cdev_notdef(), /* 41: */
- cdev_notdef(), /* 42: */
- cdev_notdef(), /* 33: */
- cdev_notdef(), /* 44: */
- cdev_notdef(), /* 45: */
- cdev_notdef(), /* 46: */
- cdev_notdef(), /* 47: */
- cdev_notdef(), /* 48: */
- cdev_notdef(), /* 49: */
- cdev_notdef(), /* 50: */
-#ifdef XFS
- cdev_xfs_init(NXFS,xfs_dev), /* 51: xfs communication device */
-#else
- cdev_notdef(), /* 51: */
-#endif
-};
-
-int nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]);
-
-/*
- * Swapdev is a fake device implemented
- * in sw.c used only internally to get to swstrategy.
- * It cannot be provided to the users, because the
- * swstrategy routine munches the b_dev and b_blkno entries
- * before calling the appropriate driver. This would horribly
- * confuse, e.g. the hashing routines. Instead, /dev/drum is
- * provided as a character (raw) device.
- */
-dev_t swapdev = makedev(1, 0);
-
-/*
- * Routine that identifies /dev/mem and /dev/kmem.
- *
- * A minimal stub routine can always return 0.
- */
-int
-iskmemdev(dev)
- dev_t dev;
-{
-
-#ifdef COMPAT_BSD44
- if (major(dev) == 2 && (minor(dev) == 0 || minor(dev) == 1))
-#else
- if (major(dev) == 3 && (minor(dev) == 0 || minor(dev) == 1))
-#endif
- return (1);
- return (0);
-}
-
-/*
- * Returns true if def is /dev/zero
- */
-int
-iszerodev(dev)
- dev_t dev;
-{
-#ifdef COMPAT_BSD44
- return (major(dev) == 2 && minor(dev) == 12);
-#else
- return (major(dev) == 3 && minor(dev) == 12);
-#endif
-}
-
-dev_t
-getnulldev()
-{
- return makedev(3, 2);
-}
-
-
-static int chrtoblktbl[] = {
- /* VCHR */ /* VBLK */
- /* 0 */ NODEV,
- /* 1 */ NODEV,
- /* 2 */ NODEV,
- /* 3 */ NODEV,
- /* 4 */ NODEV,
- /* 5 */ NODEV,
- /* 6 */ NODEV,
- /* 7 */ NODEV,
- /* 8 */ NODEV,
- /* 9 */ 0,
- /* 10 */ NODEV,
- /* 11 */ 2,
- /* 12 */ NODEV,
- /* 13 */ 7,
- /* 14 */ NODEV,
- /* 15 */ NODEV,
- /* 16 */ NODEV,
- /* 17 */ NODEV,
- /* 18 */ 4,
- /* 19 */ 5,
- /* 20 */ NODEV,
- /* 21 */ NODEV,
- /* 22 */ 8,
-};
-
-/*
- * Routine to convert from character to block device number.
- */
-dev_t
-chrtoblk(dev)
- dev_t dev;
-{
- int blkmaj;
-
- if (major(dev) >= nchrdev ||
- major(dev) > sizeof(chrtoblktbl)/sizeof(chrtoblktbl[0]))
- return (NODEV);
- blkmaj = chrtoblktbl[major(dev)];
- if (blkmaj == NODEV)
- return (NODEV);
- return (makedev(blkmaj, minor(dev)));
-}
-
-/*
- * Convert a character device number to a block device number.
- */
-dev_t
-blktochr(dev)
- dev_t dev;
-{
- int blkmaj = major(dev);
- int i;
-
- if (blkmaj >= nblkdev)
- return (NODEV);
- for (i = 0; i < sizeof(chrtoblktbl)/sizeof(chrtoblktbl[0]); i++)
- if (blkmaj == chrtoblktbl[i])
- return (makedev(i, minor(dev)));
- return (NODEV);
-}
-
-/*
- * This entire table could be autoconfig()ed but that would mean that
- * the kernel's idea of the console would be out of sync with that of
- * the standalone boot. I think it best that they both use the same
- * known algorithm unless we see a pressing need otherwise.
- */
-#include <dev/cons.h>
-
-cons_decl(pc);
-cons_decl(com);
-
-struct consdev constab[] = {
-#if NPC + NVT > 0
- cons_init(pc),
-#endif
-#if NCOM > 0
- cons_init(com),
-#endif
- { 0 },
-};
diff --git a/sys/arch/arc/arc/genassym.cf b/sys/arch/arc/arc/genassym.cf
deleted file mode 100644
index 2a1e3037ebf..00000000000
--- a/sys/arch/arc/arc/genassym.cf
+++ /dev/null
@@ -1,57 +0,0 @@
-# $OpenBSD: genassym.cf,v 1.3 1998/10/15 21:29:59 imp Exp $ */
-#
-# Copyright (c) 1997 Per Fogelstrom / Opsycon AB
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed under OpenBSD by
-# Per Fogelstrom.
-# 4. The name of the author may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
-# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
-# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-
-
-include <sys/param.h>
-include <sys/buf.h>
-include <sys/map.h>
-include <sys/proc.h>
-include <sys/mbuf.h>
-include <sys/user.h>
-
-include <machine/reg.h>
-
-
-define P_FORW offsetof(struct proc, p_forw)
-define P_BACK offsetof(struct proc, p_back)
-define P_PRIORITY offsetof(struct proc, p_priority)
-define P_ADDR offsetof(struct proc, p_addr)
-define P_UPTE offsetof(struct proc, p_md.md_upte)
-define U_PCB_REGS offsetof(struct user, u_pcb.pcb_regs[ZERO])
-define U_PCB_FPREGS offsetof(struct user, u_pcb.pcb_regs[F0])
-define U_PCB_CONTEXT offsetof(struct user, u_pcb.pcb_context)
-define U_PCB_ONFAULT offsetof(struct user, u_pcb.pcb_onfault)
-define U_PCB_SEGTAB offsetof(struct user, u_pcb.pcb_segtab)
-define V_SWTCH offsetof(struct vmmeter, v_swtch)
-
-define VM_MIN_KERNEL_ADDRESS VM_MIN_KERNEL_ADDRESS
-define SIGFPE SIGFPE
diff --git a/sys/arch/arc/arc/locore.S b/sys/arch/arc/arc/locore.S
deleted file mode 100644
index f32e2bac024..00000000000
--- a/sys/arch/arc/arc/locore.S
+++ /dev/null
@@ -1,3063 +0,0 @@
-/* $OpenBSD: locore.S,v 1.20 1999/08/15 20:35:06 niklas Exp $ */
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Digital Equipment Corporation and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (C) 1989 Digital Equipment Corporation.
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appears in all copies.
- * Digital Equipment Corporation makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/loMem.s,
- * v 1.1 89/07/11 17:55:04 nelson Exp SPRITE (DECWRL)
- * from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/machAsm.s,
- * v 9.2 90/01/29 18:00:39 shirriff Exp SPRITE (DECWRL)
- * from: Header: /sprite/src/kernel/vm/ds3100.md/vmPmaxAsm.s,
- * v 1.1 89/07/10 14:27:41 nelson Exp SPRITE (DECWRL)
- *
- * from: @(#)locore.s 8.5 (Berkeley) 1/4/94
- * $Id: locore.S,v 1.20 1999/08/15 20:35:06 niklas Exp $
- */
-
-/*
- * Contains code that is the first executed at boot time plus
- * assembly language support routines.
- */
-
-#include <sys/errno.h>
-#include <sys/syscall.h>
-
-#include <machine/param.h>
-#include <machine/psl.h>
-#include <machine/asm.h>
-#include <machine/cpu.h>
-#include <machine/regnum.h>
-#include <machine/pte.h>
-
-#include "assym.h"
-#include "ksyms.h"
-
- .set noreorder
-
-/*
- * Amount to take off of the stack for the benefit of the debugger.
- */
-#define START_FRAME ((4 * 4) + 4 + 4)
-
- .globl start
- .globl kernel_text
-kernel_text = start
-start:
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
- mtc0 zero, COP_0_CAUSE_REG # Clear soft interrupts
-
-/*
- * Initialize stack and call machine startup.
- */
- la sp, start - START_FRAME
- la gp, _gp
- sw zero, START_FRAME - 4(sp) # Zero out old ra for debugger
- jal mips_init # mips_init(argc, argv, envp)
- sw zero, START_FRAME - 8(sp) # Zero out old fp for debugger
-
- li t0, SR_COP_1_BIT # Disable interrupts and
- mtc0 t0, COP_0_STATUS_REG # enable the fp coprocessor
- li sp, KERNELSTACK - START_FRAME # switch to standard stack
- nop
- nop # wait for new status to
- nop # wait for new status to
- nop # to be effective
- nop
- cfc1 t1, FPC_ID # read FPU ID register
- sw t1, fpu_id # save FPU ID register
- jal main # main(regs)
- move a0, zero
-/*
- * proc[1] == /etc/init now running here.
- * Restore user registers and return.
- */
- .set noat
- li v0, SR_EXL
- mtc0 v0, COP_0_STATUS_REG # set exeption level bit.
- lw a0, UADDR+U_PCB_REGS+(SR * 4)
- lw t0, UADDR+U_PCB_REGS+(MULLO * 4)
- lw t1, UADDR+U_PCB_REGS+(MULHI * 4)
- mtlo t0
- mthi t1
- lw a0, UADDR+U_PCB_REGS+(PC * 4)
- lw AT, UADDR+U_PCB_REGS+(AST * 4)
- lw v0, UADDR+U_PCB_REGS+(V0 * 4)
- dmtc0 a0, COP_0_EXC_PC # set return address
- li a0, PSL_USERSET
- mtc0 a0, COP_0_STATUS_REG # switch to user mode (when eret...)
- lw v1, UADDR+U_PCB_REGS+(V1 * 4)
- lw a0, UADDR+U_PCB_REGS+(A0 * 4)
- lw a1, UADDR+U_PCB_REGS+(A1 * 4)
- lw a2, UADDR+U_PCB_REGS+(A2 * 4)
- lw a3, UADDR+U_PCB_REGS+(A3 * 4)
- lw t0, UADDR+U_PCB_REGS+(T0 * 4)
- lw t1, UADDR+U_PCB_REGS+(T1 * 4)
- lw t2, UADDR+U_PCB_REGS+(T2 * 4)
- lw t3, UADDR+U_PCB_REGS+(T3 * 4)
- lw t4, UADDR+U_PCB_REGS+(T4 * 4)
- lw t5, UADDR+U_PCB_REGS+(T5 * 4)
- lw t6, UADDR+U_PCB_REGS+(T6 * 4)
- lw t7, UADDR+U_PCB_REGS+(T7 * 4)
- lw s0, UADDR+U_PCB_REGS+(S0 * 4)
- lw s1, UADDR+U_PCB_REGS+(S1 * 4)
- lw s2, UADDR+U_PCB_REGS+(S2 * 4)
- lw s3, UADDR+U_PCB_REGS+(S3 * 4)
- lw s4, UADDR+U_PCB_REGS+(S4 * 4)
- lw s5, UADDR+U_PCB_REGS+(S5 * 4)
- lw s6, UADDR+U_PCB_REGS+(S6 * 4)
- lw s7, UADDR+U_PCB_REGS+(S7 * 4)
- lw t8, UADDR+U_PCB_REGS+(T8 * 4)
- lw gp, UADDR+U_PCB_REGS+(GP * 4)
- lw sp, UADDR+U_PCB_REGS+(SP * 4)
- lw s8, UADDR+U_PCB_REGS+(S8 * 4)
- lw ra, UADDR+U_PCB_REGS+(RA * 4)
- lw t9, UADDR+U_PCB_REGS+(T9 * 4)
- eret
- .set at
-
-/*
- * Primitives
- */
-
-/*
- * This table is indexed by u.u_pcb.pcb_onfault in trap().
- * The reason for using this table rather than storing an address in
- * u.u_pcb.pcb_onfault is simply to make the code faster.
- */
- .globl onfault_table
- .data
- .align 3
-onfault_table:
- .word 0 # invalid index number
-#define BADERR 1
- .word baderr
-#define COPYERR 2
- .word copyerr
-#define FSWBERR 3
- .word fswberr
-#define FSWINTRBERR 4
- .word fswintrberr
-#if defined(DDB) || defined(DEBUG)
-#define DDBERR 5
- .word ddberr
-#else
- .word 0
-#endif
- .text
-
-/*
- * See if access to addr with a len type instruction causes a machine check.
- * len is length of access (1=byte, 2=short, 4=long)
- *
- * badaddr(addr, len)
- * char *addr;
- * int len;
- */
-LEAF(badaddr)
- li v0, BADERR
- bne a1, 1, 2f
- sw v0, UADDR+U_PCB_ONFAULT
- b 5f
- lbu v0, (a0)
-2:
- bne a1, 2, 4f
- nop
- b 5f
- lhu v0, (a0)
-4:
- lw v0, (a0)
-5:
- sw zero, UADDR+U_PCB_ONFAULT
- j ra
- move v0, zero # made it w/o errors
-baderr:
- j ra
- li v0, 1 # trap sends us here
-END(badaddr)
-
-/*
- * This code is copied the user's stack for returning from signal handlers
- * (see sendsig() and sigreturn()). We have to compute the address
- * of the sigcontext struct for the sigreturn call.
- */
- .globl sigcode
-sigcode:
- addu a0, sp, 16 # address of sigcontext
- li v0, SYS_sigreturn # sigreturn(scp)
- syscall
- break 0 # just in case sigreturn fails
- .globl esigcode
-esigcode:
-
-/*
- * Copy a null terminated string within the kernel address space.
- * Maxlength may be null if count not wanted.
- * copystr(fromaddr, toaddr, maxlength, &lencopied)
- * caddr_t fromaddr;
- * caddr_t toaddr;
- * u_int maxlength;
- * u_int *lencopied;
- */
-LEAF(copystr)
- move t2, a2 # Save the number of bytes
-1:
- lbu t0, 0(a0)
- subu a2, a2, 1
- beq t0, zero, 2f
- sb t0, 0(a1)
- addu a0, a0, 1
- bne a2, zero, 1b
- addu a1, a1, 1
-2:
- beq a3, zero, 3f
- subu a2, t2, a2 # compute length copied
- sw a2, 0(a3)
-3:
- j ra
- move v0, zero
-END(copystr)
-
-/*
- * fillw(pat, addr, count)
- */
-LEAF(fillw)
-1:
- addiu a2, a2, -1
- sh a0, 0(a1)
- bne a2,zero, 1b
- addiu a1, a1, 2
-
- jr ra
- nop
-END(fillw)
-
-/*
- * Optimized memory zero code.
- * mem_zero_page(addr);
- */
-LEAF(mem_zero_page)
- li v0, NBPG
-1:
- subu v0, 8
- sd zero, 0(a0)
- bne zero, v0, 1b
- addu a0, 8
- jr ra
- nop
-END(mem_zero_page)
-
-/*
- * Block I/O routines mainly used by I/O drivers.
- *
- * Args as: a0 = port
- * a1 = memory address
- * a2 = count
- */
-LEAF(insb)
- beq a2, zero, 2f
- addu a2, a1
-1:
- lbu v0, 0(a0)
- addiu a1, 1
- bne a1, a2, 1b
- sb v0, -1(a1)
-2:
- jr ra
- nop
-END(insb)
-
-LEAF(insw)
- beq a2, zero, 2f
- addu a2, a2
- addu a2, a1
-1:
- lhu v0, 0(a0)
- addiu a1, 2
- bne a1, a2, 1b
- sh v0, -2(a1)
-2:
- jr ra
- nop
-END(insw)
-
-LEAF(insl)
- beq a2, zero, 2f
- sll a2, 2
- addu a2, a1
-1:
- lw v0, 0(a0)
- addiu a1, 4
- bne a1, a2, 1b
- sw v0, -4(a1)
-2:
- jr ra
- nop
-END(insl)
-
-LEAF(outsb)
- beq a2, zero, 2f
- addu a2, a1
-1:
- lbu v0, 0(a1)
- addiu a1, 1
- bne a1, a2, 1b
- sb v0, 0(a0)
-2:
- jr ra
- nop
-END(outsb)
-
-LEAF(outsw)
- beq a2, zero, 2f
- addu a2, a2
- li v0, 1
- and v0, a1
- bne v0, zero, 3f # arghh, unaligned.
- addu a2, a1
-1:
- lhu v0, 0(a1)
- addiu a1, 2
- bne a1, a2, 1b
- sh v0, 0(a0)
-2:
- jr ra
- nop
-3:
- LWHI v0, 0(a1)
- LWLO v0, 3(a1)
- addiu a1, 2
- bne a1, a2, 3b
- sh v0, 0(a0)
-
- jr ra
- nop
-END(outsw)
-
-LEAF(outsl)
- beq a2, zero, 2f
- sll a2, 2
- li v0, 3
- and v0, a1
- bne v0, zero, 3f # arghh, unaligned.
- addu a2, a1
-1:
- lw v0, 0(a1)
- addiu a1, 4
- bne a1, a2, 1b
- sw v0, 0(a0)
-2:
- jr ra
- nop
-3:
- LWHI v0, 0(a1)
- LWLO v0, 3(a1)
- addiu a1, 4
- bne a1, a2, 3b
- sw v0, 0(a0)
-
- jr ra
- nop
-END(outsl)
-
-/*
- * Copy a null terminated string from the user address space into
- * the kernel address space.
- *
- * copyinstr(fromaddr, toaddr, maxlength, &lencopied)
- * caddr_t fromaddr;
- * caddr_t toaddr;
- * u_int maxlength;
- * u_int *lencopied;
- */
-NON_LEAF(copyinstr, STAND_FRAME_SIZE, ra)
- subu sp, sp, STAND_FRAME_SIZE
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
- sw ra, STAND_RA_OFFSET(sp)
- blt a0, zero, copyerr # make sure address is in user space
- li v0, COPYERR
- jal copystr
- sw v0, UADDR+U_PCB_ONFAULT
- lw ra, STAND_RA_OFFSET(sp)
- sw zero, UADDR+U_PCB_ONFAULT
- addu sp, sp, STAND_FRAME_SIZE
- j ra
- move v0, zero
-END(copyinstr)
-
-/*
- * Copy a null terminated string from the kernel address space into
- * the user address space.
- *
- * copyoutstr(fromaddr, toaddr, maxlength, &lencopied)
- * caddr_t fromaddr;
- * caddr_t toaddr;
- * u_int maxlength;
- * u_int *lencopied;
- */
-NON_LEAF(copyoutstr, STAND_FRAME_SIZE, ra)
- subu sp, sp, STAND_FRAME_SIZE
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
- sw ra, STAND_RA_OFFSET(sp)
- blt a1, zero, copyerr # make sure address is in user space
- li v0, COPYERR
- jal copystr
- sw v0, UADDR+U_PCB_ONFAULT
- lw ra, STAND_RA_OFFSET(sp)
- sw zero, UADDR+U_PCB_ONFAULT
- addu sp, sp, STAND_FRAME_SIZE
- j ra
- move v0, zero
-END(copyoutstr)
-
-/*
- * Copy specified amount of data from user space into the kernel
- * copyin(from, to, len)
- * caddr_t *from; (user source address)
- * caddr_t *to; (kernel destination address)
- * unsigned len;
- */
-NON_LEAF(copyin, STAND_FRAME_SIZE, ra)
- subu sp, sp, STAND_FRAME_SIZE
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
- sw ra, STAND_RA_OFFSET(sp)
- blt a0, zero, copyerr # make sure address is in user space
- li v0, COPYERR
- jal bcopy
- sw v0, UADDR+U_PCB_ONFAULT
- lw ra, STAND_RA_OFFSET(sp)
- sw zero, UADDR+U_PCB_ONFAULT
- addu sp, sp, STAND_FRAME_SIZE
- j ra
- move v0, zero
-END(copyin)
-
-/*
- * Copy specified amount of data from kernel to the user space
- * copyout(from, to, len)
- * caddr_t *from; (kernel source address)
- * caddr_t *to; (user destination address)
- * unsigned len;
- */
-NON_LEAF(copyout, STAND_FRAME_SIZE, ra)
- subu sp, sp, STAND_FRAME_SIZE
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
- sw ra, STAND_RA_OFFSET(sp)
- blt a1, zero, copyerr # make sure address is in user space
- li v0, COPYERR
- jal bcopy
- sw v0, UADDR+U_PCB_ONFAULT
- lw ra, STAND_RA_OFFSET(sp)
- sw zero, UADDR+U_PCB_ONFAULT
- addu sp, sp, STAND_FRAME_SIZE
- j ra
- move v0, zero
-END(copyout)
-
-LEAF(copyerr)
- lw ra, STAND_RA_OFFSET(sp)
- sw zero, UADDR+U_PCB_ONFAULT
- addu sp, sp, STAND_FRAME_SIZE
- j ra
- li v0, EFAULT # return error
-END(copyerr)
-
-/*
- * Copy the kernel stack to the new process and save the current context so
- * the new process will return nonzero when it is resumed by cpu_switch().
- *
- * copykstack(up)
- * struct user *up;
- */
-LEAF(copykstack)
- subu v0, sp, UADDR # compute offset into stack
- addu v0, v0, a0 # v0 = new stack address
- move v1, sp # v1 = old stack address
- li t1, KERNELSTACK
-1:
- lw t0, 0(v1) # copy stack data
- addu v1, v1, 4
- sw t0, 0(v0)
- bne v1, t1, 1b
- addu v0, v0, 4
- /* FALLTHROUGH */
-/*
- * Save registers and state so we can do a longjmp later.
- * Note: this only works if p != curproc since
- * cpu_switch() will copy over pcb_context.
- *
- * savectx(up)
- * struct user *up;
- */
-ALEAF(savectx)
- sw s0, U_PCB_CONTEXT+0(a0)
- sw s1, U_PCB_CONTEXT+4(a0)
- sw s2, U_PCB_CONTEXT+8(a0)
- sw s3, U_PCB_CONTEXT+12(a0)
- mfc0 v0, COP_0_STATUS_REG
- sw s4, U_PCB_CONTEXT+16(a0)
- sw s5, U_PCB_CONTEXT+20(a0)
- sw s6, U_PCB_CONTEXT+24(a0)
- sw s7, U_PCB_CONTEXT+28(a0)
- sw sp, U_PCB_CONTEXT+32(a0)
- sw s8, U_PCB_CONTEXT+36(a0)
- sw ra, U_PCB_CONTEXT+40(a0)
- sw v0, U_PCB_CONTEXT+44(a0)
- j ra
- move v0, zero
-END(copykstack)
-
-/*
- * The following primitives manipulate the run queues. _whichqs tells which
- * of the 32 queues _qs have processes in them. Setrunqueue puts processes
- * into queues, Remrq removes them from queues. The running process is on
- * no queue, other processes are on a queue related to p->p_priority, divided
- * by 4 actually to shrink the 0-127 range of priorities into the 32 available
- * queues.
- */
-/*
- * setrunqueue(p)
- * proc *p;
- *
- * Call should be made at splclock(), and p->p_stat should be SRUN.
- */
-NON_LEAF(setrunqueue, STAND_FRAME_SIZE, ra)
- subu sp, sp, STAND_FRAME_SIZE
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
- lw t0, P_BACK(a0) ## firewall: p->p_back must be 0
- sw ra, STAND_RA_OFFSET(sp) ##
- beq t0, zero, 1f ##
- lbu t0, P_PRIORITY(a0) # put on p->p_priority / 4 queue
- PANIC("setrunqueue") ##
-1:
- li t1, 1 # compute corresponding bit
- srl t0, t0, 2 # compute index into 'whichqs'
- sll t1, t1, t0
- lw t2, whichqs # set corresponding bit
- nop
- or t2, t2, t1
- sw t2, whichqs
- sll t0, t0, 3 # compute index into 'qs'
- la t1, qs
- addu t0, t0, t1 # t0 = qp = &qs[pri >> 2]
- lw t1, P_BACK(t0) # t1 = qp->ph_rlink
- sw t0, P_FORW(a0) # p->p_forw = qp
- sw t1, P_BACK(a0) # p->p_back = qp->ph_rlink
- sw a0, P_FORW(t1) # p->p_back->p_forw = p;
- sw a0, P_BACK(t0) # qp->ph_rlink = p
- j ra
- addu sp, sp, STAND_FRAME_SIZE
-END(setrunqueue)
-
-/*
- * Remrq(p)
- *
- * Call should be made at splclock().
- */
-NON_LEAF(remrunqueue, STAND_FRAME_SIZE, ra)
- subu sp, sp, STAND_FRAME_SIZE
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
- lbu t0, P_PRIORITY(a0) # get from p->p_priority / 4 queue
- li t1, 1 # compute corresponding bit
- srl t0, t0, 2 # compute index into 'whichqs'
- lw t2, whichqs # check corresponding bit
- sll t1, t1, t0
- and v0, t2, t1
- sw ra, STAND_RA_OFFSET(sp) ##
- bne v0, zero, 1f ##
- lw v0, P_BACK(a0) # v0 = p->p_back
- PANIC("remrunqueue") ## it wasnt recorded to be on its q
-1:
- lw v1, P_FORW(a0) # v1 = p->p_forw
- nop
- sw v1, P_FORW(v0) # p->p_back->p_forw = p->p_forw;
- sw v0, P_BACK(v1) # p->p_forw->p_back = p->r_rlink
- sll t0, t0, 3 # compute index into 'qs'
- la v0, qs
- addu t0, t0, v0 # t0 = qp = &qs[pri >> 2]
- lw v0, P_FORW(t0) # check if queue empty
- nop
- bne v0, t0, 2f # No. qp->ph_link != qp
- nop
- xor t2, t2, t1 # clear corresponding bit in 'whichqs'
- sw t2, whichqs
-2:
- sw zero, P_BACK(a0) ## for firewall checking
- j ra
- addu sp, sp, STAND_FRAME_SIZE
-END(remrunqueue)
-
-/*
- * switch_exit()
- *
- * At exit of a process, do a cpu_switch for the last time.
- * The mapping of the pcb at p->p_addr has already been deleted,
- * and the memory for the pcb+stack has been freed.
- * All interrupts should be blocked at this point.
- */
-LEAF(switch_exit)
- la v1, nullproc # save state into garbage proc
- lw t0, P_UPTE+0(v1) # t0 = first u. pte
- lw t1, P_UPTE+4(v1) # t1 = 2nd u. pte
- li v0, UADDR # v0 = first HI entry
- mtc0 zero, COP_0_TLB_INDEX # set the index register
- dmtc0 v0, COP_0_TLB_HI # init high entry
- dmtc0 t0, COP_0_TLB_LO0 # init low entry0
- dmtc0 t1, COP_0_TLB_LO1 # init low entry1
- nop
- tlbwi # Write the TLB entry.
- nop
- nop
- sw zero, curproc
- b cpu_switch
- li sp, KERNELSTACK - START_FRAME # switch to standard stack
-END(switch_exit)
-
-/*
- * When no processes are on the runq, cpu_switch branches to idle
- * to wait for something to come ready.
- * Note: this is really a part of cpu_switch() but defined here for kernel
- * profiling.
- */
-LEAF(idle)
- li t0, (INT_MASK | SR_INT_ENAB)
- mtc0 t0, COP_0_STATUS_REG # enable all interrupts
- sw zero, curproc # set curproc NULL for stats
- li t1,1
-1:
- beq t1, zero, 2f
- addu t1, t1, 1
- lw t0, whichqs # look for non-empty queue
- nop
- beq t0, zero, 1b
- nop
- b sw1
- mtc0 zero, COP_0_STATUS_REG # Disable all interrupts
-2:
- break BREAK_SOVER_VAL
- b 1b
- nop
-END(idle)
-
-/*
- * cpu_switch()
- * Find the highest priority process and resume it.
- */
-NON_LEAF(cpu_switch, STAND_FRAME_SIZE, ra)
- sw sp, UADDR+U_PCB_CONTEXT+32 # save old sp
- subu sp, sp, STAND_FRAME_SIZE
- sw ra, STAND_RA_OFFSET(sp)
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
- lw t2, cnt+V_SWTCH # for statistics
- lw t1, whichqs # look for non-empty queue
- sw s0, UADDR+U_PCB_CONTEXT+0 # do a 'savectx()'
- sw s1, UADDR+U_PCB_CONTEXT+4
- sw s2, UADDR+U_PCB_CONTEXT+8
- sw s3, UADDR+U_PCB_CONTEXT+12
- mfc0 t0, COP_0_STATUS_REG # t0 = saved status register
- sw s4, UADDR+U_PCB_CONTEXT+16
- sw s5, UADDR+U_PCB_CONTEXT+20
- sw s6, UADDR+U_PCB_CONTEXT+24
- sw s7, UADDR+U_PCB_CONTEXT+28
- sw s8, UADDR+U_PCB_CONTEXT+36
- sw ra, UADDR+U_PCB_CONTEXT+40 # save return address
- sw t0, UADDR+U_PCB_CONTEXT+44 # save status register
- addu t2, t2, 1
- sw t2, cnt+V_SWTCH
- beq t1, zero, idle # if none, idle
- mtc0 zero, COP_0_STATUS_REG # Disable all interrupts
-sw1:
- nop # wait for intrs disabled
- nop
- nop
- nop
- lw t0, whichqs # look for non-empty queue
- li t2, -1 # t2 = lowest bit set
- beq t0, zero, idle # if none, idle
- move t3, t0 # t3 = saved whichqs
-1:
- addu t2, t2, 1
- and t1, t0, 1 # bit set?
- beq t1, zero, 1b
- srl t0, t0, 1 # try next bit
-/*
- * Remove process from queue.
- */
- sll t0, t2, 3
- la t1, qs
- addu t0, t0, t1 # t0 = qp = &qs[highbit]
- lw a0, P_FORW(t0) # a0 = p = highest pri process
- nop
- lw v0, P_FORW(a0) # v0 = p->p_forw
- bne t0, a0, 2f # make sure something in queue
- sw v0, P_FORW(t0) # qp->ph_link = p->p_forw;
- PANIC("cpu_switch") # nothing in queue
-2:
- sw t0, P_BACK(v0) # p->p_forw->p_back = qp
- bne v0, t0, 3f # queue still not empty
- sw zero, P_BACK(a0) ## for firewall checking
- li v1, 1 # compute bit in 'whichqs'
- sll v1, v1, t2
- xor t3, t3, v1 # clear bit in 'whichqs'
- sw t3, whichqs
-3:
-/*
- * Switch to new context.
- */
- sw zero, want_resched
- jal pmap_alloc_tlbpid # v0 = TLB PID
- move s0, a0 # BDSLOT: save p
- sw s0, curproc # set curproc
- lw t0, P_UPTE+0(s0) # t0 = first u. pte
- lw t1, P_UPTE+4(s0) # t1 = 2nd u. pte
- or v0, v0, UADDR # v0 = first HI entry
-/*
- * Resume process indicated by the pte's for its u struct
- * NOTE: This is hard coded to UPAGES == 2.
- * Also, there should be no TLB faults at this point.
- */
- mtc0 zero, COP_0_TLB_INDEX # set the index register
- dmtc0 v0, COP_0_TLB_HI # init high entry
- dmtc0 t0, COP_0_TLB_LO0 # init low entry0
- dmtc0 t1, COP_0_TLB_LO1 # init low entry1
- nop
- tlbwi # Write the TLB entry.
- nop # Delay for effect
- nop # Delay for effect
- nop
- nop
-/*
- * Now running on new u struct.
- * Restore registers and return.
- */
- lw v0, UADDR+U_PCB_CONTEXT+44 # restore kernel context
- lw ra, UADDR+U_PCB_CONTEXT+40
- lw s0, UADDR+U_PCB_CONTEXT+0
- lw s1, UADDR+U_PCB_CONTEXT+4
- lw s2, UADDR+U_PCB_CONTEXT+8
- lw s3, UADDR+U_PCB_CONTEXT+12
- lw s4, UADDR+U_PCB_CONTEXT+16
- lw s5, UADDR+U_PCB_CONTEXT+20
- lw s6, UADDR+U_PCB_CONTEXT+24
- lw s7, UADDR+U_PCB_CONTEXT+28
- lw sp, UADDR+U_PCB_CONTEXT+32
- lw s8, UADDR+U_PCB_CONTEXT+36
- mtc0 v0, COP_0_STATUS_REG
- j ra
- li v0, 1 # possible return to 'savectx()'
-END(cpu_switch)
-
-/*
- * {fu,su},{ibyte,isword,iword}, fetch or store a byte, short or word to
- * user text space.
- * {fu,su},{byte,sword,word}, fetch or store a byte, short or word to
- * user data space.
- */
-LEAF(fuword)
-ALEAF(fuiword)
- blt a0, zero, fswberr # make sure address is in user space
- li v0, FSWBERR
- sw v0, UADDR+U_PCB_ONFAULT
- lw v0, 0(a0) # fetch word
- j ra
- sw zero, UADDR+U_PCB_ONFAULT
-END(fuword)
-
-LEAF(fusword)
-ALEAF(fuisword)
- blt a0, zero, fswberr # make sure address is in user space
- li v0, FSWBERR
- sw v0, UADDR+U_PCB_ONFAULT
- lhu v0, 0(a0) # fetch short
- j ra
- sw zero, UADDR+U_PCB_ONFAULT
-END(fusword)
-
-LEAF(fubyte)
-ALEAF(fuibyte)
- blt a0, zero, fswberr # make sure address is in user space
- li v0, FSWBERR
- sw v0, UADDR+U_PCB_ONFAULT
- lbu v0, 0(a0) # fetch byte
- j ra
- sw zero, UADDR+U_PCB_ONFAULT
-END(fubyte)
-
-LEAF(suword)
- blt a0, zero, fswberr # make sure address is in user space
- li v0, FSWBERR
- sw v0, UADDR+U_PCB_ONFAULT
- sw a1, 0(a0) # store word
- sw zero, UADDR+U_PCB_ONFAULT
- j ra
- move v0, zero
-END(suword)
-
-/*
- * Have to flush instruction cache afterwards.
- */
-LEAF(suiword)
- blt a0, zero, fswberr # make sure address is in user space
- li v0, FSWBERR
- sw v0, UADDR+U_PCB_ONFAULT
- sw a1, 0(a0) # store word
- sw zero, UADDR+U_PCB_ONFAULT
- b R4K_FlushICache # FlushICache sets v0 = 0. (Ugly)
- li a1, 4 # size of word
-END(suiword)
-
-/*
- * Will have to flush the instruction cache if byte merging is done in hardware.
- */
-LEAF(susword)
-ALEAF(suisword)
- blt a0, zero, fswberr # make sure address is in user space
- li v0, FSWBERR
- sw v0, UADDR+U_PCB_ONFAULT
- sh a1, 0(a0) # store short
- sw zero, UADDR+U_PCB_ONFAULT
- j ra
- move v0, zero
-END(susword)
-
-LEAF(subyte)
-ALEAF(suibyte)
- blt a0, zero, fswberr # make sure address is in user space
- li v0, FSWBERR
- sw v0, UADDR+U_PCB_ONFAULT
- sb a1, 0(a0) # store byte
- sw zero, UADDR+U_PCB_ONFAULT
- j ra
- move v0, zero
-END(subyte)
-
-LEAF(fswberr)
- j ra
- li v0, -1
-END(fswberr)
-
-/*
- * fuswintr and suswintr are just like fusword and susword except that if
- * the page is not in memory or would cause a trap, then we return an error.
- * The important thing is to prevent sleep() and switch().
- */
-LEAF(fuswintr)
- blt a0, zero, fswintrberr # make sure address is in user space
- li v0, FSWINTRBERR
- sw v0, UADDR+U_PCB_ONFAULT
- lhu v0, 0(a0) # fetch short
- j ra
- sw zero, UADDR+U_PCB_ONFAULT
-END(fuswintr)
-
-LEAF(suswintr)
- blt a0, zero, fswintrberr # make sure address is in user space
- li v0, FSWINTRBERR
- sw v0, UADDR+U_PCB_ONFAULT
- sh a1, 0(a0) # store short
- sw zero, UADDR+U_PCB_ONFAULT
- j ra
- move v0, zero
-END(suswintr)
-
-LEAF(fswintrberr)
- j ra
- li v0, -1
-END(fswintrberr)
-
-/*
- * Insert 'p' after 'q'.
- * _insque(p, q)
- * caddr_t p, q;
- */
-LEAF(_insque)
- lw v0, 0(a1) # v0 = q->next
- sw a1, 4(a0) # p->prev = q
- sw v0, 0(a0) # p->next = q->next
- sw a0, 4(v0) # q->next->prev = p
- j ra
- sw a0, 0(a1) # q->next = p
-END(_insque)
-
-/*
- * Remove item 'p' from queue.
- * _remque(p)
- * caddr_t p;
- */
-LEAF(_remque)
- lw v0, 0(a0) # v0 = p->next
- lw v1, 4(a0) # v1 = p->prev
- nop
- sw v0, 0(v1) # p->prev->next = p->next
- j ra
- sw v1, 4(v0) # p->next->prev = p->prev
-END(_remque)
-
-/*
- * This code is copied to the TLB exception vector address to
- * handle TLB translation misses.
- * NOTE: This code must be relocatable and max 32 instructions!!!
- * Don't check for invalid pte's here. We load them as well and
- * let the processor trap to load the correct value after service.
- */
- .globl MipsTLBMiss
-MipsTLBMiss:
- .set noat
- dmfc0 k0, COP_0_BAD_VADDR # get the virtual address
- lw k1, UADDR+U_PCB_SEGTAB # get the current segment table
- bltz k0, 1f # kernel address space ->
- srl k0, k0, SEGSHIFT - 2 # compute segment table index
- andi k0, k0, 0x7fc # PMAP_SEGTABSIZ-1
- addu k1, k1, k0
- dmfc0 k0, COP_0_BAD_VADDR # get the virtual address
- lw k1, 0(k1) # get pointer to segment map
- srl k0, k0, PGSHIFT - 2 # compute segment map index
- andi k0, k0, ((NPTEPG/2) - 1) << 3
- beq k1, zero, 2f # invalid segment map
- addu k1, k1, k0 # index into segment map
- lw k0, 0(k1) # get page PTE
- lw k1, 4(k1)
- dsll k0, k0, 34
- dsrl k0, k0, 34
- dmtc0 k0, COP_0_TLB_LO0
- dsll k1, k1, 34
- dsrl k1, k1, 34
- dmtc0 k1, COP_0_TLB_LO1
- nop
- tlbwr # update TLB
- nop
- nop
- nop
- nop
- nop
- eret
-1:
- j MipsTLBMissException
- nop
-2:
- j SlowFault
- nop
-
- .globl MipsTLBMissEnd
-MipsTLBMissEnd:
- .set at
-
-/*
- * This code is copied to the general exception vector address to
- * handle all execptions except RESET and TLBMiss.
- * NOTE: This code must be relocatable!!!
- */
- .globl MipsException
-MipsException:
-/*
- * Find out what mode we came from and jump to the proper handler.
- */
- .set noat
- mfc0 k0, COP_0_STATUS_REG # Get the status register
- mfc0 k1, COP_0_CAUSE_REG # Get the cause register value.
- and k0, k0, SR_KSU_USER # test for user mode
- # sneaky but the bits are
- # with us........
- sll k0, k0, 3 # shift user bit for cause index
- and k1, k1, CR_EXC_CODE # Mask out the cause bits.
- or k1, k1, k0 # change index to user table
-1:
- la k0, machExceptionTable # get base of the jump table
- addu k0, k0, k1 # Get the address of the
- # function entry. Note that
- # the cause is already
- # shifted left by 2 bits so
- # we dont have to shift.
- lw k0, 0(k0) # Get the function address
- nop
- j k0 # Jump to the function.
- nop
- .set at
- .globl MipsExceptionEnd
-MipsExceptionEnd:
-
-/*
- * We couldn't find a TLB entry.
- * Find out what mode we came from and call the appropriate handler.
- */
-SlowFault:
- .set noat
- mfc0 k0, COP_0_STATUS_REG
- nop
- and k0, k0, SR_KSU_USER
- bne k0, zero, MipsUserGenException
- nop
- .set at
-/*
- * Fall though ...
- */
-
-/*----------------------------------------------------------------------------
- *
- * MipsKernGenException --
- *
- * Handle an exception from kernel mode.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-#ifndef MIPS_ISAIII
-#define STORE sw /* 32 bit mode regsave instruction */
-#define LOAD lw /* 32 bit mode regload instruction */
-#define RSIZE 4 /* 32 bit mode register size */
-#else
-#define STORE sd /* 64 bit mode regsave instruction */
-#define STORE ld /* 64 bit mode regload instruction */
-#define RSIZE 8 /* 64 bit mode register size */
-#endif
-
-#define SAVE_REG(reg, offs, base) \
- STORE reg, STAND_ARG_SIZE + (RSIZE * offs) (base)
-
-#define SAVE_CPU \
- SAVE_REG(AT, AST, sp) ;\
- SAVE_REG(v0, V0, sp) ;\
- SAVE_REG(v1, V1, sp) ;\
- mflo v0 ;\
- mfhi v1 ;\
- SAVE_REG(a0, A0, sp) ;\
- SAVE_REG(a1, A1, sp) ;\
- SAVE_REG(a2, A2, sp) ;\
- SAVE_REG(a3, A3, sp) ;\
- mfc0 a0, COP_0_STATUS_REG ;\
- mfc0 a1, COP_0_CAUSE_REG ;\
- mfc0 a2, COP_0_BAD_VADDR ;\
- mfc0 a3, COP_0_EXC_PC ;\
- SAVE_REG(t0, T0, sp) ;\
- SAVE_REG(t1, T1, sp) ;\
- SAVE_REG(t2, T2, sp) ;\
- SAVE_REG(t3, T3, sp) ;\
- SAVE_REG(t4, T4, sp) ;\
- SAVE_REG(t5, T5, sp) ;\
- SAVE_REG(t6, T6, sp) ;\
- SAVE_REG(t7, T7, sp) ;\
- SAVE_REG(t8, T8, sp) ;\
- SAVE_REG(t9, T9, sp) ;\
- SAVE_REG(v0, MULLO, sp) ;\
- SAVE_REG(v1, MULHI, sp) ;\
- SAVE_REG(a0, SR, sp) ;\
- SAVE_REG(a1, CAUSE, sp) ;\
- SAVE_REG(ra, RA, sp) ;\
- SAVE_REG(a2, BADVADDR, sp) ;\
- SAVE_REG(a3, PC, sp) ;\
- addu v0, sp, KERN_EXC_FRAME_SIZE ;\
- SAVE_REG(v0, SP, sp) ;\
- mtc0 zero,COP_0_STATUS_REG
-
-#ifdef DDB
-#define SAVE_CPU_DDB \
- SAVE_REG(s0, S0, sp) ;\
- SAVE_REG(s1, S1, sp) ;\
- SAVE_REG(s2, S2, sp) ;\
- SAVE_REG(s3, S3, sp) ;\
- SAVE_REG(s4, S4, sp) ;\
- SAVE_REG(s5, S5, sp) ;\
- SAVE_REG(s6, S6, sp) ;\
- SAVE_REG(s7, S7, sp) ;\
- SAVE_REG(s8, S8, sp)
-#else
-#define SAVE_CPU_DDB
-#endif
-
-#define RESTORE_REG(reg, offs, base) \
- LOAD reg, STAND_ARG_SIZE + (RSIZE * offs) (base)
-
-#define RESTORE_CPU \
- mtc0 zero,COP_0_STATUS_REG ;\
- RESTORE_REG(a0, SR, sp) ;\
- RESTORE_REG(t0, MULLO, sp) ;\
- RESTORE_REG(t1, MULHI, sp) ;\
- mtc0 a0, COP_0_STATUS_REG ;\
- mtlo t0 ;\
- mthi t1 ;\
- dmtc0 v0, COP_0_EXC_PC ;\
- RESTORE_REG(AT, AST, sp) ;\
- RESTORE_REG(v0, V0, sp) ;\
- RESTORE_REG(v1, V1, sp) ;\
- RESTORE_REG(a0, A0, sp) ;\
- RESTORE_REG(a1, A1, sp) ;\
- RESTORE_REG(a2, A2, sp) ;\
- RESTORE_REG(a3, A3, sp) ;\
- RESTORE_REG(t0, T0, sp) ;\
- RESTORE_REG(t1, T1, sp) ;\
- RESTORE_REG(t2, T2, sp) ;\
- RESTORE_REG(t3, T3, sp) ;\
- RESTORE_REG(t4, T4, sp) ;\
- RESTORE_REG(t5, T5, sp) ;\
- RESTORE_REG(t6, T6, sp) ;\
- RESTORE_REG(t7, T7, sp) ;\
- RESTORE_REG(t8, T8, sp) ;\
- RESTORE_REG(t9, T9, sp) ;\
- RESTORE_REG(ra, RA, sp) ;\
- addu sp, sp, KERN_EXC_FRAME_SIZE
-
-/*
- * The kernel exception stack contains 18 saved general registers,
- * the status register and the multiply lo and high registers.
- * In addition, we set this up for linkage conventions.
- */
-#define KERN_REG_SIZE (NUMSAVEREGS * RSIZE)
-#define KERN_EXC_FRAME_SIZE (STAND_FRAME_SIZE + KERN_REG_SIZE + 16)
-
-NNON_LEAF(MipsKernGenException, KERN_EXC_FRAME_SIZE, ra)
- .set noat
- subu sp, sp, KERN_EXC_FRAME_SIZE
- .mask 0x80000000, (STAND_RA_OFFSET - KERN_EXC_FRAME_SIZE)
-/*
- * Save CPU state, building 'frame'.
- */
- SAVE_CPU
- SAVE_CPU_DDB
-/*
- * Call the exception handler.
- */
- jal trap
- sw a3, STAND_RA_OFFSET + KERN_REG_SIZE(sp) # for debugging
-/*
- * Restore registers and return from the exception.
- * v0 contains the return address.
- */
- RESTORE_CPU
- eret # exception.
- .set at
-END(MipsKernGenException)
-
-/*----------------------------------------------------------------------------
- *
- * MipsUserGenException --
- *
- * Handle an exception from user mode.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-NNON_LEAF(MipsUserGenException, STAND_FRAME_SIZE, ra)
- .set noat
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
-/*
- * Save all of the registers except for the kernel temporaries in u.u_pcb.
- */
- sw AT, UADDR+U_PCB_REGS+(AST * 4)
- sw v0, UADDR+U_PCB_REGS+(V0 * 4)
- sw v1, UADDR+U_PCB_REGS+(V1 * 4)
- sw a0, UADDR+U_PCB_REGS+(A0 * 4)
- mflo v0
- sw a1, UADDR+U_PCB_REGS+(A1 * 4)
- sw a2, UADDR+U_PCB_REGS+(A2 * 4)
- sw a3, UADDR+U_PCB_REGS+(A3 * 4)
- sw t0, UADDR+U_PCB_REGS+(T0 * 4)
- mfhi v1
- sw t1, UADDR+U_PCB_REGS+(T1 * 4)
- sw t2, UADDR+U_PCB_REGS+(T2 * 4)
- sw t3, UADDR+U_PCB_REGS+(T3 * 4)
- sw t4, UADDR+U_PCB_REGS+(T4 * 4)
- mfc0 a0, COP_0_STATUS_REG # First arg is the status reg.
- sw t5, UADDR+U_PCB_REGS+(T5 * 4)
- sw t6, UADDR+U_PCB_REGS+(T6 * 4)
- sw t7, UADDR+U_PCB_REGS+(T7 * 4)
- sw s0, UADDR+U_PCB_REGS+(S0 * 4)
- mfc0 a1, COP_0_CAUSE_REG # Second arg is the cause reg.
- sw s1, UADDR+U_PCB_REGS+(S1 * 4)
- sw s2, UADDR+U_PCB_REGS+(S2 * 4)
- sw s3, UADDR+U_PCB_REGS+(S3 * 4)
- sw s4, UADDR+U_PCB_REGS+(S4 * 4)
- mfc0 a2, COP_0_BAD_VADDR # Third arg is the fault addr
- sw s5, UADDR+U_PCB_REGS+(S5 * 4)
- sw s6, UADDR+U_PCB_REGS+(S6 * 4)
- sw s7, UADDR+U_PCB_REGS+(S7 * 4)
- sw t8, UADDR+U_PCB_REGS+(T8 * 4)
- mfc0 a3, COP_0_EXC_PC # Fourth arg is the pc.
- sw t9, UADDR+U_PCB_REGS+(T9 * 4)
- sw gp, UADDR+U_PCB_REGS+(GP * 4)
- sw sp, UADDR+U_PCB_REGS+(SP * 4)
- sw s8, UADDR+U_PCB_REGS+(S8 * 4)
- li sp, KERNELSTACK - STAND_FRAME_SIZE # switch to kernel SP
- sw ra, UADDR+U_PCB_REGS+(RA * 4)
- sw v0, UADDR+U_PCB_REGS+(MULLO * 4)
- sw v1, UADDR+U_PCB_REGS+(MULHI * 4)
- sw a0, UADDR+U_PCB_REGS+(SR * 4)
- la gp, _gp # switch to kernel GP
- sw a3, UADDR+U_PCB_REGS+(PC * 4)
- sw a3, STAND_RA_OFFSET(sp) # for debugging
- .set at
-# Turn off fpu and enter kernel mode
- and t0, a0, ~(SR_COP_1_BIT | SR_EXL | SR_KSU_MASK | SR_INT_ENAB)
- .set noat
-/*
- * Call the exception handler.
- */
- jal trap
- mtc0 t0, COP_0_STATUS_REG
-/*
- * Restore user registers and return.
- * First disable interrupts and set exeption level.
- */
- mtc0 zero, COP_0_STATUS_REG # disable int
- nop
- nop
- nop
- li v0, SR_EXL
- mtc0 v0, COP_0_STATUS_REG # set exeption level
-
- lw a0, UADDR+U_PCB_REGS+(SR * 4)
- lw t0, UADDR+U_PCB_REGS+(MULLO * 4)
- lw t1, UADDR+U_PCB_REGS+(MULHI * 4)
- mtc0 a0, COP_0_STATUS_REG # still exeption level
- mtlo t0
- mthi t1
- lw a0, UADDR+U_PCB_REGS+(PC * 4)
- lw AT, UADDR+U_PCB_REGS+(AST * 4)
- lw v0, UADDR+U_PCB_REGS+(V0 * 4)
- dmtc0 a0, COP_0_EXC_PC # set return address
- lw v1, UADDR+U_PCB_REGS+(V1 * 4)
- lw a0, UADDR+U_PCB_REGS+(A0 * 4)
- lw a1, UADDR+U_PCB_REGS+(A1 * 4)
- lw a2, UADDR+U_PCB_REGS+(A2 * 4)
- lw a3, UADDR+U_PCB_REGS+(A3 * 4)
- lw t0, UADDR+U_PCB_REGS+(T0 * 4)
- lw t1, UADDR+U_PCB_REGS+(T1 * 4)
- lw t2, UADDR+U_PCB_REGS+(T2 * 4)
- lw t3, UADDR+U_PCB_REGS+(T3 * 4)
- lw t4, UADDR+U_PCB_REGS+(T4 * 4)
- lw t5, UADDR+U_PCB_REGS+(T5 * 4)
- lw t6, UADDR+U_PCB_REGS+(T6 * 4)
- lw t7, UADDR+U_PCB_REGS+(T7 * 4)
- lw s0, UADDR+U_PCB_REGS+(S0 * 4)
- lw s1, UADDR+U_PCB_REGS+(S1 * 4)
- lw s2, UADDR+U_PCB_REGS+(S2 * 4)
- lw s3, UADDR+U_PCB_REGS+(S3 * 4)
- lw s4, UADDR+U_PCB_REGS+(S4 * 4)
- lw s5, UADDR+U_PCB_REGS+(S5 * 4)
- lw s6, UADDR+U_PCB_REGS+(S6 * 4)
- lw s7, UADDR+U_PCB_REGS+(S7 * 4)
- lw t8, UADDR+U_PCB_REGS+(T8 * 4)
- lw t9, UADDR+U_PCB_REGS+(T9 * 4)
- lw gp, UADDR+U_PCB_REGS+(GP * 4)
- lw sp, UADDR+U_PCB_REGS+(SP * 4)
- lw s8, UADDR+U_PCB_REGS+(S8 * 4)
- lw ra, UADDR+U_PCB_REGS+(RA * 4)
- eret
- .set at
-END(MipsUserGenException)
-
-/*----------------------------------------------------------------------------
- *
- * MipsKernIntr --
- *
- * Handle an interrupt from kernel mode.
- * Interrupts use the standard kernel stack.
- * switch_exit sets up a kernel stack after exit so interrupts won't fail.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-
-NNON_LEAF(MipsKernIntr, KERN_EXC_FRAME_SIZE, ra)
- .set noat
- subu sp, sp, KERN_EXC_FRAME_SIZE
- .mask 0x80000000, (STAND_RA_OFFSET - KERN_EXC_FRAME_SIZE)
-/*
- * Save the relevant kernel registers onto the stack.
- * We don't need to save s0 - s8, sp and gp because
- * the compiler does it for us.
- */
- SAVE_CPU
-/*
- * Call the interrupt handler.
- */
- jal interrupt
- sw a3, STAND_RA_OFFSET + KERN_REG_SIZE(sp)
-/*
- * Restore registers and return from the interrupt.
- */
- lw v0, STAND_RA_OFFSET + KERN_REG_SIZE(sp)
- RESTORE_CPU
- eret
- .set at
-END(MipsKernIntr)
-
-/*----------------------------------------------------------------------------
- *
- * MipsUserIntr --
- *
- * Handle an interrupt from user mode.
- * Note: we save minimal state in the u.u_pcb struct and use the standard
- * kernel stack since there has to be a u page if we came from user mode.
- * If there is a pending software interrupt, then save the remaining state
- * and call softintr(). This is all because if we call switch() inside
- * interrupt(), not all the user registers have been saved in u.u_pcb.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-NNON_LEAF(MipsUserIntr, STAND_FRAME_SIZE, ra)
- .set noat
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
-/*
- * Save the relevant user registers into the u.u_pcb struct.
- * We don't need to save s0 - s8 because the compiler does it for us.
- */
- sw AT, UADDR+U_PCB_REGS+(AST * 4)
- sw v0, UADDR+U_PCB_REGS+(V0 * 4)
- sw v1, UADDR+U_PCB_REGS+(V1 * 4)
- sw a0, UADDR+U_PCB_REGS+(A0 * 4)
- mflo v0
- mfhi v1
- sw a1, UADDR+U_PCB_REGS+(A1 * 4)
- sw a2, UADDR+U_PCB_REGS+(A2 * 4)
- sw a3, UADDR+U_PCB_REGS+(A3 * 4)
- sw t0, UADDR+U_PCB_REGS+(T0 * 4)
- mfc0 a0, COP_0_STATUS_REG # First arg is the status reg.
- sw t1, UADDR+U_PCB_REGS+(T1 * 4)
- sw t2, UADDR+U_PCB_REGS+(T2 * 4)
- sw t3, UADDR+U_PCB_REGS+(T3 * 4)
- sw t4, UADDR+U_PCB_REGS+(T4 * 4)
- mfc0 a1, COP_0_CAUSE_REG # Second arg is the cause reg.
- sw t5, UADDR+U_PCB_REGS+(T5 * 4)
- sw t6, UADDR+U_PCB_REGS+(T6 * 4)
- sw t7, UADDR+U_PCB_REGS+(T7 * 4)
- sw t8, UADDR+U_PCB_REGS+(T8 * 4)
- mfc0 a3, COP_0_EXC_PC # Fourth arg is the pc.
- sw t9, UADDR+U_PCB_REGS+(T9 * 4)
- sw gp, UADDR+U_PCB_REGS+(GP * 4)
- sw sp, UADDR+U_PCB_REGS+(SP * 4)
- sw ra, UADDR+U_PCB_REGS+(RA * 4)
- li sp, KERNELSTACK - STAND_FRAME_SIZE # switch to kernel SP
- sw v0, UADDR+U_PCB_REGS+(MULLO * 4)
- sw v1, UADDR+U_PCB_REGS+(MULHI * 4)
- sw a0, UADDR+U_PCB_REGS+(SR * 4)
- sw a3, UADDR+U_PCB_REGS+(PC * 4)
- la gp, _gp # switch to kernel GP
-# Turn off fpu and enter kernel mode
- .set at
- and t0, a0, ~(SR_COP_1_BIT | SR_EXL | SR_INT_ENAB | SR_KSU_MASK)
- .set noat
- mtc0 t0, COP_0_STATUS_REG
-/*
- * Call the interrupt handler.
- */
- jal interrupt
- sw a3, STAND_RA_OFFSET(sp) # for debugging
-/*
- * Restore registers and return from the interrupt.
- */
- mtc0 zero, COP_0_STATUS_REG
- nop
- nop
- nop
- li v0, SR_EXL
- mtc0 v0, COP_0_STATUS_REG # set exeption level bit.
-
- lw a0, UADDR+U_PCB_REGS+(SR * 4)
- lw v0, astpending # any pending interrupts?
- mtc0 a0, COP_0_STATUS_REG # Restore the SR, disable intrs
- bne v0, zero, 1f # dont restore, call softintr
- lw t0, UADDR+U_PCB_REGS+(MULLO * 4)
- lw t1, UADDR+U_PCB_REGS+(MULHI * 4)
- lw a0, UADDR+U_PCB_REGS+(PC * 4)
- lw AT, UADDR+U_PCB_REGS+(AST * 4)
- lw v0, UADDR+U_PCB_REGS+(V0 * 4)
- dmtc0 a0, COP_0_EXC_PC # set return address
- lw v1, UADDR+U_PCB_REGS+(V1 * 4)
- lw a0, UADDR+U_PCB_REGS+(A0 * 4)
- lw a1, UADDR+U_PCB_REGS+(A1 * 4)
- lw a2, UADDR+U_PCB_REGS+(A2 * 4)
- lw a3, UADDR+U_PCB_REGS+(A3 * 4)
- mtlo t0
- mthi t1
- lw t0, UADDR+U_PCB_REGS+(T0 * 4)
- lw t1, UADDR+U_PCB_REGS+(T1 * 4)
- lw t2, UADDR+U_PCB_REGS+(T2 * 4)
- lw t3, UADDR+U_PCB_REGS+(T3 * 4)
- lw t4, UADDR+U_PCB_REGS+(T4 * 4)
- lw t5, UADDR+U_PCB_REGS+(T5 * 4)
- lw t6, UADDR+U_PCB_REGS+(T6 * 4)
- lw t7, UADDR+U_PCB_REGS+(T7 * 4)
- lw t8, UADDR+U_PCB_REGS+(T8 * 4)
- lw t9, UADDR+U_PCB_REGS+(T9 * 4)
- lw gp, UADDR+U_PCB_REGS+(GP * 4)
- lw sp, UADDR+U_PCB_REGS+(SP * 4)
- lw ra, UADDR+U_PCB_REGS+(RA * 4)
- eret # interrupt.
-
-1:
-/*
- * We have pending software interrupts; save remaining user state in u.u_pcb.
- */
- sw s0, UADDR+U_PCB_REGS+(S0 * 4)
- sw s1, UADDR+U_PCB_REGS+(S1 * 4)
- sw s2, UADDR+U_PCB_REGS+(S2 * 4)
- sw s3, UADDR+U_PCB_REGS+(S3 * 4)
- sw s4, UADDR+U_PCB_REGS+(S4 * 4)
- sw s5, UADDR+U_PCB_REGS+(S5 * 4)
- sw s6, UADDR+U_PCB_REGS+(S6 * 4)
- sw s7, UADDR+U_PCB_REGS+(S7 * 4)
- sw s8, UADDR+U_PCB_REGS+(S8 * 4)
- li t0, HARD_INT_MASK | SR_INT_ENAB
-/*
- * Call the software interrupt handler.
- */
- jal softintr
- mtc0 t0, COP_0_STATUS_REG # enable interrupts (spl0)
-/*
- * Restore user registers and return. NOTE: interrupts are enabled.
- */
- mtc0 zero, COP_0_STATUS_REG
- nop
- nop
- nop
- li v0, SR_EXL
- mtc0 v0, COP_0_STATUS_REG # set exeption level bit.
-
- lw a0, UADDR+U_PCB_REGS+(SR * 4)
- lw t0, UADDR+U_PCB_REGS+(MULLO * 4)
- lw t1, UADDR+U_PCB_REGS+(MULHI * 4)
- mtc0 a0, COP_0_STATUS_REG # this should disable interrupts
- mtlo t0
- mthi t1
- lw a0, UADDR+U_PCB_REGS+(PC * 4)
- lw AT, UADDR+U_PCB_REGS+(AST * 4)
- lw v0, UADDR+U_PCB_REGS+(V0 * 4)
- dmtc0 a0, COP_0_EXC_PC # set return address
- lw v1, UADDR+U_PCB_REGS+(V1 * 4)
- lw a0, UADDR+U_PCB_REGS+(A0 * 4)
- lw a1, UADDR+U_PCB_REGS+(A1 * 4)
- lw a2, UADDR+U_PCB_REGS+(A2 * 4)
- lw a3, UADDR+U_PCB_REGS+(A3 * 4)
- lw t0, UADDR+U_PCB_REGS+(T0 * 4)
- lw t1, UADDR+U_PCB_REGS+(T1 * 4)
- lw t2, UADDR+U_PCB_REGS+(T2 * 4)
- lw t3, UADDR+U_PCB_REGS+(T3 * 4)
- lw t4, UADDR+U_PCB_REGS+(T4 * 4)
- lw t5, UADDR+U_PCB_REGS+(T5 * 4)
- lw t6, UADDR+U_PCB_REGS+(T6 * 4)
- lw t7, UADDR+U_PCB_REGS+(T7 * 4)
- lw s0, UADDR+U_PCB_REGS+(S0 * 4)
- lw s1, UADDR+U_PCB_REGS+(S1 * 4)
- lw s2, UADDR+U_PCB_REGS+(S2 * 4)
- lw s3, UADDR+U_PCB_REGS+(S3 * 4)
- lw s4, UADDR+U_PCB_REGS+(S4 * 4)
- lw s5, UADDR+U_PCB_REGS+(S5 * 4)
- lw s6, UADDR+U_PCB_REGS+(S6 * 4)
- lw s7, UADDR+U_PCB_REGS+(S7 * 4)
- lw t8, UADDR+U_PCB_REGS+(T8 * 4)
- lw t9, UADDR+U_PCB_REGS+(T9 * 4)
- lw gp, UADDR+U_PCB_REGS+(GP * 4)
- lw sp, UADDR+U_PCB_REGS+(SP * 4)
- lw s8, UADDR+U_PCB_REGS+(S8 * 4)
- lw ra, UADDR+U_PCB_REGS+(RA * 4)
- eret
- .set at
-END(MipsUserIntr)
-
-/*----------------------------------------------------------------------------
- *
- * MipsTLBInvalidException --
- *
- * Handle a TLB invalid exception from kernel mode in kernel space.
- * The BaddVAddr, Context, and EntryHi registers contain the failed
- * virtual address.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-NLEAF(MipsTLBInvalidException)
- .set noat
- dmfc0 k0, COP_0_BAD_VADDR # get the fault address
- li k1, (VM_MIN_KERNEL_ADDRESS) # compute index
- subu k0, k0, k1
- lw k1, Sysmapsize # index within range?
- srl k0, k0, PGSHIFT
- sltu k1, k0, k1
- beq k1, zero, sys_stk_chk # No. check for valid stack
- lw k1, Sysmap
-
- sll k0, k0, 2 # compute offset from index
- tlbp # Probe the invalid entry
- addu k1, k1, k0
- and k0, k0, 4 # check even/odd page
- bne k0, zero, KernTLBIOdd
- nop
-
- mfc0 k0, COP_0_TLB_INDEX
- nop
- bltz k0, sys_stk_chk
- sltiu k0, k0, 8
-
- bne k0, zero, sys_stk_chk
- lw k0, 0(k1) # get PTE entry
-
- dsll k0, k0, 34 # get rid of "wired" bit
- dsrl k0, k0, 34
- dmtc0 k0, COP_0_TLB_LO0 # load PTE entry
- and k0, k0, PG_V # check for valid entry
- beq k0, zero, MipsKernGenException # PTE invalid
- lw k0, 4(k1) # get odd PTE entry
- dsll k0, k0, 34
- dsrl k0, k0, 34
- dmtc0 k0, COP_0_TLB_LO1 # load PTE entry
- nop
- tlbwi # write TLB
- nop
- nop
- nop
- nop
- nop
- eret
-
-KernTLBIOdd:
- mfc0 k0, COP_0_TLB_INDEX
- nop
- bltz k0, sys_stk_chk
- sltiu k0, k0, 8
-
- bne k0, zero, sys_stk_chk
- lw k0, 0(k1) # get PTE entry
-
- dsll k0, k0, 34 # get rid of wired bit
- dsrl k0, k0, 34
- dmtc0 k0, COP_0_TLB_LO1 # save PTE entry
- and k0, k0, PG_V # check for valid entry
- beq k0, zero, MipsKernGenException # PTE invalid
- lw k0, -4(k1) # get even PTE entry
- dsll k0, k0, 34
- dsrl k0, k0, 34
- dmtc0 k0, COP_0_TLB_LO0 # save PTE entry
- nop
- tlbwi # update TLB
- nop
- nop
- nop
- nop
- nop
- eret
-END(MipsTLBInvalidException)
-
-/*----------------------------------------------------------------------------
- *
- * MipsTLBMissException --
- *
- * Handle a TLB miss exception from kernel mode in kernel space.
- * The BaddVAddr, Context, and EntryHi registers contain the failed
- * virtual address.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-NLEAF(MipsTLBMissException)
- .set noat
- dmfc0 k0, COP_0_BAD_VADDR # get the fault address
- li k1, (VM_MIN_KERNEL_ADDRESS) # compute index
- subu k0, k0, k1
- lw k1, Sysmapsize # index within range?
- srl k0, k0, PGSHIFT
- sltu k1, k0, k1
- beq k1, zero, sys_stk_chk # No. check for valid stack
- lw k1, Sysmap
- srl k0, k0, 1
- sll k0, k0, 3 # compute offset from index
- addu k1, k1, k0
- lw k0, 0(k1) # get PTE entry
- lw k1, 4(k1) # get odd PTE entry
- dsll k0, k0, 34 # get rid of "wired" bit
- dsrl k0, k0, 34
- dmtc0 k0, COP_0_TLB_LO0 # load PTE entry
- dsll k1, k1, 34
- dsrl k1, k1, 34
- dmtc0 k1, COP_0_TLB_LO1 # load PTE entry
- nop
- tlbwr # write TLB
- nop
- nop
- nop
- nop
- nop
- eret
-
-sys_stk_chk:
- subu k0, sp, UADDR + 0x200 # check to see if we have a
- sltiu k0, UPAGES*NBPG - 0x200 # valid kernel stack
- bne k0, zero, MipsKernGenException # Go panic
- nop
-
- la a0, start - START_FRAME - 8 # set sp to a valid place
- sw sp, 24(a0)
- move sp, a0
- la a0, 1f
- mfc0 a2, COP_0_STATUS_REG
- mfc0 a3, COP_0_CAUSE_REG
- dmfc0 a1, COP_0_EXC_PC
- sw a2, 16(sp)
- sw a3, 20(sp)
- move a2, ra
- jal printf
- dmfc0 a3, COP_0_BAD_VADDR
- .data
-1:
- .asciiz "ktlbmiss: PC %x RA %x ADR %x\nSR %x CR %x SP %x\n"
- .text
-
- la sp, start - START_FRAME # set sp to a valid place
- PANIC("kernel stack overflow")
- .set at
-END(MipsTLBMissException)
-
-/*
- * Set/clear software interrupt routines.
- */
-
-LEAF(setsoftclock)
- mfc0 v0, COP_0_CAUSE_REG # read cause register
- nop
- or v0, v0, SOFT_INT_MASK_0 # set soft clock interrupt
- mtc0 v0, COP_0_CAUSE_REG # save it
- j ra
- nop
-END(setsoftclock)
-
-LEAF(clearsoftclock)
- mfc0 v0, COP_0_CAUSE_REG # read cause register
- nop
- and v0, v0, ~SOFT_INT_MASK_0 # clear soft clock interrupt
- mtc0 v0, COP_0_CAUSE_REG # save it
- j ra
- nop
-END(clearsoftclock)
-
-LEAF(setsoftnet)
- mfc0 v0, COP_0_CAUSE_REG # read cause register
- nop
- or v0, v0, SOFT_INT_MASK_1 # set soft net interrupt
- mtc0 v0, COP_0_CAUSE_REG # save it
- j ra
- nop
-END(setsoftnet)
-
-LEAF(clearsoftnet)
- mfc0 v0, COP_0_CAUSE_REG # read cause register
- nop
- and v0, v0, ~SOFT_INT_MASK_1 # clear soft net interrupt
- mtc0 v0, COP_0_CAUSE_REG # save it
- j ra
- nop
-END(clearsoftnet)
-
-/*
- * Set/change interrupt priority routines.
- */
-
-LEAF(MipsEnableIntr)
- mfc0 v0, COP_0_STATUS_REG # read status register
- nop
- or v0, v0, SR_INT_ENAB
- mtc0 v0, COP_0_STATUS_REG # enable all interrupts
- j ra
- nop
-END(MipsEnableIntr)
-
-LEAF(spl0)
- mfc0 v0, COP_0_STATUS_REG # read status register
- nop
- or t0, v0, (INT_MASK | SR_INT_ENAB)
- mtc0 t0, COP_0_STATUS_REG # enable all interrupts
- j ra
- and v0, v0, (INT_MASK | SR_INT_ENAB)
-END(spl0)
-
-LEAF(splsoftclock)
- mfc0 v0, COP_0_STATUS_REG # read status register
- li t0, ~SOFT_INT_MASK_0 # disable soft clock
- and t0, t0, v0
- mtc0 t0, COP_0_STATUS_REG # save it
- nop # 3 ins to disable
- j ra
- and v0, v0, (INT_MASK | SR_INT_ENAB)
-END(splsoftclock)
-
-LEAF(splsoftnet)
- mfc0 v0, COP_0_STATUS_REG # read status register
- li t0, ~(SOFT_INT_MASK_1|SOFT_INT_MASK_0)
- and t0, t0, v0
- mtc0 t0, COP_0_STATUS_REG # save it
- j ra
- and v0, v0, (INT_MASK | SR_INT_ENAB)
-END(splsoftnet)
-
-LEAF(Mips_spl0)
- mfc0 v0, COP_0_STATUS_REG # read status register
- li t0, ~(INT_MASK_0|SOFT_INT_MASK_1|SOFT_INT_MASK_0)
- and t0, t0, v0
- mtc0 t0, COP_0_STATUS_REG # save it
- nop # 3 ins to disable
- j ra
- and v0, v0, (INT_MASK | SR_INT_ENAB)
-END(Mips_spl0)
-
-LEAF(Mips_spl1)
- mfc0 v0, COP_0_STATUS_REG # read status register
- li t0, ~(INT_MASK_1|SOFT_INT_MASK_0|SOFT_INT_MASK_1)
- and t0, t0, v0
- mtc0 t0, COP_0_STATUS_REG # save it
- nop # 3 ins to disable
- j ra
- and v0, v0, (INT_MASK | SR_INT_ENAB)
-END(Mips_spl1)
-
-LEAF(Mips_spl2)
- mfc0 v0, COP_0_STATUS_REG # read status register
- li t0, ~(INT_MASK_2|SOFT_INT_MASK_1|SOFT_INT_MASK_0)
- and t0, t0, v0
- mtc0 t0, COP_0_STATUS_REG # save it
- nop # 3 ins to disable
- j ra
- and v0, v0, (INT_MASK | SR_INT_ENAB)
-END(Mips_spl2)
-
-LEAF(Mips_spl3)
- mfc0 v0, COP_0_STATUS_REG # read status register
- li t0, ~(INT_MASK_3|SOFT_INT_MASK_1|SOFT_INT_MASK_0)
- and t0, t0, v0
- mtc0 t0, COP_0_STATUS_REG # save it
- nop # 3 ins to disable
- j ra
- and v0, v0, (INT_MASK | SR_INT_ENAB)
-END(Mips_spl3)
-
-LEAF(Mips_spl4)
- mfc0 v0, COP_0_STATUS_REG # read status register
- li t0, ~(INT_MASK_4|SOFT_INT_MASK_1|SOFT_INT_MASK_0)
- and t0, t0, v0
- mtc0 t0, COP_0_STATUS_REG # save it
- nop # 3 ins to disable
- j ra
- and v0, v0, (INT_MASK | SR_INT_ENAB)
-END(Mips_spl4)
-
-LEAF(Mips_spl5)
- mfc0 v0, COP_0_STATUS_REG # read status register
- li t0, ~(INT_MASK_5|SOFT_INT_MASK_1|SOFT_INT_MASK_0)
- and t0, t0, v0
- mtc0 t0, COP_0_STATUS_REG # save it
- nop # 3 ins to disable
- j ra
- and v0, v0, (INT_MASK | SR_INT_ENAB)
-END(Mips_spl5)
-
-/*
- * We define an alternate entry point after mcount is called so it
- * can be used in mcount without causeing a recursive loop.
- */
-LEAF(splhigh)
-ALEAF(_splhigh)
- mfc0 v0, COP_0_STATUS_REG # read status register
- li t0, ~SR_INT_ENAB # disable all interrupts
- and t0, t0, v0
- mtc0 t0, COP_0_STATUS_REG # save it
- nop # 3 ins to disable
- j ra
- and v0, v0, (INT_MASK | SR_INT_ENAB)
-END(splhigh)
-
-/*
- * Restore saved interrupt mask.
- */
-LEAF(splx)
-ALEAF(_splx)
- mfc0 v0, COP_0_STATUS_REG
- li t0, ~(INT_MASK | SR_INT_ENAB)
- and t0, t0, v0
- or t0, t0, a0
- mtc0 t0, COP_0_STATUS_REG
- nop # 3 ins to disable
- j ra
- nop
-END(splx)
-
-/*----------------------------------------------------------------------------
- *
- * wbflush --
- *
- * Return when the write buffer is empty.
- *
- * wbflush()
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-LEAF(wbflush)
- nop
- sync
- j ra
- nop
-END(wbflush)
-
-/*--------------------------------------------------------------------------
- *
- * R4K_TLBWriteIndexed --
- *
- * Write the given entry into the TLB at the given index.
- *
- * R4K_TLBWriteIndexed(index, tlb)
- * unsigned index;
- * tlb *tlb;
- *
- * Results:
- * None.
- *
- * Side effects:
- * TLB entry set.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R4K_TLBWriteIndexed)
- mfc0 v1, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
- nop
- lw a2, 8(a1)
- lw a3, 12(a1)
- dmfc0 t0, COP_0_TLB_HI # Save the current PID.
-
- dmtc0 a2, COP_0_TLB_LO0 # Set up entry low0.
- dmtc0 a3, COP_0_TLB_LO1 # Set up entry low1.
- lw a2, 0(a1)
- lw a3, 4(a1)
- mtc0 a0, COP_0_TLB_INDEX # Set the index.
- dmtc0 a2, COP_0_TLB_PG_MASK # Set up entry mask.
- dmtc0 a3, COP_0_TLB_HI # Set up entry high.
- nop
- tlbwi # Write the TLB
- nop
- nop
- nop # Delay for effect
- nop
-
- dmtc0 t0, COP_0_TLB_HI # Restore the PID.
- nop
- dmtc0 zero, COP_0_TLB_PG_MASK # Default mask value.
- j ra
- mtc0 v1, COP_0_STATUS_REG # Restore the status register
-END(R4K_TLBWriteIndexed)
-
-/*--------------------------------------------------------------------------
- *
- * R4K_SetPID --
- *
- * Write the given pid into the TLB pid reg.
- *
- * R4K_SetPID(pid)
- * int pid;
- *
- * Results:
- * None.
- *
- * Side effects:
- * PID set in the entry hi register.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R4K_SetPID)
- dmtc0 a0, COP_0_TLB_HI # Write the hi reg value
- j ra
- nop
-END(R4K_SetPID)
-
-/*--------------------------------------------------------------------------
- *
- * R4K_SetWIRED --
- *
- * Write the given value into the TLB wired reg.
- *
- * R4K_SetPID(wired)
- * int wired;
- *
- * Results:
- * None.
- *
- * Side effects:
- * WIRED set in the wired register.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R4K_SetWIRED)
- mtc0 a0, COP_0_TLB_WIRED
- j ra
- nop
-END(R4K_SetWIRED)
-
-/*--------------------------------------------------------------------------
- *
- * R4K_GetWIRED --
- *
- * Get the value from the TLB wired reg.
- *
- * R4K_GetWIRED(void)
- *
- * Results:
- * Value of wired reg.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R4K_GetWIRED)
- mfc0 v0, COP_0_TLB_WIRED
- j ra
- nop
-END(R4K_GetWIRED)
-
-/*--------------------------------------------------------------------------
- *
- * R4K_TLBFlush --
- *
- * Flush the "random" entries from the TLB.
- * Uses "wired" register to determine what register to start with.
- * Arg "tlbsize" is the number of entries to flush.
- *
- * R4K_TLBFlush(tlbsize)
- *
- * Results:
- * None.
- *
- * Side effects:
- * The TLB is flushed.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R4K_TLBFlush)
- mfc0 v1, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
- mfc0 t1, COP_0_TLB_WIRED
- li v0, CACHED_MEMORY_ADDR # invalid address
- dmfc0 t0, COP_0_TLB_HI # Save the PID
-
- dmtc0 v0, COP_0_TLB_HI # Mark entry high as invalid
- dmtc0 zero, COP_0_TLB_LO0 # Zero out low entry0.
- dmtc0 zero, COP_0_TLB_LO1 # Zero out low entry1.
- mtc0 zero, COP_0_TLB_PG_MASK # Zero out mask entry.
-/*
- * Align the starting value (t1) and the upper bound (a0).
- */
-1:
- mtc0 t1, COP_0_TLB_INDEX # Set the index register.
- addu t1, t1, 1 # Increment index.
- tlbwi # Write the TLB entry.
- nop
- nop
- bne t1, a0, 1b
- nop
-
- dmtc0 t0, COP_0_TLB_HI # Restore the PID
- j ra
- mtc0 v1, COP_0_STATUS_REG # Restore the status register
-END(R4K_TLBFlush)
-
-
-/*--------------------------------------------------------------------------
- *
- * R4K_TLBFlushAddr --
- *
- * Flush any TLB entries for the given address and TLB PID.
- *
- * R4K_TLBFlushAddr(TLBhi)
- * unsigned TLBhi;
- *
- * Results:
- * None.
- *
- * Side effects:
- * The process's page is flushed from the TLB.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R4K_TLBFlushAddr)
- mfc0 v1, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
- nop
- li v0, (PG_HVPN | PG_ASID)
- and a0, a0, v0 # Make shure valid hi value.
- dmfc0 t0, COP_0_TLB_HI # Get current PID
- dmtc0 a0, COP_0_TLB_HI # look for addr & PID
- nop
- nop
- nop
- tlbp # Probe for the entry.
- nop
- nop # Delay for effect
- nop
- mfc0 v0, COP_0_TLB_INDEX # See what we got
- li t1, CACHED_MEMORY_ADDR # Load invalid entry.
- bltz v0, 1f # index < 0 => !found
- nop
- dmtc0 t1, COP_0_TLB_HI # Mark entry high as invalid
-
- dmtc0 zero, COP_0_TLB_LO0 # Zero out low entry.
- dmtc0 zero, COP_0_TLB_LO1 # Zero out low entry.
- nop
- tlbwi
- nop
- nop
- nop
- nop
-1:
- dmtc0 t0, COP_0_TLB_HI # restore PID
- j ra
- mtc0 v1, COP_0_STATUS_REG # Restore the status register
-END(R4K_TLBFlushAddr)
-
-/*--------------------------------------------------------------------------
- *
- * R4K_TLBUpdate --
- *
- * Update the TLB if highreg is found; otherwise, enter the data.
- *
- * R4K_TLBUpdate(virpageadr, lowregx)
- * unsigned virpageadr, lowregx;
- *
- * Results:
- * < 0 if loaded >= 0 if updated.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R4K_TLBUpdate)
- mfc0 v1, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
- and t1, a0, 0x1000 # t1 = Even/Odd flag
- li v0, (PG_HVPN | PG_ASID)
- and a0, a0, v0
- dmfc0 t0, COP_0_TLB_HI # Save current PID
- dmtc0 a0, COP_0_TLB_HI # Init high reg
- and a2, a1, PG_G # Copy global bit
- nop
- nop
- tlbp # Probe for the entry.
- dsll a1, a1, 34
- dsrl a1, a1, 34
- bne t1, zero, 2f # Decide even odd
- mfc0 v0, COP_0_TLB_INDEX # See what we got
-# EVEN
- nop
- bltz v0, 1f # index < 0 => !found
- nop
-
- tlbr # update, read entry first
- nop
- nop
- nop
- dmtc0 a1, COP_0_TLB_LO0 # init low reg0.
- nop
- tlbwi # update slot found
- b 4f
- nop
-1:
- mtc0 zero, COP_0_TLB_PG_MASK # init mask.
- dmtc0 a0, COP_0_TLB_HI # init high reg.
- dmtc0 a1, COP_0_TLB_LO0 # init low reg0.
- dmtc0 a2, COP_0_TLB_LO1 # init low reg1.
- nop
- tlbwr # enter into a random slot
- b 4f
- nop
-# ODD
-2:
- nop
- bltz v0, 3f # index < 0 => !found
- nop
-
- tlbr # read the entry first
- nop
- nop
- nop
- dmtc0 a1, COP_0_TLB_LO1 # init low reg1.
- nop
- tlbwi # update slot found
- b 4f
- nop
-3:
- mtc0 zero, COP_0_TLB_PG_MASK # init mask.
- dmtc0 a0, COP_0_TLB_HI # init high reg.
- dmtc0 a2, COP_0_TLB_LO0 # init low reg0.
- dmtc0 a1, COP_0_TLB_LO1 # init low reg1.
- nop
- tlbwr # enter into a random slot
-
-4: # Make shure pipeline
- nop # advances before we
- nop # uses the tlb.
- nop
- nop
- dmtc0 t0, COP_0_TLB_HI # restore PID
- j ra
- mtc0 v1, COP_0_STATUS_REG # Restore the status register
-END(R4K_TLBUpdate)
-
-/*--------------------------------------------------------------------------
- *
- * R4K_TLBRead --
- *
- * Read the TLB entry.
- *
- * R4K_TLBRead(entry, tlb)
- * unsigned entry;
- * struct tlb *tlb;
- *
- * Results:
- * None.
- *
- * Side effects:
- * tlb will contain the TLB entry found.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R4K_TLBRead)
- mfc0 v1, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
- nop
- nop
- nop
- dmfc0 t0, COP_0_TLB_HI # Get current PID
-
- mtc0 a0, COP_0_TLB_INDEX # Set the index register
- nop
- tlbr # Read from the TLB
- nop
- nop
- nop
- mfc0 t2, COP_0_TLB_PG_MASK # fetch the hi entry
- dmfc0 t3, COP_0_TLB_HI # fetch the hi entry
- dmfc0 t4, COP_0_TLB_LO0 # See what we got
- dmfc0 t5, COP_0_TLB_LO1 # See what we got
- dmtc0 t0, COP_0_TLB_HI # restore PID
- nop
- nop
- nop # wait for PID active
- mtc0 v1, COP_0_STATUS_REG # Restore the status register
- sw t2, 0(a1)
- sw t3, 4(a1)
- sw t4, 8(a1)
- j ra
- sw t5, 12(a1)
-END(R4K_TLBRead)
-
-/*--------------------------------------------------------------------------
- *
- * R4K_TLBGetPID --
- *
- * R4K_TLBGetPID()
- *
- * Results:
- * Returns the current TLB pid reg.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R4K_TLBGetPID)
- dmfc0 v0, COP_0_TLB_HI # get PID
- j ra
- and v0, v0, VMTLB_PID # mask off PID
-END(R4K_TLBGetPID)
-
-/*--------------------------------------------------------------------------
- *
- * R4K_GetCOUNT --
- *
- * R4K_GetCOUNT()
- *
- * Results:
- * Returns the current COUNT reg.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R4K_GetCOUNT)
- mfc0 v0, COP_0_COUNT
- nop #???
- nop #???
- j ra
- nop
-END(R4K_GetCOUNT)
-
-/*--------------------------------------------------------------------------
- *
- * R4K_SetCOMPARE --
- *
- * R4K_SetCOMPARE()
- *
- * Results:
- * Sets a new value to the COMPARE register.
- *
- * Side effects:
- * The COMPARE equal interrupt is acknowledged.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R4K_SetCOMPARE)
- j ra
- mtc0 a0, COP_0_COMPARE
-END(R4K_SetCOMPARE)
-
-/*----------------------------------------------------------------------------
- *
- * MipsSwitchFPState --
- *
- * Save the current state into 'from' and restore it from 'to'.
- *
- * MipsSwitchFPState(from, to)
- * struct proc *from;
- * struct user *to;
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-LEAF(MipsSwitchFPState)
- mfc0 t1, COP_0_STATUS_REG # Save old SR
- li t0, SR_COP_1_BIT # enable the coprocessor
- mtc0 t0, COP_0_STATUS_REG
-
- beq a0, zero, 1f # skip save if NULL pointer
- nop
-/*
- * First read out the status register to make sure that all FP operations
- * have completed.
- */
- lw a0, P_ADDR(a0) # get pointer to pcb for proc
- cfc1 t0, FPC_CSR # stall til FP done
- cfc1 t0, FPC_CSR # now get status
- li t3, ~SR_COP_1_BIT
- lw t2, U_PCB_REGS+(PS * 4)(a0) # get CPU status register
- sw t0, U_PCB_FPREGS+(32 * 4)(a0) # save FP status
- and t2, t2, t3 # clear COP_1 enable bit
- sw t2, U_PCB_REGS+(PS * 4)(a0) # save new status register
-/*
- * Save the floating point registers.
- */
- swc1 $f0, U_PCB_FPREGS+(0 * 4)(a0)
- swc1 $f1, U_PCB_FPREGS+(1 * 4)(a0)
- swc1 $f2, U_PCB_FPREGS+(2 * 4)(a0)
- swc1 $f3, U_PCB_FPREGS+(3 * 4)(a0)
- swc1 $f4, U_PCB_FPREGS+(4 * 4)(a0)
- swc1 $f5, U_PCB_FPREGS+(5 * 4)(a0)
- swc1 $f6, U_PCB_FPREGS+(6 * 4)(a0)
- swc1 $f7, U_PCB_FPREGS+(7 * 4)(a0)
- swc1 $f8, U_PCB_FPREGS+(8 * 4)(a0)
- swc1 $f9, U_PCB_FPREGS+(9 * 4)(a0)
- swc1 $f10, U_PCB_FPREGS+(10 * 4)(a0)
- swc1 $f11, U_PCB_FPREGS+(11 * 4)(a0)
- swc1 $f12, U_PCB_FPREGS+(12 * 4)(a0)
- swc1 $f13, U_PCB_FPREGS+(13 * 4)(a0)
- swc1 $f14, U_PCB_FPREGS+(14 * 4)(a0)
- swc1 $f15, U_PCB_FPREGS+(15 * 4)(a0)
- swc1 $f16, U_PCB_FPREGS+(16 * 4)(a0)
- swc1 $f17, U_PCB_FPREGS+(17 * 4)(a0)
- swc1 $f18, U_PCB_FPREGS+(18 * 4)(a0)
- swc1 $f19, U_PCB_FPREGS+(19 * 4)(a0)
- swc1 $f20, U_PCB_FPREGS+(20 * 4)(a0)
- swc1 $f21, U_PCB_FPREGS+(21 * 4)(a0)
- swc1 $f22, U_PCB_FPREGS+(22 * 4)(a0)
- swc1 $f23, U_PCB_FPREGS+(23 * 4)(a0)
- swc1 $f24, U_PCB_FPREGS+(24 * 4)(a0)
- swc1 $f25, U_PCB_FPREGS+(25 * 4)(a0)
- swc1 $f26, U_PCB_FPREGS+(26 * 4)(a0)
- swc1 $f27, U_PCB_FPREGS+(27 * 4)(a0)
- swc1 $f28, U_PCB_FPREGS+(28 * 4)(a0)
- swc1 $f29, U_PCB_FPREGS+(29 * 4)(a0)
- swc1 $f30, U_PCB_FPREGS+(30 * 4)(a0)
- swc1 $f31, U_PCB_FPREGS+(31 * 4)(a0)
-
-1:
-/*
- * Restore the floating point registers.
- */
- lw t0, U_PCB_FPREGS+(32 * 4)(a1) # get status register
- lwc1 $f0, U_PCB_FPREGS+(0 * 4)(a1)
- lwc1 $f1, U_PCB_FPREGS+(1 * 4)(a1)
- lwc1 $f2, U_PCB_FPREGS+(2 * 4)(a1)
- lwc1 $f3, U_PCB_FPREGS+(3 * 4)(a1)
- lwc1 $f4, U_PCB_FPREGS+(4 * 4)(a1)
- lwc1 $f5, U_PCB_FPREGS+(5 * 4)(a1)
- lwc1 $f6, U_PCB_FPREGS+(6 * 4)(a1)
- lwc1 $f7, U_PCB_FPREGS+(7 * 4)(a1)
- lwc1 $f8, U_PCB_FPREGS+(8 * 4)(a1)
- lwc1 $f9, U_PCB_FPREGS+(9 * 4)(a1)
- lwc1 $f10, U_PCB_FPREGS+(10 * 4)(a1)
- lwc1 $f11, U_PCB_FPREGS+(11 * 4)(a1)
- lwc1 $f12, U_PCB_FPREGS+(12 * 4)(a1)
- lwc1 $f13, U_PCB_FPREGS+(13 * 4)(a1)
- lwc1 $f14, U_PCB_FPREGS+(14 * 4)(a1)
- lwc1 $f15, U_PCB_FPREGS+(15 * 4)(a1)
- lwc1 $f16, U_PCB_FPREGS+(16 * 4)(a1)
- lwc1 $f17, U_PCB_FPREGS+(17 * 4)(a1)
- lwc1 $f18, U_PCB_FPREGS+(18 * 4)(a1)
- lwc1 $f19, U_PCB_FPREGS+(19 * 4)(a1)
- lwc1 $f20, U_PCB_FPREGS+(20 * 4)(a1)
- lwc1 $f21, U_PCB_FPREGS+(21 * 4)(a1)
- lwc1 $f22, U_PCB_FPREGS+(22 * 4)(a1)
- lwc1 $f23, U_PCB_FPREGS+(23 * 4)(a1)
- lwc1 $f24, U_PCB_FPREGS+(24 * 4)(a1)
- lwc1 $f25, U_PCB_FPREGS+(25 * 4)(a1)
- lwc1 $f26, U_PCB_FPREGS+(26 * 4)(a1)
- lwc1 $f27, U_PCB_FPREGS+(27 * 4)(a1)
- lwc1 $f28, U_PCB_FPREGS+(28 * 4)(a1)
- lwc1 $f29, U_PCB_FPREGS+(29 * 4)(a1)
- lwc1 $f30, U_PCB_FPREGS+(30 * 4)(a1)
- lwc1 $f31, U_PCB_FPREGS+(31 * 4)(a1)
-
- and t0, t0, ~FPC_EXCEPTION_BITS
- ctc1 t0, FPC_CSR
- nop
-
- mtc0 t1, COP_0_STATUS_REG # Restore the status register.
- j ra
- nop
-END(MipsSwitchFPState)
-
-/*----------------------------------------------------------------------------
- *
- * MipsSaveCurFPState --
- *
- * Save the current floating point coprocessor state.
- *
- * MipsSaveCurFPState(p)
- * struct proc *p;
- *
- * Results:
- * None.
- *
- * Side effects:
- * machFPCurProcPtr is cleared.
- *
- *----------------------------------------------------------------------------
- */
-LEAF(MipsSaveCurFPState)
- lw a0, P_ADDR(a0) # get pointer to pcb for proc
- mfc0 t1, COP_0_STATUS_REG # Disable interrupts and
- li t0, SR_COP_1_BIT # enable the coprocessor
- mtc0 t0, COP_0_STATUS_REG
- sw zero, machFPCurProcPtr # indicate state has been saved
-/*
- * First read out the status register to make sure that all FP operations
- * have completed.
- */
- lw t2, U_PCB_REGS+(PS * 4)(a0) # get CPU status register
- li t3, ~SR_COP_1_BIT
- and t2, t2, t3 # clear COP_1 enable bit
- cfc1 t0, FPC_CSR # stall til FP done
- cfc1 t0, FPC_CSR # now get status
- sw t2, U_PCB_REGS+(PS * 4)(a0) # save new status register
- sw t0, U_PCB_FPREGS+(32 * 4)(a0) # save FP status
-/*
- * Save the floating point registers.
- */
- swc1 $f0, U_PCB_FPREGS+(0 * 4)(a0)
- swc1 $f1, U_PCB_FPREGS+(1 * 4)(a0)
- swc1 $f2, U_PCB_FPREGS+(2 * 4)(a0)
- swc1 $f3, U_PCB_FPREGS+(3 * 4)(a0)
- swc1 $f4, U_PCB_FPREGS+(4 * 4)(a0)
- swc1 $f5, U_PCB_FPREGS+(5 * 4)(a0)
- swc1 $f6, U_PCB_FPREGS+(6 * 4)(a0)
- swc1 $f7, U_PCB_FPREGS+(7 * 4)(a0)
- swc1 $f8, U_PCB_FPREGS+(8 * 4)(a0)
- swc1 $f9, U_PCB_FPREGS+(9 * 4)(a0)
- swc1 $f10, U_PCB_FPREGS+(10 * 4)(a0)
- swc1 $f11, U_PCB_FPREGS+(11 * 4)(a0)
- swc1 $f12, U_PCB_FPREGS+(12 * 4)(a0)
- swc1 $f13, U_PCB_FPREGS+(13 * 4)(a0)
- swc1 $f14, U_PCB_FPREGS+(14 * 4)(a0)
- swc1 $f15, U_PCB_FPREGS+(15 * 4)(a0)
- swc1 $f16, U_PCB_FPREGS+(16 * 4)(a0)
- swc1 $f17, U_PCB_FPREGS+(17 * 4)(a0)
- swc1 $f18, U_PCB_FPREGS+(18 * 4)(a0)
- swc1 $f19, U_PCB_FPREGS+(19 * 4)(a0)
- swc1 $f20, U_PCB_FPREGS+(20 * 4)(a0)
- swc1 $f21, U_PCB_FPREGS+(21 * 4)(a0)
- swc1 $f22, U_PCB_FPREGS+(22 * 4)(a0)
- swc1 $f23, U_PCB_FPREGS+(23 * 4)(a0)
- swc1 $f24, U_PCB_FPREGS+(24 * 4)(a0)
- swc1 $f25, U_PCB_FPREGS+(25 * 4)(a0)
- swc1 $f26, U_PCB_FPREGS+(26 * 4)(a0)
- swc1 $f27, U_PCB_FPREGS+(27 * 4)(a0)
- swc1 $f28, U_PCB_FPREGS+(28 * 4)(a0)
- swc1 $f29, U_PCB_FPREGS+(29 * 4)(a0)
- swc1 $f30, U_PCB_FPREGS+(30 * 4)(a0)
- swc1 $f31, U_PCB_FPREGS+(31 * 4)(a0)
-
- mtc0 t1, COP_0_STATUS_REG # Restore the status register.
- j ra
- nop
-END(MipsSaveCurFPState)
-
-/*----------------------------------------------------------------------------
- *
- * MipsFPTrap --
- *
- * Handle a floating point Trap.
- *
- * MipsFPTrap(statusReg, causeReg, pc)
- * unsigned statusReg;
- * unsigned causeReg;
- * unsigned pc;
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-NON_LEAF(MipsFPTrap, STAND_FRAME_SIZE, ra)
- subu sp, sp, STAND_FRAME_SIZE
- mfc0 t0, COP_0_STATUS_REG
- sw ra, STAND_RA_OFFSET(sp)
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
-
- or t1, t0, SR_COP_1_BIT
- mtc0 t1, COP_0_STATUS_REG
- nop
- nop
- nop
- nop
- cfc1 t1, FPC_CSR # stall til FP done
- cfc1 t1, FPC_CSR # now get status
- nop
- sll t2, t1, (31 - 17) # unimplemented operation?
- bgez t2, 3f # no, normal trap
- nop
-/*
- * We got an unimplemented operation trap so
- * fetch the instruction, compute the next PC and emulate the instruction.
- */
- bgez a1, 1f # Check the branch delay bit.
- nop
-/*
- * The instruction is in the branch delay slot so the branch will have to
- * be emulated to get the resulting PC.
- */
- sw a2, STAND_FRAME_SIZE + 8(sp)
- li a0, UADDR+U_PCB_REGS # first arg is ptr to CPU registers
- move a1, a2 # second arg is instruction PC
- move a2, t1 # third arg is floating point CSR
- jal MipsEmulateBranch # compute PC after branch
- move a3, zero # fourth arg is FALSE
-/*
- * Now load the floating-point instruction in the branch delay slot
- * to be emulated.
- */
- lw a2, STAND_FRAME_SIZE + 8(sp) # restore EXC pc
- b 2f
- lw a0, 4(a2) # a0 = coproc instruction
-/*
- * This is not in the branch delay slot so calculate the resulting
- * PC (epc + 4) into v0 and continue to MipsEmulateFP().
- */
-1:
- lw a0, 0(a2) # a0 = coproc instruction
- addu v0, a2, 4 # v0 = next pc
-2:
- sw v0, UADDR+U_PCB_REGS+(PC * 4) # save new pc
-/*
- * Check to see if the instruction to be emulated is a floating-point
- * instruction.
- */
- srl a3, a0, OPCODE_SHIFT
- beq a3, OPCODE_C1, 4f # this should never fail
- nop
-/*
- * Send a floating point exception signal to the current process.
- */
-3:
- lw a0, curproc # get current process
- cfc1 a2, FPC_CSR # code = FP execptions
- ctc1 zero, FPC_CSR # Clear exceptions
- jal trapsignal
- li a1, SIGFPE
- b FPReturn
- nop
-
-/*
- * Finally, we can call MipsEmulateFP() where a0 is the instruction to emulate.
- */
-4:
- jal MipsEmulateFP
- nop
-
-/*
- * Turn off the floating point coprocessor and return.
- */
-FPReturn:
- mfc0 t0, COP_0_STATUS_REG
- lw ra, STAND_RA_OFFSET(sp)
- and t0, t0, ~SR_COP_1_BIT
- mtc0 t0, COP_0_STATUS_REG
- j ra
- addu sp, sp, STAND_FRAME_SIZE
-END(MipsFPTrap)
-
-/*----------------------------------------------------------------------------
- *
- * R4K_ConfigCache --
- *
- * Size the caches.
- * NOTE: should only be called from mips_init().
- *
- * Results:
- * None.
- *
- * Side effects:
- * The size of the data cache is stored into CpuPrimaryDataCacheSize.
- * The size of instruction cache is stored into CpuPrimaryInstCacheSize.
- * Alignment mask for cache aliasing test is stored in CpuCacheAliasMask.
- * cpu_id is set for later decision testing.
-
-XXX Needs support for Cpu controlled L2 caches (SC cpus). XXX
-
- *
- *----------------------------------------------------------------------------
- */
-LEAF(R4K_ConfigCache)
- .set noreorder
- mfc0 t0, COP_0_PRID # read processor ID register
- nop
- sw t0, cpu_id # save PRID register
- mfc0 v0, COP_0_CONFIG # Get configuration register
- mfc0 v1, COP_0_PRID
- srl t1, v0, 9 # Get I cache size.
- and t1, 3
- li t2, 4096
- sllv t2, t2, t1
- sw t2, CpuPrimaryInstCacheSize
- addiu t2, -1
- and t2, ~(NBPG - 1)
- sw t2, CpuCacheAliasMask
-
- and t2, v0, 0x20
- srl t2, t2, 1
- addu t2, t2, 16
- sw t2, CpuPrimaryInstCacheLSize
-
- srl t1, v0, 6 # Get D cache size.
- and t1, 3
- li t2, 4096
- sllv t2, t2, t1
- sw t2, CpuPrimaryDataCacheSize
-
- and t2, v0, 0x10
- addu t2, t2, 16
- sw t2, CpuPrimaryDataCacheLSize
- and v1, 0xff00
- li t2, 1 # Recognize CPU's with
- li t1, (MIPS_R4600 << 8) # two way associative caches.
- beq v1, t1, 1f
- li t1, (MIPS_R4700 << 8)
- beq v1, t1, 1f
- li t1, (MIPS_R5000 << 8)
- beq v1, t1, 1f
- li t1, (MIPS_RM52X0 << 8)
- beq v1, t1, 1f
- li t2, 1
-
- li t2, 0
-1:
- sw t2, CpuTwoWayCache
- j ra
- nop
-END(R4K_ConfigCache)
-
-/*----------------------------------------------------------------------------
- *
- * R4K_FlushCache --
- *
- * Flush the caches. Assumes a line size of 16 bytes for speed.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The contents of the caches is flushed.
- *
- *----------------------------------------------------------------------------
- */
-LEAF(R4K_FlushCache)
- .set noreorder
-/*XXX 4600 Bug */
- mfc0 v1, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
-/*XXX*/
- lw v0, CpuTwoWayCache
- lw t1, CpuPrimaryInstCacheSize
- lw t2, CpuPrimaryDataCacheSize
- # lw t3, CpuPrimaryInstCacheLSize
- # lw t4, CpuPrimaryDataCacheLSize
-/*
- * Flush the instruction cache.
- */
- li t0, CACHED_MEMORY_ADDR
- addu t1, t0, t1 # End address
- subu t1, t1, 128
-1:
- bne v0, zero, 2f
- cache 0, 0(t0)
-
- cache 0, 16(t0)
- cache 0, 48(t0)
- cache 0, 80(t0)
- b 3f
- cache 0, 112(t0)
-
-2:
- cache 0, 8192+0(t0)
- cache 0, 8192+32(t0)
- cache 0, 8192+64(t0)
- cache 0, 8192+96(t0)
-
-3:
- cache 0, 32(t0)
- cache 0, 64(t0)
- cache 0, 96(t0)
- bne t0, t1, 1b
- addu t0, t0, 128
-
-/*
- * Flush the data cache.
- */
- li t0, CACHED_MEMORY_ADDR
- addu t1, t0, t2 # End address
- subu t1, t1, 128
-1:
- bne v0, zero, 2f
- cache 1, 0(t0)
-
- cache 1, 16(t0)
- cache 1, 48(t0)
- cache 1, 80(t0)
- b 3f
- cache 1, 112(t0)
-
-2:
- cache 1, 8192+0(t0)
- cache 1, 8192+32(t0)
- cache 1, 8192+64(t0)
- cache 1, 8192+96(t0)
-
-3:
- cache 1, 32(t0)
- cache 1, 64(t0)
- cache 1, 96(t0)
- bne t0, t1, 1b
- addu t0, t0, 128
-
-/*XXX 4600 Bug */
- mtc0 v1, COP_0_STATUS_REG # Restore the status register.
-/*XXX*/
- j ra
- nop
-END(R4K_FlushCache)
-
-/*----------------------------------------------------------------------------
- *
- * R4K_FlushICache --
- *
- * void R4K_FlushICache(addr, len)
- * vm_offset_t addr, len;
- *
- * Flush instruction cache for range of addr to addr + len - 1.
- * The address can be any valid address so long as no TLB misses occur.
- * Assumes a cache line size of 16 bytes for speed.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The contents of the cache is flushed.
- * Must not touch v0.
- *
- *----------------------------------------------------------------------------
- */
-LEAF(R4K_FlushICache)
-/*XXX 4600 Bug */
- mfc0 v1, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
-/*XXX*/
- lw v0, CpuTwoWayCache
- addu a1, 127 # Align
- srl a1, a1, 7 # Number of unrolled loops
-1:
- bne v0, zero, 2f
- addu a1, -1
-
- cache 0, 16(a0)
- cache 0, 48(a0)
- cache 0, 80(a0)
- b 3f
- cache 0, 112(a0)
-
-2:
- cache 0, 8192+0(a0)
- cache 0, 8192+32(a0)
- cache 0, 8192+64(a0)
- cache 0, 8192+96(a0)
-
-3:
- cache 0, 0(a0)
- cache 0, 32(a0)
- cache 0, 64(a0)
- cache 0, 96(a0)
- bne a1, zero, 1b
- addu a0, 128
-
-/*XXX 4600 Bug */
- mtc0 v1, COP_0_STATUS_REG # Restore the status register.
-/*XXX*/
- j ra
- move v0, zero # suiword depends on this!!
-END(R4K_FlushICache)
-
-/*----------------------------------------------------------------------------
- *
- * R4K_FlushDCache --
- *
- * void R4K_FlushDCache(addr, len)
- * vm_offset_t addr, len;
- *
- * Flush data cache for index range of addr to addr + len - 1.
- * The address is reduced to a kseg0 index.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The contents of the cache is written back to primary memory.
- * The cache line is invalidated.
- *
- *----------------------------------------------------------------------------
- */
-LEAF(R4K_FlushDCache)
-/*XXX 4600 Bug */
- mfc0 v1, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
-/*XXX*/
- lw v0, CpuTwoWayCache
- lw a2, CpuPrimaryDataCacheSize
- addiu a2, -1
- and a0, a0, a2
- addu a1, 127 # Align
- li a2, 0x80000000
- addu a0, a0, a2
- addu a1, a1, a0
- and a0, a0, -128
- subu a1, a1, a0
- srl a1, a1, 7 # Compute number of cache lines
-1:
- bne v0, zero, 2f
- addu a1, -1
-
- cache 1, 16(a0)
- cache 1, 48(a0)
- cache 1, 80(a0)
- b 3f
- cache 1, 112(a0)
-
-2:
- cache 1, 8192+0(a0)
- cache 1, 8192+32(a0)
- cache 1, 8192+64(a0)
- cache 1, 8192+96(a0)
-
-3:
- cache 1, 0(a0)
- cache 1, 32(a0)
- cache 1, 64(a0)
- cache 1, 96(a0)
- bne a1, zero, 1b
- addu a0, 128
-
-/*XXX 4600 Bug */
- mtc0 v1, COP_0_STATUS_REG # Restore the status register.
-/*XXX*/
- j ra
- nop
-END(R4K_FlushDCache)
-
-/*----------------------------------------------------------------------------
- *
- * R4K_HitFlushDCache --
- *
- * void R4K_HitFlushDCache(addr, len)
- * vm_offset_t addr, len;
- *
- * Flush data cache for range of addr to addr + len - 1.
- * The address can be any valid viritual address as long
- * as no TLB invalid traps occur. Only lines with matching
- * addr is flushed.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The contents of the cache is written back to primary memory.
- * The cache line is invalidated.
- *
- *----------------------------------------------------------------------------
- */
-LEAF(R4K_HitFlushDCache)
- lw v0, CpuTwoWayCache
- beq a1, zero, 3f
- addu a1, 127 # Align
- addu a1, a1, a0
- and a0, a0, -128
- subu a1, a1, a0
- srl a1, a1, 7 # Compute number of cache lines
-1:
- bne v0, zero, 2f
- addu a1, -1
-
- cache 0x15, 16(a0)
- cache 0x15, 48(a0)
- cache 0x15, 80(a0)
- cache 0x15, 112(a0)
-
-2:
- cache 0x15, 0(a0)
- cache 0x15, 32(a0)
- cache 0x15, 64(a0)
- cache 0x15, 96(a0)
- bne a1, zero, 1b
- addu a0, 128
-
-3:
- j ra
- nop
-END(R4K_HitFlushDCache)
-/*----------------------------------------------------------------------------
- *
- * R4K_InvalidateDCache --
- *
- * void R4K_FlushDCache(addr, len)
- * vm_offset_t addr, len;
- *
- * Flush data cache for range of addr to addr + len - 1.
- * The address can be any valid address as long as no TLB misses occur.
- * (Be sure to use cached K0SEG kernel addresses or mapped addresses)
- * Results:
- * None.
- *
- * Side effects:
- * The cache line is invalidated.
- *
- *----------------------------------------------------------------------------
- */
-LEAF(R4K_InvalidateDCache)
- addu a1, a1, a0 # compute ending address
-1:
- cache 0x11, 8194(a0)
- addu a0, a0, 4
- bne a0, a1, 1b
- cache 0x11, -4(a0)
-
- j ra
- nop
-END(R4K_InvalidateDCache)
-
-#if defined(DDB) || defined(DEBUG)
-LEAF(kdbpeek)
- li v0, DDBERR
- and v0, a0, 3 # unaligned ?
- bne v0, zero, 1f
- sw v0, UADDR+U_PCB_ONFAULT
-
- lw v0, (a0)
- jr ra
- sw zero, UADDR+U_PCB_ONFAULT
-
-1:
- LWHI v0, 0(a0)
- LWLO v0, 3(a0)
- jr ra
- sw zero, UADDR+U_PCB_ONFAULT
-END(kdbpeek)
-
-ddberr:
- jr ra
- nop
-
-#if defined(DDB)
-LEAF(kdbpoke)
- li v0, DDBERR
- and v0, a0, 3 # unaligned ?
- bne v0, zero, 1f
- sw v0, UADDR+U_PCB_ONFAULT
-
- sw a1, (a0)
- jr ra
- sw zero, UADDR+U_PCB_ONFAULT
-
-1:
- SWHI a1, 0(a0)
- SWLO a1, 3(a0)
- jr ra
- sw zero, UADDR+U_PCB_ONFAULT
-END(kdbpoke)
-
-LEAF(Debugger)
- break BREAK_SOVER_VAL
- jr ra
- nop
-END(Debugger)
-
-LEAF(setjmp)
- mfc0 v0, COP_0_STATUS_REG # Later the "real" spl value!
- STORE s0, RSIZE * 0(a0)
- STORE s1, RSIZE * 1(a0)
- STORE s2, RSIZE * 2(a0)
- STORE s3, RSIZE * 3(a0)
- STORE s4, RSIZE * 4(a0)
- STORE s5, RSIZE * 5(a0)
- STORE s6, RSIZE * 6(a0)
- STORE s7, RSIZE * 7(a0)
- STORE s8, RSIZE * 8(a0)
- STORE sp, RSIZE * 9(a0)
- STORE ra, RSIZE * 10(a0)
- STORE v0, RSIZE * 11(a0)
- jr ra
- li v0, 0 # setjmp return
-END(setjmp)
-
-LEAF(longjmp)
- LOAD v0, RSIZE * 11(a0)
- LOAD ra, RSIZE * 10(a0)
- LOAD s0, RSIZE * 0(a0)
- LOAD s1, RSIZE * 1(a0)
- LOAD s2, RSIZE * 2(a0)
- LOAD s3, RSIZE * 3(a0)
- LOAD s4, RSIZE * 4(a0)
- LOAD s5, RSIZE * 5(a0)
- LOAD s6, RSIZE * 6(a0)
- LOAD s7, RSIZE * 7(a0)
- LOAD s8, RSIZE * 8(a0)
- LOAD sp, RSIZE * 9(a0)
- mtc0 v0, COP_0_STATUS_REG # Later the "real" spl value!
- jr ra
- li v0, 1 # longjmp return
-END(longjmp)
-
-#endif /* DDB */
-#endif /* DDB || DEBUG */
-
-#if defined(DDB) || NKSYMS > 0
- .data
- .globl esym
-esym: .word 0
-#endif
-
-/*
- * Interrupt counters for vmstat.
- */
- .data
- .globl intrcnt
- .globl eintrcnt
- .globl intrnames
- .globl eintrnames
-intrnames:
- .asciiz "softclock"
- .asciiz "softnet"
- .asciiz "local_dma"
- .asciiz "local_dev"
- .asciiz "isa_dev"
- .asciiz "isa_nmi"
- .asciiz "clock"
- .asciiz "statclock"
-eintrnames:
- .align 3
-intrcnt:
- .word 0,0,0,0,0,0,0,0
-eintrcnt:
diff --git a/sys/arch/arc/arc/machdep.c b/sys/arch/arc/arc/machdep.c
deleted file mode 100644
index 7d15ab03750..00000000000
--- a/sys/arch/arc/arc/machdep.c
+++ /dev/null
@@ -1,1373 +0,0 @@
-/* $OpenBSD: machdep.c,v 1.39 2000/10/27 00:16:04 mickey Exp $ */
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department, The Mach Operating System project at
- * Carnegie-Mellon University and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)machdep.c 8.3 (Berkeley) 1/12/94
- * $Id: machdep.c,v 1.39 2000/10/27 00:16:04 mickey Exp $
- */
-
-/* from: Utah Hdr: machdep.c 1.63 91/04/24 */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/signalvar.h>
-#include <sys/kernel.h>
-#include <sys/map.h>
-#include <sys/proc.h>
-#include <sys/buf.h>
-#include <sys/reboot.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/clist.h>
-#include <sys/timeout.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/msgbuf.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/user.h>
-#include <sys/exec.h>
-#include <sys/sysctl.h>
-#include <sys/mount.h>
-#include <sys/syscallargs.h>
-#ifdef SYSVSHM
-#include <sys/shm.h>
-#endif
-#ifdef SYSVSEM
-#include <sys/sem.h>
-#endif
-#ifdef SYSVMSG
-#include <sys/msg.h>
-#endif
-#ifdef MFS
-#include <ufs/mfs/mfs_extern.h>
-#endif
-
-#include <vm/vm_kern.h>
-
-#include <machine/pte.h>
-#include <machine/cpu.h>
-#include <machine/reg.h>
-#include <machine/pio.h>
-#include <machine/psl.h>
-#include <machine/bus.h>
-#include <machine/autoconf.h>
-#include <machine/memconf.h>
-
-#include <sys/exec_ecoff.h>
-
-#include <dev/cons.h>
-
-#include <mips/archtype.h>
-#include <mips/mips/arcbios.h>
-#include <arc/pica/pica.h>
-#include <arc/dti/desktech.h>
-#include <arc/algor/algor.h>
-
-extern struct consdev *cn_tab;
-extern char kernel_text[];
-extern void makebootdev __P((char *));
-extern void stacktrace __P((void));
-extern void configure __P((void));
-extern void pmap_bootstrap __P((vm_offset_t));
-extern int kbc_8042sysreset __P((void));
-
-/* the following is used externally (sysctl_hw) */
-char machine[] = "arc"; /* cpu "architecture" */
-char cpu_model[30];
-
-vm_map_t buffer_map;
-
-/*
- * Declare these as initialized data so we can patch them.
- */
-int nswbuf = 0;
-#ifdef NBUF
-int nbuf = NBUF;
-#else
-int nbuf = 0;
-#endif
-#ifdef BUFPAGES
-int bufpages = BUFPAGES;
-#else
-int bufpages = 0;
-#endif
-int msgbufmapped = 0; /* set when safe to use msgbuf */
-int physmem; /* max supported memory, changes to actual */
-int cpucfg; /* Value of processor config register */
-int l2cache_is_snooping; /* Set if L2 cache snoops uncached writes */
-int system_type; /* Mother board type */
-int num_tlbentries = 48; /* Size of the CPU tlb */
-int ncpu = 1; /* At least one cpu in the system */
-int CONADDR; /* Well, ain't it just plain stupid... */
-struct arc_bus_space arc_bus_io;/* Bus tag for bus.h macros */
-struct arc_bus_space arc_bus_mem;/* Bus tag for bus.h macros */
-char **environment; /* On some arches, pointer to environment */
-char eth_hw_addr[6]; /* HW ether addr not stored elsewhere */
-
-struct mem_descriptor mem_layout[MAXMEMSEGS];
-
-extern int Mips_spl0 __P((void)), Mips_spl1 __P((void)), Mips_spl2 __P((void));
-extern int Mips_spl3 __P((void)), Mips_spl4 __P((void)), Mips_spl5 __P((void));
-int (*Mips_splnet)(void) = splhigh;
-int (*Mips_splbio)(void) = splhigh;
-int (*Mips_splimp)(void) = splhigh;
-int (*Mips_spltty)(void) = splhigh;
-int (*Mips_splclock)(void) = splhigh;
-int (*Mips_splstatclock)(void) = splhigh;
-
-void mips_init __P((int, char *[], char *[]));
-void initcpu __P((void));
-void dumpsys __P((void));
-void dumpconf __P((void));
-
-static void tlb_init_pica __P((void));
-static void tlb_init_tyne __P((void));
-static int get_simm_size __P((int *, int));
-static char *getenv __P((char *env));
-static void get_eth_hw_addr __P((char *));
-static int atoi __P((char *, int));
-
-
-/*
- * safepri is a safe priority for sleep to set for a spin-wait
- * during autoconfiguration or after a panic.
- */
-int safepri = PSL_LOWIPL;
-
-struct user *proc0paddr;
-struct proc nullproc; /* for use by swtch_exit() */
-
-/*
- * Do all the stuff that locore normally does before calling main().
- * Process arguments passed to us by the BIOS.
- * Reset mapping and set up mapping to hardware and init "wired" reg.
- * Return the first page address following the system.
- */
-void
-mips_init(argc, argv, envv)
- int argc;
- char *argv[];
- char *envv[]; /* Not on all arches... */
-{
- char *cp;
- int i;
- unsigned firstaddr;
- caddr_t sysend;
- caddr_t start;
- struct tlb tlb;
- extern char edata[], end[];
- extern char MipsTLBMiss[], MipsTLBMissEnd[];
- extern char MipsException[], MipsExceptionEnd[];
-
- /* clear the BSS segment in OpenBSD code */
- sysend = (caddr_t)mips_round_page(end);
- bzero(edata, sysend - edata);
-
- environment = &argv[1];
-
- /* Initialize the CPU type */
- bios_ident();
-
- /*
- * Get config register now as mapped from BIOS since we are
- * going to demap these addresses later. We want as may TLB
- * entries as possible to do something useful :-).
- */
-
- switch (system_type) {
- case ACER_PICA_61: /* ALI PICA 61 and MAGNUM is almost the */
- case MAGNUM: /* Same kind of hardware. NEC goes here too */
- if(system_type == MAGNUM) {
- strcpy(cpu_model, "MIPS Magnum");
- }
- else {
- strcpy(cpu_model, "Acer Pica-61");
- }
- arc_bus_io.bus_base = PICA_V_ISA_IO;
- arc_bus_mem.bus_base = PICA_V_ISA_MEM;
- CONADDR = 0;
- break;
-
- case DESKSTATION_RPC44:
- strcpy(cpu_model, "Deskstation rPC44");
- arc_bus_io.bus_base = RPC44_V_ISA_IO;
- arc_bus_mem.bus_base = RPC44_V_ISA_MEM;
- CONADDR = 0; /* Don't screew the mouse... */
- break;
-
- case DESKSTATION_TYNE:
- strcpy(cpu_model, "Deskstation Tyne");
- arc_bus_io.bus_base = TYNE_V_ISA_IO;
- arc_bus_mem.bus_base = TYNE_V_ISA_MEM;
- CONADDR = 0; /* Don't screew the mouse... */
- break;
-
- case SNI_RM200:
- strcpy(cpu_model, "Siemens Nixdorf RM200");
-#if 0
- arc_bus_io.bus_base = RM200_V_ISA_IO;
- arc_bus_mem.bus_base = RM200_V_ISA_MEM;
-#endif
- CONADDR = 0; /* Don't screew the mouse... */
- break;
-
- case -1: /* Not identified as an ARC system. We have a couple */
- /* of other options. Systems not having an ARC Bios */
-
- /* Make this more fancy when more comes in here */
- environment = envv;
-#if 0
- system_type = ALGOR_P4032;
- strcpy(cpu_model, "Algorithmics P-4032");
- arc_bus_io.bus_sparse1 = 2;
- arc_bus_io.bus_sparse2 = 1;
- arc_bus_io.bus_sparse4 = 0;
- arc_bus_io.bus_sparse8 = 0;
- CONADDR = P4032_COM1;
-#else
- system_type = ALGOR_P5064;
- strcpy(cpu_model, "Algorithmics P-5064");
- arc_bus_io.bus_sparse1 = 0;
- arc_bus_io.bus_sparse2 = 0;
- arc_bus_io.bus_sparse4 = 0;
- arc_bus_io.bus_sparse8 = 0;
- CONADDR = P5064_COM1;
-#endif
-
- mem_layout[0].mem_start = 0;
- mem_layout[0].mem_size = mips_trunc_page(CACHED_TO_PHYS(kernel_text));
- mem_layout[1].mem_start = CACHED_TO_PHYS((int)sysend);
- if(getenv("memsize") != 0) {
- i = atoi(getenv("memsize"), 10);
- i = 1024 * 1024 * i;
- mem_layout[1].mem_size = i - (int)(CACHED_TO_PHYS(sysend));
- physmem = i;
- }
- else {
- i = get_simm_size((int *)0, 128*1024*1024);
- mem_layout[1].mem_size = i - (int)(CACHED_TO_PHYS(sysend));
- physmem = i;
-/*XXX Ouch!!! */
- mem_layout[2].mem_start = i;
- mem_layout[2].mem_size = get_simm_size((int *)(i), 0);
- physmem += mem_layout[2].mem_size;
- mem_layout[3].mem_start = i+i/2;
- mem_layout[3].mem_size = get_simm_size((int *)(i+i/2), 0);
- physmem += mem_layout[3].mem_size;
- }
-/*XXX*/
- argv[0] = getenv("bootdev");
- if(argv[0] == 0)
- argv[0] = "unknown";
-
-
- break;
-
- default: /* This is probably the best we can do... */
- bios_putstring("kernel not configured for this system\n");
- boot(RB_HALT | RB_NOSYNC);
- }
- physmem = btoc(physmem);
-
- /* look at argv[0] and compute bootdev for autoconfig setup */
- makebootdev(argv[0]);
-
- /*
- * Look at arguments passed to us and compute boothowto.
- * Default to SINGLE and ASKNAME if no args or
- * SINGLE and DFLTROOT if this is a ramdisk kernel.
- */
-#ifdef RAMDISK_HOOKS
- boothowto = RB_SINGLE | RB_DFLTROOT;
-#else
- boothowto = RB_SINGLE | RB_ASKNAME;
-#endif /* RAMDISK_HOOKS */
-
-#ifdef KADB
- boothowto |= RB_KDB;
-#endif
-
- get_eth_hw_addr(getenv("ethaddr"));
- cp = getenv("osloadoptions");
- if(cp) {
- while(*cp) {
- switch (*cp++) {
- case 'a': /* autoboot */
- boothowto &= ~RB_SINGLE;
- break;
-
- case 'd': /* use compiled in default root */
- boothowto |= RB_DFLTROOT;
- break;
-
- case 'n': /* ask for names */
- boothowto |= RB_ASKNAME;
- break;
-
- case 'N': /* don't ask for names */
- boothowto &= ~RB_ASKNAME;
- break;
-
- case 's': /* use serial console */
- boothowto |= RB_SERCONS;
- break;
- }
-
- }
- }
-
- /*
- * Now its time to abandon the BIOS and be self supplying.
- * Start with cleaning out the TLB. Bye bye Microsoft....
- */
- cpucfg = R4K_ConfigCache();
- switch(cpu_id.cpu.cp_imp) {
- case MIPS_R4300:
- num_tlbentries = 32;
- break;
- default:
- num_tlbentries = 48;
- break;
- }
-
- R4K_SetWIRED(0);
- R4K_TLBFlush(num_tlbentries);
- R4K_SetWIRED(VMWIRED_ENTRIES);
-
- switch (system_type) {
- case ACER_PICA_61:
- case MAGNUM:
- tlb_init_pica();
- break;
-
- case DESKSTATION_TYNE:
- tlb_init_tyne();
- break;
-
- case DESKSTATION_RPC44:
- break;
-
- case ALGOR_P4032:
- case ALGOR_P5064:
- break;
-
- case SNI_RM200:
- /*XXX*/
- break;
- }
-
- /*
- * Init mapping for u page(s) for proc[0], pm_tlbpid 1.
- */
- sysend = (caddr_t)(((int)sysend + 3) & -4);
- start = sysend;
- curproc->p_addr = proc0paddr = (struct user *)sysend;
- curproc->p_md.md_regs = proc0paddr->u_pcb.pcb_regs;
- firstaddr = CACHED_TO_PHYS(sysend);
- for (i = 0; i < UPAGES; i+=2) {
- tlb.tlb_mask = PG_SIZE_4K;
- tlb.tlb_hi = vad_to_vpn((UADDR + (i << PGSHIFT))) | 1;
- tlb.tlb_lo0 = vad_to_pfn(firstaddr) | PG_V | PG_M | PG_CACHED;
- tlb.tlb_lo1 = vad_to_pfn(firstaddr + NBPG) | PG_V | PG_M | PG_CACHED;
- curproc->p_md.md_upte[i] = tlb.tlb_lo0;
- curproc->p_md.md_upte[i+1] = tlb.tlb_lo1;
- R4K_TLBWriteIndexed(i,&tlb);
- firstaddr += NBPG * 2;
- }
- sysend += UPAGES * NBPG;
- sysend = (caddr_t)(((int)sysend + 3) & -4);
- R4K_SetPID(1);
-
- /*
- * init nullproc for swtch_exit().
- * init mapping for u page(s), pm_tlbpid 0
- * This could be used for an idle process.
- */
- nullproc.p_addr = (struct user *)sysend;
- nullproc.p_md.md_regs = nullproc.p_addr->u_pcb.pcb_regs;
- bcopy("nullproc", nullproc.p_comm, sizeof("nullproc"));
- firstaddr = CACHED_TO_PHYS(sysend);
- for (i = 0; i < UPAGES; i+=2) {
- nullproc.p_md.md_upte[i] = vad_to_pfn(firstaddr) | PG_V | PG_M | PG_CACHED;
- nullproc.p_md.md_upte[i+1] = vad_to_pfn(firstaddr + NBPG) | PG_V | PG_M | PG_CACHED;
- firstaddr += NBPG * 2;
- }
- sysend += UPAGES * NBPG;
-
- /* clear pages for u areas */
- bzero(start, sysend - start);
-
- /*
- * Copy down exception vector code.
- */
- if (MipsTLBMissEnd - MipsTLBMiss > 0x80)
- panic("startup: TLB code too large");
- bcopy(MipsTLBMiss, (char *)TLB_MISS_EXC_VEC,
- MipsTLBMissEnd - MipsTLBMiss);
- bcopy(MipsException, (char *)GEN_EXC_VEC,
- MipsExceptionEnd - MipsException);
-
- /*
- * Clear out the I and D caches.
- */
- R4K_FlushCache();
-
- i = *(volatile u_int32_t *)0x80000300; /* Read and cache */
- R4K_FlushCache(); /* Flush */
- *(volatile u_int32_t *)0xa0000300 = ~i; /* Write uncached */
- l2cache_is_snooping = (~i == *(volatile u_int32_t *)0x80000300);
- *(volatile u_int32_t *)0x80000300 = i; /* Write uncached */
- R4K_FlushCache(); /* Flush */
-
-
- /*
- * Initialize error message buffer.
- */
- msgbufp = (struct msgbuf *)(sysend);
- sysend = (caddr_t)(sysend + (sizeof(struct msgbuf)));
- msgbufmapped = 1;
-
- /*
- * Allocate space for system data structures.
- * The first available kernel virtual address is in "sysend".
- * As pages of kernel virtual memory are allocated, "sysend"
- * is incremented.
- *
- * These data structures are allocated here instead of cpu_startup()
- * because physical memory is directly addressable. We don't have
- * to map these into virtual address space.
- */
- start = sysend;
-
-#define valloc(name, type, num) \
- (name) = (type *)sysend; sysend = (caddr_t)((name)+(num))
-#define valloclim(name, type, num, lim) \
- (name) = (type *)sysend; sysend = (caddr_t)((lim) = ((name)+(num)))
-#ifdef REAL_CLISTS
- valloc(cfree, struct cblock, nclist);
-#endif
- valloc(timeouts, struct timeout, ntimeout);
-#ifdef SYSVSHM
- valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
-#endif
-#ifdef SYSVSEM
- valloc(sema, struct semid_ds, seminfo.semmni);
- valloc(sem, struct sem, seminfo.semmns);
- /* This is pretty disgusting! */
- valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
-#endif
-#ifdef SYSVMSG
- valloc(msgpool, char, msginfo.msgmax);
- valloc(msgmaps, struct msgmap, msginfo.msgseg);
- valloc(msghdrs, struct msg, msginfo.msgtql);
- valloc(msqids, struct msqid_ds, msginfo.msgmni);
-#endif
-
-#ifndef BUFCACHEPERCENT
-#define BUFCACHEPERCENT 5
-#endif
-
- /*
- * Determine how many buffers to allocate.
- * We allocate more buffer space than the BSD standard of
- * using 10% of memory for the first 2 Meg, 5% of remaining.
- * We just allocate a flat 10%. Ensure a minimum of 16 buffers.
- * We allocate 1/2 as many swap buffer headers as file i/o buffers.
- */
- if (bufpages == 0) {
- if (physmem < btoc(2 * 1024 * 1024))
- bufpages = physmem / (10 * CLSIZE);
- else
- bufpages = (btoc(2 * 1024 * 1024) + physmem) *
- BUFCACHEPERCENT / (100 * CLSIZE);
- }
- if (nbuf == 0) {
- nbuf = bufpages;
- if (nbuf < 16)
- nbuf = 16;
- }
-
- /* Restrict to at most 70% filled kvm */
- if (nbuf * MAXBSIZE >
- (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) * 7 / 10)
- nbuf = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
- MAXBSIZE * 7 / 10;
-
- /* More buffer pages than fits into the buffers is senseless. */
- if (bufpages > nbuf * MAXBSIZE / CLBYTES)
- bufpages = nbuf * MAXBSIZE / CLBYTES;
-
- if (nswbuf == 0) {
- nswbuf = (nbuf / 2) &~ 1; /* force even */
- if (nswbuf > 256)
- nswbuf = 256; /* sanity */
- }
- valloc(swbuf, struct buf, nswbuf);
- valloc(buf, struct buf, nbuf);
-
- /*
- * Clear allocated memory.
- */
- bzero(start, sysend - start);
-
- /*
- * Initialize the virtual memory system.
- */
- vm_set_page_size(); /* XXX Works when default page size is 4k */
- pmap_bootstrap((vm_offset_t)sysend);
-}
-
-void
-tlb_init_pica()
-{
- struct tlb tlb;
-
- tlb.tlb_mask = PG_SIZE_256K;
- tlb.tlb_hi = vad_to_vpn(R4030_V_LOCAL_IO_BASE);
- tlb.tlb_lo0 = vad_to_pfn(R4030_P_LOCAL_IO_BASE) | PG_IOPAGE;
- tlb.tlb_lo1 = vad_to_pfn(PICA_P_INT_SOURCE) | PG_IOPAGE;
- R4K_TLBWriteIndexed(1, &tlb);
-
- tlb.tlb_mask = PG_SIZE_1M;
- tlb.tlb_hi = vad_to_vpn(PICA_V_LOCAL_VIDEO_CTRL);
- tlb.tlb_lo0 = vad_to_pfn(PICA_P_LOCAL_VIDEO_CTRL) | PG_IOPAGE;
- tlb.tlb_lo1 = vad_to_pfn(PICA_P_LOCAL_VIDEO_CTRL + PICA_S_LOCAL_VIDEO_CTRL/2) | PG_IOPAGE;
- R4K_TLBWriteIndexed(2, &tlb);
-
- tlb.tlb_mask = PG_SIZE_1M;
- tlb.tlb_hi = vad_to_vpn(PICA_V_EXTND_VIDEO_CTRL);
- tlb.tlb_lo0 = vad_to_pfn(PICA_P_EXTND_VIDEO_CTRL) | PG_IOPAGE;
- tlb.tlb_lo1 = vad_to_pfn(PICA_P_EXTND_VIDEO_CTRL + PICA_S_EXTND_VIDEO_CTRL/2) | PG_IOPAGE;
- R4K_TLBWriteIndexed(3, &tlb);
-
- tlb.tlb_mask = PG_SIZE_4M;
- tlb.tlb_hi = vad_to_vpn(PICA_V_LOCAL_VIDEO);
- tlb.tlb_lo0 = vad_to_pfn(PICA_P_LOCAL_VIDEO) | PG_IOPAGE;
- tlb.tlb_lo1 = vad_to_pfn(PICA_P_LOCAL_VIDEO + PICA_S_LOCAL_VIDEO/2) | PG_IOPAGE;
- R4K_TLBWriteIndexed(4, &tlb);
-
- tlb.tlb_mask = PG_SIZE_16M;
- tlb.tlb_hi = vad_to_vpn(PICA_V_ISA_IO);
- tlb.tlb_lo0 = vad_to_pfn(PICA_P_ISA_IO) | PG_IOPAGE;
- tlb.tlb_lo1 = vad_to_pfn(PICA_P_ISA_MEM) | PG_IOPAGE;
- R4K_TLBWriteIndexed(5, &tlb);
-}
-
-void
-tlb_init_tyne()
-{
- struct tlb tlb;
-
- tlb.tlb_mask = PG_SIZE_256K;
- tlb.tlb_hi = vad_to_vpn(TYNE_V_BOUNCE);
- tlb.tlb_lo0 = vad_to_pfn64(TYNE_P_BOUNCE) | PG_IOPAGE;
- tlb.tlb_lo1 = PG_G;
- R4K_TLBWriteIndexed(1, &tlb);
-
- tlb.tlb_mask = PG_SIZE_1M;
- tlb.tlb_hi = vad_to_vpn(TYNE_V_ISA_IO);
- tlb.tlb_lo0 = vad_to_pfn64(TYNE_P_ISA_IO) | PG_IOPAGE;
- tlb.tlb_lo1 = PG_G;
- R4K_TLBWriteIndexed(2, &tlb);
-
- tlb.tlb_mask = PG_SIZE_1M;
- tlb.tlb_hi = vad_to_vpn(TYNE_V_ISA_MEM);
- tlb.tlb_lo0 = vad_to_pfn64(TYNE_P_ISA_MEM) | PG_IOPAGE;
- tlb.tlb_lo1 = PG_G;
- R4K_TLBWriteIndexed(3, &tlb);
-
- tlb.tlb_mask = PG_SIZE_4K;
- tlb.tlb_hi = vad_to_vpn(0xe3000000);
- tlb.tlb_lo0 = 0x03ffc000 | PG_IOPAGE;
- tlb.tlb_lo1 = PG_G;
- R4K_TLBWriteIndexed(4, &tlb);
-}
-
-/*
- * Simple routine to figure out SIMM module size.
- * This code is a real hack and can surely be improved on... :-)
- */
-static int
-get_simm_size(fadr, max)
- int *fadr;
- int max;
-{
- int msave;
- int msize;
- int ssize;
- static int a1 = 0, a2 = 0;
- static int s1 = 0, s2 = 0;
-
- if(!max) {
- if(a1 == (int)fadr)
- return(s1);
- else if(a2 == (int)fadr)
- return(s2);
- else
- return(0);
- }
- fadr = (int *)PHYS_TO_UNCACHED(CACHED_TO_PHYS((int)fadr));
-
- msize = max - 0x400000;
- ssize = msize - 0x400000;
-
- /* Find bank size of last module */
- while(ssize >= 0) {
- msave = fadr[ssize / 4];
- fadr[ssize / 4] = 0xC0DEB00F;
- if(fadr[msize /4 ] == 0xC0DEB00F) {
- fadr[ssize / 4] = msave;
- if(fadr[msize/4] == msave) {
- break; /* Wrap around */
- }
- }
- fadr[ssize / 4] = msave;
- ssize -= 0x400000;
- }
- msize = msize - ssize;
- if(msize == max)
- return(msize); /* well it never wrapped... */
-
- msave = fadr[0];
- fadr[0] = 0xC0DEB00F;
- if(fadr[msize / 4] == 0xC0DEB00F) {
- fadr[0] = msave;
- if(fadr[msize / 4] == msave)
- return(msize); /* First module wrap = size */
- }
-
- /* Ooops! Two not equal modules. Find size of first + second */
- s1 = s2 = msize;
- ssize = 0;
- while(ssize < max) {
- msave = fadr[ssize / 4];
- fadr[ssize / 4] = 0xC0DEB00F;
- if(fadr[msize /4 ] == 0xC0DEB00F) {
- fadr[ssize / 4] = msave;
- if(fadr[msize/4] == msave) {
- break; /* Found end of module 1 */
- }
- }
- fadr[ssize / 4] = msave;
- ssize += s2;
- msize += s2;
- }
-
- /* Is second bank dual sided? */
- fadr[(ssize+ssize/2)/4] = ~fadr[ssize];
- if(fadr[(ssize+ssize/2)/4] != fadr[ssize]) {
- a2 = ssize+ssize/2;
- }
- a1 = ssize;
-
- return(ssize);
-}
-
-/*
- * Return a pointer to the given environment variable.
- */
-static char *
-getenv(envname)
- char *envname;
-{
- char **env = environment;
- int i;
-
- i = strlen(envname);
-
- while(*env) {
- if(strncasecmp(envname, *env, i) == 0 && (*env)[i] == '=') {
- return(&(*env)[i+1]);
- }
- env++;
- }
- return(NULL);
-}
-
-/*
- * Console initialization: called early on from main,
- * before vm init or startup. Do enough configuration
- * to choose and initialize a console.
- */
-void
-consinit()
-{
- static int initted;
-
- if (initted)
- return;
- initted = 1;
- cninit();
-}
-
-/*
- * cpu_startup: allocate memory for variable-sized tables,
- * initialize cpu, and do autoconfiguration.
- */
-void
-cpu_startup()
-{
- register unsigned i;
- int base, residual;
- vm_offset_t minaddr, maxaddr;
- vm_size_t size;
-#ifdef DEBUG
- extern int pmapdebug;
- int opmapdebug = pmapdebug;
-
- pmapdebug = 0; /* Shut up pmap debug during bootstrap */
-#endif
-
- /*
- * Good {morning,afternoon,evening,night}.
- */
- printf(version);
- printf("real mem = %d\n", ctob(physmem));
-
- /*
- * Allocate virtual address space for file I/O buffers.
- * Note they are different than the array of headers, 'buf',
- * and usually occupy more virtual memory than physical.
- */
- size = MAXBSIZE * nbuf;
- buffer_map = kmem_suballoc(kernel_map, (vm_offset_t *)&buffers,
- &maxaddr, size, TRUE);
- minaddr = (vm_offset_t)buffers;
- if (vm_map_find(buffer_map, vm_object_allocate(size), (vm_offset_t)0,
- &minaddr, size, FALSE) != KERN_SUCCESS)
- panic("startup: cannot allocate buffers");
- base = bufpages / nbuf;
- residual = bufpages % nbuf;
- if (base >= MAXBSIZE / CLBYTES) {
- /* don't want to alloc more physical mem than needed */
- base = MAXBSIZE / CLBYTES;
- residual = 0;
- }
-
- for (i = 0; i < nbuf; i++) {
- vm_size_t curbufsize;
- vm_offset_t curbuf;
-
- /*
- * First <residual> buffers get (base+1) physical pages
- * allocated for them. The rest get (base) physical pages.
- *
- * The rest of each buffer occupies virtual space,
- * but has no physical memory allocated for it.
- */
- curbuf = (vm_offset_t)buffers + i * MAXBSIZE;
- curbufsize = CLBYTES * (i < residual ? base+1 : base);
- vm_map_pageable(buffer_map, curbuf, curbuf+curbufsize, FALSE);
- vm_map_simplify(buffer_map, curbuf);
- }
- /*
- * Allocate a submap for exec arguments. This map effectively
- * limits the number of processes exec'ing at any time.
- */
- exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
- 16 * NCARGS, TRUE);
- /*
- * Allocate a submap for physio
- */
- phys_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
- VM_PHYS_SIZE, TRUE);
-
- /*
- * Finally, allocate mbuf pool. Since mclrefcnt is an off-size
- * we use the more space efficient malloc in place of kmem_alloc.
- */
- mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES,
- M_MBUF, M_NOWAIT);
- bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES);
- mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
- VM_MBUF_SIZE, FALSE);
- /*
- * Initialize timeouts
- */
- timeout_init();
-
-#ifdef DEBUG
- pmapdebug = opmapdebug;
-#endif
- printf("avail mem = %d\n", ptoa(cnt.v_free_count));
- printf("using %d buffers containing %d bytes of memory\n",
- nbuf, bufpages * CLBYTES);
- /*
- * Set up CPU-specific registers, cache, etc.
- */
- initcpu();
-
- /*
- * Set up buffers, so they can be used to read disk labels.
- */
- bufinit();
-
- /*
- * Configure the system.
- */
- if (boothowto & RB_CONFIG) {
-#ifdef BOOT_CONFIG
- user_config();
-#else
- printf("kernel does not support -c; continuing..\n");
-#endif
- }
- configure();
-
- spl0(); /* safe to turn interrupts on now */
-}
-
-/*
- * machine dependent system variables.
- */
-int
-cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
- int *name;
- u_int namelen;
- void *oldp;
- size_t *oldlenp;
- void *newp;
- size_t newlen;
- struct proc *p;
-{
- dev_t consdev;
-
- /* all sysctl names at this level are terminal */
- if (namelen != 1)
- return (ENOTDIR); /* overloaded */
-
- switch (name[0]) {
- case CPU_CONSDEV:
- if (cn_tab != NULL)
- consdev = cn_tab->cn_dev;
- else
- consdev = NODEV;
- return (sysctl_rdstruct(oldp, oldlenp, newp, &consdev,
- sizeof consdev));
- default:
- return (EOPNOTSUPP);
- }
- /* NOTREACHED */
-}
-
-/*
- * Set registers on exec.
- * Clear all registers except sp, pc.
- */
-void
-setregs(p, pack, stack, retval)
- register struct proc *p;
- struct exec_package *pack;
- u_long stack;
- register_t *retval;
-{
- extern struct proc *machFPCurProcPtr;
-
- bzero((caddr_t)p->p_md.md_regs, (FSR + 1) * sizeof(int));
- p->p_md.md_regs[SP] = stack;
- p->p_md.md_regs[PC] = pack->ep_entry & ~3;
- p->p_md.md_regs[T9] = pack->ep_entry & ~3; /* abicall req */
- p->p_md.md_regs[PS] = PSL_USERSET;
- p->p_md.md_flags &= ~MDP_FPUSED;
- if (machFPCurProcPtr == p)
- machFPCurProcPtr = (struct proc *)0;
- p->p_md.md_ss_addr = 0;
-}
-
-/*
- * WARNING: code in locore.s assumes the layout shown for sf_signum
- * thru sf_handler so... don't screw with them!
- */
-struct sigframe {
- int sf_signum; /* signo for handler */
- siginfo_t *sf_sip; /* pointer to siginfo_t */
- struct sigcontext *sf_scp; /* context ptr for handler */
- sig_t sf_handler; /* handler addr for u_sigc */
- struct sigcontext sf_sc; /* actual context */
- siginfo_t sf_si;
-};
-
-#ifdef DEBUG
-int sigdebug = 0;
-int sigpid = 0;
-#define SDB_FOLLOW 0x01
-#define SDB_KSTACK 0x02
-#define SDB_FPSTATE 0x04
-#endif
-
-/*
- * Send an interrupt to process.
- */
-void
-sendsig(catcher, sig, mask, code, type, val)
- sig_t catcher;
- int sig, mask;
- u_long code;
- int type;
- union sigval val;
-{
- register struct proc *p = curproc;
- register struct sigframe *fp;
- register int *regs;
- register struct sigacts *psp = p->p_sigacts;
- int oonstack, fsize;
- struct sigcontext ksc;
- extern char sigcode[], esigcode[];
-
- regs = p->p_md.md_regs;
- oonstack = psp->ps_sigstk.ss_flags & SA_ONSTACK;
- /*
- * Allocate and validate space for the signal handler
- * context. Note that if the stack is in data space, the
- * call to grow() is a nop, and the copyout()
- * will fail if the process has not already allocated
- * the space with a `brk'.
- */
- fsize = sizeof(struct sigframe);
- if (!(psp->ps_siginfo & sigmask(sig)))
- fsize -= sizeof(siginfo_t);
- if ((psp->ps_flags & SAS_ALTSTACK) &&
- (psp->ps_sigstk.ss_flags & SA_ONSTACK) == 0 &&
- (psp->ps_sigonstack & sigmask(sig))) {
- fp = (struct sigframe *)(psp->ps_sigstk.ss_sp +
- psp->ps_sigstk.ss_size - fsize);
- psp->ps_sigstk.ss_flags |= SA_ONSTACK;
- } else
- fp = (struct sigframe *)(regs[SP] - fsize);
- if ((unsigned)fp <= USRSTACK - ctob(p->p_vmspace->vm_ssize))
- (void)grow(p, (unsigned)fp);
-#ifdef DEBUG
- if ((sigdebug & SDB_FOLLOW) ||
- ((sigdebug & SDB_KSTACK) && (p->p_pid == sigpid)))
- printf("sendsig(%d): sig %d ssp %x usp %x scp %x\n",
- p->p_pid, sig, &oonstack, fp, &fp->sf_sc);
-#endif
- /*
- * Build the signal context to be used by sigreturn.
- */
- ksc.sc_onstack = oonstack;
- ksc.sc_mask = mask;
- ksc.sc_pc = regs[PC];
- ksc.mullo = regs[MULLO];
- ksc.mulhi = regs[MULHI];
- ksc.sc_regs[ZERO] = 0xACEDBADE; /* magic number */
- bcopy((caddr_t)&regs[1], (caddr_t)&ksc.sc_regs[1],
- sizeof(ksc.sc_regs) - sizeof(int));
- ksc.sc_fpused = p->p_md.md_flags & MDP_FPUSED;
- if (ksc.sc_fpused) {
- extern struct proc *machFPCurProcPtr;
-
- /* if FPU has current state, save it first */
- if (p == machFPCurProcPtr)
- MipsSaveCurFPState(p);
- bcopy((caddr_t)&p->p_md.md_regs[F0], (caddr_t)ksc.sc_fpregs,
- sizeof(ksc.sc_fpregs));
- }
-
- if (psp->ps_siginfo & sigmask(sig)) {
- siginfo_t si;
-
- initsiginfo(&si, sig, code, type, val);
- if (copyout((caddr_t)&si, (caddr_t)&fp->sf_si, sizeof si))
- goto bail;
- }
-
- if (copyout((caddr_t)&ksc, (caddr_t)&fp->sf_sc, sizeof(ksc))) {
-bail:
- /*
- * Process has trashed its stack; give it an illegal
- * instruction to halt it in its tracks.
- */
- SIGACTION(p, SIGILL) = SIG_DFL;
- sig = sigmask(SIGILL);
- p->p_sigignore &= ~sig;
- p->p_sigcatch &= ~sig;
- p->p_sigmask &= ~sig;
- psignal(p, SIGILL);
- return;
- }
- /*
- * Build the argument list for the signal handler.
- */
- regs[A0] = sig;
- regs[A1] = (psp->ps_siginfo & sigmask(sig)) ? (int)&fp->sf_si : NULL;
- regs[A2] = (int)&fp->sf_sc;
- regs[A3] = (int)catcher;
-
- regs[PC] = (int)catcher;
- regs[T9] = (int)catcher;
- regs[SP] = (int)fp;
- /*
- * Signal trampoline code is at base of user stack.
- */
- regs[RA] = (int)PS_STRINGS - (esigcode - sigcode);
-#ifdef DEBUG
- if ((sigdebug & SDB_FOLLOW) ||
- ((sigdebug & SDB_KSTACK) && (p->p_pid == sigpid)))
- printf("sendsig(%d): sig %d returns\n",
- p->p_pid, sig);
-#endif
-}
-
-/*
- * System call to cleanup state after a signal
- * has been taken. Reset signal mask and
- * stack state from context left by sendsig (above).
- * Return to previous pc and psl as specified by
- * context left by sendsig. Check carefully to
- * make sure that the user has not modified the
- * psl to gain improper priviledges or to cause
- * a machine fault.
- */
-/* ARGSUSED */
-int
-sys_sigreturn(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct sys_sigreturn_args /* {
- syscallarg(struct sigcontext *) sigcntxp;
- } */ *uap = v;
- register struct sigcontext *scp;
- register int *regs;
- struct sigcontext ksc;
- int error;
-
- scp = SCARG(uap, sigcntxp);
-#ifdef DEBUG
- if (sigdebug & SDB_FOLLOW)
- printf("sigreturn: pid %d, scp %x\n", p->p_pid, scp);
-#endif
- regs = p->p_md.md_regs;
- /*
- * Test and fetch the context structure.
- * We grab it all at once for speed.
- */
- error = copyin((caddr_t)scp, (caddr_t)&ksc, sizeof(ksc));
- if (error || ksc.sc_regs[ZERO] != 0xACEDBADE) {
-#ifdef DEBUG
- if (!(sigdebug & SDB_FOLLOW))
- printf("sigreturn: pid %d, scp %x\n", p->p_pid, scp);
- printf(" old sp %x ra %x pc %x\n",
- regs[SP], regs[RA], regs[PC]);
- printf(" new sp %x ra %x pc %x err %d z %x\n",
- ksc.sc_regs[SP], ksc.sc_regs[RA], ksc.sc_regs[PC],
- error, ksc.sc_regs[ZERO]);
-#endif
- return (EINVAL);
- }
- scp = &ksc;
- /*
- * Restore the user supplied information
- */
- if (scp->sc_onstack & 01)
- p->p_sigacts->ps_sigstk.ss_flags |= SA_ONSTACK;
- else
- p->p_sigacts->ps_sigstk.ss_flags &= ~SA_ONSTACK;
- p->p_sigmask = scp->sc_mask &~ sigcantmask;
- regs[PC] = scp->sc_pc;
- regs[MULLO] = scp->mullo;
- regs[MULHI] = scp->mulhi;
- bcopy((caddr_t)&scp->sc_regs[1], (caddr_t)&regs[1],
- sizeof(scp->sc_regs) - sizeof(int));
- if (scp->sc_fpused)
- bcopy((caddr_t)scp->sc_fpregs, (caddr_t)&p->p_md.md_regs[F0],
- sizeof(scp->sc_fpregs));
- return (EJUSTRETURN);
-}
-
-int waittime = -1;
-
-void
-boot(howto)
- register int howto;
-{
-
- /* take a snap shot before clobbering any registers */
- if (curproc)
- savectx(curproc->p_addr, 0);
-
-#ifdef DEBUG
- if (panicstr)
- stacktrace();
-#endif
-
- boothowto = howto;
- if ((howto & RB_NOSYNC) == 0 && waittime < 0) {
- extern struct proc proc0;
- /* fill curproc with live object */
- if (curproc == NULL)
- curproc = &proc0;
- /*
- * Synchronize the disks....
- */
- waittime = 0;
- vfs_shutdown();
-
- /*
- * If we've been adjusting the clock, the todr
- * will be out of synch; adjust it now.
- */
- resettodr();
- }
- (void) splhigh(); /* extreme priority */
- if (howto & RB_HALT) {
- printf("System halted.\n");
- while(1); /* Forever */
- }
- else {
- if (howto & RB_DUMP)
- dumpsys();
- printf("System restart.\n");
-#if NPC > 0
- /* This is only done on systems with pccons driver */
- if(system_type != ALGOR_P4032) {
- (void)kbc_8042sysreset(); /* Try this first */
- delay(100000); /* Give it a chance */
- }
-#endif
- __asm__(" li $2, 0xbfc00000; jr $2; nop\n");
- while(1); /* Forever */
- }
- /*NOTREACHED*/
-}
-
-int dumpmag = (int)0x8fca0101; /* magic number for savecore */
-int dumpsize = 0; /* also for savecore */
-long dumplo = 0;
-
-void
-dumpconf()
-{
- int nblks;
-
- dumpsize = physmem;
- if (dumpdev != NODEV && bdevsw[major(dumpdev)].d_psize) {
- nblks = (*bdevsw[major(dumpdev)].d_psize)(dumpdev);
- if (dumpsize > btoc(dbtob(nblks - dumplo)))
- dumpsize = btoc(dbtob(nblks - dumplo));
- else if (dumplo == 0)
- dumplo = nblks - btodb(ctob(physmem));
- }
- /*
- * Don't dump on the first CLBYTES (why CLBYTES?)
- * in case the dump device includes a disk label.
- */
- if (dumplo < btodb(CLBYTES))
- dumplo = btodb(CLBYTES);
-}
-
-/*
- * Doadump comes here after turning off memory management and
- * getting on the dump stack, either when called above, or by
- * the auto-restart code.
- */
-void
-dumpsys()
-{
-
- msgbufmapped = 0;
- if (dumpdev == NODEV)
- return;
- /*
- * For dumps during autoconfiguration,
- * if dump device has already configured...
- */
- if (dumpsize == 0)
- dumpconf();
- if (dumplo < 0)
- return;
- printf("\ndumping to dev %x, offset %d\n", dumpdev, dumplo);
- printf("dump not yet implemented");
-#if 0 /* XXX HAVE TO FIX XXX */
- switch (error = (*bdevsw[major(dumpdev)].d_dump)(dumpdev, dumplo,)) {
-
- case ENXIO:
- printf("device bad\n");
- break;
-
- case EFAULT:
- printf("device not ready\n");
- break;
-
- case EINVAL:
- printf("area improper\n");
- break;
-
- case EIO:
- printf("i/o error\n");
- break;
-
- default:
- printf("error %d\n", error);
- break;
-
- case 0:
- printf("succeeded\n");
- }
-#endif
-}
-
-/*
- * Return the best possible estimate of the time in the timeval
- * to which tvp points. Unfortunately, we can't read the hardware registers.
- * We guarantee that the time will be greater than the value obtained by a
- * previous call.
- */
-void
-microtime(tvp)
- register struct timeval *tvp;
-{
- int s = splclock();
- static struct timeval lasttime;
-
- *tvp = time;
-#ifdef notdef
- tvp->tv_usec += clkread();
- while (tvp->tv_usec >= 1000000) {
- tvp->tv_sec++;
- tvp->tv_usec -= 1000000;
- }
-#endif
- if (tvp->tv_sec == lasttime.tv_sec &&
- tvp->tv_usec <= lasttime.tv_usec &&
- (tvp->tv_usec = lasttime.tv_usec + 1) >= 1000000) {
- tvp->tv_sec++;
- tvp->tv_usec -= 1000000;
- }
- lasttime = *tvp;
- splx(s);
-}
-
-void
-initcpu()
-{
-
- switch(system_type) {
- case ACER_PICA_61:
- case MAGNUM:
- /*
- * Disable all interrupts. New masks will be set up
- * during system configuration
- */
- out16(PICA_SYS_LB_IE,0x000);
- out32(R4030_SYS_EXT_IMASK, 0x00);
- break;
- }
-}
-/*
- * Convert "xx:xx:xx:xx:xx:xx" string to ethernet hardware address.
- */
-static void
-get_eth_hw_addr(s)
- char *s;
-{
- int i;
- if(s != NULL) {
- for(i = 0; i < 6; i++) {
- eth_hw_addr[i] = atoi(s, 16);
- s += 3; /* Don't get to fancy here :-) */
- }
- }
-}
-
-/*
- * Convert an ASCII string into an integer.
- */
-static int
-atoi(s, b)
- char *s;
- int b;
-{
- int c;
- unsigned base = b, d;
- int neg = 0, val = 0;
-
- if (s == 0 || (c = *s++) == 0)
- goto out;
-
- /* skip spaces if any */
- while (c == ' ' || c == '\t')
- c = *s++;
-
- /* parse sign, allow more than one (compat) */
- while (c == '-') {
- neg = !neg;
- c = *s++;
- }
-
- /* parse base specification, if any */
- if (c == '0') {
- c = *s++;
- switch (c) {
- case 'X':
- case 'x':
- base = 16;
- c = *s++;
- break;
- case 'B':
- case 'b':
- base = 2;
- c = *s++;
- break;
- default:
- base = 8;
- }
- }
-
- /* parse number proper */
- for (;;) {
- if (c >= '0' && c <= '9')
- d = c - '0';
- else if (c >= 'a' && c <= 'z')
- d = c - 'a' + 10;
- else if (c >= 'A' && c <= 'Z')
- d = c - 'A' + 10;
- else
- break;
- val *= base;
- val += d;
- c = *s++;
- }
- if (neg)
- val = -val;
-out:
- return val;
-}
diff --git a/sys/arch/arc/arc/pmap.c b/sys/arch/arc/arc/pmap.c
deleted file mode 100644
index 052654c613d..00000000000
--- a/sys/arch/arc/arc/pmap.c
+++ /dev/null
@@ -1,1824 +0,0 @@
-/* $OpenBSD: pmap.c,v 1.16 2000/06/08 10:31:15 art Exp $ */
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)pmap.c 8.4 (Berkeley) 1/26/94
- * $Id: pmap.c,v 1.16 2000/06/08 10:31:15 art Exp $
- */
-
-/*
- * Manages physical address maps.
- *
- * In addition to hardware address maps, this
- * module is called upon to provide software-use-only
- * maps which may or may not be stored in the same
- * form as hardware maps. These pseudo-maps are
- * used to store intermediate results from copy
- * operations to and from address spaces.
- *
- * Since the information managed by this module is
- * also stored by the logical address mapping module,
- * this module may throw away valid virtual-to-physical
- * mappings at almost any time. However, invalidations
- * of virtual-to-physical mappings must be done as
- * requested.
- *
- * In order to cope with hardware architectures which
- * make virtual-to-physical map invalidates expensive,
- * this module may delay invalidate or reduced protection
- * operations until such time as they are actually
- * necessary. This module is given full information as
- * to which processors are currently using which maps,
- * and to when physical maps must be made correct.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/malloc.h>
-#include <sys/user.h>
-#include <sys/buf.h>
-#ifdef SYSVSHM
-#include <sys/shm.h>
-#endif
-
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-#include <vm/vm_pageout.h>
-
-#include <machine/pte.h>
-#include <machine/cpu.h>
-#include <machine/memconf.h>
-
-#include <arc/dti/desktech.h>
-
-extern vm_page_t vm_page_alloc1 __P((void));
-extern void vm_page_free1 __P((vm_page_t));
-extern int num_tlbentries;
-
-/*
- * For each vm_page_t, there is a list of all currently valid virtual
- * mappings of that page. An entry is a pv_entry_t, the list is pv_table.
- * XXX really should do this as a part of the higher level code.
- */
-typedef struct pv_entry {
- struct pv_entry *pv_next; /* next pv_entry */
- struct pmap *pv_pmap; /* pmap where mapping lies */
- vm_offset_t pv_va; /* virtual address for mapping */
- int pv_flags; /* Some flags for the mapping */
-} *pv_entry_t;
-#define PV_UNCACHED 0x0001 /* Page is mapped unchached */
-
-/*
- * Local pte bits used only here
- */
-#define PG_RO 0x40000000
-#define PG_WIRED 0x80000000
-
-pv_entry_t pv_table; /* array of entries, one per page */
-
-void mem_zero_page __P((vm_offset_t));
-
-#ifdef MACHINE_NONCONTIG
-static vm_offset_t avail_next;
-static vm_offset_t avail_remaining;
-
-struct physseg {
- vm_offset_t start;
- vm_offset_t end;
- int first_page;
-} physsegs[MAXMEMSEGS+1];
-
-#define pa_index(pa) pmap_page_index(pa)
-
-#else
-#define pa_index(pa) atop((pa) - first_phys_addr)
-#endif /* MACHINE_NONCONTIG */
-
-#define pa_to_pvh(pa) (&pv_table[pa_index(pa)])
-
-#ifdef DIAGNOSTIC
-struct {
- int kernel; /* entering kernel mapping */
- int user; /* entering user mapping */
- int ptpneeded; /* needed to allocate a PT page */
- int pwchange; /* no mapping change, just wiring or protection */
- int wchange; /* no mapping change, just wiring */
- int mchange; /* was mapped but mapping to different page */
- int managed; /* a managed page */
- int firstpv; /* first mapping for this PA */
- int secondpv; /* second mapping for this PA */
- int ci; /* cache inhibited */
- int unmanaged; /* not a managed page */
- int flushes; /* cache flushes */
- int cachehit; /* new entry forced valid entry out */
-} enter_stats;
-struct {
- int calls;
- int removes;
- int flushes;
- int pidflushes; /* HW pid stolen */
- int pvfirst;
- int pvsearch;
-} remove_stats;
-
-#define PDB_FOLLOW 0x0001
-#define PDB_INIT 0x0002
-#define PDB_ENTER 0x0004
-#define PDB_REMOVE 0x0008
-#define PDB_CREATE 0x0010
-#define PDB_PTPAGE 0x0020
-#define PDB_PVENTRY 0x0040
-#define PDB_BITS 0x0080
-#define PDB_COLLECT 0x0100
-#define PDB_PROTECT 0x0200
-#define PDB_TLBPID 0x0400
-#define PDB_PARANOIA 0x2000
-#define PDB_WIRING 0x4000
-#define PDB_PVDUMP 0x8000
-
-int pmapdebug = 0x0;
-
-#endif /* DEBUG */
-
-extern int kernel_text[];
-extern int _end[];
-
-struct pmap kernel_pmap_store;
-
-vm_offset_t avail_start; /* PA of first available physical page */
-vm_offset_t avail_end; /* PA of last available physical page */
-vm_size_t mem_size; /* memory size in bytes */
-vm_offset_t virtual_avail; /* VA of first avail page (after kernel bss)*/
-vm_offset_t virtual_end; /* VA of last avail page (end of kernel AS) */
-#ifdef ATTR
-char *pmap_attributes; /* reference and modify bits */
-#endif
-struct segtab *free_segtab; /* free list kept locally */
-u_int tlbpid_gen = 1; /* TLB PID generation count */
-int tlbpid_cnt = 2; /* next available TLB PID */
-pt_entry_t *Sysmap; /* kernel pte table */
-u_int Sysmapsize; /* number of pte's in Sysmap */
-
-/*
- * Bootstrap the system enough to run with virtual memory.
- * firstaddr is the first unused kseg0 address (not page aligned).
- */
-void
-pmap_bootstrap(firstaddr)
- vm_offset_t firstaddr;
-{
- int i;
- pt_entry_t *spte;
- vm_offset_t start = firstaddr;
- extern int physmem;
-#ifdef MACHINE_NONCONTIG
- struct physseg *pseg;
- int n, nextpage;
-#endif
-
-
-#define valloc(name, type, num) \
- (name) = (type *)firstaddr; firstaddr = (vm_offset_t)((name)+(num))
- /*
- * Allocate a PTE table for the kernel.
- * The '1024' comes from PAGER_MAP_SIZE in vm_pager_init().
- * This should be kept in sync.
- * We also reserve space for kmem_alloc_pageable() for vm_fork().
- */
- Sysmapsize = (VM_KMEM_SIZE + VM_MBUF_SIZE + VM_PHYS_SIZE +
- nbuf * MAXBSIZE + 16 * NCARGS) / NBPG + 1024 + 256;
- Sysmapsize += maxproc * UPAGES * 2;
-#ifdef SYSVSHM
- Sysmapsize += shminfo.shmall;
-#endif
- valloc(Sysmap, pt_entry_t, Sysmapsize);
-#ifdef ATTR
- valloc(pmap_attributes, char, physmem);
-#endif
- /*
- * Allocate memory for pv_table.
- * This will allocate more entries than we really need.
- * We could do this in pmap_init when we know the actual
- * phys_start and phys_end but its better to use kseg0 addresses
- * rather than kernel virtual addresses mapped through the TLB.
- */
-#ifdef MACHINE_NONCONTIG
- i = 0;
- for( n = 0; n < MAXMEMSEGS; n++) {
- i += mips_btop(mem_layout[n].mem_size);
- }
-#else
- i = physmem - mips_btop(CACHED_TO_PHYS(firstaddr));
-#endif /*MACHINE_NONCONTIG*/
- valloc(pv_table, struct pv_entry, i);
-
- /*
- * Clear allocated memory.
- */
- firstaddr = mips_round_page(firstaddr);
- bzero((caddr_t)start, firstaddr - start);
-
- avail_start = CACHED_TO_PHYS(firstaddr);
- avail_end = mips_ptob(physmem);
-
-#ifdef MACHINE_NONCONTIG
- avail_remaining = 0;
- nextpage = 0;
-
- /*
- * Now set up memory areas. Be careful to remove areas used
- * for the OS and for exception vector stuff.
- */
- pseg = &physsegs[0];
-
- for( i = 0; i < MAXMEMSEGS; i++) {
- /* Adjust for the kernel exeption vectors and sys data area */
- if(mem_layout[i].mem_start < 0x20000) {
- if((mem_layout[i].mem_start + mem_layout[i].mem_size) < 0x8000)
- continue; /* To small skip it */
- mem_layout[i].mem_size -= 0x20000 - mem_layout[i].mem_start;
- mem_layout[i].mem_start = 0x20000; /* Adjust to be above vec's */
- }
- /* Adjust for the kernel expansion area (bufs etc) */
- if((mem_layout[i].mem_start + mem_layout[i].mem_size > CACHED_TO_PHYS(kernel_text)) &&
- (mem_layout[i].mem_start < CACHED_TO_PHYS(avail_start))) {
- mem_layout[i].mem_size -= CACHED_TO_PHYS(avail_start) - mem_layout[i].mem_start;
- mem_layout[i].mem_start = CACHED_TO_PHYS(avail_start);
- }
-
- if(mem_layout[i].mem_size == 0)
- continue;
-
- pseg->start = mem_layout[i].mem_start;
- pseg->end = pseg->start + mem_layout[i].mem_size;
- pseg->first_page = nextpage;
- nextpage += (pseg->end - pseg->start) / NBPG;
- avail_remaining += (pseg->end - pseg->start) / NBPG;
- pseg++;
- }
-
- avail_next = physsegs[0].start;
-
-#endif /* MACHINE_NONCONTIG */
-
- virtual_avail = VM_MIN_KERNEL_ADDRESS;
- virtual_end = VM_MIN_KERNEL_ADDRESS + Sysmapsize * NBPG;
- /* XXX need to decide how to set cnt.v_page_size */
-
- simple_lock_init(&pmap_kernel()->pm_lock);
- pmap_kernel()->pm_count = 1;
-
- /*
- * The R4?00 stores only one copy of the Global bit in the
- * translation lookaside buffer for each 2 page entry.
- * Thus invalid entrys must have the Global bit set so
- * when Entry LO and Entry HI G bits are anded together
- * they will produce a global bit to store in the tlb.
- */
- for(i = 0, spte = Sysmap; i < Sysmapsize; i++, spte++)
- spte->pt_entry = PG_G;
-}
-
-/*
- * Bootstrap memory allocator. This function allows for early dynamic
- * memory allocation until the virtual memory system has been bootstrapped.
- * After that point, either kmem_alloc or malloc should be used. This
- * function works by stealing pages from the (to be) managed page pool,
- * stealing virtual address space, then mapping the pages and zeroing them.
- *
- * It should be used from pmap_bootstrap till vm_page_startup, afterwards
- * it cannot be used, and will generate a panic if tried. Note that this
- * memory will never be freed, and in essence it is wired down.
- */
-void *
-pmap_bootstrap_alloc(size)
- int size;
-{
- vm_offset_t val;
- extern boolean_t vm_page_startup_initialized;
-
- if (vm_page_startup_initialized)
- panic("pmap_bootstrap_alloc: called after startup initialized");
-
- val = PHYS_TO_CACHED(avail_start);
- size = round_page(size);
- avail_start += size;
-
- bzero((caddr_t)val, size);
- return ((void *)val);
-}
-
-/*
- * Initialize the pmap module.
- * Called by vm_init, to initialize any structures that the pmap
- * system needs to map virtual memory.
- */
-void
-#ifdef MACHINE_NONCONTIG
-pmap_init()
-#else
-pmap_init(phys_start, phys_end)
- vm_offset_t phys_start, phys_end;
-#endif
-{
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_INIT))
-#ifdef MACHINE_NONCONTIG
- printf("pmap_init(%lx, %lx)\n", avail_start, avail_end);
-#else
- printf("pmap_init(%lx, %lx)\n", phys_start, phys_end);
-#endif
-#endif /*DEBUG*/
-}
-
-#ifdef MACHINE_NONCONTIG
-inline int
-pmap_page_index(pa)
- vm_offset_t pa;
-{
- struct physseg *ps = &physsegs[0];
- while (ps->start) {
- if(pa >= ps->start && pa < ps->end) {
- return(atop(pa - ps->start) + ps->first_page);
- }
- ps++;
- }
- return -1;
-}
-
-unsigned int
-pmap_free_pages()
-{
- return avail_remaining;
-}
-
-void
-pmap_virtual_space(startp, endp)
- vm_offset_t *startp;
- vm_offset_t *endp;
-{
- *startp = virtual_avail;
- *endp = virtual_end;
-}
-
-int
-pmap_next_page(p_addr)
- vm_offset_t *p_addr;
-{
- static int cur_seg = 0;
-
- if (physsegs[cur_seg].start == 0)
- return FALSE;
- if (avail_next == physsegs[cur_seg].end) {
- avail_next = physsegs[++cur_seg].start;
- }
-
- if (avail_next == 0)
- return FALSE;
- *p_addr = avail_next;
- avail_next += NBPG;
- avail_remaining--;
- return TRUE;
-}
-#endif /*MACHINE_NONCONTIG*/
-
-/*
- * Create and return a physical map.
- *
- * If the size specified for the map
- * is zero, the map is an actual physical
- * map, and may be referenced by the
- * hardware.
- *
- * If the size specified is non-zero,
- * the map will be used in software only, and
- * is bounded by that size.
- */
-pmap_t
-pmap_create(size)
- vm_size_t size;
-{
- register pmap_t pmap;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- printf("pmap_create(%x)\n", size);
-#endif
- /*
- * Software use map does not need a pmap
- */
- if (size)
- return (NULL);
-
- /* XXX: is it ok to wait here? */
- pmap = (pmap_t) malloc(sizeof *pmap, M_VMPMAP, M_WAITOK);
-#ifdef notifwewait
- if (pmap == NULL)
- panic("pmap_create: cannot allocate a pmap");
-#endif
- bzero(pmap, sizeof(*pmap));
- pmap_pinit(pmap);
- return (pmap);
-}
-
-/*
- * Initialize a preallocated and zeroed pmap structure,
- * such as one in a vmspace structure.
- */
-void
-pmap_pinit(pmap)
- register struct pmap *pmap;
-{
- register int i;
- int s;
- extern struct vmspace vmspace0;
- extern struct user *proc0paddr;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- printf("pmap_pinit(%x)\n", pmap);
-#endif
- simple_lock_init(&pmap->pm_lock);
- pmap->pm_count = 1;
- if (free_segtab) {
- s = splimp();
- pmap->pm_segtab = free_segtab;
- free_segtab = *(struct segtab **)free_segtab;
- pmap->pm_segtab->seg_tab[0] = NULL;
- splx(s);
- } else {
- register struct segtab *stp;
- vm_page_t mem;
-
- do {
- mem = vm_page_alloc1();
- if (mem == NULL) {
- /* XXX What else can we do? Deadlocks? */
- vm_wait("ppinit");
- }
- } while (mem == NULL);
-
- /* Do zero via cached if No L2 or Snooping L2 */
- pmap_zero_page(VM_PAGE_TO_PHYS(mem));
- pmap->pm_segtab = stp = (struct segtab *)
- PHYS_TO_CACHED(VM_PAGE_TO_PHYS(mem));
- i = NBPG / sizeof(struct segtab);
- s = splimp();
- while (--i != 0) {
- stp++;
- *(struct segtab **)stp = free_segtab;
- free_segtab = stp;
- }
- splx(s);
- }
-#ifdef DIAGNOSTIC
- for (i = 0; i < PMAP_SEGTABSIZE; i++)
- if (pmap->pm_segtab->seg_tab[i] != 0)
- panic("pmap_pinit: pm_segtab != 0");
-#endif
- if (pmap == vmspace0.vm_map.pmap) {
- /*
- * The initial process has already been allocated a TLBPID
- * in mach_init().
- */
- pmap->pm_tlbpid = 1;
- pmap->pm_tlbgen = tlbpid_gen;
- proc0paddr->u_pcb.pcb_segtab = (void *)pmap->pm_segtab;
- } else {
- pmap->pm_tlbpid = 0;
- pmap->pm_tlbgen = 0;
- }
-}
-
-/*
- * Retire the given physical map from service.
- * Should only be called if the map contains
- * no valid mappings.
- */
-void
-pmap_destroy(pmap)
- register pmap_t pmap;
-{
- int count;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- printf("pmap_destroy(%x)\n", pmap);
-#endif
- if (pmap == NULL)
- return;
-
- simple_lock(&pmap->pm_lock);
- count = --pmap->pm_count;
- simple_unlock(&pmap->pm_lock);
- if (count == 0) {
- pmap_release(pmap);
- free((caddr_t)pmap, M_VMPMAP);
- }
-}
-
-/*
- * Release any resources held by the given physical map.
- * Called when a pmap initialized by pmap_pinit is being released.
- * Should only be called if the map contains no valid mappings.
- */
-void
-pmap_release(pmap)
- register pmap_t pmap;
-{
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- printf("pmap_release(%x)\n", pmap);
-#endif
-
- if (pmap->pm_segtab) {
- register pt_entry_t *pte;
- register int i;
- int s;
-#ifdef DIAGNOSTIC
- register int j;
-#endif
-
- for (i = 0; i < PMAP_SEGTABSIZE; i++) {
- /* get pointer to segment map */
- pte = pmap->pm_segtab->seg_tab[i];
- if (!pte)
- continue;
-#ifdef DIAGNOSTIC
- for (j = 0; j < NPTEPG; j++) {
- if ((pte+j)->pt_entry)
- panic("pmap_release: segmap not empty");
- }
-#endif
- R4K_HitFlushDCache((vm_offset_t)pte, PAGE_SIZE);
- vm_page_free1(
- PHYS_TO_VM_PAGE(CACHED_TO_PHYS(pte)));
- pmap->pm_segtab->seg_tab[i] = NULL;
- }
- s = splimp();
- *(struct segtab **)pmap->pm_segtab = free_segtab;
- free_segtab = pmap->pm_segtab;
- splx(s);
- pmap->pm_segtab = NULL;
- }
-}
-
-/*
- * Add a reference to the specified pmap.
- */
-void
-pmap_reference(pmap)
- pmap_t pmap;
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_reference(%x)\n", pmap);
-#endif
- if (pmap != NULL) {
- simple_lock(&pmap->pm_lock);
- pmap->pm_count++;
- simple_unlock(&pmap->pm_lock);
- }
-}
-
-/*
- * Remove the given range of addresses from the specified map.
- *
- * It is assumed that the start and end are properly
- * rounded to the page size.
- */
-void
-pmap_remove(pmap, sva, eva)
- register pmap_t pmap;
- vm_offset_t sva, eva;
-{
- register vm_offset_t nssva;
- register pt_entry_t *pte;
- unsigned entry;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT))
- printf("pmap_remove(%x, %x, %x)\n", pmap, sva, eva);
- remove_stats.calls++;
-#endif
- if (pmap == NULL)
- return;
-
- if (!pmap->pm_segtab) {
- register pt_entry_t *pte;
-
- /* remove entries from kernel pmap */
-#ifdef DIAGNOSTIC
- if (sva < VM_MIN_KERNEL_ADDRESS || eva > virtual_end)
- panic("pmap_remove: kva not in range");
-#endif
- pte = kvtopte(sva);
- for (; sva < eva; sva += NBPG, pte++) {
- entry = pte->pt_entry;
- if (!(entry & PG_V))
- continue;
- if (entry & PG_WIRED)
- pmap->pm_stats.wired_count--;
- pmap->pm_stats.resident_count--;
- if(pmap_remove_pv(pmap, sva, pfn_to_vad(entry))) {
- R4K_FlushDCache(sva, PAGE_SIZE);
- }
-#ifdef ATTR
- pmap_attributes[atop(pfn_to_vad(entry))] = 0;
-#endif
- /*
- * Flush the TLB for the given address.
- */
- pte->pt_entry = PG_NV | PG_G; /* See above about G bit */
- R4K_TLBFlushAddr(sva);
-#ifdef DEBUG
- remove_stats.flushes++;
-
-#endif
- }
- return;
- }
-
-#ifdef DIAGNOSTIC
- if (eva > VM_MAXUSER_ADDRESS)
- panic("pmap_remove: uva not in range");
-#endif
- while (sva < eva) {
- nssva = mips_trunc_seg(sva) + NBSEG;
- if (nssva == 0 || nssva > eva)
- nssva = eva;
- /*
- * If VA belongs to an unallocated segment,
- * skip to the next segment boundary.
- */
- if (!(pte = pmap_segmap(pmap, sva))) {
- sva = nssva;
- continue;
- }
- /*
- * Invalidate every valid mapping within this segment.
- */
- pte += uvtopte(sva);
- for (; sva < nssva; sva += NBPG, pte++) {
- entry = pte->pt_entry;
- if (!(entry & PG_V))
- continue;
- if (entry & PG_WIRED)
- pmap->pm_stats.wired_count--;
- pmap->pm_stats.resident_count--;
- if(!pfn_is_ext(entry) && /* padr > 32 bits */
- pmap_remove_pv(pmap, sva, pfn_to_vad(entry))) {
- R4K_FlushDCache(sva, PAGE_SIZE);
- }
-#ifdef ATTR
- pmap_attributes[atop(pfn_to_vad(entry))] = 0;
-#endif
- pte->pt_entry = PG_NV;
- /*
- * Flush the TLB for the given address.
- */
- if (pmap->pm_tlbgen == tlbpid_gen) {
- R4K_TLBFlushAddr(sva | (pmap->pm_tlbpid <<
- VMTLB_PID_SHIFT));
-#ifdef DEBUG
- remove_stats.flushes++;
-#endif
- }
- }
- }
-}
-
-/*
- * pmap_page_protect:
- *
- * Lower the permission for all mappings to a given page.
- */
-void
-pmap_page_protect(pa, prot)
- vm_offset_t pa;
- vm_prot_t prot;
-{
- register pv_entry_t pv;
- register vm_offset_t va;
- int s;
-
-#ifdef DEBUG
- if ((pmapdebug & (PDB_FOLLOW|PDB_PROTECT)) ||
- ((prot == VM_PROT_NONE) && (pmapdebug & PDB_REMOVE)))
- printf("pmap_page_protect(%x, %x)\n", pa, prot);
-#endif
- if (!IS_VM_PHYSADDR(pa))
- return;
-
- switch (prot) {
- case VM_PROT_READ|VM_PROT_WRITE:
- case VM_PROT_ALL:
- break;
-
- /* copy_on_write */
- case VM_PROT_READ:
- case VM_PROT_READ|VM_PROT_EXECUTE:
- pv = pa_to_pvh(pa);
- s = splimp();
- /*
- * Loop over all current mappings setting/clearing as appropos.
- */
- if (pv->pv_pmap != NULL) {
- for (; pv; pv = pv->pv_next) {
- extern vm_offset_t pager_sva, pager_eva;
-
- va = pv->pv_va;
-
- /*
- * XXX don't write protect pager mappings
- */
- if (va >= pager_sva && va < pager_eva)
- continue;
- pmap_protect(pv->pv_pmap, va, va + PAGE_SIZE,
- prot);
- }
- }
- splx(s);
- break;
-
- /* remove_all */
- default:
- pv = pa_to_pvh(pa);
- s = splimp();
- while (pv->pv_pmap != NULL) {
- pmap_remove(pv->pv_pmap, pv->pv_va,
- pv->pv_va + PAGE_SIZE);
- }
- splx(s);
- }
-}
-
-/*
- * Set the physical protection on the
- * specified range of this map as requested.
- */
-void
-pmap_protect(pmap, sva, eva, prot)
- register pmap_t pmap;
- vm_offset_t sva, eva;
- vm_prot_t prot;
-{
- register vm_offset_t nssva;
- register pt_entry_t *pte;
- register unsigned entry;
- u_int p;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_PROTECT))
- printf("pmap_protect(%x, %x, %x, %x)\n", pmap, sva, eva, prot);
-#endif
- if (pmap == NULL)
- return;
-
- if ((prot & VM_PROT_READ) == VM_PROT_NONE) {
- pmap_remove(pmap, sva, eva);
- return;
- }
-
- p = (prot & VM_PROT_WRITE) ? PG_M : PG_RO;
-
- if (!pmap->pm_segtab) {
- /*
- * Change entries in kernel pmap.
- * This will trap if the page is writeable (in order to set
- * the dirty bit) even if the dirty bit is already set. The
- * optimization isn't worth the effort since this code isn't
- * executed much. The common case is to make a user page
- * read-only.
- */
-#ifdef DIAGNOSTIC
- if (sva < VM_MIN_KERNEL_ADDRESS || eva > virtual_end)
- panic("pmap_protect: kva not in range");
-#endif
- pte = kvtopte(sva);
- for (; sva < eva; sva += NBPG, pte++) {
- entry = pte->pt_entry;
- if (!(entry & PG_V))
- continue;
- entry = (entry & ~(PG_M | PG_RO)) | p;
- pte->pt_entry = entry;
- /*
- * Update the TLB if the given address is in the cache.
- */
- R4K_TLBUpdate(sva, entry);
- }
- return;
- }
-
-#ifdef DIAGNOSTIC
- if (eva > VM_MAXUSER_ADDRESS)
- panic("pmap_protect: uva not in range");
-#endif
- while (sva < eva) {
- nssva = mips_trunc_seg(sva) + NBSEG;
- if (nssva == 0 || nssva > eva)
- nssva = eva;
- /*
- * If VA belongs to an unallocated segment,
- * skip to the next segment boundary.
- */
- if (!(pte = pmap_segmap(pmap, sva))) {
- sva = nssva;
- continue;
- }
- /*
- * Change protection on every valid mapping within this segment.
- */
- pte += (sva >> PGSHIFT) & (NPTEPG - 1);
- for (; sva < nssva; sva += NBPG, pte++) {
- entry = pte->pt_entry;
- if (!(entry & PG_V))
- continue;
- entry = (entry & ~(PG_M | PG_RO)) | p;
- pte->pt_entry = entry;
- /*
- * Update the TLB if the given address is in the cache.
- */
- if (pmap->pm_tlbgen == tlbpid_gen)
- R4K_TLBUpdate(sva | (pmap->pm_tlbpid <<
- VMTLB_PID_SHIFT), entry);
- }
- }
-}
-
-/*
- * Return RO protection of page.
- */
-int
-pmap_is_page_ro(pmap, va, entry)
- pmap_t pmap;
- vm_offset_t va;
- int entry;
-{
- return(entry & PG_RO);
-}
-
-/*
- * Return page mapping status.
- */
-int
-pmap_is_pa_mapped(pa)
- vm_offset_t pa;
-{
- pv_entry_t pv;
-
- pv = pa_to_pvh(pa);
- return(pv->pv_pmap != NULL);
-}
-
-/*
- * Return page mapping status.
- */
-vm_offset_t
-pmap_pa_to_va(pa)
- vm_offset_t pa;
-{
- pv_entry_t pv;
-
- pv = pa_to_pvh(pa);
- return(pv->pv_va);
-}
-
-/*
- * pmap_page_cache:
- *
- * Change all mappings of a page to cached/uncached.
- */
-void
-pmap_page_cache(pa,mode)
- vm_offset_t pa;
- int mode;
-{
- pv_entry_t pv;
- pt_entry_t *pte;
- unsigned entry;
- unsigned newmode;
- int s;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_ENTER))
- printf("pmap_page_uncache(%x)\n", pa);
-#endif
- if (!IS_VM_PHYSADDR(pa))
- return;
-
- newmode = mode & PV_UNCACHED ? PG_UNCACHED : PG_CACHED;
- pv = pa_to_pvh(pa);
- s = splimp();
- while (pv) {
- pv->pv_flags = (pv->pv_flags & ~PV_UNCACHED) | mode;
- if (!pv->pv_pmap->pm_segtab) {
- /*
- * Change entries in kernel pmap.
- */
- pte = kvtopte(pv->pv_va);
- entry = pte->pt_entry;
- if (entry & PG_V) {
- entry = (entry & ~PG_CACHEMODE) | newmode;
- pte->pt_entry = entry;
- R4K_TLBUpdate(pv->pv_va, entry);
- }
- }
- else {
- if ((pte = pmap_segmap(pv->pv_pmap, pv->pv_va))) {
- pte += (pv->pv_va >> PGSHIFT) & (NPTEPG - 1);
- entry = pte->pt_entry;
- if (entry & PG_V) {
- entry = (entry & ~PG_CACHEMODE) | newmode;
- pte->pt_entry = entry;
- if (pv->pv_pmap->pm_tlbgen == tlbpid_gen)
- R4K_TLBUpdate(pv->pv_va | (pv->pv_pmap->pm_tlbpid <<
- VMTLB_PID_SHIFT), entry);
- }
- }
- }
- pv = pv->pv_next;
- }
-
- splx(s);
-}
-
-/*
- * Insert the given physical page (p) at
- * the specified virtual address (v) in the
- * target physical map with the protection requested.
- *
- * If specified, the page will be wired down, meaning
- * that the related pte can not be reclaimed.
- *
- * NB: This is the only routine which MAY NOT lazy-evaluate
- * or lose information. That is, this routine must actually
- * insert this page into the given map NOW.
- */
-void
-pmap_enter(pmap, va, pa, prot, wired, access_type)
- register pmap_t pmap;
- vm_offset_t va;
- register vm_offset_t pa;
- vm_prot_t prot;
- boolean_t wired;
- vm_prot_t access_type;
-{
- register pt_entry_t *pte;
- register u_int npte;
-#ifdef DIAGNOSTIC
- register int i;
-#endif
- vm_page_t mem;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_ENTER))
- printf("pmap_enter(%x, %x, %x, %x, %x)\n",
- pmap, va, pa, prot, wired);
-#endif
-#ifdef DIAGNOSTIC
- if (!pmap)
- panic("pmap_enter: pmap");
- if (!pmap->pm_segtab) {
- enter_stats.kernel++;
- if (va < VM_MIN_KERNEL_ADDRESS || va >= virtual_end)
- panic("pmap_enter: kva");
- } else {
- enter_stats.user++;
- if (va >= VM_MAXUSER_ADDRESS)
- panic("pmap_enter: uva");
- }
- if (!(prot & VM_PROT_READ))
- panic("pmap_enter: prot");
-#endif
-
- if (IS_VM_PHYSADDR(pa)) {
- register pv_entry_t pv, npv;
- int s;
-
- if (!(prot & VM_PROT_WRITE))
- npte = PG_ROPAGE;
- else {
- register vm_page_t mem;
-
- mem = PHYS_TO_VM_PAGE(pa);
- if ((int)va < 0) {
- /*
- * Don't bother to trap on kernel writes,
- * just record page as dirty.
- */
- npte = PG_RWPAGE;
-#if 0 /*XXX*/
- mem->flags &= ~PG_CLEAN;
-#endif
- } else
-#ifdef ATTR
- if ((pmap_attributes[atop(pa)] &
- PMAP_ATTR_MOD) || !(mem->flags & PG_CLEAN))
-#else
- if (!(mem->flags & PG_CLEAN))
-#endif
- npte = PG_RWPAGE;
- else
- npte = PG_CWPAGE;
- }
-
-#ifdef DIAGNOSTIC
- enter_stats.managed++;
-#endif
- /*
- * Enter the pmap and virtual address into the
- * physical to virtual map table.
- */
- pv = pa_to_pvh(pa);
- s = splimp();
-#ifdef DEBUG
- if (pmapdebug & PDB_ENTER)
- printf("pmap_enter: pv %x: was %x/%x/%x\n",
- pv, pv->pv_va, pv->pv_pmap, pv->pv_next);
-#endif
- if (pv->pv_pmap == NULL) {
- /*
- * No entries yet, use header as the first entry
- */
-#ifdef DEBUG
- if (pmapdebug & PDB_PVENTRY)
- printf("pmap_enter: first pv: pmap %x va %x\n",
- pmap, va);
-#ifdef DIAGNOSTIC
- enter_stats.firstpv++;
-#endif
-#endif
- pv->pv_va = va;
- pv->pv_flags = 0;
- pv->pv_pmap = pmap;
- pv->pv_next = NULL;
- } else {
- if (!(pv->pv_flags & PV_UNCACHED)) {
- /*
- * There is at least one other VA mapping this page.
- * Check if they are cache index compatible. If not
- * remove all mappings, flush the cache and set page
- * to be mapped uncached. Caching will be restored
- * when pages are mapped compatible again. NOT!
- */
- for (npv = pv; npv; npv = npv->pv_next) {
- /*
- * Check cache aliasing incompatibility
- */
- if((npv->pv_va & CpuCacheAliasMask) != (va & CpuCacheAliasMask)) {
- printf("pmap_enter: creating uncached mapping 0x%x, 0x%x.\n",npv->pv_va, va);
- pmap_page_cache(pa,PV_UNCACHED);
- R4K_FlushDCache(pv->pv_va, PAGE_SIZE);
- npte = (npte & ~PG_CACHEMODE) | PG_UNCACHED;
- break;
- }
- }
- }
- else {
- npte = (npte & ~PG_CACHEMODE) | PG_UNCACHED;
- }
- /*
- * There is at least one other VA mapping this page.
- * Place this entry after the header.
- *
- * Note: the entry may already be in the table if
- * we are only changing the protection bits.
- */
- for (npv = pv; npv; npv = npv->pv_next) {
- if (pmap == npv->pv_pmap && va == npv->pv_va) {
-#ifdef DIAGNOSTIC
- unsigned entry;
-
- if (!pmap->pm_segtab)
- entry = kvtopte(va)->pt_entry;
- else {
- pte = pmap_segmap(pmap, va);
- if (pte) {
- pte += (va >> PGSHIFT) &
- (NPTEPG - 1);
- entry = pte->pt_entry;
- } else
- entry = 0;
- }
- if (!(entry & PG_V) ||
- pfn_to_vad(entry) != pa)
- printf(
- "pmap_enter: found va %x pa %x in pv_table but != %x\n",
- va, pa, entry);
-#endif
- goto fnd;
- }
- }
-#ifdef DEBUG
- if (pmapdebug & PDB_PVENTRY)
- printf("pmap_enter: new pv: pmap %x va %x\n",
- pmap, va);
-#endif
- /* can this cause us to recurse forever? */
- npv = (pv_entry_t)
- malloc(sizeof *npv, M_VMPVENT, M_NOWAIT);
- npv->pv_va = va;
- npv->pv_pmap = pmap;
- npv->pv_next = pv->pv_next;
- npv->pv_flags = pv->pv_flags;
- pv->pv_next = npv;
-#ifdef DIAGNOSTIC
- if (!npv->pv_next)
- enter_stats.secondpv++;
-#endif
- fnd:
- ;
- }
- splx(s);
- } else {
- /*
- * Assumption: if it is not part of our managed memory
- * then it must be device memory which may be volitile.
- */
-#ifdef DIAGNOSTIC
- enter_stats.unmanaged++;
-#endif
- npte = (prot & VM_PROT_WRITE) ? (PG_IOPAGE & ~PG_G) : (PG_IOPAGE& ~(PG_G | PG_M));
- }
-
- /*
- * The only time we need to flush the cache is if we
- * execute from a physical address and then change the data.
- * This is the best place to do this.
- * pmap_protect() and pmap_remove() are mostly used to switch
- * between R/W and R/O pages.
- * NOTE: we only support cache flush for read only text.
- */
- if (prot == (VM_PROT_READ | VM_PROT_EXECUTE))
- R4K_FlushICache(PHYS_TO_CACHED(pa), PAGE_SIZE);
-
- if (!pmap->pm_segtab) {
- /* enter entries into kernel pmap */
- pte = kvtopte(va);
- npte |= vad_to_pfn(pa) | PG_ROPAGE | PG_G;
- if (wired) {
- pmap->pm_stats.wired_count++;
- npte |= PG_WIRED;
- }
- if (!(pte->pt_entry & PG_V)) {
- pmap->pm_stats.resident_count++;
- } else {
-#ifdef DIAGNOSTIC
- if (pte->pt_entry & PG_WIRED)
- panic("pmap_enter: kernel wired");
-#endif
- }
- /*
- * Update the same virtual address entry.
- */
- R4K_TLBUpdate(va, npte);
- pte->pt_entry = npte;
- return;
- }
-
- if (!(pte = pmap_segmap(pmap, va))) {
- do {
- mem = vm_page_alloc1();
- if (mem == NULL) {
- /* XXX What else can we do? Deadlocks? */
- vm_wait("penter");
- }
- } while (mem == NULL);
-
- /* Do zero via cached if No L2 or Snooping L2 */
- pmap_zero_page(VM_PAGE_TO_PHYS(mem));
- pmap_segmap(pmap, va) = pte = (pt_entry_t *)
- PHYS_TO_CACHED(VM_PAGE_TO_PHYS(mem));
-#ifdef DIAGNOSTIC
- for (i = 0; i < NPTEPG; i++) {
- if ((pte+i)->pt_entry)
- panic("pmap_enter: new segmap not empty");
- }
-#endif
- }
- pte += (va >> PGSHIFT) & (NPTEPG - 1);
-
- /*
- * Now validate mapping with desired protection/wiring.
- * Assume uniform modified and referenced status for all
- * MIPS pages in a OpenBSD page.
- */
- if (IS_VM_PHYSADDR(pa)) {
- npte |= vad_to_pfn(pa);
- }
- else {
- if(pa >= TYNE_V_ISA_MEM)
- npte |= vad_to_pfn64((quad_t)TYNE_P_ISA_MEM + pa - TYNE_V_ISA_MEM);
- else if(pa >= TYNE_V_ISA_IO)
- npte |= vad_to_pfn64((quad_t)TYNE_P_ISA_IO + pa - TYNE_V_ISA_IO);
- else
- npte |= vad_to_pfn(pa);
- }
- if (wired) {
- pmap->pm_stats.wired_count++;
- npte |= PG_WIRED;
- }
-#ifdef DEBUG
- if (pmapdebug & PDB_ENTER) {
- printf("pmap_enter: new pte %x", npte);
- if (pmap->pm_tlbgen == tlbpid_gen)
- printf(" tlbpid %d", pmap->pm_tlbpid);
- printf("\n");
- }
-#endif
- if (!(pte->pt_entry & PG_V)) {
- pmap->pm_stats.resident_count++;
- }
- pte->pt_entry = npte;
- if (pmap->pm_tlbgen == tlbpid_gen)
- R4K_TLBUpdate(va | (pmap->pm_tlbpid <<
- VMTLB_PID_SHIFT), npte);
-}
-
-/*
- * Routine: pmap_change_wiring
- * Function: Change the wiring attribute for a map/virtual-address
- * pair.
- * In/out conditions:
- * The mapping must already exist in the pmap.
- */
-void
-pmap_change_wiring(pmap, va, wired)
- register pmap_t pmap;
- vm_offset_t va;
- boolean_t wired;
-{
- register pt_entry_t *pte;
- u_int p;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_WIRING))
- printf("pmap_change_wiring(%x, %x, %x)\n", pmap, va, wired);
-#endif
- if (pmap == NULL)
- return;
-
- p = wired ? PG_WIRED : 0;
-
- /*
- * Don't need to flush the TLB since PG_WIRED is only in software.
- */
- if (!pmap->pm_segtab) {
- /* change entries in kernel pmap */
-#ifdef DIAGNOSTIC
- if (va < VM_MIN_KERNEL_ADDRESS || va >= virtual_end)
- panic("pmap_change_wiring");
-#endif
- pte = kvtopte(va);
- } else {
- if (!(pte = pmap_segmap(pmap, va)))
- return;
- pte += (va >> PGSHIFT) & (NPTEPG - 1);
- }
-
- if (!(pte->pt_entry & PG_WIRED) && p)
- pmap->pm_stats.wired_count++;
- else if ((pte->pt_entry & PG_WIRED) && !p)
- pmap->pm_stats.wired_count--;
-
- if (pte->pt_entry & PG_V)
- pte->pt_entry = (pte->pt_entry & ~PG_WIRED) | p;
-}
-
-/*
- * Routine: pmap_extract
- * Function:
- * Extract the physical page address associated
- * with the given map/virtual_address pair.
- */
-vm_offset_t
-pmap_extract(pmap, va)
- register pmap_t pmap;
- vm_offset_t va;
-{
- register vm_offset_t pa;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_extract(%x, %x) -> ", pmap, va);
-#endif
-
- if (!pmap->pm_segtab) {
-#ifdef DIAGNOSTIC
- if (va < VM_MIN_KERNEL_ADDRESS || va >= virtual_end)
- panic("pmap_extract");
-#endif
- pa = pfn_to_vad(kvtopte(va)->pt_entry);
- } else {
- register pt_entry_t *pte;
-
- if (!(pte = pmap_segmap(pmap, va)))
- pa = 0;
- else {
- pte += (va >> PGSHIFT) & (NPTEPG - 1);
- pa = pfn_to_vad(pte->pt_entry);
- }
- }
- if (pa)
- pa |= va & PGOFSET;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_extract: pa %x\n", pa);
-#endif
- return (pa);
-}
-
-/*
- * Copy the range specified by src_addr/len
- * from the source map to the range dst_addr/len
- * in the destination map.
- *
- * This routine is only advisory and need not do anything.
- */
-void
-pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr)
- pmap_t dst_pmap;
- pmap_t src_pmap;
- vm_offset_t dst_addr;
- vm_size_t len;
- vm_offset_t src_addr;
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_copy(%x, %x, %x, %x, %x)\n",
- dst_pmap, src_pmap, dst_addr, len, src_addr);
-#endif
-}
-
-/*
- * Require that all active physical maps contain no
- * incorrect entries NOW. [This update includes
- * forcing updates of any address map caching.]
- *
- * Generally used to insure that a thread about
- * to run will see a semantically correct world.
- */
-void
-pmap_update()
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_update()\n");
-#endif
-}
-
-/*
- * Routine: pmap_collect
- * Function:
- * Garbage collects the physical map system for
- * pages which are no longer used.
- * Success need not be guaranteed -- that is, there
- * may well be pages which are not referenced, but
- * others may be collected.
- * Usage:
- * Called by the pageout daemon when pages are scarce.
- */
-void
-pmap_collect(pmap)
- pmap_t pmap;
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_collect(%x)\n", pmap);
-#endif
-}
-
-/*
- * pmap_zero_page zeros the specified (machine independent)
- * page.
- */
-void
-pmap_zero_page(phys)
- vm_offset_t phys;
-{
- register vm_offset_t p;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_zero_page(%x)\n", phys);
-#endif
- if(l2cache_is_snooping && !pmap_is_pa_mapped(phys)) {
- mem_zero_page((vm_offset_t)PHYS_TO_UNCACHED(phys));
- }
- else if(!pmap_is_pa_mapped(phys)) {
- p = (vm_offset_t)PHYS_TO_CACHED(phys);
- mem_zero_page(p);
- R4K_HitFlushDCache(p, PAGE_SIZE);
- }
- else { /* Page is mapped or non snooping */
- R4K_FlushDCache((vm_offset_t)PHYS_TO_CACHED(pmap_pa_to_va(phys) & CpuCacheAliasMask), PAGE_SIZE);
- p = (vm_offset_t)PHYS_TO_CACHED(phys);
- mem_zero_page(p);
- R4K_HitFlushDCache(p, PAGE_SIZE);
- }
-}
-
-/*
- * pmap_copy_page copies the specified (machine independent)
- * page.
- */
-void
-pmap_copy_page(src, dst)
- vm_offset_t src, dst;
-{
- register int *s, *d, *end;
- register int tmp0, tmp1, tmp2, tmp3;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_copy_page(%x, %x)\n", src, dst);
-#endif
-/*XXX FIXME Not very sophisticated */
- R4K_FlushCache();
- s = (int *)PHYS_TO_CACHED(src);
- d = (int *)PHYS_TO_CACHED(dst);
- end = s + PAGE_SIZE / sizeof(int);
- do {
- tmp0 = s[0];
- tmp1 = s[1];
- tmp2 = s[2];
- tmp3 = s[3];
- d[0] = tmp0;
- d[1] = tmp1;
- d[2] = tmp2;
- d[3] = tmp3;
- s += 4;
- d += 4;
- } while (s != end);
-/*XXX FIXME Not very sophisticated */
- R4K_FlushCache();
-}
-
-/*
- * Routine: pmap_pageable
- * Function:
- * Make the specified pages (by pmap, offset)
- * pageable (or not) as requested.
- *
- * A page which is not pageable may not take
- * a fault; therefore, its page table entry
- * must remain valid for the duration.
- *
- * This routine is merely advisory; pmap_enter
- * will specify that these pages are to be wired
- * down (or not) as appropriate.
- */
-void
-pmap_pageable(pmap, sva, eva, pageable)
- pmap_t pmap;
- vm_offset_t sva, eva;
- boolean_t pageable;
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_pageable(%x, %x, %x, %x)\n",
- pmap, sva, eva, pageable);
-#endif
-}
-
-/*
- * Clear the modify bits on the specified physical page.
- */
-void
-pmap_clear_modify(pa)
- vm_offset_t pa;
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_clear_modify(%x)\n", pa);
-#endif
-#ifdef ATTR
- pmap_attributes[atop(pa)] &= ~PMAP_ATTR_MOD;
-#endif
-}
-
-/*
- * pmap_clear_reference:
- *
- * Clear the reference bit on the specified physical page.
- */
-void
-pmap_clear_reference(pa)
- vm_offset_t pa;
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_clear_reference(%x)\n", pa);
-#endif
-#ifdef ATTR
- pmap_attributes[atop(pa)] &= ~PMAP_ATTR_REF;
-#endif
-}
-
-/*
- * pmap_is_referenced:
- *
- * Return whether or not the specified physical page is referenced
- * by any physical maps.
- */
-boolean_t
-pmap_is_referenced(pa)
- vm_offset_t pa;
-{
-#ifdef ATTR
- return (pmap_attributes[atop(pa)] & PMAP_ATTR_REF);
-#else
- return (FALSE);
-#endif
-}
-
-/*
- * pmap_is_modified:
- *
- * Return whether or not the specified physical page is modified
- * by any physical maps.
- */
-boolean_t
-pmap_is_modified(pa)
- vm_offset_t pa;
-{
-#ifdef ATTR
- return (pmap_attributes[atop(pa)] & PMAP_ATTR_MOD);
-#else
- return (FALSE);
-#endif
-}
-
-vm_offset_t
-pmap_phys_address(ppn)
- int ppn;
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_phys_address(%x)\n", ppn);
-#endif
- return (mips_ptob(ppn));
-}
-
-/*
- * Miscellaneous support routines
- */
-
-/*
- * Allocate a hardware PID and return it.
- * It takes almost as much or more time to search the TLB for a
- * specific PID and flush those entries as it does to flush the entire TLB.
- * Therefore, when we allocate a new PID, we just take the next number. When
- * we run out of numbers, we flush the TLB, increment the generation count
- * and start over. PID zero is reserved for kernel use.
- * This is called only by switch().
- */
-int
-pmap_alloc_tlbpid(p)
- struct proc *p;
-{
- pmap_t pmap;
- int id;
-
- pmap = &p->p_vmspace->vm_pmap;
- if (pmap->pm_tlbgen != tlbpid_gen) {
- id = tlbpid_cnt;
- if (id == VMNUM_PIDS) {
- R4K_TLBFlush(num_tlbentries);
- /* reserve tlbpid_gen == 0 to alway mean invalid */
- if (++tlbpid_gen == 0)
- tlbpid_gen = 1;
- id = 1;
- }
- tlbpid_cnt = id + 1;
- pmap->pm_tlbpid = id;
- pmap->pm_tlbgen = tlbpid_gen;
- } else
- id = pmap->pm_tlbpid;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_TLBPID)) {
- if (curproc)
- printf("pmap_alloc_tlbpid: curproc %d '%s' ",
- curproc->p_pid, curproc->p_comm);
- else
- printf("pmap_alloc_tlbpid: curproc <none> ");
- printf("segtab %x tlbpid %d pid %d '%s'\n",
- pmap->pm_segtab, id, p->p_pid, p->p_comm);
- }
-#endif
- return (id);
-}
-
-/*
- * Remove a physical to virtual address translation.
- * Returns TRUE if it was the last mapping and cached, else FALSE.
- */
-int
-pmap_remove_pv(pmap, va, pa)
- pmap_t pmap;
- vm_offset_t va, pa;
-{
- register pv_entry_t pv, npv;
- int s, last;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_PVENTRY))
- printf("pmap_remove_pv(%x, %x, %x)\n", pmap, va, pa);
-#endif
- /*
- * Remove page from the PV table (raise IPL since we
- * may be called at interrupt time).
- */
- if (!IS_VM_PHYSADDR(pa))
- return(TRUE);
- pv = pa_to_pvh(pa);
- s = splimp();
- /*
- * If it is the first entry on the list, it is actually
- * in the header and we must copy the following entry up
- * to the header. Otherwise we must search the list for
- * the entry. In either case we free the now unused entry.
- */
- if (pmap == pv->pv_pmap && va == pv->pv_va) {
- last = (pv->pv_flags & PV_UNCACHED) ? FALSE : TRUE;
- npv = pv->pv_next;
- if (npv) {
- *pv = *npv;
- free((caddr_t)npv, M_VMPVENT);
- } else
- pv->pv_pmap = NULL;
-#ifdef DEBUG
- remove_stats.pvfirst++;
-#endif
- } else {
- last = FALSE;
- for (npv = pv->pv_next; npv; pv = npv, npv = npv->pv_next) {
-#ifdef DEBUG
- remove_stats.pvsearch++;
-#endif
- if (pmap == npv->pv_pmap && va == npv->pv_va)
- goto fnd;
- }
-#ifdef DIAGNOSTIC
- printf("pmap_remove_pv(%x, %x, %x) not found\n", pmap, va, pa);
- panic("pmap_remove_pv");
-#endif
- fnd:
- pv->pv_next = npv->pv_next;
- free((caddr_t)npv, M_VMPVENT);
- }
- splx(s);
- return(last);
-}
-
-/*
- * vm_page_alloc1:
- *
- * Allocate and return a memory cell with no associated object.
- */
-vm_page_t
-vm_page_alloc1()
-{
- register vm_page_t mem;
- int spl;
-
- spl = splimp(); /* XXX */
- simple_lock(&vm_page_queue_free_lock);
- if (vm_page_queue_free.tqh_first == NULL) {
- simple_unlock(&vm_page_queue_free_lock);
- splx(spl);
- return (NULL);
- }
-
- mem = vm_page_queue_free.tqh_first;
- TAILQ_REMOVE(&vm_page_queue_free, mem, pageq);
-
- cnt.v_free_count--;
- simple_unlock(&vm_page_queue_free_lock);
- splx(spl);
-
- mem->flags = PG_BUSY | PG_CLEAN | PG_FAKE;
- mem->wire_count = 0;
-
- /*
- * Decide if we should poke the pageout daemon.
- * We do this if the free count is less than the low
- * water mark, or if the free count is less than the high
- * water mark (but above the low water mark) and the inactive
- * count is less than its target.
- *
- * We don't have the counts locked ... if they change a little,
- * it doesn't really matter.
- */
-
- if (cnt.v_free_count < cnt.v_free_min ||
- (cnt.v_free_count < cnt.v_free_target &&
- cnt.v_inactive_count < cnt.v_inactive_target))
- thread_wakeup((void *)&vm_pages_needed);
- return (mem);
-}
-
-/*
- * vm_page_free1:
- *
- * Returns the given page to the free list,
- * disassociating it with any VM object.
- *
- * Object and page must be locked prior to entry.
- */
-void
-vm_page_free1(mem)
- register vm_page_t mem;
-{
-
- if (mem->flags & PG_ACTIVE) {
- TAILQ_REMOVE(&vm_page_queue_active, mem, pageq);
- mem->flags &= ~PG_ACTIVE;
- cnt.v_active_count--;
- }
-
- if (mem->flags & PG_INACTIVE) {
- TAILQ_REMOVE(&vm_page_queue_inactive, mem, pageq);
- mem->flags &= ~PG_INACTIVE;
- cnt.v_inactive_count--;
- }
-
- if (!(mem->flags & PG_FICTITIOUS)) {
- int spl;
-
- spl = splimp();
- simple_lock(&vm_page_queue_free_lock);
- TAILQ_INSERT_TAIL(&vm_page_queue_free, mem, pageq);
-
- cnt.v_free_count++;
- simple_unlock(&vm_page_queue_free_lock);
- splx(spl);
- }
-}
-
-/*
- * Find first virtual address >= *vap that doesn't cause
- * a cache alias conflict.
- */
-void
-pmap_prefer(foff, vap)
- register vm_offset_t foff;
- register vm_offset_t *vap;
-{
- register vm_offset_t va = *vap;
- register long m, d;
-
- m = 0x10000; /* Max aliased cache size */
-
- d = foff - va;
- d &= (m-1);
- *vap = va + d;
-}
-
diff --git a/sys/arch/arc/arc/swapgeneric.c b/sys/arch/arc/arc/swapgeneric.c
deleted file mode 100644
index 0bd7e4aab2b..00000000000
--- a/sys/arch/arc/arc/swapgeneric.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* $OpenBSD: swapgeneric.c,v 1.4 1996/11/06 01:38:16 deraadt Exp $ */
-
-/*-
- * Copyright (c) 1994
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)swapgeneric.c 8.2 (Berkeley) 3/21/94
- */
-
-/*
- * fake swapgeneric.c -- should do this differently.
- */
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <machine/disklabel.h>
-
-int (*mountroot) __P((void)) = NULL; /* tells autoconf.c that we are "generic" */
-
-dev_t rootdev = NODEV;
-dev_t dumpdev = NODEV;
-
-struct swdevt swdevt[] = {
- { makedev(3, 0*MAXPARTITIONS+1), 0, 0 }, /* sd0b */
- { makedev(3, 1*MAXPARTITIONS+1), 0, 0 }, /* sd1b */
- { makedev(3, 2*MAXPARTITIONS+1), 0, 0 }, /* sd2b */
- { makedev(3, 3*MAXPARTITIONS+1), 0, 0 }, /* sd3b */
- { makedev(3, 4*MAXPARTITIONS+1), 0, 0 }, /* sd4b */
- { makedev(3, 5*MAXPARTITIONS+1), 0, 0 }, /* sd5b */
- { makedev(3, 6*MAXPARTITIONS+1), 0, 0 }, /* sd6b */
- { makedev(3, 7*MAXPARTITIONS+1), 0, 0 }, /* sd7b */
- { NODEV, 0, 0 }
-};
diff --git a/sys/arch/arc/arc/trap.c b/sys/arch/arc/arc/trap.c
deleted file mode 100644
index e3373732457..00000000000
--- a/sys/arch/arc/arc/trap.c
+++ /dev/null
@@ -1,1593 +0,0 @@
-/* $OpenBSD: trap.c,v 1.25 2000/11/10 18:15:36 art Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: trap.c 1.32 91/04/06
- *
- * from: @(#)trap.c 8.5 (Berkeley) 1/11/94
- */
-
-#include "ppp.h"
-#include "bridge.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/kernel.h>
-#include <sys/signalvar.h>
-#include <sys/syscall.h>
-#include <sys/user.h>
-#include <sys/buf.h>
-#include <sys/device.h>
-#ifdef KTRACE
-#include <sys/ktrace.h>
-#endif
-#include <net/netisr.h>
-#include <miscfs/procfs/procfs.h>
-
-#include <machine/trap.h>
-#include <machine/psl.h>
-#include <machine/reg.h>
-#include <machine/cpu.h>
-#include <machine/pio.h>
-#include <machine/intr.h>
-#include <machine/autoconf.h>
-#include <machine/pte.h>
-#include <machine/pmap.h>
-#include <machine/mips_opcode.h>
-#include <machine/frame.h>
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-
-#include <arc/pica/pica.h>
-#include <mips/archtype.h>
-
-#ifdef DDB
-#include <mips/db_machdep.h>
-#include <ddb/db_sym.h>
-#endif
-
-#include <sys/cdefs.h>
-#include <sys/syslog.h>
-
-struct proc *machFPCurProcPtr; /* pointer to last proc to use FP */
-
-extern void MipsKernGenException __P((void));
-extern void MipsUserGenException __P((void));
-extern void MipsKernIntr __P((void));
-extern void MipsUserIntr __P((void));
-extern void MipsTLBModException __P((void));
-extern void MipsTLBInvalidException __P((void));
-
-void (*machExceptionTable[])(void) = {
-/*
- * The kernel exception handlers.
- */
- MipsKernIntr, /* external interrupt */
- MipsKernGenException, /* TLB modification */
- MipsTLBInvalidException, /* TLB miss (load or instr. fetch) */
- MipsTLBInvalidException, /* TLB miss (store) */
- MipsKernGenException, /* address error (load or I-fetch) */
- MipsKernGenException, /* address error (store) */
- MipsKernGenException, /* bus error (I-fetch) */
- MipsKernGenException, /* bus error (load or store) */
- MipsKernGenException, /* system call */
- MipsKernGenException, /* breakpoint */
- MipsKernGenException, /* reserved instruction */
- MipsKernGenException, /* coprocessor unusable */
- MipsKernGenException, /* arithmetic overflow */
- MipsKernGenException, /* trap exception */
- MipsKernGenException, /* viritual coherence exception inst */
- MipsKernGenException, /* floating point exception */
- MipsKernGenException, /* reserved */
- MipsKernGenException, /* reserved */
- MipsKernGenException, /* reserved */
- MipsKernGenException, /* reserved */
- MipsKernGenException, /* reserved */
- MipsKernGenException, /* reserved */
- MipsKernGenException, /* reserved */
- MipsKernGenException, /* watch exception */
- MipsKernGenException, /* reserved */
- MipsKernGenException, /* reserved */
- MipsKernGenException, /* reserved */
- MipsKernGenException, /* reserved */
- MipsKernGenException, /* reserved */
- MipsKernGenException, /* reserved */
- MipsKernGenException, /* reserved */
- MipsKernGenException, /* viritual coherence exception data */
-/*
- * The user exception handlers.
- */
- MipsUserIntr, /* 0 */
- MipsUserGenException, /* 1 */
- MipsUserGenException, /* 2 */
- MipsUserGenException, /* 3 */
- MipsUserGenException, /* 4 */
- MipsUserGenException, /* 5 */
- MipsUserGenException, /* 6 */
- MipsUserGenException, /* 7 */
- MipsUserGenException, /* 8 */
- MipsUserGenException, /* 9 */
- MipsUserGenException, /* 10 */
- MipsUserGenException, /* 11 */
- MipsUserGenException, /* 12 */
- MipsUserGenException, /* 13 */
- MipsUserGenException, /* 14 */
- MipsUserGenException, /* 15 */
- MipsUserGenException, /* 16 */
- MipsUserGenException, /* 17 */
- MipsUserGenException, /* 18 */
- MipsUserGenException, /* 19 */
- MipsUserGenException, /* 20 */
- MipsUserGenException, /* 21 */
- MipsUserGenException, /* 22 */
- MipsUserGenException, /* 23 */
- MipsUserGenException, /* 24 */
- MipsUserGenException, /* 25 */
- MipsUserGenException, /* 26 */
- MipsUserGenException, /* 27 */
- MipsUserGenException, /* 28 */
- MipsUserGenException, /* 29 */
- MipsUserGenException, /* 20 */
- MipsUserGenException, /* 31 */
-};
-
-char *trap_type[] = {
- "external interrupt",
- "TLB modification",
- "TLB miss (load or instr. fetch)",
- "TLB miss (store)",
- "address error (load or I-fetch)",
- "address error (store)",
- "bus error (I-fetch)",
- "bus error (load or store)",
- "system call",
- "breakpoint",
- "reserved instruction",
- "coprocessor unusable",
- "arithmetic overflow",
- "trap",
- "viritual coherency instruction",
- "floating point",
- "reserved 16",
- "reserved 17",
- "reserved 18",
- "reserved 19",
- "reserved 20",
- "reserved 21",
- "reserved 22",
- "watch",
- "reserved 24",
- "reserved 25",
- "reserved 26",
- "reserved 27",
- "reserved 28",
- "reserved 29",
- "reserved 30",
- "viritual coherency data",
-};
-
-struct {
- int int_mask;
- int (*int_hand)(u_int, struct clockframe *);
-} cpu_int_tab[8];
-
-int cpu_int_mask; /* External cpu interrupt mask */
-
-#if defined(DDB) || defined(DEBUG)
-#define TRAPSIZE 10
-struct trapdebug { /* trap history buffer for debugging */
- u_int status;
- u_int cause;
- u_int vadr;
- u_int pc;
- u_int ra;
- u_int sp;
- u_int code;
-} trapdebug[TRAPSIZE], *trp = trapdebug;
-
-void trapDump __P((char *));
-
-void stacktrace __P((int *));
-void logstacktrace __P((int *));
-int kdbpeek __P((int *));
-#if defined(DDB)
-int kdb_trap __P((int, db_regs_t *));
-#endif
-
-/* extern functions printed by name in stack backtraces */
-extern void idle __P((void));
-extern void MipsTLBMiss __P((void));
-#endif /* DDB || DEBUG */
-
-extern const struct callback *callv;
-extern u_long intrcnt[];
-extern void MipsSwitchFPState __P((struct proc *, int *));
-extern void MipsFPTrap __P((u_int, u_int, u_int));
-
-u_int trap __P((u_int, u_int, u_int, u_int, struct trap_frame));
-void interrupt __P((u_int, u_int, u_int, u_int, u_int));
-void softintr __P((u_int, u_int));
-int cpu_singlestep __P((struct proc *));
-u_int MipsEmulateBranch __P((int *, int, int, u_int));
-
-/*
- * Handle an exception.
- * Called from MipsKernGenException() or MipsUserGenException()
- * when a processor trap occurs.
- * In the case of a kernel trap, we return the pc where to resume if
- * ((struct pcb *)UADDR)->pcb_onfault is set, otherwise, return old pc.
- */
-u_int
-trap(statusReg, causeReg, vadr, pc, f)
- u_int statusReg; /* status register at time of the exception */
- u_int causeReg; /* cause register at time of exception */
- u_int vadr; /* address (if any) the fault occured on */
- u_int pc; /* program counter where to continue */
- struct trap_frame f;
-{
- int type, i;
- unsigned ucode = 0;
- struct proc *p = curproc;
- u_quad_t sticks;
- vm_prot_t ftype;
- extern unsigned onfault_table[];
- int typ = 0;
- union sigval sv;
-
-#if defined(DDB) || defined(DEBUG)
- trp->status = statusReg;
- trp->cause = causeReg;
- trp->vadr = vadr;
- trp->pc = pc;
- trp->ra = !USERMODE(statusReg) ? f.reg[PC] :
- p->p_md.md_regs[RA];
- trp->sp = (int)&f;
- trp->code = 0;
- if (++trp == &trapdebug[TRAPSIZE])
- trp = trapdebug;
-#endif
-
- type = (causeReg & CR_EXC_CODE) >> CR_EXC_CODE_SHIFT;
- if (USERMODE(statusReg)) {
- type |= T_USER;
- sticks = p->p_sticks;
- }
-
- /*
- * Enable hardware interrupts if they were on before.
- * We only respond to software interrupts when returning to user mode.
- */
- if (statusReg & SR_INT_ENAB)
- splx((statusReg & HARD_INT_MASK) | SR_INT_ENAB);
-
- switch (type) {
- case T_TLB_MOD:
- /* check for kernel address */
- if ((int)vadr < 0) {
- pt_entry_t *pte;
- unsigned int entry;
- vm_offset_t pa;
-
- pte = kvtopte(vadr);
- entry = pte->pt_entry;
-#ifdef DIAGNOSTIC
- if (!(entry & PG_V) || (entry & PG_M))
- panic("trap: ktlbmod: invalid pte");
-#endif
- if (pmap_is_page_ro(pmap_kernel(), mips_trunc_page(vadr), entry)) {
- /* write to read only page in the kernel */
- ftype = VM_PROT_WRITE;
- goto kernel_fault;
- }
- entry |= PG_M;
- pte->pt_entry = entry;
- vadr &= ~PGOFSET;
- R4K_TLBUpdate(vadr, entry);
- pa = pfn_to_vad(entry);
-#ifdef ATTR
- pmap_attributes[atop(pa)] |= PMAP_ATTR_MOD;
-#else
- if (!IS_VM_PHYSADDR(pa))
- panic("trap: ktlbmod: unmanaged page");
- PHYS_TO_VM_PAGE(pa)->flags &= ~PG_CLEAN;
-#endif
- return (pc);
- }
- /* FALLTHROUGH */
-
- case T_TLB_MOD+T_USER:
- {
- pt_entry_t *pte;
- unsigned int entry;
- vm_offset_t pa;
- pmap_t pmap = p->p_vmspace->vm_map.pmap;
-
- if (!(pte = pmap_segmap(pmap, vadr)))
- panic("trap: utlbmod: invalid segmap");
- pte += (vadr >> PGSHIFT) & (NPTEPG - 1);
- entry = pte->pt_entry;
-#ifdef DIAGNOSTIC
- if (!(entry & PG_V) || (entry & PG_M)) {
- panic("trap: utlbmod: invalid pte");
- }
-#endif
- if (pmap_is_page_ro(pmap, (vm_offset_t)mips_trunc_page(vadr), entry)) {
- /* write to read only page */
- ftype = VM_PROT_WRITE;
- goto dofault;
- }
- entry |= PG_M;
- pte->pt_entry = entry;
- vadr = (vadr & ~PGOFSET) | (pmap->pm_tlbpid << VMTLB_PID_SHIFT);
- R4K_TLBUpdate(vadr, entry);
- pa = pfn_to_vad(entry);
-#ifdef ATTR
- pmap_attributes[atop(pa)] |= PMAP_ATTR_MOD;
-#else
- if (!IS_VM_PHYSADDR(pa)) {
- panic("trap: utlbmod: unmanaged page");
- }
- PHYS_TO_VM_PAGE(pa)->flags &= ~PG_CLEAN;
-#endif
- if (!USERMODE(statusReg))
- return (pc);
- goto out;
- }
-
- case T_TLB_LD_MISS:
- case T_TLB_ST_MISS:
- ftype = (type == T_TLB_ST_MISS) ? VM_PROT_WRITE : VM_PROT_READ;
- /* check for kernel address */
- if ((int)vadr < 0) {
- vm_offset_t va;
- int rv;
-
- kernel_fault:
- va = trunc_page((vm_offset_t)vadr);
- rv = vm_fault(kernel_map, va, ftype, FALSE);
- if (rv == KERN_SUCCESS)
- return (pc);
- if ((i = ((struct pcb *)UADDR)->pcb_onfault) != 0) {
- ((struct pcb *)UADDR)->pcb_onfault = 0;
- return (onfault_table[i]);
- }
- goto err;
- }
- /*
- * It is an error for the kernel to access user space except
- * through the copyin/copyout routines.
- */
- if ((i = ((struct pcb *)UADDR)->pcb_onfault) == 0)
- goto err;
- /* check for fuswintr() or suswintr() getting a page fault */
- if (i == 4)
- return (onfault_table[i]);
- goto dofault;
-
- case T_TLB_LD_MISS+T_USER:
- ftype = VM_PROT_READ;
- goto dofault;
-
- case T_TLB_ST_MISS+T_USER:
- ftype = VM_PROT_WRITE;
- dofault:
- {
- vm_offset_t va;
- struct vmspace *vm;
- vm_map_t map;
- int rv;
-
- vm = p->p_vmspace;
- map = &vm->vm_map;
- va = trunc_page((vm_offset_t)vadr);
- rv = vm_fault(map, va, ftype, FALSE);
-#ifdef VMFAULT_TRACE
- printf("vm_fault(%x (pmap %x), %x (%x), %x, %d) -> %x at pc %x\n",
- map, &vm->vm_pmap, va, vadr, ftype, FALSE, rv, pc);
-#endif
- /*
- * If this was a stack access we keep track of the maximum
- * accessed stack size. Also, if vm_fault gets a protection
- * failure it is due to accessing the stack region outside
- * the current limit and we need to reflect that as an access
- * error.
- */
- if ((caddr_t)va >= vm->vm_maxsaddr) {
- if (rv == KERN_SUCCESS) {
- unsigned nss;
-
- nss = clrnd(btoc(USRSTACK-(unsigned)va));
- if (nss > vm->vm_ssize)
- vm->vm_ssize = nss;
- } else if (rv == KERN_PROTECTION_FAILURE)
- rv = KERN_INVALID_ADDRESS;
- }
- if (rv == KERN_SUCCESS) {
- if (!USERMODE(statusReg))
- return (pc);
- goto out;
- }
- if (!USERMODE(statusReg)) {
- if ((i = ((struct pcb *)UADDR)->pcb_onfault) != 0) {
- ((struct pcb *)UADDR)->pcb_onfault = 0;
- return (onfault_table[i]);
- }
- goto err;
- }
- ucode = ftype;
- i = SIGSEGV;
- typ = SEGV_MAPERR;
- break;
- }
-
- case T_ADDR_ERR_LD+T_USER: /* misaligned or kseg access */
- case T_ADDR_ERR_ST+T_USER: /* misaligned or kseg access */
- ucode = 0; /* XXX should be VM_PROT_something */
- i = SIGBUS;
- typ = BUS_ADRALN;
- break;
- case T_BUS_ERR_IFETCH+T_USER: /* BERR asserted to cpu */
- case T_BUS_ERR_LD_ST+T_USER: /* BERR asserted to cpu */
- ucode = 0; /* XXX should be VM_PROT_something */
- i = SIGBUS;
- typ = BUS_OBJERR;
- break;
-
- case T_SYSCALL+T_USER:
- {
- int *locr0 = p->p_md.md_regs;
- struct sysent *callp;
- unsigned int code;
- int numsys;
- struct args {
- int i[8];
- } args;
- int rval[2];
-
- cnt.v_syscall++;
- /* compute next PC after syscall instruction */
- if ((int)causeReg < 0) { /* Check BD bit */
- locr0[PC] = MipsEmulateBranch(locr0, pc, 0, 0);
- }
- else {
- locr0[PC] += 4;
- }
- callp = p->p_emul->e_sysent;
- numsys = p->p_emul->e_nsysent;
- code = locr0[V0];
- switch (code) {
- case SYS_syscall:
- /*
- * Code is first argument, followed by actual args.
- */
- code = locr0[A0];
- if (code >= numsys)
- callp += p->p_emul->e_nosys; /* (illegal) */
- else
- callp += code;
- i = callp->sy_argsize / sizeof(int);
- args.i[0] = locr0[A1];
- args.i[1] = locr0[A2];
- args.i[2] = locr0[A3];
- if (i > 3) {
- i = copyin((caddr_t)(locr0[SP] +
- 4 * sizeof(int)),
- (caddr_t)&args.i[3],
- (u_int)(i - 3) * sizeof(int));
- if (i) {
- locr0[V0] = i;
- locr0[A3] = 1;
-#ifdef SYSCALL_DEBUG
- scdebug_call(p, code, args.i);
-#endif
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSCALL))
- ktrsyscall(p, code,
- callp->sy_argsize,
- args.i);
-#endif
- goto done;
- }
- }
- break;
-
- case SYS___syscall:
- /*
- * Like syscall, but code is a quad, so as to maintain
- * quad alignment for the rest of the arguments.
- */
- code = locr0[A0 + _QUAD_LOWWORD];
- if (code >= numsys)
- callp += p->p_emul->e_nosys; /* (illegal) */
- else
- callp += code;
- i = callp->sy_argsize / sizeof(int);
- args.i[0] = locr0[A2];
- args.i[1] = locr0[A3];
- if (i > 2) {
- i = copyin((caddr_t)(locr0[SP] +
- 4 * sizeof(int)),
- (caddr_t)&args.i[2],
- (u_int)(i - 2) * sizeof(int));
- if (i) {
- locr0[V0] = i;
- locr0[A3] = 1;
-#ifdef SYSCALL_DEBUG
- scdebug_call(p, code, args.i);
-#endif
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSCALL))
- ktrsyscall(p, code,
- callp->sy_argsize,
- args.i);
-#endif
- goto done;
- }
- }
- break;
-
- default:
- if (code >= numsys)
- callp += p->p_emul->e_nosys; /* (illegal) */
- else
- callp += code;
- i = callp->sy_narg;
- args.i[0] = locr0[A0];
- args.i[1] = locr0[A1];
- args.i[2] = locr0[A2];
- args.i[3] = locr0[A3];
- if (i > 4) {
- i = copyin((caddr_t)(locr0[SP] +
- 4 * sizeof(int)),
- (caddr_t)&args.i[4],
- (u_int)(i - 4) * sizeof(int));
- if (i) {
- locr0[V0] = i;
- locr0[A3] = 1;
-#ifdef SYSCALL_DEBUG
- scdebug_call(p, code, args.i);
-#endif
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSCALL))
- ktrsyscall(p, code,
- callp->sy_argsize,
- args.i);
-#endif
- goto done;
- }
- }
- }
-#ifdef SYSCALL_DEBUG
- scdebug_call(p, code, args.i);
-#endif
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSCALL))
- ktrsyscall(p, code, callp->sy_argsize, args.i);
-#endif
- rval[0] = 0;
- rval[1] = locr0[V1];
-#if defined(DDB) || defined(DEBUG)
- if (trp == trapdebug)
- trapdebug[TRAPSIZE - 1].code = code;
- else
- trp[-1].code = code;
-#endif
- i = (*callp->sy_call)(p, &args, rval);
- /*
- * Reinitialize proc pointer `p' as it may be different
- * if this is a child returning from fork syscall.
- */
- p = curproc;
- locr0 = p->p_md.md_regs;
-#if defined(DDB) || defined(DEBUG)
- { int s;
- s = splhigh();
- trp->status = statusReg;
- trp->cause = causeReg;
- trp->vadr = locr0[SP];
- trp->pc = locr0[PC];
- trp->ra = locr0[RA];
- trp->code = -code;
- if (++trp == &trapdebug[TRAPSIZE])
- trp = trapdebug;
- splx(s);
- }
-#endif
- switch (i) {
- case 0:
- locr0[V0] = rval[0];
- locr0[V1] = rval[1];
- locr0[A3] = 0;
- break;
-
- case ERESTART:
- locr0[PC] = pc;
- break;
-
- case EJUSTRETURN:
- break; /* nothing to do */
-
- default:
- locr0[V0] = i;
- locr0[A3] = 1;
- }
- if(code == SYS_ptrace)
- R4K_FlushCache();
- done:
-#ifdef SYSCALL_DEBUG
- scdebug_ret(p, code, i, rval);
-#endif
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSRET))
- ktrsysret(p, code, i, rval[0]);
-#endif
- goto out;
- }
-
-#ifdef DDB
- case T_BREAK:
- kdb_trap(type, &f);
- return(f.reg[PC]);
-#endif
-
- case T_BREAK+T_USER:
- {
- unsigned int va, instr;
- struct uio uio;
- struct iovec iov;
-
- /* compute address of break instruction */
- va = pc;
- if ((int)causeReg < 0)
- va += 4;
-
- /* read break instruction */
- instr = fuiword((caddr_t)va);
-#if 0
- printf("trap: %s (%d) breakpoint %x at %x: (adr %x ins %x)\n",
- p->p_comm, p->p_pid, instr, pc,
- p->p_md.md_ss_addr, p->p_md.md_ss_instr); /* XXX */
-#endif
- if (p->p_md.md_ss_addr != va || instr != BREAK_SSTEP) {
- i = SIGTRAP;
- typ = TRAP_TRACE;
- break;
- }
-
- /*
- * Restore original instruction and clear BP
- */
- iov.iov_base = (caddr_t)&p->p_md.md_ss_instr;
- iov.iov_len = sizeof(int);
- uio.uio_iov = &iov;
- uio.uio_iovcnt = 1;
- uio.uio_offset = (off_t)va;
- uio.uio_resid = sizeof(int);
- uio.uio_segflg = UIO_SYSSPACE;
- uio.uio_rw = UIO_WRITE;
- uio.uio_procp = curproc;
- i = procfs_domem(p, p, NULL, &uio);
- R4K_FlushCache();
-
- if (i < 0)
- printf("Warning: can't restore instruction at %x: %x\n",
- p->p_md.md_ss_addr, p->p_md.md_ss_instr);
-
- p->p_md.md_ss_addr = 0;
- i = SIGTRAP;
- typ = TRAP_BRKPT;
- break;
- }
-
- case T_RES_INST+T_USER:
- i = SIGILL;
- typ = ILL_ILLOPC;
- break;
-
- case T_COP_UNUSABLE+T_USER:
- if ((causeReg & CR_COP_ERR) != 0x10000000) {
- i = SIGILL; /* only FPU instructions allowed */
- typ = ILL_ILLOPC;
- break;
- }
- MipsSwitchFPState(machFPCurProcPtr, p->p_md.md_regs);
- machFPCurProcPtr = p;
- p->p_md.md_regs[PS] |= SR_COP_1_BIT;
- p->p_md.md_flags |= MDP_FPUSED;
- goto out;
-
- case T_FPE:
-#if defined(DDB) || defined(DEBUG)
- trapDump("fpintr");
-#else
- printf("FPU Trap: PC %x CR %x SR %x\n",
- pc, causeReg, statusReg);
- goto err;
-#endif
-
- case T_FPE+T_USER:
- MipsFPTrap(statusReg, causeReg, pc);
- goto out;
-
- case T_OVFLOW+T_USER:
- i = SIGFPE;
- typ = FPE_FLTOVF;
- break;
-
- case T_ADDR_ERR_LD: /* misaligned access */
- case T_ADDR_ERR_ST: /* misaligned access */
- case T_BUS_ERR_LD_ST: /* BERR asserted to cpu */
- if ((i = ((struct pcb *)UADDR)->pcb_onfault) != 0) {
- ((struct pcb *)UADDR)->pcb_onfault = 0;
- return (onfault_table[i]);
- }
- /* FALLTHROUGH */
-
- default:
- err:
-#ifdef DEBUG
- stacktrace(!USERMODE(statusReg) ? f.reg : p->p_md.md_regs);
- trapDump("trap");
-#endif
- panic("trap");
- }
- p->p_md.md_regs[PC] = pc;
- p->p_md.md_regs[CAUSE] = causeReg;
- p->p_md.md_regs[BADVADDR] = vadr;
- sv.sival_int = vadr;
- trapsignal(p, i, ucode, typ, sv);
-out:
- /*
- * Note: we should only get here if returning to user mode.
- */
- /* take pending signals */
- while ((i = CURSIG(p)) != 0)
- postsig(i);
- p->p_priority = p->p_usrpri;
- astpending = 0;
- if (want_resched) {
- int s;
-
- /*
- * Since we are curproc, clock will normally just change
- * our priority without moving us from one queue to another
- * (since the running process is not on a queue.)
- * If that happened after we put ourselves on the run queue
- * but before we switched, we might not be on the queue
- * indicated by our priority.
- */
- s = splstatclock();
- setrunqueue(p);
- p->p_stats->p_ru.ru_nivcsw++;
- mi_switch();
- splx(s);
- while ((i = CURSIG(p)) != 0)
- postsig(i);
- }
-
- /*
- * If profiling, charge system time to the trapped pc.
- */
- if (p->p_flag & P_PROFIL) {
- extern int psratio;
-
- addupc_task(p, pc, (int)(p->p_sticks - sticks) * psratio);
- }
-
- curpriority = p->p_priority;
- return (pc);
-}
-
-/*
- * Handle an interrupt.
- * Called from MipsKernIntr() or MipsUserIntr()
- * Note: curproc might be NULL.
- */
-void
-interrupt(statusReg, causeReg, what, pc, args)
- u_int statusReg; /* status register at time of the exception */
- u_int causeReg; /* cause register at time of exception */
- u_int what;
- u_int pc; /* program counter where to continue */
- u_int args;
-{
- unsigned mask;
- int i;
- struct clockframe cf;
-
- cnt.v_trap++;
-#if defined(DDB) || defined(DEBUG)
- trp->status = statusReg;
- trp->cause = causeReg;
- trp->vadr = 0;
- trp->pc = pc;
- trp->ra = 0;
- trp->sp = (int)&args;
- trp->code = 0;
- if (++trp == &trapdebug[TRAPSIZE])
- trp = trapdebug;
-#endif
-
- cnt.v_intr++;
- mask = causeReg & statusReg; /* pending interrupts & enable mask */
- cf.pc = pc;
- cf.sr = statusReg;
- cf.cr = causeReg;
-
- /*
- * Check off all enabled interrupts. Called interrupt routine
- * returns mask of interrupts to reenable.
- */
- for(i = 0; i < 8; i++) {
- if(cpu_int_tab[i].int_mask & mask) {
- causeReg &= (*cpu_int_tab[i].int_hand)(mask, &cf);
- }
- }
- /*
- * Reenable all non served hardware levels.
- */
- splx((statusReg & ~causeReg & HARD_INT_MASK) | SR_INT_ENAB);
-
-
- if (mask & SOFT_INT_MASK_0) {
- clearsoftclock();
- cnt.v_soft++;
- softclock();
- }
- /*
- * Process network interrupt if we trapped or will very soon
- */
- if ((mask & SOFT_INT_MASK_1) ||
- (netisr && (statusReg & SOFT_INT_MASK_1))) {
- clearsoftnet();
- cnt.v_soft++;
- intrcnt[1]++;
-#ifdef INET
- if (netisr & (1 << NETISR_ARP)) {
- netisr &= ~(1 << NETISR_ARP);
- arpintr();
- }
- if (netisr & (1 << NETISR_IP)) {
- netisr &= ~(1 << NETISR_IP);
- ipintr();
- }
-#endif
-#ifdef INET6
- if (netisr & (1 << NETISR_IPV6)) {
- netisr &= ~(1 << NETISR_IPV6);
- ip6intr();
- }
-#endif
-#ifdef NETATALK
- if (netisr & (1 << NETISR_ATALK)) {
- netisr &= ~(1 << NETISR_ATALK);
- atintr();
- }
-#endif
-#ifdef NS
- if (netisr & (1 << NETISR_NS)) {
- netisr &= ~(1 << NETISR_NS);
- nsintr();
- }
-#endif
-#ifdef ISO
- if (netisr & (1 << NETISR_ISO)) {
- netisr &= ~(1 << NETISR_ISO);
- clnlintr();
- }
-#endif
-#if NPPP > 0
- if(netisr & (1 << NETISR_PPP)) {
- netisr &= ~(1 << NETISR_PPP);
- pppintr();
- }
-#endif
-#if NBRIDGE > 0
- if(netisr & (1 << NETISR_BRIDGE)) {
- netisr &= ~(1 << NETISR_BRIDGE);
- bridgeintr();
- }
-#endif
- }
- if (mask & SOFT_INT_MASK_0) {
- clearsoftclock();
- intrcnt[0]++;
- cnt.v_soft++;
- softclock();
- }
-}
-
-/*
- * Set up handler for external interrupt events.
- * Events are checked in priority order.
- */
-void
-set_intr(mask, int_hand, prio)
- int mask;
- int (*int_hand)(u_int, struct clockframe *);
- int prio;
-{
- if(prio >= 8)
- panic("set_intr: to high priority");
-
- if(cpu_int_tab[prio].int_mask != 0 &&
- (cpu_int_tab[prio].int_mask != mask ||
- cpu_int_tab[prio].int_hand != int_hand)) {
- panic("set_intr: int already set %x", prio);
- }
-
- cpu_int_tab[prio].int_hand = int_hand;
- cpu_int_tab[prio].int_mask = mask;
- cpu_int_mask |= mask >> 10;
-
- /*
- * Update external interrupt mask but don't enable clock.
- */
- switch(system_type) {
- case ACER_PICA_61:
- case MAGNUM:
- out32(R4030_SYS_EXT_IMASK, cpu_int_mask & (~INT_MASK_4 >> 10));
- break;
-
- case DESKSTATION_TYNE:
- break;
- case DESKSTATION_RPC44:
- break;
- case ALGOR_P4032:
- case ALGOR_P5064:
- break;
- }
-}
-
-/*
- * This is called from MipsUserIntr() if astpending is set.
- * This is very similar to the tail of trap().
- */
-void
-softintr(statusReg, pc)
- unsigned statusReg; /* status register at time of the exception */
- unsigned pc; /* program counter where to continue */
-{
- struct proc *p = curproc;
- int sig;
-
- cnt.v_soft++;
- /* take pending signals */
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
- p->p_priority = p->p_usrpri;
- astpending = 0;
- if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
- ADDUPROF(p);
- }
- if (want_resched) {
- int s;
-
- /*
- * Since we are curproc, clock will normally just change
- * our priority without moving us from one queue to another
- * (since the running process is not on a queue.)
- * If that happened after we put ourselves on the run queue
- * but before we switched, we might not be on the queue
- * indicated by our priority.
- */
- s = splstatclock();
- setrunqueue(p);
- p->p_stats->p_ru.ru_nivcsw++;
- mi_switch();
- splx(s);
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
- }
- curpriority = p->p_priority;
-}
-
-#if defined(DDB) || defined(DEBUG)
-void
-trapDump(msg)
- char *msg;
-{
- int i;
- int s;
-
- s = splhigh();
- printf("trapDump(%s)\n", msg);
- for (i = 0; i < TRAPSIZE; i++) {
- if (trp == trapdebug)
- trp = &trapdebug[TRAPSIZE - 1];
- else
- trp--;
- if (trp->cause == 0)
- break;
- printf("%s: ADR %x PC %x CR %x SR %x\n",
- trap_type[(trp->cause & CR_EXC_CODE) >>
- CR_EXC_CODE_SHIFT],
- trp->vadr, trp->pc, trp->cause, trp->status);
- printf(" RA %x SP %x code %d\n", trp->ra, trp->sp, trp->code);
- }
- splx(s);
-}
-#endif
-
-#if 0
-/*
- *----------------------------------------------------------------------
- *
- * MemErrorInterrupts --
- * arc_errintr - for the ACER PICA_61
- *
- * Handler an interrupt for the control register.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-static void
-arc_errintr()
-{
- volatile u_short *sysCSRPtr =
- (u_short *)PHYS_TO_UNCACHED(KN01_SYS_CSR);
- u_short csr;
-
- csr = *sysCSRPtr;
-
- if (csr & KN01_CSR_MERR) {
- printf("Memory error at 0x%x\n",
- *(unsigned *)PHYS_TO_UNCACHED(KN01_SYS_ERRADR));
- panic("Mem error interrupt");
- }
- *sysCSRPtr = (csr & ~KN01_CSR_MBZ) | 0xff;
-}
-#endif
-
-
-/*
- * Return the resulting PC as if the branch was executed.
- */
-unsigned
-MipsEmulateBranch(regsPtr, instPC, fpcCSR, instptr)
- int *regsPtr;
- int instPC;
- int fpcCSR;
- u_int instptr;
-{
- InstFmt inst;
- unsigned retAddr;
- int condition;
-
-#define GetBranchDest(InstPtr, inst) \
- ((unsigned)InstPtr + 4 + ((short)inst.IType.imm << 2))
-
-
- if(instptr) {
- inst = *(InstFmt *)&instptr;
- }
- else {
- inst = *(InstFmt *)instPC;
- }
-#if 0
- printf("regsPtr=%x PC=%x Inst=%x fpcCsr=%x\n", regsPtr, instPC,
- inst.word, fpcCSR); /* XXX */
-#endif
- switch ((int)inst.JType.op) {
- case OP_SPECIAL:
- switch ((int)inst.RType.func) {
- case OP_JR:
- case OP_JALR:
- retAddr = regsPtr[inst.RType.rs];
- break;
-
- default:
- retAddr = instPC + 4;
- break;
- }
- break;
-
- case OP_BCOND:
- switch ((int)inst.IType.rt) {
- case OP_BLTZ:
- case OP_BLTZL:
- case OP_BLTZAL:
- case OP_BLTZALL:
- if ((int)(regsPtr[inst.RType.rs]) < 0)
- retAddr = GetBranchDest(instPC, inst);
- else
- retAddr = instPC + 8;
- break;
-
- case OP_BGEZ:
- case OP_BGEZL:
- case OP_BGEZAL:
- case OP_BGEZALL:
- if ((int)(regsPtr[inst.RType.rs]) >= 0)
- retAddr = GetBranchDest(instPC, inst);
- else
- retAddr = instPC + 8;
- break;
-
- default:
- panic("MipsEmulateBranch: Bad branch cond");
- }
- break;
-
- case OP_J:
- case OP_JAL:
- retAddr = (inst.JType.target << 2) |
- ((unsigned)instPC & 0xF0000000);
- break;
-
- case OP_BEQ:
- case OP_BEQL:
- if (regsPtr[inst.RType.rs] == regsPtr[inst.RType.rt])
- retAddr = GetBranchDest(instPC, inst);
- else
- retAddr = instPC + 8;
- break;
-
- case OP_BNE:
- case OP_BNEL:
- if (regsPtr[inst.RType.rs] != regsPtr[inst.RType.rt])
- retAddr = GetBranchDest(instPC, inst);
- else
- retAddr = instPC + 8;
- break;
-
- case OP_BLEZ:
- case OP_BLEZL:
- if ((int)(regsPtr[inst.RType.rs]) <= 0)
- retAddr = GetBranchDest(instPC, inst);
- else
- retAddr = instPC + 8;
- break;
-
- case OP_BGTZ:
- case OP_BGTZL:
- if ((int)(regsPtr[inst.RType.rs]) > 0)
- retAddr = GetBranchDest(instPC, inst);
- else
- retAddr = instPC + 8;
- break;
-
- case OP_COP1:
- switch (inst.RType.rs) {
- case OP_BCx:
- case OP_BCy:
- if ((inst.RType.rt & COPz_BC_TF_MASK) == COPz_BC_TRUE)
- condition = fpcCSR & FPC_COND_BIT;
- else
- condition = !(fpcCSR & FPC_COND_BIT);
- if (condition)
- retAddr = GetBranchDest(instPC, inst);
- else
- retAddr = instPC + 8;
- break;
-
- default:
- retAddr = instPC + 4;
- }
- break;
-
- default:
- retAddr = instPC + 4;
- }
- return (retAddr);
-}
-
-/*
- * This routine is called by procxmt() to single step one instruction.
- * We do this by storing a break instruction after the current instruction,
- * resuming execution, and then restoring the old instruction.
- */
-int
-cpu_singlestep(p)
- struct proc *p;
-{
- unsigned va;
- int *locr0 = p->p_md.md_regs;
- int i;
- int bpinstr = BREAK_SSTEP;
- int curinstr;
- struct uio uio;
- struct iovec iov;
-
- /*
- * Fetch what's at the current location.
- */
- iov.iov_base = (caddr_t)&curinstr;
- iov.iov_len = sizeof(int);
- uio.uio_iov = &iov;
- uio.uio_iovcnt = 1;
- uio.uio_offset = (off_t)locr0[PC];
- uio.uio_resid = sizeof(int);
- uio.uio_segflg = UIO_SYSSPACE;
- uio.uio_rw = UIO_READ;
- uio.uio_procp = curproc;
- procfs_domem(curproc, p, NULL, &uio);
-
- /* compute next address after current location */
- if(curinstr != 0) {
- va = MipsEmulateBranch(locr0, locr0[PC], locr0[FSR], curinstr);
- }
- else {
- va = locr0[PC] + 4;
- }
- if (p->p_md.md_ss_addr) {
- printf("SS %s (%d): breakpoint already set at %x (va %x)\n",
- p->p_comm, p->p_pid, p->p_md.md_ss_addr, va); /* XXX */
- return (EFAULT);
- }
- p->p_md.md_ss_addr = va;
- /*
- * Fetch what's at the current location.
- */
- iov.iov_base = (caddr_t)&p->p_md.md_ss_instr;
- iov.iov_len = sizeof(int);
- uio.uio_iov = &iov;
- uio.uio_iovcnt = 1;
- uio.uio_offset = (off_t)va;
- uio.uio_resid = sizeof(int);
- uio.uio_segflg = UIO_SYSSPACE;
- uio.uio_rw = UIO_READ;
- uio.uio_procp = curproc;
- procfs_domem(curproc, p, NULL, &uio);
-
- /*
- * Store breakpoint instruction at the "next" location now.
- */
- iov.iov_base = (caddr_t)&bpinstr;
- iov.iov_len = sizeof(int);
- uio.uio_iov = &iov;
- uio.uio_iovcnt = 1;
- uio.uio_offset = (off_t)va;
- uio.uio_resid = sizeof(int);
- uio.uio_segflg = UIO_SYSSPACE;
- uio.uio_rw = UIO_WRITE;
- uio.uio_procp = curproc;
- i = procfs_domem(curproc, p, NULL, &uio);
- R4K_FlushCache();
-
- if (i < 0)
- return (EFAULT);
-#if 0
- printf("SS %s (%d): breakpoint set at %x: %x (pc %x) br %x\n",
- p->p_comm, p->p_pid, p->p_md.md_ss_addr,
- p->p_md.md_ss_instr, locr0[PC], curinstr); /* XXX */
-#endif
- return (0);
-}
-
-#if defined(DDB) || defined(DEBUG)
-#define MIPS_JR_RA 0x03e00008 /* instruction code for jr ra */
-
-/* forward */
-char *fn_name(unsigned addr);
-void stacktrace_subr __P((int *, int (*)(const char*, ...)));
-
-/*
- * Print a stack backtrace.
- */
-void
-stacktrace(regs)
- int *regs;
-{
- stacktrace_subr(regs, printf);
-}
-
-void
-logstacktrace(regs)
- int *regs;
-{
- stacktrace_subr(regs, addlog);
-}
-
-void
-stacktrace_subr(regs, printfn)
- int *regs;
- int (*printfn) __P((const char*, ...));
-{
- unsigned pc, sp, fp, ra, va, subr;
- unsigned a0, a1, a2, a3;
- unsigned instr, mask;
- InstFmt i;
- int more, stksize;
- extern char edata[];
- unsigned int frames = 0;
-
- /* get initial values from the exception frame */
- sp = regs[SP];
- pc = regs[PC];
- fp = regs[S8];
- ra = regs[RA]; /* May be a 'leaf' function */
- a0 = regs[A0];
- a1 = regs[A1];
- a2 = regs[A2];
- a3 = regs[A3];
-
-/* Jump here when done with a frame, to start a new one */
-loop:
-
-/* Jump here after a nonstandard (interrupt handler) frame */
-specialframe:
- stksize = 0;
- subr = 0;
- if (frames++ > 100) {
- (*printfn)("\nstackframe count exceeded\n");
- /* return breaks stackframe-size heuristics with gcc -O2 */
- goto finish; /*XXX*/
- }
-
- /* check for bad SP: could foul up next frame */
- if (sp & 3 || sp < 0x80000000) {
- (*printfn)("SP 0x%x: not in kernel\n", sp);
- ra = 0;
- subr = 0;
- goto done;
- }
-
- /* Backtraces should contine through interrupts from kernel mode */
- if (pc >= (unsigned)MipsKernIntr && pc < (unsigned)MipsUserIntr) {
- (*printfn)("MipsKernIntr+%x: (%x, %x ,%x) -------\n",
- pc-(unsigned)MipsKernIntr, a0, a1, a2);
- regs = (int *)(sp + STAND_ARG_SIZE);
- a0 = kdbpeek(&regs[A0]);
- a1 = kdbpeek(&regs[A1]);
- a2 = kdbpeek(&regs[A2]);
- a3 = kdbpeek(&regs[A3]);
-
- pc = kdbpeek(&regs[PC]); /* exc_pc - pc at time of exception */
- ra = kdbpeek(&regs[RA]); /* ra at time of exception */
- sp = kdbpeek(&regs[SP]);
- goto specialframe;
- }
-
-
-# define Between(x, y, z) \
- ( ((x) <= (y)) && ((y) < (z)) )
-# define pcBetween(a,b) \
- Between((unsigned)a, pc, (unsigned)b)
-
- /*
- * Check for current PC in exception handler code that don't
- * have a preceding "j ra" at the tail of the preceding function.
- * Depends on relative ordering of functions in locore.
- */
- if (pcBetween(MipsKernGenException, MipsUserGenException))
- subr = (unsigned) MipsKernGenException;
- else if (pcBetween(MipsUserGenException,MipsKernIntr))
- subr = (unsigned) MipsUserGenException;
- else if (pcBetween(MipsKernIntr, MipsUserIntr))
- subr = (unsigned) MipsKernIntr;
- else if (pcBetween(MipsUserIntr, MipsTLBInvalidException))
- subr = (unsigned) MipsUserIntr;
- else if (pcBetween(splx, wbflush))
- subr = (unsigned) splx;
- else if (pcBetween(cpu_switch, fuword))
- subr = (unsigned) cpu_switch;
- else if (pcBetween(idle, cpu_switch)) {
- subr = (unsigned) idle;
- ra = 0;
- goto done;
- }
- else if (pc >= (unsigned)MipsTLBMiss && pc < (unsigned)setsoftclock) {
- (*printfn)("<<locore>>");
- goto done;
- }
-
- /* check for bad PC */
- if (pc & 3 || pc < 0x80000000 || pc >= (unsigned)edata) {
- (*printfn)("PC 0x%x: not in kernel\n", pc);
- ra = 0;
- goto done;
- }
-
- /*
- * Find the beginning of the current subroutine by scanning backwards
- * from the current PC for the end of the previous subroutine.
- */
- if (!subr) {
- va = pc - sizeof(int);
- while ((instr = kdbpeek((int *)va)) != MIPS_JR_RA)
- va -= sizeof(int);
- va += 2 * sizeof(int); /* skip back over branch & delay slot */
- /* skip over nulls which might separate .o files */
- while ((instr = kdbpeek((int *)va)) == 0)
- va += sizeof(int);
- subr = va;
- }
-
- /*
- * Jump here for locore entry points for which the preceding
- * function doesn't end in "j ra"
- */
- /* scan forwards to find stack size and any saved registers */
- stksize = 0;
- more = 3;
- mask = 0;
- for (va = subr; more; va += sizeof(int),
- more = (more == 3) ? 3 : more - 1) {
- /* stop if hit our current position */
- if (va >= pc)
- break;
- instr = kdbpeek((int *)va);
- i.word = instr;
- switch (i.JType.op) {
- case OP_SPECIAL:
- switch (i.RType.func) {
- case OP_JR:
- case OP_JALR:
- more = 2; /* stop after next instruction */
- break;
-
- case OP_SYSCALL:
- case OP_BREAK:
- more = 1; /* stop now */
- };
- break;
-
- case OP_BCOND:
- case OP_J:
- case OP_JAL:
- case OP_BEQ:
- case OP_BNE:
- case OP_BLEZ:
- case OP_BGTZ:
- more = 2; /* stop after next instruction */
- break;
-
- case OP_COP0:
- case OP_COP1:
- case OP_COP2:
- case OP_COP3:
- switch (i.RType.rs) {
- case OP_BCx:
- case OP_BCy:
- more = 2; /* stop after next instruction */
- };
- break;
-
- case OP_SW:
- /* look for saved registers on the stack */
- if (i.IType.rs != 29)
- break;
- /* only restore the first one */
- if (mask & (1 << i.IType.rt))
- break;
- mask |= (1 << i.IType.rt);
- switch (i.IType.rt) {
- case 4: /* a0 */
- a0 = kdbpeek((int *)(sp + (short)i.IType.imm));
- break;
-
- case 5: /* a1 */
- a1 = kdbpeek((int *)(sp + (short)i.IType.imm));
- break;
-
- case 6: /* a2 */
- a2 = kdbpeek((int *)(sp + (short)i.IType.imm));
- break;
-
- case 7: /* a3 */
- a3 = kdbpeek((int *)(sp + (short)i.IType.imm));
- break;
-
- case 30: /* fp */
- fp = kdbpeek((int *)(sp + (short)i.IType.imm));
- break;
-
- case 31: /* ra */
- ra = kdbpeek((int *)(sp + (short)i.IType.imm));
- }
- break;
-
- case OP_ADDI:
- case OP_ADDIU:
- /* look for stack pointer adjustment */
- if (i.IType.rs != 29 || i.IType.rt != 29)
- break;
- stksize = - ((short)i.IType.imm);
- }
- }
-
-done:
- (*printfn)("%s+%x (%x,%x,%x,%x) ra %x sz %d\n",
- fn_name(subr), pc - subr, a0, a1, a2, a3, ra, stksize);
-
- if (ra) {
- if (pc == ra && stksize == 0)
- (*printfn)("stacktrace: loop!\n");
- else {
- pc = ra;
- sp += stksize;
- ra = 0;
- goto loop;
- }
- } else {
-finish:
- if (curproc)
- (*printfn)("User-level: pid %d\n", curproc->p_pid);
- else
- (*printfn)("User-level: curproc NULL\n");
- }
-}
-
-/*
- * Functions ``special'' enough to print by name
- */
-#ifdef __STDC__
-#define Name(_fn) { (void*)_fn, # _fn }
-#else
-#define Name(_fn) { _fn, "_fn"}
-#endif
-static struct { void *addr; char *name;} names[] = {
- Name(interrupt),
- Name(trap),
- Name(MipsKernGenException),
- Name(MipsUserGenException),
- Name(MipsKernIntr),
- Name(MipsUserIntr),
- Name(splx),
- Name(idle),
- Name(cpu_switch),
- {0, 0}
-};
-
-/*
- * Map a function address to a string name, if known; or a hex string.
- */
-char *
-fn_name(unsigned addr)
-{
- static char buf[17];
- int i = 0;
-
- for (i = 0; names[i].name; i++)
- if (names[i].addr == (void*)addr)
- return (names[i].name);
- sprintf(buf, "%x", addr);
- return (buf);
-}
-
-#endif /* DDB */
diff --git a/sys/arch/arc/compile/.cvsignore b/sys/arch/arc/compile/.cvsignore
deleted file mode 100644
index b84608b86bc..00000000000
--- a/sys/arch/arc/compile/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-ARCTIC
-GENERIC
-P4032
-P5064
-PICA
-RAMDISK
diff --git a/sys/arch/arc/conf/ARCTIC b/sys/arch/arc/conf/ARCTIC
deleted file mode 100644
index 5ef940eb278..00000000000
--- a/sys/arch/arc/conf/ARCTIC
+++ /dev/null
@@ -1,141 +0,0 @@
-# $OpenBSD: ARCTIC,v 1.12 1999/08/29 12:14:03 niklas Exp $
-#
-# Generic configuration file for MIPS R4x00 ARC Systems
-#
-
-machine arc
-
-maxusers 32
-
-# Need to set locally
-option TIMEZONE=0 # minutes west of GMT (for)
-option DST=0 # use daylight savings rules
-
-# Standard system options
-option SWAPPAGER # swap pager (anonymous and swap space)
-option DEVPAGER # device pager (mapped devices)
-
-# Debugging options
-option DIAGNOSTIC # extra kernel debugging checks
-option DEBUG # extra kernel debugging support
-option KTRACE # system call tracing support
-
-# System V options
-option SYSVMSG # System V-like message queues
-option SYSVSEM # System V-like semaphores
-option SYSVSHM # System V-like memory sharing
-option SHMMAXPGS=1024 # 1024 pages is the default
-option NATIVE_ELF # Arc systems uses ELF as native format
-
-# Filesystem options
-option CD9660 # ISO 9660 + Rock Ridge file system
-option FDESC # user file descriptor filesystem (/dev/fd)
-option FIFO # POSIX fifo support (in all filesystems)
-option FFS,QUOTA # fast filesystem with user and group quotas
-option KERNFS # kernel data-structure filesystem
-option MFS # memory-based filesystem
-option MSDOSFS # Ability to read write MS-Dos filsystem
-option NFSCLIENT # Sun NFS-compatible filesystem (client)
-option NFSSERVER # Sun NFS-compatible filesystem (server)
-option NULLFS # null layer filesystem
-option PORTAL # portal filesystem (still experimental)
-option UMAPFS # uid/gid remapping filesystem
-
-# Networking options
-option INET # Internet protocols
-option IPSEC # IP-sec
-#option TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP
-option GATEWAY # IP packet forwarding
-#option MULTICAST # Multicast support
-#option MROUTING # Multicast routing support
-#option ISO # OSI networking
-#option TPIP
-#option EON
-option IPFILTER
-option IPFILTER_LOG
-
-# Compatibilitry modules
-option COMPAT_43 # compatibility with 4.3BSD binaries
-#option COMPAT_ULTRIX # Ultrix binary compatibility (no go yet)
-
-# Specify storage configuration (its a joke..)
-config bsd root on sd0 swap on sd0 dumps on sd0
-
-#
-# Definition of system
-#
-mainbus0 at root
-cpu* at mainbus0
-
-isabr* at mainbus0
-
-#
-# ISA Bus.
-#
-
-isa* at isabr?
-#isadma0 at isa?
-
-clock0 at isa? port 0x70 irq 0
-
-pc0 at isa? port 0x60 irq 1 # generic PC console device
-com0 at isa? port 0x3f8 irq 4
-com1 at isa? port 0x2f8 irq 3
-com2 at isa? port 0x3e8 irq 4
-com3 at isa? port 0x2e8 irq 3
-ast0 at isa? port 0x1a0 irq 3 # AST 4-port serial cards
-com* at ast? slave ?
-
-# IDE controllers
-wdc0 at isa? port 0x1f0 irq 14 flags 0x00
-wdc1 at isa? port 0x170 irq 15 flags 0x00
-#wdc* at isapnp?
-
-# IDE hard drives
-wd* at wdc? channel ? drive ? flags 0x0000
-
-# ATAPI<->SCSI
-atapiscsi* at wdc? channel ?
-scsibus* at atapiscsi?
-
-lpt0 at isa? port 0x378 irq 7
-ep0 at isa? port ? irq ? # 3C509 ethernet cards
-we0 at isa? port 0x280 iomem 0xd0000 irq 9 # WD/SMC 80x3 ethernet
-we1 at isa? port 0x300 iomem 0xcc000 irq 10
-#we* at isapnp?
-ec0 at isa? port 0x250 iomem 0xd8000 irq 9 # 3C503 ethernet
-ne0 at isa? port 0x240 irq 9 # NE[12]000 ethernet
-ne1 at isa? port 0x300 irq 10 # NE[12]000 ethernet
-ne2 at isa? port 0x280 irq 9 # NE[12]000 ethernet
-#ne* at isapnp? # NE[12]000 PnP ethernet
-
-#aha0 at isa? port 0x330 irq ? drq ? # Adaptec 154[02] SCSI controllers
-#aha1 at isa? port 0x334 irq ? drq ? # Adaptec 154[02] SCSI controllers
-#scsibus* at aha?
-btl0 at isa? port 0x330 irq ? drq ?
-scsibus* at btl?
-#wds0 at isa? port 0x350 irq 15 drq 6 # WD7000 and TMC-7000 controllers
-#wds1 at isa? port 0x358 irq 11 drq 5
-#scsibus* at wds?
-
-#
-# SCSI Bus devices
-#
-
-sd* at scsibus? target ? lun ?
-st* at scsibus? target ? lun ?
-cd* at scsibus? target ? lun ?
-ch* at scsibus? target ? lun ?
-ss* at scsibus? target ? lun ?
-uk* at scsibus? target ? lun ?
-
-#
-pseudo-device sl 2 # serial-line IP ports
-pseudo-device ppp 2 # serial-line PPP ports
-pseudo-device tun 2 # network tunneling over tty
-pseudo-device pty 64 # pseudo ptys
-pseudo-device tb 1 # tablet line discipline
-pseudo-device bpfilter 8 # packet filter ports
-pseudo-device loop 1 # network loopback
-pseudo-device vnd 4 # paging to files
-pseudo-device enc 4 # IP encap
diff --git a/sys/arch/arc/conf/GENERIC b/sys/arch/arc/conf/GENERIC
deleted file mode 100644
index eded2aa6054..00000000000
--- a/sys/arch/arc/conf/GENERIC
+++ /dev/null
@@ -1,99 +0,0 @@
-# $OpenBSD: GENERIC,v 1.30 2000/01/09 22:00:18 itojun Exp $
-#
-# Generic configuration file for MIPS R4x00 ARC Systems
-#
-
-machine arc mips
-
-include "../../../conf/GENERIC"
-
-maxusers 32
-
-# MD options
-option NATIVE_ELF # Arc systems uses ELF as native format
-
-# Specify storage configuration (its a joke..)
-config bsd swap generic
-
-#
-# Definition of system
-#
-mainbus0 at root
-cpu* at mainbus0
-
-#### Main local buses
-
-pica* at mainbus0 # ACER Pica systems local bus.
-isabr* at mainbus0 # ISA Bus bridge (std ISA bus).
-
-#### PICA bus devices
-
-clock0 at pica?
-pc0 at pica?
-pms0 at pica?
-com0 at pica?
-com1 at pica?
-lpt0 at pica?
-sn0 at pica?
-
-fdc0 at pica?
-fd* at fdc? drive ?
-
-asc0 at pica?
-scsibus* at asc?
-
-#### ISA Bus.
-
-isa* at isabr?
-
-clock0 at isa? port 0x70 irq 0
-
-pc0 at isa? port 0x60 irq 1 # generic PC console device
-com0 at isa? port 0x3f8 irq 4
-com1 at isa? port 0x2f8 irq 3
-com2 at isa? port 0x3e8 irq 4
-com3 at isa? port 0x2e8 irq 3
-ast0 at isa? port 0x1a0 irq 3 # AST 4-port serial cards
-com* at ast? slave ?
-lpt0 at isa? port 0x378 irq 7
-
-# Joystick driver. Probe is a little strange; add only if you have one.
-# joy0 at isa? port 0x201
-
-# IDE controllers
-wdc0 at isa? port 0x1f0 irq 14 flags 0x00
-wdc1 at isa? port 0x170 irq 15 flags 0x00
-#wdc* at isapnp?
-
-# IDE hard drives
-wd* at wdc? channel ? drive ? flags 0x0000
-
-# ATAPI<->SCSI
-atapiscsi* at wdc? channel ?
-scsibus* at atapiscsi?
-
-ep0 at isa? port ? irq ? # 3C509 ethernet cards
-we0 at isa? port 0x280 iomem 0xd0000 irq 9 # WD/SMC 80x3 ethernet
-we1 at isa? port 0x300 iomem 0xcc000 irq 10 #
-#we* at isapnp?
-ec0 at isa? port 0x250 iomem 0xd8000 irq 9 # 3C503 ethernet
-ne0 at isa? port 0x240 irq 9 # NE[12]000 ethernet
-ne1 at isa? port 0x300 irq 10 # NE[12]000 ethernet
-ne2 at isa? port 0x280 irq 9 # NE[12]000 ethernet
-#ne* at isapnp? # NE[12]000 PnP ether
-
-btl0 at isa? port 0x330 irq ? drq ?
-scsibus* at btl?
-
-#### SCSI Bus devices
-
-sd* at scsibus? target ? lun ?
-st* at scsibus? target ? lun ?
-cd* at scsibus? target ? lun ?
-ch* at scsibus? target ? lun ?
-ss* at scsibus? target ? lun ?
-uk* at scsibus? target ? lun ?
-
-# for IPv6
-pseudo-device gif 4
-#pseudo-device faith 1
diff --git a/sys/arch/arc/conf/IMP3 b/sys/arch/arc/conf/IMP3
deleted file mode 100644
index 5700d37fa8f..00000000000
--- a/sys/arch/arc/conf/IMP3
+++ /dev/null
@@ -1,88 +0,0 @@
-# $OpenBSD: IMP3,v 1.2 1999/08/29 12:14:03 niklas Exp $
-#
-# Generic configuration file for MIPS R4x00 ARC Systems
-#
-
-machine arc mips
-
-include "../../../conf/GENERIC"
-
-maxusers 32
-
-# MD options
-option NATIVE_ELF # Arc systems uses ELF as native format
-
-# Specify storage configuration (its a joke..)
-config bsd swap generic
-
-#
-# Definition of system
-#
-mainbus0 at root
-cpu* at mainbus0
-
-#### Main local buses
-
-pica* at mainbus0 # ACER Pica systems local bus.
-isabr* at mainbus0 # ISA Bus bridge (std ISA bus).
-
-#### PICA bus devices
-
-clock0 at pica?
-pc0 at pica?
-pms0 at pica?
-com0 at pica?
-com1 at pica?
-lpt0 at pica?
-sn0 at pica?
-
-fdc0 at pica?
-fd* at fdc? drive ?
-
-asc0 at pica?
-scsibus* at asc?
-
-#### ISA Bus.
-
-isa* at isabr?
-
-clock0 at isa? port 0x70 irq 0
-
-pc0 at isa? port 0x60 irq 1 # generic PC console device
-com0 at isa? port 0x3f8 irq 4
-com1 at isa? port 0x2f8 irq 3
-com2 at isa? port 0x3e8 irq 4
-com3 at isa? port 0x2e8 irq 3
-ast0 at isa? port 0x1a0 irq 3 # AST 4-port serial cards
-com* at ast? slave ?
-lpt0 at isa? port 0x378 irq 7
-
-# IDE controllers
-wdc0 at isa? port 0x1f0 irq 14 flags 0x00
-wdc1 at isa? port 0x170 irq 15 flags 0x00
-#wdc* at isapnp?
-
-# IDE hard drives
-wd* at wdc? channel ? drive ? flags 0x0000
-
-# ATAPI<->SCSI
-atapiscsi* at wdc? channel ?
-scsibus* at atapiscsi?
-
-ep0 at isa? port ? irq ? # 3C509 ethernet cards
-we0 at isa? port 0x300 iomem 0xd0000 irq 5 # WD/SMC 80x3 ethernet
-ne0 at isa? port 0x300 irq 5 # NE[12]000 ethernet
-# iy0 at isa? port 0x300 irq 11 # Intel etherexpress pro/10+
-joy0 at isa? port 0x201
-
-btl0 at isa? port 0x330 irq ? drq ?
-scsibus* at btl?
-
-#### SCSI Bus devices
-
-sd* at scsibus? target ? lun ?
-st* at scsibus? target ? lun ?
-cd* at scsibus? target ? lun ?
-ch* at scsibus? target ? lun ?
-ss* at scsibus? target ? lun ?
-uk* at scsibus? target ? lun ?
diff --git a/sys/arch/arc/conf/Makefile.arc b/sys/arch/arc/conf/Makefile.arc
deleted file mode 100644
index 4105040f8f7..00000000000
--- a/sys/arch/arc/conf/Makefile.arc
+++ /dev/null
@@ -1,185 +0,0 @@
-# $OpenBSD: Makefile.arc,v 1.14 2000/08/15 01:03:36 imp Exp $
-
-# @(#)Makefile.arc 8.2 (Berkeley) 2/16/94
-#
-# Makefile for 4.4 BSD
-#
-# This makefile is constructed from a machine description:
-# config ``machineid''
-# Most changes should be made in the machine description
-# /sys/arch/arc/conf/``machineid''
-# after which you should do
-# config ``machineid''
-# Machine generic makefile changes should be made in
-# /sys/arch/arc/conf/Makefile.``machinetype''
-# after which config should be rerun for all machines of that type.
-#
-# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
-# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
-#
-# -DTRACE compile in kernel tracing hooks
-# -DQUOTA compile in file system quotas
-
-
-# DEBUG is set to -g by config if debugging is requested (config -g).
-# PROF is set to -pg by config if profiling is requested (config -p).
-
-AS?= as
-CC?= cc
-CPP?= cpp
-LD?= ld
-STRIP?= strip -d
-TOUCH?= touch -f -c
-
-# source tree is located via $S relative to the compilation directory
-S= ../../../..
-ARC= ../..
-MIPS= ../../../mips
-
-INCLUDES= -I. -I$S/arch -I$S
-CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL -Darc
-CDIAGFLAGS= -Werror -Wall -Wmissing-prototypes -Wstrict-prototypes \
- -Wno-uninitialized -Wno-format -Wno-main
-
-CFLAGS= ${DEBUG} -O2 ${CDIAGFLAGS} -mno-abicalls -mips2 -mcpu=r4000 \
- ${COPTS}
-AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE
-
-### find out what to use for libkern
-.include "$S/lib/libkern/Makefile.inc"
-.ifndef PROF
-LIBKERN= ${KERNLIB}
-.else
-LIBKERN= ${KERNLIB_PROF}
-.endif
-
-### find out what to use for libcompat
-.include "$S/compat/common/Makefile.inc"
-.ifndef PROF
-LIBCOMPAT= ${COMPATLIB}
-.else
-LIBCOMPAT= ${COMPATLIB_PROF}
-.endif
-
-# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
-# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
-# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
-# is marked as config-dependent.
-
-USRLAND_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
-USRLAND_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
-
-NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
-NORMAL_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
-
-DRIVER_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
-DRIVER_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
-
-NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
-NORMAL_S_C= ${AS} ${COPTS} ${PARAM} $< -o $@
-
-%OBJS
-
-%CFILES
-
-%SFILES
-
-# load lines for config "xxx" will be emitted as:
-# xxx: ${SYSTEM_DEP} swapxxx.o
-# ${SYSTEM_LD_HEAD}
-# ${SYSTEM_LD} swapxxx.o
-# ${SYSTEM_LD_TAIL}
-
-SYSTEM_OBJ= locore.o fp.o ${OBJS} param.o ioconf.o ${LIBKERN} \
- ${LIBCOMPAT}
-#
-SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
-SYSTEM_LD_HEAD= rm -f $@
-SYSTEM_LD= -@if [ X${DEBUG} = X-g ]; \
- then strip=-X; \
- else strip=-x; \
- fi; \
- echo ${LD} $$strip -o $@ -e start -T ../../conf/ld.script \
- '$${SYSTEM_OBJ}' vers.o; \
- ${LD} $$strip -o $@ -e start -T ../../conf/ld.script \
- ${SYSTEM_OBJ} vers.o
-#
-SYSTEM_LD_TAIL= chmod 755 $@; \
- elf2ecoff $@ $@.ecoff; \
- size $@
-
-%LOAD
-
-newvers:
- sh $S/conf/newvers.sh
- ${CC} $(CFLAGS) -c vers.c
-
-clean::
- rm -f eddep bsd bsd.gdb bsd.ecoff tags *.o locore.i [a-z]*.s \
- Errs errs linterrs makelinks
-
-lint: /tmp param.c
- @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
- ${CFILES} ioconf.c param.c
-
-symbols.sort: ${ARC}/arc/symbols.raw
- grep -v '^#' ${ARC}/arc/symbols.raw \
- | sed 's/^ //' | sort -u > symbols.sort
-
-locore.o: ${ARC}/arc/locore.S ${MIPS}/include/asm.h \
- ${MIPS}/include/cpu.h ${MIPS}/include/reg.h assym.h
- ${NORMAL_S} -mips3 ${ARC}/arc/locore.S
-
-fp.o: ${MIPS}/mips/fp.S ${MIPS}/include/asm.h \
- ${ARC}/include/cpu.h ${MIPS}/include/reg.h assym.h
- ${NORMAL_S} -mips3 ${MIPS}/mips/fp.S
-
-# the following are necessary because the files depend on the types of
-# cpu's included in the system configuration
-clock.o machdep.o autoconf.o conf.o: Makefile
-
-# depend on network configuration
-uipc_domain.o uipc_proto.o vfs_conf.o: Makefile
-if_tun.o if_loop.o if_ethersubr.o: Makefile
-in_proto.o: Makefile
-
-
-assym.h: $S/kern/genassym.sh ${ARC}/arc/genassym.cf
- sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} \
- ${PARAM} < ${ARC}/arc/genassym.cf > assym.h.tmp && \
- mv -f assym.h.tmp assym.h
-
-
-links:
- egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
- sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
- echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
- sort -u | comm -23 - dontlink | \
- sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
- sh makelinks && rm -f dontlink
-
-tags:
- @echo "see $S/kern/Makefile for tags"
-
-ioconf.o: ioconf.c
- ${NORMAL_C}
-
-param.c: $S/conf/param.c
- rm -f param.c
- cp $S/conf/param.c .
-
-param.o: param.c Makefile
- ${NORMAL_C_C}
-
-newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
- sh $S/conf/newvers.sh
- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
-
-depend:: .depend
-.depend: ${SRCS} assym.h param.c
- mkdep ${AFLAGS} ${CPPFLAGS} ${ARC}/arc/locore.S
- mkdep -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
-# mkdep -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
-
-%RULES
-
diff --git a/sys/arch/arc/conf/NFSROOT b/sys/arch/arc/conf/NFSROOT
deleted file mode 100644
index b1e9990baa5..00000000000
--- a/sys/arch/arc/conf/NFSROOT
+++ /dev/null
@@ -1,126 +0,0 @@
-# $OpenBSD: NFSROOT,v 1.2 1999/08/29 12:14:03 niklas Exp $
-#
-# Generic configuration file for MIPS R4x00 ARC Systems
-#
-
-machine arc mips
-
-option SCSITERSE
-
-maxusers 4
-option TIMEZONE=0 # time zone to adjust RTC time by
-option DST=0 # daylight savings time used by RTC
-
-option SWAPPAGER # paging; REQUIRED
-option DEVPAGER # mmap() of devices
-
-#makeoptions DEBUG="-g" # compile full symbol table
-
-option FFS # UFS
-#option EXT2FS # Linux ext2fs
-
-option NFSCLIENT # Network File System client
-
-#option CD9660 # ISO 9660 + Rock Ridge file system
-option MSDOSFS # MS-DOS file system
-option FIFO # FIFOs; RECOMMENDED
-option KERNFS # /kern
-
-option INET # IP + ICMP + TCP + UDP
-
-option BOOT_CONFIG # boot-time kernel config
-#option DDB
-
-# MD options
-option NATIVE_ELF # Arc systems uses ELF as native format
-
-# Specify storage configuration (its a joke..)
-config bsd swap generic
-
-#
-# Definition of system
-#
-mainbus0 at root
-cpu* at mainbus0
-
-#### Main local buses
-
-#pica* at mainbus0 # ACER Pica systems local bus.
-isabr* at mainbus0 # ISA Bus bridge (std ISA bus).
-
-#### PICA bus devices
-
-#clock0 at pica?
-#pc0 at pica?
-#pms0 at pica?
-#com0 at pica?
-#com1 at pica?
-#lpt0 at pica?
-#sn0 at pica?
-
-#fdc0 at pica?
-#fd* at fdc? drive ?
-
-#asc0 at pica?
-#scsibus* at asc?
-
-#### ISA Bus.
-
-isa* at isabr?
-
-clock0 at isa? port 0x70 irq 0
-
-pc0 at isa? port 0x60 irq 1 # generic PC console device
-com0 at isa? port 0x3f8 irq 4
-com1 at isa? port 0x2f8 irq 3
-com2 at isa? port 0x3e8 irq 4
-com3 at isa? port 0x2e8 irq 3
-ast0 at isa? port 0x1a0 irq 3 # AST 4-port serial cards
-com* at ast? slave ?
-lpt0 at isa? port 0x378 irq 7
-
-# Joystick driver. Probe is a little strange; add only if you have one.
-# joy0 at isa? port 0x201
-
-# IDE controllers
-wdc0 at isa? port 0x1f0 irq 14 flags 0x00
-wdc1 at isa? port 0x170 irq 15 flags 0x00
-#wdc* at pcmcia? function ?
-#wdc* at isapnp?
-
-# IDE hard drives
-wd* at wdc? channel ? drive ? flags 0x0000
-
-# ATAPI<->SCSI
-atapiscsi* at wdc? channel ?
-scsibus* at atapiscsi?
-
-ep0 at isa? port ? irq ? # 3C509 ethernet cards
-we0 at isa? port 0x280 iomem 0xd0000 irq 9 # WD/SMC 80x3 ethernet
-we1 at isa? port 0x300 iomem 0xcc000 irq 10 #
-#we* at isapnp?
-ec0 at isa? port 0x250 iomem 0xd8000 irq 9 # 3C503 ethernet
-ne0 at isa? port 0x240 irq 9 # NE[12]000 ethernet
-ne1 at isa? port 0x300 irq 10 # NE[12]000 ethernet
-ne2 at isa? port 0x280 irq 9 # NE[12]000 ethernet
-#ne* at isapnp? # NE[12]000 PnP ether cards
-
-btl0 at isa? port 0x330 irq ? drq ?
-scsibus* at btl?
-
-#### SCSI Bus devices
-
-sd* at scsibus? target ? lun ?
-st* at scsibus? target ? lun ?
-cd* at scsibus? target ? lun ?
-ch* at scsibus? target ? lun ?
-ss* at scsibus? target ? lun ?
-uk* at scsibus? target ? lun ?
-
-pseudo-device loop 1 # network loopback
-#pseudo-device sl 1 # CSLIP
-#pseudo-device ppp 1 # PPP
-pseudo-device bpfilter 1 # packet filter
-pseudo-device pty 64 # pseudo-terminals
-pseudo-device vnd 4 # concatenated disk devices
-pseudo-device ksyms 1 # kernel symbols device
diff --git a/sys/arch/arc/conf/P4032 b/sys/arch/arc/conf/P4032
deleted file mode 100644
index 3fdfee97de5..00000000000
--- a/sys/arch/arc/conf/P4032
+++ /dev/null
@@ -1,116 +0,0 @@
-# $OpenBSD: P4032,v 1.5 1998/03/16 09:38:36 pefo Exp $
-#
-# Generic configuration file for Algorithmics P4032 board
-#
-
-machine arc mips
-
-maxusers 32
-
-# Need to set locally
-option TIMEZONE=0 # minutes west of GMT (for)
-option DST=0 # use daylight savings rules
-
-# Standard system options
-option SWAPPAGER # swap pager (anonymous and swap space)
-option DEVPAGER # device pager (mapped devices)
-
-option DIAGNOSTIC # extra kernel debugging checks
-option KTRACE # system call tracing support
-option DEBUG # extra kernel debugging support
-option COMPAT_43 # compatibility with 4.3BSD binaries
-
-option DDB
-
-# System V options
-option SYSVMSG # System V-like message queues
-option SYSVSEM # System V-like semaphores
-option SYSVSHM # System V-like memory sharing
-option SHMMAXPGS=1024 # 1024 pages is the default
-option NATIVE_ELF # Arc systems uses ELF as native format
-
-# Filesystem options
-option CD9660 # ISO 9660 + Rock Ridge file system
-option FDESC # user file descriptor filesystem (/dev/fd)
-option FIFO # POSIX fifo support (in all filesystems)
-option FFS,QUOTA # fast filesystem with user and group quotas
-option KERNFS # kernel data-structure filesystem
-option MFS # memory-based filesystem
-option MSDOSFS # Ability to read write MS-Dos filsystem
-option NFSCLIENT # Sun NFS-compatible filesystem (client)
-option NFSSERVER # Sun NFS-compatible filesystem (server)
-option NULLFS # null layer filesystem
-option PORTAL # portal filesystem (still experimental)
-option PROCFS # /proc
-option UMAPFS # uid/gid remapping filesystem
-option UNION # union file system
-
-
-# Networking options
-#option GATEWAY # IP packet forwarding
-option INET # Internet protocols
-#option NS # XNS
-#option IPX # IPX+SPX
-#option ISO,TPIP # OSI networking
-#option EON # OSI tunneling over IP
-#option CCITT,LLC,HDLC # X.25
-option IPFILTER # IP packet filter for security
-option IPFILTER_LOG # use /dev/ipl to log IPF
-
-#option TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP
-#option MULTICAST # Multicast support
-#option MROUTING # Multicast routing support
-
-# Specify storage configuration (its a joke..)
-config bsd swap generic
-
-#
-# Definition of system
-#
-mainbus0 at root
-cpu* at mainbus0
-
-#### Main local buses
-
-algor* at mainbus0 # Algorithmics local bus.
-pbcpcibr* at mainbus0 # PCI Bus bridge.
-
-#### Algor bus devices
-
-clock0 at algor?
-com0 at algor?
-com1 at algor?
-lpt0 at algor?
-
-#### PCI Bus
-
-pci* at pbcpcibr?
-
-#pcivga* at pci? dev ? function ?
-ncr* at pci? dev ? function ?
-scsibus* at ncr?
-de* at pci? dev ? function ?
-
-#### SCSI Bus devices
-
-sd* at scsibus? target ? lun ?
-st* at scsibus? target ? lun ?
-cd* at scsibus? target ? lun ?
-ch* at scsibus? target ? lun ?
-ss* at scsibus? target ? lun ?
-uk* at scsibus? target ? lun ?
-
-#### PSEUDO Devices
-
-pseudo-device loop 1 # network loopback
-pseudo-device bpfilter 8 # packet filter ports
-pseudo-device sl 2 # serial-line IP ports
-pseudo-device ppp 2 # serial-line PPP ports
-pseudo-device tun 2 # network tunneling over tty
-
-pseudo-device pty 64 # pseudo ptys
-pseudo-device tb 1 # tablet line discipline
-pseudo-device vnd 4 # paging to files
-pseudo-device ccd 4 # concatenated disk devices
-pseudo-device rd 4 # ram disk.
-
diff --git a/sys/arch/arc/conf/PICA b/sys/arch/arc/conf/PICA
deleted file mode 100644
index e33be8f56ec..00000000000
--- a/sys/arch/arc/conf/PICA
+++ /dev/null
@@ -1,104 +0,0 @@
-#
-# Generic configuration file for MIPS R4400 PICA system
-#
-
-machine arc
-
-maxusers 8
-
-# Need to set locally
-option TIMEZONE="8*60" # minutes west of GMT (for)
-option DST=1 # use daylight savings rules
-
-# Standard system options
-option SWAPPAGER # swap pager (anonymous and swap space)
-option DEVPAGER # device pager (mapped devices)
-option DIAGNOSTIC # extra kernel debugging checks
-option DEBUG # extra kernel debugging support
-option "COMPAT_43" # compatibility with 4.3BSD binaries
-option KTRACE # system call tracing support
-option "NKMEMCLUSTERS=1024" # 4K pages in kernel malloc pool
-#option KGDB # support for kernel gdb
-#option "KGDBRATE=19200" # kernel gdb port rate (default 9600)
-#option "KGDBDEV=15*256+0" # device for kernel gdb
-
-# System V options
-option SYSVMSG # System V-like message queues
-option SYSVSEM # System V-like semaphores
-option SYSVSHM # System V-like memory sharing
-option SHMMAXPGS=1024 # 1024 pages is the default
-option NATIVE_ELF
-
-# Filesystem options
-option FIFO # POSIX fifo support (in all filesystems)
-option FFS,QUOTA # fast filesystem with user and group quotas
-option MFS # memory-based filesystem
-option NFSCLIENT # Sun NFS-compatible filesystem (client)
-option NFSSERVER # Sun NFS-compatible filesystem (server)
-option KERNFS # kernel data-structure filesystem
-option MSDOSFS # Ability to read write MS-Dos filsystem
-option CD9660 # ISO 9660 + Rock Ridge file system
-option FDESC # user file descriptor filesystem
-#option UMAPFS # uid/gid remapping filesystem
-#option NULLFS # null layer filesystem
-#option PORTAL # portal filesystem (still experimental)
-
-# Networking options
-option INET # Internet protocols
-#option "TCP_COMPAT_42" # compatibility with 4.2BSD TCP/IP
-option GATEWAY # IP packet forwarding
-#option MULTICAST # Multicast support
-#option MROUTING # Multicast routing support
-#option ISO # OSI networking
-#option TPIP
-#option EON
-
-# Specify storage configuration
-config bsd root on sd0 swap on sd0 and sd1
-
-#
-# Definition of system
-#
-mainbus0 at root
-cpu* at mainbus0
-
-pica* at mainbus0
-
-clock0 at pica?
-pc0 at pica?
-pms0 at pica?
-com0 at pica?
-com1 at pica?
-lpt0 at pica?
-sn0 at pica?
-
-fdc0 at pica?
-fd* at fdc? drive ?
-
-asc0 at pica?
-scsibus* at asc?
-
-sd* at scsibus? target ? lun ?
-st* at scsibus? target ? lun ?
-cd* at scsibus? target ? lun ?
-ch* at scsibus? target ? lun ?
-ss* at scsibus? target ? lun ?
-uk* at scsibus? target ? lun ?
-
-#
-# ISA Bus.
-#
-isabr* at mainbus0
-
-isa* at isabr?
-
-com2 at isa? port 0x3f8 irq 4
-com3 at isa? port 0x2f8 irq 3
-
-
-pseudo-device sl 2 # serial-line IP ports
-pseudo-device ppp 2 # serial-line PPP ports
-pseudo-device pty 64 # pseudo ptys
-pseudo-device bpfilter 16 # packet filter ports
-pseudo-device loop
-pseudo-device vnd 4 # virtual disk
diff --git a/sys/arch/arc/conf/RAMDISK b/sys/arch/arc/conf/RAMDISK
deleted file mode 100644
index 4ab86ce99d3..00000000000
--- a/sys/arch/arc/conf/RAMDISK
+++ /dev/null
@@ -1,174 +0,0 @@
-# $OpenBSD: RAMDISK,v 1.9 1999/08/29 12:14:03 niklas Exp $
-#
-# Generic configuration file for MIPS R4x00 ARC Systems
-#
-
-machine arc mips
-
-maxusers 4
-
-# Need to set locally
-option TIMEZONE=0 # minutes west of GMT (for)
-option DST=0 # use daylight savings rules
-
-# Standard system options
-option SWAPPAGER # swap pager (anonymous and swap space)
-option DEVPAGER # device pager (mapped devices)
-
-option DIAGNOSTIC # extra kernel debugging checks
-option KTRACE # system call tracing support
-option DEBUG # extra kernel debugging support
-option COMPAT_43 # compatibility with 4.3BSD binaries
-
-# System V options
-option SYSVMSG # System V-like message queues
-option SYSVSEM # System V-like semaphores
-option SYSVSHM # System V-like memory sharing
-option SHMMAXPGS=1024 # 1024 pages is the default
-option NATIVE_ELF # Arc systems uses ELF as native format
-
-# Filesystem options
-option CD9660 # ISO 9660 + Rock Ridge file system
-#option FDESC # user file descriptor filesystem (/dev/fd)
-option FIFO # POSIX fifo support (in all filesystems)
-option FFS,QUOTA # fast filesystem with user and group quotas
-option KERNFS # kernel data-structure filesystem
-option MFS # memory-based filesystem
-option MSDOSFS # Ability to read write MS-Dos filsystem
-option NFSCLIENT # Sun NFS-compatible filesystem (client)
-#option NFSSERVER # Sun NFS-compatible filesystem (server)
-#option NULLFS # null layer filesystem
-#option PORTAL # portal filesystem (still experimental)
-#option PROCFS # /proc
-#option UMAPFS # uid/gid remapping filesystem
-#option UNION # union file system
-
-
-# Networking options
-#option GATEWAY # IP packet forwarding
-option INET # Internet protocols
-#option NS # XNS
-#option IPX # IPX+SPX
-#option ISO,TPIP # OSI networking
-#option EON # OSI tunneling over IP
-#option CCITT,LLC,HDLC # X.25
-#option IPFILTER # IP packet filter for security
-#option IPFILTER_LOG # use /dev/ipl to log IPF
-
-#option TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP
-#option MULTICAST # Multicast support
-#option MROUTING # Multicast routing support
-
-# Specify storage configuration using ramdisk
-config bsd root on rd0a swap on rd0b
-
-#
-# Definition of system
-#
-mainbus0 at root
-cpu* at mainbus0
-
-#### Main local buses
-
-pica* at mainbus0 # ACER Pica systems local bus.
-isabr* at mainbus0 # ISA Bus bridge (std ISA bus).
-#algor* at mainbus0 # P4032 PCI Bridge.
-#pbcpcibr* at mainbus0 # PCI Bus bridge.
-
-#### PICA bus devices
-
-clock0 at pica?
-pc0 at pica?
-pms0 at pica?
-com0 at pica?
-com1 at pica?
-lpt0 at pica?
-sn0 at pica?
-
-fdc0 at pica?
-fd* at fdc? drive ?
-
-asc0 at pica?
-scsibus* at asc?
-
-#### Algor bus devices
-
-#clock0 at algor?
-#com0 at algor?
-#com1 at algor?
-#lpt0 at algor?
-
-#### ISA Bus.
-
-isa* at isabr?
-
-clock0 at isa? port 0x70 irq 0
-
-pc0 at isa? port 0x60 irq 1 # generic PC console device
-com0 at isa? port 0x3f8 irq 4
-com1 at isa? port 0x2f8 irq 3
-com2 at isa? port 0x3e8 irq 4
-com3 at isa? port 0x2e8 irq 3
-
-# IDE controllers
-wdc0 at isa? port 0x1f0 irq 14 flags 0x00
-wdc1 at isa? port 0x170 irq 15 flags 0x00
-#wdc* at isapnp?
-
-# IDE hard drives
-wd* at wdc? channel ? drive ? flags 0x0000
-
-# ATAPI<->SCSI
-atapiscsi* at wdc? channel ?
-scsibus* at atapiscsi?
-
-lpt0 at isa? port 0x378 irq 7
-ep0 at isa? port ? irq ? # 3C509 ethernet cards
-we0 at isa? port 0x280 iomem 0xd0000 irq 9 # WD/SMC 80x3 ethernet
-we1 at isa? port 0x300 iomem 0xcc000 irq 10
-#we* at isapnp?
-ec0 at isa? port 0x250 iomem 0xd8000 irq 9 # 3C503 ethernet
-ne0 at isa? port 0x240 irq 9 # NE[12]000 ethernet
-ne1 at isa? port 0x300 irq 10 # NE[12]000 ethernet
-ne2 at isa? port 0x280 irq 9 # NE[12]000 ethernet
-#ne* at isapnp? # NE[12]000 PnP ether
-
-btl0 at isa? port 0x330 irq ? drq ?
-scsibus* at btl?
-
-#### PCI Bus
-
-#pci* at pbcpcibr?
-
-#de* at pci? dev ? function ?
-#ncr* at pci? dev ? function ?
-#scsibus* at ncr?
-
-
-#### SCSI Bus devices
-
-sd* at scsibus? target ? lun ?
-st* at scsibus? target ? lun ?
-cd* at scsibus? target ? lun ?
-#ch* at scsibus? target ? lun ?
-#ss* at scsibus? target ? lun ?
-#uk* at scsibus? target ? lun ?
-
-#### PSEUDO Devices
-
-pseudo-device loop 1 # network loopback
-#pseudo-device bpfilter 8 # packet filter ports
-pseudo-device sl 2 # serial-line IP ports
-pseudo-device ppp 2 # serial-line PPP ports
-#pseudo-device tun 2 # network tunneling over tty
-
-#pseudo-device pty 64 # pseudo ptys
-#pseudo-device tb 1 # tablet line discipline
-#pseudo-device vnd 4 # paging to files
-#pseudo-device ccd 4 # concatenated disk devices
-pseudo-device rd 1 # Ram disk.
-
-# RAMDISK stuff
-option MINIROOTSIZE=8192
-option RAMDISK_HOOKS
-
diff --git a/sys/arch/arc/conf/files.arc b/sys/arch/arc/conf/files.arc
deleted file mode 100644
index 42a256715bb..00000000000
--- a/sys/arch/arc/conf/files.arc
+++ /dev/null
@@ -1,176 +0,0 @@
-# $OpenBSD: files.arc,v 1.23 2000/08/15 01:04:17 imp Exp $
-#
-# maxpartitions must be first item in files.${ARCH}
-#
-maxpartitions 16
-
-maxusers 2 8 64
-
-# Required files
-
-file arch/arc/arc/autoconf.c
-file arch/arc/arc/conf.c
-file arch/arc/dev/dma.c
-file arch/arc/arc/machdep.c
-file arch/arc/arc/pmap.c
-file arch/arc/arc/trap.c
-
-file arch/mips/mips/arcbios.c
-
-#
-# Media Independent Interface (mii)
-#
-include "../../../dev/mii/files.mii"
-
-#
-# Machine-independent ATAPI drivers
-#
-
-include "../../../dev/atapiscsi/files.atapiscsi"
-include "../../../dev/ata/files.ata"
-
-#
-# System BUS types
-#
-define mainbus {}
-device mainbus
-attach mainbus at root
-file arch/mips/mips/mainbus.c mainbus
-
-# Our CPU configurator
-device cpu
-attach cpu at mainbus # not optional
-file arch/mips/mips/cpu.c cpu
-
-#
-# PICA bus autoconfiguration devices
-#
-device pica {}
-attach pica at mainbus # optional
-file arch/arc/pica/picabus.c pica
-
-#
-# ALGOR bus autoconfiguration devices
-#
-device algor {}
-attach algor at mainbus # optional
-file arch/arc/algor/algorbus.c algor
-
-#
-# ISA Bus bridge
-#
-device isabr {} : isabus
-attach isabr at mainbus # optional
-file arch/arc/isa/isabus.c isabr
-
-#
-# PCI Bus bridge
-#
-device pbcpcibr {} : pcibus
-attach pbcpcibr at mainbus # optional
-file arch/arc/pci/pbcpcibus.c pbcpcibr
-
-# Ethernet chip on PICA bus
-device sn
-attach sn at pica: ifnet, ether
-file arch/arc/dev/if_sn.c sn needs-count
-
-# Use machine independent SCSI driver routines
-include "../../../scsi/files.scsi"
-major {sd = 0}
-major {cd = 3}
-
-# Symbios 53C94 SCSI interface driver on PICA bus
-device asc: scsi
-attach asc at pica
-file arch/arc/dev/asc.c asc needs-count
-
-# Floppy disk controller on PICA bus
-device fdc {drive = -1}
-attach fdc at pica
-device fd: disk
-attach fd at fdc
-file arch/arc/dev/fd.c fdc needs-flag
-major {fd = 7}
-
-#
-# Stock ISA bus support
-#
-define pcmcia {} # XXX dummy decl...
-
-include "../../../dev/pci/files.pci"
-include "../../../dev/isa/files.isa"
-major { wd = 4 }
-
-# Real time clock, must have one..
-device clock
-attach clock at pica with clock_pica
-attach clock at isa with clock_isa
-attach clock at algor with clock_algor
-file arch/arc/arc/clock_mc.c clock & (clock_isa | clock_pica | clock_algor) needs-flag
-
-# Console driver on PC-style graphics
-device pc: tty
-attach pc at pica with pc_pica
-attach pc at isa with pc_isa
-device pms: tty
-attach pms at pica
-file arch/arc/dev/pccons.c pc & (pc_pica | pc_isa) needs-flag
-
-# BusLogic BT-445C VLB SCSI Controller. Special on TYNE local bus.
-device btl: scsi
-attach btl at isa
-file arch/arc/dti/btl.c btl needs-count
-
-# 8250/16[45]50-based "com" ports
-attach com at pica with com_pica
-attach com at algor with com_algor
-file arch/arc/dev/com_lbus.c com & (com_pica | com_algor)
-
-# Game adapter (joystick)
-device joy
-attach joy at isa
-file arch/arc/isa/joy.c joy needs-flag
-
-# PC parallel ports (XXX what chip?)
-attach lpt at pica with lpt_pica
-attach lpt at algor with lpt_algor
-file arch/arc/dev/lpt_lbus.c lpt & (lpt_pica | lpt_algor)
-
-
-#
-# PCI Bus support
-#
-
-# PCI VGA display driver
-device pcivga: tty
-attach pcivga at pci
-file arch/arc/pci/pci_vga.c pcivga
-
-#
-# ISA PnP
-#
-
-include "../../../dev/isa/files.isapnp"
-file arch/arc/isa/isapnp_machdep.c isapnp
-
-#
-# Specials.
-#
-# RAM disk for boot tape
-file arch/arc/dev/rd_root.c ramdisk_hooks
-major {rd = 8}
-
-#
-# Common files
-#
-
-file dev/cons.c
-file dev/cninit.c
-file netinet/in_cksum.c
-file netns/ns_cksum.c ns
-
-file compat/ultrix/ultrix_misc.c compat_ultrix
-file compat/ultrix/ultrix_syscalls.c compat_ultrix
-file compat/ultrix/ultrix_sysent.c compat_ultrix
-
diff --git a/sys/arch/arc/conf/ld.script b/sys/arch/arc/conf/ld.script
deleted file mode 100644
index 3c59f13f80b..00000000000
--- a/sys/arch/arc/conf/ld.script
+++ /dev/null
@@ -1,74 +0,0 @@
-OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips",
- "elf32-littlemips")
-OUTPUT_ARCH(mips)
-ENTRY(_start)
-SECTIONS
-{
- /* Read-only sections, merged into text segment: */
- . = 0x80100000 + SIZEOF_HEADERS;
- .text :
- {
- _ftext = . ;
- *(.text)
- *(.rodata)
- *(.rodata1)
- *(.reginfo)
- *(.init)
- *(.stub)
- /* .gnu.warning sections are handled specially by elf32.em. */
- *(.gnu.warning)
- } =0
- _etext = .;
- PROVIDE (etext = .);
- .fini : { *(.fini) } =0
- .data :
- {
- _fdata = . ;
- *(.data)
- CONSTRUCTORS
- }
- .data1 : { *(.data1) }
- .ctors : { *(.ctors) }
- .dtors : { *(.dtors) }
- _gp = ALIGN(16) + 0x7ff0;
- .got :
- {
- *(.got.plt) *(.got)
- }
- /* We want the small data sections together, so single-instruction offsets
- can access them all, and initialized data all before uninitialized, so
- we can shorten the on-disk segment size. */
- .sdata : { *(.sdata) }
- .lit8 : { *(.lit8) }
- .lit4 : { *(.lit4) }
- _edata = .;
- PROVIDE (edata = .);
- __bss_start = .;
- _fbss = .;
- .sbss : { *(.sbss) *(.scommon) }
- .bss :
- {
- *(.dynbss)
- *(.bss)
- *(COMMON)
- }
- _end = . ;
- PROVIDE (end = .);
- /* These are needed for ELF backends which have not yet been
- converted to the new style linker. */
- .stab 0 : { *(.stab) }
- .stabstr 0 : { *(.stabstr) }
- /* DWARF debug sections.
- Symbols in the .debug DWARF section are relative to the beginning of the
- section so we begin .debug at 0. It's not clear yet what needs to happen
- for the others. */
- .debug 0 : { *(.debug) }
- .debug_srcinfo 0 : { *(.debug_srcinfo) }
- .debug_aranges 0 : { *(.debug_aranges) }
- .debug_pubnames 0 : { *(.debug_pubnames) }
- .debug_sfnames 0 : { *(.debug_sfnames) }
- .line 0 : { *(.line) }
- /* These must appear regardless of . */
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
-}
diff --git a/sys/arch/arc/dev/asc.c b/sys/arch/arc/dev/asc.c
deleted file mode 100644
index e6723fbb0be..00000000000
--- a/sys/arch/arc/dev/asc.c
+++ /dev/null
@@ -1,2091 +0,0 @@
-/* $OpenBSD: asc.c,v 1.10 2001/01/25 03:50:47 todd Exp $ */
-/* $NetBSD: asc.c,v 1.10 1994/12/05 19:11:12 dean Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell and Rick Macklem.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)asc.c 8.3 (Berkeley) 7/3/94
- */
-
-/*
- * Mach Operating System
- * Copyright (c) 1991,1990,1989 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-/*
- * HISTORY
- * Log: scsi_53C94_hdw.c,v
- * Revision 2.5 91/02/05 17:45:07 mrt
- * Added author notices
- * [91/02/04 11:18:43 mrt]
- *
- * Changed to use new Mach copyright
- * [91/02/02 12:17:20 mrt]
- *
- * Revision 2.4 91/01/08 15:48:24 rpd
- * Added continuation argument to thread_block.
- * [90/12/27 rpd]
- *
- * Revision 2.3 90/12/05 23:34:48 af
- * Recovered from pmax merge.. and from the destruction of a disk.
- * [90/12/03 23:40:40 af]
- *
- * Revision 2.1.1.1 90/11/01 03:39:09 af
- * Created, from the DEC specs:
- * "PMAZ-AA TURBOchannel SCSI Module Functional Specification"
- * Workstation Systems Engineering, Palo Alto, CA. Aug 27, 1990.
- * And from the NCR data sheets
- * "NCR 53C94, 53C95, 53C96 Advances SCSI Controller"
- * [90/09/03 af]
- */
-
-/*
- * File: scsi_53C94_hdw.h
- * Author: Alessandro Forin, Carnegie Mellon University
- * Date: 9/90
- *
- * Bottom layer of the SCSI driver: chip-dependent functions
- *
- * This file contains the code that is specific to the NCR 53C94
- * SCSI chip (Host Bus Adapter in SCSI parlance): probing, start
- * operation, and interrupt routine.
- */
-
-/*
- * This layer works based on small simple 'scripts' that are installed
- * at the start of the command and drive the chip to completion.
- * The idea comes from the specs of the NCR 53C700 'script' processor.
- *
- * There are various reasons for this, mainly
- * - Performance: identify the common (successful) path, and follow it;
- * at interrupt time no code is needed to find the current status
- * - Code size: it should be easy to compact common operations
- * - Adaptability: the code skeleton should adapt to different chips without
- * terrible complications.
- * - Error handling: and it is easy to modify the actions performed
- * by the scripts to cope with strange but well identified sequences
- *
- */
-
-#include <asc.h>
-#if NASC > 0
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/dkstat.h>
-#include <sys/buf.h>
-#include <sys/proc.h>
-#include <sys/conf.h>
-#include <sys/errno.h>
-#include <sys/device.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-
-#include <machine/cpu.h>
-#include <machine/autoconf.h>
-
-#include <mips/archtype.h>
-
-#include <arc/dev/dma.h>
-#include <arc/dev/scsi.h>
-#include <arc/dev/ascreg.h>
-
-#include <arc/pica/pica.h>
-
-
-#define readback(a) { register int foo; foo = (a); }
-
-/*
- * In 4ns ticks.
- */
-int asc_to_scsi_period[] = {
- 32,
- 33,
- 34,
- 35,
- 5,
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12,
- 13,
- 14,
- 15,
- 16,
- 17,
- 18,
- 19,
- 20,
- 21,
- 22,
- 23,
- 24,
- 25,
- 26,
- 27,
- 28,
- 29,
- 30,
- 31,
-};
-
-/*
- * Internal forward declarations.
- */
-struct asc_softc;
-static void asc_reset __P((struct asc_softc *, asc_regmap_t *));
-static void asc_startcmd __P((struct asc_softc *, int));
-
-#ifdef DEBUG
-int asc_debug = 1;
-int asc_debug_cmd;
-int asc_debug_bn;
-int asc_debug_sz;
-#define NLOG 16
-struct asc_log {
- u_int status;
- u_char state;
- u_char msg;
- int target;
- int resid;
-} asc_log[NLOG], *asc_logp = asc_log;
-#define PACK(unit, status, ss, ir) \
- ((unit << 24) | (status << 16) | (ss << 8) | ir)
-#endif
-
-/*
- * Scripts are entries in a state machine table.
- * A script has four parts: a pre-condition, an action, a command to the chip,
- * and an index into asc_scripts for the next state. The first triggers error
- * handling if not satisfied and in our case it is formed by the
- * values of the interrupt register and status register, this
- * basically captures the phase of the bus and the TC and BS
- * bits. The action part is just a function pointer, and the
- * command is what the 53C94 should be told to do at the end
- * of the action processing. This command is only issued and the
- * script proceeds if the action routine returns TRUE.
- * See asc_intr() for how and where this is all done.
- */
-typedef struct script {
- int condition; /* expected state at interrupt time */
- int (*action)(struct asc_softc *, int, int, int);
- /* extra operations */
- int command; /* command to the chip */
- struct script *next; /* index into asc_scripts for next state */
-} script_t;
-
-/* Matching on the condition value */
-#define SCRIPT_MATCH(ir, csr) ((ir) | (((csr) & 0x67) << 8))
-
-
-/* forward decls of script actions */
- /* when nothing needed */
-static int script_nop __P((struct asc_softc *, int, int, int));
- /* all come to an end */
-static int asc_end __P((struct asc_softc *, int, int, int));
- /* get status from target */
-static int asc_get_status __P((struct asc_softc *, int, int, int));
- /* start reading data from target */
-static int asc_dma_in __P((struct asc_softc *, int, int, int));
- /* cleanup after all data is read */
-static int asc_last_dma_in __P((struct asc_softc *, int, int, int));
- /* resume data in after a message */
-static int asc_resume_in __P((struct asc_softc *, int, int, int));
- /* resume DMA after a disconnect */
-static int asc_resume_dma_in __P((struct asc_softc *, int, int, int));
- /* send data to target via dma */
-static int asc_dma_out __P((struct asc_softc *, int, int, int));
- /* cleanup after all data is written */
-static int asc_last_dma_out __P((struct asc_softc *, int, int, int));
- /* resume data out after a message */
-static int asc_resume_out __P((struct asc_softc *, int, int, int));
- /* resume DMA after a disconnect */
-static int asc_resume_dma_out __P((struct asc_softc *, int, int, int));
- /* negotiate sync xfer */
-static int asc_sendsync __P((struct asc_softc *, int, int, int));
- /* negotiate sync xfer */
-static int asc_replysync __P((struct asc_softc *, int, int, int));
- /* process a message byte */
-static int asc_msg_in __P((struct asc_softc *, int, int, int));
- /* process an expected disconnect */
-static int asc_disconnect __P((struct asc_softc *, int, int, int));
-
-/* Define the index into asc_scripts for various state transitions */
-#define SCRIPT_DATA_IN 0
-#define SCRIPT_CONTINUE_IN 2
-#define SCRIPT_DATA_OUT 3
-#define SCRIPT_CONTINUE_OUT 5
-#define SCRIPT_SIMPLE 6
-#define SCRIPT_GET_STATUS 7
-#define SCRIPT_DONE 8
-#define SCRIPT_MSG_IN 9
-#define SCRIPT_REPLY_SYNC 11
-#define SCRIPT_TRY_SYNC 12
-#define SCRIPT_DISCONNECT 15
-#define SCRIPT_RESEL 16
-#define SCRIPT_RESUME_IN 17
-#define SCRIPT_RESUME_DMA_IN 18
-#define SCRIPT_RESUME_OUT 19
-#define SCRIPT_RESUME_DMA_OUT 20
-#define SCRIPT_RESUME_NO_DATA 21
-
-/*
- * Scripts
- */
-script_t asc_scripts[] = {
- /* start data in */
- {SCRIPT_MATCH(ASC_INT_FC | ASC_INT_BS, ASC_PHASE_DATAI), /* 0 */
- asc_dma_in, ASC_CMD_XFER_INFO | ASC_CMD_DMA,
- &asc_scripts[SCRIPT_DATA_IN + 1]},
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_STATUS), /* 1 */
- asc_last_dma_in, ASC_CMD_I_COMPLETE,
- &asc_scripts[SCRIPT_GET_STATUS]},
-
- /* continue data in after a chunk is finished */
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_DATAI), /* 2 */
- asc_dma_in, ASC_CMD_XFER_INFO | ASC_CMD_DMA,
- &asc_scripts[SCRIPT_DATA_IN + 1]},
-
- /* start data out */
- {SCRIPT_MATCH(ASC_INT_FC | ASC_INT_BS, ASC_PHASE_DATAO), /* 3 */
- asc_dma_out, ASC_CMD_XFER_INFO | ASC_CMD_DMA,
- &asc_scripts[SCRIPT_DATA_OUT + 1]},
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_STATUS), /* 4 */
- asc_last_dma_out, ASC_CMD_I_COMPLETE,
- &asc_scripts[SCRIPT_GET_STATUS]},
-
- /* continue data out after a chunk is finished */
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_DATAO), /* 5 */
- asc_dma_out, ASC_CMD_XFER_INFO | ASC_CMD_DMA,
- &asc_scripts[SCRIPT_DATA_OUT + 1]},
-
- /* simple command with no data transfer */
- {SCRIPT_MATCH(ASC_INT_FC | ASC_INT_BS, ASC_PHASE_STATUS), /* 6 */
- script_nop, ASC_CMD_I_COMPLETE,
- &asc_scripts[SCRIPT_GET_STATUS]},
-
- /* get status and finish command */
- {SCRIPT_MATCH(ASC_INT_FC, ASC_PHASE_MSG_IN), /* 7 */
- asc_get_status, ASC_CMD_MSG_ACPT,
- &asc_scripts[SCRIPT_DONE]},
- {SCRIPT_MATCH(ASC_INT_DISC, 0), /* 8 */
- asc_end, ASC_CMD_NOP,
- &asc_scripts[SCRIPT_DONE]},
-
- /* message in */
- {SCRIPT_MATCH(ASC_INT_FC, ASC_PHASE_MSG_IN), /* 9 */
- asc_msg_in, ASC_CMD_MSG_ACPT,
- &asc_scripts[SCRIPT_MSG_IN + 1]},
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_MSG_IN), /* 10 */
- script_nop, ASC_CMD_XFER_INFO,
- &asc_scripts[SCRIPT_MSG_IN]},
-
- /* send synchonous negotiation reply */
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_MSG_OUT), /* 11 */
- asc_replysync, ASC_CMD_XFER_INFO,
- &asc_scripts[SCRIPT_REPLY_SYNC]},
-
- /* try to negotiate synchonous transfer parameters */
- {SCRIPT_MATCH(ASC_INT_FC | ASC_INT_BS, ASC_PHASE_MSG_OUT), /* 12 */
- asc_sendsync, ASC_CMD_XFER_INFO,
- &asc_scripts[SCRIPT_TRY_SYNC + 1]},
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_MSG_IN), /* 13 */
- script_nop, ASC_CMD_XFER_INFO,
- &asc_scripts[SCRIPT_MSG_IN]},
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_COMMAND), /* 14 */
- script_nop, ASC_CMD_XFER_INFO | ASC_CMD_DMA,
- &asc_scripts[SCRIPT_RESUME_NO_DATA]},
-
- /* handle a disconnect */
- {SCRIPT_MATCH(ASC_INT_DISC, ASC_PHASE_DATAO), /* 15 */
- asc_disconnect, ASC_CMD_ENABLE_SEL,
- &asc_scripts[SCRIPT_RESEL]},
-
- /* reselect sequence: this is just a placeholder so match fails */
- {SCRIPT_MATCH(0, ASC_PHASE_MSG_IN), /* 16 */
- script_nop, ASC_CMD_MSG_ACPT,
- &asc_scripts[SCRIPT_RESEL]},
-
- /* resume data in after a message */
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_DATAI), /* 17 */
- asc_resume_in, ASC_CMD_XFER_INFO | ASC_CMD_DMA,
- &asc_scripts[SCRIPT_DATA_IN + 1]},
-
- /* resume partial DMA data in after a message */
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_DATAI), /* 18 */
- asc_resume_dma_in, ASC_CMD_XFER_INFO | ASC_CMD_DMA,
- &asc_scripts[SCRIPT_DATA_IN + 1]},
-
- /* resume data out after a message */
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_DATAO), /* 19 */
- asc_resume_out, ASC_CMD_XFER_INFO | ASC_CMD_DMA,
- &asc_scripts[SCRIPT_DATA_OUT + 1]},
-
- /* resume partial DMA data out after a message */
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_DATAO), /* 20 */
- asc_resume_dma_out, ASC_CMD_XFER_INFO | ASC_CMD_DMA,
- &asc_scripts[SCRIPT_DATA_OUT + 1]},
-
- /* resume after a message when there is no more data */
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_STATUS), /* 21 */
- script_nop, ASC_CMD_I_COMPLETE,
- &asc_scripts[SCRIPT_GET_STATUS]},
-};
-
-/*
- * State kept for each active SCSI device.
- */
-typedef struct scsi_state {
- script_t *script; /* saved script while processing error */
- struct scsi_generic cmd;/* storage for scsi command */
- int statusByte; /* status byte returned during STATUS_PHASE */
- u_int dmaBufSize; /* DMA buffer size */
- int dmalen; /* amount to transfer in this chunk */
- int dmaresid; /* amount not transferred if chunk suspended */
- int cmdlen; /* length of command in cmd */
- int buflen; /* total remaining amount of data to transfer */
- vm_offset_t buf; /* current pointer within scsicmd->buf */
- int flags; /* see below */
- int msglen; /* number of message bytes to read */
- int msgcnt; /* number of message bytes received */
- u_char sync_period; /* DMA synchronous period */
- u_char sync_offset; /* DMA synchronous xfer offset or 0 if async */
- u_char msg_out; /* next MSG_OUT byte to send */
- u_char msg_in[16]; /* buffer for multibyte messages */
-} State;
-
-/* state flags */
-#define DISCONN 0x001 /* true if currently disconnected from bus */
-#define DMA_IN_PROGRESS 0x002 /* true if data DMA started */
-#define DMA_IN 0x004 /* true if reading from SCSI device */
-#define DMA_OUT 0x010 /* true if writing to SCSI device */
-#define DID_SYNC 0x020 /* true if synchronous offset was negotiated */
-#define TRY_SYNC 0x040 /* true if try neg. synchronous offset */
-#define PARITY_ERR 0x080 /* true if parity error seen */
-#define CHECK_SENSE 0x100 /* true if doing sense command */
-
-/*
- * State kept for each active SCSI host interface (53C94).
- */
-struct asc_softc {
- struct device sc_dev; /* use as a device */
- asc_regmap_t *regs; /* chip address */
- dma_softc_t __dma; /* stupid macro..... */
- dma_softc_t *dma; /* dma control structure */
- int sc_id; /* SCSI ID of this interface */
- int myidmask; /* ~(1 << myid) */
- int state; /* current SCSI connection state */
- int target; /* target SCSI ID if busy */
- script_t *script; /* next expected interrupt & action */
- struct scsi_xfer *cmdq[ASC_NCMD];/* Pointer to queued commands */
- struct scsi_xfer *cmd[ASC_NCMD];/* Pointer to current active command */
- State st[ASC_NCMD]; /* state info for each active command */
- int min_period; /* Min transfer period clk/byte */
- int max_period; /* Max transfer period clk/byte */
- int ccf; /* CCF, whatever that really is? */
- int timeout_250; /* 250ms timeout */
- int tb_ticks; /* 4ns. ticks/tb channel ticks */
- struct scsi_link sc_link; /* scsi link struct */
-};
-
-#define ASC_STATE_IDLE 0 /* idle state */
-#define ASC_STATE_BUSY 1 /* selecting or currently connected */
-#define ASC_STATE_TARGET 2 /* currently selected as target */
-#define ASC_STATE_RESEL 3 /* currently waiting for reselect */
-
-typedef struct asc_softc *asc_softc_t;
-
-/*
- * Autoconfiguration data for config.
- */
-int ascmatch __P((struct device *, void *, void *));
-void ascattach __P((struct device *, struct device *, void *));
-int ascprint(void *, const char *);
-
-int asc_doprobe __P((void *, int, int, struct device *));
-
-struct cfattach asc_ca = {
- sizeof(struct asc_softc), ascmatch, ascattach
-};
-struct cfdriver asc_cd = {
- NULL, "asc", DV_DULL, NULL, 0
-};
-
-/*
- * Glue to the machine dependent scsi
- */
-int asc_scsi_cmd __P((struct scsi_xfer *));
-void asc_minphys __P((struct buf *));
-
-struct scsi_adapter asc_switch = {
- asc_scsi_cmd,
- asc_minphys,
- NULL,
- NULL,
-};
-
-struct scsi_device asc_dev = {
-/*XXX*/ NULL, /* Use default error handler */
-/*XXX*/ NULL, /* have a queue, served by this */
-/*XXX*/ NULL, /* have no async handler */
-/*XXX*/ NULL, /* Use default 'done' routine */
-};
-
-static int asc_intr __P((void *));
-static int asc_poll __P((struct asc_softc *, int));
-#ifdef DEBUG
-static void asc_DumpLog __P((char *));
-#endif
-
-/*
- * Match driver based on name
- */
-int
-ascmatch(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
-{
- struct confargs *ca = aux;
-
- if(!BUS_MATCHNAME(ca, "asc"))
- return(0);
- return(1);
-}
-
-void
-ascattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- register struct confargs *ca = aux;
- register asc_softc_t asc = (void *)self;
- register asc_regmap_t *regs;
- int id, s, i;
- int bufsiz;
-
- /*
- * Initialize hw descriptor, cache some pointers
- */
- asc->regs = (asc_regmap_t *)BUS_CVTADDR(ca);
-
- /*
- * Set up machine dependencies.
- * 1) how to do dma
- * 2) timing based on chip clock frequency
- */
- switch (system_type) {
- case ACER_PICA_61:
- case MAGNUM:
- bufsiz = 63 * 1024; /*XXX check if code handles 0 as 64k */
- asc->dma = &asc->__dma;
- asc_dma_init(asc->dma);
- break;
- default:
- bufsiz = 64 * 1024;
- };
- /*
- * Now for timing. The pica has a 25Mhz
- */
- switch (system_type) {
- case ACER_PICA_61:
- case MAGNUM:
- asc->min_period = ASC_MIN_PERIOD25;
- asc->max_period = ASC_MAX_PERIOD25;
- asc->ccf = ASC_CCF(25);
- asc->timeout_250 = ASC_TIMEOUT_250(25, asc->ccf);
- asc->tb_ticks = 10;
- break;
- default:
- asc->min_period = ASC_MIN_PERIOD12;
- asc->max_period = ASC_MAX_PERIOD12;
- asc->ccf = ASC_CCF(13);
- asc->timeout_250 = ASC_TIMEOUT_250(13, asc->ccf);
- asc->tb_ticks = 20;
- break;
- };
-
- asc->state = ASC_STATE_IDLE;
- asc->target = -1;
-
- regs = asc->regs;
-
- /*
- * Reset chip, fully. Note that interrupts are already enabled.
- */
- s = splbio();
-
- /* preserve our ID for now */
- asc->sc_id = regs->asc_cnfg1 & ASC_CNFG1_MY_BUS_ID;
- asc->myidmask = ~(1 << asc->sc_id);
-
- asc_reset(asc, regs);
-
- /*
- * Our SCSI id on the bus.
- * The user can set this via the prom on 3maxen/picaen.
- * If this changes it is easy to fix: make a default that
- * can be changed as boot arg.
- */
-#ifdef unneeded
- regs->asc_cnfg1 = (regs->asc_cnfg1 & ~ASC_CNFG1_MY_BUS_ID) |
- (scsi_initiator_id[unit] & 0x7);
- asc->sc_id = regs->asc_cnfg1 & ASC_CNFG1_MY_BUS_ID;
-#endif
- id = asc->sc_id;
- splx(s);
-
- /*
- * Give each target its DMA buffer region.
- * The buffer address is the same for all targets,
- * the allocated dma viritual scatter/gather space.
- */
- for (i = 0; i < ASC_NCMD; i++) {
- asc->st[i].dmaBufSize = bufsiz;
- }
-
- /*
- * Set up interrupt handler.
- */
- BUS_INTR_ESTABLISH(ca, asc_intr, (void *)asc);
-
- printf(": NCR53C94, target %d\n", id);
-
- /*
- * Fill in the prototype scsi link.
- */
- asc->sc_link.adapter_softc = asc;
- asc->sc_link.adapter_target = asc->sc_id;
- asc->sc_link.adapter = &asc_switch;
- asc->sc_link.device = &asc_dev;
- asc->sc_link.openings = 2;
-
- /*
- * Now try to attach all the sub devices.
- */
- config_found(self, &asc->sc_link, ascprint);
-}
-
-int
-ascprint(aux, name)
- void *aux;
- const char *name;
-{
- return -1;
-}
-
-/*
- * Driver breaks down request transfer size.
- */
-void
-asc_minphys(bp)
- struct buf *bp;
-{
- minphys(bp);
-}
-
-/*
- * Start activity on a SCSI device.
- * We maintain information on each device separately since devices can
- * connect/disconnect during an operation.
- */
-int
-asc_scsi_cmd(xs)
- struct scsi_xfer *xs;
-{
- struct scsi_link *sc_link = xs->sc_link;
- struct asc_softc *asc = sc_link->adapter_softc;
-
- int flags, s;
-
- flags = xs->flags;
-
- /*
- * Flush caches for any data buffer
- */
- if(xs->datalen != 0) {
- R4K_HitFlushDCache((vm_offset_t)xs->data, xs->datalen);
- }
- /*
- * The hack on the next few lines are to avoid buffers
- * mapped to UADDR. Realloc to the kva uarea address.
- */
- if((u_int)(xs->data) >= UADDR) {
- xs->data = ((u_int)(xs->data) & ~UADDR) + (u_char *)(curproc->p_addr);
- }
-
- /*
- * Check if another command is already in progress.
- * We may have to change this if we allow SCSI devices with
- * separate LUNs.
- */
- s = splbio();
- if (asc->cmd[sc_link->target]) {
- if (asc->cmdq[sc_link->target]) {
- splx(s);
- printf("asc_scsi_cmd: called when target busy");
- xs->error = XS_DRIVER_STUFFUP;
- return TRY_AGAIN_LATER;
- }
- asc->cmdq[sc_link->target] = xs;
- splx(s);
- return SUCCESSFULLY_QUEUED;
- }
- asc->cmd[sc_link->target] = xs;
-
- /*
- * Going to launch.
- * Make a local copy of the command and some pointers.
- */
- asc_startcmd(asc, sc_link->target);
-
- /*
- * If in startup, interrupts not usable yet.
- */
- if(flags & SCSI_POLL) {
- return(asc_poll(asc,sc_link->target));
- }
- splx(s);
- return SUCCESSFULLY_QUEUED;
-}
-
-int
-asc_poll(asc, target)
- struct asc_softc *asc;
- int target;
-{
- struct scsi_xfer *scsicmd = asc->cmd[target];
- int count = scsicmd->timeout * 10;
-
- while(count) {
- if(asc->regs->asc_status &ASC_CSR_INT) {
- asc_intr(asc);
- }
- if(scsicmd->flags & ITSDONE)
- break;
- DELAY(5);
- count--;
- }
- if(count == 0) {
- scsicmd->error = XS_TIMEOUT;
- asc_end(asc, 0, 0, 0);
- }
- return COMPLETE;
-}
-
-static void
-asc_reset(asc, regs)
- asc_softc_t asc;
- asc_regmap_t *regs;
-{
-
- /*
- * Reset chip and wait till done
- */
- regs->asc_cmd = ASC_CMD_RESET;
- wbflush(); DELAY(25);
-
- /* spec says this is needed after reset */
- regs->asc_cmd = ASC_CMD_NOP;
- wbflush(); DELAY(25);
-
- /*
- * Set up various chip parameters
- */
- regs->asc_ccf = asc->ccf;
- wbflush(); DELAY(25);
- regs->asc_sel_timo = asc->timeout_250;
- /* restore our ID */
- regs->asc_cnfg1 = asc->sc_id | ASC_CNFG1_P_CHECK;
- /* include ASC_CNFG2_SCSI2 if you want to allow SCSI II commands */
- regs->asc_cnfg2 = /* ASC_CNFG2_RFB | ASC_CNFG2_SCSI2 | */ ASC_CNFG2_EPL;
- regs->asc_cnfg3 = 0;
- /* zero anything else */
- ASC_TC_PUT(regs, 0);
- regs->asc_syn_p = asc->min_period;
- regs->asc_syn_o = 0; /* async for now */
- wbflush();
-}
-
-/*
- * Start a SCSI command on a target.
- */
-static void
-asc_startcmd(asc, target)
- asc_softc_t asc;
- int target;
-{
- asc_regmap_t *regs;
- State *state;
- struct scsi_xfer *scsicmd;
- int i, len;
-
- /*
- * See if another target is currently selected on this SCSI bus.
- */
- if (asc->target >= 0)
- return;
-
- regs = asc->regs;
-
- /*
- * If a reselection is in progress, it is Ok to ignore it since
- * the ASC will automatically cancel the command and flush
- * the FIFO if the ASC is reselected before the command starts.
- * If we try to use ASC_CMD_DISABLE_SEL, we can hang the system if
- * a reselect occurs before starting the command.
- */
-
- asc->state = ASC_STATE_BUSY;
- asc->target = target;
-
- /* cache some pointers */
- scsicmd = asc->cmd[target];
- state = &asc->st[target];
-
- /*
- * Init the chip and target state.
- */
- state->flags = state->flags & (DID_SYNC | CHECK_SENSE);
- state->script = (script_t *)0;
- state->msg_out = SCSI_NO_OP;
-
- /*
- * Set up for DMA of command output. Also need to flush cache.
- */
- if(!(state->flags & CHECK_SENSE)) {
- bcopy(scsicmd->cmd, &state->cmd, scsicmd->cmdlen);
- state->cmdlen = scsicmd->cmdlen;
- state->buf = (vm_offset_t)scsicmd->data;
- state->buflen = scsicmd->datalen;
- }
- len = state->cmdlen;
- state->dmalen = len;
-
-#ifdef DEBUG
- if (asc_debug > 1) {
- printf("asc_startcmd: %s target %d cmd %x len %d\n",
- asc->sc_dev.dv_xname, target,
- state->cmd.opcode, state->buflen);
- }
-#endif
-
- /* check for simple SCSI command with no data transfer */
- if(state->flags & CHECK_SENSE) {
- asc->script = &asc_scripts[SCRIPT_DATA_IN];
- state->flags |= DMA_IN;
- }
- else if (scsicmd->flags & SCSI_DATA_OUT) {
- asc->script = &asc_scripts[SCRIPT_DATA_OUT];
- state->flags |= DMA_OUT;
- }
- else if (scsicmd->flags & SCSI_DATA_IN) {
- asc->script = &asc_scripts[SCRIPT_DATA_IN];
- state->flags |= DMA_IN;
- }
- else if (state->buflen == 0) {
- /* check for sync negotiation */
- if ((scsicmd->flags & /* SCSICMD_USE_SYNC */ 0) &&
- !(state->flags & DID_SYNC)) {
- asc->script = &asc_scripts[SCRIPT_TRY_SYNC];
- state->flags |= TRY_SYNC;
- } else
- asc->script = &asc_scripts[SCRIPT_SIMPLE];
- state->buf = (vm_offset_t)0;
- }
-
-#ifdef DEBUG
- asc_debug_cmd = state->cmd.opcode;
- if (state->cmd.opcode == SCSI_READ_EXT) {
- asc_debug_bn = (state->cmd.bytes[1] << 24) |
- (state->cmd.bytes[2] << 16) |
- (state->cmd.bytes[3] << 8) |
- state->cmd.bytes[4];
- asc_debug_sz = (state->cmd.bytes[6] << 8) | state->cmd.bytes[7];
- }
- asc_logp->status = PACK(asc->sc_dev.dv_unit, 0, 0, asc_debug_cmd);
- asc_logp->target = asc->target;
- asc_logp->state = asc->script - asc_scripts;
- asc_logp->msg = SCSI_DIS_REC_IDENTIFY;
- asc_logp->resid = scsicmd->datalen;
- if (++asc_logp >= &asc_log[NLOG])
- asc_logp = asc_log;
-#endif
-
- /* preload the FIFO with the message and command to be sent */
- regs->asc_fifo = SCSI_DIS_REC_IDENTIFY | (scsicmd->sc_link->lun & 0x07);
-
- for( i = 0; i < len; i++ ) {
- regs->asc_fifo = ((caddr_t)&state->cmd)[i];
- }
- ASC_TC_PUT(regs, 0);
- readback(regs->asc_cmd);
- regs->asc_cmd = ASC_CMD_DMA;
- readback(regs->asc_cmd);
-
- regs->asc_dbus_id = target;
- readback(regs->asc_dbus_id);
- regs->asc_syn_p = state->sync_period;
- readback(regs->asc_syn_p);
- regs->asc_syn_o = state->sync_offset;
- readback(regs->asc_syn_o);
-
-/*XXX PEFO */
-/* we are not using sync transfer now, need to check this if we will */
-
- if (state->flags & TRY_SYNC)
- regs->asc_cmd = ASC_CMD_SEL_ATN_STOP;
- else
- regs->asc_cmd = ASC_CMD_SEL_ATN;
- readback(regs->asc_cmd);
-}
-
-/*
- * Interrupt routine
- * Take interrupts from the chip
- *
- * Implementation:
- * Move along the current command's script if
- * all is well, invoke error handler if not.
- */
-int
-asc_intr(sc)
- void *sc;
-{
- asc_softc_t asc = sc;
- asc_regmap_t *regs = asc->regs;
- State *state;
- script_t *scpt;
- int ss, ir, status;
-
- /* collect ephemeral information */
- status = regs->asc_status;
- ss = regs->asc_ss;
-
- if ((status & ASC_CSR_INT) == 0) /* Make shure it's a real interrupt */
- return(0);
-
- ir = regs->asc_intr; /* this resets the previous two */
- scpt = asc->script;
-
-#ifdef DEBUG
- asc_logp->status = PACK(asc->sc_dev.dv_unit, status, ss, ir);
- asc_logp->target = (asc->state == ASC_STATE_BUSY) ? asc->target : -1;
- asc_logp->state = scpt - asc_scripts;
- asc_logp->msg = -1;
- asc_logp->resid = 0;
- if (++asc_logp >= &asc_log[NLOG])
- asc_logp = asc_log;
- if (asc_debug > 2)
- printf("asc_intr: status %x ss %x ir %x cond %d:%x\n",
- status, ss, ir, scpt - asc_scripts, scpt->condition);
-#endif
-
- /* check the expected state */
- if (SCRIPT_MATCH(ir, status) == scpt->condition) {
- /*
- * Perform the appropriate operation, then proceed.
- */
- if ((*scpt->action)(asc, status, ss, ir)) {
- regs->asc_cmd = scpt->command;
- readback(regs->asc_cmd);
- asc->script = scpt->next;
- }
- goto done;
- }
-
- /*
- * Check for parity error.
- * Hardware will automatically set ATN
- * to request the device for a MSG_OUT phase.
- */
- if (status & ASC_CSR_PE) {
- printf("%s: SCSI device %d: incomming parity error seen\n",
- asc->sc_dev.dv_xname, asc->target);
- asc->st[asc->target].flags |= PARITY_ERR;
- }
-
- /*
- * Check for gross error.
- * Probably a bug in a device driver.
- */
- if (status & ASC_CSR_GE) {
- printf("%s: SCSI device %d: gross error\n",
- asc->sc_dev.dv_xname, asc->target);
- goto abort;
- }
-
- /* check for message in or out */
- if ((ir & ~ASC_INT_FC) == ASC_INT_BS) {
- register int len, fifo;
-
- state = &asc->st[asc->target];
- switch (ASC_PHASE(status)) {
- case ASC_PHASE_DATAI:
- case ASC_PHASE_DATAO:
- ASC_TC_GET(regs, len);
- fifo = regs->asc_flags & ASC_FLAGS_FIFO_CNT;
- printf("asc_intr: data overrun: buflen %d dmalen %d tc %d fifo %d\n",
- state->buflen, state->dmalen, len, fifo);
- goto abort;
-
- case ASC_PHASE_MSG_IN:
- break;
-
- case ASC_PHASE_MSG_OUT:
- /*
- * Check for parity error.
- * Hardware will automatically set ATN
- * to request the device for a MSG_OUT phase.
- */
- if (state->flags & PARITY_ERR) {
- state->flags &= ~PARITY_ERR;
- state->msg_out = SCSI_MESSAGE_PARITY_ERROR;
- /* reset message in counter */
- state->msglen = 0;
- } else
- state->msg_out = SCSI_NO_OP;
- regs->asc_fifo = state->msg_out;
- regs->asc_cmd = ASC_CMD_XFER_INFO;
- readback(regs->asc_cmd);
- goto done;
-
- case ASC_PHASE_STATUS:
- /* probably an error in the SCSI command */
- asc->script = &asc_scripts[SCRIPT_GET_STATUS];
- regs->asc_cmd = ASC_CMD_I_COMPLETE;
- readback(regs->asc_cmd);
- goto done;
-
- default:
- goto abort;
- }
-
- if (state->script)
- goto abort;
-
- /*
- * OK, message coming in clean up whatever is going on.
- * Get number of bytes left to transferred from byte counter
- * counter decrements when data is trf on the SCSI bus
- */
- ASC_TC_GET(regs, len);
- fifo = regs->asc_flags & ASC_FLAGS_FIFO_CNT;
- /* flush any data in the FIFO */
- if (fifo && !(state->flags & DMA_IN_PROGRESS)) {
-printf("asc_intr: fifo flush %d len %d fifo %x\n", fifo, len, regs->asc_fifo);
- regs->asc_cmd = ASC_CMD_FLUSH;
- readback(regs->asc_cmd);
- DELAY(2);
- }
- else if (fifo && state->flags & DMA_IN_PROGRESS) {
- if (state->flags & DMA_OUT) {
- len += fifo; /* Bytes dma'ed but not sent */
- }
- else if (state->flags & DMA_IN) {
- printf("asc_intr: IN: dmalen %d len %d fifo %d\n",
- state->dmalen, len, fifo); /* XXX */
- }
- regs->asc_cmd = ASC_CMD_FLUSH;
- readback(regs->asc_cmd);
- DELAY(2);
- }
- if (len && (state->flags & DMA_IN_PROGRESS)) {
- /* save number of bytes still to be sent or received */
- state->dmaresid = len;
- state->flags &= ~DMA_IN_PROGRESS;
- ASC_TC_PUT(regs, 0);
-#ifdef DEBUG
- if (asc_logp == asc_log)
- asc_log[NLOG - 1].resid = len;
- else
- asc_logp[-1].resid = len;
-#endif
- /* setup state to resume to */
- if (state->flags & DMA_IN) {
- /*
- * Since the ASC_CNFG3_SRB bit of the
- * cnfg3 register bit is not set,
- * we just transferred an extra byte.
- * Since we can't resume on an odd byte
- * boundary, we copy the valid data out
- * and resume DMA at the start address.
- */
- if (len & 1) {
- printf("asc_intr: msg in len %d (fifo %d)\n",
- len, fifo); /* XXX */
- len = state->dmalen - len;
- goto do_in;
- }
- state->script =
- &asc_scripts[SCRIPT_RESUME_DMA_IN];
- } else if (state->flags & DMA_OUT)
- state->script =
- &asc_scripts[SCRIPT_RESUME_DMA_OUT];
- else
- state->script = asc->script;
- } else if (state->flags & DMA_IN) {
- if (len) {
-#ifdef DEBUG
- printf("asc_intr: 1: bn %d len %d (fifo %d)\n",
- asc_debug_bn, len, fifo); /* XXX */
-#endif
- goto abort;
- }
- /* setup state to resume to */
- if (state->flags & DMA_IN_PROGRESS) {
- len = state->dmalen;
- state->flags &= ~DMA_IN_PROGRESS;
- do_in:
- DMA_END(asc->dma);
- state->buf += len;
- state->buflen -= len;
- }
- if (state->buflen)
- state->script =
- &asc_scripts[SCRIPT_RESUME_IN];
- else
- state->script =
- &asc_scripts[SCRIPT_RESUME_NO_DATA];
- } else if (state->flags & DMA_OUT) {
- if (len) {
- printf("asc_intr: 2: len %d (fifo %d)\n", len,
- fifo); /* XXX */
-/* XXX THEO */
-#if 1
- regs->asc_cmd = ASC_CMD_FLUSH;
- readback(regs->asc_cmd);
- DELAY(2);
- len = 0;
-#else
- goto abort;
-#endif
- }
- /*
- * If this is the last chunk, the next expected
- * state is to get status.
- */
- if (state->flags & DMA_IN_PROGRESS) {
- state->flags &= ~DMA_IN_PROGRESS;
- DMA_END(asc->dma);
- len = state->dmalen;
- state->buf += len;
- state->buflen -= len;
- }
- if (state->buflen)
- state->script =
- &asc_scripts[SCRIPT_RESUME_OUT];
- else
- state->script =
- &asc_scripts[SCRIPT_RESUME_NO_DATA];
- } else if (asc->script == &asc_scripts[SCRIPT_SIMPLE])
- state->script = &asc_scripts[SCRIPT_RESUME_NO_DATA];
- else
- state->script = asc->script;
-
- /* setup to receive a message */
- asc->script = &asc_scripts[SCRIPT_MSG_IN];
- state->msglen = 0;
- regs->asc_cmd = ASC_CMD_XFER_INFO;
- readback(regs->asc_cmd);
- goto done;
- }
-
- /* check for SCSI bus reset */
- if (ir & ASC_INT_RESET) {
- register int i;
-
- printf("%s: SCSI bus reset!!\n", asc->sc_dev.dv_xname);
- /* need to flush any pending commands */
- for (i = 0; i < ASC_NCMD; i++) {
- if (!asc->cmd[i])
- continue;
- asc->cmd[i]->error = XS_DRIVER_STUFFUP;
- asc_end(asc, 0, 0, 0);
- }
- /* rearbitrate synchronous offset */
- for (i = 0; i < ASC_NCMD; i++) {
- asc->st[i].sync_offset = 0;
- asc->st[i].flags = 0;
- }
- asc->target = -1;
- return(1);
- }
-
- /* check for command errors */
- if (ir & ASC_INT_ILL)
- goto abort;
-
- /* check for disconnect */
- if (ir & ASC_INT_DISC) {
- state = &asc->st[asc->target];
- switch (asc->script - asc_scripts) {
- case SCRIPT_DONE:
- case SCRIPT_DISCONNECT:
- /*
- * Disconnects can happen normally when the
- * command is complete with the phase being
- * either ASC_PHASE_DATAO or ASC_PHASE_MSG_IN.
- * The SCRIPT_MATCH() only checks for one phase
- * so we can wind up here.
- * Perform the appropriate operation, then proceed.
- */
- if ((*scpt->action)(asc, status, ss, ir)) {
- regs->asc_cmd = scpt->command;
- readback(regs->asc_cmd);
- asc->script = scpt->next;
- }
- goto done;
-
- case SCRIPT_TRY_SYNC:
- case SCRIPT_SIMPLE:
- case SCRIPT_DATA_IN:
- case SCRIPT_DATA_OUT: /* one of the starting scripts */
- if (ASC_SS(ss) == 0) {
- /* device did not respond */
- if (regs->asc_flags & ASC_FLAGS_FIFO_CNT) {
- regs->asc_cmd = ASC_CMD_FLUSH;
- readback(regs->asc_cmd);
- }
- asc->cmd[asc->target]->error = XS_DRIVER_STUFFUP;
- asc_end(asc, status, ss, ir);
- return(1);
- }
- /* FALLTHROUGH */
-
- default:
- printf("%s: SCSI device %d: unexpected disconnect\n",
- asc->sc_dev.dv_xname, asc->target);
-#ifdef DEBUG
- asc_DumpLog("asc_disc");
-#endif
- /*
- * On rare occasions my RZ24 does a disconnect during
- * data in phase and the following seems to keep it
- * happy.
- * XXX Should a scsi disk ever do this??
- */
- asc->script = &asc_scripts[SCRIPT_RESEL];
- asc->state = ASC_STATE_RESEL;
- state->flags |= DISCONN;
- regs->asc_cmd = ASC_CMD_ENABLE_SEL;
- readback(regs->asc_cmd);
- return(1);
- }
- }
-
- /* check for reselect */
- if (ir & ASC_INT_RESEL) {
- unsigned fifo, id, msg;
-
- fifo = regs->asc_flags & ASC_FLAGS_FIFO_CNT;
- if (fifo < 2)
- goto abort;
- /* read unencoded SCSI ID and convert to binary */
- msg = regs->asc_fifo & asc->myidmask;
- for (id = 0; (msg & 1) == 0; id++)
- msg >>= 1;
- /* read identify message */
- msg = regs->asc_fifo;
-#ifdef DEBUG
- if (asc_logp == asc_log)
- asc_log[NLOG - 1].msg = msg;
- else
- asc_logp[-1].msg = msg;
-#endif
- asc->state = ASC_STATE_BUSY;
- asc->target = id;
- state = &asc->st[id];
- asc->script = state->script;
- state->script = (script_t *)0;
- if (!(state->flags & DISCONN))
- goto abort;
- state->flags &= ~DISCONN;
- regs->asc_syn_p = state->sync_period;
- regs->asc_syn_o = state->sync_offset;
- regs->asc_cmd = ASC_CMD_MSG_ACPT;
- readback(regs->asc_cmd);
- goto done;
- }
-
- /* check if we are being selected as a target */
- if (ir & (ASC_INT_SEL | ASC_INT_SEL_ATN))
- goto abort;
-
- /*
- * 'ir' must be just ASC_INT_FC.
- * This is normal if canceling an ASC_ENABLE_SEL.
- */
-
-done:
- wbflush();
- /*
- * If the next interrupt comes in immediatly the interrupt
- * dispatcher (which we are returning to) will catch it
- * before returning to the interrupted code.
- */
- return(1);
-
-abort:
-#ifdef DEBUG
- asc_DumpLog("asc_intr");
-#endif
- panic("asc_intr");
- return(1);
-}
-
-/*
- * All the many little things that the interrupt
- * routine might switch to.
- */
-
-/* ARGSUSED */
-static int
-script_nop(asc, status, ss, ir)
- asc_softc_t asc;
- int status, ss, ir;
-{
- return (1);
-}
-
-/* ARGSUSED */
-static int
-asc_get_status(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register int data;
-
- /*
- * Get the last two bytes in the FIFO.
- */
- if ((data = regs->asc_flags & ASC_FLAGS_FIFO_CNT) != 2) {
- printf("asc_get_status: cmdreg %x, fifo cnt %d\n",
- regs->asc_cmd, data); /* XXX */
-#ifdef DEBUG
- asc_DumpLog("get_status"); /* XXX */
-#endif
- if (data < 2) {
- asc->regs->asc_cmd = ASC_CMD_MSG_ACPT;
- readback(asc->regs->asc_cmd);
- return (0);
- }
- do {
- data = regs->asc_fifo;
- } while ((regs->asc_flags & ASC_FLAGS_FIFO_CNT) > 2);
- }
-
- /* save the status byte */
- asc->st[asc->target].statusByte = data = regs->asc_fifo;
-#ifdef DEBUG
- if (asc_logp == asc_log)
- asc_log[NLOG - 1].msg = data;
- else
- asc_logp[-1].msg = data;
-#endif
-
- /* get the (presumed) command_complete message */
- if ((data = regs->asc_fifo) == SCSI_COMMAND_COMPLETE)
- return (1);
-
-#ifdef DEBUG
- printf("asc_get_status: status %x cmd %x\n",
- asc->st[asc->target].statusByte, data);
- asc_DumpLog("asc_get_status");
-#endif
- return (0);
-}
-
-/* ARGSUSED */
-static int
-asc_end(asc, status, ss, ir)
- asc_softc_t asc;
- int status, ss, ir;
-{
- struct scsi_xfer *scsicmd;
- struct scsi_link *sc_link;
- State *state;
- int i, target;
-
- asc->state = ASC_STATE_IDLE;
- target = asc->target;
- asc->target = -1;
- scsicmd = asc->cmd[target];
- sc_link = scsicmd->sc_link;
- asc->cmd[target] = (struct scsi_xfer *)0;
- state = &asc->st[target];
-
-#ifdef DEBUG
- if (asc_debug > 1) {
- printf("asc_end: %s target %d cmd %x err %d resid %d\n",
- asc->sc_dev.dv_xname, target,
- state->cmd.opcode, scsicmd->error, state->buflen);
- }
-#endif
-#ifdef DIAGNOSTIC
- if (target < 0 || !scsicmd)
- panic("asc_end");
-#endif
-
- /* look for disconnected devices */
- for (i = 0; i < ASC_NCMD; i++) {
- if (!asc->cmd[i] || !(asc->st[i].flags & DISCONN))
- continue;
- asc->regs->asc_cmd = ASC_CMD_ENABLE_SEL;
- readback(asc->regs->asc_cmd);
- asc->state = ASC_STATE_RESEL;
- asc->script = &asc_scripts[SCRIPT_RESEL];
- break;
- }
-
- if(scsicmd->error == XS_NOERROR && !(state->flags & CHECK_SENSE)) {
- if((state->statusByte & ST_MASK) == SCSI_CHECK) {
- struct scsi_sense *ss = (void *)&state->cmd;
- /* Save return values */
- scsicmd->resid = state->buflen;
- scsicmd->status = state->statusByte;
- /* Set up sense request command */
- bzero(ss, sizeof(*ss));
- ss->opcode = REQUEST_SENSE;
- ss->byte2 = sc_link->lun << 5;
- ss->length = sizeof(struct scsi_sense_data);
- state->cmdlen = sizeof(*ss);
- state->buf = (vm_offset_t)&scsicmd->sense;
- state->buflen = sizeof(struct scsi_sense_data);
- state->flags |= CHECK_SENSE;
- R4K_HitFlushDCache(state->buf, state->buflen);
- asc->cmd[target] = scsicmd;
- asc_startcmd(asc, target);
- return(0);
- }
- }
-
- if(scsicmd->error == XS_NOERROR && (state->flags & CHECK_SENSE)) {
- scsicmd->error = XS_SENSE;
- }
- else {
- scsicmd->resid = state->buflen;
- }
- state->flags &= ~CHECK_SENSE;
-
- /*
- * Look for another device that is ready.
- * May want to keep last one started and increment for fairness
- * rather than always starting at zero.
- */
- for (i = 0; i < ASC_NCMD; i++) {
- if (asc->cmd[i] == 0 && asc->cmdq[i] != 0) {
- asc->cmd[i] = asc->cmdq[i];
- asc->cmdq[i] = 0;
- }
- }
- for (i = 0; i < ASC_NCMD; i++) {
- /* don't restart a disconnected command */
- if (!asc->cmd[i] || (asc->st[i].flags & DISCONN))
- continue;
- asc_startcmd(asc, i);
- break;
- }
-
- /* signal device driver that the command is done */
- scsicmd->flags |= ITSDONE;
- scsi_done(scsicmd);
-
- return (0);
-}
-
-/* ARGSUSED */
-static int
-asc_dma_in(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register State *state = &asc->st[asc->target];
- register int len;
-
- /* check for previous chunk in buffer */
- if (state->flags & DMA_IN_PROGRESS) {
- /*
- * Only count bytes that have been copied to memory.
- * There may be some bytes in the FIFO if synchonous transfers
- * are in progress.
- */
- DMA_END(asc->dma);
- ASC_TC_GET(regs, len);
- len = state->dmalen - len;
- state->buf += len;
- state->buflen -= len;
- }
-
- /* setup to start reading the next chunk */
- len = state->buflen;
-#ifdef DEBUG
- if (asc_logp == asc_log)
- asc_log[NLOG - 1].resid = len;
- else
- asc_logp[-1].resid = len;
-#endif
- if (len > state->dmaBufSize)
- len = state->dmaBufSize;
- state->dmalen = len;
- DMA_START(asc->dma, (caddr_t)state->buf, len, DMA_FROM_DEV);
- ASC_TC_PUT(regs, len);
-#ifdef DEBUG
- if (asc_debug > 2)
- printf("asc_dma_in: buflen %d, len %d\n", state->buflen, len);
-#endif
-
- /* check for next chunk */
- state->flags |= DMA_IN_PROGRESS;
- if (len != state->buflen) {
- regs->asc_cmd = ASC_CMD_XFER_INFO | ASC_CMD_DMA;
- readback(regs->asc_cmd);
- asc->script = &asc_scripts[SCRIPT_CONTINUE_IN];
- return (0);
- }
- return (1);
-}
-
-/* ARGSUSED */
-static int
-asc_last_dma_in(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register State *state = &asc->st[asc->target];
- register int len, fifo;
-
- DMA_END(asc->dma);
- ASC_TC_GET(regs, len);
- fifo = regs->asc_flags & ASC_FLAGS_FIFO_CNT;
-#ifdef DEBUG
- if (asc_debug > 2)
- printf("asc_last_dma_in: buflen %d dmalen %d tc %d fifo %d\n",
- state->buflen, state->dmalen, len, fifo);
-#endif
- if (fifo) {
- /* device must be trying to send more than we expect */
- regs->asc_cmd = ASC_CMD_FLUSH;
- readback(regs->asc_cmd);
- }
- state->flags &= ~DMA_IN_PROGRESS;
- len = state->dmalen - len;
- state->buflen -= len;
-
- return (1);
-}
-
-/* ARGSUSED */
-static int
-asc_resume_in(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register State *state = &asc->st[asc->target];
- register int len;
-
- /* setup to start reading the next chunk */
- len = state->buflen;
-#ifdef DEBUG
- if (asc_logp == asc_log)
- asc_log[NLOG - 1].resid = len;
- else
- asc_logp[-1].resid = len;
-#endif
- if (len > state->dmaBufSize)
- len = state->dmaBufSize;
- state->dmalen = len;
-#ifdef DEBUG
- if (asc_logp == asc_log)
- asc_log[NLOG - 1].resid = len;
- else
- asc_logp[-1].resid = len;
-#endif
- DMA_START(asc->dma, (caddr_t)state->buf, len, DMA_FROM_DEV);
- ASC_TC_PUT(regs, len);
-#ifdef DEBUG
- if (asc_debug > 2)
- printf("asc_resume_in: buflen %d, len %d\n", state->buflen,
- len);
-#endif
-
- /* check for next chunk */
- state->flags |= DMA_IN_PROGRESS;
- if (len != state->buflen) {
- regs->asc_cmd = ASC_CMD_XFER_INFO | ASC_CMD_DMA;
- readback(regs->asc_cmd);
- asc->script = &asc_scripts[SCRIPT_CONTINUE_IN];
- return (0);
- }
- return (1);
-}
-
-/* ARGSUSED */
-static int
-asc_resume_dma_in(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register State *state = &asc->st[asc->target];
- register int len, off;
-
- /* setup to finish reading the current chunk */
- len = state->dmaresid;
- off = state->dmalen - len;
- if ((off & 1) && state->sync_offset) {
- printf("asc_resume_dma_in: odd xfer dmalen %d len %d off %d\n",
- state->dmalen, len, off); /* XXX */
- regs->asc_res_fifo = ((u_char *)state->buf)[off];
-/*XXX Need to flush cache ? */
- }
- DMA_START(asc->dma, (caddr_t)state->buf + off, len, DMA_FROM_DEV);
- ASC_TC_PUT(regs, len);
-#ifdef DEBUG
- if (asc_debug > 2)
- printf("asc_resume_dma_in: buflen %d dmalen %d len %d off %d\n",
- state->dmalen, state->buflen, len, off);
-#endif
-
- /* check for next chunk */
- state->flags |= DMA_IN_PROGRESS;
- if (state->dmalen != state->buflen) {
- regs->asc_cmd = ASC_CMD_XFER_INFO | ASC_CMD_DMA;
- readback(regs->asc_cmd);
- asc->script = &asc_scripts[SCRIPT_CONTINUE_IN];
- return (0);
- }
- return (1);
-}
-
-/* ARGSUSED */
-static int
-asc_dma_out(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register State *state = &asc->st[asc->target];
- register int len, fifo;
-
- if (state->flags & DMA_IN_PROGRESS) {
- /* check to be sure previous chunk was finished */
- ASC_TC_GET(regs, len);
- fifo = regs->asc_flags & ASC_FLAGS_FIFO_CNT;
- if (len || fifo)
- printf("asc_dma_out: buflen %d dmalen %d tc %d fifo %d\n",
- state->buflen, state->dmalen, len, fifo); /* XXX */
- len += fifo;
- len = state->dmalen - len;
- state->buf += len;
- state->buflen -= len;
- }
-
- /* setup for this chunk */
- len = state->buflen;
-#ifdef DEBUG
- if (asc_logp == asc_log)
- asc_log[NLOG - 1].resid = len;
- else
- asc_logp[-1].resid = len;
-#endif
- if (len > state->dmaBufSize)
- len = state->dmaBufSize;
- state->dmalen = len;
- DMA_START(asc->dma, (caddr_t)state->buf, len, DMA_TO_DEV);
- ASC_TC_PUT(regs, len);
-#ifdef DEBUG
- if (asc_debug > 2)
- printf("asc_dma_out: buflen %d, len %d\n", state->buflen, len);
-#endif
-
- /* check for next chunk */
- state->flags |= DMA_IN_PROGRESS;
- if (len != state->buflen) {
- regs->asc_cmd = ASC_CMD_XFER_INFO | ASC_CMD_DMA;
- readback(regs->asc_cmd);
- asc->script = &asc_scripts[SCRIPT_CONTINUE_OUT];
- return (0);
- }
- return (1);
-}
-
-/* ARGSUSED */
-static int
-asc_last_dma_out(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register State *state = &asc->st[asc->target];
- register int len, fifo;
-
- ASC_TC_GET(regs, len);
- fifo = regs->asc_flags & ASC_FLAGS_FIFO_CNT;
-#ifdef DEBUG
- if (asc_debug > 2)
- printf("asc_last_dma_out: buflen %d dmalen %d tc %d fifo %d\n",
- state->buflen, state->dmalen, len, fifo);
-#endif
- if (fifo) {
- len += fifo;
- regs->asc_cmd = ASC_CMD_FLUSH;
- readback(regs->asc_cmd);
- }
- state->flags &= ~DMA_IN_PROGRESS;
- len = state->dmalen - len;
- state->buflen -= len;
- return (1);
-}
-
-/* ARGSUSED */
-static int
-asc_resume_out(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register State *state = &asc->st[asc->target];
- register int len;
-
- /* setup for this chunk */
- len = state->buflen;
-#ifdef DEBUG
- if (asc_logp == asc_log)
- asc_log[NLOG - 1].resid = len;
- else
- asc_logp[-1].resid = len;
-#endif
- if (len > state->dmaBufSize)
- len = state->dmaBufSize;
- state->dmalen = len;
-#ifdef DEBUG
- if (asc_logp == asc_log)
- asc_log[NLOG - 1].resid = len;
- else
- asc_logp[-1].resid = len;
-#endif
- DMA_START(asc->dma, (caddr_t)state->buf, len, DMA_TO_DEV);
- ASC_TC_PUT(regs, len);
-#ifdef DEBUG
- if (asc_debug > 2)
- printf("asc_resume_out: buflen %d, len %d\n", state->buflen,
- len);
-#endif
-
- /* check for next chunk */
- state->flags |= DMA_IN_PROGRESS;
- if (len != state->buflen) {
- regs->asc_cmd = ASC_CMD_XFER_INFO | ASC_CMD_DMA;
- readback(regs->asc_cmd);
- asc->script = &asc_scripts[SCRIPT_CONTINUE_OUT];
- return (0);
- }
- return (1);
-}
-
-/* ARGSUSED */
-static int
-asc_resume_dma_out(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register State *state = &asc->st[asc->target];
- register int len, off;
-
- /* setup to finish writing this chunk */
- len = state->dmaresid;
- off = state->dmalen - len;
- if (off & 1) {
- printf("asc_resume_dma_out: odd xfer dmalen %d len %d off %d\n",
- state->dmalen, len, off); /* XXX */
- regs->asc_fifo = ((u_char *)state->buf)[off];
-/*XXX Need to flush Cache ? */
- off++;
- len--;
- }
- DMA_START(asc->dma, (caddr_t)state->buf + off, len, DMA_TO_DEV);
- ASC_TC_PUT(regs, len);
-#ifdef DEBUG
- if (asc_debug > 2)
- printf("asc_resume_dma_out: buflen %d dmalen %d len %d off %d\n",
- state->dmalen, state->buflen, len, off);
-#endif
-
- /* check for next chunk */
- state->flags |= DMA_IN_PROGRESS;
- if (state->dmalen != state->buflen) {
- regs->asc_cmd = ASC_CMD_XFER_INFO | ASC_CMD_DMA;
- readback(regs->asc_cmd);
- asc->script = &asc_scripts[SCRIPT_CONTINUE_OUT];
- return (0);
- }
- return (1);
-}
-
-/* ARGSUSED */
-static int
-asc_sendsync(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register State *state = &asc->st[asc->target];
-
- /* send the extended synchronous negotiation message */
- regs->asc_fifo = SCSI_EXTENDED_MSG;
- wbflush();
- regs->asc_fifo = 3;
- wbflush();
- regs->asc_fifo = SCSI_SYNCHRONOUS_XFER;
- wbflush();
- regs->asc_fifo = SCSI_MIN_PERIOD;
- wbflush();
- regs->asc_fifo = ASC_MAX_OFFSET;
- /* state to resume after we see the sync reply message */
- state->script = asc->script + 2;
- state->msglen = 0;
- return (1);
-}
-
-/* ARGSUSED */
-static int
-asc_replysync(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register State *state = &asc->st[asc->target];
-
-#ifdef DEBUG
- if (asc_debug > 2)
- printf("asc_replysync: %x %x\n",
- asc_to_scsi_period[state->sync_period] * asc->tb_ticks,
- state->sync_offset);
-#endif
- /* send synchronous transfer in response to a request */
- regs->asc_fifo = SCSI_EXTENDED_MSG;
- wbflush();
- regs->asc_fifo = 3;
- wbflush();
- regs->asc_fifo = SCSI_SYNCHRONOUS_XFER;
- wbflush();
- regs->asc_fifo = asc_to_scsi_period[state->sync_period] * asc->tb_ticks;
- wbflush();
- regs->asc_fifo = state->sync_offset;
- regs->asc_cmd = ASC_CMD_XFER_INFO;
- readback(regs->asc_cmd);
-
- /* return to the appropriate script */
- if (!state->script) {
-#ifdef DEBUG
- asc_DumpLog("asc_replsync");
-#endif
- panic("asc_replysync");
- }
- asc->script = state->script;
- state->script = (script_t *)0;
- return (0);
-}
-
-/* ARGSUSED */
-static int
-asc_msg_in(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register State *state = &asc->st[asc->target];
- register int msg;
- int i;
-
- /* read one message byte */
- msg = regs->asc_fifo;
-#ifdef DEBUG
- if (asc_logp == asc_log)
- asc_log[NLOG - 1].msg = msg;
- else
- asc_logp[-1].msg = msg;
-#endif
-
- /* check for multi-byte message */
- if (state->msglen != 0) {
- /* first byte is the message length */
- if (state->msglen < 0) {
- state->msglen = msg;
- return (1);
- }
- if (state->msgcnt >= state->msglen)
- goto abort;
- state->msg_in[state->msgcnt++] = msg;
-
- /* did we just read the last byte of the message? */
- if (state->msgcnt != state->msglen)
- return (1);
-
- /* process an extended message */
-#ifdef DEBUG
- if (asc_debug > 2)
- printf("asc_msg_in: msg %x %x %x\n",
- state->msg_in[0],
- state->msg_in[1],
- state->msg_in[2]);
-#endif
- switch (state->msg_in[0]) {
- case SCSI_SYNCHRONOUS_XFER:
- state->flags |= DID_SYNC;
- state->sync_offset = state->msg_in[2];
-
- /* convert SCSI period to ASC period */
- i = state->msg_in[1] / asc->tb_ticks;
- if (i < asc->min_period)
- i = asc->min_period;
- else if (i >= asc->max_period) {
- /* can't do sync transfer, period too long */
- printf("%s: SCSI device %d: sync xfer period too long (%d)\n",
- asc->sc_dev.dv_xname, asc->target, i);
- i = asc->max_period;
- state->sync_offset = 0;
- }
- if ((i * asc->tb_ticks) != state->msg_in[1])
- i++;
- state->sync_period = i & 0x1F;
-
- /*
- * If this is a request, check minimums and
- * send back an acknowledge.
- */
- if (!(state->flags & TRY_SYNC)) {
- regs->asc_cmd = ASC_CMD_SET_ATN;
- readback(regs->asc_cmd);
-
- if (state->sync_period < asc->min_period)
- state->sync_period =
- asc->min_period;
- if (state->sync_offset > ASC_MAX_OFFSET)
- state->sync_offset =
- ASC_MAX_OFFSET;
- asc->script = &asc_scripts[SCRIPT_REPLY_SYNC];
- regs->asc_syn_p = state->sync_period;
- readback(regs->asc_syn_p);
- regs->asc_syn_o = state->sync_offset;
- readback(regs->asc_syn_o);
- regs->asc_cmd = ASC_CMD_MSG_ACPT;
- readback(regs->asc_cmd);
- return (0);
- }
-
- regs->asc_syn_p = state->sync_period;
- readback(regs->asc_syn_p);
- regs->asc_syn_o = state->sync_offset;
- readback(regs->asc_syn_o);
- goto done;
-
- default:
- printf("%s: SCSI device %d: rejecting extended message 0x%x\n",
- asc->sc_dev.dv_xname, asc->target,
- state->msg_in[0]);
- goto reject;
- }
- }
-
- /* process first byte of a message */
-#ifdef DEBUG
- if (asc_debug > 2)
- printf("asc_msg_in: msg %x\n", msg);
-#endif
- switch (msg) {
-#if 0
- case SCSI_MESSAGE_REJECT:
- printf(" did not like SYNCH xfer "); /* XXX */
- state->flags |= DID_SYNC;
- regs->asc_cmd = ASC_CMD_MSG_ACPT;
- readback(regs->asc_cmd);
- status = asc_wait(regs, ASC_CSR_INT);
- ir = regs->asc_intr;
- /* some just break out here, some dont */
- if (ASC_PHASE(status) == ASC_PHASE_MSG_OUT) {
- regs->asc_fifo = SCSI_ABORT;
- regs->asc_cmd = ASC_CMD_XFER_INFO;
- readback(regs->asc_cmd);
- status = asc_wait(regs, ASC_CSR_INT);
- ir = regs->asc_intr;
- }
- if (ir & ASC_INT_DISC) {
- asc_end(asc, status, 0, ir);
- return (0);
- }
- goto status;
-#endif /* 0 */
-
- case SCSI_EXTENDED_MSG: /* read an extended message */
- /* setup to read message length next */
- state->msglen = -1;
- state->msgcnt = 0;
- return (1);
-
- case SCSI_NO_OP:
- break;
-
- case SCSI_SAVE_DATA_POINTER:
- /* expect another message */
- return (1);
-
- case SCSI_RESTORE_POINTERS:
- /*
- * Need to do the following if resuming synchonous data in
- * on an odd byte boundary.
- regs->asc_cnfg2 |= ASC_CNFG2_RFB;
- */
- break;
-
- case SCSI_DISCONNECT:
- if (state->flags & DISCONN)
- goto abort;
- state->flags |= DISCONN;
- regs->asc_cmd = ASC_CMD_MSG_ACPT;
- readback(regs->asc_cmd);
- asc->script = &asc_scripts[SCRIPT_DISCONNECT];
- return (0);
-
- default:
- printf("%s: SCSI device %d: rejecting message 0x%x\n",
- asc->sc_dev.dv_xname, asc->target, msg);
- reject:
- /* request a message out before acknowledging this message */
- state->msg_out = SCSI_MESSAGE_REJECT;
- regs->asc_cmd = ASC_CMD_SET_ATN;
- readback(regs->asc_cmd);
- }
-
-done:
- /* return to original script */
- regs->asc_cmd = ASC_CMD_MSG_ACPT;
- readback(regs->asc_cmd);
- if (!state->script) {
- abort:
-#ifdef DEBUG
- asc_DumpLog("asc_msg_in");
-#endif
- panic("asc_msg_in");
- }
- asc->script = state->script;
- state->script = (script_t *)0;
- return (0);
-}
-
-/* ARGSUSED */
-static int
-asc_disconnect(asc, status, ss, ir)
- asc_softc_t asc;
- int status, ss, ir;
-{
- State *state = &asc->st[asc->target];
-
-#ifdef DIAGNOSTIC
- if (!(state->flags & DISCONN)) {
- printf("asc_disconnect: device %d: DISCONN not set!\n",
- asc->target);
- }
-#endif /* DIAGNOSTIC */
- asc->target = -1;
- asc->state = ASC_STATE_RESEL;
- return (1);
-}
-
-#ifdef DEBUG
-/*
- * Dump the log buffer.
- */
-static void
-asc_DumpLog(str)
- char *str;
-{
- register struct asc_log *lp;
- register u_int status;
-
- printf("asc: %s: cmd %x bn %d cnt %d\n", str, asc_debug_cmd,
- asc_debug_bn, asc_debug_sz);
- lp = asc_logp;
- do {
- status = lp->status;
- printf("asc%d tgt %d status %x ss %x ir %x cond %d:%x msg %x resid %d\n",
- status >> 24,
- lp->target,
- (status >> 16) & 0xFF,
- (status >> 8) & 0xFF,
- status & 0XFF,
- lp->state,
- asc_scripts[lp->state].condition,
- lp->msg, lp->resid);
- if (++lp >= &asc_log[NLOG])
- lp = asc_log;
- } while (lp != asc_logp);
-}
-#endif /* DEBUG */
-
-#endif /* NASC > 0 */
diff --git a/sys/arch/arc/dev/ascreg.h b/sys/arch/arc/dev/ascreg.h
deleted file mode 100644
index 3ed54ec9828..00000000000
--- a/sys/arch/arc/dev/ascreg.h
+++ /dev/null
@@ -1,322 +0,0 @@
-/* $OpenBSD: ascreg.h,v 1.1.1.1 1996/06/24 09:07:19 pefo Exp $ */
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell and Rick Macklem.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)ascreg.h 8.1 (Berkeley) 6/10/93
- * $Id: ascreg.h,v 1.1.1.1 1996/06/24 09:07:19 pefo Exp $
- */
-
-/*
- * Mach Operating System
- * Copyright (c) 1991,1990,1989 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-/*
- * HISTORY
- * Log: scsi_53C94.h,v
- * Revision 2.4 91/02/05 17:44:59 mrt
- * Added author notices
- * [91/02/04 11:18:32 mrt]
- *
- * Changed to use new Mach copyright
- * [91/02/02 12:17:11 mrt]
- *
- * Revision 2.3 90/12/05 23:34:46 af
- * Documented max DMA xfer size.
- * [90/12/03 23:39:36 af]
- *
- * Revision 2.1.1.1 90/11/01 03:38:54 af
- * Created, from the DEC specs:
- * "PMAZ-AA TURBOchannel SCSI Module Functional Specification"
- * Workstation Systems Engineering, Palo Alto, CA. Aug 27, 1990.
- * And from the NCR data sheets
- * "NCR 53C94, 53C95, 53C96 Advanced SCSI Controller"
- * [90/09/03 af]
- */
-
-/*
- * File: scsi_53C94.h
- * Author: Alessandro Forin, Carnegie Mellon University
- * Date: 9/90
- *
- * Defines for the NCR 53C94 ASC (SCSI interface)
- * Some gotcha came from the "86C01/53C94 DMA lab work" written
- * by Ken Stewart (NCR MED Logic Products Applications Engineer)
- * courtesy of NCR. Thanks Ken !
- */
-
-#define ASC_OFFSET_53C94 0x0 /* from module base */
-
-#define ASC_NCMD 7 /* Number of simultaneous cmds */
-
-/*
- * Synch xfer parameters, and timing conversions
- */
-#define SCSI_MIN_PERIOD 50 /* in 4 nsecs units */
-#define ASC_MIN_PERIOD40 8 /* in CLKS/BYTE, 1 CLK = 25nsecs */
-#define ASC_MIN_PERIOD25 5 /* in CLKS/BYTE, 1 CLK = 40nsecs */
-#define ASC_MIN_PERIOD12 3 /* in CLKS/BYTE, 1 CLK = 80nsecs */
-#define ASC_MAX_PERIOD40 56 /* in CLKS/BYTE, 1 CLK = 25nsecs */
-#define ASC_MAX_PERIOD25 35 /* in CLKS/BYTE, 1 CLK = 40nsecs */
-#define ASC_MAX_PERIOD12 18 /* in CLKS/BYTE, 1 CLK = 80nsecs */
-#define ASC_MAX_OFFSET 15 /* pure number */
-/*
- * Register map, padded as needed
- */
-
-typedef volatile struct {
- u_char asc_tc_lsb; /* rw: Transfer Counter LSB */
- u_char asc_tc_msb; /* rw: Transfer Counter MSB */
- u_char asc_fifo; /* rw: FIFO top */
- u_char asc_cmd; /* rw: Command */
- u_char asc_status; /* r: Status */
-#define asc_dbus_id asc_status /* w: Destination Bus ID */
- u_char asc_intr; /* r: Interrupt */
-#define asc_sel_timo asc_intr /* w: (re)select timeout */
- u_char asc_ss; /* r: Sequence Step */
-#define asc_syn_p asc_ss /* w: synchronous period */
- u_char asc_flags; /* r: FIFO flags + seq step */
-#define asc_syn_o asc_flags /* w: synchronous offset */
- u_char asc_cnfg1; /* rw: Configuration 1 */
- u_char asc_ccf; /* w: Clock Conv. Factor */
- u_char asc_test; /* w: Test Mode */
- u_char asc_cnfg2; /* rw: Configuration 2 */
- u_char asc_cnfg3; /* rw: Configuration 3 */
- u_char asc_res_fifo; /* w: Reserve FIFO byte */
-} asc_regmap_t;
-
-/*
- * Transfer Count: access macros
- * That a NOP is required after loading the dma counter
- * I learned on the NCR test code. Sic.
- */
-
-#define ASC_TC_MAX 0x10000
-
-#define ASC_TC_GET(ptr, val) \
- val = (ptr)->asc_tc_lsb | ((ptr)->asc_tc_msb << 8)
-#define ASC_TC_PUT(ptr, val) \
- (ptr)->asc_tc_lsb = (val); \
- (ptr)->asc_tc_msb = (val) >> 8; \
- (ptr)->asc_cmd = ASC_CMD_NOP | ASC_CMD_DMA;
-
-/*
- * Command register (command codes)
- */
-
-#define ASC_CMD_DMA 0x80
- /* Miscellaneous */
-#define ASC_CMD_NOP 0x00
-#define ASC_CMD_FLUSH 0x01
-#define ASC_CMD_RESET 0x02
-#define ASC_CMD_BUS_RESET 0x03
- /* Initiator state */
-#define ASC_CMD_XFER_INFO 0x10
-#define ASC_CMD_I_COMPLETE 0x11
-#define ASC_CMD_MSG_ACPT 0x12
-#define ASC_CMD_XFER_PAD 0x18
-#define ASC_CMD_SET_ATN 0x1a
-#define ASC_CMD_CLR_ATN 0x1b
- /* Target state */
-#define ASC_CMD_SND_MSG 0x20
-#define ASC_CMD_SND_STATUS 0x21
-#define ASC_CMD_SND_DATA 0x22
-#define ASC_CMD_DISC_SEQ 0x23
-#define ASC_CMD_TERM 0x24
-#define ASC_CMD_T_COMPLETE 0x25
-#define ASC_CMD_DISC 0x27
-#define ASC_CMD_RCV_MSG 0x28
-#define ASC_CMD_RCV_CDB 0x29
-#define ASC_CMD_RCV_DATA 0x2a
-#define ASC_CMD_RCV_CMD 0x2b
-#define ASC_CMD_ABRT_DMA 0x04
- /* Disconnected state */
-#define ASC_CMD_RESELECT 0x40
-#define ASC_CMD_SEL 0x41
-#define ASC_CMD_SEL_ATN 0x42
-#define ASC_CMD_SEL_ATN_STOP 0x43
-#define ASC_CMD_ENABLE_SEL 0x44
-#define ASC_CMD_DISABLE_SEL 0x45
-#define ASC_CMD_SEL_ATN3 0x46
-
-/*
- * Status register, and phase encoding
- */
-
-#define ASC_CSR_INT 0x80
-#define ASC_CSR_GE 0x40
-#define ASC_CSR_PE 0x20
-#define ASC_CSR_TC 0x10
-#define ASC_CSR_VGC 0x08
-#define ASC_CSR_MSG 0x04
-#define ASC_CSR_CD 0x02
-#define ASC_CSR_IO 0x01
-
-#define ASC_PHASE(csr) ((csr) & 0x7)
-#define ASC_PHASE_DATAO 0x0
-#define ASC_PHASE_DATAI 0x1
-#define ASC_PHASE_COMMAND 0x2
-#define ASC_PHASE_STATUS 0x3
- /* 4..5 ANSI reserved */
-#define ASC_PHASE_MSG_OUT 0x6
-#define ASC_PHASE_MSG_IN 0x7
-
-/*
- * Destination Bus ID
- */
-
-#define ASC_DEST_ID_MASK 0x07
-
-/*
- * Interrupt register
- */
-
-#define ASC_INT_RESET 0x80
-#define ASC_INT_ILL 0x40
-#define ASC_INT_DISC 0x20
-#define ASC_INT_BS 0x10
-#define ASC_INT_FC 0x08
-#define ASC_INT_RESEL 0x04
-#define ASC_INT_SEL_ATN 0x02
-#define ASC_INT_SEL 0x01
-
-/*
- * Timeout register:
- *
- * val = (timeout * CLK_freq) / (8192 * CCF);
- */
-
-#define ASC_TIMEOUT_250(clk, ccf) (((clk) * 31) / (ccf))
-
-/*
- * Sequence Step register
- */
-
-#define ASC_SS_RESERVED 0xf0
-#define ASC_SS_SOM 0x08
-#define ASC_SS_MASK 0x07
-#define ASC_SS(ss) ((ss) & ASC_SS_MASK)
-
-/*
- * Synchronous Transfer Period
- */
-
-#define ASC_STP_MASK 0x1f
-#define ASC_STP_MIN 0x05 /* 5 clk per byte */
-#define ASC_STP_MAX 0x04 /* after ovfl, 35 clk/byte */
-
-/*
- * FIFO flags
- */
-
-#define ASC_FLAGS_SEQ_STEP 0xe0
-#define ASC_FLAGS_FIFO_CNT 0x1f
-
-/*
- * Synchronous offset
- */
-
-#define ASC_SYNO_MASK 0x0f /* 0 -> asyn */
-
-/*
- * Configuration 1
- */
-
-#define ASC_CNFG1_SLOW 0x80
-#define ASC_CNFG1_SRD 0x40
-#define ASC_CNFG1_P_TEST 0x20
-#define ASC_CNFG1_P_CHECK 0x10
-#define ASC_CNFG1_TEST 0x08
-#define ASC_CNFG1_MY_BUS_ID 0x07
-
-/*
- * CCF register
- */
-
-#define ASC_CCF(clk) ((((clk) - 1) / 5) + 1)
-
-/*
- * Test register
- */
-
-#define ASC_TEST_XXXX 0xf8
-#define ASC_TEST_HI_Z 0x04
-#define ASC_TEST_I 0x02
-#define ASC_TEST_T 0x01
-
-/*
- * Configuration 2
- */
-
-#define ASC_CNFG2_RFB 0x80
-#define ASC_CNFG2_EPL 0x40
-#define ASC_CNFG2_EBC 0x20
-#define ASC_CNFG2_DREQ_HIZ 0x10
-#define ASC_CNFG2_SCSI2 0x08
-#define ASC_CNFG2_BPA 0x04
-#define ASC_CNFG2_RPE 0x02
-#define ASC_CNFG2_DPE 0x01
-
-/*
- * Configuration 3
- */
-
-#define ASC_CNFG3_RESERVED 0xf8
-#define ASC_CNFG3_SRB 0x04
-#define ASC_CNFG3_ALT_DMA 0x02
-#define ASC_CNFG3_T8 0x01
-
-#define ST_MASK 0x3e
diff --git a/sys/arch/arc/dev/com_lbus.c b/sys/arch/arc/dev/com_lbus.c
deleted file mode 100644
index c88bce3df0c..00000000000
--- a/sys/arch/arc/dev/com_lbus.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/* $OpenBSD: com_lbus.c,v 1.7 1998/03/16 09:38:41 pefo Exp $ */
-
-/*
- * Copyright (c) 1993, 1994 Charles Hannum.
- * Copyright (c) 1990 William F. Jolitz, TeleMuse
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This software is a component of "386BSD" developed by
- * William F. Jolitz, TeleMuse.
- * 4. Neither the name of the developer nor the name "386BSD"
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS A COMPONENT OF 386BSD DEVELOPED BY WILLIAM F. JOLITZ
- * AND IS INTENDED FOR RESEARCH AND EDUCATIONAL PURPOSES ONLY. THIS
- * SOFTWARE SHOULD NOT BE CONSIDERED TO BE A COMMERCIAL PRODUCT.
- * THE DEVELOPER URGES THAT USERS WHO REQUIRE A COMMERCIAL PRODUCT
- * NOT MAKE USE OF THIS WORK.
- *
- * FOR USERS WHO WISH TO UNDERSTAND THE 386BSD SYSTEM DEVELOPED
- * BY WILLIAM F. JOLITZ, WE RECOMMEND THE USER STUDY WRITTEN
- * REFERENCES SUCH AS THE "PORTING UNIX TO THE 386" SERIES
- * (BEGINNING JANUARY 1991 "DR. DOBBS JOURNAL", USA AND BEGINNING
- * JUNE 1991 "UNIX MAGAZIN", GERMANY) BY WILLIAM F. JOLITZ AND
- * LYNNE GREER JOLITZ, AS WELL AS OTHER BOOKS ON UNIX AND THE
- * ON-LINE 386BSD USER MANUAL BEFORE USE. A BOOK DISCUSSING THE INTERNALS
- * OF 386BSD ENTITLED "386BSD FROM THE INSIDE OUT" WILL BE AVAILABLE LATE 1992.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE DEVELOPER BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Device Driver for Serial ports
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/tty.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/intr.h>
-
-#include <dev/isa/isavar.h> /* XXX for isa_chipset_tag_t in com_softc */
-
-#include <dev/ic/comreg.h>
-#include <dev/ic/comvar.h>
-#include <dev/ic/ns16550reg.h>
-
-/* Macros to clear/set/test flags. */
-#define SET(t, f) (t) |= (f)
-#define CLR(t, f) (t) &= ~(f)
-#define ISSET(t, f) ((t) & (f))
-
-int com_localbus_probe __P((struct device *, void *, void *));
-void com_localbus_attach __P((struct device *, struct device *, void *));
-
-
-struct cfattach com_pica_ca = {
- sizeof(struct com_softc), com_localbus_probe, com_localbus_attach
-};
-
-struct cfattach com_algor_ca = {
- sizeof(struct com_softc), com_localbus_probe, com_localbus_attach
-};
-
-int
-com_localbus_probe(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- int iobase;
- int rv = 1;
- struct confargs *ca = aux;
-
- if(!BUS_MATCHNAME(ca, "com"))
- return(0);
- ioh = iobase = (long)BUS_CVTADDR(ca);
- iot = &arc_bus_io;
-
- /* if it's in use as console, it's there. */
- if (iobase == comconsaddr && !comconsattached) {
- return(rv);
- }
- rv = comprobe1(iot, ioh);
- return (rv);
-}
-
-void
-com_localbus_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct com_softc *sc = (void *)self;
- int iobase;
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- struct confargs *ca = aux;
-
- sc->sc_hwflags = 0;
- sc->sc_swflags = 0;
- sc->sc_iobase = iobase = (bus_addr_t)BUS_CVTADDR(ca);
- sc->sc_ioh = ioh = (bus_space_handle_t)iobase;
- sc->sc_iot = iot = &arc_bus_io;
-
- if (iobase == comconsaddr) {
- comconsattached = 1;
-
- /*
- * Need to reset baud rate, etc. of next print so reset
- * comconsinit. Also make sure console is always "hardwired".
- */
- delay(1000); /* wait for output to finish */
- comconsinit = 0;
- SET(sc->sc_hwflags, COM_HW_CONSOLE);
- SET(sc->sc_swflags, COM_SW_SOFTCAR);
- }
-
-
- /* look for a NS 16550AF UART with FIFOs */
- sc->sc_fifolen = 1;
- bus_space_write_1(iot, ioh, com_fifo,
- FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_14);
- delay(100);
- if (ISSET(bus_space_read_1(iot, ioh, com_iir), IIR_FIFO_MASK) ==
- IIR_FIFO_MASK) {
- if (ISSET(bus_space_read_1(iot, ioh, com_fifo),
- FIFO_TRIGGER_14) == FIFO_TRIGGER_14) {
- SET(sc->sc_hwflags, COM_HW_FIFO);
- printf(": ns16550a, working fifo\n");
- sc->sc_fifolen = 16;
- }
- else {
- printf(": ns16550, broken fifo\n");
- }
- }
- else {
- printf(": ns8250 or ns16450, no fifo\n");
- }
- bus_space_write_1(iot, ioh, com_fifo, 0);
-
- /* disable interrupts */
- bus_space_write_1(iot, ioh, com_ier, 0);
- bus_space_write_1(iot, ioh, com_mcr, 0);
-
- BUS_INTR_ESTABLISH(ca, comintr, (void *)(long)sc);
-
-#ifdef KGDB
- if (kgdb_dev == makedev(commajor, unit)) {
- if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE))
- kgdb_dev = -1; /* can't debug over console port */
- else {
- cominit(iot, ioh, kgdb_rate);
- if (kgdb_debug_init) {
- /*
- * Print prefix of device name,
- * let kgdb_connect print the rest.
- */
- printf("%s: ", sc->sc_dev.dv_xname);
- kgdb_connect(1);
- } else
- printf("%s: kgdb enabled\n",
- sc->sc_dev.dv_xname);
- }
- }
-#endif
-
- /* XXX maybe move up some? */
- if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE))
- printf("%s: console\n", sc->sc_dev.dv_xname);
-}
diff --git a/sys/arch/arc/dev/dma.c b/sys/arch/arc/dev/dma.c
deleted file mode 100644
index c61a8039a14..00000000000
--- a/sys/arch/arc/dev/dma.c
+++ /dev/null
@@ -1,397 +0,0 @@
-/* $OpenBSD: dma.c,v 1.5 1998/03/01 16:49:57 niklas Exp $ */
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)rz.c 8.1 (Berkeley) 7/29/93
- * $Id: dma.c,v 1.5 1998/03/01 16:49:57 niklas Exp $
- */
-
-/*
- * PICA system dma driver. Handles resource allocation and
- * logical (viritual) address remaping.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/errno.h>
-#include <sys/malloc.h>
-#include <sys/proc.h>
-#include <sys/syslog.h>
-#include <sys/device.h>
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-
-#include <machine/pte.h>
-#include <machine/cpu.h>
-#include <machine/autoconf.h>
-#include <machine/pio.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-
-#include <arc/pica/pica.h>
-#include <arc/dev/dma.h>
-
-extern vm_map_t phys_map;
-
-#define dma_pte_to_pa(x) (((x) - first_dma_pte) * R4030_DMA_PAGE_SIZE)
-
-void picaDmaReset __P((dma_softc_t *));
-int picaDmaEnd __P((dma_softc_t *));
-void picaDmaNull __P((dma_softc_t *));
-
-dma_pte_t *free_dma_pte; /* Pointer to free dma pte list */
-dma_pte_t *first_dma_pte; /* Pointer to first dma pte */
-
-/*
- * Initialize the dma mapping register area and pool.
- */
-void
-picaDmaInit()
-{
- int map = PICA_TL_BASE;
-
- R4K_FlushCache(); /* Make shure no map entries are cached */
-
- bzero((char *)map, PICA_TL_SIZE);
- free_dma_pte = (dma_pte_t *)map;
- first_dma_pte = (dma_pte_t *)map;
- free_dma_pte->queue.next = NULL;
- free_dma_pte->queue.size = PICA_TL_SIZE / sizeof(dma_pte_t);
-
- out32(R4030_SYS_TL_BASE, UNCACHED_TO_PHYS(map));
- out32(R4030_SYS_TL_LIMIT, PICA_TL_SIZE);
- out32(R4030_SYS_TL_IVALID, 0);
-}
-
-/*
- * Allocate an array of 'size' dma pte entrys.
- * Return address to first pte.
- */
-void
-picaDmaTLBAlloc(dma_softc_t *dma)
-{
- dma_pte_t *list;
- dma_pte_t *found;
- int size;
- int s;
-
- found = NULL;
- size = dma->pte_size;
- do {
- list = (dma_pte_t *)&free_dma_pte;
- s = splhigh();
- while(list) {
- if(list->queue.next->queue.size >= size) {
- found = list->queue.next;
- break;
- }
- }
-/*XXX Wait for release wakeup */
- } while(found == NULL);
- if(found->queue.size == size) {
- list->queue.next = found->queue.next;
- }
- else {
- list->queue.next = found + size;
- list = found + size;
- list->queue.next = found->queue.next;
- list->queue.size = found->queue.size - size;
- }
- splx(s);
- dma->pte_base = found;
- dma->dma_va = dma_pte_to_pa(found);
-}
-
-/*
- * Free an array of dma pte entrys.
- */
-void
-picaDmaTLBFree(dma_softc_t *dma)
-{
- dma_pte_t *list;
- dma_pte_t *entry;
- int size;
- int s;
-
- s = splhigh();
- entry = dma->pte_base;
- size = dma->pte_size;
- entry->queue.next = NULL;
- entry->queue.size = size;
- if(free_dma_pte == NULL || entry < free_dma_pte) {
- list = entry;
- list->queue.next = free_dma_pte;
- free_dma_pte = entry;
- }
- else {
- list = free_dma_pte;
- while(list < entry && list->queue.next != NULL) {
- if(list + list->queue.size == entry) {
- list->queue.size += size;
- break;
- }
- else if(list->queue.next == NULL) {
- list->queue.next = entry;
- break;
- }
- else
- list = list->queue.next;
- }
- }
- if(list->queue.next != NULL) {
- if(list + list->queue.size == list->queue.next) {
- list->queue.size += list->queue.next->queue.size;
- list->queue.next = list->queue.next->queue.next;
- }
- }
- splx(s);
-/*XXX Wakeup waiting */
-}
-
-/*
- * Map up a viritual address space in dma space given by
- * the dma control structure and invalidate dma TLB cache.
- */
-
-void
-picaDmaTLBMap(dma_softc_t *sc)
-{
- vm_offset_t pa;
- vm_offset_t va;
- dma_pte_t *dma_pte;
- int nbytes;
-
- va = sc->next_va - sc->dma_va;
- dma_pte = sc->pte_base + (va / R4030_DMA_PAGE_SIZE);
- nbytes = dma_page_round(sc->next_size + dma_page_offs(va));
- va = sc->req_va;
- while(nbytes > 0) {
- if(va < VM_MIN_KERNEL_ADDRESS) {
- pa = CACHED_TO_PHYS(va);
- }
- else {
- pa = pmap_extract(vm_map_pmap(phys_map), va);
- }
- pa &= R4030_DMA_PAGE_NUM;
- if(pa == 0)
- panic("picaDmaTLBMap: null page frame");
- dma_pte->entry.lo_addr = pa;
- dma_pte->entry.hi_addr = 0;
- dma_pte++;
- va += R4030_DMA_PAGE_SIZE;
- nbytes -= R4030_DMA_PAGE_SIZE;
- }
-}
-
-/*
- * Start local dma channel.
- */
-void
-picaDmaStart(sc, addr, size, datain)
- struct dma_softc *sc;
- char *addr;
- size_t size;
- int datain;
-{
- pDmaReg regs = sc->dma_reg;
-
- /* Halt DMA */
- regs->dma_enab = 0;
- regs->dma_mode = 0;
-
- /* Remap request space va into dma space va */
-
- sc->req_va = (int)addr;
- sc->next_va = sc->dma_va + dma_page_offs(addr);
- sc->next_size = size;
-
- /* Map up the request viritual dma space */
- picaDmaTLBMap(sc);
- out32(R4030_SYS_TL_IVALID, 0); /* Flush dma map cache */
-
- /* Load new transfer parameters */
- regs->dma_addr = sc->next_va;
- regs->dma_count = sc->next_size;
- regs->dma_mode = sc->mode & R4030_DMA_MODE;
-
- sc->sc_active = 1;
- if(datain == DMA_FROM_DEV) {
- sc->mode &= ~DMA_DIR_WRITE;
- regs->dma_enab = R4030_DMA_ENAB_RUN | R4030_DMA_ENAB_READ;
- }
- else {
- sc->mode |= DMA_DIR_WRITE;
- regs->dma_enab = R4030_DMA_ENAB_RUN | R4030_DMA_ENAB_WRITE;
- }
- wbflush();
-}
-
-/*
- * Set up DMA mapper for external dma.
- * Used by ISA dma and SONIC
- */
-void
-picaDmaMap(sc, addr, size, offset)
- struct dma_softc *sc;
- char *addr;
- size_t size;
- int offset;
-{
- /* Remap request space va into dma space va */
-
- sc->req_va = (int)addr;
- sc->next_va = sc->dma_va + dma_page_offs(addr) + offset;
- sc->next_size = size;
-
- /* Map up the request viritual dma space */
- picaDmaTLBMap(sc);
-}
-
-/*
- * Prepare for new dma by flushing
- */
-void
-picaDmaFlush(sc, addr, size, datain)
- struct dma_softc *sc;
- char *addr;
- size_t size;
- int datain;
-{
- out32(R4030_SYS_TL_IVALID, 0); /* Flush dma map cache */
-}
-
-/*
- * Stop/Reset a DMA channel
- */
-void
-picaDmaReset(dma_softc_t *sc)
-{
- pDmaReg regs = sc->dma_reg;
-
- /* Halt DMA */
- regs->dma_enab = 0;
- regs->dma_mode = 0;
- sc->sc_active = 0;
-}
-
-/*
- * End dma operation, return byte count left.
- */
-int
-picaDmaEnd(dma_softc_t *sc)
-{
- pDmaReg regs = sc->dma_reg;
- int res;
-
- res = regs->dma_count = sc->next_size;
-
- /* Halt DMA */
- regs->dma_enab = 0;
- regs->dma_mode = 0;
- sc->sc_active = 0;
-
- return res;
-}
-
-/*
- * Null call rathole!
- */
-void
-picaDmaNull(dma_softc_t *sc)
-{
- printf("picaDmaNull called\n");
-}
-
-/*
- * dma_init..
- * Called from asc to set up dma
- */
-void
-asc_dma_init(sc)
- dma_softc_t *sc;
-{
- sc->reset = picaDmaReset;
- sc->enintr = picaDmaNull;
- sc->start = picaDmaStart;
- sc->map = picaDmaMap;
- sc->isintr = (int(*)(struct dma_softc *))picaDmaNull;
- sc->intr = (int(*)(struct dma_softc *))picaDmaNull;
- sc->end = picaDmaEnd;
-
- sc->dma_reg = (pDmaReg)R4030_SYS_DMA0_REGS;
- sc->pte_size = 32;
- sc->mode = R4030_DMA_MODE_160NS | R4030_DMA_MODE_16;
- picaDmaTLBAlloc(sc);
-}
-/*
- * dma_init..
- * Called from fdc to set up dma
- */
-void
-fdc_dma_init(dma_softc_t *sc)
-{
- sc->reset = picaDmaReset;
- sc->enintr = picaDmaNull;
- sc->start = picaDmaStart;
- sc->map = picaDmaMap;
- sc->isintr = (int(*)(struct dma_softc *))picaDmaNull;
- sc->intr = (int(*)(struct dma_softc *))picaDmaNull;
- sc->end = picaDmaEnd;
-
- sc->dma_reg = (pDmaReg)R4030_SYS_DMA1_REGS;
- sc->pte_size = 32;
- sc->mode = R4030_DMA_MODE_160NS | R4030_DMA_MODE_8;
- picaDmaTLBAlloc(sc);
-}
-/*
- * dma_init..
- * Called from sonic to set up dma
- */
-void
-sn_dma_init(dma_softc_t *sc, int pages)
-{
- sc->reset = picaDmaNull;
- sc->enintr = picaDmaNull;
- sc->start = picaDmaFlush;
- sc->map = picaDmaMap;
- sc->isintr = (int(*)(struct dma_softc *))picaDmaNull;
- sc->intr = (int(*)(struct dma_softc *))picaDmaNull;
- sc->end = (int(*)(struct dma_softc *))picaDmaNull;
-
- sc->dma_reg = (pDmaReg)NULL;
- sc->pte_size = pages;
- sc->mode = 0;
- picaDmaTLBAlloc(sc);
-}
diff --git a/sys/arch/arc/dev/dma.h b/sys/arch/arc/dev/dma.h
deleted file mode 100644
index cb9a69cadd3..00000000000
--- a/sys/arch/arc/dev/dma.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/* $OpenBSD: dma.h,v 1.3 1997/04/19 17:19:51 pefo Exp $ */
-/*
- * Copyright (c) 1996 Per Fogelstrom
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * The R4030 system has four dma channels capable of scatter/gather
- * and full memory addressing. The maximum transfer length is 1Mb.
- * Dma snopes the L2 cache so no precaution is required. However
- * if L1 cache is cached 'write back' the processor is responible
- * for flushing/invalidating it.
- *
- * The dma mapper has up to 4096 page descriptors.
- */
-
-#define PICA_TL_BASE 0xa0008000 /* Base of tl register area */
-#define PICA_TL_SIZE 0x00008000 /* Size of tl register area */
-
-/*
- * Hardware dma registers.
- */
-typedef volatile struct {
- int dma_mode;
- int pad1;
- int dma_enab;
- int pad2;
- int dma_count;
- int pad3;
- vm_offset_t dma_addr;
- int pad4;
-} DmaReg, *pDmaReg;
-
-#define R4030_DMA_MODE_40NS 0x00 /* Device dma timing */
-#define R4030_DMA_MODE_80NS 0x01 /* Device dma timing */
-#define R4030_DMA_MODE_120NS 0x02 /* Device dma timing */
-#define R4030_DMA_MODE_160NS 0x03 /* Device dma timing */
-#define R4030_DMA_MODE_200NS 0x04 /* Device dma timing */
-#define R4030_DMA_MODE_240NS 0x05 /* Device dma timing */
-#define R4030_DMA_MODE_280NS 0x06 /* Device dma timing */
-#define R4030_DMA_MODE_320NS 0x07 /* Device dma timing */
-#define R4030_DMA_MODE_8 0x08 /* Device 8 bit */
-#define R4030_DMA_MODE_16 0x10 /* Device 16 bit */
-#define R4030_DMA_MODE_32 0x18 /* Device 32 bit */
-#define R4030_DMA_MODE_INT 0x20 /* Interrupt when done */
-#define R4030_DMA_MODE_BURST 0x40 /* Burst mode (Rev 2 only) */
-#define R4030_DMA_MODE_FAST 0x80 /* Fast dma cycle (Rev 2 only) */
-#define R4030_DMA_MODE 0xff /* Mode register bits */
-#define DMA_DIR_WRITE 0x100 /* Software direction status */
-#define DMA_DIR_READ 0x000 /* Software direction status */
-
-#define R4030_DMA_ENAB_RUN 0x01 /* Enable dma */
-#define R4030_DMA_ENAB_READ 0x00 /* Read from device */
-#define R4030_DMA_ENAB_WRITE 0x02 /* Write to device */
-#define R4030_DMA_ENAB_TC_IE 0x100 /* Terminal count int enable */
-#define R4030_DMA_ENAB_ME_IE 0x200 /* Memory error int enable */
-#define R4030_DMA_ENAB_TL_IE 0x400 /* Translation limit int enable */
-
-#define R4030_DMA_COUNT_MASK 0x00fffff /* Byte count mask */
-#define R4030_DMA_PAGE_NUM 0xffff000 /* Address page number */
-#define R4030_DMA_PAGE_OFFS 0x0000fff /* Address page offset */
-#define R4030_DMA_PAGE_SIZE 0x0001000 /* Address page size */
-
-
-/*
- * Dma TLB entry
- */
-
-typedef union dma_pte {
- struct {
- vm_offset_t lo_addr; /* Low part of translation addr */
- vm_offset_t hi_addr; /* High part of translation addr */
- } entry;
- struct bbb {
- union dma_pte *next; /* Next free translation entry */
- int size; /* Number of consecutive free entrys */
- } queue;
-} dma_pte_t;
-
-/*
- * Structure used to control dma.
- */
-
-typedef struct dma_softc {
- struct device sc_dev; /* use as a device */
- struct esp_softc *sc_esp;
- vm_offset_t dma_va; /* Viritual address for transfer */
- int req_va; /* Original request va */
- vm_offset_t next_va; /* Value to program into dma regs */
- int next_size; /* Value to program into dma regs */
- int mode; /* Mode register value and direction */
- dma_pte_t *pte_base; /* Pointer to dma tlb array */
- int pte_size; /* Size of pte allocated pte array */
- pDmaReg dma_reg; /* Pointer to dma registers */
- int sc_active; /* Active flag */
- char **sc_dmaaddr; /* Pointer to dma address in dev */
- int *sc_dmalen; /* Pointer to len counter in dev */
- void (*reset)(struct dma_softc *); /* Reset routine pointer */
- void (*enintr)(struct dma_softc *); /* Int enab routine pointer */
- void (*map)(struct dma_softc *, char *, size_t, int);
- /* Map a dma viritual area */
- void (*start)(struct dma_softc *, caddr_t, size_t, int);
- /* Start routine pointer */
- int (*isintr)(struct dma_softc *); /* Int check routine pointer */
- int (*intr)(struct dma_softc *); /* Interrupt routine pointer */
- int (*end)(struct dma_softc *); /* Interrupt routine pointer */
-} dma_softc_t;
-
-#define DMA_TO_DEV 0
-#define DMA_FROM_DEV 1
-
-#define dma_page_offs(x) ((int)(x) & R4030_DMA_PAGE_OFFS)
-#define dma_page_round(x) (((int)(x) + R4030_DMA_PAGE_OFFS) & R4030_DMA_PAGE_NUM)
-
-#define DMA_RESET(r) ((r->reset)(r))
-#define DMA_START(a, b, c, d) ((a->start)(a, b, c, d))
-#define DMA_MAP(a, b, c, d) ((a->map)(a, b, c, d))
-#define DMA_INTR(r) ((r->intr)(r))
-#define DMA_DRAIN(r)
-#define DMA_END(r) ((r->end)(r))
-
-void picaDmaInit __P((void));
-void picaDmaTLBAlloc __P((dma_softc_t *));
-void picaDmaTLBFree __P((dma_softc_t *));
-void picaDmaTLBMap __P((dma_softc_t *));
-void picaDmaMap __P((struct dma_softc *, char *, size_t, int));
-void picaDmaStart __P((struct dma_softc *, char *, size_t, int));
-void picaDmaFlush __P((struct dma_softc *, char *, size_t, int));
-void asc_dma_init __P((struct dma_softc *));
-void fdc_dma_init __P((struct dma_softc *));
-void sn_dma_init __P((struct dma_softc *, int));
-
diff --git a/sys/arch/arc/dev/fd.c b/sys/arch/arc/dev/fd.c
deleted file mode 100644
index 815376cb382..00000000000
--- a/sys/arch/arc/dev/fd.c
+++ /dev/null
@@ -1,1142 +0,0 @@
-/* $OpenBSD: fd.c,v 1.6 1998/10/03 21:18:57 millert Exp $ */
-/* $NetBSD: fd.c,v 1.78 1995/07/04 07:23:09 mycroft Exp $ */
-
-/*-
- * Copyright (c) 1993, 1994, 1995 Charles Hannum.
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Don Ahn.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fd.c 7.4 (Berkeley) 5/25/91
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/ioctl.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-#include <sys/dkstat.h>
-#include <sys/disk.h>
-#include <sys/buf.h>
-#include <sys/uio.h>
-#include <sys/syslog.h>
-#include <sys/queue.h>
-
-#include <machine/cpu.h>
-#include <machine/pio.h>
-#include <machine/autoconf.h>
-
-#include <arc/dev/fdreg.h>
-#include <arc/dev/dma.h>
-
-
-#define FDUNIT(dev) ((dev & 0x080) >> 7)
-#define FDTYPE(dev) ((minor(dev) & 0x70) >> 4)
-#define FDPART(dev) (minor(dev) & 0x0f)
-
-#define b_cylin b_resid
-
-enum fdc_state {
- DEVIDLE = 0,
- MOTORWAIT,
- DOSEEK,
- SEEKWAIT,
- SEEKTIMEDOUT,
- SEEKCOMPLETE,
- DOIO,
- IOCOMPLETE,
- IOTIMEDOUT,
- DORESET,
- RESETCOMPLETE,
- RESETTIMEDOUT,
- DORECAL,
- RECALWAIT,
- RECALTIMEDOUT,
- RECALCOMPLETE,
-};
-
-/* software state, per controller */
-struct fdc_softc {
- struct device sc_dev; /* boilerplate */
-
- struct dma_softc __dma;
- struct dma_softc *dma;
-
- int sc_iobase;
-
- struct fd_softc *sc_fd[4]; /* pointers to children */
- TAILQ_HEAD(drivehead, fd_softc) sc_drives;
- enum fdc_state sc_state;
- int sc_errors; /* number of retries so far */
- u_char sc_status[7]; /* copy of registers */
-};
-
-/* controller driver configuration */
-int fdcprobe __P((struct device *, void *, void *));
-void fdcattach __P((struct device *, struct device *, void *));
-
-struct cfattach fdc_ca = {
- sizeof(struct fdc_softc), fdcprobe, fdcattach
-};
-struct cfdriver fdc_cd = {
- NULL, "fdc", DV_DULL, NULL, 0
-};
-
-/*
- * Floppies come in various flavors, e.g., 1.2MB vs 1.44MB; here is how
- * we tell them apart.
- */
-struct fd_type {
- int sectrac; /* sectors per track */
- int heads; /* number of heads */
- int seccyl; /* sectors per cylinder */
- int secsize; /* size code for sectors */
- int datalen; /* data len when secsize = 0 */
- int steprate; /* step rate and head unload time */
- int gap1; /* gap len between sectors */
- int gap2; /* formatting gap */
- int tracks; /* total num of tracks */
- int size; /* size of disk in sectors */
- int step; /* steps per cylinder */
- int rate; /* transfer speed code */
- char *name;
-};
-
-/* The order of entries in the following table is important -- BEWARE! */
-struct fd_type fd_types[] = {
- { 18,2,36,2,0xff,0xcf,0x1b,0x6c,80,2880,1,FDC_500KBPS,"1.44MB" }, /* 1.44MB diskette */
- { 15,2,30,2,0xff,0xdf,0x1b,0x54,80,2400,1,FDC_500KBPS, "1.2MB" }, /* 1.2 MB AT-diskettes */
- { 9,2,18,2,0xff,0xdf,0x23,0x50,40, 720,2,FDC_300KBPS, "360KB/AT" }, /* 360kB in 1.2MB drive */
- { 9,2,18,2,0xff,0xdf,0x2a,0x50,40, 720,1,FDC_250KBPS, "360KB/PC" }, /* 360kB PC diskettes */
- { 9,2,18,2,0xff,0xdf,0x2a,0x50,80,1440,1,FDC_250KBPS, "720KB" }, /* 3.5" 720kB diskette */
- { 9,2,18,2,0xff,0xdf,0x23,0x50,80,1440,1,FDC_300KBPS, "720KB/x" }, /* 720kB in 1.2MB drive */
- { 9,2,18,2,0xff,0xdf,0x2a,0x50,40, 720,2,FDC_250KBPS, "360KB/x" }, /* 360kB in 720kB drive */
-};
-
-/* software state, per disk (with up to 4 disks per ctlr) */
-struct fd_softc {
- struct device sc_dev;
- struct disk sc_dk;
-
- struct fd_type *sc_deftype; /* default type descriptor */
- struct fd_type *sc_type; /* current type descriptor */
-
- daddr_t sc_blkno; /* starting block number */
- int sc_bcount; /* byte count left */
- int sc_skip; /* bytes already transferred */
- int sc_nblks; /* number of blocks currently tranferring */
- int sc_nbytes; /* number of bytes currently tranferring */
-
- int sc_drive; /* physical unit number */
- int sc_flags;
-#define FD_OPEN 0x01 /* it's open */
-#define FD_MOTOR 0x02 /* motor should be on */
-#define FD_MOTOR_WAIT 0x04 /* motor coming up */
- int sc_cylin; /* where we think the head is */
-
- void *sc_sdhook; /* saved shutdown hook for drive. */
-
- TAILQ_ENTRY(fd_softc) sc_drivechain;
- int sc_ops; /* I/O ops since last switch */
- struct buf sc_q; /* head of buf chain */
-};
-
-/* floppy driver configuration */
-int fdprobe __P((struct device *, void *, void *));
-void fdattach __P((struct device *, struct device *, void *));
-
-struct cfattach fd_ca = {
- sizeof(struct fd_softc), fdprobe, fdattach
-};
-struct cfdriver fd_cd = {
- NULL, "fd", DV_DISK, NULL, 0
-};
-
-void fdgetdisklabel __P((struct fd_softc *));
-int fd_get_parms __P((struct fd_softc *));
-void fdstrategy __P((struct buf *));
-void fdstart __P((struct fd_softc *));
-int fdioctl __P((dev_t, u_long, caddr_t, int));
-int fddump __P((dev_t, daddr_t, caddr_t, size_t));
-int fdsize __P((dev_t));
-int fdopen __P((dev_t, int));
-int fdclose __P((dev_t, int));
-int fdwrite __P((dev_t, struct uio *));
-int fdread __P((dev_t, struct uio *));
-
-struct dkdriver fddkdriver = { fdstrategy };
-
-int fdprint __P((void *, const char *));
-struct fd_type *fd_nvtotype __P((char *, int, int));
-void fd_set_motor __P((struct fdc_softc *fdc, int reset));
-void fd_motor_off __P((void *arg));
-void fd_motor_on __P((void *arg));
-int fdcresult __P((struct fdc_softc *fdc));
-int out_fdc __P((int iobase, u_char x));
-void fdcstart __P((struct fdc_softc *fdc));
-void fdcstatus __P((struct device *dv, int n, char *s));
-void fdctimeout __P((void *arg));
-void fdcpseudointr __P((void *arg));
-int fdcintr __P((void *));
-void fdcretry __P((struct fdc_softc *fdc));
-void fdfinish __P((struct fd_softc *fd, struct buf *bp));
-
-int
-fdcprobe(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- register struct confargs *ca = aux;
- int iobase = (long)BUS_CVTADDR(ca);
-
- if (!BUS_MATCHNAME(ca, "fdc"))
- return (0);
-
- /* reset */
- outb(iobase + fdout, 0);
- delay(100);
- outb(iobase + fdout, FDO_FRST);
-
- /* see if it can handle a command */
- if (out_fdc(iobase, NE7CMD_SPECIFY) < 0)
- return 0;
- out_fdc(iobase, 0xdf);
- out_fdc(iobase, 2);
-
- return 1;
-}
-
-/*
- * Arguments passed between fdcattach and fdprobe.
- */
-struct fdc_attach_args {
- int fa_drive;
- struct fd_type *fa_deftype;
-};
-
-/*
- * Print the location of a disk drive (called just before attaching the
- * the drive). If `fdc' is not NULL, the drive was found but was not
- * in the system config file; print the drive name as well.
- * Return QUIET (config_find ignores this if the device was configured) to
- * avoid printing `fdN not configured' messages.
- */
-int
-fdprint(aux, fdc)
- void *aux;
- const char *fdc;
-{
- register struct fdc_attach_args *fa = aux;
-
- if (!fdc)
- printf(" drive %d", fa->fa_drive);
- return QUIET;
-}
-
-void
-fdcattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct fdc_softc *fdc = (void *)self;
- struct confargs *ca = aux;
- struct fdc_attach_args fa;
- int type;
-
- fdc->sc_iobase = (long)BUS_CVTADDR(ca);
- fdc->sc_state = DEVIDLE;
- TAILQ_INIT(&fdc->sc_drives);
-
- fdc->dma = &fdc->__dma;
- fdc_dma_init(fdc->dma);
-
- printf("\n");
-
- BUS_INTR_ESTABLISH(ca, fdcintr, fdc);
-
- /*
- * No way yet to determine default disk types.
- * we assume 1.44 3.5" type for the moment.
- */
- type = 0;
-
- /* physical limit: two drives per controller. */
- for (fa.fa_drive = 0; fa.fa_drive < 2; fa.fa_drive++) {
- if (type >= 0 && fa.fa_drive < 2)
- fa.fa_deftype = fd_nvtotype(fdc->sc_dev.dv_xname,
- type, fa.fa_drive);
- else
- fa.fa_deftype = NULL; /* unknown */
- (void)config_found(self, (void *)&fa, fdprint);
- }
-}
-
-int
-fdprobe(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct fdc_softc *fdc = (void *)parent;
- struct cfdata *cf = match;
- struct fdc_attach_args *fa = aux;
- int drive = fa->fa_drive;
- int iobase = fdc->sc_iobase;
- int n;
-
- if (cf->cf_loc[0] != -1 && cf->cf_loc[0] != drive)
- return 0;
-
- /* select drive and turn on motor */
- outb(iobase + fdout, drive | FDO_FRST | FDO_MOEN(drive));
- /* wait for motor to spin up */
- delay(500000);
- out_fdc(iobase, NE7CMD_RECAL);
- out_fdc(iobase, drive);
- /* wait for recalibrate */
- delay(2000000);
- out_fdc(iobase, NE7CMD_SENSEI);
- n = fdcresult(fdc);
-#ifdef FD_DEBUG
- {
- int i;
- printf("fdprobe: status");
- for (i = 0; i < n; i++)
- printf(" %x", fdc->sc_status[i]);
- printf("\n");
- }
-#endif
- if (n != 2 || (fdc->sc_status[0] & 0xf8) != 0x20)
- return 0;
- /* turn off motor */
- outb(iobase + fdout, FDO_FRST);
-
- return 1;
-}
-
-/*
- * Controller is working, and drive responded. Attach it.
- */
-void
-fdattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct fdc_softc *fdc = (void *)parent;
- struct fd_softc *fd = (void *)self;
- struct fdc_attach_args *fa = aux;
- struct fd_type *type = fa->fa_deftype;
- int drive = fa->fa_drive;
-
- /* XXX Allow `flags' to override device type? */
-
- if (type)
- printf(": %s %d cyl, %d head, %d sec\n", type->name,
- type->tracks, type->heads, type->sectrac);
- else
- printf(": density unknown\n");
-
- fd->sc_cylin = -1;
- fd->sc_drive = drive;
- fd->sc_deftype = type;
- fdc->sc_fd[drive] = fd;
- fd->sc_dk.dk_name = fd->sc_dev.dv_xname;
- fd->sc_dk.dk_driver = &fddkdriver;
- /* XXX Need to do some more fiddling with sc_dk. */
- dk_establish(&fd->sc_dk, &fd->sc_dev);
-
- /* Needed to power off if the motor is on when we halt. */
- fd->sc_sdhook = shutdownhook_establish(fd_motor_off, fd);
-}
-
-/*
- * Translate nvram type into internal data structure. Return NULL for
- * none/unknown/unusable.
- */
-struct fd_type *
-fd_nvtotype(fdc, nvraminfo, drive)
- char *fdc;
- int nvraminfo, drive;
-{
- int type;
-
- type = (drive == 0 ? nvraminfo : nvraminfo << 4) & 0xf0;
-#if 0
- switch (type) {
- case NVRAM_DISKETTE_NONE:
- return NULL;
- case NVRAM_DISKETTE_12M:
- return &fd_types[1];
- case NVRAM_DISKETTE_TYPE5:
- case NVRAM_DISKETTE_TYPE6:
- /* XXX We really ought to handle 2.88MB format. */
- case NVRAM_DISKETTE_144M:
- return &fd_types[0];
- case NVRAM_DISKETTE_360K:
- return &fd_types[3];
- case NVRAM_DISKETTE_720K:
- return &fd_types[4];
- default:
- printf("%s: drive %d: unknown device type 0x%x\n",
- fdc, drive, type);
- return NULL;
- }
-#else
- return &fd_types[0]; /* Use only 1.44 for now */
-#endif
-}
-
-void
-fdstrategy(bp)
- register struct buf *bp; /* IO operation to perform */
-{
- struct fd_softc *fd;
- int unit = FDUNIT(bp->b_dev);
- int sz;
- int s;
-
- /* Valid unit, controller, and request? */
- if (unit >= fd_cd.cd_ndevs ||
- (fd = fd_cd.cd_devs[unit]) == 0 ||
- bp->b_blkno < 0 ||
- (bp->b_bcount % FDC_BSIZE) != 0) {
- bp->b_error = EINVAL;
- goto bad;
- }
-
- /* If it's a null transfer, return immediately. */
- if (bp->b_bcount == 0)
- goto done;
-
- sz = howmany(bp->b_bcount, FDC_BSIZE);
-
- if (bp->b_blkno + sz > fd->sc_type->size) {
- sz = fd->sc_type->size - bp->b_blkno;
- if (sz == 0) {
- /* If exactly at end of disk, return EOF. */
- bp->b_resid = bp->b_bcount;
- goto done;
- }
- if (sz < 0) {
- /* If past end of disk, return EINVAL. */
- bp->b_error = EINVAL;
- goto bad;
- }
- /* Otherwise, truncate request. */
- bp->b_bcount = sz << DEV_BSHIFT;
- }
-
- bp->b_cylin = bp->b_blkno / (FDC_BSIZE / DEV_BSIZE) / fd->sc_type->seccyl;
-
-#ifdef FD_DEBUG
- printf("fdstrategy: b_blkno %d b_bcount %d blkno %d cylin %d sz %d\n",
- bp->b_blkno, bp->b_bcount, fd->sc_blkno, bp->b_cylin, sz);
-#endif
-
- /* Queue transfer on drive, activate drive and controller if idle. */
- s = splbio();
- disksort(&fd->sc_q, bp);
- untimeout(fd_motor_off, fd); /* a good idea */
- if (!fd->sc_q.b_active)
- fdstart(fd);
-#ifdef DIAGNOSTIC
- else {
- struct fdc_softc *fdc = (void *)fd->sc_dev.dv_parent;
- if (fdc->sc_state == DEVIDLE) {
- printf("fdstrategy: controller inactive\n");
- fdcstart(fdc);
- }
- }
-#endif
- splx(s);
- return;
-
-bad:
- bp->b_flags |= B_ERROR;
-done:
- /* Toss transfer; we're done early. */
- biodone(bp);
-}
-
-void
-fdstart(fd)
- struct fd_softc *fd;
-{
- struct fdc_softc *fdc = (void *)fd->sc_dev.dv_parent;
- int active = fdc->sc_drives.tqh_first != 0;
-
- /* Link into controller queue. */
- fd->sc_q.b_active = 1;
- TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain);
-
- /* If controller not already active, start it. */
- if (!active)
- fdcstart(fdc);
-}
-
-void
-fdfinish(fd, bp)
- struct fd_softc *fd;
- struct buf *bp;
-{
- struct fdc_softc *fdc = (void *)fd->sc_dev.dv_parent;
-
- /*
- * Move this drive to the end of the queue to give others a `fair'
- * chance. We only force a switch if N operations are completed while
- * another drive is waiting to be serviced, since there is a long motor
- * startup delay whenever we switch.
- */
- if (fd->sc_drivechain.tqe_next && ++fd->sc_ops >= 8) {
- fd->sc_ops = 0;
- TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
- if (bp->b_actf) {
- TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain);
- } else
- fd->sc_q.b_active = 0;
- }
- bp->b_resid = fd->sc_bcount;
- fd->sc_skip = 0;
- fd->sc_q.b_actf = bp->b_actf;
- biodone(bp);
- /* turn off motor 5s from now */
- timeout(fd_motor_off, fd, 10 * hz);
- fdc->sc_state = DEVIDLE;
-}
-
-int
-fdread(dev, uio)
- dev_t dev;
- struct uio *uio;
-{
-
- return (physio(fdstrategy, NULL, dev, B_READ, minphys, uio));
-}
-
-int
-fdwrite(dev, uio)
- dev_t dev;
- struct uio *uio;
-{
-
- return (physio(fdstrategy, NULL, dev, B_WRITE, minphys, uio));
-}
-
-void
-fd_set_motor(fdc, reset)
- struct fdc_softc *fdc;
- int reset;
-{
- struct fd_softc *fd;
- u_char status;
- int n;
-
- if ((fd = fdc->sc_drives.tqh_first) != NULL)
- status = fd->sc_drive;
- else
- status = 0;
- if (!reset)
- status |= FDO_FRST | FDO_FDMAEN;
- for (n = 0; n < 4; n++)
- if ((fd = fdc->sc_fd[n]) && (fd->sc_flags & FD_MOTOR))
- status |= FDO_MOEN(n);
- outb(fdc->sc_iobase + fdout, status);
-}
-
-void
-fd_motor_off(arg)
- void *arg;
-{
- struct fd_softc *fd = arg;
- int s;
-
- s = splbio();
- fd->sc_flags &= ~(FD_MOTOR | FD_MOTOR_WAIT);
- fd_set_motor((struct fdc_softc *)fd->sc_dev.dv_parent, 0);
- splx(s);
-}
-
-void
-fd_motor_on(arg)
- void *arg;
-{
- struct fd_softc *fd = arg;
- struct fdc_softc *fdc = (void *)fd->sc_dev.dv_parent;
- int s;
-
- s = splbio();
- fd->sc_flags &= ~FD_MOTOR_WAIT;
- if ((fdc->sc_drives.tqh_first == fd) && (fdc->sc_state == MOTORWAIT))
- (void) fdcintr(fdc);
- splx(s);
-}
-
-int
-fdcresult(fdc)
- struct fdc_softc *fdc;
-{
- int iobase = fdc->sc_iobase;
- u_char i;
- int j = 400000, /* Empirical, should do at 150 Mhz to */
- n = 0;
-
- for (; j; --j) {
- i = inb(iobase + fdsts) & (NE7_DIO | NE7_RQM | NE7_CB);
- if (i == NE7_RQM) {
- return n;
- }
- if (i == (NE7_DIO | NE7_RQM | NE7_CB)) {
- if (n >= sizeof(fdc->sc_status)) {
- log(LOG_ERR, "fdcresult: overrun\n");
- return -1;
- }
- fdc->sc_status[n++] = inb(iobase + fddata);
- }
- }
- log(LOG_ERR, "fdcresult: timeout\n");
- return -1;
-}
-
-int
-out_fdc(iobase, x)
- int iobase;
- u_char x;
-{
- int i = 100000;
-
- while ((inb(iobase + fdsts) & NE7_DIO) && i-- > 0);
- if (i <= 0)
- return -1;
- while ((inb(iobase + fdsts) & NE7_RQM) == 0 && i-- > 0);
- if (i <= 0)
- return -1;
- outb(iobase + fddata, x);
- return 0;
-}
-
-int
-fdopen(dev, flags)
- dev_t dev;
- int flags;
-{
- int unit;
- struct fd_softc *fd;
- struct fd_type *type;
-
- unit = FDUNIT(dev);
- if (unit >= fd_cd.cd_ndevs)
- return ENXIO;
- fd = fd_cd.cd_devs[unit];
- if (fd == 0)
- return ENXIO;
-
- if (FDTYPE(dev) > (sizeof(fd_types) / sizeof(fd_types[0])))
- type = NULL;
- else if(FDTYPE(dev))
- type = &fd_types[FDTYPE(dev) - 1];
- else
- type = fd->sc_deftype;
-
- if (type == NULL)
- return ENXIO;
-
- if ((fd->sc_flags & FD_OPEN) != 0 &&
- fd->sc_type != type)
- return EBUSY;
-
- fd->sc_type = type;
- fd->sc_cylin = -1;
- fd->sc_flags |= FD_OPEN;
-
- return 0;
-}
-
-int
-fdclose(dev, flags)
- dev_t dev;
- int flags;
-{
- struct fd_softc *fd = fd_cd.cd_devs[FDUNIT(dev)];
-
- fd->sc_flags &= ~FD_OPEN;
- return 0;
-}
-
-void
-fdcstart(fdc)
- struct fdc_softc *fdc;
-{
-
-#ifdef DIAGNOSTIC
- /* only got here if controller's drive queue was inactive; should
- be in idle state */
- if (fdc->sc_state != DEVIDLE) {
- printf("fdcstart: not idle\n");
- return;
- }
-#endif
- (void) fdcintr(fdc);
-}
-
-void
-fdcstatus(dv, n, s)
- struct device *dv;
- int n;
- char *s;
-{
- struct fdc_softc *fdc = (void *)dv->dv_parent;
-
- if (n == 0) {
- out_fdc(fdc->sc_iobase, NE7CMD_SENSEI);
- (void) fdcresult(fdc);
- n = 2;
- }
-
- printf("%s: %s", dv->dv_xname, s);
-
- switch (n) {
- case 0:
- printf("\n");
- break;
- case 2:
- printf(" (st0 %b cyl %d)\n",
- fdc->sc_status[0], NE7_ST0BITS,
- fdc->sc_status[1]);
- break;
- case 7:
- printf(" (st0 %b st1 %b st2 %b cyl %d head %d sec %d)\n",
- fdc->sc_status[0], NE7_ST0BITS,
- fdc->sc_status[1], NE7_ST1BITS,
- fdc->sc_status[2], NE7_ST2BITS,
- fdc->sc_status[3], fdc->sc_status[4], fdc->sc_status[5]);
- break;
-#ifdef DIAGNOSTIC
- default:
- printf("\nfdcstatus: weird size");
- break;
-#endif
- }
-}
-
-void
-fdctimeout(arg)
- void *arg;
-{
- struct fdc_softc *fdc = arg;
- struct fd_softc *fd = fdc->sc_drives.tqh_first;
- int s;
-
- s = splbio();
- fdcstatus(&fd->sc_dev, 0, "timeout");
-
- if (fd->sc_q.b_actf)
- fdc->sc_state++;
- else
- fdc->sc_state = DEVIDLE;
-
- (void) fdcintr(fdc);
- splx(s);
-}
-
-void
-fdcpseudointr(arg)
- void *arg;
-{
- int s;
-
- /* Just ensure it has the right spl. */
- s = splbio();
- (void) fdcintr(arg);
- splx(s);
-}
-
-int
-fdcintr(arg)
- void *arg;
-{
- struct fdc_softc *fdc = arg;
-#define st0 fdc->sc_status[0]
-#define cyl fdc->sc_status[1]
- struct fd_softc *fd;
- struct buf *bp;
- int iobase = fdc->sc_iobase;
- int read, head, sec, i, nblks;
- struct fd_type *type;
-
-loop:
- /* Is there a drive for the controller to do a transfer with? */
- fd = fdc->sc_drives.tqh_first;
- if (fd == NULL) {
- fdc->sc_state = DEVIDLE;
- return 1;
- }
-
- /* Is there a transfer to this drive? If not, deactivate drive. */
- bp = fd->sc_q.b_actf;
- if (bp == NULL) {
- fd->sc_ops = 0;
- TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
- fd->sc_q.b_active = 0;
- goto loop;
- }
-
- switch (fdc->sc_state) {
- case DEVIDLE:
- fdc->sc_errors = 0;
- fd->sc_skip = 0;
- fd->sc_bcount = bp->b_bcount;
- fd->sc_blkno = bp->b_blkno / (FDC_BSIZE / DEV_BSIZE);
- untimeout(fd_motor_off, fd);
- if ((fd->sc_flags & FD_MOTOR_WAIT) != 0) {
- fdc->sc_state = MOTORWAIT;
- return 1;
- }
- if ((fd->sc_flags & FD_MOTOR) == 0) {
- /* Turn on the motor, being careful about pairing. */
- struct fd_softc *ofd = fdc->sc_fd[fd->sc_drive ^ 1];
- if (ofd && ofd->sc_flags & FD_MOTOR) {
- untimeout(fd_motor_off, ofd);
- ofd->sc_flags &= ~(FD_MOTOR | FD_MOTOR_WAIT);
- }
- fd->sc_flags |= FD_MOTOR | FD_MOTOR_WAIT;
- fd_set_motor(fdc, 0);
- fdc->sc_state = MOTORWAIT;
- /* Allow .5s for motor to stabilize. */
- timeout(fd_motor_on, fd, hz / 2);
- return 1;
- }
- /* Make sure the right drive is selected. */
- fd_set_motor(fdc, 0);
-
- /* fall through */
- case DOSEEK:
- doseek:
- if (fd->sc_cylin == bp->b_cylin)
- goto doio;
-
- out_fdc(iobase, NE7CMD_SPECIFY);/* specify command */
- out_fdc(iobase, fd->sc_type->steprate);
- out_fdc(iobase, 6); /* XXX head load time == 6ms */
-
- out_fdc(iobase, NE7CMD_SEEK); /* seek function */
- out_fdc(iobase, fd->sc_drive); /* drive number */
- out_fdc(iobase, bp->b_cylin * fd->sc_type->step);
-
- fd->sc_cylin = -1;
- fdc->sc_state = SEEKWAIT;
- timeout(fdctimeout, fdc, 4 * hz);
- return 1;
-
- case DOIO:
- doio:
- type = fd->sc_type;
- sec = fd->sc_blkno % type->seccyl;
- nblks = type->seccyl - sec;
- nblks = min(nblks, fd->sc_bcount / FDC_BSIZE);
- nblks = min(nblks, FDC_MAXIOSIZE / FDC_BSIZE);
- fd->sc_nblks = nblks;
- fd->sc_nbytes = nblks * FDC_BSIZE;
- head = sec / type->sectrac;
- sec -= head * type->sectrac;
-#ifdef DIAGNOSTIC
- {int block;
- block = (fd->sc_cylin * type->heads + head) * type->sectrac + sec;
- if (block != fd->sc_blkno) {
- printf("fdcintr: block %d != blkno %d\n", block, fd->sc_blkno);
-#ifdef DDB
- Debugger();
-#endif
- }}
-#endif
- R4K_FlushDCache((vm_offset_t)(bp->b_data + fd->sc_skip), fd->sc_nbytes);
- read = bp->b_flags & B_READ ? DMA_FROM_DEV : DMA_TO_DEV;
- DMA_START(fdc->dma, bp->b_data + fd->sc_skip, fd->sc_nbytes, read);
- outb(iobase + fdctl, type->rate);
-#ifdef FD_DEBUG
- printf("fdcintr: %s drive %d track %d head %d sec %d nblks %d\n",
- read ? "read" : "write", fd->sc_drive, fd->sc_cylin, head,
- sec, nblks);
-#endif
- if (read)
- out_fdc(iobase, NE7CMD_READ); /* READ */
- else
- out_fdc(iobase, NE7CMD_WRITE); /* WRITE */
- out_fdc(iobase, (head << 2) | fd->sc_drive);
- out_fdc(iobase, fd->sc_cylin); /* track */
- out_fdc(iobase, head);
- out_fdc(iobase, sec + 1); /* sector +1 */
- out_fdc(iobase, type->secsize); /* sector size */
- out_fdc(iobase, type->sectrac); /* sectors/track */
- out_fdc(iobase, type->gap1); /* gap1 size */
- out_fdc(iobase, type->datalen); /* data length */
- fdc->sc_state = IOCOMPLETE;
- /* allow 2 seconds for operation */
- timeout(fdctimeout, fdc, 2 * hz);
- return 1; /* will return later */
-
- case SEEKWAIT:
- untimeout(fdctimeout, fdc);
- fdc->sc_state = SEEKCOMPLETE;
- /* allow 1/50 second for heads to settle */
- timeout(fdcpseudointr, fdc, hz / 50);
- return 1;
-
- case SEEKCOMPLETE:
- /* Make sure seek really happened. */
- out_fdc(iobase, NE7CMD_SENSEI);
- if (fdcresult(fdc) != 2 || (st0 & 0xf8) != 0x20 ||
- cyl != bp->b_cylin * fd->sc_type->step) {
-#ifdef FD_DEBUG
- fdcstatus(&fd->sc_dev, 2, "seek failed");
-#endif
- fdcretry(fdc);
- goto loop;
- }
- fd->sc_cylin = bp->b_cylin;
- goto doio;
-
- case IOTIMEDOUT:
- DMA_RESET(fdc->dma);
-
- case SEEKTIMEDOUT:
- case RECALTIMEDOUT:
- case RESETTIMEDOUT:
- fdcretry(fdc);
- goto loop;
-
- case IOCOMPLETE: /* IO DONE, post-analyze */
- untimeout(fdctimeout, fdc);
- if (fdcresult(fdc) != 7 || (st0 & 0xf8) != 0) {
- DMA_RESET(fdc->dma);
-#ifdef FD_DEBUG
- fdcstatus(&fd->sc_dev, 7, bp->b_flags & B_READ ?
- "read failed" : "write failed");
- printf("blkno %d nblks %d\n",
- fd->sc_blkno, fd->sc_nblks);
-#endif
- fdcretry(fdc);
- goto loop;
- }
- DMA_END(fdc->dma);
- read = bp->b_flags & B_READ;
- if (fdc->sc_errors) {
- diskerr(bp, "fd", "soft error", LOG_PRINTF,
- fd->sc_skip / FDC_BSIZE, (struct disklabel *)NULL);
- printf("\n");
- fdc->sc_errors = 0;
- }
- fd->sc_blkno += fd->sc_nblks;
- fd->sc_skip += fd->sc_nbytes;
- fd->sc_bcount -= fd->sc_nbytes;
- if (fd->sc_bcount > 0) {
- bp->b_cylin = fd->sc_blkno / fd->sc_type->seccyl;
- goto doseek;
- }
- fdfinish(fd, bp);
- goto loop;
-
- case DORESET:
- /* try a reset, keep motor on */
- fd_set_motor(fdc, 1);
- delay(100);
- fd_set_motor(fdc, 0);
- fdc->sc_state = RESETCOMPLETE;
- timeout(fdctimeout, fdc, hz / 2);
- return 1; /* will return later */
-
- case RESETCOMPLETE:
- untimeout(fdctimeout, fdc);
- /* clear the controller output buffer */
- for (i = 0; i < 4; i++) {
- out_fdc(iobase, NE7CMD_SENSEI);
- (void) fdcresult(fdc);
- }
-
- /* fall through */
- case DORECAL:
- out_fdc(iobase, NE7CMD_RECAL); /* recalibrate function */
- out_fdc(iobase, fd->sc_drive);
- fdc->sc_state = RECALWAIT;
- timeout(fdctimeout, fdc, 5 * hz);
- return 1; /* will return later */
-
- case RECALWAIT:
- untimeout(fdctimeout, fdc);
- fdc->sc_state = RECALCOMPLETE;
- /* allow 1/30 second for heads to settle */
- timeout(fdcpseudointr, fdc, hz / 30);
- return 1; /* will return later */
-
- case RECALCOMPLETE:
- out_fdc(iobase, NE7CMD_SENSEI);
- if (fdcresult(fdc) != 2 || (st0 & 0xf8) != 0x20 || cyl != 0) {
-#ifdef FD_DEBUG
- fdcstatus(&fd->sc_dev, 2, "recalibrate failed");
-#endif
- fdcretry(fdc);
- goto loop;
- }
- fd->sc_cylin = 0;
- goto doseek;
-
- case MOTORWAIT:
- if (fd->sc_flags & FD_MOTOR_WAIT)
- return 1; /* time's not up yet */
- goto doseek;
-
- default:
- fdcstatus(&fd->sc_dev, 0, "stray interrupt");
- return 1;
- }
-#ifdef DIAGNOSTIC
- panic("fdcintr: impossible");
-#endif
-#undef st0
-#undef cyl
-}
-
-void
-fdcretry(fdc)
- struct fdc_softc *fdc;
-{
- struct fd_softc *fd;
- struct buf *bp;
-
- fd = fdc->sc_drives.tqh_first;
- bp = fd->sc_q.b_actf;
-
- switch (fdc->sc_errors) {
- case 0:
- /* try again */
- fdc->sc_state = SEEKCOMPLETE;
- break;
-
- case 1: case 2: case 3:
- /* didn't work; try recalibrating */
- fdc->sc_state = DORECAL;
- break;
-
- case 4:
- /* still no go; reset the bastard */
- fdc->sc_state = DORESET;
- break;
-
- default:
- diskerr(bp, "fd", "hard error", LOG_PRINTF,
- fd->sc_skip / FDC_BSIZE, (struct disklabel *)NULL);
- printf(" (st0 %b st1 %b st2 %b cyl %d head %d sec %d)\n",
- fdc->sc_status[0], NE7_ST0BITS,
- fdc->sc_status[1], NE7_ST1BITS,
- fdc->sc_status[2], NE7_ST2BITS,
- fdc->sc_status[3], fdc->sc_status[4], fdc->sc_status[5]);
-
- bp->b_flags |= B_ERROR;
- bp->b_error = EIO;
- fdfinish(fd, bp);
- }
- fdc->sc_errors++;
-}
-
-int
-fdsize(dev)
- dev_t dev;
-{
-
- /* Swapping to floppies would not make sense. */
- return -1;
-}
-
-int
-fddump(dev, blkno, va, size)
- dev_t dev;
- daddr_t blkno;
- caddr_t va;
- size_t size;
-{
-
- /* Not implemented. */
- return ENXIO;
-}
-
-int
-fdioctl(dev, cmd, addr, flag)
- dev_t dev;
- u_long cmd;
- caddr_t addr;
- int flag;
-{
- struct fd_softc *fd = fd_cd.cd_devs[FDUNIT(dev)];
- struct disklabel buffer;
- int error;
-
- switch (cmd) {
- case DIOCGDINFO:
- bzero(&buffer, sizeof(buffer));
-
- buffer.d_secpercyl = fd->sc_type->seccyl;
- buffer.d_type = DTYPE_FLOPPY;
- buffer.d_secsize = FDC_BSIZE;
-
- if (readdisklabel(dev, fdstrategy, &buffer, NULL, 0) != NULL)
- return EINVAL;
-
- *(struct disklabel *)addr = buffer;
- return 0;
-
- case DIOCWLABEL:
- if ((flag & FWRITE) == 0)
- return EBADF;
- /* XXX do something */
- return 0;
-
- case DIOCWDINFO:
- if ((flag & FWRITE) == 0)
- return EBADF;
-
- error = setdisklabel(&buffer, (struct disklabel *)addr, 0, NULL);
- if (error)
- return error;
-
- error = writedisklabel(dev, fdstrategy, &buffer, NULL);
- return error;
-
- default:
- return ENOTTY;
- }
-
-#ifdef DIAGNOSTIC
- panic("fdioctl: impossible");
-#endif
-}
diff --git a/sys/arch/arc/dev/fdreg.h b/sys/arch/arc/dev/fdreg.h
deleted file mode 100644
index 454f2873ad3..00000000000
--- a/sys/arch/arc/dev/fdreg.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* $OpenBSD: fdreg.h,v 1.1.1.1 1996/06/24 09:07:19 pefo Exp $ */
-/* $NetBSD: fdreg.h,v 1.8 1995/06/28 04:30:57 cgd Exp $ */
-
-/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fdreg.h 7.1 (Berkeley) 5/9/91
- */
-
-/*
- * AT floppy controller registers and bitfields
- */
-
-/* uses NEC765 controller */
-#include <dev/ic/nec765reg.h>
-
-/* registers */
-#define fdout 2 /* Digital Output Register (W) */
-#define FDO_FDSEL 0x03 /* floppy device select */
-#define FDO_FRST 0x04 /* floppy controller reset */
-#define FDO_FDMAEN 0x08 /* enable floppy DMA and Interrupt */
-#define FDO_MOEN(n) ((1 << n) * 0x10) /* motor enable */
-
-#define fdsts 4 /* NEC 765 Main Status Register (R) */
-#define fddata 5 /* NEC 765 Data Register (R/W) */
-
-#define fdctl 7 /* Control Register (W) */
-#define FDC_500KBPS 0x00 /* 500KBPS MFM drive transfer rate */
-#define FDC_300KBPS 0x01 /* 300KBPS MFM drive transfer rate */
-#define FDC_250KBPS 0x02 /* 250KBPS MFM drive transfer rate */
-#define FDC_125KBPS 0x03 /* 125KBPS FM drive transfer rate */
-
-#define fdin 7 /* Digital Input Register (R) */
-#define FDI_DCHG 0x80 /* diskette has been changed */
-
-#define FDC_BSIZE 512
-#define FDC_NPORT 8
-#define FDC_MAXIOSIZE NBPG /* XXX should be MAXBSIZE */
diff --git a/sys/arch/arc/dev/if_sn.c b/sys/arch/arc/dev/if_sn.c
deleted file mode 100644
index a204db7a4ff..00000000000
--- a/sys/arch/arc/dev/if_sn.c
+++ /dev/null
@@ -1,1252 +0,0 @@
-/* $OpenBSD: if_sn.c,v 1.12 1999/05/13 15:44:48 jason Exp $ */
-/*
- * National Semiconductor SONIC Driver
- * Copyright (c) 1991 Algorithmics Ltd (http://www.algor.co.uk)
- * You may use, copy, and modify this program so long as you retain the
- * copyright line.
- *
- * This driver has been substantially modified since Algorithmics donated
- * it.
- */
-
-#include "sn.h"
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/buf.h>
-#include <sys/protosw.h>
-#include <sys/socket.h>
-#include <sys/syslog.h>
-#include <sys/ioctl.h>
-#include <sys/errno.h>
-#include <sys/device.h>
-#include <machine/autoconf.h>
-
-#include <net/if.h>
-#include <net/netisr.h>
-#include <net/route.h>
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/in_var.h>
-#include <netinet/ip.h>
-#include <netinet/if_ether.h>
-#endif
-
-#include <vm/vm.h>
-
-#include "bpfilter.h"
-#if NBPFILTER > 0
-#include <net/bpf.h>
-#include <net/bpfdesc.h>
-#endif
-
-#include <arc/dev/dma.h>
-
-#define SONICDW 32
-typedef unsigned char uchar;
-
-#include <arc/dev/if_sn.h>
-#define SWR(a, x) (a) = (x)
-#define SRD(a) ((a) & 0xffff)
-
-#include <machine/pte.h>
-#include <machine/cpu.h>
-
-/*
- * Statistics collected over time
- */
-struct sn_stats {
- int ls_opacks; /* packets transmitted */
- int ls_ipacks; /* packets received */
- int ls_tdr; /* contents of tdr after collision */
- int ls_tdef; /* packets where had to wait */
- int ls_tone; /* packets with one retry */
- int ls_tmore; /* packets with more than one retry */
- int ls_tbuff; /* transmit buff errors */
- int ls_tuflo; /* " uflo " */
- int ls_tlcol;
- int ls_tlcar;
- int ls_trtry;
- int ls_rbuff; /* receive buff errors */
- int ls_rfram; /* framing */
- int ls_roflo; /* overflow */
- int ls_rcrc;
- int ls_rrng; /* rx ring sequence error */
- int ls_babl; /* chip babl error */
- int ls_cerr; /* collision error */
- int ls_miss; /* missed packet */
- int ls_merr; /* memory error */
- int ls_copies; /* copies due to out of range mbufs */
- int ls_maxmbufs; /* max mbufs on transmit */
- int ls_maxslots; /* max ring slots on transmit */
-};
-
-struct sn_softc {
- struct device sc_dev;
- struct arpcom sc_ac;
-#define sc_if sc_ac.ac_if /* network visible interface */
-#define sc_enaddr sc_ac.ac_enaddr /* hardware ethernet address */
-
- struct sonic_reg *sc_csr; /* hardware pointer */
- dma_softc_t __dma; /* stupid macro ... */
- dma_softc_t *dma; /* dma mapper control */
- int sc_rxmark; /* position in rx ring for reading buffs */
-
- int sc_rramark; /* index into rra of wp */
-
- int sc_txhead; /* index of first TDA passed to chip */
- int sc_missed; /* missed packet counter */
- struct RXpkt *sc_lrxp; /* last RDA available to chip */
- struct sn_stats sc_sum;
- short sc_iflags;
-} sn_softc;
-
-int snmatch __P((struct device *, void *, void *));
-void snattach __P((struct device *, struct device *, void *));
-
-struct cfattach sn_ca = {
- sizeof(struct sn_softc), snmatch, snattach
-};
-struct cfdriver sn_cd = {
- NULL, "sn", DV_IFNET, NULL, 0
-};
-
-#undef assert
-#undef _assert
-
-#ifdef NDEBUG
-#define assert(e) ((void)0)
-#define _assert(e) ((void)0)
-#else
-#define _assert(e) assert(e)
-#ifdef __STDC__
-#define assert(e) ((e) ? (void)0 : __assert("sn ", __FILE__, __LINE__, #e))
-#else /* PCC */
-#define assert(e) ((e) ? (void)0 : __assert("sn "__FILE__, __LINE__, "e"))
-#endif
-#endif
-
-int ethdebug = 0;
-
-int snintr __P((struct sn_softc *));
-int snioctl __P((struct ifnet *ifp, u_long cmd, caddr_t data));
-void snstart __P((struct ifnet *ifp));
-void snwatchdog __P((struct ifnet *ifp));
-void snreset __P((struct sn_softc *sc));
-
-/*
- * SONIC buffers need to be aligned 16 or 32 bit aligned.
- * These macros calculate and verify alignment.
- */
-#if SONICDW == 32
-#define SONICALIGN 4
-#else
-#define SONICALIGN 2
-#endif
-#define SOALIGN(array) (((int)array+SONICALIGN-1) & ~(SONICALIGN-1))
-#define SOALIGNED(p) (!(((uint)p)&(SONICALIGN-1)))
-
-#define UPPER(x) ((unsigned)(x) >> 16)
-#define LOWER(x) ((unsigned)(x) & 0xffff)
-
-#define NRRA 32 /* # receive resource descriptors */
-#define RRAMASK 0x1f /* why it must be poer of two */
-
-#define NRBA 16 /* # receive buffers < NRRA */
-#define NRDA NRBA /* # receive descriptors */
-#define NTDA 4 /* # transmit descriptors */
-
-#define CDASIZE sizeof(struct CDA)
-#define RRASIZE (NRRA*sizeof(struct RXrsrc))
-#define RDASIZE (NRDA*sizeof(struct RXpkt))
-#define TDASIZE (NTDA*sizeof(struct TXpkt))
-
-#define FCSSIZE 4 /* size of FCS append te received packets */
-
-/*
- * maximum recieve packet size plus 2 byte pad to make each
- * one aligned. 4 byte slop (required for eobc)
- */
-#define RBASIZE (sizeof(struct ether_header) + ETHERMTU + FCSSIZE + 2 + 4)
-
-/*
- * space requiered for descriptors
- */
-#define DESC_SIZE (RRASIZE + CDASIZE + RDASIZE + TDASIZE + SONICALIGN - 1)
-
-/*
- * This should really be 'allocated' but for now we
- * 'hardwire' it.
- */
-#define SONICBUF 0xa0010000
-
-/*
- * Nicely aligned pointers into the sonicbuffers
- * p_ points at physical (K1_SEG) addresses.
- * v_ is dma viritual address used by sonic.
- */
-struct RXrsrc *p_rra; /* receiver resource descriptors */
-struct RXrsrc *v_rra;
-struct RXpkt *p_rda; /* receiver desriptors */
-struct RXpkt *v_rda;
-struct TXpkt *p_tda; /* transmitter descriptors */
-struct TXpkt *v_tda;
-struct CDA *p_cda; /* CAM descriptors */
-struct CDA *v_cda;
-char *p_rba; /* receive buffer area base */
-char *v_rba;
-
-/* Meta transmit descriptors */
-struct mtd {
- struct mtd *mtd_link;
- struct TXpkt *mtd_txp;
- struct mbuf *mtd_mbuf;
-} mtda[NTDA];
-
-struct mtd *mtdfree; /* list of free meta transmit descriptors */
-struct mtd *mtdhead; /* head of descriptors assigned to chip */
-struct mtd *mtdtail; /* tail of descriptors assigned to chip */
-struct mtd *mtdnext; /* next descriptor to give to chip */
-
-void mtd_free __P((struct mtd *));
-struct mtd *mtd_alloc __P((void));
-
-int sngetaddr __P((struct sn_softc *sc));
-int sninit __P((struct sn_softc *sc));
-int snstop __P((struct sn_softc *sc));
-int sonicput __P((struct sn_softc *sc, struct mbuf *m0));
-
-void camdump __P((struct sn_softc *sc));
-
-int
-snmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct confargs *ca = aux;
-
- /* XXX CHECK BUS */
- /* make sure that we're looking for this type of device. */
- if (!BUS_MATCHNAME(ca, "sonic"))
- return (0);
-
- return (1);
-}
-
-/*
- * Interface exists: make available by filling in network interface
- * record. System will initialize the interface when it is ready
- * to accept packets.
- */
-void
-snattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct sn_softc *sc = (void *)self;
- struct confargs *ca = aux;
- struct ifnet *ifp = &sc->sc_if;
- int p, pp;
-
- sc->sc_csr = (struct sonic_reg *)BUS_CVTADDR(ca);
-
- sc->dma = &sc->__dma;
- sn_dma_init(sc->dma, FRAGMAX * NTDA
- + (NRBA * RBASIZE / R4030_DMA_PAGE_SIZE) + 1
- + (DESC_SIZE * 2 / R4030_DMA_PAGE_SIZE) + 1);
-
-/*
- * because the sonic is basicly 16bit device it 'concatenates'
- * a higher buffer address to a 16 bit offset this will cause wrap
- * around problems near the end of 64k !!
- */
- p = SONICBUF;
- pp = SONICBUF - (FRAGMAX * NTDA * R4030_DMA_PAGE_SIZE);
-
- if ((p ^ (p + TDASIZE)) & 0x10000)
- p = (p + 0x10000) & ~0xffff;
- p_tda = (struct TXpkt *) p;
- v_tda = (struct TXpkt *)(p - pp + sc->dma->dma_va);
- p += TDASIZE;
-
- if ((p ^ (p + RRASIZE + CDASIZE)) & 0x10000)
- p = (p + 0x10000) & ~0xffff;
- p_rra = (struct RXrsrc *) p;
- v_rra = (struct RXrsrc *)(p - pp + sc->dma->dma_va);
- p += RRASIZE;
-
- if ((p ^ (p + RDASIZE)) & 0x10000)
- p = (p + 0x10000) & ~0xffff;
- p_rda = (struct RXpkt *) p;
- v_rda = (struct RXpkt *)(p - pp + sc->dma->dma_va);
- p += RDASIZE;
-
- p_cda = (struct CDA *) p;
- v_cda = (struct CDA *)(p - pp + sc->dma->dma_va);
- p += CDASIZE;
-
- p += R4030_DMA_PAGE_SIZE - (p & (R4030_DMA_PAGE_SIZE -1));
- p_rba = (char *)p;
- v_rba = (char *)(p - pp + sc->dma->dma_va);
- p += NRBA * RBASIZE;
-
- DMA_MAP(sc->dma, (caddr_t)SONICBUF, p - SONICBUF, SONICBUF - pp);
- printf(": bufsize %d",p - SONICBUF);
-
-#if 0
- camdump(sc);
-#endif
- sngetaddr(sc);
- printf(" address %s\n", ether_sprintf(sc->sc_enaddr));
-
-#if 0
-printf("\nsonic buffers: rra=0x%x cda=0x%x rda=0x%x tda=0x%x rba=0x%x\n",
- p_rra, p_cda, p_rda, p_tda, p_rba);
-printf("sonic buffers: rra=0x%x cda=0x%x rda=0x%x tda=0x%x rba=0x%x\n",
- v_rra, v_cda, v_rda, v_tda, v_rba);
-printf("mapped to offset 0x%x size 0x%x\n", SONICBUF - pp, p - SONICBUF);
-#endif
-
- BUS_INTR_ESTABLISH(ca, (intr_handler_t)snintr, (void *)sc);
-
- bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ);
- ifp->if_softc = sc;
- ifp->if_ioctl = snioctl;
- ifp->if_start = snstart;
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
- ifp->if_watchdog = snwatchdog;
-#if NBPFILTER > 0
- bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
-#endif
- if_attach(ifp);
- ether_ifattach(ifp);
-}
-
-int
-snioctl(ifp, cmd, data)
- struct ifnet *ifp;
- u_long cmd;
- caddr_t data;
-{
- struct ifaddr *ifa;
- struct sn_softc *sc = ifp->if_softc;
- int s = splnet(), err = 0;
- int temp;
- int error;
-
- if ((error = ether_ioctl(ifp, &sc->sc_ac, cmd, data)) > 0) {
- splx(s);
- return error;
- }
-
- switch (cmd) {
-
- case SIOCSIFADDR:
- ifa = (struct ifaddr *)data;
- ifp->if_flags |= IFF_UP;
- switch (ifa->ifa_addr->sa_family) {
-#ifdef INET
- case AF_INET:
- (void)sninit(ifp->if_softc);
- arp_ifinit(&sc->sc_ac, ifa);
- break;
-#endif
- default:
- (void)sninit(ifp->if_softc);
- break;
- }
- break;
-
- case SIOCSIFFLAGS:
- if ((ifp->if_flags & IFF_UP) == 0 &&
- ifp->if_flags & IFF_RUNNING) {
- snstop(ifp->if_softc);
- ifp->if_flags &= ~IFF_RUNNING;
- } else if (ifp->if_flags & IFF_UP &&
- (ifp->if_flags & IFF_RUNNING) == 0)
- (void)sninit(ifp->if_softc);
- /*
- * If the state of the promiscuous bit changes, the interface
- * must be reset to effect the change.
- */
- if (((ifp->if_flags ^ sc->sc_iflags) & IFF_PROMISC) &&
- (ifp->if_flags & IFF_RUNNING)) {
- sc->sc_iflags = ifp->if_flags;
- temp = sc->sc_if.if_flags & IFF_UP;
- snreset(sc);
- sc->sc_if.if_flags |= temp;
- snstart(ifp);
- }
- break;
-
- case SIOCADDMULTI:
- case SIOCDELMULTI:
- if(cmd == SIOCADDMULTI)
- err = ether_addmulti((struct ifreq *)data, &sc->sc_ac);
- else
- err = ether_delmulti((struct ifreq *)data, &sc->sc_ac);
-
- if (err == ENETRESET) {
- /*
- * Multicast list has changed; set the hardware
- * filter accordingly. But remember UP flag!
- */
- temp = sc->sc_if.if_flags & IFF_UP;
- snreset(sc);
- sc->sc_if.if_flags |= temp;
- err = 0;
- }
- break;
- default:
- err = EINVAL;
- }
- splx(s);
- return (err);
-}
-
-/*
- * Encapsulate a packet of type family for the local net.
- * Use trailer local net encapsulation if enough data in first
- * packet leaves a multiple of 512 bytes of data in remainder.
- */
-void
-snstart(ifp)
- struct ifnet *ifp;
-{
- struct sn_softc *sc = ifp->if_softc;
- struct mbuf *m;
-
- if ((sc->sc_if.if_flags & IFF_RUNNING) == 0)
- return;
- IF_DEQUEUE(&sc->sc_if.if_snd, m);
- if (m == 0)
- return;
-
- /*
- * If there is nothing in the o/p queue, and there is room in
- * the Tx ring, then send the packet directly. Otherwise append
- * it to the o/p queue.
- */
- if (!sonicput(sc, m)) { /* not enough space */
- IF_PREPEND(&sc->sc_if.if_snd, m);
- }
-#if NBPFILTER > 0
- /*
- * If bpf is listening on this interface, let it
- * see the packet before we commit it to the wire.
- */
- if (sc->sc_if.if_bpf)
- bpf_mtap(sc->sc_if.if_bpf, m);
-#endif
-
- sc->sc_if.if_opackets++; /* # of pkts */
- sc->sc_sum.ls_opacks++; /* # of pkts */
-}
-
-/*
- * This is called from sonicioctl() when /etc/ifconfig is run to set
- * the address or switch the i/f on.
- */
-void caminitialise __P((void));
-void camentry __P((int, u_char *ea));
-void camprogram __P((struct sn_softc *));
-void initialise_tda __P((struct sn_softc *));
-void initialise_rda __P((struct sn_softc *));
-void initialise_rra __P((struct sn_softc *));
-
-/*
- * reset and restart the SONIC. Called in case of fatal
- * hardware/software errors.
- */
-void
-snreset(sc)
- struct sn_softc *sc;
-{
- snstop(sc);
- sninit(sc);
-}
-
-int
-sninit(sc)
- struct sn_softc *sc;
-{
- struct sonic_reg *csr = sc->sc_csr;
- int s;
-
- if (sc->sc_if.if_flags & IFF_RUNNING)
- /* already running */
- return (0);
-
- s = splnet();
-
- csr->s_cr = CR_RST; /* s_dcr only accessable reset mode! */
-
- /* config it */
- csr->s_dcr = DCR_LBR | DCR_SYNC | DCR_WAIT0 | DCR_DW32 |
- DCR_RFT4 | DCR_TFT28; /*XXX RFT & TFT according to MIPS manual */
- csr->s_rcr = RCR_BRD | RCR_LBNONE;
- csr->s_imr = IMR_PRXEN | IMR_PTXEN | IMR_TXEREN | IMR_HBLEN | IMR_LCDEN;
-
- /* clear pending interrupts */
- csr->s_isr = 0x7fff;
-
- /* clear tally counters */
- csr->s_crct = -1;
- csr->s_faet = -1;
- csr->s_mpt = -1;
-
- initialise_tda(sc);
- initialise_rda(sc);
- initialise_rra(sc);
-
- /* enable the chip */
- csr->s_cr = 0;
- wbflush();
-
- /* program the CAM with our address */
- caminitialise();
- camentry(0, sc->sc_enaddr);
- camprogram(sc);
-
- /* get it to read resource descriptors */
- csr->s_cr = CR_RRRA;
- wbflush();
- while (csr->s_cr & CR_RRRA)
- continue;
-
- /* enable rx */
- csr->s_cr = CR_RXEN;
- wbflush();
-
- /* flag interface as "running" */
- sc->sc_if.if_flags |= IFF_RUNNING;
-
- splx(s);
- return (0);
-}
-
-/*
- * close down an interface and free its buffers
- * Called on final close of device, or if sninit() fails
- * part way through.
- */
-int
-snstop(sc)
- struct sn_softc *sc;
-{
- struct mtd *mtd;
- int s = splnet();
-
- /* stick chip in reset */
- sc->sc_csr->s_cr = CR_RST;
- wbflush();
-
- /* free all receive buffers (currently static so nothing to do) */
-
- /* free all pending transmit mbufs */
- while ((mtd = mtdhead)) {
- mtdhead = mtdhead->mtd_link;
- if (mtd->mtd_mbuf)
- m_freem(mtd->mtd_mbuf);
- mtd->mtd_mbuf = 0;
- mtd_free(mtd);
- }
- mtdnext = mtd_alloc();
-
- sc->sc_if.if_timer = 0;
- sc->sc_if.if_flags &= ~(IFF_RUNNING | IFF_UP);
-
- splx(s);
- return (0);
-}
-
-/*
- * Called if any Tx packets remain unsent after 5 seconds,
- * In all cases we just reset the chip, and any retransmission
- * will be handled by higher level protocol timeouts.
- */
-void
-snwatchdog(ifp)
- struct ifnet *ifp;
-{
- struct sn_softc *sc = ifp->if_softc;
- int temp;
-
- if (mtdhead && mtdhead->mtd_mbuf) {
- /* something still pending for transmit */
- if (mtdhead->mtd_txp->status == 0)
- log(LOG_ERR, "%s: Tx - timeout\n",
- sc->sc_if.if_xname);
- else
- log(LOG_ERR, "%s: Tx - lost interrupt\n",
- sc->sc_if.if_xname);
- temp = sc->sc_if.if_flags & IFF_UP;
- snreset(sc);
- sc->sc_if.if_flags |= temp;
- }
-}
-/*
- * stuff packet into sonic (at splnet)
-*/
-int
-sonicput(sc, m0)
- struct sn_softc *sc;
- struct mbuf *m0;
-{
- struct sonic_reg *csr = sc->sc_csr;
- struct TXpkt *txp;
- struct mtd *mtdnew;
- struct mbuf *m;
- int len = 0, fr = 0;
- int fragoffset; /* Offset in viritual dma space for fragment */
-
- /* grab the replacement mtd */
- if ((mtdnew = mtd_alloc()) == 0)
- return (0);
-
- /* this packet goes to mdtnext fill in the TDA */
- mtdnext->mtd_mbuf = m0;
- txp = mtdnext->mtd_txp;
- SWR(txp->config, 0);
- fragoffset = (txp - p_tda) * FRAGMAX * R4030_DMA_PAGE_SIZE;
-
- /*
- * Now fill in the fragments. Each fragment maps to it's
- * own dma page. Fragments crossing a dma page boundary
- * are split up in two fragments. This is somewhat stupid
- * because the dma mapper can do the work, but it helps
- * keeping the fragments in order. (read lazy programmer).
- */
- for (m = m0; m; m = m->m_next) {
- unsigned va = (unsigned) mtod(m, caddr_t);
- int resid = m->m_len;
-
- if(resid != 0) {
- R4K_HitFlushDCache(va, resid);
- DMA_MAP(sc->dma, (caddr_t)va, resid, fragoffset);
- }
- len += resid;
-
- while (resid) {
- unsigned pa;
- unsigned n;
-
- pa = sc->dma->dma_va + (va & PGOFSET) + fragoffset;
- n = resid;
- if (n > NBPG - (va & PGOFSET)) {
- n = NBPG - (va & PGOFSET);
- }
- if (fr < FRAGMAX) {
- SWR(txp->u[fr].frag_ptrlo, LOWER(pa));
- SWR(txp->u[fr].frag_ptrhi, UPPER(pa));
- SWR(txp->u[fr].frag_size, n);
- }
- fr++;
- va += n;
- resid -= n;
- fragoffset += R4030_DMA_PAGE_SIZE;
- }
- }
- /*
- * pad out last fragment for minimum size
- */
- if (len < ETHERMIN + sizeof(struct ether_header) && fr < FRAGMAX) {
- int pad = ETHERMIN + sizeof(struct ether_header) - len;
- static char zeros[64];
- unsigned pa;
-
- DMA_MAP(sc->dma, (caddr_t)zeros, pad, fragoffset);
- pa = sc->dma->dma_va + ((unsigned)zeros & PGOFSET) + fragoffset;
- SWR(txp->u[fr].frag_ptrlo, LOWER(pa));
- SWR(txp->u[fr].frag_ptrhi, UPPER(pa));
- SWR(txp->u[fr].frag_size, pad);
- fr++;
- len = ETHERMIN + sizeof(struct ether_header);
- }
-
- DMA_START(sc->dma, (caddr_t)0, 0, 0); /* Flush dma tlb */
-
- if (fr > FRAGMAX) {
- mtd_free(mtdnew);
- m_freem(m0);
- log(LOG_ERR, "%s: tx too many fragments %d\n",
- sc->sc_if.if_xname, fr);
- sc->sc_if.if_oerrors++;
- return (len);
- }
-
- SWR(txp->frag_count, fr);
- SWR(txp->pkt_size, len);
-
- /* link onto the next mtd that will be used */
- SWR(txp->u[fr].tlink, LOWER(v_tda + (mtdnew->mtd_txp - p_tda)) | EOL);
-
- if (mtdhead == 0) {
- /* no current transmit list start with this one */
- mtdtail = mtdhead = mtdnext;
- csr->s_ctda = LOWER(v_tda + (txp - p_tda));
- } else {
- /*
- * have a transmit list append it to end note
- * mtdnext is already physicaly linked to mtdtail in
- * mtdtail->mtd_txp->u[mtdtail->mtd_txp->frag_count].tlink
- */
- SWR(mtdtail->mtd_txp->u[mtdtail->mtd_txp->frag_count].tlink,
- SRD(mtdtail->mtd_txp->u[mtdtail->mtd_txp->frag_count].tlink) & ~EOL);
- mtdtail = mtdnext;
- }
- mtdnext->mtd_link = mtdnew;
- mtdnext = mtdnew;
-
- /* make sure chip is running */
- wbflush();
- csr->s_cr = CR_TXP;
- wbflush();
- sc->sc_if.if_timer = 5; /* 5 seconds to watch for failing to transmit */
- return (len);
-}
-
-/*
- * Read out the ethernet address from the cam. It is stored
- * there by the boot when doing a loopback test. Thus we don't
- * have to fetch it from nv ram.
- */
-int
-sngetaddr(sc)
- struct sn_softc *sc;
-{
-#if 0
- int i;
-
- sc->sc_csr->s_cr = CR_RST;
- wbflush();
- sc->sc_csr->s_cep = 0;
- i = sc->sc_csr->s_cap2;
- wbflush();
- sc->sc_enaddr[5] = i >> 8;
- sc->sc_enaddr[4] = i;
- i = sc->sc_csr->s_cap1;
- wbflush();
- sc->sc_enaddr[3] = i >> 8;
- sc->sc_enaddr[2] = i;
- i = sc->sc_csr->s_cap0;
- wbflush();
- sc->sc_enaddr[1] = i >> 8;
- sc->sc_enaddr[0] = i;
-
- sc->sc_csr->s_cr = 0;
- wbflush();
-#else
- sc->sc_enaddr[0] = 0x08;
- sc->sc_enaddr[1] = 0x00;
- sc->sc_enaddr[2] = 0x20;
- sc->sc_enaddr[3] = 0xa0;
- sc->sc_enaddr[4] = 0x66;
- sc->sc_enaddr[5] = 0x54;
-#endif
- return (0);
-}
-
-void sonictxint __P((struct sn_softc *));
-void sonicrxint __P((struct sn_softc *));
-
-int sonic_read __P((struct sn_softc *, struct RXpkt *));
-struct mbuf *sonic_get __P((struct sn_softc *, struct ether_header *, int));
-
-void
-mtd_free(mtd)
- struct mtd *mtd;
-{
- mtd->mtd_link = mtdfree;
- mtdfree = mtd;
-}
-
-struct mtd *
-mtd_alloc()
-{
- struct mtd *mtd = mtdfree;
-
- if (mtd) {
- mtdfree = mtd->mtd_link;
- mtd->mtd_link = 0;
- }
- return (mtd);
-}
-
-/*
- * CAM support
- */
-void
-caminitialise()
-{
- int i;
-
- for (i = 0; i < MAXCAM; i++)
- SWR(p_cda->desc[i].cam_ep, i);
- SWR(p_cda->enable, 0);
-}
-
-void
-camentry(entry, ea)
- int entry;
- u_char *ea;
-{
- SWR(p_cda->desc[entry].cam_ep, entry);
- SWR(p_cda->desc[entry].cam_ap2, (ea[5] << 8) | ea[4]);
- SWR(p_cda->desc[entry].cam_ap1, (ea[3] << 8) | ea[2]);
- SWR(p_cda->desc[entry].cam_ap0, (ea[1] << 8) | ea[0]);
- SWR(p_cda->enable, SRD(p_cda->enable) | (1 << entry));
-}
-
-void
-camprogram(sc)
- struct sn_softc *sc;
-{
- struct sonic_reg *csr;
- int timeout;
-
- csr = sc->sc_csr;
- csr->s_cdp = LOWER(v_cda);
- csr->s_cdc = MAXCAM;
- csr->s_cr = CR_LCAM;
- wbflush();
-
- timeout = 10000;
- while (csr->s_cr & CR_LCAM && timeout--)
- continue;
- if (timeout == 0) {
- /* XXX */
- panic("sonic: CAM initialisation failed");
- }
- timeout = 10000;
- while ((csr->s_isr & ISR_LCD) == 0 && timeout--)
- continue;
-
- if (csr->s_isr & ISR_LCD)
- csr->s_isr = ISR_LCD;
- else
- printf("sonic: CAM initialisation without interrupt\n");
-}
-
-#if 0
-void
-camdump(sc)
- struct sn_softc *sc;
-{
- struct sonic_reg *csr = sc->sc_csr;
- int i;
-
- printf("CAM entries:\n");
- csr->s_cr = CR_RST;
- wbflush();
-
- for (i = 0; i < 16; i++) {
- ushort ap2, ap1, ap0;
- csr->s_cep = i;
- wbflush();
- ap2 = csr->s_cap2;
- ap1 = csr->s_cap1;
- ap0 = csr->s_cap0;
- printf("%d: ap2=0x%x ap1=0x%x ap0=0x%x\n", i, ap2, ap1, ap0);
- }
- printf("CAM enable 0x%x\n", csr->s_cep);
-
- csr->s_cr = 0;
- wbflush();
-}
-#endif
-
-void
-initialise_tda(sc)
- struct sn_softc *sc;
-{
- struct sonic_reg *csr;
- struct mtd *mtd;
- int i;
-
- csr = sc->sc_csr;
-
- mtdfree = mtdhead = mtdtail = (struct mtd *) 0;
-
- for (i = 0; i < NTDA; i++) {
- mtd = &mtda[i];
- mtd->mtd_txp = &p_tda[i];
- mtd->mtd_mbuf = (struct mbuf *) 0;
- mtd_free(mtd);
- }
- mtdnext = mtd_alloc();
-
- csr->s_utda = UPPER(v_tda);
-}
-
-void
-initialise_rda(sc)
- struct sn_softc *sc;
-{
- struct sonic_reg *csr;
- int i;
-
- csr = sc->sc_csr;
-
- /* link the RDA's together into a circular list */
- for (i = 0; i < (NRDA - 1); i++) {
- SWR(p_rda[i].rlink, LOWER(&v_rda[i + 1]));
- SWR(p_rda[i].in_use, 1);
- }
- SWR(p_rda[NRDA - 1].rlink, LOWER(&v_rda[0]) | EOL);
- SWR(p_rda[NRDA - 1].in_use, 1);
-
- /* mark end of receive descriptor list */
- sc->sc_lrxp = &p_rda[NRDA - 1];
-
- sc->sc_rxmark = 0;
-
- csr->s_urda = UPPER(&v_rda[0]);
- csr->s_crda = LOWER(&v_rda[0]);
- wbflush();
-}
-
-void
-initialise_rra(sc)
- struct sn_softc *sc;
-{
- struct sonic_reg *csr;
- int i;
-
- csr = sc->sc_csr;
-
- csr->s_eobc = RBASIZE / 2 - 2; /* must be >= MAXETHERPKT */
- csr->s_urra = UPPER(v_rra);
- csr->s_rsa = LOWER(v_rra);
- csr->s_rea = LOWER(&v_rra[NRRA]);
- csr->s_rrp = LOWER(v_rra);
- csr->s_rsc = 0;
-
- /* fill up SOME of the rra with buffers */
- for (i = 0; i < NRBA; i++) {
- SWR(p_rra[i].buff_ptrhi, UPPER(&v_rba[i * RBASIZE]));
- SWR(p_rra[i].buff_ptrlo, LOWER(&v_rba[i * RBASIZE]));
- SWR(p_rra[i].buff_wchi, UPPER(RBASIZE / 2));
- SWR(p_rra[i].buff_wclo, LOWER(RBASIZE / 2));
- }
- sc->sc_rramark = NRBA;
- csr->s_rwp = LOWER(&v_rra[sc->sc_rramark]);
- wbflush();
-}
-
-int
-snintr(sc)
- struct sn_softc *sc;
-{
- struct sonic_reg *csr = sc->sc_csr;
- int isr;
-
- while ((isr = (csr->s_isr & ISR_ALL))) {
- /* scrub the interrupts that we are going to service */
- csr->s_isr = isr;
- wbflush();
-
- if (isr & (ISR_BR | ISR_LCD | ISR_PINT | ISR_TC))
- printf("sonic: unexpected interrupt status 0x%x\n", isr);
-
- if (isr & (ISR_TXDN | ISR_TXER))
- sonictxint(sc);
-
- if (isr & ISR_PKTRX)
- sonicrxint(sc);
-
- if (isr & (ISR_HBL | ISR_RDE | ISR_RBE | ISR_RBAE | ISR_RFO)) {
- if (isr & ISR_HBL)
- printf("sonic: no heartbeat\n");
- if (isr & ISR_RDE)
- printf("sonic: receive descriptors exhausted\n");
- if (isr & ISR_RBE)
- printf("sonic: receive buffers exhausted\n");
- if (isr & ISR_RBAE)
- printf("sonic: receive buffer area exhausted\n");
- if (isr & ISR_RFO)
- printf("sonic: receive FIFO overrun\n");
- }
- if (isr & (ISR_CRC | ISR_FAE | ISR_MP)) {
-#ifdef notdef
- if (isr & ISR_CRC)
- sc->sc_crctally++;
- if (isr & ISR_FAE)
- sc->sc_faetally++;
- if (isr & ISR_MP)
- sc->sc_mptally++;
-#endif
- }
- }
- return (1);
-}
-
-/*
- * Transmit interrupt routine
- */
-void
-sonictxint(sc)
- struct sn_softc *sc;
-{
- struct TXpkt *txp;
- struct sonic_reg *csr;
- struct mtd *mtd;
-
- if (mtdhead == (struct mtd *) 0)
- return;
-
- csr = sc->sc_csr;
-
- while ((mtd = mtdhead)) {
- struct mbuf *m = mtd->mtd_mbuf;
-
- if (m == 0)
- break;
-
- txp = mtd->mtd_txp;
-
- if (SRD(txp->status) == 0) /* it hasn't really gone yet */
- return;
-
- if (ethdebug) {
- struct ether_header *eh = mtod(m, struct ether_header *);
- printf("xmit status=0x%x len=%d type=0x%x from %s",
- txp->status,
- txp->pkt_size,
- htons(eh->ether_type),
- ether_sprintf(eh->ether_shost));
- printf(" (to %s)\n", ether_sprintf(eh->ether_dhost));
- }
- m_freem(m);
- mtd->mtd_mbuf = 0;
- mtdhead = mtd->mtd_link;
-
- mtd_free(mtd);
-
- if ((SRD(txp->status) & TCR_PTX) == 0) {
- if (mtdhead != mtdnext) {
- csr->s_ctda = LOWER(v_tda + (mtdhead->mtd_txp - p_tda));
- csr->s_cr = CR_TXP;
- wbflush();
- return;
- }
- }
- }
- /* mtdhead should be at mtdnext (go) */
- assert(mtdhead == mtdnext);
- assert(mtdhead->mtd_link == 0);
- mtdhead = 0;
-
- /* and start feeding any queued packets to chip */
- while (1) {
- struct mbuf *m;
-
- IF_DEQUEUE(&sc->sc_if.if_snd, m);
- if (m == 0) /* nothing left to send */
- break;
- if (!sonicput(sc, m)) { /* not enough space */
- IF_PREPEND(&sc->sc_if.if_snd, m);
- break;
- }
- }
-}
-
-/*
- * Receive interrupt routine
- */
-void
-sonicrxint(sc)
- struct sn_softc *sc;
-{
- struct sonic_reg *csr = sc->sc_csr;
- struct RXpkt *rxp;
- int orra;
-
- rxp = &p_rda[sc->sc_rxmark];
-
- while (SRD(rxp->in_use) == 0) {
- unsigned status = SRD(rxp->status);
- if ((status & RCR_LPKT) == 0)
- printf("sonic: more than one packet in RBA!\n");
- assert(PSNSEQ(SRD(rxp->seq_no)) == 0);
-
- if (status & RCR_PRX) {
- if (sonic_read(sc, rxp)) {
- sc->sc_if.if_ipackets++;
- sc->sc_sum.ls_ipacks++;
- sc->sc_missed = 0;
- }
- } else
- sc->sc_if.if_ierrors++;
-
- /*
- * give receive buffer area back to chip XXX what buffer
- * did the sonic use for this descriptor answer look at
- * the rba sequence number !!
- */
- orra = RBASEQ(SRD(rxp->seq_no)) & RRAMASK;
-
- assert(SRD(rxp->pkt_ptrhi) == SRD(p_rra[orra].buff_ptrhi));
- assert(SRD(rxp->pkt_ptrlo) == SRD(p_rra[orra].buff_ptrlo));
-if(SRD(rxp->pkt_ptrlo) != SRD(p_rra[orra].buff_ptrlo))
-printf("%x,%x\n",SRD(rxp->pkt_ptrlo),SRD(p_rra[orra].buff_ptrlo));
- assert(SRD(p_rra[orra].buff_wclo));
-
- /*
- * orra is now empty of packets and can be freed if
- * sonic read didnt copy it out then we would have to
- * wait !!
- * (dont bother add it back in again straight away)
- */
- p_rra[sc->sc_rramark] = p_rra[orra];
-
- /* zap old rra for fun */
- p_rra[orra].buff_wchi = 0;
- p_rra[orra].buff_wclo = 0;
-
- sc->sc_rramark = (sc->sc_rramark + 1) & RRAMASK;
- csr->s_rwp = LOWER(&v_rra[sc->sc_rramark]);
- wbflush();
-
- /*
- * give recieve descriptor back to chip simple
- * list is circular
- */
- SWR(rxp->in_use, 1);
- SWR(rxp->rlink, SRD(rxp->rlink) | EOL);
- SWR(sc->sc_lrxp->rlink, SRD(sc->sc_lrxp->rlink) & ~EOL);
- sc->sc_lrxp = rxp;
-
- if (++sc->sc_rxmark >= NRDA)
- sc->sc_rxmark = 0;
- rxp = &p_rda[sc->sc_rxmark];
- }
-}
-
-/*
- * sonic_read -- pull packet off interface and forward to
- * appropriate protocol handler
- */
-int
-sonic_read(sc, rxp)
- struct sn_softc *sc;
- struct RXpkt *rxp;
-{
- struct ifnet *ifp = &sc->sc_if;
- /*extern char *ether_sprintf();*/
- struct ether_header *et;
- struct mbuf *m;
- int len;
- caddr_t pkt;
-
- /*
- * Get input data length.
- * Get pointer to ethernet header (in input buffer).
- * Deal with trailer protocol: if type is PUP trailer
- * get true type from first 16-bit word past data.
- * Remember that type was trailer by setting off.
- */
-
- len = SRD(rxp->byte_count) - sizeof(struct ether_header) - FCSSIZE;
- pkt = (caddr_t)((SRD(rxp->pkt_ptrhi) << 16) | SRD(rxp->pkt_ptrlo));
- pkt = pkt - v_rba + p_rba;
- et = (struct ether_header *)pkt;
-
- if (ethdebug) {
- printf("rcvd 0x%x status=0x%x, len=%d type=0x%x from %s",
- et, rxp->status, len, htons(et->ether_type),
- ether_sprintf(et->ether_shost));
- printf(" (to %s)\n", ether_sprintf(et->ether_dhost));
- }
- if (len < ETHERMIN || len > ETHERMTU) {
- printf("sonic: invalid packet length %d bytes\n", len);
- return (0);
- }
-
-#if NBPFILTER > 0
- /*
- * Check if there's a bpf filter listening on this interface.
- * If so, hand off the raw packet to enet, then discard things
- * not destined for us (but be sure to keep broadcast/multicast).
- */
- if (sc->sc_if.if_bpf)
- bpf_tap(sc->sc_if.if_bpf, pkt,
- len + sizeof(struct ether_header));
-#endif
- m = sonic_get(sc, et, len);
- if (m == NULL)
- return (0);
- ether_input(ifp, et, m);
- return(1);
-}
-
-#define sonicdataaddr(eh, off, type) ((type)(((caddr_t)((eh)+1)+(off))))
-
-/*
- * munge the received packet into a mbuf chain
- * because we are using stupid buffer management this
- * is slow.
-*/
-struct mbuf *
-sonic_get(sc, eh, datalen)
- struct sn_softc *sc;
- struct ether_header *eh;
- int datalen;
-{
- struct mbuf *m;
- struct mbuf *top = 0, **mp = &top;
- int len;
- char *spkt = sonicdataaddr(eh, 0, caddr_t);
- char *epkt = spkt + datalen;
- char *cp = spkt;
-
- epkt = cp + datalen;
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (m == 0)
- return (0);
- m->m_pkthdr.rcvif = &sc->sc_if;
- m->m_pkthdr.len = datalen;
- m->m_len = MHLEN;
-
- while (datalen > 0) {
- if (top) {
- MGET(m, M_DONTWAIT, MT_DATA);
- if (m == 0) {
- m_freem(top);
- return (0);
- }
- m->m_len = MLEN;
- }
- len = min(datalen, epkt - cp);
- if (len >= MINCLSIZE) {
- MCLGET(m, M_DONTWAIT);
- if (m->m_flags & M_EXT)
- m->m_len = len = min(len, MCLBYTES);
- else
- len = m->m_len;
- } else {
- /*
- * Place initial small packet/header at end of mbuf.
- */
- if (len < m->m_len) {
- if (top == 0 && len + max_linkhdr <= m->m_len)
- m->m_data += max_linkhdr;
- m->m_len = len;
- } else
- len = m->m_len;
- }
- bcopy(cp, mtod(m, caddr_t), (unsigned) len);
- cp += len;
- *mp = m;
- mp = &m->m_next;
- datalen -= len;
- if (cp == epkt)
- cp = spkt;
- }
- return (top);
-}
diff --git a/sys/arch/arc/dev/if_sn.h b/sys/arch/arc/dev/if_sn.h
deleted file mode 100644
index 8ec2a930ebf..00000000000
--- a/sys/arch/arc/dev/if_sn.h
+++ /dev/null
@@ -1,347 +0,0 @@
-/* $OpenBSD: if_sn.h,v 1.1.1.1 1996/06/24 09:07:19 pefo Exp $ */
-/*
- * Copyright (c) 1991 Algorithmics Ltd (http://www.algor.co.uk)
- * You may use, copy, and modify this program so long as you retain the
- * copyright line.
- */
-
-/*
- * if_sonic.h -- National Semiconductor DP83932BVF (SONIC)
- */
-
-/*
- * Accessing SONIC data structures and registers as 32 bit values
- * makes code endianess independent. The SONIC is however always in
- * bigendian mode so it is necessary to ensure that data structures shared
- * between the CPU and the SONIC are always in bigendian order.
- */
-
-/*
- * Receive Resource Descriptor
- * This structure describes the buffers into which packets
- * will be received. Note that more than one packet may be
- * packed into a single buffer if constraints permit.
- */
-#if SONICDW == 32
-struct RXrsrc {
- u_long buff_ptrlo; /* buffer address LO */
- u_long buff_ptrhi; /* buffer address HI */
- u_long buff_wclo; /* buffer size (16bit words) LO */
- u_long buff_wchi; /* buffer size (16bit words) HI */
-};
-#endif
-
-/*
- * Receive Descriptor
- * This structure holds information about packets received.
- */
-#if SONICDW == 32
-struct RXpkt {
- u_long status; /* + receive status */
- u_long byte_count; /* + packet byte count (including FCS) */
- u_long pkt_ptrlo; /* + packet data LO (in RBA) */
- u_long pkt_ptrhi; /* + packet data HI (in RBA) */
- u_long seq_no; /* + RBA sequence numbers */
- u_long rlink; /* link to next receive descriptor */
- u_long in_use; /* + packet available to SONIC */
- u_long pad; /* pad to multiple of 16 bytes */
-};
-#endif
-#define RBASEQ(x) (((x)>>8)&0xff)
-#define PSNSEQ(x) ((x) & 0xff)
-
-/*
- * Transmit Descriptor
- * This structure holds information about packets to be transmitted.
- */
-#define FRAGMAX 31 /* maximum number of fragments in a packet */
-#if SONICDW == 32
-struct TXpkt {
- u_long status; /* + transmitted packet status */
- u_long config; /* transmission configuration */
- u_long pkt_size; /* entire packet size in bytes */
- u_long frag_count; /* # fragments in packet */
- union {
- struct {
- u_long _frag_ptrlo; /* pointer to packet fragment LO */
- u_long _frag_ptrhi; /* pointer to packet fragment HI */
- u_long _frag_size; /* fragment size */
- } u_frag;
- struct {
- u_long _tlink; /* link to next transmit descriptor */
- } u_link;
- } u[FRAGMAX+1]; /* +1 makes tcp->u[FRAGMAX].u_link.link valid! */
-};
-#endif
-
-#define frag_ptrlo u_frag._frag_ptrlo
-#define frag_ptrhi u_frag._frag_ptrhi
-#define frag_size u_frag._frag_size
-#define tlink u_link._tlink
-
-#define EOL 0x0001 /* end of list marker for link fields */
-
-#define MAXCAM 16 /* number of user entries in CAM */
-#if SONICDW == 32
-struct CDA {
- struct {
- u_long cam_ep; /* CAM Entry Pointer */
- u_long cam_ap0; /* CAM Address Port 0 xx-xx-xx-xx-YY-YY */
- u_long cam_ap1; /* CAM Address Port 1 xx-xx-YY-YY-xxxx */
- u_long cam_ap2; /* CAM Address Port 2 YY-YY-xx-xx-xx-xx */
- } desc[MAXCAM];
- u_long enable; /* mask enabling CAM entries */
-};
-#endif
-
-/*
- * SONIC registers as seen by the processor
- */
-struct sonic_reg {
- volatile u_long s_cr; /* 00: Command */
- volatile u_long s_dcr; /* 01: Data Configuration */
- volatile u_long s_rcr; /* 02: Receive Control */
- volatile u_long s_tcr; /* 03: Transmit Control */
- volatile u_long s_imr; /* 04: Interrupt Mask */
- volatile u_long s_isr; /* 05: Interrupt Status */
- volatile u_long s_utda; /* 06: Upper Transmit Descriptor Address */
- volatile u_long s_ctda; /* 07: Current Transmit Descriptor Address */
- volatile u_long _s_tps; /* 08* Transmit Packet Size */
- volatile u_long _s_tfc; /* 09* Transmit Fragment Count */
- volatile u_long _s_tsa0; /* 0a* Transmit Start Address 0 */
- volatile u_long _s_tsa1; /* 0b* Transmit Start Address 1 */
- volatile u_long _s_tfs; /* 0c* Transmit Fragment Size */
- volatile u_long s_urda; /* 0d: Upper Receive Descriptor Address */
- volatile u_long s_crda; /* 0e: Current Receive Descriptor Address */
- volatile u_long _s_crba0; /* 0f* Current Receive Buffer Address 0 */
- volatile u_long _s_crba1; /* 10* Current Receive Buffer Address 1 */
- volatile u_long _s_rbwc0; /* 11* Remaining Buffer Word Count 0 */
- volatile u_long _s_rbwc1; /* 12* Remaining Buffer Word Count 1 */
- volatile u_long s_eobc; /* 13: End Of Buffer Word Count */
- volatile u_long s_urra; /* 14: Upper Receive Resource Address */
- volatile u_long s_rsa; /* 15: Resource Start Address */
- volatile u_long s_rea; /* 16: Resource End Address */
- volatile u_long s_rrp; /* 17: Resource Read Pointer */
- volatile u_long s_rwp; /* 18: Resource Write Pointer */
- volatile u_long _s_trba0; /* 19* Temporary Receive Buffer Address 0 */
- volatile u_long _s_trba1; /* 1a* Temporary Receive Buffer Address 1 */
- volatile u_long _s_tbwc0; /* 1b* Temporary Buffer Word Count 0 */
- volatile u_long _s_tbwc1; /* 1c* Temporary Buffer Word Count 1 */
- volatile u_long _s_addr0; /* 1d* Address Generator 0 */
- volatile u_long _s_addr1; /* 1e* Address Generator 1 */
- volatile u_long _s_llfa; /* 1f* Last Link Field Address */
- volatile u_long _s_ttda; /* 20* Temp Transmit Descriptor Address */
- volatile u_long s_cep; /* 21: CAM Entry Pointer */
- volatile u_long s_cap2; /* 22: CAM Address Port 2 */
- volatile u_long s_cap1; /* 23: CAM Address Port 1 */
- volatile u_long s_cap0; /* 24: CAM Address Port 0 */
- volatile u_long s_ce; /* 25: CAM Enable */
- volatile u_long s_cdp; /* 26: CAM Descriptor Pointer */
- volatile u_long s_cdc; /* 27: CAM Descriptor Count */
- volatile u_long s_sr; /* 28: Silicon Revision */
- volatile u_long s_wt0; /* 29: Watchdog Timer 0 */
- volatile u_long s_wt1; /* 2a: Watchdog Timer 1 */
- volatile u_long s_rsc; /* 2b: Receive Sequence Counter */
- volatile u_long s_crct; /* 2c: CRC Error Tally */
- volatile u_long s_faet; /* 2d: FAE Tally */
- volatile u_long s_mpt; /* 2e: Missed Packet Tally */
- volatile u_long _s_mdt; /* 2f* Maximum Deferral Timer */
- volatile u_long _s_rtc; /* 30* Receive Test Control */
- volatile u_long _s_ttc; /* 31* Transmit Test Control */
- volatile u_long _s_dtc; /* 32* DMA Test Control */
- volatile u_long _s_cc0; /* 33* CAM Comparison 0 */
- volatile u_long _s_cc1; /* 34* CAM Comparison 1 */
- volatile u_long _s_cc2; /* 35* CAM Comparison 2 */
- volatile u_long _s_cm; /* 36* CAM Match */
- volatile u_long :32; /* 37* reserved */
- volatile u_long :32; /* 38* reserved */
- volatile u_long _s_rbc; /* 39* Receiver Byte Count */
- volatile u_long :32; /* 3a* reserved */
- volatile u_long _s_tbo; /* 3b* Transmitter Backoff Counter */
- volatile u_long _s_trc; /* 3c* Transmitter Random Counter */
- volatile u_long _s_tbm; /* 3d* Transmitter Backoff Mask */
- volatile u_long :32; /* 3e* Reserved */
- volatile u_long s_dcr2; /* 3f Data Configuration 2 (AVF) */
-};
-
-/*
- * Register Interpretations
- */
-
-/*
- * The command register is used for issuing commands to the SONIC.
- * With the exception of CR_RST, the bit is reset when the operation
- * completes.
- */
-#define CR_LCAM 0x0200 /* load CAM with descriptor at s_cdp */
-#define CR_RRRA 0x0100 /* read next RRA descriptor at s_rrp */
-#define CR_RST 0x0080 /* software reset */
-#define CR_ST 0x0020 /* start timer */
-#define CR_STP 0x0010 /* stop timer */
-#define CR_RXEN 0x0008 /* receiver enable */
-#define CR_RXDIS 0x0004 /* receiver disable */
-#define CR_TXP 0x0002 /* transmit packets */
-#define CR_HTX 0x0001 /* halt transmission */
-
-/*
- * The data configuration register establishes the SONIC's bus cycle
- * operation. This register can only be accessed when the SONIC is in
- * reset mode (s_cr.CR_RST is set.)
- */
-#define DCR_EXBUS 0x8000 /* extended bus mode (AVF) */
-#define DCR_LBR 0x2000 /* latched bus retry */
-#define DCR_PO1 0x1000 /* programmable output 1 */
-#define DCR_PO0 0x0800 /* programmable output 0 */
-#define DCR_STERM 0x0400 /* synchronous termination */
-#define DCR_USR1 0x0200 /* reflects USR1 input pin */
-#define DCR_USR0 0x0100 /* reflects USR0 input pin */
-#define DCR_WC1 0x0080 /* wait state control 1 */
-#define DCR_WC0 0x0040 /* wait state control 0 */
-#define DCR_DW 0x0020 /* data width select */
-#define DCR_BMS 0x0010 /* DMA block mode select */
-#define DCR_RFT1 0x0008 /* receive FIFO threshold control 1 */
-#define DCR_RFT0 0x0004 /* receive FIFO threshold control 0 */
-#define DCR_TFT1 0x0002 /* transmit FIFO threshold control 1 */
-#define DCR_TFT0 0x0001 /* transmit FIFO threshold control 0 */
-
-/* data configuration register aliases */
-#define DCR_SYNC DCR_STERM /* synchronous (memory cycle 2 clocks) */
-#define DCR_ASYNC 0 /* asynchronous (memory cycle 3 clocks) */
-
-#define DCR_WAIT0 0 /* 0 wait states added */
-#define DCR_WAIT1 DCR_WC0 /* 1 wait state added */
-#define DCR_WAIT2 DCR_WC1 /* 2 wait states added */
-#define DCR_WAIT3 (DCR_WC1|DCR_WC0) /* 3 wait states added */
-
-#define DCR_DW16 0 /* use 16-bit DMA accesses */
-#define DCR_DW32 DCR_DW /* use 32-bit DMA accesses */
-
-#define DCR_DMAEF 0 /* DMA until TX/RX FIFO has emptied/filled */
-#define DCR_DMABLOCK DCR_BMS /* DMA until RX/TX threshold crossed */
-
-#define DCR_RFT4 0 /* receive threshold 4 bytes */
-#define DCR_RFT8 DCR_RFT0 /* receive threshold 8 bytes */
-#define DCR_RFT16 DCR_RFT1 /* receive threshold 16 bytes */
-#define DCR_RFT24 (DCR_RFT1|DCR_RFT0) /* receive threshold 24 bytes */
-
-#define DCR_TFT8 0 /* transmit threshold 8 bytes */
-#define DCR_TFT16 DCR_TFT0 /* transmit threshold 16 bytes */
-#define DCR_TFT24 DCR_TFT1 /* transmit threshold 24 bytes */
-#define DCR_TFT28 (DCR_TFT1|DCR_TFT0) /* transmit threshold 28 bytes */
-
-/*
- * The receive control register is used to filter incoming packets and
- * provides status information on packets received.
- * The contents of the register are copied into the RXpkt.status field
- * when a packet is received. RCR_MC - RCR_PRX are then reset.
- */
-#define RCR_ERR 0x8000 /* accept packets with CRC errors */
-#define RCR_RNT 0x4000 /* accept runt (length < 64) packets */
-#define RCR_BRD 0x2000 /* accept broadcast packets */
-#define RCR_PRO 0x1000 /* accept all physical address packets */
-#define RCR_AMC 0x0800 /* accept all multicast packets */
-#define RCR_LB1 0x0400 /* loopback control 1 */
-#define RCR_LB0 0x0200 /* loopback control 0 */
-#define RCR_MC 0x0100 /* multicast packet received */
-#define RCR_BC 0x0080 /* broadcast packet received */
-#define RCR_LPKT 0x0040 /* last packet in RBA (RBWC < EOBC) */
-#define RCR_CRS 0x0020 /* carrier sense activity */
-#define RCR_COL 0x0010 /* collision activity */
-#define RCR_CRC 0x0008 /* CRC error */
-#define RCR_FAE 0x0004 /* frame alignment error */
-#define RCR_LBK 0x0002 /* loopback packet received */
-#define RCR_PRX 0x0001 /* packet received without errors */
-
-/* receiver control register aliases */
-/* the loopback control bits provide the following options */
-#define RCR_LBNONE 0 /* no loopback - normal operation */
-#define RCR_LBMAC RCR_LB0 /* MAC loopback */
-#define RCR_LBENDEC RCR_LB1 /* ENDEC loopback */
-#define RCR_LBTRANS (RCR_LB1|RCR_LB0) /* transceiver loopback */
-
-/*
- * The transmit control register controls the SONIC's transmit operations.
- * TCR_PINT - TCR_EXDIS are loaded from the TXpkt.config field at the
- * start of transmission. TCR_EXD-TCR_PTX are cleared at the beginning
- * of transmission and updated when the transmission is completed.
- */
-#define TCR_PINT 0x8000 /* interrupt when transmission starts */
-#define TCR_POWC 0x4000 /* program out of window collision timer */
-#define TCR_CRCI 0x2000 /* transmit packet without 4 byte FCS */
-#define TCR_EXDIS 0x1000 /* disable excessive deferral timer */
-#define TCR_EXD 0x0400 /* excessive deferrals occurred (>3.2ms) */
-#define TCR_DEF 0x0200 /* deferred transmissions occurred */
-#define TCR_NCRS 0x0100 /* carrier not present during transmission */
-#define TCR_CRSL 0x0080 /* carrier lost during transmission */
-#define TCR_EXC 0x0040 /* excessive collisions (>16) detected */
-#define TCR_OWC 0x0020 /* out of window (bad) collision occurred */
-#define TCR_PMB 0x0008 /* packet monitored bad - the tansmitted
- * packet had a bad source address or CRC */
-#define TCR_FU 0x0004 /* FIFO underrun (memory access failed) */
-#define TCR_BCM 0x0002 /* byte count mismatch (TXpkt.pkt_size
- * != sum(TXpkt.frag_size) */
-#define TCR_PTX 0x0001 /* packet transmitted without errors */
-
-/* transmit control register aliases */
-#define TCR_OWCSFD 0 /* start after start of frame delimiter */
-#define TCR_OWCPRE TCR_POWC /* start after first bit of preamble */
-
-
-/*
- * The interrupt mask register masks the interrupts that
- * are generated from the interrupt status register.
- * All reserved bits should be written with 0.
- */
-#define IMR_BREN 0x4000 /* bus retry occurred enable */
-#define IMR_HBLEN 0x2000 /* heartbeat lost enable */
-#define IMR_LCDEN 0x1000 /* load CAM done interrupt enable */
-#define IMR_PINTEN 0x0800 /* programmable interrupt enable */
-#define IMR_PRXEN 0x0400 /* packet received enable */
-#define IMR_PTXEN 0x0200 /* packet transmitted enable */
-#define IMR_TXEREN 0x0100 /* transmit error enable */
-#define IMR_TCEN 0x0080 /* timer complete enable */
-#define IMR_RDEEN 0x0040 /* receive descriptors exhausted enable */
-#define IMR_RBEEN 0x0020 /* receive buffers exhausted enable */
-#define IMR_RBAEEN 0x0010 /* receive buffer area exceeded enable */
-#define IMR_CRCEN 0x0008 /* CRC tally counter rollover enable */
-#define IMR_FAEEN 0x0004 /* FAE tally counter rollover enable */
-#define IMR_MPEN 0x0002 /* MP tally counter rollover enable */
-#define IMR_RFOEN 0x0001 /* receive FIFO overrun enable */
-
-
-/*
- * The interrupt status register indicates the source of an interrupt when
- * the INT pin goes active. The interrupt is acknowledged by writing
- * the appropriate bit(s) in this register.
- */
-#define ISR_ALL 0xffff /* all interrupts */
-#define ISR_BR 0x4000 /* bus retry occurred */
-#define ISR_HBL 0x2000 /* CD heartbeat lost */
-#define ISR_LCD 0x1000 /* load CAM command has completed */
-#define ISR_PINT 0x0800 /* programmed interrupt from TXpkt.config */
-#define ISR_PKTRX 0x0400 /* packet received */
-#define ISR_TXDN 0x0200 /* no remaining packets to be transmitted */
-#define ISR_TXER 0x0100 /* packet transmission caused error */
-#define ISR_TC 0x0080 /* timer complete */
-#define ISR_RDE 0x0040 /* receive descriptors exhausted */
-#define ISR_RBE 0x0020 /* receive buffers exhausted */
-#define ISR_RBAE 0x0010 /* receive buffer area exceeded */
-#define ISR_CRC 0x0008 /* CRC tally counter rollover */
-#define ISR_FAE 0x0004 /* FAE tally counter rollover */
-#define ISR_MP 0x0002 /* MP tally counter rollover */
-#define ISR_RFO 0x0001 /* receive FIFO overrun */
-
-/*
- * The second data configuration register allows additional user defined
- * pins to be controlled. These bits are only available if s_dcr.DCR_EXBUS
- * is set.
- */
-#define DCR2_EXPO3 0x8000 /* EXUSR3 output */
-#define DCR2_EXPO2 0x4000 /* EXUSR2 output */
-#define DCR2_EXPO1 0x2000 /* EXUSR1 output */
-#define DCR2_EXPO0 0x1000 /* EXUSR0 output */
-#define DCR2_PHL 0x0010 /* extend HOLD signal by 1/2 clock */
-#define DCR2_LRDY 0x0008 /* set latched ready mode */
-#define DCR2_PCM 0x0004 /* packet compress on match */
-#define DCR2_PCNM 0x0002 /* packet compress on mismatch */
-#define DCR2_RJM 0x0001 /* reject on match */
diff --git a/sys/arch/arc/dev/lpt_lbus.c b/sys/arch/arc/dev/lpt_lbus.c
deleted file mode 100644
index e793fe28941..00000000000
--- a/sys/arch/arc/dev/lpt_lbus.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/* $OpenBSD: lpt_lbus.c,v 1.4 2000/07/21 17:41:05 mickey Exp $ */
-
-/*
- * Copyright (c) 1993, 1994 Charles Hannum.
- * Copyright (c) 1990 William F. Jolitz, TeleMuse
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This software is a component of "386BSD" developed by
- * William F. Jolitz, TeleMuse.
- * 4. Neither the name of the developer nor the name "386BSD"
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS A COMPONENT OF 386BSD DEVELOPED BY WILLIAM F. JOLITZ
- * AND IS INTENDED FOR RESEARCH AND EDUCATIONAL PURPOSES ONLY. THIS
- * SOFTWARE SHOULD NOT BE CONSIDERED TO BE A COMMERCIAL PRODUCT.
- * THE DEVELOPER URGES THAT USERS WHO REQUIRE A COMMERCIAL PRODUCT
- * NOT MAKE USE OF THIS WORK.
- *
- * FOR USERS WHO WISH TO UNDERSTAND THE 386BSD SYSTEM DEVELOPED
- * BY WILLIAM F. JOLITZ, WE RECOMMEND THE USER STUDY WRITTEN
- * REFERENCES SUCH AS THE "PORTING UNIX TO THE 386" SERIES
- * (BEGINNING JANUARY 1991 "DR. DOBBS JOURNAL", USA AND BEGINNING
- * JUNE 1991 "UNIX MAGAZIN", GERMANY) BY WILLIAM F. JOLITZ AND
- * LYNNE GREER JOLITZ, AS WELL AS OTHER BOOKS ON UNIX AND THE
- * ON-LINE 386BSD USER MANUAL BEFORE USE. A BOOK DISCUSSING THE INTERNALS
- * OF 386BSD ENTITLED "386BSD FROM THE INSIDE OUT" WILL BE AVAILABLE LATE 1992.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE DEVELOPER BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Device Driver for AT parallel printer port
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/intr.h>
-
-#include <dev/ic/lptreg.h>
-#include <dev/ic/lptvar.h>
-
-int lpt_localbus_probe __P((struct device *, void *, void *));
-void lpt_localbus_attach __P((struct device *, struct device *, void *));
-
-struct cfattach lpt_pica_ca = {
- sizeof(struct lpt_softc), lpt_localbus_probe, lpt_localbus_attach
-};
-
-struct cfattach lpt_algor_ca = {
- sizeof(struct lpt_softc), lpt_localbus_probe, lpt_localbus_attach
-};
-
-int
-lpt_localbus_probe(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct confargs *ca = aux;
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- bus_addr_t base;
- u_int8_t mask, data;
- int i;
-
-#ifdef DEBUG
-#define ABORT \
- do { \
- printf("lpt_localbus_probe: mask %x data %x failed\n", mask, \
- data); \
- return 0; \
- } while (0)
-#else
-#define ABORT return 0
-#endif
-
- if(!BUS_MATCHNAME(ca, "lpt"))
- return(0);
-
- iot = &arc_bus_io;
- base = (bus_addr_t)BUS_CVTADDR(ca);
- ioh = (bus_space_handle_t)base;
-
- mask = 0xff;
-
- data = 0x55; /* Alternating zeros */
- if (!lpt_port_test(iot, ioh, base, lpt_data, data, mask))
- ABORT;
-
- data = 0xaa; /* Alternating ones */
- if (!lpt_port_test(iot, ioh, base, lpt_data, data, mask))
- ABORT;
-
- for (i = 0; i < CHAR_BIT; i++) { /* Walking zero */
- data = ~(1 << i);
- if (!lpt_port_test(iot, ioh, base, lpt_data, data, mask))
- ABORT;
- }
-
- for (i = 0; i < CHAR_BIT; i++) { /* Walking one */
- data = (1 << i);
- if (!lpt_port_test(iot, ioh, base, lpt_data, data, mask))
- ABORT;
- }
-
- bus_space_write_1(iot, ioh, lpt_data, 0);
- bus_space_write_1(iot, ioh, lpt_control, 0);
-
- return 1;
-}
-
-void
-lpt_localbus_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct lpt_softc *sc = (void *)self;
- struct confargs *ca = aux;
-
- sc->sc_state = 0;
- sc->sc_iot = &arc_bus_io;
- sc->sc_ioh = (bus_space_handle_t)BUS_CVTADDR(ca);
-
- lpt_attach_common(sc);
-
- BUS_INTR_ESTABLISH(ca, lptintr, sc);
-}
diff --git a/sys/arch/arc/dev/pccons.c b/sys/arch/arc/dev/pccons.c
deleted file mode 100644
index bd3602450ef..00000000000
--- a/sys/arch/arc/dev/pccons.c
+++ /dev/null
@@ -1,2409 +0,0 @@
-/* $OpenBSD: pccons.c,v 1.24 2000/07/19 13:45:09 art Exp $ */
-/* $NetBSD: pccons.c,v 1.89 1995/05/04 19:35:20 cgd Exp $ */
-
-/*-
- * Copyright (c) 1993, 1994, 1995 Charles Hannum. All rights reserved.
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz and Don Ahn.
- *
- * Copyright (c) 1994 Charles Hannum.
- * Copyright (c) 1992, 1993 Erik Forsberg.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pccons.c 5.11 (Berkeley) 5/21/91
- */
-
-/*
- * code to work keyboard & display for PC-style console
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/select.h>
-#include <sys/tty.h>
-#include <sys/uio.h>
-#include <sys/syslog.h>
-#include <sys/device.h>
-#include <sys/conf.h>
-#include <sys/vnode.h>
-#include <sys/fcntl.h>
-#include <sys/kernel.h>
-#ifdef DDB
-#include <ddb/db_var.h>
-#endif
-
-#include <dev/cons.h>
-
-#include <machine/cpu.h>
-#include <machine/pio.h>
-#include <machine/bus.h>
-#include <machine/autoconf.h>
-#include <machine/display.h>
-#include <machine/pccons.h>
-
-#include <mips/archtype.h>
-#include <arch/mips/mips/arcbios.h>
-
-#include <arc/pica/pica.h>
-#include <arc/dti/desktech.h>
-
-#include <dev/isa/isavar.h>
-#include <arc/isa/isa_machdep.h>
-#include <machine/kbdreg.h>
-
-#define XFREE86_BUG_COMPAT
-
-#ifndef BEEP_FREQ
-#define BEEP_FREQ 1600
-#endif
-#ifndef BEEP_TIME
-#define BEEP_TIME (hz/5)
-#endif
-
-#define PCBURST 128
-
-static u_short *Crtat; /* pointer to backing store */
-static u_short *crtat; /* pointer to current char */
-static u_char async, kernel, polling; /* Really, you don't want to know. */
-static u_char lock_state = 0x00, /* all off */
- old_lock_state = 0xff,
- typematic_rate = 0xff, /* don't update until set by user */
- old_typematic_rate = 0xff;
-static u_short cursor_shape = 0xffff, /* don't update until set by user */
- old_cursor_shape = 0xffff;
-static pccons_keymap_t scan_codes[KB_NUM_KEYS];/* keyboard translation table */
-int pc_xmode = 0;
-
-cdev_decl(pc);
-
-/*
- * Keyboard output queue.
- */
-int kb_oq_put = 0;
-int kb_oq_get = 0;
-u_char kb_oq[8];
-
-#define PCUNIT(x) (minor(x))
-
-static struct video_state {
- int cx, cy; /* escape parameters */
- int row, col; /* current cursor position */
- int nrow, ncol, nchr; /* current screen geometry */
- int offset; /* Saved cursor pos */
- u_char state; /* parser state */
-#define VSS_ESCAPE 1
-#define VSS_EBRACE 2
-#define VSS_EPARAM 3
- char so; /* in standout mode? */
- char color; /* color or mono display */
- char at; /* normal attributes */
- char so_at; /* standout attributes */
-} vs;
-
-struct pc_softc {
- struct device sc_dev;
- struct tty *sc_tty;
-};
-
-struct pms_softc { /* driver status information */
- struct device sc_dev;
-
- struct clist sc_q;
- struct selinfo sc_rsel;
- u_char sc_state; /* mouse driver state */
-#define PMS_OPEN 0x01 /* device is open */
-#define PMS_ASLP 0x02 /* waiting for mouse data */
- u_char sc_flags;
-#define PMS_RAW 0x01
- u_char sc_status; /* mouse button status */
- int sc_x, sc_y; /* accumulated motion in the X,Y axis */
-};
-
-int pcprobe __P((struct device *, void *, void *));
-void pcattach __P((struct device *, struct device *, void *));
-int pcintr __P((void *));
-void pc_xmode_on __P((void));
-void pc_xmode_off __P((void));
-static u_char kbc_get8042cmd __P((void));
-static int kbc_put8042cmd __P((u_char));
-int kbc_8042sysreset __P((void));
-int kbd_cmd __P((u_char, u_char));
-static __inline int kbd_wait_output __P((void));
-static __inline int kbd_wait_input __P((void));
-static __inline void kbd_flush_input __P((void));
-void set_cursor_shape __P((void));
-void get_cursor_shape __P((void));
-void async_update __P((void));
-void do_async_update __P((u_char));;
-
-void pccnprobe __P((struct consdev *));
-void pccninit __P((struct consdev *));
-void pccnputc __P((dev_t, char c));
-int pccngetc __P((dev_t));
-void pccnpollc __P((dev_t, int));
-
-
-struct cfdriver pc_cd = {
- NULL, "pc", DV_TTY, NULL, 0
-};
-
-struct cfattach pc_pica_ca = {
- sizeof(struct pc_softc), pcprobe, pcattach
-};
-
-struct cfattach pc_isa_ca = {
- sizeof(struct pc_softc), pcprobe, pcattach
-};
-int pmsprobe __P((struct device *, void *, void *));
-void pmsattach __P((struct device *, struct device *, void *));
-int pmsintr __P((void *));
-
-struct cfattach pms_ca = {
- sizeof(struct pms_softc), pmsprobe, pmsattach
-};
-struct cfdriver pms_cd = {
- NULL, "pms", DV_TTY, NULL, 0
-};
-
-#define PMSUNIT(dev) (minor(dev) / 2)
-#define PMSTYPE(dev) (minor(dev) % 2)
-
-#define CHR 2
-
-static unsigned int addr_6845;
-static unsigned int mono_base = 0x3b4;
-static unsigned int mono_buf = 0xb0000;
-static unsigned int cga_base = 0x3d4;
-static unsigned int cga_buf = 0xb8000;
-static unsigned int kbd_cmdp = 0x64;
-static unsigned int kbd_datap = 0x60;
-
-char *sget __P((void));
-void sput __P((u_char *, int));
-
-void pcstart __P((struct tty *));
-int pcparam __P((struct tty *, struct termios *));
-static __inline void wcopy __P((void *, void *, u_int));
-
-extern void fillw __P((int, u_int16_t *, int));
-
-#define KBD_DELAY \
- DELAY(10);
-
-/*
- * bcopy variant that only moves word-aligned 16-bit entities,
- * for stupid VGA cards. cnt is required to be an even vale.
- */
-static __inline void
-wcopy(src, tgt, cnt)
- void *src, *tgt;
- u_int cnt;
-{
- u_int16_t *from = src;
- u_int16_t *to = tgt;
-
- cnt >>= 1;
- if (to < from || to >= from + cnt)
- while(cnt--)
- *to++ = *from++;
- else {
- to += cnt;
- from += cnt;
- while(cnt--)
- *--to = *--from;
- }
-}
-
-static __inline int
-kbd_wait_output()
-{
- u_int i;
-
- for (i = 100000; i; i--)
- if ((inb(kbd_cmdp) & KBS_IBF) == 0) {
- KBD_DELAY;
- return 1;
- }
- return 0;
-}
-
-static __inline int
-kbd_wait_input()
-{
- u_int i;
-
- for (i = 100000; i; i--)
- if ((inb(kbd_cmdp) & KBS_DIB) != 0) {
- KBD_DELAY;
- return 1;
- }
- return 0;
-}
-
-static __inline void
-kbd_flush_input()
-{
- u_char c;
-
- while ((c = inb(kbd_cmdp)) & 0x03)
- if ((c & KBS_DIB) == KBS_DIB) {
- /* XXX - delay is needed to prevent some keyboards from
- wedging when the system boots */
- delay(6);
- (void) inb(kbd_datap);
- }
-}
-
-
-
-/*
- * Pass system reset command to keyboard controller (8042).
- */
-int
-kbc_8042sysreset()
-{
-
- if (!kbd_wait_output())
- return 0;
- outb(kbd_cmdp, 0xd1);
- if (!kbd_wait_output())
- return 0;
- outb(kbd_datap, 0); /* ZAP */
- return 1;
-}
-
-#if 1
-/*
- * Get the current command byte.
- */
-static u_char
-kbc_get8042cmd()
-{
-
- if (!kbd_wait_output())
- return -1;
- outb(kbd_cmdp, K_RDCMDBYTE);
- if (!kbd_wait_input())
- return -1;
- return inb(kbd_datap);
-}
-#endif
-
-/*
- * Pass command byte to keyboard controller (8042).
- */
-static int
-kbc_put8042cmd(val)
- u_char val;
-{
-
- if (!kbd_wait_output())
- return 0;
- outb(kbd_cmdp, K_LDCMDBYTE);
- if (!kbd_wait_output())
- return 0;
- outb(kbd_datap, val);
- return 1;
-}
-
-/*
- * Pass command to keyboard itself
- */
-int
-kbd_cmd(val, polling)
- u_char val;
- u_char polling;
-{
- u_int retries = 3;
- register u_int i;
-
- if(!polling) {
- i = spltty();
- if(kb_oq_get == kb_oq_put) {
- outb(kbd_datap, val);
- }
- kb_oq[kb_oq_put] = val;
- kb_oq_put = (kb_oq_put + 1) & 7;
- splx(i);
- return(1);
- }
- else do {
- if (!kbd_wait_output())
- return 0;
- outb(kbd_datap, val);
- for (i = 100000; i; i--) {
- if (inb(kbd_cmdp) & KBS_DIB) {
- register u_char c;
-
- KBD_DELAY;
- c = inb(kbd_datap);
- if (c == KBR_ACK || c == KBR_ECHO) {
- return 1;
- }
- if (c == KBR_RESEND) {
- break;
- }
-#ifdef DIAGNOSTIC
- printf("kbd_cmd: input char %x lost\n", c);
-#endif
- }
- }
- } while (--retries);
- return 0;
-}
-
-void
-set_cursor_shape()
-{
- register int iobase = addr_6845;
-
- outb(iobase, 10);
- outb(iobase+1, cursor_shape >> 8);
- outb(iobase, 11);
- outb(iobase+1, cursor_shape);
- old_cursor_shape = cursor_shape;
-}
-
-void
-get_cursor_shape()
-{
- register int iobase = addr_6845;
-
- outb(iobase, 10);
- cursor_shape = inb(iobase+1) << 8;
- outb(iobase, 11);
- cursor_shape |= inb(iobase+1);
-
- /*
- * real 6845's, as found on, MDA, Hercules or CGA cards, do
- * not support reading the cursor shape registers. the 6845
- * tri-states it's data bus. This is _normally_ read by the
- * cpu as either 0x00 or 0xff.. in which case we just use
- * a line cursor.
- */
- if (cursor_shape == 0x0000 || cursor_shape == 0xffff)
- cursor_shape = 0x0b10;
- else
- cursor_shape &= 0x1f1f;
-}
-
-void
-do_async_update(poll)
- u_char poll;
-{
- int pos;
- static int old_pos = -1;
-
- async = 0;
-
- if (lock_state != old_lock_state) {
- old_lock_state = lock_state;
- if (!kbd_cmd(KBC_MODEIND, poll) ||
- !kbd_cmd(lock_state, poll)) {
- printf("pc: timeout updating leds\n");
- (void) kbd_cmd(KBC_ENABLE, poll);
- }
- }
- if (typematic_rate != old_typematic_rate) {
- old_typematic_rate = typematic_rate;
- if (!kbd_cmd(KBC_TYPEMATIC, poll) ||
- !kbd_cmd(typematic_rate, poll)) {
- printf("pc: timeout updating typematic rate\n");
- (void) kbd_cmd(KBC_ENABLE, poll);
- }
- }
-
- if (pc_xmode > 0)
- return;
-
- pos = crtat - Crtat;
- if (pos != old_pos) {
- register int iobase = addr_6845;
- outb(iobase, 14);
- outb(iobase+1, pos >> 8);
- outb(iobase, 15);
- outb(iobase+1, pos);
- old_pos = pos;
- }
- if (cursor_shape != old_cursor_shape)
- set_cursor_shape();
-}
-
-void
-async_update()
-{
-
- if (kernel || polling) {
- if (async)
- untimeout((void(*)(void *))do_async_update, NULL);
- do_async_update(1);
- } else {
- if (async)
- return;
- async = 1;
- timeout((void(*)(void *))do_async_update, NULL, 1);
- }
-}
-
-/*
- * these are both bad jokes
- */
-int
-pcprobe(parent, cfdata, aux)
- struct device *parent;
- void *cfdata, *aux;
-{
- struct confargs *ca = aux;
- u_int i;
-
- /* Make shure we're looking for this type of device */
- if(!strcmp((parent)->dv_cfdata->cf_driver->cd_name, "pica")) {
- if(!BUS_MATCHNAME(ca, "pc"))
- return(0);
- }
-
- if(system_type == MAGNUM)
- return(0); /* Magnums have different graphics */
-
- /* Enable interrupts and keyboard, etc. */
- if (!kbc_put8042cmd(CMDBYTE)) {
- printf("pcprobe: command error\n");
- return 0;
- }
-
-#if 1
- /* Flush any garbage. */
- kbd_flush_input();
- /* Reset the keyboard. */
- if (!kbd_cmd(KBC_RESET, 1)) {
- printf("pcprobe: reset error %d\n", 1);
- goto lose;
- }
- for (i = 600000; i; i--)
- if ((inb(kbd_cmdp) & KBS_DIB) != 0) {
- KBD_DELAY;
- break;
- }
- if (i == 0 || inb(kbd_datap) != KBR_RSTDONE) {
- printf("pcprobe: reset error %d\n", 2);
- goto lose;
- }
- /*
- * Some keyboards seem to leave a second ack byte after the reset.
- * This is kind of stupid, but we account for them anyway by just
- * flushing the buffer.
- */
- kbd_flush_input();
- /* Just to be sure. */
- if (!kbd_cmd(KBC_ENABLE, 1)) {
- printf("pcprobe: reset error %d\n", 3);
- goto lose;
- }
-
- /*
- * Some keyboard/8042 combinations do not seem to work if the keyboard
- * is set to table 1; in fact, it would appear that some keyboards just
- * ignore the command altogether. So by default, we use the AT scan
- * codes and have the 8042 translate them. Unfortunately, this is
- * known to not work on some PS/2 machines. We try desparately to deal
- * with this by checking the (lack of a) translate bit in the 8042 and
- * attempting to set the keyboard to XT mode. If this all fails, well,
- * tough luck.
- *
- * XXX It would perhaps be a better choice to just use AT scan codes
- * and not bother with this.
- */
- if (kbc_get8042cmd() & KC8_TRANS) {
- /* The 8042 is translating for us; use AT codes. */
- if (!kbd_cmd(KBC_SETTABLE, 1) || !kbd_cmd(2, 1)) {
- printf("pcprobe: reset error %d\n", 4);
- goto lose;
- }
- } else {
- /* Stupid 8042; set keyboard to XT codes. */
- if (!kbd_cmd(KBC_SETTABLE, 1) || !kbd_cmd(1, 1)) {
- printf("pcprobe: reset error %d\n", 5);
- goto lose;
- }
- }
-
-lose:
- /*
- * Technically, we should probably fail the probe. But we'll be nice
- * and allow keyboard-less machines to boot with the console.
- */
-#endif
-
- return 1;
-}
-
-void
-pcattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct confargs *ca = aux;
- struct isa_attach_args *ia = aux;
- struct pc_softc *sc = (void *)self;
-
- printf(": %s\n", vs.color ? "color" : "mono");
- do_async_update(1);
-
- switch(system_type) {
- case ACER_PICA_61:
- BUS_INTR_ESTABLISH(ca, pcintr, (void *)(long)sc);
- break;
- case DESKSTATION_RPC44: /* XXX ick */
- case DESKSTATION_TYNE:
- isa_intr_establish(ia->ia_ic, ia->ia_irq, 1,
- 2, pcintr, sc, sc->sc_dev.dv_xname); /*XXX ick */
- break;
- }
-}
-
-int
-pcopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- struct pc_softc *sc;
- int unit = PCUNIT(dev);
- struct tty *tp;
-
- if (unit >= pc_cd.cd_ndevs)
- return ENXIO;
- sc = pc_cd.cd_devs[unit];
- if (sc == 0)
- return ENXIO;
-
- if (!sc->sc_tty) {
- tp = sc->sc_tty = ttymalloc();
- }
- else {
- tp = sc->sc_tty;
- }
-
- tp->t_oproc = pcstart;
- tp->t_param = pcparam;
- tp->t_dev = dev;
- if ((tp->t_state & TS_ISOPEN) == 0) {
- tp->t_state |= TS_WOPEN;
- ttychars(tp);
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- tp->t_cflag = TTYDEF_CFLAG;
- tp->t_lflag = TTYDEF_LFLAG;
- tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
- pcparam(tp, &tp->t_termios);
- ttsetwater(tp);
- } else if (tp->t_state&TS_XCLUDE && p->p_ucred->cr_uid != 0)
- return EBUSY;
- tp->t_state |= TS_CARR_ON;
-
- return ((*linesw[tp->t_line].l_open)(dev, tp));
-}
-
-int
-pcclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- struct pc_softc *sc = pc_cd.cd_devs[PCUNIT(dev)];
- struct tty *tp = sc->sc_tty;
-
- (*linesw[tp->t_line].l_close)(tp, flag);
- ttyclose(tp);
-#ifdef notyet /* XXX */
- ttyfree(tp);
-#endif
- return(0);
-}
-
-int
-pcread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- struct pc_softc *sc = pc_cd.cd_devs[PCUNIT(dev)];
- struct tty *tp = sc->sc_tty;
-
- return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
-}
-
-int
-pcwrite(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- struct pc_softc *sc = pc_cd.cd_devs[PCUNIT(dev)];
- struct tty *tp = sc->sc_tty;
-
- return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
-}
-
-struct tty *
-pctty(dev)
- dev_t dev;
-{
- struct pc_softc *sc = pc_cd.cd_devs[PCUNIT(dev)];
- struct tty *tp = sc->sc_tty;
-
- return (tp);
-}
-
-/*
- * Got a console receive interrupt -
- * the console processor wants to give us a character.
- * Catch the character, and see who it goes to.
- */
-int
-pcintr(arg)
- void *arg;
-{
- struct pc_softc *sc = arg;
- register struct tty *tp = sc->sc_tty;
- u_char *cp;
-
- if ((inb(kbd_cmdp) & KBS_DIB) == 0)
- return 0;
- if (polling)
- return 1;
- do {
- cp = sget();
- if (!tp || (tp->t_state & TS_ISOPEN) == 0)
- return 1;
- if (cp)
- do
- (*linesw[tp->t_line].l_rint)(*cp++, tp);
- while (*cp);
- } while (inb(kbd_cmdp) & KBS_DIB);
- return 1;
-}
-
-int
-pcioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- struct pc_softc *sc = pc_cd.cd_devs[PCUNIT(dev)];
- struct tty *tp = sc->sc_tty;
- int error;
-
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
- if (error >= 0)
- return error;
- error = ttioctl(tp, cmd, data, flag, p);
- if (error >= 0)
- return error;
-
- switch (cmd) {
- case CONSOLE_X_MODE_ON:
- pc_xmode_on();
- return 0;
- case CONSOLE_X_MODE_OFF:
- pc_xmode_off();
- return 0;
- case CONSOLE_X_BELL:
- /*
- * If set, data is a pointer to a length 2 array of
- * integers. data[0] is the pitch in Hz and data[1]
- * is the duration in msec.
- */
- if (data)
- sysbeep(((int*)data)[0],
- (((int*)data)[1] * hz) / 1000);
- else
- sysbeep(BEEP_FREQ, BEEP_TIME);
- return 0;
- case CONSOLE_SET_TYPEMATIC_RATE: {
- u_char rate;
-
- if (!data)
- return EINVAL;
- rate = *((u_char *)data);
- /*
- * Check that it isn't too big (which would cause it to be
- * confused with a command).
- */
- if (rate & 0x80)
- return EINVAL;
- typematic_rate = rate;
- async_update();
- return 0;
- }
- case CONSOLE_SET_KEYMAP: {
- pccons_keymap_t *map = (pccons_keymap_t *) data;
- int i;
-
- if (!data)
- return EINVAL;
- for (i = 0; i < KB_NUM_KEYS; i++)
- if (map[i].unshift[KB_CODE_SIZE-1] ||
- map[i].shift[KB_CODE_SIZE-1] ||
- map[i].ctl[KB_CODE_SIZE-1] ||
- map[i].altgr[KB_CODE_SIZE-1] ||
- map[i].shift_altgr[KB_CODE_SIZE-1])
- return EINVAL;
-
- bcopy(data, scan_codes, sizeof(pccons_keymap_t[KB_NUM_KEYS]));
- return 0;
- }
- case CONSOLE_GET_KEYMAP:
- if (!data)
- return EINVAL;
- bcopy(scan_codes, data, sizeof(pccons_keymap_t[KB_NUM_KEYS]));
- return 0;
-
- default:
- return ENOTTY;
- }
-
-#ifdef DIAGNOSTIC
- panic("pcioctl: impossible");
-#endif
-}
-
-void
-pcstart(tp)
- struct tty *tp;
-{
- struct clist *cl;
- int s, len;
- u_char buf[PCBURST];
-
- s = spltty();
- if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP))
- goto out;
- tp->t_state |= TS_BUSY;
- splx(s);
- /*
- * We need to do this outside spl since it could be fairly
- * expensive and we don't want our serial ports to overflow.
- */
- cl = &tp->t_outq;
- len = q_to_b(cl, buf, PCBURST);
- sput(buf, len);
- s = spltty();
- tp->t_state &= ~TS_BUSY;
- if (cl->c_cc) {
- tp->t_state |= TS_TIMEOUT;
- timeout_add(&tp->t_rstrt_to, 1);
- }
- if (cl->c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup(cl);
- }
- selwakeup(&tp->t_wsel);
- }
-out:
- splx(s);
-}
-
-int
-pcstop(tp, flag)
- struct tty *tp;
- int flag;
-{
- return(0);
-}
-
-void
-pccnprobe(cp)
- struct consdev *cp;
-{
- int maj;
-
- /* locate the major number */
- for (maj = 0; maj < nchrdev; maj++)
- if (cdevsw[maj].d_open == pcopen)
- break;
-
- /* initialize required fields */
- cp->cn_dev = makedev(maj, 0);
- if(system_type == ALGOR_P4032 ||
- system_type == ALGOR_P5064 ||
- system_type == MAGNUM) {
- cp->cn_pri = CN_DEAD; /* XXX For now... */
- }
- else {
- cp->cn_pri = CN_INTERNAL;
- }
-}
-
-/* ARGSUSED */
-void
-pccninit(cp)
- struct consdev *cp;
-{
-
- /*
- * For now, don't screw with it.
- */
- /* crtat = 0; */
- switch(system_type) {
-
- case ACER_PICA_61:
- mono_base += PICA_V_LOCAL_VIDEO_CTRL;
- mono_buf += PICA_V_LOCAL_VIDEO;
- cga_base += PICA_V_LOCAL_VIDEO_CTRL;
- cga_buf += PICA_V_LOCAL_VIDEO;
- kbd_cmdp = PICA_SYS_KBD + 0x61;
- kbd_datap = PICA_SYS_KBD + 0x60;
- break;
-
- case DESKSTATION_TYNE:
- mono_base += arc_bus_io.bus_base;
- mono_buf += arc_bus_mem.bus_base;
- cga_base += arc_bus_io.bus_base;
- cga_buf += arc_bus_mem.bus_base;
- kbd_cmdp = arc_bus_io.bus_base + 0x64;
- kbd_datap = arc_bus_io.bus_base + 0x60;
- outb(arc_bus_io.bus_base + 0x3ce, 6); /* Correct video mode */
- outb(arc_bus_io.bus_base + 0x3cf,
- inb(arc_bus_io.bus_base + 0x3cf) | 0xc);
- kbc_put8042cmd(CMDBYTE); /* Want XT codes.. */
- break;
-
- case DESKSTATION_RPC44:
- mono_base += arc_bus_io.bus_base;
- mono_buf += arc_bus_mem.bus_base;
- cga_base += arc_bus_io.bus_base;
- cga_buf = arc_bus_mem.bus_base + 0xa0000;
- kbd_cmdp = arc_bus_io.bus_base + 0x64;
- kbd_datap = arc_bus_io.bus_base + 0x60;
- kbc_put8042cmd(CMDBYTE); /* Want XT codes.. */
- break;
-
- case SNI_RM200:
- mono_base += arc_bus_io.bus_base;
- mono_buf += arc_bus_mem.bus_base;
- cga_base += arc_bus_io.bus_base;
- cga_buf += arc_bus_mem.bus_base;
- kbd_cmdp = arc_bus_io.bus_base + 0x64;
- kbd_datap = arc_bus_io.bus_base + 0x60;
- break;
- }
-}
-
-/* ARGSUSED */
-void
-pccnputc(dev, c)
- dev_t dev;
- char c;
-{
- u_char oldkernel = kernel;
-
- kernel = 1;
- if (c == '\n')
- sput("\r\n", 2);
- else
- sput(&c, 1);
- kernel = oldkernel;
-}
-
-/* ARGSUSED */
-int
-pccngetc(dev)
- dev_t dev;
-{
- register char *cp;
-
- if (pc_xmode > 0)
- return 0;
-
- do {
- /* wait for byte */
- while ((inb(kbd_cmdp) & KBS_DIB) == 0);
- /* see if it's worthwhile */
- cp = sget();
- } while (!cp);
- if (*cp == '\r')
- return '\n';
- return *cp;
-}
-
-void
-pccnpollc(dev, on)
- dev_t dev;
- int on;
-{
-
- polling = on;
- if (!on) {
- int unit;
- struct pc_softc *sc;
- int s;
-
- /*
- * If disabling polling on a device that's been configured,
- * make sure there are no bytes left in the FIFO, holding up
- * the interrupt line. Otherwise we won't get any further
- * interrupts.
- */
- unit = PCUNIT(dev);
- if (pc_cd.cd_ndevs > unit) {
- sc = pc_cd.cd_devs[unit];
- if (sc != 0) {
- s = spltty();
- pcintr(sc);
- splx(s);
- }
- }
- }
-}
-
-/*
- * Set line parameters.
- */
-int
-pcparam(tp, t)
- struct tty *tp;
- struct termios *t;
-{
-
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- tp->t_cflag = t->c_cflag;
- return 0;
-}
-
-#define wrtchar(c, at) do {\
- char *cp = (char *)crtat; *cp++ = (c); *cp = (at); crtat++; vs.col++; \
-} while (0)
-
-/* translate ANSI color codes to standard pc ones */
-static char fgansitopc[] = {
- FG_BLACK, FG_RED, FG_GREEN, FG_BROWN, FG_BLUE,
- FG_MAGENTA, FG_CYAN, FG_LIGHTGREY
-};
-
-static char bgansitopc[] = {
- BG_BLACK, BG_RED, BG_GREEN, BG_BROWN, BG_BLUE,
- BG_MAGENTA, BG_CYAN, BG_LIGHTGREY
-};
-
-static u_char iso2ibm437[] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0xff, 0xad, 0x9b, 0x9c, 0, 0x9d, 0, 0x40,
- 0x6f, 0x63, 0x61, 0xae, 0, 0, 0, 0,
- 0xf8, 0xf1, 0xfd, 0x33, 0, 0xe6, 0, 0xfa,
- 0, 0x31, 0x6f, 0xaf, 0xac, 0xab, 0, 0xa8,
- 0x41, 0x41, 0x41, 0x41, 0x8e, 0x8f, 0x92, 0x80,
- 0x45, 0x90, 0x45, 0x45, 0x49, 0x49, 0x49, 0x49,
- 0x81, 0xa5, 0x4f, 0x4f, 0x4f, 0x4f, 0x99, 0x4f,
- 0x4f, 0x55, 0x55, 0x55, 0x9a, 0x59, 0, 0xe1,
- 0x85, 0xa0, 0x83, 0x61, 0x84, 0x86, 0x91, 0x87,
- 0x8a, 0x82, 0x88, 0x89, 0x8d, 0xa1, 0x8c, 0x8b,
- 0, 0xa4, 0x95, 0xa2, 0x93, 0x6f, 0x94, 0x6f,
- 0x6f, 0x97, 0xa3, 0x96, 0x81, 0x98, 0, 0
-};
-
-/*
- * `pc3' termcap emulation.
- */
-void
-sput(cp, n)
- u_char *cp;
- int n;
-{
- u_char c, scroll = 0;
-
- if (pc_xmode > 0)
- return;
-
- if (crtat == 0) {
- volatile u_short *cp;
- u_short was;
- unsigned cursorat;
-
- cp = (volatile u_short *)cga_buf;
- was = *cp;
- *cp = (volatile u_short) 0xA55A;
- if (*cp != 0xA55A) {
- cp = (volatile u_short *)mono_buf;
- addr_6845 = mono_base;
- vs.color = 0;
- } else {
- *cp = was;
- addr_6845 = cga_base;
- vs.color = 1;
- }
-
-#ifdef FAT_CURSOR
- cursor_shape = 0x0012;
-#else
- get_cursor_shape();
-#endif
-
- bios_display_info(&vs.col, &vs.row, &vs.ncol, &vs.nrow);
- vs.nchr = vs.ncol * vs.nrow;
- vs.col--;
- vs.row--;
- cursorat = vs.ncol * vs.row + vs.col;
- vs.at = FG_LIGHTGREY | BG_BLACK;
-
- Crtat = (u_short *)cp;
- crtat = Crtat + cursorat;
-
- if (vs.color == 0)
- vs.so_at = FG_BLACK | BG_LIGHTGREY;
- else
- vs.so_at = FG_YELLOW | BG_BLACK;
-
- fillw((vs.at << 8) | ' ', crtat, vs.nchr - cursorat);
- }
-
- while (n--) {
- if (!(c = *cp++))
- continue;
-
- switch (c) {
- case 0x1B:
- if (vs.state >= VSS_ESCAPE) {
- wrtchar(c, vs.so_at);
- vs.state = 0;
- goto maybe_scroll;
- } else
- vs.state = VSS_ESCAPE;
- break;
-
- case 0x9B: /* CSI */
- vs.cx = vs.cy = 0;
- vs.state = VSS_EBRACE;
- break;
-
- case '\t': {
- int inccol = 8 - (vs.col & 7);
- crtat += inccol;
- vs.col += inccol;
- }
- maybe_scroll:
- if (vs.col >= vs.ncol) {
- vs.col -= vs.ncol;
- scroll = 1;
- }
- break;
-
- case '\b':
- if (crtat <= Crtat)
- break;
- --crtat;
- if (--vs.col < 0)
- vs.col += vs.ncol; /* non-destructive backspace */
- break;
-
- case '\r':
- crtat -= vs.col;
- vs.col = 0;
- break;
-
- case '\n':
- crtat += vs.ncol;
- scroll = 1;
- break;
-
- default:
- switch (vs.state) {
- case 0:
- if (c == '\a')
- sysbeep(BEEP_FREQ, BEEP_TIME);
- else {
- /*
- * If we're outputting multiple printed
- * characters, just blast them to the
- * screen until we reach the end of the
- * buffer or a control character. This
- * saves time by short-circuiting the
- * switch.
- * If we reach the end of the line, we
- * break to do a scroll check.
- */
- for (;;) {
- if (c & 0x80)
- c = iso2ibm437[c&0x7f];
-
- if (vs.so)
- wrtchar(c, vs.so_at);
- else
- wrtchar(c, vs.at);
- if (vs.col >= vs.ncol) {
- vs.col = 0;
- scroll = 1;
- break;
- }
- if (!n || (c = *cp) < ' ')
- break;
- n--, cp++;
- }
- }
- break;
- case VSS_ESCAPE:
- switch (c) {
- case '[': /* Start ESC [ sequence */
- vs.cx = vs.cy = 0;
- vs.state = VSS_EBRACE;
- break;
- case 'c': /* Create screen & home */
- fillw((vs.at << 8) | ' ',
- Crtat, vs.nchr);
- crtat = Crtat;
- vs.col = 0;
- vs.state = 0;
- break;
- case '7': /* save cursor pos */
- vs.offset = crtat - Crtat;
- vs.state = 0;
- break;
- case '8': /* restore cursor pos */
- crtat = Crtat + vs.offset;
- vs.row = vs.offset / vs.ncol;
- vs.col = vs.offset % vs.ncol;
- vs.state = 0;
- break;
- default: /* Invalid, clear state */
- wrtchar(c, vs.so_at);
- vs.state = 0;
- goto maybe_scroll;
- }
- break;
-
- default: /* VSS_EBRACE or VSS_EPARAM */
- switch (c) {
- int pos;
- case 'm':
- if (!vs.cx)
- vs.so = 0;
- else
- vs.so = 1;
- vs.state = 0;
- break;
- case 'A': { /* back cx rows */
- int cx = vs.cx;
- if (cx <= 0)
- cx = 1;
- else
- cx %= vs.nrow;
- pos = crtat - Crtat;
- pos -= vs.ncol * cx;
- if (pos < 0)
- pos += vs.nchr;
- crtat = Crtat + pos;
- vs.state = 0;
- break;
- }
- case 'B': { /* down cx rows */
- int cx = vs.cx;
- if (cx <= 0)
- cx = 1;
- else
- cx %= vs.nrow;
- pos = crtat - Crtat;
- pos += vs.ncol * cx;
- if (pos >= vs.nchr)
- pos -= vs.nchr;
- crtat = Crtat + pos;
- vs.state = 0;
- break;
- }
- case 'C': { /* right cursor */
- int cx = vs.cx,
- col = vs.col;
- if (cx <= 0)
- cx = 1;
- else
- cx %= vs.ncol;
- pos = crtat - Crtat;
- pos += cx;
- col += cx;
- if (col >= vs.ncol) {
- pos -= vs.ncol;
- col -= vs.ncol;
- }
- vs.col = col;
- crtat = Crtat + pos;
- vs.state = 0;
- break;
- }
- case 'D': { /* left cursor */
- int cx = vs.cx,
- col = vs.col;
- if (cx <= 0)
- cx = 1;
- else
- cx %= vs.ncol;
- pos = crtat - Crtat;
- pos -= cx;
- col -= cx;
- if (col < 0) {
- pos += vs.ncol;
- col += vs.ncol;
- }
- vs.col = col;
- crtat = Crtat + pos;
- vs.state = 0;
- break;
- }
- case 'J': /* Clear ... */
- switch (vs.cx) {
- case 0:
- /* ... to end of display */
- fillw((vs.at << 8) | ' ',
- crtat,
- Crtat + vs.nchr - crtat);
- break;
- case 1:
- /* ... to next location */
- fillw((vs.at << 8) | ' ',
- Crtat,
- crtat - Crtat + 1);
- break;
- case 2:
- /* ... whole display */
- fillw((vs.at << 8) | ' ',
- Crtat,
- vs.nchr);
- break;
- }
- vs.state = 0;
- break;
- case 'K': /* Clear line ... */
- switch (vs.cx) {
- case 0:
- /* ... current to EOL */
- fillw((vs.at << 8) | ' ',
- crtat,
- vs.ncol - vs.col);
- break;
- case 1:
- /* ... beginning to next */
- fillw((vs.at << 8) | ' ',
- crtat - vs.col,
- vs.col + 1);
- break;
- case 2:
- /* ... entire line */
- fillw((vs.at << 8) | ' ',
- crtat - vs.col, vs.ncol);
- break;
- }
- vs.state = 0;
- break;
- case 'f': /* in system V consoles */
- case 'H': { /* Cursor move */
- int cx = vs.cx,
- cy = vs.cy;
- if (!cx || !cy) {
- crtat = Crtat;
- vs.col = 0;
- } else {
- if (cx > vs.nrow)
- cx = vs.nrow;
- if (cy > vs.ncol)
- cy = vs.ncol;
- crtat = Crtat +
- (cx - 1) * vs.ncol + cy - 1;
- vs.col = cy - 1;
- }
- vs.state = 0;
- break;
- }
- case 'M': { /* delete cx rows */
- u_short *crtAt = crtat - vs.col;
- int cx = vs.cx,
- row = (crtAt - Crtat) / vs.ncol,
- nrow = vs.nrow - row;
- if (cx <= 0)
- cx = 1;
- else if (cx > nrow)
- cx = nrow;
- if (cx < nrow)
-#ifdef PCCONS_FORCE_WORD
- wcopy(crtAt + vs.ncol * cx,
- crtAt, vs.ncol * (nrow -
- cx) * CHR);
-#else
- bcopy(crtAt + vs.ncol * cx,
- crtAt, vs.ncol * (nrow -
- cx) * CHR);
-#endif
- fillw((vs.at << 8) | ' ',
- crtAt + vs.ncol * (nrow - cx),
- vs.ncol * cx);
- vs.state = 0;
- break;
- }
- case 'S': { /* scroll up cx lines */
- int cx = vs.cx;
- if (cx <= 0)
- cx = 1;
- else if (cx > vs.nrow)
- cx = vs.nrow;
- if (cx < vs.nrow)
-#ifdef PCCONS_FORCE_WORD
- wcopy(Crtat + vs.ncol * cx,
- Crtat, vs.ncol * (vs.nrow -
- cx) * CHR);
-#else
- bcopy(Crtat + vs.ncol * cx,
- Crtat, vs.ncol * (vs.nrow -
- cx) * CHR);
-#endif
- fillw((vs.at << 8) | ' ',
- Crtat + vs.ncol * (vs.nrow - cx),
- vs.ncol * cx);
- /* crtat -= vs.ncol * cx; XXX */
- vs.state = 0;
- break;
- }
- case 'L': { /* insert cx rows */
- u_short *crtAt = crtat - vs.col;
- int cx = vs.cx,
- row = (crtAt - Crtat) / vs.ncol,
- nrow = vs.nrow - row;
- if (cx <= 0)
- cx = 1;
- else if (cx > nrow)
- cx = nrow;
- if (cx < nrow)
-#ifdef PCCONS_FORCE_WORD
- wcopy(crtAt,
- crtAt + vs.ncol * cx,
- vs.ncol * (nrow - cx) *
- CHR);
-#else
- bcopy(crtAt,
- crtAt + vs.ncol * cx,
- vs.ncol * (nrow - cx) *
- CHR);
-#endif
- fillw((vs.at << 8) | ' ', crtAt,
- vs.ncol * cx);
- vs.state = 0;
- break;
- }
- case 'T': { /* scroll down cx lines */
- int cx = vs.cx;
- if (cx <= 0)
- cx = 1;
- else if (cx > vs.nrow)
- cx = vs.nrow;
- if (cx < vs.nrow)
-#ifdef PCCONS_FORCE_WORD
- wcopy(Crtat,
- Crtat + vs.ncol * cx,
- vs.ncol * (vs.nrow - cx) *
- CHR);
-#else
- bcopy(Crtat,
- Crtat + vs.ncol * cx,
- vs.ncol * (vs.nrow - cx) *
- CHR);
-#endif
- fillw((vs.at << 8) | ' ', Crtat,
- vs.ncol * cx);
- /* crtat += vs.ncol * cx; XXX */
- vs.state = 0;
- break;
- }
- case ';': /* Switch params in cursor def */
- vs.state = VSS_EPARAM;
- break;
- case 'r':
- vs.so_at = (vs.cx & FG_MASK) |
- ((vs.cy << 4) & BG_MASK);
- vs.state = 0;
- break;
- case 's': /* save cursor pos */
- vs.offset = crtat - Crtat;
- vs.state = 0;
- break;
- case 'u': /* restore cursor pos */
- crtat = Crtat + vs.offset;
- vs.row = vs.offset / vs.ncol;
- vs.col = vs.offset % vs.ncol;
- vs.state = 0;
- break;
- case 'x': /* set attributes */
- switch (vs.cx) {
- case 0:
- vs.at = FG_LIGHTGREY | BG_BLACK;
- break;
- case 1:
- /* ansi background */
- if (!vs.color)
- break;
- vs.at &= FG_MASK;
- vs.at |= bgansitopc[vs.cy & 7];
- break;
- case 2:
- /* ansi foreground */
- if (!vs.color)
- break;
- vs.at &= BG_MASK;
- vs.at |= fgansitopc[vs.cy & 7];
- break;
- case 3:
- /* pc text attribute */
- if (vs.state >= VSS_EPARAM)
- vs.at = vs.cy;
- break;
- }
- vs.state = 0;
- break;
-
- default: /* Only numbers valid here */
- if ((c >= '0') && (c <= '9')) {
- if (vs.state >= VSS_EPARAM) {
- vs.cy *= 10;
- vs.cy += c - '0';
- } else {
- vs.cx *= 10;
- vs.cx += c - '0';
- }
- } else
- vs.state = 0;
- break;
- }
- break;
- }
- }
- if (scroll) {
- scroll = 0;
- /* scroll check */
- if (crtat >= Crtat + vs.nchr) {
- if (!kernel) {
- int s = spltty();
- if (lock_state & KB_SCROLL)
- tsleep(&lock_state,
- PUSER, "pcputc", 0);
- splx(s);
- }
-#if PCCONS_FORCE_WORD
- wcopy(Crtat + vs.ncol, Crtat,
- (vs.nchr - vs.ncol) * CHR);
-#else
- bcopy(Crtat + vs.ncol, Crtat,
- (vs.nchr - vs.ncol) * CHR);
-#endif
- fillw((vs.at << 8) | ' ',
- Crtat + vs.nchr - vs.ncol,
- vs.ncol);
- crtat -= vs.ncol;
- }
- }
- }
- async_update();
-}
-
-/* the unshifted code for KB_SHIFT keys is used by X to distinguish between
- left and right shift when reading the keyboard map */
-static pccons_keymap_t scan_codes[KB_NUM_KEYS] = {
-/* type unshift shift control altgr shift_altgr scancode */
- { KB_NONE, "", "", "", "", ""}, /* 0 unused */
- { KB_ASCII, "\033", "\033", "\033", "", ""}, /* 1 ESCape */
- { KB_ASCII, "1", "!", "!", "", ""}, /* 2 1 */
- { KB_ASCII, "2", "@", "\000", "", ""}, /* 3 2 */
- { KB_ASCII, "3", "#", "#", "", ""}, /* 4 3 */
- { KB_ASCII, "4", "$", "$", "", ""}, /* 5 4 */
- { KB_ASCII, "5", "%", "%", "", ""}, /* 6 5 */
- { KB_ASCII, "6", "^", "\036", "", ""}, /* 7 6 */
- { KB_ASCII, "7", "&", "&", "", ""}, /* 8 7 */
- { KB_ASCII, "8", "*", "\010", "", ""}, /* 9 8 */
- { KB_ASCII, "9", "(", "(", "", ""}, /* 10 9 */
- { KB_ASCII, "0", ")", ")", "", ""}, /* 11 0 */
- { KB_ASCII, "-", "_", "\037", "", ""}, /* 12 - */
- { KB_ASCII, "=", "+", "+", "", ""}, /* 13 = */
- { KB_ASCII, "\177", "\177", "\010", "", ""}, /* 14 backspace */
- { KB_ASCII, "\t", "\t", "\t", "", ""}, /* 15 tab */
- { KB_ASCII, "q", "Q", "\021", "", ""}, /* 16 q */
- { KB_ASCII, "w", "W", "\027", "", ""}, /* 17 w */
- { KB_ASCII, "e", "E", "\005", "", ""}, /* 18 e */
- { KB_ASCII, "r", "R", "\022", "", ""}, /* 19 r */
- { KB_ASCII, "t", "T", "\024", "", ""}, /* 20 t */
- { KB_ASCII, "y", "Y", "\031", "", ""}, /* 21 y */
- { KB_ASCII, "u", "U", "\025", "", ""}, /* 22 u */
- { KB_ASCII, "i", "I", "\011", "", ""}, /* 23 i */
- { KB_ASCII, "o", "O", "\017", "", ""}, /* 24 o */
- { KB_ASCII, "p", "P", "\020", "", ""}, /* 25 p */
- { KB_ASCII, "[", "{", "\033", "", ""}, /* 26 [ */
- { KB_ASCII, "]", "}", "\035", "", ""}, /* 27 ] */
- { KB_ASCII, "\r", "\r", "\n", "", ""}, /* 28 return */
- { KB_CTL, "", "", "", "", ""}, /* 29 control */
- { KB_ASCII, "a", "A", "\001", "", ""}, /* 30 a */
- { KB_ASCII, "s", "S", "\023", "", ""}, /* 31 s */
- { KB_ASCII, "d", "D", "\004", "", ""}, /* 32 d */
- { KB_ASCII, "f", "F", "\006", "", ""}, /* 33 f */
- { KB_ASCII, "g", "G", "\007", "", ""}, /* 34 g */
- { KB_ASCII, "h", "H", "\010", "", ""}, /* 35 h */
- { KB_ASCII, "j", "J", "\n", "", ""}, /* 36 j */
- { KB_ASCII, "k", "K", "\013", "", ""}, /* 37 k */
- { KB_ASCII, "l", "L", "\014", "", ""}, /* 38 l */
- { KB_ASCII, ";", ":", ";", "", ""}, /* 39 ; */
- { KB_ASCII, "'", "\"", "'", "", ""}, /* 40 ' */
- { KB_ASCII, "`", "~", "`", "", ""}, /* 41 ` */
- { KB_SHIFT, "\001", "", "", "", ""}, /* 42 shift */
- { KB_ASCII, "\\", "|", "\034", "", ""}, /* 43 \ */
- { KB_ASCII, "z", "Z", "\032", "", ""}, /* 44 z */
- { KB_ASCII, "x", "X", "\030", "", ""}, /* 45 x */
- { KB_ASCII, "c", "C", "\003", "", ""}, /* 46 c */
- { KB_ASCII, "v", "V", "\026", "", ""}, /* 47 v */
- { KB_ASCII, "b", "B", "\002", "", ""}, /* 48 b */
- { KB_ASCII, "n", "N", "\016", "", ""}, /* 49 n */
- { KB_ASCII, "m", "M", "\r", "", ""}, /* 50 m */
- { KB_ASCII, ",", "<", "<", "", ""}, /* 51 , */
- { KB_ASCII, ".", ">", ">", "", ""}, /* 52 . */
- { KB_ASCII, "/", "?", "\037", "", ""}, /* 53 / */
- { KB_SHIFT, "\002", "", "", "", ""}, /* 54 shift */
- { KB_KP, "*", "*", "*", "", ""}, /* 55 kp * */
- { KB_ALT, "", "", "", "", ""}, /* 56 alt */
- { KB_ASCII, " ", " ", "\000", "", ""}, /* 57 space */
- { KB_CAPS, "", "", "", "", ""}, /* 58 caps */
- { KB_FUNC, "\033[M", "\033[Y", "\033[k", "", ""}, /* 59 f1 */
- { KB_FUNC, "\033[N", "\033[Z", "\033[l", "", ""}, /* 60 f2 */
- { KB_FUNC, "\033[O", "\033[a", "\033[m", "", ""}, /* 61 f3 */
- { KB_FUNC, "\033[P", "\033[b", "\033[n", "", ""}, /* 62 f4 */
- { KB_FUNC, "\033[Q", "\033[c", "\033[o", "", ""}, /* 63 f5 */
- { KB_FUNC, "\033[R", "\033[d", "\033[p", "", ""}, /* 64 f6 */
- { KB_FUNC, "\033[S", "\033[e", "\033[q", "", ""}, /* 65 f7 */
- { KB_FUNC, "\033[T", "\033[f", "\033[r", "", ""}, /* 66 f8 */
- { KB_FUNC, "\033[U", "\033[g", "\033[s", "", ""}, /* 67 f9 */
- { KB_FUNC, "\033[V", "\033[h", "\033[t", "", ""}, /* 68 f10 */
- { KB_NUM, "", "", "", "", ""}, /* 69 num lock */
- { KB_SCROLL, "", "", "", "", ""}, /* 70 scroll lock */
- { KB_KP, "7", "\033[H", "7", "", ""}, /* 71 kp 7 */
- { KB_KP, "8", "\033[A", "8", "", ""}, /* 72 kp 8 */
- { KB_KP, "9", "\033[I", "9", "", ""}, /* 73 kp 9 */
- { KB_KP, "-", "-", "-", "", ""}, /* 74 kp - */
- { KB_KP, "4", "\033[D", "4", "", ""}, /* 75 kp 4 */
- { KB_KP, "5", "\033[E", "5", "", ""}, /* 76 kp 5 */
- { KB_KP, "6", "\033[C", "6", "", ""}, /* 77 kp 6 */
- { KB_KP, "+", "+", "+", "", ""}, /* 78 kp + */
- { KB_KP, "1", "\033[F", "1", "", ""}, /* 79 kp 1 */
- { KB_KP, "2", "\033[B", "2", "", ""}, /* 80 kp 2 */
- { KB_KP, "3", "\033[G", "3", "", ""}, /* 81 kp 3 */
- { KB_KP, "0", "\033[L", "0", "", ""}, /* 82 kp 0 */
- { KB_KP, ",", "\177", ",", "", ""}, /* 83 kp , */
- { KB_NONE, "", "", "", "", ""}, /* 84 0 */
- { KB_NONE, "", "", "", "", ""}, /* 85 0 */
- { KB_NONE, "", "", "", "", ""}, /* 86 0 */
- { KB_FUNC, "\033[W", "\033[i", "\033[u", "", ""}, /* 87 f11 */
- { KB_FUNC, "\033[X", "\033[j", "\033[v", "", ""}, /* 88 f12 */
- { KB_NONE, "", "", "", "", ""}, /* 89 0 */
- { KB_NONE, "", "", "", "", ""}, /* 90 0 */
- { KB_NONE, "", "", "", "", ""}, /* 91 0 */
- { KB_NONE, "", "", "", "", ""}, /* 92 0 */
- { KB_NONE, "", "", "", "", ""}, /* 93 0 */
- { KB_NONE, "", "", "", "", ""}, /* 94 0 */
- { KB_NONE, "", "", "", "", ""}, /* 95 0 */
- { KB_NONE, "", "", "", "", ""}, /* 96 0 */
- { KB_NONE, "", "", "", "", ""}, /* 97 0 */
- { KB_NONE, "", "", "", "", ""}, /* 98 0 */
- { KB_NONE, "", "", "", "", ""}, /* 99 0 */
- { KB_NONE, "", "", "", "", ""}, /* 100 */
- { KB_NONE, "", "", "", "", ""}, /* 101 */
- { KB_NONE, "", "", "", "", ""}, /* 102 */
- { KB_NONE, "", "", "", "", ""}, /* 103 */
- { KB_NONE, "", "", "", "", ""}, /* 104 */
- { KB_NONE, "", "", "", "", ""}, /* 105 */
- { KB_NONE, "", "", "", "", ""}, /* 106 */
- { KB_NONE, "", "", "", "", ""}, /* 107 */
- { KB_NONE, "", "", "", "", ""}, /* 108 */
- { KB_NONE, "", "", "", "", ""}, /* 109 */
- { KB_NONE, "", "", "", "", ""}, /* 110 */
- { KB_NONE, "", "", "", "", ""}, /* 111 */
- { KB_NONE, "", "", "", "", ""}, /* 112 */
- { KB_NONE, "", "", "", "", ""}, /* 113 */
- { KB_NONE, "", "", "", "", ""}, /* 114 */
- { KB_NONE, "", "", "", "", ""}, /* 115 */
- { KB_NONE, "", "", "", "", ""}, /* 116 */
- { KB_NONE, "", "", "", "", ""}, /* 117 */
- { KB_NONE, "", "", "", "", ""}, /* 118 */
- { KB_NONE, "", "", "", "", ""}, /* 119 */
- { KB_NONE, "", "", "", "", ""}, /* 120 */
- { KB_NONE, "", "", "", "", ""}, /* 121 */
- { KB_NONE, "", "", "", "", ""}, /* 122 */
- { KB_NONE, "", "", "", "", ""}, /* 123 */
- { KB_NONE, "", "", "", "", ""}, /* 124 */
- { KB_NONE, "", "", "", "", ""}, /* 125 */
- { KB_NONE, "", "", "", "", ""}, /* 126 */
- { KB_NONE, "", "", "", "", ""} /* 127 */
-};
-
-/*
- * Get characters from the keyboard. If none are present, return NULL.
- */
-char *
-sget()
-{
- u_char dt;
- static u_char extended = 0, shift_state = 0;
- static u_char capchar[2];
-
-top:
- KBD_DELAY;
- dt = inb(kbd_datap);
-
- switch (dt) {
- case KBR_ACK: case KBR_ECHO:
- kb_oq_get = (kb_oq_get + 1) & 7;
- if(kb_oq_get != kb_oq_put) {
- outb(kbd_datap, kb_oq[kb_oq_get]);
- }
- goto loop;
- case KBR_RESEND:
- outb(kbd_datap, kb_oq[kb_oq_get]);
- goto loop;
- }
-
- if (pc_xmode > 0) {
-#if defined(DDB) && defined(XSERVER_DDB)
- /* F12 enters the debugger while in X mode */
- if (dt == 88)
- if (db_console)
- Debugger();
-#endif
- capchar[0] = dt;
- capchar[1] = 0;
- /*
- * Check for locking keys.
- *
- * XXX Setting the LEDs this way is a bit bogus. What if the
- * keyboard has been remapped in X?
- */
- switch (scan_codes[dt & 0x7f].type) {
- case KB_NUM:
- if (dt & 0x80) {
- shift_state &= ~KB_NUM;
- break;
- }
- if (shift_state & KB_NUM)
- break;
- shift_state |= KB_NUM;
- lock_state ^= KB_NUM;
- async_update();
- break;
- case KB_CAPS:
- if (dt & 0x80) {
- shift_state &= ~KB_CAPS;
- break;
- }
- if (shift_state & KB_CAPS)
- break;
- shift_state |= KB_CAPS;
- lock_state ^= KB_CAPS;
- async_update();
- break;
- case KB_SCROLL:
- if (dt & 0x80) {
- shift_state &= ~KB_SCROLL;
- break;
- }
- if (shift_state & KB_SCROLL)
- break;
- shift_state |= KB_SCROLL;
- lock_state ^= KB_SCROLL;
- if ((lock_state & KB_SCROLL) == 0)
- wakeup((caddr_t)&lock_state);
- async_update();
- break;
- }
- return capchar;
- }
-
- switch (dt) {
- case KBR_EXTENDED:
- extended = 1;
- goto loop;
- }
-
-#ifdef DDB
- /*
- * Check for cntl-alt-esc.
- */
- if ((dt == 1) && (shift_state & (KB_CTL | KB_ALT)) == (KB_CTL | KB_ALT)) {
- if (db_console)
- Debugger();
- dt |= 0x80; /* discard esc (ddb discarded ctl-alt) */
- }
-#endif
-
- /*
- * Check for make/break.
- */
- if (dt & 0x80) {
- /*
- * break
- */
- dt &= 0x7f;
- switch (scan_codes[dt].type) {
- case KB_NUM:
- shift_state &= ~KB_NUM;
- break;
- case KB_CAPS:
- shift_state &= ~KB_CAPS;
- break;
- case KB_SCROLL:
- shift_state &= ~KB_SCROLL;
- break;
- case KB_SHIFT:
- shift_state &= ~KB_SHIFT;
- break;
- case KB_ALT:
- if (extended)
- shift_state &= ~KB_ALTGR;
- else
- shift_state &= ~KB_ALT;
- break;
- case KB_CTL:
- shift_state &= ~KB_CTL;
- break;
- }
- } else {
- /*
- * make
- */
- switch (scan_codes[dt].type) {
- /*
- * locking keys
- */
- case KB_NUM:
- if (shift_state & KB_NUM)
- break;
- shift_state |= KB_NUM;
- lock_state ^= KB_NUM;
- async_update();
- break;
- case KB_CAPS:
- if (shift_state & KB_CAPS)
- break;
- shift_state |= KB_CAPS;
- lock_state ^= KB_CAPS;
- async_update();
- break;
- case KB_SCROLL:
- if (shift_state & KB_SCROLL)
- break;
- shift_state |= KB_SCROLL;
- lock_state ^= KB_SCROLL;
- if ((lock_state & KB_SCROLL) == 0)
- wakeup((caddr_t)&lock_state);
- async_update();
- break;
- /*
- * non-locking keys
- */
- case KB_SHIFT:
- shift_state |= KB_SHIFT;
- break;
- case KB_ALT:
- if (extended)
- shift_state |= KB_ALTGR;
- else
- shift_state |= KB_ALT;
- break;
- case KB_CTL:
- shift_state |= KB_CTL;
- break;
- case KB_ASCII:
- /* control has highest priority */
- if (shift_state & KB_CTL)
- capchar[0] = scan_codes[dt].ctl[0];
- else if (shift_state & KB_ALTGR) {
- if (shift_state & KB_SHIFT)
- capchar[0] = scan_codes[dt].shift_altgr[0];
- else
- capchar[0] = scan_codes[dt].altgr[0];
- }
- else {
- if (shift_state & KB_SHIFT)
- capchar[0] = scan_codes[dt].shift[0];
- else
- capchar[0] = scan_codes[dt].unshift[0];
- }
- if ((lock_state & KB_CAPS) && capchar[0] >= 'a' &&
- capchar[0] <= 'z') {
- capchar[0] -= ('a' - 'A');
- }
- capchar[0] |= (shift_state & KB_ALT);
- extended = 0;
- return capchar;
- case KB_NONE:
-printf("keycode %d\n",dt);
- break;
- case KB_FUNC: {
- char *more_chars;
- if (shift_state & KB_SHIFT)
- more_chars = scan_codes[dt].shift;
- else if (shift_state & KB_CTL)
- more_chars = scan_codes[dt].ctl;
- else
- more_chars = scan_codes[dt].unshift;
- extended = 0;
- return more_chars;
- }
- case KB_KP: {
- char *more_chars;
- if (shift_state & (KB_SHIFT | KB_CTL) ||
- (lock_state & KB_NUM) == 0 || extended)
- more_chars = scan_codes[dt].shift;
- else
- more_chars = scan_codes[dt].unshift;
- extended = 0;
- return more_chars;
- }
- }
- }
-
- extended = 0;
-loop:
- if ((inb(kbd_cmdp) & KBS_DIB) == 0)
- return 0;
- goto top;
-}
-
-int
-pcmmap(dev, offset, nprot)
- dev_t dev;
- int offset;
- int nprot;
-{
-
- switch(system_type) {
-
- case ACER_PICA_61:
- if (offset >= 0xa0000 && offset < 0xc0000)
- return mips_btop(PICA_P_LOCAL_VIDEO + offset);
- if (offset >= 0x0000 && offset < 0x10000)
- return mips_btop(PICA_P_LOCAL_VIDEO_CTRL + offset);
- if (offset >= 0x40000000 && offset < 0x40800000)
- return mips_btop(PICA_P_LOCAL_VIDEO + offset - 0x40000000);
- return -1;
-
- case DESKSTATION_RPC44:
- if (offset >= 0xa0000 && offset < 0xc0000)
- return mips_btop(RPC44_P_ISA_MEM + offset);
- if (offset >= 0x0000 && offset < 0x10000)
- return mips_btop(RPC44_P_ISA_IO + offset);
- if (offset >= 0x40000000 && offset < 0x40800000)
- return mips_btop(RPC44_P_ISA_MEM + offset - 0x40000000);
- return -1;
-
- case DESKSTATION_TYNE:
- /* Addresses returned are a fake to be able to handle >32 bit
- * physical addresses used by the tyne. The real physical adr
- * processing is done in pmap.c. Until we are a real 64 bit
- * port this is how it will be done.
- */
- if (offset >= 0xa0000 && offset < 0xc0000)
- return mips_btop(TYNE_V_ISA_MEM + offset);
- if (offset >= 0x0000 && offset < 0x10000)
- return mips_btop(TYNE_V_ISA_IO + offset);
- if (offset >= 0x40000000 && offset < 0x40800000)
- return mips_btop(TYNE_V_ISA_MEM + offset - 0x40000000);
- return -1;
- }
- return -1;
-}
-
-void
-pc_xmode_on()
-{
- if (pc_xmode)
- return;
- pc_xmode = 1;
-
-#ifdef XFREE86_BUG_COMPAT
- /* If still unchanged, get current shape. */
- if (cursor_shape == 0xffff)
- get_cursor_shape();
-#endif
-}
-
-void
-pc_xmode_off()
-{
- if (pc_xmode == 0)
- return;
- pc_xmode = 0;
-
-#ifdef XFREE86_BUG_COMPAT
- /* XXX It would be hard to justify why the X server doesn't do this. */
- set_cursor_shape();
-#endif
- async_update();
-}
-
-#include <machine/mouse.h>
-
-/* status bits */
-#define PMS_OBUF_FULL 0x01
-#define PMS_IBUF_FULL 0x02
-
-/* controller commands */
-#define PMS_INT_ENABLE 0x47 /* enable controller interrupts */
-#define PMS_INT_DISABLE 0x65 /* disable controller interrupts */
-#define PMS_AUX_ENABLE 0xa7 /* enable auxiliary port */
-#define PMS_AUX_DISABLE 0xa8 /* disable auxiliary port */
-#define PMS_MAGIC_1 0xa9 /* XXX */
-
-#define PMS_8042_CMD 0x65
-
-/* mouse commands */
-#define PMS_SET_SCALE11 0xe6 /* set scaling 1:1 */
-#define PMS_SET_SCALE21 0xe7 /* set scaling 2:1 */
-#define PMS_SET_RES 0xe8 /* set resolution */
-#define PMS_GET_SCALE 0xe9 /* get scaling factor */
-#define PMS_SET_STREAM 0xea /* set streaming mode */
-#define PMS_SET_SAMPLE 0xf3 /* set sampling rate */
-#define PMS_DEV_ENABLE 0xf4 /* mouse on */
-#define PMS_DEV_DISABLE 0xf5 /* mouse off */
-#define PMS_RESET 0xff /* reset */
-
-#define PMS_CHUNK 128 /* chunk size for read */
-#define PMS_BSIZE 1020 /* buffer size */
-
-#define FLUSHQ(q) { if((q)->c_cc) ndflush(q, (q)->c_cc); }
-
-int pmsopen __P((dev_t, int));
-int pmsclose __P((dev_t, int));
-int pmsread __P((dev_t, struct uio *, int));
-int pmsioctl __P((dev_t, u_long, caddr_t, int));
-int pmsselect __P((dev_t, int, struct proc *));
-static __inline void pms_dev_cmd __P((u_char));
-static __inline void pms_aux_cmd __P((u_char));
-static __inline void pms_pit_cmd __P((u_char));
-
-static __inline void
-pms_dev_cmd(value)
- u_char value;
-{
- kbd_flush_input();
- outb(kbd_cmdp, 0xd4);
- kbd_flush_input();
- outb(kbd_datap, value);
-}
-
-static __inline void
-pms_aux_cmd(value)
- u_char value;
-{
- kbd_flush_input();
- outb(kbd_cmdp, value);
-}
-
-static __inline void
-pms_pit_cmd(value)
- u_char value;
-{
- kbd_flush_input();
- outb(kbd_cmdp, 0x60);
- kbd_flush_input();
- outb(kbd_datap, value);
-}
-
-int
-pmsprobe(parent, probe, aux)
- struct device *parent;
- void *probe, *aux;
-{
- struct confargs *ca = aux;
- u_char x;
-
- /* Make shure we're looking for this type of device */
- if(!BUS_MATCHNAME(ca, "pms"))
- return(0);
-
- pms_dev_cmd(KBC_RESET);
- pms_aux_cmd(PMS_MAGIC_1);
- delay(10000);
- x = inb(kbd_datap);
- pms_pit_cmd(PMS_INT_DISABLE);
- if (x & 0x04)
- return 0;
-
- return 1;
-}
-
-void
-pmsattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct pms_softc *sc = (void *)self;
- struct confargs *ca = aux;
-
- printf("\n");
-
- /* Other initialization was done by pmsprobe. */
- sc->sc_state = 0;
-
- BUS_INTR_ESTABLISH(ca, pmsintr, (void *)(long)sc);
-}
-
-int
-pmsopen(dev, flag)
- dev_t dev;
- int flag;
-{
- int unit = PMSUNIT(dev);
- struct pms_softc *sc;
-
- if (unit >= pms_cd.cd_ndevs)
- return ENXIO;
- sc = pms_cd.cd_devs[unit];
- if (!sc)
- return ENXIO;
-
- if (sc->sc_state & PMS_OPEN)
- return EBUSY;
-
- if (clalloc(&sc->sc_q, PMS_BSIZE, 0) == -1)
- return ENOMEM;
-
- sc->sc_state |= PMS_OPEN;
- sc->sc_status = 0;
- sc->sc_flags = (PMSTYPE(dev) ? PMS_RAW : 0 );
- sc->sc_x = sc->sc_y = 0;
-
- /* Enable interrupts. */
- pms_dev_cmd(PMS_DEV_ENABLE);
- pms_aux_cmd(PMS_AUX_ENABLE);
- pms_dev_cmd(PMS_SET_RES);
- pms_dev_cmd(3); /* 8 counts/mm */
- pms_dev_cmd(PMS_SET_SCALE21);
-#if 0
- pms_dev_cmd(PMS_SET_SAMPLE);
- pms_dev_cmd(100); /* 100 samples/sec */
- pms_dev_cmd(PMS_SET_STREAM);
-#endif
- pms_pit_cmd(PMS_INT_ENABLE);
-
- return 0;
-}
-
-int
-pmsclose(dev, flag)
- dev_t dev;
- int flag;
-{
- struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)];
-
- /* Disable interrupts. */
- pms_dev_cmd(PMS_DEV_DISABLE);
- pms_pit_cmd(PMS_INT_DISABLE);
- pms_aux_cmd(PMS_AUX_DISABLE);
-
- sc->sc_state &= ~PMS_OPEN;
-
- clfree(&sc->sc_q);
-
- return 0;
-}
-
-int
-pmsread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)];
- int s;
- int error;
- size_t length;
- u_char buffer[PMS_CHUNK];
-
- /* Block until mouse activity occured. */
-
- s = spltty();
- while (sc->sc_q.c_cc == 0) {
- if (flag & IO_NDELAY) {
- splx(s);
- return EWOULDBLOCK;
- }
- sc->sc_state |= PMS_ASLP;
- error = tsleep((caddr_t)sc, PZERO | PCATCH, "pmsrea", 0);
- if (error) {
- sc->sc_state &= ~PMS_ASLP;
- splx(s);
- return error;
- }
- }
- splx(s);
-
- /* Transfer as many chunks as possible. */
-
- while (sc->sc_q.c_cc > 0 && uio->uio_resid > 0) {
- length = min(sc->sc_q.c_cc, uio->uio_resid);
- if (length > sizeof(buffer))
- length = sizeof(buffer);
-
- /* Remove a small chunk from the input queue. */
- (void) q_to_b(&sc->sc_q, buffer, length);
-
- /* Copy the data to the user process. */
- error = uiomove(buffer, length, uio);
- if (error)
- break;
- }
-
- return error;
-}
-
-int
-pmsioctl(dev, cmd, addr, flag)
- dev_t dev;
- u_long cmd;
- caddr_t addr;
- int flag;
-{
- struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)];
- struct mouseinfo info;
- int s;
- int error;
-
- switch (cmd) {
- case MOUSEIOCREAD:
- s = spltty();
-
- info.status = sc->sc_status;
- if (sc->sc_x || sc->sc_y)
- info.status |= MOVEMENT;
-
- if (sc->sc_x > 127)
- info.xmotion = 127;
- else if (sc->sc_x < -127)
- /* Bounding at -127 avoids a bug in XFree86. */
- info.xmotion = -127;
- else
- info.xmotion = sc->sc_x;
-
- if (sc->sc_y > 127)
- info.ymotion = 127;
- else if (sc->sc_y < -127)
- info.ymotion = -127;
- else
- info.ymotion = sc->sc_y;
-
- /* Reset historical information. */
- sc->sc_x = sc->sc_y = 0;
- sc->sc_status &= ~BUTCHNGMASK;
- ndflush(&sc->sc_q, sc->sc_q.c_cc);
-
- splx(s);
- error = copyout(&info, addr, sizeof(struct mouseinfo));
- break;
- case MOUSEIOCSRAW:
- if (!(sc->sc_flags & PMS_RAW)) {
- FLUSHQ(&sc->sc_q);
- sc->sc_flags |= PMS_RAW;
- }
- error = 0;
- break;
- case MOUSEIOCSCOOKED:
- if (sc->sc_flags & PMS_RAW) {
- FLUSHQ(&sc->sc_q);
- sc->sc_flags &= ~PMS_RAW;
- }
- error = 0;
- break;
- default:
- error = EINVAL;
- break;
- }
-
- return error;
-}
-
-/* Masks for the first byte of a packet */
-#define PS2LBUTMASK 0x01
-#define PS2RBUTMASK 0x02
-#define PS2MBUTMASK 0x04
-
-int
-pmsintr(arg)
- void *arg;
-{
- struct pms_softc *sc = arg;
- static int state = 0;
- static u_char buttons;
- u_char changed;
- static char dx, dy;
- u_char buffer[5];
-
- if ((sc->sc_state & PMS_OPEN) == 0) {
- /* Interrupts are not expected. Discard the byte. */
- kbd_flush_input();
- return 0;
- }
-
- if(!(sc->sc_flags & PMS_RAW)) {
- switch (state) {
-
- case 0:
- buttons = inb(kbd_datap);
- if ((buttons & 0xc0) == 0)
- ++state;
- break;
-
- case 1:
- dx = inb(kbd_datap);
- /* Bounding at -127 avoids a bug in XFree86. */
- dx = (dx == -128) ? -127 : dx;
- ++state;
- break;
-
- case 2:
- dy = inb(kbd_datap);
- dy = (dy == -128) ? -127 : dy;
- state = 0;
-
- buttons = ((buttons & PS2LBUTMASK) << 2) |
- ((buttons & (PS2RBUTMASK | PS2MBUTMASK)) >> 1);
- changed = ((buttons ^ sc->sc_status) & BUTSTATMASK) << 3;
- sc->sc_status = buttons | (sc->sc_status & ~BUTSTATMASK) | changed;
-
- if (dx || dy || changed) {
- /* Update accumulated movements. */
- sc->sc_x += dx;
- sc->sc_y += dy;
-
- /* Add this event to the queue. */
- buffer[0] = 0x80 | (buttons & BUTSTATMASK);
- if(dx < 0)
- buffer[0] |= 0x10;
- buffer[1] = dx & 0x7f;
- if(dy < 0)
- buffer[0] |= 0x20;
- buffer[2] = dy & 0x7f;
- buffer[3] = buffer[4] = 0;
- (void) b_to_q(buffer, sizeof buffer, &sc->sc_q);
-
- if (sc->sc_state & PMS_ASLP) {
- sc->sc_state &= ~PMS_ASLP;
- wakeup((caddr_t)sc);
- }
- selwakeup(&sc->sc_rsel);
- }
-
- break;
- }
- }
- else {
- /* read data port */
- buffer[0] = inb(kbd_datap);
-
- /* emulate old state machine for the ioctl's sake. */
- switch (state) {
- case 0:
- buttons = buffer[0];
- if ((buttons & 0xc0) == 0) {
- ++state;
- buttons = ((buttons & PS2LBUTMASK) << 2) |
- ((buttons & (PS2RBUTMASK | PS2MBUTMASK)) >> 1);
- buffer[0] &= ~BUTSTATMASK;
- buffer[0] |= buttons ^ BUTSTATMASK; /* XXX Why? */
- }
- break;
- case 1:
- dx = buffer[0];
- /* Bounding at -127 avoids a bug in XFree86. */
- dx = (dx == -128) ? -127 : dx;
- ++state;
- break;
- case 2:
- dy = buffer[0];
- dy = (dy == -128) ? -127 : dy;
- state = 0;
-
- changed = ((buttons ^ sc->sc_status) & BUTSTATMASK) << 3;
- sc->sc_status = buttons | (sc->sc_status & ~BUTSTATMASK) | changed;
-
- if (dx || dy || changed) {
- /* Update accumulated movements. */
- sc->sc_x += dx;
- sc->sc_y += dy;
- }
- break;
- }
-
- /* add raw data to the queue. */
- (void) b_to_q(buffer, 1, &sc->sc_q);
-
- if (sc->sc_state & PMS_ASLP) {
- sc->sc_state &= ~PMS_ASLP;
- wakeup((caddr_t)sc);
- }
- selwakeup(&sc->sc_rsel);
- }
- return -1;
-}
-
-int
-pmsselect(dev, rw, p)
- dev_t dev;
- int rw;
- struct proc *p;
-{
- struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)];
- int s;
- int ret;
-
- if (rw == FWRITE)
- return 0;
-
- s = spltty();
- if (!sc->sc_q.c_cc) {
- selrecord(p, &sc->sc_rsel);
- ret = 0;
- } else
- ret = 1;
- splx(s);
-
- return ret;
-
-}
diff --git a/sys/arch/arc/dev/rd_root.c b/sys/arch/arc/dev/rd_root.c
deleted file mode 100644
index d687a0183a9..00000000000
--- a/sys/arch/arc/dev/rd_root.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* $NetBSD: rd_root.c,v 1.2 1996/03/27 16:38:33 perry Exp $ */
-
-/*
- * Copyright (c) 1995 Gordon W. Ross
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/reboot.h>
-
-#include <dev/ramdisk.h>
-
-extern int boothowto;
-
-#ifndef MINIROOTSIZE
-#define MINIROOTSIZE 512
-#endif
-
-#define ROOTBYTES (MINIROOTSIZE << DEV_BSHIFT)
-
-/*
- * This array will be patched to contain a file-system image.
- * See the program: src/distrib/sun3/common/rdsetroot.c
- */
-int rd_root_size = ROOTBYTES;
-char rd_root_image[ROOTBYTES] = "|This is the root ramdisk!\n";
-
-/*
- * This is called during autoconfig.
- */
-void
-rd_attach_hook(unit, rd)
- int unit;
- struct rd_conf *rd;
-{
- if (unit == 0) {
- /* Setup root ramdisk */
- rd->rd_addr = (caddr_t) rd_root_image;
- rd->rd_size = (size_t) rd_root_size;
- rd->rd_type = RD_KMEM_FIXED;
- printf("rd%d: fixed, %d blocks\n", unit, MINIROOTSIZE);
- }
-}
-
-/*
- * This is called during open (i.e. mountroot)
- */
-void
-rd_open_hook(unit, rd)
- int unit;
- struct rd_conf *rd;
-{
-}
diff --git a/sys/arch/arc/dev/scsi.h b/sys/arch/arc/dev/scsi.h
deleted file mode 100644
index 5e603ef7f3b..00000000000
--- a/sys/arch/arc/dev/scsi.h
+++ /dev/null
@@ -1,551 +0,0 @@
-/* $OpenBSD: scsi.h,v 1.2 1997/04/19 17:19:54 pefo Exp $ */
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)scsi.h 8.1 (Berkeley) 6/10/93
- * $Id: scsi.h,v 1.2 1997/04/19 17:19:54 pefo Exp $
- *
- * scsi.h --
- *
- * Common declarations for SCSI command formaters. This file only covers
- * definitions pertaining to the SCSI common command set that are
- * common to all SCSI device types (ie disk, tapes, WORM, printers, etc).
- * Some of the references from the proceedings of the
- * 1984 Mini/Micro Northeast conference might help in understanding SCSI.
- *
- * from: Header: /sprite/src/kernel/dev/RCS/scsi.h,
- * v 9.1 90/02/13 23:11:24 jhh Exp SPRITE (Berkeley)
- * $Id: scsi.h,v 1.2 1997/04/19 17:19:54 pefo Exp $
- */
-
-#ifndef _SCSI_H
-#define _SCSI_H
-
-/*
- * "Standard" SCSI Commands.
- * SCSI commands are divided into 8 groups as follows:
- * Group0 (0x00 - 0x1f). Basic commands. 6 bytes long
- * Group1 (0x20 - 0x3f). Extended command. 10 bytes.
- * Group2 (0x40 - 0x5f). Reserved.
- * Group2 (0x60 - 0x7f). Reserved.
- * Group2 (0x80 - 0x9f). Reserved.
- * Group2 (0xa0 - 0xbf). Reserved.
- * Group6 (0xc0 - 0xdf). Vendor Unique
- * Group7 (0xe0 - 0xff). Vendor Unique
- */
-
-/*
- * Scsi Group0 commands all are 6 bytes and have a format according to
- * struct ScsiGroup0Cmd.
- */
-#define SCSI_TEST_UNIT_READY 0x00
-#define SCSI_REZERO_UNIT 0x01
-#define SCSI_REWIND 0x01
-#define SCSI_REQUEST_SENSE 0x03
-#define SCSI_FORMAT_UNIT 0x04
-#define SCSI_READ_BLOCK_LIMITS 0x05
-#define SCSI_REASSIGN_BLOCKS 0x07
-#define SCSI_READ 0x08
-#define SCSI_WRITE 0x0a
-#define SCSI_SEEK 0x0b
-#define SCSI_TRACK_SELECT 0x0b
-#define SCSI_READ_REVERSE 0x0f
-#define SCSI_WRITE_EOF 0x10
-#define SCSI_SPACE 0x11
-#define SCSI_INQUIRY 0x12
-#define SCSI_VERIFY 0x13
-#define SCSI_READ_BUFFER 0x14
-#define SCSI_MODE_SELECT 0x15
-#define SCSI_RESERVE_UNIT 0x16
-#define SCSI_RELEASE_UNIT 0x17
-#define SCSI_COPY 0x18
-#define SCSI_ERASE_TAPE 0x19
-#define SCSI_MODE_SENSE 0x1a
-#define SCSI_START_STOP 0x1b
-#define SCSI_LOAD_UNLOAD 0x1b
-#define SCSI_RECV_DIAG_RESULTS 0x1c
-#define SCSI_SEND_DIAGNOSTIC 0x1d
-#define SCSI_PREVENT_ALLOW 0x1e
-
-/*
- * Group1 commands are all 10 bytes and have a format according to
- * struct ScsiGroup1Cmd.
- */
-#define SCSI_READ_CAPACITY 0x25
-#define SCSI_READ_EXT 0x28
-#define SCSI_WRITE_EXT 0x2a
-#define SCSI_SEEK_EXT 0x2b
-#define SCSI_WRITE_VERIFY 0x2e
-#define SCSI_VERIFY_EXT 0x2f
-#define SCSI_SEARCH_HIGH 0x30
-#define SCSI_SEARCH_EQUAL 0x31
-#define SCSI_SEARCH_LOW 0x32
-#define SCSI_SET_LIMITS 0x33
-#define SCSI_COMPARE 0x39
-#define SCSI_COPY_VERIFY 0x3a
-
-/*
- * Control byte flags for Group0 and Group1 commands.
- *
- * SCSI_CTRL_LINK - This is used to prevent a bus free phase between commands.
- * If the command terminates successfully, a SCSI_LINKED_CMD_COMPLETE
- * message is returned instead of the normal SCSI_COMMAND_COMPLETE message. * The last command in a chain should not have this bit set
- * (and consequently gets a normal SCSI_COMMAND_COMPLETE message).
- * SCSI_CTRL_LINK_FLAG - This bit should only set when SCSI_CTRL_LINK is set and
- * causes a SCSI_LINKED_FLAGED_CMD_COMPLETE to be returned instead of
- * a SCSI_LINKED_CMD_COMPLETE.
- */
-#define SCSI_CTRL_LINK 0x01 /* Link commands (no bus free phase) */
-#define SCSI_CTRL_LINK_INTR 0x02 /* Interrupt after linked command */
-
-/*
- * The standard group0 6-byte SCSI control block. Note that the
- * fields between highAddr and blockCount inclusive are command dependent.
- * The definitions Addr and BlockCount cover most of the commands we will
- * use.
- */
-typedef struct ScsiGroup0Cmd {
- u_char command; /* command code, defined below. The
- * upper three bits of this are zero
- * to indicate the control block is
- * only 6 bytes long */
-#if BYTE_ORDER == BIG_ENDIAN
- u_char unitNumber :3; /* Logical Unit (LUN) to which to
- * pass the command. The device
- * has already been selected using
- * the "targetID" bit. */
- u_char highAddr :5; /* High bits of address */
-#else
- u_char highAddr :5; /* High bits of address */
- u_char unitNumber :3; /* Logical Unit (LUN) to which to
- * pass the command. The device
- * has already been selected using
- * the "targetID" bit. */
-#endif
- u_char midAddr; /* Middle bits of address */
- u_char lowAddr; /* Low bits of address */
- u_char blockCount; /* Blocks to transfer */
- u_char control; /* See flags for common bits */
-} ScsiGroup0Cmd;
-
-/*
- * Format of a SCSI_START_STOP command. This is a group 0 command, but
- * the command contents are different.
- */
-typedef struct ScsiStartStopCmd {
-#if BYTE_ORDER == BIG_ENDIAN
- u_char command; /* command code, defined below. The
- * upper three bits of this are zero
- * to indicate the control block is
- * only 6 bytes long */
- u_char unitNumber :3; /* Logical Unit (LUN) to which to
- * pass the command. The device
- * has already been selected using
- * the "targetID" bit. */
- u_char pad1 :4; /* Reserved */
- u_char immed :1; /* Immediate status bit */
- u_char pad2; /* Reserved */
- u_char pad3; /* Reserved */
- u_char pad4 :6; /* Reserved */
- u_char loadEject :1; /* Load or eject medium */
- u_char start :1; /* Start or stop medium */
- u_char control; /* See flags for common bits */
-#else
- u_char command; /* command code, defined below. The
- * upper three bits of this are zero
- * to indicate the control block is
- * only 6 bytes long */
- u_char immed :1; /* Immediate status bit */
- u_char pad1 :4; /* Reserved */
- u_char unitNumber :3; /* Logical Unit (LUN) to which to
- * pass the command. The device
- * has already been selected using
- * the "targetID" bit. */
- u_char pad2; /* Reserved */
- u_char pad3; /* Reserved */
- u_char start :1; /* Start or stop medium */
- u_char loadEject :1; /* Load or eject medium */
- u_char pad4 :6; /* Reserved */
- u_char control; /* See flags for common bits */
-#endif
-} ScsiStartStopCmd;
-
-/*
- * The standard group1 10-byte SCSI control block. Note that the
- * fields between highAddr and blockCount inclusive are command dependent.
- * The definitions Addr and BlockCount cover most of the commands we will
- * use.
- */
-typedef struct ScsiGroup1Cmd {
- u_char command; /* command code, defined below. The
- * upper three bits of this are zero
- * to indicate the control block is
- * only 6 bytes long */
-#if BYTE_ORDER == BIG_ENDIAN
- u_char unitNumber :3; /* Logical Unit (LUN) to which to
- * pass the command. The device
- * has already been selected using
- * the "targetID" bit. */
- u_char pad1 :5; /* Reserved */
-#else
- u_char pad1 :5; /* Reserved */
- u_char unitNumber :3; /* Logical Unit (LUN) to which to
- * pass the command. The device
- * has already been selected using
- * the "targetID" bit. */
-#endif
- u_char highAddr; /* High bits of address */
- u_char midHighAddr; /* Middle high bits of address */
- u_char midLowAddr; /* Middle low bits of address */
- u_char lowAddr; /* Low bits of address */
- u_char pad2; /* Reserved */
- u_char highBlockCount; /* High bits of blocks to transfer */
- u_char lowBlockCount; /* Low bits of blocks to transfer */
- u_char control; /* See flags for common bits */
-} ScsiGroup1Cmd;
-
-/*
- * SCSI status completion information.
- * This is returned by the device when a command completes.
- */
-#define SCSI_STATUS_CHECKCOND 0x02 /* Check Condition (ie., read sense) */
-#define SCSI_STATUS_CONDMET 0x04 /* Condition Met (ie., search worked) */
-#define SCSI_STATUS_BUSY 0x08
-#define SCSI_STATUS_INTERMED 0x10 /* Intermediate status sent */
-#define SCSI_STATUS_EXT 0x80 /* Extended status valid */
-
-/*
- * Sense information provided after some errors. This is divided into
- * two kinds, classes 0-6, and class 7. This is 30 bytes big to allow
- * for the drive specific sense bytes that follow the standard 4 byte header.
- *
- * For extended sense, this buffer may be cast into another type. Also
- * The actual size of the sense data returned is used to detect what
- * kind of tape drive is out there. Kludgy, but true.
- */
-typedef struct ScsiClass0Sense {
-#if BYTE_ORDER == BIG_ENDIAN
- u_char valid :1; /* Sense data is valid */
- u_char error :7; /* 3 bits class and 4 bits code */
-#else
- u_char error :7; /* 3 bits class and 4 bits code */
- u_char valid :1; /* Sense data is valid */
-#endif
- u_char highAddr; /* High byte of block address */
- u_char midAddr; /* Middle byte of block address */
- u_char lowAddr; /* Low byte of block address */
- u_char sense[26]; /* Target specific sense data */
-} ScsiClass0Sense;
-
-/*
- * Definitions for errors in the sense data. The error field is specified
- * as a 3 bit class and 4 bit code, but it is easier to treat it as a
- * single 7 bit field.
- */
-#define SCSI_NO_SENSE_DATA 0x00
-#define SCSI_NOT_READY 0x04
-#define SCSI_NOT_LOADED 0x09
-#define SCSI_INSUF_CAPACITY 0x0a
-#define SCSI_HARD_DATA_ERROR 0x11
-#define SCSI_WRITE_PROTECT 0x17
-#define SCSI_CORRECTABLE_ERROR 0x18
-#define SCSI_FILE_MARK 0x1c
-#define SCSI_INVALID_COMMAND 0x20
-#define SCSI_UNIT_ATTENTION 0x30
-#define SCSI_END_OF_MEDIA 0x34
-
-/*
- * The standard "extended" sense data returned by SCSI devices. This
- * has an error field of 0x70, for a "class 7" error.
- */
-typedef struct ScsiClass7Sense {
-#if BYTE_ORDER == BIG_ENDIAN
- u_char valid :1; /* Sense data is valid */
- u_char error7 :7; /* == 0x70 */
- u_char pad1; /* Also "segment number" for copy */
- u_char fileMark :1; /* File mark on device */
- u_char endOfMedia :1; /* End of media reached */
- u_char badBlockLen :1; /* Block length mis-match (Exabyte) */
- u_char pad2 :1;
- u_char key :4; /* Sense keys defined below */
- u_char info1; /* Information byte 1 */
- u_char info2; /* Information byte 2 */
- u_char info3; /* Information byte 3 */
- u_char info4; /* Information byte 4 */
- u_char length; /* Number of additional info bytes */
-#else
- u_char error7 :7; /* == 0x70 */
- u_char valid :1; /* Sense data is valid */
- u_char pad1; /* Also "segment number" for copy */
- u_char key :4; /* Sense keys defined below */
- u_char pad2 :1;
- u_char badBlockLen :1; /* Block length mis-match (Exabyte) */
- u_char endOfMedia :1; /* End of media reached */
- u_char fileMark :1; /* File mark on device */
- u_char info1; /* Information byte 1 */
- u_char info2; /* Information byte 2 */
- u_char info3; /* Information byte 3 */
- u_char info4; /* Information byte 4 */
- u_char length; /* Number of additional info bytes */
-#endif
-} ScsiClass7Sense; /* 8 Bytes */
-
-/*
- * Key values for standardized sense class 7.
- */
-#define SCSI_CLASS7_NO_SENSE 0
-#define SCSI_CLASS7_RECOVERABLE 1
-#define SCSI_CLASS7_NOT_READY 2
-#define SCSI_CLASS7_MEDIA_ERROR 3
-#define SCSI_CLASS7_HARDWARE_ERROR 4
-#define SCSI_CLASS7_ILLEGAL_REQUEST 5
-
-/*
- * These seem to have different meanings to different vendors....
- */
-#define SCSI_CLASS7_MEDIA_CHANGE 6
-#define SCSI_CLASS7_UNIT_ATTN 6
-
-#define SCSI_CLASS7_WRITE_PROTECT 7
-#define SCSI_CLASS7_BLANK_CHECK 8
-#define SCSI_CLASS7_VENDOR 9
-#define SCSI_CLASS7_POWER_UP_FAILURE 10
-#define SCSI_CLASS7_ABORT 11
-#define SCSI_CLASS7_EQUAL 12
-#define SCSI_CLASS7_OVERFLOW 13
-#define SCSI_CLASS7_RESERVED_14 14
-#define SCSI_CLASS7_RESERVED_15 15
-
-/*
- * Data return by the SCSI inquiry command.
- */
-typedef struct ScsiInquiryData {
-#if BYTE_ORDER == BIG_ENDIAN
- u_char type; /* Peripheral Device type. See below. */
- u_char rmb:1; /* Removable Medium bit. */
- u_char qualifier:7; /* Device type qualifier. */
- u_char version; /* Version info. */
- u_char reserved:4; /* reserved. */
- u_char format:4; /* Response format. */
- u_char length; /* length of data returned. */
- u_char reserved2[2]; /* Reserved */
- u_char flags; /* SCSI II flags (see below) */
- u_char vendorID[8]; /* Vendor ID (ASCII) */
- u_char productID[16]; /* Product ID (ASCII) */
- u_char revLevel[4]; /* Revision level (ASCII) */
- u_char revData[8]; /* Revision data (ASCII) */
-#else
- u_char type; /* Peripheral Device type. See below. */
- u_char qualifier:7; /* Device type qualifier. */
- u_char rmb:1; /* Removable Medium bit. */
- u_char version; /* Version info. */
- u_char format:4; /* Response format. */
- u_char reserved:4; /* reserved. */
- u_char length; /* length of data returned. */
- u_char reserved2[2]; /* Reserved */
- u_char flags; /* SCSI II flags (see below) */
- u_char vendorID[8]; /* Vendor ID (ASCII) */
- u_char productID[16]; /* Product ID (ASCII) */
- u_char revLevel[4]; /* Revision level (ASCII) */
- u_char revData[8]; /* Revision data (ASCII) */
-#endif
-} ScsiInquiryData;
-
-/*
- * The SCSI Peripheral type ID codes as return by the SCSI_INQUIRY command.
- *
- * SCSI_DISK_TYPE - Direct Access Device.
- * SCSI_TAPE_TYPE - Sequential Access Device.
- * SCSI_PRINTER_TYPE - Printer Device.
- * SCSI_HOST_TYPE - Processor Device.
- * SCSI_WORM_TYPE - Write-Once Read-Multiple Device.
- * SCSI_ROM_TYPE - Read-Only Direct Access Device.
- * SCSI_SCANNER_TYPE - Scanner device.
- * SCSI_OPTICAL_MEM_TYPE - Optical memory device.
- * SCSI_MEDIUM_CHANGER_TYPE - Medium changer device.
- * SCSI_COMMUNICATIONS_TYPE - Communications device.
- * SCSI_NODEVICE_TYPE - Logical Unit not present or implemented.
- *
- * Note that codes 0xa-0x7e are reserved and 0x80-0xff are vendor unique.
- */
-#define SCSI_DISK_TYPE 0
-#define SCSI_TAPE_TYPE 1
-#define SCSI_PRINTER_TYPE 2
-#define SCSI_HOST_TYPE 3
-#define SCSI_WORM_TYPE 4
-#define SCSI_ROM_TYPE 5
-#define SCSI_SCANNER_TYPE 6
-#define SCSI_OPTICAL_MEM_TYPE 7
-#define SCSI_MEDIUM_CHANGER_TYPE 8
-#define SCSI_COMMUNICATIONS_TYPE 9
-#define SCSI_NODEVICE_TYPE 0x7f
-
-/*
- * The SCSI I & II inquiry flags.
- *
- * SCSI_REL_ADR - Relative addressing supported.
- * SCSI_WIDE_32 - 32 bit wide SCSI bus transfers supported.
- * SCSI_WIDE_16 - 16 bit wide SCSI bus transfers supported.
- * SCSI_SYNC - Synchronous data transfers supported.
- * SCSI_LINKED - Linked commands supported.
- * SCSI_CMD_QUEUE - Tagged command queuing supported.
- * SCSI_SOFT_RESET - Soft RESET alternative suported.
- */
-#define SCSI_REL_ADR 0x80
-#define SCSI_WIDE_32 0x40
-#define SCSI_WIDE_16 0x20
-#define SCSI_SYNC 0x10
-#define SCSI_LINKED 0x08
-#define SCSI_CMD_QUEUE 0x02
-#define SCSI_SOFT_RESET 0x01
-
-/*
- * Standard header for SCSI_MODE_SENSE and SCSI_MODE_SELECT commands for tapes.
- */
-typedef struct ScsiTapeModeSelectHdr {
- u_char len; /* length */
- u_char media; /* media type */
-#if BYTE_ORDER == BIG_ENDIAN
- u_char writeprot:1; /* Write protected media */
- u_char bufferedMode:3; /* Type of buffer to be done. */
- u_char speed:4; /* Drive speed. */
-#else
- u_char speed:4; /* Drive speed. */
- u_char bufferedMode:3; /* Type of buffer to be done. */
- u_char writeprot:1; /* Write protected media */
-#endif
- u_char length; /* Block descriptor length. */
- u_char density; /* tape density code */
- u_char blocks_2; /* number of blocks (MSB) */
- u_char blocks_1; /* number of blocks */
- u_char blocks_0; /* number of blocks (LSB) */
- u_char reserved; /* */
- u_char block_size2; /* Tape block size (MSB) */
- u_char block_size1; /* Tape block size */
- u_char block_size0; /* Tape block size (LSB) */
- u_char vendor[6]; /* vendor specific data */
-} ScsiTapeModeSelectHdr;
-
-/*
- * Definitions of SCSI messages.
- *
- * SCSI_COMMAND_COMPLETE - After a command has completed, successfully
- * or not, this is returned to the host from the target.
- *
- * SCSI_EXTENDED_MSG - Indicates that a multi-byte message is being sent.
- *
- * The following messages are used with connect/disconnect:
- * SCSI_SAVE_DATA_POINTER - Sent from target to host to request saving
- * of current DMA address and count. Indicates a pending dis-connect.
- * SCSI_RESTORE_POINTER - Sent from the target to the host to request
- * restoring pointers saved before a disconnect
- * SCSI_DISCONNECT - Sent from the target to the host to disconnect.
- * SCSI_ABORT - Sent from the host to the target to abort current request.
- * SCSI_MESSAGE_REJECT - Indicates receipt, by either host or target, of
- * an unimplemented message.
- * SCSI_NO_OP - Sent from host to target if it has no real message to send.
- * SCSI_MESSAGE_PARITY_ERROR - Sent from host to target on message parity error
- * SCSI_BUS_RESET - Sent from host to target to reset all current I/O
- *
- * SCSI_IDENTIFY - The low order two bits of this message type indicate
- * the Logical Unit of the Target which is requesting a reconnect.
- * SCSI_DIS_REC_IDENTIFY - Sent from the host to a target to indicate
- * is supports connect/dis-connect
- *
- */
-#define SCSI_COMMAND_COMPLETE 0x00
-#define SCSI_EXTENDED_MSG 0x01
-#define SCSI_SAVE_DATA_POINTER 0x02
-#define SCSI_RESTORE_POINTERS 0x03
-#define SCSI_DISCONNECT 0x04
-#define SCSI_ABORT 0x06
-#define SCSI_MESSAGE_REJECT 0x07
-#define SCSI_NO_OP 0x08
-#define SCSI_MESSAGE_PARITY_ERROR 0x09
-#define SCSI_LINKED_CMD_COMPLETE 0x0A
-#define SCSI_LINKED_FLAGED_CMD_COMPLETE 0x0B
-#define SCSI_BUS_RESET 0x0C
-
-#define SCSI_IDENTIFY 0x80
-#define SCSI_DIS_REC_IDENTIFY 0xc0
-
-/*
- * Extended message types (2nd byte of SCSI_EXTENDED_MSG).
- */
-#define SCSI_MODIFY_DATA_PTR 0x00
-#define SCSI_SYNCHRONOUS_XFER 0x01
-#define SCSI_EXTENDED_IDENTIFY 0x02 /* only in SCSI I */
-#define SCSI_WIDE_XFER 0x03
-
-/*
- * Driver ioctl's for various scsi operations.
- */
-#ifndef _IOCTL_
-#include <sys/ioctl.h>
-#endif
-
-/*
- * Control for SCSI "format" mode.
- *
- * "Format" mode allows a privileged process to issue direct SCSI
- * commands to a drive (it is intended primarily to allow on-line
- * formatting). SDIOCSFORMAT with a non-zero arg will put the drive
- * into format mode; a zero arg will take it out. When in format
- * mode, only the process that issued the SDIOCFORMAT can read or
- * write the drive.
- *
- * In format mode, process is expected to
- * - do SDIOCSCSICOMMAND to supply cdb for next SCSI op
- * - do read or write as appropriate for cdb
- * - if i/o error, optionally do SDIOCSENSE to get completion
- * status and sense data from last scsi operation.
- */
-
-struct scsi_fmt_cdb {
- int len; /* cdb length (in bytes) */
- u_char cdb[28]; /* cdb to use on next read/write */
-};
-
-struct scsi_fmt_sense {
- u_int status; /* completion status of last op */
- u_char sense[32]; /* sense data (if any) from last op */
-};
-
-#define SDIOCSFORMAT _IOW('S', 0x1, int)
-#define SDIOCGFORMAT _IOR('S', 0x2, int)
-#define SDIOCSCSICOMMAND _IOW('S', 0x3, struct scsi_fmt_cdb)
-#define SDIOCSENSE _IOR('S', 0x4, struct scsi_fmt_sense)
-
-#endif /* _SCSI_H */
diff --git a/sys/arch/arc/dti/btl.c b/sys/arch/arc/dti/btl.c
deleted file mode 100644
index 3392b3b5087..00000000000
--- a/sys/arch/arc/dti/btl.c
+++ /dev/null
@@ -1,1436 +0,0 @@
-/* $NetBSD: bt.c,v 1.10 1996/05/12 23:51:54 mycroft Exp $ */
-
-#undef BTDIAG
-#define integrate
-
-/*
- * Copyright (c) 1994, 1996 Charles M. Hannum. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles M. Hannum.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Originally written by Julian Elischer (julian@tfs.com)
- * for TRW Financial Systems for use under the MACH(2.5) operating system.
- *
- * TRW Financial Systems, in accordance with their agreement with Carnegie
- * Mellon University, makes this software available to CMU to distribute
- * or use in any manner that they see fit as long as this message is kept with
- * the software. For this reason TFS also grants any other persons or
- * organisations permission to use or modify this software.
- *
- * TFS supplies this software to be publicly redistributed
- * on the understanding that TFS is not responsible for the correct
- * functioning of this software in any circumstances.
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/errno.h>
-#include <sys/malloc.h>
-#include <sys/ioctl.h>
-#include <sys/device.h>
-#include <sys/buf.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-
-#include <machine/intr.h>
-#include <machine/pio.h>
-
-#include <arc/dti/desktech.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-
-#include <dev/isa/isavar.h>
-#include <arc/dti/btlreg.h>
-#include <mips/archtype.h> /* XXX for cpu types */
-
-#ifndef DDB
-#define Debugger() panic("should call debugger here (bt742a.c)")
-#endif /* ! DDB */
-
-/*
- * Mail box defs etc.
- * these could be bigger but we need the bt_softc to fit on a single page..
- */
-#define BT_MBX_SIZE 32 /* mail box size (MAX 255 MBxs) */
- /* don't need that many really */
-#define BT_CCB_MAX 32 /* store up to 32 CCBs at one time */
-#define CCB_HASH_SIZE 32 /* hash table size for phystokv */
-#define CCB_HASH_SHIFT 9
-#define CCB_HASH(x) ((((long)(x))>>CCB_HASH_SHIFT) & (CCB_HASH_SIZE - 1))
-
-#define bt_nextmbx(wmb, mbx, mbio) \
- if ((wmb) == &(mbx)->mbio[BT_MBX_SIZE - 1]) \
- (wmb) = &(mbx)->mbio[0]; \
- else \
- (wmb)++;
-
-struct bt_mbx {
- struct bt_mbx_out mbo[BT_MBX_SIZE];
- struct bt_mbx_in mbi[BT_MBX_SIZE];
- struct bt_mbx_out *cmbo; /* Collection Mail Box out */
- struct bt_mbx_out *tmbo; /* Target Mail Box out */
- struct bt_mbx_in *tmbi; /* Target Mail Box in */
-};
-
-#define KVTOPHYS(x) ((system_type == DESKSTATION_TYNE) ? \
- (((int)(x) & 0x7fffff) | 0x800000) : ((int)(x)))
-#define PHYSTOKV(x) ((system_type == DESKSTATION_TYNE) ? \
- (((int)(x) & 0x7fffff) | TYNE_V_BOUNCE) : ((int)(x)))
-
-#include "aha.h"
-#include "btl.h"
-#if NAHA > 0
-int btports[NBT];
-int nbtports;
-#endif
-
-struct bt_softc {
- struct device sc_dev;
- struct isadev sc_id;
- void *sc_ih;
-
- int sc_iobase;
- int sc_irq, sc_drq;
-
- char sc_model[7],
- sc_firmware[6];
-
- struct bt_mbx *sc_mbx; /* all our mailboxes */
-#define wmbx (sc->sc_mbx)
- struct bt_ccb *sc_ccbhash[CCB_HASH_SIZE];
- TAILQ_HEAD(, bt_ccb) sc_free_ccb, sc_waiting_ccb;
- TAILQ_HEAD(, bt_buf) sc_free_buf;
- int sc_numccbs, sc_mbofull;
- int sc_numbufs;
- int sc_scsi_dev; /* adapters scsi id */
- struct scsi_link sc_link; /* prototype for devs */
-};
-
-#ifdef BTDEBUG
-int bt_debug = 0;
-#endif /* BTDEBUG */
-
-int bt_cmd __P((int, struct bt_softc *, int, u_char *, int, u_char *));
-integrate void bt_finish_ccbs __P((struct bt_softc *));
-int btintr __P((void *));
-integrate void bt_reset_ccb __P((struct bt_softc *, struct bt_ccb *));
-void bt_free_ccb __P((struct bt_softc *, struct bt_ccb *));
-integrate void bt_init_ccb __P((struct bt_softc *, struct bt_ccb *));
-struct bt_ccb *bt_get_ccb __P((struct bt_softc *, int));
-struct bt_ccb *bt_ccb_phys_kv __P((struct bt_softc *, u_long));
-void bt_queue_ccb __P((struct bt_softc *, struct bt_ccb *));
-void bt_collect_mbo __P((struct bt_softc *));
-void bt_start_ccbs __P((struct bt_softc *));
-void bt_done __P((struct bt_softc *, struct bt_ccb *));
-int bt_find __P((struct isa_attach_args *, struct bt_softc *));
-void bt_init __P((struct bt_softc *));
-void bt_inquire_setup_information __P((struct bt_softc *));
-void btminphys __P((struct buf *));
-int bt_scsi_cmd __P((struct scsi_xfer *));
-int bt_poll __P((struct bt_softc *, struct scsi_xfer *, int));
-void bt_timeout __P((void *arg));
-void bt_free_buf __P((struct bt_softc *, struct bt_buf *));
-struct bt_buf * bt_get_buf __P((struct bt_softc *, int));
-
-struct scsi_adapter bt_switch = {
- bt_scsi_cmd,
- btminphys,
- 0,
- 0,
-};
-
-/* XXX static buffer as a kludge. DMA isn't cache coherent on the rpc44, so
- * we always use uncached buffers for DMA. */
-static char rpc44_buffer[ TYNE_S_BOUNCE ];
-
-/* the below structure is so we have a default dev struct for out link struct */
-struct scsi_device bt_dev = {
- NULL, /* Use default error handler */
- NULL, /* have a queue, served by this */
- NULL, /* have no async handler */
- NULL, /* Use default 'done' routine */
-};
-
-int btprobe __P((struct device *, void *, void *));
-void btattach __P((struct device *, struct device *, void *));
-int btprint __P((void *, const char *));
-
-struct cfattach btl_ca = {
- sizeof(struct bt_softc), btprobe, btattach
-};
-
-struct cfdriver btl_cd = {
- NULL, "bt", DV_DULL
-};
-
-#define BT_RESET_TIMEOUT 2000 /* time to wait for reset (mSec) */
-#define BT_ABORT_TIMEOUT 2000 /* time to wait for abort (mSec) */
-
-/*
- * bt_cmd(iobase, sc, icnt, ibuf, ocnt, obuf)
- *
- * Activate Adapter command
- * icnt: number of args (outbound bytes including opcode)
- * ibuf: argument buffer
- * ocnt: number of expected returned bytes
- * obuf: result buffer
- * wait: number of seconds to wait for response
- *
- * Performs an adapter command through the ports. Not to be confused with a
- * scsi command, which is read in via the dma; one of the adapter commands
- * tells it to read in a scsi command.
- */
-int
-bt_cmd(iobase, sc, icnt, ibuf, ocnt, obuf)
- int iobase;
- struct bt_softc *sc;
- int icnt, ocnt;
- u_char *ibuf, *obuf;
-{
- const char *name;
- register int i;
- int wait;
- u_char sts;
- u_char opcode = ibuf[0];
-
- if (sc != NULL)
- name = sc->sc_dev.dv_xname;
- else
- name = "(bt probe)";
-
- /*
- * Calculate a reasonable timeout for the command.
- */
- switch (opcode) {
- case BT_INQUIRE_DEVICES:
- wait = 15 * 20000;
- break;
- default:
- wait = 1 * 20000;
- break;
- }
-
- /*
- * Wait for the adapter to go idle, unless it's one of
- * the commands which don't need this
- */
- if (opcode != BT_MBO_INTR_EN) {
- for (i = 20000; i; i--) { /* 1 sec? */
- sts = isa_inb(iobase + BT_STAT_PORT);
- if (sts & BT_STAT_IDLE)
- break;
- delay(50);
- }
- if (!i) {
- printf("%s: bt_cmd, host not idle(0x%x)\n",
- name, sts);
- return ENXIO;
- }
- }
- /*
- * Now that it is idle, if we expect output, preflush the
- * queue feeding to us.
- */
- if (ocnt) {
- while ((isa_inb(iobase + BT_STAT_PORT)) & BT_STAT_DF)
- isa_inb(iobase + BT_DATA_PORT);
- }
- /*
- * Output the command and the number of arguments given
- * for each byte, first check the port is empty.
- */
- while (icnt--) {
- for (i = wait; i; i--) {
- sts = isa_inb(iobase + BT_STAT_PORT);
- if (!(sts & BT_STAT_CDF))
- break;
- delay(50);
- }
- if (!i) {
- if (opcode != BT_INQUIRE_REVISION &&
- opcode != BT_INQUIRE_REVISION_3)
- printf("%s: bt_cmd, cmd/data port full\n", name);
- isa_outb(iobase + BT_CTRL_PORT, BT_CTRL_SRST);
- return ENXIO;
- }
- isa_outb(iobase + BT_CMD_PORT, *ibuf++);
- }
- /*
- * If we expect input, loop that many times, each time,
- * looking for the data register to have valid data
- */
- while (ocnt--) {
- for (i = wait; i; i--) {
- sts = isa_inb(iobase + BT_STAT_PORT);
- if (sts & BT_STAT_DF)
- break;
- delay(50);
- }
- if (!i) {
- if (opcode != BT_INQUIRE_REVISION &&
- opcode != BT_INQUIRE_REVISION_3)
- printf("%s: bt_cmd, cmd/data port empty %d\n",
- name, ocnt);
- isa_outb(iobase + BT_CTRL_PORT, BT_CTRL_SRST);
- return ENXIO;
- }
- *obuf++ = isa_inb(iobase + BT_DATA_PORT);
- }
- /*
- * Wait for the board to report a finished instruction.
- * We may get an extra interrupt for the HACC signal, but this is
- * unimportant.
- */
- if (opcode != BT_MBO_INTR_EN) {
- for (i = 20000; i; i--) { /* 1 sec? */
- sts = isa_inb(iobase + BT_INTR_PORT);
- /* XXX Need to save this in the interrupt handler? */
- if (sts & BT_INTR_HACC)
- break;
- delay(50);
- }
- if (!i) {
- printf("%s: bt_cmd, host not finished(0x%x)\n",
- name, sts);
- return ENXIO;
- }
- }
- isa_outb(iobase + BT_CTRL_PORT, BT_CTRL_IRST);
- return 0;
-}
-
-/*
- * Check if the device can be found at the port given
- * and if so, set it up ready for further work
- * as an argument, takes the isa_device structure from
- * autoconf.c
- */
-int
-btprobe(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- register struct isa_attach_args *ia = aux;
-
-#ifdef NEWCONFIG
- if (ia->ia_iobase == IOBASEUNK)
- return 0;
-#endif
-
- /* See if there is a unit at this location. */
- if (bt_find(ia, NULL) != 0)
- return 0;
-
- ia->ia_msize = 0;
- ia->ia_iosize = 4;
- /* IRQ and DRQ set by bt_find(). */
- return 1;
-}
-
-int
-btprint(aux, name)
- void *aux;
- const char *name;
-{
-
- if (name != NULL)
- printf("%s: scsibus ", name);
- return UNCONF;
-}
-
-/*
- * Attach all the sub-devices we can find
- */
-void
-btattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct isa_attach_args *ia = aux;
- struct bt_softc *sc = (void *)self;
- struct bt_ccb *ccb;
- struct bt_buf *buf;
- u_int bouncearea;
- u_int bouncebase;
- u_int bouncesize;
-
- if (bt_find(ia, sc) != 0)
- panic("btattach: bt_find of %s failed", self->dv_xname);
- sc->sc_iobase = ia->ia_iobase;
-
- /*
- * create mbox area
- */
- if (system_type == DESKSTATION_TYNE) {
- bouncebase = TYNE_V_BOUNCE;
- bouncesize = TYNE_S_BOUNCE;
- } else {
- bouncesize = TYNE_S_BOUNCE; /* Good enough? XXX */
-/* bouncebase = (u_int) malloc( bouncesize, M_DEVBUF, M_NOWAIT);*/
- bouncebase = (u_int) rpc44_buffer | 0xa0000000;
- }
- bouncearea = bouncebase + sizeof(struct bt_mbx);
- sc->sc_mbx = (struct bt_mbx *)bouncebase;
-
- bt_inquire_setup_information(sc);
- bt_init(sc);
- TAILQ_INIT(&sc->sc_free_ccb);
- TAILQ_INIT(&sc->sc_free_buf);
- TAILQ_INIT(&sc->sc_waiting_ccb);
-
- /*
- * fill up with ccb's
- */
- while (sc->sc_numccbs < BT_CCB_MAX) {
- ccb = (struct bt_ccb *)bouncearea;
- bouncearea += sizeof(struct bt_ccb);
- bt_init_ccb(sc, ccb);
- TAILQ_INSERT_HEAD(&sc->sc_free_ccb, ccb, chain);
- sc->sc_numccbs++;
- }
- /*
- * fill up with bufs's
- */
- while ((bouncearea + sizeof(struct bt_buf)) < bouncebase + bouncesize) {
- buf = (struct bt_buf *)bouncearea;
- bouncearea += sizeof(struct bt_buf);
- TAILQ_INSERT_HEAD(&sc->sc_free_buf, buf, chain);
- sc->sc_numbufs++;
- }
- /*
- * fill in the prototype scsi_link.
- */
- sc->sc_link.adapter_softc = sc;
- sc->sc_link.adapter_target = sc->sc_scsi_dev;
- sc->sc_link.adapter = &bt_switch;
- sc->sc_link.device = &bt_dev;
- sc->sc_link.openings = 1;
-
-#ifdef NEWCONFIG
- isa_establish(&sc->sc_id, &sc->sc_dev);
-#endif
- sc->sc_ih = isa_intr_establish(ia->ia_ic, sc->sc_irq, IST_EDGE,
- IPL_BIO, btintr, sc, sc->sc_dev.dv_xname);
-
- /*
- * ask the adapter what subunits are present
- */
- config_found(self, &sc->sc_link, btprint);
-}
-
-integrate void
-bt_finish_ccbs(sc)
- struct bt_softc *sc;
-{
- struct bt_mbx_in *wmbi;
- struct bt_ccb *ccb;
- int i;
-
- wmbi = wmbx->tmbi;
-
- if (wmbi->stat == BT_MBI_FREE) {
- for (i = 0; i < BT_MBX_SIZE; i++) {
- if (wmbi->stat != BT_MBI_FREE) {
- printf("%s: mbi not in round-robin order\n",
- sc->sc_dev.dv_xname);
- goto AGAIN;
- }
- bt_nextmbx(wmbi, wmbx, mbi);
- }
-#ifdef BTDIAGnot
- printf("%s: mbi interrupt with no full mailboxes\n",
- sc->sc_dev.dv_xname);
-#endif
- return;
- }
-
-AGAIN:
- do {
- ccb = bt_ccb_phys_kv(sc, phystol(wmbi->ccb_addr));
- if (!ccb) {
- printf("%s: bad mbi ccb pointer; skipping\n",
- sc->sc_dev.dv_xname);
- goto next;
- }
-
-#ifdef BTDEBUG
- if (bt_debug) {
- u_char *cp = (u_char *) &ccb->scsi_cmd;
- printf("op=%x %x %x %x %x %x\n",
- cp[0], cp[1], cp[2], cp[3], cp[4], cp[5]);
- printf("stat %x for mbi addr = 0x%08x, ",
- wmbi->stat, wmbi);
- printf("ccb addr = 0x%x\n", ccb);
- }
-#endif /* BTDEBUG */
-
- switch (wmbi->stat) {
- case BT_MBI_OK:
- case BT_MBI_ERROR:
- if ((ccb->flags & CCB_ABORT) != 0) {
- /*
- * If we already started an abort, wait for it
- * to complete before clearing the CCB. We
- * could instead just clear CCB_SENDING, but
- * what if the mailbox was already received?
- * The worst that happens here is that we clear
- * the CCB a bit later than we need to. BFD.
- */
- goto next;
- }
- break;
-
- case BT_MBI_ABORT:
- case BT_MBI_UNKNOWN:
- /*
- * Even if the CCB wasn't found, we clear it anyway.
- * See preceeding comment.
- */
- break;
-
- default:
- printf("%s: bad mbi status %02x; skipping\n",
- sc->sc_dev.dv_xname, wmbi->stat);
- goto next;
- }
-
- untimeout(bt_timeout, ccb);
- bt_done(sc, ccb);
-
- next:
- wmbi->stat = BT_MBI_FREE;
- bt_nextmbx(wmbi, wmbx, mbi);
- } while (wmbi->stat != BT_MBI_FREE);
-
- wmbx->tmbi = wmbi;
-}
-
-/*
- * Catch an interrupt from the adaptor
- */
-int
-btintr(arg)
- void *arg;
-{
- struct bt_softc *sc = arg;
- int iobase = sc->sc_iobase;
- u_char sts;
-
-#ifdef BTDEBUG
- printf("%s: btintr ", sc->sc_dev.dv_xname);
-#endif /* BTDEBUG */
-
- /*
- * First acknowlege the interrupt, Then if it's not telling about
- * a completed operation just return.
- */
- sts = isa_inb(iobase + BT_INTR_PORT);
- if ((sts & BT_INTR_ANYINTR) == 0)
- return 0;
- isa_outb(iobase + BT_CTRL_PORT, BT_CTRL_IRST);
-
-#ifdef BTDIAG
- /* Make sure we clear CCB_SENDING before finishing a CCB. */
- bt_collect_mbo(sc);
-#endif
-
- /* Mail box out empty? */
- if (sts & BT_INTR_MBOA) {
- struct bt_toggle toggle;
-
- toggle.cmd.opcode = BT_MBO_INTR_EN;
- toggle.cmd.enable = 0;
- bt_cmd(iobase, sc, sizeof(toggle.cmd), (u_char *)&toggle.cmd, 0,
- (u_char *)0);
- bt_start_ccbs(sc);
- }
-
- /* Mail box in full? */
- if (sts & BT_INTR_MBIF)
- bt_finish_ccbs(sc);
-
- return 1;
-}
-
-integrate void
-bt_reset_ccb(sc, ccb)
- struct bt_softc *sc;
- struct bt_ccb *ccb;
-{
-
- ccb->flags = 0;
-}
-
-/*
- * A ccb is put onto the free list.
- */
-void
-bt_free_ccb(sc, ccb)
- struct bt_softc *sc;
- struct bt_ccb *ccb;
-{
- int s;
-
- s = splbio();
-
- bt_reset_ccb(sc, ccb);
- TAILQ_INSERT_HEAD(&sc->sc_free_ccb, ccb, chain);
-
- /*
- * If there were none, wake anybody waiting for one to come free,
- * starting with queued entries.
- */
- if (ccb->chain.tqe_next == 0)
- wakeup(&sc->sc_free_ccb);
-
- splx(s);
-}
-
-/*
- * A buf is put onto the free list.
- */
-void
-bt_free_buf(sc, buf)
- struct bt_softc *sc;
- struct bt_buf *buf;
-{
- int s;
-
- s = splbio();
-
- TAILQ_INSERT_HEAD(&sc->sc_free_buf, buf, chain);
- sc->sc_numbufs++;
-
- /*
- * If there were none, wake anybody waiting for one to come free,
- * starting with queued entries.
- */
- if (buf->chain.tqe_next == 0)
- wakeup(&sc->sc_free_buf);
-
- splx(s);
-}
-
-integrate void
-bt_init_ccb(sc, ccb)
- struct bt_softc *sc;
- struct bt_ccb *ccb;
-{
- int hashnum;
-
- bzero(ccb, sizeof(struct bt_ccb));
- /*
- * put in the phystokv hash table
- * Never gets taken out.
- */
- ccb->hashkey = KVTOPHYS(ccb);
- hashnum = CCB_HASH(ccb->hashkey);
- ccb->nexthash = sc->sc_ccbhash[hashnum];
- sc->sc_ccbhash[hashnum] = ccb;
- bt_reset_ccb(sc, ccb);
-}
-
-/*
- * Get a free ccb
- *
- * If there are none, either return an error or sleep.
- */
-struct bt_ccb *
-bt_get_ccb(sc, flags)
- struct bt_softc *sc;
- int flags;
-{
- struct bt_ccb *ccb;
- int s;
-
- s = splbio();
-
- /*
- * If we can and have to, sleep waiting for one to come free.
- */
- for (;;) {
- ccb = sc->sc_free_ccb.tqh_first;
- if (ccb) {
- TAILQ_REMOVE(&sc->sc_free_ccb, ccb, chain);
- break;
- }
- if ((flags & SCSI_NOSLEEP) != 0)
- goto out;
- tsleep(&sc->sc_free_ccb, PRIBIO, "btccb", 0);
- }
-
- ccb->flags |= CCB_ALLOC;
-
-out:
- splx(s);
- return ccb;
-}
-
-/*
- * Get a free buf
- *
- * If there are none, either return an error or sleep.
- */
-struct bt_buf *
-bt_get_buf(sc, flags)
- struct bt_softc *sc;
- int flags;
-{
- struct bt_buf *buf;
- int s;
-
- s = splbio();
-
- /*
- * If we can and have to, sleep waiting for one to come free.
- */
- for (;;) {
- buf = sc->sc_free_buf.tqh_first;
- if (buf) {
- TAILQ_REMOVE(&sc->sc_free_buf, buf, chain);
- sc->sc_numbufs--;
- break;
- }
- if ((flags & SCSI_NOSLEEP) != 0)
- goto out;
- tsleep(&sc->sc_free_buf, PRIBIO, "btbuf", 0);
- }
-
-out:
- splx(s);
- return buf;
-}
-
-/*
- * Given a physical address, find the ccb that it corresponds to.
- */
-struct bt_ccb *
-bt_ccb_phys_kv(sc, ccb_phys)
- struct bt_softc *sc;
- u_long ccb_phys;
-{
- int hashnum = CCB_HASH(ccb_phys);
- struct bt_ccb *ccb = sc->sc_ccbhash[hashnum];
-
- while (ccb) {
- if (ccb->hashkey == ccb_phys)
- break;
- ccb = ccb->nexthash;
- }
- return ccb;
-}
-
-/*
- * Queue a CCB to be sent to the controller, and send it if possible.
- */
-void
-bt_queue_ccb(sc, ccb)
- struct bt_softc *sc;
- struct bt_ccb *ccb;
-{
-
- TAILQ_INSERT_TAIL(&sc->sc_waiting_ccb, ccb, chain);
- bt_start_ccbs(sc);
-}
-
-/*
- * Garbage collect mailboxes that are no longer in use.
- */
-void
-bt_collect_mbo(sc)
- struct bt_softc *sc;
-{
- struct bt_mbx_out *wmbo; /* Mail Box Out pointer */
-
- wmbo = wmbx->cmbo;
-
- while (sc->sc_mbofull > 0) {
- if (wmbo->cmd != BT_MBO_FREE)
- break;
-
-#ifdef BTDIAG
- ccb = bt_ccb_phys_kv(sc, phystol(wmbo->ccb_addr));
- ccb->flags &= ~CCB_SENDING;
-#endif
-
- --sc->sc_mbofull;
- bt_nextmbx(wmbo, wmbx, mbo);
- }
-
- wmbx->cmbo = wmbo;
-}
-
-/*
- * Send as many CCBs as we have empty mailboxes for.
- */
-void
-bt_start_ccbs(sc)
- struct bt_softc *sc;
-{
- int iobase = sc->sc_iobase;
- struct bt_mbx_out *wmbo; /* Mail Box Out pointer */
- struct bt_ccb *ccb;
-
- wmbo = wmbx->tmbo;
-
- while ((ccb = sc->sc_waiting_ccb.tqh_first) != NULL) {
- if (sc->sc_mbofull >= BT_MBX_SIZE) {
- bt_collect_mbo(sc);
- if (sc->sc_mbofull >= BT_MBX_SIZE) {
- struct bt_toggle toggle;
-
- toggle.cmd.opcode = BT_MBO_INTR_EN;
- toggle.cmd.enable = 1;
- bt_cmd(iobase, sc, sizeof(toggle.cmd),
- (u_char *)&toggle.cmd, 0, (u_char *)0);
- break;
- }
- }
-
- TAILQ_REMOVE(&sc->sc_waiting_ccb, ccb, chain);
-#ifdef BTDIAG
- ccb->flags |= CCB_SENDING;
-#endif
-
- /* Link ccb to mbo. */
- ltophys(KVTOPHYS(ccb), wmbo->ccb_addr);
- if (ccb->flags & CCB_ABORT)
- wmbo->cmd = BT_MBO_ABORT;
- else
- wmbo->cmd = BT_MBO_START;
-
- /* Tell the card to poll immediately. */
- isa_outb(iobase + BT_CMD_PORT, BT_START_SCSI);
-
- if ((ccb->xs->flags & SCSI_POLL) == 0)
- timeout(bt_timeout, ccb, (ccb->timeout * hz) / 1000);
-
- ++sc->sc_mbofull;
- bt_nextmbx(wmbo, wmbx, mbo);
- }
-
- wmbx->tmbo = wmbo;
-}
-
-/*
- * We have a ccb which has been processed by the
- * adaptor, now we look to see how the operation
- * went. Wake up the owner if waiting
- */
-void
-bt_done(sc, ccb)
- struct bt_softc *sc;
- struct bt_ccb *ccb;
-{
- struct scsi_sense_data *s1, *s2;
- struct scsi_xfer *xs = ccb->xs;
-
- u_long thiskv, thisbounce;
- int bytes_this_page, datalen;
- struct bt_scat_gath *sg;
- int seg;
-
- SC_DEBUG(xs->sc_link, SDEV_DB2, ("bt_done\n"));
- /*
- * Otherwise, put the results of the operation
- * into the xfer and call whoever started it
- */
-#ifdef BTDIAG
- if (ccb->flags & CCB_SENDING) {
- printf("%s: exiting ccb still in transit!\n", sc->sc_dev.dv_xname);
- Debugger();
- return;
- }
-#endif
- if ((ccb->flags & CCB_ALLOC) == 0) {
- printf("%s: exiting ccb not allocated!\n", sc->sc_dev.dv_xname);
- Debugger();
- return;
- }
- if (xs->error == XS_NOERROR) {
- if (ccb->host_stat != BT_OK) {
- switch (ccb->host_stat) {
- case BT_SEL_TIMEOUT: /* No response */
- xs->error = XS_SELTIMEOUT;
- break;
- default: /* Other scsi protocol messes */
- printf("%s: host_stat %x\n",
- sc->sc_dev.dv_xname, ccb->host_stat);
- xs->error = XS_DRIVER_STUFFUP;
- break;
- }
- } else if (ccb->target_stat != SCSI_OK) {
- switch (ccb->target_stat) {
- case SCSI_CHECK:
- s1 = &ccb->scsi_sense;
- s2 = &xs->sense;
- *s2 = *s1;
- xs->error = XS_SENSE;
- break;
- case SCSI_BUSY:
- xs->error = XS_BUSY;
- break;
- default:
- printf("%s: target_stat %x\n",
- sc->sc_dev.dv_xname, ccb->target_stat);
- xs->error = XS_DRIVER_STUFFUP;
- break;
- }
- } else
- xs->resid = 0;
- }
-
- if((datalen = xs->datalen) != 0) {
- thiskv = (int)xs->data;
- sg = ccb->scat_gath;
- seg = phystol(ccb->data_length) / sizeof(struct bt_scat_gath);
-
- while (seg) {
- thisbounce = PHYSTOKV(phystol(sg->seg_addr));
- bytes_this_page = phystol(sg->seg_len);
- if(xs->flags & SCSI_DATA_IN) {
- bcopy((void *)thisbounce, (void *)thiskv, bytes_this_page);
- }
- bt_free_buf(sc, (struct bt_buf *)thisbounce);
- thiskv += bytes_this_page;
- datalen -= bytes_this_page;
-
- sg++;
- seg--;
- }
- }
-
- bt_free_ccb(sc, ccb);
- xs->flags |= ITSDONE;
- scsi_done(xs);
-}
-
-/*
- * Find the board and find it's irq/drq
- */
-int
-bt_find(ia, sc)
- struct isa_attach_args *ia;
- struct bt_softc *sc;
-{
- int iobase = ia->ia_iobase;
- int i;
- u_char sts;
- struct bt_extended_inquire inquire;
- struct bt_config config;
- int irq, drq;
-
- /*
- * reset board, If it doesn't respond, assume
- * that it's not there.. good for the probe
- */
-
- isa_outb(iobase + BT_CTRL_PORT, BT_CTRL_HRST | BT_CTRL_SRST);
-
- delay(100);
- for (i = BT_RESET_TIMEOUT; i; i--) {
- sts = isa_inb(iobase + BT_STAT_PORT);
- if (sts == (BT_STAT_IDLE | BT_STAT_INIT))
- break;
- delay(1000);
- }
- if (!i) {
-#ifdef BTDEBUG
- if (bt_debug)
- printf("bt_find: No answer from buslogic board\n");
-#endif /* BTDEBUG */
- return 1;
- }
-
- /*
- * Check that we actually know how to use this board.
- */
- delay(1000);
- bzero(&inquire, sizeof inquire);
- inquire.cmd.opcode = BT_INQUIRE_EXTENDED;
- inquire.cmd.len = sizeof(inquire.reply);
- bt_cmd(iobase, sc, sizeof(inquire.cmd), (u_char *)&inquire.cmd,
- sizeof(inquire.reply), (u_char *)&inquire.reply);
- switch (inquire.reply.bus_type) {
- case BT_BUS_TYPE_24BIT:
- case BT_BUS_TYPE_32BIT:
- break;
- case BT_BUS_TYPE_MCA:
- /* We don't grok MicroChannel (yet). */
- return 1;
- default:
- printf("bt_find: illegal bus type %c\n", inquire.reply.bus_type);
- return 1;
- }
-
-#if NAHA > 0
- /* Adaptec 1542 cards do not support this */
- digit.reply.digit = '@';
- digit.cmd.opcode = BT_INQUIRE_REVISION_3;
- bt_cmd(iobase, sc, sizeof(digit.cmd), (u_char *)&digit.cmd,
- sizeof(digit.reply), (u_char *)&digit.reply);
- if (digit.reply.digit == '@')
- return 1;
-#endif
-
- /*
- * Assume we have a board at this stage setup dma channel from
- * jumpers and save int level
- */
- delay(1000);
- config.cmd.opcode = BT_INQUIRE_CONFIG;
- bt_cmd(iobase, sc, sizeof(config.cmd), (u_char *)&config.cmd,
- sizeof(config.reply), (u_char *)&config.reply);
- switch (config.reply.chan) {
- case EISADMA:
- drq = DRQUNK;
- break;
- case CHAN0:
- drq = 0;
- break;
- case CHAN5:
- drq = 5;
- break;
- case CHAN6:
- drq = 6;
- break;
- case CHAN7:
- drq = 7;
- break;
- default:
- printf("bt_find: illegal drq setting %x\n", config.reply.chan);
- return 1;
- }
-
- switch (config.reply.intr) {
- case INT9:
- irq = 9;
- break;
- case INT10:
- irq = 10;
- break;
- case INT11:
- irq = 11;
- break;
- case INT12:
- irq = 12;
- break;
- case INT14:
- irq = 14;
- break;
- case INT15:
- irq = 15;
- break;
- default:
- printf("bt_find: illegal irq setting %x\n", config.reply.intr);
- return 1;
- }
-
- if (sc != NULL) {
- /* who are we on the scsi bus? */
- sc->sc_scsi_dev = config.reply.scsi_dev;
-
- sc->sc_iobase = iobase;
- sc->sc_irq = irq;
- sc->sc_drq = drq;
- } else {
- if (ia->ia_irq == IRQUNK)
- ia->ia_irq = irq;
- else if (ia->ia_irq != irq)
- return 1;
- if (ia->ia_drq == DRQUNK)
- ia->ia_drq = drq;
- else if (ia->ia_drq != drq)
- return 1;
- }
-
-#if NAHA > 0
- /* XXXX To avoid conflicting with the aha1542 probe */
- btports[nbtports++] = iobase;
-#endif
- return 0;
-}
-
-/*
- * Start the board, ready for normal operation
- */
-void
-bt_init(sc)
- struct bt_softc *sc;
-{
- int iobase = sc->sc_iobase;
- struct bt_devices devices;
- struct bt_setup setup;
- struct bt_mailbox mailbox;
- struct bt_period period;
- int i;
-
- /* Enable round-robin scheme - appeared at firmware rev. 3.31. */
- if (strcmp(sc->sc_firmware, "3.31") >= 0) {
- struct bt_toggle toggle;
-
- toggle.cmd.opcode = BT_ROUND_ROBIN;
- toggle.cmd.enable = 1;
- bt_cmd(iobase, sc, sizeof(toggle.cmd), (u_char *)&toggle.cmd,
- 0, (u_char *)0);
- }
-
- /* Inquire Installed Devices (to force synchronous negotiation). */
- devices.cmd.opcode = BT_INQUIRE_DEVICES;
- bt_cmd(iobase, sc, sizeof(devices.cmd), (u_char *)&devices.cmd,
- sizeof(devices.reply), (u_char *)&devices.reply);
-
- /* Obtain setup information from. */
- setup.cmd.opcode = BT_INQUIRE_SETUP;
- setup.cmd.len = sizeof(setup.reply);
- bt_cmd(iobase, sc, sizeof(setup.cmd), (u_char *)&setup.cmd,
- sizeof(setup.reply), (u_char *)&setup.reply);
-
- printf("%s: %s, %s\n",
- sc->sc_dev.dv_xname,
- setup.reply.sync_neg ? "sync" : "async",
- setup.reply.parity ? "parity" : "no parity");
-
- for (i = 0; i < 8; i++)
- period.reply.period[i] = setup.reply.sync[i].period * 5 + 20;
-
- if (sc->sc_firmware[0] >= '3') {
- period.cmd.opcode = BT_INQUIRE_PERIOD;
- period.cmd.len = sizeof(period.reply);
- bt_cmd(iobase, sc, sizeof(period.cmd), (u_char *)&period.cmd,
- sizeof(period.reply), (u_char *)&period.reply);
- }
-
- for (i = 0; i < 8; i++) {
- if (!setup.reply.sync[i].valid ||
- (!setup.reply.sync[i].offset && !setup.reply.sync[i].period))
- continue;
- printf("%s targ %d: sync, offset %d, period %dnsec\n",
- sc->sc_dev.dv_xname, i,
- setup.reply.sync[i].offset, period.reply.period[i] * 10);
- }
-
- /*
- * Set up initial mail box for round-robin operation.
- */
- for (i = 0; i < BT_MBX_SIZE; i++) {
- wmbx->mbo[i].cmd = BT_MBO_FREE;
- wmbx->mbi[i].stat = BT_MBI_FREE;
- }
- wmbx->cmbo = wmbx->tmbo = &wmbx->mbo[0];
- wmbx->tmbi = &wmbx->mbi[0];
- sc->sc_mbofull = 0;
-
- /* Initialize mail box. */
- mailbox.cmd.opcode = BT_MBX_INIT_EXTENDED;
- mailbox.cmd.nmbx = BT_MBX_SIZE;
- ltophys(KVTOPHYS(wmbx), mailbox.cmd.addr);
- bt_cmd(iobase, sc, sizeof(mailbox.cmd), (u_char *)&mailbox.cmd,
- 0, (u_char *)0);
-}
-
-void
-bt_inquire_setup_information(sc)
- struct bt_softc *sc;
-{
- int iobase = sc->sc_iobase;
- struct bt_model model;
- struct bt_revision revision;
- struct bt_digit digit;
- char *p;
-
- /*
- * Get the firmware revision.
- */
- p = sc->sc_firmware;
- revision.cmd.opcode = BT_INQUIRE_REVISION;
- bt_cmd(iobase, sc, sizeof(revision.cmd), (u_char *)&revision.cmd,
- sizeof(revision.reply), (u_char *)&revision.reply);
- *p++ = revision.reply.firm_revision;
- *p++ = '.';
- *p++ = revision.reply.firm_version;
- digit.cmd.opcode = BT_INQUIRE_REVISION_3;
- bt_cmd(iobase, sc, sizeof(digit.cmd), (u_char *)&digit.cmd,
- sizeof(digit.reply), (u_char *)&digit.reply);
- *p++ = digit.reply.digit;
- if (revision.reply.firm_revision >= '3' ||
- (revision.reply.firm_revision == '3' && revision.reply.firm_version >= '3')) {
- digit.cmd.opcode = BT_INQUIRE_REVISION_4;
- bt_cmd(iobase, sc, sizeof(digit.cmd), (u_char *)&digit.cmd,
- sizeof(digit.reply), (u_char *)&digit.reply);
- *p++ = digit.reply.digit;
- }
- while (p > sc->sc_firmware && (p[-1] == ' ' || p[-1] == '\0'))
- p--;
- *p = '\0';
-
- /*
- * Get the model number.
- */
- if (revision.reply.firm_revision >= '3') {
- p = sc->sc_model;
- model.cmd.opcode = BT_INQUIRE_MODEL;
- model.cmd.len = sizeof(model.reply);
- bt_cmd(iobase, sc, sizeof(model.cmd), (u_char *)&model.cmd,
- sizeof(model.reply), (u_char *)&model.reply);
- *p++ = model.reply.id[0];
- *p++ = model.reply.id[1];
- *p++ = model.reply.id[2];
- *p++ = model.reply.id[3];
- while (p > sc->sc_model && (p[-1] == ' ' || p[-1] == '\0'))
- p--;
- *p++ = model.reply.version[0];
- *p++ = model.reply.version[1];
- while (p > sc->sc_model && (p[-1] == ' ' || p[-1] == '\0'))
- p--;
- *p = '\0';
- } else
- strcpy(sc->sc_model, "542B");
-
- printf(": model BT-%s, firmware %s\n", sc->sc_model, sc->sc_firmware);
-}
-
-void
-btminphys(bp)
- struct buf *bp;
-{
-
- if (bp->b_bcount > ((BT_NSEG - 1) << PGSHIFT))
- bp->b_bcount = ((BT_NSEG - 1) << PGSHIFT);
- minphys(bp);
-}
-
-/*
- * start a scsi operation given the command and the data address. Also needs
- * the unit, target and lu.
- */
-int
-bt_scsi_cmd(xs)
- struct scsi_xfer *xs;
-{
- struct scsi_link *sc_link = xs->sc_link;
- struct bt_softc *sc = sc_link->adapter_softc;
- struct bt_ccb *ccb;
- struct bt_scat_gath *sg;
- int seg; /* scatter gather seg being worked on */
- u_long thiskv, thisbounce;
- int bytes_this_page, datalen, flags;
- int s;
-
- SC_DEBUG(sc_link, SDEV_DB2, ("bt_scsi_cmd\n"));
- /*
- * get a ccb to use. If the transfer
- * is from a buf (possibly from interrupt time)
- * then we can't allow it to sleep
- */
- flags = xs->flags;
- if ((ccb = bt_get_ccb(sc, flags)) == NULL) {
- xs->error = XS_DRIVER_STUFFUP;
- return TRY_AGAIN_LATER;
- }
- ccb->xs = xs;
- ccb->timeout = xs->timeout;
-
- /*
- * Put all the arguments for the xfer in the ccb
- */
- if (flags & SCSI_RESET) {
- ccb->opcode = BT_RESET_CCB;
- ccb->scsi_cmd_length = 0;
- } else {
- /* can't use S/G if zero length */
- ccb->opcode = (xs->datalen ? BT_INIT_SCAT_GATH_CCB
- : BT_INITIATOR_CCB);
- bcopy(xs->cmd, &ccb->scsi_cmd,
- ccb->scsi_cmd_length = xs->cmdlen);
- }
-
- if (xs->datalen) {
- sg = ccb->scat_gath;
- seg = 0;
- /*
- * Set up the scatter-gather block.
- */
- SC_DEBUG(sc_link, SDEV_DB4,
- ("%d @0x%x:- ", xs->datalen, xs->data));
-
- datalen = xs->datalen;
- thiskv = (int)xs->data;
-
- while (datalen && seg < BT_NSEG) {
-
- /* put in the base address of a buf */
- thisbounce = (u_long)bt_get_buf(sc, flags);
- if(thisbounce == 0)
- break;
- ltophys(KVTOPHYS(thisbounce), sg->seg_addr);
- bytes_this_page = min(sizeof(struct bt_buf), datalen);
- if(flags & SCSI_DATA_OUT) {
- bcopy((void *)thiskv, (void *)thisbounce, bytes_this_page);
- }
- thiskv += bytes_this_page;
- datalen -= bytes_this_page;
-
- ltophys(bytes_this_page, sg->seg_len);
- sg++;
- seg++;
- }
- SC_DEBUGN(sc_link, SDEV_DB4, ("\n"));
- if (datalen) {
- printf("%s: bt_scsi_cmd, out of bufs %d of %d left.\n",
- sc->sc_dev.dv_xname, datalen, xs->datalen);
- goto badbuf;
- }
- ltophys(KVTOPHYS(ccb->scat_gath), ccb->data_addr);
- ltophys(seg * sizeof(struct bt_scat_gath), ccb->data_length);
- } else { /* No data xfer, use non S/G values */
- ltophys(0, ccb->data_addr);
- ltophys(0, ccb->data_length);
- }
-
- ccb->data_out = 0;
- ccb->data_in = 0;
- ccb->target = sc_link->target;
- ccb->lun = sc_link->lun;
- ltophys(KVTOPHYS(&ccb->scsi_sense), ccb->sense_ptr);
- ccb->req_sense_length = sizeof(ccb->scsi_sense);
- ccb->host_stat = 0x00;
- ccb->target_stat = 0x00;
- ccb->link_id = 0;
- ltophys(0, ccb->link_addr);
-
- s = splbio();
- bt_queue_ccb(sc, ccb);
- splx(s);
-
- /*
- * Usually return SUCCESSFULLY QUEUED
- */
- SC_DEBUG(sc_link, SDEV_DB3, ("cmd_sent\n"));
- if ((flags & SCSI_POLL) == 0)
- return SUCCESSFULLY_QUEUED;
-
- /*
- * If we can't use interrupts, poll on completion
- */
- if (bt_poll(sc, xs, ccb->timeout)) {
- bt_timeout(ccb);
- if (bt_poll(sc, xs, ccb->timeout))
- bt_timeout(ccb);
- }
- return COMPLETE;
-
-badbuf:
- sg = ccb->scat_gath;
- while (seg) {
- thisbounce = PHYSTOKV(phystol(sg->seg_addr));
- bt_free_buf(sc, (struct bt_buf *)thisbounce);
- sg++;
- seg--;
- }
- xs->error = XS_DRIVER_STUFFUP;
- bt_free_ccb(sc, ccb);
- return TRY_AGAIN_LATER;
-}
-
-/*
- * Poll a particular unit, looking for a particular xs
- */
-int
-bt_poll(sc, xs, count)
- struct bt_softc *sc;
- struct scsi_xfer *xs;
- int count;
-{
- int iobase = sc->sc_iobase;
-
- /* timeouts are in msec, so we loop in 1000 usec cycles */
- while (count) {
- /*
- * If we had interrupts enabled, would we
- * have got an interrupt?
- */
- if (isa_inb(iobase + BT_INTR_PORT) & BT_INTR_ANYINTR)
- btintr(sc);
- if (xs->flags & ITSDONE)
- return 0;
- delay(1000); /* only happens in boot so ok */
- count--;
- }
- return 1;
-}
-
-void
-bt_timeout(arg)
- void *arg;
-{
- struct bt_ccb *ccb = arg;
- struct scsi_xfer *xs = ccb->xs;
- struct scsi_link *sc_link = xs->sc_link;
- struct bt_softc *sc = sc_link->adapter_softc;
- int s;
-
- sc_print_addr(sc_link);
- printf("timed out");
-
- s = splbio();
-
-#ifdef BTDIAG
- /*
- * If the ccb's mbx is not free, then the board has gone Far East?
- */
- bt_collect_mbo(sc);
- if (ccb->flags & CCB_SENDING) {
- printf("%s: not taking commands!\n", sc->sc_dev.dv_xname);
- Debugger();
- }
-#endif
-
- /*
- * If it has been through before, then
- * a previous abort has failed, don't
- * try abort again
- */
- if (ccb->flags & CCB_ABORT) {
- /* abort timed out */
- printf(" AGAIN\n");
- /* XXX Must reset! */
- } else {
- /* abort the operation that has timed out */
- printf("\n");
- ccb->xs->error = XS_TIMEOUT;
- ccb->timeout = BT_ABORT_TIMEOUT;
- ccb->flags |= CCB_ABORT;
- bt_queue_ccb(sc, ccb);
- }
-
- splx(s);
-}
diff --git a/sys/arch/arc/dti/btlreg.h b/sys/arch/arc/dti/btlreg.h
deleted file mode 100644
index 2fbaf4d7fbd..00000000000
--- a/sys/arch/arc/dti/btlreg.h
+++ /dev/null
@@ -1,309 +0,0 @@
-typedef u_int8_t physaddr[4];
-typedef u_int8_t physlen[4];
-#define ltophys _lto4l
-#define phystol _4ltol
-
-/*
- * I/O port offsets
- */
-#define BT_CTRL_PORT 0 /* control (wo) */
-#define BT_STAT_PORT 0 /* status (ro) */
-#define BT_CMD_PORT 1 /* command (wo) */
-#define BT_DATA_PORT 1 /* data (ro) */
-#define BT_INTR_PORT 2 /* interrupt status (ro) */
-
-/*
- * BT_CTRL bits
- */
-#define BT_CTRL_HRST 0x80 /* Hardware reset */
-#define BT_CTRL_SRST 0x40 /* Software reset */
-#define BT_CTRL_IRST 0x20 /* Interrupt reset */
-#define BT_CTRL_SCRST 0x10 /* SCSI bus reset */
-
-/*
- * BT_STAT bits
- */
-#define BT_STAT_STST 0x80 /* Self test in Progress */
-#define BT_STAT_DIAGF 0x40 /* Diagnostic Failure */
-#define BT_STAT_INIT 0x20 /* Mbx Init required */
-#define BT_STAT_IDLE 0x10 /* Host Adapter Idle */
-#define BT_STAT_CDF 0x08 /* cmd/data out port full */
-#define BT_STAT_DF 0x04 /* Data in port full */
-#define BT_STAT_INVDCMD 0x01 /* Invalid command */
-
-/*
- * BT_CMD opcodes
- */
-#define BT_NOP 0x00 /* No operation */
-#define BT_MBX_INIT 0x01 /* Mbx initialization */
-#define BT_START_SCSI 0x02 /* start scsi command */
-#define BT_INQUIRE_REVISION 0x04 /* Adapter Inquiry */
-#define BT_MBO_INTR_EN 0x05 /* Enable MBO available interrupt */
-#if 0
-#define BT_SEL_TIMEOUT_SET 0x06 /* set selection time-out */
-#define BT_BUS_ON_TIME_SET 0x07 /* set bus-on time */
-#define BT_BUS_OFF_TIME_SET 0x08 /* set bus-off time */
-#define BT_SPEED_SET 0x09 /* set transfer speed */
-#endif
-#define BT_INQUIRE_DEVICES 0x0a /* return installed devices 0-7 */
-#define BT_INQUIRE_CONFIG 0x0b /* return configuration data */
-#define BT_TARGET_EN 0x0c /* enable target mode */
-#define BT_INQUIRE_SETUP 0x0d /* return setup data */
-#define BT_ECHO 0x1e /* Echo command data */
-#define BT_INQUIRE_DEVICES_2 0x23 /* return installed devices 8-15 */
-#define BT_MBX_INIT_EXTENDED 0x81 /* Mbx initialization */
-#define BT_INQUIRE_REVISION_3 0x84 /* Get 3rd firmware version byte */
-#define BT_INQUIRE_REVISION_4 0x85 /* Get 4th firmware version byte */
-#define BT_INQUIRE_MODEL 0x8b /* Get hardware ID and revision */
-#define BT_INQUIRE_PERIOD 0x8c /* Get synchronous period */
-#define BT_INQUIRE_EXTENDED 0x8d /* Adapter Setup Inquiry */
-#define BT_ROUND_ROBIN 0x8f /* Enable/Disable(default) round robin */
-
-/*
- * BT_INTR bits
- */
-#define BT_INTR_ANYINTR 0x80 /* Any interrupt */
-#define BT_INTR_SCRD 0x08 /* SCSI reset detected */
-#define BT_INTR_HACC 0x04 /* Command complete */
-#define BT_INTR_MBOA 0x02 /* MBX out empty */
-#define BT_INTR_MBIF 0x01 /* MBX in full */
-
-struct bt_mbx_out {
- physaddr ccb_addr;
- u_char dummy[3];
- u_char cmd;
-};
-
-struct bt_mbx_in {
- physaddr ccb_addr;
- u_char dummy[3];
- u_char stat;
-};
-
-/*
- * mbo.cmd values
- */
-#define BT_MBO_FREE 0x0 /* MBO entry is free */
-#define BT_MBO_START 0x1 /* MBO activate entry */
-#define BT_MBO_ABORT 0x2 /* MBO abort entry */
-
-/*
- * mbi.stat values
- */
-#define BT_MBI_FREE 0x0 /* MBI entry is free */
-#define BT_MBI_OK 0x1 /* completed without error */
-#define BT_MBI_ABORT 0x2 /* aborted ccb */
-#define BT_MBI_UNKNOWN 0x3 /* Tried to abort invalid CCB */
-#define BT_MBI_ERROR 0x4 /* Completed with error */
-
-#if defined(BIG_DMA)
-#define BT_NSEG 2048 /* Number of scatter gather segments - to much vm */
-#else
-#define BT_NSEG (MAXPHYS / NBPG)
-#endif /* BIG_DMA */
-
-struct bt_scat_gath {
- physlen seg_len;
- physaddr seg_addr;
-};
-
-struct bt_ccb {
- u_char opcode;
- u_char:3, data_in:1, data_out:1,:3;
- u_char scsi_cmd_length;
- u_char req_sense_length;
- /*------------------------------------longword boundary */
- physlen data_length;
- /*------------------------------------longword boundary */
- physaddr data_addr;
- /*------------------------------------longword boundary */
- u_char dummy1[2];
- u_char host_stat;
- u_char target_stat;
- /*------------------------------------longword boundary */
- u_char target;
- u_char lun;
- struct scsi_generic scsi_cmd;
- u_char dummy2[1];
- u_char link_id;
- /*------------------------------------longword boundary */
- physaddr link_addr;
- /*------------------------------------longword boundary */
- physaddr sense_ptr;
-/*-----end of HW fields-----------------------longword boundary */
- struct scsi_sense_data scsi_sense;
- /*------------------------------------longword boundary */
- struct bt_scat_gath scat_gath[BT_NSEG];
- /*------------------------------------longword boundary */
- TAILQ_ENTRY(bt_ccb) chain;
- struct bt_ccb *nexthash;
- long hashkey;
- struct scsi_xfer *xs; /* the scsi_xfer for this cmd */
- int flags;
-#define CCB_ALLOC 0x01
-#define CCB_ABORT 0x02
-#ifdef BTDIAG
-#define CCB_SENDING 0x04
-#endif
- int timeout;
-};
-
-struct bt_buf {
- TAILQ_ENTRY(bt_buf) chain;
- char buf[4096 - 2 * sizeof(struct bt_buf *)];
-};
-
-/*
- * opcode fields
- */
-#define BT_INITIATOR_CCB 0x00 /* SCSI Initiator CCB */
-#define BT_TARGET_CCB 0x01 /* SCSI Target CCB */
-#define BT_INIT_SCAT_GATH_CCB 0x02 /* SCSI Initiator with scattter gather */
-#define BT_RESET_CCB 0x81 /* SCSI Bus reset */
-
-/*
- * bt_ccb.host_stat values
- */
-#define BT_OK 0x00 /* cmd ok */
-#define BT_LINK_OK 0x0a /* Link cmd ok */
-#define BT_LINK_IT 0x0b /* Link cmd ok + int */
-#define BT_SEL_TIMEOUT 0x11 /* Selection time out */
-#define BT_OVER_UNDER 0x12 /* Data over/under run */
-#define BT_BUS_FREE 0x13 /* Bus dropped at unexpected time */
-#define BT_INV_BUS 0x14 /* Invalid bus phase/sequence */
-#define BT_BAD_MBO 0x15 /* Incorrect MBO cmd */
-#define BT_BAD_CCB 0x16 /* Incorrect ccb opcode */
-#define BT_BAD_LINK 0x17 /* Not same values of LUN for links */
-#define BT_INV_TARGET 0x18 /* Invalid target direction */
-#define BT_CCB_DUP 0x19 /* Duplicate CCB received */
-#define BT_INV_CCB 0x1a /* Invalid CCB or segment list */
-
-struct bt_extended_inquire {
- struct {
- u_char opcode;
- u_char len;
- } cmd;
- struct {
- u_char bus_type; /* Type of bus connected to */
-#define BT_BUS_TYPE_24BIT 'A' /* ISA bus */
-#define BT_BUS_TYPE_32BIT 'E' /* EISA/VLB/PCI bus */
-#define BT_BUS_TYPE_MCA 'M' /* MicroChannel bus */
- u_char bios_address; /* Address of adapter BIOS */
- u_short max_segment; /* ? */
- } reply;
-};
-
-struct bt_config {
- struct {
- u_char opcode;
- } cmd;
- struct {
- u_char chan;
- u_char intr;
- u_char scsi_dev:3;
- u_char :5;
- } reply;
-};
-
-struct bt_toggle {
- struct {
- u_char opcode;
- u_char enable;
- } cmd;
-};
-
-struct bt_mailbox {
- struct {
- u_char opcode;
- u_char nmbx;
- physaddr addr;
- } cmd;
-};
-
-struct bt_model {
- struct {
- u_char opcode;
- u_char len;
- } cmd;
- struct {
- u_char id[4]; /* i.e bt742a -> '7','4','2','A' */
- u_char version[2]; /* i.e Board Revision 'H' -> 'H', 0x00 */
- } reply;
-};
-
-struct bt_revision {
- struct {
- u_char opcode;
- } cmd;
- struct {
- u_char board_type;
- u_char custom_feature;
- char firm_revision;
- u_char firm_version;
- } reply;
-};
-
-struct bt_digit {
- struct {
- u_char opcode;
- } cmd;
- struct {
- u_char digit;
- } reply;
-};
-
-struct bt_devices {
- struct {
- u_char opcode;
- } cmd;
- struct {
- u_char junk[8];
- } reply;
-};
-
-struct bt_setup {
- struct {
- u_char opcode;
- u_char len;
- } cmd;
- struct {
- u_char sync_neg:1;
- u_char parity:1;
- u_char :6;
- u_char speed;
- u_char bus_on;
- u_char bus_off;
- u_char num_mbx;
- u_char mbx[3]; /*XXX */
- /* doesn't make sense with 32bit addresses */
- struct {
- u_char offset:4;
- u_char period:3;
- u_char valid:1;
- } sync[8];
- u_char disc_sts;
- } reply;
-};
-
-struct bt_period {
- struct {
- u_char opcode;
- u_char len;
- } cmd;
- struct {
- u_char period[8];
- } reply;
-};
-
-#define INT9 0x01
-#define INT10 0x02
-#define INT11 0x04
-#define INT12 0x08
-#define INT14 0x20
-#define INT15 0x40
-
-#define EISADMA 0x00
-#define CHAN0 0x01
-#define CHAN5 0x20
-#define CHAN6 0x40
-#define CHAN7 0x80
diff --git a/sys/arch/arc/dti/desktech.h b/sys/arch/arc/dti/desktech.h
deleted file mode 100644
index 6453aed5b84..00000000000
--- a/sys/arch/arc/dti/desktech.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $OpenBSD: desktech.h,v 1.6 1999/01/30 22:39:38 imp Exp $ */
-
-/*
- * Copyright (c) 1996 Per Fogelstrom
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#ifndef _DESKTECH_H_
-#define _DESKTECH_H_ 1
-
-/*
- * TYNE's Physical address space
- */
-
-#define TYNE_PHYS_MIN 0x00000000 /* 256 Meg */
-#define TYNE_PHYS_MAX 0x0fffffff
-
-/*
- * Memory map
- */
-
-#define TYNE_PHYS_MEMORY_START 0x00000000
-#define TYNE_PHYS_MEMORY_END 0x0fffffff /* 256 Meg in 4 slots */
-
-/*
- * I/O map
- */
-
-#define TYNE_P_ISA_IO (0x0900000000LL) /* ISA I/O Control */
-#define TYNE_V_ISA_IO 0xe0000000
-#define TYNE_S_ISA_IO 0x00010000
-
-#define TYNE_P_ISA_MEM (0x0100000000LL) /* ISA Memory control */
-#define TYNE_V_ISA_MEM 0xe1000000
-#define TYNE_S_ISA_MEM 0x00100000
-
-#define TYNE_P_BOUNCE (0x0100800000LL) /* Dma bounce buffer */
-#define TYNE_V_BOUNCE 0xe2000000
-#define TYNE_S_BOUNCE 0x00020000
-
-/*
- * Deskstation rPC44 I/O map. We map these into one TLB of size 16M.
- * Note: We really have EISA here, but no one has EISA cards yet to
- * justify implmeneting EISA.
- */
-#define RPC44_P_ISA_IO (0x10000000LL) /* ISA I/O control */
-#define RPC44_V_ISA_IO (0xb0000000)
-#define RPC44_S_ISA_IO (0x00010000)
-
-#define RPC44_P_ISA_MEM (0x00000000LL) /* ISA Memory control */
-#define RPC44_V_ISA_MEM (0xa0000000)
-#define RPC44_S_ISA_MEM (0x01000000)
-
-#endif /* _DESKTECH_H_ */
diff --git a/sys/arch/arc/include/ansi.h b/sys/arch/arc/include/ansi.h
deleted file mode 100644
index db58e5e7792..00000000000
--- a/sys/arch/arc/include/ansi.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: ansi.h,v 1.5 1998/01/28 13:46:08 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/ansi.h>
diff --git a/sys/arch/arc/include/asm.h b/sys/arch/arc/include/asm.h
deleted file mode 100644
index d768eed6956..00000000000
--- a/sys/arch/arc/include/asm.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: asm.h,v 1.7 1998/01/28 13:46:09 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/asm.h>
diff --git a/sys/arch/arc/include/autoconf.h b/sys/arch/arc/include/autoconf.h
deleted file mode 100644
index e516f4008cd..00000000000
--- a/sys/arch/arc/include/autoconf.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $OpenBSD: autoconf.h,v 1.2 1997/03/12 19:16:54 pefo Exp $ */
-/* $NetBSD: autoconf.h,v 1.1 1995/02/13 23:07:31 cgd Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-/*
- * Machine-dependent structures of autoconfiguration
- */
-
-#ifndef _ARC_AUTOCONF_H_
-#define _ARC_AUTOCONF_H_
-
-struct confargs;
-
-typedef int (*intr_handler_t) __P((void *));
-
-struct abus {
- struct device *ab_dv; /* back-pointer to device */
- int ab_type; /* bus type (see below) */
- void (*ab_intr_establish) /* bus's set-handler function */
- __P((struct confargs *, intr_handler_t, void *));
- void (*ab_intr_disestablish) /* bus's unset-handler function */
- __P((struct confargs *));
- caddr_t (*ab_cvtaddr) /* convert slot/offset to address */
- __P((struct confargs *));
- int (*ab_matchname) /* see if name matches driver */
- __P((struct confargs *, char *));
-};
-
-#define BUS_MAIN 1 /* mainbus */
-#define BUS_PICA 2 /* PICA Bus */
-#define BUS_ISABR 3 /* ISA Bridge Bus */
-#define BUS_ALGOR 4 /* Algorithmics local bus */
-#define BUS_PCIBR 5 /* Algorithmics PCI bridge */
-
-#define BUS_INTR_ESTABLISH(ca, handler, val) \
- (*(ca)->ca_bus->ab_intr_establish)((ca), (handler), (val))
-#define BUS_INTR_DISESTABLISH(ca) \
- (*(ca)->ca_bus->ab_intr_establish)(ca)
-#define BUS_CVTADDR(ca) \
- (*(ca)->ca_bus->ab_cvtaddr)(ca)
-#define BUS_MATCHNAME(ca, name) \
- (*(ca)->ca_bus->ab_matchname)((ca), (name))
-
-struct confargs {
- char *ca_name; /* Device name. */
- int ca_slot; /* Device slot. */
- int ca_offset; /* Offset into slot. */
- struct abus *ca_bus; /* bus device resides on. */
-};
-
-void set_clockintr __P((void (*)(struct clockframe *)));
-void set_iointr __P((void (*)(void *, int)));
-int badaddr __P((void *, u_int64_t));
-
-#endif /* _ARC_AUTOCONF_H_ */
diff --git a/sys/arch/arc/include/bus.h b/sys/arch/arc/include/bus.h
deleted file mode 100644
index deb60661090..00000000000
--- a/sys/arch/arc/include/bus.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/* $OpenBSD: bus.h,v 1.15 1999/08/11 23:15:21 niklas Exp $ */
-
-/*
- * Copyright (c) 1997 Per Fogelstrom. All rights reserved.
- * Copyright (c) 1996 Niklas Hallqvist. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christopher G. Demetriou
- * for the NetBSD Project.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _ARC_BUS_H_
-#define _ARC_BUS_H_
-
-#include <machine/pio.h>
-
-#ifdef __STDC__
-#define CAT(a,b) a##b
-#define CAT3(a,b,c) a##b##c
-#else
-#define CAT(a,b) a/**/b
-#define CAT3(a,b,c) a/**/b/**/c
-#endif
-
-/*
- * Bus access types.
- */
-typedef u_int32_t bus_addr_t;
-typedef u_int32_t bus_size_t;
-typedef u_int32_t bus_space_handle_t;
-typedef struct arc_bus_space *bus_space_tag_t;
-
-struct arc_bus_space {
- u_int32_t bus_base;
- u_int8_t bus_sparse1; /* Sparse addressing shift count */
- u_int8_t bus_sparse2; /* Sparse addressing shift count */
- u_int8_t bus_sparse4; /* Sparse addressing shift count */
- u_int8_t bus_sparse8; /* Sparse addressing shift count */
-};
-
-extern struct arc_bus_space arc_bus_io, arc_bus_mem;
-
-/*
- * Access methods for bus resources
- */
-#define bus_space_map(t, addr, size, cacheable, bshp) \
- ((*(bshp) = (t)->bus_base + (addr)), 0)
-
-#define bus_space_unmap(t, bsh, size)
-
-#define bus_space_subregion(t, bsh, offset, size, nbshp) \
- ((*(nbshp) = (bsh) + (offset)), 0)
-
-#define bus_space_read(n,m) \
-static __inline CAT3(u_int,m,_t) \
-CAT(bus_space_read_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
- bus_addr_t ba) \
-{ \
- return *(volatile CAT3(u_int,m,_t) *)(bsh + ((ba) << CAT(bst->bus_sparse,n))); \
-}
-
-bus_space_read(1,8)
-bus_space_read(2,16)
-bus_space_read(4,32)
-
-#define bus_space_read_8 !!! bus_space_read_8 unimplemented !!!
-
-#define bus_space_read_multi_1(t, h, o, a, c) do { \
- insb((u_int8_t *)((h) + (o)), (a), (c)); \
- } while(0)
-
-#define bus_space_read_multi_2(t, h, o, a, c) do { \
- insw((u_int16_t *)((h) + (o)), (a), (c)); \
- } while(0)
-
-#define bus_space_read_multi_4(t, h, o, a, c) do { \
- insl((u_int32_t *)((h) + (o)), (a), (c)); \
- } while(0)
-
-#define bus_space_read_multi_8 !!! bus_space_read_multi_8 not implemented !!!
-
-#define bus_space_read_region(n,m) \
-static __inline void \
-CAT(bus_space_read_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
- bus_addr_t ba, CAT3(u_int,m,_t) *x, size_t cnt) \
-{ \
- while (cnt--) \
- *x++ = CAT(bus_space_read_,n)(bst, bsh, ba++); \
-}
-
-bus_space_read_region(1,8)
-bus_space_read_region(2,16)
-bus_space_read_region(4,32)
-
-#define bus_space_read_region_8 !!! bus_space_read_region_8 not implemented !!!
-
-#define bus_space_write(n,m) \
-static __inline void \
-CAT(bus_space_write_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
- bus_addr_t ba, CAT3(u_int,m,_t) x) \
-{ \
- *(volatile CAT3(u_int,m,_t) *)(bsh + ((ba) << CAT(bst->bus_sparse,n))) = x; \
-}
-
-bus_space_write(1,8)
-bus_space_write(2,16)
-bus_space_write(4,32)
-
-#define bus_space_write_8 !!! bus_space_write_8 unimplemented !!!
-
-
-#define bus_space_write_multi_1(t, h, o, a, c) do { \
- outsb((u_int8_t *)((h) + (o)), (a), (c)); \
- } while(0)
-
-#define bus_space_write_multi_2(t, h, o, a, c) do { \
- outsw((u_int16_t *)((h) + (o)), (a), (c)); \
- } while(0)
-
-#define bus_space_write_multi_4(t, h, o, a, c) do { \
- outsl((u_int32_t *)((h) + (o)), (a), (c)); \
- } while(0)
-
-#define bus_space_write_multi_8 !!! bus_space_write_multi_8 not implemented !!!
-
-#define bus_space_write_region(n,m) \
-static __inline void \
-CAT(bus_space_write_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
- bus_addr_t ba, const CAT3(u_int,m,_t) *x, size_t cnt) \
-{ \
- while (cnt--) \
- CAT(bus_space_write_,n)(bst, bsh, ba++, *x++); \
-}
-
-bus_space_write_region(1,8)
-bus_space_write_region(2,16)
-bus_space_write_region(4,32)
-
-#define bus_space_write_region_8 \
- !!! bus_space_write_region_8 not implemented !!!
-
-#define bus_space_set_region(n,m) \
-static __inline void \
-CAT(bus_space_set_region_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
- bus_addr_t ba, CAT3(u_int,m,_t) x, size_t cnt) \
-{ \
- while (cnt--) \
- CAT(bus_space_write_,n)(bst, bsh, ba++, x); \
-}
-
-bus_space_set_region(1,8)
-bus_space_set_region(2,16)
-bus_space_set_region(4,32)
-
-#define bus_space_write_8 !!! bus_space_write_8 unimplemented !!!
-
-
-/* These are OpenBSD extensions to the general NetBSD bus interface. */
-#define bus_space_read_raw_multi(n,m,l) \
-static __inline void \
-CAT(bus_space_read_raw_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
- bus_addr_t ba, u_int8_t *buf, bus_size_t cnt) \
-{ \
- CAT(bus_space_read_multi_,n)(bst, bsh, ba, (CAT3(u_int,m,_t) *)buf, \
- cnt >> l); \
-}
-
-bus_space_read_raw_multi(2,16,1)
-bus_space_read_raw_multi(4,32,2)
-
-#define bus_space_read_raw_multi_8 \
- !!! bus_space_read_raw_multi_8 not implemented !!!
-
-#define bus_space_write_raw_multi(n,m,l) \
-static __inline void \
-CAT(bus_space_write_raw_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh,\
- bus_addr_t ba, const u_int8_t *buf, bus_size_t cnt) \
-{ \
- CAT(bus_space_write_multi_,n)(bst, bsh, ba, \
- (const CAT3(u_int,m,_t) *)buf, cnt >> l); \
-}
-
-bus_space_write_raw_multi(2,16,1)
-bus_space_write_raw_multi(4,32,2)
-
-#define bus_space_write_raw_multi_8 \
- !!! bus_space_write_raw_multi_8 not implemented !!!
-
-/* XXX placeholders */
-typedef void *bus_dma_tag_t;
-typedef void *bus_dmamap_t;
-
-#endif /* _ARC_BUS_H_ */
diff --git a/sys/arch/arc/include/cdefs.h b/sys/arch/arc/include/cdefs.h
deleted file mode 100644
index 1b2aa7463a9..00000000000
--- a/sys/arch/arc/include/cdefs.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: cdefs.h,v 1.2 1998/01/28 13:46:10 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/cdefs.h>
diff --git a/sys/arch/arc/include/cpu.h b/sys/arch/arc/include/cpu.h
deleted file mode 100644
index e97f1c9d1b4..00000000000
--- a/sys/arch/arc/include/cpu.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: cpu.h,v 1.9 1998/01/28 13:46:10 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/cpu.h>
diff --git a/sys/arch/arc/include/db_machdep.h b/sys/arch/arc/include/db_machdep.h
deleted file mode 100644
index 866b7342083..00000000000
--- a/sys/arch/arc/include/db_machdep.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: db_machdep.h,v 1.1 1998/03/16 09:38:44 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/db_machdep.h>
diff --git a/sys/arch/arc/include/disklabel.h b/sys/arch/arc/include/disklabel.h
deleted file mode 100644
index 35b1a6c3033..00000000000
--- a/sys/arch/arc/include/disklabel.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* $OpenBSD: disklabel.h,v 1.16 1999/12/04 03:35:57 deraadt Exp $ */
-/* $NetBSD: disklabel.h,v 1.3 1996/03/09 20:52:54 ghudson Exp $ */
-
-/*
- * Copyright (c) 1994 Christopher G. Demetriou
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christopher G. Demetriou.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_DISKLABEL_H_
-#define _MACHINE_DISKLABEL_H_
-
-#define LABELSECTOR 1 /* sector containing label */
-#define LABELOFFSET 0 /* offset of label in sector */
-#define MAXPARTITIONS 16 /* number of partitions */
-#define RAW_PART 2 /* raw partition: ie. rsd0c */
-
-/* DOS partition table -- located in boot block */
-#define DOSBBSECTOR 0 /* DOS boot block relative sector # */
-#define DOSPARTOFF 446
-#define DOSACTIVE 0x80
-#define NDOSPART 4
-#define DOSMBR_SIGNATURE 0xAA55
-#define DOSMBR_SIGNATURE_OFF 0x1FE
-
-struct dos_partition {
- u_int8_t dp_flag; /* bootstrap flags */
- u_int8_t dp_shd; /* starting head */
- u_int8_t dp_ssect; /* starting sector */
- u_int8_t dp_scyl; /* starting cylinder */
- u_int8_t dp_typ; /* partition type (see below) */
- u_int8_t dp_ehd; /* end head */
- u_int8_t dp_esect; /* end sector */
- u_int8_t dp_ecyl; /* end cylinder */
- u_int32_t dp_start; /* absolute starting sector number */
- u_int32_t dp_size; /* partition size in sectors */
-};
-
-/* Known DOS partition types. */
-#define DOSPTYP_UNUSED 0x00 /* Unused partition */
-#define DOSPTYP_FAT12 0x01 /* 12-bit FAT */
-#define DOSPTYP_FAT16S 0x04 /* 16-bit FAT, less than 32M */
-#define DOSPTYP_EXTEND 0x05 /* Extended; contains sub-partitions */
-#define DOSPTYP_FAT16B 0x06 /* 16-bit FAT, more than 32M */
-#define DOSPTYP_FAT32 0x0b /* 32-bit FAT */
-#define DOSPTYP_FAT32L 0x0c /* 32-bit FAT, LBA-mapped */
-#define DOSPTYP_FAT16L 0x0e /* 16-bit FAT, LBA-mapped */
-#define DOSPTYP_ONTRACK 0x54
-#define DOSPTYP_EXTENDL 0x0f /* Extended, LBA-mapped; contains sub-partitions */
-#define DOSPTYP_LINUX 0x83 /* That other thing */
-#define DOSPTYP_FREEBSD 0xa5 /* FreeBSD partition type */
-#define DOSPTYP_OPENBSD 0xa6 /* OpenBSD partition type */
-#define DOSPTYP_NETBSD 0xa9 /* NetBSD partition type */
-
-#include <sys/dkbad.h>
-struct cpu_disklabel {
- struct dos_partition dosparts[NDOSPART];
- struct dkbad bad;
-};
-
-#define DKBAD(x) ((x)->bad)
-
-/* Isolate the relevant bits to get sector and cylinder. */
-#define DPSECT(s) ((s) & 0x3f)
-#define DPCYL(c, s) ((c) + (((s) & 0xc0) << 2))
-
-static __inline u_int32_t get_le __P((void *));
-
-static __inline u_int32_t
-#ifdef __cplusplus
-get_le(void *p)
-#else
-get_le(p)
- void *p;
-#endif
-{
- u_int8_t *_p = (u_int8_t *)p;
- u_int32_t x;
- x = _p[0];
- x |= _p[1] << 8;
- x |= _p[2] << 16;
- x |= _p[3] << 24;
- return x;
-}
-
-#endif /* _MACHINE_DISKLABEL_H_ */
diff --git a/sys/arch/arc/include/display.h b/sys/arch/arc/include/display.h
deleted file mode 100644
index a0d88f623e3..00000000000
--- a/sys/arch/arc/include/display.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $OpenBSD: display.h,v 1.1.1.1 1996/06/24 09:07:17 pefo Exp $ */
-
-/*
- * IBM PC display definitions
- *
- */
-
-/* Color attributes for foreground text */
-
-#define FG_BLACK 0
-#define FG_BLUE 1
-#define FG_GREEN 2
-#define FG_CYAN 3
-#define FG_RED 4
-#define FG_MAGENTA 5
-#define FG_BROWN 6
-#define FG_LIGHTGREY 7
-#define FG_DARKGREY 8
-#define FG_LIGHTBLUE 9
-#define FG_LIGHTGREEN 10
-#define FG_LIGHTCYAN 11
-#define FG_LIGHTRED 12
-#define FG_LIGHTMAGENTA 13
-#define FG_YELLOW 14
-#define FG_WHITE 15
-#define FG_BLINK 0x80
-#define FG_MASK 0x8f
-
-/* Color attributes for text background */
-
-#define BG_BLACK 0x00
-#define BG_BLUE 0x10
-#define BG_GREEN 0x20
-#define BG_CYAN 0x30
-#define BG_RED 0x40
-#define BG_MAGENTA 0x50
-#define BG_BROWN 0x60
-#define BG_LIGHTGREY 0x70
-#define BG_MASK 0x70
-
-/* Monochrome attributes for foreground text */
-
-#define FG_UNDERLINE 0x01
-#define FG_INTENSE 0x08
-
-/* Monochrome attributes for text background */
-
-#define BG_INTENSE 0x10
diff --git a/sys/arch/arc/include/dlfcn.h b/sys/arch/arc/include/dlfcn.h
deleted file mode 100644
index f6c31713664..00000000000
--- a/sys/arch/arc/include/dlfcn.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: dlfcn.h,v 1.2 1998/01/28 13:46:11 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/dlfcn.h>
diff --git a/sys/arch/arc/include/ecoff.h b/sys/arch/arc/include/ecoff.h
deleted file mode 100644
index 54e7da74449..00000000000
--- a/sys/arch/arc/include/ecoff.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: ecoff.h,v 1.4 1998/01/28 13:46:11 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/ecoff.h>
diff --git a/sys/arch/arc/include/elf_abi.h b/sys/arch/arc/include/elf_abi.h
deleted file mode 100644
index 64ae3cddc2b..00000000000
--- a/sys/arch/arc/include/elf_abi.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: elf_abi.h,v 1.3 1998/01/28 13:46:12 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/elf_abi.h>
diff --git a/sys/arch/arc/include/endian.h b/sys/arch/arc/include/endian.h
deleted file mode 100644
index 1dd21b4571c..00000000000
--- a/sys/arch/arc/include/endian.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* $OpenBSD: endian.h,v 1.8 1999/05/10 16:02:08 espie Exp $ */
-
-/*-
- * Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Niklas Hallqvist.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _ARC_ENDIAN_H_
-#define _ARC_ENDIAN_H_
-
-#define BYTE_ORDER LITTLE_ENDIAN
-#include <sys/endian.h>
-
-#endif /* _ARC_ENDIAN_H_ */
diff --git a/sys/arch/arc/include/exec.h b/sys/arch/arc/include/exec.h
deleted file mode 100644
index a1531969a19..00000000000
--- a/sys/arch/arc/include/exec.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $OpenBSD: exec.h,v 1.3 2001/01/22 14:51:03 art Exp $ */
-/* $NetBSD: exec.h,v 1.5 1994/10/26 21:09:39 cgd Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)exec.h 8.1 (Berkeley) 6/10/93
- */
-
-#define __LDPGSZ 4096
-
-/*
- * Define what exec "formats" we should handle.
- */
-#define NATIVE_EXEC_ELF
-#define EXEC_SCRIPT
-
-#define ARCH_ELFSIZE 32
-
-#define ELF_TARG_CLASS ELFCLASS32
-#define ELF_TARG_DATA ELFDATA2LSB
-#define ELF_TARG_MACH EM_MIPS
-
-#define _NLIST_DO_AOUT
-#define _NLIST_DO_ELF
-#define _NLIST_DO_ECOFF
-
-#define _KERN_DO_ECOFF
-#define _KERN_DO_ELF
diff --git a/sys/arch/arc/include/float.h b/sys/arch/arc/include/float.h
deleted file mode 100644
index 0196b10f37a..00000000000
--- a/sys/arch/arc/include/float.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: float.h,v 1.4 1998/01/28 13:46:13 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/float.h>
diff --git a/sys/arch/arc/include/frame.h b/sys/arch/arc/include/frame.h
deleted file mode 100644
index 58760d190dd..00000000000
--- a/sys/arch/arc/include/frame.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: frame.h,v 1.2 1998/03/16 09:38:45 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/frame.h>
diff --git a/sys/arch/arc/include/ieeefp.h b/sys/arch/arc/include/ieeefp.h
deleted file mode 100644
index 16d15693847..00000000000
--- a/sys/arch/arc/include/ieeefp.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: ieeefp.h,v 1.2 1998/01/28 13:46:14 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/ieeefp.h>
diff --git a/sys/arch/arc/include/intr.h b/sys/arch/arc/include/intr.h
deleted file mode 100644
index bbc55e66bd7..00000000000
--- a/sys/arch/arc/include/intr.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* $NetBSD: intr.h,v 1.5 1996/05/13 06:11:28 mycroft Exp $ */
-
-/*
- * Copyright (c) 1996 Charles M. Hannum. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles M. Hannum.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _ARC_INTR_H_
-#define _ARC_INTR_H_
-
-/* Interrupt priority `levels'; not mutually exclusive. */
-#define IPL_BIO 0 /* block I/O */
-#define IPL_NET 1 /* network */
-#define IPL_TTY 2 /* terminal */
-#define IPL_CLOCK 3 /* clock */
-#define IPL_IMP 4 /* memory allocation */
-#define IPL_NONE 5 /* nothing */
-#define IPL_HIGH 6 /* everything */
-
-/* Interrupt sharing types. */
-#define IST_NONE 0 /* none */
-#define IST_PULSE 1 /* pulsed */
-#define IST_EDGE 2 /* edge-triggered */
-#define IST_LEVEL 3 /* level-triggered */
-
-/* Soft interrupt masks. */
-#define SIR_CLOCK 31
-#define SIR_CLOCKMASK ((1 << SIR_CLOCK))
-#define SIR_NET 30
-#define SIR_NETMASK ((1 << SIR_NET) | SIR_CLOCKMASK)
-#define SIR_TTY 29
-#define SIR_TTYMASK ((1 << SIR_TTY) | SIR_CLOCKMASK)
-#define SIR_ALLMASK (SIR_CLOCKMASK | SIR_NETMASK | SIR_TTYMASK)
-
-#ifndef _LOCORE
-
-void setsoftclock __P((void));
-void clearsoftclock __P((void));
-int splsoftclock __P((void));
-void setsoftnet __P((void));
-void clearsoftnet __P((void));
-int splsoftnet __P((void));
-
-#define spllowersoftclock() splsoftclock()
-
-struct clockframe;
-void set_intr __P((int, int(*)(u_int, struct clockframe *), int));
-
-volatile int cpl, ipending, astpending;
-int imask[7];
-
-#endif /* _LOCORE */
-
-#endif /* _ARC_INTR_H_ */
diff --git a/sys/arch/arc/include/joystick.h b/sys/arch/arc/include/joystick.h
deleted file mode 100644
index 7429e112130..00000000000
--- a/sys/arch/arc/include/joystick.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* $OpenBSD: joystick.h,v 1.1 1998/05/05 05:44:43 imp Exp $ */
-/* $NetBSD: joystick.h,v 1.1 1996/03/27 19:18:56 perry Exp $ */
-
-#ifndef _JOY_IOCTL_H_
-#define _JOY_IOCTL_H_
-
-#include <sys/ioccom.h>
-
-struct joystick {
- int x;
- int y;
- int b1;
- int b2;
-};
-
-#define JOY_SETTIMEOUT _IOW('J', 1, int) /* set timeout */
-#define JOY_GETTIMEOUT _IOR('J', 2, int) /* get timeout */
-#define JOY_SET_X_OFFSET _IOW('J', 3, int) /* set offset on X-axis */
-#define JOY_SET_Y_OFFSET _IOW('J', 4, int) /* set offset on X-axis */
-#define JOY_GET_X_OFFSET _IOR('J', 5, int) /* get offset on X-axis */
-#define JOY_GET_Y_OFFSET _IOR('J', 6, int) /* get offset on Y-axis */
-
-#endif /* _JOY_IOCTL_H_ */
diff --git a/sys/arch/arc/include/kbdreg.h b/sys/arch/arc/include/kbdreg.h
deleted file mode 100644
index b15039d21c0..00000000000
--- a/sys/arch/arc/include/kbdreg.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* $OpenBSD: kbdreg.h,v 1.3 1996/09/04 21:18:24 pefo Exp $ */
-
-/*
- * Copyright (c) 1996 Per Fogelstrom
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * Keyboard definitions
- *
- */
-
-#define KBSTATP (0x61) /* controller status port (I) */
-#define KBS_DIB 0x01 /* data in buffer */
-#define KBS_IBF 0x02 /* input buffer low */
-#define KBS_WARM 0x04 /* input buffer low */
-#define KBS_OCMD 0x08 /* output buffer has command */
-#define KBS_NOSEC 0x10 /* security lock not engaged */
-#define KBS_TERR 0x20 /* transmission error */
-#define KBS_RERR 0x40 /* receive error */
-#define KBS_PERR 0x80 /* parity error */
-
-#define KBCMDP (0x61) /* controller port (O) */
-#define KBDATAP (0x60) /* data port (I) */
-#define KBOUTP (0x60) /* data port (O) */
-
-#define K_RDCMDBYTE 0x20
-#define K_LDCMDBYTE 0x60
-
-#define KC8_TRANS 0x40 /* convert to old scan codes */
-#define KC8_MDISABLE 0x20 /* disable mouse */
-#define KC8_KDISABLE 0x10 /* disable keyboard */
-#define KC8_IGNSEC 0x08 /* ignore security lock */
-#define KC8_CPU 0x04 /* exit from protected mode reset */
-#define KC8_MENABLE 0x02 /* enable mouse interrupt */
-#define KC8_KENABLE 0x01 /* enable keyboard interrupt */
-#define CMDBYTE (KC8_TRANS|KC8_CPU|KC8_MENABLE|KC8_KENABLE)
-
-/* keyboard commands */
-#define KBC_RESET 0xFF /* reset the keyboard */
-#define KBC_RESEND 0xFE /* request the keyboard resend the last byte */
-#define KBC_SETDEFAULT 0xF6 /* resets keyboard to its power-on defaults */
-#define KBC_DISABLE 0xF5 /* as per KBC_SETDEFAULT, but also disable key scanning */
-#define KBC_ENABLE 0xF4 /* enable key scanning */
-#define KBC_TYPEMATIC 0xF3 /* set typematic rate and delay */
-#define KBC_SETTABLE 0xF0 /* set scancode translation table */
-#define KBC_MODEIND 0xED /* set mode indicators (i.e. LEDs) */
-#define KBC_ECHO 0xEE /* request an echo from the keyboard */
-
-/* keyboard responses */
-#define KBR_EXTENDED 0xE0 /* extended key sequence */
-#define KBR_RESEND 0xFE /* needs resend of command */
-#define KBR_ACK 0xFA /* received a valid command */
-#define KBR_OVERRUN 0x00 /* flooded */
-#define KBR_FAILURE 0xFD /* diagnosic failure */
-#define KBR_BREAK 0xF0 /* break code prefix - sent on key release */
-#define KBR_RSTDONE 0xAA /* reset complete */
-#define KBR_ECHO 0xEE /* echo response */
diff --git a/sys/arch/arc/include/kcore.h b/sys/arch/arc/include/kcore.h
deleted file mode 100644
index 52131fd69b6..00000000000
--- a/sys/arch/arc/include/kcore.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: kcore.h,v 1.2 1998/01/28 13:46:15 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/kcore.h>
diff --git a/sys/arch/arc/include/kdbparam.h b/sys/arch/arc/include/kdbparam.h
deleted file mode 100644
index 91bf9d081aa..00000000000
--- a/sys/arch/arc/include/kdbparam.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: kdbparam.h,v 1.2 1998/01/28 13:46:16 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/kdbparam.h>
diff --git a/sys/arch/arc/include/limits.h b/sys/arch/arc/include/limits.h
deleted file mode 100644
index 641a7aaf265..00000000000
--- a/sys/arch/arc/include/limits.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: limits.h,v 1.3 1998/01/28 13:46:17 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/limits.h>
diff --git a/sys/arch/arc/include/link.h b/sys/arch/arc/include/link.h
deleted file mode 100644
index 0f67c7222de..00000000000
--- a/sys/arch/arc/include/link.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: link.h,v 1.3 1998/01/28 13:46:18 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/link.h>
diff --git a/sys/arch/arc/include/memconf.h b/sys/arch/arc/include/memconf.h
deleted file mode 100644
index 3a6171bc8ad..00000000000
--- a/sys/arch/arc/include/memconf.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: memconf.h,v 1.3 1998/01/28 13:46:18 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/memconf.h>
diff --git a/sys/arch/arc/include/mips_opcode.h b/sys/arch/arc/include/mips_opcode.h
deleted file mode 100644
index dbe46558fd0..00000000000
--- a/sys/arch/arc/include/mips_opcode.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: mips_opcode.h,v 1.2 1998/01/28 13:46:19 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/mips_opcode.h>
diff --git a/sys/arch/arc/include/mouse.h b/sys/arch/arc/include/mouse.h
deleted file mode 100644
index 08920bff76b..00000000000
--- a/sys/arch/arc/include/mouse.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* $OpenBSD: mouse.h,v 1.2 1997/01/19 09:58:45 pefo Exp $ */
-/* $NetBSD: mouse.h,v 1.4 1994/10/27 04:16:10 cgd Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993 Erik Forsberg.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
- * NO EVENT SHALL I BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MOUSE_H_
-#define _MOUSE_H_
-
-struct mouseinfo {
- unsigned char status;
- char xmotion, ymotion;
-};
-
-#define BUTSTATMASK 0x07 /* Any mouse button down if any bit set */
-#define BUTCHNGMASK 0x38 /* Any mouse button changed if any bit set */
-
-#define BUT3STAT 0x01 /* Button 3 down if set */
-#define BUT2STAT 0x02 /* Button 2 down if set */
-#define BUT1STAT 0x04 /* Button 1 down if set */
-#define BUT3CHNG 0x08 /* Button 3 changed if set */
-#define BUT2CHNG 0x10 /* Button 2 changed if set */
-#define BUT1CHNG 0x20 /* Button 1 changed if set */
-#define MOVEMENT 0x40 /* Mouse movement detected */
-
-/* Ioctl definitions */
-
-#define MOUSEIOC ('M'<<8)
-#define MOUSEIOCREAD (MOUSEIOC|60)
-#define MOUSEIOCSRAW (MOUSEIOC|61)
-#define MOUSEIOCSCOOKED (MOUSEIOC|62)
-
-#endif /* !_MOUSE_H_ */
diff --git a/sys/arch/arc/include/param.h b/sys/arch/arc/include/param.h
deleted file mode 100644
index 39387239bdd..00000000000
--- a/sys/arch/arc/include/param.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/* $OpenBSD: param.h,v 1.12 1999/08/11 22:14:17 niklas Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: machparam.h 1.11 89/08/14
- * from: @(#)param.h 8.1 (Berkeley) 6/10/93
- */
-
-#ifndef _MACHINE_PARAM_H_
-#define _MACHINE_PARAM_H_
-
-#ifdef _KERNEL
-#ifdef _LOCORE
-#include <machine/psl.h>
-#else
-#include <machine/cpu.h>
-#endif
-#endif
-
-/*
- * Machine dependent constants for ARC BIOS MIPS machines:
- * Acer Labs PICA_61
- * Deskstation rPC44
- * Deskstation Tyne
- * Etc
- */
-#define MACHINE "arc"
-#define _MACHINE arc
-#define MACHINE_ARCH "mips"
-#define _MACHINE_ARCH mips
-
-#define MID_MACHINE 0 /* None but has to be defined */
-
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value for all
- * data types (int, long, ...). The result is u_int and must be cast to
- * any desired pointer type.
- */
-#define ALIGNBYTES 7
-#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
-#define ALIGNED_POINTER(p, t) ((((u_int32_t)(p)) & (sizeof (t) - 1)) == 0)
-
-#define NBPG 4096 /* bytes/page */
-#define PGOFSET (NBPG-1) /* byte offset into page */
-#define PGSHIFT 12 /* LOG2(NBPG) */
-#define NPTEPG (NBPG/4)
-
-#define NBSEG 0x400000 /* bytes/segment */
-#define SEGOFSET (NBSEG-1) /* byte offset into segment */
-#define SEGSHIFT 22 /* LOG2(NBSEG) */
-
-#define KERNBASE 0x80000000 /* start of kernel virtual */
-#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT)
-
-#define DEV_BSIZE 512
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define BLKDEV_IOSIZE 2048
-/* XXX Maxphys temporary changed to 32K while SCSI driver is fixed. */
-#define MAXPHYS (32 * 1024) /* max raw I/O transfer size */
-
-#define CLSIZE 1
-#define CLSIZELOG2 0
-
-/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
-#define SSIZE 1 /* initial stack size/NBPG */
-#define SINCR 1 /* increment of stack/NBPG */
-
-#define UPAGES 2 /* pages of u-area */
-#if defined(_LOCORE) && defined(notyet)
-#define UADDR 0xffffffffffffc000 /* address of u */
-#else
-#define UADDR 0xffffc000 /* address of u */
-#endif
-#define USPACE (UPAGES*NBPG) /* size of u-area in bytes */
-#define UVPN (UADDR>>PGSHIFT)/* virtual page number of u */
-#define KERNELSTACK (UADDR+UPAGES*NBPG) /* top of kernel stack */
-
-/*
- * Constants related to network buffer management.
- * MCLBYTES must be no larger than CLBYTES (the software page size), and,
- * on machines that exchange pages of input or output buffers with mbuf
- * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
- * of the hardware page size.
- */
-#define MSIZE 128 /* size of an mbuf */
-#define MCLSHIFT 11
-#define MCLBYTES (1 << MCLSHIFT) /* enough for whole Ethernet packet */
-#define MCLOFSET (MCLBYTES - 1)
-#ifndef NMBCLUSTERS
-#ifdef GATEWAY
-#define NMBCLUSTERS 2048 /* map size, max cluster allocation */
-#else
-#define NMBCLUSTERS 1024 /* map size, max cluster allocation */
-#endif
-#endif
-
-/*
- * Size of kernel malloc arena in CLBYTES-sized logical pages
- */
-#ifndef NKMEMCLUSTERS
-#define NKMEMCLUSTERS (4096*1024/CLBYTES)
-#endif
-
-/* pages ("clicks") (4096 bytes) to disk blocks */
-#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
-
-/* pages to bytes */
-#define ctob(x) ((x) << PGSHIFT)
-#define btoc(x) (((x) + PGOFSET) >> PGSHIFT)
-
-/* bytes to disk blocks */
-#define btodb(x) ((x) >> DEV_BSHIFT)
-#define dbtob(x) ((x) << DEV_BSHIFT)
-
-/*
- * Map a ``block device block'' to a file system block.
- * This should be device dependent, and should use the bsize
- * field from the disk label.
- * For now though just use DEV_BSIZE.
- */
-#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
-
-/*
- * Conversion macros
- */
-#define mips_round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1))
-#define mips_trunc_page(x) ((unsigned)(x) & ~(NBPG-1))
-#define mips_btop(x) ((unsigned)(x) >> PGSHIFT)
-#define mips_ptob(x) ((unsigned)(x) << PGSHIFT)
-
-#ifdef _KERNEL
-#ifndef _LOCORE
-extern int (*Mips_splnet)(void), (*Mips_splbio)(void), (*Mips_splimp)(void),
- (*Mips_spltty)(void), (*Mips_splclock)(void), (*Mips_splstatclock)(void);
-#define splnet() ((*Mips_splnet)())
-#define splbio() ((*Mips_splbio)())
-#define splimp() ((*Mips_splimp)())
-#define spltty() ((*Mips_spltty)())
-#define splclock() ((*Mips_splclock)())
-#define splstatclock() ((*Mips_splstatclock)())
-
-int splhigh __P((void));
-int splx __P((int));
-int spl0 __P((void));
-
-/*
- * Delay is based on an assumtion that each time in the loop
- * takes 3 clocks. Three is for branch and subtract in the delay slot.
- */
-extern int cpuspeed;
-#define DELAY(n) { register int N = cpuspeed * (n); while ((N -= 3) > 0); }
-void delay __P((int));
-#endif
-
-#else /* !_KERNEL */
-#define DELAY(n) { register int N = (n); while (--N > 0); }
-#endif /* !_KERNEL */
-
-#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/arc/include/pcb.h b/sys/arch/arc/include/pcb.h
deleted file mode 100644
index 23b9d6673f1..00000000000
--- a/sys/arch/arc/include/pcb.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: pcb.h,v 1.3 1998/01/28 13:46:21 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/pcb.h>
diff --git a/sys/arch/arc/include/pccons.h b/sys/arch/arc/include/pccons.h
deleted file mode 100644
index f75ac09a16b..00000000000
--- a/sys/arch/arc/include/pccons.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $OpenBSD: pccons.h,v 1.2 1996/09/01 16:50:12 deraadt Exp $ */
-/* $NetBSD: pccons.h,v 1.4 1996/02/02 18:06:06 mycroft Exp $ */
-
-/*
- * pccons.h -- pccons ioctl definitions
- */
-
-#ifndef _PCCONS_H_
-#define _PCCONS_H_
-
-#include <sys/ioctl.h>
-
-/* key types -- warning: pccons.c depends on most values */
-
-#define KB_SCROLL 0x0001 /* stop output */
-#define KB_NUM 0x0002 /* numeric shift cursors vs. numeric */
-#define KB_CAPS 0x0004 /* caps shift -- swaps case of letter */
-#define KB_SHIFT 0x0008 /* keyboard shift */
-#define KB_CTL 0x0010 /* control shift -- allows ctl function */
-#define KB_ASCII 0x0020 /* ascii code for this key */
-#define KB_ALTGR 0x0040 /* alternate graphics shift */
-#define KB_ALT 0x0080 /* alternate shift -- alternate chars */
-#define KB_FUNC 0x0100 /* function key */
-#define KB_KP 0x0200 /* Keypad keys */
-#define KB_NONE 0x0400 /* no function */
-
-#define KB_CODE_SIZE 4 /* Use a max of 4 for now... */
-#define KB_NUM_KEYS 128 /* Number of scan codes */
-typedef struct {
- u_short type;
- char unshift[KB_CODE_SIZE];
- char shift[KB_CODE_SIZE];
- char ctl[KB_CODE_SIZE];
- char altgr[KB_CODE_SIZE];
- char shift_altgr[KB_CODE_SIZE];
-} pccons_keymap_t;
-
-#define CONSOLE_X_MODE_ON _IO('t',121)
-#define CONSOLE_X_MODE_OFF _IO('t',122)
-#define CONSOLE_X_BELL _IOW('t',123,int[2])
-#define CONSOLE_SET_TYPEMATIC_RATE _IOW('t',124,u_char)
-#define CONSOLE_GET_KEYMAP _IOR('t',128,pccons_keymap_t[KB_NUM_KEYS])
-#define CONSOLE_SET_KEYMAP _IOW('t',129,pccons_keymap_t[KB_NUM_KEYS])
-
-#endif /* _PCCONS_H_ */
diff --git a/sys/arch/arc/include/pio.h b/sys/arch/arc/include/pio.h
deleted file mode 100644
index 2518883df87..00000000000
--- a/sys/arch/arc/include/pio.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: pio.h,v 1.4 1998/01/28 13:46:21 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/pio.h>
diff --git a/sys/arch/arc/include/pmap.h b/sys/arch/arc/include/pmap.h
deleted file mode 100644
index b8ed772f22c..00000000000
--- a/sys/arch/arc/include/pmap.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: pmap.h,v 1.4 1998/01/28 13:46:22 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/pmap.h>
diff --git a/sys/arch/arc/include/proc.h b/sys/arch/arc/include/proc.h
deleted file mode 100644
index 6e067e0e8fb..00000000000
--- a/sys/arch/arc/include/proc.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: proc.h,v 1.3 1998/01/28 13:46:23 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/proc.h>
diff --git a/sys/arch/arc/include/profile.h b/sys/arch/arc/include/profile.h
deleted file mode 100644
index f5bbda39494..00000000000
--- a/sys/arch/arc/include/profile.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: profile.h,v 1.4 1998/01/28 13:46:23 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/profile.h>
diff --git a/sys/arch/arc/include/psl.h b/sys/arch/arc/include/psl.h
deleted file mode 100644
index a9da8c2cab8..00000000000
--- a/sys/arch/arc/include/psl.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* $OpenBSD: psl.h,v 1.2 1998/01/28 13:46:25 pefo Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)psl.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <machine/cpu.h>
-
-#define PSL_LOWIPL (INT_MASK | SR_INT_ENAB)
-
-#define PSL_USERSET ( \
- SR_KSU_USER | \
- SR_INT_ENAB | \
- SR_EXL | \
- INT_MASK)
-
-#define PSL_USERCLR ( \
- SR_COP_USABILITY | \
- SR_BOOT_EXC_VEC | \
- SR_TLB_SHUTDOWN | \
- SR_PARITY_ERR | \
- SR_CACHE_MISS | \
- SR_PARITY_ZERO | \
- SR_SWAP_CACHES | \
- SR_ISOL_CACHES | \
- SR_KU_CUR | \
- SR_INT_ENA_CUR | \
- SR_MBZ)
-
-/*
- * Macros to decode processor status word.
- */
-#define USERMODE(ps) (((ps) & SR_KSU_MASK) == SR_KSU_USER)
-#define BASEPRI(ps) (((ps) & (INT_MASK | SR_INT_ENA_PREV)) \
- == (INT_MASK | SR_INT_ENA_PREV))
-
-#ifdef _KERNEL
-#include <machine/intr.h>
-#endif
diff --git a/sys/arch/arc/include/pte.h b/sys/arch/arc/include/pte.h
deleted file mode 100644
index db6ece9363b..00000000000
--- a/sys/arch/arc/include/pte.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* $OpenBSD: pte.h,v 1.4 1998/01/28 13:46:25 pefo Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: pte.h 1.11 89/09/03
- * from: @(#)pte.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * R4000 hardware page table entry
- */
-
-#ifndef _LOCORE
-struct pte {
-#if BYTE_ORDER == BIG_ENDIAN
-unsigned int pg_prot:2, /* SW: access control */
- pg_pfnum:24, /* HW: core page frame number or 0 */
- pg_attr:3, /* HW: cache attribute */
- pg_m:1, /* HW: modified (dirty) bit */
- pg_v:1, /* HW: valid bit */
- pg_g:1; /* HW: ignore pid bit */
-#endif
-#if BYTE_ORDER == LITTLE_ENDIAN
-unsigned int pg_g:1, /* HW: ignore pid bit */
- pg_v:1, /* HW: valid bit */
- pg_m:1, /* HW: modified (dirty) bit */
- pg_attr:3, /* HW: cache attribute */
- pg_pfnum:24, /* HW: core page frame number or 0 */
- pg_prot:2; /* SW: access control */
-#endif
-};
-
-/*
- * Structure defining an tlb entry data set.
- */
-
-struct tlb {
- int tlb_mask;
- int tlb_hi;
- int tlb_lo0;
- int tlb_lo1;
-};
-
-typedef union pt_entry {
- unsigned int pt_entry; /* for copying, etc. */
- struct pte pt_pte; /* for getting to bits by name */
-} pt_entry_t; /* Mips page table entry */
-#endif /* _LOCORE */
-
-#define PT_ENTRY_NULL ((pt_entry_t *) 0)
-
-#define PG_WIRED 0x80000000 /* SW */
-#define PG_RO 0x40000000 /* SW */
-
-#define PG_SVPN 0xfffff000 /* Software page no mask */
-#define PG_HVPN 0xffffe000 /* Hardware page no mask */
-#define PG_ODDPG 0x00001000 /* Odd even pte entry */
-#define PG_ASID 0x000000ff /* Address space ID */
-#define PG_G 0x00000001 /* HW */
-#define PG_V 0x00000002
-#define PG_NV 0x00000000
-#define PG_M 0x00000004
-#define PG_ATTR 0x0000003f
-#define PG_UNCACHED 0x00000010
-#define PG_CACHED 0x00000018
-#define PG_CACHEMODE 0x00000038
-#define PG_ROPAGE (PG_V | PG_RO | PG_CACHED) /* Write protected */
-#define PG_RWPAGE (PG_V | PG_M | PG_CACHED) /* Not wr-prot not clean */
-#define PG_CWPAGE (PG_V | PG_CACHED) /* Not wr-prot but clean */
-#define PG_IOPAGE (PG_G | PG_V | PG_M | PG_UNCACHED)
-#define PG_FRAME 0x3fffffc0
-#define PG_SHIFT 6
-#define pfn_is_ext(x) ((x) & 0x3c000000)
-#define vad_to_pfn(x) (((unsigned)(x) >> PG_SHIFT) & PG_FRAME)
-#define vad_to_pfn64(x) (((quad_t)(x) >> PG_SHIFT) & PG_FRAME)
-#define pfn_to_vad(x) (((x) & PG_FRAME) << PG_SHIFT)
-#define vad_to_vpn(x) ((unsigned)(x) & PG_SVPN)
-#define vpn_to_vad(x) ((x) & PG_SVPN)
-/* User viritual to pte page entry */
-#define uvtopte(adr) (((adr) >> PGSHIFT) & (NPTEPG -1))
-
-#define PG_SIZE_4K 0x00000000
-#define PG_SIZE_16K 0x00006000
-#define PG_SIZE_64K 0x0001e000
-#define PG_SIZE_256K 0x0007e000
-#define PG_SIZE_1M 0x001fe000
-#define PG_SIZE_4M 0x007fe000
-#define PG_SIZE_16M 0x01ffe000
-
-#if defined(_KERNEL) && !defined(_LOCORE)
-/*
- * Kernel virtual address to page table entry and visa versa.
- */
-#define kvtopte(va) \
- (Sysmap + (((vm_offset_t)(va) - VM_MIN_KERNEL_ADDRESS) >> PGSHIFT))
-#define ptetokv(pte) \
- ((((pt_entry_t *)(pte) - Sysmap) << PGSHIFT) + VM_MIN_KERNEL_ADDRESS)
-
-extern pt_entry_t *Sysmap; /* kernel pte table */
-extern u_int Sysmapsize; /* number of pte's in Sysmap */
-#endif
diff --git a/sys/arch/arc/include/ptrace.h b/sys/arch/arc/include/ptrace.h
deleted file mode 100644
index 4494ed41a62..00000000000
--- a/sys/arch/arc/include/ptrace.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: ptrace.h,v 1.2 1998/01/28 13:46:26 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/ptrace.h>
diff --git a/sys/arch/arc/include/reg.h b/sys/arch/arc/include/reg.h
deleted file mode 100644
index c2a9c0d20d1..00000000000
--- a/sys/arch/arc/include/reg.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: reg.h,v 1.2 1998/01/28 13:46:27 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/reg.h>
diff --git a/sys/arch/arc/include/regdef.h b/sys/arch/arc/include/regdef.h
deleted file mode 100644
index c80fb40f16f..00000000000
--- a/sys/arch/arc/include/regdef.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: regdef.h,v 1.2 1998/01/28 13:46:28 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/regdef.h>
diff --git a/sys/arch/arc/include/regnum.h b/sys/arch/arc/include/regnum.h
deleted file mode 100644
index 0dd3d50181c..00000000000
--- a/sys/arch/arc/include/regnum.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: regnum.h,v 1.2 1998/01/28 13:46:29 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/regnum.h>
diff --git a/sys/arch/arc/include/reloc.h b/sys/arch/arc/include/reloc.h
deleted file mode 100644
index 928d1c8ed72..00000000000
--- a/sys/arch/arc/include/reloc.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: reloc.h,v 1.3 1998/01/28 13:46:30 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/reloc.h>
diff --git a/sys/arch/arc/include/setjmp.h b/sys/arch/arc/include/setjmp.h
deleted file mode 100644
index 4f456c11d0e..00000000000
--- a/sys/arch/arc/include/setjmp.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: setjmp.h,v 1.2 1998/01/28 13:46:32 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/setjmp.h>
diff --git a/sys/arch/arc/include/signal.h b/sys/arch/arc/include/signal.h
deleted file mode 100644
index 28ac725a8c1..00000000000
--- a/sys/arch/arc/include/signal.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: signal.h,v 1.2 1998/01/28 13:46:33 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/signal.h>
diff --git a/sys/arch/arc/include/spinlock.h b/sys/arch/arc/include/spinlock.h
deleted file mode 100644
index 199b445ab98..00000000000
--- a/sys/arch/arc/include/spinlock.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: spinlock.h,v 1.2 1999/01/26 20:33:06 imp Exp $ */
-
-#include <mips/spinlock.h>
diff --git a/sys/arch/arc/include/stdarg.h b/sys/arch/arc/include/stdarg.h
deleted file mode 100644
index dc6f04224b8..00000000000
--- a/sys/arch/arc/include/stdarg.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: stdarg.h,v 1.3 1998/01/28 13:46:34 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/stdarg.h>
diff --git a/sys/arch/arc/include/trap.h b/sys/arch/arc/include/trap.h
deleted file mode 100644
index f01ccd08c76..00000000000
--- a/sys/arch/arc/include/trap.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: trap.h,v 1.2 1998/01/28 13:46:35 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/trap.h>
diff --git a/sys/arch/arc/include/types.h b/sys/arch/arc/include/types.h
deleted file mode 100644
index 98d59fbe530..00000000000
--- a/sys/arch/arc/include/types.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: types.h,v 1.3 1998/01/28 13:46:36 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/types.h>
diff --git a/sys/arch/arc/include/varargs.h b/sys/arch/arc/include/varargs.h
deleted file mode 100644
index e04cab2a9b5..00000000000
--- a/sys/arch/arc/include/varargs.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: varargs.h,v 1.3 1998/01/29 15:10:34 pefo Exp $ */
-
-/* Use Mips generic include file */
-
-#include <mips/varargs.h>
diff --git a/sys/arch/arc/include/vmparam.h b/sys/arch/arc/include/vmparam.h
deleted file mode 100644
index e72f314f405..00000000000
--- a/sys/arch/arc/include/vmparam.h
+++ /dev/null
@@ -1,235 +0,0 @@
-/* $OpenBSD: vmparam.h,v 1.4 1997/08/01 11:22:14 deraadt Exp $ */
-/* $NetBSD: vmparam.h,v 1.5 1994/10/26 21:10:10 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: vmparam.h 1.16 91/01/18
- * @(#)vmparam.h 8.2 (Berkeley) 4/22/94
- */
-
-/*
- * Machine dependent constants.
- */
-/*
- * USRTEXT is the start of the user text/data space, while USRSTACK
- * is the top (end) of the user stack.
- */
-#define USRTEXT 0x00400000
-#define USRSTACK 0x80000000 /* Start of user stack */
-
-/*
- * Virtual memory related constants, all in bytes
- */
-#ifndef MAXTSIZ
-#define MAXTSIZ (24*1024*1024) /* max text size */
-#endif
-#ifndef DFLDSIZ
-#define DFLDSIZ (32*1024*1024) /* initial data size limit */
-#endif
-#ifndef MAXDSIZ
-#define MAXDSIZ (32*1024*1024) /* max data size */
-#endif
-#ifndef DFLSSIZ
-#define DFLSSIZ (1024*1024) /* initial stack size limit */
-#endif
-#ifndef MAXSSIZ
-#define MAXSSIZ MAXDSIZ /* max stack size */
-#endif
-
-/*
- * Default sizes of swap allocation chunks (see dmap.h).
- * The actual values may be changed in vminit() based on MAXDSIZ.
- * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024.
- * DMMIN should be at least ctod(1) so that vtod() works.
- * vminit() insures this.
- */
-#define DMMIN 32 /* smallest swap allocation */
-#define DMMAX 4096 /* largest potential swap allocation */
-
-/*
- * Sizes of the system and user portions of the system page table.
- */
-/* SYSPTSIZE IS SILLY; (really number of buffers for I/O) */
-#define SYSPTSIZE 1228
-#define USRPTSIZE 1024
-
-/*
- * PTEs for mapping user space into the kernel for phyio operations.
- * 16 pte's are enough to cover 8 disks * MAXBSIZE.
- */
-#ifndef USRIOSIZE
-#define USRIOSIZE 32
-#endif
-
-/*
- * PTEs for system V style shared memory.
- * This is basically slop for kmempt which we actually allocate (malloc) from.
- */
-#ifndef SHMMAXPGS
-#define SHMMAXPGS 1024 /* 4mb */
-#endif
-
-/*
- * Boundary at which to place first MAPMEM segment if not explicitly
- * specified. Should be a power of two. This allows some slop for
- * the data segment to grow underneath the first mapped segment.
- */
-#define MMSEG 0x200000
-
-/*
- * The size of the clock loop.
- */
-#define LOOPPAGES (maxfree - firstfree)
-
-/*
- * The time for a process to be blocked before being very swappable.
- * This is a number of seconds which the system takes as being a non-trivial
- * amount of real time. You probably shouldn't change this;
- * it is used in subtle ways (fractions and multiples of it are, that is, like
- * half of a ``long time'', almost a long time, etc.)
- * It is related to human patience and other factors which don't really
- * change over time.
- */
-#define MAXSLP 20
-
-/*
- * A swapped in process is given a small amount of core without being bothered
- * by the page replacement algorithm. Basically this says that if you are
- * swapped in you deserve some resources. We protect the last SAFERSS
- * pages against paging and will just swap you out rather than paging you.
- * Note that each process has at least UPAGES+CLSIZE pages which are not
- * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this
- * number just means a swapped in process is given around 25k bytes.
- * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81),
- * so we loan each swapped in process memory worth 100$, or just admit
- * that we don't consider it worthwhile and swap it out to disk which costs
- * $30/mb or about $0.75.
- */
-#define SAFERSS 4 /* nominal ``small'' resident set size
- protected against replacement */
-
-/*
- * DISKRPM is used to estimate the number of paging i/o operations
- * which one can expect from a single disk controller.
- */
-#define DISKRPM 60
-
-/*
- * Klustering constants. Klustering is the gathering
- * of pages together for pagein/pageout, while clustering
- * is the treatment of hardware page size as though it were
- * larger than it really is.
- *
- * KLMAX gives maximum cluster size in CLSIZE page (cluster-page)
- * units. Note that ctod(KLMAX*CLSIZE) must be <= DMMIN in dmap.h.
- * ctob(KLMAX) should also be less than MAXPHYS (in vm_swp.c)
- * unless you like "big push" panics.
- */
-
-#ifdef notdef /* XXX */
-#define KLMAX (4/CLSIZE)
-#define KLSEQL (2/CLSIZE) /* in klust if vadvise(VA_SEQL) */
-#define KLIN (4/CLSIZE) /* default data/stack in klust */
-#define KLTXT (4/CLSIZE) /* default text in klust */
-#define KLOUT (4/CLSIZE)
-#else
-#define KLMAX (1/CLSIZE)
-#define KLSEQL (1/CLSIZE)
-#define KLIN (1/CLSIZE)
-#define KLTXT (1/CLSIZE)
-#define KLOUT (1/CLSIZE)
-#endif
-
-/*
- * KLSDIST is the advance or retard of the fifo reclaim for sequential
- * processes data space.
- */
-#define KLSDIST 3 /* klusters advance/retard for seq. fifo */
-
-/*
- * Paging thresholds (see vm_sched.c).
- * Strategy of 1/19/85:
- * lotsfree is 512k bytes, but at most 1/4 of memory
- * desfree is 200k bytes, but at most 1/8 of memory
- */
-#define LOTSFREE (512 * 1024)
-#define LOTSFREEFRACT 4
-#define DESFREE (200 * 1024)
-#define DESFREEFRACT 8
-
-/*
- * There are two clock hands, initially separated by HANDSPREAD bytes
- * (but at most all of user memory). The amount of time to reclaim
- * a page once the pageout process examines it increases with this
- * distance and decreases as the scan rate rises.
- */
-#define HANDSPREAD (2 * 1024 * 1024)
-
-/*
- * The number of times per second to recompute the desired paging rate
- * and poke the pagedaemon.
- */
-#define RATETOSCHEDPAGING 4
-
-/*
- * Believed threshold (in megabytes) for which interleaved
- * swapping area is desirable.
- */
-#define LOTSOFMEM 2
-
-/*
- * Mach derived constants
- */
-
-/* user/kernel map constants */
-#define VM_MIN_ADDRESS ((vm_offset_t)0x00000000)
-#define VM_MAXUSER_ADDRESS ((vm_offset_t)0x80000000)
-#define VM_MAX_ADDRESS ((vm_offset_t)0x80000000)
-#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)0xC0000000)
-#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)0xFFFFC000)
-
-#define MACHINE_NONCONTIG /* VM <=> pmap interface modifier */
-
-/* virtual sizes (bytes) for various kernel submaps */
-#define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES)
-#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES)
-#define VM_PHYS_SIZE (USRIOSIZE*CLBYTES)
-
-struct vm_map;
-
-vm_offset_t kmem_alloc_upage __P((struct vm_map *, vm_size_t));
diff --git a/sys/arch/arc/isa/isa_machdep.h b/sys/arch/arc/isa/isa_machdep.h
deleted file mode 100644
index 2c3e8fb7ec3..00000000000
--- a/sys/arch/arc/isa/isa_machdep.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* $OpenBSD: isa_machdep.h,v 1.6 1998/06/29 05:47:39 downsj Exp $ */
-
-/*
- * Copyright (c) 1996 Per Fogelstrom
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Per Fogelstrom
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _ISA_MACHDEP_H_
-#define _ISA_MACHDEP_H_
-
-typedef struct arc_isa_bus *isa_chipset_tag_t;
-
-/*
- * I/O macros to access isa bus ports/memory.
- * At the first glance theese macros may seem inefficient.
- * However, the cpu executes an instruction every 7.5ns
- * so the bus is much slower so it doesn't matter, really.
- */
-#define isa_outb(x,y) outb(arc_bus_io.bus_base + (x), y)
-#define isa_inb(x) inb(arc_bus_io.bus_base + (x))
-
-struct arc_isa_bus {
- void *ic_data;
-
- void (*ic_attach_hook) __P((struct device *, struct device *,
- struct isabus_attach_args *));
- void *(*ic_intr_establish) __P((isa_chipset_tag_t, int, int, int,
- int (*)(void *), void *, char *));
- void (*ic_intr_disestablish) __P((isa_chipset_tag_t, void *));
-};
-
-
-/*
- * Functions provided to machine-independent ISA code.
- */
-#define isa_attach_hook(p, s, a) /* \
- (*(a)->iba_ic->ic_attach_hook)((p), (s), (a)) */
-#define isa_intr_establish(c, i, t, l, f, a, w) \
- (*(c)->ic_intr_establish)((c)->ic_data, (i), (t), (l), (f), (a), (w))
-#define isa_intr_disestablish(c, h) \
- (*(c)->ic_intr_disestablish)((c)->ic_data, (h))
-
-#define __NO_ISA_INTR_CHECK /* FIXME */
-
-void sysbeepstop __P((void *));
-void sysbeep __P((int, int));
-
-
-/*
- * Interrupt control struct used to control the ICU setup.
- */
-
-struct intrhand {
- struct intrhand *ih_next;
- int (*ih_fun) __P((void *));
- void *ih_arg;
- u_long ih_count;
- int ih_level;
- int ih_irq;
- char *ih_what;
-};
-
-#endif /* _ISA_MACHDEP_H_ */
diff --git a/sys/arch/arc/isa/isabus.c b/sys/arch/arc/isa/isabus.c
deleted file mode 100644
index 8486aa5ef58..00000000000
--- a/sys/arch/arc/isa/isabus.c
+++ /dev/null
@@ -1,528 +0,0 @@
-/* $OpenBSD: isabus.c,v 1.15 1998/03/16 09:38:46 pefo Exp $ */
-/* $NetBSD: isa.c,v 1.33 1995/06/28 04:30:51 cgd Exp $ */
-
-/*-
- * Copyright (c) 1995 Per Fogelstrom
- * Copyright (c) 1993, 1994 Charles Hannum.
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz and Don Ahn.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)isa.c 7.2 (Berkeley) 5/12/91
- */
-/*
- * Mach Operating System
- * Copyright (c) 1991,1990,1989 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-/*
- Copyright 1988, 1989 by Intel Corporation, Santa Clara, California.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and
-its documentation for any purpose and without fee is hereby
-granted, provided that the above copyright notice appears in all
-copies and that both the copyright notice and this permission notice
-appear in supporting documentation, and that the name of Intel
-not be used in advertising or publicity pertaining to distribution
-of the software without specific, written prior permission.
-
-INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
-IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
-CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
-NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
-WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/systm.h>
-#include <sys/time.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-
-#include <machine/pte.h>
-#include <machine/cpu.h>
-#include <machine/pio.h>
-#include <machine/autoconf.h>
-#include <machine/intr.h>
-
-#include <mips/archtype.h>
-#include <arc/pica/pica.h>
-
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
-#include <arc/isa/timerreg.h>
-#include <arc/isa/spkrreg.h>
-#include <arc/isa/isa_machdep.h>
-
-static int beeping;
-
-#define IRQ_SLAVE 2
-#define ICU_LEN 16
-
-struct isabr_softc {
- struct device sc_dv;
- struct arc_isa_bus arc_isa_cs;
- struct abus sc_bus;
-};
-
-/* Definition of the driver for autoconfig. */
-int isabrmatch(struct device *, void *, void *);
-void isabrattach(struct device *, struct device *, void *);
-int isabrprint(void *, const char *);
-
-struct cfattach isabr_ca = {
- sizeof(struct isabr_softc), isabrmatch, isabrattach
-};
-struct cfdriver isabr_cd = {
- NULL, "isabr", DV_DULL, NULL, 0
-};
-
-void *isabr_intr_establish __P((isa_chipset_tag_t, int, int, int,
- int (*)(void *), void *, char *));
-void isabr_intr_disestablish __P((isa_chipset_tag_t, void*));
-int isabr_iointr __P((unsigned int, struct clockframe *));
-void isabr_initicu __P((void));
-void intr_calculatemasks __P((void));
-int fakeintr __P((void *));
-
-int
-isabrmatch(parent, cfdata, aux)
- struct device *parent;
- void *cfdata;
- void *aux;
-{
- struct confargs *ca = aux;
-
- /* Make sure that we're looking for a ISABR. */
- if (strcmp(ca->ca_name, isabr_cd.cd_name) != 0)
- return (0);
-
- return (1);
-}
-
-void
-isabrattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct isabr_softc *sc = (struct isabr_softc *)self;
- struct isabus_attach_args iba;
-
- printf("\n");
-
- /* Initialize interrupt controller */
- isabr_initicu();
-
- /* set up interrupt handlers */
- switch(system_type) {
- case ACER_PICA_61:
- case MAGNUM:
- set_intr(INT_MASK_2, isabr_iointr, 3);
- break;
- case DESKSTATION_TYNE:
- set_intr(INT_MASK_2, isabr_iointr, 2);
- break;
- case DESKSTATION_RPC44:
- set_intr(INT_MASK_2, isabr_iointr, 2);
- break;
- default:
- panic("isabrattach: unkown system_type!");
- }
-
-/*XXX we may remove the abus part of the softc struct... */
- sc->sc_bus.ab_dv = (struct device *)sc;
- sc->sc_bus.ab_type = BUS_ISABR;
-
- sc->arc_isa_cs.ic_intr_establish = isabr_intr_establish;
- sc->arc_isa_cs.ic_intr_disestablish = isabr_intr_disestablish;
-
- iba.iba_busname = "isa";
- iba.iba_iot = (bus_space_tag_t)&arc_bus_io;
- iba.iba_memt = (bus_space_tag_t)&arc_bus_mem;
- iba.iba_ic = &sc->arc_isa_cs;
- config_found(self, &iba, isabrprint);
-}
-
-int
-isabrprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
- struct confargs *ca = aux;
-
- if (pnp)
- printf("%s at %s", ca->ca_name, pnp);
- printf(" isa_io_base 0x%lx isa_mem_base 0x%lx",
- arc_bus_io.bus_base, arc_bus_mem.bus_base);
- return (UNCONF);
-}
-
-
-/*
- * Interrupt system driver code
- * ============================
- */
-#define LEGAL_IRQ(x) ((x) >= 0 && (x) < ICU_LEN && (x) != 2)
-
-int imen;
-int intrtype[ICU_LEN], intrmask[ICU_LEN], intrlevel[ICU_LEN];
-struct intrhand *intrhand[ICU_LEN];
-
-int fakeintr(void *a) {return 0;}
-
-/*
- * Recalculate the interrupt masks from scratch.
- * We could code special registry and deregistry versions of this function that
- * would be faster, but the code would be nastier, and we don't expect this to
- * happen very much anyway.
- */
-void
-intr_calculatemasks()
-{
- int irq, level;
- struct intrhand *q;
-
- /* First, figure out which levels each IRQ uses. */
- for (irq = 0; irq < ICU_LEN; irq++) {
- register int levels = 0;
- for (q = intrhand[irq]; q; q = q->ih_next)
- levels |= 1 << q->ih_level;
- intrlevel[irq] = levels;
- }
-
- /* Then figure out which IRQs use each level. */
- for (level = 0; level < 5; level++) {
- register int irqs = 0;
- for (irq = 0; irq < ICU_LEN; irq++)
- if (intrlevel[irq] & (1 << level))
- irqs |= 1 << irq;
- imask[level] = irqs | SIR_ALLMASK;
- }
-
- /*
- * There are tty, network and disk drivers that use free() at interrupt
- * time, so imp > (tty | net | bio).
- */
- imask[IPL_IMP] |= imask[IPL_TTY] | imask[IPL_NET] | imask[IPL_BIO];
-
- /*
- * Enforce a hierarchy that gives slow devices a better chance at not
- * dropping data.
- */
- imask[IPL_TTY] |= imask[IPL_NET] | imask[IPL_BIO];
- imask[IPL_NET] |= imask[IPL_BIO];
-
- /*
- * These are pseudo-levels.
- */
- imask[IPL_NONE] = 0x00000000;
- imask[IPL_HIGH] = 0xffffffff;
-
- /* And eventually calculate the complete masks. */
- for (irq = 0; irq < ICU_LEN; irq++) {
- register int irqs = 1 << irq;
- for (q = intrhand[irq]; q; q = q->ih_next)
- irqs |= imask[q->ih_level];
- intrmask[irq] = irqs | SIR_ALLMASK;
- }
-
- /* Lastly, determine which IRQs are actually in use. */
- {
- register int irqs = 0;
- for (irq = 0; irq < ICU_LEN; irq++)
- if (intrhand[irq])
- irqs |= 1 << irq;
- if (irqs >= 0x100) /* any IRQs >= 8 in use */
- irqs |= 1 << IRQ_SLAVE;
- imen = ~irqs;
- isa_outb(IO_ICU1 + 1, imen);
- isa_outb(IO_ICU2 + 1, imen >> 8);
- }
-}
-
-/*
- * Establish a ISA bus interrupt.
- */
-void *
-isabr_intr_establish(ic, irq, type, level, ih_fun, ih_arg, ih_what)
- isa_chipset_tag_t ic;
- int irq;
- int type;
- int level;
- int (*ih_fun) __P((void *));
- void *ih_arg;
- char *ih_what;
-{
- struct intrhand **p, *q, *ih;
- static struct intrhand fakehand = {NULL, fakeintr};
- extern int cold;
-
- /* no point in sleeping unless someone can free memory. */
- ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK);
- if (ih == NULL)
- panic("isa_intr_establish: can't malloc handler info");
-
- if (!LEGAL_IRQ(irq) || type == IST_NONE)
- panic("intr_establish: bogus irq or type");
-
- switch (intrtype[irq]) {
- case IST_EDGE:
- case IST_LEVEL:
- if (type == intrtype[irq])
- break;
- case IST_PULSE:
- if (type != IST_NONE)
- panic("intr_establish: can't share %s with %s",
- isa_intr_typename(intrtype[irq]),
- isa_intr_typename(type));
- break;
- }
-
- /*
- * Figure out where to put the handler.
- * This is O(N^2), but we want to preserve the order, and N is
- * generally small.
- */
- for (p = &intrhand[irq]; (q = *p) != NULL; p = &q->ih_next)
- ;
-
- /*
- * Actually install a fake handler momentarily, since we might be doing
- * this with interrupts enabled and don't want the real routine called
- * until masking is set up.
- */
- fakehand.ih_level = level;
- *p = &fakehand;
-
- intr_calculatemasks();
-
- /*
- * Poke the real handler in now.
- */
- ih->ih_fun = ih_fun;
- ih->ih_arg = ih_arg;
- ih->ih_count = 0;
- ih->ih_next = NULL;
- ih->ih_level = level;
- ih->ih_irq = irq;
- ih->ih_what = ih_what;
- *p = ih;
-
- return (ih);
-}
-
-void
-isabr_intr_disestablish(ic, arg)
- isa_chipset_tag_t ic;
- void *arg;
-{
-
-}
-
-/*
- * Process an interrupt from the ISA bus.
- */
-int
-isabr_iointr(mask, cf)
- unsigned mask;
- struct clockframe *cf;
-{
- struct intrhand *ih;
- int isa_vector;
- int o_imen;
- char vector;
-
- switch(system_type) {
- case ACER_PICA_61:
- case MAGNUM:
- isa_vector = in32(R4030_SYS_ISA_VECTOR) & (ICU_LEN - 1);
- break;
-
- case DESKSTATION_TYNE:
- isa_outb(IO_ICU1, 0x0f); /* Poll */
- vector = isa_inb(IO_ICU1);
- if(vector > 0 || (isa_vector = vector & 7) == 2) {
- isa_outb(IO_ICU2, 0x0f);
- vector = isa_inb(IO_ICU2);
- if(vector > 0) {
- printf("isa: spurious interrupt.\n");
- return(~0);
- }
- isa_vector = (vector & 7) | 8;
- }
- break;
-
- case DESKSTATION_RPC44:
- isa_outb(IO_ICU1, 0x0f); /* Poll */
- vector = isa_inb(IO_ICU1);
- if(vector > 0 || (isa_vector = vector & 7) == 2) {
- isa_outb(IO_ICU2, 0x0f);
- vector = isa_inb(IO_ICU2);
- if(vector > 0) {
- printf("isa: spurious interrupt.\n");
- return(~0);
- }
- isa_vector = (vector & 7) | 8;
- }
- break;
- }
-
- o_imen = imen;
- imen |= 1 << (isa_vector & (ICU_LEN - 1));
- if(isa_vector & 0x08) {
- isa_inb(IO_ICU2 + 1);
- isa_outb(IO_ICU2 + 1, imen >> 8);
- isa_outb(IO_ICU2, 0x60 + (isa_vector & 7));
- isa_outb(IO_ICU1, 0x60 + IRQ_SLAVE);
- }
- else {
- isa_inb(IO_ICU1 + 1);
- isa_outb(IO_ICU1 + 1, imen);
- isa_outb(IO_ICU1, 0x60 + isa_vector);
- }
- ih = intrhand[isa_vector];
- if(isa_vector == 0) { /* Clock */ /*XXX*/
- (*ih->ih_fun)(cf);
- ih = ih->ih_next;
- }
- while(ih) {
- (*ih->ih_fun)(ih->ih_arg);
- ih = ih->ih_next;
- }
- imen = o_imen;
- isa_inb(IO_ICU1 + 1);
- isa_inb(IO_ICU2 + 1);
- isa_outb(IO_ICU1 + 1, imen);
- isa_outb(IO_ICU2 + 1, imen >> 8);
-
- return(~0); /* Dont reenable */
-}
-
-
-/*
- * Initialize the Interrupt controller logic.
- */
-void
-isabr_initicu()
-{
-
- isa_outb(IO_ICU1, 0x11); /* reset; program device, four bytes */
- isa_outb(IO_ICU1+1, 0); /* starting at this vector index */
- isa_outb(IO_ICU1+1, 1 << IRQ_SLAVE); /* slave on line 2 */
- isa_outb(IO_ICU1+1, 1); /* 8086 mode */
- isa_outb(IO_ICU1+1, 0xff); /* leave interrupts masked */
- isa_outb(IO_ICU1, 0x68); /* special mask mode (if available) */
- isa_outb(IO_ICU1, 0x0a); /* Read IRR by default. */
-#ifdef REORDER_IRQ
- isa_outb(IO_ICU1, 0xc0 | (3 - 1)); /* pri order 3-7, 0-2 (com2 first) */
-#endif
-
- isa_outb(IO_ICU2, 0x11); /* reset; program device, four bytes */
- isa_outb(IO_ICU2+1, 8); /* staring at this vector index */
- isa_outb(IO_ICU2+1, IRQ_SLAVE);
- isa_outb(IO_ICU2+1, 1); /* 8086 mode */
- isa_outb(IO_ICU2+1, 0xff); /* leave interrupts masked */
- isa_outb(IO_ICU2, 0x68); /* special mask mode (if available) */
- isa_outb(IO_ICU2, 0x0a); /* Read IRR by default. */
-}
-
-
-/*
- * SPEAKER BEEPER...
- */
-void
-sysbeepstop(arg)
- void *arg;
-{
- int s;
-
- /* disable counter 2 */
- s = splhigh();
- isa_outb(PITAUX_PORT, isa_inb(PITAUX_PORT) & ~PIT_SPKR);
- splx(s);
- beeping = 0;
-}
-
-void
-sysbeep(pitch, period)
- int pitch, period;
-{
- static int last_pitch, last_period;
- int s;
- extern int cold;
-
- if (cold)
- return; /* Can't beep yet. */
-
- if (beeping)
- untimeout(sysbeepstop, 0);
- if (!beeping || last_pitch != pitch) {
- s = splhigh();
- isa_outb(TIMER_MODE, TIMER_SEL2 | TIMER_16BIT | TIMER_SQWAVE);
- isa_outb(TIMER_CNTR2, TIMER_DIV(pitch) % 256);
- isa_outb(TIMER_CNTR2, TIMER_DIV(pitch) / 256);
- isa_outb(PITAUX_PORT, isa_inb(PITAUX_PORT) | PIT_SPKR);
- splx(s);
- }
- last_pitch = pitch;
- beeping = last_period = period;
- timeout(sysbeepstop, 0, period);
-}
diff --git a/sys/arch/arc/isa/isadma.c b/sys/arch/arc/isa/isadma.c
deleted file mode 100644
index b44840270f8..00000000000
--- a/sys/arch/arc/isa/isadma.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/* $OpenBSD: isadma.c,v 1.2 1996/11/23 21:45:34 kstailey Exp $ */
-/* $NetBSD: isadma.c,v 1.19 1996/04/29 20:03:26 christos Exp $ */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/file.h>
-#include <sys/buf.h>
-#include <sys/syslog.h>
-#include <sys/malloc.h>
-#include <sys/uio.h>
-
-#include <vm/vm.h>
-
-#include <machine/pio.h>
-
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
-#include <dev/isa/isadmavar.h>
-#include <arch/arc/isa/isadmareg.h> /*XXX*/
-
-struct dma_info {
- int flags;
- int active;
- caddr_t addr;
- vm_size_t nbytes;
- struct isadma_seg phys[1];
-};
-
-static struct isadma_softc *isadma_sc; /*XXX ugly */
-static struct dma_info dma_info[8];
-static u_int8_t dma_finished;
-
-/* high byte of address is stored in this port for i-th dma channel */
-static int dmapageport[2][4] = {
- {0x87, 0x83, 0x81, 0x82},
- {0x8f, 0x8b, 0x89, 0x8a}
-};
-
-static u_int8_t dmamode[4] = {
- DMA37MD_READ | DMA37MD_SINGLE,
- DMA37MD_WRITE | DMA37MD_SINGLE,
- DMA37MD_READ | DMA37MD_LOOP,
- DMA37MD_WRITE | DMA37MD_LOOP
-};
-
-int isadmamatch __P((struct device *, void *, void *));
-void isadmaattach __P((struct device *, struct device *, void *));
-int isadmaprint __P((void *, const char *));
-
-struct isadma_softc {
- struct device sc_dev;
- bus_chipset_tag_t sc_bc;
- bus_io_handle_t sc_ioh1;
- bus_io_handle_t sc_ioh2;
-}
-
-struct cfattach isadma_ca = {
- sizeof(struct isadma_softc), isadmamatch, isadmaattach
-};
-
-struct cfdriver isadma_cd = {
- NULL, "isadma", DV_DULL, 1
-};
-
-isadmamatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct isa_attach_args *ia = aux;
-
- /* Sure we exist */
- ia->ia_iosize = 0;
- return (1);
-}
-
-void
-isadmaattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct isadma_softc *sc = (void *)self;
- struct isa_attach_args *ia = aux;
- bus_chipset_tag_t bc;
- bus_io_handle_t ioh;
-
- printf("\n");
-
- bc = sc->sc_bc = ia->ia_bc;
- if (bus_io_map(bc, IO_DMA1, DMA_NREGS, &ioh))
- panic("isadmaattach: couldn't map I/O ports");
- sc->sc_ioh1 = ioh;
- if (bus_io_map(bc, IO_DMA2, DMA_NREGS*2, &ioh))
- panic("isadmaattach: couldn't map I/O ports");
- sc->sc_ioh2 = ioh;
- isadma_sc = sc;
-}
-
-/*
- * isadma_cascade(): program 8237 DMA controller channel to accept
- * external dma control by a board.
- */
-void
-isadma_cascade(chan)
- int chan;
-{
- struct isadma_softc *sc = isadma_sc;
- bus_chipset_tag_t bc = sc->sc_bc;
-
-#ifdef ISADMA_DEBUG
- if (chan < 0 || chan > 7)
- panic("isadma_cascade: impossible request");
-#endif
-
- /* set dma channel mode, and set dma channel mode */
- if ((chan & 4) == 0) {
- bus_io_write_1(bc, sc->sc_ioh1, DMA1_MODE, chan | DMA37MD_CASCADE);
- bus_io_write_1(bc, sc->sc_ioh1, DMA1_SMSK, chan);
- } else {
- chan &= 3;
-
- bus_io_write_1(bc, sc->sc_ioh2, DMA2_MODE, chan | DMA37MD_CASCADE);
- bus_io_write_1(bc, sc->sc_ioh2, DMA2_SMSK, chan);
- }
-}
-
-/*
- * isadma_start(): program 8237 DMA controller channel, avoid page alignment
- * problems by using a bounce buffer.
- */
-void
-isadma_start(addr, nbytes, chan, flags)
- caddr_t addr;
- vm_size_t nbytes;
- int chan;
- int flags;
-{
- struct dma_info *di;
- int waport;
- int mflags;
- vm_size_t size;
- struct isadma_softc *sc = isadma_sc;
- bus_chipset_tag_t bc = sc->sc_bc;
- bus_io_handle_t ioh;
-
-#ifdef ISADMA_DEBUG
- if (chan < 0 || chan > 7 ||
- (((flags & DMAMODE_READ) != 0) + ((flags & DMAMODE_WRITE) != 0) +
- ((flags & DMAMODE_LOOP) != 0) != 1) ||
- ((chan & 4) ? (nbytes >= (1<<17) || nbytes & 1 || (u_int)addr & 1) :
- (nbytes >= (1<<16))))
- panic("isadma_start: impossible request");
-#endif
-
- di = dma_info+chan;
- if (di->active) {
- log(LOG_ERR,"isadma_start: old request active on %d\n",chan);
- isadma_abort(chan);
- }
-
- di->flags = flags;
- di->active = 1;
- di->addr = addr;
- di->nbytes = nbytes;
-
- mflags = ISADMA_MAP_WAITOK | ISADMA_MAP_BOUNCE | ISADMA_MAP_CONTIG;
- mflags |= (chan & 4) ? ISADMA_MAP_16BIT : ISADMA_MAP_8BIT;
-
- if (isadma_map(addr, nbytes, di->phys, mflags) != 1)
- panic("isadma_start: cannot map");
-
- /* XXX Will this do what we want with DMAMODE_LOOP? */
- if ((flags & DMAMODE_READ) == 0)
- isadma_copytobuf(addr, nbytes, 1, di->phys);
-
- dma_finished &= ~(1 << chan);
-
- if ((chan & 4) == 0) {
- ioh = sc->sc_ioh1;
- /*
- * Program one of DMA channels 0..3. These are
- * byte mode channels.
- */
- /* set dma channel mode, and reset address ff */
- bus_io_write_1(bc, ioh, DMA1_MODE, chan | dmamode[flags]);
- bus_io_write_1(bc, ioh, DMA1_FFC, 0);
-
- /* send start address */
- waport = DMA1_CHN(chan);
- outb(dmapageport[0][chan], di->phys[0].addr>>16);
- outb(waport, di->phys[0].addr);
- outb(waport, di->phys[0].addr>>8);
-
- /* send count */
- outb(waport + 1, --nbytes);
- outb(waport + 1, nbytes>>8);
-
- /* unmask channel */
- bus_io_write_1(bc, ioh, DMA1_SMSK, chan | DMA37SM_CLEAR);
- } else {
- ioh = sc->sc_ioh2;
- /*
- * Program one of DMA channels 4..7. These are
- * word mode channels.
- */
- /* set dma channel mode, and reset address ff */
- bus_io_write_1(bc, ioh, DMA2_MODE, (chan & 3) | dmamode[flags]);
- bus_io_write_1(bc, ioh, DMA2_FFC, 0);
-
- /* send start address */
- waport = DMA2_CHN(chan & 3);
- outb(dmapageport[1][chan], di->phys[0].addr>>16);
- outb(waport, di->phys[0].addr>>1);
- outb(waport, di->phys[0].addr>>9);
-
- /* send count */
- nbytes >>= 1;
- outb(waport + 2, --nbytes);
- outb(waport + 2, nbytes>>8);
-
- /* unmask channel */
- bus_io_write_1(bc, ioh, DMA2_SMSK, (chan & 3) | DMA37SM_CLEAR);
- }
-}
-
-void
-isadma_abort(chan)
- int chan;
-{
- struct dma_info *di;
- struct isadma_softc *sc = isadma_sc;
- bus_chipset_tag_t bc = sc->sc_bc;
-
-#ifdef ISADMA_DEBUG
- if (chan < 0 || chan > 7)
- panic("isadma_abort: impossible request");
-#endif
-
- di = dma_info+chan;
- if (! di->active) {
- log(LOG_ERR,"isadma_abort: no request active on %d\n",chan);
- return;
- }
-
- /* mask channel */
- if ((chan & 4) == 0)
- bus_io_write_1(bc, sc->sc_ioh1, DMA1_SMSK, DMA37SM_SET | chan);
- else
- bus_io_write_1(bc, sc->sc_ioh2, DMA2_SMSK, DMA37SM_SET | (chan & 3));
-
- isadma_unmap(di->addr, di->nbytes, 1, di->phys);
- di->active = 0;
-}
-
-int
-isadma_finished(chan)
- int chan;
-{
- struct isadma_softc *sc = isadma_sc;
- bus_chipset_tag_t bc = sc->sc_bc;
-
-#ifdef ISADMA_DEBUG
- if (chan < 0 || chan > 7)
- panic("isadma_finished: impossible request");
-#endif
-
- /* check that the terminal count was reached */
- if ((chan & 4) == 0)
- dma_finished |= bus_io_read_1(bc, sc->sc_ioh1, DMA1_SR) & 0x0f;
- else
- dma_finished |= (bus_io_read_1(bc, sc->sc_ioh2, DMA2_SR) & 0x0f) << 4;
-
- return ((dma_finished & (1 << chan)) != 0);
-}
-
-void
-isadma_done(chan)
- int chan;
-{
- struct dma_info *di;
- u_char tc;
- struct isadma_softc *sc = isadma_sc;
- bus_chipset_tag_t bc = sc->sc_bc;
-
-#ifdef DIAGNOSTIC
- if (chan < 0 || chan > 7)
- panic("isadma_done: impossible request");
-#endif
-
- di = dma_info+chan;
- if (! di->active) {
- log(LOG_ERR,"isadma_done: no request active on %d\n",chan);
- return;
- }
-
- /* check that the terminal count was reached */
- if ((chan & 4) == 0)
- tc = bus_io_read_1(bc, sc->sc_ioh1, DMA1_SR) & (1 << chan);
- else
- tc = bus_io_read_1(bc, sc->sc_ioh2, DMA2_SR) & (1 << (chan & 3));
- if (tc == 0)
- /* XXX probably should panic or something */
- log(LOG_ERR, "dma channel %d not finished\n", chan);
-
- /* mask channel */
- if ((chan & 4) == 0)
- bus_io_write_1(bc, sc->sc_ioh1, DMA1_SMSK, DMA37SM_SET | chan);
- else
- bus_io_write_1(bc, sc->sc_ioh2, DMA2_SMSK, DMA37SM_SET | (chan & 3));
-
- /* XXX Will this do what we want with DMAMODE_LOOP? */
- if (di->flags & DMAMODE_READ)
- isadma_copyfrombuf(di->addr, di->nbytes, 1, di->phys);
-
- isadma_unmap(di->addr, di->nbytes, 1, di->phys);
- di->active = 0;
-}
diff --git a/sys/arch/arc/isa/isadmareg.h b/sys/arch/arc/isa/isadmareg.h
deleted file mode 100644
index 185016060f2..00000000000
--- a/sys/arch/arc/isa/isadmareg.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* $NetBSD: isadmareg.h,v 1.4 1995/06/28 04:31:48 cgd Exp $ */
-
-#include <dev/ic/i8237reg.h>
-
-#define DMA_NREG 16
-/*
- * Register definitions for DMA controller 1 (channels 0..3):
- */
-#define DMA1_CHN(c) (1*(2*(c))) /* addr reg for channel c */
-#define DMA1_SR (1*8) /* status register */
-#define DMA1_SMSK (1*10) /* single mask register */
-#define DMA1_MODE (1*11) /* mode register */
-#define DMA1_FFC (1*12) /* clear first/last FF */
-
-/*
- * Register definitions for DMA controller 2 (channels 4..7):
- */
-#define DMA2_CHN(c) (2*(2*(c))) /* addr reg for channel c */
-#define DMA2_SR (2*8) /* status register */
-#define DMA2_SMSK (2*10) /* single mask register */
-#define DMA2_MODE (2*11) /* mode register */
-#define DMA2_FFC (2*12) /* clear first/last FF */
diff --git a/sys/arch/arc/isa/isapnp_machdep.c b/sys/arch/arc/isa/isapnp_machdep.c
deleted file mode 100644
index cf4e1fec867..00000000000
--- a/sys/arch/arc/isa/isapnp_machdep.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* $OpenBSD: isapnp_machdep.c,v 1.1 1997/12/27 12:13:11 niklas Exp $ */
-/* $NetBSD: isapnp_machdep.c,v 1.5 1997/10/04 17:32:30 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
- * NASA Ames Research Center.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1996 Christos Zoulas. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christos Zoulas.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Machine-dependent portions of ISA PnP bus autoconfiguration.
- *
- * N.B. This file exists mostly to get around some lameness surrounding
- * the PnP spec. ISA PnP registers live where some `normal' ISA
- * devices do, but are e.g. write-only registers where the normal
- * device has a read-only register. This breaks in the presence of
- * i/o port accounting. This file takes care of mapping ISA PnP
- * registers without actually allocating them in extent maps.
- *
- * Since this is a machine-dependent file, we make all sorts of
- * assumptions about bus.h's guts. Beware!
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-
-#include <machine/bus.h>
-
-#include <dev/isa/isapnpreg.h>
-
-#include <dev/isa/isavar.h>
-
-/* isapnp_map():
- * Map I/O regions used by PnP
- */
-int
-isapnp_map(sc)
- struct isapnp_softc *sc;
-{
- sc->sc_addr_ioh = sc->sc_iot->bus_base + ISAPNP_ADDR;
- sc->sc_wrdata_ioh = sc->sc_iot->bus_base + ISAPNP_WRDATA;
- return (0);
-}
-
-/* isapnp_unmap():
- * Unmap I/O regions used by PnP
- */
-void
-isapnp_unmap(sc)
- struct isapnp_softc *sc;
-{
- /* Do nothing. */
-}
-
-/* isapnp_map_readport():
- * Called to map the PnP `read port', which is mapped independently
- * of the `write' and `addr' ports.
- *
- * NOTE: assumes the caller has filled in sc->sc_read_port!
- */
-int
-isapnp_map_readport(sc)
- struct isapnp_softc *sc;
-{
-#ifdef _KERNEL
- int error;
-
- /* Check if some other device has already claimed this port. */
- if ((error = bus_space_map(sc->sc_iot, sc->sc_read_port, 1, 0,
- &sc->sc_read_ioh)) != 0)
- return error;
-
- /*
- * XXX: We unmap the port because it can and will be used by other
- * devices such as a joystick. We need a better port accounting
- * scheme with read and write ports.
- */
- bus_space_unmap(sc->sc_iot, sc->sc_read_ioh, 1);
-#endif
- return 0;
-}
-
-/* isapnp_unmap_readport():
- * Pretend to unmap a previously mapped `read port'.
- */
-void
-isapnp_unmap_readport(sc)
- struct isapnp_softc *sc;
-{
- /* Do nothing */
-}
diff --git a/sys/arch/arc/isa/isapnp_machdep.h b/sys/arch/arc/isa/isapnp_machdep.h
deleted file mode 100644
index 43ee6e17be0..00000000000
--- a/sys/arch/arc/isa/isapnp_machdep.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* $OpenBSD: isapnp_machdep.h,v 1.1 1997/12/27 12:13:12 niklas Exp $ */
-/* $NetBSD: isapnp_machdep.h,v 1.2 1997/10/04 17:32:32 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
- * NASA Ames Research Center.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1996 Christos Zoulas. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christos Zoulas.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Functions provided to machine-independent ISA PnP code.
- */
-int isapnp_map __P((struct isapnp_softc *));
-void isapnp_unmap __P((struct isapnp_softc *));
-int isapnp_map_readport __P((struct isapnp_softc *));
-void isapnp_unmap_readport __P((struct isapnp_softc *));
diff --git a/sys/arch/arc/isa/joy.c b/sys/arch/arc/isa/joy.c
deleted file mode 100644
index 6d42df3221c..00000000000
--- a/sys/arch/arc/isa/joy.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/* $NetBSD: joy.c,v 1.3 1996/05/05 19:46:15 christos Exp $ */
-
-/*-
- * Copyright (c) 1995 Jean-Marc Zucconi
- * All rights reserved.
- *
- * Ported to NetBSD by Matthieu Herrb <matthieu@laas.fr>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer
- * in this position and unchanged.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software withough specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-#include <sys/errno.h>
-
-#include <machine/cpu.h>
-#include <machine/pio.h>
-#include <machine/joystick.h>
-
-#include <dev/isa/isavar.h>
-#include <dev/isa/isareg.h>
-#include <arc/isa/timerreg.h>
-
-/*
- * The game port can manage 4 buttons and 4 variable resistors (usually 2
- * joysticks, each with 2 buttons and 2 pots.) via the port at address 0x201.
- * Getting the state of the buttons is done by reading the game port;
- * buttons 1-4 correspond to bits 4-7 and resistors 1-4 (X1, Y1, X2, Y2)
- * to bits 0-3. If button 1 (resp 2, 3, 4) is pressed, the bit 4 (resp 5,
- * 6, 7) is set to 0 to get the value of a resistor, write the value 0xff
- * at port and wait until the corresponding bit returns to 0.
- */
-
-/*
- * The formulae below only work if u is ``not too large''. See also
- * the discussion in microtime.s
- */
-#define USEC2TICKS(u) (((u) * 19549) >> 14)
-#define TICKS2USEC(u) (((u) * 3433) >> 12)
-
-
-#define JOYPART(d) (minor(d) & 1)
-#define JOYUNIT(d) minor(d) >> 1 & 3
-
-#ifndef JOY_TIMEOUT
-#define JOY_TIMEOUT 2000 /* 2 milliseconds */
-#endif
-
-#define JOY_NPORTS 1
-
-struct joy_softc {
- struct device sc_dev;
- int port;
- int x_off[2], y_off[2];
- int timeout[2];
-};
-
-int joyprobe __P((struct device *, void *, void *));
-int joyread __P((dev_t dev, struct uio *uio, int flag));
-int joyioctl __P((dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p));
-void joyattach __P((struct device *, struct device *, void *));
-int joyopen __P((dev_t, int, int, struct proc *));
-int joyclose __P((dev_t, int, int, struct proc *));
-static int get_tick __P((void));
-
-struct cfattach joy_ca = {
- sizeof(struct joy_softc), joyprobe, joyattach
-};
-
-struct cfdriver joy_cd = {
- NULL, "joy", DV_DULL
-};
-
-
-int
-joyprobe(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct isa_attach_args *ia = aux;
-#ifdef WANT_JOYSTICK_CONNECTED
- int iobase = ia->ia_iobase;
-
- isa_outb(iobase, 0xff);
- DELAY(10000); /* 10 ms delay */
- return (isa_inb(iobase) & 0x0f) != 0x0f;
-#else
- ia->ia_iosize = JOY_NPORTS;
- ia->ia_msize = 0;
- return 1;
-#endif
-}
-
-void
-joyattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct joy_softc *sc = (void *) self;
- struct isa_attach_args *ia = aux;
- int iobase = ia->ia_iobase;
-
- sc->port = iobase;
- sc->timeout[0] = sc->timeout[1] = 0;
- isa_outb(iobase, 0xff);
- DELAY(10000); /* 10 ms delay */
- printf(": joystick%sconnected\n",
- (isa_inb(iobase) & 0x0f) == 0x0f ? " not " : " ");
-}
-
-int
-joyopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- int unit = JOYUNIT(dev);
- int i = JOYPART(dev);
- struct joy_softc *sc;
-
- if (unit >= joy_cd.cd_ndevs)
- return (ENXIO);
-
- sc = joy_cd.cd_devs[unit];
-
- if (sc->timeout[i])
- return EBUSY;
-
- sc->x_off[i] = sc->y_off[i] = 0;
- sc->timeout[i] = JOY_TIMEOUT;
- return 0;
-}
-
-int
-joyclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- int unit = JOYUNIT(dev);
- int i = JOYPART(dev);
- struct joy_softc *sc = joy_cd.cd_devs[unit];
-
- sc->timeout[i] = 0;
- return 0;
-}
-
-int
-joyread(dev_t dev, struct uio *uio, int flag)
-{
- int unit = JOYUNIT(dev);
- struct joy_softc *sc = joy_cd.cd_devs[unit];
- struct joystick c;
- int port = sc->port;
- int i, t0, t1;
- int state = 0, x = 0, y = 0;
-
- /* disable_intr(); */ /* XXX BAD */
- isa_outb(port, 0xff);
- t0 = get_tick();
- t1 = t0;
- i = USEC2TICKS(sc->timeout[JOYPART(dev)]);
- while (t0 - t1 < i) {
- state = isa_inb(port);
- if (JOYPART(dev) == 1)
- state >>= 2;
- t1 = get_tick();
- if (t1 > t0)
- t1 -= TIMER_FREQ / hz;
- if (!x && !(state & 0x01))
- x = t1;
- if (!y && !(state & 0x02))
- y = t1;
- if (x && y)
- break;
- }
- /* enable_intr(); */ /* XXX BAD */
- c.x = x ? sc->x_off[JOYPART(dev)] + TICKS2USEC(t0 - x) : 0x80000000;
- c.y = y ? sc->y_off[JOYPART(dev)] + TICKS2USEC(t0 - y) : 0x80000000;
- state >>= 4;
- c.b1 = ~state & 1;
- c.b2 = ~(state >> 1) & 1;
- return uiomove((caddr_t) & c, sizeof(struct joystick), uio);
-}
-
-int
-joyioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
- int unit = JOYUNIT(dev);
- struct joy_softc *sc = joy_cd.cd_devs[unit];
- int i = JOYPART(dev);
- int x;
-
- switch (cmd) {
- case JOY_SETTIMEOUT:
- x = *(int *) data;
- if (x < 1 || x > 10000) /* 10ms maximum! */
- return EINVAL;
- sc->timeout[i] = x;
- break;
- case JOY_GETTIMEOUT:
- *(int *) data = sc->timeout[i];
- break;
- case JOY_SET_X_OFFSET:
- sc->x_off[i] = *(int *) data;
- break;
- case JOY_SET_Y_OFFSET:
- sc->y_off[i] = *(int *) data;
- break;
- case JOY_GET_X_OFFSET:
- *(int *) data = sc->x_off[i];
- break;
- case JOY_GET_Y_OFFSET:
- *(int *) data = sc->y_off[i];
- break;
- default:
- return ENXIO;
- }
- return 0;
-}
-
-static int
-get_tick()
-{
- int low, high;
-
- isa_outb(TIMER_MODE, TIMER_SEL0);
- low = isa_inb(TIMER_CNTR0);
- high = isa_inb(TIMER_CNTR0);
-
- return (high << 8) | low;
-}
diff --git a/sys/arch/arc/isa/spkrreg.h b/sys/arch/arc/isa/spkrreg.h
deleted file mode 100644
index af1df50e2ad..00000000000
--- a/sys/arch/arc/isa/spkrreg.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/* $NetBSD: spkrreg.h,v 1.2 1994/10/27 04:18:16 cgd Exp $ */
-
-/*
- * PIT port addresses and speaker control values
- */
-
-#define PITAUX_PORT 0x61 /* port of Programmable Peripheral Interface */
-#define PIT_ENABLETMR2 0x01 /* Enable timer/counter 2 */
-#define PIT_SPKRDATA 0x02 /* Direct to speaker */
-
-#define PIT_SPKR (PIT_ENABLETMR2|PIT_SPKRDATA)
diff --git a/sys/arch/arc/isa/timerreg.h b/sys/arch/arc/isa/timerreg.h
deleted file mode 100644
index 996834cadca..00000000000
--- a/sys/arch/arc/isa/timerreg.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* $NetBSD: timerreg.h,v 1.4 1994/10/27 04:18:17 cgd Exp $ */
-
-/*-
- * Copyright (c) 1993 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Register definitions for the Intel 8253 Programmable Interval Timer.
- *
- * This chip has three independent 16-bit down counters that can be
- * read on the fly. There are three mode registers and three countdown
- * registers. The countdown registers are addressed directly, via the
- * first three I/O ports. The three mode registers are accessed via
- * the fourth I/O port, with two bits in the mode byte indicating the
- * register. (Why are hardware interfaces always so braindead?).
- *
- * To write a value into the countdown register, the mode register
- * is first programmed with a command indicating the which byte of
- * the two byte register is to be modified. The three possibilities
- * are load msb (TMR_MR_MSB), load lsb (TMR_MR_LSB), or load lsb then
- * msb (TMR_MR_BOTH).
- *
- * To read the current value ("on the fly") from the countdown register,
- * you write a "latch" command into the mode register, then read the stable
- * value from the corresponding I/O port. For example, you write
- * TMR_MR_LATCH into the corresponding mode register. Presumably,
- * after doing this, a write operation to the I/O port would result
- * in undefined behavior (but hopefully not fry the chip).
- * Reading in this manner has no side effects.
- *
- * The outputs of the three timers are connected as follows:
- *
- * timer 0 -> irq 0
- * timer 1 -> dma chan 0 (for dram refresh)
- * timer 2 -> speaker (via keyboard controller)
- *
- * Timer 0 is used to call hardclock.
- * Timer 2 is used to generate console beeps.
- */
-
-/*
- * Frequency of all three count-down timers; (TIMER_FREQ/freq) is the
- * appropriate count to generate a frequency of freq hz.
- */
-#ifndef TIMER_FREQ
-#define TIMER_FREQ 1193182
-#endif
-#define TIMER_DIV(x) ((TIMER_FREQ+(x)/2)/(x))
-
-/*
- * Macros for specifying values to be written into a mode register.
- */
-#define TIMER_CNTR0 (IO_TIMER1 + 0) /* timer 0 counter port */
-#define TIMER_CNTR1 (IO_TIMER1 + 1) /* timer 1 counter port */
-#define TIMER_CNTR2 (IO_TIMER1 + 2) /* timer 2 counter port */
-#define TIMER_MODE (IO_TIMER1 + 3) /* timer mode port */
-#define TIMER_SEL0 0x00 /* select counter 0 */
-#define TIMER_SEL1 0x40 /* select counter 1 */
-#define TIMER_SEL2 0x80 /* select counter 2 */
-#define TIMER_INTTC 0x00 /* mode 0, intr on terminal cnt */
-#define TIMER_ONESHOT 0x02 /* mode 1, one shot */
-#define TIMER_RATEGEN 0x04 /* mode 2, rate generator */
-#define TIMER_SQWAVE 0x06 /* mode 3, square wave */
-#define TIMER_SWSTROBE 0x08 /* mode 4, s/w triggered strobe */
-#define TIMER_HWSTROBE 0x0a /* mode 5, h/w triggered strobe */
-#define TIMER_LATCH 0x00 /* latch counter for reading */
-#define TIMER_LSB 0x10 /* r/w counter LSB */
-#define TIMER_MSB 0x20 /* r/w counter MSB */
-#define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */
-#define TIMER_BCD 0x01 /* count in BCD */
-
diff --git a/sys/arch/arc/pci/pbcpcibus.c b/sys/arch/arc/pci/pbcpcibus.c
deleted file mode 100644
index e98e22bdcb6..00000000000
--- a/sys/arch/arc/pci/pbcpcibus.c
+++ /dev/null
@@ -1,534 +0,0 @@
-/* $OpenBSD: pbcpcibus.c,v 1.7 1998/03/25 11:52:48 pefo Exp $ */
-
-/*
- * Copyright (c) 1997, 1998 Per Fogelstrom, Opsycon AB
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom, Opsycon AB.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-/*
- * ARC PCI BUS Bridge driver.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-#include <sys/proc.h>
-#include <vm/vm.h>
-
-#include <machine/autoconf.h>
-#include <machine/pte.h>
-#include <machine/cpu.h>
-
-#include <dev/pci/pcireg.h>
-#include <dev/pci/pcivar.h>
-
-#include <mips/archtype.h>
-#include <arc/algor/algor.h>
-#include <arc/pci/pcibrvar.h>
-#include <arc/pci/v962pcbreg.h>
-
-extern vm_map_t phys_map;
-extern char eth_hw_addr[]; /* Hardware ethernet address stored elsewhere */
-
-int pbcpcibrmatch __P((struct device *, void *, void *));
-void pbcpcibrattach __P((struct device *, struct device *, void *));
-
-void pbc_attach_hook __P((struct device *, struct device *,
- struct pcibus_attach_args *));
-int pbc_bus_maxdevs __P((void *, int));
-pcitag_t pbc_make_tag __P((void *, int, int, int));
-void pbc_decompose_tag __P((void *, pcitag_t, int *, int *, int *));
-pcireg_t pbc_conf_read __P((void *, pcitag_t, int));
-void pbc_conf_write __P((void *, pcitag_t, int, pcireg_t));
-
-int pbc_intr_map __P((void *, pcitag_t, int, int, pci_intr_handle_t *));
-const char *pbc_intr_string __P((void *, pci_intr_handle_t));
-void *pbc_intr_establish __P((void *, pci_intr_handle_t,
- int, int (*func)(void *), void *, char *));
-void pbc_intr_disestablish __P((void *, void *));
-int pbc_ether_hw_addr __P((u_int8_t *));
-
-struct cfattach pbcpcibr_ca = {
- sizeof(struct pcibr_softc), pbcpcibrmatch, pbcpcibrattach,
-};
-
-struct cfdriver pbcpcibr_cd = {
- NULL, "pbcpcibr", DV_DULL,
-};
-
-/*
- * Code from "pci/if_de.c" used to calculate crc32 of ether rom data.
- * Another example can be found in document EC-QPQWA-TE from DEC.
- */
-#define TULIP_CRC32_POLY 0xEDB88320UL
-static __inline__ unsigned
-srom_crc32(
- const unsigned char *databuf,
- size_t datalen)
-{
- u_int idx, bit, data, crc = 0xFFFFFFFFUL;
-
- for (idx = 0; idx < datalen; idx++)
- for (data = *databuf++, bit = 0; bit < 8; bit++, data >>= 1)
- crc = (crc >> 1) ^ (((crc ^ data) & 1) ? TULIP_CRC32_POLY : 0);
- return crc;
-}
-static int pbcpcibrprint __P((void *, const char *pnp));
-
-struct pcibr_config pbc_config;
-static int pbc_version;
-
-int
-pbcpcibrmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct confargs *ca = aux;
-
- /* Make sure that we're looking for a PCI bridge. */
- if (strcmp(ca->ca_name, pbcpcibr_cd.cd_name) != 0)
- return (0);
-
- return (1);
-}
-
-void
-pbcpcibrattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct pcibr_softc *sc = (struct pcibr_softc *)self;
- struct pcibr_config *lcp;
- struct pcibus_attach_args pba;
-
- switch(system_type) {
- case ALGOR_P4032:
- case ALGOR_P5064:
- V96X_PCI_BASE0 = V96X_PCI_BASE0 & 0xffff0000;
-
- lcp = sc->sc_pcibr = &pbc_config;
-
- sc->sc_bus_space.bus_base = V96X_PCI_MEM_SPACE;
- sc->sc_bus_space.bus_sparse1 = 0;
- sc->sc_bus_space.bus_sparse2 = 0;
- sc->sc_bus_space.bus_sparse4 = 0;
- sc->sc_bus_space.bus_sparse8 = 0;
-
- lcp->lc_pc.pc_conf_v = lcp;
- lcp->lc_pc.pc_attach_hook = pbc_attach_hook;
- lcp->lc_pc.pc_bus_maxdevs = pbc_bus_maxdevs;
- lcp->lc_pc.pc_make_tag = pbc_make_tag;
- lcp->lc_pc.pc_decompose_tag = pbc_decompose_tag;
- lcp->lc_pc.pc_conf_read = pbc_conf_read;
- lcp->lc_pc.pc_conf_write = pbc_conf_write;
- lcp->lc_pc.pc_ether_hw_addr = pbc_ether_hw_addr;
- lcp->lc_pc.pc_sync_cache = R4K_HitFlushDCache;
-
- lcp->lc_pc.pc_intr_v = lcp;
- lcp->lc_pc.pc_intr_map = pbc_intr_map;
- lcp->lc_pc.pc_intr_string = pbc_intr_string;
- lcp->lc_pc.pc_intr_establish = pbc_intr_establish;
- lcp->lc_pc.pc_intr_disestablish = pbc_intr_disestablish;
-
- pbc_version = V96X_PCI_CC_REV;
- printf(": V3 V962, Revision %x.\n", pbc_version);
- break;
- }
-
- pba.pba_busname = "pci";
- pba.pba_iot = &sc->sc_bus_space;
- pba.pba_memt = &sc->sc_bus_space;
- pba.pba_pc = &lcp->lc_pc;
- pba.pba_bus = 0;
- config_found(self, &pba, pbcpcibrprint);
-
-}
-
-static int
-pbcpcibrprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
- struct pcibus_attach_args *pba = aux;
-
- if(pnp)
- printf("%s at %s", pba->pba_busname, pnp);
- printf(" bus %d", pba->pba_bus);
- return(UNCONF);
-}
-
-/*
- * Get PCI physical address from given viritual address.
- */
-
-vm_offset_t
-vtophysaddr(dp, p)
- struct device *dp;
- vm_offset_t p;
-{
- vm_offset_t pa;
- vm_offset_t va;
-
- va = p;
- if(va >= UADDR) { /* Stupid driver have buf on stack!! */
- va = (vm_offset_t)curproc->p_addr + (va & ~UADDR);
- }
- if((vm_offset_t)va < VM_MIN_KERNEL_ADDRESS) {
- pa = CACHED_TO_PHYS(va);
- }
- else {
- pa = pmap_extract(vm_map_pmap(phys_map), va);
- }
- if(dp->dv_class == DV_IFNET && pbc_version < V96X_VREV_C0) {
- /* BUG in early V962PBC's */
- pa |= 0xc0000000; /* Use aparture II */
- }
- return(pa);
-}
-
-void
-pbc_attach_hook(parent, self, pba)
- struct device *parent, *self;
- struct pcibus_attach_args *pba;
-{
-}
-
-int
-pbc_bus_maxdevs(cpv, busno)
- void *cpv;
- int busno;
-{
- return(16);
-}
-
-pcitag_t
-pbc_make_tag(cpv, bus, dev, fnc)
- void *cpv;
- int bus, dev, fnc;
-{
- return (bus << 16) | (dev << 11) | (fnc << 8);
-}
-
-void
-pbc_decompose_tag(cpv, tag, busp, devp, fncp)
- void *cpv;
- pcitag_t tag;
- int *busp, *devp, *fncp;
-{
- if (busp != NULL)
- *busp = (tag >> 16) & 0x7;
- if (devp != NULL)
- *devp = (tag >> 11) & 0x1f;
- if (fncp != NULL)
- *fncp = (tag >> 8) & 0x7;
-}
-
-pcireg_t
-pbc_conf_read(cpv, tag, offset)
- void *cpv;
- pcitag_t tag;
- int offset;
-{
- pcireg_t data;
- u_int32_t addr;
- int bus, device, func, ad_low;
- int s;
-
- if(offset & 3 || offset < 0 || offset >= 0x100) {
- printf ("pci_conf_read: bad reg %x\n", offset);
- return(~0);
- }
- pbc_decompose_tag(cpv, tag, &bus, &device, &func);
- ad_low = 0;
-
- if(system_type == ALGOR_P4032) {
- if(bus != 0 || device > 5 || func > 7) {
- return(~0);
- }
- addr = (0x800 << device) | (func << 8) | offset;
- ad_low = 0;
- }
- else { /* P5064 */
- if(bus == 0) {
- if(device > 5 || func > 7) {
- return(~0);
- }
- addr = (1L << (device + 24)) | (func << 8) | offset;
- ad_low = 0;
- }
- else if(pbc_version >= V96X_VREV_C0) {
- if(bus > 255 || device > 15 || func > 7) {
- return(~0);
- }
- addr = (bus << 16) | (device << 11) | (func << 8);
- ad_low = V96X_LB_MAPx_AD_LOW_EN;
- }
- else {
- return(~0);
- }
- }
-
- s = splhigh();
-
- /* high 12 bits of address go in map register, and set for conf space */
- V96X_LB_MAP0 = ((addr >> 16) & V96X_LB_MAPx_MAP_ADR) | ad_low | V96X_LB_TYPE_CONF;
- /* clear aborts */
- V96X_PCI_STAT |= V96X_PCI_STAT_M_ABORT | V96X_PCI_STAT_T_ABORT;
-
- wbflush();
-
- /* low 20 bits of address are in the actual address */
- data = *(volatile pcireg_t *) (V96X_PCI_CONF_SPACE + (addr&0xfffff));
-
- if (V96X_PCI_STAT & V96X_PCI_STAT_M_ABORT) {
- V96X_PCI_STAT |= V96X_PCI_STAT_M_ABORT;
- return(~0); /* Nothing there */
- }
-
- if (V96X_PCI_STAT & V96X_PCI_STAT_T_ABORT) {
- V96X_PCI_STAT |= V96X_PCI_STAT_T_ABORT;
- printf ("PCI slot %d: target abort!\n", device);
- return(~0); /* Ooops! */
- }
-
- splx(s);
- return(data);
-}
-
-void
-pbc_conf_write(cpv, tag, offset, data)
- void *cpv;
- pcitag_t tag;
- int offset;
- pcireg_t data;
-{
- u_int32_t addr;
- int bus, device, func, ad_low;
- int s;
-
- pbc_decompose_tag(cpv, tag, &bus, &device, &func);
- ad_low = 0;
-
- if(system_type == ALGOR_P4032) {
- if(bus != 0 || device > 5 || func > 7) {
- return;
- }
- addr = (0x800 << device) | (func << 8) | offset;
- ad_low = 0;
- }
- else { /* P5064 */
- if(bus == 0) {
- if(device > 5 || func > 7) {
- return;
- }
- addr = (1L << (device + 24)) | (func << 8) | offset;
- ad_low = 0;
- }
- else if(pbc_version >= V96X_VREV_C0) {
- if(bus > 255 || device > 15 || func > 7) {
- return;
- }
- addr = (bus << 16) | (device << 11) | (func << 8);
- ad_low = V96X_LB_MAPx_AD_LOW_EN;
- }
- else {
- return;
- }
- }
-
- s = splhigh();
-
- /* high 12 bits of address go in map register, and set for conf space */
- V96X_LB_MAP0 = ((addr >> 16) & V96X_LB_MAPx_MAP_ADR) | ad_low | V96X_LB_TYPE_CONF;
- /* clear aborts */
- V96X_PCI_STAT |= V96X_PCI_STAT_M_ABORT | V96X_PCI_STAT_T_ABORT;
-
- wbflush();
-
- /* low 20 bits of address are in the actual address */
- *(volatile pcireg_t *) (V96X_PCI_CONF_SPACE + (addr&0xfffff)) = data;
-
- /* wait for write FIFO to empty */
- do {
- } while (V96X_FIFO_STAT & V96X_FIFO_STAT_L2P_WR);
-
- if (V96X_PCI_STAT & V96X_PCI_STAT_M_ABORT) {
- V96X_PCI_STAT |= V96X_PCI_STAT_M_ABORT;
- printf ("PCI slot %d: conf_write: master abort\n", device);
- }
-
- if (V96X_PCI_STAT & V96X_PCI_STAT_T_ABORT) {
- V96X_PCI_STAT |= V96X_PCI_STAT_T_ABORT;
- printf ("PCI slot %d: conf_write: target abort!\n", device);
- }
-
- splx(s);
-}
-
-/*
- * Build the serial rom info normaly stored in an EEROM on
- * PCI DEC21x4x boards. Cheapo designs skips the rom so
- * we do the job here. The setup is not 100% correct but
- * close enough to make the driver happy!
- */
-int
-pbc_ether_hw_addr(p)
- u_int8_t *p;
-{
- int i;
-
- for(i = 0; i < 128; i++)
- p[i] = 0x00;
- p[18] = 0x03; /* Srom version. */
- p[19] = 0x01; /* One chip. */
- /* Next six, ethernet address. */
- bcopy(eth_hw_addr, &p[20], 6);
-
- p[26] = 0x00; /* Chip 0 device number */
- p[27] = 30; /* Descriptor offset */
- p[28] = 00;
- p[29] = 00; /* MBZ */
- /* Descriptor */
- p[30] = 0x00; /* Autosense. */
- p[31] = 0x08;
- if(system_type == ALGOR_P4032 ||
- system_type == ALGOR_P5064) {
- p[32] = 0x01; /* Block cnt */
- p[33] = 0x02; /* Medium type is AUI */
- }
- else {
- p[32] = 0xff; /* GP cntrl */
- p[33] = 0x01; /* Block cnt */
-#define GPR_LEN 0
-#define RES_LEN 0
- p[34] = 0x80 + 12 + GPR_LEN + RES_LEN;
- p[35] = 0x01; /* MII PHY type */
- p[36] = 0x00; /* PHY number 0 */
- p[37] = 0x00; /* GPR Length */
- p[38] = 0x00; /* Reset Length */
- p[39] = 0x00; /* Media capabilities */
- p[40] = 0x78; /* Media capabilities */
- p[41] = 0x00; /* Autoneg advertisment */
- p[42] = 0x78; /* Autoneg advertisment */
- p[43] = 0x00; /* Full duplex map */
- p[44] = 0x50; /* Full duplex map */
- p[45] = 0x00; /* Treshold map */
- p[46] = 0x18; /* Treshold map */
- }
-
- i = (srom_crc32(p, 126) & 0xFFFF) ^ 0xFFFF;
- p[126] = i;
- p[127] = i >> 8;
- return(1); /* Got it! */
-}
-
-int
-pbc_intr_map(lcv, bustag, buspin, line, ihp)
- void *lcv;
- pcitag_t bustag;
- int buspin, line;
- pci_intr_handle_t *ihp;
-{
- struct pcibr_config *lcp = lcv;
- pci_chipset_tag_t pc = &lcp->lc_pc;
- int device, pirq;
-
- if (buspin == 0) {
- /* No IRQ used. */
- *ihp = -1;
- return 1;
- }
- if (buspin > 4) {
- printf("pbc_intr_map: bad interrupt pin %d\n", buspin);
- *ihp = -1;
- return 1;
- }
-
- pci_decompose_tag(pc, bustag, NULL, &device, NULL);
- pirq = buspin - 1;
-
- switch(device) {
- case 0: /* DC21041 */
- pirq = 9;
- break;
- case 1: /* NCR SCSI */
- pirq = 10;
- break;
- default:
- switch (buspin) {
- case PCI_INTERRUPT_PIN_A:
- pirq = 0;
- break;
- case PCI_INTERRUPT_PIN_B:
- pirq = 1;
- break;
- case PCI_INTERRUPT_PIN_C:
- pirq = 2;
- break;
- case PCI_INTERRUPT_PIN_D:
- pirq = 3;
- break;
- }
- }
- *ihp = pirq;
- return 0;
-}
-
-const char *
-pbc_intr_string(lcv, ih)
- void *lcv;
- pci_intr_handle_t ih;
-{
- static char str[16];
-
- sprintf(str, "pciirq%d", ih);
- return(str);
-}
-
-void *
-pbc_intr_establish(lcv, ih, level, func, arg, name)
- void *lcv;
- pci_intr_handle_t ih;
- int level;
- int (*func) __P((void *));
- void *arg;
- char *name;
-{
- return algor_pci_intr_establish(ih, level, func, arg, name);
-}
-
-void
-pbc_intr_disestablish(lcv, cookie)
- void *lcv, *cookie;
-{
- algor_pci_intr_disestablish(cookie);
-}
diff --git a/sys/arch/arc/pci/pci_machdep.h b/sys/arch/arc/pci/pci_machdep.h
deleted file mode 100644
index 904395e9b2a..00000000000
--- a/sys/arch/arc/pci/pci_machdep.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* $OpenBSD: pci_machdep.h,v 1.4 1998/03/18 12:06:18 pefo Exp $ */
-
-/*
- * Copyright (c) 1996 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-/*
- * Machine-specific definitions for PCI autoconfiguration.
- */
-
-/*
- * Types provided to machine-independent PCI code
- */
-typedef struct arc_pci_chipset *pci_chipset_tag_t;
-typedef u_long pcitag_t;
-typedef u_long pci_intr_handle_t;
-
-/*
- * arc-specific PCI structure and type definitions.
- * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
- */
-struct arc_pci_chipset {
- void *pc_conf_v;
- void (*pc_attach_hook) __P((struct device *,
- struct device *, struct pcibus_attach_args *));
- int (*pc_bus_maxdevs) __P((void *, int));
- pcitag_t (*pc_make_tag) __P((void *, int, int, int));
- void (*pc_decompose_tag) __P((void *, pcitag_t, int *,
- int *, int *));
- pcireg_t (*pc_conf_read) __P((void *, pcitag_t, int));
- void (*pc_conf_write) __P((void *, pcitag_t, int, pcireg_t));
-
- void *pc_intr_v;
- int (*pc_intr_map) __P((void *, pcitag_t, int, int,
- pci_intr_handle_t *));
- const char *(*pc_intr_string) __P((void *, pci_intr_handle_t));
- void *(*pc_intr_establish) __P((void *, pci_intr_handle_t,
- int, int (*)(void *), void *, char *));
- void (*pc_intr_disestablish) __P((void *, void *));
- int (*pc_ether_hw_addr) __P((u_int8_t *));
- void (*pc_sync_cache) __P((vm_offset_t, int));
-};
-
-/*
- * Functions provided to machine-independent PCI code.
- */
-#define pci_attach_hook(p, s, pba) \
- (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
-#define pci_bus_maxdevs(c, b) \
- (*(c)->pc_bus_maxdevs)((c)->pc_conf_v, (b))
-#define pci_make_tag(c, b, d, f) \
- (*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f))
-#define pci_decompose_tag(c, t, bp, dp, fp) \
- (*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp))
-#define pci_conf_read(c, t, r) \
- (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
-#define pci_conf_write(c, t, r, v) \
- (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
-#define pci_intr_map(c, it, ip, il, ihp) \
- (*(c)->pc_intr_map)((c)->pc_intr_v, (it), (ip), (il), (ihp))
-#define pci_intr_string(c, ih) \
- (*(c)->pc_intr_string)((c)->pc_intr_v, (ih))
-#define pci_intr_establish(c, ih, l, h, a, nm) \
- (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a), (nm))
-#define pci_intr_disestablish(c, iv) \
- (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv))
-#define pci_ether_hw_addr(c, p) \
- (*(c)->pc_ether_hw_addr)((p))
-#define pci_sync_cache(c, p, s) \
- (*(c)->pc_sync_cache)((p), (s))
-
-vm_offset_t vtophysaddr __P((struct device *, vm_offset_t));
-
-#define TULIP_KVATOPHYS(sc, va) vtophysaddr(&sc->tulip_dev, (vm_offset_t)va)
-#define NCR_KVATOPHYS(sc, va) vtophysaddr(&sc->sc_dev, (vm_offset_t)va)
diff --git a/sys/arch/arc/pci/pcibrvar.h b/sys/arch/arc/pci/pcibrvar.h
deleted file mode 100644
index 5994df85659..00000000000
--- a/sys/arch/arc/pci/pcibrvar.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $OpenBSD: pcibrvar.h,v 1.2 1997/04/10 16:29:32 pefo Exp $ */
-
-/*
- * Copyright (c) 1997 Per Fogelstrom
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-struct pcibr_config {
- bus_space_tag_t lc_iot;
- bus_space_tag_t lc_memt;
- struct arc_pci_chipset lc_pc;
- int pci_init_done;
-};
-
-struct pcibr_softc {
- struct device sc_dev;
- struct pcibr_config *sc_pcibr;
- struct arc_bus_space sc_bus_space; /* Same for I/O and Mem */
-};
-
-
diff --git a/sys/arch/arc/pci/v962pcbreg.h b/sys/arch/arc/pci/v962pcbreg.h
deleted file mode 100644
index 9320bafee6b..00000000000
--- a/sys/arch/arc/pci/v962pcbreg.h
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * v96xpbc.h: i960 to PCI bridge controller
- */
-
-/* Where we map the config space */
-#define V96X_PCI_CONF_SPACE 0xbee00000
-
-/* Where we map the PCI memory space */
-#define V96X_PCI_MEM_SPACE 0xa0000000
-
-/* offsets from base pointer, this construct allows optimisation */
-static char * const _v96xp = (char *)P4032_V96x;
-
-#if BYTE_ORDER == LITTLE_ENDIAN
-#define V96XW(x) *(volatile unsigned long *)(_v96xp + (x))
-#define V96XH(x) *(volatile unsigned short *)(_v96xp + (x))
-#define V96XB(x) *(volatile unsigned char *)(_v96xp + (x))
-#else
-#define V96XW(x) *(volatile unsigned long *)(_v96xp + (x))
-#define V96XH(x) *(volatile unsigned short *)(_v96xp + ((x)^2))
-#define V96XB(x) *(volatile unsigned char *)(_v96xp + ((x)^3))
-#endif
-
-#define V96X_PCI_VENDOR V96XH(0x00)
-#define V96X_PCI_DEVICE V96XH(0x02)
-#define V96X_PCI_CMD V96XH(0x04)
-#define V96X_PCI_STAT V96XH(0x06)
-#define V96X_PCI_CC_REV V96XW(0x08)
-#define V96X_PCI_I20_BASE V96XW(0x10) /* B.2 only */
-#define V96X_PCI_HDR_CFG V96XW(0x0c)
-#define V96X_PCI_IO_BASE V96XW(0x10)
-#define V96X_PCI_BASE0 V96XW(0x14)
-#define V96X_PCI_BASE1 V96XW(0x18)
-#define V96X_PCI_BPARAM V96XW(0x3c)
-#define V96X_PCI_MAP0 V96XW(0x40)
-#define V96X_PCI_MAP1 V96XW(0x44)
-#define V96X_PCI_INT_STAT V96XW(0x48)
-#define V96X_PCI_INT_CFG V96XW(0x4c)
-#define V96X_LB_BASE0 V96XW(0x54)
-#define V96X_LB_BASE1 V96XW(0x58)
-#define V96X_LB_MAP0 V96XH(0x5e)
-#define V96X_LB_MAP1 V96XH(0x62)
-#define V96X_LB_BASE2 V96XH(0x64) /* B.2 only */
-#define V96X_LB_MAP2 V96XH(0x66) /* B.2 only */
-#define V96X_LB_SIZE V96XW(0x68) /* B.2 only */
-#define V96X_LB_IO_BASE V96XW(0x6c)
-#define V96X_FIFO_CFG V96XH(0x70)
-#define V96X_FIFO_PRIORITY V96XH(0x72)
-#define V96X_FIFO_STAT V96XH(0x74)
-#define V96X_LB_ISTAT V96XB(0x76)
-#define V96X_LB_IMASK V96XB(0x77)
-#define V96X_SYSTEM V96XH(0x78)
-#define V96X_LB_CFGL V96XB(0x7a)
-#define V96X_LB_CFG V96XB(0x7b)
-#define V96X_PCI_CFG V96XB(0x7c) /* B.2 only */
-#define V96X_DMA_PCI_ADDR0 V96XW(0x80)
-#define V96X_DMA_LOCAL_ADDR0 V96XW(0x84)
-#define V96X_DMA_LENGTH0 V96XW(0x88)
-#define V96X_DMA_CTLB_ADR0 V96XW(0x8c)
-#define V96X_DMA_PCI_ADDR1 V96XW(0x90)
-#define V96X_DMA_LOCAL_ADDR1 V96XW(0x94)
-#define V96X_DMA_LENGTH1 V96XW(0x98)
-#define V96X_DMA_CTLB_ADR1 V96XW(0x9c)
-#define V96X_MAIL_DATA(n) V96XB(0xc0+(n))
-#define V96X_LB_MAIL_IEWR V96XH(0xd0)
-#define V96X_LB_MAIL_IERD V96XH(0xd2)
-#define V96X_PCI_MAIL_IEWR V96XH(0xd4)
-#define V96X_PCI_MAIL_IERD V96XH(0xd6)
-#define V96X_MAIL_WR_STAT V96XH(0xd8)
-#define V96X_MAIL_RD_STAT V96XH(0xdc)
-
-#define V96X_PCI_CMD_FBB_EN 0x0200
-#define V96X_PCI_CMD_SERR_EN 0x0100
-#define V96X_PCI_CMD_PAR_EN 0x0040
-#define V96X_PCI_CMD_MASTER_EN 0x0004
-#define V96X_PCI_CMD_MEM_EN 0x0002
-#define V96X_PCI_CMD_IO_EN 0x0001
-
-#define V96X_PCI_STAT_PAR_ERR 0x8000
-#define V96X_PCI_STAT_SYS_ERR 0x4000
-#define V96X_PCI_STAT_M_ABORT 0x2000
-#define V96X_PCI_STAT_T_ABORT 0x1000
-#define V96X_PCI_STAT_DEVSEL 0x0600
-#define V96X_PCI_STAT_PAR_REP 0x0100
-#define V96X_PCI_STAT_FAST_BACK 0x0080
-
-#define V96X_PCI_CC_REV_BASE_CLASS 0xff000000
-#define V96X_PCI_CC_REV_SUB_CLASS 0x00ff0000
-#define V96X_PCI_CC_REV_PROG_IF 0x0000ff00
-#define V96X_PCI_CC_REV_UREV 0x000000f0
-#define V96X_PCI_CC_REV_VREV 0x0000000f
-
-#define V96X_VREV_A 0x0
-#define V96X_VREV_B0 0x1
-#define V96X_VREV_B1 0x2
-#define V96X_VREV_B2 0x3
-#define V96X_VREV_C0 0x4
-
-#define V96X_PCI_HDR_CFG_LT 0x0000ff00
-#define V96X_PCI_HDR_CFG_LT_SHIFT 8
-#define V96X_PCI_HDR_CFG_CLS 0x000000ff
-#define V96X_PCI_HDR_CFG_CLS_SHIFT 0
-
-/* pci access to internal v96xpbc registers */
-#define V96X_PCI_IO_BASE_ADR_BASE 0xfffffff0
-#define V96X_PCI_IO_BASE_PREFETCH 0x00000008
-#define V96X_PCI_IO_BASE_TYPE 0x00000006
-#define V96X_PCI_IO_BASE_IO 0x00000001
-#define V96X_PCI_IO_BASE_MEM 0x00000000
-
-/* pci to local bus aperture 0 base address */
-#define V96X_PCI_BASE0_ADR_BASE 0xfff00000
-#define V96X_PCI_BASE0_ADR_BASEL 0x000fff00
-
-/* pci to local bus aperture 1 base address */
-#define V96X_PCI_BASE1_ADR_BASE 0xfff00000
-#define V96X_PCI_BASE1_ADR_BASEL 0x000fc000
-#define V96X_PCI_BASE1_ADR_DOS_MEM 0x00000700
-
-#define V96X_PCI_BASEx_PREFETCH 0x00000008
-#define V96X_PCI_BASEx_IO 0x00000001
-#define V96X_PCI_BASEx_MEM 0x00000000
-
-/* pci bus parameter register */
-#define V96X_PCI_BPARAM_MAX_LAT 0xff000000
-#define V96X_PCI_BPARAM_MIN_GNT 0x00ff0000
-#define V96X_PCI_BPARAM_INT_PIN 0x00000700
-#define V96X_PCI_BPARAM_INT_LINE 0x0000000f
-
-/* pci bus to local bus address map 0 */
-#define V96X_PCI_MAPx_MAP_ADR 0xfff00000
-#define V96X_PCI_MAPx_RD_POST_INH 0x00008000
-#define V96X_PCI_MAP0_ROM_SIZE 0x00000c00
-#define V96X_PCI_MAPx_SWAP 0x00000300
-#define V96X_PCI_MAPx_ADR_SIZE 0x000000f0
-#define V96X_PCI_MAPx_REG_EN 0x00000002
-#define V96X_PCI_MAPx_ENABLE 0x00000001
-
-#define V96X_ADR_SIZE_1MB (0x0<<4)
-#define V96X_ADR_SIZE_2MB (0x1<<4)
-#define V96X_ADR_SIZE_4MB (0x2<<4)
-#define V96X_ADR_SIZE_8MB (0x3<<4)
-#define V96X_ADR_SIZE_16MB (0x4<<4)
-#define V96X_ADR_SIZE_32MB (0x5<<4)
-#define V96X_ADR_SIZE_64MB (0x6<<4)
-#define V96X_ADR_SIZE_128MB (0x7<<4)
-#define V96X_ADR_SIZE_256MB (0x8<<4)
-#define V96X_ADR_SIZE_DOSMODE (0xc<<4)
-
-#define V96X_SWAP_NONE (0x0<<8)
-#define V96X_SWAP_16BIT (0x1<<8)
-#define V96X_SWAP_8BIT (0x2<<8)
-#define V96X_SWAP_AUTO (0x3<<8)
-
-/* pci interrupt status register */
-#define V96X_PCI_INT_STAT_MAILBOX 0x80000000
-#define V96X_PCI_INT_STAT_LOCAL 0x40000000
-#define V96X_PCI_INT_STAT_DMA1 0x02000000
-#define V96X_PCI_INT_STAT_DMA0 0x01000000
-#define V96X_PCI_INT_STAT_INTC_TO_D 0x00004000
-#define V96X_PCI_INT_STAT_INTB_TO_D 0x00002000
-#define V96X_PCI_INT_STAT_INTA_TO_D 0x00001000
-#define V96X_PCI_INT_STAT_INTD_TO_C 0x00000800
-#define V96X_PCI_INT_STAT_INTB_TO_C 0x00000200
-#define V96X_PCI_INT_STAT_INTA_TO_C 0x00000100
-#define V96X_PCI_INT_STAT_INTD_TO_B 0x00000080
-#define V96X_PCI_INT_STAT_INTC_TO_B 0x00000040
-#define V96X_PCI_INT_STAT_INTA_TO_B 0x00000010
-#define V96X_PCI_INT_STAT_INTD_TO_A 0x00000008
-#define V96X_PCI_INT_STAT_INTC_TO_A 0x00000004
-#define V96X_PCI_INT_STAT_INTB_TO_A 0x00000002
-
-/* pci interrupt config register */
-#define V96X_PCI_INT_CFG_MAILBOX 0x80000000
-#define V96X_PCI_INT_CFG_LOCAL 0x40000000
-#define V96X_PCI_INT_CFG_DMA1 0x02000000
-#define V96X_PCI_INT_CFG_DMA0 0x01000000
-#define V96X_PCI_INT_CFG_MODE_D 0x00c00000
-#define V96X_PCI_INT_CFG_MODE_D_SHIFT 22
-#define V96X_PCI_INT_CFG_MODE_C 0x00300000
-#define V96X_PCI_INT_CFG_MODE_C_SHIFT 20
-#define V96X_PCI_INT_CFG_MODE_B 0x000c0000
-#define V96X_PCI_INT_CFG_MODE_B_SHIFT 18
-#define V96X_PCI_INT_CFG_MODE_A 0x00030000
-#define V96X_PCI_INT_CFG_MODE_A_SHIFT 16
-#define V96X_PCI_INT_CFG_MODE_LEVEL 0x0
-#define V96X_PCI_INT_CFG_MODE_EDGE 0x1
-#define V96X_PCI_INT_CFG_MODE_SWCLR 0x2
-#define V96X_PCI_INT_CFG_MODE_HWCLR 0x3
-#define V96X_PCI_INT_CFG_INTD_TO_LB 0x00008000
-#define V96X_PCI_INT_CFG_INTC_TO_D 0x00004000
-#define V96X_PCI_INT_CFG_INTB_TO_D 0x00002000
-#define V96X_PCI_INT_CFG_INTA_TO_D 0x00001000
-#define V96X_PCI_INT_CFG_INTD_TO_C 0x00000800
-#define V96X_PCI_INT_CFG_INTC_TO_LB 0x00000400
-#define V96X_PCI_INT_CFG_INTB_TO_C 0x00000200
-#define V96X_PCI_INT_CFG_INTA_TO_C 0x00000100
-#define V96X_PCI_INT_CFG_INTD_TO_B 0x00000080
-#define V96X_PCI_INT_CFG_INTC_TO_B 0x00000040
-#define V96X_PCI_INT_CFG_INTB_TO_LB 0x00000020
-#define V96X_PCI_INT_CFG_INTA_TO_B 0x00000010
-#define V96X_PCI_INT_CFG_INTD_TO_A 0x00000008
-#define V96X_PCI_INT_CFG_INTC_TO_A 0x00000004
-#define V96X_PCI_INT_CFG_INTB_TO_A 0x00000002
-#define V96X_PCI_INT_CFG_INTA_TO_LB 0x00000001
-
-/* local bus to pci bus aperture 0,1 */
-#define V96X_LB_BASEx_ADR_BASE 0xfff00000
-#define V96X_LB_BASEx_SWAP 0x00000300
-#define V96X_LB_BASEx_ADR_SIZE 0x000000f0
-#define V96X_LB_BASEx_PREFETCH 0x00000008
-#define V96X_LB_BASEx_ENABLE 0x00000001
-
-/* local bus to pci bus address map 0,1 */
-#define V96X_LB_MAPx_MAP_ADR 0xfff0
-#define V96X_LB_MAPx_TYPE 0x0007
-#define V96X_LB_TYPE_IACK (0x0<<1)
-#define V96X_LB_TYPE_IO (0x1<<1)
-#define V96X_LB_TYPE_MEM (0x3<<1)
-#define V96X_LB_TYPE_CONF (0x5<<1)
-#define V96X_LB_MAPx_AD_LOW_EN 0x0001 /* C.0 only */
-
-/* local bus interrupt control, status and masks */
-#define V96X_LB_INTR_MAILBOX 0x80
-#define V96X_LB_INTR_PCI_RD 0x40
-#define V96X_LB_INTR_PCI_WR 0x20
-#define V96X_LB_INTR_PCI_INT 0x10
-#define V96X_LB_INTR_DMA1 0x02
-#define V96X_LB_INTR_DMA0 0x01
-
-/* local bus configuration */
-#define V96X_LB_CFG_TO_256 0x20
-#define V96X_LB_CFG_TO_64 0x00
-#define V96X_LB_CFG_LB_INT 0x02
-#define V96X_LB_CFG_ERR_EN 0x02
-#define V96X_LB_CFG_RDY_EN 0x01
-
-/* PCI bus configuration */
-#define V96X_PCI_CFG_I2O_EN 0x8000
-#define V96X_PCI_CFG_IO_REG_DIS 0x4000
-#define V96X_PCI_CFG_IO_DIS 0x2000
-#define V96X_PCI_CFG_EN3V 0x1000
-#define V96X_PCI_CFG_AD_LOW 0x0300
-#define V96X_PCI_CFG_AD_LOW_SHIFT 8
-#define V96X_PCI_CFG_DMA_RTYPE 0x00e0
-#define V96X_PCI_CFG_DMA_WTYPE 0x000e
-
-/* fifo configuration register */
-#define V96X_FIFO_CFG_PBRST_MAX 0xc000
-#define V96X_FIFO_CFG_PBRST_MAX_SHIFT 14
-#define V96X_FIFO_CFG_WR_LB 0x3000
-#define V96X_FIFO_CFG_WR_LB_SHIFT 12
-#define V96X_FIFO_CFG_RD_LB1 0x0c00
-#define V96X_FIFO_CFG_RD_LB1_SHIFT 10
-#define V96X_FIFO_CFG_RD_LB0 0x0300
-#define V96X_FIFO_CFG_RD_LB0_SHIFT 8
-#define V96X_FIFO_CFG_LBRST_MAX 0x00c0
-#define V96X_FIFO_CFG_LBRST_MAX_SHIFT 6
-#define V96X_FIFO_CFG_WR_PCI 0x0030
-#define V96X_FIFO_CFG_WR_PCI_SHIFT 4
-#define V96X_FIFO_CFG_RD_PCI1 0x000c
-#define V96X_FIFO_CFG_RD_PCI1_SHIFT 2
-#define V96X_FIFO_CFG_RD_PCI0 0x0003
-#define V96X_FIFO_CFG_RD_PCI0_SHIFT 0
-
-/* meaning of above bitfields */
-
-/* max burst length */
-#define V96X_FIFO_CFG_BRST_4 0x0
-#define V96X_FIFO_CFG_BRST_8 0x1
-#define V96X_FIFO_CFG_BRST_16 0x2
-#define V96X_FIFO_CFG_BRST_256 0x3
-
-/* when to start refilling read fifo */
-#define V96X_FIFO_CFG_RD_NOTFULL 0x0
-#define V96X_FIFO_CFG_RD_HALF 0x1
-#define V96X_FIFO_CFG_RD_EMPTY 0x2
-
-/* when to start emptying write fifo */
-#define V96X_FIFO_CFG_WR_NOTEMPTY 0x0
-#define V96X_FIFO_CFG_WR_3WORDS 0x2
-#define V96X_FIFO_CFG_WR_ENDBRST 0x3
-
-/* fifo priority control */
-#define V96X_FIFO_PRIORITY_LOCAL_RD 0x1000
-#define V96X_FIFO_PRIORITY_LOCAL_WR 0x0000
-#define V96X_FIFO_PRIORITY_LB_RD1 0x0c00
-#define V96X_FIFO_PRIORITY_LB_RD1_SHIFT 10
-#define V96X_FIFO_PRIORITY_LB_RD0 0x0300
-#define V96X_FIFO_PRIORITY_LB_RD0_SHIFT 8
-#define V96X_FIFO_PRIORITY_PCI_RD 0x0010
-#define V96X_FIFO_PRIORITY_PCI_WR 0x0000
-#define V96X_FIFO_PRIORITY_PCI_RD1 0x000c
-#define V96X_FIFO_PRIORITY_PCI_RD1_SHIFT 2
-#define V96X_FIFO_PRIORITY_PCI_RD0 0x0003
-#define V96X_FIFO_PRIORITY_PCI_RD0_SHIFT 0
-
-/* meaning of above bitfields */
-#define V96X_FIFO_PRI_NOFLUSH 0x0
-#define V96X_FIFO_PRI_FLUSHME 0x2
-#define V96X_FIFO_PRI_FLUSHALL 0x3
-
-/* fifo status */
-#define V96X_FIFO_STAT_L2P_WR 0x3000
-#define V96X_FIFO_STAT_L2P_RD1 0x0c00
-#define V96X_FIFO_STAT_L2P_RD0 0x0300
-#define V96X_FIFO_STAT_P2L_WR 0x0030
-#define V96X_FIFO_STAT_P2L_RD1 0x000c
-#define V96X_FIFO_STAT_P2L_RD0 0x0003
-
-#define V96X_DMA_COUNT_CHAIN 0x80000000
-#define V96X_DMA_COUNT_PRIORITY 0x20000000
-#define V96X_DMA_COUNT_P2L 0x10000000
-#define V96X_DMA_COUNT_SWAP 0x0c000000
-#define V96X_DMA_COUNT_ABORT 0x02000000
-#define V96X_DMA_COUNT_DMA_IPR 0x01000000
-
-#define V96X_SYSTEM_RST_OUT 0x8000
-#define V96X_SYSTEM_LOCK 0x4000
-#define V96X_SYSTEM_SPROM_EN 0x2000
-#define V96X_SYSTEM_SCL 0x1000
-#define V96X_SYSTEM_SDA_OUT 0x0800
-#define V96X_SYSTEM_SDA_IN 0x0400
-#define V96X_SYSTEM_POE 0x0200
-#define V96X_SYSTEM_LB_RD_PCI1 0x0040
-#define V96X_SYSTEM_LB_RD_PCI0 0x0020
-#define V96X_SYSTEM_LB_WR_PCI 0x0010
-#define V96X_SYSTEM_PCI_RD_LB1 0x0004
-#define V96X_SYSTEM_PCI_RD_LB0 0x0002
-#define V96X_SYSTEM_PC_WR_LBI 0x0001
-
diff --git a/sys/arch/arc/pica/pica.h b/sys/arch/arc/pica/pica.h
deleted file mode 100644
index 24f7438e71a..00000000000
--- a/sys/arch/arc/pica/pica.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/* $OpenBSD: pica.h,v 1.4 1996/09/14 15:58:28 pefo Exp $ */
-
-/*
- * Copyright (c) 1994, 1995, 1996 Per Fogelstrom
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-#ifndef _PICA_H_
-#define _PICA_H_ 1
-
-/*
- * PICA's Physical address space
- */
-
-#define PICA_PHYS_MIN 0x00000000 /* 256 Meg */
-#define PICA_PHYS_MAX 0x0fffffff
-
-/*
- * Memory map
- */
-
-#define PICA_PHYS_MEMORY_START 0x00000000
-#define PICA_PHYS_MEMORY_END 0x0fffffff /* 256 Meg in 8 slots */
-
-#define PICA_MEMORY_SIZE_REG 0xe00fffe0 /* Memory size register */
-#define PICA_CONFIG_REG 0xe00ffff0 /* Hardware config reg */
-
-/*
- * I/O map
- */
-
-#define R4030_P_LOCAL_IO_BASE 0x80000000 /* I/O Base address */
-#define R4030_V_LOCAL_IO_BASE 0xe0000000
-#define R4030_S_LOCAL_IO_BASE 0x00040000 /* Size */
-#define R4030 R4030_V_LOCAL_IO_BASE
-
-#define R4030_SYS_CONFIG (R4030+0x0000) /* Global config register */
-#define R4030_SYS_TL_BASE (R4030+0x0018) /* DMA transl. table base */
-#define R4030_SYS_TL_LIMIT (R4030+0x0020) /* DMA transl. table limit */
-#define R4030_SYS_TL_IVALID (R4030+0x0028) /* DMA transl. cache inval */
-#define R4030_SYS_DMA0_REGS (R4030+0x0100) /* DMA ch0 base address */
-#define R4030_SYS_DMA1_REGS (R4030+0x0120) /* DMA ch0 base address */
-#define R4030_SYS_DMA2_REGS (R4030+0x0140) /* DMA ch0 base address */
-#define R4030_SYS_DMA3_REGS (R4030+0x0160) /* DMA ch0 base address */
-#define R4030_SYS_DMA_INT_SRC (R4030+0x0200) /* DMA int source status reg */
-#define R4030_SYS_NVRAM_PROT (R4030+0x0220) /* NV ram protect register */
-#define R4030_SYS_IT_VALUE (R4030+0x0228) /* Interval timer reload */
-#define R4030_SYS_IT_STAT (R4030+0x0230) /* Interval timer count */
-#define R4030_SYS_ISA_VECTOR (R4030+0x0238) /* ISA Interrupt vector */
-#define R4030_SYS_EXT_IMASK (R4030+0x00e8) /* External int enable mask */
-
-#define PVLB R4030_V_LOCAL_IO_BASE
-#define PICA_SYS_SONIC (PVLB+0x1000) /* SONIC base address */
-#define PICA_SYS_SCSI (PVLB+0x2000) /* SCSI base address */
-#define PICA_SYS_FLOPPY (PVLB+0x3000) /* Floppy base address */
-#define PICA_SYS_CLOCK (PVLB+0x4000) /* Clock base address */
-#define PICA_SYS_KBD (PVLB+0x5000) /* Keybrd/mouse base address */
-#define PICA_SYS_COM1 (PVLB+0x6000) /* Com port 1 */
-#define PICA_SYS_COM2 (PVLB+0x7000) /* Com port 2 */
-#define PICA_SYS_PAR1 (PVLB+0x8000) /* Parallel port 1 */
-#define PICA_SYS_NVRAM (PVLB+0x9000) /* Unprotected NV-ram */
-#define PICA_SYS_PNVRAM (PVLB+0xa000) /* Protected NV-ram */
-#define PICA_SYS_NVPROM (PVLB+0xb000) /* Read only NV-ram */
-#define PICA_SYS_SOUND (PVLB+0xc000) /* Sound port */
-
-#define PICA_SYS_ISA_AS (PICA_V_ISA_IO+0x70)
-
-#define PICA_P_DRAM_CONF 0x800e0000 /* Dram config registers */
-#define PICA_V_DRAM_CONF 0xe00e0000
-#define PICA_S_DRAM_CONF 0x00020000
-
-#define PICA_P_INT_SOURCE 0xf0000000 /* Interrupt src registers */
-#define PICA_V_INT_SOURCE R4030_V_LOCAL_IO_BASE+R4030_S_LOCAL_IO_BASE
-#define PICA_S_INT_SOURCE 0x00001000
-#define PVIS PICA_V_INT_SOURCE
-#define PICA_SYS_LB_IS (PVIS+0x0000) /* Local bus int source */
-#define PICA_SYS_LB_IE (PVIS+0x0002) /* Local bus int enables */
-#define PICA_SYS_LB_IE_PAR1 0x0001 /* Parallel port enable */
-#define PICA_SYS_LB_IE_FLOPPY 0x0002 /* Floppy ctrl enable */
-#define PICA_SYS_LB_IE_SOUND 0x0004 /* Sound port enable */
-#define PICA_SYS_LB_IE_VIDEO 0x0008 /* Video int enable */
-#define PICA_SYS_LB_IE_SONIC 0x0010 /* Ethernet ctrl enable */
-#define PICA_SYS_LB_IE_SCSI 0x0020 /* Scsi crtl enable */
-#define PICA_SYS_LB_IE_KBD 0x0040 /* Keyboard ctrl enable */
-#define PICA_SYS_LB_IE_MOUSE 0x0080 /* Mouse ctrl enable */
-#define PICA_SYS_LB_IE_COM1 0x0100 /* Serial port 1 enable */
-#define PICA_SYS_LB_IE_COM2 0x0200 /* Serial port 2 enable */
-
-#define PICA_P_LOCAL_VIDEO_CTRL 0x60000000 /* Local video control */
-#define PICA_V_LOCAL_VIDEO_CTRL 0xe0200000
-#define PICA_S_LOCAL_VIDEO_CTRL 0x00200000
-
-#define PICA_P_EXTND_VIDEO_CTRL 0x60200000 /* Extended video control */
-#define PICA_V_EXTND_VIDEO_CTRL 0xe0400000
-#define PICA_S_EXTND_VIDEO_CTRL 0x00200000
-
-#define PICA_P_LOCAL_VIDEO 0x40000000 /* Local video memory */
-#define PICA_V_LOCAL_VIDEO 0xe0800000
-#define PICA_S_LOCAL_VIDEO 0x00800000
-
-#define PICA_P_ISA_IO 0x90000000 /* ISA I/O control */
-#define PICA_V_ISA_IO 0xe2000000
-#define PICA_S_ISA_IO 0x01000000
-
-#define PICA_P_ISA_MEM 0x91000000 /* ISA Memory control */
-#define PICA_V_ISA_MEM 0xe3000000
-#define PICA_S_ISA_MEM 0x01000000
-
-/*
- * Addresses used by various display drivers.
- */
-#define PICA_MONO_BASE (PICA_V_LOCAL_VIDEO_CTRL + 0x3B4)
-#define PICA_MONO_BUF (PICA_V_LOCAL_VIDEO + 0xB0000)
-#define PICA_CGA_BASE (PICA_V_LOCAL_VIDEO_CTRL + 0x3D4)
-#define PICA_CGA_BUF (PICA_V_LOCAL_VIDEO + 0xB8000)
-
-/*
- * Interrupt vector descriptor for device on pica bus.
- */
-struct pica_int_desc {
- int int_mask; /* Mask used in PICA_SYS_LB_IE */
- intr_handler_t int_hand; /* Interrupt handler */
- void *param; /* Parameter to send to handler */
- int spl_mask; /* Spl mask for interrupt */
-};
-
-int pica_intrnull __P((void *));
-#endif /* _PICA_H_ */
diff --git a/sys/arch/arc/pica/picabus.c b/sys/arch/arc/pica/picabus.c
deleted file mode 100644
index 2c2eb8442d6..00000000000
--- a/sys/arch/arc/pica/picabus.c
+++ /dev/null
@@ -1,318 +0,0 @@
-/* $OpenBSD: picabus.c,v 1.11 1999/01/11 05:11:10 millert Exp $ */
-/* $NetBSD: tc.c,v 1.2 1995/03/08 00:39:05 cgd Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- * Author: Per Fogelstrom. (Mips R4x00)
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/device.h>
-
-#include <machine/intr.h>
-#include <machine/pte.h>
-#include <machine/cpu.h>
-#include <machine/pio.h>
-#include <machine/autoconf.h>
-
-#include <mips/archtype.h>
-#include <arc/pica/pica.h>
-#include <arc/dev/dma.h>
-
-struct pica_softc {
- struct device sc_dv;
- struct abus sc_bus;
- struct pica_dev *sc_devs;
-};
-
-/* Definition of the driver for autoconfig. */
-int picamatch(struct device *, void *, void *);
-void picaattach(struct device *, struct device *, void *);
-int picaprint(void *, const char *);
-
-struct cfattach pica_ca = {
- sizeof(struct pica_softc), picamatch, picaattach
-};
-struct cfdriver pica_cd = {
- NULL, "pica", DV_DULL, NULL, 0
-};
-
-void pica_intr_establish __P((struct confargs *, int (*)(void *), void *));
-void pica_intr_disestablish __P((struct confargs *));
-caddr_t pica_cvtaddr __P((struct confargs *));
-int pica_matchname __P((struct confargs *, char *));
-int pica_iointr __P((unsigned int, struct clockframe *));
-int pica_clkintr __P((unsigned int, struct clockframe *));
-
-/*
- * Interrupt dispatch table.
- */
-struct pica_int_desc int_table[] = {
- {0, pica_intrnull, (void *)NULL, 0 }, /* 0 */
- {0, pica_intrnull, (void *)NULL, 0 }, /* 1 */
- {0, pica_intrnull, (void *)NULL, 0 }, /* 2 */
- {0, pica_intrnull, (void *)NULL, 0 }, /* 3 */
- {0, pica_intrnull, (void *)NULL, 0 }, /* 4 */
- {0, pica_intrnull, (void *)NULL, 0 }, /* 5 */
- {0, pica_intrnull, (void *)NULL, 0 }, /* 6 */
- {0, pica_intrnull, (void *)NULL, 0 }, /* 7 */
- {0, pica_intrnull, (void *)NULL, 0 }, /* 8 */
- {0, pica_intrnull, (void *)NULL, 0 }, /* 9 */
- {0, pica_intrnull, (void *)NULL, 0 }, /* 10 */
- {0, pica_intrnull, (void *)NULL, 0 }, /* 11 */
- {0, pica_intrnull, (void *)NULL, 0 }, /* 12 */
- {0, pica_intrnull, (void *)NULL, 0 }, /* 13 */
- {0, pica_intrnull, (void *)NULL, 0 }, /* 14 */
- {0, pica_intrnull, (void *)NULL, 0 }, /* 15 */
-};
-
-struct pica_dev {
- struct confargs ps_ca;
- u_int ps_mask;
- intr_handler_t ps_handler;
- void *ps_base;
-};
-struct pica_dev acer_pica_61_cpu[] = {
- {{ "dallas_rtc",0, 0, },
- 0, pica_intrnull, (void *)PICA_SYS_CLOCK, },
- {{ "lpt", 1, 0, },
- PICA_SYS_LB_IE_PAR1, pica_intrnull, (void *)PICA_SYS_PAR1, },
- {{ "fdc", 2, 0, },
- PICA_SYS_LB_IE_FLOPPY,pica_intrnull, (void *)PICA_SYS_FLOPPY, },
- {{ NULL, 3, NULL, },
- 0, pica_intrnull, (void *)NULL, },
- {{ NULL, 4, NULL, },
- 0, pica_intrnull, (void *)NULL, },
- {{ "sonic", 5, 0, },
- PICA_SYS_LB_IE_SONIC, pica_intrnull, (void *)PICA_SYS_SONIC, },
- {{ "asc", 6, 0, },
- PICA_SYS_LB_IE_SCSI, pica_intrnull, (void *)PICA_SYS_SCSI, },
- {{ "pc", 7, 0, },
- PICA_SYS_LB_IE_KBD, pica_intrnull, (void *)PICA_SYS_KBD, },
- {{ "pms", 8, NULL, },
- PICA_SYS_LB_IE_MOUSE, pica_intrnull, (void *)PICA_SYS_KBD, },
- {{ "com", 9, 0, },
- PICA_SYS_LB_IE_COM1, pica_intrnull, (void *)PICA_SYS_COM1, },
- {{ "com", 10, 0, },
- PICA_SYS_LB_IE_COM2, pica_intrnull, (void *)PICA_SYS_COM2, },
- {{ NULL, -1, NULL, },
- 0, NULL, (void *)NULL, },
-};
-
-struct pica_dev *pica_cpu_devs[] = {
- NULL, /* Unused */
- acer_pica_61_cpu, /* Acer PICA */
- acer_pica_61_cpu, /* MAGNUMS same as Acer PICA */
- NULL,
- NULL,
- NULL,
- acer_pica_61_cpu, /* NEC-R94 same as MAGNUM */
-};
-int npica_cpu_devs = sizeof pica_cpu_devs / sizeof pica_cpu_devs[0];
-
-int local_int_mask = 0; /* Local interrupt enable mask */
-
-int
-picamatch(parent, cfdata, aux)
- struct device *parent;
- void *cfdata;
- void *aux;
-{
- struct cfdata *cf = cfdata;
- struct confargs *ca = aux;
-
- /* Make sure that we're looking for a PICA. */
- if (strcmp(ca->ca_name, pica_cd.cd_name) != 0)
- return (0);
-
- /* Make sure that unit exists. */
- if (cf->cf_unit != 0 ||
- system_type > npica_cpu_devs || pica_cpu_devs[system_type] == NULL)
- return (0);
-
- return (1);
-}
-
-void
-picaattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct pica_softc *sc = (struct pica_softc *)self;
- struct confargs *nca;
- int i;
-
- printf("\n");
-
- /* keep our CPU device description handy */
- sc->sc_devs = pica_cpu_devs[system_type];
-
- /* set up interrupt handlers */
- set_intr(INT_MASK_1, pica_iointr, 2);
-
- sc->sc_bus.ab_dv = (struct device *)sc;
- sc->sc_bus.ab_type = BUS_PICA;
- sc->sc_bus.ab_intr_establish = pica_intr_establish;
- sc->sc_bus.ab_intr_disestablish = pica_intr_disestablish;
- sc->sc_bus.ab_cvtaddr = pica_cvtaddr;
- sc->sc_bus.ab_matchname = pica_matchname;
-
- /* Initialize PICA Dma */
- picaDmaInit();
-
- /* Try to configure each PICA attached device */
- for (i = 0; sc->sc_devs[i].ps_ca.ca_slot >= 0; i++) {
-
- if(sc->sc_devs[i].ps_ca.ca_name == NULL)
- continue; /* Empty slot */
-
- nca = &sc->sc_devs[i].ps_ca;
- nca->ca_bus = &sc->sc_bus;
-
- /* Tell the autoconfig machinery we've found the hardware. */
- config_found(self, nca, picaprint);
- }
-}
-
-int
-picaprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
- struct confargs *ca = aux;
-
- if (pnp)
- printf("%s at %s", ca->ca_name, pnp);
- printf(" slot %ld offset 0x%lx", ca->ca_slot, ca->ca_offset);
- return (UNCONF);
-}
-
-caddr_t
-pica_cvtaddr(ca)
- struct confargs *ca;
-{
- struct pica_softc *sc = pica_cd.cd_devs[0];
-
- return(sc->sc_devs[ca->ca_slot].ps_base + ca->ca_offset);
-
-}
-
-void
-pica_intr_establish(ca, handler, val)
- struct confargs *ca;
- intr_handler_t handler;
- void *val;
-{
- struct pica_softc *sc = pica_cd.cd_devs[0];
-
- int slot;
-
- slot = ca->ca_slot;
- if(slot == 0) { /* Slot 0 is special, clock */
- set_intr(INT_MASK_4, pica_clkintr, 1);
- }
-
- if(int_table[slot].int_mask != 0) {
- panic("pica intr already set");
- }
- else {
- int_table[slot].int_mask = sc->sc_devs[slot].ps_mask;;
- local_int_mask |= int_table[slot].int_mask;
- int_table[slot].int_hand = handler;
- int_table[slot].param = val;
- }
- out16(PICA_SYS_LB_IE, local_int_mask);
-}
-
-void
-pica_intr_disestablish(ca)
- struct confargs *ca;
-{
- int slot;
-
- slot = ca->ca_slot;
- if(slot != 0) { /* Slot 0 is special, clock */
- local_int_mask &= ~int_table[slot].int_mask;
- int_table[slot].int_mask = 0;
- int_table[slot].int_hand = pica_intrnull;
- int_table[slot].param = (void *)NULL;
- }
-}
-
-int
-pica_matchname(ca, name)
- struct confargs *ca;
- char *name;
-{
- return (strcmp(name, ca->ca_name) == 0);
-}
-
-int
-pica_intrnull(val)
- void *val;
-{
- panic("uncaught PICA intr for slot %d", val);
-}
-
-/*
- * Handle pica i/o interrupt.
- */
-int
-pica_iointr(mask, cf)
- unsigned mask;
- struct clockframe *cf;
-{
- int vector;
-
- while((vector = inb(PVIS) >> 2) != 0) {
- (*int_table[vector].int_hand)(int_table[vector].param);
- }
- return(~0); /* Dont reenable */
-}
-
-/*
- * Handle pica interval clock interrupt.
- */
-int
-pica_clkintr(mask, cf)
- unsigned mask;
- struct clockframe *cf;
-{
- int temp;
-
- temp = inw(R4030_SYS_IT_STAT);
- hardclock(cf);
-
- /* Re-enable clock interrupts */
- splx(INT_MASK_4 | SR_INT_ENAB);
-
- return(~INT_MASK_4); /* Keep clock interrupts enabled */
-}
-
diff --git a/sys/arch/arc/stand/Makefile b/sys/arch/arc/stand/Makefile
deleted file mode 100644
index fbe4ff31c14..00000000000
--- a/sys/arch/arc/stand/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 1997/05/19 09:35:24 pefo Exp $
-
-SUBDIR= mbr
-
-.include <bsd.subdir.mk>
diff --git a/sys/arch/arc/stand/libsa/Makefile b/sys/arch/arc/stand/libsa/Makefile
deleted file mode 100644
index d147171311d..00000000000
--- a/sys/arch/arc/stand/libsa/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-# $NetBSD: Makefile,v 1.5 1995/01/18 06:53:51 mellon Exp $
-# @(#)Makefile 8.2 (Berkeley) 2/16/94
-
-LIB= sa
-SRCS= alloc.c bcopy.c bzero.c close.c dev.c disklabel.c getfile.c \
- getputchar.c ioctl.c lseek.c open.c printf.c read.c ufs.c write.c \
- devopen.c getenv.c gets.c strcat.c strcmp.c strcpy.c strlen.c
-
-.PATH: ../../../../lib/libsa ../../../../lib/libkern
-NOPROFILE=noprofile
-
-.include <bsd.lib.mk>
-
-CFLAGS=-O2 -I../../include -I/sys -DSMALL
diff --git a/sys/arch/arc/stand/libsa/devopen.c b/sys/arch/arc/stand/libsa/devopen.c
deleted file mode 100644
index 79b35f8f595..00000000000
--- a/sys/arch/arc/stand/libsa/devopen.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* $NetBSD: devopen.c,v 1.5 1995/01/18 06:53:54 mellon Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)devopen.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <lib/libsa/stand.h>
-
-/*
- * Decode the string 'fname', open the device and return the remaining
- * file name if any.
- */
-devopen(f, fname, file)
- struct open_file *f;
- const char *fname;
- char **file; /* out */
-{
- register char *cp;
- register char *ncp;
- register struct devsw *dp;
- register int c, i;
- int ctlr = 0, unit = 0, part = 0;
- char namebuf[20];
- int rc;
-
- cp = fname;
- ncp = namebuf;
-
- /* expect a string like 'rz(0,0,0)vmunix' */
- while ((c = *cp) != '\0') {
- if (c == '(') {
- cp++;
- break;
- }
- if (ncp < namebuf + sizeof(namebuf) - 1)
- *ncp++ = c;
- cp++;
- }
-
- /* get controller number */
- if ((c = *cp) >= '0' && c <= '9') {
- ctlr = c - '0';
- c = *++cp;
- }
-
- if (c == ',') {
- /* get SCSI device number */
- if ((c = *++cp) >= '0' && c <= '9') {
- unit = c - '0';
- c = *++cp;
- }
-
- if (c == ',') {
- /* get partition number */
- if ((c = *++cp) >= '0' && c <= '9') {
- part = c - '0';
- c = *++cp;
- }
- }
- }
- if (c != ')')
- return (ENXIO);
- cp++;
- *ncp = '\0';
-
-#ifdef SMALL
- if (strcmp (namebuf, "rz")) {
- printf ("Unknown device: %s\n", namebuf);
- return ENXIO;
- }
- dp = devsw;
- i = 0;
-#else
- for (dp = devsw, i = 0; i < ndevs; dp++, i++)
- if (dp->dv_name && strcmp(namebuf, dp->dv_name) == 0)
- goto fnd;
- printf("Unknown device '%s'\nKnown devices are:", namebuf);
- for (dp = devsw, i = 0; i < ndevs; dp++, i++)
- if (dp->dv_name)
- printf(" %s", dp->dv_name);
- printf("\n");
- return (ENXIO);
-
-fnd:
-#endif
- rc = (dp->dv_open)(f, ctlr, unit, part);
- if (rc)
- return (rc);
-
- f->f_dev = dp;
- if (file && *cp != '\0')
- *file = cp;
- return (0);
-}
diff --git a/sys/arch/arc/stand/libsa/getenv.c b/sys/arch/arc/stand/libsa/getenv.c
deleted file mode 100644
index 7e063cd4ad5..00000000000
--- a/sys/arch/arc/stand/libsa/getenv.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $NetBSD: getenv.c,v 1.5 1995/01/18 06:53:55 mellon Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)getenv.c 8.1 (Berkeley) 6/10/93
- */
-
-char *
-getenv(s)
- char *s;
-{
-}
diff --git a/sys/arch/arc/stand/libsa/getputchar.c b/sys/arch/arc/stand/libsa/getputchar.c
deleted file mode 100644
index dbfae22d4d6..00000000000
--- a/sys/arch/arc/stand/libsa/getputchar.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* $NetBSD: getenv.c,v 1.5 1995/01/18 06:53:55 mellon Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)getenv.c 8.1 (Berkeley) 6/10/93
- */
-
-getchar()
-{
- char buf[4];
- int cnt;
-
- if(Bios_Read(0, &buf, 1, &cnt) != 0)
- return(-1);
- return(buf[0] & 255);
-}
-
-putchar(c)
-char c;
-{
- char buf[4];
- int cnt;
-
- if(c == '\n') {
- buf[0] = '\r';
- buf[1] = c;
- cnt = 2;
- }
- else {
- buf[0] = c;
- cnt = 1;
- }
- if(Bios_Write(1, &buf, cnt, &cnt) != 0)
- return(-1);
- return(0);
-}
diff --git a/sys/arch/arc/stand/mbr/Makefile b/sys/arch/arc/stand/mbr/Makefile
deleted file mode 100644
index 406e148d8cf..00000000000
--- a/sys/arch/arc/stand/mbr/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 1997/08/01 12:32:10 pefo Exp $
-
-CLEANFILES= mbr msdos5mb.gz
-
-all: mbr msdos5mb.gz
-
-mbr: mbr.uu
- uudecode ${.CURDIR}/mbr.uu
-
-msdos5mb.gz: msdos5mb.gz.uu
- uudecode ${.CURDIR}/msdos5mb.gz.uu
-
-realinstall:
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 mbr msdos5mb.gz \
- ${DESTDIR}/usr/mdec
-
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/arc/stand/mbr/mbr.uu b/sys/arch/arc/stand/mbr/mbr.uu
deleted file mode 100644
index ea442faa598..00000000000
--- a/sys/arch/arc/stand/mbr/mbr.uu
+++ /dev/null
@@ -1,15 +0,0 @@
-begin 644 mbr
-M,\#ZCM"\`'R.P([8^XOTOP`&N0`"_/.DZAT&``"P!+Z^!X`\@'0,@\80_LAU
-M]+Z]!NM#B_Z+%(M,`H/&$/[(=%=%5H(`````:6]M96=A+7II<```````````
-M`````````````````````@``(````$````!@``````@``````P``````````
-M`!`.`0``````````````````````````````````````````````````````
-M`````````````````````%=%5H+Y>@8``"`````@``````$``!`````$```'
-M"!````````````````````````#P`@``$`````0````(``````,````````$
-M````"```X`\``"``````````"``````P`@``T`````0```<($```````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M`````````````````````````````````````````````````````````0$`
-M`3\@!"````#@)P````````````````````````````````````````````"`
-1``$%IBO0Y``H``!P_1X`5:H`
-`
-end
diff --git a/sys/arch/arc/stand/mbr/msdos5mb.gz.uu b/sys/arch/arc/stand/mbr/msdos5mb.gz.uu
deleted file mode 100644
index d2dfc58b7b4..00000000000
--- a/sys/arch/arc/stand/mbr/msdos5mb.gz.uu
+++ /dev/null
@@ -1,208 +0,0 @@
-begin 644 msdos5mb.gz
-M'XL("&J`?#,"`V1O<P#MV/63D&7W,/"E)446EI!8"<DEEI:2;I;NEA0D=B56
-MED5!)%9:0"2DD6X%E@X7*0GI?`A9)*1#$;Z\KS]\WW_AG>?SF;GGG/O,/6?.
-M7-</UUSW[?(3ZS>I%M:D9.&B`0G?2A"0,"#AE;S/$P<$!WSXYOG7YP'YGP?U
-M#*P2%M8T^%\U*C<M%OHF_E5\Y_BC6P.B@I+%#@XHM:]T]N9!3794C-J<,N#E
-MHX5)<_Q<_=7;,6DR18VN_V),S81QR2I&_7TX,#RR^,ZR20.C/GTK)DU@U)@T
-MP5%STT8]>S\H*E'2K%&!0=G?Q#11(XX'+&@8-2:H<=2"VF]"W:A-P0'/WG\G
-M*B9[RJA$>VH]>Y0@:>VH$6_J`;$!26+>?#:O853\Y(#P;&L2Q*\("`^*^?O-
-M#-M_'_IH\8`4XX8%OWEYM/C33-OG#(WO$%!\Y^&@]CDF))Y0+>'AS"U;MKP=
-M'U,S2ZU:8[.GC@I]_>Q:HC>=`]]TC@U(MCE10,/&C>(_"`@_\Z9OTX!6K5N&
-MQR9)$/!FND1O!KEZ=6SA#%%C@W*_&:MVU+RZ47\$!/0+6)%BYZ?Y-Z2)319P
-M..WMA^6",D5%9'Y6*E/4J]VC@\*BBA]_5BI+U.B@/%$+ZD<]W_-BSX:$,4'U
-MH]8F/?Y[BE)A43$'OKKU?QJ.+94GZG#@GM0I&O3M$](D,N+3KI\$=^D9T2NX
-M;_B_L6MX>-_PU"D:=^W7N]-'78,[]>D2W"^\:T3$FRPRN%?7R.!!/;KV"0[O
-MVJE+9.H4`;7#_MVW)JV:_-_=_C<-"&BV[/GKUP$`P'\7YS\`_/?Y?W[JY/O?
-MZB=#U^3\-[L1_+\"`LJ_J:_)67YHM3?Q0J*`CF$6$```````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M`.#_<QVN5&K7,N;$N:(C&V<9&OM@ZL5YC:K]LG[P_;U?=]APZ,CB`UVNYR_6
-ML^W+IK_VCAF9^,O112>'#[TQ]_/C`S<WG[2V?]'[1]>L.9;YNXX!PR<GRY,S
-MT>US=Q(D"'M5]EZ&O9^7K9VW4HO$K1\W#CM2)_/Q\R_/O']O0-$YY5J]>#*T
-M5(&S)Q\O.[D\^_CU*]NU:Y'FZI2_=U5.=K;)[E5KUJ1,W>[*L855J];Z(;+(
-MX.C;N48UG;2E:OC^-AOB9OUS,?[>_A1CD^<)CHXY?W-2@CTI*IW9W"/IBX(7
-M8WHM>"?=BY%9DQ=X-.6;.5=+=@XM7*!`R+;5IU:]^L_I&IW?R_+3CO1=/ZQW
-MH=S<.0]W1=5<<&)8]N-9QL[LE7;FF`Q9UM[MV+-$1*9;MY?G'[_];(X5ZR>W
-M7-0IVYPB@^9_5F7=O05)+KQ]:VNMR.A1JQK6Z5VXWH;HAM%%!GX=W^K#@5O>
-M:51PZYE-9ZX4CNFW8NZ5-=E"EEV);1:0Z]2@!$__25RFS]T[!?)'M,[_XMG:
-M@A__G?[DO([Q/[5L^DV/+JG+A1RKM;ODL;.UF[=(>?/4J69-&^_^_6BS/_/U
-MBDS;Z+>3V9,.O'<[5>VE%7YMLGOGT0U)3^8;&1O5LD_<#PF3W5CRX=`3G^>:
-M=.5LR2EEOCA1,N+:SAK;=W5KEW#?IJF73KY\'?)TW=]CLVXZ6SE;O;[K&Y?Z
-MHUF%SXZ7;-#TR<I>*6KN.3:KW_@Z>;XOTBO=LD5_AO^4;\C&A5]-7C^C=63V
-MF-!9MT[6'7:W>LF0NW\."?XY\=5NOZWK-.&M56U3G)DZI.NEL$+?E6N[(.WH
-M7WJ6NIU_S)CD;99LNE]KZ<(9(^LVO1\\:^$_=^/V+?WU8/&.F6I<#(N/&S7W
-MB^9G]LXK.+;;_?&/!L1&W/MUU-I7&YH5WS!C6]RX.\<;-XI]\N7:`>=:'B_Q
-MGQXCZMQ]<31R?:D4>[_\X-<,XY_TO9+Y_K?14]*WF?%%[[P3'X0^';/ZHX(C
-MBL5^VNGM$Q]/K;WZQ1]]FP:]53?GR\"7]=Y9DZ;DM0UA[9:O6EDS?=F=<<VF
-MCVYR>%OHP(<#2M9=U#RZ2Y$D8]:&5)WU5Y]EEVZE_'I<EBRQJT,'33KP5>#0
-MK<'#TS9]%7YK6)=*&4[_W>EFHUV/]J9MON77T26FC=YV>];(Y]'I#N7.UVU'
-MFO.GEZU*-27)T9'+QJP>U[WRD9,??YMP9<.YU0<,.;_CW2&[-K19=JM0E@4_
-M+)VTO_V!AMDW]DMU]6*'@K=?G5O9/5_W_'/.S#Y\>D[-RAFWK!A0_$[\S-XA
-M"[ZJE^G9[/$/'_0.>O%>SO:1Y=)G6'VJT99LR=_YMEC?W54'5AQ>-.^@K><G
-MKUU>[^W0!?ES)>OQ1[$ZDQYW.U;Y^90QBUM]_-V/F4<\[U%KSNM:*6H7O+>N
-M7*7GS;Z*F?SHJWIA1:=/6'RHU)Z&*SJ'7EY^;6?F=`-SA,5?J_#]T^?-YW?N
-ML+=$]5+??]6^]-F=6R8?G#'JMW6A8;,>EZR8J?[H](&M#C5HO[S9FAV5L_;=
-M_^F^H[_EC'WW9N8U3^.JMOHL8?\L\3,&??'SU*.K6_3Z+M>=E?%KHI]?ZILS
-M;Y]^=T^4[/SH],[PJ?5OG[H^__?))?8_&7[C7*=4VWM<[7[SV90Z72(J5.S^
-M>_/C2\IGSU)X]]5+3Q.DV[V_RI$&O1Z=OSZFV.'4+5I-N1":XO2C$V=Z_O*Z
-MX>=IUF1^U"<PJDC0HD.K=LXNV:C)^)D'/W[4HF'XK<$QSS_ZN'BW)[E^?%A]
-M0?3G#<<.ZCF]VN,115;$]`]]_V#8K-?S)B[/7SS#C$DK1N;X*<OVW+46'BHP
-M)$&'66?G=(I>_G1)OK?CZQ;I,2&P_]YN]<[^\?7N_H%_U-J<-;IIYHPC2@17
-M[E.GWV=E.XR<EG#1G_,KU$A>-'/\M'\V/[Y0MFCVO_M$#PQYL3:T=Y(E'89L
-MWI6MU/,4R?JFZ?]GV9E9YHQO\/C6+X7+7[NY.W#"_JVG9I1XGB%HQ)*@K5U?
-M]!J7*,G%%NON'WRG6_$CA5I<&E;WK>Y7#X4F+[WH^_&?Y"J1JGFF^-:[[J^I
-M]/1&WV51X[:DRY^K1.N7?W\Q\VZ;%?T*G:CW[LENK1I]W'I9^=P#$C]_\%[Y
-MS?/[[CRRJG"1COT7W^LR\N&/S4/VG5J8KN3OHS)?ZY'I\,*FJ:)K'3K1IW>A
-M@Q,:Y9J6Z9T9-9?E[M6QZ,))Y1X$U_YL3]*;PVNM>S"L6Y$]\V=O>A76H,Q/
-M28K??[#B2)6_4B6H_F>VE`VZG*B0?$'NML^V%_QG;\Z74=$!4\)B!A]^.]7Y
-M<3,NSCRR=7&W_JU>'C[=/>.DA5.OOJY==M&LTA$EG[Q7MD_2_JOJ]#O6Y.NA
-M$366?%%K9:'%^[=E.GNL:-N=I5=5/WX]U:I6G7?<WSNG?^WR,Y\]G'KWV\_[
-MGGFKZ[GSB_XS(/[(RPF3+R5<]/K;C*/;[4R7I\G5]T^5'SX^2_^F/095W'_]
-M[_+?ERN2N,JQMJGGE+HW<$31SD/NUU^Z\5[-LA';EH][O&=OJK932ATL62)K
-MU?>#2DR:M&!;P-N]4F4)7%'ZPIF(SS]XW&7]MP<>G]T0__NEB17C6Y>LNN/F
-MR@/OUWT45R[TRHGR_4[U2'KPP:WPT!*1]5(/^OC9EYF&[KFT?V*"^:VO;8_[
-M:'V;_^3^H%],T>2W'CS.,3#!]AXUAE]:&!G5=,X'X[L7N%$W;O_.10^K_#QU
-MSYUA_2*+OKJ0*\.5@R^;]YF;<GKKT-_WYB^X\D'ASB^ZK^J^).>1X:UR%\C[
-MR_:7\U8G/)8Z4;E_%OY9L-RFIQ%U\VQ?_&W.D.XG2Z6[^4_V:V6NA`2_^\/Y
-MOWJ6O3$SW^(1M9=<>Q&>IF:A"[$9+Z6+N-$O]+/T20:\.M!HT99Q;0,3152,
-MSEF]W/'HC84V3)X4>_3<HO2?'FLUXLD[-\]/N3>MY<7VU0L^RW"X]K6):1>L
-MO)PK9,SUX7N.-[\[[)?@,H\^7!>8LV+*0@^S?CFAV(`:`X<GNIQE8YF0;<>?
-M'?GH=:V#G8Y]O;=UA473/VFRN$'/;ZL7>WXY3^HEC7[)WV%NV?5/#Q0X%S:D
-MR*ESK4]GVEDA;;$]@^-WI(\H?>VG=N]&_W"[3]&#D0\>?38EP8EAN>(^[]=\
-MR[);)=I,B*^4*6;QA,XOHTJ6#GJ^:V%`_177'HW*U[[P!^V&#D_W7M-/QQ\L
-MT/).Y*!".^8,Z%.Y6^B:IRUB]S7.\4&E$7DKG[UYJ/*0#N^.KEZDVT]99]],
-M-:/(L.,;,\T.WY-M5/9JTV].__"?D<M&?)HC/,VA'-$W[GWW58VN']R?5V_%
-MR._2C?QH]LN7C2=T>Y0P/%&2!N&=+RX86B#%M")/!X=N.O?7ZKBG7VXO,"_L
-M=+?QERN\:/U'3(8'WSTLGK'=\MN["L8\Z_A1:%"V;8^GW?YQ7,'XCJMCKT>G
-MO#?XP=:Y':)7SZS_8N;>&;>+%3U\/ZS6PSG1!39OWA\2\>I*S*3%15L&GIF=
-M;-K3ZOO:A*V._#C/QI`[]QJ'Y?FY]ZK7&2N$=([_-4'6:7T/'`R[.#7+F1R7
-MXWYH4^O!DZZWZDQ>T21V9\56'ZU_^6/>9T$-NJ3\-?N"CX9V^29-G]>=\P9F
-MGSQG1L(4N4:\KMBAT-9OVB8.O'WM3J)K>];''CP4DS5]H6K5.FU<G*K=W],F
-M-Z_3L$'#M^H?_^;PR//3DF2^.W+?J,H3FQY^-F#`QJE/@[:E*W6Z]$_3[W[_
-MY,G-"6<C!PQY]]VA`R('1?2-&-2_?_CE+K6F;ILZ>]S(D9\,_61`NW;UJ]>M
-M,W-+R)^M!U\LLVA(BT?7LV9MNSCA@;H':_]V;'_<%Q.29&[5+.,[*=]^.U&B
-M)(E?/O_GZJ'/H@(7/UGTUY"H7J^_O_+^T-VYK^S95+7:OGU[]]5\Z\>$%2K6
-M";L\Z*_1<?&%KTT^7^/ZXF;MNU9]]L/2GL^S/KT<=*+,]R<_&3=U_*P\&V<O
-M6K0Q;ORE<Y?C[FR.R'7KYW:/SYYMV7)7KRY-!S]=MG1ISPUU"]Y*T'C>W'(5
-M-T]L.V=(J[(GDK6<^+COC2JU:^ZON?CLEP^J)[]?[<*%W;NK#+P[9,70F_LS
-MI?R^S9-O8E]FK%2W;M(":=(DO][AP):@/'M^R9`Q6Y;04DM""F9,_E;'X_=O
-MU8_=<3?P98?![?M>2KG@[./&N;M\>.!D\^;7MHZ:_LUW:]9=&K)BTYR4S2L4
-MJA=V,_STL21?;1XSO<NJUD5.%<BR;O[\.3,/_UR]T]*O%R3_O4*95STC9Q1+
-M>NKU^1'%BA18W?*OB6FJ5$L;G+;]Z/VK4CTX/_9!PXE'&WXQ)&W8_2*QG9.5
-M.;/CPRVM+G2K6B5D3K)](V\$/!_0MM.FX_7;W8J\^/.0TG_%[?AM\X#R$4L:
-M'NW5<FO,@IX]ERR)'U;@C^6]EJ]:TCO'G=YWEZYX\M/Q"MG>/5CI?N<[$?<3
-M%W[1<5&2^/35DN?M=W[K_C(]7^1>OGI^H6Y/=I;?NK[BTWJYHK/]-C??_6)K
-MCPULU&)]W?/]CJUIV&_3B9#!#1M&%]K_WHC(7SK$77ZQZOTBSU)FB[ON!O3?
-+[7\`48/DYP#`3P!I
-`
-end
diff --git a/sys/arch/arm32/Makefile b/sys/arch/arm32/Makefile
deleted file mode 100644
index 4b3fb67f788..00000000000
--- a/sys/arch/arm32/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-# $NetBSD: Makefile,v 1.1 1996/01/31 23:14:53 mark Exp $
-# @(#)Makefile 7.3 (Berkeley) 6/9/91
-
-# Makefile for arm32 tags file and boot blocks
-
-NOPROG= noprog
-NOMAN= noman
-
-SUBDIR=
-
-TARM32= ../arm32/tags
-SARM32= ../arm32/arm32/*.[ch] ../arm32/include/*.h ../arm32/dev/*.[ch] \
- ../arm32/podulebus/*.[ch] ../arm32/mainbus/*.[ch]
-AARM32= ../arm32/arm32/*.s
-
-# Directories in which to place arm32 tags links
-DARM32= dev mainbus podulebus include
-
-tags:
- -ctags -dtf ${TARM32} ${COMM} ${SARM32}
- egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${AARM32} | \
- sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
- >> ${TARM32}
- sort -o ${TARM32} ${TARM32}
-
-links:
- -for i in ${DARM32}; do \
- cd $$i && rm -f tags; ln -s ../tags tags; done
-
-obj: _SUBDIRUSE
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/arm32/arm32/ast.c b/sys/arch/arm32/arm32/ast.c
deleted file mode 100644
index faddfb23c1a..00000000000
--- a/sys/arch/arm32/arm32/ast.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* $NetBSD: ast.c,v 1.2 1996/03/08 18:54:55 mark Exp $ */
-
-/*
- * Copyright (c) 1994,1995 Mark Brinicombe
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD team.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTERS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * ast.c
- *
- * Code to handle ast's and returns to user mode
- *
- * Created : 11/10/94
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/user.h>
-#include <sys/acct.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/signal.h>
-#include <machine/cpu.h>
-#include <machine/frame.h>
-#include <machine/katelib.h>
-#include <machine/psl.h>
-
-int want_resched = 0;
-
-void
-userret(p, pc, oticks)
- register struct proc *p;
- int pc;
- u_quad_t oticks;
-{
- int sig, s;
-
- if (p == NULL)
- panic("userret: p=0 curproc=%08x", curproc);
-
-#ifdef DIAGNOSTIC
- if ((GetCPSR() & PSR_MODE) != PSR_SVC32_MODE) {
- traceback();
- panic("userret called in non SVC mode !");
- }
-
- if (current_spl_level != SPL_0)
- printf("WARNING: (1) current spl level=%d\n", current_spl_level);
-#endif
-
-/* take pending signals */
-
- while ((sig = (CURSIG(p))) != 0) {
- postsig(sig);
- }
-
- p->p_priority = p->p_usrpri;
-
-/*
- * Check for reschedule request
- */
-
- if (want_resched) {
- /*
- * Since we are curproc, a clock interrupt could
- * change our priority without changing run queues
- * (the running process is not kept on a run queue).
- * If this happened after we setrunqueue ourselves but
- * before we switch()'ed, we might not be on the queue
- * indicated by our priority
- */
-
- s = splstatclock();
- setrunqueue(p);
- p->p_stats->p_ru.ru_nivcsw++;
-
- mi_switch();
-
- (void)splx(s);
- while ((sig = (CURSIG(p))) != 0) {
- postsig(sig);
- }
- }
-
-/*
- * Not sure if this profiling bit is working yet ... Not been tested
- */
-
- if (p->p_flag & P_PROFIL) {
- extern int psratio;
- addupc_task(p, pc, (int)(p->p_sticks - oticks) * psratio);
- }
-
- curpriority = p->p_priority;
-
-#ifdef DIAGNOSTIC
- if (current_spl_level != SPL_0)
- printf("WARNING: (2) current spl level=%d\n", current_spl_level);
-#endif
-}
-
-
-/*
- * void ast(trapframe_t *frame)
- *
- * Handle asynchronous system traps.
- * This is called from the irq handler to deliver signals
- * and switch processes if required.
- * userret() does all the signal delivery and process switching work
- */
-
-void
-ast(frame)
- trapframe_t *frame;
-{
- register struct proc *p;
-
- cnt.v_trap++;
-
- if ((p = curproc) == 0)
- p = &proc0;
- if (&p->p_addr->u_pcb == 0)
- panic("ast: nopcb!");
-
- cnt.v_soft++;
- if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
- ADDUPROF(p);
- }
-#ifdef VALIDATE_TRAPFRAME
- validate_trapframe(frame, 3);
-#endif
-
- userret(p, frame->tf_pc, p->p_sticks);
-
-#ifdef VALIDATE_TRAPFRAME
- validate_trapframe(frame, 3);
-#endif
-}
-
-/* End of ast.c */
diff --git a/sys/arch/arm32/arm32/autoconf.c b/sys/arch/arm32/arm32/autoconf.c
deleted file mode 100644
index 8ce5b86ba6d..00000000000
--- a/sys/arch/arm32/arm32/autoconf.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/* $NetBSD: autoconf.c,v 1.2 1996/03/06 23:11:36 mark Exp $ */
-
-/*
- * Copyright (c) 1994,1995 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * autoconf.c
- *
- * Autoconfiguration functions
- *
- * Created : 08/10/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/reboot.h>
-#include <sys/disklabel.h>
-#include <sys/device.h>
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-
-#include <machine/irqhandler.h>
-#include <machine/bootconfig.h>
-
-#include "wdc.h"
-#include "fdc.h"
-#include "rd.h"
-#include "sd.h"
-#include "cd.h"
-#include "wcd.h"
-
-extern dev_t rootdev;
-extern dev_t swapdev;
-extern dev_t dumpdev;
-extern dev_t argdev;
-
-extern struct swdevt swdevt[];
-
-extern char *boot_args;
-extern int pmap_debug_level;
-
-char * strstr __P((char */*s1*/, char */*s2*/));
-long strtoul __P((const char *, char **, int));
-
-/* Table major numbers for the device names, NULL terminated */
-
-struct {
- char *name;
- dev_t dev;
-} rootdevices[] = {
-#if NWDC > 0
- { "wd", 0x10 },
-#endif
-#if NFDC > 0
- { "fd", 0x11 },
-#endif
-#if NRD > 0
- { "rd", 0x12 },
-#endif
-#if NSD > 0
- { "sd", 0x18 },
-#endif
-#if NCD > 0
- { "cd", 0x1a },
-#endif
-#if NWCD > 0
- { "wcd", 0x14 },
-#endif
- { NULL, 0x00 },
-};
-
-/* Decode a device name to a major and minor number */
-
-dev_t
-get_device(name)
- char *name;
-{
- int loop;
- int unit;
- int part;
-
- if (strncmp(name, "/dev/", 5) == 0)
- name += 5;
-
- for (loop = 0; rootdevices[loop].name; ++loop) {
- if (strncmp(name, rootdevices[loop].name,
- strlen(rootdevices[loop].name)) == 0) {
- name += strlen(rootdevices[loop].name);
- unit = name[0] - '0';
- part = name[1] - 'a';
- if (unit < 0 || unit > 9)
- return(NODEV);
- if (part < 0 || part > MAXPARTITIONS)
- return(NODEV);
- return(makedev(rootdevices[loop].dev,
- unit * MAXPARTITIONS + part));
- }
- }
- return(NODEV);
-}
-
-
-/* Set the rootdev variable from the root specifier in the boot args */
-
-void
-set_root_device()
-{
- char *ptr;
-
- if (boot_args) {
- ptr = strstr(boot_args, "root=");
- if (ptr) {
- ptr += 5;
- rootdev = get_device(ptr);
-
- if (pmap_debug_level >= 0)
- printf("rootdev = %08x\n", rootdev);
- }
- }
-
- if (rootdev == NODEV)
- panic("No root device specified in boot config");
-}
-
-
-/* Set the swap devices from the swap specifiers in the boot ars */
-
-void
-set_swap_device()
-{
- char *ptr;
- int nswap = 0;
-
- if (boot_args) {
- ptr = boot_args;
- do {
- ptr = strstr(ptr, "swap=");
- if (ptr) {
- ptr += 5;
- swdevt[nswap].sw_dev = get_device(ptr);
-
- /*
- * Remember the first swap device
- */
-
- if (nswap == 0)
- swapdev = get_device(ptr);
- ++nswap;
- }
- } while (ptr);
- }
-}
-
-
-/*
- * Configure swap space and related parameters.
- */
-
-void
-swapconf()
-{
- register struct swdevt *swp;
- register int nblks;
- int swapsize = -1;
- char *ptr;
- int maj;
- int s; /* The spl stuff was here for debugging reaons */
-
- /*
- * Loop round all the defined swap device configuring them.
- */
-
- for (swp = swdevt; swp->sw_dev != NODEV; swp++) {
- maj = major(swp->sw_dev);
- if (maj > nblkdev)
- break;
- if (bdevsw[maj].d_psize) {
- s = spltty();
- printf("swap dev %04x ", swp->sw_dev);
- (void)splx(s);
- if (swapsize == -1)
- nblks = (*bdevsw[maj].d_psize)(swp->sw_dev);
- else
- nblks = swapsize;
- s = spltty();
- if (nblks == -1)
- printf("-> device not configured for swap\n");
- else
- printf("-> %d bytes\n", nblks*DEV_BSIZE);
- (void)splx(s);
- if (nblks != -1 &&
- (swp->sw_nblks == 0 || swp->sw_nblks > nblks))
- swp->sw_nblks = nblks;
- swp->sw_nblks = ctod(dtoc(swp->sw_nblks));
- }
- }
-}
-
-
-/* Set up the root and swap device numbers, configure the swap space and dump space */
-
-void
-set_boot_devs()
-{
- set_root_device();
- set_swap_device();
-
- if (swapdev == NODEV && minor(rootdev) < (MAXPARTITIONS - 2))
- swapdev = makedev(major(rootdev), minor(rootdev) + 1);
-
- dumpdev = swapdev;
- argdev = swapdev;
- swdevt[0].sw_dev = swapdev;
-
- swapconf();
- dumpconf();
-}
-
-
-/*
- * void configure()
- *
- * Configure all the root devices
- * The root devices are expected to configure their own children
- */
-
-void
-configure()
-{
-
-/*
- * Loop round all the root devices configuring them. Configure failure
- * is not expected for the root devices
- */
-
- config_rootfound("mainbus", NULL);
- config_rootfound("podulebus", NULL);
-
-/* Debugging information */
-
- printf("ipl_bio=%08x ipl_net=%08x ipl_tty=%08x ipl_clock=%08x ipl_imp=%08x\n",
- irqmasks[IPL_BIO], irqmasks[IPL_NET], irqmasks[IPL_TTY],
- irqmasks[IPL_CLOCK], irqmasks[IPL_IMP]);
-
-/* Time to start taking interrupts so lets open the flood gates .... */
-
- (void)spl0();
-}
-
-/* End of autoconf.c */
diff --git a/sys/arch/arm32/arm32/bcopy.S b/sys/arch/arm32/arm32/bcopy.S
deleted file mode 100644
index d2092567df5..00000000000
--- a/sys/arch/arm32/arm32/bcopy.S
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $OpenBSD: bcopy.S,v 1.2 2000/03/03 00:54:46 todd Exp $ */
-/* $NetBSD: bcopy.S,v 1.1 1996/01/31 23:15:12 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- * Copyright (c) 1995 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * memset.S
- *
- * optimized memset function
- *
- * Created : 16/05/95
- * Last updated : 16/05/95
- *
- */
-
-sp .req r13
-lr .req r14
-pc .req r15
-
-.text
- .global _bcopy
- .global _ovbcopy
-
-_bcopy:
-_ovbcopy:
- teq r2, #0x00000000
- moveq r0, #0x00000000
- moveq pc, lr
- cmp r0, r1
- blt bcopy_back
-
-bcopy_loop:
- ldrb r3, [r0], #0x0001
- strb r3, [r1], #0x0001
- subs r2, r2, #0x00000001
- bne bcopy_loop
-
- mov pc, r14
-
-bcopy_back:
- add r0, r0, r2
- add r1, r1, r2
-
-bcopy_bloop:
- ldrb r3, [r0, #-0x0001]!
- strb r3, [r1, #-0x0001]!
- subs r2, r2, #0x00000001
- bne bcopy_bloop
-
- mov pc, r14
-
-
- .global _memcpy
-
-_memcpy:
- teq r2, #0x00000000
- moveq r0, #0x00000000
- moveq pc, lr
- cmp r1, r0
- blt memcpy_back
-
-memcpy_loop:
- ldrb r3, [r1], #0x0001
- strb r3, [r0], #0x0001
- subs r2, r2, #0x00000001
- bne memcpy_loop
-
- mov pc, r14
-
-memcpy_back:
- add r0, r0, r2
- add r1, r1, r2
-
-memcpy_bloop:
- ldrb r3, [r1, #-0x0001]!
- strb r3, [r0, #-0x0001]!
- subs r2, r2, #0x00000001
- bne memcpy_bloop
-
- mov pc, r14
diff --git a/sys/arch/arm32/arm32/bcopy_page.S b/sys/arch/arm32/arm32/bcopy_page.S
deleted file mode 100644
index c1f3d895b60..00000000000
--- a/sys/arch/arm32/arm32/bcopy_page.S
+++ /dev/null
@@ -1,150 +0,0 @@
-/* $OpenBSD: bcopy_page.S,v 1.2 2000/03/03 00:54:46 todd Exp $ */
-/* $NetBSD: bcopy_page.S,v 1.1 1996/01/31 23:15:17 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Scott Stevens
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Scott Stevens.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * bcopy_page.S
- *
- * page optimised bcopy and bzero routines
- *
- * Created : 08/04/95
- * Last updated : 12/05/95
- *
- */
-
-#include <machine/param.h>
-
-/* TODO:
- *
- * Use r2 as the counter so that r3-r10 can be used instead of r4-r11
- * This means r11 will not need to be pushed on the stack.
- */
-
-/* bcopy_page(src, dest)
- * r0 - src
- * r1 - dest
- * number of bytes (NBPG) is a multiple of 512
- */
-
- .global _bcopy_page
-_bcopy_page:
- mov r3, #(NBPG >> 9)
-
- STMFD r13!, {r4-r11, r14}
-
-loopcopy:
- ldmia r0!, {r4-r11}
- stmia r1!, {r4-r11}
- ldmia r0!, {r4-r11}
- stmia r1!, {r4-r11}
- ldmia r0!, {r4-r11}
- stmia r1!, {r4-r11}
- ldmia r0!, {r4-r11}
- stmia r1!, {r4-r11}
-
- ldmia r0!, {r4-r11}
- stmia r1!, {r4-r11}
- ldmia r0!, {r4-r11}
- stmia r1!, {r4-r11}
- ldmia r0!, {r4-r11}
- stmia r1!, {r4-r11}
- ldmia r0!, {r4-r11}
- stmia r1!, {r4-r11}
-
- ldmia r0!, {r4-r11}
- stmia r1!, {r4-r11}
- ldmia r0!, {r4-r11}
- stmia r1!, {r4-r11}
- ldmia r0!, {r4-r11}
- stmia r1!, {r4-r11}
- ldmia r0!, {r4-r11}
- stmia r1!, {r4-r11}
-
- ldmia r0!, {r4-r11}
- stmia r1!, {r4-r11}
- ldmia r0!, {r4-r11}
- stmia r1!, {r4-r11}
- ldmia r0!, {r4-r11}
- stmia r1!, {r4-r11}
- ldmia r0!, {r4-r11}
- stmia r1!, {r4-r11}
-
- subs r3, r3, #1
- bgt loopcopy
-
- ldmfd r13!, {r4-r11, r15}
-
-/* bzero_page(dest)
- * r0 - dest
- * number of bytes is a multiple of 512
- */
-
- .global _bzero_page
-_bzero_page:
- mov r3, #(NBPG >> 9)
-
- stmfd r13!, {r4-r11, r14}
-
- mov r4, #0
- mov r5, #0
- mov r6, #0
- mov r7, #0
- mov r8, #0
- mov r9, #0
- mov r10, #0
- mov r11, #0
-
-loopzero:
- stmia r0!, {r4-r11}
- stmia r0!, {r4-r11}
- stmia r0!, {r4-r11}
- stmia r0!, {r4-r11}
-
- stmia r0!, {r4-r11}
- stmia r0!, {r4-r11}
- stmia r0!, {r4-r11}
- stmia r0!, {r4-r11}
-
- stmia r0!, {r4-r11}
- stmia r0!, {r4-r11}
- stmia r0!, {r4-r11}
- stmia r0!, {r4-r11}
-
- stmia r0!, {r4-r11}
- stmia r0!, {r4-r11}
- stmia r0!, {r4-r11}
- stmia r0!, {r4-r11}
-
- subs r3, r3, #1
- bgt loopzero
-
- ldmfd r13!, {r4-r11, r15}
diff --git a/sys/arch/arm32/arm32/bcopyinout.S b/sys/arch/arm32/arm32/bcopyinout.S
deleted file mode 100644
index b119f256482..00000000000
--- a/sys/arch/arm32/arm32/bcopyinout.S
+++ /dev/null
@@ -1,132 +0,0 @@
-/* $OpenBSD: bcopyinout.S,v 1.2 2000/03/03 00:54:46 todd Exp $ */
-/* $NetBSD: bcopyinout.S,v 1.3 1996/02/02 18:05:47 mycroft Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- * Copyright (c) 1995 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * bcopyinout.S
- *
- * optimized and fault protected copyinout function
- *
- * Created : 16/05/95
- * Last updated : 16/05/95
- *
- */
-
-#include "assym.h"
-#include <sys/errno.h>
-
-sp .req r13
-lr .req r14
-pc .req r15
-
-.text
-Lcurpcb:
- .word _curpcb
-
-Lcurproc:
- .word _curproc
-
-bcopyinoutfault:
- mov r0, #0x00000000
- str r0, [r4, #PCB_ONFAULT]
- mov r0, #EFAULT
- ldmfd sp!, {r4}
- mov pc, lr
-
-bcopyinoutpcbfault:
- stmfd sp!, {lr}
- mov r3, r1
- mov r1, r4
- add r0, pc, #bcopyinouttext - . - 8
- mov r2, r3
- ldr r3, Lcurproc
- ldr r3, [r3]
- bl _printf
- mov r0, #EFAULT
- ldmfd sp!, {lr}
- ldmfd sp!, {r4}
- mov pc, lr
-
-bcopyinouttext:
- .asciz "Alert ! PCB = %08x during bcopyinout addr=%08x curproc=%08x\n"
-
- .align 0
-
- .global _bcopyinout
-
-_bcopyinout:
- teq r2, #0x00000000
- moveq r0, #0x000000000
- moveq pc,lr
-
- stmfd sp!, {r4}
- ldr r4, Lcurpcb
- ldr r4, [r4]
- teq r4, #0x00000000
- beq bcopyinoutpcbfault
- add r3, pc, #bcopyinoutfault - . - 8
- str r3, [r4, #PCB_ONFAULT]
-
- cmp r0, r1
- blt bcopy_back
-
-bcopy_loop:
- ldrb r3, [r0], #0x0001
- strb r3, [r1], #0x0001
- subs r2, r2, #0x00000001
- bne bcopy_loop
-
- mov r0, #0x00000000
- str r0, [r4, #PCB_ONFAULT]
- ldmfd sp!, {r4}
- mov pc, lr
-
-bcopy_back:
- add r0, r0, r2
- add r1, r1, r2
-
-bcopy_bloop:
- ldrb r3, [r0, #-0x0001]!
- strb r3, [r1, #-0x0001]!
- subs r2, r2, #0x00000001
- bne bcopy_bloop
-
- mov r0, #0x00000000
- str r0, [r4, #PCB_ONFAULT]
- ldmfd sp!, {r4}
- mov pc, r14
-
diff --git a/sys/arch/arm32/arm32/blockio.S b/sys/arch/arm32/arm32/blockio.S
deleted file mode 100644
index ae69bfe3847..00000000000
--- a/sys/arch/arm32/arm32/blockio.S
+++ /dev/null
@@ -1,312 +0,0 @@
-/* $OpenBSD: blockio.S,v 1.2 2000/03/03 00:54:46 todd Exp $ */
-/* $NetBSD: blockio.S,v 1.1 1996/01/31 23:15:22 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * blockio.S
- *
- * optimised block read/write from/to IO routines.
- *
- * Created : 08/10/94
- * Last updated : 12/05/95
- *
- */
-
-sp .req r13
-lr .req r14
-pc .req r15
-
-.text
-
- .global _insw
-/*
- * Reads short ints (16 bits) from an I/O address into a block of memory
- *
- * r0 = address to read from (IO)
- * r1 = address to write to (memory)
- * r2 = length
- */
-
-_insw:
-/* Make sure that we have a positive length */
- cmp r2, #0x00000000
- movle pc, lr
-
-/* If the destination address and the size is word aligned, do it fast */
-
- tst r2, #0x00000001
- tsteq r1, #0x00000003
- beq fastinsw
-
-/* Non aligned insw */
-
-inswloop:
- ldr r3, [r0]
- strb r3, [r1], #0x0001
- mov r3, r3, lsr #8
- strb r3, [r1], #0x0001
- subs r2, r2, #0x00000001
- bgt inswloop
-
- mov pc, lr
-
-/* Word aligned insw */
-
-fastinsw:
- stmfd r13!, {r4}
-
-fastinswloop:
- ldr r3, [r0, #0x0002] /* take advantage of nonaligned
- * word accesses */
- ldr r4, [r0]
- mov r3, r3, lsr #16 /* Put the two shorts together */
- orr r3, r3, r4, lsl #16
- str r3, [r1], #0x0004 /* Store */
- subs r2, r2, #0x00000002 /* Next */
- bgt fastinswloop
-
- ldmfd r13!, {r4}
-
- mov pc, lr
-
-
- .global _outsw
-
-/*
- * Writes short ints (16 bits) from a block of memory to an I/O address
- *
- * r0 = address to write to (IO)
- * r1 = address to read from (memory)
- * r2 = length
- */
-
-_outsw:
-/* Make sure that we have a positive length */
- cmp r2, #0x00000000
- movle pc, lr
-
-#ifdef notyet
-
-/*
- * The optimised routines have not been tested yet and I don't feel
- * like testing the new write code on 2.8 Gig of valuable data.
- * Need to wait until I hang another HD on my machine
- */
-
-/* If the destination address and the size is word aligned, do it fast */
-
- tst r2, #0x00000001
- tsteq r1, #0x00000003
- beq fastoutsw
-#endif
-
-/* Non aligned outsw */
-
- stmfd sp!, {r4}
-
-outswloop:
- ldrb r3, [r1], #0x0001
- ldrb r4, [r1], #0x0001
- orr r3, r3, r4, lsl #8
- orr r3, r3, r3, lsl #16
- str r3, [r0]
- subs r2, r2, #0x00000001
- bgt outswloop
-
- ldmfd sp!, {r4}
-
- mov pc, lr
-
-#ifdef notyet
-/* Word aligned outsw */
-
-fastoutsw:
- stmfd r13!, {r4}
-
-fastoutswloop:
- ldr r3, [r1], #0x0004
-
- mov r4, r3, lsl #16
- orr r4, r4, lsr #16
- str r4, [r0]
-
- mov r4, r3, lsr #16
- orr r4, r4, lsl #16
- str r4, [r0]
-
- subs r2, r2, #0x00000002
- bgt outswloop
-
- ldmfd sp!, {r4}
-
- mov pc, lr
-#endif
-
- .global _insw16
-/*
- * reads short ints (16 bits) from an I/O address into a block of memory
- * with a length garenteed to be a multiple of 16 bytes
- * with a word aligned destination address
- *
- * r0 = address to read from (IO)
- * r1 = address to write to (memory)
- * r2 = length
- */
-
-_insw16:
-/* Make sure that we have a positive length */
- cmp r2, #0x00000000
- movle pc, lr
-
-/* If the destination address and the size is word aligned, do it fast */
-
- tst r2, #0x0000000f
- tsteq r1, #0x00000003
-
- bne _insw
-
-/* Word aligned insw */
-
- stmfd r13!, {r4-r7}
-
-insw16loop:
- ldr r3, [r0, #0x0002] /* take advantage of nonaligned
- * word accesses */
- ldr r7, [r0]
- mov r3, r3, lsr #16 /* Put the two shorts together */
- orr r3, r3, r7, lsl #16
-
- ldr r4, [r0, #0x0002] /* take advantage of nonaligned
- * word accesses */
- ldr r7, [r0]
- mov r4, r4, lsr #16 /* Put the two shorts together */
- orr r4, r4, r7, lsl #16
-
- ldr r5, [r0, #0x0002] /* take advantage of nonaligned
- * word accesses */
- ldr r7, [r0]
- mov r5, r5, lsr #16 /* Put the two shorts together */
- orr r5, r5, r7, lsl #16
-
- ldr r6, [r0, #0x0002] /* take advantage of nonaligned
- * word accesses */
- ldr r7, [r0]
- mov r6, r6, lsr #16 /* Put the two shorts together */
- orr r6, r6, r7, lsl #16
-
- stmia r1!, {r3-r6}
- subs r2, r2, #0x00000008 /* Next */
- bgt insw16loop
-
- ldmfd r13!, {r4-r7}
-
- mov pc, lr
-
-
-#ifdef notyet
-/*
- * The optimised routines have not been tested yet and I don't feel
- * like testing the new write code on 2.8 Gig of valuable data.
- * Need to wait until I hang another HD on my machine
- */
- .global _outsw16
-/*
- * Writes short ints (16 bits) from a block of memory to an I/O address
- *
- * r0 = address to write to (IO)
- * r1 = address to read from (memory)
- * r2 = length
- */
-
-_outsw16:
-/* Make sure that we have a positive length */
- cmp r2, #0x00000000
- movle pc, lr
-
-/* If the destination address and the size is word aligned, do it fast */
-
- tst r2, #0x0000000f
- tsteq r1, #0x00000003
-
- bne _outsw
-
-/* Word aligned outsw */
-
- stmfd r13!, {r4-r8}
-
-outsw16loop:
- ldmia r1!, {r4-r8}
-
- mov r3, r4, lsl #16
- orr r3, r3, lsr #16
- str r3, [r0]
-
- mov r3, r4, lsr #16
- orr r3, r4, lsl #16
- str r3, [r0]
-
- mov r3, r5, lsl #16
- orr r3, r3, lsr #16
- str r3, [r0]
-
- mov r3, r5, lsr #16
- orr r3, r4, lsl #16
- str r3, [r0]
-
- mov r3, r6, lsl #16
- orr r3, r3, lsr #16
- str r3, [r0]
-
- mov r3, r6, lsr #16
- orr r3, r4, lsl #16
- str r3, [r0]
-
- mov r3, r7, lsl #16
- orr r3, r3, lsr #16
- str r3, [r0]
-
- mov r3, r7, lsr #16
- orr r3, r4, lsl #16
- str r3, [r0]
-
- subs r2, r2, #0x00000008
- bgt outsw16loop
-
- ldmfd sp!, {r4-r8}
-
- mov pc, lr
-#endif
diff --git a/sys/arch/arm32/arm32/clock.c b/sys/arch/arm32/arm32/clock.c
deleted file mode 100644
index 41d70681f00..00000000000
--- a/sys/arch/arm32/arm32/clock.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/* $NetBSD: clock.c,v 1.4 1996/04/19 19:39:17 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1996 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * clock.c
- *
- * Timer related machine specific code
- *
- * Created : 29/09/94
- */
-
-/* Include header files */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/time.h>
-
-#include <machine/katelib.h>
-#include <machine/iomd.h>
-#include <machine/irqhandler.h>
-#include <machine/cpu.h>
-#include <machine/rtc.h>
-
-#define TIMER0_COUNT 20000 /* 100Hz */
-#define TIMER_FREQUENCY 20000000 /* 2MHz clock */
-#define TICKS_PER_MICROSECOND (TIMER_FREQUENCY / 10000000)
-
-static irqhandler_t clockirq;
-static irqhandler_t statclockirq;
-
-
-/*
- * int clockhandler(struct clockframe *frame)
- *
- * Function called by timer 0 interrupts. This just calls
- * hardclock(). Eventually the irqhandler can call hardclock() directly
- * but for now we use this function so that we can debug IRQ's
- */
-
-int
-clockhandler(frame)
- struct clockframe *frame;
-{
- hardclock(frame);
- return(1);
-}
-
-
-/*
- * int statclockhandler(struct clockframe *frame)
- *
- * Function called by timer 1 interrupts. This just calls
- * statclock(). Eventually the irqhandler can call statclock() directly
- * but for now we use this function so that we can debug IRQ's
- */
-
-int
-statclockhandler(frame)
- struct clockframe *frame;
-{
- statclock(frame);
- return(1);
-}
-
-
-/*
- * void setstatclockrate(int hz)
- *
- * Set the stat clock rate. The stat clock uses timer1
- */
-
-void
-setstatclockrate(hz)
- int hz;
-{
- int count;
-
- count = TIMER_FREQUENCY / hz;
-
- printf("Setting statclock to %dHz (%d ticks)\n", hz, count);
-
- WriteByte(IOMD_T1LOW, (count >> 0) & 0xff);
- WriteByte(IOMD_T1HIGH, (count >> 8) & 0xff);
-
-/* reload the counter */
-
- WriteByte(IOMD_T1GO, 0);
-}
-
-
-/*
- * void cpu_initclocks(void)
- *
- * Initialise the clocks.
- * This sets up the two timers in the IOMD and installs the IRQ handlers
- *
- * NOTE: Currently only timer 0 is setup and the IRQ handler is not installed
- */
-
-void
-cpu_initclocks()
-{
-/*
- * Load timer 0 with count down value
- * This timer generates 100Hz interrupts for the system clock
- */
-
- printf("clock: hz=%d stathz = %d profhz = %d\n", hz, stathz, profhz);
-
- WriteByte(IOMD_T0LOW, (TIMER0_COUNT >> 0) & 0xff);
- WriteByte(IOMD_T0HIGH, (TIMER0_COUNT >> 8) & 0xff);
-
-/* reload the counter */
-
- WriteByte(IOMD_T0GO, 0);
-
- clockirq.ih_func = clockhandler;
- clockirq.ih_arg = 0;
- clockirq.ih_level = IPL_CLOCK;
- clockirq.ih_name = "TMR0 hard clk";
- if (irq_claim(IRQ_TIMER0, &clockirq) == -1)
- panic("Cannot installer timer 0 IRQ handler");
-
- if (stathz) {
- setstatclockrate(stathz);
-
- statclockirq.ih_func = statclockhandler;
- statclockirq.ih_arg = 0;
- statclockirq.ih_level = IPL_CLOCK;
- if (irq_claim(IRQ_TIMER1, &clockirq) == -1)
- panic("Cannot installer timer 1 IRQ handler");
- }
-}
-
-
-/*
- * void microtime(struct timeval *tvp)
- *
- * Fill in the specified timeval struct with the current time
- * accurate to the microsecond.
- */
-
-void
-microtime(tvp)
- struct timeval *tvp;
-{
- int s;
- int tm;
- int deltatm;
- static int oldtm;
- static struct timeval oldtv;
-
- s = splhigh();
-
-/*
- * Latch the current value of the timer and then read it. This garentees
- * an atmoic reading of the time.
- */
-
- WriteByte(IOMD_T0LATCH, 0);
- tm = ReadByte(IOMD_T0LOW) + (ReadByte(IOMD_T0HIGH) << 8);
- deltatm = tm - oldtm;
- if (deltatm < 0) deltatm += TIMER0_COUNT;
- if (deltatm < 0) {
- printf("opps deltatm < 0 tm=%d oldtm=%d deltatm=%d\n",
- tm, oldtm, deltatm);
- }
- oldtm = tm;
-
-/* Fill in the timeval struct */
-
- *tvp = time;
- tvp->tv_usec += (deltatm / TICKS_PER_MICROSECOND);
-
-/* Make sure the micro seconds don't overflow. */
-
- while (tvp->tv_usec >= 1000000) {
- tvp->tv_usec -= 1000000;
- ++tvp->tv_sec;
- }
-
-/* Make sure the time has advanced. */
-
- if (tvp->tv_sec == oldtv.tv_sec &&
- tvp->tv_usec <= oldtv.tv_usec) {
- tvp->tv_usec = oldtv.tv_usec + 1;
- if (tvp->tv_usec >= 1000000) {
- tvp->tv_usec -= 1000000;
- ++tvp->tv_sec;
- }
- }
-
-
- oldtv = *tvp;
- (void)splx(s);
-}
-
-
-void
-need_proftick(p)
- struct proc *p;
-{
-}
-
-
-static inline int
-yeartoday(year)
- int year;
-{
- return((year % 4) ? 365 : 366);
-}
-
-
-static int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-static int timeset = 0;
-
-#define SECPERDAY (24*60*60)
-#define SECPERNYEAR (365*SECPERDAY)
-#define SECPER4YEARS (4*SECPERNYEAR+SECPERDAY)
-#define EPOCHYEAR 1970
-
-/*
- * Write back the time of day to the rtc
- */
-
-void
-resettodr()
-{
- int s;
- time_t year, mon, day, hour, min, sec;
- rtc_t rtc;
-
- if (!timeset)
- return;
-
- sec = time.tv_sec;
- year = (sec / SECPER4YEARS) * 4;
- sec %= SECPER4YEARS;
-
- /* year now hold the number of years rounded down 4 */
-
- while (sec > (yeartoday(EPOCHYEAR+year) * SECPERDAY)) {
- sec -= yeartoday(EPOCHYEAR+year)*SECPERDAY;
- year++;
- }
-
- /* year is now a correct offset from the EPOCHYEAR */
-
- year+=EPOCHYEAR;
- mon=0;
- if (yeartoday(year) == 366)
- month[1]=29;
- else
- month[1]=28;
- while ((sec/SECPERDAY) > month[mon]) {
- sec -= month[mon]*SECPERDAY;
- mon++;
- }
-
- day = sec / SECPERDAY;
- sec %= SECPERDAY;
- hour = sec / 3600;
- sec %= 3600;
- min = sec / 60;
- sec %= 60;
- rtc.rtc_cen = year / 100;
- rtc.rtc_year = year % 100;
- rtc.rtc_mon = mon+1;
- rtc.rtc_day = day+1;
- rtc.rtc_hour = hour;
- rtc.rtc_min = min;
- rtc.rtc_sec = sec;
- rtc.rtc_centi =
- rtc.rtc_micro = 0;
-
-/*
- printf("resettod: %d/%d/%d%d %d:%d:%d\n", rtc.rtc_day,
- rtc.rtc_mon, rtc.rtc_cen, rtc.rtc_year, rtc.rtc_hour,
- rtc.rtc_min, rtc.rtc_sec);
-*/
-
- s = splclock();
- rtc_write(&rtc);
- (void)splx(s);
-}
-
-/*
- * Initialise the time of day register, based on the time base which is, e.g.
- * from a filesystem.
- */
-
-void
-inittodr(base)
- time_t base;
-{
- time_t n;
- int i, days = 0;
- int s;
- int year;
- rtc_t rtc;
-
-/*
- * We ignore the suggested time for now and go for the RTC
- * clock time stored in the CMOS RAM.
- */
-
- s = splclock();
- if (rtc_read(&rtc) == 0) {
- (void)splx(s);
- return;
- }
-
- (void)splx(s);
-
- n = rtc.rtc_sec + 60 * rtc.rtc_min + 3600 * rtc.rtc_hour;
- n += (rtc.rtc_day - 1) * 3600 * 24;
- year = (rtc.rtc_year + rtc.rtc_cen * 100) - 1900;
-
- if (yeartoday(year) == 366)
- month[1] = 29;
- for (i = rtc.rtc_mon - 2; i >= 0; i--)
- days += month[i];
- month[1] = 28;
-
- for (i = 70; i < year; i++)
- days += yeartoday(i);
-
- n += days * 3600 * 24;
-
- n += tz.tz_minuteswest * 60;
- if (tz.tz_dsttime)
- n -= 3600;
-
- time.tv_sec = n;
- time.tv_usec = 0;
-
-/* timeset is used to ensure the time is valid before a resettodr() */
-
- timeset = 1;
-
-/* If the base was 0 then keep quiet */
-
- if (base) {
- printf("inittodr: %02d:%02d:%02d.%02d%02d %02d/%02d/%02d%02d\n",
- rtc.rtc_hour, rtc.rtc_min, rtc.rtc_sec, rtc.rtc_centi,
- rtc.rtc_micro, rtc.rtc_day, rtc.rtc_mon, rtc.rtc_cen,
- rtc.rtc_year);
-
- if (n > base + 60) {
- days = (n - base) / SECPERDAY;
- printf("Clock has gained %d day%c %ld hours %ld minutes %ld secs\n",
- days, ((days == 1) ? 0 : 's'), ((n - base) / 3600) % 24,
- ((n - base) / 60) % 60, (n - base) % 60);
- }
- }
-}
-
-/* End of clock.c */
diff --git a/sys/arch/arm32/arm32/conf.c b/sys/arch/arm32/arm32/conf.c
deleted file mode 100644
index 19fc646cc36..00000000000
--- a/sys/arch/arm32/arm32/conf.c
+++ /dev/null
@@ -1,422 +0,0 @@
-/* $NetBSD: conf.c,v 1.6 1996/04/19 19:40:29 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * conf.c
- *
- * Character and Block Device configuration
- * Console configuration
- *
- * Defines the structures cdevsw and constab
- *
- * Created : 17/09/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/conf.h>
-#include <sys/vnode.h>
-
-int ttselect __P((dev_t, int, struct proc *));
-
-#include "wdc.h"
-bdev_decl(wd);
-bdev_decl(sw);
-#include "fdc.h"
-bdev_decl(fd);
-#include "rd.h"
-bdev_decl(rd);
-#include "sd.h"
-bdev_decl(sd);
-#include "st.h"
-bdev_decl(st);
-#include "cd.h"
-bdev_decl(cd);
-#include "vnd.h"
-bdev_decl(vnd);
-#include "ccd.h"
-bdev_decl(ccd);
-/* Temporary hack for ATAPI CDROM */
-#include "wcd.h"
-bdev_decl(wcd);
-
-/* Block devices */
-
-struct bdevsw bdevsw[] = {
- bdev_lkm_dummy(), /* 0: */
- bdev_swap_init(1, sw), /* 1: swap pseudo-device */
- bdev_lkm_dummy(), /* 2: */
- bdev_lkm_dummy(), /* 3: */
- bdev_lkm_dummy(), /* 4: */
- bdev_lkm_dummy(), /* 5: */
- bdev_lkm_dummy(), /* 6: */
- bdev_lkm_dummy(), /* 7: */
- bdev_lkm_dummy(), /* 8: */
- bdev_lkm_dummy(), /* 9: */
- bdev_lkm_dummy(), /* 10: */
- bdev_lkm_dummy(), /* 11: */
- bdev_lkm_dummy(), /* 12: */
- bdev_lkm_dummy(), /* 13: */
- bdev_lkm_dummy(), /* 14: */
- bdev_lkm_dummy(), /* 15: */
- bdev_disk_init(NWDC, wd), /* 16: Internal IDE disk */
- bdev_disk_init(NFDC, fd), /* 17: floppy diskette */
- bdev_disk_init(NRD, rd), /* 18: ramdisk */
- bdev_disk_init(NVND,vnd), /* 19: vnode disk driver */
- bdev_disk_init(NWCD, wcd), /* 20: */
- bdev_disk_init(NCCD,ccd), /* 21: concatenated disk driver */
- bdev_lkm_dummy(), /* 22: */
- bdev_lkm_dummy(), /* 23: */
- bdev_disk_init(NSD,sd), /* 24: SCSI disk */
- bdev_tape_init(NST,st), /* 25: SCSI tape */
- bdev_disk_init(NCD,cd), /* 26: SCSI cdrom */
- bdev_lkm_dummy(), /* 27: */
- bdev_lkm_dummy(), /* 28: */
- bdev_lkm_dummy(), /* 29: */
- bdev_lkm_dummy(), /* 30: */
- bdev_lkm_dummy(), /* 31: */
- bdev_lkm_dummy(), /* 32: */
- bdev_lkm_dummy(), /* 33: */
- bdev_lkm_dummy(), /* 34: */
- bdev_lkm_dummy(), /* 35: */
- bdev_lkm_dummy(), /* 36: */
- bdev_lkm_dummy(), /* 37: */
- bdev_lkm_dummy(), /* 38: */
- bdev_lkm_dummy(), /* 39: */
- bdev_lkm_dummy(), /* 40: */
- bdev_lkm_dummy(), /* 41: */
- bdev_lkm_dummy(), /* 42: */
- bdev_lkm_dummy(), /* 43: */
- };
-
-int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
-
-
-/* Character device declarations */
-
-/* open, close, read, write, ioctl, tty, mmap */
-#define cdev_physcon_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
- dev_init(c,n,write), dev_init(c,n,ioctl), dev_init(c,n,stop), \
- dev_init(c,n,tty), ttselect, dev_init(c,n,mmap), 0 }
-
-/* open, close, write, ioctl */
-#define cdev_lpt_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
- dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
- 0, seltrue, (dev_type_mmap((*))) enodev, 0 }
-
-/* open, close, write, ioctl */
-#define cdev_beep_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
- (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, \
- 0, seltrue, (dev_type_mmap((*))) enodev, 0 }
-
-/* open, close, write, ioctl */
-#define cdev_kbd_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
- (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, \
- 0, dev_init(c,n,select), (dev_type_mmap((*))) enodev, 0 }
-
-/* open, close, write, ioctl */
-#define cdev_cpu_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
- (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, \
- 0, seltrue, (dev_type_mmap((*))) enodev, 0 }
-
-/* open, close, write, ioctl */
-#define cdev_vidcvid_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
- (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, \
- 0, seltrue, dev_init(c,n,mmap), 0 }
-
-/* open, close, write, ioctl */
-#define cdev_iic_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
- dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
- 0, seltrue, (dev_type_mmap((*))) enodev, 0 }
-
-/* open, close, write, ioctl */
-#define cdev_rtc_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
- dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
- 0, seltrue, (dev_type_mmap((*))) enodev, 0 }
-
-cdev_decl(cn);
-cdev_decl(ctty);
-#include "vt.h"
-cdev_decl(physcon);
-cdev_decl(vidcvideo);
-#define mmread mmrw
-#define mmwrite mmrw
-cdev_decl(mm);
-cdev_decl(wd);
-cdev_decl(sw);
-#include "pty.h"
-#define ptstty ptytty
-#define ptsioctl ptyioctl
-cdev_decl(pts);
-#define ptctty ptytty
-#define ptcioctl ptyioctl
-cdev_decl(ptc);
-cdev_decl(log);
-#include "com.h"
-cdev_decl(com);
-#include "lpt.h"
-cdev_decl(lpt);
-cdev_decl(fd);
-dev_decl(filedesc,open);
-cdev_decl(rd);
-#include "bpfilter.h"
-cdev_decl(bpf);
-cdev_decl(sd);
-cdev_decl(st);
-cdev_decl(cd);
-#include "ch.h"
-cdev_decl(ch);
-#include "uk.h"
-cdev_decl(uk);
-#include "ss.h"
-cdev_decl(ss);
-#ifdef LKM
-#define NLKM 1
-#else
-#define NLKM 0
-#endif
-cdev_decl(lkm);
-#include "tun.h"
-cdev_decl(tun);
-cdev_decl(vnd);
-cdev_decl(ccd);
-#include "quadmouse.h"
-cdev_decl(quadmouse);
-#include "pms.h"
-cdev_decl(pms);
-#include "beep.h"
-cdev_decl(beep);
-#include "kbd.h"
-cdev_decl(kbd);
-#include "audio.h"
-cdev_decl(audio);
-#include "cpu.h"
-cdev_decl(cpu);
-#include "iic.h"
-cdev_decl(iic);
-#include "rtc.h"
-cdev_decl(rtc);
-cdev_decl(random);
-/* Temporary hack for ATAPI CDROM */
-cdev_decl(wcd);
-#ifdef XFS
-#include <xfs/nxfs.h>
-cdev_decl(xfs_dev);
-#endif
-
-/* Character devices */
-
-struct cdevsw cdevsw[] = {
- cdev_mm_init(1, mm), /* 0: /dev/{null,mem,kmem,...} */
- cdev_swap_init(1, sw), /* 1: /dev/drum (swap pseudo-device) */
- cdev_cn_init(1, cn), /* 2: virtual console */
- cdev_ctty_init(1,ctty), /* 3: controlling terminal */
- cdev_physcon_init(NVT, physcon), /* 4: RPC console */
- cdev_log_init(1,log), /* 5: /dev/klog */
- cdev_ptc_init(NPTY,ptc), /* 6: pseudo-tty master */
- cdev_tty_init(NPTY,pts), /* 7: pseudo-tty slave */
- cdev_lpt_init(NLPT,lpt), /* 8: parallel printer */
- cdev_mouse_init(NQUADMOUSE,quadmouse), /* 9: quadmouse driver */
- cdev_beep_init(NBEEP,beep), /* 10: simple beep device */
- cdev_kbd_init(NKBD,kbd), /* 11: kbd device */
- cdev_tty_init(NCOM,com), /* 12: serial port */
- cdev_lkm_dummy(), /* 13: */
- cdev_lkm_dummy(), /* 14: */
- cdev_lkm_dummy(), /* 15: */
- cdev_disk_init(NWDC, wd), /* 16: ST506/ESDI/IDE disk */
- cdev_disk_init(NFDC, fd), /* 17: floppy diskette */
- cdev_disk_init(NRD, rd), /* 18: ram disk driver */
- cdev_disk_init(NVND,vnd), /* 19: vnode disk driver */
- cdev_disk_init(NWCD, wcd), /* 20: */
- cdev_disk_init(NCCD,ccd), /* 21: concatenated disk driver */
- cdev_lkm_dummy(), /* 22: */
- cdev_lkm_dummy(), /* 23: */
- cdev_disk_init(NSD,sd), /* 24: SCSI disk */
- cdev_tape_init(NST,st), /* 25: SCSI tape */
- cdev_disk_init(NCD,cd), /* 26: SCSI CD-ROM */
- cdev_ch_init(NCH,ch), /* 27: SCSI autochanger */
- cdev_ch_init(NUK,uk), /* 28: SCSI unknown */
- cdev_ss_init(NSS,ss), /* 29: SCSI scanner */
- cdev_lkm_dummy(), /* 30: */
- cdev_lkm_dummy(), /* 31: */
- cdev_bpftun_init(NBPFILTER,bpf),/* 32: Berkeley packet filter */
- cdev_bpftun_init(NTUN,tun), /* 33: network tunnel */
- cdev_fd_init(1,filedesc), /* 34: file descriptor pseudo-device */
- cdev_lkm_init(NLKM,lkm), /* 35: loadable module driver */
- cdev_audio_init(NAUDIO,audio), /* 36: generic audio I/O */
- cdev_vidcvid_init(1,vidcvideo), /* 37: vidcvideo device */
- cdev_cpu_init(NCPU,cpu), /* 38: cpu device */
- cdev_lkm_dummy(), /* 39: */
- cdev_mouse_init(NPMS,pms), /* 40: PS2 mouse driver */
- cdev_lkm_dummy(), /* 41: */
- cdev_iic_init(NIIC, iic), /* 42: IIC bus driver */
- cdev_rtc_init(NRTC, rtc), /* 43: RTC driver */
- cdev_random_init(1, random), /* 44: random data source */
- cdev_notdef(), /* 45: */
- cdev_notdef(), /* 46: */
- cdev_notdef(), /* 47: */
- cdev_notdef(), /* 48: */
- cdev_notdef(), /* 49: */
- cdev_notdef(), /* 50: */
-#ifdef XFS
- cdev_xfs_init(NXFS,xfs_dev), /* 51: xfs communication device */
-#else
- cdev_lkm_dummy(), /* 51: */
-#endif
-};
-
-int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
-
-int mem_no = 0; /* major device number of memory special file */
-
-
-/*
- * Returns true if dev is /dev/mem or /dev/kmem.
- */
-int
-iskmemdev(dev)
- dev_t dev;
-{
- return (major(dev) == mem_no && minor(dev) < 2);
-}
-
-/*
- * Returns true if dev is /dev/zero.
- */
-int
-iszerodev(dev)
- dev_t dev;
-{
- return (major(dev) == mem_no && minor(dev) == 3);
-}
-
-dev_t
-getnulldev()
-{
- return makedev(mem_no, 2);
-}
-
-
-static int chrtoblktbl[] = {
-/* XXXX This needs to be dynamic for LKMs. */
- /*VCHR*/ /*VBLK*/
- /* 0 */ NODEV,
- /* 1 */ 1,
- /* 2 */ NODEV,
- /* 3 */ NODEV,
- /* 4 */ NODEV,
- /* 5 */ NODEV,
- /* 6 */ NODEV,
- /* 7 */ NODEV,
- /* 8 */ NODEV,
- /* 9 */ NODEV,
- /* 10 */ NODEV,
- /* 11 */ NODEV,
- /* 12 */ NODEV,
- /* 13 */ NODEV,
- /* 14 */ NODEV,
- /* 15 */ NODEV,
- /* 16 */ 16,
- /* 17 */ 17,
- /* 18 */ 18,
- /* 19 */ 19,
- /* 20 */ 20,
- /* 21 */ 21,
- /* 22 */ NODEV,
- /* 23 */ NODEV,
- /* 24 */ 24,
- /* 25 */ 25,
- /* 26 */ 26,
-};
-
-/*
- * Convert a character device number to a block device number.
- */
-dev_t
-chrtoblk(dev)
- dev_t dev;
-{
- int blkmaj;
-
- if (major(dev) >= nchrdev ||
- major(dev) > sizeof(chrtoblktbl)/sizeof(chrtoblktbl[0]))
- return (NODEV);
- blkmaj = chrtoblktbl[major(dev)];
- if (blkmaj == NODEV)
- return (NODEV);
- return (makedev(blkmaj, minor(dev)));
-}
-
-/*
- * This entire table could be autoconfig()ed but that would mean that
- * the kernel's idea of the console would be out of sync with that of
- * the standalone boot. I think it best that they both use the same
- * known algorithm unless we see a pressing need otherwise.
- */
-
-#include <dev/cons.h>
-
-cons_decl(rpcconsole);
-cons_decl(com);
-
-struct consdev constab[] = {
-#if (NVT + NRPC > 0)
- cons_init(rpcconsole),
-#endif
-
-/*#if (NCOM > 0)
- cons_init(com),
-#endif*/
- { 0 },
-};
-
-/* End of conf.c */
diff --git a/sys/arch/arm32/arm32/coproc15.S b/sys/arch/arm32/arm32/coproc15.S
deleted file mode 100644
index 7ca9bab5349..00000000000
--- a/sys/arch/arm32/arm32/coproc15.S
+++ /dev/null
@@ -1,150 +0,0 @@
-/* $OpenBSD: coproc15.S,v 1.2 2000/03/03 00:54:46 todd Exp $ */
-/* $NetBSD: coproc15.S,v 1.1 1996/01/31 23:15:33 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * coproc15.S
- *
- * Manipulation of the CPU internal coprocessor #15 registers
- *
- * Created : 29/11/94
- * Last updated : 28/08/95
- *
- * Based on arm/readcoproc15.S & arm/writecoproc15.S
- *
- */
-
-lr .req r14
-pc .req r15
-
-.text
-/*
- * Functions to read the internal coprocessor registers
- *
- * Currently the only registers that can be read are
- * r0 - CPU ID
- * r5 - Fault status
- * r6 - Fault address
- *
- * Eventually these should be inlined.
- */
-
- .global _cpu_id
-
-_cpu_id:
- mrc 15, 0, r0, c0, c0, 0
- mov pc, lr
-
- .global _cpu_faultstatus
-
-_cpu_faultstatus:
- mrc 15, 0, r0, c5, c0, 0
- mov pc, lr
-
- .global _cpu_faultaddress
-
-_cpu_faultaddress:
- mrc 15, 0, r0, c6, c0, 0
- mov pc, lr
-
-
-/*
- * Functions to write the internal coprocessor registers
- *
- *
- * Currently the only registers that can be write are
- * r1 - CPU Control
- * r2 - TTB
- * r3 - Domain Access Control
- * r5 - Flush TLB
- * r6 - Purge TLB
- * r7 - Flush IDC
- *
- * Eventually these should be inlined.
- */
-
- .global _cpu_control
-
-_cpu_control:
- mcr 15, 0, r0, c1, c0, 0
- mov pc, lr
-
- .global _setttb
-
-_setttb:
-/* We need to flush the cache as it uses virtual addresses that are about to change */
- mcr 15, 0, r0, c7, c0, 0
-
-/* Write the TTB */
- mcr 15, 0, r0, c2, c0, 0
-
-/* If we have updated the TTB we must flush the TLB */
- mcr 15, 0, r0, c5, c0, 0
-
-/* For good measure we will flush the IDC as well - do we need this */
- mcr 15, 0, r0, c7, c0, 0
-
-/* Make sure that pipeline is emptied */
-
- mov r0, r0
- mov r0, r0
-
- mov pc, lr
-
- .global _cpu_domains
-
-_cpu_domains:
- mcr 15, 0, r0, c3, c0, 0
- mov pc, lr
-
- .global _tlbflush
-
-_tlbflush:
- mcr 15, 0, r0, c5, c0, 0
- mov pc, lr
-
- .global _tlbpurge
-
-_tlbpurge:
- mcr 15, 0, r0, c6, c0, 0
- mov pc, lr
-
- .global _idcflush
-
-_idcflush:
- mcr 15, 0, r0, c7, c0, 0
- mov pc, lr
diff --git a/sys/arch/arm32/arm32/copystr.S b/sys/arch/arm32/arm32/copystr.S
deleted file mode 100644
index 0c22370138f..00000000000
--- a/sys/arch/arm32/arm32/copystr.S
+++ /dev/null
@@ -1,132 +0,0 @@
-/* $NetBSD: copystr.S,v 1.4 1996/03/27 22:19:32 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- * Copyright (c) 1995 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * copystr.S
- *
- * optimised and fault protected copystr function
- *
- * Created : 16/05/95
- */
-
-#include "assym.h"
-#include <sys/errno.h>
-
-sp .req r13
-lr .req r14
-pc .req r15
-
- .text
-Lcurpcb:
- .word _curpcb
-
-Lcurproc:
- .word _curproc
-
-copystrfault:
- mov r0, #0x00000000
- str r0, [r4, #PCB_ONFAULT]
- mov r0, #EFAULT
- ldmfd sp!, {r4-r6}
- mov pc, lr
-
-copystrpcbfault:
- stmfd sp!, {lr}
- mov r3, r1
- mov r1, r4
- add r0, pc, #copystrtext - . - 8
- mov r2, r3
- ldr r3, Lcurproc
- ldr r3, [r3]
- bl _printf
-
- bl _traceback
-
- mov r0, #EFAULT
- ldmfd sp!, {lr}
- ldmfd sp!, {r4-r6}
- mov pc, lr
-
-copystrtext:
- .asciz "Alert ! PCB = %08x during copystr addr=%08x curproc=%08x\n"
-
- .align 0
-
-/*
- * r0 - from
- * r1 - to
- * r2 - maxlens
- * r3 - lencopied
- */
-
- .global _copystrinout
-
-_copystrinout:
- stmfd sp!, {r4-r6}
- teq r2, #0x00000000
- moveq r5, #0x00000000
- moveq r6, #0x00000000
- beq copystrexit
-
- ldr r4, Lcurpcb
- ldr r4, [r4]
- teq r4, #0x00000000
- beq copystrpcbfault
- add r5, pc, #copystrfault - . - 8
- str r5, [r4, #PCB_ONFAULT]
- mov r6, #0x00000000
-
-copystr_loop:
- ldrb r5, [r0], #0x0001
- strb r5, [r1], #0x0001
- add r6, r6, #0x00000001
- teq r5, #0x00000000
- teqne r6, r2
- bne copystr_loop
-
-copystrexit:
- teq r3, #0x00000000
- strne r6, [r3]
-
- teq r5, #0x00000000
- moveq r0, #0x00000000
- movne r0, #ENAMETOOLONG
-
- mov r6, #0x00000000
- str r6, [r4, #PCB_ONFAULT]
- ldmfd sp!, {r4-r6}
- mov pc, lr
diff --git a/sys/arch/arm32/arm32/cpuswitch.S b/sys/arch/arm32/arm32/cpuswitch.S
deleted file mode 100644
index 6dba0964093..00000000000
--- a/sys/arch/arm32/arm32/cpuswitch.S
+++ /dev/null
@@ -1,786 +0,0 @@
-/* $NetBSD: cpuswitch.S,v 1.6 1996/03/27 21:24:39 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1996 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * cpu.S
- *
- * cpu switching functions
- *
- * Created : 15/10/94
- */
-
-#include "assym.h"
-#include <machine/param.h>
-#include <machine/cpu.h>
-
-sp .req r13
-lr .req r14
-pc .req r15
-
-/*
- * PULLFRAME - macro to pull a trap frame from the stack in the current mode
- * Since the current mode is used, the SVC R14 field is ignored.
- */
-
-#define PULLFRAME \
- ldr r0, [sp], #0x0004; /* Get the SPSR from stack */ \
- msr spsr_all, r0; \
- add sp, sp, #(4*15); /* Adjust the stack pointer */ \
- ldmdb sp, {r0-r14}^; /* Restore the registers (user mode) */ \
- mov r0, r0; /* NOP for previous instruction */ \
- add sp, sp, #0x00000004; /* Skip SVC R14 */ \
- ldr lr, [sp], #0x0004; /* Pull the return address */
-
-/*
- * setrunqueue() and remrunqueue()
- *
- * Functions to add and remove a process for the run queue.
- */
-
- .text
-
-Lwhichqs:
- .word _whichqs
-
-Lqs:
- .word _qs
-
-/*
- * On entry
- * r0 = process
- */
-
- .global _setrunqueue
-_setrunqueue:
-/*
- * Local register usage
- * r0 = process
- * r1 = queue
- * r2 = &qs[queue]
- * r3 = temp
- * r4 = whichqs
- */
- stmfd sp!, {r4}
-
-#ifdef DIAGNOSTIC
- ldr r1, [r0, #(P_BACK)]
- teq r1, #0x00000000
- bne Lsetrunqueue_erg
-
- ldr r1, [r0, #(P_WCHAN)]
- teq r1, #0x00000000
- bne Lsetrunqueue_erg
-#endif
-
-/* Get the priority of the queue */
-
- ldrb r1, [r0, #(P_PRIORITY)]
- mov r1, r1, lsr #2
-
-/* Indicate that there is a process on this queue */
-
- ldr r4, Lwhichqs
- ldr r2, [r4]
- mov r3, #0x00000001
- mov r3, r3, lsl r1
- orr r2, r2, r3
- str r2, [r4]
-
-/* Get the address of the queue */
-
- ldr r2, Lqs
- add r1, r2, r1, lsl # 3
-
-/* Hook the process in */
- str r1, [r0, #(P_FORW)]
- ldr r2, [r1, #(P_BACK)]
-
- str r0, [r1, #(P_BACK)]
-#ifdef DIAGNOSTIC
- teq r2, #0x00000000
- beq Lsetrunqueue_erg
-#endif
- str r0, [r2, #(P_FORW)]
- str r2, [r0, #(P_BACK)]
-
- ldmfd sp!, {r4}
-
- mov pc, lr
-
-#ifdef DIAGNOSTIC
-Lsetrunqueue_erg:
- mov r2, r1
- mov r1, r0
- add r0, pc, #Ltext1 - . - 8
- bl _printf
-
- ldr r2, Lqs
- ldr r1, [r2]
- add r0, pc, #Ltext2 - . - 8
- b _panic
-
-Ltext1:
- .asciz "setrunqueue : %08x %08x\n"
-Ltext2:
- .asciz "setrunqueue : [qs]=%08x qs=%08x\n"
- .align 0
-#endif
-
-/*
- * On entry
- * r0 = process
- */
-
- .global _remrunqueue
-_remrunqueue:
-
-/*
- * Local register usage
- * r0 = oldproc
- * r1 = queue
- * r2 = &qs[queue]
- * r3 = scratch
- * r4 = whichqs
- */
- stmfd sp!, {r4}
-
-/* Get the priority of the queue */
-
- ldrb r1, [r0, #(P_PRIORITY)]
- mov r1, r1, lsr #2
-
-/* Unhook the process */
-
- ldr r2, [r0, #(P_FORW)]
- ldr r3, [r0, #(P_BACK)]
-
- str r3, [r2, #(P_BACK)]
- str r2, [r3, #(P_FORW)]
-
-/* If the queue is now empty clear the queue not empty flag */
-
- teq r2, r3
-
-/* This could be reworked to avoid the use of r4 */
-
- ldreq r4, Lwhichqs
- ldreq r2, [r4]
- moveq r3, #0x00000001
- moveq r3, r3, lsl r1
- biceq r2, r2, r3
- streq r2, [r4]
-
-/* Remove the back pointer for the process */
-
- mov r1, #0x00000000
- str r1, [r0, #(P_BACK)]
-
- ldmfd sp!, {r4}
-
- mov pc, lr
-
-
-/*
- * cpuswitch()
- *
- * preforms a process context switch.
- * This function has several entry points
- */
-
-
-Lcurproc:
- .word _curproc
-
- .global _curpcb
-
-_curpcb:
- .word 0x00000000
-
-Lcurpcb:
- .word _curpcb
-
-Lwant_resched:
- .word _want_resched
-
-
-/*
- * Idle loop, exercised while waiting for a process to wake up.
- */
-
- .global _idle
-_idle:
-idle:
-
-/* Enable interrupts */
-
- IRQenable
-
-#ifdef CPU_ARM7500
-/* ARM7500 has a suspend mode so use it ! [danny, does this work ? - mark] */
-
- mov r7, #(IOMD_BASE)
- orr r7, r7, #(IOMD_SUSPEND - IOMD_BASE)
- mov r3, #0x00000001
- strb r3, [r7]
-#endif
-
-/* Disable interrupts while we check for an active queue */
-
- IRQdisable
- ldr r7, Lwhichqs
- ldr r3, [r7]
- teq r3, #0x00000000
- bne sw1
-
-/* All processes are still asleep so idle a while longer */
-
- b idle
-
-
-/*
- * Find a new process to run, save the current context and
- * load the new context
- */
-
- .global _cpu_switch
-_cpu_switch:
-/*
- * Local register usage. Some of these registers are out of date.
- * r1 = oldproc
- * r2 = spl level
- * r3 = whichqs
- * r4 = queue
- * r5 = &qs[queue]
- * r6 = newproc
- * r7 = scratch
- */
- stmfd sp!, {r4-r7, lr}
-
-/*
- * Get the current process and indicate that there is no longer a valid
- * process (curproc = 0)
- */
-
- ldr r7, Lcurproc
- ldr r1, [r7]
- mov r0, #0x00000000
- str r0, [r7]
-
-/* Zero the pcb */
-
- ldr r7, Lcurpcb
- str r0, [r7]
-
-/* Lower the spl level to spl0 and get the current spl level. */
-
- mov r7, r1
-
-#ifdef spl0
- mov r0, #(SPL_0)
- bl _splx
-#else
- bl _spl0
-#endif
-
-/* Push the old spl level onto the stack */
-
- str r0, [sp, #-0x0004]!
-
- mov r1, r7
-
-/* First phase : find a new process */
-
-/* rem: r1 = old proc */
-
-switch_search:
- IRQdisable
-
-/* Do we have any active queues */
-
- ldr r7, Lwhichqs
- ldr r3, [r7]
-
-/* If not we must idle until we do. */
-
- teq r3, #0x00000000
- beq idle
-
-sw1:
-/* rem: r1 = old proc */
-/* rem: r3 = whichqs */
-/* rem: interrupts are disabled */
-
-/*
- * Paranoid debug time ....
- * Is this overkill ? If we are not in SVC mode then things are
- * very sick and will probably have already died.
- */
-
-#ifdef DIAGNOSTIC
- mrs r4, cpsr_all
- and r4, r4, #(PSR_MODE)
- teq r4, #(PSR_SVC32_MODE)
- beq switchmodeok
-
- add r0, pc, #switchpanic - . - 8
- mrs r1, cpsr_all
- bl _panic
-
-switchpanic:
- .asciz "Yikes! In cpu_switch() but not in SVC mode (%08x)\n"
- .align 0
-
-switchmodeok:
-#endif
-
-/*
- * We have found an active queue. Currently we do not know which queue
- * is active just that one of them is.
- * We must check each queue to find the active one.
- * r3 contains a bit for each of the 32 queues. A one indicates that
- * that the queue has something in it.
- */
-
-/* This ffs() type routine code be optimised */
-
- mov r4, #0x00000000
-
-findqueue:
- mov r0, #0x00000001
- mov r0, r0, lsl r4
-
- tst r3, r0
- addeq r4, r4, #0x00000001
- beq findqueue
-
-/*
- * Ok we have found the active queue. The above code can never fail as
- * we only get to it if r3 != 0
- * r4 contains the number of the first queue found with a process in it.
- */
-
-/* rem: r0 = bit mask of chosen queue (1 << r4) */
-/* rem: r1 = old proc */
-/* rem: r3 = whichqs */
-/* rem: r4 = queue number */
-/* rem: interrupts are disabled */
-
-/* Get the address of the queue (&qs[queue]) */
-
- ldr r5, Lqs
- add r5, r5, r4, lsl #3
-
-/*
- * Get the process from the queue and place the next process in the queue
- * at the head. This basically unlinks the process at the head of the queue.
- */
- ldr r6, [r5, #(P_FORW)]
-
-/* rem: r6 = new process */
-
- ldr r7, [r6, #(P_FORW)]
- str r7, [r5, #(P_FORW)]
-
-/*
- * Test to see if the queue is now empty. If the head of the queue points
- * to the queue itself then there are no more processes in the queue.
- * We can therefore clear the queue not empty flag held in r3.
- */
-
- teq r5, r7
- biceq r3, r3, r0
-
-/* rem: r0 = bit mask of chosen queue (1 << r4) - NOT NEEDED AN MORE */
-
-/* Fix the back pointer for the process now at the head of the queue. */
-
- ldr r0, [r6, #(P_BACK)]
- str r0, [r7, #(P_BACK)]
-
-/* Update the RAM copy of the queue not empty flags word. */
-
- ldr r7, Lwhichqs
- str r3, [r7]
-
-/* rem: r1 = old proc */
-/* rem: r3 = whichqs - NOT NEEDED ANY MORE */
-/* rem: r4 = queue number - NOT NEEDED ANY MORE */
-/* rem: r6 = new process */
-/* rem: interrupts are disabled */
-
-/* Clear the want_resched flag */
-
- mov r0, #0x00000000
- ldr r7, Lwant_resched
- str r0, [r7]
-
-/*
- * Clear the back pointer of the process we have removed from the head
- * of the queue. The new process is isolated now.
- */
-
- mov r0, #0x00000000
- str r0, [r6, #(P_BACK)]
-
-/* We have a new curproc now so make a note it */
-
- ldr r7, Lcurproc
- str r6, [r7]
-
-/* Hook in a new pcb */
-
- ldr r7, Lcurpcb
- ldr r0, [r6, #(P_ADDR)]
- str r0, [r7]
-
-/* At this point we can allow IRQ's again. */
-
-/*
- IRQenable
- IRQdisable
-*/
-
-/* rem: r1 = old proc */
-/* rem: r6 = new process */
-/* rem: interrupts are disabled */
-
-/*
- * If the new process is the same as the process that called cpu_switch
- * Then we do not need to save and restore any contexts. This means
- * we can make a quick exit.
- * The test is simple if curproc on entry (now in r1) is the same as the
- * proc removed from the queue we can jump to the exit.
- */
-
- teq r1, r6
- beq switch_return
-
-/*
- * If the curproc on entry to cpu_switch was zero then the process that
- * called it was exiting. This means that we do not need to save the current
- * context. Instead we can jump straight to restoring the context for
- * the new process.
- */
-
- teq r1, #0x00000000
- beq switch_exited
-
-/* rem: r1 = old proc */
-/* rem: r6 = new process */
-/* rem: interrupts are disabled */
-
-/* Stage two : Save old context */
-
-/* Remember the old process in r0 */
-
- mov r0, r1
-
-/* Get the user structure for the old process. */
-
- ldr r1, [r1, #(P_ADDR)]
-
-/* Save all the registers in the old process's pcb */
-
- add r7, r1, #(PCB_R8)
- stmia r7, {r8-r13}
-
-/*
- * This can be optimised... We know we want to go from SVC32 mode to UND32
- * mode
- */
-
- mrs r3, cpsr_all
- bic r2, r3, #(PSR_MODE)
- orr r2, r2, #(PSR_UND32_MODE | I32_bit | F32_bit)
- msr cpsr_all, r2
-
- str sp, [r1, #(PCB_UND_SP)]
-
- msr cpsr_all, r3 /* Restore the old mode */
-
-/* rem: r0 = old proc */
-/* rem: r0 = old pcb */
-/* rem: r6 = new process */
-/* rem: interrupts are disabled */
-
-/* What else needs to be saved Only FPA stuff when that is supported */
-
-/* Third phase : restore saved context */
-
-switch_exited:
-
-/* At this point we need to kill IRQ's again. */
-
- mrs r0, cpsr_all
- orr r0, r0, #(I32_bit | F32_bit)
- msr cpsr_all , r0
-
-/* IRQdisable*/
-
-/* Get the user structure for the new process in r1 */
-
- ldr r1, [r6, #(P_ADDR)]
-
-/* Get the pagedir physical address for the process. */
-
- ldr r0, [r1, #(PCB_PAGEDIR)]
-
-/* Switch the memory to the new process */
-
-/* For good measure we will flush the IDC as well */
- mcr 15, 0, r0, c7, c0, 0
-
-/* Write the TTB */
- mcr 15, 0, r0, c2, c0, 0
-
-/* If we have updated the TTB we must flush the TLB */
- mcr 15, 0, r0, c5, c0, 0
-
-/* For good measure we will flush the IDC as well */
- mcr 15, 0, r0, c7, c0, 0
-
-/* Make sure that pipeline is emptied */
- mov r0, r0
- mov r0, r0
-
-/*
- * This can be optimised... We know we want to go from SVC32 mode to UND32
- * mode
- */
-
- mrs r3, cpsr_all
- bic r2, r3, #(PSR_MODE)
- orr r2, r2, #(PSR_UND32_MODE)
- msr cpsr_all, r2
-
- ldr sp, [r1, #(PCB_UND_SP)]
-
- msr cpsr_all, r3 /* Restore the old mode */
-
-/* Restore all the save registers */
-
- add r7, r1, #PCB_R8
- ldmia r7, {r8-r13}
-
-/* Remember the pcb currently in use */
-
- ldr r7, Lcurpcb
- str r1, [r7]
-
-/* We can enable interrupts again */
-
-/*
- IRQenable
-*/
-
-#ifdef ARMFPE
- add r0, r1, #(USER_SIZE) & 0x00ff
- add r0, r0, #(USER_SIZE) & 0xff00
- bl _arm_fpe_core_changecontext
-#endif
-
-switch_return:
-
-/* We have a new curproc now so make a note it */
-
-/*
- ldr r7, Lcurproc
- str r6, [r7]
-*/
-
-/* Get the spl level from the stack and update the current spl level */
-
- ldr r0, [sp], #0x0004
- bl _splx
-
-/* IRQenable*/
-
-/* cpu_switch returns the proc it switched to. */
-
- mov r0, r6
-
-/*
- * Pull the registers that got pushed when either savectx or cpu_switch
- * was called and return.
- */
- ldmfd sp!, {r4-r7, pc}
-
-Lproc0:
- .word _proc0
-
-Lkernel_map:
- .word _kernel_map
-
-
- .global _switch_exit
-
-_switch_exit:
-
-/*
- * r0 = proc
- * r1 = proc0
- */
-
- ldr r1, Lproc0
-
-/* In case we fault */
-
- mov r2, #0x00000000
- ldr r3, Lcurproc
- str r2, [r3]
-
-/* ldr r3, Lcurpcb
- str r2, [r3]*/
-
-/* Switch to proc0 context */
-
- IRQdisable
-
- ldr r2, [r1, #(P_ADDR)]
- ldr r3, [r2, #(PCB_PAGEDIR)]
-
-/* For good measure we will flush the IDC as well */
- mcr 15, 0, r0, c7, c0, 0
-
-/* Write the TTB */
- mcr 15, 0, r3, c2, c0, 0
-
-/* If we have updated the TTB we must flush the TLB */
- mcr 15, 0, r0, c5, c0, 0
-
-/* For good measure we will flush the IDC as well */
- mcr 15, 0, r0, c7, c0, 0
-
-/* Make sure that pipeline is emptied */
- mov r0, r0
- mov r0, r0
-
-/* Restore all the save registers */
-
- add r7, r2, #PCB_R8
- ldmia r7, {r8-r13}
-
-/* This is not really needed ! */
-/* Yes it is for the su and fu routines */
-
-/* ldr sp, [r2, #(PCB_SP)]*/
- ldr r3, Lcurpcb
- str r2, [r3]
-
-/* IRQenable*/
-
- str r0, [sp, #-0x0004]!
-
-/* Thoroughly nuke the old process's resources. */
-
-/* This has to be done here, before we lose the pmap */
-
- mov r1, #0x00000000
- add r2, r1, #NBPG
- ldr r0, [r0, #(P_VMSPACE)]
- add r0, r0, #(VM_PMAP)
- bl _pmap_remove
- ldr r0, [sp]
-
-/*
- * Have to wait until we have switched to proc0 as the pmap gets released
- * in vmspace_free()
- */
-
- ldr r0, [r0, #(P_VMSPACE)]
- bl _vmspace_free
-
-/* This has to be done here */
-
- mov r2, #(UPAGES << PGSHIFT)
- ldr r0, [sp], #0x0004
- ldr r1, [r0, #(P_ADDR)]
- ldr r0, Lkernel_map
- ldr r0, [r0]
- bl _kmem_free
-
-/* Paranoia */
-
- mov r0, #0x00000000
- ldr r1, Lcurproc
- str r0, [r1]
-
- ldr r1, Lproc0
- b switch_search
-
-
-Lcurrent_spl_level:
- .word _current_spl_level
-
- .global _savectx
-_savectx:
-/*
- * r0 = pcb
- */
-
-/* Push registers.*/
-
- stmfd sp!, {r4-r7, lr}
-
-/* Store all the registers in the process's pcb */
-
- add r2, r0, #(PCB_R8)
- stmia r2, {r8-r13}
-
-/* Pull the regs of the stack */
-
- ldmfd sp!, {r4-r7, pc}
-
-
- .global _proc_trampoline
-_proc_trampoline:
- add lr, pc, #(trampoline_return - . - 8)
- mov r0, r5
- mov r1, sp
- mov pc, r4
-
-trampoline_return:
-/* Kill irq's */
-
- mrs r0, cpsr_all
- orr r0, r0, #(I32_bit)
- msr cpsr_all, r0
-
- PULLFRAME
-
- movs pc, lr /* Exit */
-
diff --git a/sys/arch/arm32/arm32/db_disasm.c b/sys/arch/arm32/arm32/db_disasm.c
deleted file mode 100644
index 7e7d8b9d075..00000000000
--- a/sys/arch/arm32/arm32/db_disasm.c
+++ /dev/null
@@ -1,558 +0,0 @@
-/* $NetBSD: db_disasm.c,v 1.2 1996/03/06 22:46:37 mark Exp $ */
-
-/*
- * Copyright (c) 1996 Mark Brinicombe.
- * Copyright (c) 1996 Brini.
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * db_disasm.c
- *
- * Kernel disassembler
- *
- * Created : 10/02/96
- *
- * Structured after the sparc/sparc/db_disasm.c by David S. Miller &
- * Paul Kranenburg
- *
- * This code is not complete. Not all instructions are disassembled.
- * Current LDF, STF, CDT and MSRF are not supported.
- */
-
-#include <sys/param.h>
-#include <machine/db_machdep.h>
-#include <ddb/db_sym.h>
-
-/*
- * General instruction format
- *
- * insn[cc][mod] [operands]
- *
- * Those fields with an uppercase format code indicate that the field follows
- * directly after the instruction before the separator i.e. they modify the instruction
- * rather than just being an operand to the instruction. The only exception is the
- * writeback flag which follows a operand.
- *
- *
- * 2 - print Operand 2 of a data processing instrcution
- * d - destination register (bits 12-15)
- * n - n register (bits 16-19)
- * s - s register (bits 8-11)
- * o - indirect register rn (bits 16-19) (used by swap)
- * m - m register (bits 0-4)
- * a - address operand of ldr/str instruction
- * l - register list for ldm/stm instruction
- * f - 1st fp operand (register) (bits 12-14)
- * g - 2nd fp operand (register) (bits 16-18)
- * h - 3rd fp operand (register/immediate) (bits 0-4)
- * b - branch address
- * X - block transfer type
- * c - comment field bits(0-23)
- * p - saved or current status register
- * B - byte transfer flag
- * S - set status flag
- * T - user mode transfer
- * P - fp precision
- * R - fp rounding
- * w - writeback flag
- * # - co-processor number
- * y - co-processor data processing registers
- * z - co-processor data transfer registers
- */
-
-struct arm32_insn {
- u_int mask;
- u_int pattern;
- char* name;
- char* format;
-};
-
-struct arm32_insn arm32_i[] = {
- { 0x0f000000, 0x0f000000, "swi", "c" },
- { 0x0f000000, 0x0a000000, "b", "b" },
- { 0x0f000000, 0x0b000000, "bl", "b" },
- { 0x0fe000f0, 0x00000090, "mul", "Sdms" },
- { 0x0fe000f0, 0x00200090, "mla", "Sdmsn" },
- { 0x0e100000, 0x04000000, "str", "BTdaW" },
- { 0x0e100000, 0x04100000, "ldr", "BTdaW" },
- { 0x0c100010, 0x04000000, "str", "BTdaW" },
- { 0x0c100010, 0x04100000, "ldr", "BTdaW" },
- { 0x0e100000, 0x08000000, "stm", "XnWl" },
- { 0x0e100000, 0x08100000, "ldm", "XnWl" },
- { 0x0fb00ff0, 0x01000090, "swap", "Bdmo" },
- { 0x0fbf0fff, 0x010f0000, "mrs", "dp" },
- { 0x0dbffff0, 0x0129f000, "msr", "pm" },
- { 0x0dbffff0, 0x0128f000, "msrf", "pm" },
- { 0x0de00000, 0x00000000, "and", "Sdn2" },
- { 0x0de00000, 0x00200000, "eor", "Sdn2" },
- { 0x0de00000, 0x00400000, "sub", "Sdn2" },
- { 0x0de00000, 0x00600000, "rsb", "Sdn2" },
- { 0x0de00000, 0x00800000, "add", "Sdn2" },
- { 0x0de00000, 0x00a00000, "adc", "Sdn2" },
- { 0x0de00000, 0x00c00000, "sbc", "Sdn2" },
- { 0x0de00000, 0x00e00000, "rsc", "Sdn2" },
- { 0x0de00000, 0x01000000, "tst", "Sn2" },
- { 0x0de00000, 0x01200000, "teq", "Sn2" },
- { 0x0de00000, 0x01400000, "cmp", "Sn2" },
- { 0x0de00000, 0x01600000, "cmn", "Sn2" },
- { 0x0de00000, 0x01800000, "orr", "Sdn2" },
- { 0x0de00000, 0x01a00000, "mov", "Sd2" },
- { 0x0de00000, 0x01c00000, "bic", "Sdn2" },
- { 0x0de00000, 0x01e00000, "mvn", "Sd2" },
- { 0x0ff08f10, 0x0e000100, "adf", "PRfgh" },
- { 0x0ff08f10, 0x0e100100, "muf", "PRfgh" },
- { 0x0ff08f10, 0x0e200100, "suf", "PRfgh" },
- { 0x0ff08f10, 0x0e300100, "rsf", "PRfgh" },
- { 0x0ff08f10, 0x0e400100, "dvf", "PRfgh" },
- { 0x0ff08f10, 0x0e500100, "rdf", "PRfgh" },
- { 0x0ff08f10, 0x0e600100, "pow", "PRfgh" },
- { 0x0ff08f10, 0x0e700100, "rpw", "PRfgh" },
- { 0x0ff08f10, 0x0e800100, "rmf", "PRfgh" },
- { 0x0ff08f10, 0x0e900100, "fml", "PRfgh" },
- { 0x0ff08f10, 0x0ea00100, "fdv", "PRfgh" },
- { 0x0ff08f10, 0x0eb00100, "frd", "PRfgh" },
- { 0x0ff08f10, 0x0ec00100, "pol", "PRfgh" },
- { 0x0f008f10, 0x0e000100, "fpbop", "PRfgh" },
- { 0x0ff08f10, 0x0e008100, "mvf", "PRfh" },
- { 0x0ff08f10, 0x0e108100, "mnf", "PRfh" },
- { 0x0ff08f10, 0x0e208100, "abs", "PRfh" },
- { 0x0ff08f10, 0x0e308100, "rnd", "PRfh" },
- { 0x0ff08f10, 0x0e408100, "sqt", "PRfh" },
- { 0x0ff08f10, 0x0e508100, "log", "PRfh" },
- { 0x0ff08f10, 0x0e608100, "lgn", "PRfh" },
- { 0x0ff08f10, 0x0e708100, "exp", "PRfh" },
- { 0x0ff08f10, 0x0e808100, "sin", "PRfh" },
- { 0x0ff08f10, 0x0e908100, "cos", "PRfh" },
- { 0x0ff08f10, 0x0ea08100, "tan", "PRfh" },
- { 0x0ff08f10, 0x0eb08100, "asn", "PRfh" },
- { 0x0ff08f10, 0x0ec08100, "acs", "PRfh" },
- { 0x0ff08f10, 0x0ed08100, "atn", "PRfh" },
- { 0x0f008f10, 0x0e008100, "fpuop", "PRfh" },
- { 0x0e100f00, 0x0c000100, "stf", "P" },
- { 0x0e100f00, 0x0c100100, "ldf", "P" },
- { 0x0f100010, 0x0e000010, "mcr", "#z" },
- { 0x0f100010, 0x0e100010, "mrc", "#z" },
- { 0x0f000010, 0x0e000000, "cdp", "#y" },
- { 0x0e000000, 0x0c000000, "cdt", "#" },
- { 0x00000000, 0x00000000, NULL, NULL }
-};
-
-char *arm32_insn_conditions[] = {
- "eq",
- "ne",
- "cs",
- "cc",
- "mi",
- "pl",
- "vs",
- "vc",
- "hi",
- "ls",
- "ge",
- "lt",
- "gt",
- "le",
- "",
- "nv"
-};
-
-char *insn_block_transfers[] = {
- "da",
- "ia",
- "db",
- "ib"
-};
-
-char *insn_stack_block_transfers[] = {
- "fa",
- "ea",
- "fd",
- "fa"
-};
-
-char *op_shifts[] = {
- "lsl",
- "lsr",
- "asr",
- "ror"
-};
-
-char *insn_fpa_rounding[] = {
- "",
- "p",
- "m",
- "z"
-};
-
-char *insn_fpa_precision[] = {
- "s",
- "d",
- "e",
- "p"
-};
-
-char *insn_fpaconstants[] = {
- "0.0",
- "1.0",
- "2.0",
- "3.0",
- "4.0",
- "5.0",
- "0.5",
- "10.0"
-};
-
-#define insn_condition(x) arm32_insn_conditions[(x >> 28) & 0x0f]
-#define insn_blktrans(x) insn_block_transfers[(x >> 23) & 3]
-#define insn_stkblktrans(x) insn_stack_block_transfers[(x >> 23) & 3]
-#define op2_shift(x) op_shifts[(x >> 5) & 3]
-#define insn_fparnd(x) insn_fpa_rounding[(x >> 5) & 0x03]
-#define insn_fpaprec(x) insn_fpa_precision[(((x >> 18) & 2)|(x >> 7)) & 3]
-#define insn_fpaimm(x) insn_fpaconstants[x & 0x07]
-
-void db_register_shift __P((u_int insn));
-void db_print_reglist __P((u_int insn));
-void db_insn_ldrstr __P((u_int insn, u_int loc));
-
-
-vm_offset_t
-db_disasm(loc, altfmt)
- vm_offset_t loc;
- boolean_t altfmt;
-{
- struct arm32_insn* i_ptr = (struct arm32_insn *)&arm32_i;
-
- u_int insn;
- int matchp;
- int branch;
- char* f_ptr, *cp;
- int fmt;
-
- fmt = 0;
- matchp = 0;
- insn = db_get_value(loc, 4, 0);
-
-/* db_printf("loc=%08x insn=%08x : ", loc, insn);*/
-/* db_printf("loc=%08x : ", loc);*/
-
- while (i_ptr->name) {
- if ((insn & i_ptr->mask) == i_ptr->pattern) {
- matchp = 1;
- break;
- }
- i_ptr++;
- }
-
- if (!matchp) {
- db_printf("undefined\n");
- return(loc + 4);
- }
-
- db_printf("%s%s", i_ptr->name, insn_condition(insn));
-
- f_ptr = i_ptr->format;
-
- while (*f_ptr) {
- switch (*f_ptr) {
- case '2':
- if (insn & 0x02000000) {
- db_printf("#0x%08x", (insn & 0xff) << (((insn >> 7) & 0x1e)));
- } else {
- db_register_shift(insn);
- }
- break;
- case 'd':
- db_printf("r%d", ((insn >> 12) & 0x0f));
- break;
- case 'n':
- db_printf("r%d", ((insn >> 16) & 0x0f));
- break;
- case 's':
- db_printf("r%d", ((insn >> 8) & 0x0f));
- break;
- case 'o':
- db_printf("[r%d]", ((insn >> 16) & 0x0f));
- break;
- case 'm':
- db_printf("r%d", ((insn >> 0) & 0x0f));
- break;
- case 'a':
- db_insn_ldrstr(insn, loc);
- break;
- case 'l':
- db_print_reglist(insn);
- break;
- case 'f':
- db_printf("f%d", (insn >> 12) & 7);
- break;
- case 'g':
- db_printf("f%d", (insn >> 16) & 7);
- break;
- case 'h':
- if (insn & (1 << 3))
- db_printf("#%s", insn_fpaimm(insn));
- else
- db_printf("f%d", insn & 7);
- break;
- case 'b':
- branch = ((insn << 2) & 0x03ffffff);
- if (branch & 0x02000000)
- branch |= 0xfc000000;
- db_printsym((db_addr_t)(loc + 8 + branch),
- DB_STGY_ANY);
- break;
- case 'X':
- db_printf("%s", insn_blktrans(insn));
- break;
- case 'c':
- db_printf("0x%08x", (insn & 0x00ffffff));
- break;
- case 'p':
- if (insn & 0x00400000)
- db_printf("spsr");
- else
- db_printf("cpsr");
- case 'B':
- if (insn & 0x00400000)
- db_printf("b");
- break;
- case 'S':
- if (insn & 0x00100000)
- db_printf("s");
- break;
- case 'T':
- if ((insn & 0x01200000) == 0x00200000)
- db_printf("t");
- break;
- case 'P':
- db_printf("%s", insn_fpaprec(insn));
- break;
- case 'R':
- db_printf("%s", insn_fparnd(insn));
- break;
- case 'W':
- if (insn & (1 << 21))
- db_printf("!");
- break;
- case '#':
- db_printf("CP #%d", (insn >> 8) & 0x0f);
- break;
- case 'y':
- db_printf("%d, ", (insn >> 20) & 0x0f);
-
- db_printf("cr%d, cr%d, cr%d", (insn >> 12) & 0x0f, (insn >> 16) & 0x0f,
- insn & 0x0f);
-
- db_printf(", %d", (insn >> 5) & 0x07);
- break;
- case 'z':
- db_printf("%d, ", (insn >> 21) & 0x07);
- db_printf("r%d, cr%d, cr%d", (insn >> 12) & 0x0f, (insn >> 16) & 0x0f,
- insn & 0x0f);
-
- if (((insn >> 5) & 0x07) != 0)
- db_printf(", %d", (insn >> 5) & 0x07);
- break;
- default:
- db_printf("[%02x:c](unknown)", *f_ptr, *f_ptr);
- break;
- }
- ++fmt;
- if (*(f_ptr+1) > 'A' && *(f_ptr+1) < 'Z')
- ++f_ptr;
- else if (*(++f_ptr)) {
- if (fmt == 1)
- db_printf("\t");
- else
- db_printf(", ");
- }
- };
-
- db_printf("\n");
-
- return(loc + 4);
-}
-
-
-void
-db_register_shift(insn)
- u_int insn;
-{
- db_printf("r%d", (insn & 0x0f));
- if ((insn & 0x00000ff0) == 0)
- ;
- else if ((insn & 0x00000ff0) == 0x00000060)
- db_printf(", RRX");
- else {
- if (insn & 0x10)
- db_printf(", %s r%d", op2_shift(insn),
- (insn >> 8) & 0x0f);
- else
- db_printf(", %s #%d", op2_shift(insn),
- (insn >> 7) & 0x1f);
- }
-}
-
-
-void
-db_print_reglist(insn)
- u_int insn;
-{
- int loop;
- int start;
- int comma;
-
- db_printf("{");
- start = -1;
- comma = 0;
-
- for (loop = 0; loop < 17; ++loop) {
- if (start != -1) {
- if (!(insn & (1 << loop)) || loop == 16) {
- if (comma)
- db_printf(", ");
- else
- comma = 1;
- if (start == loop - 1)
- db_printf("r%d", start);
- else
- db_printf("r%d-r%d", start, loop - 1);
- start = -1;
- }
- } else {
- if (insn & (1 << loop))
- start = loop;
- }
- }
- db_printf("}");
-
- if (insn & (1 << 22))
- db_printf("^");
-}
-
-void
-db_insn_ldrstr(insn, loc)
- u_int insn;
- u_int loc;
-{
- if (((insn >> 16) & 0x0f) == 15 && (insn & (1 << 21)) == 0
- && (insn & (1 << 24)) != 0 && (insn & (1 << 25) == 0)) {
- if (insn & 0x00800000)
- loc += (insn & 0xffff);
- else
- loc -= (insn & 0xffff);
- db_printsym((db_addr_t)(loc - 8), DB_STGY_ANY);
- } else {
- printf("[r%d", (insn >> 16) & 0x0f);
- printf("%s, ", (insn & (1 << 24)) ? "" : "]");
-
- if (!(insn & 0x00800000))
- printf("-");
- if (insn & (1 << 25))
- db_register_shift(insn);
- else
- printf("#0x%04x", insn & 0xfff);
- if (insn & (1 << 24))
- printf("]");
- }
-}
-
-
-
-#if 0
-
-u_int instruction_msrf(u_int addr, u_int word)
- {
- printf("MSR%s\t", opcode_condition(word));
-
- printf("%s_flg, ", (word & 0x00400000) ? "SPSR" : "CPSR");
-
- if (word & 0x02000000)
- printf("#0x%08x", (word & 0xff) << (32 - ((word >> 7) & 0x1e)));
- else
- printf("r%d", word &0x0f);
- return(addr);
- }
-
-
-u_int instruction_cdt(u_int addr, u_int word)
- {
- printf("%s%s%s\t", (word & (1 << 20)) ? "LDC" : "STC",
- opcode_condition(word), (word & (1 << 22)) ? "L" : "");
-
- printf("CP #%d, cr%d, ", (word >> 8) & 0x0f, (word >> 12) & 0x0f);
-
- printf("[r%d", (word >> 16) & 0x0f);
-
- printf("%s, ", (word & (1 << 24)) ? "" : "]");
-
- if (!(word & (1 << 23)))
- printf("-");
-
- printf("#0x%02x", word & 0xff);
-
- if (word & (1 << 24))
- printf("]");
-
- if (word & (1 << 21))
- printf("!");
-
- return(addr);
- }
-
-
-u_int instruction_ldfstf(u_int addr, u_int word)
- {
- printf("%s%s%s\t", (word & (1 << 20)) ? "LDF" : "STF",
- opcode_condition(word), (word & (1 << 22)) ? "L" : "");
-
- printf("f%d, [r%d", (word >> 12) & 0x07, (word >> 16) & 0x0f);
-
- printf("%s, ", (word & (1 << 24)) ? "" : "]");
-
- if (!(word & (1 << 23)))
- printf("-");
-
- printf("#0x%03x", (word & 0xff) << 2);
-
- if (word & (1 << 24))
- printf("]");
-
- if (word & (1 << 21))
- printf("!");
-
- return(addr);
- }
-
-#endif
-
-/* End of db_disasm.c */
diff --git a/sys/arch/arm32/arm32/db_interface.c b/sys/arch/arm32/arm32/db_interface.c
deleted file mode 100644
index fde231b8753..00000000000
--- a/sys/arch/arm32/arm32/db_interface.c
+++ /dev/null
@@ -1,288 +0,0 @@
-/* $NetBSD: db_interface.c,v 1.5 1996/03/18 21:33:05 mark Exp $ */
-
-/*
- * Copyright (c) 1996 Scott K. Stevens
- *
- * Mach Operating System
- * Copyright (c) 1991,1990 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- *
- * From: db_interface.c,v 2.4 1991/02/05 17:11:13 mrt (CMU)
- */
-
-/*
- * Interface to new debugger.
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/reboot.h>
-#include <sys/systm.h> /* just for boothowto */
-#include <sys/exec.h>
-
-#include <vm/vm.h>
-
-#include <machine/db_machdep.h>
-#include <machine/katelib.h>
-#include <machine/pte.h>
-#include <ddb/db_command.h>
-#include <ddb/db_variables.h>
-
-static int nil;
-
-int db_access_svc_sp __P((struct db_variable *, db_expr_t *, int));
-
-struct db_variable db_regs[] = {
- { "spsr", (long *)&DDB_TF->tf_spsr, FCN_NULL, },
- { "r0", (long *)&DDB_TF->tf_r0, FCN_NULL, },
- { "r1", (long *)&DDB_TF->tf_r1, FCN_NULL, },
- { "r2", (long *)&DDB_TF->tf_r2, FCN_NULL, },
- { "r3", (long *)&DDB_TF->tf_r3, FCN_NULL, },
- { "r4", (long *)&DDB_TF->tf_r4, FCN_NULL, },
- { "r5", (long *)&DDB_TF->tf_r5, FCN_NULL, },
- { "r6", (long *)&DDB_TF->tf_r6, FCN_NULL, },
- { "r7", (long *)&DDB_TF->tf_r7, FCN_NULL, },
- { "r8", (long *)&DDB_TF->tf_r8, FCN_NULL, },
- { "r9", (long *)&DDB_TF->tf_r9, FCN_NULL, },
- { "r10", (long *)&DDB_TF->tf_r10, FCN_NULL, },
- { "r11", (long *)&DDB_TF->tf_r11, FCN_NULL, },
- { "r12", (long *)&DDB_TF->tf_r12, FCN_NULL, },
- { "usr_sp", (long *)&DDB_TF->tf_usr_sp, FCN_NULL, },
- { "svc_sp", (long *)&nil, db_access_svc_sp, },
- { "usr_lr", (long *)&DDB_TF->tf_usr_lr, FCN_NULL, },
- { "svc_lr", (long *)&DDB_TF->tf_svc_lr, FCN_NULL, },
- { "pc", (long *)&DDB_TF->tf_pc, FCN_NULL, },
-};
-
-struct db_variable *db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
-
-extern label_t *db_recover;
-
-int db_active = 0;
-
-int db_access_svc_sp(vp, valp, rw)
- struct db_variable *vp;
- db_expr_t *valp;
- int rw;
-{
- if(rw == DB_VAR_GET)
- *valp = get_stackptr(PSR_SVC32_MODE);
- return(0);
-}
-
-#if 0
-extern char *trap_type[];
-#endif
-
-/*
- * Received keyboard interrupt sequence.
- */
-kdb_kbd_trap(tf)
- struct trapframe *tf;
-{
- if (db_active == 0 && (boothowto & RB_KDB)) {
- printf("\n\nkernel: keyboard interrupt\n");
- kdb_trap(-1, tf);
- }
-}
-
-/*
- * kdb_trap - field a TRACE or BPT trap
- */
-kdb_trap(type, tf)
- int type;
- register struct trapframe *tf;
-{
-
-#if 0
- fb_unblank();
-#endif
-
- switch (type) {
- case T_BREAKPOINT: /* breakpoint */
- case -1: /* keyboard interrupt */
- break;
- default:
- db_printf("kernel: trap");
- if (db_recover != 0) {
- db_error("Faulted in DDB; continuing...\n");
- /*NOTREACHED*/
- }
- }
-
- /* Should switch to kdb`s own stack here. */
-
- ddb_regs.ddb_tf = *tf;
- ddb_regs.ddb_tf.tf_pc -= 4;
-
- db_active++;
- cnpollc(TRUE);
- db_trap(type, 0/*code*/);
- cnpollc(FALSE);
- db_active--;
-
- *tf = ddb_regs.ddb_tf;
-
- return (1);
-}
-
-/*
- * Read bytes from kernel address space for debugger.
- */
-void
-db_read_bytes(addr, size, data)
- vm_offset_t addr;
- register int size;
- register char *data;
-{
- register char *src;
-
- src = (char *)addr;
- while (--size >= 0)
- *data++ = *src++;
-}
-
-#define splpmap() splimp()
-
-static void
-db_write_text(dst, ch)
- unsigned char *dst;
- int ch;
-{
- pt_entry_t *ptep, pte, pteo;
- int s;
- vm_offset_t va;
-
- s = splpmap();
- va = (unsigned long)dst & (~PGOFSET);
- ptep = vtopte(va);
-
- if ((*ptep & L2_MASK) == L2_INVAL) {
- db_printf(" address 0x%x not a valid page\n", dst);
- splx(s);
- return;
- }
-
- pteo = ReadWord(ptep);
- pte = pteo | PT_AP(AP_KRW);
- WriteWord(ptep, pte);
- tlbflush();
-
- *dst = (unsigned char)ch;
-
- WriteWord(ptep, pteo);
- tlbflush();
- splx(s);
-}
-
-/*
- * Write bytes to kernel address space for debugger.
- */
-void
-db_write_bytes(addr, size, data)
- vm_offset_t addr;
- register int size;
- register char *data;
-{
- extern char etext[];
- register char *dst;
-
- dst = (char *)addr;
- while (--size >= 0) {
- if ((dst >= (char *)VM_MIN_KERNEL_ADDRESS) && (dst < etext))
- db_write_text(dst, *data);
- else
- *dst = *data;
- dst++, data++;
- }
-}
-
-void
-Debugger()
-{
- asm(".word 0xe7ffffff");
-}
-
-void db_show_vmstat_cmd __P((db_expr_t addr, int have_addr, db_expr_t count, char *modif));
-void db_show_fs_cmd __P((db_expr_t addr, int have_addr, db_expr_t count, char *modif));
-void db_show_vnode_cmd __P((db_expr_t addr, int have_addr, db_expr_t count, char *modif));
-
-struct db_command arm32_db_command_table[] = {
- { "vmstat", db_show_vmstat_cmd, 0, NULL },
- { "fs", db_show_fs_cmd, 0, NULL },
- { "vnode", db_show_vnode_cmd, 0, NULL },
- { NULL, NULL, 0, NULL }
-};
-
-int
-db_trapper(addr, inst, frame)
- u_int addr;
- u_int inst;
- trapframe_t *frame;
-{
-/* db_printf("db_trapper\n");*/
- kdb_trap(1, frame);
- return(0);
-}
-
-extern u_int esym;
-extern u_int end;
-
-void
-db_machine_init()
-{
- struct exec *kernexec = (struct exec *)KERNEL_BASE;
- u_int *ptr;
- int len;
-
-/*
- * The boot loader currently loads the kernel with the a.out header still attached.
- */
-
- if (kernexec->a_syms == 0) {
- printf("[No symbol table]\n");
- } else {
- esym = (int)&end + kernexec->a_syms + sizeof(int);
- len = *((u_int *)esym);
- esym += (len + (sizeof(u_int) - 1)) & ~(sizeof(u_int) - 1);
- }
-
- install_coproc_handler(0, db_trapper);
- db_machine_commands_install(arm32_db_command_table);
-}
-
-
-u_int
-branch_taken(insn, pc, reg, db_regs)
- u_int insn;
- u_int pc;
- u_int reg;
- db_regs_t *db_regs;
-{
- int branch;
-
- branch = ((insn << 2) & 0x03ffffff);
- if (branch & 0x02000000)
- branch |= 0xfc000000;
- return(pc + 8 + branch);
-}
diff --git a/sys/arch/arm32/arm32/db_machdep.c b/sys/arch/arm32/arm32/db_machdep.c
deleted file mode 100644
index ef013173ee6..00000000000
--- a/sys/arch/arm32/arm32/db_machdep.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/* $NetBSD: db_machdep.c,v 1.1 1996/03/06 23:08:36 mark Exp $ */
-
-/*
- * Copyright (c) 1996 Mark Brinicombe
- *
- * Mach Operating System
- * Copyright (c) 1991,1990 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/mount.h>
-#include <sys/vnode.h>
-#include <machine/db_machdep.h>
-
-#include <ddb/db_access.h>
-#include <ddb/db_sym.h>
-
-void
-db_show_fs_cmd(addr, have_addr, count, modif)
- db_expr_t addr;
- int have_addr;
- db_expr_t count;
- char *modif;
-{
- struct vfsops **vfsp;
- int s;
-
- s = splhigh();
-
- db_printf("Registered filesystems (%d)\n", nvfssw);
-
- for (vfsp = &vfssw[0]; vfsp < &vfssw[nvfssw]; vfsp++) {
- if (*vfsp == NULL)
- continue;
- db_printf(" %s\n", (*vfsp)->vfs_name);
- }
- (void)splx(s);
-}
-
-
-/*
- * Print out a description of a vnode.
- * Some parts borrowed from kern/vfs_subr.c
- */
-
-static char *typename[] =
- { "VNON", "VREG", "VDIR", "VBLK", "VCHR", "VLNK", "VSOCK", "VFIFO", "VBAD" };
-
-void
-db_show_vnode_cmd(addr, have_addr, count, modif)
- db_expr_t addr;
- int have_addr;
- db_expr_t count;
- char *modif;
-{
- char buf[64];
- struct vnode *vp;
-
- if (!have_addr) {
- db_printf("vnode address must be specified\n");
- return;
- }
-
- vp = (struct vnode *)addr;
-
-/* Decode the one argument */
-
- db_printf("vp : %08x\n", (u_int)vp);
- db_printf("vp->v_type = %d\n", vp->v_type);
- db_printf("vp->v_flag = %ld\n", vp->v_flag);
- db_printf("vp->v_numoutput = %ld\n", vp->v_numoutput);
-
- db_printf("type %s, usecount %d, writecount %d, refcount %d,",
- typename[vp->v_type], vp->v_usecount, vp->v_writecount,
- vp->v_holdcnt);
- buf[0] = '\0';
- if (vp->v_flag & VROOT)
- strcat(buf, "|VROOT");
- if (vp->v_flag & VTEXT)
- strcat(buf, "|VTEXT");
- if (vp->v_flag & VSYSTEM)
- strcat(buf, "|VSYSTEM");
- if (vp->v_flag & VXLOCK)
- strcat(buf, "|VXLOCK");
- if (vp->v_flag & VXWANT)
- strcat(buf, "|VXWANT");
- if (vp->v_flag & VBWAIT)
- strcat(buf, "|VBWAIT");
- if (vp->v_flag & VALIASED)
- strcat(buf, "|VALIASED");
- if (buf[0] != '\0')
- db_printf(" flags (%s)", &buf[1]);
- db_printf("\n");
- if (vp->v_data != NULL) {
- db_printf("data=%08x\n", vp->v_data);
- }
-}
-
-
-void
-db_show_vmstat_cmd(addr, have_addr, count, modif)
- db_expr_t addr;
- int have_addr;
- db_expr_t count;
- char *modif;
-{
- struct vmmeter sum;
-
- sum = cnt;
- db_printf("%9u cpu context switches\n", sum.v_swtch);
- db_printf("%9u device interrupts\n", sum.v_intr);
- db_printf("%9u software interrupts\n", sum.v_soft);
- db_printf("%9u traps\n", sum.v_trap);
- db_printf("%9u system calls\n", sum.v_syscall);
- db_printf("%9u total faults taken\n", sum.v_faults);
- db_printf("%9u swap ins\n", sum.v_swpin);
- db_printf("%9u swap outs\n", sum.v_swpout);
- db_printf("%9u pages swapped in\n", sum.v_pswpin / CLSIZE);
- db_printf("%9u pages swapped out\n", sum.v_pswpout / CLSIZE);
- db_printf("%9u page ins\n", sum.v_pageins);
- db_printf("%9u page outs\n", sum.v_pageouts);
- db_printf("%9u pages paged in\n", sum.v_pgpgin);
- db_printf("%9u pages paged out\n", sum.v_pgpgout);
- db_printf("%9u pages reactivated\n", sum.v_reactivated);
- db_printf("%9u intransit blocking page faults\n", sum.v_intrans);
- db_printf("%9u zero fill pages created\n", sum.v_nzfod / CLSIZE);
- db_printf("%9u zero fill page faults\n", sum.v_zfod / CLSIZE);
- db_printf("%9u pages examined by the clock daemon\n", sum.v_scan);
- db_printf("%9u revolutions of the clock hand\n", sum.v_rev);
- db_printf("%9u VM object cache lookups\n", sum.v_lookups);
- db_printf("%9u VM object hits\n", sum.v_hits);
- db_printf("%9u total VM faults taken\n", sum.v_vm_faults);
- db_printf("%9u copy-on-write faults\n", sum.v_cow_faults);
- db_printf("%9u pages freed by daemon\n", sum.v_dfree);
- db_printf("%9u pages freed by exiting processes\n", sum.v_pfree);
- db_printf("%9u pages free\n", sum.v_free_count);
- db_printf("%9u pages wired down\n", sum.v_wire_count);
- db_printf("%9u pages active\n", sum.v_active_count);
- db_printf("%9u pages inactive\n", sum.v_inactive_count);
- db_printf("%9u bytes per page\n", sum.v_page_size);
-}
diff --git a/sys/arch/arm32/arm32/db_trace.c b/sys/arch/arm32/arm32/db_trace.c
deleted file mode 100644
index c44b4325a37..00000000000
--- a/sys/arch/arm32/arm32/db_trace.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* $NetBSD: db_trace.c,v 1.2 1996/03/06 22:49:51 mark Exp $ */
-
-/*
- * Copyright (c) 1996 Scott K. Stevens
- *
- * Mach Operating System
- * Copyright (c) 1991,1990 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <machine/db_machdep.h>
-
-#include <ddb/db_access.h>
-#include <ddb/db_sym.h>
-
-#define INKERNEL(va) (((vm_offset_t)(va)) >= USRSTACK)
-
-void
-db_stack_trace_cmd(addr, have_addr, count, modif)
- db_expr_t addr;
- int have_addr;
- db_expr_t count;
- char *modif;
-{
- struct frame *frame;
- boolean_t kernel_only = TRUE;
-
- {
- register char c, *cp = modif;
- while ((c = *cp++) != 0)
- if (c == 'u')
- kernel_only = FALSE;
- }
-
- if (count == -1)
- count = 65535;
-
-/*
- * The frame pointer points to the top word of the stack frame so we
- * need to adjust it by sizeof(struct frame) - sizeof(u_int))
- * to get the address of the start of the frame structure.
- */
-
- if (!have_addr)
- frame = (struct frame *)(DDB_TF->tf_r11 - (sizeof(struct frame) - sizeof(u_int)));
- else
- frame = (struct frame *)(addr - (sizeof(struct frame) - sizeof(u_int)));
-
- while (count--) {
- int i;
- db_expr_t offset;
- db_sym_t sym;
- char *name;
- db_addr_t pc;
-
-/* db_printf("fp=%08x: fp=%08x sp=%08x lr=%08x pc=%08x\n", (u_int)frame, frame->fr_fp, frame->fr_sp, frame->fr_lr, frame->fr_pc);*/
-
- pc = frame->fr_pc;
- if (!INKERNEL(pc))
- break;
-
- db_find_sym_and_offset(pc, &name, &offset);
- if (name == NULL)
- name = "?";
-
- db_printf("%s(", name);
-
- /*
- * Switch to next frame up
- */
- frame = (struct frame *)(frame->fr_fp - (sizeof(struct frame) - sizeof(u_int)));
-
- db_printsym(pc, DB_STGY_PROC);
- db_printf(")");
- db_printf("\n");
- if (frame == NULL)
- break;
- }
-}
diff --git a/sys/arch/arm32/arm32/debug.c b/sys/arch/arm32/arm32/debug.c
deleted file mode 100644
index 9654a893dde..00000000000
--- a/sys/arch/arm32/arm32/debug.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/* $NetBSD: debug.c,v 1.2 1996/03/08 20:14:48 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Melvin Tang-Richardson (Nut)
- * Copyright (c) 1994 Mark Brinicombe
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by RiscBSD.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * debug.c
- *
- * Debugging functions
- *
- * Created : 11/10/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/callout.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/mount.h>
-#include <sys/vnode.h>
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-
-int
-debug_count_processes_on_q(queue)
- int queue;
-{
- struct proc *lastproc, *queue_head;
- int counter;
- int s;
-
- counter = 0;
- s = splhigh();
- queue_head=(struct proc *)&qs[queue];
- for (lastproc=qs[queue].ph_link;lastproc!=queue_head;lastproc=lastproc->p_forw) {
- if (lastproc != queue_head)
- printf("Process queue=%8x proc=%08x p_addr=%8x, comm=%s\n",
- queue, (u_int) lastproc, (u_int) lastproc->p_addr,
- lastproc->p_comm);
- counter++;
- }
- (void)splx(s);
- return(counter);
-}
-
-void
-debug_show_q_details()
-{
- int counter=0;
- int s;
-
- s = splhigh();
- for (counter=0; counter<32; counter++ )
- debug_count_processes_on_q(counter);
-
- if (whichqs == 0)
- printf("queues empty\n");
- (void)splx(s);
-}
-
-void
-debug_show_all_procs(argc, argv)
- int argc;
- char *argv[];
-{
- int np;
- struct proc *ap, *p, *pp;
- int s;
-
- s = splhigh();
-
- np = nprocs;
- p = ap = (struct proc *)allproc.lh_first;
- if (argc > 1)
- printf(" pid proc addr map pcb pmap comm wchan\n");
- else
- printf(" pid proc addr uid ppid pgrp flag stat comm cputime \n");
- while (--np >= 0) {
- pp = p->p_pptr;
- if (pp == 0)
- pp = p;
- if (p->p_stat) {
- if (argc > 1)
- printf("%5d %08x %08x %08x %08x %08x %12s ",
- p->p_pid, (u_int) ap, (u_int)p->p_addr,
- (u_int) p->p_vmspace,
- (u_int) &p->p_addr->u_pcb, (p->p_vmspace ? (u_int)&p->p_vmspace->vm_pmap : 0),
- ((p->p_comm == 0) ? "..." : p->p_comm));
- else
- printf("%5d %08x %08x %5d %5d %5d %08x %d %12s %5u.%02d ",
- p->p_pid, (u_int) ap, (u_int) p->p_addr,
- p->p_cred->p_ruid,
- pp->p_pid, p->p_pgrp->pg_id, p->p_flag,
- p->p_stat, p->p_comm,
- (u_int)p->p_rtime.tv_sec,
- (u_int)p->p_rtime.tv_usec / 10000);
- if (p->p_wchan && argc > 1) {
- if (p->p_wmesg)
- printf("%12s ", p->p_wmesg);
- printf("%x", (u_int)p->p_wchan);
- }
- printf("\n");
- }
- ap = p->p_list.le_next;
- if (ap == 0 && np > 0)
- ap = (struct proc*)zombproc.lh_first;
- p = ap;
- }
- (void)splx(s);
-}
-
-
-void
-debug_show_callout(argc, argv)
- int argc;
- char *argv[];
-{
- register struct callout *p1;
- register int cum;
- register int s;
- register int t;
-
- s = splhigh();
- printf(" cum ticks func arg\n");
- for (cum = 0, p1 = calltodo.c_next; p1; p1 = p1->c_next) {
- t = p1->c_time;
- if (t > 0)
- cum += t;
- printf("%9d %9d %08x %08x\n", cum, t, (u_int) p1->c_func,
- (u_int) p1->c_arg);
- }
- (void)splx(s);
-}
-
-void
-debug_show_fs(argc, argv)
- int argc;
- char *argv[];
-{
- struct vfsops **vfsp;
- int s;
-
- s = splhigh();
-
- printf("Registered filesystems (%d)\n", nvfssw);
-
- for (vfsp = &vfssw[0]; vfsp < &vfssw[nvfssw]; vfsp++) {
- if (*vfsp == NULL)
- continue;
- printf(" %s\n", (*vfsp)->vfs_name);
- }
- (void)splx(s);
-}
-
-
-void
-debug_show_vm_map(map, text)
- vm_map_t map;
- char *text;
-{
- vm_map_entry_t mapentry;
- int s;
-
- s = splhigh();
-
- printf("vm_map dump : %s\n", text);
-
- mapentry = &map->header;
-
- do {
- printf("vm_map_entry: start = %08x end = %08x\n",
- (u_int) mapentry->start, (u_int) mapentry->end);
- mapentry = mapentry->next;
- } while (mapentry != &map->header);
- (void)splx(s);
-}
-
-
-void
-debug_show_pmap(pmap)
- pmap_t pmap;
-{
- u_int loop;
- u_int loop1;
- u_int start;
- pt_entry_t *pt;
- pd_entry_t *pd;
- int s;
-
- s = splhigh();
-
- pd = (pd_entry_t *)pmap;
-
- printf("pdir=%08x\n", (u_int) pd);
- for (loop = 0; loop < 4096; ++loop) {
- if (pd[loop] == 0)
- continue;
- printf("%08x : %08x\n", loop * 1024*1024, pd[loop]);
- if ((pd[loop] & 0xff) == 0x11) {
- pt = (pt_entry_t *)(PROCESS_PAGE_TBLS_BASE
- + loop * 1024);
- loop1 = 0;
- while (loop1 < 256) {
- if (pt[loop1]) {
- start = loop1;
- ++loop1;
- while (loop1 < 256 && pt[loop1])
- ++loop1;
- printf(" %08x -> %08x\n",
- loop * 1024*1024 + start * 4096,
- loop * 1024*1024 + loop1 * 4096 - 1);
- }
- ++loop1;
- }
- }
- }
- (void)splx(s);
-}
-
-/* End of debug.c */
diff --git a/sys/arch/arm32/arm32/disassem.c b/sys/arch/arm32/arm32/disassem.c
deleted file mode 100644
index 4ebddbd8975..00000000000
--- a/sys/arch/arm32/arm32/disassem.c
+++ /dev/null
@@ -1,650 +0,0 @@
-/* $NetBSD: disassem.c,v 1.3 1996/03/16 00:13:09 thorpej Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * disassem.c
- *
- * Debug / Monitor disassembler
- *
- * Created : 09/10/94
- */
-
-/* Include standard header files */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-/* Local header files */
-
-#include <machine/katelib.h>
-
-typedef u_int (*instruction_decoder) (u_int addr, u_int word);
-
-typedef struct _opcodes {
- u_int mask;
- u_int pattern;
- u_int colour;
- instruction_decoder decoder;
-} opcodes_struct;
-
-u_int instruction_swi(u_int addr, u_int word);
-u_int instruction_branch(u_int addr, u_int word);
-u_int instruction_mul(u_int addr, u_int word);
-u_int instruction_mla(u_int addr, u_int word);
-u_int instruction_ldrstr(u_int addr, u_int word);
-u_int instruction_ldmstm(u_int addr, u_int word);
-u_int instruction_dataproc(u_int addr, u_int word);
-u_int instruction_swap(u_int addr, u_int word);
-u_int instruction_mrs(u_int addr, u_int word);
-u_int instruction_msr(u_int addr, u_int word);
-u_int instruction_msrf(u_int addr, u_int word);
-u_int instruction_mrcmcr(u_int addr, u_int word);
-u_int instruction_cdp(u_int addr, u_int word);
-u_int instruction_cdt(u_int addr, u_int word);
-u_int instruction_fpabinop(u_int addr, u_int word);
-u_int instruction_fpaunop(u_int addr, u_int word);
-u_int instruction_ldfstf(u_int addr, u_int word);
-
-/* Declare global variables */
-
-opcodes_struct opcodes[] = {
- { 0x0f000000, 0x0f000000, 7, instruction_swi },
- { 0x0e000000, 0x0a000000, 7, instruction_branch },
- { 0x0fe000f0, 0x00000090, 7, instruction_mul },
- { 0x0fe000f0, 0x00200090, 7, instruction_mla },
- { 0x0e000000, 0x04000000, 7, instruction_ldrstr },
- { 0x0c000010, 0x04000000, 7, instruction_ldrstr },
- { 0x0e000000, 0x08000000, 6, instruction_ldmstm },
- { 0x0FB00FF0, 0x01000090, 7, instruction_swap },
- { 0x0FBF0FFF, 0x010F0000, 1, instruction_mrs },
- { 0x0DBFFFF0, 0x0129F000, 1, instruction_msr },
- { 0x0DBFFFF0, 0x0128F000, 1, instruction_msrf },
- { 0x0C000000, 0x00000000, 7, instruction_dataproc },
- { 0x0F008F10, 0x0E000100, 3, instruction_fpabinop },
- { 0x0F008F10, 0x0E008100, 3, instruction_fpaunop },
- { 0x0E000F00, 0x0C000100, 3, instruction_ldfstf },
- { 0x0F000010, 0x0E000010, 2, instruction_mrcmcr },
- { 0x0F000010, 0x0E000000, 2, instruction_cdp },
- { 0x0E000000, 0x0C000000, 2, instruction_cdt },
- { 0x00000000, 0x00000000, 0, NULL }
-};
-
-char *opcode_conditions[] = {
- "EQ",
- "NE",
- "CS",
- "CC",
- "MI",
- "PL",
- "VS",
- "VC",
- "HI",
- "LS",
- "GE",
- "LT",
- "GT",
- "LE",
- "",
- "NV"
-};
-
-char *opcode_data_procs[] = {
- "AND",
- "EOR",
- "SUB",
- "RSB",
- "ADD",
- "ADC",
- "SBC",
- "RSC",
- "TST",
- "TEQ",
- "CMP",
- "CMN",
- "ORR",
- "MOV",
- "BIC",
- "MVN"
-};
-
-char *opcode_shifts[] = {
- "LSL",
- "LSR",
- "ASR",
- "ROR"
-};
-
-char *opcode_block_transfers[] = {
- "DA",
- "IA",
- "DB",
- "IB"
-};
-
-char *opcode_stack_block_transfers[] = {
- "FA",
- "EA",
- "FD",
- "FA"
-};
-
-char *opcode_fpabinops[] = {
- "ADF",
- "MUF",
- "SUF",
- "RSF",
- "DVF",
- "RDF",
- "POW",
- "RPW",
- "RMF",
- "FML",
- "FDV",
- "FRD",
- "POL",
- "???",
- "???",
- "???",
- "???"
-};
-
-char *opcode_fpaunops[] = {
- "MVF",
- "MNF",
- "ABS",
- "RND",
- "SQT",
- "LOG",
- "LGN",
- "EXP",
- "SIN",
- "COS",
- "TAN",
- "ASN",
- "ACS",
- "ATN",
- "???",
- "???",
- "???"
-};
-
-char *opcode_fpaconstants[] = {
- "0.0",
- "1.0",
- "2.0",
- "3.0",
- "4.0",
- "5.0",
- "0.5",
- "10.0"
-};
-
-char *opcode_fpa_rounding[] = {
- "",
- "P",
- "M",
- "Z"
-};
-
-char *opcode_fpa_precision[] = {
- "S",
- "D",
- "E",
- "P"
-};
-
-#define opcode_condition(x) opcode_conditions[x >> 28]
-
-#define opcode_s(x) ((x & 0x00100000) ? "S" : "")
-
-#define opcode_b(x) ((x & 0x00400000) ? "B" : "")
-
-#define opcode_t(x) ((x & 0x01200000) == 0x00200000 ? "T" : "")
-
-#define opcode_dataproc(x) opcode_data_procs[(x >> 21) & 0x0f]
-
-#define opcode_shift(x) opcode_shifts[(x >> 5) & 3]
-
-#define opcode_blktrans(x) opcode_block_transfers[(x >> 23) & 3]
-
-#define opcode_stkblktrans(x) opcode_stack_block_transfers[(x >> 23) & 3]
-
-#define opcode_fpabinop(x) opcode_fpabinops[(x >> 20) & 0x0f]
-
-#define opcode_fpaunop(x) opcode_fpaunops[(x >> 20) & 0x0f]
-
-#define opcode_fpaimm(x) opcode_fpaconstants[x & 0x07]
-
-#define opcode_fparnd(x) opcode_fpa_rounding[(x >> 5) & 0x03]
-
-#define opcode_fpaprec(x) opcode_fpa_precision[(((x >> 18) & 2)|(x >> 7)) & 3]
-
-/* Declare external variables */
-
-extern caddr_t shell_ident;
-
-/* Local function prototypes */
-
-u_int disassemble(u_char *addr);
-
-/* Now for the main code */
-
-void
-printascii(byte)
- int byte;
-{
- if (byte < 0x20)
- printf("\x1b[31m%c\x1b[0m", byte + '@');
- else if (byte == 0x7f)
- printf("\x1b[31m?\x1b[0m");
- else
- printf("%c", byte);
-}
-
-
-u_int disassemble(u_char *addr)
- {
- int loop;
- u_int word;
- u_int result = 0;
-
- printf("%08x : ", (u_int)addr);
-
- word = *((u_int *)addr);
-
- for (loop = 0; loop < 4; ++loop)
- printascii(addr[loop]);
-
- printf(" : %08x : ", word);
-
- loop = 0;
-
- while (opcodes[loop].mask != 0)
- {
- if ((word & opcodes[loop].mask) == opcodes[loop].pattern)
- {
- printf("\x1b[3%dm", opcodes[loop].colour);
- result = (*opcodes[loop].decoder)((u_int )addr, word);
- printf("\x1b[0m");
- break;
- }
- ++loop;
- }
-
- if (opcodes[loop].mask == 0)
- printf("Undefined instruction");
-
- printf("\n\r");
- return(result);
- }
-
-
-u_int instruction_swi(u_int addr, u_int word)
- {
- printf("SWI%s\t0x%08x", opcode_condition(word), (word & 0x00ffffff));
- return(addr);
- }
-
-
-u_int instruction_branch(u_int addr, u_int word)
- {
- u_int branch;
-
- branch = ((word << 2) & 0x03ffffff);
- if (branch & 0x02000000)
- branch |= 0xfc000000;
-
- branch += addr + 8;
-
- if (word & 0x01000000)
- printf("BL%s\t0x%08x", opcode_condition(word), branch);
- else
- printf("B%s\t0x%08x", opcode_condition(word), branch);
-
- return(branch);
- }
-
-
-u_int instruction_mul(u_int addr, u_int word)
- {
- printf("MUL%s%s\t", opcode_condition(word), opcode_s(word));
-
- printf("r%d, r%d, r%d", (word >> 16) & 0x0f, word & 0x0f,
- (word >> 8) & 0x0f);
- return(addr);
- }
-
-
-u_int instruction_mla(u_int addr, u_int word)
- {
- printf("MLA%s%s\t", opcode_condition(word), opcode_s(word));
-
- printf("r%d, r%d, r%d, r%d", (word >> 16) & 0x0f, word & 0x0f,
- (word >> 8) & 0x0f, (word >> 12) & 0x0f);
- return(addr);
- }
-
-
-void register_shift(u_int word)
- {
- printf("r%d", (word & 0x0f));
- if ((word & 0x00000ff0) == 0)
- ;
- else if ((word & 0x00000ff0) == 0x00000060)
- printf(", RRX");
- else
- {
- if (word & 0x10)
- {
- printf(", %s r%d", opcode_shift(word), (word >> 8) & 0x0f);
- }
- else
- {
- printf(", %s #%d", opcode_shift(word), (word >> 7) & 0x1f);
- }
- }
- }
-
-
-u_int instruction_ldrstr(u_int addr, u_int word)
- {
- printf("%s%s%s%s\t", (word & 0x00100000) ? "LDR" : "STR",
- opcode_condition(word), opcode_b(word), opcode_t(word));
-
- printf("r%d, ", (word >> 12) & 0x0f);
-
- if (((word >> 16) & 0x0f) == 16)
- {
-/* u_int location;
-
- location = addr + 8;
-
- addr = */
- }
- else
- {
- printf("[r%d", (word >> 16) & 0x0f);
-
- printf("%s, ", (word & (1 << 24)) ? "" : "]");
-
- if (!(word & 0x00800000))
- printf("-");
-
- if (word & (1 << 25))
- register_shift(word);
- else
- printf("#0x%04x", word & 0xfff);
-
- if (word & (1 << 24))
- printf("]");
-
- if (word & (1 << 21))
- printf("!");
- }
-
- return(addr);
- }
-
-
-u_int instruction_ldmstm(u_int addr, u_int word)
- {
- int loop;
- int start;
-
- printf("%s%s%s\t", (word & 0x00100000) ? "LDM" : "STM",
- opcode_condition(word), opcode_blktrans(word));
-
- printf("r%d", (word >> 16) & 0x0f);
-
- if (word & (1 << 21))
- printf("!");
-
- printf(", {");
-
- start = -1;
-
- for (loop = 0; loop < 17; ++loop)
- {
- if (start != -1)
- {
- if (!(word & (1 << loop)) || loop == 16)
- {
- if (start == loop - 1)
- printf("r%d, ", start);
- else
- printf("r%d-r%d, ", start, loop - 1);
- start = -1;
- }
- }
- else
- {
- if (word & (1 << loop))
- start = loop;
- }
-
- }
- printf("\x7f\x7f}");
-
- if (word & (1 << 22))
- printf("^");
- return(addr);
- }
-
-
-u_int instruction_dataproc(u_int addr, u_int word)
- {
- if ((word & 0x01800000) == 0x01000000)
- word = word & ~(1<<20);
-
- printf("%s%s%s\t", opcode_dataproc(word), opcode_condition(word),
- opcode_s(word));
-
- if ((word & 0x01800000) != 0x01000000)
- printf("r%d, ", (word >> 12) & 0x0f);
-
- if ((word & 0x01a00000) != 0x01a00000)
- printf("r%d, ", (word >> 16) & 0x0f);
-
- if (word & 0x02000000)
- {
- printf("#&%08x", (word & 0xff) << (((word >> 7) & 0x1e)));
- }
- else
- {
- register_shift(word);
- }
- return(addr);
- }
-
-
-u_int instruction_swap(u_int addr, u_int word)
- {
- printf("SWP%s%s\t", opcode_condition(word), opcode_b(word));
-
- printf("r%d, r%d, [r%d]", (word >> 12) & 0x0f, (word & 0x0f),
- (word >> 16) & 0x0f);
- return(addr);
- }
-
-
-u_int instruction_mrs(u_int addr, u_int word)
- {
- printf("MRS%s\tr%d, ", opcode_condition(word), (word >> 12) & 0x0f);
-
- printf("%s", (word & 0x00400000) ? "SPSR" : "CPSR");
- return(addr);
- }
-
-
-u_int instruction_msr(u_int addr, u_int word)
- {
- printf("MSR%s\t", opcode_condition(word));
-
- printf("%s, r%d", (word & 0x00400000) ? "SPSR" : "CPSR", word & 0x0f);
-
- return(addr);
- }
-
-
-u_int instruction_msrf(u_int addr, u_int word)
- {
- printf("MSR%s\t", opcode_condition(word));
-
- printf("%s_flg, ", (word & 0x00400000) ? "SPSR" : "CPSR");
-
- if (word & 0x02000000)
- printf("#0x%08x", (word & 0xff) << (32 - ((word >> 7) & 0x1e)));
- else
- printf("r%d", word &0x0f);
- return(addr);
- }
-
-
-u_int instruction_mrcmcr(u_int addr, u_int word)
- {
- printf("%s%s\t", (word & (1 << 20)) ? "MRC" : "MCR",
- opcode_condition(word));
-
- printf("CP #%d, %d, ", (word >> 8) & 0x0f, (word >> 21) & 0x07);
-
- printf("r%d, cr%d, cr%d", (word >> 12) & 0x0f, (word >> 16) & 0x0f,
- word & 0x0f);
-
- if (((word >> 5) & 0x07) != 0)
- printf(", %d", (word >> 5) & 0x07);
-
- return(addr);
- }
-
-
-u_int instruction_cdp(u_int addr, u_int word)
- {
- printf("CDP%s\t", opcode_condition(word));
-
- printf("CP #%d, %d, ", (word >> 8) & 0x0f, (word >> 20) & 0x0f);
-
- printf("cr%d, cr%d, cr%d", (word >> 12) & 0x0f, (word >> 16) & 0x0f,
- word & 0x0f);
-
- printf(", %d", (word >> 5) & 0x07);
-
- return(addr);
- }
-
-
-u_int instruction_cdt(u_int addr, u_int word)
- {
- printf("%s%s%s\t", (word & (1 << 20)) ? "LDC" : "STC",
- opcode_condition(word), (word & (1 << 22)) ? "L" : "");
-
- printf("CP #%d, cr%d, ", (word >> 8) & 0x0f, (word >> 12) & 0x0f);
-
- printf("[r%d", (word >> 16) & 0x0f);
-
- printf("%s, ", (word & (1 << 24)) ? "" : "]");
-
- if (!(word & (1 << 23)))
- printf("-");
-
- printf("#0x%02x", word & 0xff);
-
- if (word & (1 << 24))
- printf("]");
-
- if (word & (1 << 21))
- printf("!");
-
- return(addr);
- }
-
-
-u_int instruction_fpabinop(u_int addr, u_int word)
- {
- printf("%s%s%s%s\t", opcode_fpabinop(word), opcode_condition(word),
- opcode_fpaprec(word), opcode_fparnd(word));
-
- printf("f%d, f%d, ", (word >> 12) & 0x07, (word >> 16) & 0x07);
-
- if (word & (1 << 3))
- printf("#%s", opcode_fpaimm(word));
- else
- printf("f%d", word & 0x07);
-
- return(addr);
- }
-
-
-u_int instruction_fpaunop(u_int addr, u_int word)
- {
- printf("%s%s%s%s\t", opcode_fpaunop(word), opcode_condition(word),
- opcode_fpaprec(word), opcode_fparnd(word));
-
- printf("f%d, ", (word >> 12) & 0x07);
-
- if (word & (1 << 3))
- printf("#%s", opcode_fpaimm(word));
- else
- printf("f%d", word & 0x07);
-
- return(addr);
- }
-
-
-u_int instruction_ldfstf(u_int addr, u_int word)
- {
- printf("%s%s%s\t", (word & (1 << 20)) ? "LDF" : "STF",
- opcode_condition(word), (word & (1 << 22)) ? "L" : "");
-
- printf("f%d, [r%d", (word >> 12) & 0x07, (word >> 16) & 0x0f);
-
- printf("%s, ", (word & (1 << 24)) ? "" : "]");
-
- if (!(word & (1 << 23)))
- printf("-");
-
- printf("#0x%03x", (word & 0xff) << 2);
-
- if (word & (1 << 24))
- printf("]");
-
- if (word & (1 << 21))
- printf("!");
-
- return(addr);
- }
-
-/* End of disassem.c */
diff --git a/sys/arch/arm32/arm32/disksubr.c b/sys/arch/arm32/arm32/disksubr.c
deleted file mode 100644
index 5901b429cfa..00000000000
--- a/sys/arch/arm32/arm32/disksubr.c
+++ /dev/null
@@ -1,583 +0,0 @@
-/* $NetBSD: disksubr.c,v 1.2 1996/03/06 22:43:11 mark Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
- * Copyright (c) 1995 Mark Brinicombe
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/dkbad.h>
-#include <sys/disklabel.h>
-#include <sys/syslog.h>
-#include <sys/device.h>
-#include <sys/disk.h>
-
-#define b_cylin b_resid
-
-/* int filecore_checksum(char *bootblock)
- *
- * Calculates the filecore boot block checksum. This is used to validate
- * a filecore boot block on the disc. If a boot block is validated then
- * it is used to locate the partition table. If the boot block is not
- * validated, it is assumed that the whole disc is RiscBSD.
- */
-
-/*
- * This can be coded better using add with carry but as it is used rarely
- * there is not much point writing it in assembly.
- */
-
-u_int
-filecore_checksum(bootblock)
- u_char *bootblock;
-{
- register u_int sum;
- register u_int loop;
-
-/* A boot block of zero has a zero checksum - clever thinking Acorn, NOT ! */
-
- sum = 0;
-
- for (loop = 0; loop < 512; ++loop)
- sum += bootblock[loop];
-
-/* If the whole block is zero then it is invalid */
-
- if (sum == 0) return(0xffff);
-
- sum = 0;
-
- for (loop = 0; loop < 511; ++loop) {
- sum += bootblock[loop];
- if (sum > 255)
- sum -= 255;
- }
-
- return(sum);
-}
-
-
-/*
- * Attempt to read a disk label from a device
- * using the indicated strategy routine.
- * The label must be partly set up before this:
- * secpercyl, secsize and anything required for a block i/o read
- * operation in the driver's strategy/start routines
- * must be filled in before calling us.
- *
- * If dos partition table requested, attempt to load it and
- * find disklabel inside a DOS partition. Also, if bad block
- * table needed, attempt to extract it as well. Return buffer
- * for use in signalling errors if requested.
- *
- * Returns null on success and an error string on failure.
- */
-
-char *
-readdisklabel(dev, strat, lp, osdep, spoofonly)
- dev_t dev;
- void (*strat)();
- struct disklabel *lp;
- struct cpu_disklabel *osdep;
- int spoofony;
-{
- struct riscbsd_partition *rp = osdep->partitions;
- struct dkbad *bdp = &osdep->bad;
- register struct buf *bp;
- struct disklabel *dlp;
- char *msg = NULL;
- int cyl, riscbsdpartoff, i;
-
-/* printf("Reading disclabel for %04x\n", dev);*/
-
-/* minimal requirements for archtypal disk label */
-
- if (lp->d_secsize == 0)
- lp->d_secsize = DEV_BSIZE;
-
- if (lp->d_secperunit == 0)
- lp->d_secperunit = 0x1fffffff;
-
- lp->d_npartitions = MAXPARTITIONS;
- for (i = 0; i < MAXPARTITIONS; i++) {
- if (i == RAW_PART) continue;
- lp->d_partitions[i].p_offset = 0;
- lp->d_partitions[i].p_fstype = FS_UNUSED;
- lp->d_partitions[i].p_size = 0;
- }
-
- if (lp->d_partitions[RAW_PART].p_size == 0) {
- lp->d_partitions[RAW_PART].p_fstype = FS_UNUSED;
- lp->d_partitions[RAW_PART].p_offset = 0;
- lp->d_partitions[RAW_PART].p_size = 0x1fffffff;
- }
-
- if (spoofonly)
- return (NULL);
-
-/* obtain buffer to probe drive with */
-
- bp = geteblk((int)lp->d_secsize);
-
-/* request no partition relocation by driver on I/O operations */
-
- bp->b_dev = dev;
-
-/* do riscbsd partitions in the process of getting disklabel? */
-
- riscbsdpartoff = 0;
- cyl = LABELSECTOR / lp->d_secpercyl;
-
- if (rp) {
- struct filecore_bootblock *bb;
- int heads;
- int sectors;
-
-/* read the filecore boot block */
-
-/* printf("readdisclabel: Reading boot block\n");*/
-
- bp->b_blkno = FILECORE_BOOT_SECTOR;
- bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
- bp->b_cylin = bp->b_blkno / lp->d_secpercyl;
- (*strat)(bp);
-
-/* if successful, validate boot block and locate parition table */
-
- if (biowait(bp)) {
- msg = "filecore boot block I/O error";
- goto done;
- }
-
- bb = (struct filecore_bootblock *)bp->b_data;
-
-/* Validate boot block */
-
- if (bb->checksum != filecore_checksum((u_char *)bb)) {
-
-/* Invalid boot block so lets assume the entire disc is RiscBSD */
-
-/* printf("readdisklabel: Invalid filecore boot block (incorrect checksum)\n");*/
- goto readlabel;
- }
-
-/* Get some information from the boot block */
-
- cyl = bb->partition_cyl_low + (bb->partition_cyl_high << 8);
-
- heads = bb->heads;
- sectors = bb->secspertrack;
-
-/* Do we have a RiscBSD partition table ? */
-
- if (bb->partition_type == PARTITION_FORMAT_RISCBSD) {
-/* printf("heads = %d nsectors = %d\n", heads, sectors);*/
-
- riscbsdpartoff = cyl * heads * sectors;
- } else if (bb->partition_type == PARTITION_FORMAT_RISCIX) {
- struct riscix_partition_table *rpt;
- int loop;
-
-/* We have a RISCiX partition table :-( groan */
-
-/* Ok read the RISCiX partition table and see if there is a RiscBSD partition */
-
- bp->b_blkno = cyl * heads * sectors;
- printf("Found RiscIX partition table @ %08x\n", bp->b_blkno);
- bp->b_cylin = bp->b_blkno / lp->d_secpercyl;
- bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
- (*strat)(bp);
-
-/* if successful, locate disk label within block and validate */
-
- if (biowait(bp)) {
- msg = "disk label I/O error";
- goto done;
- }
-
- rpt = (struct riscix_partition_table *)bp->b_data;
-/* for (loop = 0; loop < NRISCIX_PARTITIONS; ++loop)
- printf("p%d: %16s %08x %08x %08x\n", loop,
- rpt->partitions[loop].rp_name,
- rpt->partitions[loop].rp_start,
- rpt->partitions[loop].rp_length,
- rpt->partitions[loop].rp_type);
-*/
- for (loop = 0; loop < NRISCIX_PARTITIONS; ++loop) {
- if (strcmp(rpt->partitions[loop].rp_name, "RiscBSD") == 0
- || strcmp(rpt->partitions[loop].rp_name, "NetBSD") == 0) {
- riscbsdpartoff = rpt->partitions[loop].rp_start;
- break;
- }
- }
- if (loop == NRISCIX_PARTITIONS) {
- msg = "RiscBSD partition identifier string not found.";
- goto done;
- }
- } else {
- msg = "Invalid partition format";
- goto done;
- }
- }
-
-/* next, dig out disk label */
-
-readlabel:
-/* printf("Reading disklabel addr=%08x\n", riscbsdpartoff * DEV_BSIZE);*/
-
- bp->b_blkno = riscbsdpartoff + LABELSECTOR;
- bp->b_cylin = bp->b_blkno / lp->d_secpercyl;
- bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
- (*strat)(bp);
-
-/* if successful, locate disk label within block and validate */
-
- if (biowait(bp)) {
- msg = "disk label I/O error";
- goto done;
- }
- for (dlp = (struct disklabel *)bp->b_data;
- dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp));
- dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
- if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
- if (msg == NULL)
- msg = "no disk label";
- } else if (dlp->d_npartitions > MAXPARTITIONS ||
- dkcksum(dlp) != 0)
- msg = "disk label corrupted";
- else {
- *lp = *dlp;
- msg = NULL;
- break;
- }
- }
-
- if (msg)
- goto done;
-
- /* obtain bad sector table if requested and present */
- if (bdp && (lp->d_flags & D_BADSECT)) {
- struct dkbad *db;
-
- i = 0;
- do {
- /* read a bad sector table */
- bp->b_flags = B_BUSY | B_READ;
- bp->b_blkno = lp->d_secperunit - lp->d_nsectors + i;
- if (lp->d_secsize > DEV_BSIZE)
- bp->b_blkno *= lp->d_secsize / DEV_BSIZE;
- else
- bp->b_blkno /= DEV_BSIZE / lp->d_secsize;
- bp->b_bcount = lp->d_secsize;
- bp->b_cylin = lp->d_ncylinders - 1;
- (*strat)(bp);
-
- /* if successful, validate, otherwise try another */
- if (biowait(bp)) {
- msg = "bad sector table I/O error";
- } else {
- db = (struct dkbad *)(bp->b_data);
-#define DKBAD_MAGIC 0x4321
- if (db->bt_mbz == 0
- && db->bt_flag == DKBAD_MAGIC) {
- msg = NULL;
- *bdp = *db;
- break;
- } else
- msg = "bad sector table corrupted";
- }
- } while ((bp->b_flags & B_ERROR) && (i += 2) < 10 &&
- i < lp->d_nsectors);
- }
-
-done:
- bp->b_flags = B_INVAL | B_AGE | B_READ;
- brelse(bp);
- return (msg);
-}
-
-
-/*
- * Check new disk label for sensibility
- * before setting it.
- */
-
-int
-setdisklabel(olp, nlp, openmask, osdep)
- struct disklabel *olp;
- struct disklabel *nlp;
- u_long openmask;
- struct cpu_disklabel *osdep;
-{
- register i;
- register struct partition *opp, *npp;
-
-/* sanity clause */
-
- if (nlp->d_secpercyl == 0 || nlp->d_secsize == 0
- || (nlp->d_secsize % DEV_BSIZE) != 0)
- return(EINVAL);
-
-/* special case to allow disklabel to be invalidated */
-
- if (nlp->d_magic == 0xffffffff) {
- *olp = *nlp;
- return (0);
- }
-
- if (nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC
- || dkcksum(nlp) != 0)
- return (EINVAL);
-
-/* XXX missing check if other dos partitions will be overwritten */
-
- while (openmask != 0) {
- i = ffs(openmask) - 1;
- openmask &= ~(1 << i);
- if (nlp->d_npartitions <= i)
- return (EBUSY);
- opp = &olp->d_partitions[i];
- npp = &nlp->d_partitions[i];
- if (npp->p_offset != opp->p_offset || npp->p_size < opp->p_size)
- return (EBUSY);
- /*
- * Copy internally-set partition information
- * if new label doesn't include it. XXX
- */
- if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
- npp->p_fstype = opp->p_fstype;
- npp->p_fsize = opp->p_fsize;
- npp->p_frag = opp->p_frag;
- npp->p_cpg = opp->p_cpg;
- }
- }
-
- nlp->d_checksum = 0;
- nlp->d_checksum = dkcksum(nlp);
- *olp = *nlp;
- return (0);
-}
-
-
-/*
- * Write disk label back to device after modification.
- */
-
-int
-writedisklabel(dev, strat, lp, osdep)
- dev_t dev;
- void (*strat)();
- struct disklabel *lp;
- struct cpu_disklabel *osdep;
-{
- struct riscbsd_partition *rp = osdep->partitions;
- register struct buf *bp;
- struct disklabel *dlp;
- int cyl, riscbsdpartoff;
- int error = 0;
-
-/* get a buffer and initialize it */
-
- bp = geteblk((int)lp->d_secsize);
- bp->b_dev = dev;
-
-/* do riscbsd partitions in the process of getting disklabel? */
-
- riscbsdpartoff = 0;
- cyl = LABELSECTOR / lp->d_secpercyl;
-
- if (rp) {
- struct filecore_bootblock *bb;
- int heads;
- int sectors;
-
-/* read the filecore boot block */
-
- printf("writedisklabel: Reading boot block\n");
-
- bp->b_blkno = FILECORE_BOOT_SECTOR;
- bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
- bp->b_cylin = bp->b_blkno / lp->d_secpercyl;
- (*strat)(bp);
-
-/* if successful, validate boot block and locate parition table */
-
- if (biowait(bp)) {
- printf("writedisklabel: filecore boot block I/O error\n");
- goto done;
- }
-
- bb = (struct filecore_bootblock *)bp->b_data;
-
-/* Validate boot block */
-
- if (bb->checksum != filecore_checksum((u_char *)bb)) {
-/* Invalid boot block so lets assume the entire disc is RiscBSD */
-
- printf("writedisklabel: Invalid filecore boot block (incorrect checksum)\n");
- goto writelabel;
- }
-
-/* Do we have a RiscBSD partition ? */
-
- if (bb->partition_type != PARTITION_FORMAT_RISCBSD) {
- printf("writedisklabel: Invalid partition format\n");
- goto done;
- }
-
- cyl = bb->partition_cyl_low + (bb->partition_cyl_high << 8);
-
- heads = bb->heads;
- sectors = bb->secspertrack;
-
- /*printf("heads = %d nsectors = %d\n", heads, sectors);*/
-
- riscbsdpartoff = cyl * heads * sectors;
- }
-
-writelabel:
-
-/* printf("writedisklabel: Reading disklabel addr=%08x\n", riscbsdpartoff * DEV_BSIZE);*/
-
-/* next, dig out disk label */
-
- bp->b_blkno = riscbsdpartoff + LABELSECTOR;
- bp->b_cylin = cyl;
- bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
- (*strat)(bp);
-
-/* if successful, locate disk label within block and validate */
-
- if ((error = biowait(bp)))
- goto done;
- for (dlp = (struct disklabel *)bp->b_data;
- dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp));
- dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
- if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
- dkcksum(dlp) == 0) {
- *dlp = *lp;
- bp->b_flags = B_BUSY | B_WRITE;
- (*strat)(bp);
- error = biowait(bp);
- goto done;
- }
- }
-
- error = ESRCH;
-
-done:
- bp->b_flags |= B_INVAL;
- brelse(bp);
- return (error);
-}
-
-
-/*
- * Determine the size of the transfer, and make sure it is
- * within the boundaries of the partition. Adjust transfer
- * if needed, and signal errors or early completion.
- */
-int
-bounds_check_with_label(bp, lp, osdep, wlabel)
- struct buf *bp;
- struct disklabel *lp;
- struct cpu_disklabel *osdep;
- int wlabel;
-{
- struct partition *p = lp->d_partitions + DISKPART(bp->b_dev);
- int labelsector = lp->d_partitions[0].p_offset + LABELSECTOR;
- int sz;
-
- /* avoid division by zero */
- if (lp->d_secpercyl == 0) {
- bp->b_error = EINVAL;
- goto bad;
- }
-
- sz = howmany(bp->b_bcount, lp->d_secsize);
-
- if (bp->b_blkno + sz > p->p_size) {
- sz = p->p_size - bp->b_blkno;
- if (sz == 0) {
- /* If exactly at end of disk, return EOF. */
- bp->b_resid = bp->b_bcount;
- goto done;
- }
- if (sz < 0) {
- /* If past end of disk, return EINVAL. */
- bp->b_error = EINVAL;
- goto bad;
- }
- /* Otherwise, truncate request. */
- bp->b_bcount = sz << DEV_BSHIFT;
- }
-
- /* Overwriting disk label? */
- if (bp->b_blkno + p->p_offset <= labelsector &&
-#if LABELSECTOR != 0
- bp->b_blkno + p->p_offset + sz > labelsector &&
-#endif
- (bp->b_flags & B_READ) == 0 && !wlabel) {
- bp->b_error = EROFS;
- goto bad;
- }
-
- /* calculate cylinder for disksort to order transfers with */
- bp->b_cylin = (bp->b_blkno + p->p_offset) /
- (lp->d_secsize / DEV_BSIZE) / lp->d_secpercyl;
- return (1);
-
-bad:
- bp->b_flags |= B_ERROR;
-done:
- return (0);
-}
-
-
-int
-dk_establish(dk, dev)
- struct dkdevice *dk;
- struct device *dev;
-{
- return(-1);
-}
-
-/* End of disksubr.c */
diff --git a/sys/arch/arm32/arm32/exception.S b/sys/arch/arm32/arm32/exception.S
deleted file mode 100644
index 8e4783fd31c..00000000000
--- a/sys/arch/arm32/arm32/exception.S
+++ /dev/null
@@ -1,340 +0,0 @@
-/* $NetBSD: exception.S,v 1.5 1996/03/13 21:00:26 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1996 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * exception.S
- *
- * Low level handlers for exception vectors
- *
- * Created : 24/09/94
- *
- * Based on kate/display/abort.s
- */
-
-#include <machine/cpu.h>
-#include "assym.h"
-
-/*
- * PUSHFRAME - macro to push a trap frame on the stack in the current mode
- * Since the current mode is used, the SVC R14 field is not defined.
- */
-
-#define PUSHFRAME \
- str lr, [sp, #-4]!; /* Push the return address */ \
- sub sp, sp, #0x00000004; /* Skip SVC R14 */ \
- stmdb sp, {r0-r14}^; /* Push the user mode registers */ \
- sub sp, sp, #(4*15); /* Adjust the stack pointer */ \
- mrs r0, spsr_all; /* Put the SPSR on the stack */ \
- str r0, [sp, #-4]!;
-
-/*
- * PULLFRAME - macro to pull a trap frame from the stack in the current mode
- * Since the current mode is used, the SVC R14 field is ignored.
- */
-
-#define PULLFRAME \
- ldr r0, [sp], #0x0004; /* Get the SPSR from stack */ \
- msr spsr_all, r0; \
- add sp, sp, #(4*15); /* Adjust the stack pointer */ \
- ldmdb sp, {r0-r14}^; /* Restore the registers (user mode) */ \
- mov r0, r0; /* NOP for previous instruction */ \
- add sp, sp, #0x00000004; /* Skip SVC R14 */ \
- ldr lr, [sp], #0x0004; /* Pull the return address */
-
-/*
- * PUSHFRAMEINSVC - macro to push a trap frame on the stack in SVC32 mode
- * This should only be used if the processor is not currently in SVC32
- * mode. The processor mode is switched to SVC mode and the trap frame is
- * stored. The SVC R14 field is used to store the previous value of
- * R14 in SVC mode.
- */
-
-#define PUSHFRAMEINSVC \
- stmdb sp, {r0-r3}; /* Save 4 registers */ \
- mov r0, lr; /* Save xxx32 r14 */ \
- mov r1, sp; /* Save xxx32 sp */ \
- mrs r3, spsr_all; /* Save xxx32 spsr */ \
- mrs r2, cpsr_all; /* Get the CPSR */ \
- bic r2, r2, #(PSR_MODE); /* Fix for SVC mode */ \
- orr r2, r2, #(PSR_SVC32_MODE); \
- msr cpsr_all, r2; /* Punch into SVC mode */ \
- str r0, [sp, #-4]!; /* Push return address */ \
- str lr, [sp, #-4]!; /* Push SVC r14 */ \
- msr spsr_all, r3; /* Restore correct spsr */ \
- ldmdb r1, {r0-r3}; /* Restore 4 regs from xxx mode */ \
- stmdb sp, {r0-r14}^; /* Push the user mode registers */ \
- sub sp, sp, #(4*15); /* Adjust the stack pointer */ \
- mrs r0, spsr_all; /* Put the SPSR on the stack */ \
- str r0, [sp, #-4]!
-
-/*
- * PULLFRAMEFROMSVCANDEXIT - macro to pull a trap frame from the stack
- * in SVC32 mode and restore the saved processor mode and PC.
- * This should be used when the SVC R14 register needs to be restored on
- * exit.
- */
-
-#define PULLFRAMEFROMSVCANDEXIT \
- ldr r0, [sp], #0x0004; /* Get the SPSR from stack */ \
- msr spsr_all, r0; /* restore SPSR */ \
- add sp, sp, #(4*15); /* Adjust the stack pointer */ \
- ldmdb sp, {r0-r14}^; /* Restore the registers (user mode) */ \
- mov r0, r0; /* NOP for previous instruction */ \
- ldmia sp!, {lr, pc}^ /* Restore lr and exit */
-
-sp .req r13
-lr .req r14
-pc .req r15
-
- .text
- .align 0
-
-/* entry point for CPU data abort */
-
- .global data_abort_entry
-
-data_abort_entry:
- sub lr, lr, #0x00000008 /* Adjust the lr */
-
- PUSHFRAMEINSVC /* Push trap frame and switch */
- /* to SVC32 mode */
-
- mov r0, sp /* pass the stack pointer as r0 */
-
- add lr, pc, #Ldata_abort_return - . - 8
- ldr r1, Ldata_abort_handler_address
- ldr pc, [r1]
-
-Ldata_abort_return:
-#if 0 /* For now only handle ast's after interrupts */
- ldr r0, [sp] /* Get the SPSR from stack */
- and r0, r0, #(PSR_MODE) /* Test for USR32 mode before the ABT */
- teq r0, #(PSR_USR32_MODE)
- ldreq r0, Lastpending /* Do we have an AST pending ? */
- ldreq r1, [r0]
- teqeq r1, #0x00000001
- moveq r1, #0x00000000 /* Clear it */
- streq r1, [r0]
-
- moveq r0, sp /* arg 0 = irq frame */
- bleq _ast /* call the AST handler */
-#endif
-
-/* Kill IRQ's */
- mrs r0, cpsr_all
- orr r0, r0, #(I32_bit)
- msr cpsr_all, r0
-
- PULLFRAMEFROMSVCANDEXIT /* Restore the trap frame and exit */
-
-Ldata_abort_handler_address:
- .word _data_abort_handler_address
-
- .data
- .global _data_abort_handler_address
-
-_data_abort_handler_address:
- .word abortdata
-
- .text
-abortdata:
- add r0, pc, #abortdatamsg - . - 8
- b _panic
-
-abortdatamsg:
- .asciz "abortdata"
- .align 0
-
-
- .global prefetch_abort_entry
-
-prefetch_abort_entry:
- sub lr, lr, #0x00000004 /* Adjust the lr */
-
- PUSHFRAMEINSVC
-
- mov r0, sp /* pass the stack pointer as r0 */
-
- add lr, pc, #Lprefetch_abort_return - . - 8
- ldr r1, Lprefetch_abort_handler_address
- ldr pc, [r1]
-
-Lprefetch_abort_return:
-#if 0 /* For the moment ast's are only handled by irq handler */
- ldr r0, [sp] /* Get the SPSR from stack */
- and r0, r0, #(PSR_MODE) /* Test for USR32 mode before the IRQ */
- teq r0, #(PSR_USR32_MODE)
- ldreq r0, Lastpending /* Do we have an AST pending ? */
- ldreq r1, [r0]
- teqeq r1, #0x00000001
- moveq r1, #0x00000000 /* Clear it */
- streq r1, [r0]
-
- moveq r0, sp /* arg 0 = irq frame */
- bleq _ast /* call the AST handler */
-#endif
-
-/* Kill IRQ's */
- mrs r0, cpsr_all
- orr r0, r0, #(I32_bit)
- msr cpsr_all, r0
-
- PULLFRAMEFROMSVCANDEXIT
-
-Lprefetch_abort_handler_address:
- .word _prefetch_abort_handler_address
-
- .data
- .global _prefetch_abort_handler_address
-
-_prefetch_abort_handler_address:
- .word abortprefetch
-
- .text
-abortprefetch:
- add r0, pc, #abortprefetchmsg - . - 8
- b _panic
-
-abortprefetchmsg:
- .asciz "abortprefetch"
- .align 0
-
-
-/*
- * swi_entry
- *
- * Main entry point for the SWI vector
- */
-
- .global swi_entry
-swi_entry:
- PUSHFRAME
-
- sub r0, lr, #0x00000004 /* Get the address of the SWI */
- ldr r4, [r0] /* Get the instruction */
-
- bic r1, r4, #0xff000000 /* Extract the comment field */
-
- mov r0, sp /* Pass the frame to any function */
-
- bl _syscall /* It's a syscall ! */
-
-#if 0 /* Ast's only from the irqhandler .... */
- ldr r0, Lastpending /* Do we have an AST pending ? */
- ldr r1, [r0]
- teq r1, #0x00000001
- moveq r1, #0x00000000 /* Clear it */
- streq r1, [r0]
-
- moveq r0, sp /* arg 0 = irq frame */
- bleq _ast /* call the AST handler */
-#endif
-
-/* Kill irq's */
-
- mrs r0, cpsr_all
- orr r0, r0, #(I32_bit)
- msr cpsr_all, r0
-
- PULLFRAME
-
- movs pc, lr /* Exit */
-
-Lastpending:
- .word _astpending
-
- .text
- .align 0
-
-/*
- * We indirect the undefined vector via the handler address
- * in the data area.
- * Entry to the undefined handler must look like direct
- * entry from the vector.
- */
-
- .global undefined_entry
-undefined_entry:
- stmfd sp!, {r0, r1}
- ldr r0, Lundefined_handler_indirection
- ldr r1, [sp], #0x0004
- str r1, [r0, #0x0000]
- ldr r1, [sp], #0x0004
- str r1, [r0, #0x0004]
- ldmia r0, {r0, r1, pc}
-
-Lundefined_handler_indirection:
- .word Lundefined_handler_indirection_data
-
-/*
- * assembly bounce code for calling the kernel
- * undefined instruction handler. This uses
- * a standard trap frame and is called in SVC mode.
- */
-
- .global _undefinedinstruction_bounce
-_undefinedinstruction_bounce:
- PUSHFRAMEINSVC
- mov r0, sp
- bl _undefinedinstruction
-
-/* Kill irq's */
- mrs r0, cpsr_all
- orr r0, r0, #(I32_bit)
- msr cpsr_all, r0
-
- PULLFRAMEFROMSVCANDEXIT
-
-
- .data
- .align 0
-
-/*
- * Indirection data
- * 2 words use for preserving r0 and r1
- * 3rd word contains the undefined handler address.
- */
-
-Lundefined_handler_indirection_data:
- .word 0
- .word 0
-
- .global _undefined_handler_address
-_undefined_handler_address:
- .word _undefinedinstruction_bounce
-
-/* End of exception.S */
diff --git a/sys/arch/arm32/arm32/fault.c b/sys/arch/arm32/arm32/fault.c
deleted file mode 100644
index 3656fdc037b..00000000000
--- a/sys/arch/arm32/arm32/fault.c
+++ /dev/null
@@ -1,1240 +0,0 @@
-/* $NetBSD: fault.c,v 1.3 1996/03/13 21:41:41 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1996 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * fault.c
- *
- * Fault handlers
- *
- * Created : 28/11/94
- */
-
-/*
- * Special compilation symbols
- *
- * DEBUG_FAULT_CORRECTION - Add debug code used to develop the register
- * correction following a data abort.
- *
- * CONTINUE_AFTER_SVC_PREFETCH - Do not panic following a prefetch abort
- * in SVC mode. Used during developement.
- */
-
-#define DEBUG_FAULT_CORRECTION
-/*#define CONTINUE_AFTER_SVC_PREFETCH*/
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/user.h>
-#include <sys/kernel.h>
-
-#include <vm/vm_kern.h>
-
-#include <machine/katelib.h>
-#include <machine/cpu.h>
-#include <machine/pte.h>
-
-#include <machine/irqhandler.h>
-#include <machine/frame.h>
-
-extern int pmap_debug_level;
-extern int nopagefault;
-static int onfault_count = 0;
-int nopagefault = 0; /* gross hack, has to go anyway */
-
-int pmap_modified_emulation __P((pmap_t, vm_offset_t));
-int pmap_handled_emulation __P((pmap_t, vm_offset_t));
-
-u_int disassemble __P((u_int));
-u_int ReadWordWithChecks __P((u_int, u_int *));
-
-/* Abort code */
-
-/* Define text descriptions of the different aborts */
-
-static char *aborts[16] = {
- "Write buffer fault",
- "Alignment fault",
- "Write buffer fault",
- "Alignment fault",
- "Bus error (LF section)",
- "Translation fault (section)",
- "Bus error (page)",
- "Translation fault (page)",
- "Bus error (section)",
- "Domain error (section)",
- "Bus error (page)",
- "Domain error (page)",
- "Bus error trans (L1)",
- "Permission error (section)",
- "Bus error trans (L2)",
- "Permission error (page)"
-};
-
-/*
- * void data_abort_handler(trapframe_t *frame)
- *
- * Abort handler called when read/write occurs at an address of
- * a non existant or restricted (access permissions) memory page.
- * We first need to identify the type of page fault.
- */
-
-void
-data_abort_handler(frame)
- trapframe_t *frame;
-{
- struct proc *p;
- struct pcb *pcb;
- u_int fault_address;
- u_int fault_status;
- u_int fault_pc;
- u_int fault_instruction;
- u_int s;
- int fault_code;
- u_quad_t sticks;
- int saved_lr;
-
-/*
- * OK you did not see this :-) This is worse than your worst nightmare
- * This bug was found when implementing LDR/STR late abort fixes
- * Don't know why I did not spot it before.
- * I really need to rethink the trapframe structure ...
- */
-
- if ((frame->tf_spsr & PSR_MODE) == PSR_SVC32_MODE) {
-
-/* Ok an abort in SVC mode */
-
-/* CHEAT CHEAT CHEAT - SHUT YOUR EYES NOW ! */
-
-/* Copy the SVC r14 into the usr r14 - The usr r14 is garbage as the fault
- * happened in svc mode but we need it in the usr slot so we can
- * treat the registers as an array of ints during fixing.
- * NOTE: This PC is in the position but writeback is not allowed on r15.
- */
- saved_lr = frame->tf_usr_lr;
- frame->tf_usr_lr = frame->tf_svc_lr;
-
-/* Note the trapframe does not have the SVC r13 so a fault from an
- * instruction with writeback to r13 in SVC mode is not allowed.
- * This should not happen as the kstack is always valid.
- */
- }
-
-
-/*
- * Enable IRQ's and FIQ's (disabled by CPU on abort) if trapframe shows
- * they were enabled.
- */
-
-#ifndef BLOCK_IRQS
- if (!(frame->tf_spsr & I32_bit))
- enable_interrupts(I32_bit);
-#endif
-
-/* Update vmmeter statistics */
-
- cnt.v_trap++;
-
-/* Get fault address and status from the CPU */
-
- fault_address = cpu_faultaddress();
- fault_status = cpu_faultstatus();
- fault_pc = frame->tf_pc;
-
- fault_instruction = ReadWord(fault_pc);
-
-/* More debug stuff */
-
- s = splhigh();
- if (pmap_debug_level >= 0) {
- printf("Data abort: '%s' status = %03x address = %08x PC = %08x\n",
- aborts[fault_status & 0xf], fault_status & 0xfff,
- fault_address, fault_pc);
-
- printf("Instruction @V%08x = %08x\n",
- fault_pc, fault_instruction);
- }
-
-/* Decode the fault instruction and fix the registers as needed */
-
-/* Was is a swap instruction ? */
-
- if ((fault_instruction & 0x0fb00ff0) == 0x01000090) {
- if (pmap_debug_level >= 0) {
- printf("SWP\n");
- disassemble(fault_pc);
- }
- } else if ((fault_instruction & 0x0c000000) == 0x04000000) {
-
-/* Was is a ldr/str instruction */
-
-#ifdef CPU_LATE_ABORT
-
-/* This is for late abort only */
-
- int base;
- int offset;
- int *registers = &frame->tf_r0;
-#endif
-
-#ifdef DEBUG_FAULT_CORRECTION
- if (pmap_debug_level >= 0) {
-/* printf("LDR/STR\n");*/
- disassemble(fault_pc);
- }
-#endif
-
-#ifdef CPU_LATE_ABORT
-
-/* This is for late abort only */
-
- if ((fault_instruction & (1 << 24)) == 0
- || (fault_instruction & (1 << 21)) != 0) {
- base = (fault_instruction >> 16) & 0x0f;
- if (base == 13 && (frame->tf_spsr & PSR_MODE) == PSR_SVC32_MODE) {
- disassemble(fault_pc);
- panic("Abort handler cannot fix this :-(");
- }
- if (base == 15) {
- disassemble(fault_pc);
- panic("Abort handler cannot fix this :-(");
- }
-#ifdef DEBUG_FAULT_CORRECTION
- if (pmap_debug_level >=0)
- printf("late abt fix: r%d=%08x ", base, registers[base]);
-#endif
- if ((fault_instruction & (1 << 25)) == 0) {
-/* Immediate offset - easy */
- offset = fault_instruction & 0xfff;
- if ((fault_instruction & (1 << 23)))
- offset = -offset;
- registers[base] += offset;
-#ifdef DEBUG_FAULT_CORRECTION
- if (pmap_debug_level >=0)
- printf("imm=%08x ", offset);
-#endif
- } else {
- int shift;
-
- offset = fault_instruction & 0x0f;
- if (offset == base) {
- disassemble(fault_pc);
- panic("Abort handler cannot fix this :-(");
- }
-
-/* Register offset - hard we have to cope with shifts ! */
- offset = registers[offset];
-
- if ((fault_instruction & (1 << 4)) == 0)
- shift = (fault_instruction >> 7) & 0x1f;
- else {
- if ((fault_instruction & (1 << 7)) != 0) {
- disassemble(fault_pc);
- panic("Abort handler cannot fix this :-(");
- }
- shift = ((fault_instruction >> 8) & 0xf);
- if (base == shift) {
- disassemble(fault_pc);
- panic("Abort handler cannot fix this :-(");
- }
-#ifdef DEBUG_FAULT_CORRECTION
- if (pmap_debug_level >=0)
- printf("shift reg=%d ", shift);
-#endif
- shift = registers[shift];
- }
-#ifdef DEBUG_FAULT_CORRECTION
- if (pmap_debug_level >=0)
- printf("shift=%08x ", shift);
-#endif
- switch (((fault_instruction >> 5) & 0x3)) {
- case 0 : /* Logical left */
- offset = (int)(((u_int)offset) << shift);
- break;
- case 1 : /* Logical Right */
- if (shift == 0) shift = 32;
- offset = (int)(((u_int)offset) >> shift);
- break;
- case 2 : /* Arithmetic Right */
- if (shift == 0) shift = 32;
- offset = (int)(((int)offset) >> shift);
- break;
- case 3 : /* Rotate right */
- disassemble(fault_pc);
- panic("Abort handler cannot fix this yet :-(");
- break;
- }
-
-#ifdef DEBUG_FAULT_CORRECTION
- if (pmap_debug_level >=0)
- printf("abt: fixed LDR/STR with register offset\n");
-#endif
- if ((fault_instruction & (1 << 23)))
- offset = -offset;
-#ifdef DEBUG_FAULT_CORRECTION
- if (pmap_debug_level >=0)
- printf("offset=%08x ", offset);
-#endif
- registers[base] += offset;
- }
-#ifdef DEBUG_FAULT_CORRECTION
- if (pmap_debug_level >=0)
- printf("r%d=%08x\n", base, registers[base]);
-#endif
- }
-#endif
- }
- else if ((fault_instruction & 0x0e000000) == 0x08000000) {
- int base;
- int loop;
- int count;
- int *registers = &frame->tf_r0;
-
-#ifdef DEBUG_FAULT_CORRECTION
- if (pmap_debug_level >= 0) {
- printf("LDM/STM\n");
- disassemble(fault_pc);
- }
-#endif
- if (fault_instruction & (1 << 21)) {
-#ifdef DEBUG_FAULT_CORRECTION
- if (pmap_debug_level >= 0)
- printf("This instruction must be corrected\n");
-#endif
- base = (fault_instruction >> 16) & 0x0f;
- if (base == 15) {
- disassemble(fault_pc);
- panic("Abort handler cannot fix this :-(");
- }
- count = 0;
- for (loop = 0; loop < 16; ++loop) {
- if (fault_instruction & (1<<loop))
- ++count;
- }
-#ifdef DEBUG_FAULT_CORRECTION
- if (pmap_debug_level >= 0) {
- printf("%d registers used\n", count);
- printf("Corrected r%d by %d bytes ", base, count * 4);
- }
-#endif
- if (fault_instruction & (1 << 23)) {
-#ifdef DEBUG_FAULT_CORRECTION
- if (pmap_debug_level >= 0)
- printf("down\n");
-#endif
- registers[base] -= count * 4;
- } else {
-#ifdef DEBUG_FAULT_CORRECTION
- if (pmap_debug_level >= 0)
- printf("up\n");
-#endif
- registers[base] += count * 4;
- }
- }
- } else if ((fault_instruction & 0x0e000000) == 0x0c000000) {
- int base;
- int offset;
- int *registers = &frame->tf_r0;
-
-/* REGISTER CORRECTION IS REQUIRED FOR THESE INSTRUCTIONS */
-
-#ifdef DEBUG_FAULT_CORRECTION
- if (pmap_debug_level >= 0) {
- printf("LDC/STC\n");
- disassemble(fault_pc);
- }
-#endif
-
-/* Only need to fix registers if write back is turned on */
-
- if ((fault_instruction & (1 << 21)) != 0) {
- base = (fault_instruction >> 16) & 0x0f;
- if (base == 13 && (frame->tf_spsr & PSR_MODE) == PSR_SVC32_MODE) {
- disassemble(fault_pc);
- panic("Abort handler cannot fix this :-(");
- }
- if (base == 15) {
- disassemble(fault_pc);
- panic("Abort handler cannot fix this :-(");
- }
-
- offset = (fault_instruction & 0xff) << 2;
- if (pmap_debug_level >= 0)
- printf("r%d=%08x\n", base, registers[base]);
- if ((fault_instruction & (1 << 23)) != 0)
- offset = -offset;
- registers[base] += offset;
- if (pmap_debug_level >= 0)
- printf("r%d=%08x\n", base, registers[base]);
- }
- } else if ((fault_instruction & 0x0e000000) == 0x0c000000) {
- disassemble(fault_pc);
- panic("How did this happen ...\nWe have faulted on a non data transfer instruction");
- }
-
-/*
- * OK you did not see this :-) This is worse than your worst nightmare
- * This bug was found when implementing LDR/STR late abort fixes
- * Don't know why I did not spot it before.
- * I really need to rethink the trapframe structure ...
- */
-
- if ((frame->tf_spsr & PSR_MODE) == PSR_SVC32_MODE) {
-
-/* Ok an abort in SVC mode */
-
-/* CHEAT CHEAT CHEAT - SHUT YOUR EYES NOW ! */
-
-/* Copy the SVC r14 into the usr r14 - The usr r14 is garbage as the fault
- * happened in svc mode but we need it in the usr slot so we can
- * treat the registers as an array of ints during fixing.
- * NOTE: This PC is in the position but writeback is not allowed on r15.
- */
-
- frame->tf_svc_lr = frame->tf_usr_lr;
- frame->tf_usr_lr = saved_lr;
-
-/* Note the trapframes does not have the SVC r13 so a fault from an
- * instruction with writeback to r13 in SVC mode is not allowed.
- * This should not happen as the kstack is always valid.
- */
- }
-
- (void)splx(s);
-
-/* Extract the fault code from the fault status */
-
- fault_code = fault_status & FAULT_TYPE_MASK;
-
-/* Get the current proc structure or proc0 if there is none */
-
- if ((p = curproc) == 0)
- p = &proc0;
-
- if (pmap_debug_level >= 0)
- printf("fault in process %08x\n", (u_int)p);
-
-/* can't use curpcb, as it might be NULL; and we have p in a register anyway */
-
- pcb = &p->p_addr->u_pcb;
- if (pcb == 0) {
- vm_offset_t va;
-
- va = trunc_page((vm_offset_t)fault_address);
- if (pmap_handled_emulation(kernel_pmap, va))
- return;
- if (pmap_modified_emulation(kernel_pmap, va))
- return;
- panic("no pcb ... we're toast !");
- }
-
- if (pcb != curpcb) {
- printf("data_abort: Alert ! pcb(%08x) != curpcb(%08x)\n", (u_int)pcb,
- (u_int)curpcb);
- printf("data_abort: Alert ! proc(%08x), curproc(%08x)\n", (u_int)p,
- (u_int)curproc);
- }
-
-/* fusubail is used by [fs]uswintr to avoid page faulting */
-
-/*
- * To get this correct I need to talk to the person coding the
- * fubyte and subyte routines etc.
- * There appear to be cases where a fault should be swallowed.
- * The 386 does this by checking the error handler being used.
- */
-/*
- * Well it looks like I am doing this so I will talk to myself.
- * Need to allow perm faults in case of modified bit emulation.
- */
-
- if (nopagefault != 0)
- printf("fault occured with no_page_fault == %d\n", nopagefault);
-
- if (pcb->pcb_onfault
- && ((fault_code != FAULT_TRANS_S && fault_code != FAULT_TRANS_P)
-/* || pcb->pcb_onfault == fusubailout*/)) {
-copyfault:
- printf("Using pcb_onfault=%08x addr=%08x st=%08x\n",
- (u_int)pcb->pcb_onfault, fault_address, fault_status);
- frame->tf_pc = (u_int)pcb->pcb_onfault;
- if ((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE)
- printf("Yikes pcb_onfault=%08x during USR mode fault\n",
- (u_int)pcb->pcb_onfault);
-#ifdef VALIDATE_TRAPFRAME
- validate_trapframe(frame, 1);
-#endif
- ++onfault_count;
- if (onfault_count > 10) {
- traceback();
- panic("Eaten by zombies");
- }
- return;
- }
-
-/* Were we in user mode when the abort occurred ? */
-
- if ((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE) {
- sticks = p->p_sticks;
-
-/* Modify the fault_code to reflect the USR/SVC state at time of fault */
-
- fault_code |= FAULT_USER;
- p->p_md.md_regs = frame;
- }
-
-/* Now act of the fault type */
-
- switch (fault_code) {
- case FAULT_WRTBUF_0 | FAULT_USER: /* Write Buffer Fault */
- case FAULT_WRTBUF_1 | FAULT_USER: /* Write Buffer Fault */
- case FAULT_WRTBUF_0: /* Write Buffer Fault */
- case FAULT_WRTBUF_1: /* Write Buffer Fault */
-/* If this happens forget it no point in continuing */
-
- panic("Write Buffer Fault - Halting");
- break;
-
- case FAULT_ALIGN_0 | FAULT_USER: /* Alignment Fault */
- case FAULT_ALIGN_1 | FAULT_USER: /* Alignment Fault */
- case FAULT_ALIGN_0: /* Alignment Fault */
- case FAULT_ALIGN_1: /* Alignment Fault */
-
-/*
- * Really this should just kill the process. Alignment faults are turned
- * off in the kernel in order to get better performance from shorts with
- * GCC so an alignment fault means somebody has played with the control
- * register in the CPU. Might as well panic as the kernel was not compiled
- * for aligned accesses.
- */
- panic("Alignment fault - Halting");
-/* trapsignal(p, SIGBUS, fault_status & FAULT_TYPE_MASK);*/
- break;
-
- case FAULT_BUSERR_0 | FAULT_USER: /* Bus Error LF Section */
- case FAULT_BUSERR_1 | FAULT_USER: /* Bus Error Page */
- case FAULT_BUSERR_2 | FAULT_USER: /* Bus Error Section */
- case FAULT_BUSERR_3 | FAULT_USER: /* Bus Error Page */
- case FAULT_BUSERR_0: /* Bus Error LF Section */
- case FAULT_BUSERR_1: /* Bus Error Page */
- case FAULT_BUSERR_2: /* Bus Error Section */
- case FAULT_BUSERR_3: /* Bus Error Page */
-
-/* What will accutally cause a bus error ? */
-/* Real bus errors are not a process problem but hardware */
-
- panic("Bus Error - Halting");
-/* trapsignal(p, SIGBUS, fault_status & FAULT_TYPE_MASK);*/
- break;
-
- case FAULT_DOMAIN_S | FAULT_USER: /* Section Domain Error Fault */
- case FAULT_DOMAIN_P | FAULT_USER: /* Page Domain Error Fault*/
- case FAULT_DOMAIN_S: /* Section Domain Error Fault */
- case FAULT_DOMAIN_P: /* Page Domain Error Fault*/
-
-/*
- * Right well we dont use domains, everything is always a client and thus
- * subject to access permissions.
- * If we get a domain error then we have corrupts PTE's so we might
- * as well die !
- * I suppose eventually this should just kill the process who owns the
- * PTE's but if this happens it implies a kernel problem.
- */
-
- panic("Domain Error - Halting");
-/* trapsignal(p, SIGBUS, fault_status & FAULT_TYPE_MASK);*/
- break;
-
- case FAULT_PERM_P: /* Page Permission Fault*/
- case FAULT_PERM_P | FAULT_USER: /* Page Permission Fault*/
-/* Ok we have a permission fault in user or kernel mode */
- {
- register vm_offset_t va;
- register struct vmspace *vm = p->p_vmspace;
- register vm_map_t map;
- int rv;
- vm_prot_t ftype;
-
-/*
- * Ok we have a permission fault in user mode. The only cause must be
- * that a read only page has been written to. This may be genuine or it
- * may be a bad access. In the future it may also be cause by the software
- * emulation of the modified flag.
- */
-
- va = trunc_page((vm_offset_t)fault_address);
-
- if (pmap_debug_level >= 0)
- printf("ok we have a page permission fault - addr=V%08x ",
- (u_int)va);
-
-/*
- * It is only a kernel address space fault iff:
- * 1. (fault_code & FAULT_USER) == 0 and
- * 2. pcb_onfault not set or
- * 3. pcb_onfault set but supervisor space fault
- * The last can occur during an exec() copyin where the
- * argument space is lazy-allocated.
- */
-
- if ((fault_code & FAULT_USER) == 0
- && (va >= KERNEL_BASE || va <= VM_MIN_ADDRESS)) {
- /* Was the fault due to the FPE ? */
-
- if ((frame->tf_spsr & PSR_MODE) == PSR_UND32_MODE) {
- printf("FPE Data abort: '%s' status = %03x address = %08x PC = %08x\n",
- aborts[fault_status & 0xf], fault_status & 0xfff, fault_address,
- fault_pc);
- postmortem(frame);
- trapsignal(p, SIGBUS, FAULT_PERM_P);
- goto out;
- }
-
- printf("Data abort: '%s' status = %03x address = %08x PC = %08x\n",
- aborts[fault_status & 0xf], fault_status & 0xfff, fault_address,
- fault_pc);
- postmortem(frame);
- panic("permission fault in kernel by kernel");
- } else
- map = &vm->vm_map;
-
-#ifdef DIAGNOSTIC
- if (va == 0 && map == kernel_map) {
- printf("fault: bad kernel access at %x\n", (u_int)va);
- goto we_re_toast;
- }
-#endif
-
- if (pmap_debug_level >= 0)
- printf("vmmap=%08x ", (u_int)map);
-
-/*
- * We need to know whether the page should be mapped as R or R/W.
- * The MMU does not give us the info as to whether the fault was caused
- * by a read or a write. This means we need to disassemble the instruction
- * responcible and determine if it was a read or write instruction.
- */
-
- ftype = VM_PROT_READ;
-
- if ((fault_instruction & 0x0c100000) == 0x04000000)
- ftype |= VM_PROT_WRITE;
- else if ((fault_instruction & 0x0a100000) == 0x08000000)
- ftype |= VM_PROT_WRITE;
- else if ((fault_instruction & 0x0fb00ff0) == 0x01000090)
- ftype |= VM_PROT_WRITE;
-
-/* if (!(ftype & VM_PROT_WRITE)) {
- panic("permission fault on a read !");
- }*/
-
- if (pmap_modified_emulation(map->pmap, va))
- goto out;
- else {
-
-/* The page must be mapped to cause a permission fault. */
-
- rv = vm_fault(map, va, ftype, FALSE);
- if (pmap_debug_level >= 0)
- printf("fault result=%d\n", rv);
- if (rv == KERN_SUCCESS)
- goto out;
- printf("Data abort: '%s' status = %03x address = %08x PC = %08x\n",
- aborts[fault_status & 0xf], fault_status & 0xfff, fault_address,
- fault_pc);
- postmortem(frame);
- trapsignal(p, SIGSEGV, FAULT_PERM_P);
- break;
- }
- }
-/* panic("Page Permission Fault - Halting");*/
- break;
-
-#if 0
- case FAULT_PERM_P: /* Page Permission Fault is non USR mode */
-
-/*
- * Kernel permission faults should not happen. The kernel should never
- * access memory it does not have permission for. Since the kernel has
- * read access on all mapped pages it means the kernel has written to
- * a read only kernel page. e.g. page 0
- *
- * Erg: Major cock up time. The kernel can take permission faults during
- * the emulation of FP instructions. How comes I have not hit this problem ?
- * ok out with the superglue ... This condition needs to be integrated with
- * the FAULT_PERM_P | FAULT_USER case similarly to FAULT_TRANS_P
- */
-
- printf("Data abort: '%s' status = %03x address = %08x PC = %08x\n",
- aborts[fault_status & 0xf], fault_status & 0xfff, fault_address,
- fault_pc);
- postmortem(frame);
- panic("Page Permission Fault - (in SVC mode) Halting");
- break;
-#endif
-
- case FAULT_PERM_S | FAULT_USER: /* Section Permission Fault */
-/*
- * Section permission fault should not happen yet.
- * However I have had this panic once so it can occor
- * Yes they do ... Writing to -1 in user space does it ...
- */
- printf("Data abort: '%s' status = %03x address = %08x PC = %08x\n",
- aborts[fault_status & 0xf], fault_status & 0xfff, fault_address,
- fault_pc);
- disassemble(fault_pc);
- postmortem(frame);
- trapsignal(p, SIGBUS, FAULT_PERM_S);
- break;
-
-/* panic("Section Permission Fault - Halting");
- trapsignal(p, SIGBUS, fault_status & FAULT_TYPE_MASK);
- break;*/
-
- case FAULT_BUSTRNL1 | FAULT_USER: /* Bus Error Trans L1 Fault */
- case FAULT_BUSTRNL2 | FAULT_USER: /* Bus Error Trans L2 Fault */
- case FAULT_BUSTRNL1: /* Bus Error Trans L1 Fault */
- case FAULT_BUSTRNL2: /* Bus Error Trans L2 Fault */
-/*
- * These faults imply that the PTE is corrupt. Likely to be a kernel
- * fault so we had better stop.
- */
- panic("Bus Error Translation - Halting");
- break;
-/* trapsignal(p, SIGBUS, fault_status & FAULT_TYPE_MASK);
- break;*/
-
- case FAULT_TRANS_P: /* Page Translation Fault */
- case FAULT_TRANS_P | FAULT_USER: /* Page Translation Fault */
-/* Ok page translation fault - The page does not exist */
- {
- register vm_offset_t va;
- register struct vmspace *vm = p->p_vmspace;
- register vm_map_t map;
- int rv;
- vm_prot_t ftype;
- extern vm_map_t kernel_map;
- u_int nss;
-
- va = trunc_page((vm_offset_t)fault_address);
-
- if (pmap_debug_level >= 0)
- printf("ok we have a page fault - addr=V%08x ", (u_int)va);
-
-/*
- * It is only a kernel address space fault iff:
- * 1. (fault_code & FAULT_USER) == 0 and
- * 2. pcb_onfault not set or
- * 3. pcb_onfault set but supervisor space fault
- * The last can occur during an exec() copyin where the
- * argument space is lazy-allocated.
- */
-
- if (fault_code == FAULT_TRANS_P
- && (va >= KERNEL_BASE || va < VM_MIN_ADDRESS))
- map = kernel_map;
- else
- map = &vm->vm_map;
-
- if (pmap_debug_level >= 0)
- printf("vmmap=%08x ", (u_int)map);
-
- if (pmap_handled_emulation(map->pmap, va))
- goto out;
-
-/* debug_show_vm_map(map, "fault");*/
-
-/* We need to know whether the page should be mapped as R or R/W.
- * The MMU does not give us the info as to whether the fault was caused
- * by a read or a write. This means we need to disassemble the instruction
- * responcible and determine if it was a read or write instruction.
- * For the moment we will cheat and make it read only. If it was a write
- * When the instruction is re-executed we will get a permission fault
- * instead.
- */
-
- ftype = VM_PROT_READ;
-
-/* STR instruction ? */
- if ((fault_instruction & 0x0c100000) == 0x04000000)
- ftype |= VM_PROT_WRITE;
-/* STM instruction ? */
- else if ((fault_instruction & 0x0a100000) == 0x08000000)
- ftype |= VM_PROT_WRITE;
-/* SWP instruction ? */
- else if ((fault_instruction & 0x0fb00ff0) == 0x01000090)
- ftype |= VM_PROT_WRITE;
-
- if (pmap_debug_level >= 0)
- printf("fault protection = %d\n", ftype);
-
-#ifdef DIAGNOSTIC
- if (va == 0 && map == kernel_map) {
- printf("trap: bad kernel access at %x\n", (u_int)va);
- goto we_re_toast;
- }
-#endif
-
- nss = 0;
- if ((caddr_t)va >= vm->vm_maxsaddr
- && (caddr_t)va < (caddr_t)VM_MAXUSER_ADDRESS
- && map != kernel_map) {
- nss = clrnd(btoc(USRSTACK-(u_int)va));
- if (nss > btoc(p->p_rlimit[RLIMIT_STACK].rlim_cur)) {
- rv = KERN_FAILURE;
- goto nogo;
- }
- }
-
-/* check if page table is mapped, if not, fault it first */
-
-/*
- if (*(((pt_entry_t **)(PROCESS_PAGE_TBLS_BASE + va >> (PD_SHIFT+2)))[]) == 0)
- panic("vm_fault: Page table is needed first")
-*/
-
- rv = vm_fault(map, va, ftype, FALSE);
-/*printf("fault result=%d\n", rv);*/
- if (rv == KERN_SUCCESS) {
- if (nss > vm->vm_ssize)
- vm->vm_ssize = nss;
- va = trunc_page(vtopte(va));
-/*
- * for page table, increment wiring as long as not a page
- * table fault as well
- */
- if (map != kernel_map)
- vm_map_pageable(map, va, round_page(va+1), FALSE);
- if (fault_code == FAULT_TRANS_P)
- return;
- goto out;
- }
-nogo:
- if (fault_code == FAULT_TRANS_P) {
- printf("Failed page fault in kernel\n");
- if (pcb->pcb_onfault)
- goto copyfault;
- printf("vm_fault(%x, %x, %x, 0) -> %x\n",
- (u_int)map, (u_int)va, ftype, rv);
- goto we_re_toast;
- }
- printf("nogo, Data abort: '%s' status = %03x address = %08x PC = %08x\n",
- aborts[fault_status & 0xf], fault_status & 0xfff, fault_address,
- fault_pc);
- disassemble(fault_pc);
- postmortem(frame);
- trapsignal(p, SIGSEGV, FAULT_TRANS_P);
- break;
- }
-/* panic("Page Fault - Halting");*/
- break;
-
- case FAULT_TRANS_S: /* Section Translation Fault */
- case FAULT_TRANS_S | FAULT_USER: /* Section Translation Fault */
-/* Section translation fault - the L1 page table does not exist */
- {
- register vm_offset_t va;
- register struct vmspace *vm = p->p_vmspace;
- register vm_map_t map;
- int rv;
- vm_prot_t ftype;
- u_int nss, v;
-
- va = trunc_page((vm_offset_t)fault_address);
-
- if (pmap_debug_level >= 0)
- printf("ok we have a section fault page addr=V%08x\n",
- (u_int)va);
-
-/*
- * It is only a kernel address space fault iff:
- * 1. (fault_code & FAULT_USER) == 0 and
- * 2. pcb_onfault not set or
- * 3. pcb_onfault set but supervisor space fault
- * The last can occur during an exec() copyin where the
- * argument space is lazy-allocated.
- */
-
- if (fault_code == FAULT_TRANS_S && va >= KERNEL_BASE)
- map = kernel_map;
- else
- map = &vm->vm_map;
-
-/*
- debug_show_vm_map(map, "fault");
- debug_show_vm_map(kernel_map, "kernel");
-*/
-
-/* We are mapping a page table so this must be kernel r/w */
-
- ftype = VM_PROT_READ | VM_PROT_WRITE;
-#ifdef DIAGNOSTIC
- if (map == kernel_map && va == 0) {
- printf("trap: bad kernel access at %x\n", (u_int)va);
- goto we_re_toast;
- }
-#endif
-
- nss = 0;
- if ((caddr_t)va >= vm->vm_maxsaddr
- && (caddr_t)va < (caddr_t)VM_MAXUSER_ADDRESS
- && map != kernel_map) {
-/* printf("Address is in the stack\n");*/
- nss = clrnd(btoc(USRSTACK-(u_int)va));
- if (nss > btoc(p->p_rlimit[RLIMIT_STACK].rlim_cur)) {
- printf("Stack limit exceeded %08x %08x\n",
- nss, btoc(p->p_rlimit[RLIMIT_STACK].rlim_cur));
- rv = KERN_FAILURE;
- goto nogo1;
- }
- }
-
-/* check if page table is mapped, if not, fault it first */
-
- v = trunc_page(vtopte(va));
- if (pmap_debug_level >= 0)
- printf("v=%08x\n", v);
- rv = vm_fault(map, v, ftype, FALSE);
- if (rv != KERN_SUCCESS)
- goto nogo1;
-
- if (pmap_debug_level >= 0)
- printf("vm_fault succeeded\n");
-
-/* update increment wiring as this is a page table fault */
-
- vm_map_pageable(map, v, round_page(v+1), FALSE);
-
- if (pmap_debug_level >= 0)
- printf("faulting in page %08x\n", (u_int)va);
-
- ftype = VM_PROT_READ;
-
- rv = vm_fault(map, va, ftype, FALSE);
- if (rv == KERN_SUCCESS) {
- if (nss > vm->vm_ssize)
- vm->vm_ssize = nss;
- va = trunc_page(vtopte(va));
-/*
- * for page table, increment wiring as long as not a page
- * table fault as well
- */
- if (!v && map != kernel_map)
- vm_map_pageable(map, va, round_page(va+1), FALSE);
- if (fault_code == FAULT_TRANS_S)
- return;
- goto out;
- }
-nogo1:
- printf("nogo1, Data abort: '%s' status = %03x address = %08x PC = %08x\n",
- aborts[fault_status & 0xf], fault_status & 0xfff, fault_address,
- fault_pc);
- disassemble(fault_pc);
- if (fault_code == FAULT_TRANS_S) {
- printf("Section fault in SVC mode\n");
- if (pcb->pcb_onfault)
- goto copyfault;
- printf("vm_fault(%x, %x, %x, 0) -> %x\n",
- (u_int)map, (u_int)va, ftype, rv);
- goto we_re_toast;
- }
- postmortem(frame);
- trapsignal(p, SIGSEGV, FAULT_TRANS_S);
- break;
- }
-/* panic("Section Fault - Halting");
- break;*/
-
- default :
-/* Are there any combinations I have missed ? */
-
- printf("fault status = %08x fault code = %08x\n",
- fault_status, fault_code);
-
-we_re_toast:
-/* Were are dead, try and provide some debug infomation before dying */
-
- postmortem(frame);
-
- panic("Fault cannot be handled");
- break;
- }
-
-out:
- if ((fault_code & FAULT_USER) == 0)
- return;
-
-#ifdef VALIDATE_TRAPFRAME
- validate_trapframe(frame, 1);
-#endif
- userret(p, frame->tf_pc, sticks);
-
-#ifdef VALIDATE_TRAPFRAME
- validate_trapframe(frame, 1);
-#endif
-}
-
-
-/*
- * void prefetch_abort_handler(trapframe_t *frame)
- *
- * Abort handler called when instruction execution occurs at
- * a non existant or restricted (access permissions) memory page.
- * If the address is invalid and we were in SVC mode then panic as
- * the kernel should never prefetch abort.
- * If the address is invalid and the page is mapped then the user process
- * does no have read permission so send it a signal.
- * Otherwise fault the page in and try again.
- */
-
-void
-prefetch_abort_handler(frame)
- trapframe_t *frame;
-{
- register u_int fault_pc;
- register struct proc *p;
- register struct pcb *pcb;
- u_int fault_instruction;
- u_int s;
- int fault_code;
- u_quad_t sticks;
-
-/* Debug code */
-
- if ((GetCPSR() & PSR_MODE) != PSR_SVC32_MODE) {
- s = splhigh();
- printf("fault being handled in non SVC32 mode\n");
- postmortem(frame);
- pmap_debug_level = 0;
- (void)splx(s);
- panic("Fault handler not in SVC mode");
- }
-
-
-/*
- * Enable IRQ's & FIQ's (disabled by the abort) This always comes
- * from user mode so we know interrupts were not disabled.
- * But we check anyway.
- */
-
-#ifndef BLOCK_IRQS
- if (!(frame->tf_spsr & I32_bit))
- enable_interrupts(I32_bit);
-#endif
-
-/* Update vmmeter statistics */
-
- cnt.v_trap++;
-
-/* Get the current proc structure or proc0 if there is none */
-
- if ((p = curproc) == 0) {
- p = &proc0;
- printf("Prefetch about with curproc == 0\n");
- }
-
- if (pmap_debug_level >= 0)
- printf("prefetch fault in process %08x\n", (u_int)p);
-
-/* can't use curpcb, as it might be NULL; and we have p in a register anyway */
-
- pcb = &p->p_addr->u_pcb;
- if (pcb == 0)
- panic("no pcb ... we're toast !");
-
- if (pcb != curpcb) {
- printf("data_abort: Alert ! pcb(%08x) != curpcb(%08x)\n", (u_int)pcb,
- (u_int)curpcb);
- printf("data_abort: Alert ! proc(%08x), curproc(%08x)\n", (u_int)p,
- (u_int)curproc);
- }
-
- if ((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE) {
- sticks = p->p_sticks;
-
-/* Modify the fault_code to reflect the USR/SVC state at time of fault */
-
- fault_code |= FAULT_USER;
- p->p_md.md_regs = frame;
- } else {
-/* All the kernel code pages are loaded at boot and do not get paged */
-
- s = splhigh();
- printf("Prefetch address = %08x\n", frame->tf_pc);
-
- postmortem(frame);
-
-#ifdef CONTINUE_AFTER_SVC_PREFETCH
-
- printf("prefetch abort in SVC mode !\n");
- printf("The system should now be considered very unstable :-)\n");
- sigexit(curproc, SIGILL);
-/* Not reached */
- (void)splx(s);
-#ifdef VALIDATE_TRAPFRAME
- validate_trapframe(frame, 4);
-#endif
- userret(p, frame->tf_pc, sticks);
-
-#ifdef VALIDATE_TRAPFRAME
- validate_trapframe(frame, 4);
-#endif
-#else
- panic("Prefetch abort in SVC mode");
-#endif
- }
-
-/* Get fault address */
-
- fault_pc = frame->tf_pc;
-
- if (pmap_debug_level >= 0)
- printf("Prefetch abort: PC = %08x\n", fault_pc);
-
-/* Ok validate the address, can only execute in USER space */
-
- if (fault_pc < VM_MIN_ADDRESS || fault_pc >= VM_MAXUSER_ADDRESS) {
- s = splhigh();
- printf("prefetch: pc (%08x) not in user process space\n", fault_pc);
- postmortem(frame);
- trapsignal(p, SIGBUS, FAULT_PERM_P);
- (void)splx(s);
- userret(p, frame->tf_pc, sticks);
- return;
- }
-
-/* Ok read the fault address. This will fault the page in for us */
-
- if (ReadWordWithChecks(fault_pc, &fault_instruction) != 0) {
- s = splhigh();
- printf("prefetch: faultin failed for address %08x!!\n", fault_pc);
- postmortem(frame);
- trapsignal(p, SIGSEGV, fault_pc);
- (void)splx(s);
- } else {
-
-/* More debug stuff */
-
- if (pmap_debug_level >= 0) {
- s = splhigh();
- printf("Instruction @V%08x = %08x\n", fault_pc, fault_instruction);
- disassemble(fault_pc);
- printf("return addr=%08x\n", frame->tf_pc);
-
- (void)splx(s);
- }
- }
-
-#ifdef VALIDATE_TRAPFRAME
- validate_trapframe(frame, 4);
-#endif
-
- userret(p, frame->tf_pc, sticks);
-
-#ifdef VALIDATE_TRAPFRAME
- validate_trapframe(frame, 2);
-#endif
-}
-
-
-void
-validate_trapframe(frame, where)
- trapframe_t *frame;
- int where;
-{
- char *ptr;
- u_int mode;
-
- if ((GetCPSR() & PSR_MODE) != PSR_SVC32_MODE)
- printf("VTF Warning : validate_trapframe : Not in SVC32 mode\n");
-
- mode = frame->tf_spsr & PSR_MODE;
-
- switch (where) {
- case 1:
- ptr = "data abort handler";
- break;
- case 2:
- ptr = "prefetch abort handler";
- if (mode != PSR_USR32_MODE)
- printf("VTF Warning : %s : not USR32 mode\n", ptr);
- break;
- case 3:
- ptr = "ast handler";
- if (mode != PSR_USR32_MODE)
- printf("VTF Warning : %s : not USR32 mode\n", ptr);
- break;
- case 4:
- ptr = "syscall handler";
- if (mode != PSR_USR32_MODE)
- printf("VTF Warning : %s : not USR32 mode\n", ptr);
- break;
- case 5:
- ptr = "undefined handler";
- if (mode != PSR_USR32_MODE)
- printf("VTF Warning : %s : not USR32 mode\n", ptr);
- break;
- case 6:
- ptr = "sigreturn handler";
- if (mode != PSR_USR32_MODE)
- printf("VTF Warning : %s : not USR32 mode\n", ptr);
- break;
- default:
- ptr = "unknown handler";
- break;
- }
-
- if (frame->tf_usr_sp >= VM_MAXUSER_ADDRESS)
- printf("VTF WARNING: %s : frame->tf_usr_sp >= VM_MAXUSER_ADDRESS [%08x]\n", ptr, frame->tf_usr_sp);
- if (frame->tf_svc_lr >= 0xf1000000)
- printf("VTF WARNING: %s : frame->tf_svc_lr >= 0xf1000000 [%08x]\n", ptr, frame->tf_svc_lr);
- if (frame->tf_pc >= 0xf1000000)
- printf("VTF WARNING: %s: frame->tf_pc >= 0xf1000000 [%08x]\n", ptr, frame->tf_pc);
- if (frame->tf_pc < VM_MIN_ADDRESS)
- printf("VTF WARNING: %s: frame->tf_pc >= VM_MIN_ADDRESS [%08x]\n", ptr, frame->tf_pc);
- if (mode != PSR_USR32_MODE) {
- if (frame->tf_svc_lr < 0xf0000000)
- printf("VTF WARNING: %s : frame->tf_svc_lr < 0xf0000000 [%08x]\n", ptr, frame->tf_svc_lr);
- if (frame->tf_pc < 0xf0000000)
- printf("VTF WARNING: %s: frame->tf_pc < 0xf0000000 [%08x]\n", ptr, frame->tf_pc);
- }
-}
-
-/* End of fault.c */
diff --git a/sys/arch/arm32/arm32/fiq.S b/sys/arch/arm32/arm32/fiq.S
deleted file mode 100644
index 1fe9f1bf88a..00000000000
--- a/sys/arch/arm32/arm32/fiq.S
+++ /dev/null
@@ -1,78 +0,0 @@
-/* $OpenBSD: fiq.S,v 1.2 2000/03/03 00:54:46 todd Exp $ */
-/* $NetBSD: fiq.S,v 1.1 1996/01/31 23:15:55 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * fiq.S
- *
- * Low level fiq handlers
- *
- * Created : 27/09/94
- * Last updated : 28/11/94
- *
- */
-
-#include <machine/cpu.h>
-
-sp .req r13
-lr .req r14
-pc .req r15
-
-.text
-
- .global _floppy_read_fiq
- .global _floppy_read_fiq_end
-
-_floppy_read_fiq:
- subs r11, r11, #0x00000001
- addeq r13, r13, #0x00018000
- ldrb r10, [r13]
- strb r10, [r12], #0x0001
- subs pc, lr, #0x00000004
-_floppy_read_fiq_end:
-
- .global _floppy_write_fiq
- .global _floppy_write_fiq_end
-
-_floppy_write_fiq:
- subs r11, r11, #0x00000001
- addeq r13, r13, #0x00018000
- ldrb r10, [r12], #0x0001
- strb r10, [r13]
- subs pc, lr, #0x00000004
-
-_floppy_write_fiq_end:
diff --git a/sys/arch/arm32/arm32/fusu.c b/sys/arch/arm32/arm32/fusu.c
deleted file mode 100644
index 824c6e33ccd..00000000000
--- a/sys/arch/arm32/arm32/fusu.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/* $NetBSD: fusu.c,v 1.2 1996/03/27 22:42:08 mark Exp $ */
-
-/*
- * Copyright (C) 1993 Wolfgang Solfrank.
- * Copyright (C) 1993 TooLs GmbH.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by TooLs GmbH.
- * 4. The name of TooLs GmbH may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Emulate fubyte.
- */
-
-int
-fubyte(addr)
-char *addr;
-{
- unsigned char c;
-
- if (copyin(addr,&c,sizeof(c)))
- return -1;
- return c;
-}
-
-/*
- * Emulate fuibyte.
- * Note: This is the same as fubyte.
- * In case of separate I&D space this MUST be replaced.
- */
-
-int
-fuibyte(addr)
-char *addr;
-{
- unsigned char c;
-
- if (copyin(addr,&c,sizeof(c)))
- return -1;
- return c;
-}
-
-/*
- * Emulate fuiword
- * Note: This is the same as fuword.
- * In case of separate I&D space this MUST be replaced.
- */
-
-int
-fuiword(addr)
-char *addr;
-{
- unsigned long l;
-
- if (copyin(addr,&l,sizeof(l)))
- return -1;
- return l;
-}
-
-/*
- * Emulate fuswintr
- */
-
-int
-fuswintr(addr)
-char *addr;
-{
- unsigned short s;
- extern int nopagefault;
- int ret;
-
- nopagefault++;
- if (copyin(addr,&s,sizeof(s)))
- ret = -1;
- else
- ret = s;
- nopagefault--;
- return ret;
-}
-
-/*
- * Emulate fusword
- */
-
-int
-fusword(addr)
-char *addr;
-{
- unsigned short s;
-
- if (copyin(addr,&s,sizeof(s)))
- return -1;
- return s;
-}
-
-/*
- * Emulate fuword
- */
-
-int
-fuword(addr)
-char *addr;
-{
- unsigned long l;
-
- if (copyin(addr,&l,sizeof(l)))
- return -1;
- return l;
-}
-
-/*
- * Emulate subyte.
- */
-
-int
-subyte(addr,c)
-char *addr;
-unsigned char c;
-{
- if (copyout(&c,addr,sizeof(c)))
- return -1;
- return 0;
-}
-
-/*
- * Emulate suibyte.
- * Note: This is the same as subyte.
- * In case of separate I&D space this MUST be replaced.
- */
-
-int
-suibyte(addr,c)
-char *addr;
-unsigned char c;
-{
- if (copyout(&c,addr,sizeof(c)))
- return -1;
- return 0;
-}
-
-/*
- * Emulate suiword
- * Note: This is the same as suword.
- * In case of separate I&D space this MUST be replaced.
- */
-
-int
-suiword(addr,l)
-char *addr;
-unsigned long l;
-{
- if (copyout(&l,addr,sizeof(l)))
- return -1;
- return 0;
-}
-
-/*
- * Emulate suswintr
- */
-
-int
-suswintr(addr,s)
-char *addr;
-unsigned short s;
-{
- extern int nopagefault;
- int ret;
-
- nopagefault++;
- ret = copyout(&s,addr,sizeof(s)) ? -1 : 0;
- nopagefault--;
- return ret;
-}
-
-/*
- * Emulate susword
- */
-
-int
-susword(addr,s)
-char *addr;
-unsigned short s;
-{
- if (copyout(&s,addr,sizeof(s)))
- return -1;
- return 0;
-}
-
-/*
- * Emulate suword
- */
-
-int
-suword(addr,l)
-char *addr;
-unsigned long l;
-{
- if (copyout(&l,addr,sizeof(l)))
- return -1;
- return 0;
-}
diff --git a/sys/arch/arm32/arm32/genassym.c b/sys/arch/arm32/arm32/genassym.c
deleted file mode 100644
index 9fe837d9842..00000000000
--- a/sys/arch/arm32/arm32/genassym.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/* $NetBSD: genassym.c,v 1.4 1996/03/13 21:22:32 mark Exp $ */
-
-/*-
- * Copyright (c) 1982, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/resourcevar.h>
-#include <sys/device.h>
-#include <sys/user.h>
-#include <sys/signal.h>
-
-#include <vm/vm.h>
-
-#include <machine/pmap.h>
-#include <machine/frame.h>
-#include <machine/vmparam.h>
-#include <machine/irqhandler.h>
-
-main()
-{
- struct proc *p = 0;
- struct vmmeter *vm = 0;
- struct pcb *pcb = 0;
- struct trapframe *tf = 0;
- struct sigframe *sigf = 0;
- struct uprof *uprof = 0;
- irqhandler_t *ih = 0;
- struct vconsole *vc = 0;
- struct vidc_info *vi = 0;
- struct vmspace *vms = 0;
-
-#define def(N,V) printf("#define\t%s %d\n", N, V)
-
- def("UPAGES", UPAGES);
- def("PGSHIFT", PGSHIFT);
- def("PDSHIFT", PDSHIFT);
-
- def("P_ADDR", &p->p_addr);
- def("P_BACK", &p->p_back);
- def("P_FORW", &p->p_forw);
- def("P_PRIORITY", &p->p_priority);
- def("P_STAT", &p->p_stat);
- def("P_WCHAN", &p->p_wchan);
- def("P_VMSPACE", &p->p_vmspace);
- def("P_SPARE", &p->p_md.__spare);
-
- def("PCB_PAGEDIR", &pcb->pcb_pagedir);
- def("PCB_FLAGS", &pcb->pcb_flags);
- def("PCB_R0", &pcb->pcb_r0);
- def("PCB_R1", &pcb->pcb_r1);
- def("PCB_R2", &pcb->pcb_r2);
- def("PCB_R3", &pcb->pcb_r3);
- def("PCB_R4", &pcb->pcb_r4);
- def("PCB_R5", &pcb->pcb_r5);
- def("PCB_R6", &pcb->pcb_r6);
- def("PCB_R7", &pcb->pcb_r7);
- def("PCB_R8", &pcb->pcb_r8);
- def("PCB_R9", &pcb->pcb_r9);
- def("PCB_R10", &pcb->pcb_r10);
- def("PCB_R11", &pcb->pcb_r11);
- def("PCB_R12", &pcb->pcb_r12);
- def("PCB_SP", &pcb->pcb_sp);
- def("PCB_LR", &pcb->pcb_lr);
- def("PCB_PC", &pcb->pcb_pc);
- def("PCB_UND_SP", &pcb->pcb_und_sp);
- def("PCB_ONFAULT", &pcb->pcb_onfault);
-
- def("USER_SIZE", sizeof(struct user));
-
- def("V_TRAP", &vm->v_trap);
- def("V_INTR", &vm->v_intr);
- def("V_SOFT", &vm->v_soft);
-
- def("VM_MAP", &vms->vm_map);
- def("VM_PMAP", &vms->vm_pmap);
-
- def("PR_BASE", &uprof->pr_base);
- def("PR_SIZE", &uprof->pr_size);
- def("PR_OFF", &uprof->pr_off);
- def("PR_SCALE", &uprof->pr_scale);
-
- def("IH_FUNC", &ih->ih_func);
- def("IH_ARG", &ih->ih_arg);
- def("IH_LEVEL", &ih->ih_level);
- def("IH_NUM", &ih->ih_num);
- def("IH_FLAGS", &ih->ih_flags);
- def("IH_MASK", &ih->ih_irqmask);
- def("IH_BIT", &ih->ih_irqbit);
- def("IH_NEXT", &ih->ih_next);
-
- def("SIGF_HANDLER", &sigf->sf_handler);
- def("SIGF_SC", &sigf->sf_sc);
-
- def("SIGTRAP", SIGTRAP);
- def("SIGEMT", SIGEMT);
-
- def("TF_R0", &tf->tf_r0);
- def("TF_R10", &tf->tf_r10);
- def("TF_PC", &tf->tf_pc);
-
- def("PROCSIZE", sizeof(struct proc));
- def("TRAPFRAMESIZE", sizeof(struct trapframe));
- exit(0);
-}
diff --git a/sys/arch/arm32/arm32/irq.S b/sys/arch/arm32/arm32/irq.S
deleted file mode 100644
index c1f9ed0d2e3..00000000000
--- a/sys/arch/arm32/arm32/irq.S
+++ /dev/null
@@ -1,508 +0,0 @@
-/* $NetBSD: irq.S,v 1.4 1996/03/27 20:42:53 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1996 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * irq.S
- *
- * Low level irq and fiq handlers
- *
- * Created : 27/09/94
- */
-
-#include "assym.h"
-#include <machine/cpu.h>
-#include <machine/iomd.h>
-
-#define PUSHFRAME \
- str lr, [sp, #-4]!; /* Push the return address */ \
- sub sp, sp, #0x00000004; /* Skip SVC R14 */ \
- stmdb sp, {r0-r14}^; /* Push the user mode registers */ \
- sub sp, sp, #(4*15); /* Adjust the stack pointer */ \
- mrs r0, spsr_all; /* Put the SPSR on the stack */ \
- str r0, [sp, #-4]!;
-
-#define PULLFRAME \
- ldr r0, [sp], #0x0004; /* Get the SPSR from stack */ \
- msr spsr_all, r0; \
- add sp, sp, #(4*15); /* Adjust the stack pointer */ \
- ldmdb sp, {r0-r14}^; /* Restore the registers (user mode) */ \
- mov r0, r0; /* NOP for previous instruction */ \
- add sp, sp, #0x00000004; /* Skip SVC R14 */ \
- ldr lr, [sp], #0x0004; /* Pull the return address */
-
-#define PULLFRAMEANDEXIT \
- ldr r0, [sp], #0x0004; /* Get the SPSR from stack */ \
- msr spsr_all, r0; \
- add sp, sp, #(4*15); /* Adjust the stack pointer */ \
- ldmdb sp, {r0-r14}^; /* Restore the registers (user mode) */ \
- mov r0, r0; /* NOP for previous instruction */ \
- add sp, sp, #0x00000004; /* Skip SVC R14 */ \
- ldmia sp!, {pc}^ /* Pull the return address */
-
-sp .req r13
-lr .req r14
-pc .req r15
-
-.text
-
-/*
- *
- * irq_entry
- *
- * Main entry point for the IRQ vector
- *
- * This function reads the irq request bits in the IOMD registers
- * IRQRQA, IRQRQB and DMARQ
- * It then calls an installed handler for each bit that is set.
- * The function stray_irqhandler is called if a handler is not defined
- * for a particular interrupt.
- * If a interrupt handler is found then it is called with r0 containing
- * the argument defined in the handler structure. If the field ih_arg
- * is zero then a pointer to the IRQ frame on the stack is passed instead.
- */
-
-Ldisabled_mask:
- .word _disabled_mask
-
-Lcurrent_spl_level:
- .word _current_spl_level
-
- .global irq_entry
-
-/*
- * Regsister usage
- *
- * r6 - Address of current handler
- * r7 - Pointer to handler pointer list
- * r8 - Current IRQ requests.
- * r9 - Used to count through possible IRQ bits.
- * r10 - Base address of IOMD
- */
-
-irq_entry:
- sub lr, lr, #0x00000004 /* Adjust the lr */
-
- PUSHFRAME
-
-/* Raise the spl level and re-enable interrupts */
-
-#if 0
- ldr r1, Lcurrent_spl_level
- ldr r0, [r1]
- add r0, r0, #1
- bl _raisespl
-#endif
-#if 0
- mrs r0, cpsr_all /* Enable IRQ's */
- bic r0, r0, #I32_bit
- msr cpsr_all, r0
-#endif
-
-/*
- * If we did not raise the spl level high enough we will get another
- * interrupt here.
- */
-
- mov r11, #0x00000000
- mov r10, #(IOMD_BASE) /* Point to the IOMD */
- ldrb r8, [r10, #(IOMD_IRQRQA - IOMD_BASE)] /* Get IRQ request A */
-/* strb r8, [r10, #(IOMD_IRQRQA - IOMD_BASE)]*/
- ldrb r9, [r10, #(IOMD_IRQRQB - IOMD_BASE)] /* Get IRQ request B */
- orr r8, r8, r9, lsl #8
- ldrb r9, [r10, #(IOMD_DMARQ - IOMD_BASE)] /* Get DMA Request */
- orr r8, r8, r9, lsl #16
-
-/*#if 0*/
- mov r0, #0x7d /* Clear IOMD IRQ bits */
- strb r0, [r10, #(IOMD_IRQRQA - IOMD_BASE)]
-/*#endif*/
-
-/* ldr r1, Ldisabled_mask
- ldr r0, [r1]
- orr r0, r0, r8
- str r0, [r1]
-
- bl _irq_setmasks*/
-
-#if 0
- mrs r0, cpsr_all /* Enable IRQ's */
- bic r0, r0, #I32_bit
- msr cpsr_all, r0
-#endif
- mov r0, sp
- mov r1, r8
- bl _validate_irq_address
-
- ldr r7, [pc, #irqhandlers - . - 8]
- mov r9, #0x00000001
-
- stmfd sp!, {r8}
-
-irqloop:
- tst r8, r9 /* Is a bit set ? */
-
- beq nextirq /* No ? try next bit */
-
- ldr r6, [r7] /* Get address of first handler structure */
-
- teq r6, #0x00000000 /* Do we have a handler */
- moveq r0, r8 /* IRQ requests as arg 0 */
- beq _stray_irqhandler /* call special handler */
-
- ldr r0, Lcnt
- ldr r1, [r0, #(V_INTR)]
- add r1, r1, #0x00000001
- str r1, [r0, #(V_INTR)]
-
-irqchainloop:
- add lr, pc, #nextinchain - . - 8 /* return address */
-
-#ifdef IRQSTATS
- ldr r0, Lintrcnt
- ldr r1, [r6, #(IH_NUM)]
-
- add r0, r0, r1, lsl #2
- ldr r1, [r0]
- add r1, r1, #0x00000001
- str r1, [r0]
-#endif
-
- ldr r0, [r6, #(IH_ARG)] /* Get argument pointer */
- teq r0, #0x00000000 /* If arg is zero pass stack frame */
- addeq r0, sp, #4 /* ... stack frame */
- ldr pc, [r6, #(IH_FUNC)] /* Call handler */
-
-nextinchain:
-/* ldr r1, Ldisabled_mask
- ldr r2, [r1]
- bic r2, r2, r9
- str r2, [r1]
- bl _irq_setmasks*/
-
- teq r0, #0x00000001 /* Was the irq serviced ? */
- beq nextirq
-
- ldr r6, [r6, #(IH_NEXT)]
- teq r6, #0x00000000
-/* bne irqchainloop*/
-
-nextirq:
- add r7, r7, #0x00000004 /* update pointer to handlers */
- mov r9, r9, lsl #1 /* move on to next bit */
- teq r9, #(1 << 24) /* done the last bit ? */
- bne irqloop /* no - loop back. */
-
- ldmfd sp!, {r8}
-
-
-#if 0
- mrs r0, cpsr_all /* Enable IRQ's */
- orr r0, r0, #I32_bit
- msr cpsr_all, r0
-#endif
-
- bl _dosoftints /* Handle the soft interrupts */
-
-/* Disable interrupts and lower the spl level */
-
-#if 0
- mrs r0, cpsr_all /* Enable IRQ's */
- orr r0, r0, #I32_bit
- msr cpsr_all, r0
-#endif
-#if 0
- ldr r1, Lcurrent_spl_level
- ldr r0, [r1]
- sub r0, r0, #1
- bl _lowerspl
-#endif
-
- ldr r0, [sp] /* Get the SPSR from stack */
-
- and r0, r0, #(PSR_MODE) /* Test for USR32 mode before the IRQ */
- teq r0, #(PSR_USR32_MODE)
- ldreq r0, Lastpending /* Do we have an AST pending ? */
- ldreq r1, [r0]
- teqeq r1, #0x00000001
- moveq r1, #0x00000000 /* Clear it */
- streq r1, [r0]
-
- moveq r0, sp /* arg 0 = irq frame */
- beq _irqast /* exit via the AST handler */
-
- PULLFRAME
-
- movs pc, lr /* Exit */
-
-
- .global _irqast
-_irqast:
-/* Punch into SVC32 mode (R0 points to the irqframe) */
-/* We can trash all the registers we like :-) */
-
-/* Debug message */
-
-/* stmfd sp!, {r0-r3}
- add r0, pc, #Lirqtext0 - . - 8
- bl _printf
- ldmfd sp!, {r0-r3}*/
-
- mrs r2, cpsr_all
- tst r2, #(I32_bit)
- bne Lis
-
- orr r2, r2, #(I32_bit)
- msr cpsr_all, r2
-
- stmfd sp!, {r0-r3, lr}
- add r0, pc, #Lirqtext0 - . - 8
- bl _printf
- ldmfd sp!, {r0-r3, lr}
-Lis:
- add sp, sp, #72 /* Correct IRQ32 sp */
-
-/*
- * We have now put IRQ mode back correct so we never need to return to
- * IRQ mode we can just exit via SVC mode. We must copy the trap frame
- * which still lies on the IRQ stack over to the SVC stack.
- */
-
-/* Punch into SVC 32 mode (IRQ's still disabled) */
-
- mrs r2, cpsr_all
- bic r2, r2, #(PSR_MODE)
- eor r2, r2, #(PSR_SVC32_MODE)
- orr r2, r2, #(I32_bit) /* Overkill */
- msr cpsr_all, r2
-
- sub sp, sp, #72 /* Correct SVC32 sp */
- mov r12, sp
-
-/* r0 points to the trap frame on the IRQ stack (SP corrected) */
-/* r12 points to the trap frame on the SVC stack */
-
- ldmia r0!, {r1-r9} /* Pull 9 regs off the IRQ stack */
- stmia r12!, {r1-r9} /* Store on the SVC stack */
- ldmia r0!, {r1-r9} /* Pull 9 regs off the IRQ stack */
- stmia r12!, {r1-r9} /* Store on the SVC stack */
-
-/* Ok the IRQ trapframe is now the SVC trapframe */
-
-/* IRQ's could be enabled here */
-
-/* Debug message */
-
-/* stmfd sp!, {r0-r3}
- add r0, pc, #Lirqtext1 - . - 8
- bl _printf
- ldmfd sp!, {r0-r3}
-*/
-/* r0 points to trap frame on entry to ast() */
-
- mov r0, sp
- stmfd sp!, {lr} /* Is this needed ? */
-
- bl _ast
-
- ldmfd sp!, {lr} /* Is this needed ? */
-
-/* Remember the address of the trap frame */
-
-/* stmfd sp!, {r0-r3}
- add r0, pc, #Lirqtext2 - . - 8
- bl _printf
- ldmfd sp!, {r0-r3}
-*/
-
-/* Pull the frame from the SVC stack and return */
-
-/* mov lr, #0*/
-
-/* Kill IRQ's incase ast as somehow re-enabled them ... */
-
- mrs r0, cpsr_all
- orr r0, r0, #(I32_bit)
- msr cpsr_all, r0
-
- PULLFRAMEANDEXIT
-
- mov r4, #0x000000A0
- mov pc, #0x00000000
-
-Lirqtext0:
- .asciz "irqs enabled during ast\n"
- .align 0
-
-Lirqtext1:
- .asciz "irqframe copied to SVC stack\n"
- .align 0
-
-Lirqtext2:
- .asciz "irqframe restored from SVC stack\n"
- .align 0
-
-Lspl_mask:
- .word _spl_mask
-
-Lcurrent_mask:
- .word _current_mask
-
- .global _irq_setmasks
-
-_irq_setmasks:
- ldr r1, Lcurrent_mask
- ldr r1, [r1]
- ldr r2, Lspl_mask
- ldr r2, [r2]
- and r1, r1, r2
- ldr r2, Ldisabled_mask
- ldr r2, [r2]
- bic r1, r1, r2
-
- mov r0, #(IOMD_BASE) /* Point to the IOMD */
- strb r1, [r0, #(IOMD_IRQMSKA - IOMD_BASE)] /* Set IRQ mask A */
- mov r1, r1, lsr #8
- strb r1, [r0, #(IOMD_IRQMSKB - IOMD_BASE)] /* Set IRQ mask B */
- mov r1, r1, lsr #8
- strb r1, [r0, #(IOMD_DMAMSK - IOMD_BASE)] /* Set DMA mask */
- mov pc, r14
-
-
-Lcnt:
- .word _cnt
-
-Lintrcnt:
- .word _intrcnt
-
-
-irqhandlers:
- .word _irqhandlers /* Pointer to array of irqhandlers */
-
-Lastpending:
- .word _astpending
-
-#ifdef IRQSTATS
-/* These symbols are used by vmstat */
-
- .text
- .global __intrnames
-__intrnames:
- .word _intrnames
-
- .data
-
- .globl _intrnames, _eintrnames, _intrcnt, _eintrcnt
-_intrnames:
- .asciz "interrupt 0 "
- .asciz "softnet " /* reserved0 */
- .asciz "interrupt 2 "
- .asciz "interrupt 3 "
- .asciz "interrupt 4 "
- .asciz "interrupt 5 "
- .asciz "interrupt 6 "
- .asciz "softclock " /* reserved1 */
- .asciz "reserved 2 "
- .asciz "interrupt 9 "
- .asciz "interrupt 10 "
- .asciz "interrupt 11 "
- .asciz "interrupt 12 "
- .asciz "interrupt 13 "
- .asciz "interrupt 14 "
- .asciz "interrupt 15 "
- .asciz "dma channel 0"
- .asciz "dma channel 1"
- .asciz "dma channel 2"
- .asciz "dma channel 3"
- .asciz "interrupt 20 "
- .asciz "interrupt 21 "
- .asciz "reserved 3 "
- .asciz "reserved 4 "
- .asciz "exp card 0 "
- .asciz "exp card 1 "
- .asciz "exp card 2 "
- .asciz "exp card 3 "
- .asciz "exp card 4 "
- .asciz "exp card 5 "
- .asciz "exp card 6 "
- .asciz "exp card 7 "
-_eintrnames:
-
- .bss
- .align 0
-_intrcnt:
- .space 32*4
-_eintrcnt:
-
-#else
-/* Dummy entries to keep vmstat happy */
-
- .text
- .globl _intrnames, _eintrnames, _intrcnt, _eintrcnt
-_intrnames:
- .long 0
-_eintrnames:
-
-_intrcnt:
- .long 0
-_eintrcnt:
-#endif
-
-/* FIQ code */
-
- .text
- .align 0
- .global _fiq_setregs /* Sets up the FIQ handler */
-
-_fiq_setregs:
- mrs r2, cpsr_all
- mov r3, r2
- bic r2, r2, #(PSR_MODE)
- orr r2, r2, #(PSR_FIQ32_MODE)
- msr cpsr_all, r2
-
- ldr r8, [r0, #0x000c] /* Update FIQ registers*/
- ldr r9, [r0, #0x0010]
- ldr r10, [r0, #0x0014]
- ldr r11, [r0, #0x0018]
- ldr r12, [r0, #0x001c]
- ldr r13, [r0, #0x0020]
-
- msr cpsr_all, r3 /* Back to old mode */
-
- mov pc, lr /* Exit */
-
-/* End of irq.S */
diff --git a/sys/arch/arm32/arm32/irqhandler.c b/sys/arch/arm32/arm32/irqhandler.c
deleted file mode 100644
index 7ee69cd3e46..00000000000
--- a/sys/arch/arm32/arm32/irqhandler.c
+++ /dev/null
@@ -1,576 +0,0 @@
-/* $NetBSD: irqhandler.c,v 1.4 1996/03/28 21:43:52 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1996 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * irqhandler.c
- *
- * IRQ/FIQ initialisation, claim, release and handler routines
- *
- * NOTE: Although the irqhandlers support chaining and the claim
- * and release routines install handlers at the top of the chain
- * The low level IRQ handler will only call the top handler in a
- * chain.
- *
- * Created : 30/09/94
- */
-
-/* Note: Need to remove IRQ_FLAG_ACTIVE as it is not used */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <vm/vm.h>
-#include <sys/syslog.h>
-
-#include <machine/irqhandler.h>
-#include <machine/cpu.h>
-#include <machine/iomd.h>
-#include <machine/katelib.h>
-#include <machine/pte.h>
-
-irqhandler_t *irqhandlers[NIRQS];
-fiqhandler_t *fiqhandlers;
-
-u_int irqmasks[IRQ_LEVELS];
-u_int current_mask;
-u_int actual_mask;
-u_int disabled_mask;
-u_int spl_mask;
-u_int soft_interrupts;
-extern u_int intrcnt[];
-
-typedef struct {
- vm_offset_t physical;
- vm_offset_t virtual;
-} pv_addr_t;
-
-extern pv_addr_t systempage;
-
-/* Prototypes */
-
-int podule_irqhandler __P((void));
-int irq_claim __P((int /*irq*/, irqhandler_t */*handler*/));
-void zero_page_readonly __P((void));
-void zero_page_readwrite __P((void));
-
-int fiq_setregs __P((fiqhandler_t *));
-
-/*
- * void irq_init(void)
- *
- * Initialise the IRQ/FIQ sub system
- */
-
-void
-irq_init()
-{
- int loop;
-
-/* Clear all the IRQ handlers */
-
- for (loop = 0; loop < NIRQS; ++loop)
- irqhandlers[loop] = NULL;
-
-/* Clear the FIQ handler */
-
- fiqhandlers = NULL;
-
-/* Clear the IRQ/FIQ masks in the IOMD */
-
- WriteByte(IOMD_IRQMSKA, 0x00);
- WriteByte(IOMD_IRQMSKB, 0x00);
- WriteByte(IOMD_FIQMSK, 0x00);
- WriteByte(IOMD_DMAMSK, 0x00);
-
-/*
- * Setup the irqmasks for the different Interrupt Priority Levels
- * We will start with no bits set and these will be updated as handlers
- * are installed at different IPL's.
- */
-
- irqmasks[IPL_BIO] = 0x00000000;
- irqmasks[IPL_NET] = 0x00000000;
- irqmasks[IPL_TTY] = 0x00000000;
- irqmasks[IPL_CLOCK] = 0x00000000;
- irqmasks[IPL_IMP] = 0x00000000;
-
- current_mask = 0x00000000;
- actual_mask = 0x00000000;
- spl_mask = 0x00000000;
- soft_interrupts = 0x00000000;
-
- set_spl_masks();
-
-/* Enable IRQ's and FIQ's */
-
- enable_interrupts(I32_bit | F32_bit);
-}
-
-
-/*
- * int irq_claim(int irq, irqhandler_t *handler)
- *
- * Enable an IRQ and install a handler for it.
- */
-
-int
-irq_claim(irq, handler)
- int irq;
- irqhandler_t *handler;
-{
- int level;
-
-/* IRQ_INSTRUCT indicates that we should get the irq number from the irq structure */
-
- if (irq == IRQ_INSTRUCT)
- irq = handler->ih_num;
-
-/* Make sure the irq number is valid */
-
- if (irq < 0 || irq >= NIRQS)
- return(-1);
-
-/* Install the handler at the top of the chain */
-
- handler->ih_next = irqhandlers[irq];
- irqhandlers[irq] = handler;
-
-/* if (irq == IRQ_VSYNC)
- {
- irqhandler_t *x;
- x = irqhandlers[irq];
- while (x) {
- printf("handler = %08x %08x\n", x, handler);
- x = x->ih_next;
- }
- }*/
-
-/*
- * Reset the flags for this handler. As it is at the top of the list it
- * must be the active handler.
- */
-/* amb - no needed these days */
- handler->ih_flags = 0 | IRQ_FLAG_ACTIVE;
-
-/*
- * Record the interrupt number for accounting.
- * Done here as the accounting number may not be the same as the IRQ number
- * though for the moment they are
- */
-
- handler->ih_num = irq;
-
-/* If this is the first interrupt to be attached make a not of any name */
-
-#ifdef IRQSTATS
- if (handler->ih_next == NULL && handler->ih_name) {
- extern char *_intrnames;
- char *ptr = _intrnames + (irq * 14);
-/* printf("intrnames=%08x ptr=%08x irq=%d\n", (u_int)_intrnames, (u_int)ptr, irq);*/
- strcpy(ptr, " ");
- strncpy(ptr, handler->ih_name, min(strlen(handler->ih_name), 13));
- }
-#endif
-
-/*
- * Update the irq masks.
- * This IRQ is allowable at all lower Interrupt Priority Levels.
- */
- if (handler->ih_level >= 0 && handler->ih_level < IRQ_LEVELS) {
- level = handler->ih_level - 1;
- while (level >= 0) {
- irqmasks[level] |= (1 << irq);
- --level;
- }
-
-#include "sl.h"
-#include "ppp.h"
-#if NSL > 0 || NPPP > 0
-/* In the presence of SLIP or PPP, splimp > spltty. */
- irqmasks[IPL_NET] &= irqmasks[IPL_TTY];
-#endif
- }
-
-/*
- for (level = 0; level < IRQ_LEVELS; ++level)
- printf("irqmask[%d] = %08x\n", level, irqmasks[level]);
-*/
-
-/*
- * Is this an expansion card IRQ and is there a PODULE IRQ handler
- * installed ?
- * If not panic as the podulebus irq handler should have been installed
- * when the podulebus was attached.
- */
-
- if (irq >= IRQ_EXPCARD0 && irqhandlers[IRQ_PODULE] == NULL)
- panic("Podule IRQ %d claimed but no podulebus handler installed",
- irq);
-
- enable_irq(irq);
- set_spl_masks();
-
- return(0);
-}
-
-
-/*
- * int irq_release(int irq, irqhandler_t *handler)
- *
- * Disable an IRQ and remove a handler for it.
- */
-
-int
-irq_release(irq, handler)
- int irq;
- irqhandler_t *handler;
-{
- int level;
-
- irqhandler_t *irqhand;
- irqhandler_t **prehand;
-
-/* IRQ_INSTRUCT indicates that we should get the irq number from the irq structure */
-
- if (irq == IRQ_INSTRUCT)
- irq = handler->ih_num;
-
-/* Make sure the irq number is valid */
-
- if (irq < 0 || irq >= NIRQS)
- return(-1);
-
-/*
- * Update the irq masks.
- * Remove the IRQ from all the approriate IPL's
- */
-
- if (handler->ih_level >= 0 && handler->ih_level < IRQ_LEVELS) {
- level = handler->ih_level - 1;
- while (level >= 0) {
- irqmasks[level] &= ~(1 << irq);
- --level;
- }
- }
-
-/* Locate the handler */
-
- irqhand = irqhandlers[irq];
- prehand = &irqhandlers[irq];
-
- while (irqhand && handler != irqhand) {
- prehand = &irqhand;
- irqhand = irqhand->ih_next;
- }
-
-/* Remove the handler if located */
-
- if (irqhand)
- *prehand = irqhand->ih_next;
- else
- return(-1);
-
-/* Flag the handler being removed as non active (in case it was) */
-/* Not needed these days - AMB */
- irqhand->ih_flags &= ~IRQ_FLAG_ACTIVE;
-
-/* Make sure the head of the handler list is active */
-
- if (irqhandlers[irq])
- irqhandlers[irq]->ih_flags |= IRQ_FLAG_ACTIVE;
-
-/*
- * Disable the appropriate mask bit if there are no handlers left for
- * this IRQ.
- */
-
- if (irqhandlers[irq] == NULL)
- disable_irq(irq);
-
- set_spl_masks();
-
- return(0);
-}
-
-
-u_int
-disable_interrupts(mask)
- u_int mask;
-{
- register u_int cpsr;
-
- cpsr = SetCPSR(mask, mask);
- if ((GetCPSR() & I32_bit) == 0)
- printf("Alert ! disable_interrupts has failed\n");
-
- return(cpsr);
-}
-
-
-u_int
-restore_interrupts(old_cpsr)
- u_int old_cpsr;
-{
- register int mask = I32_bit | F32_bit;
- return(SetCPSR(mask, old_cpsr & mask));
-}
-
-
-u_int
-enable_interrupts(mask)
- u_int mask;
-{
- return(SetCPSR(mask, 0));
-}
-
-
-/*
- * void disable_irq(int irq)
- *
- * Disables a specific irq. The irq is removed from the master irq mask
- */
-
-void
-disable_irq(irq)
- int irq;
-{
- register int oldirqstate;
-
- oldirqstate = disable_interrupts(I32_bit);
- current_mask &= ~(1 << irq);
- irq_setmasks();
- restore_interrupts(oldirqstate);
-}
-
-
-/*
- * void enable_irq(int irq)
- *
- * Enables a specific irq. The irq is added to the master irq mask
- * This routine should be used with caution. A handler should already
- * be installed.
- */
-
-void
-enable_irq(irq)
- int irq;
-{
- register u_int oldirqstate;
-
- oldirqstate = disable_interrupts(I32_bit);
- current_mask |= (1 << irq);
- irq_setmasks();
- restore_interrupts(oldirqstate);
-}
-
-
-/*
- * void stray_irqhandler(u_int mask)
- *
- * Handler for stray interrupts. This gets called if a handler cannot be
- * found for an interrupt.
- */
-
-void
-stray_irqhandler(mask)
- u_int mask;
-{
-/* panic("Stray IRQ received (%08x)", mask);*/
- static u_int stray_irqs = 0;
-
- if (++stray_irqs <= 8)
- log(LOG_ERR, "Stray interrupt %08x%s\n", mask,
- stray_irqs >= 8 ? ": stopped logging" : "");
-}
-
-
-void
-dosoftints()
-{
- register u_int softints;
-
- softints = soft_interrupts & spl_mask;
- if (softints & IRQMASK_SOFTCLOCK) {
- int s;
-
- ++cnt.v_soft;
- ++intrcnt[IRQ_SOFTCLOCK];
- soft_interrupts &= ~IRQMASK_SOFTCLOCK;
- s = lowerspl(SPL_SOFT);
- softclock();
- (void)splx(s);
- }
- if (softints & IRQMASK_SOFTNET) {
- ++cnt.v_soft;
- ++intrcnt[IRQ_SOFTNET];
- soft_interrupts &= ~IRQMASK_SOFTNET;
-#ifdef INET
-#include "ether.h"
-#if NETHER > 0
- arpintr();
-#endif
- ipintr();
-#endif
-#ifdef INET6
- ip6intr();
-#endif
-#ifdef IMP
- impintr();
-#endif
-#ifdef NS
- nsintr();
-#endif
-#ifdef ISO
- clnlintr();
-#endif
-#ifdef CCITT
- ccittintr();
-#endif
-#include "ppp.h"
-#if NPPP > 0
- pppintr();
-#endif
- }
-}
-
-extern vgone();
-extern vfinddev();
-extern idle();
-extern cpu_switch();
-extern switch_exit();
-
-void
-validate_irq_address(irqf, mask)
- irqframe_t *irqf;
- u_int mask;
-{
- return;
- if (irqf->if_pc > (int)idle && irqf->if_pc < (int)switch_exit)
- return;
- if (irqf->if_pc > (int)SetCPSR && irqf->if_pc < (int)GetCPSR)
- return;
- if ((irqf->if_spsr & PSR_MODE) != PSR_USR32_MODE) {
- printf("Alert! IRQ while in non USR mode (%08x) pc=%08x\n",
- irqf->if_spsr, irqf->if_pc);
- }
- if ((GetCPSR() & I32_bit) == 0) {
- printf("Alert! IRQ's enabled during IRQ handler\n");
- }
- if (irqf->if_pc >= (int)vgone && irqf->if_pc < (int)vfinddev)
- printf("Alert! IRQ between vgone & vfinddev : pc=%08x\n",
- irqf->if_pc);
-}
-
-
-/*
- * int fiq_claim(fiqhandler_t *handler)
- *
- * Claim FIQ's and install a handler for them.
- */
-
-int
-fiq_claim(handler)
- fiqhandler_t *handler;
-{
-/* Fail if the FIQ's are already claimed */
-
- if (fiqhandlers)
- return(-1);
-
- if (handler->fh_size > 0xc0)
- return(-1);
-
-/* Install the handler */
-
- fiqhandlers = handler;
-
-/* Now we have to actually install the FIQ handler */
-
-/* Eventually we will copy this down but for the moment ... */
-
- zero_page_readwrite();
-
- WriteWord(0x0000003c, (u_int) handler->fh_func);
-
- zero_page_readonly();
-
-/* bcopy(handler->fh_func, 0x0000001c, handler->fh_size);*/
-
-/* We must now set up the FIQ registers */
-
- fiq_setregs(handler);
-
-/* Set up the FIQ mask */
-
- WriteWord(IOMD_FIQMSK, handler->fh_mask);
-
-/* Make sure that the FIQ's are enabled */
-
- enable_interrupts(F32_bit);
- return(0);
-}
-
-
-/*
- * int fiq_release(fiqhandler_t *handler)
- *
- * Release FIQ's and remove a handler for them.
- */
-
-int
-fiq_release(handler)
- fiqhandler_t *handler;
-{
-/* Fail if the handler is wrong */
-
- if (fiqhandlers != handler)
- return(-1);
-
-/* Disable FIQ interrupts */
-
- disable_interrupts(F32_bit);
-
-/* Clear up the FIQ mask */
-
- WriteWord(IOMD_FIQMSK, 0x00);
-
-/* Remove the handler */
-
- fiqhandlers = NULL;
- return(0);
-}
-
-/* End of irqhandler.c */
diff --git a/sys/arch/arm32/arm32/kgdb_glue.c b/sys/arch/arm32/arm32/kgdb_glue.c
deleted file mode 100644
index f8ed9b6ada8..00000000000
--- a/sys/arch/arm32/arm32/kgdb_glue.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/* $NetBSD: kgdb_glue.c,v 1.2 1996/03/27 22:42:16 mark Exp $ */
-
-/*
- * Copyright (C) 1994 Wolfgang Solfrank.
- * Copyright (C) 1994 TooLs GmbH.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by TooLs GmbH.
- * 4. The name of TooLs GmbH may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/reboot.h>
-
-#include <kgdb/kgdb.h>
-
-#include <machine/cpu.h>
-#include <machine/psl.h>
-#include <machine/kgdb.h>
-
-int kgdbregs[NREG];
-
-dump(p, l)
- u_char *p;
-{
- int i, j, n;
-
- while (l > 0) {
- printf("%08x: ", p);
- n = l > 16 ? 16 : l;
- for (i = 4; --i >= 0;) {
- for (j = 4; --j >= 0;)
- printf(--n >= 0 ? "%02x " : " ", *p++);
- printf(" ");
- }
- p -= 16;
- n = l > 16 ? 16 : l;
- n = (n + 3) & ~3;
- for (i = 4; --i >= 0;)
- printf((n -= 4) >= 0 ? "%08x " : "", *((long *)p)++);
- printf("\n");
- l -= 16;
- }
-}
-
-#define NDBGSTKS 8 /* number of debugstacks */
-#define SZDBGSTK 512 /* size of one debugstack */
-static int debugstack[NDBGSTKS * SZDBGSTK];
-static int dbgstkused;
-
-int *
-kgdb_find_stack()
-{
- int i;
-
- for (i = 0; i < NDBGSTKS; i++)
- if (!(dbgstkused&(1 << i))) {
- dbgstkused |= 1 << i;
- return debugstack + (i + 1) * SZDBGSTK;
- }
- panic("KGDB: no stack");
-}
-
-void
-kgdb_free_stack(sp)
- int *sp;
-{
- int i;
-
- for (i = 0; i < NDBGSTKS; i++)
- if (sp == debugstack + (i + 1) * SZDBGSTK) {
- if (!(dbgstkused&(1 << i)))
- panic("KGDB: free free stack");
- dbgstkused &= ~(1 << i);
- return;
- }
- panic("KGDB: free non-stack");
-}
-
-void
-kgdbinit()
-{
- /* initialize undefined mode & setup trap vector */
- initmode(PSR_UND32_MODE|F32_bit|I32_bit, kgdb_find_stack());
-}
-
-void
-kgdb_connect(when)
- int when;
-{
- boothowto |= RB_KDB;
- if (when == 0)
- printf("waiting for remote GDB\n");
- __asm(".word 0xe6000010");
-}
-
-int
-kgdb_poll()
-{
- return 0;
-}
-
-void
-kgdb_panic()
-{
- kgdbpanic = 1;
- __asm(".word 0xe6000010");
-}
-
-int
-kgdb_trap_glue(regs)
- int *regs;
-{
- int inst;
- int cnt;
-
- inst = fetchinst(regs[PC] - 4);
- switch (inst) {
- default:
- /* unexpected */
-#ifdef __notyet__
- return 0;
-#endif
- case 0xe6000011: /* KGDB installed breakpoint */
- regs[PC] -= 4;
- break;
- case 0xe6000010: /* breakpoint in kgdb_connect */
- break;
- }
- while (1) {
- kgdbcopy(regs, kgdbregs, sizeof kgdbregs);
- switch (kgdbcmds()) {
- case 1:
- kgdbcopy(kgdbregs, regs, sizeof kgdbregs);
- if ((cnt = singlestep(regs)) < 0)
- panic("singlestep");
- regs[PC] += cnt;
- continue;
- default:
- break;
- }
- break;
- }
- kgdbcopy(kgdbregs, regs, sizeof kgdbregs);
- if (PSR_USER(regs[PSR]) || !PSR_32(regs[PSR]))
- panic("KGDB: invalid mode %x", regs[PSR]);
- return 1;
-}
-
-void
-kgdbcopy(vs, vd, n)
- void *vs, *vd;
- int n;
-{
- char *s = vs, *d = vd;
- long *ls, *ld;
- int ln;
-
- if (((int)s&(sizeof(long)-1)) == ((int)d&(sizeof(long)-1))
- && n >= 2 * sizeof(long)) {
- while (((int)s&(sizeof(long)-1)) && --n >= 0)
- *d++ = *s++;
- ln = n / sizeof(long);
- n -= ln * sizeof(long);
- ls = (long *)s;
- ld = (long *)d;
- while (--ln >= 0)
- *ld++ = *ls++;
- s = (char *)ls;
- d = (char *)ld;
- }
- while (--n >= 0)
- *d++ = *s++;
-}
-
-void
-kgdbzero(vd, n)
- void *vd;
- int n;
-{
- char *d = vd;
- long *ld;
- int ln;
-
- if (n >= 2 * sizeof(long)) {
- while (--n >= 0) {
- if (!((int)d&sizeof(long)-1))
- break;
- *d++ = 0;
- }
- ln = n / sizeof(long);
- n -= ln * sizeof(long);
- ld = (long *)d;
- while (--ln >= 0)
- *ld++ = 0;
- d = (char *)ld;
- }
- while (--n >= 0)
- *d++ = 0;
-}
-
-int
-kgdbcmp(vs, vd, n)
- void *vs, *vd;
- int n;
-{
- char *s = vs, *d = vd;
- long *ls, *ld;
- int ln;
-
- if (((int)s&(sizeof(long)-1)) == ((int)d&(sizeof(long)-1))
- && n >= 2 * sizeof(long)) {
- while (--n >= 0) {
- if (!((int)s&(sizeof(long)-1)))
- break;
- if (*d++ != *s++)
- return *--d - *--s;
- }
- ln = n / sizeof(long);
- n -= ln * sizeof(long);
- ls = (long *)s;
- ld = (long *)d;
- while (--ln >= 0)
- if (*ld++ != *ls++) {
- n += ++ln * sizeof(long);
- break;
- }
- s = (char *)ls;
- d = (char *)ld;
- }
- while (--n >= 0)
- if (*d++ != *s++)
- return *--d - *--s;
- return 0;
-}
diff --git a/sys/arch/arm32/arm32/kgdb_step.c b/sys/arch/arm32/arm32/kgdb_step.c
deleted file mode 100644
index c3b260ba22b..00000000000
--- a/sys/arch/arm32/arm32/kgdb_step.c
+++ /dev/null
@@ -1,440 +0,0 @@
-/* $NetBSD: kgdb_step.c,v 1.2 1996/03/27 22:42:20 mark Exp $ */
-
-/*
- * Copyright (C) 1994 Wolfgang Solfrank.
- * Copyright (C) 1994 TooLs GmbH.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by TooLs GmbH.
- * 4. The name of TooLs GmbH may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-
-#include <machine/cpu.h>
-#include <machine/psl.h>
-#include <machine/kgdb.h>
-
-/*
- * Faults during instruction fetch? XXX
- */
-int
-fetchinst(pc)
- void *pc;
-{
- int inst, byte, n;
-
- inst = 0;
- pc += sizeof(int);
- for (n = sizeof(int); --n >= 0;) {
- inst <<= 8;
- byte = kgdbfbyte(--pc);
- if (byte < 0)
- return 0xe7ffffff; /* special hack! */
- inst |= byte;
- }
- return inst;
-}
-
-static __inline void
-execute(inst, args, regs)
- int inst;
- int *args;
- int *regs;
-{
- int *sp;
-
- /*
- * For now, no user level emulation
- */
- if (PSR_USER(regs[PSR]) || !PSR_32(regs[PSR]))
- panic("execute");
- sp = kgdb_find_stack();
- regs[PSR] = Execute(inst, regs[PSR], args, sp);
- kgdb_free_stack(sp);
-}
-
-static __inline int
-condition(inst, args, regs)
- int inst;
- int *args;
- int *regs;
-{
- args[0] = 0;
- /* mov{cond} r0, #1 */
- execute((inst&0xf0000000)|0x03a00001, args, regs);
- return args[0];
-}
-
-static __inline int
-immediate(inst)
- int inst;
-{
- int imm = inst&0xff;
- int rot = (inst >> 8)&0xf;
-
- rot *= 2;
- return (imm >> rot)|(imm << (32 - rot));
-}
-
-static __inline int
-getreg(reg, ahead, regs)
- int reg;
- int ahead;
- int *regs;
-{
- if (reg == PC)
- return regs[PC] + (ahead ? 12 : 8);
- return regs[reg];
-}
-
-static __inline void
-setreg(reg, val, regs)
- int reg;
- int val;
- int *regs;
-{
- if (reg == PC)
- val &= ~3;
- regs[reg] = val;
-}
-
-int
-singlestep(regs)
- int *regs;
-{
- int inst;
- int args[5];
- int dst, idx;
- int val;
-
- inst = fetchinst(regs[PC]);
- switch (inst&0x0c000000) {
- case 0x00000000:
- if ((inst&0x0fb00ff0) == 0x01000090) {
- /* swp */
- dst = (inst >> 12)&0xf;
- if (dst == PC)
- return -1;
- idx = inst&0xf;
- if (idx == PC)
- return -1;
- args[0] = getreg(idx, 0, regs);
- args[1] = getreg(dst, 0, regs);
- idx = (inst >> 16)&0xf;
- if (idx == PC)
- return -1;
- args[2] = getreg(idx, 0, regs);
- execute((inst&0xf0400000)|0x01021090, args, regs);
- setreg(dst, args[1], regs);
- return 4;
- }
- if ((inst&0x0fbf0fff) == 0x01000090) {
- /* mrs */
- if ((regs[PSR]&0xf) == 0
- && (inst&0x00400000))
- /* mrs xx, spsr in user mode */
- return 4; /* ??? */
- dst = (inst >> 12)&0xf;
- if (dst == PC)
- return -1;
- if (condition(inst, args, regs))
- setreg(dst, regs[(inst&0x00400000) ? SPSR : PSR], regs);
- return 4;
- }
- if ((inst&0x0fbffff0) == 0x0129f000) {
- /* msr */
- if (condition(inst, args, regs)) {
- idx = inst&0xf;
- if (idx == PC)
- return -1;
- val = getreg(idx, 0, regs);
- if ((regs[PSR]&0xf) == 0) {
- if (inst&0x00400000)
- /* msr spsr, xx in user mode */
- return 4; /* ??? */
- val &= 0xf0000000;
- val |= regs[PSR]&0x0fffffff;
- }
- regs[(inst&0x00400000) ? SPSR : PSR] = val;
- }
- return 4;
- }
- if ((inst&0x0dbff000) == 0x0128f000) {
- /* msrf */
- if (condition(inst, args, regs)) {
- if ((regs[PSR]&0xf) == 0
- && (inst&0x00400000))
- /* msr spsr_flg, xx in user mode */
- return 4; /* ??? */
- if (inst&0x02000000)
- val = immediate(inst);
- else if (inst&0x00000ff0)
- return -1;
- else {
- idx = inst&0xf;
- if (idx == PC)
- return -1;
- val = getreg(idx, 0, regs);
- }
- val &= 0xf0000000;
- val |= regs[PSR]&0x0fffffff;
- regs[(inst&0x00400000) ? SPSR : PSR] = val;
- }
- return 4;
- }
- if ((inst&0x0fc000f0) == 0x00000090) {
- /* mul/mla */
- dst = (inst >> 16)&0xf;
- if (dst == PC)
- return -1;
- idx = inst&0xf;
- if (idx == dst || idx == PC)
- return -1;
- args[1] = getreg(idx, 0, regs);
- idx = (inst >> 8)&0xf;
- if (idx == PC)
- return -1;
- args[2] = getreg(idx, 0, regs);
- idx = (inst >> 12)&0xf;
- if (idx == PC)
- return -1;
- if (idx && !(inst&0x00200000))
- /* mul with rn != 0 */
- return -1;
- args[0] = getreg(idx, 0, regs);
- args[3] = getreg(dst, 0, regs);
- execute((inst&0xfff00000)|0x30291, args, regs);
- setreg(dst, args[3], regs);
- return 4;
- }
- {
- /* data processing */
- if (condition(inst, args, regs)) {
- dst = (inst >> 12)&0xf;
- if (inst&0x00100000) {
- /* S-Bit set */
- if (dst == PC)
- /* S-Bit set and destination is R15 */
- return -1; /* not yet */
- } else
- /* S-Bit not set */
- switch ((inst >> 21)&0xf) {
- case 0x8: /* TST */
- case 0x9: /* TEQ */
- case 0xa: /* CMP */
- case 0xb: /* CMN */
- return -1;
- }
- val = ((inst&0x02000010) == 0x00000010);
- args[0] = getreg((inst >> 16)&0xf, val, regs);
- if (!(inst&0x02000000)) {
- args[2] = getreg(inst&0xf, val, regs);
- if (inst&0x00000010) {
- if (inst&0x00000080)
- return -1;
- args[3] = getreg((inst >> 8)&0xf, val, regs);
- inst = (inst&0xfff000f0)|0x00001302;
- } else
- inst = (inst&0xfff00ff0)|0x00001002;
- } else
- inst = (inst&0xfff00fff)|0x00001000;
- execute(inst, args, regs);
- switch ((inst >> 21)&0xf) {
- case 0x8: /* TST */
- case 0x9: /* TEQ */
- case 0xa: /* CMP */
- case 0xb: /* CMN */
- break;
- default:
- setreg(dst, args[1], regs);
- break;
- }
- return dst == PC ? 0 : 4;
- }
- return 4;
- }
- break;
- case 0x04000000:
- if ((inst&0x0e000010) == 0x06000010)
- /* undefined */
- return -1;
- {
- /* ldr/str */
- if (condition(inst, args, regs)) {
- dst = (inst >> 12)&0xf;
- if (inst&0x00100000)
- args[1] = regs[dst];
- else
- args[1] = getreg(dst, 1, regs);
- val = (inst >> 16)&0xf;
- if ((inst&0x00200000) && val == PC)
- /* write back with pc as base */
- return -1;
- args[2] = getreg(val, 0, regs);
- if (inst&0x02000000) {
- if (inst&0x00000010)
- /* shift amount in register */
- return -1;
- idx = inst&0xf;
- if (idx == PC)
- /* offset in PC */
- return -1;
- args[0] = getreg(idx, 0, regs);
- inst = (inst&0xfff00ff0)|0x21000;
- } else
- inst = (inst&0xfff00fff)|0x21000;
- execute(inst, args, regs);
- if (inst&0x00200000)
- regs[val] = args[2];
- if (inst&0x00100000)
- setreg(dst, args[1], regs);
- return dst == PC ? 0 : 4;
- }
- return 4;
- }
- break;
- case 0x08000000:
- switch (inst&0x0e000000) {
- case 0x08000000:
- /* ldm/stm */
- if (condition(inst, args, regs)) {
- int cnt;
- int val, is1;
- int final;
-
- if (inst&0x00400000)
- /* S-bit not yet supported */
- return -1;
- dst = (inst >> 16)&0xf;
- if (dst == PC)
- return -1;
- args[0] = final = val = getreg(dst, 0, regs);
- cnt = 0;
- is1 = 0;
- for (idx = 0; idx < 16; idx++)
- if ((inst&(1 << idx))
- && (cnt += 4) <= 4 /* count the registers */
- && idx == dst)
- /* indicate unmodified store */
- is1 = 1;
- if ((inst&0x00300000) == 0x00200000
- && (inst&(1 << dst))
- && !is1) {
- /*
- * The destination is in the list of a stm
- * with write-back and is not the first
- * register
- */
- if (inst&0x00800000)
- val -= cnt;
- else
- val += cnt;
- }
- if (!(inst&0x00800000)) {
- /* lowest address involved */
- args[0] -= cnt;
- if (!(inst&0x01000000))
- /* post-decrement */
- args[0] += 4;
- if (inst&0x00200000)
- final -= cnt;
- } else {
- if (inst&0x01000000)
- /* pre-increment */
- args[0] += 4;
- if (inst&0x00200000)
- final += cnt;
- }
- for (idx = 0; idx < 16; idx++)
- if (inst&(1 << idx)) {
- args[1] = dst == idx
- ? val
- : getreg(idx, 1, regs);
- execute((inst&0xfe100000)|0x00a00002, args, regs);
- if (inst&0x00100000)
- regs[idx] = args[1];
- }
- switch (inst&0x00300000) {
- case 0x00300000: /* ldm! */
- if (inst&(1 << dst))
- break;
- case 0x00200000: /* stm! */
- regs[dst] = final;
- break;
- }
- return (inst&(1 << PC)) && (inst&0x00100000) ? 0 : 4;
- }
- return 4;
- case 0x0a000000:
- /* branch */
- if (condition(inst, args, regs)) {
- if (inst&0x01000000)
- regs[LR] = regs[PC] + 4;
- if (inst&0x00800000)
- inst |= 0xff000000;
- else
- inst &= ~0xff000000;
- regs[PC] += 8 + (inst << 2);
- return 0;
- }
- return 4;
- }
- break;
- case 0x0c000000:
- switch (inst&0x0f000000) {
- case 0x0c000000:
- case 0x0d000000:
- /* ldc/stc */
- return -1;
- case 0x0f000000:
- /* swi */
- return -1;
- case 0x0e000000:
- /* cdp/mrc/mcr */
- if ((regs[PSR]&0xf) == 0)
- /* user mode */
- return -1;
- if ((inst&0x00e00fff) != 0x00000f10)
- /* cdp, different cp# or unknown operation */
- return -1;
- dst = (inst >> 12)&0xf;
- if (dst == PC)
- args[0] = regs[PSR];
- else
- args[0] = getreg(dst, 1, regs);
- execute(inst&0xffff0fff, args, regs);
- if (!(inst&0x00100000))
- if (dst == PC)
- regs[PSR] = (regs[PSR]&0x0fffffff)
- |(args[0]&0xf0000000);
- else
- regs[dst] = args[0];
- return 4;
- }
- break;
- }
- return -1;
-}
diff --git a/sys/arch/arm32/arm32/locore.S b/sys/arch/arm32/arm32/locore.S
deleted file mode 100644
index ce231b4693e..00000000000
--- a/sys/arch/arm32/arm32/locore.S
+++ /dev/null
@@ -1,565 +0,0 @@
-/* $NetBSD: locore.S,v 1.8 1996/03/20 18:57:58 mark Exp $ */
-
-/*
- * Copyright (C) 1994 Mark Brinicombe
- * Copyright (C) 1994 Brini
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of Brini may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "assym.h"
-#include <machine/asm.h>
-#include <machine/cpu.h>
-#include <machine/param.h>
-#include <sys/syscall.h>
-
-/* What size shoudl this really be ? It is only used by init_arm() */
-
-#define INIT_ARM_STACK_SIZE 2048
-
-#define PUSHFRAME \
- str lr, [sp, #-4]!; /* Push the return address */ \
- sub sp, sp, #0x00000004; /* Skip SVC R14 */ \
- stmdb sp, {r0-r14}^; /* Push the user mode registers */ \
- sub sp, sp, #(4*15); /* Adjust the stack pointer */ \
- mrs r0, spsr_all; /* Put the SPSR on the stack */ \
- str r0, [sp, #-4]!;
-
-#define PULLFRAME \
- ldr r0, [sp], #0x0004; /* Get the SPSR from stack */ \
- msr spsr_all, r0; \
- add sp, sp, #(4*15); /* Adjust the stack pointer */ \
- ldmdb sp, {r0-r14}^; /* Restore the registers (user mode) */ \
- mov r0, r0; /* NOP for previous instruction */ \
- add sp, sp, #0x00000004; /* Skip SVC R14 */ \
- ldr lr, [sp], #0x0004; /* Pull the return address */
-
-/* register equates */
-fp .req r11
-ip .req r12
-sp .req r13
-lr .req r14
-pc .req r15
-
-.text
- .align 0
- .global start
- .global _C_LABEL(kernel_text)
- _C_LABEL(kernel_text) = start
-start:
- add r1, pc, #(Lstart - . - 8)
- ldmia r1, { r1, r2, r13 } /* Set initial stack and */
- sub r2, r2, r1 /* get zero init data */
- mov r3, #0
-
-L1:
- str r3, [r1], #0x0004 /* Zero the bss */
- subs r2, r2, #4
- bgt L1
-
- mov fp, #0x00000000 /* trace back starts here */
- bl _initarm /* Off we go */
-
-/* init arm will return the new stack pointer. */
-
- mov sp, r0
-
-/* Debug code */
-
-/* mov r1, sp
- add r0, pc, #(Ltext9 - . - 8)
- bl _printf
-*/
-
-/* Setup an initial trap frame for start_init to use */
-
- PUSHFRAME
-
- mov fp, #0x00000000 /* trace back starts here */
- mov r0, sp /* parameter to main is trap frame*/
-
-/* Debug */
-
-#if 0
-stmfd r13!, {r0-r3}
- ldr r1, Lproc0
- ldr r2, [r1]
-/* mov r1, r0*/
- add r0, pc, #(Ltext7 - . - 8)
- bl _printf
-ldmfd r13!, {r0-r3}
-#endif
-
- bl _main /* Lets light the flame and start her up */
-
- PULLFRAME /* Pull the trap frame, now valid */
-
- movs pc, lr /* Exit to user process */
-
-/* Never gets here */
-
- b .
-
-Lstart:
- .word _edata
- .word _end
- .word svcstk + INIT_ARM_STACK_SIZE
-
-Lproc0:
- .word _proc0
-
-/*
-Ltext7:
- .asciz "proc0=%08x %08x\n"
- .align 0
-
-
-Ltext9:
- .asciz "proc0 stack at V%08x %08x\n"
- .align 0
-*/
-
-/* What size shoudl this really be ? It is only used by init_arm() */
-
- .bss
-svcstk: .space INIT_ARM_STACK_SIZE
-
-/*
- * Instructions to copy to the bottom of zero page
- * These are the entry point to the system exception routines
- */
-
- .text
- .align 0
- .global _page0, _page0_end
-_page0:
- ldr pc, [pc, #Lreset - . - 8]
- ldr pc, [pc, #Lundefined - . - 8]
- ldr pc, [pc, #Lswi - . - 8]
- ldr pc, [pc, #Labortpre - . - 8]
- ldr pc, [pc, #Labortdata - . - 8]
- ldr pc, [pc, #Laddrexc - . - 8]
- ldr pc, [pc, #Lirq - . - 8]
- ldr pc, [pc, #Lfiq - . - 8]
-
-Lreset:
- .word reset_entry
-Lundefined:
- .word undefined_entry
-Lswi:
- .word swi_entry
-Labortpre:
- .word prefetch_abort_entry
-Labortdata:
- .word data_abort_entry
-Laddrexc:
- .word addrexc
-Lirq:
- .word irq_entry
-
-Lfiq:
- .word fiq
-_page0_end = .
-
-#if 0
-reset:
- add r0, pc, #Wreset - . - 8
- ldmia r0, {r0, pc}
-resetmsg:
- .asciz "reset"
- .align 0
-Wreset:
- .word resetmsg
- .word _panic
-#endif
-
-reset_entry:
- PUSHFRAME
-
- mov r0, sp /* Pass the frame to any function */
-
- bl _resethandler /* It's a branch throught zero ! */
-
- PULLFRAME
-
- movs pc, lr /* Exit */
-
-#if 0
-undefined:
-#ifndef KGDB
- add r0, pc, #Wundefined - . - 8
- ldmia r0, {r0, pc}
-undmsg:
- .asciz "undefined"
- .align 0
-Wundefined:
- .word undmsg
- .word _panic
-#else
-/*
- * lr is the saved pc, and we make space for the saved psr
- */
- stmfd sp!, {lr, pc}
-/*
- * now save all the rest of the registers (r13&r14) are redone later
- */
- stmfd sp!, {r0-lr}
-/*
- * now switch to the old mode to get r13&r14, but disable interrupts
-*/
-/* stupid gas doesn't yet know about the psr transfers */
- .word 0xe10f3000 @ mrs r3, cpsr
- .word 0xe14f2000 @ mrs r2, spsr
- str r2, [sp, #64]
- orr r2, r2, #(PSR_FIQ32_MODE|PSR_IRQ32_MODE)
- .word 0xe129f002 @ msr cpsr, r2
- mov r0, r13
- mov r1, r14
- orr r3, r3, #(PSR_FIQ32_MODE|PSR_IRQ32_MODE)
- .word 0xe129f003 @ msr cpsr, r3
- str r0, [sp, #52]
- str r1, [sp, #56]
- mov r0, sp
- mov lr, pc
- ldr pc, [pc, #Wundefined - . - 8]
- add sp, sp, #52 /* adjust stack to r13 */
-/*
- * set saved psr and get r13&r14 to new (saved) mode first
- */
- ldr r2, [sp, #12]
- ldr r0, [sp]
- ldr r1, [sp, #4]
-/* stupid gas doesn't yet know about the psr transfers */
- .word 0xe169f002 @ msr spsr, r2
- .word 0xe10f3000 @ mrs r3, cpsr
- orr r2, r2, #(PSR_FIQ32_MODE|PSR_IRQ32_MODE)
- .word 0xe129f002 @ msr cpsr, r2
- mov r13, r0
- mov r14, r1
- .word 0xe129f003 @ msr cpsr, r3
- ldmea sp, {r0-r12} /* now the rest of the registers */
- add sp, sp, #16 /* Adjust stack to top */
- ldr lr, [sp, #-8] /* get link address */
- movs pc, lr /* return */
-Wundefined:
- .word _kgdb_trap_glue
-#endif
-#endif
-
-addrexc:
- .word 0xe10f1000
- .word 0xe14f2000
- mov r3, lr
- add r0, pc, #addrexcmsg - . - 8
- bl _printf
- b data_abort_entry
-
-addrexcmsg:
- .asciz "address exception CPSR=%08x SPSR=%08x lr=%08x\n"
- .align 0
-Waddrexc:
- .word addrexcmsg
- .word _panic
-
-irq:
- add r0, pc, #Wirq - . - 8
- ldmia r0, {r0, pc}
-irqmsg:
- .asciz "irq"
- .align 0
-Wirq:
- .word irqmsg
- .word _panic
-
-fiq:
- add r0, pc, #Wfiq - . - 8
- ldmia r0, {r0, pc}
-fiqmsg:
- .asciz "fiq"
- .align 0
-Wfiq:
- .word fiqmsg
- .word _panic
-
- .global _initmode
-_initmode:
-/* stupid gas doesn't yet know about the psr transfers */
- mrs r2, cpsr_all
- msr cpsr_all, r0
- mov sp, r1
- msr cpsr_all, r2
- mov pc, lr
-
-
- .global _boot0
-_boot0:
- mrs r2, cpsr_all
- bic r2, r2, #(PSR_MODE)
- orr r2, r2, #(PSR_SVC32_MODE)
- orr r2, r2, #(I32_bit | F32_bit)
- msr cpsr_all, r2
-
- mov r0, #0
- mcr 15, 0, r0, c1, c0, 0
- mov pc, r0
-
-
-/* Debug routine to print trace back information from stack */
-
- .global _traceback
-
-_traceback:
- stmfd sp!, {r4, r5, r6, lr}
- mov r4, r11
- ldr r5, Ltracebackmin
- ldr r6, Ltracebackmax
-
-tbloop:
- mov r1, r4
- ldr r2, [r4, #-12]
- ldr r3, [r4, #-8]
- add r0, pc, #Ltb1 - . - 8
- bl _printf
-
-/* ldr r1, [r4, #-4]
- ldr r2, [r4]
- add r0, pc, #Ltb2 - . - 8
- bl _printf*/
- ldr r0, [r4, #-4]
- ldr r1, [r4]
- bl _traceback_sym
-
- mov r3, r4
- ldr r4, [r4, #-12]
- teq r3, r4
- beq tbexit
- cmp r4, r5
- bls tbexit
- cmp r4, r6
- bge tbexit
- teq r4, #0x00000000
- bne tbloop
-
-tbexit:
- mov r0, r4
- ldmfd sp!, {r4, r5, r6, pc}
-
-Ltracebackmin:
- .word 0xefbfe000
-
-Ltracebackmax:
- .word 0xefc00000
-
-Ltb1:
- .asciz "traceback: fp=%08x fp->fp=%08x fp->sp=%08x "
-
-Ltb2:
- .asciz "fp->lr=%08x fp->pc=%08x\n"
-
- .align 0
-
-/* Debug routine to print trace back information from stack */
-
- .global _simpletraceback
-
-_simpletraceback:
- stmfd sp!, {r4, r5, r6, lr}
- mov r4, r11
- ldr r5, Ltracebackmin
- ldr r6, Ltracebackmax
-
-stbloop:
-/* ldr r1, [r4, #-4]
- ldr r2, [r4]
- add r0, pc, #Ltb2 - . - 8
- bl _printf*/
- ldr r0, [r4, #-4]
- ldr r1, [r4]
- bl _traceback_sym
-
- mov r3, r4
- ldr r4, [r4, #-12]
- teq r3, r4
- beq stbexit
- cmp r4, r5
- bls stbexit
- cmp r4, r6
- bge stbexit
- teq r4, #0x00000000
- bne stbloop
-
-stbexit:
- mov r0, r4
- ldmfd sp!, {r4, r5, r6, pc}
-
-
-/* Debug routine to print trace back information from stack */
-
- .global _irqtraceback
-
-_irqtraceback:
- stmfd sp!, {r4, r5, r6, lr}
- mov r4, r0
- mov r5, r1
- add r6, r5, #(NBPG)
-
-itbloop:
- mov r1, r4
- ldr r2, [r4, #-12]
- ldr r3, [r4, #-8]
- add r0, pc, #Ltb1 - . - 8
- bl _printf
-
-/* ldr r1, [r4, #-4]
- ldr r2, [r4]
- add r0, pc, #Ltb2 - . - 8
- bl _printf*/
- ldr r0, [r4, #-4]
- ldr r1, [r4]
- bl _traceback_sym
-
- mov r3, r4
- ldr r4, [r4, #-12]
- teq r3, r4
- beq itbexit
- cmp r4, r5
- bls itbexit
- cmp r4, r6
- bge itbexit
- teq r4, #0x00000000
- bne itbloop
-
-itbexit:
- mov r0, r4
- ldmfd sp!, {r4, r5, r6, pc}
-
-
- .global _user_traceback
-
-_user_traceback:
- stmfd sp!, {r4, r5, r6, lr}
- mov r4, r0
- ldr r5, Lusertracebackmin
- ldr r6, Lusertracebackmax
-
-usertbloop:
- mov r1, r4
- ldr r2, [r4, #-12]
- ldr r3, [r4, #-8]
- add r0, pc, #Lusertb1 - . - 8
- bl _printf
-
- ldr r1, [r4, #-4]
- ldr r2, [r4]
- add r0, pc, #Lusertb2 - . - 8
- bl _printf
-
- mov r3, r4
- ldr r4, [r4, #-12]
- teq r3, r4
- beq usertbexit
- cmp r4, r5
- bls tbexit
- cmp r4, r6
- bge usertbexit
- teq r4, #0x00000000
- bne usertbloop
-
-usertbexit:
- mov r0, r4
- ldmfd sp!, {r4, r5, r6, pc}
-
-Lusertracebackmin:
- .word 0x00001000
-
-Lusertracebackmax:
- .word 0xefbfe000
-
-Lusertb1:
- .asciz "traceback: fp=%08x fp->fp=%08x fp->sp=%08x "
-
-Lusertb2:
- .asciz "fp->lr=%08x fp->pc=%08x\n"
-
- .align 0
-
-
-
-/*
- * Signal trampoline; copied to top of user stack.
- */
- .global _sigcode
-ENTRY(sigcode)
-/*
- * r0-r2 are our signal handler parameters
- * r3 is the handler address
- */
-
- add lr, pc, #0 /* Set return address */
- mov pc, r3 /* Call the handler */
-
-/*
- * Call sig_return with address of the signal context
- * Note: Don't use SIG_SCP as this make have been trashed by the program
- */
- add r0, sp, #SIGF_SC
- swi SYS_sigreturn
-
-/* Well if that failed we better exit quick ! */
-
- add r0, pc, #Lsigerr - . - 8
- swi 0x1002
-
- swi SYS_exit
-
-Lsigerr:
- .asciz "sigreturn syscall failed\n"
- .align 0
- .globl _esigcode
-_esigcode:
-
-/*
- * setjump + longjmp
- */
- .global _setjmp
-ENTRY(setjmp)
- stmia r0, {r4-r14}
- mov r0, #0x00000000
- mov r15, r14
-
- .global _longjmp
-ENTRY(longjmp)
- ldmia r2, {r4-r14}
- mov r0, #0x00000001
- mov r15, r14
-
- .global _esym
-_esym: .word _end
-
- .global _abort
-_abort:
- b _abort
diff --git a/sys/arch/arm32/arm32/machdep.c b/sys/arch/arm32/arm32/machdep.c
deleted file mode 100644
index cd52f66de06..00000000000
--- a/sys/arch/arm32/arm32/machdep.c
+++ /dev/null
@@ -1,2156 +0,0 @@
-/* $OpenBSD: machdep.c,v 1.7 2000/06/08 22:25:17 niklas Exp $ */
-/* $NetBSD: machdep.c,v 1.6 1996/03/13 21:32:39 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1996 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * machdep.c
- *
- * Machine dependant functions for kernel setup
- *
- * This file needs a lot of work.
- *
- * Created : 17/09/94
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/reboot.h>
-#include <sys/timeout.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/user.h>
-#include <sys/kernel.h>
-#include <sys/mbuf.h>
-#include <sys/msgbuf.h>
-#include <sys/buf.h>
-#include <sys/map.h>
-#include <sys/exec.h>
-#include <sys/mount.h>
-#include <sys/vnode.h>
-#include <sys/device.h>
-#include <sys/sysctl.h>
-#include <sys/syscallargs.h>
-
-#ifdef SYSVMSG
-#include <sys/msg.h>
-#endif
-#ifdef SYSVSEM
-#include <sys/sem.h>
-#endif
-#ifdef SYSVSHM
-#include <sys/shm.h>
-#endif
-
-#include <vm/vm_kern.h>
-
-#include <machine/signal.h>
-#include <machine/frame.h>
-#include <machine/bootconfig.h>
-#include <machine/katelib.h>
-#include <machine/cpu.h>
-#include <machine/pte.h>
-#include <machine/vidc.h>
-#include <machine/iomd.h>
-#include <machine/io.h>
-#include <machine/irqhandler.h>
-#include <machine/undefined.h>
-#include <machine/rtc.h>
-
-#include "hydrabus.h"
-
-/* Describe different actions to take when boot() is called */
-
-#define ACTION_HALT 0x01 /* Halt and boot */
-#define ACTION_REBOOT 0x02 /* Halt and request RiscBSD reboot */
-#define ACTION_KSHELL 0x04 /* Call kshell */
-#define ACTION_DUMP 0x08 /* Dump the system to the dump dev */
-
-#define HALT_ACTION ACTION_HALT | ACTION_KSHELL /* boot(RB_HALT) */
-#define REBOOT_ACTION ACTION_REBOOT /* boot(0) */
-#define PANIC_ACTION ACTION_HALT | ACTION_KSHELL /* panic() */
-
-BootConfig bootconfig; /* Boot config storage */
-videomemory_t videomemory; /* Video memory descriptor */
-
-vm_offset_t physical_start;
-vm_offset_t physical_freestart;
-vm_offset_t physical_freeend;
-vm_offset_t physical_end;
-int physical_memoryblock;
-u_int free_pages;
-vm_offset_t pagetables_start;
-int physmem = 0;
-
-int debug_flags;
-int max_processes;
-int cpu_cache;
-int cpu_ctrl;
-
-u_int ramdisc_size; /* Ramdisc size */
-
-u_int kmodule_base;
-u_int kmodule_size;
-
-u_int videodram_size; /* Amount of DRAM to reserve for video */
-vm_offset_t videodram_start;
-
-vm_offset_t physical_pt_start;
-vm_offset_t virtual_pt_end;
-
-u_int *cursor_data; /* Will move to the vidc code */
-
-typedef struct {
- vm_offset_t physical;
- vm_offset_t virtual;
-} pv_addr_t;
-
-pv_addr_t systempage;
-pv_addr_t irqstack;
-pv_addr_t undstack;
-pv_addr_t abtstack;
-pv_addr_t kernelstack;
-#if NHYDRABUS > 0
-pv_addr_t hydrascratch;
-#endif
-
-pt_entry_t kernel_pt_table[15];
-
-/* the following is used externally (sysctl_hw) */
-char machine[] = "arm32"; /* cpu "architecture" */
-
-char *boot_args;
-
-extern pt_entry_t msgbufpte;
-int msgbufmapped;
-vm_offset_t msgbufphys;
-
-extern u_int data_abort_handler_address;
-extern u_int prefetch_abort_handler_address;
-extern u_int undefined_handler_address;
-
-extern int pmap_debug_level;
-
-#define KERNEL_PT_PAGEDIR 0
-#define KERNEL_PT_PDE 1
-#define KERNEL_PT_PTE 2
-#define KERNEL_PT_VMEM 3
-#define KERNEL_PT_SYS 4
-#define KERNEL_PT_KERNEL 5
-#define KERNEL_PT_VMDATA0 6
-#define KERNEL_PT_VMDATA1 7
-#define KERNEL_PT_VMDATA2 8
-#define KERNEL_PT_VMDATA3 9
-#define KERNEL_PT_VMDATA4 10
-#define KERNEL_PT_VMDATA5 11
-#define KERNEL_PT_VMDATA6 12
-#define KERNEL_PT_VMDATA7 13
-#define KERNEL_PT_VMDATA7 13
-#define KERNEL_PT_KSTACK 14
-
-struct user *proc0paddr;
-
-/*
- * Declare these as initialized data so we can patch them.
- */
-int nswbuf = 0;
-#ifdef NBUF
-int nbuf = NBUF;
-#else
-int nbuf = 0;
-#endif
-#ifdef BUFPAGES
-int bufpages = BUFPAGES;
-#else
-int bufpages = 0;
-#endif
-
-int cold = 1;
-
-/* Prototypes */
-
-void boot0 __P((void));
-void bootsync __P((void));
-
-char *strstr __P((char */*s1*/, char */*s2*/));
-
-void physconputchar __P((char));
-void physcon_display_base __P((u_int));
-void consinit __P((void));
-
-void map_section __P((vm_offset_t, vm_offset_t, vm_offset_t));
-void map_pagetable __P((vm_offset_t, vm_offset_t, vm_offset_t));
-void map_entry __P((vm_offset_t, vm_offset_t va, vm_offset_t));
-void map_entry_ro __P((vm_offset_t, vm_offset_t, vm_offset_t));
-
-void process_kernel_args __P((void));
-u_long strtoul __P((const char */*s*/, char **/*ptr*/, int /*base*/));
-caddr_t allocsys __P((caddr_t /*v*/));
-void identify_cpu __P((void));
-void data_abort_handler __P((trapframe_t */*frame*/));
-void prefetch_abort_handler __P((trapframe_t */*frame*/));
-void undefinedinstruction_bounce __P((trapframe_t */*frame*/));
-void set_boot_devs __P((void));
-void configure __P((void));
-void zero_page_readonly __P((void));
-void zero_page_readwrite __P((void));
-u_int disassemble __P((u_int /*addr*/));
-int setup_cursor __P((void));
-void init_fpe_state __P((struct proc *));
-
-void pmap_debug __P((int /*level*/));
-void dumpsys __P((void));
-void hydrastop __P((void));
-
-void vtbugreport __P((void));
-
-/*
- * Debug function just to park the CPU
- *
- * This should be updated to power down an ARM7500
- */
-
-void
-halt()
-{
- while (1);
-}
-
-
-/*
- * void boot(int howto)
- *
- * Reboots the system
- *
- * This gets called when a reboot is request by the user or after a panic.
- * Call boot0() will reboot the machine. For the moment we will try and be
- * clever and return to the booting environment. This may work if we
- * have be booted with the Kate boot loader as long as we have not messed
- * the system up to much. Until we have our own memory management running
- * this should work. The only use of being able to return (to RISC OS)
- * is so I don't have to wait while the machine reboots.
- */
-
-/* NOTE: These variables will be removed, well some of them */
-
-extern u_int spl_mask;
-extern u_int current_mask;
-struct pcb dumppcb;
-extern u_int arm700bugcount;
-extern int ioctlconsolebug;
-
-void
-boot(howto)
- int howto;
-{
- int loop;
- int action;
-
-/* Debugging here */
-
- if (curproc == NULL)
- printf("curproc = 0 - must have been in cpu_idle()\n");
-
-/* if (panicstr)
- printf("ioctlconsolebug=%d %08x\n", ioctlconsolebug, ioctlconsolebug);*/
-
-/* if (curpcb)
- printf("curpcb=%08x pcb_sp=%08x pcb_und_sp=%08x\n", curpcb, curpcb->pcb_sp, curpcb->pcb_und_sp);*/
-
-#if NHYDRABUS > 0
-/*
- * If we are halting the master then we should halt the slaves :-)
- * otherwise it can get a bit disconcerting to have 4 other
- * processor still tearing away doing things.
- */
-
- hydrastop();
-#endif
-
-/* Debug info */
-
- printf("boot: howto=%08x %08x curproc=%08x\n", howto, spl_mask, (u_int)curproc);
-
- printf("current_mask=%08x spl_mask=%08x\n", current_mask, spl_mask);
- printf("ipl_bio=%08x ipl_net=%08x ipl_tty=%08x ipl_clock=%08x ipl_imp=%08x\n",
- irqmasks[IPL_BIO], irqmasks[IPL_NET], irqmasks[IPL_TTY],
- irqmasks[IPL_CLOCK], irqmasks[IPL_IMP]);
-
- dump_spl_masks();
-
-/* vtbugreport();*/
-
-/* Did we encounter the ARM700 bug we discovered ? */
-
- if (arm700bugcount > 0)
- printf("ARM700 PREFETCH/SWI bug count = %d\n", arm700bugcount);
-
-/* Disable console buffering */
-
- cnpollc(1);
-
-/* If we are still cold then hit the air brakes */
-
- if (cold) {
- printf("Halted while still in the ICE age.\n");
- printf("Hit a key to reboot\n");
- cngetc();
- boot0();
- }
-
-/*
- * Depending on how we got here and with what intructions, choose
- * the actions to take. (See the actions defined above)
- */
-
- if (panicstr)
- action = PANIC_ACTION;
- else if (howto & RB_HALT)
- action = HALT_ACTION;
- else
- action = REBOOT_ACTION;
-
-/*
- * If RB_NOSYNC was not specified sync the discs.
- * Note: Unless cold is set to 1 here, syslogd will die during the unmount.
- * It looks like syslogd is getting woken up only to find that it cannot
- * page part of the binary in as the filesystem has been unmounted.
- */
-
-
- if (!(howto & RB_NOSYNC)) {
- cold = 1; /* no sleeping etc. */
- bootsync();
- }
-
-/* Say NO to interrupts */
-
- splhigh();
-
-#ifdef KSHELL
-
-/* Now enter our crude debug shell if required. Soon to be replaced with DDB */
-
- if (action & ACTION_KSHELL)
- shell();
-#else
- if (action & ACTION_KSHELL) {
- printf("Halted.\n");
- printf("Hit a key to reboot ");
- cngetc();
- }
-#endif
-
-/* Auto reboot overload protection */
-
-/*
- * This code stops the kernel entering an endless loop of reboot - panic
- * cycles. This will only effect kernels that have been configured to
- * reboot on a panic and will have the effect of stopping further reboots
- * after it has rebooted 16 times after panics and clean halt or reboot
- * will reset the counter.
- */
-
-/*
- * Have we done 16 reboots in a row ? If so halt rather than reboot
- * since 16 panics in a row without 1 clean halt means something is
- * seriously wrong
- */
-
- if (cmos_read(RTC_ADDR_REBOOTCNT) > 16)
- action = (action & ~ACTION_REBOOT) | ACTION_HALT;
-
-/*
- * If we are rebooting on a panic then up the reboot count otherwise reset
- * This will thus be reset if the kernel changes the boot action from
- * reboot to halt due to too any reboots.
- */
-
- if ((action & ACTION_REBOOT) && panicstr)
- cmos_write(RTC_ADDR_REBOOTCNT,
- cmos_read(RTC_ADDR_REBOOTCNT) + 1);
- else
- cmos_write(RTC_ADDR_REBOOTCNT, 0);
-
-/*
- * If we need a RiscBSD reboot, request it but setting a bit in the CMOS RAM
- * This can be detected by the RiscBSD boot loader during a RISC OS boot
- * No other way to do this as RISC OS is in ROM.
- */
-
- if (action & ACTION_REBOOT)
- cmos_write(RTC_ADDR_BOOTOPTS,
- cmos_read(RTC_ADDR_BOOTOPTS) | 0x02);
-
-/* If we need to do a dump, do it */
-
- if ((howto & RB_DUMP) && (action & ACTION_DUMP)) {
- savectx(&dumppcb);
- dumpsys();
- }
-
-/* Run any shutdown hooks */
-
- printf("Running shutdown hooks ...\n");
- doshutdownhooks();
-
-/* Make sure IRQ's are disabled */
-
- IRQdisable;
-
-/* Tell the user we are booting */
-
- printf("boot...");
-
-/* Give the user time to read the last couple of lines of text. */
-
- for (loop = 5; loop > 0; --loop) {
- printf("%d..", loop);
- delay(500000);
- }
-
- boot0();
-}
-
-
-/* Sync the discs and unmount the filesystems */
-
-void
-bootsync(void)
-{
- int iter;
- int nbusy;
- struct buf *bp;
- static int bootsyncdone = 0;
-
- if (bootsyncdone) return;
-
- bootsyncdone = 1;
-
-/* Make sure we can still manage to do things */
-
- if (GetCPSR() & I32_bit) {
-/*
- * If we get then boot has been called with out RB_NOSYNC and interrupts were
- * disabled. This means the boot() call did not come from a user process e.g.
- * shutdown, but must have come from somewhere in the kernel.
- */
-
- IRQenable;
- printf("Warning IRQ's disabled during boot()\n");
- }
-
- vfs_shutdown();
-}
-
-
-/*
- * Estimated loop for n microseconds
- */
-
-/* Need to re-write this to use the timers */
-
-/* One day soon I will actually do this */
-
-void
-delay(n)
- u_int n;
-{
- u_int i;
-
- while (--n > 0)
- for (i = 8; --i;);
-}
-
-
-/*
- * u_int initarm(BootConfig *bootconf)
- *
- * Initial entry point on startup. This gets called before main() is
- * entered.
- * It should be responcible for setting up everything that must be
- * in place when main is called.
- * This includes
- * Taking a copy of the boot configuration structure.
- * Initialising the physical console so characters can be printed.
- * Setting up page tables for the kernel
- * Relocating the kernel to the bottom of physical memory
- */
-
-/* This routine is frightening mess ! This is what my mind looks like -mark */
-
-u_int
-initarm(bootconf)
- BootConfig *bootconf;
-{
- int loop;
- int loop1;
- u_int logical;
- u_int physical;
- u_int kerneldatasize;
- u_int l1pagetable;
- u_int l2pagetable;
- extern char page0[], page0_end[];
- struct exec *kernexec = (struct exec *)KERNEL_BASE;
-
-/* Copy the boot configuration structure */
-
- bootconfig = *bootconf;
-
-/*
- * Initialise the video memory descriptor
- *
- * This will change in the future to correctly report DRAM as well
- * but for the moment hardwire it. This will allow the console code
- * to use the structure now.
- *
- * Note: all references to the video memory virtual/physical address
- * should go via this structure.
- */
-
-/*
- * In the future ...
- *
- * All console output will be postponed until the primary bootstrap
- * has been completed so that we have had a chance to reserve some
- * memory for the video system if we do not have separate VRAM.
- */
-
- videomemory.vidm_vbase = bootconfig.display_start;
- videomemory.vidm_pbase = VRAM_BASE;
- videomemory.vidm_type = VIDEOMEM_TYPE_VRAM;
- videomemory.vidm_size = bootconfig.display_size;
-
-/*
- * Initialise the physical console
- * This is done in main() but for the moment we do it here so that
- * we can use printf in initarm() before main() has been called.
- */
-
- consinit();
-
-/* Talk to the user */
-
- printf("initarm...\n");
-
- printf("Kernel loaded from file %s\n", bootconfig.kernelname);
- printf("Kernel arg string %s\n", (char *)bootconfig.argvirtualbase);
-
- printf("\nBoot configuration structure reports the following memory\n");
-
- printf(" DRAM block 0a at %08x size %08x DRAM block 0b at %08x size %08x\n\r",
- bootconfig.dram[0].address,
- bootconfig.dram[0].pages * bootconfig.pagesize,
- bootconfig.dram[1].address,
- bootconfig.dram[1].pages * bootconfig.pagesize);
- printf(" DRAM block 1a at %08x size %08x DRAM block 1b at %08x size %08x\n\r",
- bootconfig.dram[2].address,
- bootconfig.dram[2].pages * bootconfig.pagesize,
- bootconfig.dram[3].address,
- bootconfig.dram[3].pages * bootconfig.pagesize);
- printf(" VRAM block 0 at %08x size %08x\n\r",
- bootconfig.vram[0].address,
- bootconfig.vram[0].pages * bootconfig.pagesize);
-
- printf(" videomem = %08x %08x\n", bootconfig.display_start, videomemory.vidm_vbase);
-
-/* Check to make sure the page size is correct */
-
- if (NBPG != bootconfig.pagesize)
- panic("Page size is not %d bytes", NBPG);
-
-/*
- * Ok now we have the hard bit.
- * We have the kernel allocated up high. The rest of the memory map is
- * available. We are still running on RISC OS page tables.
- *
- * We need to construct new page tables move the kernel in physical
- * memory and switch to them.
- *
- * The booter will have left us 6 pages at the top of memory.
- * Two of these are used as L2 page tables and the other 4 form the L1
- * page table.
- */
-
-/*
- * Ok we must construct own own page table tables.
- * Once we have these we can reorganise the memory as required
- */
-
-/*
- * We better check to make sure the booter has set up the scratch
- * area for us correctly. We use this area to create temporary pagetables
- * while we reorganise the memory map.
- */
-
- if ((bootconfig.scratchphysicalbase & 0x3fff) != 0)
- panic("initarm: Scratch area not aligned on 16KB boundry");
-
- if ((bootconfig.scratchsize < 0xc000) != 0)
- panic("initarm: Scratch area too small (need >= 48KB)");
-
-/*
- * Ok start the primary bootstrap.
- * The primary bootstrap basically replaces the booter page tables with
- * new ones that it creates in the boot scratch area. These page tables
- * map the rest of the physical memory into the virtaul memory map.
- * This allows low physical memory to be accessed to create the
- * kernels page tables, relocate the kernel code from high physical
- * memory to low physical memory etc.
- */
-
- printf("initarm: Primary bootstrap ... ");
-
-/*
- * Update the videomemory structure to reflect the mapping changes
- */
-
- videomemory.vidm_vbase = VMEM_VBASE;
- videomemory.vidm_pbase = VRAM_BASE;
- videomemory.vidm_type = VIDEOMEM_TYPE_VRAM;
- videomemory.vidm_size = bootconfig.vram[0].pages * NBPG;
-
- kerneldatasize = bootconfig.kernsize + bootconfig.argsize;
-
- l2pagetable = bootconfig.scratchvirtualbase;
- l1pagetable = l2pagetable + 0x4000;
-
-/*
- * Now we construct a L2 pagetables for the VRAM, the current kernel memory
- * and the new kernel memory
- */
-
- for (logical = 0; logical < 0x200000; logical += NBPG) {
- map_entry(l2pagetable + 0x1000, logical,
- bootconfig.vram[0].address + logical);
- map_entry(l2pagetable + 0x1000, logical + 0x200000,
- bootconfig.vram[0].address + logical);
- }
-
- for (logical = 0; logical < kerneldatasize + bootconfig.scratchsize;
- logical += NBPG) {
- map_entry(l2pagetable + 0x3000, logical,
- bootconfig.kernphysicalbase + logical);
- }
-
-#if NHYDRABUS > 0
- for (logical = 0; logical < 0x200000; logical += NBPG) {
- map_entry(l2pagetable + 0x2000, logical,
- bootconfig.dram[0].address + logical + NBPG);
- }
-#else
- for (logical = 0; logical < 0x200000; logical += NBPG) {
- map_entry(l2pagetable + 0x2000, logical,
- bootconfig.dram[0].address + logical);
- }
-#endif
-
-/*
- * Now we construct the L1 pagetable. This only needs the minimum to
- * keep us going until we can contruct the proper kernel L1 page table.
- */
-
- map_section(l1pagetable, VIDC_BASE, VIDC_HW_BASE);
- map_section(l1pagetable, IOMD_BASE, IOMD_HW_BASE);
-
- map_pagetable(l1pagetable, 0x00000000,
- bootconfig.scratchphysicalbase + 0x2000);
- map_pagetable(l1pagetable, KERNEL_BASE,
- bootconfig.scratchphysicalbase + 0x3000);
- map_pagetable(l1pagetable, VMEM_VBASE,
- bootconfig.scratchphysicalbase + 0x1000);
-
-/* Print some debugging info */
-
-/*
- printf("page tables look like this ...\n");
- printf("V0x00000000 - %08x\n", ReadWord(l1pagetable + 0x0000));
- printf("V0x03500000 - %08x\n", ReadWord(l1pagetable + 0x00d4));
- printf("V0x00200000 - %08x\n", ReadWord(l1pagetable + 0x0080));
- printf("V0xf4000000 - %08x\n", ReadWord(l1pagetable + 0x3d00));
- printf("V0xf0000000 - %08x\n", ReadWord(l1pagetable + 0x3c00));
- printf("page dir = P%08x\n", bootconfig.scratchphysicalbase + 0x4000);
- printf("l1= V%08x\n", l1pagetable);
-*/
-
-/*
- * Pheww right we are ready to switch page tables !!!
- * The L1 table is at bootconfig.scratchphysicalbase + 0x4000
- */
-
-/* Switch tables */
-
- setttb(bootconfig.scratchphysicalbase + 0x4000);
-
-/* Since we have mapped the VRAM up into kernel space we must now update the
- * the bootconfig and display structures by hand.
- */
-
- bootconfig.display_start = VMEM_VBASE;
- physcon_display_base(VMEM_VBASE);
-
- printf("done.\n");
-
-/*
- * Ok we have finished the primary boot strap. All this has done is to
- * allow us to access all the physical memory from known virtual
- * location. We also now know that all the used pages are at the top
- * of the physical memory and where they are in the virtual memory map.
- *
- * This should be the stage we are at at the end of the bootstrap when
- * we have a two stage booter.
- *
- * The secondary bootstrap has the responcibility to sort locating the
- * kernel to the correct address and for creating the kernel page tables.
- * It must also set up various memory pointers that are used by pmap etc.
- */
-
- process_kernel_args();
-
- printf("initarm: Secondary bootstrap ... ");
-
-/* Zero down the memory we mapped in for the secondary bootstrap */
-
- bzero(0x00000000, 0x200000);
-
-/* Set up the variables that define the availablilty of physcial memory */
-
- physical_start = bootconfig.dram[0].address;
- physical_freestart = physical_start;
- physical_end = bootconfig.dram[bootconfig.dramblocks - 1].address
- + bootconfig.dram[bootconfig.dramblocks - 1].pages * NBPG;
- physical_freeend = physical_end;
- physical_memoryblock = 0;
- free_pages = bootconfig.drampages;
-
- for (loop = 0; loop < bootconfig.dramblocks; ++loop)
- physmem += bootconfig.dram[loop].pages;
-
-/*
- * Reserve some pages at the top of the memory for later use
- *
- * This area is not currently used but could be used for the allocation
- * of L1 page tables for each process.
- * The size of this memory would be determined by the maximum number of
- * processes.
- *
- * For the moment we just reserve a few pages just to make sure the
- * system copes.
- */
-
- physical_freeend -= videodram_size;
- free_pages -= (videodram_size / NBPG);
- videodram_start = physical_freeend;
-
- physical_freeend -= PD_SIZE * max_processes;
- free_pages -= 4 * max_processes;
- pagetables_start = physical_freeend;
-
-/* Right We have the bottom meg of memory mapped to 0x00000000
- * so was can get at it. The kernel will ocupy the start of it.
- * After the kernel/args we allocate some the the fixed page tables
- * we need to get the system going.
- * We allocate one page directory and 8 page tables and store the
- * physical addresses in the kernel_pt_table array.
- * Must remember that neither the page L1 or L2 page tables are the same
- * size as a page !
- *
- * Ok the next bit of physical allocate may look complex but it is
- * simple really. I have done it like this so that no memory gets wasted
- * during the allocate of various pages and tables that are all different
- * sizes.
- * The start address will be page aligned.
- * We allocate the kernel page directory on the first free 16KB boundry
- * we find.
- * We allocate the kernel page tables on the first 1KB boundry we find.
- * We allocate 9 PT's. This means that in the process we
- * KNOW that we will encounter at least 1 16KB boundry.
- *
- * Eventually if the top end of the memory gets used for process L1 page
- * tables the kernel L1 page table may be moved up there.
- */
-
-/*
- * The Simtec Hydra board needs a 2MB aligned page for bootstrapping.
- * Simplest thing is to nick the bottom page of physical memory.
- */
-
-#if NHYDRABUS > 0
- hydrascratch.physical = physical_start;
- physical_start += NBPG;
- --free_pages;
-#endif
-
- physical = physical_start + kerneldatasize;
-/* printf("physical=%08x next_phys=%08x\n", physical, pmap_next_phys_page(physical - NBPG));*/
- loop1 = 1;
- kernel_pt_table[0] = 0;
- for (loop = 0; loop < 15; ++loop) {
- if ((physical & (PD_SIZE-1)) == 0 && kernel_pt_table[0] == 0) {
- kernel_pt_table[KERNEL_PT_PAGEDIR] = physical;
- bzero((char *)physical - physical_start, PD_SIZE);
- physical += PD_SIZE;
- } else {
- kernel_pt_table[loop1] = physical;
- bzero((char *)physical - physical_start, PT_SIZE);
- physical += PT_SIZE;
- ++loop1;
- }
- }
-
-/* A bit of debugging info */
-
-/*
- for (loop=0; loop < 10; ++loop)
- printf("%d - P%08x\n", loop, kernel_pt_table[loop]);
-*/
-
-/* This should never be able to happen but better confirm that. */
-
- if ((kernel_pt_table[0] & (PD_SIZE-1)) != 0)
- panic("initarm: Failed to align the kernel page directory");
-
-/* Update the address of the first free page of physical memory */
-
- physical_freestart = physical;
-/* printf("physical_fs=%08x next_phys=%08x\n", (u_int)physical_freestart, (u_int)pmap_next_phys_page(physical_freestart - NBPG));*/
- free_pages -= (physical - physical_start) / NBPG;
-
-/* Allocate a page for the system page mapped to 0x00000000 */
-
- systempage.physical = physical_freestart;
- physical_freestart += NBPG;
-/* printf("(0)physical_fs=%08x next_phys=%08x\n", (u_int)physical_freestart, (u_int)pmap_next_phys_page(physical_freestart - NBPG));*/
- --free_pages;
- bzero((char *)systempage.physical - physical_start, NBPG);
-
-/* Allocate another 3 pages for the stacks in different CPU modes. */
-
- irqstack.physical = physical_freestart;
- physical_freestart += NBPG;
- abtstack.physical = physical_freestart;
- physical_freestart += NBPG;
- undstack.physical = physical_freestart;
- physical_freestart += NBPG;
- bzero((char *)irqstack.physical - physical_start, 3*NBPG);
- free_pages -= 3;
- irqstack.virtual = KERNEL_BASE + irqstack.physical-physical_start;
- abtstack.virtual = KERNEL_BASE + abtstack.physical-physical_start;
- undstack.virtual = KERNEL_BASE + undstack.physical-physical_start;
-/* printf("(1)physical_fs=%08x next_phys=%08x\n", (u_int)physical_freestart, (u_int)pmap_next_phys_page(physical_freestart - NBPG));*/
-
- kernelstack.physical = physical_freestart;
- physical_freestart += UPAGES * NBPG;
- bzero((char *)kernelstack.physical - physical_start, UPAGES * NBPG);
- free_pages -= UPAGES;
-
-/* printf("(2)physical_fs=%08x next_phys=%08x\n", (u_int)physical_freestart, (u_int)pmap_next_phys_page(physical_freestart - NBPG));*/
-
-
- kernelstack.virtual = KERNEL_BASE + kernelstack.physical
- - physical_start;
-
- msgbufphys = physical_freestart;
- physical_freestart += round_page(sizeof(struct msgbuf));
- free_pages -= round_page(sizeof(struct msgbuf)) / NBPG;
-
-/* printf("physical_fs=%08x next_phys=%08x\n", (u_int)physical_freestart, (u_int)pmap_next_phys_page(physical_freestart - NBPG));*/
-
-/* Ok we have allocated physical pages for the primary kernel page tables */
-
-/* Now we fill in the L2 pagetable for the kernel code/data */
-
- l2pagetable = kernel_pt_table[KERNEL_PT_KERNEL] - physical_start;
-
- if (N_GETMAGIC(kernexec[0]) == ZMAGIC) {
-/* printf("[ktext read-only] ");
- printf("[%08x %08x %08x] \n", (u_int)kerneldatasize, (u_int)kernexec->a_text,
- (u_int)(kernexec->a_text+kernexec->a_data+kernexec->a_bss));*/
-/* printf("physical start=%08x physical freestart=%08x hydra phys=%08x\n", physical_start, physical_freestart, hydrascratch.physical);*/
- for (logical = 0; logical < 0x00/*kernexec->a_text*/;
- logical += NBPG)
- map_entry_ro(l2pagetable, logical, physical_start
- + logical);
- for (; logical < kerneldatasize; logical += NBPG)
- map_entry(l2pagetable, logical, physical_start
- + logical);
- } else
- for (logical = 0; logical < kerneldatasize; logical += NBPG)
- map_entry(l2pagetable, logical, physical_start
- + logical);
-
-/* Map the stack pages */
-
- map_entry(l2pagetable, irqstack.physical-physical_start,
- irqstack.physical);
- map_entry(l2pagetable, abtstack.physical-physical_start,
- abtstack.physical);
- map_entry(l2pagetable, undstack.physical-physical_start,
- undstack.physical);
- map_entry(l2pagetable, kernelstack.physical - physical_start,
- kernelstack.physical);
- map_entry(l2pagetable, kernelstack.physical + NBPG - physical_start,
- kernelstack.physical + NBPG);
-
- l2pagetable = kernel_pt_table[KERNEL_PT_KSTACK] - physical_start;
-
- map_entry(l2pagetable, 0x003fe000, kernelstack.physical);
- map_entry(l2pagetable, 0x003ff000, kernelstack.physical + NBPG);
-
-/* Now we fill in the L2 pagetable for the VRAM */
-
-/*
- * Current architectures mean that the VRAM is always in 1 continuous
- * bank.
- * This means that we can just map the 2 meg that the VRAM would occupy.
- * In theory we don't need a page table for VRAM, we could section map
- * it but we would need the page tables if DRAM was in use.
- */
-
- l2pagetable = kernel_pt_table[KERNEL_PT_VMEM] - physical_start;
-
- for (logical = 0; logical < 0x200000; logical += NBPG) {
- map_entry(l2pagetable, logical, bootconfig.vram[0].address
- + logical);
- map_entry(l2pagetable, logical + 0x200000,
- bootconfig.vram[0].address + logical);
- }
-
-/* Map entries in the page table used to map PDE's */
-
- l2pagetable = kernel_pt_table[KERNEL_PT_PDE] - physical_start;
- map_entry(l2pagetable, 0x0000000,
- kernel_pt_table[KERNEL_PT_PAGEDIR]);
- map_entry(l2pagetable, 0x0001000,
- kernel_pt_table[KERNEL_PT_PAGEDIR] + 0x1000);
- map_entry(l2pagetable, 0x0002000,
- kernel_pt_table[KERNEL_PT_PAGEDIR] + 0x2000);
- map_entry(l2pagetable, 0x0003000,
- kernel_pt_table[KERNEL_PT_PAGEDIR] + 0x3000);
-
-/*
- * Map entries in the page table used to map PTE's
- * Basically every kernel page table gets mapped here
- */
-
- l2pagetable = kernel_pt_table[KERNEL_PT_PTE] - physical_start;
- map_entry(l2pagetable, (KERNEL_BASE >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_KERNEL]);
- map_entry(l2pagetable, (PAGE_DIRS_BASE >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_PDE]);
- map_entry(l2pagetable, (PROCESS_PAGE_TBLS_BASE >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_PTE]);
- map_entry(l2pagetable, (VMEM_VBASE >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_VMEM]);
- map_entry(l2pagetable, (0x00000000 >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_SYS]);
- map_entry(l2pagetable, ((KERNEL_VM_BASE + 0x00000000) >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_VMDATA0]);
- map_entry(l2pagetable, ((KERNEL_VM_BASE + 0x00400000) >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_VMDATA1]);
- map_entry(l2pagetable, ((KERNEL_VM_BASE + 0x00800000) >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_VMDATA2]);
- map_entry(l2pagetable, ((KERNEL_VM_BASE + 0x00c00000) >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_VMDATA3]);
- map_entry(l2pagetable, ((KERNEL_VM_BASE + 0x01000000) >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_VMDATA4]);
- map_entry(l2pagetable, ((KERNEL_VM_BASE + 0x01400000) >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_VMDATA5]);
- map_entry(l2pagetable, ((KERNEL_VM_BASE + 0x01800000) >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_VMDATA6]);
- map_entry(l2pagetable, ((KERNEL_VM_BASE + 0x01c00000) >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_VMDATA7]);
- map_entry(l2pagetable, ((0xef800000) >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_KSTACK]);
-
- map_entry(l2pagetable, (0xf5000000 >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_PAGEDIR] + 0x0000);
- map_entry(l2pagetable, (0xf5400000 >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_PAGEDIR] + 0x1000);
- map_entry(l2pagetable, (0xf5800000 >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_PAGEDIR] + 0x2000);
- map_entry(l2pagetable, (0xf5c00000 >> (PGSHIFT-2)),
- kernel_pt_table[KERNEL_PT_PAGEDIR] + 0x3000);
-
-/*
- * Map the system page in the kernel page table for the bottom 1Meg
- * of the virtual memory map.
- */
-
- l2pagetable = kernel_pt_table[KERNEL_PT_SYS] - physical_start;
- map_entry(l2pagetable, 0x0000000, systempage.physical);
-
-/* Now we construct the L1 pagetable */
-
- l1pagetable = kernel_pt_table[KERNEL_PT_PAGEDIR] - physical_start;
-
-/* Map the VIDC20, IOMD, COMBO and podules */
-
-/* Map the VIDC20 */
-
- map_section(l1pagetable, VIDC_BASE, VIDC_HW_BASE);
-
-/* Map the IOMD (and SLOW and MEDIUM simple podules) */
-
- map_section(l1pagetable, IOMD_BASE, IOMD_HW_BASE);
-
-/* Map the COMBO (and module space) */
-
- map_section(l1pagetable, IO_BASE, IO_HW_BASE);
-
-/* Map the L2 pages tables in the L1 page table */
-
- map_pagetable(l1pagetable, 0x00000000,
- kernel_pt_table[KERNEL_PT_SYS]);
- map_pagetable(l1pagetable, 0xef800000,
- kernel_pt_table[KERNEL_PT_KSTACK]);
- map_pagetable(l1pagetable, KERNEL_BASE,
- kernel_pt_table[KERNEL_PT_KERNEL]);
- map_pagetable(l1pagetable, KERNEL_VM_BASE + 0x00000000,
- kernel_pt_table[KERNEL_PT_VMDATA0]);
- map_pagetable(l1pagetable, KERNEL_VM_BASE + 0x00400000,
- kernel_pt_table[KERNEL_PT_VMDATA1]);
- map_pagetable(l1pagetable, KERNEL_VM_BASE + 0x00800000,
- kernel_pt_table[KERNEL_PT_VMDATA2]);
- map_pagetable(l1pagetable, KERNEL_VM_BASE + 0x00c00000,
- kernel_pt_table[KERNEL_PT_VMDATA3]);
- map_pagetable(l1pagetable, KERNEL_VM_BASE + 0x01000000,
- kernel_pt_table[KERNEL_PT_VMDATA4]);
- map_pagetable(l1pagetable, KERNEL_VM_BASE + 0x01400000,
- kernel_pt_table[KERNEL_PT_VMDATA5]);
- map_pagetable(l1pagetable, KERNEL_VM_BASE + 0x01800000,
- kernel_pt_table[KERNEL_PT_VMDATA6]);
- map_pagetable(l1pagetable, KERNEL_VM_BASE + 0x01c00000,
- kernel_pt_table[KERNEL_PT_VMDATA7]);
- map_pagetable(l1pagetable, PAGE_DIRS_BASE,
- kernel_pt_table[KERNEL_PT_PDE]);
- map_pagetable(l1pagetable, PROCESS_PAGE_TBLS_BASE,
- kernel_pt_table[KERNEL_PT_PTE]);
- map_pagetable(l1pagetable, VMEM_VBASE,
- kernel_pt_table[KERNEL_PT_VMEM]);
-
-/* Bit more debugging info */
-
-/*
- printf("page tables look like this ...\n");
- printf("V0x00000000 - %08x\n", ReadWord(l1pagetable + 0x0000));
- printf("V0x03200000 - %08x\n", ReadWord(l1pagetable + 0x00c8));
- printf("V0x03500000 - %08x\n", ReadWord(l1pagetable + 0x00d4));
- printf("V0xf0000000 - %08x\n", ReadWord(l1pagetable + 0x3c00));
- printf("V0xf1000000 - %08x\n", ReadWord(l1pagetable + 0x3c40));
- printf("V0xf2000000 - %08x\n", ReadWord(l1pagetable + 0x3c80));
- printf("V0xf3000000 - %08x\n", ReadWord(l1pagetable + 0x3cc0));
- printf("V0xf3300000 - %08x\n", ReadWord(l1pagetable + 0x3ccc));
- printf("V0xf4000000 - %08x\n", ReadWord(l1pagetable + 0x3d00));
- printf("V0xf6000000 - %08x\n", ReadWord(l1pagetable + 0x3d80));
-*/
-/* printf("V0xefc00000 - %08x\n", ReadWord(l1pagetable + 0x3bf8));
- printf("V0xef800000 - %08x\n", ReadWord(l1pagetable + 0x3bfc));*/
-
-/*
- * Now we have the real page tables in place so we can switch to them.
- * Once this is done we will be running with the REAL kernel page tables.
- */
-
-/*
- * The last thing we must do is copy the kernel down to the new memory.
- * This copies all our kernel data structures and variables as well
- * which is why it is left to the last moment.
- */
-
- printf("mapping ... ");
-
- bcopy((char *)KERNEL_BASE, (char *)0x00000000, kerneldatasize);
-
-/* Switch tables */
-
- setttb(kernel_pt_table[KERNEL_PT_PAGEDIR]);
-
- printf("done.\n");
-
-/* Right set up the vectors at the bottom of page 0 */
-
- bcopy(page0, (char *)0x00000000, page0_end - page0);
-
-/*
- * Pages were allocated during the secondary bootstrap for the
- * stacks for different CPU modes.
- * We must now set the r13 registers in the different CPU modes to
- * point to these stacks.
- * Since the ARM stacks use STMFD etc. we must set r13 to the top end
- * of the stack memory.
- */
-
-#ifdef DIAGNOSTIC
- printf("IRQ stack V%08x P%08x\n", (u_int) irqstack.virtual,
- (u_int) irqstack.physical);
- printf("ABT stack V%08x P%08x\n", (u_int) abtstack.virtual,
- (u_int) abtstack.physical);
- printf("UND stack V%08x P%08x\n", (u_int) undstack.virtual,
- (u_int) undstack.physical);
-#endif
-
- printf("init subsystems: stacks ");
-
- set_stackptr(PSR_IRQ32_MODE, irqstack.virtual + NBPG);
- set_stackptr(PSR_ABT32_MODE, abtstack.virtual + NBPG);
- set_stackptr(PSR_UND32_MODE, undstack.virtual + NBPG);
-
- if (pmap_debug_level >= 0)
- printf("kstack V%08x P%08x\n", (int) kernelstack.virtual,
- (int) kernelstack.physical);
-
-/*
- * Well we should set a data abort handler.
- * Once things get going this will change as we will need a proper handler.
- * Until then we will use a handler that just panics but tells us
- * why.
- * Initialisation of the vectors will just panic on a data abort.
- * This just fills in a slighly better one.
- */
-
- printf("vectors ");
- data_abort_handler_address = (u_int)data_abort_handler;
- prefetch_abort_handler_address = (u_int)prefetch_abort_handler;
- undefined_handler_address = (u_int)undefinedinstruction_bounce;
-
-/* Diagnostic stuff. while writing the boot code */
-
-/*
- for (loop = 0x0; loop < 0x1000; ++loop) {
- if (ReadWord(PAGE_DIRS_BASE + loop * 4) != 0)
- printf("Pagetable for V%08x = %08x\n", loop << 20,
- ReadWord(0xf2000000 + loop * 4));
- }
-
-*/
-
-/* Diagnostic stuff. while writing the boot code */
-
-/*
- for (loop = 0x0; loop < 0x400; ++loop) {
- if (ReadWord(kernel_pt_table[KERNEL_PT_PTE] + loop * 4) != 0)
- printf("Pagetable for V%08x P%08x = %08x\n",
- loop << 22, kernel_pt_table[KERNEL_PT_PTE]+loop*4,
- ReadWord(kernel_pt_table[KERNEL_PT_PTE]+loop * 4));
- }
-*/
-
-/* At last !
- * We now have the kernel in physical memory from the bottom upwards.
- * Kernel page tables are physically above this.
- * The kernel is mapped to 0xf0000000
- * The kernel data PTs will handle the mapping of 0xf1000000-0xf1ffffff
- * 2Meg of VRAM is mapped to 0xf4000000
- * The kernel page directory is mapped to 0xf3000000
- * The page tables are mapped to 0xefc00000
- * The IOMD is mapped to 0xf6000000
- * The VIDC is mapped to 0xf6100000
- */
-
-/* Initialise the undefined instruction handlers */
-
- printf("undefined ");
- undefined_init();
-
-/* Boot strap pmap telling it where the kernel page table is */
-
- printf("pmap ");
- pmap_bootstrap(PAGE_DIRS_BASE);
-
-/* Setup the IRQ system */
-
- printf("irq ");
- irq_init();
- printf("done.\n");
-
-#ifdef DDB
- printf("ddb: ");
- db_machine_init();
- ddb_init();
-
- if (boothowto & RB_KDB)
- Debugger();
-#endif
-
-/* We return the new stack pointer address */
- return(kernelstack.virtual + USPACE_SVC_STACK_TOP);
-}
-
-
-/*
- * void cpu_startup(void)
- *
- * Machine dependant startup code.
- *
- */
-
-void
-cpu_startup()
-{
- int loop;
- vm_offset_t minaddr;
- vm_offset_t maxaddr;
- caddr_t sysbase;
- caddr_t size;
- vm_size_t bufsize;
- int base, residual;
-
-/* Set the cpu control register */
-
- cpu_ctrl = CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_32BP_ENABLE
- | CPU_CONTROL_32BD_ENABLE | CPU_CONTROL_SYST_ENABLE;
-
- if (cpu_cache & 1)
- cpu_ctrl |= CPU_CONTROL_IDC_ENABLE;
- if (cpu_cache & 2)
- cpu_ctrl |= CPU_CONTROL_WBUF_ENABLE;
-
- if (!(cpu_cache & 4))
- cpu_ctrl |= CPU_CONTROL_CPCLK;
-
-#ifdef CPU_LATE_ABORT
- cpu_ctrl |= CPU_CONTROL_LABT_ENABLE;
-#endif
-
-/* Clear out the cache */
-
- idcflush();
-
- cpu_control(cpu_ctrl);
-
-/* All domains MUST be clients, permissions are VERY important */
-
- cpu_domains(DOMAIN_CLIENT);
-
-/* Lock down zero page */
-
- zero_page_readonly();
-
-/*
- * Initialize error message buffer (at end of core).
- */
-
-/* msgbufphys was setup during the secondary boot strap */
-
- for (loop = 0; loop < btoc(sizeof(struct msgbuf)); ++loop)
- pmap_enter(pmap_kernel(),
- (vm_offset_t)((caddr_t)msgbufp + loop * NBPG),
- msgbufphys + loop * NBPG, VM_PROT_ALL, TRUE);
-
- msgbufmapped = 1;
-
-/*
- * Identify ourselves for the msgbuf (everything printed earlier will
- * not be buffered).
- */
-
- printf(version);
-
- printf("screen: %d x %d x %d\n", bootconfig.width + 1, bootconfig.height + 1, bootconfig.framerate);
-
- if (cmos_read(RTC_ADDR_REBOOTCNT) > 0)
- printf("Warning: REBOOTCNT = %d\n", cmos_read(RTC_ADDR_REBOOTCNT));
-
- printf("real mem = %d (%d pages)\n", arm_page_to_byte(physmem), physmem);
-
- /*
- * Find out how much space we need, allocate it,
- * and then give everything true virtual addresses.
- */
-
- size = allocsys((caddr_t)0);
- sysbase = (caddr_t)kmem_alloc(kernel_map, round_page(size));
- if (sysbase == 0)
- panic("cpu_startup: no room for system tables %d bytes required", size);
- if ((caddr_t)((allocsys(sysbase) - sysbase)) != size)
- panic("cpu_startup: system table size inconsistency");
-
-/*
- * Now allocate buffers proper. They are different than the above
- * in that they usually occupy more virtual memory than physical.
- */
-
- bufsize = MAXBSIZE * nbuf;
- buffer_map = kmem_suballoc(kernel_map, (vm_offset_t *)&buffers,
- &maxaddr, bufsize, TRUE);
- minaddr = (vm_offset_t)buffers;
- if (vm_map_find(buffer_map, vm_object_allocate(bufsize),
- (vm_offset_t)0, &minaddr, bufsize, FALSE) != KERN_SUCCESS)
- panic("startup: cannot allocate buffers");
-
- if ((bufpages / nbuf) >= btoc(MAXBSIZE)) {
-/* don't want to alloc more physical mem than needed */
- bufpages = btoc(MAXBSIZE) * nbuf;
- }
-
- base = bufpages / nbuf;
- residual = bufpages % nbuf;
- for (loop = 0; loop < nbuf; ++loop) {
- vm_size_t curbufsize;
- vm_offset_t curbuf;
-
-/*
- * First <residual> buffers get (base+1) physical pages
- * allocated for them. The rest get (base) physical pages.
- *
- * The rest of each buffer occupies virtual space,
- * but has no physical memory allocated for it.
- */
-
- curbuf = (vm_offset_t)buffers + loop * MAXBSIZE;
- curbufsize = CLBYTES * (loop < residual ? base+1 : base);
- vm_map_pageable(buffer_map, curbuf, curbuf+curbufsize, FALSE);
- vm_map_simplify(buffer_map, curbuf);
- }
-
-/*
- * Allocate a submap for exec arguments. This map effectively
- * limits the number of processes exec'ing at any time.
- */
-
- exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
- 16*NCARGS, TRUE);
-
-/*
- * Allocate a submap for physio
- */
-
- phys_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
- VM_PHYS_SIZE, TRUE);
-
-/*
- * Finally, allocate mbuf pool. Since mclrefcnt is an off-size
- * we use the more space efficient malloc in place of kmem_alloc.
- */
-
- mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES,
- M_MBUF, M_NOWAIT);
- bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES);
- mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
- VM_MBUF_SIZE, FALSE);
-
-/*
- printf("mb_buf: map=%08x maxaddr = %08x mbutl = %08x\n", mb_map, maxaddr, mbutl);
-*/
-
-/*
- * Initialise timeouts
- */
- timeout_init();
-
- printf("avail mem = %d (%d pages)\n", (int)ptoa(cnt.v_free_count),
- (int)ptoa(cnt.v_free_count) / NBPG);
- printf("using %d buffers containing %d bytes of memory\n",
- nbuf, bufpages * CLBYTES);
-
-/*
- * Set up buffers, so they can be used to read disk labels.
- */
-
- bufinit();
-
- proc0paddr = (struct user *)kernelstack.virtual;
- proc0.p_addr = proc0paddr;
-
- curpcb = &proc0.p_addr->u_pcb;
- curpcb->pcb_flags = 0;
- curpcb->pcb_und_sp = (u_int)proc0.p_addr + USPACE_UNDEF_STACK_TOP;
- curpcb->pcb_sp = (u_int)proc0.p_addr + USPACE_SVC_STACK_TOP;
- curpcb->pcb_pagedir = (pd_entry_t *)pmap_extract(kernel_pmap,
- (vm_offset_t)(kernel_pmap)->pm_pdir);
-
- proc0.p_md.md_regs = (struct trapframe *)curpcb->pcb_sp - 1;
-#if 0
-/* Hack proc0 */
-
- proc0paddr = (struct user *)kernelstack.virtual;
- proc0.p_addr = proc0paddr;
-
- curpcb = &proc0.p_addr->u_pcb;
- proc0.p_addr->u_pcb.pcb_flags = 0;
- proc0.p_addr->u_pcb.pcb_und_sp = (u_int)proc0.p_addr + USPACE_UNDEF_STACK_TOP;
-
- proc0.p_addr->u_pcb.pcb_pagedir = (pd_entry_t *)pmap_extract(kernel_pmap,
- (vm_offset_t)(kernel_pmap)->pm_pdir);
-#endif
-/*
- * Install an IRQ handler on the VSYNC interrupt to reboot if the
- * middle mouse button is pressed.
- */
-
- setup_cursor();
-
-/* Allocate memory for the kmodule area if required */
-
- if (kmodule_size) {
- kmodule_size = round_page(kmodule_size);
- kmodule_base = (u_int)kmem_alloc(kernel_map, kmodule_size);
- if (kmodule_base)
- printf("KMODULE SPACE = %08x\n", kmodule_base);
- else
- printf("\x1b[31mNO KMODULE SPACE\n\x1b[0m");
- }
-
-/*
- * Configure the hardware
- */
-
- if (boothowto & RB_CONFIG) {
-#ifdef BOOT_CONFIG
- user_config();
-#else
- printf("kernel does not support -c; continuing..\n");
-#endif
- }
- configure();
-
-/* Set the root, swap and dump devices from the boot args */
-
- set_boot_devs();
-
- dump_spl_masks();
-
- cold = 0; /* We are warm now ... */
-}
-
-
-/*
- * Allocate space for system data structures. We are given
- * a starting virtual address and we return a final virtual
- * address; along the way we set each data structure pointer.
- *
- * We call allocsys() with 0 to find out how much space we want,
- * allocate that much and fill it with zeroes, and then call
- * allocsys() again with the correct base virtual address.
- */
-
-caddr_t
-allocsys(v)
- register caddr_t v;
-{
-
-#define valloc(name, type, num) \
- (caddr_t)(name) = (type *)v; \
- v = (caddr_t)((name) + (num));
-
- valloc(timeouts, struct timeout, ntimeout);
-
-#ifdef SYSVSHM
- valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
-#endif
-#ifdef SYSVSEM
- valloc(sema, struct semid_ds, seminfo.semmni);
- valloc(sem, struct sem, seminfo.semmns);
- /* This is pretty disgusting! */
- valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
-#endif
-#ifdef SYSVMSG
- valloc(msgpool, char, msginfo.msgmax);
- valloc(msgmaps, struct msgmap, msginfo.msgseg);
- valloc(msghdrs, struct msg, msginfo.msgtql);
- valloc(msqids, struct msqid_ds, msginfo.msgmni);
-#endif
-
-/*
- * Determine how many buffers to allocate. We use 10% of the
- * first 2MB of memory, and 5% of the rest, with a minimum of 16
- * buffers. We allocate 1/2 as many swap buffer headers as file
- * i/o buffers.
- */
-
- if (bufpages == 0)
- if (physmem < arm_byte_to_page(2 * 1024 * 1024))
- bufpages = physmem / (10 * CLSIZE);
- else
- bufpages = (arm_byte_to_page(2 * 1024 * 1024)
- + physmem) / (20 * CLSIZE);
-
-#ifdef DIAGNOSTIC
- if (bufpages == 0)
- panic("bufpages = 0");
-#endif
-
- if (nbuf == 0) {
- nbuf = bufpages;
- if (nbuf < 16)
- nbuf = 16;
- }
-
- if (nswbuf == 0) {
- nswbuf = (nbuf / 2) & ~1; /* force even */
- if (nswbuf > 256)
- nswbuf = 256; /* sanity */
- }
-
- valloc(swbuf, struct buf, nswbuf);
- valloc(buf, struct buf, nbuf);
-
- return(v);
-}
-
-
-/* A few functions that are used to help construct the page tables
- * during the bootstrap process.
- */
-
-void
-map_section(pagetable, va, pa)
- vm_offset_t pagetable;
- vm_offset_t va;
- vm_offset_t pa;
-{
- if ((va & 0xfffff) != 0)
- panic("initarm: Cannot allocate 1MB section on non 1MB boundry");
-
- ((u_int *)pagetable)[(va >> 20)] = L1_SEC((pa & PD_MASK));
-}
-
-
-void
-map_pagetable(pagetable, va, pa)
- vm_offset_t pagetable;
- vm_offset_t va;
- vm_offset_t pa;
-{
- if ((pa & 0xc00) != 0)
- panic("pagetables should be group allocated on pageboundry");
- ((u_int *)pagetable)[(va >> 20) + 0] = L1_PTE((pa & PG_FRAME) + 0x000);
- ((u_int *)pagetable)[(va >> 20) + 1] = L1_PTE((pa & PG_FRAME) + 0x400);
- ((u_int *)pagetable)[(va >> 20) + 2] = L1_PTE((pa & PG_FRAME) + 0x800);
- ((u_int *)pagetable)[(va >> 20) + 3] = L1_PTE((pa & PG_FRAME) + 0xc00);
-}
-
-
-void
-map_entry(pagetable, va, pa)
- vm_offset_t pagetable;
- vm_offset_t va;
- vm_offset_t pa;
-{
- WriteWord(pagetable + ((va >> 10) & 0x00000ffc),
- L2_PTE((pa & PG_FRAME), AP_KRW));
-}
-
-
-void
-map_entry_nc(pagetable, va, pa)
- vm_offset_t pagetable;
- vm_offset_t va;
- vm_offset_t pa;
-{
- WriteWord(pagetable + ((va >> 10) & 0x00000ffc),
- L2_PTE_NC((pa & PG_FRAME), AP_KRW));
-}
-
-
-void
-map_entry_ro(pagetable, va, pa)
- vm_offset_t pagetable;
- vm_offset_t va;
- vm_offset_t pa;
-{
- WriteWord(pagetable + ((va >> 10) & 0x00000ffc),
- L2_PTE((pa & PG_FRAME), AP_KR));
-}
-
-
-int wdresethack = 1;
-
-void
-process_kernel_args()
-{
- char *ptr;
- char *args;
-
-/* Ok now we will check the arguments for interesting parameters. */
-
- args = (char *)bootconfig.argvirtualbase;
- max_processes = 64;
- boothowto = 0;
- kmodule_size = 0;
- cpu_cache = 0x03;
- debug_flags = 0;
- videodram_size = 0;
-
-/* Skip the first parameter (the boot loader filename) */
-
- while (*args != ' ' && *args != 0)
- ++args;
-
- while (*args == ' ')
- ++args;
-
-/* Skip the kernel image filename */
-
- while (*args != ' ' && *args != 0)
- ++args;
-
- while (*args == ' ')
- ++args;
-
- boot_args = NULL;
-
- if (*args != 0) {
- boot_args = args;
-
- if (strstr(args, "nocache"))
- cpu_cache &= ~1;
-
- if (strstr(args, "nowritebuf"))
- cpu_cache &= ~2;
-
- if (strstr(args, "fpaclk2"))
- cpu_cache |= 4;
-
- ptr = strstr(args, "maxproc=");
- if (ptr) {
- max_processes = (int)strtoul(ptr + 8, NULL, 10);
- if (max_processes < 16)
- max_processes = 16;
- if (max_processes > 256)
- max_processes = 256;
- printf("Maximum \"in memory\" processes = %d\n",
- max_processes);
- }
- ptr = strstr(args, "ramdisc=");
- if (ptr) {
- ramdisc_size = (u_int)strtoul(ptr + 8, NULL, 10);
- ramdisc_size *= 1024;
- if (ramdisc_size < 32*1024)
- ramdisc_size = 32*1024;
- if (ramdisc_size > 2048*1024)
- ramdisc_size = 2048*1024;
- }
- ptr = strstr(args, "kmodule=");
- if (ptr) {
- kmodule_size = (u_int)strtoul(ptr + 8, NULL, 10);
- kmodule_size *= 1024;
- if (kmodule_size < 4*1024)
- kmodule_size = 4*1024;
- if (kmodule_size > 256*1024)
- kmodule_size = 256*1024;
- }
- ptr = strstr(args, "videodram=");
- if (ptr) {
- videodram_size = (u_int)strtoul(ptr + 10, NULL, 10);
- /* Round to 4K page */
- videodram_size *= 1024;
- videodram_size = round_page(videodram_size);
- if (videodram_size > 1024*1024)
- videodram_size = 1024*1024;
- printf("VIDEO DRAM = %d\n", videodram_size);
- }
- if (strstr(args, "single"))
- boothowto |= RB_SINGLE;
- if (strstr(args, "kdb"))
- boothowto |= RB_KDB;
- ptr = strstr(args, "pmapdebug=");
- if (ptr) {
- pmap_debug_level = (int)strtoul(ptr + 10, NULL, 10);
- pmap_debug(pmap_debug_level);
- debug_flags |= 0x01;
- }
- if (strstr(args, "termdebug"))
- debug_flags |= 0x02;
- if (strstr(args, "nowdreset"))
- wdresethack = 0;
- if (strstr(args, "notermcls"))
- debug_flags |= 0x04;
- }
-}
-
-/* This should happen in the console code - This really must move soon */
-
-int
-setup_cursor()
-{
-
-/* The cursor currently gets set up here. slightly wasteful on memory */
-
-/*
- * This should be done in the vidc code as that is responcible for the cursor.
- * This will probably happen when the vidc code is separated from the console
- * (currently work in progress)
- */
-
- cursor_data = (u_int *)kmem_alloc(kernel_map, NBPG);
-/* printf("Cursor data page = V%08x P%08x\n", cursor_data, pmap_extract(kernel_pmap, (vm_offset_t)cursor_data));*/
- WriteWord(IOMD_CURSINIT, pmap_extract(kernel_pmap,
- (vm_offset_t)cursor_data));
- return(0);
-}
-
-
-/*
- * Clear registers on exec
- */
-
-void
-setregs(p, pack, stack, retval)
- struct proc *p;
- struct exec_package *pack;
- u_long stack;
- register_t *retval;
-{
- register struct trapframe *tf;
-
- if (pmap_debug_level >= -1)
- printf("setregs: ip=%08x sp=%08x proc=%08x\n",
- (u_int) pack->ep_entry, (u_int) stack, (u_int) p);
-
- tf = p->p_md.md_regs;
-
- if (pmap_debug_level >= -1)
- printf("mdregs=%08x pc=%08x lr=%08x sp=%08x\n",
- (u_int) tf, tf->tf_pc, tf->tf_usr_lr, tf->tf_usr_sp);
-
- tf->tf_r11 = 0; /* bottom of the fp chain */
- tf->tf_r12 = 0; /* ??? */
- tf->tf_pc = pack->ep_entry;
- tf->tf_usr_lr = pack->ep_entry;
- tf->tf_svc_lr = 0x77777777; /* Something we can see */
- tf->tf_usr_sp = stack;
- tf->tf_r10 = 0xaa55aa55; /* Something we can see */
- tf->tf_spsr = PSR_USR32_MODE;
-
- p->p_addr->u_pcb.pcb_flags = 0;
-
- retval[1] = 0;
-}
-
-
-/*
- * Modify the current mapping for zero page to make it read only
- *
- * This routine is only used until things start forking. Then new
- * system pages are mapped read only in pmap_enter().
- */
-
-void
-zero_page_readonly()
-{
- WriteWord(0xefc00000, L2_PTE((systempage.physical & PG_FRAME), AP_KR));
- tlbflush();
-}
-
-
-/*
- * Modify the current mapping for zero page to make it read/write
- *
- * This routine is only used until things start forking. Then system
- * pages belonging to user processes are never made writable.
- */
-
-void
-zero_page_readwrite()
-{
- WriteWord(0xefc00000, L2_PTE((systempage.physical & PG_FRAME), AP_KRW));
- tlbflush();
-}
-
-
-/*
- * Send an interrupt to process.
- *
- * Stack is set up to allow sigcode stored in u. to call routine, followed by kcall
- * to sigreturn routine below. After sigreturn resets the signal mask, the stack, and the
- * frame pointer, it returns to the user specified pc.
- */
-
-void
-sendsig(catcher, sig, mask, code)
- sig_t catcher;
- int sig;
- int mask;
- u_long code;
-{
- struct proc *p = curproc;
- struct trapframe *tf;
- struct sigframe *fp, frame;
- struct sigacts *psp = p->p_sigacts;
- int oonstack;
- extern char sigcode[], esigcode[];
-
- if (pmap_debug_level >= 0)
- printf("Sendsig: sig=%d mask=%08x catcher=%08x code=%08x\n",
- sig, mask, (u_int)catcher, (u_int)code);
-
- tf = p->p_md.md_regs;
- oonstack = psp->ps_sigstk.ss_flags & SA_ONSTACK;
-
-/*
- * Allocate space for the signal handler context.
- */
-
- if ((psp->ps_flags & SAS_ALTSTACK) && !oonstack &&
- (psp->ps_sigonstack & sigmask(sig))) {
- fp = (struct sigframe *)(psp->ps_sigstk.ss_sp +
- psp->ps_sigstk.ss_size - sizeof(struct sigframe));
- psp->ps_sigstk.ss_flags |= SA_ONSTACK;
- } else {
- fp = (struct sigframe *)tf->tf_usr_sp - 1;
- }
-
-/*
- * Build the argument list for the signal handler.
- */
-
- frame.sf_signum = sig;
-
- frame.sf_code = code;
- frame.sf_scp = &fp->sf_sc;
- frame.sf_handler = catcher;
-
-/*
- * Build the signal context to be used by sigreturn.
- */
-
- frame.sf_sc.sc_onstack = oonstack;
- frame.sf_sc.sc_mask = mask;
- frame.sf_sc.sc_r0 = tf->tf_r0;
- frame.sf_sc.sc_r1 = tf->tf_r1;
- frame.sf_sc.sc_r2 = tf->tf_r2;
- frame.sf_sc.sc_r3 = tf->tf_r3;
- frame.sf_sc.sc_r4 = tf->tf_r4;
- frame.sf_sc.sc_r5 = tf->tf_r5;
- frame.sf_sc.sc_r6 = tf->tf_r6;
- frame.sf_sc.sc_r7 = tf->tf_r7;
- frame.sf_sc.sc_r8 = tf->tf_r8;
- frame.sf_sc.sc_r9 = tf->tf_r9;
- frame.sf_sc.sc_r10 = tf->tf_r10;
- frame.sf_sc.sc_r11 = tf->tf_r11;
- frame.sf_sc.sc_r12 = tf->tf_r12;
- frame.sf_sc.sc_usr_sp = tf->tf_usr_sp;
- frame.sf_sc.sc_usr_lr = tf->tf_usr_lr;
- frame.sf_sc.sc_svc_lr = tf->tf_svc_lr;
- frame.sf_sc.sc_pc = tf->tf_pc;
- frame.sf_sc.sc_spsr = tf->tf_spsr;
-
- if (copyout(&frame, fp, sizeof(frame)) != 0) {
-/*
- * Process has trashed its stack; give it an illegal
- * instruction to halt it in its tracks.
- */
-
- sigexit(p, SIGILL);
- /* NOTREACHED */
- }
-
-/*
- * Build context to run handler in.
- */
-
- tf->tf_r0 = frame.sf_signum;
- tf->tf_r1 = frame.sf_code;
- tf->tf_r2 = (u_int)frame.sf_scp;
- tf->tf_r3 = (u_int)frame.sf_handler;
- tf->tf_usr_sp = (int)fp;
- tf->tf_pc = (int)(((char *)PS_STRINGS) - (esigcode - sigcode));
-
- if (pmap_debug_level >= 0)
- printf("Sendsig: sig=%d pc=%08x\n", sig, tf->tf_pc);
-}
-
-
-
-/*
- * System call to cleanup state after a signal
- * has been taken. Reset signal mask and
- * stack state from context left by sendsig (above).
- * Return to previous pc and psl as specified by
- * context left by sendsig. Check carefully to
- * make sure that the user has not modified the
- * psr to gain improper privileges or to cause
- * a machine fault.
- */
-
-int
-sys_sigreturn(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct sys_sigreturn_args /* {
- syscallarg(struct sigcontext *) sigcntxp;
- } */ *uap = v;
- struct sigcontext *scp, context;
-/* register struct sigframe *fp;*/
- register struct trapframe *tf;
-
- if (pmap_debug_level >= 0)
- printf("sigreturn: context=%08x\n", (int)SCARG(uap, sigcntxp));
-
- tf = p->p_md.md_regs;
-
- /*
- * The trampoline code hands us the context.
- * It is unsafe to keep track of it ourselves, in the event that a
- * program jumps out of a signal handler.
- */
-
- scp = SCARG(uap, sigcntxp);
-
- if (copyin((caddr_t)scp, &context, sizeof(*scp)) != 0)
- return (EFAULT);
-
-/*
- * Check for security violations.
- */
-
-/* Make sure the processor mode has not been tampered with */
-
- if ((context.sc_spsr & PSR_MODE) != PSR_USR32_MODE)
- return(EINVAL);
-
- if (context.sc_onstack & 01)
- p->p_sigacts->ps_sigstk.ss_flags |= SA_ONSTACK;
- else
- p->p_sigacts->ps_sigstk.ss_flags &= ~SA_ONSTACK;
- p->p_sigmask = context.sc_mask & ~sigcantmask;
-
- /*
- * Restore signal context.
- */
-
- tf->tf_r0 = context.sc_r0;
- tf->tf_r1 = context.sc_r1;
- tf->tf_r2 = context.sc_r2;
- tf->tf_r3 = context.sc_r3;
- tf->tf_r4 = context.sc_r4;
- tf->tf_r5 = context.sc_r5;
- tf->tf_r6 = context.sc_r6;
- tf->tf_r7 = context.sc_r7;
- tf->tf_r8 = context.sc_r8;
- tf->tf_r9 = context.sc_r9;
- tf->tf_r10 = context.sc_r10;
- tf->tf_r11 = context.sc_r11;
- tf->tf_r12 = context.sc_r12;
- tf->tf_usr_sp = context.sc_usr_sp;
- tf->tf_usr_lr = context.sc_usr_lr;
- tf->tf_svc_lr = context.sc_svc_lr;
- tf->tf_pc = context.sc_pc;
- tf->tf_spsr = context.sc_spsr;
-
-#ifdef VALIDATE_TRAPFRAME
- validate_trapframe(tf, 6);
-#endif
-
- return (EJUSTRETURN);
-}
-
-/*
- * machine dependent system variables.
- */
-
-int
-cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
- int *name;
- u_int namelen;
- void *oldp;
- size_t *oldlenp;
- void *newp;
- size_t newlen;
- struct proc *p;
-{
- printf("cpu_sysctl: Currently stoned - Cannot support the operation\n");
- return(EOPNOTSUPP);
-}
-
-
-/*
- * Ok these are some development functions. They map blocks of memory
- * into the video ram virtual memory.
- * The idea is to follow this with a call to the vidc device to
- * reinitialise the vidc20 for the new video ram.
- */
-
-/* Map DRAM into the video memory */
-
-int
-vmem_mapdram()
-{
- u_int l2pagetable;
- u_int logical;
-
- if (videodram_start == 0 || videodram_size == 0)
- return(ENOMEM);
-
-/* Flush any video data in the cache */
-
- idcflush();
-
-/* Get the level 2 pagetable for the video memory */
-
- l2pagetable = pmap_pte(kernel_pmap, videomemory.vidm_vbase);
-
-/* Map a block of DRAM into the video memory area */
-
- for (logical = 0; logical < 0x200000; logical += NBPG) {
- map_entry(l2pagetable, logical, videodram_start
- + logical);
- map_entry(l2pagetable, logical + 0x200000,
- videodram_start + logical);
- }
-
-/* Flush the TLB so we pick up the new mappings */
-
- tlbflush();
-
-/* Rebuild the video memory descriptor */
-
- videomemory.vidm_vbase = VMEM_VBASE;
- videomemory.vidm_pbase = videodram_start;
- videomemory.vidm_type = VIDEOMEM_TYPE_DRAM;
- videomemory.vidm_size = videodram_size;
-
-/* Reinitialise the video system */
-
-/* video_reinit();*/
- return(0);
-}
-
-
-/* Map VRAM into the video memory */
-
-int
-vmem_mapvram()
-{
- u_int l2pagetable;
- u_int logical;
-
- if (bootconfig.vram[0].address == 0 || bootconfig.vram[0].pages == 0)
- return(ENOMEM);
-
-/* Flush any video data in the cache */
-
- idcflush();
-
-/* Get the level 2 pagetable for the video memory */
-
- l2pagetable = pmap_pte(kernel_pmap, videomemory.vidm_vbase);
-
-/* Map the VRAM into the video memory area */
-
- for (logical = 0; logical < 0x200000; logical += NBPG) {
- map_entry(l2pagetable, logical, bootconfig.vram[0].address
- + logical);
- map_entry(l2pagetable, logical + 0x200000,
- bootconfig.vram[0].address + logical);
- }
-
-/* Flush the TLB so we pick up the new mappings */
-
- tlbflush();
-
-/* Rebuild the video memory descriptor */
-
- videomemory.vidm_vbase = VMEM_VBASE;
- videomemory.vidm_pbase = VRAM_BASE;
- videomemory.vidm_type = VIDEOMEM_TYPE_VRAM;
- videomemory.vidm_size = bootconfig.vram[0].pages * NBPG;
-
-/* Reinitialise the video system */
-
-/* video_reinit();*/
- return(0);
-}
-
-
-/* Set the cache behaviour for the video memory */
-
-int
-vmem_cachectl(flag)
- int flag;
-{
- u_int l2pagetable;
- u_int logical;
-
- if (bootconfig.vram[0].address == 0 || bootconfig.vram[0].pages == 0)
- return(ENOMEM);
-
-/* Flush any video data in the cache */
-
- idcflush();
-
-/* Get the level 2 pagetable for the video memory */
-
- l2pagetable = pmap_pte(kernel_pmap, videomemory.vidm_vbase);
-
-/* Map the VRAM into the video memory area */
-
- if (flag & 1) {
- for (logical = 0; logical < 0x200000; logical += NBPG) {
- map_entry(l2pagetable, logical, bootconfig.vram[0].address
- + logical);
- map_entry(l2pagetable, logical + 0x200000,
- bootconfig.vram[0].address + logical);
- }
- } else {
- for (logical = 0; logical < 0x200000; logical += NBPG) {
- map_entry_nc(l2pagetable, logical, bootconfig.vram[0].address
- + logical);
- map_entry_nc(l2pagetable, logical + 0x200000,
- bootconfig.vram[0].address + logical);
- }
- }
-
-/* Flush the TLB so we pick up the new mappings */
-
- tlbflush();
-
- return(0);
-}
-
-#if 0
-extern int vtvalbug;
-extern char *vtlastbug;
-extern u_int vtbugaddr;
-extern u_int vtbugcaddr;
-
-void
-vtbugreport()
-{
- printf("vtvalbug = %d\n", vtvalbug);
- if (vtlastbug)
- printf("vtlastbug = %s\n", vtlastbug);
- printf("vtbugaddr = %08x\n", vtbugaddr);
- printf("vtbugcaddr = %08x\n", vtbugcaddr);
-}
-#endif
-
-/* End of machdep.c */
diff --git a/sys/arch/arm32/arm32/makemodes.c b/sys/arch/arm32/arm32/makemodes.c
deleted file mode 100644
index 6a1f5e354a8..00000000000
--- a/sys/arch/arm32/arm32/makemodes.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/* $NetBSD: makemodes.c,v 1.3 1996/03/16 00:13:12 thorpej Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD team.
- * 4. The name of the group nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * makemodes.c
- *
- * VIDC20 mode configuration program.
- *
- * Builds a list of configured modes using mode specifiers to select
- * the VIDC timings from a monitor definition file
- *
- * Not yet perfect, this is just experimental.
- *
- * Created : 17/05/95
- * Last updated : 17/05/95
- */
-
-#include <stdio.h>
-
-/*#define VERBOSE*/
-
-#define MAX_MD 100 /* Support up to 100 modes from a file */
-
-struct md {
- int md_xres;
- int md_yres;
- int md_pixelrate;
- int md_htimings[6];
- int md_vtimings[6];
- int md_syncpol;
- int md_framerate;
-} mds[MAX_MD];
-
-int md; /* Number of modes defined in the mds array */
-
-
-void makemode __P((FILE *, int, int, int, int));
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- char line[100]; /* Line read from mdf */
- char token[40]; /* token read from mdf line */
- char value[60]; /* value of token read form mdf line */
- int startmode; /* Are we between startmode and endmode tokens */
- char monitor[40]; /* monitor name */
- int dpms; /* DPMS state for monitor */
- FILE *mdf_fd; /* mdf file descriptor */
- FILE *out_fd; /* output file descriptor */
- int loop; /* loop counter */
- int x, y, c, f; /* mode specifier variables */
- int params;
- char *ptr;
-
-/* Check the args */
-
- if (argc < 3) {
- fprintf(stderr, "Syntax: makemodes <mdf> <outfile> <modes>\n");
- exit(10);
- }
-
-/* Open the monitor definition file */
-
- mdf_fd = fopen(argv[1], "r");
- if (!mdf_fd) {
- fprintf(stderr, "Cannot open monitor definition file\n");
- exit(10);
- }
-
-/* Open the output file */
-
- out_fd = fopen(argv[2], "w");
- if (!out_fd) {
- fprintf(stderr, "Cannot open output file\n");
- exit(10);
- }
-
-/* Initialise some variables */
-
- startmode = 0;
- md = 0;
- dpms = 0;
- monitor[0] = 0;
-
-/* Loop for each line in the monitor definition file */
-
- do {
-
-/* get a line */
-
- if (fgets(line, 99, mdf_fd) == NULL)
- break;
-
- ptr = line;
-
-/* Skip any spaces or tabs */
-
- while (*ptr == ' ' || *ptr == '\t')
- ++ptr;
-
-/* Ignore comment or blank lines */
-
- if (*ptr == '#' || strlen(ptr) < 2)
- continue;
-
-/* Do we have a startmode or endmode token ? */
-
- if (sscanf(ptr, "%s", token) == 1) {
- if (strcmp(token, "startmode") == 0) {
- if (md < MAX_MD)
- startmode = 1;
- }
- if (strcmp(token, "endmode") == 0) {
- startmode = 0;
- ++md;
- }
- }
-
-/* Do we have a token:value line ? */
-
- if (sscanf(ptr, "%[^:]:%[^\n]\n", token, value) == 2) {
- if (strcmp(token, "monitor_title") == 0)
- strcpy(monitor, value);
- if (strcmp(token, "file_format") == 0) {
- if (atoi(value) != 1) {
- fprintf(stderr, "Unrecognised file format\n");
- exit(10);
- }
- }
- if (strcmp(token, "DPMS_state") == 0)
- dpms = atoi(value);
- if (strcmp(token, "x_res") == 0 && startmode)
- mds[md].md_xres = atoi(value);
- if (strcmp(token, "y_res") == 0 && startmode)
- mds[md].md_yres = atoi(value);
- if (strcmp(token, "pixel_rate") == 0 && startmode)
- mds[md].md_pixelrate = atoi(value);
- if (strcmp(token, "h_timings") == 0 && startmode)
- sscanf(value, "%d,%d,%d,%d,%d,%d",
- &mds[md].md_htimings[0],
- &mds[md].md_htimings[1],
- &mds[md].md_htimings[2],
- &mds[md].md_htimings[3],
- &mds[md].md_htimings[4],
- &mds[md].md_htimings[5]);
- if (strcmp(token, "v_timings") == 0 && startmode)
- sscanf(value, "%d,%d,%d,%d,%d,%d",
- &mds[md].md_vtimings[0],
- &mds[md].md_vtimings[1],
- &mds[md].md_vtimings[2],
- &mds[md].md_vtimings[3],
- &mds[md].md_vtimings[4],
- &mds[md].md_vtimings[5]);
- if (strcmp(token, "sync_pol") == 0 && startmode)
- mds[md].md_syncpol = atoi(value);
- }
-
- }
- while (!feof(mdf_fd));
-
-/* We have finished with the monitor definition file */
-
- fclose(mdf_fd);
-
-#ifdef VERBOSE
-
-/* This was for debugging */
-
- for (loop = 0; loop < md; ++loop) {
- printf("%d x %d: %d %d [%d,%d,%d,%d,%d,%d] [%d,%d,%d,%d,%d,%d]\n",
- mds[loop].md_xres,
- mds[loop].md_yres,
- mds[loop].md_pixelrate,
- mds[loop].md_syncpol,
- mds[loop].md_htimings[0],
- mds[loop].md_htimings[1],
- mds[loop].md_htimings[2],
- mds[loop].md_htimings[3],
- mds[loop].md_htimings[4],
- mds[loop].md_htimings[5],
- mds[loop].md_vtimings[0],
- mds[loop].md_vtimings[1],
- mds[loop].md_vtimings[2],
- mds[loop].md_vtimings[3],
- mds[loop].md_vtimings[4],
- mds[loop].md_vtimings[5]);
- }
-#endif
-
-/* Start building the output file */
-
- fprintf(out_fd, "/*\n");
- fprintf(out_fd, " * MACHINE GENERATED: DO NOT EDIT\n");
- fprintf(out_fd, " *\n");
- fprintf(out_fd, " * %s, from %s\n", argv[2], argv[1]);
- fprintf(out_fd, " */\n\n");
- fprintf(out_fd, "#include <sys/types.h>\n");
- fprintf(out_fd, "#include <machine/vidc.h>\n\n");
- fprintf(out_fd, "char *monitor=\"%s\";\n", monitor);
- fprintf(out_fd, "int dpms=%d;\n", dpms);
- fprintf(out_fd, "\n", dpms);
- fprintf(out_fd, "struct vidc_mode vidcmodes[] = {\n");
-
- loop = 3;
-
-/* Loop over the rest of the args processing then as mode specifiers */
-
-/* NOTE: A mode specifier cannot have a space in it at the moment */
-
- while (argv[loop]) {
- printf("%s ==> ", argv[loop]);
- f = -1;
- c = 256;
- params = sscanf(argv[loop], "X%dY%dC%dF%d", &x, &y, &c, &f);
- if (params < 2)
- params = sscanf(argv[loop], "%d,%d,%d,%d", &x, &y, &c, &f);
- if (params == 2 || params == 4)
- makemode(out_fd, x, y, c, f);
- else if (params == 3)
- makemode(out_fd, x, y, 256, c);
- else
- printf("Invalid mode specifier\n");
- printf("\n");
- ++loop;
- }
-
-/* Finish off the output file */
-
- fprintf(out_fd, " { 0 }\n");
- fprintf(out_fd, "};\n");
-
- fclose(out_fd);
-}
-
-
-/* Locate an appropriate mode for the specifier and write it to the file */
-
-void makemode(out_fd, x, y, c, f)
- FILE *out_fd;
- int x, y, c, f;
-{
- int loop; /* loop counter */
- float framerate; /* frame rate */
- int fr; /* integer frame rate */
- int found = -1; /* array index of found mode */
- int max = -1; /* maximum frame rate found */
- int pos = -1; /* array index of max frame rate */
-
-/* Print some info */
-
- printf("%d x %d x %d x %d : ", x, y, c, f);
-
-/* Scan the modes */
-
- for (loop = 0; loop < md; ++loop) {
-
-/* X and Y have to match */
-
- if (mds[loop].md_xres == x && mds[loop].md_yres == y) {
-
-/* Now calculate the frame rate */
-
- framerate = (float)mds[loop].md_pixelrate /
- (float)(mds[loop].md_htimings[0] +
- mds[loop].md_htimings[1] +
- mds[loop].md_htimings[2] +
- mds[loop].md_htimings[3] +
- mds[loop].md_htimings[4] +
- mds[loop].md_htimings[5]) /
- (float)(mds[loop].md_vtimings[0] +
- mds[loop].md_vtimings[1] +
- mds[loop].md_vtimings[2] +
- mds[loop].md_vtimings[3] +
- mds[loop].md_vtimings[4] +
- mds[loop].md_vtimings[5]);
- framerate = framerate * 1000;
- fr = (framerate + 0.5);
- mds[loop].md_framerate = fr;
-
-/* Print it as info */
-
- printf("%d ", fr);
-
-/* Is this a new maximum ? */
-
- if (max < fr) {
- max = fr;
- pos = loop;
- }
-
-/* Does it match the specified frame rate ? */
-
- if (fr == f)
- found = loop;
- }
- }
-
-/* No exact match so use the max */
-
- if (found == -1)
- found = pos;
-
-/* Do we have an entry for this X & Y resolution */
-
- if (found != -1) {
- fprintf(out_fd, " { %d,/**/%d, %d, %d, %d, %d, %d,/**/%d, %d, %d, %d, %d, %d,/**/%d,/**/%d, %d },\n",
- mds[found].md_pixelrate,
- mds[found].md_htimings[0],
- mds[found].md_htimings[1],
- mds[found].md_htimings[2],
- mds[found].md_htimings[3],
- mds[found].md_htimings[4],
- mds[found].md_htimings[5],
- mds[found].md_vtimings[0],
- mds[found].md_vtimings[1],
- mds[found].md_vtimings[2],
- mds[found].md_vtimings[3],
- mds[found].md_vtimings[4],
- mds[found].md_vtimings[5],
- ffs(c),
- mds[found].md_syncpol,
- mds[found].md_framerate);
- }
- else {
- fprintf(stderr, "Cannot find mode\n");
- }
-}
-
-/* End of makemodes.c */
diff --git a/sys/arch/arm32/arm32/mcount.S b/sys/arch/arm32/arm32/mcount.S
deleted file mode 100644
index 9d032d8769c..00000000000
--- a/sys/arch/arm32/arm32/mcount.S
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $OpenBSD: mcount.S,v 1.2 2000/03/03 00:54:46 todd Exp $ */
-/* $NetBSD: mcount.S,v 1.1 1996/01/31 23:16:32 mark Exp $ */
-
-/*
- * Copyright (C) 1994 Mark Brinicombe
- * Copyright (C) 1994 Brini
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of Brini may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-fp .req r11
-ip .req r12
-sp .req r13
-lr .req r14
-pc .req r15
-
-.text
- .align 0
-
- .global mcount
-mcount:
- add pc, lr, #0x00000004
diff --git a/sys/arch/arm32/arm32/mem.c b/sys/arch/arm32/arm32/mem.c
deleted file mode 100644
index ab59b08d7d6..00000000000
--- a/sys/arch/arm32/arm32/mem.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/* $NetBSD: mem.c,v 1.2 1996/03/27 22:42:24 mark Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Memory special file
- */
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/buf.h>
-#include <sys/systm.h>
-#include <sys/uio.h>
-#include <sys/malloc.h>
-#include <sys/proc.h>
-#include <sys/fcntl.h>
-
-#include <machine/cpu.h>
-
-#include <vm/vm.h>
-
-extern char *memhook; /* poor name! */
-caddr_t zeropage;
-
-/*ARGSUSED*/
-int
-mmopen(dev, flag, mode)
- dev_t dev;
- int flag, mode;
-{
- switch (minor(dev)) {
- default:
- break;
- }
- return (0);
-}
-
-/*ARGSUSED*/
-int
-mmclose(dev, flag, mode)
- dev_t dev;
- int flag, mode;
-{
-
- return (0);
-}
-
-/*ARGSUSED*/
-int
-mmrw(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- register vm_offset_t o, v;
- register int c;
- register struct iovec *iov;
- int error = 0;
- static int physlock;
-
- if (minor(dev) == 0) {
- /* lock against other uses of shared vmmap */
- while (physlock > 0) {
- physlock++;
- error = tsleep((caddr_t)&physlock, PZERO | PCATCH,
- "mmrw", 0);
- if (error)
- return (error);
- }
- physlock = 1;
- }
- while (uio->uio_resid > 0 && error == 0) {
- iov = uio->uio_iov;
- if (iov->iov_len == 0) {
- uio->uio_iov++;
- uio->uio_iovcnt--;
- if (uio->uio_iovcnt < 0)
- panic("mmrw");
- continue;
- }
- switch (minor(dev)) {
-
-/* minor device 0 is physical memory */
- case 0:
- v = uio->uio_offset;
- pmap_enter(pmap_kernel(), (vm_offset_t)memhook,
- trunc_page(v), uio->uio_rw == UIO_READ ?
- VM_PROT_READ : VM_PROT_WRITE, TRUE);
- o = uio->uio_offset & PGOFSET;
- c = min(uio->uio_resid, (int)(NBPG - o));
- error = uiomove((caddr_t)memhook + o, c, uio);
- pmap_remove(pmap_kernel(), (vm_offset_t)memhook,
- (vm_offset_t)memhook + NBPG);
- continue;
-
-/* minor device 1 is kernel memory */
- case 1:
- v = uio->uio_offset;
- c = min(iov->iov_len, MAXPHYS);
- if (!kernacc((caddr_t)v, c,
- uio->uio_rw == UIO_READ ? B_READ : B_WRITE))
- return (EFAULT);
- error = uiomove((caddr_t)v, c, uio);
- continue;
-
-/* minor device 2 is EOF/RATHOLE */
- case 2:
- if (uio->uio_rw == UIO_WRITE)
- uio->uio_resid = 0;
- return (0);
-
-/* minor device 3 (/dev/zero) is source of nulls on read, rathole on write */
- case 3:
- if (uio->uio_rw == UIO_WRITE) {
- c = iov->iov_len;
- break;
- }
- if (zeropage == NULL) {
- zeropage = (caddr_t)
- malloc(CLBYTES, M_TEMP, M_WAITOK);
- bzero(zeropage, CLBYTES);
- }
- c = min(iov->iov_len, CLBYTES);
- error = uiomove(zeropage, c, uio);
- continue;
-
- default:
- return (ENXIO);
- }
- if (error)
- break;
- iov->iov_base += c;
- iov->iov_len -= c;
- uio->uio_offset += c;
- uio->uio_resid -= c;
- }
- if (minor(dev) == 0) {
-/*unlock:*/
- if (physlock > 1)
- wakeup((caddr_t)&physlock);
- physlock = 0;
- }
- return (error);
-}
-
-int
-mmmmap(dev, off, prot)
- dev_t dev;
- int off, prot;
-{
- struct proc *p = curproc; /* XXX */
-
- switch (minor(dev)) {
-/* minor device 0 is physical memory */
- case 0:
- if (off > ctob(physmem) &&
- suser(p->p_ucred, &p->p_acflag) != 0)
- return -1;
- return arm_byte_to_page(off);
-
-/* minor device 1 is kernel memory */
- case 1:
- /* XXX - writability, executability checks? */
- if (!kernacc((caddr_t)off, NBPG, B_READ))
- return -1;
- return arm_byte_to_page(vtophys(off));
-
- default:
- return -1;
- }
-}
-
-int
-mmioctl(dev, cmd, data, flags, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flags;
- struct proc *p;
-{
- return (EOPNOTSUPP);
-}
diff --git a/sys/arch/arm32/arm32/memset.S b/sys/arch/arm32/arm32/memset.S
deleted file mode 100644
index 99f32875ba3..00000000000
--- a/sys/arch/arm32/arm32/memset.S
+++ /dev/null
@@ -1,136 +0,0 @@
-/* $OpenBSD: memset.S,v 1.2 2000/03/03 00:54:46 todd Exp $ */
-/* $NetBSD: memset.S,v 1.1 1996/01/31 23:16:35 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- * Copyright (c) 1995 Brini.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * memset.S
- *
- * optimized memset function
- *
- * Created : 16/05/95
- * Last updated : 16/05/95
- *
- */
-
-sp .req r13
-lr .req r14
-pc .req r15
-
-.text
-
- .global _memset
-
-/* Sets a block of memory to the specified value
- *
- * r0 - address
- * r1 - byte to write
- * r2 - number of bytes to write
- */
-
-_memset:
- and r1, r1, #0x000000ff /* We write bytes */
-
- cmp r2, #0x00000004 /* Do we have less than 4 bytes */
- blt memset_lessthanfour
-
-/* Ok first we will word align the address */
-
- ands r3, r0, #0x00000003 /* Get the bottom two bits */
- beq memset_addraligned /* The address is word aligned */
-
- rsb r3, r3, #0x00000004
- sub r2, r2, r3
- cmp r3, #0x00000002
- strb r1, [r0], #0x0001 /* Set 1 byte */
- strgeb r1, [r0], #0x0001 /* Set another byte */
- strgtb r1, [r0], #0x0001 /* and a third */
-
- cmp r2, #0x00000004
- blt memset_lessthanfour
-
-/* Now we must be word aligned */
-
-memset_addraligned:
-
- orr r3, r1, r1, lsl #8 /* Repeat the byte into a word */
- orr r3, r3, r3, lsl #16
-
-/* We know we have at least 4 bytes ... */
-
- cmp r2, #0x00000020 /* If less than 32 then use words */
- blt memset_lessthan32
-
-/* We have at least 32 so lets use quad words */
-
- stmfd sp!, {r4-r6} /* Store registers */
- mov r4, r3 /* Duplicate data */
- mov r5, r3
- mov r6, r3
-
-memset_loop16:
- stmia r0!, {r3-r6} /* Store 16 bytes */
- sub r2, r2, #0x00000010 /* Adjust count */
- cmp r2, #0x00000010 /* Still got at least 16 bytes ? */
- bgt memset_loop16
-
- ldmfd sp!, {r4-r6} /* Restore registers */
-
-/* Do we need to set some words as well ? */
-
- cmp r2, #0x00000004
- blt memset_lessthanfour
-
-/* Have either less than 16 or less than 32 depending on route taken */
-
-memset_lessthan32:
-
-/* We have at least 4 bytes so copy as words */
-
-memset_loop4:
- str r3, [r0], #0x0004
- sub r2, r2, #0x0004
- cmp r2, #0x00000004
- bge memset_loop4
-
-memset_lessthanfour:
- cmp r2, #0x00000000
- moveq pc, lr /* Zero length so exit */
-
- cmp r2, #0x00000002
- strb r1, [r0], #0x0001 /* Set 1 byte */
- strgeb r1, [r0], #0x0001 /* Set another byte */
- strgtb r1, [r0], #0x0001 /* and a third */
-
- mov pc, lr /* Exit */
diff --git a/sys/arch/arm32/arm32/pmap.c b/sys/arch/arm32/arm32/pmap.c
deleted file mode 100644
index 41957167ef6..00000000000
--- a/sys/arch/arm32/arm32/pmap.c
+++ /dev/null
@@ -1,2571 +0,0 @@
-/* $NetBSD: pmap.c,v 1.4 1996/03/13 21:25:04 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1996 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * pmap.c
- *
- * Machine dependant vm stuff
- *
- * Created : 20/09/94
- */
-
-/*
- * The dram block info is currently referenced from the bootconfig.
- * This should be placed in a separate structure
- *
- * Need a pmap_map() routine for multiple pmap_enter() calls
- *
- * sob sob sob - been looking at other pmap code ... don't think
- * I should have base mine of the i386 code ...
- */
-
-#define PMAPDEBUG 0
-
-/*
- * Special compilation symbols
- * DEBUG_PMAP
- * PMAPDEBUG
- */
-
-/* Include header files */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/malloc.h>
-#include <sys/msgbuf.h>
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-
-#include <machine/bootconfig.h>
-#include <machine/pmap.h>
-#include <machine/pcb.h>
-#include <machine/param.h>
-#include <machine/katelib.h>
-#include <machine/vidc.h>
-
-#include "hydrabus.h"
-
-/*#define bcopy_page(s, d) bcopy(s, d, NBPG)*/
-/*#define bzero_page(s) bzero(s, NBPG)*/
-#define bzero_pagedir(s) bzero(s, PD_SIZE)
-
-#define VM_KERNEL_VIRTUAL_MIN KERNEL_VM_BASE + 0x00000000
-#define VM_KERNEL_VIRTUAL_MAX KERNEL_VM_BASE + 0x01ffffff
-
-#define pmap_pde(m, v) (&((m)->pm_pdir[((vm_offset_t)(v) >> PDSHIFT)&4095]))
-
-#define pmap_pte_pa(pte) (*(pte) & PG_FRAME)
-#define pmap_pde_v(pde) (*(pde) != 0)
-#define pmap_pte_v(pte) (*(pte) != 0)
-
-#define PT_KS 0x80
-
-int pmap_debug_level = -2;
-
-struct pmap kernel_pmap_store;
-pmap_t kernel_pmap;
-
-pagehook_t page_hook0;
-pagehook_t page_hook1;
-char *memhook;
-pt_entry_t msgbufpte;
-
-u_char *pmap_attributes = NULL;
-pv_entry_t pv_table = NULL;
-TAILQ_HEAD(pv_page_list, pv_page) pv_page_freelist;
-int pv_nfree = 0;
-
-vm_size_t npages;
-
-extern vm_offset_t physical_start;
-extern vm_offset_t physical_freestart;
-extern vm_offset_t physical_end;
-extern vm_offset_t physical_freeend;
-extern int physical_memoryblock;
-extern unsigned int free_pages;
-extern vm_offset_t pagetables_start;
-extern int max_processes;
-extern pt_entry_t kernel_pt_table[9];
-extern videomemory_t videomemory;
-
-extern struct proc *proc1;
-
-struct pmap **pagedirectories;
-
-vm_offset_t virtual_start;
-vm_offset_t virtual_end;
-
-vm_offset_t avail_start;
-vm_offset_t avail_end;
-
-typedef struct {
- vm_offset_t physical;
- vm_offset_t virtual;
-} pv_addr_t;
-
-extern pv_addr_t kernelstack;
-#if NHYDRABUS > 0
-extern pv_addr_t hydrascratch;
-#endif
-
-#define ALLOC_PAGE_HOOK(x, s) \
- x.va = virtual_start; \
- x.pte = (pt_entry_t *)pmap_pte(kernel_pmap, virtual_start); \
- virtual_start += s;
-
-
-/* Local variables (not used outside this file) */
-
-/* Local function prototypes (not used outside this file) */
-
-pt_entry_t *pmap_pte __P((pmap_t /*pmap*/, vm_offset_t /*va*/));
-int pmap_page_index __P((vm_offset_t /*pa*/));
-void map_pagetable __P((vm_offset_t /*pagetable*/, vm_offset_t /*va*/,
- vm_offset_t /*pa*/, unsigned int /*flags*/));
-void pmap_copy_on_write __P((vm_offset_t /*pa*/));
-
-void bzero_page __P((vm_offset_t));
-void bcopy_page __P((vm_offset_t, vm_offset_t));
-
-
-/* Function to set the debug level of the pmap code */
-
-void
-pmap_debug(level)
- int level;
-{
- pmap_debug_level = level;
- printf("pmap_debug: level=%d\n", pmap_debug_level);
-}
-
-
-/*
- * Functions for manipluation pv_entry structures. These are used to keep a
- * record of the mappings of virtual addresses and the associated physical
- * pages.
- */
-
-struct pv_entry *
-pmap_alloc_pv()
-{
- struct pv_page *pvp;
- struct pv_entry *pv;
- int i;
-
-/*
- * Do we have any free pv_entry structures left ?
- * If not allocate a page of them
- */
-
- if (pv_nfree == 0) {
- pvp = (struct pv_page *)kmem_alloc(kernel_map, NBPG);
- if (pvp == 0)
- panic("pmap_alloc_pv: kmem_alloc() failed");
- pvp->pvp_pgi.pgi_freelist = pv = &pvp->pvp_pv[1];
- for (i = NPVPPG - 2; i; i--, pv++)
- pv->pv_next = pv + 1;
- pv->pv_next = 0;
- pv_nfree += pvp->pvp_pgi.pgi_nfree = NPVPPG - 1;
- TAILQ_INSERT_HEAD(&pv_page_freelist, pvp, pvp_pgi.pgi_list);
- pv = &pvp->pvp_pv[0];
- } else {
- --pv_nfree;
- pvp = pv_page_freelist.tqh_first;
- if (--pvp->pvp_pgi.pgi_nfree == 0) {
- TAILQ_REMOVE(&pv_page_freelist, pvp, pvp_pgi.pgi_list);
- }
- pv = pvp->pvp_pgi.pgi_freelist;
-#ifdef DIAGNOSTIC
- if (pv == 0)
- panic("pmap_alloc_pv: pgi_nfree inconsistent");
-#endif
- pvp->pvp_pgi.pgi_freelist = pv->pv_next;
- }
- return pv;
-}
-
-void
-pmap_free_pv(pv)
- struct pv_entry *pv;
-{
- register struct pv_page *pvp;
-
- pvp = (struct pv_page *) trunc_page(pv);
- switch (++pvp->pvp_pgi.pgi_nfree) {
- case 1:
- TAILQ_INSERT_TAIL(&pv_page_freelist, pvp, pvp_pgi.pgi_list);
- default:
- pv->pv_next = pvp->pvp_pgi.pgi_freelist;
- pvp->pvp_pgi.pgi_freelist = pv;
- ++pv_nfree;
- break;
- case NPVPPG:
- pv_nfree -= NPVPPG - 1;
- TAILQ_REMOVE(&pv_page_freelist, pvp, pvp_pgi.pgi_list);
- kmem_free(kernel_map, (vm_offset_t)pvp, NBPG);
- break;
- }
-}
-
-
-void
-pmap_collect_pv()
-{
- struct pv_page_list pv_page_collectlist;
- struct pv_page *pvp, *npvp;
- struct pv_entry *ph, *ppv, *pv, *npv;
- int s;
-
- TAILQ_INIT(&pv_page_collectlist);
-
- for (pvp = pv_page_freelist.tqh_first; pvp; pvp = npvp) {
- if (pv_nfree < NPVPPG)
- break;
- npvp = pvp->pvp_pgi.pgi_list.tqe_next;
- if (pvp->pvp_pgi.pgi_nfree > NPVPPG / 3) {
- TAILQ_REMOVE(&pv_page_freelist, pvp, pvp_pgi.pgi_list);
- TAILQ_INSERT_TAIL(&pv_page_collectlist, pvp, pvp_pgi.pgi_list);
- pv_nfree -= pvp->pvp_pgi.pgi_nfree;
- pvp->pvp_pgi.pgi_nfree = -1;
- }
- }
-
- if (pv_page_collectlist.tqh_first == 0)
- return;
-
- for (ph = &pv_table[npages - 1]; ph >= &pv_table[0]; ph--) {
- if (ph->pv_pmap == 0)
- continue;
- s = splimp();
- for (ppv = ph; (pv = ppv->pv_next) != 0; ) {
- pvp = (struct pv_page *) trunc_page(pv);
- if (pvp->pvp_pgi.pgi_nfree == -1) {
- pvp = pv_page_freelist.tqh_first;
- if (--pvp->pvp_pgi.pgi_nfree == 0) {
- TAILQ_REMOVE(&pv_page_freelist, pvp, pvp_pgi.pgi_list);
- }
- npv = pvp->pvp_pgi.pgi_freelist;
-#ifdef DIAGNOSTIC
- if (npv == 0)
- panic("pmap_collect_pv: pgi_nfree inconsistent");
-#endif
- pvp->pvp_pgi.pgi_freelist = npv->pv_next;
- *npv = *pv;
- ppv->pv_next = npv;
- ppv = npv;
- } else
- ppv = pv;
- }
- splx(s);
- }
-
- for (pvp = pv_page_collectlist.tqh_first; pvp; pvp = npvp) {
- npvp = pvp->pvp_pgi.pgi_list.tqe_next;
- kmem_free(kernel_map, (vm_offset_t)pvp, NBPG);
- }
-}
-
-
-/*__inline*/ int
-pmap_enter_pv(pmap, va, pind, flags)
- pmap_t pmap;
- vm_offset_t va;
- int pind;
- u_int flags;
-{
- register struct pv_entry *pv, *npv;
- u_int s;
-
- if (!pv_table)
- return(1);
-
- s = splimp();
- pv = &pv_table[pind];
-
- if (pmap_debug_level >= 5)
- printf("pmap_enter_pv: pind=%08x pv %08x: %08x/%08x/%08x\n",
- pind, (int) pv, (int) pv->pv_va, (int) pv->pv_pmap, (int) pv->pv_next);
-
- if (pv->pv_pmap == NULL) {
-/*
- * No entries yet, use header as the first entry
- */
- pv->pv_va = va;
- pv->pv_pmap = pmap;
- pv->pv_next = NULL;
- pv->pv_flags = flags;
- splx(s);
- return(1);
- } else {
-/*
- * There is at least one other VA mapping this page.
- * Place this entry after the header.
- */
-/*#ifdef DEBUG*/
- for (npv = pv; npv; npv = npv->pv_next)
- if (pmap == npv->pv_pmap && va == npv->pv_va) {
-/*
- * HACK HACK HACK - The system vector page is wired in with pmap_enter()
- * this mapping should be deleted during switch_exit() but at the moment it
- * is not so a duplicate mapping is possible. For the moment we just updated
- * flags and exit ... This should work as it is a special case.
- */
- npv->pv_va = va;
- npv->pv_pmap = pmap;
- npv->pv_flags = flags;
- printf("pmap_enter_pv: already in pv_tab pind=%08x pv %08x: %08x/%08x/%08x",
- pind, (int) pv, (int) pv->pv_va, (int) pv->pv_pmap, (int) pv->pv_next);
- splx(s);
- return(0);
-/* } else
- panic("pmap_enter_pv: already in pv_tab pind=%08x pv %08x: %08x/%08x/%08x",
- pind, (int) pv, (int) pv->pv_va, (int) pv->pv_pmap, (int) pv->pv_next);*/
- }
-/*#endif*/
- npv = pmap_alloc_pv();
- npv->pv_va = va;
- npv->pv_pmap = pmap;
- npv->pv_flags = flags;
- npv->pv_next = pv->pv_next;
- pv->pv_next = npv;
- }
- splx(s);
- return(0);
-}
-
-
-/* __inline*/ u_int
-pmap_remove_pv(pmap, va, pind)
- pmap_t pmap;
- vm_offset_t va;
- int pind;
-{
- register struct pv_entry *pv, *npv;
- u_int s;
- u_int flags = 0;
-
- if (pv_table == NULL)
- return(0);
-
-/*
- * Remove from the PV table (raise IPL since we
- * may be called at interrupt time).
- */
-
- s = splimp();
- pv = &pv_table[pind];
-
-/* if (va == 0xefbfe000 || va == 0xefbff000 || va == 0xf1003000 || va == 0xf1004000)
- printf("pmap_remove_pv(%08x, %08x, %d)\n",
- (u_int)pmap, (u_int)va, pind);*/
-
-/*
- * If it is the first entry on the list, it is actually
- * in the header and we must copy the following entry up
- * to the header. Otherwise we must search the list for
- * the entry. In either case we free the now unused entry.
- */
-
- if (pmap == pv->pv_pmap && va == pv->pv_va) {
- npv = pv->pv_next;
- if (npv) {
- *pv = *npv;
-
- flags = npv->pv_flags;
-
- pmap_attributes[pind] |= flags & (PT_M | PT_H);
-
- pmap_free_pv(npv);
- } else
- pv->pv_pmap = NULL;
- } else {
- for (npv = pv->pv_next; npv; pv = npv, npv = npv->pv_next) {
- if (pmap == npv->pv_pmap && va == npv->pv_va)
- break;
- }
- if (npv) {
- pv->pv_next = npv->pv_next;
-
- flags = npv->pv_flags;
- pmap_attributes[pind] |= flags & (PT_M | PT_H);
-
- pmap_free_pv(npv);
- }
- }
- splx(s);
- return(flags);
-}
-
-
-/*__inline */ u_int
-pmap_modify_pv(pmap, va, pind, bic_mask, eor_mask)
- pmap_t pmap;
- vm_offset_t va;
- int pind;
- u_int bic_mask;
- u_int eor_mask;
-{
- register struct pv_entry *pv, *npv;
- u_int s;
- u_int flags;
-
- if (pmap_debug_level >= 5)
- printf("pmap_modify_pv: pmap=%08x va=%08x pi=%08x bic_mask=%08x eor_mask=%08x\n",
- (int) pmap, (int) va, pind, bic_mask, eor_mask);
-
- if (!pv_table)
- return(0);
-
-#ifdef DIAGNOSTIC
- if (pind > 0x00010000 || pind < 0) {
- traceback();
- panic("pmap_modify_pv: pind out of range pind = %08x va=%08x", pind, va);
- }
-#endif
-
- s = splimp();
- pv = &pv_table[pind];
-
- if (pmap_debug_level >= 5)
- printf("pmap_modify_pv: pind=%08x pv %08x: %08x/%08x/%08x/%08x ",
- pind, (int) pv, (int)pv->pv_va, (int)pv->pv_pmap, (int)pv->pv_next,
- pv->pv_flags);
-
-/*
- * There is at least one VA mapping this page.
- */
-
- for (npv = pv; npv; npv = npv->pv_next) {
- if (pmap == npv->pv_pmap && va == npv->pv_va) {
- flags = npv->pv_flags;
- npv->pv_flags = ((flags & ~bic_mask) ^ eor_mask);
- if (pmap_debug_level >= 0)
- printf("done flags=%08x\n", flags);
- splx(s);
- return(flags);
- }
- }
-
- if (pmap_debug_level >= 0)
- printf("done.\n");
- splx(s);
- return(0);
-}
-
-
-/*
- * Used to map a range of physical addresses into kernel
- * virtual address space.
- *
- * For now, VM is already on, we only need to map the
- * specified memory.
- */
-
-vm_offset_t
-pmap_map(va, spa, epa, prot)
- vm_offset_t va, spa, epa;
- int prot;
-{
- while (spa < epa) {
- pmap_enter(pmap_kernel(), va, spa, prot, FALSE);
- va += NBPG;
- spa += NBPG;
- }
- return(va);
-}
-
-
-/*
- * void pmap_bootstrap(pd_entry_t *kernel_l1pt)
- *
- * bootstrap the pmap system. This is called from initarm and allows
- * the pmap system to initailise any structures it requires.
- *
- * Currently this sets up the kernel_pmap that is statically allocated
- * and also allocated virtual addresses for certain page hooks.
- * Currently the only one page hook is allocated that is used
- * to zero physical pages of memory.
- * It also initialises the start and end address of the kernel data space.
- */
-
-void
-pmap_bootstrap(kernel_l1pt)
- pd_entry_t *kernel_l1pt;
-{
- kernel_pmap = &kernel_pmap_store;
-
- kernel_pmap->pm_pdir = kernel_l1pt;
- kernel_pmap->pm_pptpt = kernel_pt_table[2];
- simple_lock_init(&kernel_pmap->pm_lock);
- kernel_pmap->pm_count = 1;
-
- virtual_start = VM_KERNEL_VIRTUAL_MIN;
- virtual_end = VM_KERNEL_VIRTUAL_MAX;
-
- ALLOC_PAGE_HOOK(page_hook0, NBPG);
- ALLOC_PAGE_HOOK(page_hook1, NBPG);
-
-/* The mem special device needs a virtual hook but we don't need a pte */
-
- memhook = (char *)virtual_start;
- virtual_start += NBPG;
-
- msgbufp = (struct msgbuf *)virtual_start;
- msgbufpte = (pt_entry_t)pmap_pte(kernel_pmap, virtual_start);
- virtual_start += round_page(sizeof(struct msgbuf));
-
-#if PMAPDEBUG > 0
- printf("pmap_bootstrap: page_hook = V%08x pte = V%08x\n",
- page_hook_addr0, page_hook_pte0);
-#endif
-
-#if NHYDRABUS > 0
- hydrascratch.virtual = virtual_start;
- virtual_start += NBPG;
-
- *((pt_entry_t *)pmap_pte(kernel_pmap, hydrascratch.virtual)) = L2_PTE_NC(hydrascratch.physical, AP_KRW);
- tlbflush();
-#endif
-}
-
-
-/*
- * void pmap_init(void)
- *
- * Initialize the pmap module.
- * Called by vm_init() in vm/vm_init.c in order to initialise
- * any structures that the pmap system needs to map virtual memory.
- */
-
-extern int physmem;
-
-void
-pmap_init()
-{
- vm_size_t s;
- vm_offset_t addr;
-
-/* printf("pmap_init:\n");*/
-
- npages = pmap_page_index(physical_freeend - 1) + 1;
- printf("Number of pages to handle = %ld\n", npages);
-
-/*
- * Set the available memory vars - These do not map to real memory
- * addresses. They are used by ps for %mem calculations.
- */
-
-/* avail_start = pmap_page_index(physical_start) * NBPG;
- avail_end = pmap_page_index(physical_freeend) * NBPG;*/
- avail_start = 0;
- avail_end = physmem * NBPG;
-
- s = (vm_size_t) (sizeof(struct pv_entry) * npages + npages);
-/* printf("pv_table size = %08x\n", s);*/
- s = round_page(s);
- addr = (vm_offset_t) kmem_alloc(kernel_map, s);
-/* printf("addr = %08x", addr);*/
- pv_table = (pv_entry_t) addr;
- addr += sizeof(struct pv_entry) * npages;
- pmap_attributes = (char *) addr;
-/* printf(" attributes = %08x\n", pmap_attributes);*/
-
-/* Ok currently there are some difficulties in allocating the process
- * page directories on the fly. This is because the page directories
- * are 16KB in size and there are no garentees that we can get 16KB
- * continuous physical memory starting on a 16KB boundry from
- * kmem_alloc() etc.
- *
- * For the moment a number of pages will have been reserved at the top
- * of the physical memory map.
- */
-
- s = max_processes * sizeof(struct pmap *);
- pagedirectories = (struct pmap **)kmem_alloc(kernel_map, s);
-
-#if PMAPDEBUG > 0
- printf("pagedirectories pointers at %08x\n", pagedirectories);
-#endif
-
- bzero(pagedirectories, s);
- printf("%dKB reserved for L1 page tables\n",
- max_processes * NBPG * 4 / 1024);
-}
-
-
-/*
- * Create and return a physical map.
- *
- * If the size specified for the map is zero, the map is an actual physical
- * map, and may be referenced by the hardware.
- *
- * If the size specified is non-zero, the map will be used in software only,
- * and is bounded by that size.
- */
-
-pmap_t
-pmap_create(size)
- vm_size_t size;
-{
- register pmap_t pmap;
-
-/*
- * Software use map does not need a pmap
- */
-
- if (size) return NULL;
-
-/* Allocate memory for pmap structure and zero it */
-/* XXX: I assume waiting here us ok */
-
- pmap = (pmap_t) malloc(sizeof *pmap, M_VMPMAP, M_WAITOK);
- bzero(pmap, sizeof(*pmap));
-
-/* Now init the machine part of the pmap */
-
- pmap_pinit(pmap);
- return(pmap);
-}
-
-
-/*
- * Initialize a preallocated and zeroed pmap structure,
- * such as one in a vmspace structure.
- *
- * MAJOR rewrite pending
- */
-
-int
-pmap_allocpagedir(pmap)
- struct pmap *pmap;
-{
- int loop;
- vm_offset_t pd;
- pt_entry_t *pte;
-
- if (pmap_debug_level >= 0)
- printf("pmap_allocpagedir: pmap=%08x\n", (int)pmap);
-
-/*
- * No need to allocate page table space yet but we do need a
- * valid page directory table.
- */
-
-/* Ok we need a 16KB aligned check of memory */
-
- for (loop = 0; loop < max_processes; ++loop) {
-/* Locate a free page directory */
-
- if (pagedirectories[loop] == 0) {
-/* Register the pmap for this page directory */
-
- pagedirectories[loop] = pmap;
-
-/* Calculate the virtual address of the page directory */
-
- pmap->pm_pdir = (pd_entry_t *) ((PAGE_DIRS_BASE
- + PD_SIZE) + loop * PD_SIZE);
- pd = (vm_offset_t)(pagetables_start + loop * PD_SIZE);
-#if PMAP_DEBUG > 0
- printf("pmap_pinit: page dir at V%08x P%08x\n",
- pmap->pm_pdir, pde);
-#endif
-
-/* Calculate the address of the page table entry needed to map this page dir */
-
- pte = (pt_entry_t *)(PROCESS_PAGE_TBLS_BASE
- + ((unsigned int)pmap->pm_pdir >> (PGSHIFT-2)));
-
-/* See if it is already mapped */
-
- if (*(pte + 0) != 0 || *(pte + 1) != 0
- || *(pte + 2) != 0 || *(pte + 3) != 0) {
- if (pmap_debug_level >= 0)
- printf("pmap_pinit = V%08x (%08x) (%08x) (%08x) (%08x)\n",
- (int) pte, *(pte+0), *(pte+1),
- *(pte+2), *(pte+3));
- }
-
-/* Hook this page directory into the memory map */
-
- *(pte + 0) = L2_PTE((pd + (0 * NBPG)) & PG_FRAME, AP_KRW);
- *(pte + 1) = L2_PTE((pd + (1 * NBPG)) & PG_FRAME, AP_KRW);
- *(pte + 2) = L2_PTE((pd + (2 * NBPG)) & PG_FRAME, AP_KRW);
- *(pte + 3) = L2_PTE((pd + (3 * NBPG)) & PG_FRAME, AP_KRW);
-
-#if PMAP_DEBUG > 0
- printf("pmap_pinit = V%08x (%08x) (%08x) (%08x) (%08x)\n",
- pte, *(pte+0), *(pte+1), *(pte+2), *(pte+3));
-#endif
-
-/* Flush the TLB so that the page directory is accessible */
-
- tlbflush();
-
-/* Clear it down */
-
- bzero_pagedir(pmap->pm_pdir);
-
-/* Duplicate the kernel mapping i.e. all mappings 0xf0000000 + */
-
- bcopy((char *)kernel_pmap->pm_pdir + 0x3c00,
- (char *)pmap->pm_pdir + 0x3c00, 0x400);
-
-/* Borrow the kernel's system page as well */
-
-/* pmap->pm_pdir[0] = kernel_pmap->pm_pdir[0];
- pmap->pm_pdir[1] = kernel_pmap->pm_pdir[1];
- pmap->pm_pdir[2] = kernel_pmap->pm_pdir[2];
- pmap->pm_pdir[3] = kernel_pmap->pm_pdir[3];*/
-
-/*printf("L1 pagetable V%08x, P%08x\n", pmap->pm_pdir, pd);*/
-
-/* Allocate a page table to map all the page tables for this pmap */
-
- if (pmap->pm_vptpt == 0) {
- pmap->pm_vptpt = kmem_alloc(kernel_map, NBPG);
- pmap->pm_pptpt = pmap_extract(kernel_pmap,
- pmap->pm_vptpt) & PG_FRAME;
- }
-
-/* printf("pagetable = V%08x P%08x\n", pagetable,
- pmap_extract(kernel_pmap, pagetable));
- printf("L1 addr = %08x\n",
- &((pd_entry_t **)pmap->pm_pdir)[0xefc]);
-*/
-
-/* Wire in this page table */
-
- pmap->pm_pdir[0xefc] = L1_PTE(pmap->pm_pptpt + 0x000);
- pmap->pm_pdir[0xefd] = L1_PTE(pmap->pm_pptpt + 0x400);
- pmap->pm_pdir[0xefe] = L1_PTE(pmap->pm_pptpt + 0x800);
- pmap->pm_pdir[0xeff] = L1_PTE(pmap->pm_pptpt + 0xc00);
-
-/* printf("copying %08x\n", (PROCESS_PAGE_TBLS_BASE
- + (PROCESS_PAGE_TBLS_BASE >> (PGSHIFT-2)) + 0xf00));
-*/
-
-/*
- * Map the kernel page tables for 0xf0000000 + and 0x00000000 into
- * the page table used to map the pmap's page tables
- */
-
- bcopy((char *)(PROCESS_PAGE_TBLS_BASE
- + (PROCESS_PAGE_TBLS_BASE >> (PGSHIFT-2)) + 0xf00),
- (char *)pmap->pm_vptpt + 0xf00, 0x100);
-/* bcopy((char *)(PROCESS_PAGE_TBLS_BASE
- + (PROCESS_PAGE_TBLS_BASE >> (PGSHIFT-2)) + 0x000),
- (char *)pmap->pm_vptpt + 0x000, 0x004);*/
-
-/* Add a self reference reference */
-
- *((pt_entry_t *)(pmap->pm_vptpt + 0xefc)) =
- L2_PTE(pmap->pm_pptpt, AP_KRWUR);
-
-/*
- if (pmap_debug_level >= 0) {
- printf("::::%08x %08x\n",
- ((pt_entry_t *)(pmap->pm_vptpt + 0xefc)),
- &((pt_entry_t *)pmap->pm_vptpt)[0xefc >> 2]);
- }
-*/
-
-/*
- * Now we get nasty. We need to map the page directory to a standard address
- * in the memory map. This means we can easily find the active page directory.
- * This is needed by pmap_pte to hook in an alternate pmap's page tables.
- * This means that a page table is needed in each process to map this memory
- * as the kernel tables cannot be used as they are shared.
- * The HACK is to borrow some of the space in the page table that maps all
- * the pmap page tables.
- * Mapping a 16KB page directory into that means that a 16MB chunk of the
- * memory map will no longer be mappable.
- * Eventually a chuck of user space (at the top end) could be reserved for
- * this but for the moment the 16MB block at 0xf5000000 is not allocated and
- * so has become reserved for this processes.
- */
-
- *((pt_entry_t *)(pmap->pm_vptpt + 0xf50)) =
- L2_PTE(pd + 0x0000, AP_KRW);
- *((pt_entry_t *)(pmap->pm_vptpt + 0xf54)) =
- L2_PTE(pd + 0x1000, AP_KRW);
- *((pt_entry_t *)(pmap->pm_vptpt + 0xf58)) =
- L2_PTE(pd + 0x2000, AP_KRW);
- *((pt_entry_t *)(pmap->pm_vptpt + 0xf5c)) =
- L2_PTE(pd + 0x3000, AP_KRW);
-
- pmap->pm_count = 1;
- simple_lock_init(&pmap->pm_lock);
- return(0);
- }
- }
-
- return(1);
-}
-
-
-/*
- * Initialize a preallocated and zeroed pmap structure,
- * such as one in a vmspace structure.
- *
- * MAJOR rewrite pending
- */
-
-void
-pmap_pinit(pmap)
- struct pmap *pmap;
-{
- if (pmap_debug_level >= 0)
- printf("pmap_pinit: pmap=%08x\n", (int)pmap);
-
-/* Keep looping until we succeed in allocating a page directory */
-
- while (pmap_allocpagedir(pmap) != 0) {
-/*
- * Ok all the allocated L1 page tables are in use so we should sleep for
- * a while. We only sleep for 10 secs at most. Although we will be wakened
- * if a slot became available it could be possible for things to jamup with
- * every process waiting on a process that is waiting for a page table.
- * If we time out then it means that all the page tables are in use and
- * there has not be a process termination in 10 secs i.e. possible deadlock
- */
-
-/*
- * The snag with this routine is it is not allowed to fail. If we
- * do detect a possible deadlock then we can report it. The Q is what to
- * do next. We could start randomly killing processes or process groups.
- * Since this process is only part formed it is not easy to kill. The
- * best thing may be to kill it parent.
- */
-
-/* What we should do here is start swapping out processes. That way
- * the page directory for the process will be released.
- * The pagedaemon will swap out processes but only in low memory conditions.
- * Lack of page directories does not count so we will have to swapout
- * processes ourselves.
- */
-
- if (tsleep((caddr_t)pagedirectories, PZERO, "l1ptwait", 1000)
- == EWOULDBLOCK)
- printf("Warning: Possible process deadlock due to shortage of L1 page tables\n");
- }
-}
-
-
-/*
- * Retire the given physical map from service.
- * Should only be called if the map contains no valid mappings.
- */
-
-void
-pmap_destroy(pmap)
- pmap_t pmap;
-{
- int count;
-
- if (pmap_debug_level >= 0)
- printf("pmap_destroy: pmap = %08x\n", (int) pmap);
-
- if (pmap == NULL)
- return;
-
- simple_lock(&pmap->pm_lock);
- count = --pmap->pm_count;
- simple_unlock(&pmap->pm_lock);
- if (count == 0) {
- pmap_release(pmap);
- free((caddr_t)pmap, M_VMPMAP);
- } else
- printf("pmap_destroy: pm_count=%d\n", count);
-}
-
-
-void
-pmap_freepagedir(pmap)
- register pmap_t pmap;
-{
- int index;
-
- index = (((u_int) pmap->pm_pdir) - PAGE_DIRS_BASE - PD_SIZE) / PD_SIZE;
- if (pagedirectories[index] != pmap)
- panic("pm_pdir inconsistancy found");
-
- pagedirectories[index] = 0;
-
-/* Wake up any sleeping processes waiting for a l1 page table */
-
- wakeup((caddr_t)pagedirectories);
-}
-
-
-/*
- * Release any resources held by the given physical map.
- * Called when a pmap initialized by pmap_pinit is being released.
- * Should only be called if the map contains no valid mappings.
- */
-
-void
-pmap_release(pmap)
- register pmap_t pmap;
-{
- if (pmap_debug_level >= 0)
- printf("pmap_release: pmap=%08x\n", (int) pmap);
-
- if (pmap->pm_count != 1) /* XXX: needs sorting */
- panic("pmap_release count");
-
-/* Free the memory used for the page table mapping */
-
- kmem_free(kernel_map, (vm_offset_t)pmap->pm_vptpt, NBPG);
-
- pmap_freepagedir(pmap);
-}
-
-
-/*
- * void pmap_reference(pmap_t pmap)
- *
- * Add a reference to the specified pmap.
- */
-
-void
-pmap_reference(pmap)
- pmap_t pmap;
-{
- if (pmap == NULL)
- return;
-
- simple_lock(&pmap->pm_lock);
- pmap->pm_count++;
- simple_unlock(&pmap->pm_lock);
-}
-
-
-/*
- * void pmap_virtual_space(vm_offset_t *start, vm_offset_t *end)
- *
- * Return the start and end addresses of the kernel's virtual space.
- * These values are setup in pmap_bootstrap and are updated as pages
- * are allocated.
- */
-
-void
-pmap_virtual_space(start, end)
- vm_offset_t *start;
- vm_offset_t *end;
-{
- *start = virtual_start;
- *end = virtual_end;
-}
-
-
-/*
- * void pmap_pageable(pmap_t pmap, vm_offset_t sva, vm_offset_t eva,
- * boolean_t pageable)
- *
- * Make the specified pages (by pmap, offset) pageable (or not) as requested.
- *
- * A page which is not pageable may not take a fault; therefore, its
- * page table entry must remain valid for the duration.
- *
- * This routine is merely advisory; pmap_enter will specify that these
- * pages are to be wired down (or not) as appropriate.
- */
-
-void
-pmap_pageable(pmap, sva, eva, pageable)
- pmap_t pmap;
- vm_offset_t sva;
- vm_offset_t eva;
- boolean_t pageable;
-{
-/*
- * Ok we can only make the specified pages pageable under the following
- * conditions.
- * 1. pageable == TRUE
- * 2. eva = sva + NBPG
- * 3. the pmap is the kernel_pmap ??? - got this from i386/pmap.c ??
- *
- * right this will get called when making pagetables pageable
- */
-
- if (pmap_debug_level >= 5)
- printf("pmap_pageable: pmap=%08x sva=%08x eva=%08x p=%d\n",
- (int) pmap, (int) sva, (int) eva, (int) pageable);
-
- if (pmap == kernel_pmap && pageable && eva == (sva + NBPG)) {
- vm_offset_t pa;
- pt_entry_t *pte;
-
- pte = pmap_pte(pmap, sva);
- if (!pte)
- return;
- if (!pmap_pte_v(pte))
- return;
- pa = pmap_pte_pa(pte);
-
-/*
- * Mark it unmodified to avoid pageout
- */
- pmap_clear_modify(pa);
-
- if (pmap_debug_level >= 0)
- printf("pmap_pageable: ermm can't really do this yet (%08x)!\n",
- (int) sva);
- }
-}
-
-
-void
-pmap_activate(pmap, pcbp)
- pmap_t pmap;
- struct pcb *pcbp;
-{
- if (pmap != NULL) {
-#if PMAP_DEBUG > 1
- printf("pmap_activate: pagedir = V%08x\n", pmap->pm_pdir);
-#endif
- pcbp->pcb_pagedir = (pd_entry_t *)pmap_extract(kernel_pmap,
- (vm_offset_t)pmap->pm_pdir);
- if (pmap_debug_level >= 0)
- printf("pmap_activate: pmap=%08x pcb=%08x pdir=%08x l1=%08x\n",
- (int) pmap, (int) pcbp, (int) pmap->pm_pdir,
- (int) pcbp->pcb_pagedir);
-#if PMAP_DEBUG > 1
- printf("pmap_activate: pagedir = P%08x\n", pcbp->pcb_pagedir);
-#endif
-
- if (pmap == &curproc->p_vmspace->vm_pmap) {
- printf("pmap: Setting TTB\n");
- setttb((u_int)pcbp->pcb_pagedir);
- }
- pmap->pm_pdchanged = FALSE;
- }
-#if PMAP_DEBUG > 1
- printf("pmap_activate: done\n");
-#endif
-}
-
-
-/*
- * void pmap_zero_page(vm_offset_t phys)
- *
- * zero fill the specific physical page. To do this the page must be
- * mapped into the virtual memory. Then bzero can be used to zero it.
- */
-
-void
-pmap_zero_page(phys)
- vm_offset_t phys;
-{
-#if PMAPDEBUG > 4
- printf("pmap_zero_page: pa = %08x", phys);
-#endif
-
-/* Hook the physical page into the memory at our special hook point */
-
- *page_hook0.pte = L2_PTE(phys & PG_FRAME, AP_KRW);
-
-/* Flush the tlb - eventually this can be a purge tlb */
-
- tlbflush();
-
-/* Zero the memory */
-
-#if PMAPDEBUG > 4
- printf(" zeroing...");
-#endif
- bzero_page(page_hook0.va);
- idcflush();
-#if PMAPDEBUG > 4
- printf("done.\n");
-#endif
-}
-
-
-/*
- * void pmap_copy_page(vm_offset_t src, vm_offset_t dest)
- *
- * pmap_copy_page copies the specified page by mapping it into virtual
- * memory and using bcopy to copy its contents.
- */
-
-void
-pmap_copy_page(src, dest)
- vm_offset_t src;
- vm_offset_t dest;
-{
- if (pmap_debug_level >= -1)
- printf("pmap_copy_page: src=P%08x dest=P%08x\n",
- (int) src, (int) dest);
-
-/* Hook the physical page into the memory at our special hook point */
-
- *page_hook0.pte = L2_PTE(src & PG_FRAME, AP_KRW);
- *page_hook1.pte = L2_PTE(dest & PG_FRAME, AP_KRW);
-
-/* Flush the tlb - eventually this can be a purge tlb */
-
- tlbflush();
-
-/* Copy the memory */
-
- bcopy_page(page_hook0.va, page_hook1.va);
- idcflush();
-}
-
-
-/*
- * int pmap_next_page(vm_offset_t *addr)
- *
- * Allocate another physical page returning true or false depending
- * on whether a page could be allocated.
- *
- * MARK - This needs optimising ... look at the amiga version
- */
-
-int
-pmap_next_page(addr)
- vm_offset_t *addr;
-{
- if (physical_freestart == physical_freeend) {
- if (pmap_debug_level >= 0)
- printf("pmap_next_page: Trying to allocate beyond memory\n");
- return(FALSE);
- }
-
- pmap_zero_page(physical_freestart);
- *addr = physical_freestart;
- --free_pages;
-
- physical_freestart += NBPG;
- if (physical_freestart == (bootconfig.dram[physical_memoryblock].address
- + bootconfig.dram[physical_memoryblock].pages * NBPG)) {
- ++physical_memoryblock;
- if (bootconfig.dram[physical_memoryblock].address != 0)
- physical_freestart = bootconfig.dram[physical_memoryblock].address;
- }
-
-#if PMAPDEBUG > 10
- printf("pmap_next_page: Allocated physpage %08x\n", *addr);
- printf("pmap_next_page: Next page is %08x\n", physical_freestart);
-#endif
-
- return(TRUE);
-}
-
-
-/*
- * int pmap_next_phys_page(vm_offset_t *addr)
- *
- * Allocate another physical page returning true or false depending
- * on whether a page could be allocated.
- */
-
-vm_offset_t
-pmap_next_phys_page(addr)
- vm_offset_t addr;
-
-{
- int loop;
-
- if (addr < bootconfig.dram[0].address)
- return(bootconfig.dram[0].address);
-
- loop = 0;
-
- while (bootconfig.dram[loop].address != 0
- && addr > (bootconfig.dram[loop].address + bootconfig.dram[loop].pages * NBPG))
- ++loop;
-
- if (bootconfig.dram[loop].address == 0)
- return(0);
-
- addr += NBPG;
-
- if (addr >= (bootconfig.dram[loop].address + bootconfig.dram[loop].pages * NBPG)) {
- if (bootconfig.dram[loop + 1].address == 0)
- return(0);
- addr = bootconfig.dram[loop + 1].address;
- }
-
- return(addr);
-}
-
-
-/*
- * unsigned int pmap_free_pages(void)
- *
- * Returns the number of free pages the system has.
- * free_pages is set up during initarm and decremented every time a page
- * is allocated.
- */
-
-unsigned int
-pmap_free_pages()
-{
-#if PMAPDEBUG > 0
- printf("pmap_free_pages: %08x pages free\n", free_pages);
-#endif
- return(free_pages);
-}
-
-
-/*
- * int pmap_page_index(vm_offset_t pa)
- *
- * returns a linear index to the physical page. This routine has to take
- * a physical address and work out the corresponding physical page number.
- * There does not appear to be a simple way of doing this as the memory
- * is split into a series of blocks. We search each block to determine
- * which block the physical page is. Once we have scanned the blocks to
- * this point we can calculate the physical page index.
- */
-
-int
-pmap_page_index(pa)
- vm_offset_t pa;
-{
- int index;
- int loop;
-
-#if PMAPDEBUG > 0
- printf("pmap_page_index: pa = P%08x", (int)pa);
-#endif
-
- if (pa < bootconfig.dram[0].address)
- return(-1);
-
- index = 0;
- for (loop = 0; loop < bootconfig.dramblocks; ++loop) {
- if (pa < (bootconfig.dram[loop].address
- + bootconfig.dram[loop].pages * NBPG)) {
- index += (pa - bootconfig.dram[loop].address) >> PGSHIFT;
-#if PMAPDEBUG > 0
- printf(" index = %08x\n" ,index);
-#endif
-#ifdef DIAGNOSTIC
- if (index > 0x00010000 || index < 0)
- printf("pmap_page_index: pa = %08x\n", (int)pa);
-#endif
- return(index);
- } else
- index += bootconfig.dram[loop].pages;
- }
-#if PMAPDEBUG > 0
- printf(" index = Invalid\n");
-#endif
- if (pmap_debug_level >= 1)
- printf("page invalid - no index %08x\n", (int) pa);
- return(-1);
-}
-
-
-void
-pmap_remove(pmap, sva, eva)
- struct pmap *pmap;
- vm_offset_t sva;
- vm_offset_t eva;
-{
- register pt_entry_t *pte = NULL;
- vm_offset_t pa;
- int pind;
- int flush = 0;
-
- idcflush();
-
- if (pmap_debug_level >= 0)
- printf("pmap_remove: pmap=%08x sva=%08x eva=%08x\n", (int) pmap,
- (int) sva, (int) eva);
-
- sva &= PG_FRAME;
- eva &= PG_FRAME;
-
-/*
- * We need to acquire a pointer to a page table page before entering
- * the following loop.
- */
-
- while (sva < eva) {
- pte = pmap_pte(pmap, sva);
- if (pte) break;
- sva = (sva & PD_MASK) + NBPD;
- }
-
- while (sva < eva) {
-/* only check once in a while */
- if ((sva & PT_MASK) == 0) {
- if (!pmap_pde_v(pmap_pde(pmap, sva))) {
-/* We can race ahead here, to the next pde. */
- sva += NBPD;
- pte += arm_byte_to_page(NBPD);
- continue;
- }
- }
-
- if (!pmap_pte_v(pte))
- goto next;
-
- flush = 1;
-
-/*
- * Update statistics
- */
-
-/* Wired bit done below */
-
-/*
- if (pmap_pte_w(pte))
- pmap->pm_stats.wired_count--;
-*/
- pmap->pm_stats.resident_count--;
-
- pa = pmap_pte_pa(pte);
-
-/*
- * Invalidate the PTEs.
- * XXX: should cluster them up and invalidate as many
- * as possible at once.
- */
-
-#ifdef DEBUG
- if (pmapdebug & PDB_REMOVE)
- printf("remove: inv pte at %x(%x) ", pte, *pte);
-#endif
-
- if ((pind = pmap_page_index(pa)) != -1) {
-/* pmap_attributes[pind] |= *pte & (PG_M | PG_U);*/
-/* pmap_remove_pv will update pmap_attributes */
-#ifdef DIAGNOSTIC
- if (pind > 0x00010000 || pind < 0) {
- printf("eerk ! pind=%08x pa=%08x\n", pind, (int) pa);
- panic("The axe has fallen, were dead");
- }
-#endif
- if (pmap_remove_pv(pmap, sva, pind) & PT_W)
- pmap->pm_stats.wired_count--;
- }
-
- *pte = 0;
-next:
- sva += NBPG;
- pte++;
- }
-
- if (flush)
- pmap_update();
-}
-
-
-/*
- * Routine: pmap_remove_all
- * Function:
- * Removes this physical page from
- * all physical maps in which it resides.
- * Reflects back modify bits to the pager.
- */
-
-void
-pmap_remove_all(pa)
- vm_offset_t pa;
-{
- struct pv_entry *ph, *pv, *npv;
- register pmap_t pmap;
- register pt_entry_t *pte;
- int pind;
- int s;
-
- idcflush();
- if (pmap_debug_level >= 0)
- printf("pmap_remove_all: pa=%08x ", (int) pa);
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT))
- printf("pmap_remove_all(%x)", (int) pa);
- /*pmap_pvdump(pa);*/
-#endif
-
- if ((pind = pmap_page_index(pa)) == -1) {
- if (pmap_debug_level >= 0)
- printf("no accounting\n");
- return;
- }
-
- s = splimp();
- pv = ph = &pv_table[pind];
-
- if (ph->pv_pmap == NULL) {
- if (pmap_debug_level >= 0)
- printf("free page\n");
- splx(s);
- return;
- }
-
- while (pv) {
- pmap = pv->pv_pmap;
- pte = pmap_pte(pmap, pv->pv_va);
-
- if (pmap_debug_level >= 0)
- printf("[%08x,%08x,%08x,%08x] ", (int) pmap, *pte,
- (int) pv->pv_va, pv->pv_flags);
-
-#ifdef DEBUG
- if (!pte || !pmap_pte_v(pte) || pmap_pte_pa(pte) != pa)
- panic("pmap_remove_all: bad mapping");
-#endif
-
-/*
- * Update statistics
- */
-/* Wired bit done below */
-
-/*
- if (pmap_pte_w(pte))
- pmap->pm_stats.wired_count--;
-*/
- pmap->pm_stats.resident_count--;
-
- if (pv->pv_flags & PT_W)
- pmap->pm_stats.wired_count--;
-
-/*
- * Invalidate the PTEs.
- * XXX: should cluster them up and invalidate as many
- * as possible at once.
- */
-#ifdef DEBUG
- if (pmapdebug & PDB_REMOVE)
- printf("remove: inv pte at %x(%x) ", pte, *pte);
-#endif
-
-#ifdef needednotdone
-reduce wiring count on page table pages as references drop
-#endif
-
-/*
- * Update saved attributes for managed page
- */
-
-/* pmap_attributes[pind] |= *pte & (PG_M | PG_U);*/
- pmap_attributes[pind] |= pv->pv_flags & (PT_M | PT_H);
-
- *pte = 0;
-
- npv = pv->pv_next;
- if (pv == ph)
- ph->pv_pmap = NULL;
- else
- pmap_free_pv(pv);
- pv = npv;
- }
- splx(s);
-
- if (pmap_debug_level >= 0)
- printf("done\n");
-
- pmap_update();
-}
-
-
-/*
- * Set the physical protection on the specified range of this map as requested.
- */
-
-void
-pmap_protect(pmap, sva, eva, prot)
- pmap_t pmap;
- vm_offset_t sva;
- vm_offset_t eva;
- vm_prot_t prot;
-{
- register pt_entry_t *pte = NULL;
- register int armprot;
- int flush = 0;
- vm_offset_t pa;
- int pind;
-
- if (pmap_debug_level >= 0)
- printf("pmap_protect: pmap=%08x %08x->%08x %08x\n",
- (int) pmap, (int) sva, (int) eva, prot);
-
- if ((prot & VM_PROT_READ) == VM_PROT_NONE) {
- pmap_remove(pmap, sva, eva);
- return;
- }
- if (prot & VM_PROT_WRITE)
- return;
-
- sva &= PG_FRAME;
- eva &= PG_FRAME;
-
-/*
- * We need to acquire a pointer to a page table page before entering
- * the following loop.
- */
-
- while (sva < eva) {
- pte = pmap_pte(pmap, sva);
- if (pte)
- break;
- sva = (sva & PD_MASK) + NBPD;
- }
-
- while (sva < eva) {
-/*printf("pmap_protect: sva = %08x eva=%08x\n", sva, eva);*/
-/* only check once in a while */
- if ((sva & PT_MASK) == 0) {
- if (!pmap_pde_v(pmap_pde(pmap, sva))) {
-/* We can race ahead here, to the next pde. */
- sva += NBPD;
- pte += arm_byte_to_page(NBPD);
- continue;
- }
- }
-
- if (!pmap_pte_v(pte))
- goto next;
-
- flush = 1;
-
- armprot = 0;
-/*
- if (prot & VM_PROT_WRITE)
- armprot |= PT_AP(AP_W);
-*/
- if (sva < VM_MAXUSER_ADDRESS)
- armprot |= PT_AP(AP_U);
- else if (sva < VM_MAX_ADDRESS)
- armprot |= PT_AP(AP_W); /* XXX Ekk what is this ? */
- *pte = (*pte & 0xfffff00f) | armprot;
-
- pa = pmap_pte_pa(pte);
-
-/* Get the physical page index */
-
- if ((pind = pmap_page_index(pa)) == -1)
- panic("pmap_protect: pmap_page_index failed for pte %08x", pte);
-
-/* Clear write flag */
-
- pmap_modify_pv(pmap, sva, pind, PT_Wr, 0);
-next:
- sva += NBPG;
- pte++;
- }
-
- if (flush)
- pmap_update();
-}
-
-
-/*
- * void pmap_enter(pmap_t pmap, vm_offset_t va, vm_offset_t pa, vm_prot_t prot,
- * boolean_t wired)
- *
- * Insert the given physical page (p) at
- * the specified virtual address (v) in the
- * target physical map with the protection requested.
- *
- * If specified, the page will be wired down, meaning
- * that the related pte can not be reclaimed.
- *
- * NB: This is the only routine which MAY NOT lazy-evaluate
- * or lose information. That is, this routine must actually
- * insert this page into the given map NOW.
- */
-
-void
-pmap_enter(pmap, va, pa, prot, wired)
- pmap_t pmap;
- vm_offset_t va;
- vm_offset_t pa;
- vm_prot_t prot;
- boolean_t wired;
-{
- register pt_entry_t *pte;
- register u_int npte;
- int pind = -2;
- u_int cacheable = 0;
-
-#if PMAP_DEBUG > 5
- printf("pmap_enter: V%08x P%08x in pmap V%08x\n", va, pa, pmap);
-#endif
-
- if (pmap_debug_level >= 5)
- printf("pmap_enter: V%08x P%08x in pmap V%08x prot=%08x, wired = %d\n",
- (int) va, (int) pa, (int) pmap, prot, wired);
-
-/* Valid pmap ? */
-
- if (pmap == NULL)
- return;
-
-/* Valid address ? */
-
- if (va >= VM_KERNEL_VIRTUAL_MAX)
- panic("pmap_enter: too big");
-
-/*
- * Get a pointer to the pte for this virtual address. We should always have
- * a page table ready for us so if the page table is missing ....
- */
-
- pte = pmap_pte(pmap, va);
- if (!pte) {
- printf("pmap_enter: pde = %08x\n", (u_int) pmap_pde(pmap, va));
- printf("pmap_enter: pte = %08x\n", (u_int) pmap_pte(pmap, va));
- panic("Failure 01 in pmap_enter (V%08x P%08x)", (u_int) va, (u_int) pa);
- }
-
-/* More debugging info */
-
- if (pmap_debug_level >= 5) {
- printf("pmap_enter: pte for V%08x = V%08x", (u_int) va, (u_int) pte);
- printf(" (%08x)\n", *pte);
- }
-
-/* Is the pte valid ? If so then this page is already mapped */
-
- if (pmap_pte_v(pte))
- {
- vm_offset_t opa;
-
-/* Get the physical address of the current page mapped */
-
- opa = pmap_pte_pa(pte);
-
-/* Are we mapping the same page ? */
-
- if (opa == pa)
- {
- int flags;
-
-/* All we must be doing is changing the protection */
-
- if (pmap_debug_level >= 0)
- printf("Failure 02 in pmap_enter (V%08x P%08x)\n", (u_int) va, (u_int) pa);
-
- pind = pmap_page_index(pa);
- cacheable = (*pte) & PT_C;
-
-/* Has the wiring changed ? */
-
- flags = pmap_modify_pv(pmap, va, pind, 0, 0) & PT_W;
- if (flags && !wired)
- --pmap->pm_stats.wired_count;
- else if (!flags && wired)
- ++pmap->pm_stats.wired_count;
-
- }
- else
- {
-/* We are replacing the page with a new one. */
-
- idcflush();
-
- if (pmap_debug_level >= 0)
- printf("Failure 03 in pmap_enter (V%08x P%08x P%08x)\n",
- (int) va, (int) pa, (int) opa);
-
-/*
- * If it is part of our managed memory then we must remove it from the PV list
- */
-
- if ((pind = pmap_page_index(opa)) != -1)
- {
-/* pmap_attributes[pind] |= *pte & (PG_M | PG_U);*/
-/* pmap_remove_pv updates pmap_attribute */
-/* Adjust the wiring count if the page was wired */
- if (pmap_remove_pv(pmap, va, pind) & PT_W)
- --pmap->pm_stats.wired_count;
-
- }
-
-/* Update the wiring stats for the new page */
-
- if (wired)
- ++pmap->pm_stats.wired_count;
-
-/*
- * Enter on the PV list if part of our managed memory
- */
- if ((pind = pmap_page_index(pa)) != -1)
- {
- if (pmap_enter_pv(pmap, va, pind, 0))
- cacheable = PT_C;
- }
- else
- /*
- * Assumption: if it is not part of our managed memory
- * then it must be device memory which may be volatile.
- * The video memory may be double mapped but should only be accesses from
- * one address at a time. Will be double mapped by the X server and
- * we must keep the cache on for performance.
- */
- if (pa >= videomemory.vidm_pbase
- && pa < videomemory.vidm_pbase + videomemory.vidm_size)
- cacheable = PT_C;
- else
- cacheable = 0;
- }
- }
- else
- {
-/* pte is not valid so we must be hooking in a new page */
-
- idcflush();
-
- ++pmap->pm_stats.resident_count;
- if (wired)
- ++pmap->pm_stats.wired_count;
-
-/*
- * Enter on the PV list if part of our managed memory
- */
- if ((pind = pmap_page_index(pa)) != -1)
- {
- if (pmap_enter_pv(pmap, va, pind, 0))
- cacheable = PT_C;
- }
- else
- /*
- * Assumption: if it is not part of our managed memory
- * then it must be device memory which may be volatile.
- */
- {
- /*
- * Bit of a hack really as all doubly mapped addresses should be uncached
- * as the cache works on virtual addresses not physical ones.
- * However for the video memory this kill performance and the screen
- * should be locked anyway so there should only be one process trying
- * to write to it at once.
- */
-
- if (pa >= videomemory.vidm_pbase
- && pa < videomemory.vidm_pbase + videomemory.vidm_size)
- cacheable = PT_C;
- else
- cacheable = 0;
- if (pmap_debug_level > 0)
- printf("pmap_enter: non-managed memory mapping va=%08x pa=%08x\n",
- (int) va, (int) pa);
- }
- }
-
-/* Construct the pte, giving the correct access */
-
- npte = (pa & PG_FRAME) | cacheable | PT_B;
-
-if (va == 0 && (prot & VM_PROT_WRITE))
- printf("va=0 prot=%d\n", prot);
-
-/*if (va < VM_MIN_ADDRESS)
- printf("pmap_enter: va=%08x\n", (u_int)va);*/
-
-/* if (va >= VM_MIN_ADDRESS && va < VM_MAXUSER_ADDRESS && !wired)
- npte |= L2_INVAL;
- else*/
- npte |= L2_SPAGE;
-
-/************ not sure about wired *************/
-
- if (prot & VM_PROT_WRITE)
- npte |= PT_AP(AP_W);
-
- if (va >= VM_MIN_ADDRESS) {
- if (va < VM_MAXUSER_ADDRESS)
- npte |= PT_AP(AP_U);
- else if (va < VM_MAX_ADDRESS) /* This must be a page table */
- npte |= PT_AP(AP_W);
- }
-
- if (va >= VM_MIN_ADDRESS && va < VM_MAXUSER_ADDRESS && pind != -1) /* Inhibit write access for user pages */
- *pte = (npte & ~PT_AP(AP_W));
- else
- *pte = npte;
-
- if (*pte == 0)
- {
- panic("oopss: *pte = 0 in pmap_enter() npte=%08x", npte);
- }
-
- if (pind != -1)
- {
- int flags = 0;
-
- if (wired) flags |= PT_W;
- flags |= npte & (PT_Wr | PT_Us);
-/* if (flags & PT_Wr) flags |= PT_M;*/
- #ifdef DIAGNOSTIC
- if (pind > 0x00010000 || pind < 0)
- {
- printf("pind=%08x\n", pind);
- }
- #endif
-/* pmap_modify_pv(pmap, va, pind, 0xffffffff, flags);*/
- pmap_modify_pv(pmap, va, pind, ~(PT_Wr | PT_Us | PT_W), flags);
- }
-
-/*
- * If we are mapping in a page to where the page tables are store then we
- * must be mapping a page table. In this case we should also map the
- * page table into the page directory
- */
-
- if (va >= 0xefc00000 && va < 0xf0000000)
- {
- if (pmap_debug_level >= 0)
- {
- printf("Page being mapped in the page table area\n");
- printf("page P%08x will be installed in the L1 table as well\n",
- (int) pa);
- }
- pa = pa & PG_FRAME;
- pmap->pm_pdir[((va - 0xefc00000)>>10)+0] = L1_PTE(pa + 0x000);
- pmap->pm_pdir[((va - 0xefc00000)>>10)+1] = L1_PTE(pa + 0x400);
- pmap->pm_pdir[((va - 0xefc00000)>>10)+2] = L1_PTE(pa + 0x800);
- pmap->pm_pdir[((va - 0xefc00000)>>10)+3] = L1_PTE(pa + 0xc00);
- }
-
-/* Better flush the TLB ... */
-
- tlbflush();
-
-#if PMAP_DEBUG > 5
- printf("pmap_enter: pte = V%08x %08x\n", pte, *pte);
-#endif
- }
-
-
-/*
- * pmap_page_protect:
- *
- * Lower the permission for all mappings to a given page.
- */
-
-void
-pmap_page_protect(phys, prot)
- vm_offset_t phys;
- vm_prot_t prot;
-{
- if (pmap_debug_level >= 0)
- printf("pmap_page_protect: pa=%08x, prot=%d\n", (int) phys, prot);
-
- switch(prot) {
- case VM_PROT_READ:
- case VM_PROT_READ|VM_PROT_EXECUTE:
- pmap_copy_on_write(phys);
- break;
-
- case VM_PROT_ALL:
- break;
-
- default:
- pmap_remove_all(phys);
- break;
- }
-}
-
-
-/*
- * Routine: pmap_change_wiring
- * Function: Change the wiring attribute for a map/virtual-address
- * pair.
- * In/out conditions:
- * The mapping must already exist in the pmap.
- */
-
-void
-pmap_change_wiring(pmap, va, wired)
- pmap_t pmap;
- vm_offset_t va;
- boolean_t wired;
-{
- register pt_entry_t *pte;
- vm_offset_t pa;
- int pind;
- int current;
-
-/* Get the pte */
-
- pte = pmap_pte(pmap, va);
- if (!pte)
- return;
-
-/* Extract the physical address of the page */
-
- pa = pmap_pte_pa(pte);
-
-/* Get the physical page index */
-
- if ((pind = pmap_page_index(pa)) == -1)
- return;
-
-/* Update the wired bit in the pv entry for this page. */
-
- current = pmap_modify_pv(pmap, va, pind, PT_W, wired ? PT_W : 0) & PT_W;
-
-/* Update the statistics */
-
- if (wired & !current)
- pmap->pm_stats.wired_count++;
- else if (!wired && current)
- pmap->pm_stats.wired_count--;
-}
-
-
-/*
- * pt_entry_t *pmap_pte(pmap_t pmap, vm_offset_t va)
- *
- * Return the pointer to a page table entry corresponding to the supplied
- * virtual address.
- *
- * The page directory is first checked to make sure that a page table
- * for the address in question exists and if it does a pointer to the
- * entry is returned.
- *
- * The way this works is that that the kernel page tables are mapped
- * into the memory map at 0xf3c00000 to 0xf3fffffff. This allows
- * page tables to be located quickly.
- */
-
-pt_entry_t *
-pmap_pte(pmap, va)
- pmap_t pmap;
- vm_offset_t va;
-{
- pd_entry_t *pde;
- pt_entry_t *ptp;
- pt_entry_t *result;
- int s;
-
-/* The pmap must be valid */
-
- if (!pmap)
- return(NULL);
-
-/* Return the address of the pte */
-
-#if PMAP_DEBUG > 10
- printf("pmap_pte: pmap=V%08x va=V%08x pde = V%08x", pmap, va,
- pmap_pde(pmap, va));
- printf(" (%08x)\n", *(pmap_pde(pmap, va)));
-#endif
-
- if (pmap_debug_level >= 10) {
- printf("pmap_pte: pmap=V%08x va=V%08x pde = V%08x", (int) pmap,
- (int) va, (int) pmap_pde(pmap, va));
- printf(" (%08x)\n", *(pmap_pde(pmap, va)));
- }
-
-/* Do we have a valid pde ? If not we don't have a page table */
-
- if (!pmap_pde_v(pmap_pde(pmap, va))) {
- if (pmap_debug_level >= 0)
- printf("pmap_pte: failed - pde = %08x\n", (int) pmap_pde(pmap, va));
- return(NULL);
- }
-
- if (pmap_debug_level >= 10)
- printf("pmap pagetable = P%08x current = P%08x\n", (int) pmap->pm_pptpt,
- (*((pt_entry_t *)(PROCESS_PAGE_TBLS_BASE
- + (PROCESS_PAGE_TBLS_BASE >> (PGSHIFT-2))+0xefc)) & PG_FRAME));
-
- if (pmap == kernel_pmap || pmap->pm_pptpt
- == (*((pt_entry_t *)(PROCESS_PAGE_TBLS_BASE
- + ((PROCESS_PAGE_TBLS_BASE >> (PGSHIFT-2)) & ~3)+0xefc)) & PG_FRAME)) {
- ptp = (pt_entry_t *)PROCESS_PAGE_TBLS_BASE;
- } else {
- pde = (pd_entry_t *)CURRENT_PAGEDIR_BASE;
- idcflush();
-
-/*printf("\x1b[33mpde=%08x kernel pmap=%08x pmap=%08x\x1b[0m\n", pde, kernel_pmap, pmap);*/
- ptp = (pt_entry_t *)ALT_PAGE_TBLS_BASE;
- pde[(ALT_PAGE_TBLS_BASE >> 20) + 0] = L1_PTE(pmap->pm_pptpt + 0x000);
- pde[(ALT_PAGE_TBLS_BASE >> 20) + 1] = L1_PTE(pmap->pm_pptpt + 0x400);
- pde[(ALT_PAGE_TBLS_BASE >> 20) + 2] = L1_PTE(pmap->pm_pptpt + 0x800);
- pde[(ALT_PAGE_TBLS_BASE >> 20) + 3] = L1_PTE(pmap->pm_pptpt + 0xc00);
-
- *((pt_entry_t *)(PROCESS_PAGE_TBLS_BASE + ((PROCESS_PAGE_TBLS_BASE
- >> (PGSHIFT-2)) & ~3) + (ALT_PAGE_TBLS_BASE >> 20))) =
- L2_PTE(pmap->pm_pptpt, AP_KRWUR);
- tlbflush();
- }
- if (pmap_debug_level >= 10)
- printf("page tables base = %08x\n", (int) ptp);
- result = (pt_entry_t *)((char *)ptp + ((va >> (PGSHIFT-2)) & ~3));
- return(result);
-}
-
-
-/*
- * Routine: pmap_extract
- * Function:
- * Extract the physical page address associated
- * with the given map/virtual_address pair.
- */
-
-vm_offset_t
-pmap_extract(pmap, va)
- pmap_t pmap;
- vm_offset_t va;
-{
- register pt_entry_t *pte;
- register vm_offset_t pa;
-/*
- printf("pmap_extract: pmap = %08x va = V%08x\n", pmap, va);
-*/
-
-/*
- * Get the pte for this virtual address. If there is no pte then there is
- * no page table etc.
- */
-
- pte = pmap_pte(pmap, va);
- if (!pte)
- return(0);
-
-/* Is the pte valid ? If not then no paged is actually mapped here */
-
- if (!pmap_pte_v(pte))
- return(0);
-
-/* Extract the physical address from the pte */
-
- pa = pmap_pte_pa(pte);
-
-/* printf("pmap_extract: pa = P%08x\n", (pa | (va & ~PG_FRAME))); */
-
- return(pa | (va & ~PG_FRAME));
-}
-
-
-#if 0 /* Macro in pmap.h */
-pt_entry_t *
-vtopte(va)
- vm_offset_t va;
-{
- return((pt_entry_t *)(PROCESS_PAGE_TBLS_BASE
- + (arm_byte_to_page(va) << 2)));
-}
-#endif
-
-#if 0 /* Macro in pmap.h */
-u_int
-vtophys(va)
- vm_offset_t va;
-{
- return((*vtopte(va) & PG_FRAME) | ((unsigned)(va) & ~PG_FRAME));
-}
-#endif
-
-
-/*
- * Copy the range specified by src_addr/len from the source map to the
- * range dst_addr/len in the destination map.
- *
- * This routine is only advisory and need not do anything.
- */
-
-void
-pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr)
- pmap_t dst_pmap;
- pmap_t src_pmap;
- vm_offset_t dst_addr;
- vm_size_t len;
- vm_offset_t src_addr;
-{
- if (pmap_debug_level >= 0)
- printf("pmap_copy(%x, %x, %x, %x, %x)\n",
- (int) dst_pmap, (int) src_pmap, (int) dst_addr,
- (int) len, (int) src_addr);
-}
-
-
-void
-pmap_dump_pvlist(phys, m)
- vm_offset_t phys;
- char *m;
-{
- register struct pv_entry *pv;
-
- if (!pv_table)
- return;
-
- printf("%s %08x:", m, (int) phys);
- pv = &pv_table[pmap_page_index(phys)];
- if (pv->pv_pmap == NULL) {
- printf(" no mappings\n");
- return;
- }
-
- for (; pv; pv = pv->pv_next)
- printf(" pmap %08x va %08x flags %08x", (int) pv->pv_pmap,
- (int) pv->pv_va, pv->pv_flags);
-
- printf("\n");
-}
-
-
-void
-pmap_dump_pvs()
-{
- register struct pv_entry *pv;
- register int loop;
-
- if (!pv_table)
- return;
-
- printf("pv dump\n");
-
- for (loop = 0; loop < npages; ++loop) {
- pv = &pv_table[loop];
- if (pv->pv_pmap != NULL) {
- printf("%4d : ", loop);
- for (; pv; pv = pv->pv_next) {
- printf(" pmap %08x va %08x flags %08x", (int) pv->pv_pmap,
- (int) pv->pv_va, pv->pv_flags);
- }
- printf("\n");
- }
- }
- }
-
-
-boolean_t
-pmap_testbit(pa, setbits)
- vm_offset_t pa;
- int setbits;
-{
- register struct pv_entry *pv;
-/* register pt_entry_t *pte;*/
- int pind;
- int s;
-
- if (pmap_debug_level >= 1)
- printf("pmap_testbit: pa=%08x set=%08x\n", (int) pa, setbits);
-
- if (pv_table == NULL || pmap_attributes == NULL)
- return(FALSE);
-
- if ((pind = pmap_page_index(pa)) == -1)
- return(FALSE);
-
- s = splimp();
- pv = &pv_table[pind];
-
-/*
- if (pmap_debug_level >= 0)
- printf("pmap_attributes = %02x\n", pmap_attributes[pind]);
-*/
-
-/*
- * Check saved info first
- */
-
- if (pmap_attributes[pind] & setbits) {
- if (pmap_debug_level >= 0)
- printf("pmap_attributes = %02x\n", pmap_attributes[pind]);
-
- splx(s);
- return(TRUE);
- }
-
-/*
- * Not found, check current mappings returning
- * immediately if found.
- */
-
- if (pv->pv_pmap != NULL) {
- for (; pv; pv = pv->pv_next) {
-/* pte = pmap_pte(pv->pv_pmap, pv->pv_va);*/
-
-/* The write bit is in the flags */
-
- if ((pv->pv_flags & setbits) /*|| (*pte & (setbits & PT_Wr))*/) {
- splx(s);
- return(TRUE);
- }
- if ((setbits & PT_M) && pv->pv_va >= VM_MAXUSER_ADDRESS) {
- splx(s);
- return(TRUE);
- }
- if ((setbits & PT_H) && pv->pv_va >= VM_MAXUSER_ADDRESS) {
- splx(s);
- return(TRUE);
- }
- }
- }
-
- splx(s);
- return(FALSE);
-}
-
-
-/*
- * Modify pte bits for all ptes corresponding to the given physical address.
- * We use `maskbits' rather than `clearbits' because we're always passing
- * constants and the latter would require an extra inversion at run-time.
- */
-
-void
-pmap_changebit(pa, setbits, maskbits)
- vm_offset_t pa;
- int setbits;
- int maskbits;
-{
- register struct pv_entry *pv;
- register pt_entry_t *pte;
- vm_offset_t va;
- int pind;
- int s;
-
- if (pmap_debug_level >= 1)
- printf("pmap_changebit: pa=%08x set=%08x mask=%08x\n",
- (int) pa, setbits, maskbits);
-
- if (pv_table == NULL || pmap_attributes == NULL)
- return;
-
- if ((pind = pmap_page_index(pa)) == -1)
- return;
-
- s = splimp();
- pv = &pv_table[pind];
-
-/*
- * Clear saved attributes (modify, reference)
- */
-
- if (pmap_debug_level >= 0 && pmap_attributes[pind])
- printf("pmap_attributes = %02x\n", pmap_attributes[pind]);
-
- if (~maskbits)
- pmap_attributes[pind] &= maskbits;
-
-/*
- * Loop over all current mappings setting/clearing as appropos
- */
-
- if (pv->pv_pmap != NULL) {
- for (; pv; pv = pv->pv_next) {
- va = pv->pv_va;
-
-/*
- * XXX don't write protect pager mappings
- */
-
- if (maskbits == ~PT_Wr) {
- extern vm_offset_t pager_sva, pager_eva;
-
- if (va >= pager_sva && va < pager_eva)
- continue;
- }
-
- pv->pv_flags = (pv->pv_flags & maskbits) | setbits;
- pte = pmap_pte(pv->pv_pmap, va);
- if ((maskbits & PT_Wr) == 0)
- *pte = (*pte) & ~PT_AP(AP_W);
- if (setbits & PT_Wr)
- *pte = (*pte) | PT_AP(AP_W);
-/*
- if ((maskbits & PT_H) == 0)
- *pte = ((*pte) & ~L2_MASK) | L2_INVAL;
-*/
- }
- pmap_update();
- }
- splx(s);
-}
-
-
-void
-pmap_clear_modify(pa)
- vm_offset_t pa;
-{
- if (pmap_debug_level >= 0)
- printf("pmap_clear_modify pa=%08x\n", (int) pa);
- pmap_changebit(pa, 0, ~PT_M);
-}
-
-
-void
-pmap_clear_reference(pa)
- vm_offset_t pa;
-{
- if (pmap_debug_level >= 0)
- printf("pmap_clear_reference pa=%08x\n", (int) pa);
- pmap_changebit(pa, 0, ~PT_H);
-}
-
-
-void
-pmap_copy_on_write(pa)
- vm_offset_t pa;
-{
- if (pmap_debug_level >= 0)
- printf("pmap_copy_on_write pa=%08x\n", (int) pa);
- pmap_changebit(pa, 0, ~PT_Wr);
-}
-
-boolean_t
-pmap_is_modified(pa)
- vm_offset_t pa;
-{
- boolean_t result;
-
- result = pmap_testbit(pa, PT_M);
- if (pmap_debug_level >= 0)
- printf("pmap_is_modified pa=%08x %08x\n", (int) pa, result);
-
- return(result);
-}
-
-
-boolean_t
-pmap_is_referenced(pa)
- vm_offset_t pa;
-{
- boolean_t result;
-/* int pind;*/
-
- result = pmap_testbit(pa, PT_H);
- if (pmap_debug_level >= 0)
- printf("pmap_is_referenced pa=%08x %08x\n", (int) pa, result);
-
- return(result);
-}
-
-
-int
-pmap_modified_emulation(pmap, va)
- pmap_t pmap;
- vm_offset_t va;
-{
- pt_entry_t *pte;
- vm_offset_t pa;
- int pind;
- u_int flags;
-
-/* Get the pte */
-
- pte = pmap_pte(pmap, va);
- if (!pte)
- return(0);
-
-/* Extract the physical address of the page */
-
- pa = pmap_pte_pa(pte);
-
-/* Get the physical page index */
-
- if ((pind = pmap_page_index(pa)) == -1)
- return(0);
-
-/* Get the current flags for this page. */
-
- flags = pmap_modify_pv(pmap, va, pind, 0, 0);
- if (pmap_debug_level > 2)
- printf("pmap_modified_emulation: flags = %08x\n", flags);
-
-/*
- * Do the flags say this page is writable ? If not then it is a genuine
- * write fault. If yes then the write fault is our fault as we did not
- * reflect the write access in the PTE. Now we know a write has occurred
- * we can correct this and also set the modified bit
- */
-
- if (!(flags & PT_Wr))
- return(0);
-
- if (pmap_debug_level > 0)
- printf("pmap_modified_emulation: Got a hit va=%08x\n", (int) va);
-
- if (pmap_debug_level > 0)
- printf("pte = %08x (%08x)", (int) pte, *pte);
- *pte = *pte | PT_AP(AP_W);
- if (pmap_debug_level > 0)
- printf("->(%08x)\n", *pte);
-
- tlbflush();
-
-/* pmap_modify_pv(pmap, va, pind, PT_M, PT_M);*/
-
- if (pmap_attributes)
- pmap_attributes[pind] |= PT_M;
-
-/* panic("pmap_modified_emulation: Not yet completed");*/
-
-/* Return, indicating the problem has been dealt with */
-
- return(1);
-}
-
-
-int
-pmap_handled_emulation(pmap, va)
- pmap_t pmap;
- vm_offset_t va;
-{
- pt_entry_t *pte;
- vm_offset_t pa;
- int pind;
-/* u_int flags;*/
-
- if (pmap_debug_level > 2)
- printf("pmap_handled_emulation\n");
-
-/* return(0);*/
-
-/* Get the pte */
-
- pte = pmap_pte(pmap, va);
- if (!pte) {
- if (pmap_debug_level > 2)
- printf("no pte\n");
- return(0);
- }
-
-/* Check for a zero pte */
-
- if (pmap_debug_level > 1)
- printf("*pte=%08x\n", *pte);
-
- if (*pte == 0)
- return(0);
-
- if (pmap_debug_level > 1)
- printf("pmap_handled_emulation: non zero pte %08x\n", *pte);
-
-/* Have we marked a valid pte as invalid ? */
-
- if (((*pte) & L2_MASK) != L2_INVAL)
- return(0);
-
- if (pmap_debug_level >=-1)
- printf("Got an invalid pte\n");
-
-/* Extract the physical address of the page */
-
- pa = pmap_pte_pa(pte);
-
-/* Get the physical page index */
-
- if ((pind = pmap_page_index(pa)) == -1)
- return(0);
-
-/*
- * Ok we just enable the pte and mark the flags as handled
- */
-
- if (pmap_debug_level > 0)
- printf("pmap_handled_emulation: Got a hit va=%08x\n", (int) va);
-
- if (pmap_debug_level > 0)
- printf("pte = %08x (%08x)", (int) pte, *pte);
- *pte = ((*pte) & ~L2_MASK) | L2_SPAGE;
- if (pmap_debug_level > 0)
- printf("->(%08x)\n", *pte);
-
- tlbflush();
-
- if (pmap_attributes)
- pmap_attributes[pind] |= PT_H;
-
-/* Return, indicating the problem has been dealt with */
-
- return(1);
-}
-
-
-void
-pmap_pagedir_dump()
-{
- int loop;
-
- printf("PD pmap PD pmap\n");
-
- for (loop = 0; loop < max_processes / 2; ++loop) {
- printf("%2d %08x %2d %08x\n", loop,
- (int) pagedirectories[loop], loop + max_processes / 2,
- (int) pagedirectories[loop + max_processes / 2]);
- }
-}
-
-
-int
-pmap_page_attributes(va)
- vm_offset_t va;
-{
- vm_offset_t pa;
- int pind;
-
-/* Get the physical page */
-
- pa = (vm_offset_t)vtopte(va);
-
-/* Get the physical page index */
-
- if ((pind = pmap_page_index(pa)) == -1)
- return(-1);
-
- if (pmap_attributes)
- return((int)pmap_attributes[pind]);
-
- return(-1);
-}
-
-#if 0 /* Macro in pmap.h */
-vm_offset_t
-pmap_phys_address(ppn)
- int ppn;
-{
- return(arm_page_to_byte(ppn));
-}
-#endif
-
-
-void
-pmap_collect(pmap)
- pmap_t pmap;
-{
-}
-
-/* End of pmap.c */
diff --git a/sys/arch/arm32/arm32/postmortem.c b/sys/arch/arm32/arm32/postmortem.c
deleted file mode 100644
index 0b855e3ecc6..00000000000
--- a/sys/arch/arm32/arm32/postmortem.c
+++ /dev/null
@@ -1,336 +0,0 @@
-/* $NetBSD: postmortem.c,v 1.4 1996/03/13 21:26:52 mark Exp $ */
-
-/*
- * Copyright (c) 1994,1995 Mark Brinicombe.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * postmortem.c
- *
- * Postmortem routines
- *
- * Created : 17/09/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <machine/db_machdep.h>
-#include <ddb/db_sym.h>
-#include <machine/frame.h>
-#include <machine/katelib.h>
-
-#ifdef POSTMORTEM
-
-typedef struct {
- vm_offset_t physical;
- vm_offset_t virtual;
-} pv_addr_t;
-
-extern pv_addr_t irqstack;
-extern pv_addr_t undstack;
-extern pv_addr_t abtstack;
-extern struct proc *proc1;
-
-int usertraceback = 0;
-
-/* dumpb - dumps memory in bytes */
-
-void
-pm_dumpb(addr, count)
- u_char *addr;
- int count;
-{
- u_int byte;
- int loop;
-
- for (; count > 0; count -= 16) {
- printf("%08x: ", (int)addr);
-
- for (loop = 0; loop < 16; ++loop) {
- byte = addr[loop];
- printf("%02x ", byte);
- }
-
- printf(" ");
-
- for (loop = 0; loop < 16; ++loop) {
- byte = addr[loop];
- if (byte < 0x20)
- printf("\x1b[31m%c\x1b[0m", byte + '@');
- else if (byte == 0x7f)
- printf("\x1b[31m?\x1b[0m");
- else if (byte < 0x80)
- printf("%c", byte);
- else if (byte < 0xa0)
- printf("\x1b[32m%c\x1b[0m", byte - '@');
- else if (byte == 0xff)
- printf("\x1b[32m?\x1b[0m");
- else
- printf("%c", byte & 0x7f);
- }
-
- printf("\r\n");
- addr += 16;
- }
-}
-
-
-/* dumpw - dumps memory in bytes */
-
-void
-pm_dumpw(addr, count)
- u_char *addr;
- int count;
-{
- u_int byte;
- int loop;
-
- for (; count > 0; count -= 32) {
- printf("%08x: ", (int)addr);
-
- for (loop = 0; loop < 8; ++loop) {
- byte = ((u_int *)addr)[loop];
- printf("%08x ", byte);
- }
-
- printf(" ");
-
- for (loop = 0; loop < 32; ++loop) {
- byte = addr[loop];
- if (byte < 0x20)
- printf("\x1b[31m%c\x1b[0m", byte + '@');
- else if (byte == 0x7f)
- printf("\x1b[31m?\x1b[0m");
- else if (byte < 0x80)
- printf("%c", byte);
- else if (byte < 0xa0)
- printf("\x1b[32m%c\x1b[0m", byte - '@');
- else if (byte == 0xff)
- printf("\x1b[32m?\x1b[0m");
- else
- printf("%c", byte & 0x7f);
- }
-
- printf("\r\n");
- addr += 32;
- }
-}
-
-
-/* Dump a trap frame */
-
-void
-dumpframe(frame)
- trapframe_t *frame;
-{
- u_int s;
-
- s = splhigh();
- printf("frame address = %08x ", (u_int)frame);
- printf("spsr =%08x\n", frame->tf_spsr);
- printf("r0 =%08x r1 =%08x r2 =%08x r3 =%08x\n", frame->tf_r0, frame->tf_r1, frame->tf_r2, frame->tf_r3);
- printf("r4 =%08x r5 =%08x r6 =%08x r7 =%08x\n", frame->tf_r4, frame->tf_r5, frame->tf_r6, frame->tf_r7);
- printf("r8 =%08x r9 =%08x r10=%08x r11=%08x\n", frame->tf_r8, frame->tf_r9, frame->tf_r10, frame->tf_r11);
- printf("r12=%08x r13=%08x r14=%08x r15=%08x\n", frame->tf_r12, frame->tf_usr_sp, frame->tf_usr_lr, frame->tf_pc);
- printf("slr=%08x\n", frame->tf_svc_lr);
-
- (void)splx(s);
-}
-
-
-/* Dump kstack information */
-/*
-void kstack_stuff(p)
- struct proc *p;
-{
- struct pmap *pmap;
-
- if (p == 0) return;
- if (p->p_addr == 0) return;
- if (p->p_vmspace == 0) return;
-
- printf("proc=%08x comm=%s pid=%d\n", (u_int)p, p->p_comm, p->p_pid);
-
- pmap = &p->p_vmspace->vm_pmap;
-
- printf("pmap=%08x\n", (u_int)pmap);
-
- printf("p->p_addr=%08x pa=%08x,%d:%08x,%d\n",
- (u_int)p->p_addr,
- (u_int)pmap_extract(pmap, (vm_offset_t)p->p_addr),
- pmap_page_index(pmap_extract(pmap, (vm_offset_t)p->p_addr)),
- (u_int)pmap_extract(pmap, (vm_offset_t)p->p_addr + NBPG),
- pmap_page_index(pmap_extract(pmap, (vm_offset_t)p->p_addr + NBPG)));
-}
-*/
-
-void
-check_stacks(p)
- struct proc *p;
-{
- u_char *ptr;
- int loop;
-
- if (p) {
- ptr = ((u_char *)p->p_addr) + USPACE_UNDEF_STACK_BOTTOM;
- for (loop = 0; loop < (USPACE_UNDEF_STACK_TOP - USPACE_UNDEF_STACK_BOTTOM) && *ptr == 0xdd; ++loop, ++ptr) ;
- printf("%d bytes of undefined stack fill pattern out of %d bytes\n", loop,
- USPACE_UNDEF_STACK_TOP - USPACE_UNDEF_STACK_BOTTOM);
- ptr = ((u_char *)p->p_addr) + USPACE_SVC_STACK_BOTTOM;
- for (loop = 0; loop < (USPACE_SVC_STACK_TOP - USPACE_SVC_STACK_BOTTOM) && *ptr == 0xdd; ++loop, ++ptr) ;
- printf("%d bytes of svc stack fill pattern out of %d bytes\n", loop,
- USPACE_SVC_STACK_TOP - USPACE_SVC_STACK_BOTTOM);
- }
-}
-
-
-/* Perform a postmortem */
-
-void
-postmortem(frame)
- trapframe_t *frame;
-{
- u_int s;
- struct proc *p = curproc;
- int loop;
- u_int addr;
-
- s = splhigh();
-
-/* Check the stack for a known pattern */
-
- check_stacks(p);
-
-#ifdef ROTTEN_INARDS
- addr = traceback();
-
- dumpframe(frame);
-
- printf("curproc=%08x paddr=%08x pcb=%08x curpcb=%08x\n",
- (u_int) curproc, (u_int) curproc->p_addr,
- (u_int) &curproc->p_addr->u_pcb, (u_int) curpcb);
- printf("CPSR=%08x ", GetCPSR());
-
- printf("Process = %08x ", (u_int)curproc);
- printf("pid = %d ", curproc->p_pid);
- printf("comm = %s\n", curproc->p_comm);
-
- pm_dumpw(irqstack.virtual + NBPG - 0x100, 0x100);
- pm_dumpw(undstack.virtual + NBPG - 0x20, 0x20);
- pm_dumpw(abtstack.virtual + NBPG - 0x20, 0x20);
-
- printf("abt_sp=%08x irq_sp=%08x und_sp=%08x svc_sp=%08x\n",
- get_stackptr(PSR_ABT32_MODE),
- get_stackptr(PSR_IRQ32_MODE),
- get_stackptr(PSR_UND32_MODE),
- get_stackptr(PSR_SVC32_MODE));
-
- if (curpcb)
- printf("curpcb=%08x pcb_sp=%08x pcb_und_sp=%08x\n", curpcb, curpcb->pcb_sp, curpcb->pcb_und_sp);
-
- printf("proc0=%08x paddr=%08x pcb=%08x\n", (u_int)&proc0,
- (u_int)proc0.p_addr, (u_int) &proc0.p_addr->u_pcb);
-
-/*
- kstack_stuff(&proc0);
- kstack_stuff(curproc);
-*/
-#else
- printf("Process = %08x ", (u_int)curproc);
- printf("pid = %d ", curproc->p_pid);
- printf("comm = %s\n", curproc->p_comm);
- printf("CPSR=%08x ", GetCPSR());
-
- printf("Traceback info\n");
- addr = simpletraceback();
- printf("Trapframe PC = %08x\n", frame->tf_pc);
- printf("Trapframe SPSR = %08x\n", frame->tf_spsr);
-
- if (usertraceback) {
- printf("Attempting user trackback\n");
- user_traceback(frame->tf_r11);
- }
-
-#endif
- if ((frame->tf_spsr & PSR_MODE) == PSR_IRQ32_MODE
- && addr >= irqstack.virtual && addr < (irqstack.virtual + NBPG)) {
- printf("Trap occurred in IRQ\n");
- printf("IRQ Traceback info\n");
- irqtraceback(addr, irqstack.virtual);
- }
- (void)splx(s);
-}
-
-
-void
-buried_alive(p)
- struct proc *p;
-{
- printf("Ok major screw up detected on kernel stack\n");
- printf("Putting the process down to minimise further trashing\n");
- printf("Process was %08x pid=%d comm=%s\n", (u_int) p, p->p_pid, p->p_comm);
-
-}
-#else
-void
-postmortem(frame)
- trapframe_t *frame;
-{
- printf("No postmortem support compiled in\n");
-}
-
-void
-buried_alive(p)
- struct proc *p;
-{
-}
-#endif
-
-void
-traceback_sym(lr, pc)
- u_int lr;
- u_int pc;
-{
-#ifdef DDB
- printf("fp->lr=%08x fp->pc=%08x\n", lr, pc);
-/* printf("fp->lr=");
- db_printsym((db_addr_t)(lr), DB_STGY_ANY);
- printf(" fp->pc=");
- db_printsym((db_addr_t)(pc), DB_STGY_ANY);
- printf("\n");*/
-#else
- printf("fp->lr=%08x fp->pc=%08x\n", lr, pc);
-#endif
-}
-
-/* End of postmortem.c */
diff --git a/sys/arch/arm32/arm32/process_machdep.c b/sys/arch/arm32/arm32/process_machdep.c
deleted file mode 100644
index 2a087848afa..00000000000
--- a/sys/arch/arm32/arm32/process_machdep.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/* $NetBSD: process_machdep.c,v 1.2 1996/03/27 22:42:26 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Frank Lancaster. All rights reserved.
- * Copyright (c) 1995 Tools GmbH. All rights reserved.
- * Copyright (c) 1995 Charles M. Hannum. All rights reserved.
- * Copyright (c) 1993 The Regents of the University of California.
- * Copyright (c) 1993 Jan-Simon Pendry
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Jan-Simon Pendry.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * From:
- * Id: procfs_i386.c,v 4.1 1993/12/17 10:47:45 jsp Rel
- */
-
-/*
- * This file may seem a bit stylized, but that so that it's easier to port.
- * Functions to be implemented here are:
- *
- * process_read_regs(proc, regs)
- * Get the current user-visible register set from the process
- * and copy it into the regs structure (<machine/reg.h>).
- * The process is stopped at the time read_regs is called.
- *
- * process_write_regs(proc, regs)
- * Update the current register set from the passed in regs
- * structure. Take care to avoid clobbering special CPU
- * registers or privileged bits in the PSL.
- * The process is stopped at the time write_regs is called.
- *
- * process_sstep(proc, sstep)
- * Arrange for the process to trap or not trap depending on sstep
- * after executing a single instruction.
- *
- * process_set_pc(proc)
- * Set the process's program counter.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/time.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/vnode.h>
-#include <sys/ptrace.h>
-
-#include <machine/reg.h>
-
-static inline struct trapframe *
-process_frame(p)
- struct proc *p;
-{
-
- return (p->p_md.md_regs);
-}
-
-static inline struct fp_state *
-process_fpframe(p)
- struct proc *p;
-{
-
- /* is this correct ? don't we need fpregs in the trapframe ?
- or doesn't the kernel use fp ? */
- return (&p->p_addr->u_pcb.pcb_fpstate);
-}
-
-int
-process_read_regs(p, regs)
- struct proc *p;
- struct reg *regs;
-{
- struct trapframe *tf = process_frame(p);
-
- bcopy((caddr_t)&tf->tf_r0, (caddr_t)regs->r, sizeof(regs->r));
- regs->r_sp = tf->tf_usr_sp;
- regs->r_lr = tf->tf_usr_lr;
- regs->r_pc = tf->tf_pc;
- regs->r_cpsr = tf->tf_spsr;
-
- return (0);
-}
-
-int
-process_read_fpregs(p, regs)
- struct proc *p;
- struct fpreg *regs;
-{
- struct fp_state *statep;
-
- /* NOTE: struct fpreg == struct fpstate */
- statep = process_fpframe(p);
- bcopy(statep, regs, sizeof(struct fpreg));
- return (0);
-}
-
-int
-process_write_regs(p, regs)
- struct proc *p;
- struct reg *regs;
-{
- struct trapframe *tf = process_frame(p);
-
- bcopy((caddr_t)regs->r, (caddr_t)&tf->tf_r0, sizeof(regs->r));
- tf->tf_usr_sp = regs->r_sp;
- tf->tf_usr_lr = regs->r_lr;
- tf->tf_pc = regs->r_pc;
- tf->tf_spsr &= ~PSR_FLAGS;
- tf->tf_spsr |= regs->r_cpsr & PSR_FLAGS;
-
- return (0);
-}
-
-int
-process_write_fpregs(p, regs)
- struct proc *p;
- struct fpreg *regs;
-{
- struct fp_state *statep;
-
- /* NOTE: struct fpreg == struct fpstate */
- statep = process_fpframe(p);
- bcopy(regs, statep, sizeof(struct fpreg));
- return (0);
-}
-
-int
-process_sstep(p, sstep)
- struct proc *p;
- int sstep;
-{
- if (sstep)
- /* this is going to be fun, I'll start off with kgdb_step ... */
- return (EINVAL);
- return (0);
-}
-
-int
-process_set_pc(p, addr)
- struct proc *p;
- caddr_t addr;
-{
- struct trapframe *tf = process_frame(p);
-
- tf->tf_pc = (int)addr;
-
- return (0);
-}
diff --git a/sys/arch/arm32/arm32/scratch.S b/sys/arch/arm32/arm32/scratch.S
deleted file mode 100644
index 9e7ed161846..00000000000
--- a/sys/arch/arm32/arm32/scratch.S
+++ /dev/null
@@ -1,263 +0,0 @@
-/* $OpenBSD: scratch.S,v 1.2 2000/03/03 00:54:46 todd Exp $ */
-/* $NetBSD: scratch.S,v 1.2 1996/02/02 02:35:49 mycroft Exp $ */
-
-/*
- * Copyright (c) 1994,1995 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * scratch.S
- *
- * Miscellaneous routines scratchpad routines
- *
- * Created : 02/04/95
- * Last updated : 04/06/95
- *
- */
-
-#include "assym.h"
-
-lr .req r14
-pc .req r15
-
-.text
-
- .global _ReadWordWithChecks
-
-/* Reads a word but traps failed faults
- *
- * r0 - address to read
- * r1 - address to store result
- */
-
-Lcurpcb:
- .word _curpcb
-
-_ReadWordWithChecks:
- ldr r2, Lcurpcb
- ldr r2, [r2]
- teq r2, #0x00000000
- beq ReadWordPCBFault
- add r3, pc, #ReadWordFault - . - 8
- str r3, [r2, #PCB_ONFAULT]
-
- ldr r0, [r0]
- str r0, [r1]
-
- mov r0, #0x00000000
- str r0, [r2, #PCB_ONFAULT]
- mov pc, lr
-
-ReadWordFault:
- mov r0, #0x00000000
- str r0, [r2, #PCB_ONFAULT]
- mov r0, #0x00000001
- mov pc, lr
-
-ReadWordPCBFault:
- stmfd sp!, {lr}
- mov r2, r0
- add r0, pc, #ReadWordText1 - . - 8
- mov r1, r2
- bl _printf
- mov r0, #0x00000001
- ldmfd sp!, {lr}
- mov pc, lr
-
-ReadWordText1:
- .asciz "Alert ! PCB = %08x during ReadWordWithChecks addr=%08x\n"
-
-
- .global new_fuword
-
-new_fuword:
- ldr r2, Lcurpcb
- ldr r2, [r2]
- teq r2, #0x00000000
- beq fusupcbfault
- add r1, pc, #fusufault - . - 8
- str r1, [r2, #PCB_ONFAULT]
-
- ldr r0, [r0]
-
- mov r1, #0x00000000
- str r1, [r2, #PCB_ONFAULT]
- mov pc, lr
-
- .global new_fuswintr
-
-new_fuswintr:
- ldr r2, Lcurpcb
- ldr r2, [r2]
- teq r2, #0x00000000
- beq fusupcbfault
- add r1, pc, #fusubailout - . - 8
- str r1, [r2, #PCB_ONFAULT]
-
- ldr r0, [r0]
- bic r0, r0, #0xff000000
- bic r0, r0, #0x00ff0000
-
- mov r1, #0x00000000
- str r1, [r2, #PCB_ONFAULT]
- mov pc, lr
-
- .global new_fusword
-
-new_fusword:
- ldr r2, Lcurpcb
- ldr r2, [r2]
- teq r2, #0x00000000
- beq fusupcbfault
- add r1, pc, #fusufault - . - 8
- str r1, [r2, #PCB_ONFAULT]
-
- ldr r0, [r0]
- bic r0, r0, #0xff000000
- bic r0, r0, #0x00ff0000
-
- mov r1, #0x00000000
- str r1, [r2, #PCB_ONFAULT]
- mov pc, lr
-
- .global new_fubyte
-
-new_fubyte:
- ldr r2, Lcurpcb
- ldr r2, [r2]
- teq r2, #0x00000000
- beq fusupcbfault
- add r1, pc, #fusufault - . - 8
- str r1, [r2, #PCB_ONFAULT]
-
- ldrb r0, [r0]
-
- mov r1, #0x00000000
- str r1, [r2, #PCB_ONFAULT]
- mov pc, lr
-
-
-fusufault:
- mov r0, #0x00000000
- str r0, [r2, #PCB_ONFAULT]
- mvn r0, #0x00000000
- mov pc, lr
-
- .global fusubailout
-
-fusubailout:
- mov r0, #0x00000000
- str r0, [r2, #PCB_ONFAULT]
- mvn r0, #0x00000000
- mov pc, lr
-
-fusuaddrfault:
- mvn r0, #0x00000000
- mov pc, lr
-
-fusupcbfault:
- stmfd sp!, {lr}
- mov r2, r0
- add r0, pc, #ReadWordText1 - . - 8
- mov r1, r2
- bl _printf
- mvn r0, #0x00000000
- ldmfd sp!, {lr}
- mov pc, lr
-
- .global new_suword
-
-new_suword:
- ldr r2, Lcurpcb
- ldr r2, [r2]
- teq r2, #0x00000000
- beq fusupcbfault
- add r3, pc, #fusufault - . - 8
- str r3, [r2, #PCB_ONFAULT]
-
- str r1, [r0]
-
- mov r0, #0x00000000
- str r0, [r2, #PCB_ONFAULT]
- mov pc, lr
-
- .global new_suswintr
-
-new_suswintr:
- ldr r2, Lcurpcb
- ldr r2, [r2]
- teq r2, #0x00000000
- beq fusupcbfault
- add r3, pc, #fusubailout - . - 8
- str r3, [r2, #PCB_ONFAULT]
-
- strb r1, [r0, #0x0000]
- mov r1, r1, lsr #8
- strb r1, [r0, #0x0000]
-
- mov r0, #0x00000000
- str r0, [r2, #PCB_ONFAULT]
- mov pc, lr
-
- .global new_susword
-
-new_susword:
- ldr r2, Lcurpcb
- ldr r2, [r2]
- teq r2, #0x00000000
- beq fusupcbfault
- add r3, pc, #fusufault - . - 8
- str r3, [r2, #PCB_ONFAULT]
-
- strb r1, [r0, #0x0000]
- mov r1, r1, lsr #8
- strb r1, [r0, #0x0000]
-
- mov r0, #0x00000000
- str r0, [r2, #PCB_ONFAULT]
- mov pc, lr
-
- .global new_subyte
-
-new_subyte:
- ldr r2, Lcurpcb
- ldr r2, [r2]
- teq r2, #0x00000000
- beq fusupcbfault
- add r3, pc, #fusufault - . - 8
- str r3, [r2, #PCB_ONFAULT]
-
- strb r1, [r0]
-
- mov r0, #0x00000000
- str r0, [r2, #PCB_ONFAULT]
- mov pc, lr
diff --git a/sys/arch/arm32/arm32/setcpsr.S b/sys/arch/arm32/arm32/setcpsr.S
deleted file mode 100644
index 50d2e7c7aaa..00000000000
--- a/sys/arch/arm32/arm32/setcpsr.S
+++ /dev/null
@@ -1,95 +0,0 @@
-/* $OpenBSD: setcpsr.S,v 1.2 2000/03/03 00:54:46 todd Exp $ */
-/* $NetBSD: setcpsr.S,v 1.1 1996/01/31 23:16:54 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * setcpsr.S
- *
- * Miscellaneous routines to play with the CPSR register
- *
- * Eventually this routine can be inline assembly.
- *
- * Created : 12/09/94
- * Last updated : 28/05/95
- *
- * Based of kate/display/setcpsr.s
- *
- */
-
-fp .req r11
-ip .req r12
-sp .req r13
-lr .req r14
-pc .req r15
-
-.text
-
- .global _SetCPSR
-
-/* Sets and clears bits in the CPSR register
- *
- * r0 - bic mask
- * r1 - eor mask
- */
-
-_SetCPSR:
-/* mov ip, sp
- stmfd sp!, {fp, ip, lr, pc}
- sub fp, ip, #4*/
-
- mrs r3, cpsr_all /* Set the CPSR */
- bic r2, r3, r0
- eor r2, r2, r1
- msr cpsr_all, r2
-
- mov r0, r3 /* Return the old CPSR */
-
-/* ldmea fp, {fp, sp, pc}*/
- mov pc, lr
-
- .global _GetCPSR
-
-/* Gets the CPSR register
- *
- * Returns the CPSR in r0
- */
-
-_GetCPSR:
- mrs r0, cpsr_all /* Get the CPSR */
-
- mov pc, lr
-
diff --git a/sys/arch/arm32/arm32/setstack.S b/sys/arch/arm32/arm32/setstack.S
deleted file mode 100644
index 87e3591f14b..00000000000
--- a/sys/arch/arm32/arm32/setstack.S
+++ /dev/null
@@ -1,104 +0,0 @@
-/* $OpenBSD: setstack.S,v 1.2 2000/03/03 00:54:46 todd Exp $ */
-/* $NetBSD: setstack.S,v 1.1 1996/01/31 23:16:59 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * setstack.S
- *
- * Miscellaneous routine to play with the stack pointer in different CPU modes
- *
- * Eventually this routine can be inline assembly.
- *
- * Created : 17/09/94
- * Last updated : 15/10/94
- *
- * Based of kate/display/setstack.s
- *
- */
-
-#include <machine/cpu.h>
-
-sp .req r13
-lr .req r14
-pc .req r15
-
-.text
-
- .global _set_stackptr
-
-/* To set the stack pointer for a particular mode we must switch
- * to that mode update the banked r13 and then switch back.
- * This routine provides an easy way of doing this for any mode
- *
- * r0 = CPU mode
- * r1 = stackptr
- */
-
-_set_stackptr:
- mrs r3, cpsr_all /* Switch to the appropriate mode */
- bic r2, r3, #(PSR_MODE)
- orr r2, r2, r0
- msr cpsr_all, r2
-
- mov sp, r1 /* Set the stack pointer */
-
- msr cpsr_all, r3 /* Restore the old mode */
-
- mov pc, lr /* Exit */
-
- .global _get_stackptr
-
-/* To get the stack pointer for a particular mode we must switch
- * to that mode copy the banked r13 and then switch back.
- * This routine provides an easy way of doing this for any mode
- *
- * r0 = CPU mode
- */
-
-_get_stackptr:
- mrs r3, cpsr_all /* Switch to the appropriate mode */
- bic r2, r3, #(PSR_MODE)
- orr r2, r2, r0
- msr cpsr_all, r2
-
- mov r0, sp /* Set the stack pointer */
-
- msr cpsr_all, r3 /* Restore the old mode */
-
- mov pc, lr /* Exit */
-
-/* End of setstack.S */
diff --git a/sys/arch/arm32/arm32/spl.S b/sys/arch/arm32/arm32/spl.S
deleted file mode 100644
index 62733c69e82..00000000000
--- a/sys/arch/arm32/arm32/spl.S
+++ /dev/null
@@ -1,126 +0,0 @@
-/* $OpenBSD: spl.S,v 1.2 2000/03/03 00:54:46 todd Exp $ */
-/* $NetBSD: spl.S,v 1.1 1996/03/08 18:03:15 mark Exp $ */
-
-/*
- * Copyright (c) 1996 Mark Brinicombe.
- * Copyright (c) Brini.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * splasm.S
- *
- * spl routines
- *
- * Created : 01/03/96
- *
- */
-
-#include "assym.h"
-#include <machine/psl.h>
-
-sp .req r13
-lr .req r14
-pc .req r15
-
- .text
- .align 0
-
-Lcurrent_spl_level:
- .word _current_spl_level
-
-Lspl_masks:
- .word _spl_masks
-
-Lspl_mask:
- .word _spl_mask
-
- .global _raisespl
-_raisespl:
- mov r3, r0 /* Save the new value */
- ldr r1, Lcurrent_spl_level /* Get the current spl level */
- ldr r0, [r1]
- cmp r3, r0
- movle pc, lr
-
- str r3, [r1] /* Store the new spl mask */
-
- ldr r2, Lspl_masks /* Get the spl mask */
- ldr r2, [r2, r3, lsl #2]
-
- ldr r1, Lspl_mask /* Store in the current spl mask */
- str r2, [r1]
-
- stmfd sp!, {r0, lr} /* Preserve registers */
- bl _irq_setmasks /* Update the actual masks */
- ldmfd sp!, {r0, pc} /* Exit */
-
-
- .global _lowerspl
-_lowerspl:
- mov r3, r0 /* Save the new value */
- ldr r1, Lcurrent_spl_level /* Get the current spl level */
- ldr r0, [r1]
- cmp r3, r0
- movge pc, lr
-
- str r3, [r1] /* Store the new spl mask */
-
- ldr r2, Lspl_masks /* Get the spl mask */
- ldr r2, [r2, r3, lsl #2]
-
- ldr r1, Lspl_mask /* Store in the current spl mask */
- str r2, [r1]
-
- stmfd sp!, {r0, lr} /* Preserve registers */
- bl _irq_setmasks /* Update the actual masks */
- ldmfd sp!, {r0, pc} /* Exit */
-
-
- .global _splx
-_splx:
- mov r3, r0 /* Save the new value */
- ldr r1, Lcurrent_spl_level /* Get the current spl level */
- ldr r0, [r1]
- cmp r3, r0
- moveq pc, lr
-
- str r3, [r1] /* Store the new spl mask */
-
- ldr r2, Lspl_masks /* Get the spl mask */
- ldr r2, [r2, r3, lsl #2]
-
- ldr r1, Lspl_mask /* Store in the current spl mask */
- str r2, [r1]
-
- stmfd sp!, {r0, lr} /* Preserve registers */
- bl _irq_setmasks /* Update the actual masks */
- ldmfd sp!, {r0, pc} /* Exit */
-
diff --git a/sys/arch/arm32/arm32/strstr.c b/sys/arch/arm32/arm32/strstr.c
deleted file mode 100644
index 5b3a0f9529e..00000000000
--- a/sys/arch/arm32/arm32/strstr.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $NetBSD: strstr.c,v 1.2 1996/03/27 22:42:28 mark Exp $ */
-
-/*
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: strstr.c,v 1.4 1995/06/15 00:08:43 jtc Exp
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-/*
- * Find the first occurrence of find in s.
- */
-
-char *
-strstr(s, find)
- register const char *s, *find;
-{
- register char c, sc;
- register size_t len;
-
- if ((c = *find++) != 0) {
- len = strlen(find);
- do {
- do {
- if ((sc = *s++) == 0)
- return (NULL);
- } while (sc != c);
- } while (strncmp(s, find, len) != 0);
- s--;
- }
- return ((char *)s);
-}
-
-/* End of strstr.c */
diff --git a/sys/arch/arm32/arm32/strtoul.c b/sys/arch/arm32/arm32/strtoul.c
deleted file mode 100644
index d245930cc47..00000000000
--- a/sys/arch/arm32/arm32/strtoul.c
+++ /dev/null
@@ -1,83 +0,0 @@
-#include <sys/param.h>
-
-#ifndef ULONG_MAX
-#define ULONG_MAX ((u_long)(~0L)) /* 0xFFFFFFFF */
-#endif
-
-u_long
-strtoul(s, ptr, base)
- const char *s;
- char **ptr;
- int base;
-{
- u_long total = 0;
- u_int digit;
- const char *start=s;
- int did_conversion=0;
- int overflow = 0;
- int negate = 0;
- u_long maxdiv, maxrem;
-
- if (s == NULL) {
- if (!ptr)
- *ptr = (char *)start;
- return 0L;
- }
-
- while (*s == ' ')
- s++;
- if (*s == '+')
- s++;
- else if (*s == '-')
- s++, negate = 1;
- if (base==0 || base==16) { /* the 'base==16' is for handling 0x */
- int tmp;
-
- /*
- * try to infer base from the string
- */
- if (*s != '0')
- tmp = 10; /* doesn't start with 0 - assume decimal */
- else if (s[1] == 'X' || s[1] == 'x')
- tmp = 16, s += 2; /* starts with 0x or 0X - hence hex */
- else
- tmp = 8; /* starts with 0 - hence octal */
- if (base==0)
- base = (int)tmp;
- }
-
- maxdiv = ULONG_MAX / base;
- maxrem = ULONG_MAX % base;
-
- while ((digit = *s) != '\0') {
- if (digit >= '0' && digit < ('0'+base))
- digit -= '0';
- else
- if (base > 10) {
- if (digit >= 'a' && digit < ('a'+(base-10)))
- digit = digit - 'a' + 10;
- else if (digit >= 'A' && digit < ('A'+(base-10)))
- digit = digit - 'A' + 10;
- else
- break;
- }
- else
- break;
- did_conversion = 1;
- if (total > maxdiv
- || (total == maxdiv && digit > maxrem))
- overflow = 1;
- total = (total * base) + digit;
- s++;
- }
- if (overflow) {
- if (ptr != NULL)
- *ptr = (char *)s;
- return (ULONG_MAX);
- }
- if (ptr != NULL)
- *ptr = (char *) ((did_conversion) ? (char *)s : (char *)start);
- return negate ? -total : total;
-}
-
-/* End of strtoul.c */
diff --git a/sys/arch/arm32/arm32/stubs.c b/sys/arch/arm32/arm32/stubs.c
deleted file mode 100644
index f87be59bf5a..00000000000
--- a/sys/arch/arm32/arm32/stubs.c
+++ /dev/null
@@ -1,618 +0,0 @@
-/* $NetBSD: stubs.c,v 1.4 1996/03/08 18:41:52 mark Exp $ */
-
-/*
- * Copyright (c) 1994,1995 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * stubs.c
- *
- * Routines that are temporary or do not have a home yet.
- *
- * Created : 17/09/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/errno.h>
-#include <sys/proc.h>
-#include <sys/types.h>
-#include <sys/device.h>
-#include <sys/buf.h>
-#include <sys/exec.h>
-#include <sys/vnode.h>
-#include <sys/conf.h>
-#include <sys/reboot.h>
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-#include <dev/ramdisk.h>
-#include <machine/param.h>
-#include <machine/vmparam.h>
-#include <machine/cpu.h>
-#include <machine/irqhandler.h>
-#include <machine/vidc.h>
-#include <machine/bootconfig.h>
-#include <machine/katelib.h>
-#include <machine/psl.h>
-
-#include "fdc.h"
-#include "rd.h"
-
-#define VM_MAXKERN_ADDRESS 0xf3000000
-
-extern int ffs_mountroot();
-extern int cd9660_mountroot();
-int do_mountroot();
-int (*mountroot)() = do_mountroot;
-
-extern u_int soft_interrupts;
-
-extern int msgbufmapped;
-extern dev_t rootdev;
-extern dev_t dumpdev;
-#ifdef RAMDISK_HOOKS
-extern struct rd_conf *bootrd;
-#endif
-
-extern BootConfig bootconfig;
-extern videomemory_t videomemory;
-
-int
-do_mountroot()
-{
- struct buf *bp;
- int loop;
- int s;
- int type;
- int floppysize;
- int error;
-
-#if (NFDC > 0 && NRD > 0 && defined(RAMDISK_HOOKS))
-
-/*
- * Ok ideally the ramdisc would be loaded via the rd_open_hook() but since
- * we are loading the ramdisc from floppy we only want to load it during
- * the boot and not at any other time.
- */
-
-/*
- * Ok bit of bodging here. The ramdisc minor is the unit number. However if booting
- * from the ramdisc we limit to always booting off minor 0 i.e. rd0 The ramdisc
- * device passed as the root device is only used to identify the ramdisc major. The
- * minor, instead of indicating the ramdisc unit is used to indicate the floppy
- * minor that should be used for loading the boot ramdisc which is unit 0.
- */
-
- if (major(rootdev) == 18 && bootrd) {
- if (load_ramdisc_from_floppy(bootrd, makedev(17, minor(rootdev))) != 0)
- panic("Failed to load ramdisc");
- boothowto |= RB_SINGLE;
- rootdev = makedev(major(rootdev), 0);
- }
-#endif
-
-/*
- * Slight bug with mounting CD's sometimes. The first mount may fail
- * so we will try again. This only happens with the temporary ATAPI
- * CDROM driver we are using
- */
-
-#ifdef CD9660
- if (major(rootdev) == 20 || major(rootdev) == 26) {
- error = cd9660_mountroot();
- if (error)
- error = cd9660_mountroot();
- }
- else {
-#endif
-#ifdef FFS
- error = ffs_mountroot();
-#else
-#error FFS not configured
-#endif
-#ifdef CD9660
- if (error)
- error = cd9660_mountroot();
- }
-#endif
- return(error);
-}
-
-
-/*
- * All the copyin and copyout and copystr functions need to be recoded in assembly
- * at some point. The guts of the functions now use an assembly bcopy routine but
- * it would be nice to code them completely in assembly. The main reason they have
- * not been is purely because it is easier to add debugging code to check the
- * parameters in C.
- */
-
-#if 0
-int
-copystr(from, to, maxlen, lencopied)
- void *from;
- void *to;
- size_t maxlen;
- size_t *lencopied;
-{
- int byte = 0;
- int len;
-
- len = 0;
-
- do {
- if (len == maxlen)
- break;
- byte = *((caddr_t)from)++;
- *((caddr_t)to)++ = byte;
- ++len;
- } while (byte != 0);
-
- if (lencopied)
- *lencopied = len;
-
- if (byte == 0)
- return(0);
- else
- return(ENAMETOOLONG);
-}
-
-
-#else
-int
-copystr(from, to, maxlen, lencopied)
- void *from;
- void *to;
- size_t maxlen;
- size_t *lencopied;
-
-{
- return(copystrinout(from, to, maxlen, lencopied));
-}
-#endif
-
-int copystrinout __P((void */*from*/, void */*to*/, size_t /*maxlen*/, size_t */*lencopied*/));
-
-
-int
-copyinstr(udaddr, kaddr, len, done)
- void *udaddr;
- void *kaddr;
- u_int len;
- u_int *done;
-{
- if (udaddr < (void *)VM_MIN_ADDRESS
- || udaddr >= (void *)VM_MAXUSER_ADDRESS) {
- printf("akt: copyinstr: udaddr=%08x kaddr=%08x\n",
- (u_int)udaddr, (u_int)kaddr);
- return(EFAULT);
- }
- if (kaddr < (void *)VM_MAXUSER_ADDRESS
- || kaddr >= (void *)VM_MAXKERN_ADDRESS) {
- printf("akt: copyinstr: udaddr=%08x kaddr=%08x\n",
- (u_int)udaddr, (u_int)kaddr);
- return(EFAULT);
- }
- return(copystrinout(udaddr, kaddr, len, done));
-}
-
-int
-copyoutstr(kaddr, udaddr, len, done)
- void *kaddr;
- void *udaddr;
- u_int len;
- u_int *done;
-{
- if (udaddr < (void *)VM_MIN_ADDRESS
- || udaddr >= (void*)VM_MAXUSER_ADDRESS) {
- printf("akt: copyoutstr: udaddr=%08x kaddr=%08x\n",
- (u_int)udaddr, (u_int)kaddr);
- return(EFAULT);
- }
- if (kaddr < (void *)VM_MAXUSER_ADDRESS
- || kaddr >= (void *)VM_MAXKERN_ADDRESS) {
- printf("akt: copyoutstr: udaddr=%08x kaddr=%08x\n",
- (u_int)udaddr, (u_int)kaddr);
- return(EFAULT);
- }
- return(copystrinout(kaddr, udaddr, len, done));
-}
-
-int bcopyinout __P((void *, void *, u_int));
-
-int
-copyin(udaddr, kaddr, len)
- void *udaddr;
- void *kaddr;
- u_int len;
-{
- int error;
-
- if (udaddr < (void *)VM_MIN_ADDRESS
- || udaddr >= (void *)VM_MAXUSER_ADDRESS) {
- printf("akt: copyin: udaddr=%08x kaddr=%08x\n",
- (u_int)udaddr, (u_int)kaddr);
- return(EFAULT);
- }
- if (kaddr < (void *)VM_MAXUSER_ADDRESS
- || kaddr >= (void *)VM_MAXKERN_ADDRESS) {
- printf("akt: copyin: udaddr=%08x kaddr=%08x\n",
- (u_int)udaddr, (u_int)kaddr);
- return(EFAULT);
- }
- error = bcopyinout(udaddr, kaddr, len);
- if (error)
- printf("akt: copyin(%08x,%08x,%08x) failed\n",
- (u_int)udaddr, (u_int)kaddr, len);
- return(error);
-}
-
-int
-copyout(kaddr, udaddr, len)
- void *kaddr;
- void *udaddr;
- u_int len;
-{
- int error;
-
- if (udaddr < (void*)VM_MIN_ADDRESS
- || udaddr >= (void*)VM_MAXUSER_ADDRESS) {
- printf("akt: copyout: udaddr=%08x kaddr=%08x\n",
- (u_int)udaddr, (u_int)kaddr);
- return(EFAULT);
- }
- if (kaddr < (void *)VM_MAXUSER_ADDRESS
- || kaddr >= (void *)VM_MAXKERN_ADDRESS) {
- printf("akt: copyout: udaddr=%08x kaddr=%08x\n",
- (u_int)udaddr, (u_int)kaddr);
- return(EFAULT);
- }
- error = bcopyinout(kaddr, udaddr, len);
- if (error) {
- printf("akt: copyout(%08x,%08x,%08x) failed\n",
- (u_int)kaddr, (u_int)udaddr, len);
- traceback();
- }
- return(error);
-}
-
-void
-setsoftnet()
-{
- soft_interrupts |= IRQMASK_SOFTNET;
-}
-
-int astpending;
-
-void
-setsoftast()
-{
- astpending = 1;
-}
-
-extern int want_resched;
-
-void
-need_resched(void)
-{
- want_resched = 1;
- setsoftast();
-}
-
-
-struct queue {
- struct queue *q_next, *q_prev;
-};
-
-/*
- * insert an element into a queue
- */
-
-void
-_insque(v1, v2)
- void *v1;
- void *v2;
-{
- register struct queue *elem = v1, *head = v2;
- register struct queue *next;
-
- next = head->q_next;
- elem->q_next = next;
- head->q_next = elem;
- elem->q_prev = head;
- next->q_prev = elem;
-}
-
-/*
- * remove an element from a queue
- */
-
-void
-_remque(v)
- void *v;
-{
- register struct queue *elem = v;
- register struct queue *next, *prev;
-
- next = elem->q_next;
- prev = elem->q_prev;
- next->q_prev = prev;
- prev->q_next = next;
- elem->q_prev = 0;
-}
-
-
-
-/*
- * These variables are needed by /sbin/savecore
- */
-u_long dumpmag = 0x8fca0101; /* magic number */
-int dumpsize = 0; /* pages */
-long dumplo = 0; /* blocks */
-
-/*
- * This is called by configure to set dumplo and dumpsize.
- * Dumps always skip the first CLBYTES of disk space
- * in case there might be a disk label stored there.
- * If there is extra space, put dump at the end to
- * reduce the chance that swapping trashes it.
- */
-
-void
-dumpconf()
-{
- int nblks; /* size of dump area */
- int maj;
-
- if (dumpdev == NODEV)
- return;
- maj = major(dumpdev);
- if (maj < 0 || maj >= nblkdev)
- panic("dumpconf: bad dumpdev=0x%x", dumpdev);
- if (bdevsw[maj].d_psize == NULL)
- return;
- nblks = (*bdevsw[maj].d_psize)(dumpdev);
- if (nblks <= ctod(1))
- return;
-
- dumpsize = physmem;
-
- /* Always skip the first CLBYTES, in case there is a label there. */
- if (dumplo < ctod(1))
- dumplo = ctod(1);
-
- /* Put dump at end of partition, and make it fit. */
- if (dumpsize > dtoc(nblks - dumplo))
- dumpsize = dtoc(nblks - dumplo);
- if (dumplo < nblks - ctod(dumpsize))
- dumplo = nblks - ctod(dumpsize);
-}
-
-
-extern pagehook_t page_hook0;
-
-/*
- * Doadump comes here after turning off memory management and
- * getting on the dump stack, either when called above, or by
- * the auto-restart code.
- */
-
-void
-dumpsys()
-{
- daddr_t blkno;
- int psize;
- int error;
- int addr;
- int block;
- vm_offset_t dumpspace;
-
- msgbufmapped = 0;
- if (dumpdev == NODEV)
- return;
- if (dumpsize == 0) {
- dumpconf();
- if (dumpsize == 0)
- return;
- }
- printf("\ndumping to dev %x, offset %d\n", (u_int)dumpdev,
- (u_int)dumplo);
-
- blkno = dumplo;
- dumpspace = page_hook0.va;
-
- psize = (*bdevsw[major(dumpdev)].d_psize)(dumpdev);
- printf("dump ");
- if (psize == -1) {
- printf("area unavailable\n");
- return;
- }
-
- error = 0;
- for (block = 0; block < bootconfig.dramblocks && error == 0; ++block) {
- for (addr = bootconfig.dram[block].address;
- addr < bootconfig.dram[block].address
- + bootconfig.dram[block].pages * NBPG; addr += NBPG) {
- pmap_map(dumpspace, addr, addr + NBPG, VM_PROT_READ);
- error = (*bdevsw[major(dumpdev)].d_dump)(dumpdev, blkno, (caddr_t) dumpspace, NBPG);
- if (error) break;
- blkno += btodb(NBPG);
- }
- }
-
- if (error == 0 && videomemory.vidm_type == VIDEOMEM_TYPE_VRAM) {
- for (addr = videomemory.vidm_pbase; addr < videomemory.vidm_pbase
- + videomemory.vidm_size; addr += NBPG) {
- pmap_map(dumpspace, addr, addr + NBPG, VM_PROT_READ);
- error = (*bdevsw[major(dumpdev)].d_dump)(dumpdev, blkno, (caddr_t) dumpspace, NBPG);
- if (error) break;
- blkno += btodb(NBPG);
- }
- }
-
- switch (error) {
- case ENXIO:
- printf("device bad\n");
- break;
-
- case EFAULT:
- printf("device not ready\n");
- break;
-
- case EINVAL:
- printf("area improper\n");
- break;
-
- case EIO:
- printf("i/o error\n");
- break;
-
- case EINTR:
- printf("aborted from console\n");
- break;
-
- default:
- printf("succeeded\n");
- break;
- }
- printf("\n\n");
- delay(1000000);
-}
-
-/*
- * Dummy function is case no audio device has been configured
- * Need to fix the code that uses this function (console) to check NBEEP.
- */
-
-#include "beep.h"
-#if NBEEP == 0
-void
-beep_generate()
-{
-}
-#endif
-
-
-#if 0
-/* Debugging functions to dump the buffers linked to a vnode */
-
-void
-dumpvndbuf(vp)
- register struct vnode *vp;
-{
- register struct buf *bp, *nbp;
- int s;
-
- s = splbio();
- for (bp = vp->v_dirtyblkhd.lh_first; bp; bp = nbp) {
- nbp = bp->b_vnbufs.le_next;
-
- printf("buf=%08x\n", bp);
- printf("flags=%08x proc=%08x bufsize=%08x dev=%04x\n", bp->b_flags, bp->b_proc, bp->b_bufsize, bp->b_dev);
- printf("vp=%08x resid=%08x count=%08x addr=%08x\n", bp->b_vp, bp->b_resid, bp->b_bcount, bp->b_un.b_addr);
- }
- (void)splx(s);
-}
-
-
-void
-dumpvncbuf(vp)
- register struct vnode *vp;
-{
- register struct buf *bp, *nbp;
- int s;
-
- s = splbio();
- for (bp = vp->v_cleanblkhd.lh_first; bp; bp = nbp) {
- nbp = bp->b_vnbufs.le_next;
-
- printf("buf=%08x\n", bp);
- printf("flags=%08x proc=%08x bufsize=%08x dev=%04x\n", bp->b_flags, bp->b_proc, bp->b_bufsize, bp->b_dev);
- printf("vp=%08x resid=%08x count=%08x addr=%08x\n", bp->b_vp, bp->b_resid, bp->b_bcount, bp->b_un.b_addr);
- }
- (void)splx(s);
-}
-#endif
-
-
-extern u_int spl_mask;
-
-int current_spl_level = SPL_0;
-u_int spl_masks[8];
-
-int safepri = SPL_0;
-
-void
-set_spl_masks()
-{
- spl_masks[SPL_0] = 0xffffffff;
- spl_masks[SPL_SOFT] = ~IRQMASK_SOFTNET;
- spl_masks[SPL_BIO] = irqmasks[IPL_BIO];
- spl_masks[SPL_NET] = irqmasks[IPL_NET];
- spl_masks[SPL_TTY] = irqmasks[IPL_TTY];
- spl_masks[SPL_CLOCK] = irqmasks[IPL_CLOCK];
- spl_masks[SPL_IMP] = irqmasks[IPL_IMP];
- spl_masks[SPL_HIGH] = 0x00000000;
-}
-
-void
-dump_spl_masks()
-{
- printf("spl0=%08x splsoft=%08x splbio=%08x splnet=%08x\n",
- spl_masks[SPL_0], spl_masks[SPL_SOFT], spl_masks[SPL_BIO], spl_masks[SPL_NET]);
- printf("spltty=%08x splclock=%08x splimp=%08x splhigh=%08x\n",
- spl_masks[SPL_TTY], spl_masks[SPL_CLOCK], spl_masks[SPL_IMP], spl_masks[SPL_HIGH]);
-}
-
-/*
- * Ok things are broken here. If we lower the spl level to SPL_SOFT
- * then, for the most things work. However wd interrupts start to get
- * lost ... i.e. you either get wdc interrupt lost messages or
- * wdc timeout messages.
- * The fault is the CLKF_FRAME macro uses in kern_clock.c. This
- * currently always returns 1 thus splsoftclock() is always
- * called before calling softclock().
- *
- * This is about to be fixed
- */
-
-int
-splsoftclock()
-{
-/* return(lowerspl(SPL_SOFT));*/
- return(current_spl_level);
-}
-
-/* End of stubs.c */
diff --git a/sys/arch/arm32/arm32/swapgeneric.c b/sys/arch/arm32/arm32/swapgeneric.c
deleted file mode 100644
index 6c7a2b3e697..00000000000
--- a/sys/arch/arm32/arm32/swapgeneric.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $NetBSD: swapgeneric.c,v 1.2 1996/03/27 22:42:30 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * swapgeneric.h
- *
- * Miscellaneous swap stuff
- *
- * Created : 10/10/94
- */
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-
-dev_t rootdev = NODEV;
-dev_t swapdev = NODEV;
-dev_t argdev = NODEV;
-dev_t dumpdev = NODEV;
-int nswap;
-struct swdevt swdevt[] = {
- { NODEV, 0, 0 },
- { NODEV, 0, 0 },
- { NODEV, 0, 0 },
- { NODEV, 0, 0 },
-};
-
-/* End of swapgeneric.c */
diff --git a/sys/arch/arm32/arm32/sys_machdep.c b/sys/arch/arm32/arm32/sys_machdep.c
deleted file mode 100644
index 64499aace16..00000000000
--- a/sys/arch/arm32/arm32/sys_machdep.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* $NetBSD: sys_machdep.c,v 1.2 1996/03/27 22:42:31 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * sys_machdep.c
- *
- * Machine dependant syscalls
- *
- * Created : 10/01/96
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/mbuf.h>
-#include <sys/buf.h>
-#include <sys/exec.h>
-#include <sys/mount.h>
-#include <sys/vnode.h>
-#include <sys/sysctl.h>
-#include <sys/syscallargs.h>
-
-int
-sys_sysarch(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct sys_sysarch_args /* {
- syscallarg(int) op;
- syscallarg(char *) parms;
- } */ *uap = v;
-
- printf("sys_sysarch: Currently stoned - Cannot support the operation (%d)\n",
- SCARG(uap, op));
-
- return(EINVAL);
-}
-
-/* End of sys_machdep.c */
diff --git a/sys/arch/arm32/arm32/syscall.c b/sys/arch/arm32/arm32/syscall.c
deleted file mode 100644
index 335dc62b297..00000000000
--- a/sys/arch/arm32/arm32/syscall.c
+++ /dev/null
@@ -1,573 +0,0 @@
-/* $NetBSD: syscall.c,v 1.5 1996/03/13 21:21:00 mark Exp $ */
-
-/*
- * Copyright (c) 1994,1995 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * syscall.c
- *
- * High level syscall handling
- *
- * Created : 09/11/94
- */
-
-#include <sys/param.h>
-#include <sys/filedesc.h>
-#include <sys/errno.h>
-#include <sys/exec.h>
-#include <sys/kernel.h>
-#include <sys/mount.h>
-#include <sys/map.h>
-#include <sys/proc.h>
-#include <sys/resourcevar.h>
-#include <sys/signalvar.h>
-#include <sys/systm.h>
-#include <sys/vnode.h>
-#include <sys/conf.h>
-#include <sys/buf.h>
-#include <sys/device.h>
-#include <sys/protosw.h>
-#include <sys/reboot.h>
-#include <sys/user.h>
-#include <sys/syscall.h>
-#include <sys/syscallargs.h>
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#ifdef KTRACE
-#include <sys/ktrace.h>
-#endif
-#include <machine/cpu.h>
-#include <machine/frame.h>
-#include <machine/katelib.h>
-#include <machine/undefined.h>
-
-#include "hydrabus.h"
-
-/*
- * CONTINUE_AFTER_SYSCALL_BUG is used to determine whether the kernel
- * should continue running following a swi instruction in SVC mode.
- * This was used for debugging.
- */
-
-#define CONTINUE_AFTER_SYSCALL_BUG
-
-extern int pmap_debug_level;
-extern u_int kmodule_size;
-extern u_int kmodule_base;
-u_int arm700bugcount = 0;
-extern int vnodeconsolebug;
-extern int usertraceback;
-
-#if NHYDRABUS > 0
-typedef struct {
- vm_offset_t physical;
- vm_offset_t virtual;
-} pv_addr_t;
-
-extern pv_addr_t hydrascratch;
-#endif
-
-void postmortem __P((trapframe_t *));
-void fpe_dump_prof __P(());
-
-#define SYSCALL_SPECIAL_RETURN \
- userret(p, frame->tf_pc, sticks); \
- validate_trapframe(frame, 4); \
- return;
-
-/*
- * syscall(frame):
- *
- * System call request from POSIX system call gate interface to kernel.
- */
-
-void
-syscall(frame, code)
- trapframe_t *frame;
- int code;
-{
- caddr_t params;
- struct sysent *callp;
- struct proc *p;
- int error, opc;
- u_int argsize;
- int args[8], rval[2];
- int nsys;
- u_quad_t sticks;
- int regparams;
-
- cnt.v_syscall++;
-
-#ifdef DIAGNOSTIC
- if ((frame->tf_spsr & PSR_MODE) != PSR_USR32_MODE) {
- u_int s;
-
- s = splhigh();
- printf("swi code = %08x %d\n", code, code);
- postmortem(frame);
-
- printf("nkt: syscall in kernel mode !\n");
-#ifdef CONTINUE_AFTER_SYSCALL_BUG
- printf("The system should now be considered very unstable :-(\n");
- sigexit(curproc, SIGILL);
-
-/* Not reached */
-
- (void)splx(s);
- userret(curproc, frame->tf_pc, curproc->p_sticks);
-
-#ifdef VALIDATE_TRAPFRAME
- validate_trapframe(frame, 4);
-#endif
- return;
-#else
- panic("syscall in kernel mode !");
-#endif
- }
-#endif
-
-/*
- * ARM700/ARM710 match sticks and sellotape job ...
- *
- * I know this affects GPS/VLSI ARM700/ARM710.
- *
- * Not heard anything from ARM since I told them about this ...
- * On occasion data aborts are mishandled and end up calling
- * the swi vector.
- */
-
- if ((ReadWord(frame->tf_pc - 4) & 0x0f000000) != 0x0f000000) {
- frame->tf_pc -= 4;
- ++arm700bugcount;
-
- userret(curproc, frame->tf_pc, curproc->p_sticks);
-
-#ifdef VALIDATE_TRAPFRAME
- validate_trapframe(frame, 4);
-#endif
- return;
- }
-
-#ifdef DIAGNOSTIC
- if ((GetCPSR() & PSR_MODE) != PSR_SVC32_MODE) {
- splhigh();
-
- printf("swi code = %08x %d\n", code, code);
- postmortem(frame);
- panic("syscall in non SVC mode !");
- }
-#endif
-
-/*
- * Enable interrupts if they were enable before the exception.
- * Sinces all syscalls *should* come from user mode it will always
- * be safe to enable them, but check anyway.
- */
-
-#ifndef BLOCK_IRQS
- if (!(frame->tf_spsr & I32_bit))
- enable_interrupts(I32_bit);
-#endif
-
- p = curproc;
- sticks = p->p_sticks;
- p->p_md.md_regs = frame;
- opc = frame->tf_pc;
- params = (caddr_t)&frame->tf_r0;
- regparams = 4;
-
- if (pmap_debug_level >= -1)
- printf("\x1b[31mSYSCALL\x1b[0m: code=%08x lr=%08x pid=%d\n",
- code, frame->tf_pc, p->p_pid);
-
- nsys = p->p_emul->e_nsysent;
- callp = p->p_emul->e_sysent;
-
- switch (code) {
- case 0x1002:
- printf((char *)frame->tf_r0, frame->tf_r1, frame->tf_r2, frame->tf_r3);
- SYSCALL_SPECIAL_RETURN;
- break;
-
- case 0x1003:
- printf("%s", (char *)frame->tf_r0);
- SYSCALL_SPECIAL_RETURN;
- break;
-
-/* case 0x1004:
- if (frame->tf_r0 != 0)
- panic((char *)frame->tf_r0, frame->tf_r1, frame->tf_r2,
- frame->tf_r3);
- panic("SYSCALL 0x1004 panic");
- break;*/
-
-/* case 0x1007:
- pmap_debug(frame->tf_r0);
- SYSCALL_SPECIAL_RETURN;
- break;*/
-
- case 0x1008:
- switch (frame->tf_r0) {
- case 0 :
- debug_show_all_procs(frame->tf_r1, frame->tf_r2);
- break;
-#ifdef FPE
- case 4 :
- fpe_dump_prof();
- break;
-#endif
- case 5 :
- pmap_dump_pvs();
- break;
- case 6:
- WriteWord(frame->tf_r1, frame->tf_r2);
- break;
- case 7:
- frame->tf_r0 = ReadWord(frame->tf_r1);
- break;
- case 8:
- WriteByte(frame->tf_r1, frame->tf_r2);
- break;
- case 9:
- frame->tf_r0 = ReadByte(frame->tf_r1);
- break;
- case 10:
- WriteShort(frame->tf_r1, frame->tf_r2);
- break;
- case 11:
- frame->tf_r0 = ReadShort(frame->tf_r1);
- break;
- case 16:
- pmap_pagedir_dump();
- break;
-/* case 32:
- frame->tf_r0 = pmap_next_phys_page(frame->tf_r1);
- break;*/
- default:
- printf("Unknown SYS_special call (%d)\n", frame->tf_r0);
- break;
- }
- SYSCALL_SPECIAL_RETURN;
- break;
-
- case 0x100a:
- printf("Warning: This syscall is about to be revoked (0x100a)\n");
- frame->tf_r0 = pmap_page_attributes(frame->tf_r0);
- SYSCALL_SPECIAL_RETURN;
- break;
-/*
- case 0x1010:
- frame->tf_r0 = kmodule_base;
- SYSCALL_SPECIAL_RETURN;
- break;
-
- case 0x1011:
- frame->tf_r0 = kmodule_size;
- SYSCALL_SPECIAL_RETURN;
- break;
-
- case 0x1012:
- if (frame->tf_r1 < kmodule_size) {
- bcopy((char *)frame->tf_r0, (char *)kmodule_base,
- frame->tf_r1);
- frame->tf_r0 = 0;
- }
- else
- frame->tf_r0 = 1;
- SYSCALL_SPECIAL_RETURN;
- break;
-
- case 0x1013:
- {
- int (*caller)();
-
- caller = (void *)frame->tf_r0;
-
- frame->tf_r0 = (*caller)(printf, install_coproc_handler);
- }
- SYSCALL_SPECIAL_RETURN;
- break;
-*/
-#if NHYDRABUS > 0
- case 0x1014:
- frame->tf_r0 = hydrascratch.physical;
- SYSCALL_SPECIAL_RETURN;
- break;
- case 0x1015:
- frame->tf_r0 = hydrascratch.virtual;
- SYSCALL_SPECIAL_RETURN;
- break;
- case 0x1016:
- frame->tf_r0 = (u_int)proc0.p_addr->u_pcb.pcb_pagedir;
- SYSCALL_SPECIAL_RETURN;
- break;
- case 0x1017:
- frame->tf_r0 = kmem_alloc(kernel_map, round_page(frame->tf_r0));
- SYSCALL_SPECIAL_RETURN;
- break;
- case 0x1018:
- kmem_free(kernel_map, frame->tf_r0, frame->tf_r1);
- SYSCALL_SPECIAL_RETURN;
- break;
-#endif
-#if 0
- case 0x1020:
- vprint(frame->tf_r0, frame->tf_r1);
- SYSCALL_SPECIAL_RETURN;
- break;
- case 0x1021:
- { struct vnode *vp;
- vp = (struct vp *)frame->tf_r0;
- if (vp->v_numoutput > 0 && vp->v_usecount == 0 && vp->v_writecount == 0) {
- printf("Patching vnode %08x\n", vp);
- vprint(NULL, vp);
- if (--vp->v_numoutput < 0)
- panic("vwakeup: neg numoutput");
- if ((vp->v_flag & VBWAIT) && vp->v_numoutput <= 0) {
- vp->v_flag &= ~VBWAIT;
- wakeup((caddr_t)&vp->v_numoutput);
- }
- }
- SYSCALL_SPECIAL_RETURN;
- }
- break;
-
- case 0x1022:
- { struct vnode *vp;
- vp = (struct vp *)frame->tf_r0;
- if (vp->v_numoutput == 0 && vp->v_usecount == 0 && vp->v_writecount == 0) {
- printf("Patching vnode %08x\n", vp);
- vprint(NULL, vp);
- if ((vp->v_flag & VBWAIT) && vp->v_numoutput <= 0) {
- vp->v_flag &= ~VBWAIT;
- wakeup((caddr_t)&vp->v_numoutput);
- }
- }
- SYSCALL_SPECIAL_RETURN;
- }
- break;
-
- case 0x1023:
- wakeup((caddr_t)frame->tf_r0);
- SYSCALL_SPECIAL_RETURN;
- break;
-/*
- case 0x1024:
- dumpvndbuf((struct vnode *)frame->tf_r0);
- SYSCALL_SPECIAL_RETURN;
- break;
-
- case 0x1025:
- dumpvncbuf((struct vnode *)frame->tf_r0);
- SYSCALL_SPECIAL_RETURN;
- break;
-*/
-/* case 0x1026:
- vfs_bufstats();
- SYSCALL_SPECIAL_RETURN;
- break;
-*/
- case 0x1027:
- bcopy(frame->tf_r0, frame->tf_r1, sizeof(struct vnode));
- SYSCALL_SPECIAL_RETURN;
- break;
- case 0x1028:
- vnodeconsolebug = frame->tf_r0;
- SYSCALL_SPECIAL_RETURN;
- break;
-#endif
- case 0x102a:
- usertraceback = frame->tf_r0;
- SYSCALL_SPECIAL_RETURN;
- break;
-
- case 0x102b:
- frame->tf_r0 = vmem_mapdram();
- SYSCALL_SPECIAL_RETURN;
- break;
-
- case 0x102c:
- frame->tf_r0 = vmem_mapvram();
- SYSCALL_SPECIAL_RETURN;
- break;
-
- case 0x102d:
- frame->tf_r0 = vmem_cachectl(frame->tf_r0);
- SYSCALL_SPECIAL_RETURN;
- break;
-
- case SYS_syscall:
-/* code = fuword(params);*/
- code = ReadWord(params);
- params += sizeof(int);
- regparams -= 1;
- printf("SYS_syscall: code=%d %02x", code, code);
- break;
-
- case SYS___syscall:
- if (callp != sysent)
- break;
-/* code = fuword(params + _QUAD_LOWWORD * sizeof(int));*/
-
-/* Since this will be a register ... */
-
- code = ReadWord(params + _QUAD_LOWWORD * sizeof(int));
- params += sizeof(quad_t);
- regparams -= 2;
- break;
-
- default:
- /* do nothing by default */
- break;
- }
-
- if (code < 0 || code >= nsys)
- callp += p->p_emul->e_nosys; /* illegal */
- else
- callp += code;
-
- if (callp->sy_call == sys_nosys) {
- printf("SYSCALL: nosys code=%08x lr=%08x proc=%08x pid=%d %s\n",
- code, frame->tf_pc, (u_int)p, p->p_pid, p->p_comm);
- postmortem(frame);
-#ifdef POSTMORTEM
- disassemble(frame->tf_pc-8);
- disassemble(frame->tf_pc-4);
- disassemble(frame->tf_pc);
- disassemble(frame->tf_pc+4);
-#endif
- pmap_debug(-2);
- }
-
- argsize = callp->sy_argsize;
- if (argsize > (regparams * sizeof(int)))
- argsize = regparams*sizeof(int);
-/* if (argsize && (error = copyin(params, (caddr_t)args, argsize))) {
-#ifdef SYSCALL_DEBUG
- scdebug_call(p, code, callp->sy_narg, args);
-#endif
- goto bad;
- }*/
- if (argsize)
- bcopy(params, (caddr_t)args, argsize);
-
- argsize = callp->sy_argsize;
- if (callp->sy_argsize > (regparams * sizeof(int))
- && (error = copyin((caddr_t)frame->tf_usr_sp,
- (caddr_t)&args[regparams], argsize - (regparams * sizeof(int))))) {
-#ifdef SYSCALL_DEBUG
- scdebug_call(p, code, callp->sy_narg, args);
-#endif
- goto bad;
- }
-
-#ifdef SYSCALL_DEBUG
- scdebug_call(p, code, callp->sy_narg, args);
-#endif
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSCALL))
- ktrsyscall(p, code, argsize, args);
-#endif
- rval[0] = 0;
- rval[1] = frame->tf_r1;
-
- error = (*callp->sy_call)(p, args, rval);
-
- switch (error) {
- case 0:
-/*
- * Reinitialize proc pointer `p' as it may be different
- * if this is a child returning from fork syscall.
- */
- p = curproc;
- frame->tf_r0 = rval[0];
- frame->tf_r1 = rval[1];
- frame->tf_spsr &= ~PSR_C_bit; /* carry bit */
- break;
-
- case ERESTART:
-/*
- * Reconstruct the pc. opc contains the odl pc address which is
- * the instruction after the swi.
- */
- frame->tf_pc = opc - 4;
- break;
-
- case EJUSTRETURN:
-/* nothing to do */
- break;
-
- default:
- bad:
- frame->tf_r0 = error;
- frame->tf_spsr |= PSR_C_bit; /* carry bit */
- break;
- }
-
-#ifdef SYSCALL_DEBUG
- scdebug_ret(p, code, error, rval[0]);
-#endif
-
- validate_trapframe(frame, 4);
-
- userret(p, frame->tf_pc, sticks);
-
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSRET))
- ktrsysret(p, code, error, rval[0]);
-#endif
-
- validate_trapframe(frame, 4);
-}
-
-
-void
-child_return(p, frame)
- struct proc *p;
- struct trapframe *frame;
-{
- frame->tf_r0 = 0;
- frame->tf_spsr &= ~PSR_C_bit; /* carry bit */
-
- userret(p, frame->tf_pc, 0);
-
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSRET))
- ktrsysret(p, SYS_fork, 0, 0);
-#endif
-}
-
-/* End of syscall.c */
diff --git a/sys/arch/arm32/arm32/undefined.c b/sys/arch/arm32/arm32/undefined.c
deleted file mode 100644
index 941c63d1fab..00000000000
--- a/sys/arch/arm32/arm32/undefined.c
+++ /dev/null
@@ -1,326 +0,0 @@
-/* $NetBSD: undefined.c,v 1.2 1996/03/08 20:54:25 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- * Copyright (c) 1995 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * undefined.c
- *
- * Fault handler
- *
- * Created : 06/01/95
- */
-
-#define CONTINUE_AFTER_RESET_BUG
-#define FAST_FPE
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/user.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#ifdef FAST_FPE
-#include <sys/acct.h>
-#endif
-
-#include <machine/cpu.h>
-#include <machine/katelib.h>
-#include <machine/frame.h>
-#include <machine/undefined.h>
-#include <machine/irqhandler.h>
-
-#ifdef FAST_FPE
-extern int want_resched;
-#endif
-
-undef_handler_t undefined_handlers[MAX_COPROCS];
-
-u_int disassemble __P((u_int));
-
-
-int
-default_undefined_handler(address, instruction, frame)
- u_int address;
- u_int instruction;
- trapframe_t *frame;
-{
- struct proc *p;
-
- p = curproc;
- if (p == NULL)
- p = &proc0;
- log(LOG_ERR, "Undefined instruction 0x%08x @ 0x%08x in process %s (pid %d)\n",
- instruction, address, p->p_comm, p->p_pid);
- return(1);
-}
-
-
-int
-install_coproc_handler(coproc, handler)
- int coproc;
- undef_handler_t handler;
-{
- if (coproc < 0 || coproc > MAX_COPROCS)
- return(EINVAL);
- if (handler == (undef_handler_t)0)
- handler = default_undefined_handler;
-
- undefined_handlers[coproc] = handler;
- return(0);
-}
-
-
-void
-undefined_init()
-{
- int loop;
-
- for (loop = 0; loop < MAX_COPROCS; ++loop)
- undefined_handlers[loop] = default_undefined_handler;
-}
-
-
-void
-undefinedinstruction(frame)
- trapframe_t *frame;
-{
- struct proc *p;
-/* struct pcb *pcb;*/
- u_int fault_pc;
- int fault_instruction;
- int s;
- int fault_code;
- u_quad_t sticks;
- int coprocessor;
-
-#ifndef BLOCK_IRQS
- if (!(frame->tf_spsr & I32_bit))
- enable_interrupts(I32_bit);
-#endif
-
-/* Update vmmeter statistics */
-
- cnt.v_trap++;
-
- fault_pc = frame->tf_pc - 4;
-
-/* Should use fuword() here .. but in the interests of squeezing every bit
- * of speed we will just use ReadWord(). We know the instruction can be
- * read as was just executed so this will never fail unless the kernel
- * is screwed up in which case it does not really matter does it ?
- */
-
- fault_instruction = ReadWord(fault_pc);
-
-/* Check for coprocessor instruction */
-
-/*
- * According to the datasheets you only need to look at bit 27 of the instruction
- * to tell the difference between and undefined instruction and a
- * coprocessor instruction.
- */
-
- if ((fault_instruction & (1 << 27)) != 0)
- coprocessor = (fault_instruction >> 8) & 0x0f;
- else {
- coprocessor = 0;
- s = splhigh();
- disassemble(fault_pc);
- (void)splx(s);
- }
-
-/* Get the current proc structure or proc0 if there is none */
-
- if ((p = curproc) == 0)
- p = &proc0;
-
-/* printf("fault in process %08x %d\n", p, p->p_pid);*/
-
- if ((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE) {
-/* printf("USR32 mode : %08x\n", frame->tf_spsr);*/
- sticks = p->p_sticks;
-
-/* Modify the fault_code to reflect the USR/SVC state at time of fault */
-
- fault_code = FAULT_USER;
- p->p_md.md_regs = frame;
- } else
- fault_code = 0;
-
-#if 0
-/* can't use curpcb, as it might be NULL; and we have p in a register anyway */
-
- pcb = &p->p_addr->u_pcb;
- if (pcb == 0)
- {
- panic("no pcb ... we're toast !");
- }
-#endif
-
-/* OK this is were we do something about the instruction */
-
-/* Check for coprocessor instruction */
-
-/*
- s = splhigh();
- printf("Coprocessor number %d instruction fault\n", coprocessor);
- (void)splx(s);
-*/
-
- if ((undefined_handlers[coprocessor](fault_pc, fault_instruction,
- frame)) != 0) {
- s = splhigh();
-
- if ((fault_instruction & 0x0f000010) == 0x0e000000) {
- printf("CDP\n");
- disassemble(fault_pc);
- }
- else if ((fault_instruction & 0x0e000000) == 0x0c000000) {
- printf("LDC/STC\n");
- disassemble(fault_pc);
- }
- else if ((fault_instruction & 0x0f000010) == 0x0e000010) {
- printf("MRC/MCR\n");
- disassemble(fault_pc);
- }
- else {
- printf("Undefined instruction\n");
- disassemble(fault_pc);
- }
-
- (void)splx(s);
-
- if ((fault_code & FAULT_USER) == 0) {
- printf("Undefined instruction in kernel: Heavy man !\n");
- postmortem(frame);
- }
-
- trapsignal(p, SIGILL, fault_instruction);
- }
-
- if ((fault_code & FAULT_USER) == 0)
- return;
-
-#ifdef FAST_FPE
-/* Optimised exit code */
-
- {
- int sig;
-
-/* take pending signals */
-
- while ((sig = (CURSIG(p))) != 0) {
- postsig(sig);
- }
-
- p->p_priority = p->p_usrpri;
-
-/*
- * Check for reschedule request, at the moment there is only
- * 1 ast so this code should always be run
- */
-
- if (want_resched) {
- /*
- * Since we are curproc, a clock interrupt could
- * change our priority without changing run queues
- * (the running process is not kept on a run queue).
- * If this happened after we setrunqueue ourselves but
- * before we switch()'ed, we might not be on the queue
- * indicated by our priority
- */
-
- s = splstatclock();
- setrunqueue(p);
- p->p_stats->p_ru.ru_nivcsw++;
-
- mi_switch();
-
- (void)splx(s);
- while ((sig = (CURSIG(p))) != 0) {
- postsig(sig);
- }
- }
-
-/*
- * The profiling bit is commented out at the moment. This can be reinstated
- * later on. Currently addupc_task is not written.
- */
-
- if (p->p_flag & P_PROFIL) {
- extern int psratio;
- addupc_task(p, frame->tf_pc, (int)(p->p_sticks - sticks) * psratio );
- }
-
- curpriority = p->p_priority;
- }
-
-#else
-#ifdef VALIDATE_TRAPFRAME
- validate_trapframe(frame, 5);
-#endif
-
- userret(p, frame->tf_pc, sticks);
-
-#ifdef VALIDATE_TRAPFRAME
- validate_trapframe(frame, 5);
-#endif
-#endif
-}
-
-
-void
-resethandler(frame)
- trapframe_t *frame;
-{
- postmortem(frame);
-
-#ifdef CONTINUE_AFTER_RESET_BUG
- printf("Branch throuh zero\n");
- printf("The system should now be considered very unstable :-)\n");
- sigexit(curproc, SIGILL);
-
-#ifdef VALIDATE_TRAPFRAME
- validate_trapframe(frame, 4);
-#endif
-#else
- panic("Branch through zero..... were dead");
-#endif
-}
-
-/* End of undefined.c */
diff --git a/sys/arch/arm32/arm32/vm_machdep.c b/sys/arch/arm32/arm32/vm_machdep.c
deleted file mode 100644
index d57ade8f862..00000000000
--- a/sys/arch/arm32/arm32/vm_machdep.c
+++ /dev/null
@@ -1,577 +0,0 @@
-/* $NetBSD: vm_machdep.c,v 1.3 1996/03/13 21:16:15 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1996 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * vm_machdep.h
- *
- * vm machine specifiv bits
- *
- * Created : 08/10/94
- */
-
-#define DEBUG_VMMACHDEP
-/*#define FREESWAPPEDPAGEDIRS*/
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/malloc.h>
-#include <sys/vnode.h>
-#include <sys/buf.h>
-#include <sys/user.h>
-#include <sys/core.h>
-#include <sys/exec.h>
-#include <sys/syslog.h>
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-
-#include <machine/cpu.h>
-#include <machine/pmap.h>
-#include <machine/reg.h>
-#include <machine/vmparam.h>
-#include <machine/katelib.h>
-
-#ifdef ARMFPE
-#include <sys/device.h>
-#include <machine/cpus.h>
-#include <arm32/fpe-arm/armfpe.h>
-#endif
-
-typedef struct {
- vm_offset_t physical;
- vm_offset_t virtual;
-} pv_addr_t;
-
-extern pv_addr_t systempage;
-
-extern int pmap_debug_level;
-
-void switch_exit __P((struct proc */*p*/, struct proc */*proc0*/));
-int savectx __P((struct pcb *pcb));
-void pmap_activate __P((pmap_t /*pmap*/, struct pcb */*pcbp*/));
-extern void proc_trampoline __P(());
-extern void child_return __P(());
-
-/*
- * Special compilation symbols
- * DEBUG_VMMACHDEP
- */
-
-/*
- * Finish a fork operation, with process p2 nearly set up.
- * Copy and update the kernel stack and pcb, making the child
- * ready to run, and marking it so that it can return differently
- * than the parent. Returns 1 in the child process, 0 in the parent.
- * We currently double-map the user area so that the stack is at the same
- * address in each process; in the future we will probably relocate
- * the frame pointers on the stack after copying.
- */
-
-void
-cpu_fork(p1, p2, stack, stacksize)
- struct proc *p1;
- struct proc *p2;
- void *stack;
- size_t stacksize;
-{
- struct user *up = p2->p_addr;
- struct pcb *pcb = (struct pcb *)&p2->p_addr->u_pcb;
- struct trapframe *tf;
- struct switchframe *sf;
- int loop;
- vm_offset_t addr;
- u_char *ptr;
- vm_offset_t muaddr = VM_MAXUSER_ADDRESS;
- struct vm_map *vp;
-
-#ifdef DEBUG_VMMACHDEP
- if (pmap_debug_level >= 0)
- printf("cpu_fork: %08x %08x %08x %08x\n", (u_int)p1, (u_int)p2,
- (u_int) curproc, (u_int)&proc0);
-#endif
-
-/* Sync the pcb */
- savectx(curpcb);
-
-/* Copy the pcb */
- *pcb = p1->p_addr->u_pcb;
-
-/* Set up the undefined stack for the process. Note: this stack is not in use if we are forking */
- pcb->pcb_und_sp = (u_int)p2->p_addr + USPACE_UNDEF_STACK_TOP;
- pcb->pcb_sp = (u_int)p2->p_addr + USPACE_SVC_STACK_TOP;
-
-/* Fill the undefined stack with a known pattern */
-
- ptr = ((u_char *)p2->p_addr) + USPACE_UNDEF_STACK_BOTTOM;
- for (loop = 0; loop < (USPACE_UNDEF_STACK_TOP - USPACE_UNDEF_STACK_BOTTOM); ++loop, ++ptr) {
- *ptr = 0xdd;
- }
-
-/* Fill the kernel stack with a known pattern */
-
- ptr = ((u_char *)p2->p_addr) + USPACE_SVC_STACK_BOTTOM;
- for (loop = 0; loop < (USPACE_SVC_STACK_TOP - USPACE_SVC_STACK_BOTTOM); ++loop, ++ptr) {
- *ptr = 0xdd;
- }
-
-/* Now ...
- * vm_fork has allocated UPAGES in kernel Vm space for us. p2->p_addr
- * points to the start of this. The i386 releases this memory in vm_fork
- * and relocates it in cpu_fork.
- * We can work with it allocated by vm_fork. We we must do is
- * copy the stack and activate the p2 page directory.
- * We activate first and then call savectx which will copy the stack.
- * This must also set the stack pointer for p2 to its correct address
- * NOTE: This will be different from p1 stack address.
- */
-
-#ifdef DEBUG_VMMACHDEP
- if (pmap_debug_level >= 0) {
- printf("cpu_fork: pcb = %08x pagedir = %08x\n",
- (u_int)&up->u_pcb, (u_int)up->u_pcb.pcb_pagedir);
- printf("p1->procaddr=%08x p1->procaddr->u_pcb=%08x pid=%d pmap=%08x\n",
- (u_int)p1->p_addr, (u_int)&p1->p_addr->u_pcb, p1->p_pid, (u_int)&p1->p_vmspace->vm_pmap);
- printf("p2->procaddr=%08x p2->procaddr->u_pcb=%08x pid=%d pmap=%08x\n",
- (u_int)p2->p_addr, (u_int)&p2->p_addr->u_pcb, p2->p_pid, (u_int)&p2->p_vmspace->vm_pmap);
- }
-#endif
-
-/* ream out old pagetables */
-
- vp = &p2->p_vmspace->vm_map;
- (void)vm_deallocate(vp, muaddr, VM_MAX_ADDRESS - muaddr);
- (void)vm_allocate(vp, &muaddr, VM_MAX_ADDRESS - muaddr, FALSE);
- (void)vm_map_inherit(vp, muaddr, VM_MAX_ADDRESS, VM_INHERIT_NONE);
-
-
-/* Get the address of the page table containing 0x00000000 */
-
- addr = trunc_page((u_int)vtopte(0));
-
-#ifdef DEBUG_VMMACHDEP
- if (pmap_debug_level >= 0) {
- printf("fun time: paging in PT %08x for %08x\n", (u_int)addr, 0);
- printf("p2->p_vmspace->vm_pmap.pm_pdir[0] = %08x\n", p2->p_vmspace->vm_pmap.pm_pdir[0]);
- printf("p2->pm_vptpt[0] = %08x", *((int *)(p2->p_vmspace->vm_pmap.pm_vptpt + 0)));
- }
-#endif
-
-/* Nuke the exising mapping */
-
- p2->p_vmspace->vm_pmap.pm_pdir[0] = 0;
- p2->p_vmspace->vm_pmap.pm_pdir[1] = 0;
- p2->p_vmspace->vm_pmap.pm_pdir[2] = 0;
- p2->p_vmspace->vm_pmap.pm_pdir[3] = 0;
-
- *((int *)(p2->p_vmspace->vm_pmap.pm_vptpt + 0)) = 0;
-
-/* Wire down a page to cover the page table zero page and the start of the user are in */
-
-#ifdef DEBUG_VMMACHDEP
- if (pmap_debug_level >= 0) {
- printf("vm_map_pageable: addr=%08x\n", addr);
- }
-#endif
-
- if (vm_map_pageable(&p2->p_vmspace->vm_map, addr, addr+NBPG, FALSE) != 0) {
- panic("Failed to fault in system page PT");
- }
-
-#ifdef DEBUG_VMMACHDEP
- if (pmap_debug_level >= 0) {
- printf("party on! acquired a page table for 0M->(4M-1)\n");
- printf("p2->p_vmspace->vm_pmap.pm_pdir[0] = %08x\n", p2->p_vmspace->vm_pmap.pm_pdir[0]);
- printf("p2->pm_vptpt[0] = %08x", *((int *)(p2->p_vmspace->vm_pmap.pm_vptpt + 0)));
- }
-#endif
-
-/* Map the system page */
-
- pmap_enter(&p2->p_vmspace->vm_pmap, 0,
- systempage.physical, VM_PROT_READ, TRUE);
-
- pmap_activate(&p2->p_vmspace->vm_pmap, &up->u_pcb);
-
-#ifdef ARMFPE
-/* Initialise a new FP context for p2 and copy the context from p1 */
- arm_fpe_core_initcontext(FP_CONTEXT(p2));
- arm_fpe_copycontext(FP_CONTEXT(p1), FP_CONTEXT(p2));
-#endif
-
- /*
- * Copy the trap frame, and arrange for the child to return directly
- * through return_to_user(). Note the inline cpu_set_kpc().
- */
- p2->p_md.md_regs = tf = (struct trapframe *)pcb->pcb_sp - 1;
-
- *tf = *p1->p_md.md_regs;
-
- /*
- * If specified, give the child a different stack.
- */
- if (stack != NULL)
- tf->tf_usr_sp = (u_int)stack + stacksize;
-
- sf = (struct switchframe *)tf - 1;
- sf->sf_spl = SPL_0;
- sf->sf_r4 = (u_int)child_return;
- sf->sf_r5 = (u_int)p2;
- sf->sf_pc = (u_int)proc_trampoline;
- pcb->pcb_sp = (u_int)sf;
-}
-
-
-void
-cpu_set_kpc(p, pc, arg)
- struct proc *p;
- void (*pc) __P((void *));
- void *arg;
-{
- struct switchframe *sf = (struct switchframe *)p->p_addr->u_pcb.pcb_sp;
-
- sf->sf_r4 = (u_int)pc;
- sf->sf_r5 = (u_int)arg;
-}
-
-
-/*
- * cpu_exit is called as the last action during exit.
- *
- * We clean up a little and then call switch_exit() with the old proc as an
- * argument. switch_exit() first switches to proc0's context, then does the
- * vmspace_free() and kmem_free() that we don't do here, and finally jumps
- * into switch() to wait for another process to wake up.
- */
-
-void
-cpu_exit(p)
- register struct proc *p;
-{
- struct vmspace *vm;
-
-#ifdef ARMFPE
-/* Abort any active FP operation and deactivate the context */
- arm_fpe_core_abort(FP_CONTEXT(p), NULL, NULL);
- arm_fpe_core_changecontext(0);
-#endif
-
-/* Report how much stack has been used - debugging */
-
-/* if (p) {
- u_char *ptr;
- int loop;
-
- ptr = ((u_char *)p2->p_addr) + USPACE_UNDEF_STACK_BOTTOM;
- for (loop = 0; loop < (USPACE_UNDEF_STACK_TOP - USPACE_UNDEF_STACK_BOTTOM) && *ptr == 0xdd; ++loop, ++ptr) ;
- log(LOG_INFO, "%d bytes of undefined stack fill pattern\n", loop);
- ptr = ((u_char *)p2->p_addr) + USPACE_SVC_STACK_BOTTOM;
- for (loop = 0; loop < (USPACE_SVC_STACK_TOP - USPACE_SVC_STACK_BOTTOM) && *ptr == 0xdd; ++loop, ++ptr) ;
- log(LOG_INFO, "%d bytes of svc stack fill pattern\n", loop);
-
- }
-*/
-
-/* printf("cpu_exit: proc=%08x pid=%d comm=%s\n", p, p->p_pid, p->p_comm);*/
-
- vm = p->p_vmspace;
- if (vm->vm_refcnt == 1) /* What does this do and is it needed ? */
- vm_map_remove(&vm->vm_map, VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS);
-
- cnt.v_swtch++;
-
- switch_exit(p, &proc0);
-}
-
-
-void
-cpu_swapin(p)
- struct proc *p;
-{
- vm_offset_t addr;
- int loop;
-
-#ifdef DEBUG_VMMACHDEP
- if (pmap_debug_level >= 0)
- printf("cpu_swapin(%08x, %d, %s, %08x)\n", (u_int)p, p->p_pid, p->p_comm, (u_int)&p->p_vmspace->vm_pmap);
-#endif
-
-#ifdef FREESWAPPEDPAGEDIRS
- printf("cpu_swapin(%08x, %d, %s, %08x)\n", (u_int)p, p->p_pid, p->p_comm, (u_int)&p->p_vmspace->vm_pmap);
- if (p->p_vmspace->vm_pmap.pm_pdir)
- printf("pdir = %08x\n", p->p_vmspace->vm_pmap.pm_pdir);
- pmap_pinit(&p->p_vmspace->vm_pmap);
- pmap_debug_level = 10;
-#endif
-
-/* Get the address of the page table containing 0x00000000 */
-
- addr = trunc_page((u_int)vtopte(0));
-
-#ifdef DEBUG_VMMACHDEP
- if (pmap_debug_level >= 0) {
- printf("fun time: paging in PT %08x for %08x\n", (u_int)addr, 0);
- printf("p->p_vmspace->vm_pmap.pm_pdir[0] = %08x\n", p->p_vmspace->vm_pmap.pm_pdir[0]);
- printf("p->pm_vptpt[0] = %08x", *((int *)(p->p_vmspace->vm_pmap.pm_vptpt + 0)));
- }
-#endif
-
-/* Wire down a page to cover the page table zero page and the start of the user are in */
-
- vm_map_pageable(&p->p_vmspace->vm_map, addr, addr+NBPG, FALSE);
-
-#ifdef DEBUG_VMMACHDEP
- if (pmap_debug_level >= 0) {
- printf("party on! acquired a page table for 0M->(4M-1)\n");
- printf("p->p_vmspace->vm_pmap.pm_pdir[0] = %08x\n", p->p_vmspace->vm_pmap.pm_pdir[0]);
- printf("p->pm_vptpt[0] = %08x", *((int *)(p->p_vmspace->vm_pmap.pm_vptpt + 0)));
- }
-#endif
-
-/* Map the system page */
-
- pmap_enter(&p->p_vmspace->vm_pmap, 0,
- systempage.physical, VM_PROT_READ, TRUE);
-}
-
-
-void
-cpu_swapout(p)
- struct proc *p;
-{
-#ifdef DEBUG_VMMACHDEP
- if (pmap_debug_level >= 0) {
- printf("cpu_swapout(%08x, %d, %s, %08x)\n", (u_int)p, p->p_pid, p->p_comm, (u_int)&p->p_vmspace->vm_pmap);
- printf("p->pm_vptpt[0] = %08x", *((int *)(p->p_vmspace->vm_pmap.pm_vptpt + 0)));
- }
-#endif
-
-/* Free the system page mapping */
-
- pmap_remove(&p->p_vmspace->vm_pmap, 0, NBPG);
-
-#ifdef FREESWAPPEDPAGEDIRS
- printf("cpu_swapout(%08x, %d, %s, %08x)\n", (u_int)p, p->p_pid, p->p_comm, (u_int)&p->p_vmspace->vm_pmap);
- printf("p->pm_vptpt[0] = %08x pdir=%08x\n", *((int *)(p->p_vmspace->vm_pmap.pm_vptpt + 0)), p->p_vmspace->vm_pmap.pm_pdir);
- pmap_freepagedir(&p->p_vmspace->vm_pmap);
- p->p_vmspace->vm_pmap.pm_pdir = 0;
-#endif
-
- idcflush();
-}
-
-
-/*
- * Move pages from one kernel virtual address to another.
- * Both addresses are assumed to reside in the Sysmap,
- * and size must be a multiple of CLSIZE.
- */
-
-void
-pagemove(from, to, size)
- caddr_t from, to;
- int size;
-{
- register pt_entry_t *fpte, *tpte;
-
- if (size % CLBYTES)
- panic("pagemove: size=%08x", size);
-
-#ifdef DEBUG_VMMACHDEP
- if (pmap_debug_level >= 0)
- printf("pagemove: V%08x to %08x size %08x\n", (u_int)from,
- (u_int)to, size);
-#endif
- fpte = vtopte(from);
- tpte = vtopte(to);
-
- idcflush();
-
- while (size > 0) {
- *tpte++ = *fpte;
- *fpte++ = 0;
- size -= NBPG;
- }
- tlbflush();
-}
-
-extern vm_map_t phys_map;
-
-/*
- * Map an IO request into kernel virtual address space. Requests fall into
- * one of five catagories:
- *
- * B_PHYS|B_UAREA: User u-area swap.
- * Address is relative to start of u-area (p_addr).
- * B_PHYS|B_PAGET: User page table swap.
- * Address is a kernel VA in usrpt (Usrptmap).
- * B_PHYS|B_DIRTY: Dirty page push.
- * Address is a VA in proc2's address space.
- * B_PHYS|B_PGIN: Kernel pagein of user pages.
- * Address is VA in user's address space.
- * B_PHYS: User "raw" IO request.
- * Address is VA in user's address space.
- *
- * All requests are (re)mapped into kernel VA space via the useriomap
- * (a name with only slightly more meaning than "kernelmap")
- */
-
-void
-vmapbuf(bp, len)
- struct buf *bp;
- vm_size_t len;
-{
- vm_offset_t faddr, taddr, off;
- pt_entry_t *fpte, *tpte;
- pt_entry_t *pmap_pte __P((pmap_t, vm_offset_t));
-
- if (pmap_debug_level >= 0)
- printf("vmapbuf: bp=%08x buf=%08x len=%08x\n", (u_int)bp,
- (u_int)bp->b_data, (u_int)len);
-
- if ((bp->b_flags & B_PHYS) == 0)
- panic("vmapbuf");
-
- faddr = trunc_page(bp->b_saveaddr = bp->b_data);
- off = (vm_offset_t)bp->b_data - faddr;
- len = round_page(off + len);
- taddr = kmem_alloc_wait(phys_map, len);
- bp->b_data = (caddr_t)(taddr + off);
- /*
- * The region is locked, so we expect that pmap_pte() will return
- * non-NULL.
- */
-
- fpte = pmap_pte(vm_map_pmap(&bp->b_proc->p_vmspace->vm_map), faddr);
- tpte = pmap_pte(vm_map_pmap(phys_map), taddr);
-
- idcflush();
-
- do {
- *fpte = (*fpte) & ~PT_C;
- *tpte++ = *fpte++;
- len -= PAGE_SIZE;
- } while (len > 0);
- tlbflush();
-}
-
-/*
- * Free the io map PTEs associated with this IO operation.
- * We also invalidate the TLB entries and restore the original b_addr.
- */
-
-void
-vunmapbuf(bp, len)
- struct buf *bp;
- vm_size_t len;
-{
- vm_offset_t addr, off;
-
- if (pmap_debug_level >= 0)
- printf("vunmapbuf: bp=%08x buf=%08x len=%08x\n",
- (u_int)bp, (u_int)bp->b_data, (u_int)len);
-
- if ((bp->b_flags & B_PHYS) == 0)
- panic("vunmapbuf");
-
- idcflush();
-
- addr = trunc_page(bp->b_data);
- off = (vm_offset_t)bp->b_data - addr;
- len = round_page(off + len);
- kmem_free_wakeup(phys_map, addr, len);
- bp->b_data = bp->b_saveaddr;
- bp->b_saveaddr = 0;
-
- tlbflush();
-}
-
-/*
- * Dump the machine specific segment at the start of a core dump.
- */
-
-int
-cpu_coredump(p, vp, cred, chdr)
- struct proc *p;
- struct vnode *vp;
- struct ucred *cred;
- struct core *chdr;
-{
- int error;
- struct {
- struct reg regs;
- struct fpreg fpregs;
- } cpustate;
- struct coreseg cseg;
-
- CORE_SETMAGIC(*chdr, COREMAGIC, MID_ARM6, 0);
- chdr->c_hdrsize = ALIGN(sizeof(*chdr));
- chdr->c_seghdrsize = ALIGN(sizeof(cseg));
- chdr->c_cpusize = sizeof(cpustate);
-
- /* Save integer registers. */
- error = process_read_regs(p, &cpustate.regs);
- if (error)
- return error;
- /* Save floating point registers. */
- error = process_read_fpregs(p, &cpustate.fpregs);
- if (error)
- return error;
-
- CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_ARM6, CORE_CPU);
- cseg.c_addr = 0;
- cseg.c_size = chdr->c_cpusize;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
- (off_t)chdr->c_hdrsize, UIO_SYSSPACE,
- IO_NODELOCKED|IO_UNIT, cred, NULL, p);
- if (error)
- return error;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cpustate, sizeof(cpustate),
- (off_t)(chdr->c_hdrsize + chdr->c_seghdrsize), UIO_SYSSPACE,
- IO_NODELOCKED|IO_UNIT, cred, NULL, p);
- if (error)
- return error;
-
- chdr->c_nseg++;
-
- return error;
-}
-
-/* End of vm_machdep.c */
diff --git a/sys/arch/arm32/boot/Makefile b/sys/arch/arm32/boot/Makefile
deleted file mode 100644
index 22eba77ebe4..00000000000
--- a/sys/arch/arm32/boot/Makefile
+++ /dev/null
@@ -1,96 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2000/03/03 00:54:46 todd Exp $
-# $NetBSD: Makefile,v 1.2 1996/02/01 22:29:25 mycroft Exp $
-
-# Copyright (c) 1994,1995 Mark Brinicombe.
-# Copyright (c) 1994 Brini.
-# All rights reserved.
-#
-# This code is derived from software written for Brini by Mark Brinicombe
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by Brini.
-# 4. The name of the company nor the name of the author may be used to
-# endorse or promote products derived from this software without specific
-# prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
-# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-# SERVICES# LOSS OF USE, DATA, OR PROFITS OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# RiscBSD kernel project
-#
-# Makefile
-#
-# Makefile for RiscBSD bootloader for RISCOS
-#
-# Created : 14/01/96
-# Last updated : 14/01/96
-#
-#
-
-S= ../../..
-
-machine-links:
- -rm -f machine && \
- ln -s ${.CURDIR}/../include machine
- -rm -f ${MACHINE_ARCH} && \
- ln -s ${.CURDIR}/../include ${MACHINE_ARCH}
-
-all: machine-links boot
-
-NOPROG= noprog
-NOMAN= noman
-
-CFLAGS= -O3 -fno-builtin -D_LOCORE -D_KERNEL -I. -I${.CURDIR} -I$S -I${.CURDIR}/../..
-AFLAGS= -D_LOCORE -D_KERNEL -I. -I${.CURDIR} -I$S -I${.CURDIR}/../..
-
-### find out what to use for libkern and libsa
-#SAREL=
-#KERNREL=
-#.include "Makefile.inc"
-.include "$S/lib/libsa/Makefile.inc"
-.include "$S/lib/libkern/Makefile.inc"
-
-all: boot ${SALIB} ${KERNLIB}
-
-#.PATH: $S/lib/libkern
-#.PATH: $S/lib/libkern/arch/arm32
-
-# start.o should be first
-OBJS= start.o strcpy.o strlen.o strncmp.o strstr.o \
- svc32.o div.o exit.o enteros.o exitos.o setcpsr.o \
- memcpy.o memset.o ntohl.o _bsdboot.o _main.o \
- areahand.o vsprintf.o bsdbooter.o swiv.o
-
-boot: ${OBJS}
- ${LD} -Bstatic -e start -N -Ttext 0x8000 -o boot ${OBJS}
- cp boot boot.sym
- @strip boot
- @sh ${.CURDIR}/rmaouthdr boot boot.tmp
- @mv -f boot.tmp boot
- @ls -l boot
-
-CLEANFILES+=boot boot.sym machine ${MACHINE_ARCH}
-
-clean::
- rm -f a.out [Ee]rrs mklog core *.core
- rm -f ${PROG} ${OBJS} ${LOBJS} ${CLEANFILES}
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/arm32/boot/Makefile.inc b/sys/arch/arm32/boot/Makefile.inc
deleted file mode 100644
index 45bcede83bc..00000000000
--- a/sys/arch/arm32/boot/Makefile.inc
+++ /dev/null
@@ -1,28 +0,0 @@
-# $NetBSD: Makefile.inc,v 1.1 1996/01/31 23:17:48 mark Exp $
-#
-# NOTE: $S must correspond to the top of the 'sys' tree
-
-KERNDIR= $S/lib/libkern
-
-KERNDST= lib/kern
-KERNREL?= ../../
-KERNLIB?= ${KERNDST}/libkern.a
-
-${KERNLIB}: .NOTMAIN __always_make_kernlib
- @echo making sure the kern library is up to date...
- @(cd ${KERNDST} && ${MAKE} -f ${KERNREL}${KERNDIR}/Makefile \
- KERNCC="${CC}" \
- KERNCFLAGS="${CFLAGS}" \
- KERNREL="${KERNREL}" \
- KERNDIR="${KERNDIR}" libkern.o)
-
-clean:: .NOTMAIN __always_make_kernlib
- @echo cleaning the kern library objects
- @(cd ${KERNDST} && ${MAKE} -f ${KERNREL}${KERNDIR}/Makefile \
- KERNCC="${CC}" \
- KERNCFLAGS="${CFLAGS}" \
- KERNREL="${KERNREL}" \
- KERNDIR="${KERNDIR}" clean)
-
-__always_make_kernlib: .NOTMAIN
- @([ -d ${KERNDST} ] || mkdir -p ${KERNDST})
diff --git a/sys/arch/arm32/boot/README b/sys/arch/arm32/boot/README
deleted file mode 100644
index 27aa4846887..00000000000
--- a/sys/arch/arm32/boot/README
+++ /dev/null
@@ -1,7 +0,0 @@
-Ok, this is the bootloader source that can be used to boot NetBSD/arm32
-from RISCOS. This code was written for use with Norcroft C and
-objasm under RISCOS. It has been modified to compile under NetBSD/arm32
-but is as yet untested.
-
-It is provided here for the moment as example code for a boot loader
-and will be updated shortly to compile under NetBSD/arm32
diff --git a/sys/arch/arm32/boot/_bsdboot.S b/sys/arch/arm32/boot/_bsdboot.S
deleted file mode 100644
index 26de26c5999..00000000000
--- a/sys/arch/arm32/boot/_bsdboot.S
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $OpenBSD: _bsdboot.S,v 1.2 2000/03/03 00:54:47 todd Exp $ */
-/* $NetBSD: _bsdboot.S,v 1.1 1996/01/31 23:17:52 mark Exp $ */
-
-/* Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES * LOSS OF USE, DATA, OR PROFITS * OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * _boot.s
- *
- * Kernel entry/exit code
- *
- * Created : 12/09/94
- * Last updated : 12/09/94
- *
- * Based on kate/boot/_boot.s
- *
- */
-
-#include "regs.h"
-
- .text
- .global __bsdboot
-__bsdboot:
- mov pc, r1
diff --git a/sys/arch/arm32/boot/_main.S b/sys/arch/arm32/boot/_main.S
deleted file mode 100644
index 94f95b1d2a3..00000000000
--- a/sys/arch/arm32/boot/_main.S
+++ /dev/null
@@ -1,141 +0,0 @@
-/* $OpenBSD: _main.S,v 1.2 2000/03/03 00:54:47 todd Exp $ */
-/* $NetBSD: _main.S,v 1.1 1996/01/31 23:17:57 mark Exp $ */
-
-/* Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES * LOSS OF USE, DATA, OR PROFITS * OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * _main.s
- *
- * Kernel entry/exit code
- *
- * Created : 12/09/94
- * Last updated : 12/09/94
- *
- * Based on kate/boot/_main.s
- *
- */
-
-#include "regs.h"
-
- .global ___main
-___main:
- swi 0x20010
- mov sp, r1
- sub sl, sp, #2048
-
- ldr r3, [pc, #cli_ptr - . - 8]
- str r0, [r3]
-#if 0
- LDR a4,[pc,#|__cli_ptr|-.-8]
- STR a1,[a4,#0]
- LDR a4,[pc,#|__himem_ptr|-.-8]
- STR a2,[a4,#0]
- LDR a4,[pc,#|__stack_ptr|-.-8]
- STR sl,[a4,#0]
- LDR a4,[pc,#|__robase_ptr|-.-8]
- LDR a1,[a4,#0]
- LDR a4,[pc,#|__base_ptr|-.-8]
- STR a1,[a4,#0]
- LDR a4,[pc,#|__rwlimit_ptr|-.-8]
- LDR a1,[a4,#0]
- LDR a4,[pc,#|__lomem_ptr|-.-8]
- STR a1,[a4,#0]
- LDR a4,[pc,#|__break_ptr|-.-8]
- STR a1,[a4,#0]
-#endif
-#if 0
- cmp sl, r0
- movlss pc, lr /* no stack - exit fast */
- add sl, sl, #256
-#endif
- mov fp, #0
- b __main
-
-cli_ptr:
- .word ___cli
-
- .data
- .global ___cli
-___cli:
- .word 0
-
-#if 0
-
-|__cli_ptr|
- DCD |__cli|
-
-|__robase_ptr|
- DCD |__robase|
-|__base_ptr|
- DCD |__base|
-|__rwbase_ptr|
- DCD |__rwbase|
-|__rwlimit_ptr|
- DCD |__rwlimit|
-|__himem_ptr|
- DCD |__himem|
-|__lomem_ptr|
- DCD |__lomem|
-
-|__break_ptr|
- DCD |__break|
-|__stack_ptr|
- DCD |__stack|
-
-|__time_ptr|
- DCD |__time|
-
- EXPORT |__cli| ; CLI from OS_GetEnv
-|__cli|
- DCD 0
-
- EXPORT |__base| ; BASE (application = 0x8000)
-|__base|
- DCD 0
- EXPORT |__lomem| ; LOMEM
-|__lomem|
- DCD 0
- EXPORT |__himem| ; HIMEM from OS_GetEnv
-|__himem|
- DCD 0
-
- EXPORT |__break| ; the 'break'
-|__break|
- DCD 0
- EXPORT |__stack| ; stack limit
-|__stack|
- DCD 0
-
-#endif
diff --git a/sys/arch/arm32/boot/areahand.S b/sys/arch/arm32/boot/areahand.S
deleted file mode 100644
index fa5cb98ec36..00000000000
--- a/sys/arch/arm32/boot/areahand.S
+++ /dev/null
@@ -1,98 +0,0 @@
-/* $OpenBSD: areahand.S,v 1.2 2000/03/03 00:54:47 todd Exp $ */
-/* $NetBSD: areahand.S,v 1.1 1996/01/31 23:18:01 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * areahand.s
- *
- *
- *
- * Created : 12/09/94
- * Last updated : 12/09/94
- *
- */
-
-#include "regs.h"
-
- .text
- .global _kernarea_handler
-/*
- * r0 - code
- * r1 - page block
- * r2 - entries
- * r3 - size increase
- * r4 - current size
- * r5 - pagesize
- * r12 - arrangement table
- */
-
-_kernarea_handler:
-/* Is it a pregrow request ? */
- teq r0, #0x00000000
- bicnes pc, lr, #1<<28
-
-/* Make sure that the area is currently 0 in size */
- teq r4, #0x00000000
- movne r0, #0x000000
- orrnes pc, lr, #1<<28
-
- teq r1, #0x00000000
- biceqs pc, lr, #1<<28
-
-/* Store registers */
- stmfd sp!, {r0-r12}
-
-/* Get first page number */
- ldr r8, [r12, #0x0004]
- sub r8, r8, r2
- mov r8, #0x00000700
- str r1, [r12]
-
-loop:
- str r8, [r1], #0x000c
- add r8, r8, #0x00000001
- subs r2, r2, #0x00000001
- bne loop
-
- ldmfd sp!, {r0-r12}
-/* bics pc, lr, #1<<28 */
- adr r0, error1
- orrs pc, lr, #1<<28
-
-error1:
- .word 0
- .asciz "error1"
diff --git a/sys/arch/arm32/boot/arm6.h b/sys/arch/arm32/boot/arm6.h
deleted file mode 100644
index 9c52ce662a9..00000000000
--- a/sys/arch/arm32/boot/arm6.h
+++ /dev/null
@@ -1,161 +0,0 @@
-; ARM6 PSR transfer macros
-
-; Condition code symbols
-
-Cond_EQ * 0 :SHL: 28
-Cond_NE * 1 :SHL: 28
-Cond_CS * 2 :SHL: 28
-Cond_HS * Cond_CS
-Cond_CC * 3 :SHL: 28
-Cond_LO * Cond_CC
-Cond_MI * 4 :SHL: 28
-Cond_PL * 5 :SHL: 28
-Cond_VS * 6 :SHL: 28
-Cond_VC * 7 :SHL: 28
-Cond_HI * 8 :SHL: 28
-Cond_LS * 9 :SHL: 28
-Cond_GE * 10 :SHL: 28
-Cond_LT * 11 :SHL: 28
-Cond_GT * 12 :SHL: 28
-Cond_LE * 13 :SHL: 28
-Cond_AL * 14 :SHL: 28
-Cond_ * Cond_AL
-Cond_NV * 15 :SHL: 28
-
-; New positions of I and F bits in 32-bit PSR
-
-I32_bit * 1 :SHL: 7
-F32_bit * 1 :SHL: 6
-IF32_26Shift * 26-6
-
-; Processor mode numbers
-
-USR26_mode * 2_00000
-FIQ26_mode * 2_00001
-IRQ26_mode * 2_00010
-SVC26_mode * 2_00011
-USR32_mode * 2_10000
-FIQ32_mode * 2_10001
-IRQ32_mode * 2_10010
-SVC32_mode * 2_10011
-ABT32_mode * 2_10111
-UND32_mode * 2_11011
-
-; New register names
-
-r13_abort RN 13
-r14_abort RN 14
-lr_abort RN 14
-
-r13_undef RN 13
-r14_undef RN 14
-lr_undef RN 14
-
- MACRO
- mrs $cond, $rd, $psrs
- LCLA psrtype
-psrtype SETA -1
- [ "$psrs" = "CPSR" :LOR: "$psrs" = "CPSR_all"
-psrtype SETA 0 :SHL: 22
- ]
- [ "$psrs" = "SPSR" :LOR: "$psrs" = "SPSR_all"
-psrtype SETA 1 :SHL: 22
- ]
- ASSERT psrtype <> -1
- ASSERT $rd <> 15
- & Cond_$cond :OR: 2_00000001000011110000000000000000 :OR: psrtype :OR: ($rd :SHL: 12)
- MEND
-
- MACRO
- msr $cond, $psrl, $op2a, $op2b
- LCLA psrtype
- LCLS op2as
- LCLA op
- LCLA shift
-psrtype SETA -1
- [ "$psrl" = "CPSR" :LOR: "$psrl" = "CPSR_all"
-psrtype SETA (0:SHL:22) :OR: (1:SHL:19) :OR: (1:SHL:16)
- ]
- [ "$psrl" = "CPSR_flg"
-psrtype SETA (0:SHL:22) :OR: (1:SHL:19) :OR: (0:SHL:16)
- ]
- [ "$psrl" = "CPSR_ctl"
-psrtype SETA (0:SHL:22) :OR: (0:SHL:19) :OR: (1:SHL:16)
- ]
- [ "$psrl" = "SPSR" :LOR: "$psrl" = "SPSR_all"
-psrtype SETA (1:SHL:22) :OR: (1:SHL:19) :OR: (1:SHL:16)
- ]
- [ "$psrl" = "SPSR_flg"
-psrtype SETA (1:SHL:22) :OR: (1:SHL:19) :OR: (0:SHL:16)
- ]
- [ "$psrl" = "SPSR_ctl"
-psrtype SETA (1:SHL:22) :OR: (0:SHL:19) :OR: (1:SHL:16)
- ]
- ASSERT psrtype <> -1
- [ ("$op2a" :LEFT: 1) = "#"
- ; Immediate operand
-
-op2as SETS "$op2a" :RIGHT: ((:LEN: "$op2a")-1)
-op SETA $op2as
-
- [ "$op2b" = ""
- ; Rotate not specified in immediate operand
-shift SETA 0
- WHILE (op :AND: &FFFFFF00)<>0 :LAND: shift<16
-op SETA ((op:SHR:30):AND:3):OR:(op:SHL:2)
-shift SETA shift + 1
- WEND
- ASSERT (op :AND: &FFFFFF00)=0
- |
- ; Rotate of immediate operand specified explicitly
- ASSERT (($op2b):AND:&FFFFFFE1)=0
-shift SETA ($opt2b):SHR:1
- ]
-op SETA (shift :SHL: 8) :OR: op :OR: (1:SHL:25)
- |
-
- ; Not an immediate operand
- [ "$op2b" = ""
- ; Unshifted register
-op SETA ($op2a) :OR: (0:SHL:25)
- |
- ! 1, "Shifted register not yet implemented in this macro!"
- ]
- ]
- & Cond_$cond :OR: 2_00000001001000001111000000000000 :OR: op :OR: psrtype
- MEND
-
-; SetMode newmode, reg1, regoldpsr
-;
-; Sets processor mode to constant value newmode
-; using register reg1 as a temporary.
-; If regoldpsr is specified, then this register
-; on exit holds the old PSR before the mode change
-; reg1 on exit always holds the new PSR after the mode change
-
-; MACRO
-; SetMode $newmode, $reg1, $regoldpsr
-; [ "$regoldpsr"=""
-; mrs AL, $reg1, CPSR_all
-; BIC $reg1, $reg1, #&1F
-; ORR $reg1, $reg1, #$newmode
-; msr AL, CPSR_all, $reg1
-; |
-; mrs AL, $regoldpsr, CPSR_all
-; BIC $reg1, $regoldpsr, #&1F
-; ORR $reg1, $reg1, #$newmode
-; msr AL, CPSR_all, $reg1
-; ]
-; MEND
-
- MACRO
- mrc $cond, $coproc, $op, $rd, $crn, $crm, $info
- & Cond_$cond :OR: 2_00001110000100000000000000010000 :OR: ($coproc :SHL: 8) :OR: ($op :SHL: 21) :OR: ($rd :SHL: 12) :OR: ($crn :SHL: 16) :OR: $crm :OR: ($info :SHL: 5)
- MEND
-
- MACRO
- mcr $cond, $coproc, $op, $rd, $crn, $crm, $info
- & Cond_$cond :OR: 2_00001110000000000000000000010000 :OR: ($coproc :SHL: 8) :OR: ($op :SHL: 21) :OR: ($rd :SHL: 12) :OR: ($crn :SHL: 16) :OR: $crm :OR: ($info :SHL: 5)
- MEND
-
- END
diff --git a/sys/arch/arm32/boot/bsdbooter.c b/sys/arch/arm32/boot/bsdbooter.c
deleted file mode 100644
index 7ac1b66221a..00000000000
--- a/sys/arch/arm32/boot/bsdbooter.c
+++ /dev/null
@@ -1,777 +0,0 @@
-/* $OpenBSD: bsdbooter.c,v 1.2 2000/03/03 00:54:47 todd Exp $ */
-/* $NetBSD: bsdbooter.c,v 1.1 1996/01/31 23:18:08 mark Exp $ */
-
-/*
- * Copyright (c) 1994,1995 Mark Brinicombe.
- * Copyright (c) 1994,1995 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * bsdbooter.c
- *
- * RiscBSD boot loader
- *
- * Created : 12/09/94
- * Last updated : 08/03/95
- *
- * Based on kate/boot/boot.c
- *
- */
-
-/* Include standard header files */
-
-# include <stdlib.h>
-# include <string.h>
-# include <stdarg.h>
-
-/* Include local headers */
-
-#include <sys/types.h>
-#include <sys/exec.h>
-#include <machine/cpu.h>
-#include <machine/katelib.h>
-#include <machine/bootconfig.h>
-#include "swiv.h"
-#include "swis.h"
-
-/*
- * Declare global variables
- */
-
-# define VERSION "2.10"
-
-# define USE_MODULEAREA
-
-# define KERNAREA 512
-# define KERNBASE 0xf0000000
-
-# define TABLEAREA 513
-# define LOADAREA 514
-
-# define SCRATCHSIZE 0xc000
-
-
-# define OS_DynamicArea 0x66
-# define OS_Memory 0x68
-# define OS_MMUControl 0x6b
-
-# define FASTBOOT_FILENAME "<BtRiscBSD$Dir>.booter.fastboot"
-
-/*
- * Declare external variables
- */
-
-extern char *__cli;
-
-/*
- * Local vars. Some of these have to be global because they are used after
- * the processor has been switches to SVC mode local variables would be
- * lost as they would be on the USR mode stack.
- */
-
-typedef struct exec aout_t;
-
-BootConfig bootconfig;
-int in[3], out[3];
-char kernelname[1024];
-unsigned char *buffer;
-static aout_t aout;
-unsigned int kernelsize;
-unsigned int logical;
-unsigned int physical;
-unsigned int filesize;
-unsigned int copysize;
-
-/*
- * Local function prototypes
- */
-
-void fatal(struct Error *error);
-unsigned char *locate_memory_blocks(void);
-void uprintf(char *formattoken, ...);
-void _bsdboot(BootConfig *bootconfig, unsigned int address);
-int vsprintf(char *buf, const char *fmt, va_list args);
-
-/* Now for the main code */
-
-extern int main (int, char **);
-
-void __exit(int);
-
-void _main(void)
- {
- uprintf("_main entered\n");
- __exit (main (0, (char **)0)); /* ... ignition */
-
-/* not reached */
- }
-
-/* The main booter code */
-
-int main(int argc, char *argv[])
- {
- char *cliptr;
- int loop;
- int filehandle;
- unsigned char *arrangementtable;
-
- uprintf("main entered\n");
-
-/* Analyse the command line */
-
- cliptr = __cli;
-
- uprintf("command line is %s\n", cliptr);
-
-/* Skip the command name */
-
- while (*cliptr != ' ' && *cliptr != 0)
- ++cliptr;
-
-/* Skip any spaces */
-
- while (*cliptr == ' ')
- ++cliptr;
-
-/* Check for another parameter */
-
- if (*cliptr != 0)
- {
- for (loop = 0; *cliptr != ' ' && *cliptr != 0; ++loop,++cliptr)
- {
- kernelname[loop] = *cliptr;
- }
- kernelname[loop] = 0;
- }
- else
- strcpy(kernelname, "riscbsd");
-
- strcpy(bootconfig.kernelname, kernelname);
-
-/* Write the command line used to a fastboot file. Execing or Obeying
- * this file will boot RiscBSD. This can be used during the RiscOS bootup
- * to enable a fast boot.
- */
-
-/*
- * Open the autoboot file. Just skip if file cannot be opened.
- */
-
- swi(OS_Find, IN(R0|R1)|OUT(R0), 0x80, FASTBOOT_FILENAME, &filehandle);
- if (filehandle != 0)
- {
- swi(OS_GBPB, IN(R0|R1|R2|R3|R4), 2, filehandle, __cli,
- strlen(__cli), 0);
- swi(OS_GBPB, IN(R0|R1|R2|R3|R4), 2, filehandle, "\n", 1, 0);
-
-/* Close the file */
-
- swi(OS_Find, IN(R0|R1), 0, filehandle);
-
- swi(OS_File, IN(R0|R1|R2), 18, FASTBOOT_FILENAME, 0xfeb);
- }
- else
- {
- uprintf("Warning: Cannot write fastboot file %s\n\r", FASTBOOT_FILENAME);
- }
-
-/* Set the screen mode ... */
-
-/* I know this is messy. It is currently just a hack to try things out
- * Why didn't Acorn add a SWI call to interpret the mode string and return
- * a mode specifer ?
- */
-
-/* Also this is temporary as eventually the console driver will set the VIDC
- * up as required.
- * It sort of expects the screenmode= options to be at the end of the string.
- */
-
- {
- char *modeptr;
- int modespec[6];
-
- modeptr = strstr(__cli, "screenmode=");
- if (modeptr)
- {
- modeptr += 11;
- modespec[0] = 0x00000001;
- modespec[1] = 0x00000000;
- modespec[2] = 0x00000000;
- modespec[3] = 0x00000003;
- modespec[4] = 0x00000000;
- modespec[5] = -1;
-
- while (*modeptr)
- {
- switch (*modeptr)
- {
- case 'X':
- case 'x':
- ++modeptr;
- while (*modeptr >= '0' && *modeptr <= '9')
- {
- modespec[1] = (modespec[1] * 10) + (*modeptr - '0');
- ++modeptr;
- }
- break;
-
- case 'Y':
- case 'y':
- ++modeptr;
- while (*modeptr >= '0' && *modeptr <= '9')
- {
- modespec[2] = (modespec[2] * 10) + (*modeptr - '0');
- ++modeptr;
- }
- break;
-/*
- case 'C':
- case 'c':
- case 'G':
- case 'g':
- ++modeptr;
- while (*modeptr >= '0' && *modeptr <= '9')
- {
- modespec[3] = (modespec[3] * 10) + (*modeptr - '0');
- ++modeptr;
- }
- break;
-*/
- case 'F':
- case 'f':
- ++modeptr;
- while (*modeptr >= '0' && *modeptr <= '9')
- {
- modespec[4] = (modespec[4] * 10) + (*modeptr - '0');
- ++modeptr;
- }
- break;
-
- default:
- ++modeptr;
- break;
- }
- }
- if (modespec[4] == 0) modespec[4] = -1;
-/* uprintf("x=%d y=%d c=%d f=%d\n", modespec[1], modespec[2],
- modespec[3], modespec[4]);*/
- fatal(swix(Wimp_SetMode, IN(R0), &modespec));
- bootconfig.framerate = modespec[4];
- }
- else
- bootconfig.framerate = 0;
- }
-
-/* Announcement time .. */
-/* Used to be above but now moved to after the mode change */
-
-
- if (strstr(__cli, "verbose") != 0)
- uprintf("RiscBSD BootLoader " VERSION " " __DATE__ "\n\r");
-
-/* A bit of info */
-
- if (strstr(__cli, "verbose") != 0)
- uprintf("Kernel: %s\n\r", kernelname);
-
-/* Get the machine id */
-
- fatal(swix(OS_ReadSysInfo, IN(R0)|OUT(R3), 2, &bootconfig.machine_id));
-
-/* Get the display variables. Failure on any of these will abort the boot */
-
- in[0] = 149;
- in[1] = 150;
- in[2] = -1;
-
- fatal(swix(OS_ReadVduVariables, IN(R0|R1), &in, &out));
-
- bootconfig.display_start = out[0];
- bootconfig.display_size = out[1];
-
- fatal(swix(OS_ReadModeVariable, IN(R0|R1) | OUT(R2), -1, 9,
- &bootconfig.bitsperpixel));
- fatal(swix(OS_ReadModeVariable, IN(R0|R1) | OUT(R2), -1, 11,
- &bootconfig.width));
- fatal(swix(OS_ReadModeVariable, IN(R0|R1) | OUT(R2), -1, 12,
- &bootconfig.height));
-
-/* Will the kernel support this mode ? */
-
- if (bootconfig.bitsperpixel > 3)
- {
- swi(OS_Write0, IN(R0),
- "Error: Only 1, 2, 4 or 8 bpp modes are currently supported\n\r");
- return(0);
- }
-
-/* Get the arrangement table for the memory */
-
- arrangementtable = locate_memory_blocks();
-
-/*
- * Ok we will support a.out files as well. This means that we need to
- * identify the format.
- */
-
-/* Get the size of the file */
-
- fatal(swix(OS_File, IN(R0|R1)|OUT(R4), 5, kernelname, &filesize));
-
-/*
- * Read the start of the file so that we change check for the a.out
- * magic number.
- */
-
- swi(OS_Find, IN(R0|R1)|OUT(R0), 0x40, kernelname, &filehandle);
- if (filehandle == 0)
- {
- uprintf("Error: Cannot read kernel file %s\n\r", kernelname);
- return(0);
- }
-
- aout.a_midmag = 0;
-
- fatal(swix(OS_GBPB, IN(R0|R1|R2|R3|R4), 3, filehandle, &aout,
- sizeof(aout_t), 0));
-
-/* Do we have an a.out file ? */
-
- switch(N_GETMAGIC(aout)) {
- case NMAGIC:
- if (strstr(__cli, "verbose") != 0)
- swi(OS_Write0, IN(R0), "Kernel binary is NMAGIC a.out format\n\r");
- kernelsize = (unsigned int)(aout.a_text + aout.a_data + aout.a_bss);
- copysize = (unsigned int)(aout.a_text + aout.a_data);
- break;
- case OMAGIC:
- if (strstr(__cli, "verbose") != 0)
- swi(OS_Write0, IN(R0), "Kernel binary is OMAGIC a.out format\n\r");
- kernelsize = (unsigned int)(aout.a_text + aout.a_data + aout.a_bss);
- copysize = (unsigned int)(aout.a_text + aout.a_data);
- break;
- case ZMAGIC:
- if (strstr(__cli, "verbose") != 0)
- swi(OS_Write0, IN(R0), "Kernel binary is ZMAGIC a.out format\n\r");
- kernelsize = (unsigned int)(aout.a_text + aout.a_data + aout.a_bss);
- copysize = (unsigned int)(aout.a_text + aout.a_data);
- break;
- default:
- if (strstr(__cli, "verbose") != 0)
- swi(OS_Write0, IN(R0), "Kernel binary is AIF format\n\r");
- kernelsize = filesize;
- copysize = filesize;
- break;
- }
-
-/* Give ourselves 16K of spare space and round off to a page */
-
-/*
- * This is messy. We should read the memory info first, but I have not
- * changed things yet. This is part of the hack to support a.out files
- * as well
- */
-
- kernelsize = (kernelsize + 0x4000) & ~(bootconfig.pagesize-1);
-
-/* Set the virtual address of the kernel in the bootconfig structure */
-
- bootconfig.kernvirtualbase = KERNBASE;
- bootconfig.kernsize = kernelsize;
- bootconfig.argvirtualbase = bootconfig.kernvirtualbase
- + bootconfig.kernsize;
- bootconfig.argsize = bootconfig.pagesize;
- bootconfig.scratchvirtualbase = bootconfig.argvirtualbase
- + bootconfig.argsize;
- bootconfig.scratchsize = SCRATCHSIZE;
-
- kernelsize += bootconfig.argsize;
-
- kernelsize += bootconfig.scratchsize;
-
-/* Verbose info to the user. This is mainly debugging */
-
- if (strstr(__cli, "verbose") != 0)
- {
- uprintf("filesize = %08x\n\r", filesize);
- uprintf("bootconfig.kernvirtualbase = %08x\n\r",
- bootconfig.kernvirtualbase);
- uprintf("bootconfig.kernsize = %08x\n\r", bootconfig.kernsize);
- uprintf("bootconfig.argvirtualbase = %08x\n\r",
- bootconfig.argvirtualbase);
- uprintf("bootconfig.argsize = %08x\n\r", bootconfig.argsize);
- uprintf("bootconfig.scratchvirtualbase = %08x\n\r",
- bootconfig.scratchvirtualbase);
- uprintf("bootconfig.scratchsize = %08x\n\r", bootconfig.scratchsize);
- uprintf("kernelsize = %08x\n\r", kernelsize);
- uprintf("copysize = %08x\n\r", copysize);
- }
-
-# ifdef USE_MODULEAREA
-
-/* Allocate memory in module area to hold the data we are loading */
-
- fatal(swix(OS_Module, IN(R0|R3)|OUT(R2), 6, filesize, &buffer));
-
-# else
-
-/* Allocate memory to hold the data we are loading */
-
- swix(OS_DynamicArea, IN(R0|R1), 1, LOADAREA);
-
- fatal(swix(OS_DynamicArea, IN(R0|R1|R2|R3|R4|R5|R6|R7|R8)|OUT(R3), 0,
- LOADAREA, filesize, -1, 0x80, filesize, 0, 0, "Kate Data", &buffer));
-
-# endif
-
-/* Load the appropriate part depending on the file type */
-
- switch (N_GETMAGIC(aout)) {
- case OMAGIC:
- case NMAGIC:
- swi(OS_GBPB, IN(R0|R1|R2|R3|R4), 3, filehandle, buffer,
- filesize, sizeof(aout_t));
- break;
- case ZMAGIC:
- default:
- swi(OS_GBPB, IN(R0|R1|R2|R3|R4), 3, filehandle, buffer,
- filesize, 0);
- break;
- }
-
-/* Close the file */
-
- fatal(swix(OS_Find, IN(R0|R1), 0, filehandle));
-
-
-/* This is redundant at the moment */
-
- swix(OS_DynamicArea, IN(R0|R1), 1, KERNAREA);
-
- fatal(swix(OS_DynamicArea, IN(R0|R1|R2|R3|R4|R5|R6|R7|R8), 0,
- KERNAREA, 0, KERNBASE, 0x80, 0x1000, 0, 0, "Kate Kernel"));
-
-/* Shutdown RiscOS cleanly ... */
-
-/* Close all open files and shutdown filing systems */
-
- swix(OS_FSControl, IN(R0), 23);
-
-/* Issue a pre-reset service call to reset the podules */
-
- swix(OS_ServiceCall, IN(R1), 0x45);
-
-/* Kill the etherH module to avoid locks up on reboot */
-
- swix(OS_Module, IN(R0|R1), 4, "EtherH");
-
-/* More user information describing the memory found */
-
- if (strstr(__cli, "verbose") != 0)
- {
- uprintf("DRAM bank 0a = %08x %08x\n\r", bootconfig.dram[0].address,
- bootconfig.dram[0].pages * bootconfig.pagesize);
- uprintf("DRAM bank 0b = %08x %08x\n\r", bootconfig.dram[1].address,
- bootconfig.dram[1].pages * bootconfig.pagesize);
- uprintf("DRAM bank 1a = %08x %08x\n\r", bootconfig.dram[2].address,
- bootconfig.dram[2].pages * bootconfig.pagesize);
- uprintf("DRAM bank 1b = %08x %08x\n\r", bootconfig.dram[3].address,
- bootconfig.dram[3].pages * bootconfig.pagesize);
- uprintf("VRAM bank 0 = %08x %08x\n\r", bootconfig.vram[0].address,
- bootconfig.vram[0].pages * bootconfig.pagesize);
- }
-
-/* Hack for 2 Meg VRAM until the new console code is in place */
-
-/* if (strstr(__cli, "vramhack") != 0)
- {
- bootconfig.display_size /= 1;
- bootconfig.vram[0].pages /= 2;
-
- uprintf("VRAM bank 0 = %08x %08x\n\r", bootconfig.vram[0].address,
- bootconfig.vram[0].pages * bootconfig.pagesize);
- }*/
-
-/* Jump to SVC26 mode - remember we have no local vars now ! */
-
- EnterOS();
-
-/* Find the number of the upper most bank of DRAM available */
-
- loop = 3;
- while (bootconfig.dram[loop].address == 0)
- --loop;
-
-/* Allocate the physical addresses for the kernel in this bank */
-
- physical = bootconfig.dram[loop].address - kernelsize
- + bootconfig.dram[loop].pages * bootconfig.pagesize;
- bootconfig.kernphysicalbase = physical;
- bootconfig.argphysicalbase = bootconfig.kernphysicalbase
- + bootconfig.kernsize;
- bootconfig.scratchphysicalbase = bootconfig.argphysicalbase
- + bootconfig.argsize;
-
-/* Yet more debugging info */
-
- if (strstr(__cli, "verbose") != 0)
- {
- uprintf("buffer = %08x\n\r", buffer);
- uprintf("physical = %08x\n\r", physical);
- uprintf("bootconfig.kernphysicalbase = %08x\n\r",
- bootconfig.kernphysicalbase);
- uprintf("bootconfig.argphysicalbase = %08x\n\r",
- bootconfig.argphysicalbase);
- uprintf("bootconfig.scratchphysicalbase = %08x\n\r",
- bootconfig.scratchphysicalbase);
- }
-
-/*
- * Ok just check to see if anything is mapped where we are about to map
- * the kernel.
- */
-
-/*
- for (logical = KERNBASE; logical < KERNBASE + kernelsize;
- logical += bootconfig.pagesize)
- {
- if (ReadWord(0x02c00000 + (logical >> 10) & 0xfffffffc) != 0)
- {
- uprintf("Error: Memory required for RiscBSD boot not available\n\r");
- return(0);
- }
- }
-*/
-/* Get out clause */
-
- if (strstr(__cli, "noboot") != 0)
- {
- ExitOS();
- return(0);
- }
-
-/*
- * Hook the physical pages to the required virtual address directly by
- * writing into RiscOS's page tables. This should be done via a
- * dynamic area handler but I cannot get it to work as documented.
- */
-
- for (logical = KERNBASE; logical < KERNBASE + kernelsize;
- logical += bootconfig.pagesize)
- {
- WriteWord(0x02c00000 + (logical >> 10) & 0xfffffffc,
- 0x00000ffe | (physical & 0xfffff000));
- physical += bootconfig.pagesize;
- }
-
-/* Map the IO up high so we can get at it */
-
- WriteWord(0x02c0c000 + (0xf6000000 >> 18) & 0xfffffffc,
- 0x00000412 | (0x03200000 & 0xfffff000));
- WriteWord(0x02c0c000 + (0xf6100000 >> 18) & 0xfffffffc,
- 0x00000412 | (0x03400000 & 0xfffff000));
-
- memset((char *)bootconfig.display_start, 0xcc, 0x4000);
-
-/* Disable IRQ and FIQ interrupts */
-
- SetCPSR(I32_bit | F32_bit, I32_bit | F32_bit);
-
- memset((char *)bootconfig.display_start + 0x4000, 0x55, 0x4000);
-
- memcpy((char *)bootconfig.argvirtualbase, __cli, bootconfig.argsize);
-
- memset((char *)bootconfig.display_start + 0x8000, 0x80, 0x4000);
-
- memset((char *)bootconfig.argvirtualbase, SCRATCHSIZE, 0);
-
- memset((char *)bootconfig.display_start + 0xC000, 0xbb, 0x4000);
-
- memcpy((char *)bootconfig.kernvirtualbase, buffer, copysize);
-
- memset((char *)bootconfig.display_start + 0x10000, 0xaa, 0x4000);
-
-/* Real late debugging get out clause */
-
- if (strstr(__cli, "nearboot") != 0)
- {
- SetCPSR(I32_bit | F32_bit, 0);
- ExitOS();
- return(0);
- }
-
-/* Punch into SVC32 mode */
-
- SVC32();
-
-/* Point of no return */
-
- switch (N_GETMAGIC(aout)) {
- case OMAGIC:
- case NMAGIC:
- case ZMAGIC:
- _bsdboot(&bootconfig, (unsigned int)aout.a_entry);
- break;
- default:
- _bsdboot(&bootconfig, KERNBASE);
- break;
- }
-
- return(0);
- }
-
-
-/* Report an error */
-
-void fatal(struct Error *error)
- {
- if (error)
- {
- swi(OS_GenerateError, IN(R0), error);
- }
- }
-
-
-/* Locate all the blocks of memory in the system */
-
-unsigned char *locate_memory_blocks(void)
- {
- int loop;
- int page;
- int currentpage;
- int currentpages;
- int currentaddr;
- unsigned char *table;
- unsigned int pagesize;
- unsigned int tablesize;
- int dramblocks = 0;
- int vramblocks = 0;
-
-/* Get table size and page size */
-
- fatal(swix(OS_Memory, IN(R0)|OUT(R1|R2), 6, &tablesize, &pagesize));
-
-/* Allocate memory for table */
-
-/*# ifdef USE_MODULEAREA*/
-
- fatal(swix(OS_Module, IN(R0|R3)|OUT(R2), 6, tablesize, &table));
-
-/*# else*/
-
-/* Allocate memory to hold the data we are loading */
-
-/* swix(OS_DynamicArea, IN(R0|R1), 1, TABLEAREA);
-
- fatal(swix(OS_DynamicArea, IN(R0|R1|R2|R3|R4|R5|R6|R7|R8)|OUT(R3), 0,
- TABLEAREA, tablesize, -1, 0x80, tablesize, 0, 0, "Kate Table", &table));
-
-# endif*/
-
-
-/* read the table */
-
- fatal(swix(OS_Memory, IN(R0|R1), 7, table));
-
-/* Loop round locating all the valid blocks of memory */
-
- currentpage = -1;
-
- for (loop = 0; loop < tablesize * 2; ++loop)
- {
- page = table[loop / 2];
- if (loop % 2)
- page = page >> 4;
-
- page = page & 0x07;
-
- if (page != currentpage)
- {
- switch (currentpage)
- {
- case 1:
- bootconfig.dram[dramblocks].address = currentaddr * pagesize;
- bootconfig.dram[dramblocks].pages = currentpages;
- ++dramblocks;
- break;
-
- case 2:
- bootconfig.vram[vramblocks].address = currentaddr * pagesize;
- bootconfig.vram[vramblocks].pages = currentpages;
- ++vramblocks;
- break;
-
- default :
- break;
- }
-
- currentpage = page;
- currentaddr = loop;
- currentpages = 0;
- }
- ++currentpages;
- }
-
-/* Get the number of dram and vram pages */
-
- fatal(swix(OS_Memory, IN(R0)|OUT(R1), 0x00000108, &bootconfig.drampages));
- fatal(swix(OS_Memory, IN(R0)|OUT(R1), 0x00000208, &bootconfig.vrampages));
-
-/* Fill in more bootconfig parameters */
-
- bootconfig.pagesize = pagesize;
-
- bootconfig.dramblocks = dramblocks;
- bootconfig.vramblocks = vramblocks;
-
- return(table);
- }
-
-
-/* printf ... */
-
-void uprintf(char *formattoken, ...)
- {
- va_list ap;
- char temp[1024];
-
- temp[0] = '\0';
-
- va_start(ap, formattoken);
- vsprintf(temp, formattoken, ap);
- va_end(ap);
-
- swi(OS_Write0, IN(R0), temp);
- }
-
-/* End of bsdbooter.c */
diff --git a/sys/arch/arm32/boot/enteros.S b/sys/arch/arm32/boot/enteros.S
deleted file mode 100644
index 4989efbb991..00000000000
--- a/sys/arch/arm32/boot/enteros.S
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $OpenBSD: enteros.S,v 1.2 2000/03/03 00:54:47 todd Exp $ */
-/* $NetBSD: enteros.S,v 1.1 1996/01/31 23:18:11 mark Exp $ */
-
-/*
- * Copyright (c) 1994,1995 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * enteros.s
- *
- * Created : 12/09/94
- * Last updated : 12/09/94
- *
- * Based on kate/library/enteros.s
- *
- */
-
-#include "regs.h"
-
-#define OS_EnterOS 0x0016
-
-/*
- * Enters SVC26 mode
- */
-
- .text
- .global _EnterOS
-_EnterOS:
- mov r1, lr
- swi OS_EnterOS
-
- mov r0, pc
- mov pc, r1
-
diff --git a/sys/arch/arm32/boot/exit.S b/sys/arch/arm32/boot/exit.S
deleted file mode 100644
index cdd76e21507..00000000000
--- a/sys/arch/arm32/boot/exit.S
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $OpenBSD: exit.S,v 1.2 2000/03/03 00:54:47 todd Exp $ */
-/* $NetBSD: exit.S,v 1.1 1996/01/31 23:18:14 mark Exp $ */
-
-/*
- * Copyright (c) 1994,1995 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * _exit.s
- *
- * Boot loader exit point
- *
- * Created : 12/09/94
- * Last updated : 12/09/94
- *
- * Based on kate/boot/_exit.s
- *
- */
-
-#include "regs.h"
-
-#define OS_Exit 0x00000011
-
- .text
- .global ___exit
-___exit:
- mov r2, r0
- ldr r1, [pc, #Lexit_word - . - 8]
- mov r0, #0x00000000
- swi OS_Exit
-
-Lexit_word:
- .word 0x58454241
diff --git a/sys/arch/arm32/boot/exitos.S b/sys/arch/arm32/boot/exitos.S
deleted file mode 100644
index 5e956ae76dc..00000000000
--- a/sys/arch/arm32/boot/exitos.S
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $OpenBSD: exitos.S,v 1.2 2000/03/03 00:54:47 todd Exp $ */
-/* $NetBSD: exitos.S,v 1.1 1996/01/31 23:18:16 mark Exp $ */
-
-/*
- * Copyright (c) 1994,1995 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * exitos.s
- *
- *
- *
- * Created : 12/09/94
- * Last updated : 12/09/94
- *
- * Based on kate/library/exitos.s
- *
- *
- */
-
-#include "regs.h"
-
-/*
- * Returns from SVC26 mode to USR26 mode
- */
-
- .text
- .global _ExitOS
-_ExitOS:
- mov r2, lr
- bic r2, r2, #0x00000003
- movs pc, r2
diff --git a/sys/arch/arm32/boot/memcpy.S b/sys/arch/arm32/boot/memcpy.S
deleted file mode 100644
index e7243b0f939..00000000000
--- a/sys/arch/arm32/boot/memcpy.S
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $OpenBSD: memcpy.S,v 1.2 2000/03/03 00:54:47 todd Exp $ */
-/* $NetBSD: memcpy.S,v 1.1 1996/01/31 23:18:17 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- * Copyright (c) 1995 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * memset.S
- *
- * optimized memset function
- *
- * Created : 16/05/95
- * Last updated : 16/05/95
- *
- */
-
-sp .req r13
-lr .req r14
-pc .req r15
-
-.text
- .global _bcopy
- .global _ovbcopy
-
-_bcopy:
-_ovbcopy:
- teq r2, #0x00000000
- moveq r0, #0x00000000
- moveq pc, lr
- cmp r0, r1
- blt bcopy_back
-
-bcopy_loop:
- ldrb r3, [r0], #0x0001
- strb r3, [r1], #0x0001
- subs r2, r2, #0x00000001
- bne bcopy_loop
-
- mov pc, r14
-
-bcopy_back:
- add r0, r0, r2
- add r1, r1, r2
-
-bcopy_bloop:
- ldrb r3, [r0, #-0x0001]!
- strb r3, [r1, #-0x0001]!
- subs r2, r2, #0x00000001
- bne bcopy_bloop
-
- mov pc, r14
-
-
- .global _memcpy
-
-_memcpy:
- teq r2, #0x00000000
- moveq r0, #0x00000000
- moveq pc, lr
- cmp r1, r0
- blt memcpy_back
-
-memcpy_loop:
- ldrb r3, [r1], #0x0001
- strb r3, [r0], #0x0001
- subs r2, r2, #0x00000001
- bne memcpy_loop
-
- mov pc, r14
-
-memcpy_back:
- add r0, r0, r2
- add r1, r1, r2
-
-memcpy_bloop:
- ldrb r3, [r1, #-0x0001]!
- strb r3, [r0, #-0x0001]!
- subs r2, r2, #0x00000001
- bne memcpy_bloop
-
- mov pc, r14
diff --git a/sys/arch/arm32/boot/memset.S b/sys/arch/arm32/boot/memset.S
deleted file mode 100644
index 46796be5fca..00000000000
--- a/sys/arch/arm32/boot/memset.S
+++ /dev/null
@@ -1,136 +0,0 @@
-/* $OpenBSD: memset.S,v 1.2 2000/03/03 00:54:47 todd Exp $ */
-/* $NetBSD: memset.S,v 1.1 1996/01/31 23:18:19 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- * Copyright (c) 1995 Brini.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * memset.S
- *
- * optimized memset function
- *
- * Created : 16/05/95
- * Last updated : 16/05/95
- *
- */
-
-sp .req r13
-lr .req r14
-pc .req r15
-
-.text
-
- .global _memset
-
-/* Sets a block of memory to the specified value
- *
- * r0 - address
- * r1 - byte to write
- * r2 - number of bytes to write
- */
-
-_memset:
- and r1, r1, #0x000000ff /* We write bytes */
-
- cmp r2, #0x00000004 /* Do we have less than 4 bytes */
- blt memset_lessthanfour
-
-/* Ok first we will word align the address */
-
- ands r3, r0, #0x00000003 /* Get the bottom two bits */
- beq memset_addraligned /* The address is word aligned */
-
- rsb r3, r3, #0x00000004
- sub r2, r2, r3
- cmp r3, #0x00000002
- strb r1, [r0], #0x0001 /* Set 1 byte */
- strgeb r1, [r0], #0x0001 /* Set another byte */
- strgtb r1, [r0], #0x0001 /* and a third */
-
- cmp r2, #0x00000004
- blt memset_lessthanfour
-
-/* Now we must be word aligned */
-
-memset_addraligned:
-
- orr r3, r1, r1, lsl #8 /* Repeat the byte into a word */
- orr r3, r3, r3, lsl #16
-
-/* We know we have at least 4 bytes ... */
-
- cmp r2, #0x00000020 /* If less than 32 then use words */
- blt memset_lessthan32
-
-/* We have at least 32 so lets use quad words */
-
- stmfd sp!, {r4-r6} /* Store registers */
- mov r4, r3 /* Duplicate data */
- mov r5, r3
- mov r6, r3
-
-memset_loop16:
- stmia r0!, {r3-r6} /* Store 16 bytes */
- sub r2, r2, #0x00000010 /* Adjust count */
- cmp r2, #0x00000010 /* Still got at least 16 bytes ? */
- bgt memset_loop16
-
- ldmfd sp!, {r4-r6} /* Restore registers */
-
-/* Do we need to set some words as well ? */
-
- cmp r2, #0x00000004
- blt memset_lessthanfour
-
-/* Have either less than 16 or less than 32 depending on route taken */
-
-memset_lessthan32:
-
-/* We have at least 4 bytes so copy as words */
-
-memset_loop4:
- str r3, [r0], #0x0004
- sub r2, r2, #0x0004
- cmp r2, #0x00000004
- bge memset_loop4
-
-memset_lessthanfour:
- cmp r2, #0x00000000
- moveq pc, lr /* Zero length so exit */
-
- cmp r2, #0x00000002
- strb r1, [r0], #0x0001 /* Set 1 byte */
- strgeb r1, [r0], #0x0001 /* Set another byte */
- strgtb r1, [r0], #0x0001 /* and a third */
-
- mov pc, lr /* Exit */
diff --git a/sys/arch/arm32/boot/regs.h b/sys/arch/arm32/boot/regs.h
deleted file mode 100644
index 2a08b6424ed..00000000000
--- a/sys/arch/arm32/boot/regs.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* $OpenBSD: regs.h,v 1.2 2000/03/03 00:54:47 todd Exp $ */
-/* $NetBSD: regs.h,v 1.1 1996/01/31 23:18:21 mark Exp $ */
-
-/* Copyright (c) 1994,1995 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES * LOSS OF USE, DATA, OR PROFITS * OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * regs.h
- *
- * Assembly register definitions
- *
- * Created : 14/01/96
- * Last updated : 14/01/96
- *
- */
-
-fp .req r11
-sl .req r12
-sp .req r13
-lr .req r14
-pc .req r15
diff --git a/sys/arch/arm32/boot/rmaouthdr b/sys/arch/arm32/boot/rmaouthdr
deleted file mode 100644
index 39e09843891..00000000000
--- a/sys/arch/arm32/boot/rmaouthdr
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-# $NetBSD: rmaouthdr,v 1.1 1996/01/31 23:18:23 mark Exp $
-
-dd if=$1 of=$2 ibs=32 skip=1 obs=1024b
diff --git a/sys/arch/arm32/boot/setcpsr.S b/sys/arch/arm32/boot/setcpsr.S
deleted file mode 100644
index d0ab3ff21c2..00000000000
--- a/sys/arch/arm32/boot/setcpsr.S
+++ /dev/null
@@ -1,95 +0,0 @@
-/* $OpenBSD: setcpsr.S,v 1.2 2000/03/03 00:54:47 todd Exp $ */
-/* $NetBSD: setcpsr.S,v 1.1 1996/01/31 23:18:27 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * setcpsr.S
- *
- * Miscellaneous routines to play with the CPSR register
- *
- * Eventually this routine can be inline assembly.
- *
- * Created : 12/09/94
- * Last updated : 28/05/95
- *
- * Based of kate/display/setcpsr.s
- *
- */
-
-fp .req r11
-ip .req r12
-sp .req r13
-lr .req r14
-pc .req r15
-
-.text
-
- .global _SetCPSR
-
-/* Sets and clears bits in the CPSR register
- *
- * r0 - bic mask
- * r1 - eor mask
- */
-
-_SetCPSR:
-/* mov ip, sp
- stmfd sp!, {fp, ip, lr, pc}
- sub fp, ip, #4*/
-
- mrs r3, cpsr_all /* Set the CPSR */
- bic r2, r3, r0
- eor r2, r2, r1
- msr cpsr_all, r2
-
- mov r0, r3 /* Return the old CPSR */
-
-/* ldmea fp, {fp, sp, pc}*/
- mov pc, lr
-
- .global _GetCPSR
-
-/* Gets the CPSR register
- *
- * Returns the CPSR in r0
- */
-
-_GetCPSR:
- mrs r0, cpsr_all /* Get the CPSR */
-
- mov pc, lr
-
diff --git a/sys/arch/arm32/boot/start.S b/sys/arch/arm32/boot/start.S
deleted file mode 100644
index 2ccb54700a5..00000000000
--- a/sys/arch/arm32/boot/start.S
+++ /dev/null
@@ -1,54 +0,0 @@
-/* $OpenBSD: start.S,v 1.2 2000/03/03 00:54:47 todd Exp $ */
-/* $NetBSD: start.S,v 1.1 1996/01/31 23:18:30 mark Exp $ */
-
-/* Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES * LOSS OF USE, DATA, OR PROFITS * OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * _main.s
- *
- * Kernel entry/exit code
- *
- * Created : 12/09/94
- * Last updated : 12/09/94
- *
- * Based on kate/boot/_main.s
- *
- */
-
-#include "regs.h"
-
- .global start
-start:
- b ___main
diff --git a/sys/arch/arm32/boot/strstr.c b/sys/arch/arm32/boot/strstr.c
deleted file mode 100644
index ce199dff82a..00000000000
--- a/sys/arch/arm32/boot/strstr.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $OpenBSD: strstr.c,v 1.2 2000/03/03 00:54:47 todd Exp $ */
-/* $NetBSD: strstr.c,v 1.1 1996/01/31 23:18:34 mark Exp $ */
-
-/*
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: strstr.c,v 1.4 1995/06/15 00:08:43 jtc Exp
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-/*
- * Find the first occurrence of find in s.
- */
-
-char *
-strstr(s, find)
- register const char *s, *find;
-{
- register char c, sc;
- register size_t len;
-
- if ((c = *find++) != 0) {
- len = strlen(find);
- do {
- do {
- if ((sc = *s++) == 0)
- return (NULL);
- } while (sc != c);
- } while (strncmp(s, find, len) != 0);
- s--;
- }
- return ((char *)s);
-}
-
-/* End of strstr.c */
diff --git a/sys/arch/arm32/boot/svc32.S b/sys/arch/arm32/boot/svc32.S
deleted file mode 100644
index db6cabae3f4..00000000000
--- a/sys/arch/arm32/boot/svc32.S
+++ /dev/null
@@ -1,66 +0,0 @@
-/* $OpenBSD: svc32.S,v 1.2 2000/03/03 00:54:47 todd Exp $ */
-/* $NetBSD: svc32.S,v 1.1 1996/01/31 23:18:38 mark Exp $ */
-
-/*
- * Copyright (c) 1994,1955 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES * LOSS OF USE, DATA, OR PROFITS * OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * svc32.s
- *
- * Created : 12/09/94
- * Last updated : 12/09/94
- *
- * Based on kate/library/svc32.s
- *
- */
-
-#include "regs.h"
-#include <machine/cpu.h>
-
-/*
- * Switches from SVC26 mode to SVC32 mode
- */
-
- .text
- .global _SVC32
-_SVC32:
- mrs r1, cpsr_all
- bic r1, r1, #(PSR_MODE)
- orr r1, r1, #(PSR_SVC32_MODE)
- msr cpsr_all, r1
-
- bic lr, lr, #0xfc000000
-
- mov pc, lr
diff --git a/sys/arch/arm32/boot/swis.h b/sys/arch/arm32/boot/swis.h
deleted file mode 100644
index e1282b1a4c7..00000000000
--- a/sys/arch/arm32/boot/swis.h
+++ /dev/null
@@ -1,596 +0,0 @@
-/*
- Title: Swi numbers for RiscOs
- Copyright (C) 1989, Acorn Computers Ltd., Cambridge, England
- $Revision: 1.1.1.1 $ SWI_LIST 1.00 02-May-89 (Program generated)
-*/
-
-#ifndef __swis_h
-#define __swis_h
-
-#define XOS_Bit 0x020000
-
-#define OS_WriteI 0x000100
-
-#define OS_WriteC 0x000000
-#define OS_WriteS 0x000001
-#define OS_Write0 0x000002
-#define OS_NewLine 0x000003
-#define OS_ReadC 0x000004
-#define OS_CLI 0x000005
-#define OS_Byte 0x000006
-#define OS_Word 0x000007
-#define OS_File 0x000008
-#define OS_Args 0x000009
-#define OS_BGet 0x00000a
-#define OS_BPut 0x00000b
-#define OS_GBPB 0x00000c
-#define OS_Find 0x00000d
-#define OS_ReadLine 0x00000e
-#define OS_Control 0x00000f
-#define OS_GetEnv 0x000010
-#define OS_Exit 0x000011
-#define OS_SetEnv 0x000012
-#define OS_IntOn 0x000013
-#define OS_IntOff 0x000014
-#define OS_CallBack 0x000015
-#define OS_EnterOS 0x000016
-#define OS_BreakPt 0x000017
-#define OS_BreakCtrl 0x000018
-#define OS_UnusedSWI 0x000019
-#define OS_UpdateMEMC 0x00001a
-#define OS_SetCallBack 0x00001b
-#define OS_Mouse 0x00001c
-#define OS_Heap 0x00001d
-#define OS_Module 0x00001e
-#define OS_Claim 0x00001f
-#define OS_Release 0x000020
-#define OS_ReadUnsigned 0x000021
-#define OS_GenerateEvent 0x000022
-#define OS_ReadVarVal 0x000023
-#define OS_SetVarVal 0x000024
-#define OS_GSInit 0x000025
-#define OS_GSRead 0x000026
-#define OS_GSTrans 0x000027
-#define OS_BinaryToDecimal 0x000028
-#define OS_FSControl 0x000029
-#define OS_ChangeDynamicArea 0x00002a
-#define OS_GenerateError 0x00002b
-#define OS_ReadEscapeState 0x00002c
-#define OS_EvaluateExpression 0x00002d
-#define OS_SpriteOp 0x00002e
-#define OS_ReadPalette 0x00002f
-#define OS_ServiceCall 0x000030
-#define OS_ReadVduVariables 0x000031
-#define OS_ReadPoint 0x000032
-#define OS_UpCall 0x000033
-#define OS_CallAVector 0x000034
-#define OS_ReadModeVariable 0x000035
-#define OS_RemoveCursors 0x000036
-#define OS_RestoreCursors 0x000037
-#define OS_SWINumberToString 0x000038
-#define OS_SWINumberFromString 0x000039
-#define OS_ValidateAddress 0x00003a
-#define OS_CallAfter 0x00003b
-#define OS_CallEvery 0x00003c
-#define OS_RemoveTickerEvent 0x00003d
-#define OS_InstallKeyHandler 0x00003e
-#define OS_CheckModeValid 0x00003f
-#define OS_ChangeEnvironment 0x000040
-#define OS_ClaimScreenMemory 0x000041
-#define OS_ReadMonotonicTime 0x000042
-#define OS_SubstituteArgs 0x000043
-#define OS_PrettyPrint 0x000044
-#define OS_Plot 0x000045
-#define OS_WriteN 0x000046
-#define OS_AddToVector 0x000047
-#define OS_WriteEnv 0x000048
-#define OS_ReadArgs 0x000049
-#define OS_ReadRAMFsLimits 0x00004a
-#define OS_ClaimDeviceVector 0x00004b
-#define OS_ReleaseDeviceVector 0x00004c
-#define OS_DelinkApplication 0x00004d
-#define OS_RelinkApplication 0x00004e
-#define OS_HeapSort 0x00004f
-#define OS_ExitAndDie 0x000050
-#define OS_ReadMemMapInfo 0x000051
-#define OS_ReadMemMapEntries 0x000052
-#define OS_SetMemMapEntries 0x000053
-#define OS_AddCallBack 0x000054
-#define OS_ReadDefaultHandler 0x000055
-#define OS_SetECFOrigin 0x000056
-#define OS_SerialOp 0x000057
-#define OS_ReadSysInfo 0x000058
-#define OS_Confirm 0x000059
-#define OS_ChangedBox 0x00005a
-#define OS_CRC 0x00005b
-#define OS_ReadDynamicArea 0x00005c
-#define OS_PrintChar 0x00005d
-#define OS_ChangeRedirection 0x00005e
-#define OS_RemoveCallBack 0x00005f
-#define OS_FindMemMapEntries 0x000060
-#define OS_SetColour 0x000061
-#define OS_ConvertStandardDateAndTime 0x0000c0
-#define OS_ConvertDateAndTime 0x0000c1
-#define OS_ConvertHex1 0x0000d0
-#define OS_ConvertHex2 0x0000d1
-#define OS_ConvertHex4 0x0000d2
-#define OS_ConvertHex6 0x0000d3
-#define OS_ConvertHex8 0x0000d4
-#define OS_ConvertCardinal1 0x0000d5
-#define OS_ConvertCardinal2 0x0000d6
-#define OS_ConvertCardinal3 0x0000d7
-#define OS_ConvertCardinal4 0x0000d8
-#define OS_ConvertInteger1 0x0000d9
-#define OS_ConvertInteger2 0x0000da
-#define OS_ConvertInteger3 0x0000db
-#define OS_ConvertInteger4 0x0000dc
-#define OS_ConvertBinary1 0x0000dd
-#define OS_ConvertBinary2 0x0000de
-#define OS_ConvertBinary3 0x0000df
-#define OS_ConvertBinary4 0x0000e0
-#define OS_ConvertSpacedCardinal1 0x0000e1
-#define OS_ConvertSpacedCardinal2 0x0000e2
-#define OS_ConvertSpacedCardinal3 0x0000e3
-#define OS_ConvertSpacedCardinal4 0x0000e4
-#define OS_ConvertSpacedInteger1 0x0000e5
-#define OS_ConvertSpacedInteger2 0x0000e6
-#define OS_ConvertSpacedInteger3 0x0000e7
-#define OS_ConvertSpacedInteger4 0x0000e8
-#define OS_ConvertFixedNetStation 0x0000e9
-#define OS_ConvertNetStation 0x0000ea
-#define OS_ConvertFixedFileSize 0x0000eb
-#define OS_ConvertFileSize 0x0000ec
-#define IIC_Control 0x000240
-#define Cache_Control 0x000280
-#define Cache_Cacheable 0x000281
-#define Cache_Updateable 0x000282
-#define Cache_Disruptive 0x000283
-#define Cache_Flush 0x000284
-#define Trace_R0 0x00bf00
-#define Trace_R1 0x00bf01
-#define Trace_R2 0x00bf02
-#define Trace_R3 0x00bf03
-#define Trace_R4 0x00bf04
-#define Trace_R5 0x00bf05
-#define Trace_R6 0x00bf06
-#define Trace_R7 0x00bf07
-#define Trace_R8 0x00bf08
-#define Trace_R9 0x00bf09
-#define Trace_R10 0x00bf0a
-#define Trace_R11 0x00bf0b
-#define Trace_R12 0x00bf0c
-#define Trace_R13 0x00bf0d
-#define Trace_R14 0x00bf0e
-#define Trace_R15 0x00bf0f
-#define Trace_Regs 0x00bf10
-#define Trace_WriteC 0x00bf11
-#define Trace_NewLine 0x00bf12
-#define Trace_WriteS 0x00bf13
-#define Trace_Write0 0x00bf14
-#define Font_CacheAddr 0x040080
-#define Font_FindFont 0x040081
-#define Font_LoseFont 0x040082
-#define Font_ReadDefn 0x040083
-#define Font_ReadInfo 0x040084
-#define Font_StringWidth 0x040085
-#define Font_Paint 0x040086
-#define Font_Caret 0x040087
-#define Font_ConverttoOS 0x040088
-#define Font_Converttopoints 0x040089
-#define Font_SetFont 0x04008a
-#define Font_CurrentFont 0x04008b
-#define Font_FutureFont 0x04008c
-#define Font_FindCaret 0x04008d
-#define Font_CharBBox 0x04008e
-#define Font_ReadScaleFactor 0x04008f
-#define Font_SetScaleFactor 0x040090
-#define Font_ListFonts 0x040091
-#define Font_SetFontColours 0x040092
-#define Font_SetPalette 0x040093
-#define Font_ReadThresholds 0x040094
-#define Font_SetThresholds 0x040095
-#define Font_FindCaretJ 0x040096
-#define Font_StringBBox 0x040097
-#define Font_ReadColourTable 0x040098
-#define Font_MakeBitmap 0x040099
-#define Font_UnCacheFile 0x04009a
-#define Font_SetFontMax 0x04009b
-#define Font_ReadFontMax 0x04009c
-#define Font_ReadFontPrefix 0x04009d
-#define Font_SwitchOutputToBuffer 0x04009e
-#define Font_ReadFontMetrics 0x04009f
-#define Font_DecodeMenu 0x0400a0
-#define Font_ScanString 0x0400a1
-#define Font_SetColourTable 0x0400a2
-#define Font_CurrentRGB 0x0400a3
-#define Font_FutureRGB 0x0400a4
-#define Font_ReadEncodingFilename 0x0400a5
-#define Font_FindField 0x0400a6
-#define Font_ApplyFields 0x0400a7
-#define Font_LookupFont 0x0400a8
-#define Wimp_Initialise 0x0400c0
-#define Wimp_CreateWindow 0x0400c1
-#define Wimp_CreateIcon 0x0400c2
-#define Wimp_DeleteWindow 0x0400c3
-#define Wimp_DeleteIcon 0x0400c4
-#define Wimp_OpenWindow 0x0400c5
-#define Wimp_CloseWindow 0x0400c6
-#define Wimp_Poll 0x0400c7
-#define Wimp_RedrawWindow 0x0400c8
-#define Wimp_UpdateWindow 0x0400c9
-#define Wimp_GetRectangle 0x0400ca
-#define Wimp_GetWindowState 0x0400cb
-#define Wimp_GetWindowInfo 0x0400cc
-#define Wimp_SetIconState 0x0400cd
-#define Wimp_GetIconState 0x0400ce
-#define Wimp_GetPointerInfo 0x0400cf
-#define Wimp_DragBox 0x0400d0
-#define Wimp_ForceRedraw 0x0400d1
-#define Wimp_SetCaretPosition 0x0400d2
-#define Wimp_GetCaretPosition 0x0400d3
-#define Wimp_CreateMenu 0x0400d4
-#define Wimp_DecodeMenu 0x0400d5
-#define Wimp_WhichIcon 0x0400d6
-#define Wimp_SetExtent 0x0400d7
-#define Wimp_SetPointerShape 0x0400d8
-#define Wimp_OpenTemplate 0x0400d9
-#define Wimp_CloseTemplate 0x0400da
-#define Wimp_LoadTemplate 0x0400db
-#define Wimp_ProcessKey 0x0400dc
-#define Wimp_CloseDown 0x0400dd
-#define Wimp_StartTask 0x0400de
-#define Wimp_ReportError 0x0400df
-#define Wimp_GetWindowOutline 0x0400e0
-#define Wimp_PollIdle 0x0400e1
-#define Wimp_PlotIcon 0x0400e2
-#define Wimp_SetMode 0x0400e3
-#define Wimp_SetPalette 0x0400e4
-#define Wimp_ReadPalette 0x0400e5
-#define Wimp_SetColour 0x0400e6
-#define Wimp_SendMessage 0x0400e7
-#define Wimp_CreateSubMenu 0x0400e8
-#define Wimp_SpriteOp 0x0400e9
-#define Wimp_BaseOfSprites 0x0400ea
-#define Wimp_BlockCopy 0x0400eb
-#define Wimp_SlotSize 0x0400ec
-#define Wimp_ReadPixTrans 0x0400ed
-#define Wimp_ClaimFreeMemory 0x0400ee
-#define Wimp_CommandWindow 0x0400ef
-#define Wimp_TextColour 0x0400f0
-#define Wimp_TransferBlock 0x0400f1
-#define Wimp_ReadSysInfo 0x0400f2
-#define Wimp_SetFontColours 0x0400f3
-#define Wimp_GetMenuState 0x0400f4
-#define Wimp_RegisterFilter 0x0400f5
-#define Wimp_AddMessages 0x0400f6
-#define Wimp_RemoveMessages 0x0400f7
-#define Wimp_SetColourMapping 0x0400f8
-#define Sound_Configure 0x040140
-#define Sound_Enable 0x040141
-#define Sound_Stereo 0x040142
-#define Sound_Speaker 0x040143
-#define Sound_Volume 0x040180
-#define Sound_SoundLog 0x040181
-#define Sound_LogScale 0x040182
-#define Sound_InstallVoice 0x040183
-#define Sound_RemoveVoice 0x040184
-#define Sound_AttachVoice 0x040185
-#define Sound_ControlPacked 0x040186
-#define Sound_Tuning 0x040187
-#define Sound_Pitch 0x040188
-#define Sound_Control 0x040189
-#define Sound_AttachNamedVoice 0x04018a
-#define Sound_ReadControlBlock 0x04018b
-#define Sound_WriteControlBlock 0x04018c
-#define Sound_QInit 0x0401c0
-#define Sound_QSchedule 0x0401c1
-#define Sound_QRemove 0x0401c2
-#define Sound_QFree 0x0401c3
-#define Sound_QSDispatch 0x0401c4
-#define Sound_QTempo 0x0401c5
-#define Sound_QBeat 0x0401c6
-#define Sound_QInterface 0x0401c7
-#define ADFS_DiscOp 0x040240
-#define ADFS_HDC 0x040241
-#define ADFS_Drives 0x040242
-#define ADFS_FreeSpace 0x040243
-#define ADFS_Retries 0x040244
-#define ADFS_DescribeDisc 0x040245
-#define ADFS_VetFormat 0x040246
-#define ADFS_FlpProcessDCB 0x040247
-#define ADFS_ControllerType 0x040248
-#define ADFS_PowerControl 0x040249
-#define ADFS_SetIDEController 0x04024a
-#define ADFS_IDEUserOp 0x04024b
-#define ADFS_MiscOp 0x04024c
-#define ADFS_ECCSAndRetries 0x040250
-#define Podule_ReadID 0x040280
-#define Podule_ReadHeader 0x040281
-#define Podule_EnumerateChunks 0x040282
-#define Podule_ReadChunk 0x040283
-#define Podule_ReadBytes 0x040284
-#define Podule_WriteBytes 0x040285
-#define Podule_CallLoader 0x040286
-#define Podule_RawRead 0x040287
-#define Podule_RawWrite 0x040288
-#define Podule_HardwareAddress 0x040289
-#define Podule_EnumerateChunksWithInfo 0x04028a
-#define Podule_HardwareAddresses 0x04028b
-#define Podule_ReturnNumber 0x04028c
-#define PCEmMod_KeyEvent_Init 0x0402c0
-#define PCEmMod_KeyEvent_Info 0x0402c1
-#define PCEmMod_KeyEvent_Accept 0x0402c2
-#define PCEmMod_KeyEvent_Ignore 0x0402c3
-#define PCEmMod_KeyEvent_Check 0x0402c4
-#define PCEmMod_KeyEvent_Get 0x0402c5
-#define PCEmMod_KeyEvent_Put 0x0402c6
-#define PCEmMod_MicroTimer_Get 0x0402c7
-#define PCEmMod_PCEvent_Init 0x0402c8
-#define PCEmMod_PCEvent_Accept 0x0402c9
-#define PCEmMod_PCEvent_Ignore 0x0402ca
-#define PCEmMod_PCEvent_Check 0x0402cb
-#define PCEmMod_PCEvent_Get 0x0402cc
-#define PCEmMod_DelayFor 0x0402cd
-#define PCEmMod_CodeBase 0x0402ce
-#define PCEmMod_Profile_Init 0x0402cf
-#define PCEmMod_Profile_On 0x0402d0
-#define PCEmMod_Profile_Off 0x0402d1
-#define PCEmMod_Profile_Write 0x0402d2
-#define PCEmMod_InterceptMouse 0x0402d3
-#define PCEmMod_RestoreMouse 0x0402d4
-#define PCEmMod_ReadMouse 0x0402d5
-#define Debugger_Disassemble 0x040380
-#define SCSI_Version 0x0403c0
-#define SCSI_Initialise 0x0403c1
-#define SCSI_Control 0x0403c2
-#define SCSI_Op 0x0403c3
-#define SCSI_Status 0x0403c4
-#define SCSI_Reserve 0x0403c7
-#define SCSI_List 0x0403c8
-#define FPEmulator_Version 0x040480
-#define FileCore_DiscOp 0x040540
-#define FileCore_Create 0x040541
-#define FileCore_Drives 0x040542
-#define FileCore_FreeSpace 0x040543
-#define FileCore_FloppyStructure 0x040544
-#define FileCore_DescribeDisc 0x040545
-#define FileCore_DiscardReadSectorsCache 0x040546
-#define FileCore_DiscFormat 0x040547
-#define FileCore_LayoutStructure 0x040548
-#define FileCore_MiscOp 0x040549
-#define Shell_Create 0x0405c0
-#define Shell_Destroy 0x0405c1
-#define Hourglass_On 0x0406c0
-#define Hourglass_Off 0x0406c1
-#define Hourglass_Smash 0x0406c2
-#define Hourglass_Start 0x0406c3
-#define Hourglass_Percentage 0x0406c4
-#define Hourglass_LEDs 0x0406c5
-#define Hourglass_Colours 0x0406c6
-#define Draw_ProcessPath 0x040700
-#define Draw_ProcessPathFP 0x040701
-#define Draw_Fill 0x040702
-#define Draw_FillFP 0x040703
-#define Draw_Stroke 0x040704
-#define Draw_StrokeFP 0x040705
-#define Draw_StrokePath 0x040706
-#define Draw_StrokePathFP 0x040707
-#define Draw_FlattenPath 0x040708
-#define Draw_FlattenPathFP 0x040709
-#define Draw_TransformPath 0x04070a
-#define Draw_TransformPathFP 0x04070b
-#define ColourTrans_SelectTable 0x040740
-#define ColourTrans_SelectGCOLTable 0x040741
-#define ColourTrans_ReturnGCOL 0x040742
-#define ColourTrans_SetGCOL 0x040743
-#define ColourTrans_ReturnColourNumber 0x040744
-#define ColourTrans_ReturnGCOLForMode 0x040745
-#define ColourTrans_ReturnColourNumberForMode 0x040746
-#define ColourTrans_ReturnOppGCOL 0x040747
-#define ColourTrans_SetOppGCOL 0x040748
-#define ColourTrans_ReturnOppColourNumber 0x040749
-#define ColourTrans_ReturnOppGCOLForMode 0x04074a
-#define ColourTrans_ReturnOppColourNumberForMode 0x04074b
-#define ColourTrans_GCOLToColourNumber 0x04074c
-#define ColourTrans_ColourNumberToGCOL 0x04074d
-#define ColourTrans_ReturnFontColours 0x04074e
-#define ColourTrans_SetFontColours 0x04074f
-#define ColourTrans_InvalidateCache 0x040750
-#define ColourTrans_SetCalibration 0x040751
-#define ColourTrans_ReadCalibration 0x040752
-#define ColourTrans_ConvertDeviceColour 0x040753
-#define ColourTrans_ConvertDevicePalette 0x040754
-#define ColourTrans_ConvertRGBToCIE 0x040755
-#define ColourTrans_ConvertCIEToRGB 0x040756
-#define ColourTrans_WriteCalibrationToFile 0x040757
-#define ColourTrans_ConvertRGBToHSV 0x040758
-#define ColourTrans_ConvertHSVToRGB 0x040759
-#define ColourTrans_ConvertRGBToCMYK 0x04075a
-#define ColourTrans_ConvertCMYKToRGB 0x04075b
-#define ColourTrans_ReadPalette 0x04075c
-#define ColourTrans_WritePalette 0x04075d
-#define ColourTrans_SetColour 0x04075e
-#define ColourTrans_MiscOp 0x04075f
-#define ColourTrans_WriteLoadingsToFile 0x040760
-#define ColourTrans_SetTextColour 0x040761
-#define ColourTrans_SetOppTextColour 0x040762
-#define ColourTrans_GenerateTable 0x040763
-#define SCSIFS_DiscOp 0x040980
-#define SCSIFS_Drives 0x040982
-#define SCSIFS_FreeSpace 0x040983
-#define SCSIFS_DescribeDisc 0x040985
-#define SCSIFS_TestReady 0x040986
-#define Super_Sample90 0x040d80
-#define Super_Sample45 0x040d81
-#define FilerAction_SendSelectedDirectory 0x040f80
-#define FilerAction_SendSelectedFile 0x040f81
-#define FilerAction_SendStartOperation 0x040f82
-#define SCSI_LogVersion 0x041080
-#define SCSI_LogList 0x041081
-#define MessageTrans_FileInfo 0x041500
-#define MessageTrans_OpenFile 0x041501
-#define MessageTrans_Lookup 0x041502
-#define MessageTrans_MakeMenus 0x041503
-#define MessageTrans_CloseFile 0x041504
-#define MessageTrans_EnumerateTokens 0x041505
-#define MessageTrans_ErrorLookup 0x041506
-#define MessageTrans_GSLookup 0x041507
-#define MessageTrans_CopyError 0x041508
-#define PDumper_Info 0x041b00
-#define PDumper_Claim 0x041b01
-#define PDumper_Free 0x041b02
-#define PDumper_Find 0x041b03
-#define PDumper_StartJob 0x041b04
-#define PDumper_TidyJob 0x041b05
-#define PDumper_SetColour 0x041b06
-#define PDumper_PrepareStrip 0x041b07
-#define PDumper_LookupError 0x041b08
-#define PDumper_CopyFilename 0x041b09
-#define ResourceFS_RegisterFiles 0x041b40
-#define ResourceFS_DeregisterFiles 0x041b41
-#define DragASprite_Start 0x042400
-#define DragASprite_Stop 0x042401
-#define DDEUtils_Prefix 0x042580
-#define DDEUtils_SetCLSize 0x042581
-#define DDEUtils_SetCL 0x042582
-#define DDEUtils_GetCLSize 0x042583
-#define DDEUtils_GetCl 0x042584
-#define DDEUtils_ThrowbackRegister 0x042585
-#define DDEUtils_ThrowbackUnRegister 0x042586
-#define DDEUtils_ThrowbackStart 0x042587
-#define DDEUtils_ThrowbackSend 0x042588
-#define DDEUtils_ThrowbackEnd 0x042589
-#define Filter_RegisterPreFilter 0x042640
-#define Filter_RegisterPostFilter 0x042641
-#define Filter_DeRegisterPreFilter 0x042642
-#define Filter_DeRegisterPostFilter 0x042643
-#define TaskManager_TaskNameFromHandle 0x042680
-#define TaskManager_EnumerateTasks 0x042681
-#define TaskManager_Shutdown 0x042682
-#define Squash_Compress 0x042700
-#define Squash_Decompress 0x042701
-#define DeviceFS_Register 0x042740
-#define DeviceFS_Deregister 0x042741
-#define DeviceFS_RegisterObjects 0x042742
-#define DeviceFS_DeregisterObjects 0x042743
-#define DeviceFS_CallDevice 0x042744
-#define DeviceFS_Threshold 0x042745
-#define DeviceFS_ReceivedCharacter 0x042746
-#define DeviceFS_TransmitCharacter 0x042747
-#define Impulse_Initialise 0x0428c0
-#define Impulse_Decode 0x0428c1
-#define Impulse_SendMessage 0x0428c2
-#define Impulse_TransmitData 0x0428c3
-#define Impulse_FetchData 0x0428c4
-#define Impulse_CloseDown 0x0428c5
-#define Impulse_DeferReply 0x0428c6
-#define Buffer_Create 0x042940
-#define Buffer_Remove 0x042941
-#define Buffer_Register 0x042942
-#define Buffer_Deregister 0x042943
-#define Buffer_ModifyFlags 0x042944
-#define Buffer_LinkDevice 0x042945
-#define Buffer_UnlinkDevice 0x042946
-#define Buffer_GetInfo 0x042947
-#define Buffer_Threshold 0x042948
-#define BASICTrans_HELP 0x042c80
-#define BASICTrans_Error 0x042c81
-#define BASICTrans_Message 0x042c82
-#define Parallel_HardwareAddress 0x042ec0
-#define Parallel_Op 0x042ec1
-#define Territory_Number 0x043040
-#define Territory_Register 0x043041
-#define Territory_Deregister 0x043042
-#define Territory_NumberToName 0x043043
-#define Territory_Exists 0x043044
-#define Territory_AlphabetNumberToName 0x043045
-#define Territory_SelectAlphabet 0x043046
-#define Territory_SetTime 0x043047
-#define Territory_ReadCurrentTimeZone 0x043048
-#define Territory_ConvertTimeToUTCOrdinals 0x043049
-#define Territory_ReadTimeZones 0x04304a
-#define Territory_ConvertDateAndTime 0x04304b
-#define Territory_ConvertStandardDateAndTime 0x04304c
-#define Territory_ConvertStandardDate 0x04304d
-#define Territory_ConvertStandardTime 0x04304e
-#define Territory_ConvertTimeToOrdinals 0x04304f
-#define Territory_ConvertTimeStringToOrdinals 0x043050
-#define Territory_ConvertOrdinalsToTime 0x043051
-#define Territory_Alphabet 0x043052
-#define Territory_AlphabetIdentifier 0x043053
-#define Territory_SelectKeyboardHandler 0x043054
-#define Territory_WriteDirection 0x043055
-#define Territory_CharacterPropertyTable 0x043056
-#define Territory_LowerCaseTable 0x043057
-#define Territory_UpperCaseTable 0x043058
-#define Territory_ControlTable 0x043059
-#define Territory_PlainTable 0x04305a
-#define Territory_ValueTable 0x04305b
-#define Territory_RepresentationTable 0x04305c
-#define Territory_Collate 0x04305d
-#define Territory_ReadSymbols 0x04305e
-#define Territory_ReadCalendarInformation 0x04305f
-#define Territory_NameToNumber 0x043060
-#define Territory_TransformString 0x043061
-#define Territory_Reserved1 0x043062
-#define Territory_Reserved2 0x043063
-#define Territory_Reserved3 0x043064
-#define Territory_Reserved4 0x043065
-#define Territory_Reserved5 0x043066
-#define Territory_Reserved6 0x043067
-#define Territory_Reserved7 0x043068
-#define Territory_Reserved8 0x043069
-#define Territory_Reserved9 0x04306a
-#define Territory_Reserved10 0x04306b
-#define Territory_Reserved11 0x04306c
-#define Territory_Reserved12 0x04306d
-#define Territory_Reserved13 0x04306e
-#define Territory_Reserved14 0x04306f
-#define Territory_Reserved15 0x043070
-#define Territory_Reserved16 0x043071
-#define Territory_Reserved17 0x043072
-#define Territory_Reserved18 0x043073
-#define Territory_Reserved19 0x043074
-#define Territory_ConvertTextToString 0x043075
-#define ScreenBlanker_Control 0x043100
-#define TaskWindow_TaskInfo 0x043380
-#define Free_Register 0x0444c0
-#define Free_DeRegister 0x0444c1
-#define DOSFS_DiscFormat 0x044b00
-#define DOSFS_LayoutStructure 0x044b01
-#define PDriver_Info 0x080140
-#define PDriver_SetInfo 0x080141
-#define PDriver_CheckFeatures 0x080142
-#define PDriver_PageSize 0x080143
-#define PDriver_SetPageSize 0x080144
-#define PDriver_SelectJob 0x080145
-#define PDriver_CurrentJob 0x080146
-#define PDriver_FontSWI 0x080147
-#define PDriver_EndJob 0x080148
-#define PDriver_AbortJob 0x080149
-#define PDriver_Reset 0x08014a
-#define PDriver_GiveRectangle 0x08014b
-#define PDriver_DrawPage 0x08014c
-#define PDriver_GetRectangle 0x08014d
-#define PDriver_CancelJob 0x08014e
-#define PDriver_ScreenDump 0x08014f
-#define PDriver_EnumerateJobs 0x080150
-#define PDriver_SetPrinter 0x080151
-#define PDriver_CancelJobWithError 0x080152
-#define PDriver_SelectIllustration 0x080153
-#define PDriver_InsertIllustration 0x080154
-#define PDriver_DeclareFont 0x080155
-#define PDriver_DeclareDriver 0x080156
-#define PDriver_RemoveDriver 0x080157
-#define PDriver_SelectDriver 0x080158
-#define PDriver_EnumerateDrivers 0x080159
-#define PDriver_MiscOp 0x08015a
-#define PDriver_MiscOpForDriver 0x08015b
-#define PDriver_SetDriver 0x08015c
-#define SharedCLibrary_LibInitAPCS_A 0x080680
-#define SharedCLibrary_LibInitAPCS_R 0x080681
-#define SharedCLibrary_LibInitModule 0x080682
-#define FrontEnd_ExtendedCmdLine 0x081400
-#define FrontEnd_FreeCmdLine 0x081401
-
-#endif
diff --git a/sys/arch/arm32/boot/swiv.S b/sys/arch/arm32/boot/swiv.S
deleted file mode 100644
index 6e42afaa9d5..00000000000
--- a/sys/arch/arm32/boot/swiv.S
+++ /dev/null
@@ -1,80 +0,0 @@
-#include "regs.h"
-
- .text
-
-SWIReturnInst:
- ldr pc, [sp, #0*4]
-
- .global _swix
-_swix:
- orr r0, r0, #0x20000
-
- .global _swi
-_swi:
-
-/*
- * Construct a stack frame that looks something like this:
- * returnval
- * LDMIA r12!, {r0..rn}
- * SWI xxxxxx
- * LDR pc, [sp]
- * saved r4-r11,lr
- * saved r1
- * saved input values (r2...rn)
- */
-
- mov pc, lr
-
- stmfd sp!, {r1-r3} /* Save r1 and put 1st two variadic args on stack */
- bic r2, r0, #0xff000000
- orr r2, r2, #0xef000000 /* Construct SWI instruction */
- adr r0, SWIReturn
- tst r1, #0x20000 /* bit for write flags */
- adrne r0, SWIReturnFlags
- bic r1, r1, #0xff000000 /* Construct LDMIA R12!, {regs} instruction, if */
- bics r1, r1, #0x00ff0000 /* {regs} = {} (IE no input regs) we must not */
- orrne r1, r1, #0xe8000000 /* use an LDMIA R12!, {} instruction as this is an */
- orrne r1, r1, #0x00bc0000 /* invalid instruction, we use a suitable NOP instead */
- moveq r1, #0 /* 0 = opcode for ANDEQ r0, r0, r0 (a suitable NOP) */
- ldr r3, SWIReturnInst
- stmfd sp!, {r0-r9, r11, lr} /* Save regs and set up SWI call routine (in R0-R3) */
- add r12, sp, #(12+1)*4 /* Point R12 at input regs on stack. */
- add pc, sp, #4 /* Call routine on stack */
-SWIReturnFlags:
- ldr r11, [r12], #4
- str pc, [r11] /* write flags */
-SWIReturn:
- ldr lr, [sp, #(12+0)*4] /* Fetch reg mask again */
- movs lr, lr, asl #1 /* Shift out setting C if R0 to be written, N */
- ldrcs r11, [r12], #4 /* if R1 to be written. */
- strcs r0, [r11]
- ldrmi r11, [r12], #4
- strmi r1, [r11]
- movs lr, lr, asl #2 /* Shift 2 bits each time for the next 2 regs */
- ldrcs r11, [r12], #4
- strcs r2, [r11]
- ldrmi r11, [r12], #4
- strmi r3, [r11]
- movs lr, lr, asl #2
- ldrcs r11, [r12], #4
- strcs r4, [r11]
- ldrmi r11, [r12], #4
- strmi r5, [r11]
- movs lr, lr, asl #2
- ldrcs r11, [r12], #4
- strcs r6, [r11]
- ldrmi r11, [r12], #4
- strmi r7, [r11]
- movs lr, lr, asl #2
- ldrcs r11, [r12], #4
- strcs r8, [r11]
- ldrmi r11, [r12], #4
- strmi r9, [r11]
- ldr r1, [sp, #2*4]
- tst r1, #0x20000 /* X-bit clear */
- cmpeq pc, #0x80000000 /* SET V flag if so, so R0 not cleared */
- movvc r0, #0 /* Clear R0 if no error (or X-bit clear) */
- add sp, sp, #4*4 /* Drop SWI call routine */
- ldmia sp!, {r4-r9,r11,lr}
- add sp, sp, #3*4 /* Drop saved R1 and 1st two variadic args. */
- movs pc, lr
diff --git a/sys/arch/arm32/boot/swiv.h b/sys/arch/arm32/boot/swiv.h
deleted file mode 100644
index d60ee2e546a..00000000000
--- a/sys/arch/arm32/boot/swiv.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* SWI veneers:
- * Written by Edward Nevill and Jonathan Roach in an idle moment between projects.
- * Hacked by BDB to add flag returning
- */
-
-/* Anonymous Error type */
-
-struct Error { int num; char msg[4]; };
-
-typedef struct Error Error;
-
-/* Generic SWI interface
- * swi(swino,mask,regs...)
- * swino = SWI number to call as defined in h.swis, X bit set if you wish the
- * X form of the SWI to be called, clear if you want the non X form.
- * reg_mask = mask of in / out registers
- * bits 0-9: Bit N set => Register N specified on input
- * Bit N clear => Register N unspecified on input
- * bits 22-31: Bit N set => Register N-22 on output stored
- * in address specified in varargs list.
- * ... In order, input registers followed by output registers,
- * starting at r0 and going up.
- * returns 0 or errorblock pointer if X-bit set
- * returns r0 if X-bit clear
- * swix(swino,mask,regs...)
- * This behaves identically to 'swi' except that it always calls the X form.
- *
- * Eg:
- * swi(OS_SWINumberToString, IN(R0|R1|R2), n, buf, 255);
- * e = swi(XOS_SWINumberFromString, IN(R1)|OUT(R0), str, &n);
- * - Error block pointer (or 0) is returned so must get returned R0
- * - via argument list.
- * e = swix(OS_SWINumberFromString, IN(R1)|OUT(R0), str, &n);
- * - As above but uses the swix function rather that setting the X bit
- * explicitly (saves one instruction on SWI call).
- * e = swi(OS_File, IN(R0|R1|R2|R3)|OUT(R4), 255, name, buff, 0, &len);
- * - We don't care about the load, exec or attrs so don't specify
- * them in the output registers.
- */
-
-extern Error *swix(int swino, int reg_mask, ...);
-extern int swi(int swino, int reg_mask, ...);
-
-/* Register mask macros
- * The bits in the register mask are arranged as follows:
- * 31 30 29 ... 22 ... 8 ... 2 1 0
- * O0 O1 O2 ... O9 I9 ... I2 I1 I0 I(N) = bit set if R(N) used on entry
- * O(N) = bit set if R(N) written on exit
- * The bits are arranged like this to optimise the case where a SWI is being
- * called with a small number of input and output registers. For example, a SWI
- * call which uses R0-R5 on entry and R0-R1 on exit will have a register mask
- * of 0xC000003f which can be loaded into an ARM register in one instruction
- * (the compiler performs this optimisation, even when the constant wraps
- * around between bits 0 and 31). Using the more obvious coding of I0-I9 in bits
- * 0 - 9 and O0-O9 in bits 16-23 leads to a constant of 0x0003003f which require
- * two instructions.
- */
-#define IN(m) (m)
-/* old, incorrect version
-#define OUT(m) ((unsigned)(m&1)<<31|(m&2)<<29|(m&4)<<27|(m&8)<<25|(m&16)<<23|\
- (m&32)<<21|(m&64)<<19|(m&128)<<17|(m&256)<<15|(m&512)<<13)
-*/
-#define OUT(m) ((unsigned)((m)&1)<<31|((m)&2)<<29|((m)&4)<<27|\
- ((m)&8)<<25|((m)&16)<<23|((m)&32)<<21|((m)&64)<<19|\
- ((m)&128)<<17|((m)&256)<<15|((m)&512)<<13|((m)&1024)<<11)
-
-/* The register names
- * Change these to use different names if you use R0 - R9 elsewhere in your program
- */
-#define PSW 0x400 /* Use only in OUT, orders BEFORE others */
-#define R0 0x001
-#define R1 0x002
-#define R2 0x004
-#define R3 0x008
-#define R4 0x010
-#define R5 0x020
-#define R6 0x040
-#define R7 0x080
-#define R8 0x100
-#define R9 0x200
diff --git a/sys/arch/arm32/boot/vsprintf.c b/sys/arch/arm32/boot/vsprintf.c
deleted file mode 100644
index 3e6e9ffb28a..00000000000
--- a/sys/arch/arm32/boot/vsprintf.c
+++ /dev/null
@@ -1,275 +0,0 @@
-#include <stdarg.h>
-#include <string.h>
-
-# define toupper(x) ((x >= 'a' && x <= 'z') ? (x & 0xdf) : x)
-/*# define tolower(x) ((x >= 'A' && x <= 'Z') ? (x | 0x20) : x)*/
-# define islower(x) ((x >= 'a' && x <= 'z') ? 1 : 0)
-# define isdigit(x) ((x >= '0' && x <= '9') ? 1 : 0)
-# define isxdigit(x) (((x >= '0' && x <= '9') || (x >= 'a' && x <= 'f') || (x >= 'A' && x <= 'F')) ? 1 : 0)
-
-unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base)
-{
- unsigned long result = 0,value;
-
- if (!base) {
- base = 10;
- if (*cp == '0') {
- base = 8;
- cp++;
- if ((*cp == 'x') && isxdigit(cp[1])) {
- cp++;
- base = 16;
- }
- }
- }
- while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp-'0' : (islower(*cp)
- ? toupper(*cp) : *cp)-'A'+10) < base) {
- result = result*base + value;
- cp++;
- }
- if (endp)
- *endp = (char *)cp;
- return result;
-}
-
-/* we use this so that we can do without the ctype library */
-#define is_digit(c) ((c) >= '0' && (c) <= '9')
-
-static int skip_atoi(const char **s)
-{
- int i=0;
-
- while (is_digit(**s))
- i = i*10 + *((*s)++) - '0';
- return i;
-}
-
-#define ZEROPAD 1 /* pad with zero */
-#define SIGN 2 /* unsigned/signed long */
-#define PLUS 4 /* show plus */
-#define SPACE 8 /* space if plus */
-#define LEFT 16 /* left justified */
-#define SPECIAL 32 /* 0x */
-#define SMALL 64 /* use 'abcdef' instead of 'ABCDEF' */
-
-static unsigned int do_div(unsigned int *n, unsigned int base)
- {
- unsigned int d;
-
- d = *n % base;
- *n /= base;
-
- return(d);
- }
-
-static char * number(char * str, int num, int base, int size, int precision
- ,int type)
-{
- char c,sign,tmp[36];
- const char *digits="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- int i;
-
- if (type&SMALL) digits="0123456789abcdefghijklmnopqrstuvwxyz";
- if (type&LEFT) type &= ~ZEROPAD;
- if (base<2 || base>36)
- return 0;
- c = (type & ZEROPAD) ? '0' : ' ' ;
- if (type&SIGN && num<0) {
- sign='-';
- num = -num;
- } else
- sign=(type&PLUS) ? '+' : ((type&SPACE) ? ' ' : 0);
- if (sign) size--;
- if (type&SPECIAL) {
- if (base==16) size -= 2;
- else if (base==8) size--;
- }
- i=0;
- if (num==0)
- tmp[i++]='0';
- else while (num!=0)
- tmp[i++]=digits[do_div((unsigned int *)&num,base)];
- if (i>precision) precision=i;
- size -= precision;
- if (!(type&(ZEROPAD+LEFT)))
- while(size-->0)
- *str++ = ' ';
- if (sign)
- *str++ = sign;
- if (type&SPECIAL) {
- if (base==8)
- *str++ = '0';
- else if (base==16) {
- *str++ = '0';
- *str++ = digits[33];
- }
- }
- if (!(type&LEFT))
- while(size-->0)
- *str++ = c;
- while(i<precision--)
- *str++ = '0';
- while(i-->0)
- *str++ = tmp[i];
- while(size-->0)
- *str++ = ' ';
- return str;
-}
-
-int vsprintf(char *buf, const char *fmt, va_list args)
-{
- int len;
- int i;
- char * str;
- char *s;
- int *ip;
-
- int flags; /* flags to number() */
-
- int field_width; /* width of output field */
- int precision; /* min. # of digits for integers; max
- number of chars for from string */
- int qualifier; /* 'h', 'l', or 'L' for integer fields */
-
- for (str=buf ; *fmt ; ++fmt) {
- if (*fmt != '%') {
- *str++ = *fmt;
- continue;
- }
-
- /* process flags */
- flags = 0;
- repeat:
- ++fmt; /* this also skips first '%' */
- switch (*fmt) {
- case '-': flags |= LEFT; goto repeat;
- case '+': flags |= PLUS; goto repeat;
- case ' ': flags |= SPACE; goto repeat;
- case '#': flags |= SPECIAL; goto repeat;
- case '0': flags |= ZEROPAD; goto repeat;
- }
-
- /* get field width */
- field_width = -1;
- if (is_digit(*fmt))
- field_width = skip_atoi(&fmt);
- else if (*fmt == '*') {
- /* it's the next argument */
- field_width = va_arg(args, int);
- if (field_width < 0) {
- field_width = -field_width;
- flags |= LEFT;
- }
- }
-
- /* get the precision */
- precision = -1;
- if (*fmt == '.') {
- ++fmt;
- if (is_digit(*fmt))
- precision = skip_atoi(&fmt);
- else if (*fmt == '*') {
- /* it's the next argument */
- precision = va_arg(args, int);
- }
- if (precision < 0)
- precision = 0;
- }
-
- /* get the conversion qualifier */
- qualifier = -1;
- if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L') {
- qualifier = *fmt;
- ++fmt;
- }
-
- switch (*fmt) {
- case 'c':
- if (!(flags & LEFT))
- while (--field_width > 0)
- *str++ = ' ';
- *str++ = (unsigned char) va_arg(args, int);
- while (--field_width > 0)
- *str++ = ' ';
- break;
-
- case 's':
- s = va_arg(args, char *);
- if (!s)
- s = "<NULL>";
- len = strlen(s);
- if (precision < 0)
- precision = len;
- else if (len > precision)
- len = precision;
-
- if (!(flags & LEFT))
- while (len < field_width--)
- *str++ = ' ';
- for (i = 0; i < len; ++i)
- *str++ = *s++;
- while (len < field_width--)
- *str++ = ' ';
- break;
-
- case 'o':
- str = number(str, va_arg(args, unsigned long), 8,
- field_width, precision, flags);
- break;
-
- case 'p':
- if (field_width == -1) {
- field_width = 8;
- flags |= ZEROPAD;
- }
- str = number(str,
- (unsigned long) va_arg(args, void *), 16,
- field_width, precision, flags);
- break;
-
- case 'x':
- flags |= SMALL;
- case 'X':
- str = number(str, va_arg(args, unsigned long), 16,
- field_width, precision, flags);
- break;
-
- case 'd':
- case 'i':
- flags |= SIGN;
- case 'u':
- str = number(str, va_arg(args, unsigned long), 10,
- field_width, precision, flags);
- break;
-
- case 'n':
- ip = va_arg(args, int *);
- *ip = (str - buf);
- break;
-
- default:
- if (*fmt != '%')
- *str++ = '%';
- if (*fmt)
- *str++ = *fmt;
- else
- --fmt;
- break;
- }
- }
- *str = '\0';
- return str-buf;
-}
-
-
-int sprintf(char * buf, const char *fmt, ...)
-{
- va_list args;
- int i;
-
- va_start(args, fmt);
- i=vsprintf(buf,fmt,args);
- va_end(args);
- return i;
-}
-
diff --git a/sys/arch/arm32/conf/BETA b/sys/arch/arm32/conf/BETA
deleted file mode 100644
index c2559a8d488..00000000000
--- a/sys/arch/arm32/conf/BETA
+++ /dev/null
@@ -1,185 +0,0 @@
-#
-# BETA -- Kernel configuration used for beta kernels
-#
-
-include "std.arm32"
-
-# estimated number of users
-
-maxusers 8
-
-# Standard system options
-
-options TIMEZONE=0 # time zone to adjust RTC time by
-options DST=0 # daylight savings time used by RTC
-options SWAPPAGER # paging; REQUIRED
-options DEVPAGER # mmap() of devices
-
-# CPU options
-
-options CPU_ARM6
-options CPU_LATE_ABORT # ARM7XX compatibility
-
-# FPA options
-
-options FPE # Single precision FPE
-options ARMFPE # ARM Ltd FPE
-
-# File system options
-
-options FFS # UFS
-#options QUOTA # UFS quotas
-#options LFS # log-structured file system
-#options MFS # memory file system
-
-options CD9660 # ISO 9660 + Rock Ridge file system
-options MSDOSFS # MS-DOS file system
-options FDESC # /dev/fd
-options FIFO # FIFOs; RECOMMENDED
-options KERNFS # /kern
-#options NULLFS # loopback file system
-#options PORTAL # ?
-options PROCFS # /proc
-#options UMAPFS # NULLFS + uid and gid remapping
-options UNION # union file system
-
-# Networking options
-
-options NFSCLIENT
-options NFSSERVER
-#options GATEWAY # packet forwarding
-options INET # IP + ICMP + TCP + UDP
-#options NS # XNS
-#options ISO,TPIP # OSI
-#options EON # OSI tunneling over IP
-#options CCITT,LLC,HDLC # X.25
-
-# Compatibility options
-
-options COMPAT_43
-options COMPAT_10
-options COMPAT_09
-#options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD
-
-# Shared memory options
-
-#options SYSVMSG # System V-like message queues
-#options SYSVSEM # System V-like semaphores
-#options SYSVSHM # System V-like memory sharing
-#options SHMMAXPGS=1024 # 1024 pages is the default
-
-# Device options
-
-options RAMDISK_HOOKS # boottime setup of ramdisk
-options RAMDISK_SIZE=0 # Size in KBytes
-options PLIP # Build plip device into lpt driver
-
-# Development options
-
-options DIAGNOSTIC # internally consistency checks
-options KTRACE # system call tracing, a la ktrace(1)
-options IRQSTATS # IRQ statistics
-options POSTMORTEM # perform postmortem on panic
-#options ROTTEN_INNARDS # show the gory bit of the postmortem
-options KSHELL # kernel developemnt shell (debug)
-#options LKM # loadable kernel modules
-#options DEBUGTERM # create a debug console
-#options KGDB # remote kernel debugging
-#options DDB # in-kernel debugger
-#makeoptions DEBUG="-g" # compile full symbol table
-
-config netbsd swap generic
-options GENERIC
-
-# The main bus device
-mainbus0 at root
-
-# The boot cpu
-cpu0 at mainbus?
-
-# The vidc
-vidcvideo0 at mainbus?
-
-# generic VT console device
-vt0 at mainbus?
-vt1 at mainbus?
-vt2 at mainbus?
-vt3 at mainbus?
-vt4 at mainbus?
-vt5 at mainbus?
-
-# IDE disk controller
-wdc0 at mainbus? base 0x002107c0 irq 9
-wd0 at wdc? drive ?
-wd1 at wdc? drive ?
-
-# Floppy disk controller
-fdc0 at mainbus? base 0x00210fc0 irq 12 dack 0x00002000
-fd0 at fdc? drive ?
-
-# kbd via IOMD
-kbd0 at mainbus? base 0x00000000
-
-# quadrature mouse
-quadmouse0 at mainbus? base 0x00000000
-
-# Serial ports
-com0 at mainbus? base 0x00210fe0 irq 10
-#com1 at mainbus? base 0x00210be0
-
-# Parallel ports
-lpt0 at mainbus? base 0x002109e0 irq 0
-
-# Crude sound device
-beep0 at mainbus? base 0x00000000
-
-# IIC bus device
-iic0 at mainbus?
-
-# RTC device
-rtc0 at iic? addr 0xa0
-
-# Podule bus device
-podulebus0 at root
-
-asc0 at podulebus? # Acorn SCSI card
-scsibus* at asc?
-
-csc0 at podulebus? # Cumana SCSI II card
-scsibus* at csc?
-
-ptsc0 at podulebus? # Power-Tec SCSI II card
-scsibus* at ptsc?
-
-oak0 at podulebus? # Oak SCSI I card
-scsibus* at oak?
-
-sd* at scsibus? target ? lun ? # SCSI disk drives
-st* at scsibus? target ? lun ? # SCSI tape drives
-cd* at scsibus? target ? lun ? # SCSI CD-ROM drives
-ch* at scsibus? target ? lun ? # SCSI auto-changers
-uk* at scsibus? target ? lun ? # SCSI unknown device
-
-#kie* at podulebus? slot ? offset ?
-
-ea0 at podulebus? # Ether3 podules
-eb0 at podulebus? # EtherB network slot cards
-eh0 at podulebus? # EtherH network slot cards
-ie0 at podulebus? # Ether1 podules
-
-pseudo-device loop 1 # network loopback
-pseudo-device bpfilter 8 # packet filter
-pseudo-device sl 2 # CSLIP
-pseudo-device ppp 2 # PPP
-pseudo-device tun 2 # network tunneling over tty
-
-pseudo-device pty 32 # pseudo-terminals
-pseudo-device tb 1 # tablet line discipline
-pseudo-device vnd 4 # paging to files
-pseudo-device ccd 2 # concatenated disk devices
-
-pseudo-device rd 1 # Ramdisk driver
-
-makeoptions MONITOR="Taxan875+LR"
-#makeoptions MONITOR="AKF60"
-makeoptions MODES="1024,768,60 1024,768,70 800,600,60 640,480,60 1280,1024 1152,900"
diff --git a/sys/arch/arm32/conf/CLAIRE b/sys/arch/arm32/conf/CLAIRE
deleted file mode 100644
index 175914fc3dd..00000000000
--- a/sys/arch/arm32/conf/CLAIRE
+++ /dev/null
@@ -1,184 +0,0 @@
-#
-# CLAIRE -- Nut's development machine
-#
-
-include "std.arm32"
-
-# estimated number of users
-
-maxusers 8
-
-# Standard system options
-
-options TIMEZONE=0 # time zone to adjust RTC time by
-options DST=0 # daylight savings time used by RTC
-options SWAPPAGER # paging; REQUIRED
-options DEVPAGER # mmap() of devices
-
-# CPU options
-
-options CPU_ARM6
-options CPU_LATE_ABORT # ARM7XX compatibility
-
-# FPA options
-
-options FPE # Single precision FPE
-options ARMFPE # ARM Ltd FPE
-
-# File system options
-
-options FFS # UFS
-#options QUOTA # UFS quotas
-#options LFS # log-structured file system
-#options MFS # memory file system
-
-options CD9660 # ISO 9660 + Rock Ridge file system
-options MSDOSFS # MS-DOS file system
-#options FDESC # /dev/fd
-options FIFO # FIFOs; RECOMMENDED
-options KERNFS # /kern
-#options NULLFS # loopback file system
-#options PORTAL # ?
-options PROCFS # /proc
-#options UMAPFS # NULLFS + uid and gid remapping
-#options UNION # union file system
-
-# Networking options
-
-options NFSCLIENT
-options NFSSERVER
-options GATEWAY # packet forwarding
-options INET # IP + ICMP + TCP + UDP
-#options NS # XNS
-#options ISO,TPIP # OSI
-#options EON # OSI tunneling over IP
-#options CCITT,LLC,HDLC # X.25
-
-# Compatibility options
-
-options COMPAT_43
-options COMPAT_10
-options COMPAT_09
-#options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD
-
-# Shared memory options
-
-#options SYSVMSG # System V-like message queues
-#options SYSVSEM # System V-like semaphores
-#options SYSVSHM # System V-like memory sharing
-#options SHMMAXPGS=1024 # 1024 pages is the default
-
-# Device options
-
-options RAMDISK_HOOKS # boottime setup of ramdisk
-options RAMDISK_SIZE=0 # Size in KBytes
-options PLIP # Build plip device into lpt driver
-
-# Development options
-
-options DIAGNOSTIC # internally consistency checks
-options KTRACE # system call tracing, a la ktrace(1)
-options IRQSTATS # IRQ statistics
-options POSTMORTEM # perform postmortem on panic
-#options ROTTEN_INNARDS # show the gory bit of the postmortem
-options KSHELL # kernel developemnt shell (debug)
-options LKM # loadable kernel modules
-#options DEBUGTERM # create a debug console
-#options KGDB # remote kernel debugging
-#options DDB # in-kernel debugger
-#makeoptions DEBUG="-g" # compile full symbol table
-
-config netbsd swap generic
-options GENERIC
-
-# The main bus device
-mainbus0 at root
-
-# The boot cpu
-cpu0 at mainbus?
-
-# The vidc
-vidcvideo0 at mainbus?
-
-# generic VT console device
-vt0 at mainbus?
-vt1 at mainbus?
-vt2 at mainbus?
-vt3 at mainbus?
-vt4 at mainbus?
-vt5 at mainbus?
-
-# IDE disk controller
-wdc0 at mainbus? base 0x002107c0 irq 9
-wd0 at wdc? drive ?
-wd1 at wdc? drive ?
-
-# Floppy disk controller
-fdc0 at mainbus? base 0x00210fc0 irq 12 dack 0x00002000
-fd0 at fdc? drive ?
-
-# kbd via IOMD
-kbd0 at mainbus? base 0x00000000
-
-# quadrature mouse
-quadmouse0 at mainbus? base 0x00000000
-
-# Serial ports
-com0 at mainbus? base 0x00210fe0 irq 10
-#com1 at mainbus? base 0x00210be0
-
-# Parallel ports
-lpt0 at mainbus? base 0x002109e0 irq 0
-
-# Crude sound device
-beep0 at mainbus? base 0x00000000
-
-# IIC bus device
-iic0 at mainbus?
-
-# RTC device
-rtc0 at iic? addr 0xa0
-
-# Podule bus device
-podulebus0 at root
-
-#asc0 at podulebus? # Acorn SCSI card
-#scsibus* at asc?
-
-#csc0 at podulebus? # Cumana SCSI II card
-#scsibus* at csc?
-
-#ptsc0 at podulebus? # Power-Tec SCSI II card
-#scsibus* at ptsc?
-
-oak0 at podulebus? # Oak SCSI I card
-scsibus* at oak?
-
-sd* at scsibus? target ? lun ? # SCSI disk drives
-st* at scsibus? target ? lun ? # SCSI tape drives
-cd* at scsibus? target ? lun ? # SCSI CD-ROM drives
-ch* at scsibus? target ? lun ? # SCSI auto-changers
-uk* at scsibus? target ? lun ? # SCSI unknown device
-
-#kie* at podulebus? slot ? offset ?
-
-#ea0 at podulebus? # Ether3 podules
-#eb0 at podulebus? # EtherB network slot cards
-eh0 at podulebus? # EtherH network slot cards
-ie0 at podulebus? # Ether1 podules
-
-pseudo-device loop 1 # network loopback
-pseudo-device bpfilter 8 # packet filter
-pseudo-device sl 2 # CSLIP
-pseudo-device ppp 2 # PPP
-pseudo-device tun 2 # network tunneling over tty
-
-pseudo-device pty 32 # pseudo-terminals
-pseudo-device tb 1 # tablet line discipline
-pseudo-device vnd 4 # paging to files
-pseudo-device ccd 2 # concatenated disk devices
-
-pseudo-device rd 1 # Ramdisk driver
-
-makeoptions MONITOR="AKF60"
-makeoptions MODES="1024,768,60 1024,768,70 800,600,60 640,480,60 1280,1024 1152,900"
diff --git a/sys/arch/arm32/conf/GENERIC b/sys/arch/arm32/conf/GENERIC
deleted file mode 100644
index 3103d84dae6..00000000000
--- a/sys/arch/arm32/conf/GENERIC
+++ /dev/null
@@ -1,201 +0,0 @@
-#
-# GENERIC -- everything that's currently supported
-#
-
-include "std.arm32"
-
-# estimated number of users
-
-maxusers 32
-
-# Standard system options
-
-options TIMEZONE=0 # time zone to adjust RTC time by
-options DST=0 # daylight savings time used by RTC
-options SWAPPAGER # paging; REQUIRED
-options DEVPAGER # mmap() of devices
-
-# CPU options
-
-options CPU_ARM6
-options CPU_LATE_ABORT # ARM7XX compatibility
-
-# FPA options
-
-options FPE # Single precision FPE
-options ARMFPE # ARM Ltd FPE
-
-# File system options
-
-options FFS # UFS
-options QUOTA # UFS quotas
-options LFS # log-structured file system
-options MFS # memory file system
-
-options CD9660 # ISO 9660 + Rock Ridge file system
-options MSDOSFS # MS-DOS file system
-options FDESC # /dev/fd
-options FIFO # FIFOs; RECOMMENDED
-options KERNFS # /kern
-options NULLFS # loopback file system
-options PORTAL # create sockets with open(2)
-options PROCFS # /proc
-options UMAPFS # NULLFS + uid and gid remapping
-options UNION # union file system
-
-# Networking options
-
-options NFSCLIENT
-options NFSSERVER
-options GATEWAY # packet forwarding
-options INET # IP + ICMP + TCP + UDP
-options NS # XNS
-options ISO,TPIP # OSI
-options EON # OSI tunneling over IP
-options CCITT,LLC,HDLC # X.25
-
-# Compatibility options
-
-options COMPAT_43
-options COMPAT_10
-options COMPAT_09
-#options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD
-
-# Shared memory options
-
-#options SYSVMSG # System V-like message queues
-#options SYSVSEM # System V-like semaphores
-#options SYSVSHM # System V-like memory sharing
-#options SHMMAXPGS=1024 # 1024 pages is the default
-
-# Device options
-
-options RAMDISK_HOOKS # boottime setup of ramdisk
-options RAMDISK_SIZE=0 # Size in KBytes
-options PLIP # Build plip device into lpt driver
-
-# Development options
-
-options DIAGNOSTIC # internally consistency checks
-options KTRACE # system call tracing, a la ktrace(1)
-options IRQSTATS # IRQ statistics
-options POSTMORTEM # perform postmortem on panic
-#options ROTTEN_INNARDS # show the gory bit of the postmortem
-options KSHELL # kernel developemnt shell (debug)
-options LKM # loadable kernel modules
-#options DEBUGTERM # create a debug console
-#options KGDB # remote kernel debugging
-options DDB # in-kernel debugger
-#makeoptions DEBUG="-g" # compile full symbol table
-
-config netbsd swap generic
-options GENERIC
-
-# The main bus device
-mainbus0 at root
-
-# The boot cpu
-cpu0 at mainbus?
-
-# The hydra multiprocessor device
-#hydrabus0 at mainbus?
-
-#cpu1 at hydrabus?
-#cpu2 at hydrabus?
-#cpu3 at hydrabus?
-#cpu4 at hydrabus?
-
-# The vidc
-vidcvideo0 at mainbus?
-
-# generic VT console device
-vt0 at mainbus?
-vt1 at mainbus?
-vt2 at mainbus?
-vt3 at mainbus?
-vt4 at mainbus?
-vt5 at mainbus?
-
-# IDE disk controller
-wdc0 at mainbus? base 0x002107c0 irq 9
-wd0 at wdc? drive ?
-wd1 at wdc? drive ?
-
-# Floppy disk controller
-fdc0 at mainbus? base 0x00210fc0 irq 12 dack 0x00002000
-fd0 at fdc? drive ?
-
-# kbd via IOMD
-kbd0 at mainbus? base 0x00000000
-
-# quadrature mouse
-quadmouse0 at mainbus? base 0x00000000
-
-# PS2 mouse
-pms0 at mainbus? base 0x00000000
-
-# Serial ports
-com0 at mainbus? base 0x00210fe0 irq 10
-#com1 at mainbus? base 0x00210be0
-
-# Parallel ports
-lpt0 at mainbus? base 0x002109e0 irq 0
-
-# Crude sound device
-beep0 at mainbus? base 0x00000000
-
-# IIC bus device
-iic0 at mainbus?
-
-# RTC device
-rtc0 at iic? addr 0xa0
-
-# Podule bus device
-podulebus0 at root
-
-asc0 at podulebus? # Acorn SCSI card
-scsibus* at asc?
-
-#csc0 at podulebus? # Cumana SCSI II card
-#scsibus* at csc?
-
-ptsc0 at podulebus? # Power-Tec SCSI II card
-scsibus* at ptsc?
-
-oak0 at podulebus? # Oak SCSI I card
-scsibus* at oak?
-
-sd* at scsibus? target ? lun ? # SCSI disk drives
-st* at scsibus? target ? lun ? # SCSI tape drives
-cd* at scsibus? target ? lun ? # SCSI CD-ROM drives
-ch* at scsibus? target ? lun ? # SCSI auto-changers
-ss* at scsibus? target ? lun ? # SCSI scanner
-uk* at scsibus? target ? lun ? # SCSI unknown device
-
-#kie* at podulebus? slot ? offset ?
-
-ea0 at podulebus? # Ether3 podules
-eb0 at podulebus? # EtherB network slot cards
-eh0 at podulebus? # EtherH network slot cards
-ie0 at podulebus? # Ether1 podules
-
-pseudo-device loop 1 # network loopback
-pseudo-device bpfilter 8 # packet filter
-pseudo-device sl 2 # CSLIP
-pseudo-device ppp 2 # PPP
-pseudo-device tun 2 # network tunneling over tty
-
-pseudo-device pty 32 # pseudo-terminals
-pseudo-device tb 1 # tablet line discipline
-pseudo-device vnd 4 # paging to files
-pseudo-device ccd 2 # concatenated disk devices
-
-pseudo-device rd 1 # Ramdisk driver
-
-# for IPv6
-pseudo-device gif 4
-#pseudo-device faith 1
-
-makeoptions MONITOR="Taxan875+LR"
-#makeoptions MONITOR="AKF60"
-makeoptions MODES="1024,768,60 1024,768,70 800,600,60 640,480,60 1280,1024 1152,900"
diff --git a/sys/arch/arm32/conf/Makefile.arm32 b/sys/arch/arm32/conf/Makefile.arm32
deleted file mode 100644
index 00ab84a7cab..00000000000
--- a/sys/arch/arm32/conf/Makefile.arm32
+++ /dev/null
@@ -1,185 +0,0 @@
-# $NetBSD: Makefile.arm32,v 1.10 1996/02/29 20:55:24 cgd Exp $
-
-# Makefile for NetBSD
-#
-# This makefile is constructed from a machine description:
-# config machineid
-# Most changes should be made in the machine description
-# /sys/arch/arm32/conf/``machineid''
-# after which you should do
-# config machineid
-# Machine generic makefile changes should be made in
-# /sys/arch/arm32/conf/Makefile.arm32
-# after which config should be rerun for all machines of that type.
-#
-# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
-# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
-#
-# -DTRACE compile in kernel tracing hooks
-# -DQUOTA compile in file system quotas
-
-# DEBUG is set to -g if debugging.
-# PROF is set to -pg if profiling.
-
-AS?= as
-CC?= cc
-CPP?= cpp
-LD?= ld
-STRIP?= strip -d
-TOUCH?= touch -f -c
-
-# source tree is located via $S relative to the compilation directory
-S= ../../../..
-ARM32= ../..
-
-INCLUDES= -I. -I$S/arch -I$S
-CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL -Darm32
-CFLAGS= ${DEBUG} -O2 -Werror -fno-builtin
-AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE
-LINKFLAGS= -Ttext F0000020 -e start
-
-### find out what to use for libkern
-.include "$S/lib/libkern/Makefile.inc"
-.ifndef PROF
-LIBKERN= ${KERNLIB}
-.else
-LIBKERN= ${KERNLIB_PROF}
-.endif
-
-### find out what to use for libcompat
-.include "$S/compat/common/Makefile.inc"
-.ifndef PROF
-LIBCOMPAT= ${COMPATLIB}
-.else
-LIBCOMPAT= ${COMPATLIB_PROF}
-.endif
-
-# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
-# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
-# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
-# is marked as config-dependent.
-
-NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
-NORMAL_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
-
-DRIVER_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
-DRIVER_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
-
-NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
-NORMAL_S_C= ${CC} ${AFLAGS} ${CPPFLAGS} ${PARAM} -c $<
-
-%OBJS
-
-%CFILES
-
-%SFILES
-
-# load lines for config "xxx" will be emitted as:
-# xxx: ${SYSTEM_DEP} swapxxx.o
-# ${SYSTEM_LD_HEAD}
-# ${SYSTEM_LD} swapxxx.o
-# ${SYSTEM_LD_TAIL}
-SYSTEM_OBJ= locore.o modedefs.o \
- param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
-SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
-SYSTEM_LD_HEAD= rm -f $@
-SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
- ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
-SYSTEM_LD_TAIL= @size $@; chmod 755 $@
-
-DEBUG?=
-.if ${DEBUG} == "-g"
-LINKFLAGS+= -X
-SYSTEM_LD_TAIL+=; \
- echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
- echo ${STRIP} $@; ${STRIP} $@
-.else
-LINKFLAGS+= -x
-.endif
-
-%LOAD
-
-assym.h: genassym
- ./genassym >assym.h
-
-genassym: genassym.o
- ${CC} -o $@ genassym.o
-
-genassym.o: ${ARM32}/arm32/genassym.c
- ${NORMAL_C_C}
-
-param.c: $S/conf/param.c
- rm -f param.c
- cp $S/conf/param.c .
-
-param.o: param.c Makefile
- ${NORMAL_C_C}
-
-ioconf.o: ioconf.c
- ${NORMAL_C}
-
-newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
- sh $S/conf/newvers.sh
- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
-
-
-clean::
- rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
- [Ee]rrs linterrs makelinks genassym genassym.o assym.h
-
-lint:
- @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \
- ${CFILES} ${ARM32}/arm32/swapgeneric.c ioconf.c param.c | \
- grep -v 'static function .* unused'
-
-tags:
- @echo "see $S/kern/Makefile for tags"
-
-links:
- egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
- sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
- echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
- sort -u | comm -23 - dontlink | \
- sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
- sh makelinks && rm -f dontlink
-
-SRCS= ${ARM32}/arm32/locore.S modedefs.c \
- param.c ioconf.c ${CFILES} ${SFILES}
-depend: .depend
-.depend: ${SRCS} assym.h param.c
- mkdep ${AFLAGS} ${CPPFLAGS} ${ARM32}/arm32/locore.S
- mkdep -a ${CFLAGS} ${CPPFLAGS} modedefs.c
- mkdep -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
- mkdep -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
- mkdep -a ${CFLAGS} ${CPPFLAGS} ${PARAM} ${ARM32}/arm32/genassym.c
-
-
-# depend on root or device configuration
-autoconf.o conf.o: Makefile
-
-# depend on network or filesystem configuration
-uipc_proto.o vfs_conf.o: Makefile
-
-# depend on maxusers
-genassym.o machdep.o: Makefile
-
-# depend on CPU configuration
-cpuswitch.o fault.o machdep.o: Makefile
-
-
-locore.o: ${ARM32}/arm32/locore.S assym.h
- ${NORMAL_S}
-
-modedefs.c: makemodes ${ARM32}/conf/monitors/${MONITOR} Makefile
- ./makemodes ${ARM32}/conf/monitors/${MONITOR} modedefs.c ${MODES}
-
-modedefs.o: modedefs.c
- ${NORMAL_C}
-
-makemodes: makemodes.o
- ${CC} -o $@ makemodes.o
-
-makemodes.o: ${ARM32}/arm32/makemodes.c
- ${NORMAL_C_C}
-
-%RULES
diff --git a/sys/arch/arm32/conf/PHARM b/sys/arch/arm32/conf/PHARM
deleted file mode 100644
index d8146f16494..00000000000
--- a/sys/arch/arm32/conf/PHARM
+++ /dev/null
@@ -1,193 +0,0 @@
-#
-# PHARM -- Mark's development machine in the office
-#
-
-include "std.arm32"
-
-# estimated number of users
-
-maxusers 32
-
-# Standard system options
-
-options TIMEZONE=0 # time zone to adjust RTC time by
-options DST=0 # daylight savings time used by RTC
-options SWAPPAGER # paging; REQUIRED
-options DEVPAGER # mmap() of devices
-
-# CPU options
-
-options CPU_ARM6
-options CPU_LATE_ABORT # ARM7XX compatibility
-
-# FPA options
-
-#options FPE # Single precision FPE
-options ARMFPE # ARM Ltd FPE
-
-# File system options
-
-options FFS # UFS
-#options QUOTA # UFS quotas
-#options LFS # log-structured file system
-#options MFS # memory file system
-
-options CD9660 # ISO 9660 + Rock Ridge file system
-options MSDOSFS # MS-DOS file system
-options FDESC # /dev/fd
-options FIFO # FIFOs; RECOMMENDED
-options KERNFS # /kern
-#options NULLFS # loopback file system
-#options PORTAL # ?
-options PROCFS # /proc
-#options UMAPFS # NULLFS + uid and gid remapping
-options UNION # union file system
-
-# Networking options
-
-options NFSCLIENT
-options NFSSERVER
-options GATEWAY # packet forwarding
-options INET # IP + ICMP + TCP + UDP
-#options NS # XNS
-#options ISO,TPIP # OSI
-#options EON # OSI tunneling over IP
-#options CCITT,LLC,HDLC # X.25
-
-# Compatibility options
-
-options COMPAT_43
-options COMPAT_10
-options COMPAT_09
-#options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD
-
-# Shared memory options
-
-#options SYSVMSG # System V-like message queues
-#options SYSVSEM # System V-like semaphores
-#options SYSVSHM # System V-like memory sharing
-#options SHMMAXPGS=1024 # 1024 pages is the default
-
-# Device options
-
-options RAMDISK_HOOKS # boottime setup of ramdisk
-options RAMDISK_SIZE=0 # Size in KBytes
-options PLIP # Build plip device into lpt driver
-
-# Development options
-
-options DIAGNOSTIC # internally consistency checks
-options KTRACE # system call tracing, a la ktrace(1)
-options IRQSTATS # IRQ statistics
-options POSTMORTEM # perform postmortem on panic
-#options ROTTEN_INNARDS # show the gory bit of the postmortem
-options KSHELL # kernel developemnt shell (debug)
-options LKM # loadable kernel modules
-#options DEBUGTERM # create a debug console
-#options KGDB # remote kernel debugging
-options DDB # in-kernel debugger
-#makeoptions DEBUG="-g" # compile full symbol table
-
-config netbsd swap generic
-options GENERIC
-
-# The main bus device
-mainbus0 at root
-
-# The boot cpu
-cpu0 at mainbus?
-
-# The hydra multiprocessor device
-#hydrabus0 at mainbus?
-
-#cpu1 at hydrabus?
-#cpu2 at hydrabus?
-#cpu3 at hydrabus?
-#cpu4 at hydrabus?
-
-# The vidc
-vidcvideo0 at mainbus?
-
-# generic VT console device
-vt0 at mainbus?
-vt1 at mainbus?
-vt2 at mainbus?
-vt3 at mainbus?
-vt4 at mainbus?
-vt5 at mainbus?
-
-# IDE disk controller
-wdc0 at mainbus? base 0x002107c0 irq 9
-wd0 at wdc? drive ?
-wd1 at wdc? drive ?
-
-# Floppy disk controller
-fdc0 at mainbus? base 0x00210fc0 irq 12 dack 0x00002000
-fd0 at fdc? drive ?
-
-# kbd via IOMD
-kbd0 at mainbus? base 0x00000000
-
-# quadrature mouse
-quadmouse0 at mainbus? base 0x00000000
-
-# Serial ports
-com0 at mainbus? base 0x00210fe0 irq 10
-#com1 at mainbus? base 0x00210be0
-
-# Parallel ports
-lpt0 at mainbus? base 0x002109e0 irq 0
-
-# Crude sound device
-beep0 at mainbus? base 0x00000000
-
-# IIC bus device
-iic0 at mainbus?
-
-# RTC device
-rtc0 at iic? addr 0xa0
-
-# Podule bus device
-podulebus0 at root
-
-#asc0 at podulebus? # Acorn SCSI card
-#scsibus* at asc?
-
-#csc0 at podulebus? # Cumana SCSI II card
-#scsibus* at csc?
-
-ptsc0 at podulebus? # Power-Tec SCSI II card
-scsibus* at ptsc?
-
-#oak0 at podulebus? # Oak SCSI I card
-#scsibus* at oak?
-
-sd* at scsibus? target ? lun ? # SCSI disk drives
-st* at scsibus? target ? lun ? # SCSI tape drives
-cd* at scsibus? target ? lun ? # SCSI CD-ROM drives
-ch* at scsibus? target ? lun ? # SCSI auto-changers
-uk* at scsibus? target ? lun ? # SCSI unknown device
-
-#kie* at podulebus? slot ? offset ?
-
-#ea0 at podulebus? # Ether3 podules
-eb0 at podulebus? # EtherB network slot cards
-#eh0 at podulebus? # EtherH network slot cards
-#ie0 at podulebus? # Ether1 podules
-
-pseudo-device loop 1 # network loopback
-pseudo-device bpfilter 8 # packet filter
-pseudo-device sl 2 # CSLIP
-pseudo-device ppp 2 # PPP
-pseudo-device tun 2 # network tunneling over tty
-
-pseudo-device pty 32 # pseudo-terminals
-pseudo-device tb 1 # tablet line discipline
-pseudo-device vnd 4 # paging to files
-pseudo-device ccd 2 # concatenated disk devices
-
-pseudo-device rd 1 # Ramdisk driver
-
-makeoptions MONITOR="Taxan875+LR"
-#makeoptions MONITOR="AKF60"
-makeoptions MODES="1024,768,60 1024,768,70 800,600,60 640,480,60 1280,1024 1152,900"
diff --git a/sys/arch/arm32/conf/REMY b/sys/arch/arm32/conf/REMY
deleted file mode 100644
index 7cc66cf4395..00000000000
--- a/sys/arch/arm32/conf/REMY
+++ /dev/null
@@ -1,328 +0,0 @@
-#
-# REMY -- Scott's development machine
-#
-
-include "std.arm32"
-
-# estimated number of users
-
-maxusers 8
-
-# Standard system options
-
-options TIMEZONE=0 # time zone to adjust RTC time by
-options DST=0 # daylight savings time used by RTC
-options SWAPPAGER # paging; REQUIRED
-options DEVPAGER # mmap() of devices
-
-# CPU options
-
-options CPU_ARM6
-options CPU_LATE_ABORT # ARM7XX compatibility
-
-# FPA options
-
-options FPE # Single precision FPE
-options ARMFPE # ARM Ltd FPE
-
-# File system options
-
-options FFS # UFS
-#options QUOTA # UFS quotas
-#options LFS # log-structured file system
-#options MFS # memory file system
-
-options CD9660 # ISO 9660 + Rock Ridge file system
-options MSDOSFS # MS-DOS file system
-options FDESC # /dev/fd
-options FIFO # FIFOs; RECOMMENDED
-options KERNFS # /kern
-#options NULLFS # loopback file system
-#options PORTAL # ?
-options PROCFS # /proc
-#options UMAPFS # NULLFS + uid and gid remapping
-options UNION # union file system
-
-# Networking options
-
-options NFSCLIENT
-options NFSSERVER
-#options GATEWAY # packet forwarding
-options INET # IP + ICMP + TCP + UDP
-#options NS # XNS
-#options ISO,TPIP # OSI
-#options EON # OSI tunneling over IP
-#options CCITT,LLC,HDLC # X.25
-
-# Compatibility options
-
-options COMPAT_43
-options COMPAT_10
-options COMPAT_09
-#options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD
-
-# Shared memory options
-
-#options SYSVMSG # System V-like message queues
-#options SYSVSEM # System V-like semaphores
-#options SYSVSHM # System V-like memory sharing
-#options SHMMAXPGS=1024 # 1024 pages is the default
-
-# Device options
-
-options RAMDISK_HOOKS # boottime setup of ramdisk
-options RAMDISK_SIZE=0 # Size in KBytes
-options PLIP # Build plip device into lpt driver
-
-# Development options
-
-options DIAGNOSTIC # internally consistency checks
-options KTRACE # system call tracing, a la ktrace(1)
-options IRQSTATS # IRQ statistics
-options POSTMORTEM # perform postmortem on panic
-#options ROTTEN_INNARDS # show the gory bit of the postmortem
-options KSHELL # kernel developemnt shell (debug)
-options LKM # loadable kernel modules
-#options DEBUGTERM # create a debug console
-#options KGDB # remote kernel debugging
-#options DDB # in-kernel debugger
-#makeoptions DEBUG="-g" # compile full symbol table
-
-config netbsd swap generic
-options GENERIC
-
-# The main bus device
-mainbus0 at root
-
-# The boot cpu
-cpu0 at mainbus?
-
-# The vidc
-vidcvideo0 at mainbus?
-
-# generic VT console device
-vt0 at mainbus?
-vt1 at mainbus?
-vt2 at mainbus?
-vt3 at mainbus?
-vt4 at mainbus?
-vt5 at mainbus?
-
-# IDE disk controller
-wdc0 at mainbus? base 0x002107c0 irq 9
-wd0 at wdc? drive ?
-wd1 at wdc? drive ?
-
-# Floppy disk controller
-fdc0 at mainbus? base 0x00210fc0 irq 12 dack 0x00002000
-fd0 at fdc? drive ?
-
-# kbd via IOMD
-kbd0 at mainbus? base 0x00000000
-
-# quadrature mouse
-quadmouse0 at mainbus? base 0x00000000
-
-# Serial ports
-com0 at mainbus? base 0x00210fe0 irq 10
-#com1 at mainbus? base 0x00210be0
-
-# Parallel ports
-lpt0 at mainbus? base 0x002109e0 irq 0
-
-# Crude sound device
-beep0 at mainbus? base 0x00000000
-
-# IIC bus device
-iic0 at mainbus?
-
-# RTC device
-rtc0 at iic? addr 0xa0
-
-# Podule bus device
-podulebus0 at root
-
-sd* at scsibus? target ? lun ? # SCSI disk drives
-st* at scsibus? target ? lun ? # SCSI tape drives
-cd* at scsibus? target ? lun ? # SCSI CD-ROM drives
-ch* at scsibus? target ? lun ? # SCSI auto-changers
-uk* at scsibus? target ? lun ? # SCSI unknown device
-
-asc0 at podulebus0 slot 0 # Acorn SCSI card
-asc1 at podulebus0 slot 1 # Acorn SCSI card
-asc2 at podulebus0 slot 2 # Acorn SCSI card
-asc3 at podulebus0 slot 3 # Acorn SCSI card
-csc0 at podulebus0 slot 0 # Cumana SCSI card
-csc1 at podulebus0 slot 1 # Cumana SCSI card
-csc2 at podulebus0 slot 2 # Cumana SCSI card
-csc3 at podulebus0 slot 3 # Cumana SCSI card
-ptsc0 at podulebus0 slot 0 # Power-tec SCSI card
-ptsc1 at podulebus0 slot 1 # Power-tec SCSI card
-ptsc2 at podulebus0 slot 2 # Power-tec SCSI card
-ptsc3 at podulebus0 slot 3 # Power-tec SCSI card
-#oak0 at podulebus0 slot 0 # Oak SCSI card
-#oak1 at podulebus0 slot 1 # Oak SCSI card
-#oak2 at podulebus0 slot 2 # Oak SCSI card
-#oak3 at podulebus0 slot 3 # Oak SCSI card
-
-scsibus0 at asc0
-scsibus1 at asc1
-scsibus2 at asc2
-scsibus3 at asc3
-scsibus0 at csc0
-scsibus1 at csc1
-scsibus2 at csc2
-scsibus3 at csc3
-scsibus0 at ptsc0
-scsibus1 at ptsc1
-scsibus2 at ptsc2
-scsibus3 at ptsc3
-#scsibus0 at oak0
-#scsibus1 at oak1
-#scsibus2 at oak2
-#scsibus3 at oak3
-
-# First SCSI bus
-sd0 at scsibus0 target 0 lun ? # SCSI disk drive
-sd1 at scsibus0 target 1 lun ? # SCSI disk drive
-sd2 at scsibus0 target 2 lun ? # SCSI disk drive
-sd3 at scsibus0 target 3 lun ? # SCSI disk drive
-sd4 at scsibus0 target 4 lun ? # SCSI disk drive
-sd5 at scsibus0 target 5 lun ? # SCSI disk drive
-sd6 at scsibus0 target 6 lun ? # SCSI disk drive
-st0 at scsibus0 target 0 lun ? # SCSI tape drive
-st1 at scsibus0 target 1 lun ? # SCSI tape drive
-st2 at scsibus0 target 2 lun ? # SCSI tape drive
-st3 at scsibus0 target 3 lun ? # SCSI tape drive
-st4 at scsibus0 target 4 lun ? # SCSI tape drive
-st5 at scsibus0 target 5 lun ? # SCSI tape drive
-st6 at scsibus0 target 6 lun ? # SCSI tape drive
-cd0 at scsibus0 target 0 lun ? # SCSI CD-ROM drive
-cd1 at scsibus0 target 1 lun ? # SCSI CD-ROM drive
-cd2 at scsibus0 target 2 lun ? # SCSI CD-ROM drive
-cd3 at scsibus0 target 3 lun ? # SCSI CD-ROM drive
-cd4 at scsibus0 target 4 lun ? # SCSI CD-ROM drive
-cd5 at scsibus0 target 5 lun ? # SCSI CD-ROM drive
-cd6 at scsibus0 target 6 lun ? # SCSI CD-ROM drive
-uk0 at scsibus0 target 0 lun ? # SCSI Unknown device
-uk1 at scsibus0 target 1 lun ? # SCSI Unknown device
-uk2 at scsibus0 target 2 lun ? # SCSI Unknown device
-uk3 at scsibus0 target 3 lun ? # SCSI Unknown device
-uk4 at scsibus0 target 4 lun ? # SCSI Unknown device
-uk5 at scsibus0 target 5 lun ? # SCSI Unknown device
-uk6 at scsibus0 target 6 lun ? # SCSI Unknown device
-
-# Second SCSI bus
-sd8 at scsibus1 target 0 lun ? # SCSI disk drive
-sd9 at scsibus1 target 1 lun ? # SCSI disk drive
-sd10 at scsibus1 target 2 lun ? # SCSI disk drive
-sd11 at scsibus1 target 3 lun ? # SCSI disk drive
-sd12 at scsibus1 target 4 lun ? # SCSI disk drive
-sd13 at scsibus1 target 5 lun ? # SCSI disk drive
-sd14 at scsibus1 target 6 lun ? # SCSI disk drive
-st8 at scsibus1 target 0 lun ? # SCSI tape drive
-st9 at scsibus1 target 1 lun ? # SCSI tape drive
-st10 at scsibus1 target 2 lun ? # SCSI tape drive
-st11 at scsibus1 target 3 lun ? # SCSI tape drive
-st12 at scsibus1 target 4 lun ? # SCSI tape drive
-st13 at scsibus1 target 5 lun ? # SCSI tape drive
-st14 at scsibus1 target 6 lun ? # SCSI tape drive
-cd8 at scsibus1 target 0 lun ? # SCSI CD-ROM drive
-cd9 at scsibus1 target 1 lun ? # SCSI CD-ROM drive
-cd10 at scsibus1 target 2 lun ? # SCSI CD-ROM drive
-cd11 at scsibus1 target 3 lun ? # SCSI CD-ROM drive
-cd12 at scsibus1 target 4 lun ? # SCSI CD-ROM drive
-cd13 at scsibus1 target 5 lun ? # SCSI CD-ROM drive
-cd14 at scsibus1 target 6 lun ? # SCSI CD-ROM drive
-uk8 at scsibus1 target 0 lun ? # SCSI Unknown device
-uk9 at scsibus1 target 1 lun ? # SCSI Unknown device
-uk10 at scsibus1 target 2 lun ? # SCSI Unknown device
-uk11 at scsibus1 target 3 lun ? # SCSI Unknown device
-uk12 at scsibus1 target 4 lun ? # SCSI Unknown device
-uk13 at scsibus1 target 5 lun ? # SCSI Unknown device
-uk14 at scsibus1 target 6 lun ? # SCSI Unknown device
-
-# Third SCSI bus
-sd16 at scsibus2 target 0 lun ? # SCSI disk drive
-sd17 at scsibus2 target 1 lun ? # SCSI disk drive
-sd18 at scsibus2 target 2 lun ? # SCSI disk drive
-sd19 at scsibus2 target 3 lun ? # SCSI disk drive
-sd20 at scsibus2 target 4 lun ? # SCSI disk drive
-sd21 at scsibus2 target 5 lun ? # SCSI disk drive
-sd22 at scsibus2 target 6 lun ? # SCSI disk drive
-st16 at scsibus2 target 0 lun ? # SCSI tape drive
-st17 at scsibus2 target 1 lun ? # SCSI tape drive
-st18 at scsibus2 target 2 lun ? # SCSI tape drive
-st19 at scsibus2 target 3 lun ? # SCSI tape drive
-st20 at scsibus2 target 4 lun ? # SCSI tape drive
-st21 at scsibus2 target 5 lun ? # SCSI tape drive
-st22 at scsibus2 target 6 lun ? # SCSI tape drive
-cd16 at scsibus2 target 0 lun ? # SCSI CD-ROM drive
-cd17 at scsibus2 target 1 lun ? # SCSI CD-ROM drive
-cd18 at scsibus2 target 2 lun ? # SCSI CD-ROM drive
-cd19 at scsibus2 target 3 lun ? # SCSI CD-ROM drive
-cd20 at scsibus2 target 4 lun ? # SCSI CD-ROM drive
-cd21 at scsibus2 target 5 lun ? # SCSI CD-ROM drive
-cd22 at scsibus2 target 6 lun ? # SCSI CD-ROM drive
-uk16 at scsibus2 target 0 lun ? # SCSI Unknown device
-uk17 at scsibus2 target 1 lun ? # SCSI Unknown device
-uk18 at scsibus2 target 2 lun ? # SCSI Unknown device
-uk19 at scsibus2 target 3 lun ? # SCSI Unknown device
-uk20 at scsibus2 target 4 lun ? # SCSI Unknown device
-uk21 at scsibus2 target 5 lun ? # SCSI Unknown device
-uk22 at scsibus2 target 6 lun ? # SCSI Unknown device
-
-# Fourth SCSI bus
-sd24 at scsibus3 target 0 lun ? # SCSI disk drive
-sd25 at scsibus3 target 1 lun ? # SCSI disk drive
-sd26 at scsibus3 target 2 lun ? # SCSI disk drive
-sd27 at scsibus3 target 3 lun ? # SCSI disk drive
-sd28 at scsibus3 target 4 lun ? # SCSI disk drive
-sd29 at scsibus3 target 5 lun ? # SCSI disk drive
-sd30 at scsibus3 target 6 lun ? # SCSI disk drive
-st24 at scsibus3 target 0 lun ? # SCSI tape drive
-st25 at scsibus3 target 1 lun ? # SCSI tape drive
-st26 at scsibus3 target 2 lun ? # SCSI tape drive
-st27 at scsibus3 target 3 lun ? # SCSI tape drive
-st28 at scsibus3 target 4 lun ? # SCSI tape drive
-st29 at scsibus3 target 5 lun ? # SCSI tape drive
-st30 at scsibus3 target 6 lun ? # SCSI tape drive
-cd24 at scsibus3 target 0 lun ? # SCSI CD-ROM drive
-cd25 at scsibus3 target 1 lun ? # SCSI CD-ROM drive
-cd26 at scsibus3 target 2 lun ? # SCSI CD-ROM drive
-cd27 at scsibus3 target 3 lun ? # SCSI CD-ROM drive
-cd28 at scsibus3 target 4 lun ? # SCSI CD-ROM drive
-cd29 at scsibus3 target 5 lun ? # SCSI CD-ROM drive
-cd30 at scsibus3 target 6 lun ? # SCSI CD-ROM drive
-uk24 at scsibus3 target 0 lun ? # SCSI Unknown device
-uk25 at scsibus3 target 1 lun ? # SCSI Unknown device
-uk26 at scsibus3 target 2 lun ? # SCSI Unknown device
-uk27 at scsibus3 target 3 lun ? # SCSI Unknown device
-uk28 at scsibus3 target 4 lun ? # SCSI Unknown device
-uk29 at scsibus3 target 5 lun ? # SCSI Unknown device
-uk30 at scsibus3 target 6 lun ? # SCSI Unknown device
-
-ch* at scsibus? target ? lun ? # SCSI auto-changers
-
-#kie* at podulebus? slot ? offset ?
-
-#ea0 at podulebus? # Ether3 podules
-#eb0 at podulebus? # EtherB network slot cards
-#eh0 at podulebus? # EtherH network slot cards
-#ie0 at podulebus? # Ether1 podules
-
-pseudo-device loop 1 # network loopback
-pseudo-device bpfilter 8 # packet filter
-pseudo-device sl 2 # CSLIP
-pseudo-device ppp 2 # PPP
-pseudo-device tun 2 # network tunneling over tty
-
-pseudo-device pty 32 # pseudo-terminals
-pseudo-device tb 1 # tablet line discipline
-pseudo-device vnd 4 # paging to files
-pseudo-device ccd 2 # concatenated disk devices
-
-pseudo-device rd 1 # Ramdisk driver
-
-makeoptions MONITOR="AKF85"
-makeoptions MODES="1280,1024 1024,768,60 1024,768,70 800,600,60 640,480,60 1152,900"
diff --git a/sys/arch/arm32/conf/VOYAGER b/sys/arch/arm32/conf/VOYAGER
deleted file mode 100644
index 1da127ca959..00000000000
--- a/sys/arch/arm32/conf/VOYAGER
+++ /dev/null
@@ -1,196 +0,0 @@
-#
-# VOYAGER -- Mark's master development machine
-#
-
-include "std.arm32"
-
-# estimated number of users
-
-maxusers 32
-
-# Standard system options
-
-options TIMEZONE=0 # time zone to adjust RTC time by
-options DST=0 # daylight savings time used by RTC
-options SWAPPAGER # paging; REQUIRED
-options DEVPAGER # mmap() of devices
-
-# CPU options
-
-options CPU_ARM6
-options CPU_LATE_ABORT # ARM7XX compatibility
-
-# FPA options
-
-#options FPE # Single precision FPE
-options ARMFPE # ARM Ltd FPE
-
-# File system options
-
-options FFS # UFS
-#options QUOTA # UFS quotas
-#options LFS # log-structured file system
-options MFS # memory file system
-
-options CD9660 # ISO 9660 + Rock Ridge file system
-options MSDOSFS # MS-DOS file system
-options FDESC # /dev/fd
-options FIFO # FIFOs; RECOMMENDED
-options KERNFS # /kern
-options NULLFS # loopback file system
-#options PORTAL # ?
-options PROCFS # /proc
-#options UMAPFS # NULLFS + uid and gid remapping
-options UNION # union file system
-
-# Networking options
-
-options NFSCLIENT
-options NFSSERVER
-options GATEWAY # packet forwarding
-options INET # IP + ICMP + TCP + UDP
-#options NS # XNS
-#options ISO,TPIP # OSI
-#options EON # OSI tunneling over IP
-#options CCITT,LLC,HDLC # X.25
-
-# Compatibility options
-
-options COMPAT_43
-options COMPAT_10
-options COMPAT_09
-#options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD
-
-# Shared memory options
-
-#options SYSVMSG # System V-like message queues
-#options SYSVSEM # System V-like semaphores
-#options SYSVSHM # System V-like memory sharing
-#options SHMMAXPGS=1024 # 1024 pages is the default
-
-# Device options
-
-options RAMDISK_HOOKS # boottime setup of ramdisk
-options RAMDISK_SIZE=0 # Size in KBytes
-options PLIP # Build plip device into lpt driver
-
-# Development options
-
-options DIAGNOSTIC # internally consistency checks
-options KTRACE # system call tracing, a la ktrace(1)
-options IRQSTATS # IRQ statistics
-options POSTMORTEM # perform postmortem on panic
-#options ROTTEN_INNARDS # show the gory bit of the postmortem
-options KSHELL # kernel developemnt shell (debug)
-options LKM # loadable kernel modules
-#options DEBUGTERM # create a debug console
-#options KGDB # remote kernel debugging
-options DDB # in-kernel debugger
-#makeoptions DEBUG="-g" # compile full symbol table
-
-config netbsd swap generic
-options GENERIC
-
-# The main bus device
-mainbus0 at root
-
-# The boot cpu
-cpu0 at mainbus?
-
-# The hydra multiprocessor device
-hydrabus0 at mainbus?
-
-#cpu1 at hydrabus?
-#cpu2 at hydrabus?
-#cpu3 at hydrabus?
-#cpu4 at hydrabus?
-
-# The vidc
-vidcvideo0 at mainbus?
-
-# generic VT console device
-vt0 at mainbus?
-vt1 at mainbus?
-vt2 at mainbus?
-vt3 at mainbus?
-vt4 at mainbus?
-vt5 at mainbus?
-
-# IDE disk controller
-wdc0 at mainbus? base 0x002107c0 irq 9
-wd* at wdc? drive ?
-
-# Floppy disk controller
-fdc0 at mainbus? base 0x00210fc0 irq 12 dack 0x00002000
-fd0 at fdc? drive ?
-
-# kbd via IOMD
-kbd0 at mainbus? base 0x00000000
-
-# quadrature mouse
-quadmouse0 at mainbus? base 0x00000000
-
-# PS2 mouse
-pms0 at mainbus? base 0x00000000
-
-# Serial ports
-com0 at mainbus? base 0x00210fe0 irq 10
-#com1 at mainbus? base 0x00210be0
-
-# Parallel ports
-lpt0 at mainbus? base 0x002109e0 irq 0
-
-# Crude sound device
-beep0 at mainbus? base 0x00000000
-
-# IIC bus device
-iic0 at mainbus?
-
-# RTC device
-rtc0 at iic? addr 0xa0
-
-# Podule bus device
-podulebus0 at root
-
-asc0 at podulebus? # Acorn SCSI card
-scsibus* at asc?
-
-csc0 at podulebus? # Cumana SCSI II card
-scsibus* at csc?
-
-ptsc0 at podulebus? # Power-Tec SCSI II card
-scsibus* at ptsc?
-
-oak0 at podulebus? # Oak SCSI I card
-scsibus* at oak?
-
-sd* at scsibus? target ? lun ? # SCSI disk drives
-st* at scsibus? target ? lun ? # SCSI tape drives
-cd* at scsibus? target ? lun ? # SCSI CD-ROM drives
-ch* at scsibus? target ? lun ? # SCSI auto-changers
-uk* at scsibus? target ? lun ? # SCSI unknown device
-ss* at scsibus? target ? lun ? # SCSI scanner
-
-#kie* at podulebus? slot ? offset ?
-
-ea0 at podulebus? # Ether3 podules
-eb0 at podulebus? # EtherB network slot cards
-eh0 at podulebus? # EtherH network slot cards
-ie0 at podulebus? # Ether1 podules
-
-pseudo-device loop 1 # network loopback
-pseudo-device bpfilter 8 # packet filter
-pseudo-device sl 2 # CSLIP
-pseudo-device ppp 2 # PPP
-pseudo-device tun 2 # network tunneling over tty
-
-pseudo-device pty 32 # pseudo-terminals
-pseudo-device tb 1 # tablet line discipline
-pseudo-device vnd 4 # paging to files
-pseudo-device ccd 2 # concatenated disk devices
-
-pseudo-device rd 1 # Ramdisk device
-
-makeoptions MONITOR="Taxan875+LR"
-#makeoptions MONITOR="AKF60"
-makeoptions MODES="1024,768,60 1024,768,70 800,600,60 640,480,60 1280,1024 1152,900"
diff --git a/sys/arch/arm32/conf/files.arm32 b/sys/arch/arm32/conf/files.arm32
deleted file mode 100644
index e2bd7bc9598..00000000000
--- a/sys/arch/arm32/conf/files.arm32
+++ /dev/null
@@ -1,268 +0,0 @@
-#
-# First try for arm-specific configuration info
-#
-
-maxpartitions 8
-maxusers 2 8 64
-
-device mainbus { [base = -1], [dack = -1], [irq = -1] }
-attach mainbus at root
-file arch/arm32/mainbus/mainbus.c mainbus
-
-device hydrabus { [slot = -1] }
-attach hydrabus at mainbus
-file arch/arm32/mainbus/exp/hydra.c hydrabus needs-flag
-file arch/arm32/mainbus/exp/hydraboot.S hydrabus
-
-device cpu
-attach cpu at mainbus, hydrabus
-file arch/arm32/mainbus/cpu.c cpu needs-flag
-major {cpu = 38}
-
-#Standard NetBSD wd driver
-device wdc {drive = -1}
-attach wdc at mainbus
-device wd: disk
-attach wd at wdc
-file arch/arm32/mainbus/wd.c wdc needs-flag
-major {wd = 16}
-
-#Hacked NetBSD wd driver with cd and atapi support - nasty hack atm
-#device wdc {drive = -1}
-#attach wdc at mainbus
-#device wd: disk
-#attach wd at wdc
-#file arch/arm32/mainbus/exp/wd.c wdc needs-flag
-#major {wd = 16}
-
-device atapi: disk
-attach atapi at mainbus
-file arch/arm32/mainbus/exp/atapi.c atapi needs-flag
-
-device wcd: disk
-attach wcd at mainbus
-file arch/arm32/mainbus/exp/wcd.c wcd needs-flag
-major {wcd = 20}
-
-#Standard NetBSD fd driver
-device fdc {drive = -1}
-attach fdc at mainbus
-device fd: disk
-attach fd at fdc
-file arch/arm32/mainbus/fd.c fdc needs-flag
-major {fd = 17}
-
-# RAM disk driver
-file arch/arm32/dev/rd_hooks.c rd | ramdisk_hooks
-major {rd = 18}
-
-device lpt: tty, ether, ifnet
-attach lpt at mainbus
-file arch/arm32/mainbus/lpt.c lpt needs-flag
-major {lpt = 8}
-
-device com: tty
-attach com at mainbus
-file arch/arm32/mainbus/com.c com needs-flag
-major {com = 12}
-
-# Mouse devices
-device quadmouse: tty
-attach quadmouse at mainbus
-file arch/arm32/mainbus/qmouse.c quadmouse needs-flag
-major {quadmouse = 9}
-
-device pms: tty
-attach pms at mainbus
-file arch/arm32/mainbus/pms.c pms needs-flag
-major {pms = 40}
-
-# Audio devices
-device beep
-attach beep at mainbus
-file arch/arm32/mainbus/beep.c beep needs-flag
-major {beep = 10}
-
-device audio: audio
-attach audio at mainbus
-file arch/arm32/mainbus/vidcaudio.c vidcaudio needs-flag
-major {audio = 36}
-
-device kbd
-attach kbd at mainbus
-file arch/arm32/mainbus/kbd.c kbd needs-flag
-major {kbd = 11}
-
-# Podule bus device
-device podulebus { [slot = -1] }
-attach podulebus at root
-file arch/arm32/podulebus/podulebus.c podulebus
-
-# Ethernet devices
-device ea: ether, ifnet
-attach ea at podulebus
-file arch/arm32/podulebus/if_ea.c ea
-
-device eb: ether, ifnet
-attach eb at podulebus
-file arch/arm32/podulebus/if_eb.c eb
-
-device eh: ether, ifnet
-attach eh at podulebus
-file arch/arm32/podulebus/if_eh.c eh
-
-attach ie at podulebus
-file arch/arm32/podulebus/if_ie.c ie
-
-# IIC/RTC files
-device iic { addr = -1 }
-attach iic at mainbus
-file arch/arm32/mainbus/iic_asm.S iic
-file arch/arm32/mainbus/iic.c iic needs-flag
-
-device rtc
-attach rtc at iic
-file arch/arm32/mainbus/rtc.c rtc needs-count
-
-#define kgdb
-
-#device kie: kgdb
-#attach kie at podule
-#file arch/arm32/podulebus/kgdb_ie.c kie
-
-#file arch/arm32/arm32/kgdb_glue.c kgdb
-#file arch/arm32/arm32/kgdb_step.c kgdb
-
-#
-# Machine-independent SCSI drivers
-#
-
-include "../../../scsi/files.scsi"
-major {sd = 24}
-major {st = 25}
-major {cd = 26}
-major {ch = 27}
-major {uk = 28}
-major {ss = 29}
-
-# Generic sbic (WD3393) driver
-define sbic
-file arch/arm32/podulebus/sbic.c sbic
-
-# Acorn SCSI I specific layer for sbic
-device asc: scsi, sbic
-attach asc at podulebus
-file arch/arm32/podulebus/asc.c asc
-
-# Generic fas216 + esp216 driver
-define sfas
-file arch/arm32/podulebus/sfas.c sfas
-
-# Cumana specific layer for sfas
-device csc: scsi, sfas
-attach csc at podulebus
-file arch/arm32/podulebus/exp/csc.c csc
-
-device ptsc: scsi, sfas
-attach ptsc at podulebus
-file arch/arm32/podulebus/ptsc.c ptsc
-
-# Generic NCR driver
-define ncr
-file arch/arm32/podulebus/ncr5380sbc.c ncr
-
-# Oak specific layer for ncr
-device oak: scsi, ncr
-attach oak at podulebus
-file arch/arm32/podulebus/oak.c oak
-
-device vidcvideo
-attach vidcvideo at mainbus
-major {vidcvideo = 37}
-device vt: tty
-attach vt at mainbus
-file arch/arm32/dev/console/console.c vt needs-count
-file arch/arm32/dev/console/vidcconsole.c vt needs-count
-file arch/arm32/dev/console/vidc_mc.S vt needs-count
-file arch/arm32/dev/console/vidc.c vt needs-count
-file arch/arm32/dev/console/vt220.c vt needs-count
-file arch/arm32/dev/console/debugconsole.c vt needs-count
-file arch/arm32/dev/console/dumb.c vt needs-count
-
-file arch/arm32/arm32/autoconf.c
-file arch/arm32/arm32/blockio.S
-file arch/arm32/arm32/clock.c
-file arch/arm32/arm32/conf.c
-file arch/arm32/arm32/cpuswitch.S
-file arch/arm32/arm32/disksubr.c disk
-file arch/arm32/arm32/stubs.c
-file arch/arm32/arm32/exception.S
-file arch/arm32/arm32/syscall.c
-file arch/arm32/arm32/ast.c
-file arch/arm32/arm32/fault.c
-file arch/arm32/arm32/undefined.c
-file arch/arm32/arm32/mem.c
-file arch/arm32/arm32/scratch.S
-file arch/arm32/arm32/process_machdep.c
-file arch/arm32/arm32/machdep.c
-file arch/arm32/arm32/sys_machdep.c
-file arch/arm32/arm32/vm_machdep.c
-file arch/arm32/arm32/pmap.c
-file arch/arm32/arm32/fusu.c
-
-file netinet/in_cksum.c inet
-file netns/ns_cksum.c ns
-
-# IRQ/FIQ files
-file arch/arm32/arm32/spl.S
-file arch/arm32/arm32/irq.S
-file arch/arm32/arm32/irqhandler.c
-file arch/arm32/arm32/fiq.S
-
-# library functions
-file arch/arm32/arm32/strstr.c
-file arch/arm32/arm32/strtoul.c
-file arch/arm32/arm32/memset.S
-file arch/arm32/arm32/bcopy_page.S
-file arch/arm32/arm32/bcopy.S
-file arch/arm32/arm32/bcopyinout.S
-file arch/arm32/arm32/copystr.S
-file arch/arm32/arm32/coproc15.S
-file arch/arm32/arm32/setcpsr.S
-file arch/arm32/arm32/setstack.S
-
-# files related to the shell
-file arch/arm32/kshell/shell_input.c kshell
-file arch/arm32/kshell/shell_shell.c kshell
-file arch/arm32/kshell/shell_disassem.c kshell
-file arch/arm32/kshell/strchr.c kshell
-file arch/arm32/kshell/dumphex.c kshell
-
-# files related to debugging
-file arch/arm32/arm32/debug.c
-file arch/arm32/arm32/disassem.c
-file arch/arm32/arm32/postmortem.c
-
-file dev/cons.c
-file dev/cninit.c
-
-# Signal precision FPE
-file arch/arm32/fpe-sp/fpe.c fpe
-file arch/arm32/fpe-sp/fpeadd.S fpe
-file arch/arm32/fpe-sp/fpesub.S fpe
-file arch/arm32/fpe-sp/fpemul.S fpe
-file arch/arm32/fpe-sp/fpediv.S fpe
-file arch/arm32/fpe-sp/fpefix.S fpe
-file arch/arm32/fpe-sp/fpecmf.S fpe
-file arch/arm32/fpe-sp/fpetoe.S fpe
-
-# ARM FPE
-file arch/arm32/fpe-arm/armfpe_glue.S armfpe
-file arch/arm32/fpe-arm/armfpe_init.c armfpe
-file arch/arm32/fpe-arm/armfpe.s armfpe
-
-# DDB
-file arch/arm32/arm32/db_disasm.c ddb
-file arch/arm32/arm32/db_interface.c ddb
-file arch/arm32/arm32/db_trace.c ddb
-file arch/arm32/arm32/db_machdep.c ddb
diff --git a/sys/arch/arm32/conf/monitors/AKF60 b/sys/arch/arm32/conf/monitors/AKF60
deleted file mode 100644
index a420a66a0c1..00000000000
--- a/sys/arch/arm32/conf/monitors/AKF60
+++ /dev/null
@@ -1,360 +0,0 @@
-# Modefile written by !MakeModes version 0.19 (22-Aug-1994)
-# Monitor description file for Acorn AKF60 monitor
-# Line rate: 30 - 50 kHz
-
-file_format:1
-monitor_title:Acorn AKF60
-DPMS_state:1
-
-# Letterbox modes
-
-# 240 x 352 (70Hz)
-startmode
-mode_name:
-x_res:240
-y_res:352
-pixel_rate:9440
-h_timings:18,16,8,240,8,10
-v_timings:2,58,0,352,0,37
-sync_pol:2
-endmode
-
-# 320 x 250 (70Hz - Modes 6,7)
-# Low band
-startmode
-mode_name:
-x_res:320
-y_res:250
-pixel_rate:12587
-h_timings:36,14,12,320,12,6
-v_timings:2,109,0,250,0,88
-sync_pol:2
-endmode
-
-# 320 x 256 (70Hz - Modes 1,2,5,9,10,13)
-# Low band
-startmode
-mode_name:
-x_res:320
-y_res:256
-pixel_rate:12587
-h_timings:36,14,12,320,12,6
-v_timings:2,106,0,256,0,85
-sync_pol:2
-endmode
-
-# 384 x 288 (70Hz)
-# Low band
-startmode
-mode_name:
-x_res:384
-y_res:288
-pixel_rate:18881
-h_timings:64,16,66,384,66,4
-v_timings:2,58,32,288,32,37
-sync_pol:2
-endmode
-
-# 480 x 352 (70Hz)
-# Low band
-startmode
-mode_name:480 x 352
-x_res:480
-y_res:352
-pixel_rate:18881
-h_timings:64,16,18,480,18,4
-v_timings:2,58,0,352,0,37
-sync_pol:2
-endmode
-
-# 640 x 200 (70Hz - Modes 44,45,46)
-# Low band
-startmode
-mode_name:
-x_res:640
-y_res:200
-pixel_rate:25175
-h_timings:88,22,22,640,22,6
-v_timings:2,134,0,200,0,113
-sync_pol:2
-endmode
-
-# 640 x 250 (70Hz - Modes 3,11,14)
-# Low band
-startmode
-mode_name:
-x_res:640
-y_res:250
-pixel_rate:25175
-h_timings:88,22,22,640,22,6
-v_timings:2,109,0,250,0,88
-sync_pol:2
-endmode
-
-# 640 x 256 (70Hz - Modes 0,4,8,12,15)
-# Low band
-startmode
-mode_name:
-x_res:640
-y_res:256
-pixel_rate:25175
-h_timings:88,22,22,640,22,6
-v_timings:2,106,0,256,0,85
-sync_pol:2
-endmode
-
-# 640 x 352 (70Hz - Modes 41,42,43)
-# Low band
-startmode
-mode_name:
-x_res:640
-y_res:352
-pixel_rate:25175
-h_timings:88,22,22,640,22,6
-v_timings:2,58,0,352,0,37
-sync_pol:2
-endmode
-
-# Other modes (some also numbered)
-
-# 320 x 480 (60Hz - Games modes 48,49)
-# Low band
-startmode
-mode_name:
-x_res:320
-y_res:480
-pixel_rate:12587
-h_timings:36,14,12,320,12,6
-v_timings:2,32,0,480,0,11
-sync_pol:3
-endmode
-
-# 320 x 480 (72Hz)
-# Mid band
-startmode
-mode_name:
-x_res:320
-y_res:480
-pixel_rate:15750
-h_timings:28,30,16,320,16,6
-v_timings:3,28,0,480,0,9
-sync_pol:3
-endmode
-
-# 320 x 480 (75Hz)
-# Mid band
-startmode
-mode_name:
-x_res:320
-y_res:480
-pixel_rate:15750
-h_timings:26,34,16,320,16,8
-v_timings:3,16,0,480,0,1
-sync_pol:3
-endmode
-
-# 360 x 480 (60Hz - PCSoft mode 47)
-# Low band
-startmode
-mode_name:
-x_res:360
-y_res:480
-pixel_rate:16783
-h_timings:62,44,16,360,16,34
-v_timings:2,32,0,480,0,11
-sync_pol:3
-endmode
-
-# 640 x 480 (60Hz - Modes 25,26,27,28)
-# Low band
-startmode
-mode_name:640 x 480
-x_res:640
-y_res:480
-pixel_rate:25175
-h_timings:88,22,22,640,22,6
-v_timings:2,32,0,480,0,11
-sync_pol:3
-endmode
-
-# 640 x 480 (72Hz)
-# Mid band
-startmode
-mode_name:640 x 480
-x_res:640
-y_res:480
-pixel_rate:31500
-h_timings:52,64,30,640,30,14
-# VESA:40,128,0,640,0,24
-v_timings:3,28,0,480,0,9
-sync_pol:3
-endmode
-
-# 640 x 480 (75Hz)
-# Mid band
-startmode
-mode_name:640 x 480
-x_res:640
-y_res:480
-pixel_rate:31500
-h_timings:62,64,30,640,30,14
-# VESA:64,120,0,640,0,16
-v_timings:3,16,0,480,0,1
-sync_pol:3
-endmode
-
-# 800 x 600 (56Hz - Modes 29,30,31)
-# Mid band
-startmode
-mode_name:800 x 600
-x_res:800
-y_res:600
-pixel_rate:36000
-h_timings:70,74,34,800,34,12
-# VESA:72,128,0,800,0,24
-v_timings:2,22,0,600,0,1
-sync_pol:0
-endmode
-
-# 800 x 600 (60Hz)
-# Mid band
-startmode
-mode_name:800 x 600
-x_res:800
-y_res:600
-pixel_rate:40000
-h_timings:112,64,40,800,40,0
-# VESA:128,88, 0,800,0,40
-v_timings:4,23,0,600,0,1
-sync_pol:0
-endmode
-
-# 800 x 600 (72Hz)
-# High band
-startmode
-mode_name:800 x 600
-x_res:800
-y_res:600
-pixel_rate:50000
-h_timings:88,34,42,800,42,34
-# VESA:120,64, 0,800,0,56
-v_timings:6,23,0,600,0,37
-sync_pol:0
-endmode
-
-# 800 x 600 (75Hz)
-# High band
-startmode
-mode_name:800 x 600
-x_res:800
-y_res:600
-pixel_rate:49500
-h_timings:80,46,42,800,42,46
-# VESA:80,160,0,800,0,16
-v_timings:3,21,0,600,0,1
-sync_pol:0
-endmode
-
-# 1024 x 768 (60Hz)
-# High band
-startmode
-mode_name:1024 x 768
-x_res:1024
-y_res:768
-pixel_rate:65000
-h_timings:128,36,60,1024,60,36
-# VESA:136,160,0,1024,0,24
-v_timings:6,29,0,768,0,3
-sync_pol:0
-endmode
-
-# Pixel-doubled modes
-
-# 1280 x 480 (60Hz)
-# Low band
-startmode
-mode_name:1280 x 480
-x_res:1280
-y_res:480
-pixel_rate:50350
-h_timings:176,44,44,1280,44,12
-v_timings:2,32,0,480,0,11
-sync_pol:3
-endmode
-
-# 1280 x 480 (72Hz)
-# Mid band
-startmode
-mode_name:1280 x 480
-x_res:1280
-y_res:480
-pixel_rate:63000
-h_timings:104,128,60,1280,60,28
-# VESA:80,256,0,1280,0,48
-v_timings:3,28,0,480,0,9
-sync_pol:3
-endmode
-
-# 1280 x 480 (75Hz)
-# Mid band
-startmode
-mode_name:1280 x 480
-x_res:1280
-y_res:480
-pixel_rate:63000
-h_timings:124,128,60,1280,60,28
-# VESA:128,240,0,1280,0,32
-v_timings:3,16,0,480,0,1
-sync_pol:3
-endmode
-
-# 1600 x 600 (56Hz)
-# Mid band
-startmode
-mode_name:1600 x 600
-x_res:1600
-y_res:600
-pixel_rate:72000
-h_timings:140,148,68,1600,68,24
-v_timings:2,22,0,600,0,1
-sync_pol:0
-endmode
-
-# 1600 x 600 (60Hz)
-# Mid band
-startmode
-mode_name:1600 x 600
-x_res:1600
-y_res:600
-pixel_rate:80000
-h_timings:224,128,80,1600,80,0
-# VESA:256,176, 0,1600,0,80
-v_timings:4,23,0,600,0,1
-sync_pol:0
-endmode
-
-# 1600 x 600 (72Hz)
-# High band
-startmode
-mode_name:1600 x 600
-x_res:1600
-y_res:600
-pixel_rate:100000
-h_timings:176,68,84,1600,84,68
-# VESA:240,128, 0,1600,0,112
-v_timings:6,23,0,600,0,37
-sync_pol:0
-endmode
-
-# 1600 x 600 (75Hz)
-# High band
-startmode
-mode_name:1600 x 600
-x_res:1600
-y_res:600
-pixel_rate:99000
-h_timings:160,92,84,1600,84,92
-# VESA:160,320,0,1600,0,32
-v_timings:3,21,0,600,0,1
-sync_pol:0
-endmode
diff --git a/sys/arch/arm32/conf/monitors/AKF85 b/sys/arch/arm32/conf/monitors/AKF85
deleted file mode 100644
index 7813bf90f4d..00000000000
--- a/sys/arch/arm32/conf/monitors/AKF85
+++ /dev/null
@@ -1,397 +0,0 @@
-# Modefile written by !MakeModes version 0.19 (22-Aug-1994)
-# Monitor description file for Acorn AKF85 monitor
-# Line rate: 30 - 82 kHz
-# Frame rate: 50 - 120 Hz
-# Dot rate: Up to 135 MHz
-
-
-file_format:1
-monitor_title:Acorn AKF85
-DPMS_state:0
-
-# 240 x 352 (70Hz)
-startmode
-mode_name:
-x_res:240
-y_res:352
-pixel_rate:9440
-h_timings:20,16,8,240,8,8
-v_timings:2,58,0,352,0,37
-sync_pol:2
-endmode
-
-# 320 x 250 (70Hz)
-startmode
-mode_name:
-x_res:320
-y_res:250
-pixel_rate:12587
-h_timings:42,14,12,320,12,0
-v_timings:2,109,0,250,0,88
-sync_pol:2
-endmode
-
-# 320 x 256 (70Hz)
-startmode
-mode_name:
-x_res:320
-y_res:256
-pixel_rate:12587
-h_timings:42,14,12,320,12,0
-v_timings:2,106,0,256,0,85
-sync_pol:2
-endmode
-
-# 320 x 480 (60Hz)
-startmode
-mode_name:
-x_res:320
-y_res:480
-pixel_rate:12587
-h_timings:42,14,12,320,12,0
-v_timings:2,32,0,480,0,11
-sync_pol:3
-endmode
-
-# 320 x 480 (73Hz)
-startmode
-mode_name:
-x_res:320
-y_res:480
-pixel_rate:15750
-h_timings:24,40,16,320,16,0
-v_timings:3,28,0,480,0,9
-sync_pol:3
-endmode
-
-# 320 x 480 (75Hz)
-startmode
-mode_name:
-x_res:320
-y_res:480
-pixel_rate:15750
-h_timings:24,44,16,320,16,0
-v_timings:3,16,0,480,0,1
-sync_pol:3
-endmode
-
-# 360 x 480 (60Hz)
-startmode
-mode_name:
-x_res:360
-y_res:480
-pixel_rate:16783
-h_timings:64,46,16,360,16,30
-v_timings:2,32,0,480,0,11
-sync_pol:3
-endmode
-
-# 384 x 288 (70Hz)
-startmode
-mode_name:
-x_res:384
-y_res:288
-pixel_rate:18881
-h_timings:68,16,66,384,66,0
-v_timings:2,58,32,288,32,37
-sync_pol:2
-endmode
-
-# 480 x 352 (70Hz)
-startmode
-mode_name:480 x 352
-x_res:480
-y_res:352
-pixel_rate:18881
-h_timings:68,16,18,480,18,0
-v_timings:2,58,0,352,0,37
-sync_pol:2
-endmode
-
-# 640 x 200 (70Hz)
-startmode
-mode_name:
-x_res:640
-y_res:200
-pixel_rate:25175
-h_timings:92,24,22,640,22,0
-v_timings:2,134,0,200,0,113
-sync_pol:2
-endmode
-
-# 640 x 250 (70Hz)
-startmode
-mode_name:
-x_res:640
-y_res:250
-pixel_rate:25175
-h_timings:92,24,22,640,22,0
-v_timings:2,109,0,250,0,88
-sync_pol:2
-endmode
-
-# 640 x 256 (70Hz)
-startmode
-mode_name:
-x_res:640
-y_res:256
-pixel_rate:25175
-h_timings:92,24,22,640,22,0
-v_timings:2,106,0,256,0,85
-sync_pol:2
-endmode
-
-# 640 x 352 (70Hz)
-startmode
-mode_name:
-x_res:640
-y_res:352
-pixel_rate:25175
-h_timings:92,24,22,640,22,0
-v_timings:2,58,0,352,0,37
-sync_pol:2
-endmode
-
-# 640 x 480 (60Hz)
-startmode
-mode_name:640 x 480
-x_res:640
-y_res:480
-pixel_rate:25175
-h_timings:94,22,22,640,22,0
-v_timings:2,32,0,480,0,11
-sync_pol:3
-endmode
-
-# 640 x 480 (73Hz)
-startmode
-mode_name:640 x 480
-x_res:640
-y_res:480
-pixel_rate:31500
-h_timings:48,84,30,640,30,0
-v_timings:3,28,0,480,0,9
-sync_pol:3
-endmode
-
-# 640 x 480 (75Hz)
-startmode
-mode_name:640 x 480
-x_res:640
-y_res:480
-pixel_rate:31500
-h_timings:64,76,30,640,30,0
-v_timings:3,16,0,480,0,1
-sync_pol:3
-endmode
-
-# 640 x 480 (120Hz)
-startmode
-mode_name:640 x 480
-x_res:640
-y_res:480
-pixel_rate:52600
-h_timings:64,76,30,640,46,18
-v_timings:3,16,0,480,0,1
-sync_pol:3
-endmode
-
-# 800 x 600 (60Hz)
-startmode
-mode_name:800 x 600
-x_res:800
-y_res:600
-pixel_rate:40000
-h_timings:128,48,40,800,40,0
-v_timings:4,23,0,600,0,1
-sync_pol:0
-endmode
-
-# 800 x 600 (75Hz)
-startmode
-mode_name:800 x 600
-x_res:800
-y_res:600
-pixel_rate:49500
-h_timings:80,92,42,800,42,0
-v_timings:3,21,0,600,0,1
-sync_pol:0
-endmode
-
-# 800 x 600 (100Hz)
-startmode
-mode_name:800 x 600
-x_res:800
-y_res:600
-pixel_rate:69350
-h_timings:100,104,0,800,66,42
-v_timings:3,21,0,600,0,1
-sync_pol:0
-endmode
-
-# 1024 x 768 (60Hz)
-startmode
-mode_name:1024 x 768
-x_res:1024
-y_res:768
-pixel_rate:65000
-h_timings:136,64,60,1024,60,0
-v_timings:6,29,0,768,0,3
-sync_pol:0
-endmode
-
-# 1024 x 768 (70Hz)
-startmode
-mode_name:1024 x 768
-x_res:1024
-y_res:768
-pixel_rate:75000
-h_timings:124,36,72,1024,72,0
-v_timings:6,29,0,768,0,3
-sync_pol:0
-endmode
-
-# 1024 x 768 (75Hz)
-startmode
-mode_name:1024 x 768
-x_res:1024
-y_res:768
-pixel_rate:80310
-h_timings:122,86,30,1024,76,0
-v_timings:3,28,0,768,0,1
-sync_pol:0
-endmode
-
-# 1024 x 768 (102Hz)
-startmode
-mode_name:1024 x 768
-x_res:1024
-y_res:768
-pixel_rate:119000
-h_timings:130,96,46,1024,106,50
-v_timings:3,28,0,768,0,1
-sync_pol:0
-endmode
-
-# 1152 x 900 (55Hz)
-startmode
-mode_name:1152 x 900
-x_res:1152
-y_res:900
-pixel_rate:80000
-h_timings:156,40,98,1152,124,0
-v_timings:1,28,0,900,0,3
-sync_pol:0
-endmode
-
-# 1152 x 900 (86Hz)
-startmode
-mode_name:1152 x 900
-x_res:1152
-y_res:900
-pixel_rate:134480
-h_timings:132,70,124,1152,124,70
-v_timings:1,28,0,900,0,3
-sync_pol:0
-endmode
-
-# 1280 x 480 (60Hz)
-startmode
-mode_name:1280 x 480
-x_res:1280
-y_res:480
-pixel_rate:50350
-h_timings:188,44,44,1280,44,0
-v_timings:2,32,0,480,0,11
-sync_pol:3
-endmode
-
-# 1280 x 480 (73Hz)
-startmode
-mode_name:1280 x 480
-x_res:1280
-y_res:480
-pixel_rate:63000
-h_timings:96,172,58,1280,58,0
-v_timings:3,28,0,480,0,9
-sync_pol:3
-endmode
-
-# 1280 x 480 (75Hz)
-startmode
-mode_name:1280 x 480
-x_res:1280
-y_res:480
-pixel_rate:63000
-h_timings:128,156,58,1280,58,0
-v_timings:3,16,0,480,0,1
-sync_pol:3
-endmode
-
-# 1280 x 1024 (76Hz)
-startmode
-mode_name:1280 x 1024
-x_res:1280
-y_res:1024
-pixel_rate:139000
-h_timings:166,90,96,1280,96,0
-v_timings:3,32,0,1024,0,3
-sync_pol:0
-endmode
-
-# 1600 x 600 (56Hz)
-startmode
-mode_name:1600 x 600
-x_res:1600
-y_res:600
-pixel_rate:72000
-h_timings:144,168,68,1600,68,0
-v_timings:2,22,0,600,0,1
-sync_pol:0
-endmode
-
-# 1600 x 600 (60Hz)
-startmode
-mode_name:1600 x 600
-x_res:1600
-y_res:600
-pixel_rate:80000
-h_timings:256,98,78,1600,78,2
-v_timings:4,23,0,600,0,1
-sync_pol:0
-endmode
-
-# 1600 x 600 (72Hz)
-startmode
-mode_name:1600 x 600
-x_res:1600
-y_res:600
-pixel_rate:100000
-h_timings:226,58,84,1600,84,28
-v_timings:6,23,0,600,0,37
-sync_pol:0
-endmode
-
-# 1600 x 600 (75Hz)
-startmode
-mode_name:1600 x 600
-x_res:1600
-y_res:600
-pixel_rate:99000
-h_timings:160,188,82,1600,82,0
-v_timings:3,21,0,600,0,1
-sync_pol:0
-endmode
-
-# 1600 x 1200 (50Hz)
-startmode
-mode_name:1600 x 1200
-x_res:1600
-y_res:1200
-pixel_rate:131000
-h_timings:166,90,96,1600,128,44
-v_timings:3,32,0,1200,0,3
-sync_pol:0
-endmode
-
-# End
diff --git a/sys/arch/arm32/conf/monitors/Taxan875+LR b/sys/arch/arm32/conf/monitors/Taxan875+LR
deleted file mode 100644
index 4a02e255477..00000000000
--- a/sys/arch/arm32/conf/monitors/Taxan875+LR
+++ /dev/null
@@ -1,412 +0,0 @@
-# Modefile written by !MakeModes version 0.19 (22-Aug-1994)
-# Monitor description file for Taxan 875+LR monitor
-# Line rate: 30 - 82 kHz
-# Frame rate: 50 - 120 Hz
-# Dot rate: Up to 135 MHz
-
-file_format:1
-monitor_title:Taxan 875+LR
-DPMS_state:0
-
-# Letterbox modes
-
-# 240 x 352 (70Hz)
-startmode
-mode_name:
-x_res:240
-y_res:352
-pixel_rate:9440
-h_timings:20,16,8,240,8,8
-v_timings:2,58,0,352,0,37
-sync_pol:2
-endmode
-
-# 320 x 250 (70Hz - Modes 6,7)
-startmode
-mode_name:
-x_res:320
-y_res:250
-pixel_rate:12587
-h_timings:42,14,12,320,12,0
-v_timings:2,109,0,250,0,88
-sync_pol:2
-endmode
-
-# 320 x 256 (70Hz - Modes 1,2,5,9,10,13)
-startmode
-mode_name:
-x_res:320
-y_res:256
-pixel_rate:12587
-h_timings:42,14,12,320,12,0
-v_timings:2,106,0,256,0,85
-sync_pol:2
-endmode
-
-# 384 x 288 (70Hz)
-startmode
-mode_name:
-x_res:384
-y_res:288
-pixel_rate:18881
-h_timings: 68,16,66,384,66,0
-v_timings: 2,58,32,288,32,37
-sync_pol:2
-endmode
-
-# 480 x 352 (70Hz)
-startmode
-mode_name:480 x 352
-x_res:480
-y_res:352
-pixel_rate:18881
-h_timings: 68,16,18,480,18,0
-v_timings: 2,58,0,352,0,37
-sync_pol:2
-endmode
-
-# 640 x 200 (70Hz - Modes 44,45,46)
-startmode
-mode_name:
-x_res:640
-y_res:200
-pixel_rate:25175
-h_timings:92,24,22,640,22,0
-v_timings:2,134,0,200,0,113
-sync_pol:2
-endmode
-
-# 640 x 250 (70Hz - Modes 3,11,14)
-startmode
-mode_name:
-x_res:640
-y_res:250
-pixel_rate:25175
-h_timings:92,24,22,640,22,0
-v_timings:2,109,0,250,0,88
-sync_pol:2
-endmode
-
-# 640 x 256 (70Hz - Modes 0,4,8,12,15)
-startmode
-mode_name:
-x_res:640
-y_res:256
-pixel_rate:25175
-h_timings:92,24,22,640,22,0
-v_timings:2,106,0,256,0,85
-sync_pol:2
-endmode
-
-# 640 x 352 (70Hz - Modes 41,42,43)
-startmode
-mode_name:
-x_res:640
-y_res:352
-pixel_rate:25175
-h_timings:92,24,22,640,22,0
-v_timings:2,58,0,352,0,37
-sync_pol:2
-endmode
-
-# Other modes (some also numbered)
-
-# 320 x 480 (60Hz - Games modes 48,49)
-startmode
-mode_name:
-x_res:320
-y_res:480
-pixel_rate:12587
-h_timings:42,14,12,320,12,0
-v_timings:2,32,0,480,0,11
-sync_pol:3
-endmode
-
-# 320 x 480 (72Hz)
-startmode
-mode_name:
-x_res:320
-y_res:480
-pixel_rate:15750
-h_timings:24,40,16,320,16,0
-v_timings:3,28,0,480,0,9
-sync_pol:3
-endmode
-
-# 320 x 480 (75Hz)
-startmode
-mode_name:
-x_res:320
-y_res:480
-pixel_rate:15750
-h_timings:24,44,16,320,16,0
-v_timings:3,16,0,480,0,1
-sync_pol:3
-endmode
-
-# 360 x 480 (60Hz - PCSoft mode 47)
-startmode
-mode_name:
-x_res:360
-y_res:480
-pixel_rate:16783
-h_timings:64,46,16,360,16,30
-v_timings:2,32,0,480,0,11
-sync_pol:3
-endmode
-
-# 640 x 480 (60Hz - Modes 25,26,27,28)
-startmode
-mode_name:640 x 480
-x_res:640
-y_res:480
-pixel_rate:25175
-h_timings:94,22,22,640,22,0
-v_timings:2,32,0,480,0,11
-sync_pol:3
-endmode
-
-# 640 x 480 (72Hz)
-startmode
-mode_name:640 x 480
-x_res:640
-y_res:480
-pixel_rate:31500
-h_timings:48,84,30,640,30,0
-# VESA:40,128,0,640,0,24
-v_timings:3,28,0,480,0,9
-sync_pol:3
-endmode
-
-# 640 x 480 (75Hz)
-startmode
-mode_name:640 x 480
-x_res:640
-y_res:480
-pixel_rate:31500
-h_timings:64,76,30,640,30,0
-# VESA:64,120,0,640,0,16
-v_timings:3,16,0,480,0,1
-sync_pol:3
-endmode
-
-# 800 x 600 (56Hz - Modes 29,30,31)
-startmode
-mode_name:800 x 600
-x_res:800
-y_res:600
-pixel_rate:36000
-h_timings:72,84,34,800,34,0
-# VESA:72,128,0,800,0,24
-v_timings:2,22,0,600,0,1
-sync_pol:0
-endmode
-
-# 800 x 600 (60Hz)
-startmode
-mode_name:800 x 600
-x_res:800
-y_res:600
-pixel_rate:40000
-h_timings:128,48,40,800,40,0
-# VESA:128,88, 0,800,0,40
-v_timings:4,23,0,600,0,1
-sync_pol:0
-endmode
-
-# 800 x 600 (72Hz)
-startmode
-mode_name:800 x 600
-x_res:800
-y_res:600
-pixel_rate:50000
-h_timings:100,42,42,800,42,14
-# VESA:120,64, 0,800,0,56
-v_timings:6,23,0,600,0,37
-sync_pol:0
-endmode
-
-# Stick with just the 72Hz mode as this is a factory default
-# 800 x 600 (75Hz)
-#startmode
-#mode_name:800 x 600
-#x_res:800
-#y_res:600
-#pixel_rate:49500
-#h_timings:80,92,42,800,42,0
-# VESA:80,160,0,800,0,16
-#v_timings:3,21,0,600,0,1
-#sync_pol:0
-#endmode
-
-# 1024 x 768 (60Hz)
-startmode
-mode_name:1024 x 768
-x_res:1024
-y_res:768
-pixel_rate:65000
-h_timings:136,64,60,1024,60,0
-# VESA:136,160,0,1024,0,24
-v_timings:6,29,0,768,0,3
-sync_pol:0
-endmode
-
-# 1024 x 768 (70Hz)
-startmode
-mode_name:1024 x 768
-x_res:1024
-y_res:768
-pixel_rate:75000
-h_timings:124,36,72,1024,72,0
-# VESA:136,144,0,1024,0,24
-v_timings:6,29,0,768,0,3
-sync_pol:0
-endmode
-
-# this has been removed so that it does not get selected for the 16 colour
-# version. 70Hz 1024x768 is a build in setting, 75Hz ain't !
-# 1024 x 768 (75Hz)
-#startmode
-#mode_name:1024 x 768
-#x_res:1024
-#y_res:768
-#pixel_rate:80310
-# VESA:78750
-#h_timings:122,86,30,1024,76,0
-# VESA: 96,176,0,1024,0,16
-#v_timings:3,28,0,768,0,1
-#sync_pol:0
-#endmode
-
-# 1152 x 900 (53Hz)
-startmode
-mode_name:1152 x 900
-x_res:1152
-y_res:900
-pixel_rate:76000
-h_timings:152,64,60,1152,100,0
-v_timings:6,29,0,900,0,3
-sync_pol:3
-endmode
-
-# 1152 x 900 (76Hz)
-startmode
-mode_name:1152 x 900
-x_res:1152
-y_res:900
-pixel_rate:117000
-h_timings:170,96,96,1152,104,12
-v_timings:3,33,0,900,0,3
-sync_pol:3
-endmode
-
-# 1280 x 1024 (60Hz)
-startmode
-mode_name:1280 x 1024
-x_res:1280
-y_res:1024
-pixel_rate:110000
-h_timings:166,90,96,1280,96,0
-#h_timings:128,256,0,1280,0,64
-v_timings:3,32,0,1024,0,3
-sync_pol:0
-endmode
-
-# The taxan has a 70Hz 1280 x 768 build in just got to find it.
-# 1280 x 1024 (70Hz)
-startmode
-mode_name:1280 x 1024
-x_res:1280
-y_res:1024
-pixel_rate:128000
-h_timings:160,88,96,1280,96,0
-#h_timings:166,90,96,1280,96,0
-#h_timings:128,256,0,1280,0,64
-v_timings:3,32,0,1024,0,3
-sync_pol:0
-endmode
-
-# Pixel-doubled modes
-
-# 1280 x 480 (60Hz)
-startmode
-mode_name:1280 x 480
-x_res:1280
-y_res:480
-pixel_rate:50350
-h_timings:188,44,44,1280,44,0
-v_timings:2,32,0,480,0,11
-sync_pol:3
-endmode
-
-# 1280 x 480 (72Hz)
-startmode
-mode_name:1280 x 480
-x_res:1280
-y_res:480
-pixel_rate:63000
-h_timings:96,172,58,1280,58,0
-# VESA:80,256,0,1280,0,48
-v_timings:3,28,0,480,0,9
-sync_pol:3
-endmode
-
-# 1280 x 480 (75Hz)
-startmode
-mode_name:1280 x 480
-x_res:1280
-y_res:480
-pixel_rate:63000
-h_timings:128,156,58,1280,58,0
-# VESA:128,240,0,1280,0,32
-v_timings:3,16,0,480,0,1
-sync_pol:3
-endmode
-
-# 1600 x 600 (56Hz)
-startmode
-mode_name:1600 x 600
-x_res:1600
-y_res:600
-pixel_rate:72000
-h_timings:144,168,68,1600,68,0
-v_timings:2,22,0,600,0,1
-sync_pol:0
-endmode
-
-# 1600 x 600 (60Hz)
-startmode
-mode_name:1600 x 600
-x_res:1600
-y_res:600
-pixel_rate:80000
-h_timings:256,98,78,1600,78,2
-# VESA:256,176, 0,1600,0,80
-v_timings:4,23,0,600,0,1
-sync_pol:0
-endmode
-
-# 1600 x 600 (72Hz)
-startmode
-mode_name:1600 x 600
-x_res:1600
-y_res:600
-pixel_rate:100000
-h_timings:226,58,84,1600,84,28
-# VESA:240,128, 0,1600,0,112
-v_timings:6,23,0,600,0,37
-sync_pol:0
-endmode
-
-# 1600 x 600 (75Hz)
-startmode
-mode_name:1600 x 600
-x_res:1600
-y_res:600
-pixel_rate:99000
-h_timings:160,188,82,1600,82,0
-# VESA:160,320,0,1600,0,32
-v_timings:3,21,0,600,0,1
-sync_pol:0
-endmode
-
diff --git a/sys/arch/arm32/conf/std.arm32 b/sys/arch/arm32/conf/std.arm32
deleted file mode 100644
index 053df992201..00000000000
--- a/sys/arch/arm32/conf/std.arm32
+++ /dev/null
@@ -1,5 +0,0 @@
-# standard NetBSD/arm32 options
-
-machine arm32
-
-options MACHINE_NONCONTIG # temporary kludge
diff --git a/sys/arch/arm32/dev/console/console.c b/sys/arch/arm32/dev/console/console.c
deleted file mode 100644
index a0beedf0bb1..00000000000
--- a/sys/arch/arm32/dev/console/console.c
+++ /dev/null
@@ -1,1220 +0,0 @@
-/* $NetBSD: console.c,v 1.6 1996/04/19 20:03:37 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1995 Melvyn Tang-Richardson
- * Copyright (c) 1994-1995 RiscBSD kernel team
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD kernel team
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE RISCBSD TEAM ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * console.c
- *
- * Console functions
- *
- * Created : 17/09/94
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/device.h>
-#include <sys/time.h>
-#include <sys/systm.h>
-#include <sys/errno.h>
-#include <sys/tty.h>
-#include <sys/ioctl.h>
-#include <sys/uio.h>
-#include <sys/malloc.h>
-#include <sys/msgbuf.h>
-#include <sys/user.h>
-#include <sys/sysctl.h>
-#include <sys/syslog.h>
-
-#include <dev/cons.h>
-
-#include <machine/vidc.h>
-#include <machine/vconsole.h>
-#include <machine/katelib.h>
-
-#include "vt.h"
-
-#define CONSOLE_VERSION "[V203C] "
-
-/*
- * Externals
- */
-
-extern struct tty *constty;
-extern int debug_flags;
-#define consmap_col(x) (x & 0x3)
-#define CONSMAP_BOLD 8
-#define CONSMAP_ITALIC 16
-
-/*
- * Local variables (to this file)
- */
-
-int locked=0; /* Nut - is this really safe ? */
-struct tty *physcon_tty[NVT];
-struct vconsole vconsole_master_store;
-struct vconsole *vconsole_master = &vconsole_master_store;
-struct vconsole *vconsole_current;
-struct vconsole *vconsole_head;
-struct vconsole *vconsole_default;
-struct cfdriver rpc_cd;
-extern struct vconsole *debug_vc; /* rename this to vconsole_debug */
-int physcon_major=4;
-static char undefined_string[] = "UNDEFINED";
-int lastconsole;
-static int printing=0;
-static int want_switch=-1;
-
-/*
- * Prototypes
- */
-
-int physcon_switch __P((u_int /*number*/));
-void physconstart __P((struct tty */*tp*/));
-static struct vconsole *vconsole_spawn __P((dev_t , struct vconsole *));
-int physconparam __P((struct tty */*tp*/, struct termios */*t*/));
-void consinit __P((void));
-int physcon_switchup __P((void));
-int physcon_switchdown __P((void));
-
-/*
- * Exported variables
- */
-
-#define BLANKINIT (10*60*60)
-int vconsole_pending=0;
-int vconsole_blankinit=BLANKINIT;
-int vconsole_blankcounter=BLANKINIT;
-
-/*
- * Now list all my render engines and terminal emulators
- */
-
-extern struct render_engine vidcconsole;
-extern struct terminal_emulator vt220;
-
-/*
- * These find functions should move the console it finds to the top of
- * the list to achieve a caching type of operation. A doubly
- * linked list would be faster methinks.
- */
-
-struct tty *
-find_tp(dev)
- dev_t dev;
-{
- struct vconsole *vc;
- struct vconsole *last=0;
- int unit = minor (dev);
- int s;
-
- s = spltty();
- for (vc=vconsole_head; vc != NULL; vc=vc->next) {
- if (vc->number==unit) {
- if (vc != vconsole_head) {
- last->next = vc->next;
- vc->next = vconsole_head;
- vconsole_head = vc;
- }
- (void)splx(s);
- return vc->tp;
- }
- last = vc;
- }
- (void)splx(s);
- return NULL;
-}
-
-struct vconsole *
-find_vc(dev)
- dev_t dev;
-{
- struct vconsole *vc;
- struct vconsole *last=NULL;
- int unit = minor (dev);
- int s;
-
- s = spltty();
-
- for (vc=vconsole_head; vc!=NULL; vc=vc->next) {
- if (vc->number==unit) {
- if (vc!=vconsole_head) {
- last->next = vc->next;
- vc->next = vconsole_head;
- vconsole_head = vc;
- }
- (void)splx(s);
- return vc;
- }
- last=vc;
- }
- (void)splx(s);
- return NULL;
-}
-
-struct tty *console_tty = NULL;
-
-/*
- * Place a graphics driver under virtual console switching control.
- */
-
-struct vconsole *
-vconsole_spawn_re(dev, vc)
- dev_t dev;
- struct vconsole *vc;
-{
- struct vconsole *new;
- register int num = minor(dev);
-
- MALLOC(new, struct vconsole *, sizeof(struct vconsole),
- M_DEVBUF,M_NOWAIT );
-
- bzero ( (char *)new, sizeof(struct vconsole) );
- *new = *vc;
- new->number = num;
- new->next = vconsole_head;
- new->tp = vc->tp; /* Implied */
- new->data=0;
- new->t_scrolledback=0;
- new->r_scrolledback=0;
- new->r_data=0;
- new->flags=LOSSY;
- new->vtty = 0;
- vconsole_head = new;
- new->R_INIT ( new );
- new->SPAWN ( new );
- new->data = 0;
- /*new->charmap = 0;*/
- new->flags=LOSSY;
- new->proc = curproc;
- new->vtty = 0;
- return new;
-}
-
-static struct vconsole *
-vconsole_spawn(dev, vc)
- dev_t dev;
- struct vconsole *vc;
-{
- struct vconsole *new;
- register int num = minor(dev);
-
- if ( find_vc ( dev ) != 0 )
- return 0;
-
- MALLOC(new, struct vconsole *, sizeof(struct vconsole),
- M_DEVBUF, M_NOWAIT );
-
- bzero ( (char *)new, sizeof(struct vconsole) );
- *new = *vc;
- new->number = num;
- new->next = vconsole_head;
- new->tp=NULL;
- new->opened=0;
- new->data=0;
- new->t_scrolledback=0;
- new->r_scrolledback=0;
- new->r_data=0;
- new->vtty = 1;
- vconsole_head = new;
- new->R_INIT ( new );
- new->FLASH ( new, 1 );
- new->CURSOR_FLASH ( new, 1 );
- new->SPAWN ( new );
- new->vtty = 1;
-
- MALLOC (new->charmap, int *, sizeof(int)*((new->xchars)*(new->ychars)),
- M_DEVBUF, M_NOWAIT );
-
- if (new->charmap==0)
- return 0;
- {
- int counter=0;
- for ( counter=0; counter<((new->xchars)*(new->ychars)); counter++ )
- (new->charmap)[counter]=' ';
- }
- new->TERM_INIT ( new );
- new->proc = curproc;
- return new;
-}
-
-void
-vconsole_addcharmap(vc)
- struct vconsole *vc;
-{
- int counter=0;
-
- MALLOC (vc->charmap, int *, sizeof(int)*((vc->xchars)*(vc->ychars)),
- M_DEVBUF, M_NOWAIT );
- for ( counter=0; counter<((vc->xchars)*(vc->ychars)); counter++ )
- (vc->charmap)[counter]=' ';
-}
-
-int
-physconopen(dev, flag, mode, p)
- dev_t dev;
- int flag;
- int mode;
- struct proc *p;
-{
- struct vconsole *new;
-
- struct vconsole *vc;
- int unit = minor(dev);
- int found=0;
- int majorhack=0;
- int ret;
-
- /*
- * To allow the raw consoles a permanat hook for ioctls
- * Spawning another virtual console will actuall configure it
- */
-
- if ( unit >= NVT ) {
- if ( find_vc(dev)==0 )
- return ENXIO;
- }
-/*
- if (unit >= rpc_cd.cd_ndevs || !rpc_cd.cd_devs[unit])
- return ENXIO;
-*/
-
- /* If this virtual console is the real virtual console and hasn't got */
- /* a charmap then to allocate it one. We can be sure addcharmap works */
- /* here since this is the open routine. This is incase the console */
- /* was initialised before the system was brought up */
-
- if ((unit==0)&&(vconsole_master->charmap==0)) {
- if (vconsole_master==vconsole_current)
- majorhack=1;
- vconsole_addcharmap ( vconsole_master );
- vconsole_master->flags &= ~LOSSY;
- }
-
- /* Check to see if this console has already been spawned */
-
- for ( vc = vconsole_head; vc!=NULL; vc=vc->next ) {
- if ( vc->number == unit ) {
- found=1;
- break;
- }
- }
-
- /* Sanity check. If we have no default console, set it to the master one */
-
- if ( vconsole_default==0 )
- vconsole_default = vconsole_master;
-
- /* Ensure we have a vconsole structure. Allocate one if we dont already */
-
- if (found==0)
- new = vconsole_spawn ( dev, vconsole_default );
- else
- new = vc;
-
- new->proc = p;
-
- /* Initialise the terminal subsystem for this device */
-
-#define TP (new->tp)
-
- if (TP == NULL)
- TP = ttymalloc();
-
- physcon_tty[unit] = TP;
-
- TP->t_oproc = physconstart;
- TP->t_param = physconparam;
- TP->t_dev = dev;
- if ((TP->t_state & TS_ISOPEN) == 0) {
- TP->t_state |= TS_WOPEN;
- ttychars(TP);
- TP->t_iflag = TTYDEF_IFLAG;
- TP->t_oflag = TTYDEF_OFLAG;
- TP->t_cflag = TTYDEF_CFLAG;
- TP->t_lflag = TTYDEF_LFLAG;
- TP->t_ispeed = TP->t_ospeed = TTYDEF_SPEED;
- physconparam(TP, &TP->t_termios);
- ttsetwater(TP);
- } else if (TP->t_state&TS_XCLUDE && p->p_ucred->cr_uid != 0)
- return EBUSY;
- TP->t_state |= TS_CARR_ON;
-
- new->opened=1;
-
- TP->t_winsize.ws_col = new->xchars;
- TP->t_winsize.ws_row = new->ychars;
- ret = ((*linesw[TP->t_line].l_open)(dev, TP));
-
- if ( majorhack==1 ) {
- struct vconsole *vc_store;
- int counter;
- int end;
- int lines;
- int xs;
-
- end = msgbufp->msg_bufx-1;
- if (end>=MSG_BSIZE) end-=MSG_BSIZE;
-
- /*
- * Try some cute things. Count the number of lines in the msgbuf
- * then scroll the real screen up, just to fit the msgbuf on the
- * screen, then sink all output, and spew the msgbuf to the
- * new consoles charmap!
- */
-
- lines = 0; xs=0;
-
- for (counter=0;counter<end;counter++) {
- xs++;
- if (*((msgbufp->msg_bufc)+counter)==0x0a) {
- if (xs>vc->xchars) lines++;
- lines++;
- xs=0;
- }
- }
-
- if ( lines < vc->ychars ) {
- counter=vc->ycur;
- while ( (counter--) > lines )
- new->PUTSTRING ( "\x0a", 1, new );
- }
-
- new->SLEEP(new);
-
- vc_store = vconsole_current;
- vconsole_current = 0; /* !!! */
-
- /* HAHA, cant do this */
- /* new->CLS ( new ); */
-
- new->PUTSTRING ( "\x0c", 1, new );
-
- /*
- * Hmmm, I could really pass the whole damn thing to putstring
- * since it doesn't have zeros, but I need to do the crlf
- * conversion
- */
-
- xs=0;
-
- if ( end < 0 )
- panic ( "msgbuf trashed reboot and try again" );
-
- for (counter=0;counter<end;counter++) {
- if (*((msgbufp->msg_bufc)+counter)==0x0a) {
- new->PUTSTRING ( "\x0d", 1, new );
- xs=0;
- }
- if ( (xs++)<new->xchars )
- new->PUTSTRING ((msgbufp->msg_bufc)+counter, 1, new );
- }
- vconsole_master->ycur = lines;
- vconsole_current = vc_store;
- new->WAKE(new);
- vconsole_current->xcur = 0;
-
- printf ( "\x0a" );
- }
-
- return(ret);
-}
-
-/*
- * int physconclose(dev_t dev, int flag, int mode, struct proc *p)
- *
- * Close the physical console
- */
-
-int
-physconclose(dev, flag, mode, p)
- dev_t dev;
- int flag;
- int mode;
- struct proc *p;
-{
- register struct tty *tp;
-
- tp = find_tp ( dev );
- if (tp == NULL) {
- printf("physconclose: tp=0 dev=%04x\n", dev);
- return(ENXIO);
- }
- (*linesw[tp->t_line].l_close)(tp, flag);
- ttyclose(tp);
-
- return(0);
-}
-
-int
-physconread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- register struct tty *tp = find_tp ( dev );
- if (tp == NULL) {
- printf("physconread: tp=0 dev=%04x\n", dev);
- return(ENXIO);
- }
- return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
-}
-
-int
-physconwrite(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- register struct tty *tp;
-
- tp = find_tp(dev);
-
- if (tp == NULL) {
- printf("physconwrite: tp=0 dev=%04x\n", dev);
- return(ENXIO);
- }
-
- return((*linesw[tp->t_line].l_write)(tp, uio, flag));
-}
-
-struct tty *
-physcontty(dev)
- dev_t dev;
-{
- return(find_tp(dev));
-}
-
-int ioctlconsolebug;
-
-int
-physconioctl(dev, cmd, data, flag, p)
- dev_t dev;
- int cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- struct vconsole vconsole_new;
- struct tty *tp=(struct tty *)0xDEADDEAD ;
- int error;
- int s;
- struct vconsole *vc = find_vc(dev);
-
- ioctlconsolebug = cmd;
-
- tp = find_tp(dev);
-
- if ((vc==0)||(tp==0))
- return ENXIO;
-
- switch ( cmd ) {
- case CONSOLE_SWITCHUP:
- physcon_switchup ();
- return 0;
- case CONSOLE_SWITCHDOWN:
- physcon_switchdown ();
- return 0;
- case CONSOLE_SWITCHTO:
- if (!physcon_switch ( *(int *)data ))
- return 0;
- else
- return EINVAL;
- case CONSOLE_SWITCHPREV:
- physcon_switch ( lastconsole );
- return 0;
- case CONSOLE_CREATE:
- if ( vconsole_spawn ( makedev ( physcon_major, *(int *)data ),
- vconsole_default ) == 0 )
- return ENOMEM;
- else
- return 0;
- break;
-
- case CONSOLE_RENDERTYPE:
- strncpy ( (char *)data, vc->T_NAME, 20 );
- return 0;
-
- case CONSOLE_TERMTYPE:
- strncpy ( (char *)data, vc->T_NAME, 20 );
- return 0;
-
- case CONSOLE_LOCK:
- s = spltty();
- locked++;
- (void)splx(s);
- return 0;
- case CONSOLE_UNLOCK:
- s = spltty();
- locked--;
- if ( locked<0 )
- locked=0;
- (void)splx(s);
- return 0;
- case CONSOLE_SPAWN_VIDC:
-/*
- vconsole_new = *vconsole_default;
-*/
- vconsole_new = *vc;
- vconsole_new.render_engine = &vidcconsole;
- if ( vconsole_spawn_re (
- makedev ( physcon_major, *(int *)data ),
- &vconsole_new ) == 0 )
- return ENOMEM;
- else
- return 0;
-
- case CONSOLE_GETVC:
- {
-/* struct vconsole *vc_p;
- vc_p = find_vc(dev);
- *(int *)data = vc_p->number;*/
- *(int *)data = vconsole_current->number;
- return 0;
- }
-
- case CONSOLE_CURSORFLASHRATE:
- vc->CURSORFLASHRATE ( vc, *(int *)data );
- return 0;
-
- case CONSOLE_BLANKTIME:
- vconsole_blankinit = *(int *)data;
- return 0;
-
- case CONSOLE_DEBUGPRINT:
- {
- struct vconsole *vc_p;
-
- vc_p = find_vc(makedev(physcon_major,*(int*)data));
- if (vc_p==0) return EINVAL;
- printf ( "DEBUGPRINT for console %d\n", *(int*)data );
- printf ( "flags %08x vtty %01x\n", vc_p->flags, vc_p->vtty );
- printf ( "TTY INFO - winsize (%d, %d)\n",
- vc_p->tp->t_winsize.ws_col,
- vc_p->tp->t_winsize.ws_row);
- vc_p->R_DEBUGPRINT ( vc_p );
- vc_p->T_DEBUGPRINT ( vc_p );
- return 0;
- }
-
- default:
- error = vc->IOCTL ( vc, dev, cmd, data, flag, p );
- if ( error >=0 )
- return error;
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
- if (error >= 0)
- return error;
- error = ttioctl(tp, cmd, data, flag, p);
- if (error >= 0)
- return error;
- }
- return(ENOTTY);
-}
-
-int
-physconmmap(dev, offset, nprot)
- dev_t dev;
- int offset;
- int nprot;
-{
- struct vconsole *vc = find_vc(dev);
- u_int physaddr;
-
- if (minor(dev) < 64) {
- log(LOG_WARNING, "You should no longer use ttyv to mmap a frame buffer\n");
- log(LOG_WARNING, "For vidc use /dev/vidcvideo0\n");
- }
- physaddr = vc->MMAP(vc, offset, nprot);
- return(physaddr);
-}
-
-/*
- * Perform output on specified tty stream
- */
-
-void
-physconstart(tp)
- struct tty *tp;
-{
- int s, len;
- struct clist *cl;
- struct vconsole *vc;
- u_char buf[128];
-
- s = spltty();
-
- vc = find_vc ( tp->t_dev );
-
- /* Are we ready to perform output */
-
- if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP)) {
- (void)splx(s);
- return;
- }
-
- tp->t_state |= TS_BUSY;
-
- /* Fill our buffer with the data to print */
-
- cl = &tp->t_outq;
-
- if ( vc->r_scrolledback ) vc->R_SCROLLBACKEND ( vc );
- if ( vc->t_scrolledback ) vc->T_SCROLLBACKEND ( vc );
-
- (void)splx(s);
-
- /* Apparently we do this out of spl since it _IS_ fairly expensive */
- /* and it stops the serial ports overflowing */
-
- while ( (len = q_to_b(cl, buf, 128)) ) {
- if ( vc!=NULL )
- vc->PUTSTRING(buf, len, vc);
- }
-
- s = spltty ();
-
- tp->t_state &= ~TS_BUSY;
-
- if (cl->c_cc) {
- tp->t_state |= TS_TIMEOUT;
- timeout_add(&tp->t_rstrt_to, 1);
- }
-
- if (cl->c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup(cl);
- }
- selwakeup(&tp->t_wsel);
- }
-
- if ( want_switch != -1 ) {
- physcon_switch ( want_switch );
- want_switch=-1;
- }
-
- (void)splx(s);
-}
-
-int
-physconparam(tp, t)
- struct tty *tp;
- struct termios *t;
-{
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- tp->t_cflag = t->c_cflag;
- return(0);
-}
-
-void
-physconstop(tp, flag)
- struct tty *tp;
- int flag;
-{
- /* Nothing necessary */
-}
-
-int
-physconkbd(key)
- int key;
-{
- char *string;
- register struct tty *tp;
- int s;
-
- s = spltty();
-
- tp = vconsole_current->tp;
-
- if (tp == NULL) return(1);
-
- if ((tp->t_state & TS_ISOPEN) == 0) {
- (void)splx(s);
- return(1);
- }
-
- if (key < 0x100)
- (*linesw[tp->t_line].l_rint)(key, tp);
- else {
- switch (key) {
- case 0x100:
- string = "\x1b[A";
- break;
- case 0x101:
- string = "\x1b[B";
- break;
- case 0x102:
- string = "\x1b[D";
- break;
- case 0x103:
- string = "\x1b[C";
- break;
- case 0x104:
- string = "\x1b[6~";
- break;
- case 0x105:
- string = "\x1b[5~";
- break;
- case 0x108:
- string = "\x1b[2~";
- break;
- case 0x109:
- string = "\x7f";
- break;
- default:
- string = "";
- break;
- }
- while (*string != 0) {
- (*linesw[tp->t_line].l_rint)(*string, tp);
- ++string;
- }
- }
- (void)splx(s);
- return(0);
-}
-
-static int physconinit_called = 0;
-
-void
-physconinit(cp)
- struct consdev *cp;
-{
- int *test;
- int counter;
-
- /*
- * Incase we're called more than once. All routines below here
- * undergo once time initialisation
- */
-
- if ( physconinit_called )
- return;
-
- physconinit_called=1;
-
- locked=0;
-
- physcon_major = major ( cp->cn_dev );
-
- /*
- * Create the master console
- */
-
- vconsole_master->next = NULL;
- vconsole_master->number = 0;
- vconsole_master->opened = 1;
- vconsole_master->tp = NULL;
-
- /*
- * Right, here I can choose some render routines
- */
-
- vconsole_master->render_engine = &vidcconsole;
- vconsole_master->terminal_emulator = &vt220;
-
- /*
- * We will very soon loose the master console, and number 0 will
- * become the current console so as not to waste a struct vconsole
- */
- vconsole_current = vconsole_head = vconsole_master;
- vconsole_master->data = NULL;
- vconsole_master->vtty = 1;
-
- /*
- * Perform initial checking
- */
-
- if ( vconsole_master->terminal_emulator->name == 0 )
- vconsole_master->terminal_emulator->name = undefined_string;
- if ( vconsole_master->render_engine->name == 0 )
- vconsole_master->render_engine->name = undefined_string;
-
- /*
- * Right, I have to assume the init and print procedures are ok
- * or there's nothing else that can be done
- */
-
- vconsole_master->R_INIT ( vconsole_master);
- vconsole_master->SPAWN ( vconsole_master );
- vconsole_master->TERM_INIT (vconsole_master);
- vconsole_master->flags = LOSSY;
-
- /*
- * Now I can do some productive verification
- */
-
- /* Ensure there are no zeros in the termulation and render_engine */
-
- test = (int *) vconsole_master->render_engine;
- for ( counter=0; counter<(sizeof(struct render_engine)/4)-1; counter++ )
- if (test[counter]==0)
- panic ( "Render engine %i is missins a routine",
- vconsole_master->render_engine->name );
-
- test = (int *) vconsole_master->terminal_emulator;
- for ( counter=0; counter<(sizeof(struct terminal_emulator)/4)-1; counter++ )
- if (test[counter]==0)
- panic ( "Render engine %i is missing a routine",
- vconsole_master->terminal_emulator->name );
-}
-
-/*
- * void physconputstring(char *string, int length)
- *
- * Render a string on the physical console
- */
-
-void
-physconputstring(string, length)
- char *string;
- int length;
-{
- vconsole_current->PUTSTRING(string, length, vconsole_current);
-}
-
-/*
- * void physcongetchar(void)
- *
- * Get a character from the physical console
- */
-
-int getkey_polled __P(());
-
-char
-physcongetchar(void)
-{
- return(getkey_polled());
-}
-
-void
-consinit(void)
-{
- static int consinit_called = 0;
-
- if (consinit_called != 0)
- return;
-
- consinit_called = 1;
- cninit();
-
-/* Ok get our start up message in early ! */
-
- printf("\x0cRiscBSD booting...\n%s\n", version);
-}
-
-void
-rpcconsolecnprobe(cp)
- struct consdev *cp;
-{
- int major;
-
-/* printf("rpcconsoleprobe: pc=%08x\n", cp);*/
-
-/*
- * Locate the major number for the physical console device
- * We do this by searching the character device list until we find
- * the device with the open function for the physical console
- */
-
- for (major = 0; major < nchrdev; ++major) {
- if (cdevsw[major].d_open == physconopen)
- break;
- }
-
-/* Initialise the required fields */
-
- cp->cn_dev = makedev(major, 0);
- cp->cn_pri = CN_INTERNAL;
-}
-
-#define RPC_BUF_LEN (64)
-char rpc_buf[RPC_BUF_LEN];
-int rpc_buf_ptr = 0;
-
-#define RPC_BUF_FLUSH \
-{ \
- vconsole_current->PUTSTRING ( rpc_buf, rpc_buf_ptr, vconsole_current ); \
- rpc_buf_ptr=0; \
-}
-
-void
-rpcconsolecninit(cp)
- struct consdev *cp;
-{
- physconinit(cp); /* woo Woo WOO!!!, woo, woo, yes ok bye */
-}
-
-void
-rpcconsolecnputc(dev, character)
- dev_t dev;
- char character;
-{
- extern int cold;
-
- if (( rpc_buf_ptr==RPC_BUF_LEN ) || (cold==0) )
- RPC_BUF_FLUSH
-
- rpc_buf[rpc_buf_ptr++] = character;
-
- if ((character == 0x0a )||(character==0x0d)||(character=='.'))
- RPC_BUF_FLUSH
-}
-
-int
-console_switchdown()
-{
- physcon_switchdown ();
- return 0;
-}
-
-int
-console_switchup()
-{
- physcon_switchup ();
- return 0;
-}
-
-int
-console_unblank()
-{
- vconsole_blankcounter = vconsole_blankinit;
- vconsole_current->BLANK ( vconsole_current, BLANK_NONE );
- return 0;
-}
-
-int
-console_scrollback ()
-{
- if (vconsole_current==NULL)
- return 0;
- if ( vconsole_current->R_SCROLLBACK(vconsole_current) ==-1 ) {
- if ( vconsole_current->T_SCROLLBACK(vconsole_current)==-1 ) {
- }
- }
- return 0;
-}
-
-int
-console_scrollforward ()
-{
- if (vconsole_current==NULL)
- return 0;
- if ( vconsole_current->R_SCROLLFORWARD(vconsole_current) ==-1 ) {
- if ( vconsole_current->T_SCROLLFORWARD(vconsole_current)==-1 ) {
- }
- }
- return 0;
-}
-
-int
-console_switchlast ()
-{
- return (physcon_switch ( lastconsole ));
-}
-
-int
-physcon_switchdown ()
-{
- int start;
- int next = (vconsole_current->number);
- start=next;
- do {
- next--;
- next = next&0xff;
- if (next==start) return 0;
- } while (physcon_switch ( next ));
- return 0;
-}
-
-int
-physcon_switchup ()
-{
- int start;
- int next = (vconsole_current->number);
- start=next;
- do {
- next++;
- next = next&0xff;
- if (next==start) return 0;
- } while (physcon_switch ( next ));
- return 0;
-}
-
-void
-console_switch(number)
- u_int number;
-{
- physcon_switch ( number );
-}
-
-/* switchto */
-int
-physcon_switch(number)
- u_int number;
-{
- register struct vconsole *vc;
- int s = spltty ();
- int ret;
-
- if ( locked!=0 ) {
- ret=0;
- goto out;
- }
-
- if ( printing ) {
- want_switch = number;
- ret=0;
- goto out;
- }
-
- vc = find_vc ( makedev ( physcon_major, number ) );
-
- if ( vc==0 ) {
- ret = 1;
- goto out;
- }
-
- if ( vc==vconsole_current ) {
- ret = 1;
- goto out;
- }
-
- /* Point of no return */
-
- locked++; /* We cannot reenter this routine now */
-
- /* De-activate the render engine functions */
- if ( vconsole_current->vtty==1 ) {
- vconsole_current->SLEEP(vconsole_current);
- vconsole_current->FLASH ( vc, 0 );
- vconsole_current->CURSOR_FLASH ( vc, 0 );
- }
-
- /* Swap in the new consoles state */
-
- lastconsole = vconsole_current->number;
- vconsole_current=vc;
- vconsole_current->R_SWAPIN ( vc );
-
- /* Re-activate the render engine functions */
-
- if ( vconsole_current->vtty==1 ) {
- vconsole_current->T_SWAPIN ( vc );
- vconsole_current->WAKE(vconsole_current);
- vconsole_current->FLASH ( vc, 1 );
- vconsole_current->CURSOR_FLASH ( vc, 1 );
- }
-
- locked--;
-
- /* Tell the process about the switch, like the X server */
-
- if ( vc->proc )
- psignal ( vc->proc, SIGIO );
-
- ret = 0;
-out:
- (void)splx(s);
- return(ret);
-}
-
-char
-rpcconsolecngetc(dev)
- dev_t dev;
-{
- return( physcongetchar () );
-}
-
-void
-rpcconsolecnpollc(dev, on)
- dev_t dev;
- int on;
-{
- RPC_BUF_FLUSH
-}
-
-int
-rpcprobe(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
-{
- return(1);
-}
-
-void
-rpcattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- printf(" riscbsd generic console driver %susing %s %s\n",
- CONSOLE_VERSION, vconsole_master->terminal_emulator->name,
- vconsole_master->render_engine->name);
-
- vconsole_master->T_ATTACH(vconsole_master, parent, self, aux);
- vconsole_master->R_ATTACH(vconsole_master, parent, self, aux);
-}
-
-/*
-struct cfattach rpc_ca = {
- sizeof(struct device), rpcprobe, rpcattach
-};
-
-struct cfdriver rpc_cd = {
- NULL, "rpc", DV_TTY
-};
-*/
-
-struct cfattach vt_ca = {
- sizeof(struct device), rpcprobe, rpcattach
-};
-
-struct cfdriver vt_cd = {
- NULL, "rpc", DV_TTY
-};
-
-extern struct terminal_emulator vt220;
-
-struct render_engine *render_engine_tab[] = {
- &vidcconsole,
-};
-
-struct terminal_emulator *terminal_emulator_tab[] = {
- &vt220,
-};
diff --git a/sys/arch/arm32/dev/console/debugconsole.c b/sys/arch/arm32/dev/console/debugconsole.c
deleted file mode 100644
index 2fc947b4c2c..00000000000
--- a/sys/arch/arm32/dev/console/debugconsole.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* $NetBSD: debugconsole.c,v 1.2 1996/03/18 19:33:04 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1995 Melvyn Tang-Richardson
- * Copyright (c) 1994-1995 RiscBSD kernel team
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD kernel team
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE RISCBSD TEAM ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * debugconsole.c
- *
- * Console functions
- *
- * Created : 17/09/94
- */
-
-#ifdef DEBUGTERM
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/tty.h>
-#include <machine/stdarg.h>
-#include <machine/vconsole.h>
-
-#define TOTTY 0x02
-
-/*
- * This code allows the kernel developer to have a 'nice' virtual
- * console for debugging information.
- *
- * It is more useful than say, printf since the output is
- *
- * a) isolated
- *
- */
-
-struct vconsole *debug_vc=0;
-struct tty *debug_tty=0;
-
-void
-dprintf(fmt, va_alist)
- char *fmt;
-{
- if ( debug_vc==0 )
- return;
-
- dumb_putstring ( fmt, strlen(fmt), debug_vc );
-/*
- va_list *ap;
-
- if ( debug_tty == NULL )
- return;
-
- va_start(ap, fmt);
- kprintf(fmt, TOTTY, debug_tty, ap);
- va_end(ap);
-*/
-}
-
-#endif
-
diff --git a/sys/arch/arm32/dev/console/dumb.c b/sys/arch/arm32/dev/console/dumb.c
deleted file mode 100644
index 40396cbf70b..00000000000
--- a/sys/arch/arm32/dev/console/dumb.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/* $NetBSD: dumb.c,v 1.2 1996/03/18 19:33:05 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1995 Melvyn Tang-Richardson
- * Copyright (c) 1994-1995 RiscBSD kernel team
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD kernel team
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE RISCBSD TEAM ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * dumb.c
- *
- * Console functions
- *
- * Created : 17/09/94
- */
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-#include <machine/param.h>
-#include <machine/katelib.h>
-#include <machine/cpu.h>
-#include <machine/bootconfig.h>
-#include <machine/iomd.h>
-#include <machine/vidc.h>
-#include <machine/vconsole.h>
-
-#define TERMTYPE_PUTSTRING dumb_putstring
-#define TERMTYPE_INIT dumb_init
-
-int
-TERMTYPE_INIT(vc)
- struct vconsole *vc;
-{
- /* This dumb termial is so dumb it requires very little init */
- return 0;
-}
-
-static void
-do_scrollup(vc)
- struct vconsole *vc;
-{
-
- if (vc==vconsole_current)
- vc->SCROLLUP ( vc, 0, vc->ychars-1 );
-
- vc->ycur=vc->ychars-1;
-
- if ( ((vc->flags)&(LOSSY)) == 0 ) {
- int counter;
- for ( counter=vc->xchars; counter < ((vc->ychars)*(vc->xchars)); counter++ ) {
- vc->charmap[counter-vc->xchars] = vc->charmap[counter];
- }
- for ( counter=vc->xchars*(vc->ychars-1); counter < (vc->xchars*vc->ychars); counter++ ) {
- vc->charmap[counter]=0x20;
- }
- }
-}
-
-static int
-do_render(c, vc)
- char c;
- struct vconsole *vc;
-{
- /* THE RENDER STAGE **********************************/
- if ((c>=0x20)&&(c<=0x7f)) {
- if (((vc->flags)&(LOSSY))==0) {
- vc->charmap[ vc->xcur + vc->ycur*vc->xchars ] = c | 7<<8;
- }
-
- if ( vc==vconsole_current )
- vc->RENDER ( vc, c );
-
- vc->xcur++;
- }
-
- if ( vc->xcur >= vc->xchars ) {
- vc->xcur=0;
- vc->ycur++;
- }
-
- if ( vc->ycur >= vc->ychars ) {
- do_scrollup ( vc );
- vc->xcur=0;
- vc->ycur=vc->ychars-1;
- }
-}
-
-int
-TERMTYPE_PUTSTRING(string, length, vc)
- char *string;
- int length;
- struct vconsole *vc;
-{
- char c;
-
- while ( ((c=*(string++))!=0) && ((length--)>0)) {
- if ((c<31)||(c>127)) c='*';
- switch (c) {
- case 0x0a:
- vc->ycur++;
- if ( vc->ycur>=vc->ychars ) {
- do_scrollup ( vc );
- vc->ycur=vc->ychars-1;
- }
- break;
-
- case 0x0d:
- vc->xcur=0;
- break;
-
- default:
- do_render ( c, vc );
- break;
- }
- }
-}
diff --git a/sys/arch/arm32/dev/console/fonts/font_bold.h b/sys/arch/arm32/dev/console/fonts/font_bold.h
deleted file mode 100644
index f3a792f24f5..00000000000
--- a/sys/arch/arm32/dev/console/fonts/font_bold.h
+++ /dev/null
@@ -1,265 +0,0 @@
-/* $OpenBSD: font_bold.h,v 1.2 2000/03/03 00:54:47 todd Exp $ */
-/* $NetBSD: font_bold.h,v 1.1 1996/01/31 23:20:07 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * font_terminal14_bold.h
- *
- * Font for physical console driver
- *
- * Created : 18/09/94
- * Last updated : 15/10/94
- *
- * Based on kate/display/14bold.h
- *
- */
-
-unsigned char font_terminal_14bold_data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x24, 0x24, 0x7e, 0x7e, 0x24, 0x7e, 0x7e, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0x0c, 0x38, 0x60, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x6c, 0x76, 0x3c, 0x30, 0x18, 0x78, 0xdc, 0x6c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x18, 0x34, 0x34, 0x98, 0x7c, 0x66, 0x66, 0xbc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x60, 0x30, 0x30, 0x18, 0x18, 0x18, 0x18, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x18, 0x18, 0x0c, 0x0c, 0x06, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x54, 0x38, 0xfe, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x66, 0x66, 0x66, 0x66, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x18, 0x1c, 0x1a, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x70, 0x38, 0x1c, 0x0e, 0x66, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x38, 0x60, 0x60, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x70, 0x68, 0x64, 0x66, 0xfe, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3e, 0x06, 0x06, 0x3e, 0x60, 0x60, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x06, 0x06, 0x3e, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7c, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x00, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x60, 0x30, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7c, 0x8e, 0xe6, 0xb6, 0xb6, 0xe6, 0x0e, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x3e, 0x66, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x06, 0x06, 0x06, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7c, 0x0c, 0x0c, 0x3c, 0x0c, 0x0c, 0x0c, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7c, 0x0c, 0x0c, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x06, 0x76, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xc6, 0x66, 0x36, 0x1e, 0x1e, 0x36, 0x66, 0xc6, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x6e, 0x6e, 0x76, 0x76, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x76, 0x3c, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66, 0x3e, 0x36, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x06, 0x3e, 0x7c, 0x60, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0x7c, 0x28, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x3c, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7e, 0x60, 0x70, 0x38, 0x1c, 0x0e, 0x06, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x7c, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x06, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x7e, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x0c, 0x3e, 0x0c, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x3c, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x1c, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x1e, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x66, 0x36, 0x1e, 0x1e, 0x36, 0x66, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x1c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0xd6, 0xd6, 0xd6, 0xd6, 0xc6, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x06, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xcc, 0x0c, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x46, 0x3e, 0x7c, 0x62, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x3e, 0x0c, 0x0c, 0x0c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x2c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x3c, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x70, 0x38, 0x1c, 0x0e, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x70, 0x18, 0x18, 0x30, 0x1c, 0x30, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x0e, 0x18, 0x18, 0x0c, 0x38, 0x0c, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x4c, 0x7e, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xfc, 0x36, 0x36, 0x76, 0x36, 0x36, 0x36, 0xfc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xd6, 0xf6, 0x16, 0xd6, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x66, 0x66, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x3c, 0x66, 0x06, 0x66, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x78, 0x4c, 0x0c, 0x3e, 0x0c, 0x0c, 0xde, 0x7a, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x38, 0x6c, 0x6c, 0x38, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x42, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x7e, 0x18, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x3c, 0x66, 0x0e, 0x3c, 0x66, 0x66, 0x3c, 0x70, 0x66, 0x3c, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7e, 0xc3, 0xdb, 0xcb, 0xcb, 0xdb, 0xc3, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x1c, 0x30, 0x3c, 0x36, 0x3c, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x6c, 0x36, 0x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x7e, 0x7e, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x3c, 0x7e, 0x81, 0x9d, 0xad, 0x9d, 0xad, 0x81, 0x7e, 0x3c, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x1c, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x1c, 0x32, 0x30, 0x1c, 0x06, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x1c, 0x32, 0x18, 0x30, 0x32, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0xfe, 0x06, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xfc, 0x5e, 0x5e, 0x5e, 0x5e, 0x5c, 0x58, 0x58, 0x58, 0x58, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x0c, 0x00, 0x00,
- 0x00, 0x00, 0x18, 0x1c, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x1c, 0x36, 0x36, 0x36, 0x1c, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x36, 0x6c, 0x36, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x0c, 0x0e, 0x8c, 0x4c, 0x3e, 0x10, 0x68, 0x74, 0x6a, 0xfd, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x0c, 0x0e, 0x8c, 0x4c, 0x3e, 0x10, 0x68, 0xd4, 0xc2, 0x61, 0x30, 0xf0, 0x00, 0x00, 0x00,
- 0x00, 0x0c, 0x1e, 0x98, 0x4c, 0x38, 0x1e, 0x6c, 0x74, 0x6a, 0xfd, 0x60, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x0c, 0x46, 0x66, 0x3c, 0x00, 0x00, 0x00,
- 0x00, 0x0c, 0x18, 0x00, 0x18, 0x3c, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x30, 0x18, 0x00, 0x18, 0x3c, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x18, 0x3c, 0x00, 0x18, 0x3c, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x5c, 0x3a, 0x00, 0x18, 0x3c, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x66, 0x66, 0x00, 0x18, 0x3c, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
- 0x18, 0x2c, 0x2c, 0x18, 0x18, 0x3c, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xfc, 0x36, 0x36, 0x76, 0x3e, 0x36, 0x36, 0xf6, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x06, 0x06, 0x06, 0x06, 0x66, 0x3c, 0x10, 0x18, 0x00, 0x00,
- 0x00, 0x18, 0x30, 0x00, 0x7c, 0x0c, 0x0c, 0x3c, 0x0c, 0x0c, 0x0c, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x60, 0x30, 0x00, 0x7c, 0x0c, 0x0c, 0x3c, 0x0c, 0x0c, 0x0c, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x18, 0x3c, 0x00, 0x7c, 0x0c, 0x0c, 0x3c, 0x0c, 0x0c, 0x0c, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x6c, 0x6c, 0x00, 0x7c, 0x0c, 0x0c, 0x3c, 0x0c, 0x0c, 0x0c, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x0c, 0x18, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x30, 0x18, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x18, 0x3c, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x66, 0x66, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x1c, 0x2c, 0x4c, 0x4c, 0x5e, 0x4c, 0x2c, 0x1c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x5c, 0x3a, 0x00, 0x66, 0x66, 0x6e, 0x6e, 0x76, 0x76, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x0c, 0x18, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x30, 0x18, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x18, 0x3c, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x5c, 0x3a, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x66, 0x66, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x80, 0x78, 0x6c, 0x6c, 0x7c, 0x7c, 0x6c, 0x6c, 0x3c, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x0c, 0x18, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x30, 0x18, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x18, 0x3c, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x66, 0x66, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x30, 0x18, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x1e, 0x0c, 0x3c, 0x6c, 0x6c, 0x3c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x36, 0x66, 0x66, 0x66, 0x36, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x30, 0x00, 0x3c, 0x60, 0x7c, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x30, 0x18, 0x00, 0x3c, 0x60, 0x7c, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x3c, 0x00, 0x3c, 0x60, 0x7c, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x58, 0x34, 0x00, 0x3c, 0x60, 0x7c, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x3c, 0x60, 0x7c, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x3c, 0x6e, 0x3c, 0x00, 0x3c, 0x60, 0x7c, 0x66, 0x66, 0xdc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xb2, 0xfc, 0x36, 0xb6, 0x6c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x06, 0x06, 0x66, 0x3c, 0x10, 0x18, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x0c, 0x18, 0x00, 0x3c, 0x66, 0x7e, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x30, 0x18, 0x00, 0x3c, 0x66, 0x7e, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x3c, 0x00, 0x3c, 0x66, 0x7e, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x3c, 0x66, 0x7e, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x0c, 0x18, 0x00, 0x1c, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x30, 0x18, 0x00, 0x1c, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x3c, 0x00, 0x1c, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x36, 0x36, 0x00, 0x1c, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x24, 0x18, 0x1c, 0x30, 0x7c, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x5c, 0x3a, 0x00, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x0c, 0x18, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x30, 0x18, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x3c, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x5c, 0x3a, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x7e, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0x6c, 0x7c, 0x7c, 0x6c, 0x3a, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x0c, 0x18, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x30, 0x18, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x3c, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x30, 0x18, 0x00, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x66, 0x3c, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0x3c, 0x6c, 0x6c, 0x6c, 0x6c, 0x3c, 0x0c, 0x0c, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x66, 0x3c, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa,
- 0x00, 0x00, 0x00, 0x08, 0x1c, 0x2a, 0x49, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x49, 0x2a, 0x1c, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0xff, 0x02, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, 0x40, 0xff, 0x40, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-font_struct font_terminal_14bold = {
- 199,
- 1,
- 16,
- 8,
- 16,
- 8,
- 16,
- 3184,
- font_terminal_14bold_data
-};
-
-/* End of font14bold.h */
diff --git a/sys/arch/arm32/dev/console/fonts/font_italic.h b/sys/arch/arm32/dev/console/fonts/font_italic.h
deleted file mode 100644
index dd9b00dedbe..00000000000
--- a/sys/arch/arm32/dev/console/fonts/font_italic.h
+++ /dev/null
@@ -1,265 +0,0 @@
-/* $OpenBSD: font_italic.h,v 1.2 2000/03/03 00:54:47 todd Exp $ */
-/* $NetBSD: font_italic.h,v 1.1 1996/01/31 23:20:13 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * font_terminal14_italic.h
- *
- * Font for physical console driver
- *
- * Created : 18/09/94
- * Last updated : 15/10/94
- *
- * Based on kate/display/14norm.h
- *
- */
-
-unsigned char font_terminal_14italic_data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x24, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x7e, 0x24, 0x7e, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x54, 0x18, 0x30, 0x54, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x24, 0x3a, 0x14, 0x10, 0x08, 0x28, 0x54, 0x24, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x14, 0x14, 0x08, 0x54, 0x22, 0x22, 0x5c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x54, 0x38, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x42, 0x42, 0x42, 0x42, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x18, 0x14, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x40, 0x20, 0x18, 0x04, 0x02, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x40, 0x38, 0x40, 0x40, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x30, 0x28, 0x24, 0x22, 0x7e, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7e, 0x02, 0x02, 0x3e, 0x42, 0x40, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x38, 0x04, 0x02, 0x3e, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7e, 0x40, 0x20, 0x10, 0x08, 0x08, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x3c, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x7c, 0x40, 0x20, 0x1c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x1c, 0x22, 0x20, 0x10, 0x08, 0x08, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x72, 0x4a, 0x4a, 0x72, 0x02, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3e, 0x42, 0x42, 0x3e, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x02, 0x02, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7c, 0x04, 0x04, 0x3c, 0x04, 0x04, 0x04, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7c, 0x04, 0x04, 0x3c, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x72, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x78, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x44, 0x24, 0x14, 0x0c, 0x0c, 0x14, 0x24, 0x44, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x82, 0xc6, 0xaa, 0xaa, 0x92, 0x92, 0x82, 0x82, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x42, 0x46, 0x4a, 0x4a, 0x52, 0x52, 0x62, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x4a, 0x52, 0x3c, 0x40, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x3e, 0x12, 0x22, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x3c, 0x40, 0x40, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x82, 0x92, 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xc6, 0x44, 0x28, 0x10, 0x10, 0x28, 0x44, 0xc6, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7e, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x1c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1c, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x40, 0x7c, 0x42, 0x42, 0xbc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x3a, 0x46, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x5c, 0x62, 0x42, 0x42, 0x42, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x7e, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x70, 0x08, 0x08, 0x3c, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x1c, 0x22, 0x22, 0x1c, 0x02, 0x3c, 0x42, 0x3c, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x3a, 0x46, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x18, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x1c, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x22, 0x12, 0x0e, 0x12, 0x22, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x18, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x92, 0x92, 0x92, 0x82, 0x82, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x46, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x46, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x42, 0x42, 0x42, 0x62, 0x5c, 0x40, 0x40, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x4c, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x3c, 0x40, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x3c, 0x08, 0x08, 0x08, 0x48, 0x30, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x62, 0x5c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x24, 0x18, 0x18, 0x24, 0x66, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x40, 0x42, 0x3c, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x20, 0x10, 0x08, 0x04, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x30, 0x08, 0x08, 0x10, 0x0c, 0x10, 0x08, 0x08, 0x08, 0x30, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x0c, 0x10, 0x10, 0x08, 0x30, 0x08, 0x10, 0x10, 0x10, 0x0c, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x4c, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xfc, 0x12, 0x12, 0x72, 0x12, 0x12, 0x12, 0xfc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x92, 0xf2, 0x12, 0x92, 0x6c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x24, 0x24, 0x00, 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10, 0x10, 0x38, 0x54, 0x14, 0x54, 0x38, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x30, 0x48, 0x48, 0x08, 0x08, 0x3c, 0x08, 0x8c, 0x76, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x44, 0x38, 0x44, 0x44, 0x44, 0x38, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x28, 0x7c, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x38, 0x44, 0x04, 0x38, 0x44, 0x44, 0x38, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7c, 0x82, 0xb2, 0x8a, 0x8a, 0xb2, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x10, 0x1c, 0x12, 0x1c, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x24, 0x12, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x7e, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7c, 0x82, 0x9a, 0xaa, 0x9a, 0xaa, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x10, 0x08, 0x04, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x10, 0x20, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x24, 0x24, 0x12, 0x12, 0x6d, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x7c, 0x2e, 0x2e, 0x2e, 0x2c, 0x28, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x18, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x0c, 0x08, 0x08, 0x08, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x12, 0x12, 0x0c, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x24, 0x48, 0x24, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x04, 0x06, 0x44, 0x24, 0x1e, 0x48, 0x64, 0x52, 0xf8, 0x40, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x04, 0x06, 0x44, 0x24, 0x1e, 0x68, 0x94, 0x42, 0x20, 0xf0, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0c, 0x12, 0x08, 0x52, 0x2c, 0x50, 0x68, 0x54, 0xfa, 0x40, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x10, 0x10, 0x10, 0x08, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00,
- 0x00, 0x08, 0x10, 0x00, 0x18, 0x24, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x10, 0x08, 0x00, 0x18, 0x24, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x18, 0x24, 0x00, 0x18, 0x24, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x4c, 0x32, 0x00, 0x18, 0x24, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x24, 0x24, 0x00, 0x18, 0x24, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x18, 0x24, 0x18, 0x18, 0x24, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xf8, 0x14, 0x14, 0x72, 0x1e, 0x12, 0x12, 0xf2, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x02, 0x02, 0x02, 0x42, 0x3c, 0x10, 0x08, 0x00, 0x00,
- 0x00, 0x08, 0x10, 0x00, 0x7c, 0x04, 0x04, 0x3c, 0x04, 0x04, 0x04, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x20, 0x10, 0x00, 0x7c, 0x04, 0x04, 0x3c, 0x04, 0x04, 0x04, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x30, 0x48, 0x00, 0x7c, 0x04, 0x04, 0x3c, 0x04, 0x04, 0x04, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x28, 0x00, 0x7c, 0x04, 0x04, 0x3c, 0x04, 0x04, 0x04, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x08, 0x10, 0x00, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x20, 0x10, 0x00, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x10, 0x28, 0x00, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x28, 0x00, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x38, 0x48, 0x48, 0x48, 0x5c, 0x48, 0x48, 0x38, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x4c, 0x32, 0x00, 0x42, 0x46, 0x4a, 0x4a, 0x52, 0x52, 0x62, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x08, 0x10, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x10, 0x08, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x18, 0x24, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x4c, 0x32, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x24, 0x24, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xbc, 0x42, 0x62, 0x52, 0x52, 0x4a, 0x46, 0x3e, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x08, 0x10, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x10, 0x08, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x18, 0x24, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x24, 0x24, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x30, 0x08, 0x00, 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0e, 0x04, 0x3c, 0x44, 0x44, 0x3c, 0x04, 0x0e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x26, 0x44, 0x44, 0x44, 0x34, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x3c, 0x40, 0x7c, 0x42, 0x42, 0xbc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x10, 0x00, 0x3c, 0x40, 0x7c, 0x42, 0x42, 0xbc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x24, 0x00, 0x3c, 0x40, 0x7c, 0x42, 0x42, 0xbc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x58, 0x34, 0x00, 0x3c, 0x40, 0x7c, 0x42, 0x42, 0xbc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x48, 0x48, 0x00, 0x3c, 0x40, 0x7c, 0x42, 0x42, 0xbc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x38, 0x44, 0x38, 0x00, 0x3c, 0x40, 0x7c, 0x42, 0x42, 0xbc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x90, 0xfc, 0x12, 0x92, 0x6c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x02, 0x42, 0x3c, 0x08, 0x04, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x3c, 0x42, 0x7e, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x10, 0x00, 0x3c, 0x42, 0x7e, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x24, 0x00, 0x3c, 0x42, 0x7e, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x24, 0x24, 0x00, 0x3c, 0x42, 0x7e, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x18, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10, 0x08, 0x00, 0x18, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x24, 0x00, 0x18, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x28, 0x28, 0x00, 0x18, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x12, 0x0c, 0x0c, 0x12, 0x3c, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x58, 0x34, 0x00, 0x3a, 0x46, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10, 0x08, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x24, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x58, 0x34, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x24, 0x24, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x7c, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7c, 0x62, 0x52, 0x4a, 0x46, 0x3e, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x42, 0x42, 0x42, 0x42, 0x62, 0x5c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10, 0x08, 0x00, 0x42, 0x42, 0x42, 0x42, 0x62, 0x5c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x24, 0x00, 0x42, 0x42, 0x42, 0x42, 0x62, 0x5c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x24, 0x24, 0x00, 0x42, 0x42, 0x42, 0x42, 0x62, 0x5c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x10, 0x00, 0xc6, 0x44, 0x44, 0x28, 0x30, 0x10, 0x12, 0x0c, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x04, 0x3c, 0x44, 0x44, 0x3c, 0x04, 0x0e, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x28, 0x28, 0x00, 0xc6, 0x44, 0x44, 0x28, 0x28, 0x10, 0x12, 0x0c, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa,
- 0x00, 0x00, 0x00, 0x08, 0x1c, 0x2a, 0x49, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x49, 0x2a, 0x1c, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0xff, 0x02, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, 0x40, 0xff, 0x40, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-font_struct font_terminal_14italic = {
- 199,
- 1,
- 16,
- 8,
- 16,
- 8,
- 16,
- 3184,
- font_terminal_14italic_data
-};
-
-/* End of font14norm.h */
diff --git a/sys/arch/arm32/dev/console/fonts/font_normal.h b/sys/arch/arm32/dev/console/fonts/font_normal.h
deleted file mode 100644
index dfe8c017061..00000000000
--- a/sys/arch/arm32/dev/console/fonts/font_normal.h
+++ /dev/null
@@ -1,265 +0,0 @@
-/* $OpenBSD: font_normal.h,v 1.2 2000/03/03 00:54:48 todd Exp $ */
-/* $NetBSD: font_normal.h,v 1.1 1996/01/31 23:20:16 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * font_terminal14_normal.h
- *
- * Font for physical console driver
- *
- * Created : 18/09/94
- * Last updated : 15/10/94
- *
- * Based on kate/display/14norm.h
- *
- */
-
-unsigned char font_terminal_14normal_data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x24, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x7e, 0x24, 0x7e, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x54, 0x18, 0x30, 0x54, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x24, 0x3a, 0x14, 0x10, 0x08, 0x28, 0x54, 0x24, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x14, 0x14, 0x08, 0x54, 0x22, 0x22, 0x5c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x54, 0x38, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x42, 0x42, 0x42, 0x42, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x18, 0x14, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x40, 0x20, 0x18, 0x04, 0x02, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x40, 0x38, 0x40, 0x40, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x30, 0x28, 0x24, 0x22, 0x7e, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7e, 0x02, 0x02, 0x3e, 0x42, 0x40, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x38, 0x04, 0x02, 0x3e, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7e, 0x40, 0x20, 0x10, 0x08, 0x08, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x3c, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x7c, 0x40, 0x20, 0x1c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x1c, 0x22, 0x20, 0x10, 0x08, 0x08, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x72, 0x4a, 0x4a, 0x72, 0x02, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3e, 0x42, 0x42, 0x3e, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x02, 0x02, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7c, 0x04, 0x04, 0x3c, 0x04, 0x04, 0x04, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7c, 0x04, 0x04, 0x3c, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x72, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x78, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x44, 0x24, 0x14, 0x0c, 0x0c, 0x14, 0x24, 0x44, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x82, 0xc6, 0xaa, 0xaa, 0x92, 0x92, 0x82, 0x82, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x42, 0x46, 0x4a, 0x4a, 0x52, 0x52, 0x62, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x4a, 0x52, 0x3c, 0x40, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x3e, 0x12, 0x22, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x3c, 0x40, 0x40, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x82, 0x92, 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xc6, 0x44, 0x28, 0x10, 0x10, 0x28, 0x44, 0xc6, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7e, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x1c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1c, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x40, 0x7c, 0x42, 0x42, 0xbc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x3a, 0x46, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x5c, 0x62, 0x42, 0x42, 0x42, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x7e, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x70, 0x08, 0x08, 0x3c, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x1c, 0x22, 0x22, 0x1c, 0x02, 0x3c, 0x42, 0x3c, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x3a, 0x46, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x18, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x22, 0x1c, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x22, 0x12, 0x0e, 0x12, 0x22, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x18, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x92, 0x92, 0x92, 0x82, 0x82, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x46, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x46, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x42, 0x42, 0x42, 0x62, 0x5c, 0x40, 0x40, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x4c, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x3c, 0x40, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x3c, 0x08, 0x08, 0x08, 0x48, 0x30, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x62, 0x5c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x24, 0x18, 0x18, 0x24, 0x66, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x40, 0x42, 0x3c, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x20, 0x10, 0x08, 0x04, 0x7e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x30, 0x08, 0x08, 0x10, 0x0c, 0x10, 0x08, 0x08, 0x08, 0x30, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x0c, 0x10, 0x10, 0x08, 0x30, 0x08, 0x10, 0x10, 0x10, 0x0c, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x4c, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xfc, 0x12, 0x12, 0x72, 0x12, 0x12, 0x12, 0xfc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x92, 0xf2, 0x12, 0x92, 0x6c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x24, 0x24, 0x00, 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10, 0x10, 0x38, 0x54, 0x14, 0x54, 0x38, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x30, 0x48, 0x48, 0x08, 0x08, 0x3c, 0x08, 0x8c, 0x76, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x44, 0x38, 0x44, 0x44, 0x44, 0x38, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x28, 0x7c, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x38, 0x44, 0x04, 0x38, 0x44, 0x44, 0x38, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7c, 0x82, 0xb2, 0x8a, 0x8a, 0xb2, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x10, 0x1c, 0x12, 0x1c, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x24, 0x12, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x7e, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x7c, 0x82, 0x9a, 0xaa, 0x9a, 0xaa, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x10, 0x08, 0x04, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x10, 0x20, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x24, 0x24, 0x12, 0x12, 0x6d, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x7c, 0x2e, 0x2e, 0x2e, 0x2c, 0x28, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x18, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x0c, 0x08, 0x08, 0x08, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x12, 0x12, 0x0c, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x24, 0x48, 0x24, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x04, 0x06, 0x44, 0x24, 0x1e, 0x48, 0x64, 0x52, 0xf8, 0x40, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x04, 0x06, 0x44, 0x24, 0x1e, 0x68, 0x94, 0x42, 0x20, 0xf0, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0c, 0x12, 0x08, 0x52, 0x2c, 0x50, 0x68, 0x54, 0xfa, 0x40, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x10, 0x10, 0x10, 0x08, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00,
- 0x00, 0x08, 0x10, 0x00, 0x18, 0x24, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x10, 0x08, 0x00, 0x18, 0x24, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x18, 0x24, 0x00, 0x18, 0x24, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x4c, 0x32, 0x00, 0x18, 0x24, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x24, 0x24, 0x00, 0x18, 0x24, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x18, 0x24, 0x18, 0x18, 0x24, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xf8, 0x14, 0x14, 0x72, 0x1e, 0x12, 0x12, 0xf2, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x02, 0x02, 0x02, 0x42, 0x3c, 0x10, 0x08, 0x00, 0x00,
- 0x00, 0x08, 0x10, 0x00, 0x7c, 0x04, 0x04, 0x3c, 0x04, 0x04, 0x04, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x20, 0x10, 0x00, 0x7c, 0x04, 0x04, 0x3c, 0x04, 0x04, 0x04, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x30, 0x48, 0x00, 0x7c, 0x04, 0x04, 0x3c, 0x04, 0x04, 0x04, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x28, 0x00, 0x7c, 0x04, 0x04, 0x3c, 0x04, 0x04, 0x04, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x08, 0x10, 0x00, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x20, 0x10, 0x00, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x10, 0x28, 0x00, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x28, 0x00, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x38, 0x48, 0x48, 0x48, 0x5c, 0x48, 0x48, 0x38, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x4c, 0x32, 0x00, 0x42, 0x46, 0x4a, 0x4a, 0x52, 0x52, 0x62, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x08, 0x10, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x10, 0x08, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x18, 0x24, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x4c, 0x32, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x24, 0x24, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xbc, 0x42, 0x62, 0x52, 0x52, 0x4a, 0x46, 0x3e, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x08, 0x10, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x10, 0x08, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x18, 0x24, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x24, 0x24, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x30, 0x08, 0x00, 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0e, 0x04, 0x3c, 0x44, 0x44, 0x3c, 0x04, 0x0e, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x26, 0x44, 0x44, 0x44, 0x34, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x3c, 0x40, 0x7c, 0x42, 0x42, 0xbc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x10, 0x00, 0x3c, 0x40, 0x7c, 0x42, 0x42, 0xbc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x24, 0x00, 0x3c, 0x40, 0x7c, 0x42, 0x42, 0xbc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x58, 0x34, 0x00, 0x3c, 0x40, 0x7c, 0x42, 0x42, 0xbc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x48, 0x48, 0x00, 0x3c, 0x40, 0x7c, 0x42, 0x42, 0xbc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x38, 0x44, 0x38, 0x00, 0x3c, 0x40, 0x7c, 0x42, 0x42, 0xbc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x90, 0xfc, 0x12, 0x92, 0x6c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x02, 0x42, 0x3c, 0x08, 0x04, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x3c, 0x42, 0x7e, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x10, 0x00, 0x3c, 0x42, 0x7e, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x24, 0x00, 0x3c, 0x42, 0x7e, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x24, 0x24, 0x00, 0x3c, 0x42, 0x7e, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x18, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10, 0x08, 0x00, 0x18, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x24, 0x00, 0x18, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x28, 0x28, 0x00, 0x18, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x12, 0x0c, 0x0c, 0x12, 0x3c, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x58, 0x34, 0x00, 0x3a, 0x46, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10, 0x08, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x24, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x58, 0x34, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x24, 0x24, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x7c, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7c, 0x62, 0x52, 0x4a, 0x46, 0x3e, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x42, 0x42, 0x42, 0x42, 0x62, 0x5c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x10, 0x08, 0x00, 0x42, 0x42, 0x42, 0x42, 0x62, 0x5c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x24, 0x00, 0x42, 0x42, 0x42, 0x42, 0x62, 0x5c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x24, 0x24, 0x00, 0x42, 0x42, 0x42, 0x42, 0x62, 0x5c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x10, 0x00, 0xc6, 0x44, 0x44, 0x28, 0x30, 0x10, 0x12, 0x0c, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x04, 0x3c, 0x44, 0x44, 0x3c, 0x04, 0x0e, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x28, 0x28, 0x00, 0xc6, 0x44, 0x44, 0x28, 0x28, 0x10, 0x12, 0x0c, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa,
- 0x00, 0x00, 0x00, 0x08, 0x1c, 0x2a, 0x49, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x49, 0x2a, 0x1c, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0xff, 0x02, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, 0x40, 0xff, 0x40, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-font_struct font_terminal_14normal = {
- 199,
- 1,
- 16,
- 8,
- 16,
- 8,
- 16,
- 3184,
- font_terminal_14normal_data
-};
-
-/* End of font14norm.h */
diff --git a/sys/arch/arm32/dev/console/fonts/font_wide.h b/sys/arch/arm32/dev/console/fonts/font_wide.h
deleted file mode 100644
index 646ecec35a9..00000000000
--- a/sys/arch/arm32/dev/console/fonts/font_wide.h
+++ /dev/null
@@ -1,259 +0,0 @@
-/* $OpenBSD: font_wide.h,v 1.2 2000/03/03 00:54:48 todd Exp $ */
-/* $NetBSD: font_wide.h,v 1.1 1996/01/31 23:20:22 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * font_terminal14_wide.h
- *
- * Font for physical console driver
- *
- * Created : 18/09/94
- * Last updated : 15/10/94
- *
- * Based on kate/display/14widen.h
- *
- */
-
-unsigned char font_terminal_14widen_data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x30, 0x03, 0x30, 0x03, 0x30, 0x03, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x01, 0x98, 0x01, 0xfe, 0x07, 0x98,
- 0x01, 0xfe, 0x07, 0x98, 0x01, 0x98, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0xfc, 0x03, 0x66, 0x04, 0xfc,
- 0x03, 0x60, 0x06, 0x66, 0x06, 0xfc, 0x03, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x06, 0x44, 0x03, 0xb8, 0x01, 0xc0,
- 0x00, 0x60, 0x00, 0xb0, 0x03, 0x58, 0x04, 0x8c, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x98, 0x01, 0x98, 0x01, 0xf0,
- 0x04, 0x8c, 0x05, 0x06, 0x03, 0x06, 0x03, 0xfc, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0x80, 0x00, 0x40, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0xc0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x30,
- 0x00, 0x30, 0x00, 0x30, 0x00, 0x60, 0x00, 0xc0, 0x00, 0x80, 0x03, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x60, 0x00, 0xc0, 0x00, 0x80, 0x01, 0x80,
- 0x01, 0x80, 0x01, 0x80, 0x01, 0xc0, 0x00, 0x60, 0x00, 0x38, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x66, 0x06, 0xf8, 0x01, 0xf8,
- 0x01, 0x66, 0x06, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0xfe,
- 0x07, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x30, 0x00, 0x18, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc,
- 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x03, 0x80, 0x01, 0xc0,
- 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x0c, 0x03, 0x06, 0x06, 0x06,
- 0x06, 0x06, 0x06, 0x06, 0x06, 0x0c, 0x03, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x60, 0x00, 0x70, 0x00, 0x78,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x06, 0x06, 0x00, 0x06, 0x80,
- 0x03, 0xe0, 0x01, 0x78, 0x00, 0x1e, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x06, 0x06, 0x00, 0x06, 0xe0,
- 0x03, 0x00, 0x06, 0x00, 0x06, 0x06, 0x06, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xc0, 0x01, 0xa0, 0x01, 0x90,
- 0x01, 0x88, 0x01, 0x84, 0x01, 0xfe, 0x07, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x07, 0x06, 0x00, 0x06, 0x00, 0xfe,
- 0x03, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x0c, 0x00, 0x06, 0x00, 0xfe,
- 0x03, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x03, 0x00, 0x03, 0x80, 0x01, 0xc0,
- 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x06, 0x06, 0x06, 0x06, 0xfc,
- 0x03, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x06, 0x06, 0x06, 0x06, 0x06,
- 0x06, 0xfc, 0x07, 0x00, 0x06, 0x00, 0x03, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x30,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x30,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x30, 0x00, 0x18, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x30,
- 0x00, 0x0c, 0x00, 0x30, 0x00, 0xc0, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc,
- 0x07, 0x00, 0x00, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x30, 0x00, 0xc0,
- 0x00, 0x00, 0x03, 0xc0, 0x00, 0x30, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x06, 0x06, 0x00, 0x06, 0xc0,
- 0x03, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x06, 0x06, 0xc6, 0x07, 0x66,
- 0x06, 0x66, 0x06, 0xc6, 0x07, 0x06, 0x00, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x98, 0x01, 0x0c, 0x03, 0x0c,
- 0x03, 0xfe, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x03, 0x06, 0x06, 0x06, 0x06, 0xfe,
- 0x03, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0xfe, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x06, 0x06, 0x06, 0x00, 0x06,
- 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x06, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x03, 0x06, 0x06, 0x06, 0x06, 0x06,
- 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0xfe, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0x0c, 0x00, 0x0c, 0x00, 0xfc,
- 0x03, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0x0c, 0x00, 0x0c, 0x00, 0x0c,
- 0x00, 0xfc, 0x03, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x06, 0x06, 0x06, 0x00, 0x06,
- 0x00, 0x86, 0x07, 0x06, 0x06, 0x06, 0x06, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0xfe,
- 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x07, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x07, 0x80, 0x01, 0x80, 0x01, 0x80,
- 0x01, 0x80, 0x01, 0x80, 0x01, 0x86, 0x01, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x86, 0x01, 0x66, 0x00, 0x1e,
- 0x00, 0x1e, 0x00, 0x66, 0x00, 0x86, 0x01, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c,
- 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x0e, 0x07, 0x9e, 0x07, 0xf6,
- 0x06, 0x66, 0x06, 0x66, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x0e, 0x06, 0x1e, 0x06, 0x36,
- 0x06, 0x66, 0x06, 0xc6, 0x06, 0x86, 0x07, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x06, 0x06, 0x06, 0x06, 0x06,
- 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x03, 0x06, 0x06, 0x06, 0x06, 0x06,
- 0x06, 0xfe, 0x03, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x06, 0x06, 0x06, 0x06, 0x06,
- 0x06, 0x06, 0x06, 0x06, 0x06, 0x86, 0x07, 0xfc, 0x03, 0x00, 0x06, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x03, 0x06, 0x06, 0x06, 0x06, 0x06,
- 0x06, 0xfe, 0x03, 0x86, 0x01, 0x06, 0x03, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x06, 0x06, 0x06, 0x00, 0xfc,
- 0x03, 0x00, 0x06, 0x00, 0x06, 0x06, 0x06, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x07, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
- 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
- 0x06, 0x0c, 0x03, 0x98, 0x01, 0xf0, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66,
- 0x06, 0x66, 0x06, 0xf6, 0x06, 0x9c, 0x03, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x0c, 0x03, 0x98, 0x01, 0xf0,
- 0x00, 0xf0, 0x00, 0x98, 0x01, 0x0c, 0x03, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x0c, 0x03, 0x98, 0x01, 0xf0,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x03, 0x80, 0x01, 0xc0, 0x00, 0x60,
- 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00, 0xfe, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xf0, 0x03, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30,
- 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0xf0, 0x03, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x18, 0x00, 0x30, 0x00, 0x60,
- 0x00, 0xc0, 0x00, 0x80, 0x01, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80,
- 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf8, 0x01, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x98, 0x01, 0x06, 0x06, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x20, 0x00, 0x40, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x03, 0x00,
- 0x06, 0xfc, 0x07, 0x06, 0x06, 0x06, 0x06, 0xfc, 0x0d, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xf6, 0x03, 0x0e,
- 0x06, 0x06, 0x06, 0x06, 0x06, 0x0e, 0x06, 0xf6, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x06,
- 0x06, 0x06, 0x00, 0x06, 0x00, 0x06, 0x06, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0xfc, 0x06, 0x06,
- 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0xfc, 0x06, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x06,
- 0x06, 0xfe, 0x07, 0x06, 0x00, 0x06, 0x06, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0x18, 0x00, 0x18, 0x00, 0xfe,
- 0x03, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0x06,
- 0x06, 0x06, 0x06, 0x06, 0x06, 0xfc, 0x07, 0x00, 0x06, 0x00, 0x03, 0xfc, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xf6, 0x03, 0x0e,
- 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x78, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0xe0, 0x03, 0x00,
- 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0xf8, 0x01,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x86, 0x01, 0x66,
- 0x00, 0x1e, 0x00, 0x66, 0x00, 0x86, 0x01, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60,
- 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, 0x03, 0x66,
- 0x06, 0x66, 0x06, 0x66, 0x06, 0x66, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x03, 0x0e,
- 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x06,
- 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x03, 0x0e,
- 0x06, 0x06, 0x06, 0x06, 0x06, 0x0e, 0x06, 0xf6, 0x03, 0x06, 0x00, 0x06, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x06, 0x06,
- 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0xfc, 0x06, 0x00, 0x06, 0x00, 0x06,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x03, 0x38,
- 0x06, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x06,
- 0x04, 0xfc, 0x03, 0x00, 0x06, 0x06, 0x06, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x00, 0xfe, 0x01, 0x18,
- 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06,
- 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0xfc, 0x06, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06,
- 0x06, 0x0c, 0x03, 0x98, 0x01, 0xf0, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06,
- 0x06, 0x66, 0x06, 0x66, 0x06, 0xf6, 0x06, 0x9c, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x07, 0x98,
- 0x01, 0xf0, 0x00, 0xf0, 0x00, 0x98, 0x01, 0x0e, 0x07, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06,
- 0x06, 0x0c, 0x03, 0x98, 0x01, 0xf0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x1c, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0x00,
- 0x07, 0xc0, 0x01, 0x70, 0x00, 0x1c, 0x00, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x30, 0x00, 0x30, 0x00, 0x60, 0x00, 0x3c,
- 0x00, 0x60, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0xe0, 0x03, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0,
- 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x80, 0x01, 0x80, 0x01, 0xc0, 0x00, 0x80,
- 0x07, 0xc0, 0x00, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf8, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3c, 0x06, 0x66, 0x06, 0xc6, 0x03, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0x66, 0x00, 0x66, 0x00, 0xe6,
- 0x01, 0x66, 0x00, 0x66, 0x00, 0x66, 0x00, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x66,
-};
-
-font_struct font_terminal_14widen = {
- 193,
- 2,
- 13,
- 12,
- 13,
- 12,
- 13,
- 5018,
- font_terminal_14widen_data
-};
-
-/* End of font14widen.h */
diff --git a/sys/arch/arm32/dev/console/vidc.c b/sys/arch/arm32/dev/console/vidc.c
deleted file mode 100644
index e289593fd56..00000000000
--- a/sys/arch/arm32/dev/console/vidc.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/* $NetBSD: vidc.c,v 1.2 1996/03/18 19:33:07 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1995 Melvyn Tang-Richardson
- * Copyright (c) 1994-1995 RiscBSD kernel team
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD kernel team
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE RISCBSD TEAM ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * vidc.c
- *
- * Old console ioctl declarations
- *
- * Created : 17/09/94
- */
-
-#include <sys/types.h>
-#include <machine/vidc.h>
-#include <machine/katelib.h>
-
-/* VIDC STUFF */
-
-/*
- * A structure containing ALL the information required to restore
- * the VIDC20 to any given state. ALL vidc transactions should
- * go through these procedures, which record the vidc's state.
- * it may be an idea to set the permissions of the vidc base address
- * so we get a fault, so the fault routine can record the state but
- * I guess that's not really necessary for the time being, since we
- * can make the kernel more secure later on. Also, it is possible
- * to write a routine to allow 'reading' of the vidc registers.
- */
-
-struct vidc_state vidc_lookup = {
- { 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0
- },
-
- VIDC_PALREG,
- VIDC_BCOL,
- VIDC_CP1 ,
- VIDC_CP2,
- VIDC_CP3,
- VIDC_HCR,
- VIDC_HSWR,
- VIDC_HBSR,
- VIDC_HDSR,
- VIDC_HDER,
- VIDC_HBER,
- VIDC_HCSR,
- VIDC_HIR,
- VIDC_VCR,
- VIDC_VSWR,
- VIDC_VBSR,
- VIDC_VDSR,
- VIDC_VDER,
- VIDC_VBER,
- VIDC_VCSR,
- VIDC_VCER,
- VIDC_EREG,
- VIDC_FSYNREG,
- VIDC_CONREG,
- VIDC_DCTL
-};
-
-struct vidc_state vidc_current[1];
-
-int
-vidc_write(reg, value)
- u_int reg;
- int value;
-{
- int counter;
-
- int *current;
- int *tab;
-
- tab = (int *)&vidc_lookup;
- current = (int *)vidc_current;
-
- /* End higly doddgy code */
-/*
-WriteWord ( VIDC_BASE, reg | value );
-return 1;
-*/
-
- /*
- * OK, the VIDC_PALETTE register is handled differently
- * to the others on the VIDC, so take that into account here
- */
- if (reg==VIDC_PALREG) {
- vidc_current->palreg = 0;
- WriteWord ( VIDC_BASE, reg | value );
- return 0;
- }
-
- if (reg==VIDC_PALETTE) {
- WriteWord ( VIDC_BASE, reg | value );
- vidc_current->palette[vidc_current->palreg] = value;
- vidc_current->palreg++;
- vidc_current->palreg = vidc_current->palreg & 0xff;
- return 0;
- }
-
- /*
- * Undefine SAFER if you wish to speed things up (a little)
- * although this means the function will assume things abou
- * the structure of vidc_state. i.e. the first 256 words are
- * the palette array
- */
-
-#define SAFER
-
-#ifdef SAFER
-#define INITVALUE 0
-#else
-#define INITVALUE 256
-#endif
-
- for ( counter=INITVALUE; counter<= sizeof(struct vidc_state); counter++ ) {
- if ( reg==tab[counter] ) {
- WriteWord ( VIDC_BASE, reg | value );
- current[counter] = value;
- return 0;
- }
- }
- return -1;
-}
-
-void
-vidc_setpalette(vidc)
- struct vidc_state *vidc;
-{
- int counter = 0;
-
- vidc_write(VIDC_PALREG, 0x00000000);
- for (counter = 0; counter < 255; counter++)
- vidc_write(VIDC_PALETTE, vidc->palette[counter]);
-}
-
-void
-vidc_setstate(vidc)
- struct vidc_state *vidc;
-{
- vidc_write ( VIDC_PALREG, vidc->palreg );
- vidc_write ( VIDC_BCOL, vidc->bcol );
- vidc_write ( VIDC_CP1, vidc->cp1 );
- vidc_write ( VIDC_CP2, vidc->cp2 );
- vidc_write ( VIDC_CP3, vidc->cp3 );
- vidc_write ( VIDC_HCR, vidc->hcr );
- vidc_write ( VIDC_HSWR, vidc->hswr );
- vidc_write ( VIDC_HBSR, vidc->hbsr );
- vidc_write ( VIDC_HDSR, vidc->hdsr );
- vidc_write ( VIDC_HDER, vidc->hder );
- vidc_write ( VIDC_HBER, vidc->hber );
- vidc_write ( VIDC_HCSR, vidc->hcsr );
- vidc_write ( VIDC_HIR, vidc->hir );
- vidc_write ( VIDC_VCR, vidc->vcr );
- vidc_write ( VIDC_VSWR, vidc->vswr );
- vidc_write ( VIDC_VBSR, vidc->vbsr );
- vidc_write ( VIDC_VDSR, vidc->vdsr );
- vidc_write ( VIDC_VDER, vidc->vder );
- vidc_write ( VIDC_VBER, vidc->vber );
- vidc_write ( VIDC_VCSR, vidc->vcsr );
- vidc_write ( VIDC_VCER, vidc->vcer );
-/*
- * Right, dunno what to set these to yet, but let's keep RiscOS's
- * ones for now, until the time is right to finish this code
- */
-
-/* vidc_write ( VIDC_EREG, vidc->ereg ); */
-/* vidc_write ( VIDC_FSYNREG, vidc->fsynreg ); */
-/* vidc_write ( VIDC_CONREG, vidc->conreg ); */
-/* vidc_write ( VIDC_DCTL, vidc->dctl ); */
-
-}
-
-
-void
-vidc_getstate(vidc)
- struct vidc_state *vidc;
-{
- *vidc = *vidc_current;
-}
-
-void
-vidc_stdpalette()
-{
- WriteWord(VIDC_BASE, VIDC_PALREG | 0x00000000);
- WriteWord(VIDC_BASE, VIDC_PALETTE | VIDC_COL( 0, 0, 0));
- WriteWord(VIDC_BASE, VIDC_PALETTE | VIDC_COL(255, 0, 0));
- WriteWord(VIDC_BASE, VIDC_PALETTE | VIDC_COL( 0, 255, 0));
- WriteWord(VIDC_BASE, VIDC_PALETTE | VIDC_COL(255, 255, 0));
- WriteWord(VIDC_BASE, VIDC_PALETTE | VIDC_COL( 0, 0, 255));
- WriteWord(VIDC_BASE, VIDC_PALETTE | VIDC_COL(255, 0, 255));
- WriteWord(VIDC_BASE, VIDC_PALETTE | VIDC_COL( 0, 255, 255));
- WriteWord(VIDC_BASE, VIDC_PALETTE | VIDC_COL(255, 255, 255));
- WriteWord(VIDC_BASE, VIDC_PALETTE | VIDC_COL(128, 128, 128));
- WriteWord(VIDC_BASE, VIDC_PALETTE | VIDC_COL(255, 128, 128));
- WriteWord(VIDC_BASE, VIDC_PALETTE | VIDC_COL(128, 255, 128));
- WriteWord(VIDC_BASE, VIDC_PALETTE | VIDC_COL(255, 255, 128));
- WriteWord(VIDC_BASE, VIDC_PALETTE | VIDC_COL(128, 128, 255));
- WriteWord(VIDC_BASE, VIDC_PALETTE | VIDC_COL(255, 128, 255));
- WriteWord(VIDC_BASE, VIDC_PALETTE | VIDC_COL(128, 255, 255));
- WriteWord(VIDC_BASE, VIDC_PALETTE | VIDC_COL(255, 255, 255));
-}
-
-#if 0
-int
-vidc_col(red, green, blue)
- int red;
- int green;
- int blue;
-{
- red = red & 0xFF;
- green = green & 0xFF;
- blue = blue & 0xFF;
-
- return ( (blue<<16) + (green<<8) + red );
-}
-
-#endif
diff --git a/sys/arch/arm32/dev/console/vidc_mc.S b/sys/arch/arm32/dev/console/vidc_mc.S
deleted file mode 100644
index d22ece5384a..00000000000
--- a/sys/arch/arm32/dev/console/vidc_mc.S
+++ /dev/null
@@ -1,213 +0,0 @@
-/* $NetBSD: vidc_mc.S,v 1.3 1996/03/18 19:33:08 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1995 Melvyn Tang-Richardson
- * Copyright (c) 1994-1995 RiscBSD kernel team
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD kernel team
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE RISCBSD TEAM ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * vidc_mc.S
- *
- * Console assembly functions
- *
- * Created : 17/09/94
- */
-
-#include "assym.h"
-#include <machine/iomd.h>
-
-lr .req r14
-pc .req r15
-sp .req r13
-
-.text
- .global _vidcconsole_loadtab
-_vidcconsole_loadtab:
- mov r0, r0
- ldmia r0!, { r2 }
- ldmia r0!, { r2-r3 }
- ldmia r0!, { r2-r4 }
- ldmia r0!, { r2-r5 }
- ldmia r0!, { r2-r6 }
- ldmia r0!, { r2-r7 }
- ldmia r0!, { r2-r8 }
- ldmia r0!, { r2-r9 }
- ldmia r0!, { r2-r10 }
- ldmia r0!, { r2-r11 }
- ldmia r0!, { r2-r12 }
- ldmia r0!, { r2-r12, r14 }
-
- .global _vidcconsole_storetab
-_vidcconsole_storetab:
- mov r0, r0
- stmia r0!, { r2 }
- stmia r0!, { r2-r3 }
- stmia r0!, { r2-r4 }
- stmia r0!, { r2-r5 }
- stmia r0!, { r2-r6 }
- stmia r0!, { r2-r7 }
- stmia r0!, { r2-r8 }
- stmia r0!, { r2-r9 }
- stmia r0!, { r2-r10 }
- stmia r0!, { r2-r11 }
- stmia r0!, { r2-r12 }
- stmia r0!, { r2-r12, r14 }
-
- .global _vidcconsole_pushtab
-_vidcconsole_pushtab:
- mov r0, r0
- stmfd r13!, { r0-r3 }
- stmfd r13!, { r0-r7 }
- stmfd r13!, { r0-r11 }
- stmfd r13!, { r0-r14 }
-
- .global _vidcconsole_poptab
-_vidcconsole_poptab:
- mov r0, r0
- ldmfd r13!, { r0-r3 }
- ldmfd r13!, { r0-r7 }
- ldmfd r13!, { r0-r11 }
- ldmfd r13!, { r0-r14 }
-
- .global _vidcconsole_enter
-_vidcconsole_enter:
- stmfd r13!, { r15 }
-
- .global _vidcconsole_exit
-_vidcconsole_exit:
- stmfd r13!, { r15 }
-
- .global _vidcconsolemc_render
-
- /* On entry r0 = addr */
- /* r1 = font */
- /* r2 = col */
- /* r3 = xres */
-
- /* Optimise for 8x16 font */
- /* At the moment */
-
-_vidcconsolemc_render:
-
- stmfd r13!, {r0-r9, lr}
-
- /* Generate colour mask */
-
- mov r9, r2, lsr #16
- mov r4, r2, lsr #8
- and r9, r9, #0xff
- and r4, r4, #0xff
- and r2, r2, #0xff
-
- /* For each row (8 pixels) */
-
-xloop:
- ldrb r5, [r1], #1
-
- mov r7, #0
- mov r8, #0
-
-/* This loop will get *SOOOO* much faster with */
-/* the new algorithmn */
- tst r5, #8
- orrne r7, r2, r7, lsl #8
- orreq r7, r4, r7, lsl #8
- tst r5, #4
- orrne r7, r2, r7, lsl #8
- orreq r7, r4, r7, lsl #8
- tst r5, #2
- orrne r7, r2, r7, lsl #8
- orreq r7, r4, r7, lsl #8
- tst r5, #1
- orrne r7, r2, r7, lsl #8
- orreq r7, r4, r7, lsl #8
- tst r5, #0x80
- orrne r8, r2, r8, lsl #8
- orreq r8, r4, r8, lsl #8
- tst r5, #0x40
- orrne r8, r2, r8, lsl #8
- orreq r8, r4, r8, lsl #8
- tst r5, #0x20
- orrne r8, r2, r8, lsl #8
- orreq r8, r4, r8, lsl #8
- tst r5, #0x10
- orrne r8, r2, r8, lsl #8
- orreq r8, r4, r8, lsl #8
-
- stmia r0, {r7, r8}
- add r0, r0, r3
-
- subs r9, r9, #1
- bne xloop
-
- ldmfd r13!, {r0-r9, pc}
-
- .global _vidcconsolemc_cls
-
- /* On entry r0 = start */
- /* r1 = end */
- /* r2 = col */
-
-
-_vidcconsolemc_cls:
- stmfd r13!, {r0-r9, lr}
-
- mov r3, r2
- mov r4, r2
- mov r5, r2
- mov r6, r2
- mov r7, r2
- mov r8, r2
- mov r9, r2
-
-loop:
- stmia r0!, { r2-r9 }
- stmia r0!, { r2-r9 }
- stmia r0!, { r2-r9 }
- stmia r0!, { r2-r9 }
- stmia r0!, { r2-r9 }
- stmia r0!, { r2-r9 }
- stmia r0!, { r2-r9 }
- stmia r0!, { r2-r9 }
- stmia r0!, { r2-r9 }
- stmia r0!, { r2-r9 }
- stmia r0!, { r2-r9 }
- stmia r0!, { r2-r9 }
- stmia r0!, { r2-r9 }
- stmia r0!, { r2-r9 }
- stmia r0!, { r2-r9 }
- stmia r0!, { r2-r9 }
-
- cmp r0, r1
- ble loop
-
- ldmfd r13!, {r0-r9, pc}
-
diff --git a/sys/arch/arm32/dev/console/vidcconsole.c b/sys/arch/arm32/dev/console/vidcconsole.c
deleted file mode 100644
index bd8305e607e..00000000000
--- a/sys/arch/arm32/dev/console/vidcconsole.c
+++ /dev/null
@@ -1,1818 +0,0 @@
-/* $NetBSD: vidcconsole.c,v 1.7 1996/03/28 21:18:40 mark Exp $ */
-
-/*
- * Copyright (c) 1996 Robert Black
- * Copyright (c) 1994-1995 Melvyn Tang-Richardson
- * Copyright (c) 1994-1995 RiscBSD kernel team
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD kernel team
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE RISCBSD TEAM ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * vidcconsole.c
- *
- * Console assembly functions
- *
- * Created : 17/09/94
- * Last updated : 07/02/96
- */
-
-/* woo */
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/ioctl.h>
-#include <sys/conf.h>
-#include <sys/tty.h>
-#include <sys/device.h>
-#include <sys/map.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/syslog.h>
-#include <sys/resourcevar.h>
-#include <vm/vm.h>
-
-#include <machine/cpu.h>
-#include <machine/param.h>
-#include <machine/katelib.h>
-#include <machine/cpu.h>
-#include <machine/bootconfig.h>
-#include <machine/iomd.h>
-#include <machine/irqhandler.h>
-#include <machine/pmap.h>
-#include <machine/vidc.h>
-#include <machine/vconsole.h>
-
-#include <arm32/dev/console/fonts/font_normal.h>
-#include <arm32/dev/console/fonts/font_bold.h>
-#include <arm32/dev/console/fonts/font_italic.h>
-
-
-#define BCOPY bcopy
-
-#ifndef DEBUGTERM
-#define dprintf(x) ;
-#endif
-
-/* Options ************************************/
-#define ACTIVITY_WARNING
-#define SCREENBLANKER
-#undef INVERSE_CONSOLE
-/**********************************************/
-
-/* Internal defines only **********************/
-#define DEVLOPING
-#undef SELFTEST
-#undef SILLIES
-/**********************************************/
-
-#ifdef SILLIES
-#define PRETTYCURSOR
-#endif
-
-extern int physcon_major;
-extern struct vconsole *vconsole_default;
-
-extern videomemory_t videomemory;
-
-extern font_struct font_terminal_14normal;
-extern font_struct font_terminal_14bold;
-extern font_struct font_terminal_14italic;
-
-#define font_normal font_terminal_14normal
-#define font_bold font_terminal_14bold
-#define font_italic font_terminal_14italic
-
-#define VIDC_ENGINE_NAME "VIDC"
-#define R_DATA ((struct vidc_info *)vc->r_data)
-#define MODE (R_DATA->mode)
-
-static int cold_init = 0;
-
-extern struct vconsole *vconsole_master;
-extern struct vconsole *vconsole_current;
-static struct vidc_mode vidc_initialmode;
-static struct vidc_mode *vidc_currentmode;
-
-unsigned int dispstart;
-unsigned int dispsize;
-unsigned int dispbase;
-unsigned int dispend;
-unsigned int ptov;
-unsigned int transfersize;
-unsigned int vmem_base;
-unsigned int phys_base;
-int flash;
-int cursor_flash;
-char *cursor_normal;
-char *cursor_transparent;
-int p_cursor_normal;
-int p_cursor_transparent;
-
-/* Local function prototypes */
-static void vidcconsole_cls __P(( struct vconsole */*vc*/ ));
-static int vidc_cursor_init __P(( struct vconsole */*vc*/ ));
-static int vidcconsole_cursorintr __P(( struct vconsole */*vc*/ ));
-int vidcconsole_flashintr __P(( struct vconsole */*vc*/ ));
-static int vidcconsole_textpalette __P(( struct vconsole */*vc*/ ));
-static void vidcconsole_render __P(( struct vconsole */*vc*/, char /*c*/ ));
-static void vidcconsole_mode __P(( struct vconsole */*vc*/, struct vidc_mode */*mode*/ ));
-int vidcconsole_flash __P(( struct vconsole */*vc*/, int /*flash*/ ));
-int vidcconsole_cursorflash __P(( struct vconsole */*vc*/, int /*flash*/ ));
-int vidcconsole_flash_go __P(( struct vconsole */*vc*/ ));
-int vidcconsole_blank __P(( struct vconsole */*vc*/, int /*type*/ ));
-void vidcconsole_putchar __P(( dev_t dev, char c, struct vconsole *vc));
-extern int vidcconsolemc_cls __P(( unsigned char *, unsigned char *, int ));
-
-void (*line_cpfunc) __P(( char *, char * ));
-
-/*
- * This will be called while still in the mode that we were left
- * in after exiting from riscos
- */
-
-static irqhandler_t cursor_ih;
-irqhandler_t flash_ih;
-
-
-#ifndef HARDCODEDMODES
-/* The table of modes is separately compiled */
-extern struct vidc_mode vidcmodes[];
-#else /* HARDCODEDMODES */
-#ifdef RC7500
-static struct vidc_mode vidcmodes[] = {
- {31500,/**/48, 84, 30, 640, 30, 0,/**/3, 28, 0, 480, 0, 9,/**/0,/**/3},
- {36000,/**/72, 84, 34, 800, 34, 0,/**/2, 22, 0, 600, 0, 1,/**/0,/**/3},
-};
-#else /* RC7500 */
-/* We have a hard compiled table of modes and a list of definable modes */
-static struct vidc_mode vidcmodes[] = {
- {32500,/**/52, 64, 30, 640, 30, 14,/**/3, 28, 0, 480, 0, 9,/**/0,/**/3},
- {65000,/**/128, 36, 60, 1024, 60 ,36,/**/6, 29, 0, 768, 0, 3,/**/0,/**/3},
-};
-#endif /* RC7500 */
-#endif /* HARDCODEDMODES */
-
-#ifdef RC7500
-struct vfreq {
- u_int frqcon;
- int freq;
-};
-
-static struct vfreq vfreq[] = {
- { VIDFREQ_25_18, 25175},
- { VIDFREQ_25_18, 25180},
- { VIDFREQ_28_32, 28320},
- { VIDFREQ_31_50, 31500},
- { VIDFREQ_36_00, 36000},
- { VIDFREQ_40_00, 40000},
- { VIDFREQ_44_90, 44900},
- { VIDFREQ_50_00, 50000},
- { VIDFREQ_65_00, 65000},
- { VIDFREQ_72_00, 72000},
- { VIDFREQ_75_00, 75000},
- { VIDFREQ_77_00, 77000},
- { VIDFREQ_80_00, 80000},
- { VIDFREQ_94_50, 94500},
- { VIDFREQ_110_0, 110000},
- { VIDFREQ_120_0, 120000},
- { VIDFREQ_130_0, 130000}
-};
-
-#define NFREQ (sizeof (vfreq) / sizeof(struct vfreq))
-u_int vfreqcon = 0;
-#else /* RC7500 */
-
-struct fsyn {
- int r, v, f;
-};
-
-static struct fsyn fsyn_pref[] = {
- { 6, 2, 8000 },
- { 4, 2, 12000 },
- { 3, 2, 16000 },
- { 2, 2, 24000 },
- { 41, 43, 25171 },
- { 50, 59, 28320 },
- { 3, 4, 32000 },
- { 2, 3, 36000 },
- { 31, 58, 44903 },
- { 12, 35, 70000 },
- { 0, 0, 00000 }
-};
-#endif /* RC7500 */
-
-static inline int
-mod ( int n )
-{
- if (n<0) return (-n);
- else return n;
-}
-
-static int
-vidcconsole_coldinit(vc)
- struct vconsole *vc;
-{
- int found;
- int loop;
-
- line_cpfunc = NULL;
-
- /* Do this first so it dont look messy */
-
- vidc_write ( VIDC_CP1, 0x0 );
- vidc_write ( VIDC_CP2, 0x0 );
- vidc_write ( VIDC_CP3, 0x0 );
-
- /* Try to determine the current mode */
- vidc_initialmode.hder = bootconfig.width+1;
- vidc_initialmode.vder = bootconfig.height+1;
-/*
- vidc_initialmode.hder = 1024;
- vidc_initialmode.vder = 768;
-*/
- vidc_initialmode.bitsperpixel = 1 << bootconfig.bitsperpixel;
-
-/* Nut - should be using videomemory.vidm_vbase - mark */
-
- dispbase = vmem_base = dispstart = bootconfig.display_start;
- phys_base = videomemory.vidm_pbase;
-
-/* Nut - should be using videomemory.vidm_size - mark */
-
-#ifdef RC7500
- dispsize = videomemory.vidm_size;
- transfersize = 16;
-#else /* RC7500 */
- dispsize = bootconfig.vram[0].pages * NBPG;
- transfersize = dispsize >> 10;
-#endif /* RC7500 */
-
- ptov = dispbase - phys_base;
-
- dispend = dispstart+dispsize;
-
- vidc_currentmode = &vidcmodes[0];
- loop = 0;
- found = 0;
-
- while (vidcmodes[loop].pixel_rate != 0) {
- if (vidcmodes[loop].hder == (bootconfig.width + 1)
- && vidcmodes[loop].vder == (bootconfig.height + 1)
- && vidcmodes[loop].frame_rate == bootconfig.framerate) {
- vidc_currentmode = &vidcmodes[loop];
- found = 1;
- }
- ++loop;
- }
-
- if (!found) {
- vidc_currentmode = &vidcmodes[0];
- loop = 0;
- found = 0;
-
- while (vidcmodes[loop].pixel_rate != 0) {
- if (vidcmodes[loop].hder == (bootconfig.width + 1)
- && vidcmodes[loop].vder == (bootconfig.height + 1)) {
- vidc_currentmode = &vidcmodes[loop];
- found = 1;
- }
- ++loop;
- }
- }
-
- /* vidc_currentmode = &vidcmodes[0];*/
- vidc_currentmode->bitsperpixel = 1 << bootconfig.bitsperpixel;
-
- R_DATA->flash = R_DATA->cursor_flash = 0;
-
- dispstart = dispbase;
- dispend = dispstart+dispsize;
-
- WriteWord ( IOMD_VIDINIT, dispstart-ptov );
- WriteWord ( IOMD_VIDSTART, dispstart-ptov );
- WriteWord ( IOMD_VIDEND, (dispend-transfersize)-ptov );
- return 0;
-}
-
-struct vidc_mode newmode;
-
-static const int bpp_mask_table[] = {
- 0, /* 1bpp */
- 1, /* 2bpp */
- 2, /* 4bpp */
- 3, /* 8bpp */
- 4, /* 16bpp */
- 6 /* 32bpp */
-};
-
-void
-vidcconsole_mode(vc, mode)
- struct vconsole *vc;
- struct vidc_mode *mode;
-{
- register int acc;
- int bpp_mask;
- int log_bpp;
- int tmp_bpp;
-
-#ifndef RC7500
- int best_r, best_v, best_match;
-#endif
-
-/*
- * Find out what bit mask we need to or with the vidc20 control register
- * in order to generate the desired number of bits per pixel.
- * log_bpp is log base 2 of the number of bits per pixel.
- */
-
- tmp_bpp = mode->bitsperpixel;
- if (tmp_bpp < 1 || tmp_bpp > 32)
- tmp_bpp = 8; /* Set 8 bpp if we get asked for something silly */
-
- for (log_bpp = 0; tmp_bpp != 1; tmp_bpp >>= 1)
- log_bpp++;
-
- bpp_mask = bpp_mask_table[log_bpp];
-
-/*
- printf ( "res = (%d, %d) rate = %d\n", mode->hder, mode->vder, mode->pixel_rate );
-*/
-
- newmode = *mode;
- vidc_currentmode = &newmode;
-
-#ifdef RC7500
- {
- int i;
- int old, new;
- u_int nfreq;
-
- old = vfreq[0].freq;
- nfreq = vfreq[0].frqcon;
- for (i = 0; i < (NFREQ - 1); i++) {
- new = vfreq[i].freq - mode->pixel_rate;
- if (new < 0)
- new = -new;
- if (new < old) {
- nfreq = vfreq[i].frqcon;
- old = new;
- }
- if (new == 0)
- break;
- }
- nfreq |= (vfreqcon & 0xf0);
- vfreqcon = nfreq;
- }
-#else /* RC7500 */
- /* Program the VCO Look up a preferred value before choosing one */
- {
- int least_error = mod (fsyn_pref[0].f - vidc_currentmode->pixel_rate);
- int counter;
- best_r = fsyn_pref[0].r;
- best_match = fsyn_pref[0].f;
- best_v = fsyn_pref[0].v;
-
- /* Look up */
-
- counter=0;
-
- while ( fsyn_pref[counter].r != 0 ) {
- if (least_error > mod (fsyn_pref[counter].f - vidc_currentmode->pixel_rate)) {
- best_match = fsyn_pref[counter].f;
- least_error = mod (fsyn_pref[counter].f - vidc_currentmode->pixel_rate);
- best_r = fsyn_pref[counter].r;
- best_v = fsyn_pref[counter].v;
- }
- counter++;
- }
-
- if ( least_error > 0) { /* Accuracy of 1000Hz */
- int r, v, f;
- for ( v=63; v>0; v-- )
- for ( r=63; r>0; r-- ) {
- f = (v * VIDC_FREF/1000) / r;
- if (least_error >= mod (f - vidc_currentmode->pixel_rate)) {
- best_match = f;
- least_error = mod (f - vidc_currentmode->pixel_rate);
- best_r = r;
- best_v = v;
- }
- }
- }
-
- if ( best_r>63 ) best_r=63;
- if ( best_v>63 ) best_v=63;
- if ( best_r<1 ) best_r= 1;
- if ( best_v<1 ) best_v= 1;
-
- }
-/*
- printf ( "best_v = %d best_r = %d best_f = %d\n", best_v, best_r, best_match );
-*/
-#endif /* RC7500 */
-
- if (vc==vconsole_current) {
-#ifdef RC7500
- outb(FREQCON, vfreqcon);
- /*
- * Need to program the control register first.
- */
- if ( dispsize>1024*1024 ) {
- if ( vidc_currentmode->hder>=800 )
- vidc_write ( VIDC_CONREG, 7<<8 | bpp_mask<<5);
- else
- vidc_write ( VIDC_CONREG, 6<<8 | bpp_mask<<5);
- } else {
- vidc_write ( VIDC_CONREG, 7<<8 | bpp_mask<<5);
- }
-
- /*
- * We don't use VIDC_FSYNREG. Program it low.
- */
- vidc_write(VIDC_FSYNREG, 0x2020);
-#else /* RC7500 */
- vidc_write ( VIDC_FSYNREG, (best_v-1)<<8 | (best_r-1)<<0 );
-#endif /* RC7500 */
- acc=0;
- acc+=vidc_currentmode->hswr;vidc_write(VIDC_HSWR,(acc - 8 )& (~1) );
- acc+=vidc_currentmode->hbsr;vidc_write(VIDC_HBSR,(acc - 12 )& (~1) );
- acc+=vidc_currentmode->hdsr;vidc_write(VIDC_HDSR,(acc - 18 )& (~1) );
- acc+=vidc_currentmode->hder;vidc_write(VIDC_HDER,(acc - 18 )& (~1) );
- acc+=vidc_currentmode->hber;vidc_write(VIDC_HBER,(acc - 12 )& (~1) );
- acc+=vidc_currentmode->hcr ;vidc_write(VIDC_HCR ,(acc - 8)&(~3));
-
- acc=0;
- acc+=vidc_currentmode->vswr; vidc_write(VIDC_VSWR,(acc - 1 ));
- acc+=vidc_currentmode->vbsr; vidc_write(VIDC_VBSR,(acc - 1 ));
- acc+=vidc_currentmode->vdsr; vidc_write(VIDC_VDSR,(acc - 1 ));
- acc+=vidc_currentmode->vder; vidc_write(VIDC_VDER,(acc - 1 ));
- acc+=vidc_currentmode->vber; vidc_write(VIDC_VBER,(acc - 1 ));
- acc+=vidc_currentmode->vcr; vidc_write(VIDC_VCR ,(acc - 1 ));
-
- WriteWord(IOMD_FSIZE, vidc_currentmode->vcr
- + vidc_currentmode->vswr
- + vidc_currentmode->vber
- + vidc_currentmode->vbsr - 1 );
-
- if ( dispsize==1024*1024 )
- vidc_write ( VIDC_DCTL, vidc_currentmode->hder>>2 | 1<<16 | 1<<12);
- else
- vidc_write ( VIDC_DCTL, vidc_currentmode->hder>>2 | 3<<16 | 1<<12);
-
- vidc_write ( VIDC_EREG, 1<<12 );
- if ( dispsize>1024*1024) {
- if ( vidc_currentmode->hder>=800 )
- vidc_write ( VIDC_CONREG, 7<<8 | bpp_mask<<5);
- else
- vidc_write ( VIDC_CONREG, 6<<8 | bpp_mask<<5);
- } else {
- vidc_write ( VIDC_CONREG, 7<<8 | bpp_mask<<5);
- }
- }
-
- R_DATA->mode = *vidc_currentmode;
- R_DATA->screensize = R_DATA->XRES * R_DATA->YRES * R_DATA->BITSPERPIXEL/8;
- R_DATA->pixelsperbyte = 8 / R_DATA->BITSPERPIXEL;
- R_DATA->frontporch = MODE.hswr + MODE.hbsr + MODE.hdsr;
- R_DATA->topporch = MODE.vswr + MODE.vbsr + MODE.vdsr;
- R_DATA->bytes_per_line = R_DATA->XRES *
- R_DATA->font->y_spacing/R_DATA->pixelsperbyte;
- R_DATA->bytes_per_scroll = (vc->ycur % R_DATA->font->y_spacing)
- * vc->xcur / R_DATA->pixelsperbyte;
- R_DATA->text_width = R_DATA->XRES / R_DATA->font->x_spacing;
- R_DATA->text_height = R_DATA->YRES / R_DATA->font->y_spacing;
- vc->xchars = R_DATA->text_width;
- vc->ychars = R_DATA->text_height;
-}
-
-void
-physcon_display_base(base)
- u_int base;
-{
- dispstart = dispstart-dispbase + base;
- dispbase = vmem_base = base;
- dispend = base + dispsize;
- ptov = dispbase - phys_base;
-}
-
-static struct vidc_info masterinfo;
-static int cursor_init = 0;
-
-int
-vidcconsole_init(vc)
- struct vconsole *vc;
-{
- struct vidc_info *new;
- int loop;
-
- if ( cold_init==0 ) {
- vidcconsole_coldinit ( vc );
- } else {
- if ( cursor_init == 0 )
- vidcconsole_flash_go ( vc );
- }
-
- /*
- * If vc->r_data is initialised then this means that the previous
- * render engine on this vconsole was not freed properly. I should
- * not try to clear it up, since I could panic the kernel. Instead
- * I forget about its memory, which could cause a memory leak, but
- * this would be easily detectable and fixable
- */
-
-#ifdef SELFTEST
- if ( vc->r_data != 0 ) {
- printf( "*********************************************************\n" );
- printf( "You have configured SELFTEST mode in the console driver\n" );
- printf( "vc->rdata non zero. This could mean a new console\n" );
- printf( "render engine has not freed up its data structure when\n" );
- printf( "exiting.\n" );
- printf( "DO NOT COMPILE NON DEVELOPMENT KERNELS WITH SELFTEST\n" );
- printf( "*********************************************************" );
- }
-#endif
-
- if ( vc==vconsole_master ) {
- vc->r_data = (char *)&masterinfo;
- } else {
- MALLOC ( (vc->r_data), char *, sizeof(struct vidc_info),
- M_DEVBUF, M_NOWAIT );
- }
-
- if (vc->r_data==0)
- panic ( "render engine initialisation failed. CLEAN THIS UP!" );
-
- R_DATA->normalfont = &font_normal;
- R_DATA->italicfont = &font_italic;
- R_DATA->boldfont = &font_bold;
- R_DATA->font = R_DATA->normalfont;
-
- vidcconsole_mode ( vc, vidc_currentmode );
- R_DATA->scrollback_end = dispstart;
-
- new = (struct vidc_info *)vc->r_data;
-
- R_DATA->text_colours = 1 << R_DATA->BITSPERPIXEL;
- if ( R_DATA->text_colours > 8 ) R_DATA->text_colours = 8;
-
-#ifdef INVERSE_CONSOLE
- R_DATA->n_backcolour = R_DATA->text_colours - 1;
- R_DATA->n_forecolour = 0;
-#else
- R_DATA->n_backcolour = 0;
- R_DATA->n_forecolour = R_DATA->text_colours - 1;
-#endif
-
- R_DATA->backcolour = R_DATA->n_backcolour;
- R_DATA->forecolour = R_DATA->n_forecolour;
-
- R_DATA->forefillcolour = 0;
- R_DATA->backfillcolour = 0;
-
- R_DATA->bold = 0;
- R_DATA->reverse = 0;
-
- for (loop = 0; loop < R_DATA->pixelsperbyte; ++loop) {
- R_DATA->forefillcolour |= (R_DATA->forecolour <<
- loop * R_DATA->BITSPERPIXEL);
- R_DATA->backfillcolour |= (R_DATA->backcolour <<
- loop * R_DATA->BITSPERPIXEL);
- }
-
- R_DATA->fast_render = R_DATA->forecolour | (R_DATA->backcolour<<8) | (R_DATA->font->pixel_height<<16);
- R_DATA->blanked=0;
- vc->BLANK ( vc, BLANK_NONE );
-
- if ( vc == vconsole_current )
- vidcconsole_textpalette ( vc );
-
- vidc_cursor_init ( vc ) ;
-
- if ( cold_init == 0 ) {
- vidc_write ( VIDC_CP1, 0x0 );
- vidc_write ( VIDC_CP2, 0x0 );
- vidc_write ( VIDC_CP3, 0x0 );
- }
- cold_init=1;
- return 0;
-}
-
-void
-vidcconsole_putchar(dev, c, vc)
- dev_t dev;
- char c;
- struct vconsole *vc;
-{
- vc->PUTSTRING ( &c, 1, vc );
-}
-
-int
-vidcconsole_spawn(vc)
- struct vconsole *vc;
-{
- vc->xchars = R_DATA->text_width;
- vc->ychars = R_DATA->text_height;
- vc->xcur = 0;
- vc->ycur = 0;
- vc->flags = 0;
- return 0;
-}
-
-int
-vidcconsole_redraw(vc, x, y, a, b)
- struct vconsole *vc;
- int x, y;
- int a, b;
-{
- int xs, ys;
- struct vidc_state vidc;
- font_struct *p_font = R_DATA->font;
- int p_forecol = R_DATA->forecolour;
- int p_backcol = R_DATA->backcolour;
- if (x<0) x=0;
- if (y<0) y=0;
- if (x>(vc->xchars-1)) x=vc->xchars-1;
- if (y>(vc->ychars-1)) x=vc->ychars-1;
-
- if (a>(vc->xchars-1)) a=vc->xchars-1;
- if (b>(vc->ychars-1)) b=vc->ychars-1;
-
- if (a<x) a=x;
- if (b<y) b=y;
-
-
- vidc = *vidc_current;
- xs=vc->xcur;
- ys=vc->ycur;
-
- vc->xcur = 0;
- vc->ycur = 0;
- if ( (vc->flags&LOSSY) == 0 )
- {
- register int c;
- /* This has *GOT* to be turboed */
- for ( vc->ycur=y; vc->ycur<=b; vc->ycur++ )
- {
- for ( vc->xcur=x; vc->xcur<=a; vc->xcur++ )
- {
- c = (vc->charmap)[vc->xcur+vc->ycur*vc->xchars];
- if ((c&BOLD)!=0)
- R_DATA->font = R_DATA->boldfont;
- else
- R_DATA->font = R_DATA->normalfont;
-R_DATA->fast_render = ((c>>8)&0x7)|(((c>>11)&0x7)<<8)| (R_DATA->font->pixel_height<<16);
-if ( c & BLINKING )
- c+=1<<8 | 1;
- if ((c&BLINKING)!=0)
- {
- R_DATA->forecolour+=16;
- R_DATA->backcolour+=16;
- }
- vidcconsole_render( vc, c&0xff );
- }
- }
- }
- vc->xcur = xs;
- vc->ycur = ys;
- R_DATA->forecolour = p_forecol;
- R_DATA->backcolour = p_backcol;
- R_DATA->font = p_font;
- return 0;
-}
-
-
-int
-vidcconsole_swapin(vc)
- struct vconsole *vc;
-{
- register int counter;
- int xs, ys;
- struct vidc_state vidc;
- font_struct *p_font = R_DATA->font;
- int p_forecol = R_DATA->forecolour;
- int p_backcol = R_DATA->backcolour;
-
-#ifdef ACTIVITY_WARNING
- vconsole_pending = 0;
-#endif
- vidc_write ( VIDC_CP1, 0x0 );
-
- vidc = *vidc_current;
- vidc_write ( VIDC_PALREG, 0x00000000 );
- for ( counter=0; counter<255; counter++ )
- vidc_write ( VIDC_PALETTE, 0x00000000 );
- xs=vc->xcur;
- ys=vc->ycur;
-/*TODO This needs to be vidc_restore (something) */
- vidcconsole_mode ( vc, &MODE );
-
- vc->xcur = 0;
- vc->ycur = 0;
- if ( (vc->flags&LOSSY) == 0 )
- {
- register int c;
- /* This has *GOT* to be turboed */
- for ( vc->ycur=0; vc->ycur<vc->ychars; vc->ycur++ )
- {
- for ( vc->xcur=0; vc->xcur<vc->xchars; vc->xcur++ )
- {
- c = (vc->charmap)[vc->xcur+vc->ycur*vc->xchars];
- if ((c&BOLD)!=0)
- R_DATA->font = R_DATA->boldfont;
- else
- R_DATA->font = R_DATA->normalfont;
-/*
- R_DATA->forecolour = ((c>>8)&0x7);
- R_DATA->backcolour = ((c>>11)&0x7);
-*/
-R_DATA->fast_render = ((c>>8)&0x7)|(((c>>11)&0x7)<<8)| (R_DATA->font->pixel_height<<16);
-if ( c & BLINKING )
- c+=1<<8 | 1;
- if ((c&BLINKING)!=0)
- {
- R_DATA->forecolour+=16;
- R_DATA->backcolour+=16;
- }
- vidcconsole_render( vc, c&0xff );
- }
- }
- }
- else
- {
- vc->CLS ( vc );
- }
-
- if ( vc->vtty==1 )
- {
- vc->xcur = xs;
- vc->ycur = ys;
- vidcconsole_textpalette ( vc );
- vidc_write ( VIDC_CP1, 0xffffff );
- R_DATA->forecolour = p_forecol;
- R_DATA->backcolour = p_backcol;
- R_DATA->font = p_font;
- }
-/* Make the cursor blank */
- WriteWord(IOMD_CURSINIT,p_cursor_transparent);
- return 0;
-
-}
-
-int
-vidcconsole_mmap(vc, offset, nprot)
- struct vconsole *vc;
- int offset;
- int nprot;
-{
- if (offset > videomemory.vidm_size)
- return (-1);
- return(arm_byte_to_page(((videomemory.vidm_pbase) + (offset))));
-}
-
-extern void vidcconsolemc_render __P(( unsigned char *addr, unsigned char *fontaddr,
- int fast_render, int xres ));
-
-void
-vidcconsole_render(vc, c)
- struct vconsole *vc;
- char c;
-{
- register unsigned char *fontaddr;
- register unsigned char *addr;
-
- /* Calculate the font's address */
-
- fontaddr = R_DATA->font->data
- + ((c-(0x20)) * R_DATA->font->height
- * R_DATA->font->width);
-
- addr = (unsigned char *)dispstart
- + (vc->xcur * R_DATA->font->x_spacing)
- + (vc->ycur * R_DATA->bytes_per_line);
-
- vidcconsolemc_render ( addr, fontaddr, R_DATA->fast_render,
- R_DATA->XRES );
-}
-
-/*
- * Uugh. vidc graphics dont support scrolling regions so we have to emulate
- * it here. This would normally require much software scrolling which is
- * horriblly slow, so I'm going to try and do a composite scroll, which
- * causes problems for scrollback but it's less speed critical
- */
-
-void
-vidcconsole_scrollup(vc, low, high)
- struct vconsole *vc;
- int low;
- int high;
-{
- unsigned char *start, *end;
-
- if ( ( low==0 ) && ( high==vc->ychars-1 ))
- {
- /* All hardware scroll */
- dispstart+=R_DATA->bytes_per_line;
- if ( dispstart >= dispend )
- dispstart -= dispsize;
-
- high=high+1; /* Big hack */
-
- WriteWord(IOMD_VIDINIT, dispstart - ptov );
- }
- else
- {
- char *oldstart=(char *)dispstart;
-
- /* Composite scroll */
-
- if ( (high-low) > (vc->ychars>>1) )
- {
- /* Scroll region greater than half the screen */
-
- dispstart+=R_DATA->bytes_per_line;
- if ( dispstart >= dispend ) dispstart -= dispsize;
-
- WriteWord(IOMD_VIDINIT, dispstart - ptov );
-
- if ( low!=0 )
- {
- start = (unsigned char *)oldstart;
- end=(unsigned char*)oldstart+((low+1) * R_DATA->bytes_per_line);
- BCOPY ( start, start+R_DATA->bytes_per_line,
- end-start-R_DATA->bytes_per_line);
- }
-
- if ( high!=(vc->ychars-1) )
- {
- start =(unsigned char *)dispstart+(high)*R_DATA->bytes_per_line;
- end=(unsigned char*)dispstart+((vc->ychars)*R_DATA->bytes_per_line);
- BCOPY ( start, start+R_DATA->bytes_per_line,
- end-start-R_DATA->bytes_per_line);
- }
- high++;
- }
- else
- {
- /* Scroll region less than half the screen */
-
- /* NO COMPOSITE SCROLL YET */
-
- high++;
- if (low<0) low=0;
- if (high>(vc->ychars)) high=vc->ychars;
- if (low>high) return; /* yuck */
- start = (unsigned char *)dispstart + ((low)*R_DATA->bytes_per_line);
- end = (unsigned char *)dispstart + ((high)*R_DATA->bytes_per_line);
- BCOPY ( start+R_DATA->bytes_per_line, start,
- (end-start)-R_DATA->bytes_per_line );
- R_DATA->scrollback_end = dispstart;
- }
- }
- memset ( (char *) dispstart + ((high-1)*R_DATA->bytes_per_line) ,
- R_DATA->backfillcolour,
- R_DATA->bytes_per_line );
-}
-
-void
-vidcconsole_scrolldown(vc, low, high)
- struct vconsole *vc;
- int low;
- int high;
-{
- unsigned char *start;
- unsigned char *end;
-
- if ( low<0 ) low = 0;
- if ( high>(vc->ychars-1) ) high=vc->ychars-1;
-
- if ( ( low==0 ) && ( high==vc->ychars-1 ))
- {
- dispstart-=R_DATA->bytes_per_line;
-
- if ( dispstart < dispbase )
- dispstart += dispsize;
-
- WriteWord(IOMD_VIDINIT, dispstart - ptov );
- }
- else
- {
- if ( ((high-low) > (vc->ychars>>1)) )
- {
-high--;
- if (high!=(vc->ychars-1))
- {
- start =(unsigned char*)dispstart+((high+1)*R_DATA->bytes_per_line);
- end=(unsigned char*)dispstart+((vc->ychars)*R_DATA->bytes_per_line);
- BCOPY ( start+R_DATA->bytes_per_line, start,
- (end-start)-R_DATA->bytes_per_line );
- }
-
- dispstart-=R_DATA->bytes_per_line;
- if ( dispstart < dispbase )
- dispstart += dispsize;
- WriteWord(IOMD_VIDINIT, dispstart - ptov );
- start = (unsigned char *)dispstart + (low * R_DATA->bytes_per_line);
-
- if (low!=0)
- {
- end = (unsigned char *)dispstart + ((low+1)*R_DATA->bytes_per_line);
- BCOPY ( (char*)(dispstart+R_DATA->bytes_per_line),
- (char *)dispstart,
- (int)((end-dispstart)-R_DATA->bytes_per_line ));
- }
- }
- else
- {
- start = (unsigned char *)dispstart + (low * R_DATA->bytes_per_line);
- end = (unsigned char *)dispstart + ((high+1) * R_DATA->bytes_per_line);
- BCOPY ( start, start+R_DATA->bytes_per_line, end-start-R_DATA->bytes_per_line);
- }
-
- }
- memset ((char*) dispstart + (low*R_DATA->bytes_per_line) ,
- R_DATA->backfillcolour, R_DATA->bytes_per_line );
-}
-
-void
-vidcconsole_cls(vc)
- struct vconsole *vc;
-{
-#ifdef RC7500
- dispstart = dispbase;
- dispend = dispstart+dispsize;
-
- WriteWord ( IOMD_VIDINIT, dispstart-ptov );
- WriteWord ( IOMD_VIDSTART, dispstart-ptov );
- WriteWord ( IOMD_VIDEND, (dispend-transfersize)-ptov );
-#endif
-
- vidcconsolemc_cls ( (char *)dispstart, (char *)dispstart+R_DATA->screensize, R_DATA->backfillcolour );
- /*
- memset((char *)dispstart,
- R_DATA->backfillcolour, R_DATA->screensize);
- */
- vc->xcur = vc->ycur = 0;
-}
-
-void
-vidcconsole_update(vc)
- struct vconsole *vc;
-{
-}
-
-static char vidcconsole_name[] = VIDC_ENGINE_NAME;
-
-static int scrollback_ptr = 0;
-
-int
-vidcconsole_scrollback(vc)
- struct vconsole *vc;
-{
- int temp;
-
- if (scrollback_ptr==0)
- scrollback_ptr=dispstart;
-
- temp = scrollback_ptr;
-
- scrollback_ptr-=R_DATA->bytes_per_line * (vc->ychars-2);
-
- if ( scrollback_ptr < dispbase )
- scrollback_ptr += dispsize;
-
- if ( (scrollback_ptr>dispstart)&&
- (scrollback_ptr<(dispstart+R_DATA->screensize) ) )
- {
- scrollback_ptr=temp;
- return 0;
- }
-
- vc->r_scrolledback = 1;
-
- WriteWord(IOMD_VIDINIT, scrollback_ptr - ptov );
- return 0;
-}
-
-int
-vidcconsole_scrollforward(vc)
- struct vconsole *vc;
-{
- register int temp;
-
- if (scrollback_ptr==0)
- return 0;
-
- temp = scrollback_ptr;
-
- scrollback_ptr+=R_DATA->bytes_per_line * (vc->ychars - 2);
-
- if ( scrollback_ptr >= dispend )
- scrollback_ptr -= dispsize;
-
- if ( scrollback_ptr == dispstart )
- {
- WriteWord(IOMD_VIDINIT, scrollback_ptr - ptov );
- scrollback_ptr=0;
- vc->r_scrolledback = 0;
- return 0;
- }
-
- WriteWord(IOMD_VIDINIT, scrollback_ptr - ptov );
- return 0;
-}
-
-int
-vidcconsole_scrollbackend(vc)
- struct vconsole *vc;
-{
- scrollback_ptr = 0;
- WriteWord(IOMD_VIDINIT, dispstart - ptov );
- vc->r_scrolledback = 0;
- return 0;
-}
-
-int
-vidcconsole_clreos(vc, code)
- struct vconsole *vc;
- int code;
-{
- char *addr;
- char *endofscreen;
-
- addr = (unsigned char *)dispstart
- + (vc->xcur * R_DATA->font->x_spacing)
- + (vc->ycur * R_DATA->bytes_per_line);
-
- endofscreen = (unsigned char *)dispstart
- + (vc->xchars * R_DATA->font->x_spacing)
- + (vc->ychars * R_DATA->bytes_per_line);
-
-
- switch (code)
- {
- case 0:
- vidcconsolemc_cls ( addr,
- (unsigned char *)dispend,
- R_DATA->backfillcolour );
- if ((unsigned char *)endofscreen > (unsigned char *)dispend) {
- char string[80];
- sprintf(string, "(addr=%08x eos=%08x dispend=%08x dispstart=%08x base=%08x)",
- (u_int)addr, (u_int)endofscreen, dispend, dispstart, dispbase);
- dprintf(string);
- vidcconsolemc_cls((unsigned char *)dispbase, (unsigned char *)(dispbase + (endofscreen - dispend)), R_DATA->backfillcolour);
- }
- break;
-
- case 1:
- vidcconsolemc_cls ( (unsigned char *)dispstart+R_DATA->screensize,
- addr,
- R_DATA->backfillcolour );
- break;
-
- case 2:
- default:
- vidcconsole_cls ( vc );
- break;
- }
- return 0;
-}
-
-#define VIDC R_DATA->vidc
-
-int
-vidcconsole_debugprint(vc)
- struct vconsole *vc;
-{
-#ifdef DEVLOPING
- printf ( "VIDCCONSOLE DEBUG INFORMATION\n\n" );
- printf ( "res (%d, %d) charsize (%d, %d) cursor (%d, %d)\n"
- , R_DATA->XRES, R_DATA->YRES
- , vc->xchars, vc->ychars, vc->xcur, vc->ycur );
- printf ( "bytes_per_line %d\n" , R_DATA->bytes_per_line );
- printf ( "pixelsperbyte %d\n" , R_DATA->pixelsperbyte );
- printf ( "dispstart %08x\n" , dispstart );
- printf ( "dispend %08x\n" , dispend );
- printf ( "screensize %08x\n" , R_DATA->screensize );
-
- printf ( "fontwidth %08x\n" , R_DATA->font->pixel_width );
- printf ( "fontheight %08x\n" , R_DATA->font->pixel_height );
- printf ( "\n" );
- printf ( "palreg = %08x bcol = %08x\n" , VIDC.palreg, VIDC.bcol );
- printf ( "cp1 = %08x cp2 = %08x cp3 = %08x\n" , VIDC.cp1, VIDC.cp2, VIDC.cp3 );
- printf ( "hcr = %08x hswr = %08x hbsr = %08x\n" , VIDC.hcr, VIDC.hswr, VIDC.hbsr );
- printf ( "hder = %08x hber = %08x hcsr = %08x\n" , VIDC.hder, VIDC.hber, VIDC.hcsr );
- printf ( "hir = %08x\n" , VIDC.hir );
- printf ( "vcr = %08x vswr = %08x vbsr = %08x\n" , VIDC.vcr, VIDC.vswr, VIDC.vbsr );
- printf ( "vder = %08x vber = %08x vcsr = %08x\n" , VIDC.vder, VIDC.vber, VIDC.vcsr );
- printf ( "vcer = %08x\n" , VIDC.vcer );
- printf ( "ereg = %08x fsynreg = %08x conreg = %08x\n" , VIDC.ereg, VIDC.fsynreg, VIDC.conreg );
- printf ( "\n" );
- printf ( "flash %08x, cursor_flash %08x", R_DATA->flash, R_DATA->cursor_flash );
-#else
- printf ( "VIDCCONSOLE - NO DEBUG INFO\n" );
-#endif
- return 0;
-}
-
-#ifdef NICE_UPDATE
-static int need_update = 0;
-
-void
-vidcconsole_updatecursor(arg)
- void *arg;
-{
- struct vconsole *vc = vconsole_current;
-
- vidc_write(VIDC_HCSR, R_DATA->frontporch-17+ (vc->xcur)*R_DATA->font->pixel_width );
- vidc_write(VIDC_VCSR, R_DATA->topporch-2+ (vc->ycur+1)*R_DATA->font->pixel_height-2 + 3
- - R_DATA->font->pixel_height);
- vidc_write(VIDC_VCER, R_DATA->topporch-2+ (vc->ycur+3)*R_DATA->font->pixel_height+2 + 3 );
- return;
-}
-
-int
-vidcconsole_cursorupdate(vc)
- struct vconsole *vc;
-{
- timeout ( vidcconsole_updatecursor, NULL, 20 );
- return 0;
-}
-
-#else
-
-static int
-vidcconsole_cursorupdate(vc)
- struct vconsole *vc;
-{
- vidc_write(VIDC_HCSR, R_DATA->frontporch-17+ (vc->xcur)*R_DATA->font->pixel_width );
- vidc_write(VIDC_VCSR, R_DATA->topporch-2+ (vc->ycur+1)*R_DATA->font->pixel_height-2 + 3
- - R_DATA->font->pixel_height);
- vidc_write(VIDC_VCER, R_DATA->topporch-2+ (vc->ycur+3)*R_DATA->font->pixel_height+2 + 3 );
- return (0);
-}
-
-#endif
-
-#define DEFAULT_CURSORSPEED (25)
-
-static int CURSORSPEED = DEFAULT_CURSORSPEED;
-
-static int
-vidcconsole_cursorflashrate(vc, rate)
- struct vconsole *vc;
- int rate;
-{
- CURSORSPEED = 60/rate;
-}
-
-static int cursorcounter=DEFAULT_CURSORSPEED;
-static int flashcounter=DEFAULT_CURSORSPEED;
-#ifdef PRETTYCURSOR
-static int pretty=0xff;
-#endif
-
-static int cursor_col = 0x0;
-
-static int
-vidcconsole_cursorintr(vc)
- struct vconsole *vc;
-{
- if ( cursor_flash==0 )
- return 0;
-
- /*
- * We don't need this.
- */
-#ifndef RC7500
- vconsole_blankcounter--;
-
- if ( vconsole_blankcounter<0 ) {
- vconsole_blankcounter=vconsole_blankinit;
- vidcconsole_blank ( vc, BLANK_OFF );
- }
-#endif
-
- cursorcounter--;
- if (cursorcounter<=0) {
- cursorcounter=CURSORSPEED;
- cursor_col = cursor_col ^ 0xffffff;
-#ifdef ACTIVITY_WARNING
- if (vconsole_pending) {
- if ( cursor_col==0 )
- WriteWord(IOMD_CURSINIT,p_cursor_transparent);
- else
- WriteWord(IOMD_CURSINIT,p_cursor_normal);
- vidc_write ( VIDC_CP1, cursor_col&0xff );
- } else
-#endif
- {
- if ( cursor_col==0 )
- WriteWord(IOMD_CURSINIT,p_cursor_transparent);
- else
- WriteWord(IOMD_CURSINIT,p_cursor_normal);
- vidc_write ( VIDC_CP1, 0xffffff );
- }
- }
- return(0);
-}
-
-int
-vidcconsole_flashintr(vc)
- struct vconsole *vc;
-{
- if ( flash==0 )
- return 0;
-
- flashcounter--;
- if (flashcounter<=0) {
- flashcounter=CURSORSPEED;
- if ( cursor_col == 0 ) {
-
- vidc_write(VIDC_PALREG, 0x00000010);
- vidc_write(VIDC_PALETTE, VIDC_COL( 0, 0, 0));
- vidc_write(VIDC_PALETTE, VIDC_COL(255, 0, 0));
- vidc_write(VIDC_PALETTE, VIDC_COL( 0, 255, 0));
- vidc_write(VIDC_PALETTE, VIDC_COL(255, 255, 0));
- vidc_write(VIDC_PALETTE, VIDC_COL( 0, 0, 255));
- vidc_write(VIDC_PALETTE, VIDC_COL(255, 0, 255));
- vidc_write(VIDC_PALETTE, VIDC_COL( 0, 255, 255));
- vidc_write(VIDC_PALETTE, VIDC_COL(255, 255, 255));
- vidc_write(VIDC_PALETTE, VIDC_COL(128, 128, 128));
- vidc_write(VIDC_PALETTE, VIDC_COL(255, 128, 128));
- vidc_write(VIDC_PALETTE, VIDC_COL(128, 255, 128));
- vidc_write(VIDC_PALETTE, VIDC_COL(255, 255, 128));
- vidc_write(VIDC_PALETTE, VIDC_COL(128, 128, 255));
- vidc_write(VIDC_PALETTE, VIDC_COL(255, 128, 255));
- vidc_write(VIDC_PALETTE, VIDC_COL(255, 255, 255));
- } else {
- vidc_write(VIDC_PALREG, 0x00000010);
- vidc_write(VIDC_PALETTE, VIDC_COL( 0, 0, 0));
- vidc_write(VIDC_PALETTE, VIDC_COL( 0, 0, 0));
- vidc_write(VIDC_PALETTE, VIDC_COL( 0, 0, 0));
- vidc_write(VIDC_PALETTE, VIDC_COL( 0, 0, 0));
- vidc_write(VIDC_PALETTE, VIDC_COL( 0, 0, 0));
- vidc_write(VIDC_PALETTE, VIDC_COL( 0, 0, 0));
- vidc_write(VIDC_PALETTE, VIDC_COL( 0, 0, 0));
- vidc_write(VIDC_PALETTE, VIDC_COL( 0, 0, 0));
- vidc_write(VIDC_PALETTE, VIDC_COL( 0, 0, 0));
- vidc_write(VIDC_PALETTE, VIDC_COL( 0, 0, 0));
- vidc_write(VIDC_PALETTE, VIDC_COL( 0, 0, 0));
- vidc_write(VIDC_PALETTE, VIDC_COL( 0, 0, 0));
- vidc_write(VIDC_PALETTE, VIDC_COL( 0, 0, 0));
- vidc_write(VIDC_PALETTE, VIDC_COL( 0, 0, 0));
- vidc_write(VIDC_PALETTE, VIDC_COL( 0, 0, 0));
- vidc_write(VIDC_PALETTE, VIDC_COL( 0, 0, 0));
- }
- }
- return(0);
-}
-
-static int
-vidc_cursor_init(vc)
- struct vconsole *vc;
-{
- extern char *cursor_data;
- int counter;
- int line;
-
- /* Blank the cursor while initialising it's sprite */
-
- vidc_write ( VIDC_CP1, 0x0 );
- vidc_write ( VIDC_CP2, 0x0 );
- vidc_write ( VIDC_CP3, 0x0 );
-
- cursor_normal = cursor_data;
- cursor_transparent = cursor_data + (R_DATA->font->pixel_height *
- R_DATA->font->pixel_width);
-
- cursor_transparent += 32;
- cursor_transparent = (char *)((int)cursor_transparent & (~31) );
-
- for ( line = 0; line<R_DATA->font->pixel_height; ++ line )
- {
- for ( counter=0; counter<R_DATA->font->pixel_width/4;counter++ )
- cursor_normal[line*R_DATA->font->pixel_width + counter]=0x55;
- for ( ; counter<8; counter++ )
- cursor_normal[line*R_DATA->font->pixel_width + counter]=0;
- }
-
- for ( line = 0; line<R_DATA->font->pixel_height; ++ line )
- {
- for ( counter=0; counter<R_DATA->font->pixel_width/4;counter++ )
- cursor_transparent[line*R_DATA->font->pixel_width + counter]=0x00;
- for ( ; counter<8; counter++ )
- cursor_transparent[line*R_DATA->font->pixel_width + counter]=0;
- }
-
-
- p_cursor_normal = pmap_extract(kernel_pmap,(vm_offset_t)cursor_normal );
- p_cursor_transparent = pmap_extract(kernel_pmap,(vm_offset_t)cursor_transparent);
-
-/*
- memset ( cursor_normal, 0x55,
- R_DATA->font->pixel_width*R_DATA->font->pixel_height );
-
- memset ( cursor_transparent, 0x55,
- R_DATA->font->pixel_width*R_DATA->font->pixel_height );
-*/
-
- /* Ok, now see the cursor */
-
- vidc_write ( VIDC_CP1, 0xffffff );
- return 0;
-}
-
-int
-vidcconsole_setfgcol(vc, col)
- struct vconsole *vc;
- int col;
-{
- register int loop;
-
- if ( R_DATA->forecolour >= 16 )
- R_DATA->forecolour=16;
- else
- R_DATA->forecolour=0;
-
- R_DATA->forefillcolour = 0;
-
- R_DATA->forecolour += col;
-
-/*TODO
- if ( R_DATA->forecolour >> 1<<R_DATA->BITSPERPIXEL )
- R_DATA->forecolour>>1;
-*/
-
- for (loop = 0; loop < R_DATA->pixelsperbyte; ++loop) {
- R_DATA->forefillcolour |= (R_DATA->forecolour <<
- loop * R_DATA->BITSPERPIXEL);
- }
- R_DATA->fast_render = R_DATA->forecolour | (R_DATA->backcolour<<8) | (R_DATA->font->pixel_height<<16);
- return 0;
-}
-
-int
-vidcconsole_setbgcol(vc, col)
- struct vconsole *vc;
- int col;
-{
- register int loop;
-
- if ( R_DATA->backcolour >= 16 )
- R_DATA->backcolour=16;
- else
- R_DATA->backcolour=0;
-
- R_DATA->backfillcolour = 0;
- R_DATA->backcolour += col;
- /*TODO
- if ( R_DATA->backcolour >> 1<<R_DATA->BITSPERPIXEL )
- R_DATA->backcolour>>1;
-*/
-
- for (loop = 0; loop < R_DATA->pixelsperbyte; ++loop) {
- R_DATA->backfillcolour |= (R_DATA->backcolour <<
- loop * R_DATA->BITSPERPIXEL);
- }
- return 0;
-}
-
-int
-vidcconsole_textpalette(vc)
- struct vconsole *vc;
-{
- R_DATA->forecolour = COLOUR_WHITE_8;
- R_DATA->backcolour = COLOUR_BLACK_8;
-
- vidc_write( VIDC_PALREG , 0x00000000);
- vidc_write( VIDC_PALETTE , VIDC_COL( 0, 0, 0));
- vidc_write( VIDC_PALETTE , VIDC_COL(255, 0, 0));
- vidc_write( VIDC_PALETTE , VIDC_COL( 0, 255, 0));
- vidc_write( VIDC_PALETTE , VIDC_COL(255, 255, 0));
- vidc_write( VIDC_PALETTE , VIDC_COL( 0, 0, 255));
- vidc_write( VIDC_PALETTE , VIDC_COL(255, 0, 255));
- vidc_write( VIDC_PALETTE , VIDC_COL( 0, 255, 255));
- vidc_write( VIDC_PALETTE , VIDC_COL(255, 255, 255));
- vidc_write( VIDC_PALETTE , VIDC_COL(128, 128, 128));
- vidc_write( VIDC_PALETTE , VIDC_COL(255, 128, 128));
- vidc_write( VIDC_PALETTE , VIDC_COL(128, 255, 128));
- vidc_write( VIDC_PALETTE , VIDC_COL(255, 255, 128));
- vidc_write( VIDC_PALETTE , VIDC_COL(128, 128, 255));
- vidc_write( VIDC_PALETTE , VIDC_COL(255, 128, 255));
- vidc_write( VIDC_PALETTE , VIDC_COL(255, 255, 255));
-
-R_DATA->fast_render = R_DATA->forecolour | (R_DATA->backcolour<<8) | (R_DATA->font->pixel_height<<16);
- return 0;
-}
-
-int
-vidcconsole_sgr (vc, type)
- struct vconsole *vc;
- int type;
-{
- switch ( type )
- {
- case 0: /* Normal */
- if (R_DATA->BITSPERPIXEL == 8)
- {
- R_DATA->n_forecolour = COLOUR_WHITE_8;
- R_DATA->n_backcolour = COLOUR_BLACK_8;
- }
-
- R_DATA->forecolour = R_DATA->n_forecolour;
- R_DATA->backcolour = R_DATA->n_backcolour;
- R_DATA->font = R_DATA->normalfont;
- break;
-
- case 1: /* bold */
- R_DATA->font = R_DATA->boldfont;
- break;
-
- case 22: /* not bold */
- R_DATA->font = R_DATA->normalfont;
- break;
-
- case 5: /* blinking */
- if ( R_DATA->forecolour < 16 )
- {
- R_DATA->forecolour+=16;
- R_DATA->backcolour+=16;
- R_DATA->n_forecolour+=16;
- R_DATA->n_backcolour+=16;
- }
- break;
-
- case 25: /* not blinking */
- if ( R_DATA->forecolour >= 16 )
- {
- R_DATA->forecolour-=16;
- R_DATA->backcolour-=16;
- R_DATA->n_forecolour-=16;
- R_DATA->n_backcolour-=16;
- }
- break;
-
- case 7: /* reverse */
- R_DATA->forecolour = R_DATA->n_backcolour;
- R_DATA->backcolour = R_DATA->n_forecolour;
- break;
-
- case 27: /* not reverse */
- R_DATA->forecolour = R_DATA->n_forecolour;
- R_DATA->backcolour = R_DATA->n_backcolour;
- break;
- }
-R_DATA->fast_render = R_DATA->forecolour | (R_DATA->backcolour<<8) | (R_DATA->font->pixel_height<<16);
- return 0;
-}
-
-int
-vidcconsole_scrollregion(vc, low, high)
- struct vconsole *vc;
- int low;
- int high;
-{
- return 0;
-}
-
-int
-vidcconsole_blank(vc, type)
- struct vconsole *vc;
- int type;
-{
- vc->blanked=type;
- switch (type) {
- case 0:
-#ifdef RC7500
- vidc_write ( VIDC_EREG, 0x51<<12 );
-#else
- vidc_write ( VIDC_EREG, 1<<12 );
-#endif
- break;
-
- case 1: /* not implemented yet */
- case 2:
- case 3:
- vidc_write ( VIDC_EREG, 0 );
- break;
- }
- return 0;
-}
-
-extern struct tty *find_tp __P((dev_t dev));
-
-int vidcconsole_ioctl ( struct vconsole *vc, dev_t dev, int cmd, caddr_t data,
- int flag, struct proc *p )
-{
- int error;
- struct tty *tp;
- struct winsize ws;
- switch ( cmd )
- {
- case CONSOLE_MODE:
- tp = find_tp(dev);
- printf ( "mode ioctl called\n" );
- vidcconsole_mode ( vc, (struct vidc_mode *)data );
- vc->MODECHANGE ( vc );
- ws.ws_row=vc->ychars;
- ws.ws_col=vc->xchars;
- error = (*linesw[tp->t_line].l_ioctl)(tp, TIOCSWINSZ, (char *)&ws, flag, p);
- error = ttioctl(tp, TIOCSWINSZ, (char *)&ws, flag, p);
- return 0;
- break;
-
- case CONSOLE_RESETSCREEN:
- {
- extern unsigned int dispbase;
- extern unsigned int dispsize;
- extern unsigned int ptov;
- extern unsigned int transfersize;
-
- WriteWord ( IOMD_VIDINIT, dispbase-ptov );
- WriteWord ( IOMD_VIDSTART, dispbase-ptov );
- WriteWord ( IOMD_VIDEND, (dispbase+dispsize-transfersize)-ptov );
- return 0;
- }
- case CONSOLE_RESTORESCREEN:
- {
- extern unsigned int dispstart;
- extern unsigned int dispsize;
- extern unsigned int ptov;
- extern unsigned int transfersize;
-
- WriteWord ( IOMD_VIDINIT, dispstart-ptov );
- WriteWord ( IOMD_VIDSTART, dispstart-ptov );
- WriteWord ( IOMD_VIDEND, (dispstart+dispsize-transfersize)-ptov );
- vidc_stdpalette();
- return 0;
- }
- case CONSOLE_GETINFO:
- {
- extern videomemory_t videomemory;
- register struct console_info *inf = (void *)data;
-
-
- inf->videomemory = videomemory;
- inf->width = R_DATA->mode.hder;
- inf->height = R_DATA->mode.vder;
- inf->bpp = R_DATA->mode.bitsperpixel;
- return 0;
- }
- case CONSOLE_PALETTE:
- {
- register struct console_palette *pal = (void *)data;
- vidc_write(VIDC_PALREG, pal->entry);
- vidc_write(VIDC_PALETTE, VIDC_COL(pal->red, pal->green, pal->blue));
- return 0;
- }
- }
- return -1;
-}
-
-int
-vidcconsole_attach(vc, parent, self, aux)
- struct vconsole *vc;
- struct device *parent;
- struct device *self;
- void *aux;
-{
- vidc_cursor_init ( vc );
- vidcconsole_flash_go ( vc );
- return 0;
-}
-
-int
-vidcconsole_flash_go(vc)
- struct vconsole *vc;
-{
- static lock=0;
- if (lock==1)
- return -1;
- lock=0;
-
- cursor_ih.ih_func = vidcconsole_cursorintr;
- cursor_ih.ih_arg = vc;
- cursor_ih.ih_level = IPL_TTY;
- cursor_ih.ih_name = "vsync";
- irq_claim ( IRQ_FLYBACK, &cursor_ih );
-
- cursor_init = 0;
- return 0;
-}
-
-/* What does this function do ? */
-int
-vidcconsole_flash(vc, flash)
- struct vconsole *vc;
- int flash;
-{
- flash = flash;
-}
-
-int
-vidcconsole_cursorflash(vc, flash)
- struct vconsole *vc;
- int flash;
-{
- cursor_flash = flash;
- return(0);
-}
-
-struct render_engine vidcconsole = {
- vidcconsole_name,
- vidcconsole_init,
-
- vidcconsole_putchar,
-
- vidcconsole_spawn,
- vidcconsole_swapin,
- vidcconsole_mmap,
- vidcconsole_render,
- vidcconsole_scrollup,
- vidcconsole_scrolldown,
- vidcconsole_cls,
- vidcconsole_update,
- vidcconsole_scrollback,
- vidcconsole_scrollforward,
- vidcconsole_scrollbackend,
- vidcconsole_clreos,
- vidcconsole_debugprint,
- vidcconsole_cursorupdate,
- vidcconsole_cursorflashrate,
- vidcconsole_setfgcol,
- vidcconsole_setbgcol,
- vidcconsole_textpalette,
- vidcconsole_sgr,
- vidcconsole_blank,
- vidcconsole_ioctl,
- vidcconsole_redraw,
- vidcconsole_attach,
- vidcconsole_flash,
- vidcconsole_cursorflash
-};
-
-
-
-
-
-
-
-struct vidcvideo_softc {
- struct device device;
- int sc_opened;
-};
-
-int
-vidcvideo_probe(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
-{
-/*
- struct vidcvideo_softc *vidcvideosoftc = (void *)match;
- struct mainbus_attach_args *mb = aux;
-*/
-
- return 1;
-}
-
-void
-vidcvideo_attach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct vidcvideo_softc *vidcvideosoftc = (void *)self;
- vidcvideosoftc->sc_opened=0;
-
- printf ( ": vidc 20\n" );
-}
-
-struct cfattach vidcvideo_ca = {
- sizeof (struct vidcvideo_softc), vidcvideo_probe, vidcvideo_attach
-};
-
-struct cfdriver vidcvideo_cd = {
- NULL, "vidcvideo", DV_DULL
-};
-
-int
-vidcvideoopen(dev, flags, fmt, p)
- dev_t dev;
- int flags;
- int fmt;
- struct proc *p;
-{
- struct vidcvideo_softc *sc;
- struct vconsole vconsole_new;
- int unit = minor(dev);
- int s;
-
- if ( unit >= vidcvideo_cd.cd_ndevs )
- return ENXIO;
- sc = vidcvideo_cd.cd_devs[unit];
- if (!sc)
- return ENXIO;
-
- s = spltty();
-/* if (sc->sc_opened) {
- (void)splx(s);
- return(EBUSY);
- }*/
- ++sc->sc_opened;
- (void)splx(s);
-
- if (sc->sc_opened == 1) {
- vconsole_new = *vconsole_default;
- vconsole_new.render_engine = &vidcconsole;
- vconsole_spawn_re (
- makedev ( physcon_major, 64 + minor(dev) ),
- &vconsole_new );
- } else {
- log(LOG_WARNING, "Multiple open of/dev/vidcvideo0 by proc %d\n", p->p_pid);
- }
-
- return 0;
-}
-
-int
-vidcvideoclose(dev, flags, fmt, p)
- dev_t dev;
- int flags;
- int fmt;
- struct proc *p;
-{
- struct vidcvideo_softc *sc;
- int unit = minor(dev);
- int s;
-
- if ( unit >= vidcvideo_cd.cd_ndevs )
- return ENXIO;
- sc = vidcvideo_cd.cd_devs[unit];
- if (!sc)
- return ENXIO;
-
- s = spltty();
- --sc->sc_opened;
- (void)splx(s);
-
- return 0;
-}
-
-extern int physconioctl __P(( dev_t, int, caddr_t, int, struct proc *));
-
-int
-vidcvideoioctl(dev, cmd, data, flag, p)
- dev_t dev;
- int cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- dev = makedev(physcon_major, 64 + minor(dev));
- return ( physconioctl ( dev, cmd, data, flag, p ));
-}
-
-extern int physconmmap __P((dev_t, int, int));
-
-int
-vidcvideommap(dev, offset, prot)
- dev_t dev;
- int offset;
- int prot;
-{
- dev = makedev(physcon_major, 64 + minor(dev));
- return(physconmmap(dev, offset, prot));
-}
-
diff --git a/sys/arch/arm32/dev/console/vt220.c b/sys/arch/arm32/dev/console/vt220.c
deleted file mode 100644
index 41bb883da3b..00000000000
--- a/sys/arch/arm32/dev/console/vt220.c
+++ /dev/null
@@ -1,2008 +0,0 @@
-/* $NetBSD: vt220.c,v 1.3 1996/03/18 19:33:10 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1995 Melvyn Tang-Richardson
- * Copyright (c) 1994-1995 RiscBSD kernel team
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD kernel team
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE RISCBSD TEAM ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * vt220.c
- *
- * VT220 emulation functions
- *
- * Created : 17/09/94
- */
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/malloc.h>
-#include <sys/tty.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/systm.h>
-#include <sys/syslog.h>
-#include <machine/param.h>
-#include <machine/katelib.h>
-#include <machine/cpu.h>
-#include <machine/bootconfig.h>
-#include <machine/iomd.h>
-#include <machine/vconsole.h>
-#include <machine/vidc.h>
-
-#include <arm32/dev/console/vt220.h>
-
-/* Temporary for debugging the vnode bug */
-
-int vnodeconsolebug = 0;
-u_int vnodeconsolebug1 = 0;
-u_int vnodeconsolebug2 = 0;
-
-static char vt220_name[] = "vt100";
-
-/* These defines are for the developer only !!!! */
-#define SELFTEST
-#define dprintf(x) ;
-
-/*************************************************/
-
-#define FGCOL 0x0700
-#define BGCOL 0x3800
-
-/* Options */
-#define HARD_RESET_AT_INIT
-#undef SIMPLE_CURSOR /* Define if any render engine is cursorless */
-
-/*************************************************/
-
-#define DA_VT220 "\033[?62;1;2;6;7;8;9c"
-
-char console_proc[41]; /* Is this debugging ? */
-
-#ifdef SIMPLE_CURSOR
-#define SIMPLE_CURSOR_CHAR ('_')
-#endif
-
-#define TERMTYPE_PUTSTRING vt220_putstring
-#define TERMTYPE_INIT vt220_init
-
-extern struct vconsole *vconsole_master;
-
-static int default_beepstate = 0;
-
-#define CDATA struct vt220_info *cdata = (struct vt220_info *)vc->data
-
-struct vt220_info master_termdata_store;
-struct vt220_info *master_termdata = &master_termdata_store;
-
-int do_render __P(( char /*c*/, struct vconsole */*vc*/ ));
-void do_render_noscroll __P(( char /*c*/, struct vconsole */*vc*/ ));
-void do_scrollcheck __P(( struct vconsole */*vc*/ ));
-void vt_ris __P((struct vconsole */*vc*/));
-
-void
-clr_params(cdata)
- struct vt220_info *cdata;
-{
- int i;
- for (i=0; i<MAXPARMS; i++)
- cdata->param[i] = 0;
- cdata->parami = 0;
-}
-
-int
-TERMTYPE_INIT(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata;
-
- if (vc->data==NULL) {
- if ( vc==vconsole_master ) {
- vc->data = (char *) master_termdata;
- } else {
- MALLOC ( vc->data, char *, sizeof(struct vt220_info),
- M_DEVBUF, M_NOWAIT );
- }
- }
-
- cdata = (struct vt220_info *)vc->data;
-
- bzero ( (char *)cdata, sizeof (cdata) );
-
-#ifdef HARD_RESET_AT_INIT
- vt_ris ( vc );
-#else
- cdata->state = STATE_INIT;
- cdata->disable_function = 1;
- cdata->m_om = 0;
- vc->xcur = vc->ycur = 0;
- cdata->beepoff=default_beepstate;
- cdata->simple_cursor_store = ' ';
- cdata->scrr_beg = 0;
- cdata->scrr_len = vc->ychars;
- cdata->scrr_end = vc->ychars-1;
- cdata->simple_cursor_on = 0;
-
- for ( counter=0; counter<MAXTABSTOPS; counter++ ) {
- if ( !(counter%8) )
- cdata->tab_stops[counter] = 1;
- else
- cdata->tab_stops[counter] = 0;
- }
-#endif
- return 0;
-}
-
-int
-mapped_cls(vc)
- struct vconsole *vc;
-{
- int ptr;
- if (vc->charmap == NULL)
- return -1;
- for ( ptr=0; ptr<(vc->xchars*vc->ychars); ptr++ )
- vc->charmap[ptr]=0x20;
- return 0;
-}
-
-void
-do_scrolldown(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
-
-/*
- if ( ( cdata->scrr_beg<0 ) || ( cdata->scrr_end>=vc->ychars) )
- dprintf ( "INVALID SCROLLDOWN" );
-*/
-
- /* Clean up */
-
-/*
- if ( cdata->scrr_beg < 0 ) cdata->scrr_beg = 0;
-*/
- if ( cdata->scrr_end >= vc->ychars ) cdata->scrr_end=vc->ychars-1;
-
-
- if (vc==vconsole_current)
- vc->SCROLLDOWN ( vc, cdata->scrr_beg, cdata->scrr_end );
- else
- vconsole_pending=vc->number;
-
- if (vnodeconsolebug) {
- if (ReadWord(0xf148a000) != vnodeconsolebug2) {
- log(LOG_WARNING, "vnode 0xf148a000 v_flag changed from %08x to %08x in do_scrolldown(1)\n",
- vnodeconsolebug2, ReadWord(0xf148a000));
- log(LOG_WARNING, "vc=%08x vcur=%08x charmap=%08x\n", vc, vconsole_current, vc->charmap);
- }
- }
-
-/*
- * This version of the following code was responcible for the vnode bug
- * It can trash part of the word that follows the allocated block
- * e.g. charmap = 0xf1484000, size 0x6000
- * vnode = 0xf148a000
- * first word of vnode is trashed.
- * bug is an adjustment of -1 for counting backwards was not made.
-
- if ( ((vc->flags)&(LOSSY)) == 0 ) {
- int counter;
- for ( counter=((cdata->scrr_end+1)*(vc->xchars));
- counter > (cdata->scrr_beg+1)*(vc->xchars) ; counter-- ) {
- vc->charmap[counter] = vc->charmap[counter-vc->xchars];
- }
-
- for ( counter=(cdata->scrr_beg)*(vc->xchars);
- counter < (cdata->scrr_beg+1)*(vc->xchars); counter++ ) {
- vc->charmap[counter]=0x20;
- }
- }
-*/
- if ( ((vc->flags)&(LOSSY)) == 0 ) {
- int counter;
- for ( counter=((cdata->scrr_end+1)*(vc->xchars)) - 1;
- counter >= (cdata->scrr_beg+1)*(vc->xchars) ; counter-- ) {
- vc->charmap[counter] = vc->charmap[counter-vc->xchars];
- }
-
- for ( counter=(cdata->scrr_beg)*(vc->xchars);
- counter < (cdata->scrr_beg+1)*(vc->xchars); counter++ ) {
- vc->charmap[counter]=0x20;
- }
- }
- if (vnodeconsolebug) {
- if (ReadWord(0xf148a000) != vnodeconsolebug2) {
- log(LOG_WARNING, "vnode 0xf148a000 v_flag changed from %08x to %08x in do_scrolldown(2)\n",
- vnodeconsolebug2, ReadWord(0xf148a000));
- log(LOG_WARNING, "vc=%08x vcur=%08x charmap=%08x\n", vc, vconsole_current, vc->charmap);
- }
- }
-}
-
-void
-do_scrollup(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
-
- if (vc==vconsole_current)
- vc->SCROLLUP ( vc, cdata->scrr_beg, cdata->scrr_end );
- else
- vconsole_pending = vc->number;
-
- if ( cdata->scrr_end == 0 )
- vc->ycur=vc->ychars-1;
- else
- vc->ycur=cdata->scrr_end;
-
-/* Do a cyclic buffer for this !!!!!!!!!!!!!! */
- if ( ((vc->flags)&(LOSSY)) == 0 ) {
-/* bcopy was weird, do this for now */
- int counter;
- for ( counter=(cdata->scrr_beg+1)*vc->xchars;
- counter < ((cdata->scrr_end+1)*(vc->xchars)); counter++ ) {
- vc->charmap[counter-vc->xchars] = vc->charmap[counter];
- }
- for ( counter=vc->xchars*(cdata->scrr_end);
- counter < (vc->xchars*(cdata->scrr_end+1)); counter++ ) {
- vc->charmap[counter]=0x20;
- }
- }
-}
-
-void
-respond(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
-
- while (*cdata->report_chars && cdata->report_count > 0) {
- (*linesw[vc->tp->t_line].l_rint)
- (*cdata->report_chars++ & 0xff, vc->tp);
- cdata->report_count--;
- }
-}
-
-void
-vt_curadr(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
-
-#ifdef SELFTEST
-strcpy ( console_proc, "vt_curadr" );
-#endif
-
- if ( cdata->m_om ) /* relative to scrolling region */
- {
- cdata->param[0]+=cdata->scrr_beg;
- if ( (cdata->param[0]==0) && (cdata->param[1]==0) )
- {
- vc->xcur = 0;
- vc->ycur = 0;
- return;
- }
- /* Limit checking */
- cdata->param[0] = (cdata->param[0] <= 0) ? 1 : cdata->param[0];
- cdata->param[0] = (cdata->param[0] > vc->ychars) ? vc->ychars : cdata->param[0];
- cdata->param[1] = (cdata->param[1] <= 0) ? 1 : cdata->param[1];
- cdata->param[1] = (cdata->param[1] >= vc->xchars) ? (vc->xchars-1) : cdata->param[1];
- (cdata->param[0])--;
- (cdata->param[1])--;
- vc->ycur = cdata->param[0];
- vc->xcur = cdata->param[1];
- }
- else
- {
- if ( (cdata->param[0]==0) && (cdata->param[1]==0) )
- {
- vc->xcur = 0;
- vc->ycur = 0;
- return;
- }
- /* Limit checking */
-
- (cdata->param[0])--;
- (cdata->param[1])--;
-
- vc->ycur = cdata->param[0];
- vc->xcur = cdata->param[1];
-
-{
- char buf[80];
- sprintf ( buf, "vc->xcur %d vc->ycur %d", vc->xcur, vc->ycur );
- dprintf ( buf );
-}
- }
-}
-
-extern void beep_generate(void);
-
-void
-vt_reset_dec_priv_qm(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
-#ifdef SELFTEST
-strcpy ( console_proc, "vt_reset_dec_priv_qm" );
-#endif
- switch(cdata->param[0])
- {
- case 7: /* AWM - auto wrap mode */
- beep_generate();
- cdata->flags &= ~F_AWM;
- break;
- case 0: /* error, ignored */
- case 1: /* CKM - cursor key mode */
- case 2: /* ANM - ansi/vt52 mode */
- case 3: /* COLM - column mode */
- case 4: /* SCLM - scrolling mode */
- case 5: /* SCNM - screen mode */
- case 8: /* ARM - auto repeat mode */
- case 9: /* INLM - interlace mode */
- case 10: /* EDM - edit mode */
- case 11: /* LTM - line transmit mode */
- case 12: /* */
- case 13: /* SCFDM - space compression / field delimiting */
- case 14: /* TEM - transmit execution mode */
- case 15: /* */
- case 16: /* EKEM - edit key execution mode */
- case 25: /* TCEM - text cursor enable mode */
- case 42: /* NRCM - 7bit NRC characters */
- break;
-
- case 6: /* OM - origin mode */
- cdata->m_om = 0;
- break;
- }
-}
-
-void
-vt_sc(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
-
-#ifdef SELFTEST
- strcpy ( console_proc, "vt_sc" );
-#endif
-
- cdata->sc_G0 = cdata->G0;
- cdata->sc_G1 = cdata->G1;
- cdata->sc_G2 = cdata->G2;
- cdata->sc_G3 = cdata->G3;
- cdata->sc_GL = cdata->GL;
- cdata->sc_GR = cdata->GR;
- cdata->sc_xcur = vc->xcur;
- cdata->sc_ycur = vc->ycur;
- cdata->sc_om = cdata->m_om;
- cdata->sflags = cdata->flags;
-/*
- cdata->sc_attr = cdata->c_attr;
- cdata->sc_awm = cdata->m_awm;
- cdata->sc_sel = cdata->selchar;
- cdata->sc_vtsgr = cdata->vtsgr;
- cdata->sc_flag = 1;
-*/
-}
-
-void
-vt_rc(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
- cdata->G0 = cdata->sc_G0;
- cdata->G1 = cdata->sc_G1;
- cdata->G2 = cdata->sc_G2;
- cdata->G3 = cdata->sc_G3;
- cdata->GL = cdata->sc_GL;
- cdata->GR = cdata->sc_GR;
- vc->xcur = cdata->sc_xcur;
- vc->ycur = cdata->sc_ycur;
- cdata->m_om = cdata->sc_om;
- cdata->flags = cdata->sflags;
-
-/*
- cdata->c_attr = cdata->sc_attr;
- cdata->awm = cdata->sc_awm;
- cdata->sel = cdata->sc_selchar;
- cdata->vtsgr = cdata->sc_vtsgr;
- cdata->flag = 0;
-*/
-}
-
-void
-vt_clreol(vc)
- struct vconsole *vc;
-{
-/*
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
-*/
- int counter;
- int x = vc->xcur;
- int y = vc->ycur;
-
-#ifdef SELFTEST
- strcpy ( console_proc, "vt_clreol" );
-#endif
-
- for ( counter=vc->xcur; counter<vc->xchars; counter++ )
- do_render_noscroll ( ' ', vc );
-
- vc->xcur = x;
- vc->ycur = y;
-}
-
-/* index, move cursor down */
-
-void
-vt_ind(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
-
-#ifdef SELFTEST
- strcpy ( console_proc, "vt_ind" );
-#endif
-
- vc->ycur++;
-
- {
- char buf[80];
- sprintf ( buf, "{vt_ind [%d,%d] [%d,%d] }",
- vc->xcur, vc->ycur, cdata->scrr_beg, cdata->scrr_end);
- dprintf ( buf );
- }
-
- do_scrollcheck ( vc );
-}
-
-void
-vt_nel(vc)
- struct vconsole *vc;
-{
- vc->ycur++;
- do_scrollcheck ( vc );
- vc->xcur=0;
-}
-
-void
-vt_ri(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
-
- if (vnodeconsolebug & 1)
- vnodeconsolebug2 = ReadWord(0xf148a000);
-
- vc->ycur--;
-
- if (vc->ycur<=cdata->scrr_beg)
- vc->ycur = cdata->scrr_beg;
-
-
- if (vc->ycur <= cdata->scrr_beg) {
- if (vnodeconsolebug & 4) {
- if (ReadWord(0xf148a000) != vnodeconsolebug2) {
- log(LOG_WARNING, "vnode 0xf148a000 v_flag changed from %08x to %08x in vt_ri(1)\n",
- vnodeconsolebug2, ReadWord(0xf148a000));
- log(LOG_WARNING, "vc=%08x ycur=%d scrr_beg=%d\n", vc, vc->ycur, cdata->scrr_beg);
- vnodeconsolebug2 = ReadWord(0xf148a000);
- }
- }
- do_scrolldown ( vc );
- if (vnodeconsolebug & 4) {
- if (ReadWord(0xf148a000) != vnodeconsolebug2) {
- log(LOG_WARNING, "vnode 0xf148a000 v_flag changed from %08x to %08x in vt_ri(2)\n",
- vnodeconsolebug2, ReadWord(0xf148a000));
- log(LOG_WARNING, "vc=%08x ycur=%d scrr_beg=%d charmap=%08x\n", vc, vc->ycur, cdata->scrr_beg, vc->charmap);
- vnodeconsolebug2 = ReadWord(0xf148a000);
- }
- }
- vc->ycur = cdata->scrr_beg;
- }
-}
-
-/* selective in line erase */
-
-int
-vt_sel(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
- register int counter;
- register int x = vc->xcur;
- register int y = vc->ycur;
-
- switch ( cdata->param[0] )
- {
- case 0: /* Delete to the end of the line */
- for ( counter=x; counter<vc->xchars; counter++ )
- do_render_noscroll ( ' ', vc );
- break;
-
- case 1: /* Delete to the beginning of the line */
- vc->xcur = 0;
- for ( counter=0; counter<x; counter++ )
- do_render_noscroll ( ' ', vc );
- break;
-
- case 2: /* Delete the whole line */
- default:
- vc->xcur = 0;
- for ( counter=0; counter<vc->xchars; counter++ )
- do_render_noscroll ( ' ', vc );
- break;
- }
-
- vc->xcur = x;
- vc->ycur = y;
- return 0;
-}
-
-void
-vt_cuu(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
- cdata->param[0] = (cdata->param[0] <= 0) ? 1 : cdata->param[0];
- vc->ycur -= cdata->param[0];
- vc->ycur = vc->ycur < 0 ? 0 : vc->ycur;
-}
-
-void
-vt_cub(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
-
- cdata->param[0] = (cdata->param[0] <= 0) ? 1 : cdata->param[0];
-
- vc->xcur -= cdata->param[0];
- cdata->param[0] = (cdata->param[0] < 0 ) ? 0 : cdata->param[0];
-}
-
-void
-vt_da(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
- static u_char *response = (u_char *)DA_VT220;
-
- cdata->report_chars = response;
- cdata->report_count = 18;
- respond(vc);
-}
-
-void
-vt_str(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
- int counter;
-
- if (cdata == NULL) {
- return;
- }
-
- clr_params ( cdata );
-
- cdata->state = STATE_INIT;
- cdata->disable_function = 1;
- cdata->m_om = 0; /* origin mode */
- vc->xcur = vc->ycur = 0;
- cdata->beepoff=default_beepstate;
- cdata->simple_cursor_store = ' ';
- cdata->scrr_beg = 0;
- cdata->scrr_len = vc->ychars;
- cdata->scrr_end = vc->ychars-1;
- cdata->simple_cursor_on = 0;
- cdata->nfgcol = 7;
- cdata->nbgcol = 0;
- cdata->fgcol = cdata->nfgcol;
- cdata->bgcol = cdata->nbgcol;
- cdata->attribs=cdata->fgcol<<8 | cdata->bgcol<<11;
- cdata->sc_flag = 0; /* save cursor position */
- cdata->flags = F_AWM;
- cdata->irm = 0;
-
- for ( counter=0; counter<MAXTABSTOPS; counter++ )
- {
- if ( !(counter%8) )
- cdata->tab_stops[counter] = 1;
- else
- cdata->tab_stops[counter] = 0;
- }
-}
-
-void
-vt_ris(vc)
- struct vconsole *vc;
-{
- vc->xcur = vc->ycur = 0;
- vt_str(vc); /* and soft terminal reset */
-}
-
-void
-vt_cud(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
-
- cdata->param[0] = (cdata->param[0] <= 0) ? 1 : cdata->param[0];
-
- cdata->param[0] = (cdata->param[0] > (cdata->scrr_end-vc->ycur))
- ? (cdata->scrr_end-vc->ycur) : cdata->param[0];
-
- vc->ycur += cdata->param[0];
-
- do_scrollcheck ( vc );
-}
-
-void
-vt_tst(vc)
- struct vconsole *vc;
-{
- int counter, times;
-
- for ( times=0; times<100; times++ );
- for ( counter=32; counter<127; counter++ )
- do_render ( counter, vc );
-}
-
-void
-vt_il(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
- register int beg, end;
-
- if ( vc->ycur >= (vc->ychars-2) )
- return;
-
- cdata->param[0] = cdata->param[0]<=0 ? 1 : cdata->param[0];
-
- beg = cdata->scrr_beg;
- end = cdata->scrr_end;
-
- cdata->scrr_beg = vc->ycur;
- cdata->scrr_end = vc->ychars-1;
-
- for ( ; cdata->param[0]>0; cdata->param[0]-- )
- do_scrolldown( vc );
-
- cdata->scrr_beg = beg;
- cdata->scrr_end = end;
-}
-
-void
-vt_ic(vc)
- struct vconsole *vc;
-{
- int counter;
- int ox, oy;
- int *ptr = vc->charmap + (vc->xcur + vc->ycur*vc->xchars);
- for ( counter=vc->xchars-vc->xcur; counter>=0; counter-- )
- ptr[counter+1] = ptr[counter];
- ptr[0] = ' ';
- ox = vc->xcur; oy = vc->ycur;
-
- for ( ; vc->xcur < vc->xchars; )
- do_render_noscroll ( vc->charmap[vc->xcur+vc->ycur*vc->xchars], vc );
- vc->xcur = ox; vc->ycur = oy;
-}
-
-void
-vt_dch(vc)
- struct vconsole *vc;
-{
- int counter;
- int ox, oy;
- int *ptr = vc->charmap + (vc->ycur*vc->xchars);
-
- for ( counter=vc->xcur; counter<(vc->xchars-1); counter++ )
- ptr[counter] = ptr[counter+1];
-
- ptr[vc->xchars] = ' ';
-
- ox = vc->xcur; oy = vc->ycur;
-
- for ( ; vc->xcur < vc->xchars; )
- do_render_noscroll ( vc->charmap[vc->xcur+vc->ycur*vc->xchars], vc );
-
- vc->xcur = ox; vc->ycur = oy;
-}
-
-void
-vt_dl(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
- register int beg, end;
-
- cdata->param[0] = cdata->param[0]<=0 ? 1 : cdata->param[0];
- cdata->param[0] = cdata->param[0]>vc->xchars ? vc->xchars : cdata->param[0];
-
-/*
- vc->xcur=0;
-*/
-
- beg = cdata->scrr_beg;
- end = cdata->scrr_end;
-
- cdata->scrr_beg = vc->ycur;
- cdata->scrr_end = vc->ychars-1;
-
- for ( ; cdata->param[0]>0; cdata->param[0]-- )
- do_scrollup( vc );
-
- cdata->scrr_beg = beg;
- cdata->scrr_end = end;
-}
-
-/* Set scrolling region */
-
-void
-vt_stbm(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
-
- if((cdata->param[0] == 0) && (cdata->param[1] == 0))
- {
- cdata->xcur = 0;
- cdata->ycur = 0;
- cdata->scrr_beg = 0;
- cdata->scrr_len = vc->ychars;
- cdata->scrr_end = cdata->scrr_len - 1;
- return;
- }
- if(cdata->param[1] <= cdata->param[0])
- return;
-
- /* range parm 1 */
-
- cdata->scrr_beg = cdata->param[0]-1;
- cdata->scrr_len = cdata->param[1] - cdata->param[0] + 1;
- cdata->scrr_end = cdata->param[1]-1;
-
-/*
- if (cdata->scrr_beg<0)
- cdata->scrr_beg = 0;
-*/
-
- if (cdata->scrr_end>(vc->ychars-1))
- cdata->scrr_end = vc->ychars-1;
-
- cdata->scrr_len = cdata->scrr_end - cdata->scrr_beg - 1;
-{
- char buf[80];
- sprintf ( buf, "scrr_beg %d, scrr_end %d", cdata->scrr_beg,
- cdata->scrr_end );
- dprintf ( buf );
-}
-
- cdata->flags &= ~F_LASTCHAR;
-}
-
-void
-vt_dsr(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
- static u_char *answr = (u_char *)"\033[0n";
- static u_char *panswr = (u_char *)"\033[?13n"; /* Printer Unattached */
- static u_char *udkanswr = (u_char *)"\033[?21n"; /* UDK Locked */
- static u_char *langanswr = (u_char *)"\033[?27;1n"; /* North American*/
- static u_char buffer[16];
- int i = 0;
-
- switch(cdata->param[0])
- {
- case 5: /* return status */
- cdata->report_chars = answr;
- cdata->report_count = 4;
- respond(vc);
- break;
-
- case 6: /* return cursor position */
- buffer[i++] = 0x1b;
- buffer[i++] = '[';
- if((vc->ycur+1) > 10)
- buffer[i++] = ((vc->ycur+1) / 10) + '0';
- buffer[i++] = ((vc->ycur+1) % 10) + '0';
- buffer[i++] = ';';
- if((vc->xcur+1) > 10)
- buffer[i++] = ((cdata->xcur+1) / 10) + '0';
- buffer[i++] = ((vc->xcur+1) % 10) + '0';
- buffer[i++] = 'R';
- buffer[i++] = '\0';
-
- cdata->report_chars = buffer;
- cdata->report_count = i;
- respond(vc);
- break;
-
- case 15: /* return printer status */
- cdata->report_chars = panswr;
- cdata->report_count = 6;
- respond(vc);
- break;
-
- case 25: /* return udk status */
- cdata->report_chars = udkanswr;
- cdata->report_count = 6;
- respond(vc);
- break;
-
- case 26: /* return language status */
- cdata->report_chars = langanswr;
- cdata->report_count = 8;
- respond(vc);
- break;
-
- default: /* nothing else valid */
- break;
- }
-}
-
-void
-vt_su(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
-
- cdata->param[0] = cdata->param[0]<=0 ? 1 : cdata->param[0];
- cdata->param[0] = cdata->param[0]>(vc->xchars-1) ? vc->xchars-1 : cdata->param[0];
-
- do_scrollup ( vc );
-}
-
-void
-vt_set_dec_priv_qm(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
-
- switch(cdata->param[0])
- {
- case 7: /* AWM - auto wrap mode */
- cdata->flags |= F_AWM;
- break;
-
- /* Implement these */
- case 1: /* CKM - cursor key mode */
- case 3: /* COLM - column mode */
- case 6: /* OM - origin mode */
- case 8: /* ARM - auto repeat mode */
- case 25: /* TCEM - text cursor enable mode */
- break;
-
- case 0: /* error, ignored */
- case 2: /* ANM - ansi/vt52 mode */
- case 4: /* SCLM - scrolling mode */
- case 5: /* SCNM - screen mode */
- case 9: /* INLM - interlace mode */
- case 10: /* EDM - edit mode */
- case 11: /* LTM - line transmit mode */
- case 12: /* */
- case 13: /* SCFDM - space compression / field delimiting */
- case 14: /* TEM - transmit execution mode */
- case 15: /* */
- case 16: /* EKEM - edit key execution mode */
- case 42: /* NRCM - 7bit NRC characters */
- break;
- }
-}
-
-void
-vt_keyappl(vc)
- struct vconsole *vc;
-{
- dprintf ( "VT_KEYAPPL" );
-}
-
-void
-vt_clrtab(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
- int i;
-
- if(cdata->param[0] == 0)
- cdata->tab_stops[vc->xcur] = 0;
- else if(cdata->param[0] == 3)
- {
- for(i=0; i<MAXTABSTOPS; i++)
- cdata->tab_stops[i] = 0;
- }
-}
-
-/*
-void
-vt_cuf(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
-
- cdata->param[0] = (cdata->param[0] <= 0) ? 1 : cdata->param[0];
-
- vc->xcur += cdata->param[0];
-
- cdata->param[0] = (cdata->param[0] > vc->xchars ) ? vc->xchars : cdata->param[0];
-}
-*/
-
-void
-vt_cuf(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
- register int p = cdata->param[0];
-
- if(vc->xcur == ((vc->xchars)-1)) /* already at right margin */
- return;
- if(p <= 0) /* parameter min = 1 */
- p = 1;
- else if(p > ((vc->xchars)-1)) /* parameter max = 79 */
- p = ((vc->xchars)-1);
- if((vc->xcur + p) > ((vc->xchars)-1)) /* not more than */
- p = ((vc->xchars)-1) - vc->xcur;
- vc->xcur += p;
-}
-
-void
-vt_sgr(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
- register int i=0;
-
- do
- {
- vc->SGR ( vc, cdata->param[i] );
- switch ( cdata->param[i++] )
- {
- case 0: /* reset to normal attributes */
- cdata->fgcol = cdata->nfgcol;
- cdata->bgcol = cdata->nbgcol;
- cdata->attribs=cdata->fgcol<<8 | cdata->bgcol<<11;
- break;
- case 1: /* bold */
- cdata->attribs |= BOLD;
- break;
- case 4: /* underline */
- cdata->attribs |= UNDERLINE;
- break;
- case 5: /* blinking */
- cdata->attribs |= BLINKING;
- break;
- case 7: /* reverse */
- cdata->fgcol = cdata->nbgcol;
- cdata->bgcol = cdata->nfgcol;
- cdata->attribs |= REVERSE;
- cdata->attribs&=~0x3F00;
- cdata->attribs|=cdata->fgcol<<8 | cdata->bgcol<<11;
- break;
- case 22: /* not bold */
- cdata->attribs &= ~BOLD;
- break;
- case 24: /* not underlined */
- cdata->attribs &= ~UNDERLINE;
- break;
- case 25: /* not blinking */
- cdata->attribs &= ~BLINKING;
- break;
- case 27: /* not reverse */
- cdata->attribs &= ~REVERSE;
- cdata->fgcol = cdata->nfgcol;
- cdata->bgcol = cdata->nbgcol;
- cdata->attribs&=~0x3F00;
- cdata->attribs|=cdata->fgcol<<8 | cdata->bgcol<<11;
- break;
-
- default:
- if ( ( cdata->param[i-1] > 29 )&&( cdata->param[i-1] < 38 ) )
- {
- vc->SETFGCOL ( vc, cdata->param[i-1] - 30 );
- cdata->fgcol = cdata->param[i-1] - 30;
- cdata->attribs&=~0x3F00;
- cdata->attribs|=cdata->fgcol<<8 | cdata->bgcol<<11;
-
- }
- if ( ( cdata->param[i-1] > 39 )&&( cdata->param[i-1] < 48 ) )
- {
- vc->SETBGCOL ( vc, cdata->param[i-1] - 40 );
- cdata->bgcol = cdata->param[i-1] - 40;
- cdata->attribs&=~0x3F00;
- cdata->attribs|=cdata->fgcol<<8 | cdata->bgcol<<11;
- }
- }
- } while ( i<=cdata->parami );
-}
-
-void
-vt_clreos(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
- int ptr;
- if ( vc == vconsole_current )
- vc->R_CLREOS ( vc, cdata->param[0] );
- else
- vconsole_pending = vc->number;
-
- switch ( cdata->param[0] )
- {
- case 0: /* Erase from cursor to end of screen */
- for ( ptr=vc->xcur + vc->ycur * vc->xchars
- ; ptr<(vc->xchars*vc->ychars); ptr++ )
- vc->charmap[ptr]=0x20;
- break;
-
- case 1: /* Erase from start to cursor */
- for ( ptr=0;
- ptr<vc->ycur*vc->xchars + vc->xcur;
- ptr++ )
- vc->charmap[ptr]=0x20;
- break;
-
- case 2: /* Blitz the whole bloody thing */
- if ((vc->flags&LOSSY)==0)
- mapped_cls(vc);
- if (vc==vconsole_current)
- vc->CLS(vc);
- else
- vconsole_pending = vc->number;
- break;
- }
-}
-
-void
-vt_set_ansi(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
-
- switch(cdata->param[0])
- {
- case 0: /* error, ignored */
- case 1: /* GATM - guarded area transfer mode */
- case 2: /* KAM - keyboard action mode */
- case 3: /* CRM - Control Representation mode */
- case 20: /* LNM - line feed / newline mode */
- break;
-
- case 4: /* IRM - insert replacement mode */
- cdata->irm = 1;
- break;
-
- case 5: /* SRTM - status report transfer mode */
- case 6: /* ERM - erasue mode */
- case 7: /* VEM - vertical editing mode */
- case 10: /* HEM - horizontal editing mode */
- case 11: /* PUM - position unit mode */
- case 12: /* SRM - send-receive mode */
- case 13: /* FEAM - format effector action mode */
- case 14: /* FETM - format effector transfer mode */
- case 15: /* MATM - multiple area transfer mode */
- case 16: /* TTM - transfer termination */
- case 17: /* SATM - selected area transfer mode */
- case 18: /* TSM - tabulation stop mode */
- case 19: /* EBM - editing boundary mode */
- break;
- }
-}
-
-void
-vt_reset_ansi(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
-
- switch(cdata->param[0])
- {
- /* Implement these */
- case 0: /* error, ignored */
- case 1: /* GATM - guarded area transfer mode */
- case 2: /* KAM - keyboard action mode */
- case 3: /* CRM - Control Representation mode */
- case 20: /* LNM - line feed / newline mode */
- break;
-
- case 4: /* IRM - insert replacement mode */
- cdata->irm = 0;
- break;
-
- case 5: /* SRTM - status report transfer mode */
- case 6: /* ERM - erasue mode */
- case 7: /* VEM - vertical editing mode */
- case 10: /* HEM - horizontal editing mode */
- case 11: /* PUM - position unit mode */
- case 12: /* SRM - send-receive mode */
- case 13: /* FEAM - format effector action mode */
- case 14: /* FETM - format effector transfer mode */
- case 15: /* MATM - multiple area transfer mode */
- case 16: /* TTM - transfer termination */
- case 17: /* SATM - selected area transfer mode */
- case 18: /* TSM - tabulation stop mode */
- case 19: /* EBM - editing boundary mode */
- break;
- }
-}
-
-/* DRN */
-
-void
-do_render_noscroll(c, vc)
- char c;
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
- /* THE RENDER STAGE **********************************/
-
- if ((c>=0x20)&&(c<=0x7f))
- {
- if (((vc->flags)&(LOSSY))==0)
- {
- if ( vc->charmap[vc->xcur+vc->ycur*vc->xchars] != c|cdata->attribs )
- {
- if ( vc==vconsole_current )
- vc->RENDER ( vc, c );
- else
- vconsole_pending = vc->number;
- }
- vc->charmap[ vc->xcur + vc->ycur*vc->xchars ] = c|cdata->attribs;
- }
- else
- {
- if ( vc==vconsole_current )
- vc->RENDER ( vc, c );
- else
- vconsole_pending = vc->number;
- }
- }
-
- vc->xcur++;
-
- /*do_scrollcheck ( vc );*/
-}
-
-#ifdef SIMPLE_CURSOR
-void
-simple_cursor_on(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
- if (cdata->simple_cursor_on)
- return 0;
- if (vc!=vconsole_current)
- return 0;
- if (((vc->flags)&(LOSSY))==0)
- {
- cdata->simple_cursor_store = vc->charmap[ vc->xcur + vc->ycur*vc->xchars ];
- vc->RENDER ( vc, SIMPLE_CURSOR_CHAR );
- }
- cdata->simple_cursor_on = 1;
-}
-
-void
-simple_cursor_off(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
- if (!cdata->simple_cursor_on)
- return 0;
- if (vc!=vconsole_current)
- return 0;
- if (((vc->flags)&(LOSSY))==0)
- {
- vc->RENDER ( vc, cdata->simple_cursor_store );
- }
- cdata->simple_cursor_on = 0;
-}
-#endif
-
-/* DSC */
-void
-do_scrollcheck(vc)
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
-
- /* BOUNDARY CHECK ************************************/
- if ((vc->xcur >= (vc->xchars))&&((cdata->flags&F_AWM)!=0))
- {
- cdata->flags|=F_LASTCHAR;
- cdata->lastpos = vc->ycur*vc->xchars+vc->xcur;
- }
-
- /* SCROLL CHECK *************************************/
- if ( vc->ycur >= cdata->scrr_end+1 )
- {
- do_scrollup ( vc );
- }
-}
-
-/* DR */
-
-int
-do_render(c, vc)
- char c;
- struct vconsole *vc;
-{
- struct vt220_info *cdata = (struct vt220_info *)vc->data;
- /* THE RENDER STAGE **********************************/
-
- if (((cdata->flags&F_AWM)==0)&&(vc->xcur >= 20))
- return 0;
-
- if ( cdata->flags & F_LASTCHAR )
- {
- if ( cdata->lastpos==vc->ycur*vc->xchars+vc->xchars)
- {
- vc->ycur++;
- vc->xcur = 0;
- cdata->flags &= ~F_LASTCHAR;
- do_scrollcheck(vc);
- }
- else
- {
- cdata->flags &= ~F_LASTCHAR;
- }
- }
-
- if ((c>=0x20)&&(c<=0x7f))
- {
- if (((vc->flags)&(LOSSY))==0)
- {
- if ( cdata->irm == 0 )
- {
- if(vc->charmap[vc->xcur+vc->ycur*vc->xchars]!=c|cdata->attribs )
- {
- if ( vc==vconsole_current )
- vc->RENDER ( vc, c );
- else
- vconsole_pending = vc->number;
- }
- vc->charmap[vc->xcur+vc->ycur*vc->xchars ] = c|cdata->attribs;
- }
- else
- {
- int counter;
- int ox, oy;
- int *ptr = vc->charmap + (vc->xcur + vc->ycur*vc->xchars);
- for ( counter=vc->xchars-vc->xcur; counter>=0; counter-- )
- ptr[counter+1] = ptr[counter];
- ptr[0] = c;
- ox = vc->xcur; oy = vc->ycur;
-
- for ( ; vc->xcur < vc->xchars; )
- do_render_noscroll ( vc->charmap[vc->xcur+vc->ycur*vc->xchars], vc );
- vc->xcur = ox; vc->ycur = oy;
-
- }
- }
- else
- {
- if ( vc==vconsole_current )
- vc->RENDER ( vc, c );
- else
- vconsole_pending = vc->number;
- }
- }
-
- vc->xcur++;
-
- do_scrollcheck ( vc );
-
- if ( cdata->flags & F_LASTCHAR )
- vc->xcur--;
- return 0;
-}
-
-int
-TERMTYPE_PUTSTRING(string, length, vc)
- char *string;
- int length;
- struct vconsole *vc;
-{
- struct vt220_info *cdata;
- register char c;
- char dc[] = "x\0";
- cdata = (struct vt220_info *)vc->data;
-
- /* A piece of saftey code */
- if ( vconsole_current->vtty == 0 )
- return 0;
-
-#ifdef SIMPLE_CURSOR
- if ( vc==vconsole_current )
- if ( vc->CURSORUPDATE(vc)==-1 ) simple_cursor_off ( vc );
-#else
- if ( vc==vconsole_current )
- vc->CURSORUPDATE (vc);
-#endif
-
- while ( ((c=*(string++))!=0) && ((length--)>0) )
- {
-
- if ( cdata->state != STATE_INIT )
- cdata->flags &= ~F_LASTCHAR;
-
- if ( ( c == 0x0a ) || ( c== 0x0d ) )
- cdata->flags &= ~F_LASTCHAR;
-
-/* Middle mouse button freezes the display while active */
-
- while ((ReadByte(IO_MOUSE_BUTTONS) & MOUSE_BUTTON_MIDDLE) == 0);
-
-/* Left mouse button slows down the display speed */
-
- if ((ReadByte(IO_MOUSE_BUTTONS) & MOUSE_BUTTON_LEFT) == 0)
- delay(5000);
-
-/* Always process characters in the range of 0x00 to 0x1f */
-
-
-#ifdef DEBUGTERM
-*dc = c;
-switch (c)
-{
- case 0x0a: dprintf ( "[0a]" ); break;
- case 0x0d: dprintf ( "[0d]" ); break;
- case 0x0c: dprintf ( "[0c]" ); break;
- case 0x1b: dprintf ( "[1b]" ); break;
-}
-#endif
- if ( c <= 0x1f )
- {
- if ( cdata->disable_function )
- {
- if ( cdata->flags & F_LASTCHAR )
- {
- if ( cdata->lastpos==vc->ycur*vc->xchars+vc->xchars)
- {
- vc->ycur++;
- vc->xcur = 0;
- cdata->flags &= ~F_LASTCHAR;
- do_scrollcheck(vc);
- }
- else
- {
- cdata->flags &= ~F_LASTCHAR;
- }
- }
-
- switch (c)
- {
- case 0x00: /* NUL */
- case 0x01: /* SOH */
- case 0x02: /* STX */
- case 0x03: /* ETX */
- case 0x04: /* EOT */
- case 0x05: /* ENQ */
- case 0x06: /* ACK */
- break;
-
- case 0x07: /* BEL */
- beep_generate();
- if ( !cdata->beepoff )
- c = 'G';
- break;
-
- case 0x08: /* BS */
- cdata->flags &= ~F_LASTCHAR;
- if ( vc->xcur>0 )
- vc->xcur--;
- break;
-
- case 0x09: /* TAB */
- while ( vc->xcur < vc->xchars-1 )
- {
- vc->xcur++;
- if (cdata->tab_stops[vc->xcur])
- break;
- }
- break;
-
- case 0x0a:
- cdata->flags &= ~F_LASTCHAR;
- vc->ycur++;
- do_scrollcheck ( vc );
- break;
-
- case 0x0c:
- cdata->flags &= ~F_LASTCHAR;
- if ((vc->flags&LOSSY)==0)
- mapped_cls(vc);
- if (vc==vconsole_current)
- vc->CLS(vc);
- vc->xcur=0;
- vc->ycur=0;
-
- break;
- case 0x0d:
- cdata->flags &= ~F_LASTCHAR;
- vc->xcur=0;
- break;
-
- case 0x10: /* DLE */
- case 0x11: /* DC1/XON */
- case 0x12: /* DC2 */
- case 0x13: /* DC3/XOFF */
- case 0x14: /* DC4 */
- case 0x15: /* NAK */
- case 0x16: /* SYN */
- case 0x17: /* ETB */
- break;
-
- case 0x18: /* CAN */
- cdata->state = STATE_INIT;
- clr_params(cdata);
- break;
-
- case 0x19: /* EM */
- break;
-
- case 0x1a: /* SUB */
- cdata->state = STATE_INIT;
- clr_params(cdata);
- break;
-
- case 0x1b: /* ESC */
- cdata->state = STATE_ESC;
- clr_params(cdata);
- break;
-
- case 0x1c: /* FS */
- case 0x1d: /* GS */
- case 0x1e: /* RS */
- case 0x1f: /* US */
- break;
- }
- }
- }
- else
- {
- /* 0x20 to 0xff depends on current state */
- switch ( cdata->state )
- {
- case STATE_INIT:
- do_render ( c, vc );
- break;
-
- case STATE_ESC:
-#ifdef DEBUGTERM
-{
- char buf[]="x";
- buf[0] = c;
- dprintf ( buf );
-}
-#endif
- switch (c)
- {
- case '7': /* SAVE CUSOR */
- vt_sc ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case '8': /* RESTORE CUSOR */
- vt_rc ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case '=':
- vt_keyappl ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case '>': /* Keypad numeric mode */
-#ifdef DEBUGTERM
-dprintf ( "\r\nKEYPAD NUMERIC MODE\r\n ");
-#endif
- cdata->state = STATE_INIT;
- break;
-
- case 'D':
- vt_ind ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'E':
- vt_nel ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'H':
- cdata->tab_stops[vc->xcur] = 1;
- cdata->state = STATE_INIT;
- break;
-
- case 'M':
- vt_ri ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'N':
- cdata->Gs = cdata->G2;
- cdata->ss = 1;
- cdata->state = STATE_INIT;
- break;
-
- case 'O':
- cdata->Gs = cdata->G3;
- cdata->ss = 1;
- cdata->state = STATE_INIT;
- break;
-
- case 'P':
- cdata->dcs_state = DCS_INIT;
- cdata->state = STATE_DCS;
- break;
-
- case 'Z':
- vt_da ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case '~':
- cdata->GR = cdata->G1;
- cdata->state = STATE_INIT;
- break;
-
- case '[':
- clr_params ( cdata );
- cdata->state = STATE_CSI;
- break;
-
- case '\\':
- cdata->state = STATE_INIT;
- break;
-
- case 'c':
- vt_ris ( vc );
- cdata->state = STATE_CSI;
- break;
-
- case 'n':
- cdata->GL = cdata->G2;
- cdata->state = STATE_INIT;
- break;
-
- case 'o':
- cdata->GL = cdata->G3;
- cdata->state = STATE_INIT;
- break;
-
- case '}':
- cdata->GR = cdata->G2;
- cdata->state = STATE_INIT;
- break;
-
- case '|':
- cdata->GR = cdata->G3;
- cdata->state = STATE_INIT;
- break;
-
- default:
- do_render ( c, vc );
- cdata->state = STATE_INIT;
- break;
- }
- break;
-
- case STATE_CSIQM:
-#ifdef DEBUGTERM
-{
- char buf[]="x";
- buf[0] = c;
- dprintf ( buf );
-}
-#endif
- switch (c)
- {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': /* parameters */
- cdata->param[cdata->parami] *= 10;
- cdata->param[cdata->parami] += (c-'0');
- break;
-
- case ';': /* next parameter */
- cdata->parami =
- (cdata->parami+1 < MAXPARMS) ?
- cdata->parami+1 : cdata->parami;
- break;
-
- case 'h':
- vt_set_dec_priv_qm ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'l':
- vt_reset_dec_priv_qm ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'n':
- vt_dsr ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'K':
- vt_sel ( vc );
- cdata->state = STATE_INIT;
- break;
-
- default:
- do_render ( '[', vc );
- do_render ( c, vc );
- cdata->state = STATE_INIT;
- {
- register int counter;
- for ( counter=0; counter<=cdata->parami; counter++ )
- {
- do_render ( '@', vc );
- }
- }
- do_render ( c, vc );
- break;
- }
-
- case STATE_CSI:
-#ifdef DEBUGTERM
-{
- char buf[]="x";
- buf[0] = c;
- dprintf ( buf );
-}
-#endif
- switch (c)
- {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': /* parameters */
- cdata->param[cdata->parami] *= 10;
- cdata->param[cdata->parami] += (c-'0');
- break;
-
- case ';': /* next parameter */
- cdata->parami =
- (cdata->parami+1 < MAXPARMS) ?
- cdata->parami+1 : cdata->parami;
- break;
-
- case '?': /* ESC [ ? family */
- cdata->state = STATE_CSIQM;
- break;
-
- case '@': /* insert char */
- vt_ic ( vc );
- cdata->state = STATE_INIT;
- break;
-
- /*
- case '!':
- cdata->state = STATE_STR;
- break;
- */
-
- case 'A': /* cursor up */
- vt_cuu ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'B': /* cursor down */
- vt_cud ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'C':
- vt_cuf ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'D': /* cursor back */
- vt_cub ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'H': /* direct cursor addressing */
- vt_curadr ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'J': /* erase screen */
- vt_clreos ( vc );
- cdata->state = STATE_INIT;
- break;
-
- cdata->state = STATE_INIT;
- break;
-
- case 'K': /* erase line */
- vt_clreol ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'L': /* insert line */
- vt_il ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'M': /* delete line */
- vt_dl ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'P': /* Delete chars */
- vt_dch ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'S': /* scroll up */
- vt_su ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'c':
- vt_da ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'f':
- vt_curadr ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'h':
- vt_set_ansi ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'l':
- vt_reset_ansi ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'm': /* select graphic rendition */
- vt_sgr( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'n':
- vt_dsr ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'r': /* set scrolling region */
- vt_stbm ( vc );
- cdata->state = STATE_INIT;
- break;
-
- case 'y':
- vt_tst ( vc );
- cdata->state = STATE_INIT;
- break;
-
- default:
- do_render ( '[', vc );
- do_render ( c, vc );
- cdata->state = STATE_INIT;
- {
- register int counter;
- for ( counter=0; counter<=cdata->parami; counter++ )
- {
- do_render ( '@', vc );
- }
- }
- do_render ( c, vc );
- cdata->state = STATE_INIT;
- break;
- }
- break;
-
- default:
- cdata->state = STATE_INIT;
- break;
- }
- }
- }
-#ifdef SIMPLE_CURSOR
- if ( vc==vconsole_current )
- if ( vc->CURSORUPDATE(vc)==-1 )
- simple_cursor_on ( vc );
-#else
- if ( vc==vconsole_current )
- vc->CURSORUPDATE (vc);
-#endif
- return 0;
-}
-
-void
-console_debug()
-{
-}
-
-int
-vt220_swapin(vc)
- struct vconsole *vc;
-{
-#ifdef SIMPLE_CURSOR
- if ( vc==vconsole_current )
- if ( vc->CURSORUPDATE(vc)==-1 ) simple_cursor_on ( vc );
-#else
- if ( vc==vconsole_current )
- vc->CURSORUPDATE (vc);
-#endif
- return 0;
-}
-
-int
-vt220_swapout(vc)
- struct vconsole *vc;
-{
- return 0;
-}
-
-
-int
-vt220_sleep(vc)
- struct vconsole *vc;
-{
-#ifdef SIMPLE_CURSOR
- if ( vc==vconsole_current )
- if ( vc->CURSORUPDATE(vc)==-1 ) simple_cursor_off ( vc );
-#else
- if ( vc==vconsole_current )
- vc->CURSORUPDATE (vc);
-#endif
- vc->FLASH ( vc, 0 );
- vc->CURSOR_FLASH ( vc, 0 );
- return 0;
-}
-
-int
-vt220_wake(vc)
- struct vconsole *vc;
-{
- vc->FLASH ( vc, 1 );
- vc->CURSOR_FLASH ( vc, 1 );
-
-#ifdef SIMPLE_CURSOR
- if ( vc==vconsole_current )
- if ( vc->CURSORUPDATE(vc)==-1 )
- simple_cursor_on ( vc );
-#else
- if ( vc==vconsole_current )
- vc->CURSORUPDATE (vc);
-#endif
- return 0;
-}
-
-int
-vt220_scrollback(vc)
- struct vconsole *vc;
-{
- return -1;
-}
-
-int
-vt220_scrollforward(vc)
- struct vconsole *vc;
-{
- return -1;
-}
-
-int
-vt220_scrollbackend(vc)
- struct vconsole *vc;
-{
- return -1;
-}
-
-int
-vt220_debugprint(vc)
- struct vconsole *vc;
-{
- printf ( "VT220 TERMINAL EMULATOR\n\n" );
- printf ( "no information\n" );
- printf ( "\n" );
- return 0;
-}
-
-int
-vt220_modechange(vc)
- struct vconsole *vc;
-{
- if (vc->number >= 64)
- return(0);
-
- if (vc == NULL) {
- return(EINVAL);
- }
- vt_str ( vc );
- if (vc->charmap)
- {
- free ( vc->charmap, M_DEVBUF );
-
- MALLOC (vc->charmap, int *, sizeof(int)*((vc->xchars)*(vc->ychars)), M_DEVBUF, M_NOWAIT );
- if ((vc->flags&LOSSY)==0)
- mapped_cls(vc);
- if (vc==vconsole_current)
- vc->CLS(vc);
- vc->xcur=0;
- vc->ycur=0;
- }
-
- return 0;
-}
-
-int
-vt220_attach(vc, a, b, aux)
- struct vconsole *vc;
- struct device *a;
- struct device *b;
- void *aux;
-{
- return 0;
-}
-
-struct terminal_emulator vt220 = {
- vt220_name,
- vt220_init,
- vt220_putstring,
- vt220_swapin,
- vt220_swapout,
- vt220_sleep,
- vt220_wake,
- vt220_scrollback,
- vt220_scrollforward,
- vt220_scrollbackend,
- vt220_debugprint,
- vt220_modechange,
- vt220_attach
-};
diff --git a/sys/arch/arm32/dev/console/vt220.h b/sys/arch/arm32/dev/console/vt220.h
deleted file mode 100644
index ef877f0919d..00000000000
--- a/sys/arch/arm32/dev/console/vt220.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* $NetBSD: vt220.h,v 1.2 1996/03/18 19:33:12 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1995 Melvyn Tang-Richardson
- * Copyright (c) 1994-1995 RiscBSD kernel team
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD kernel team
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE RISCBSD TEAM ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * vt220.h
- *
- * VT220 emulation header file
- *
- * Created : 17/09/94
- */
-
-#define MAXTABSTOPS 132
-
-#define STATE_INIT 0
-#define STATE_HASH 1
-#define STATE_BROPN 2
-#define STATE_BRCLO 3
-#define STATE_STAR 4
-#define STATE_PLUS 5
-#define STATE_MINUS 6
-#define STATE_DOT 7
-#define STATE_SLASH 8
-#define STATE_AMPSND 9
-#define SHP_INIT 10
-#define STATE_ESC 11
-#define STATE_CSIQM 14
-#define STATE_CSI 15
-#define STATE_DCS 16
-#define STATE_SCA 17
-#define STATE_STR 18
-
-/* sub-states for Device Control String processing */
-
-#define DCS_INIT 0 /* got ESC P ... */
-#define DCS_AND_UDK 1 /* got ESC P ... | */
-#define DCS_UDK_DEF 2 /* got ESC P ... | fnckey / */
-#define DCS_UDK_ESC 3 /* got ESC P ... | fnckey / ... ESC */
-#define DCS_DLD_DSCS 4 /* got ESC P ... { */
-#define DCS_DLD_DEF 5 /* got ESC P ... { dscs */
-#define DCS_DLD_ESC 6 /* got ESC P ... { dscs ... / ... ESC */
-
-#define F_AWM (1)
-#define F_LASTCHAR (2)
-#define F_IRM (3)
-
-#define MAXPARMS 10
-
-struct vt220_info {
- int tab_stops[MAXTABSTOPS];
- int state;
- int hp_state;
- int disable_function;
- int lastchar;
- int beepoff;
- int param[MAXPARMS];
- int parami;
- u_char m_om, sc_om; /* flag, vt100 mode, origin mode */
- u_char scrr_beg;
- u_char scrr_len;
- u_char scrr_end;
- int simple_cursor_store;
- int simple_cursor_on;
-
- int dcs_state;
-
- int G0, G1, G2, G3, GL, GR, sc_G0, sc_G1, sc_G2, sc_G3, sc_GL, sc_GR;
- int Gs, ss;
- int xcur, ycur, sc_xcur, sc_ycur;
- int sc_flag;
-
- char *report_chars;
- int report_count;
- int cursor_on;
-
- int fgcol, bgcol;
- int nfgcol, nbgcol;
-
- int attribs;
- int flags;
- int sflags;
-
- int lastpos;
- int irm;
-};
-
diff --git a/sys/arch/arm32/dev/rd_hooks.c b/sys/arch/arm32/dev/rd_hooks.c
deleted file mode 100644
index 7aa97324645..00000000000
--- a/sys/arch/arm32/dev/rd_hooks.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* $NetBSD: rd_hooks.c,v 1.5 1996/03/28 21:14:13 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Gordon W. Ross
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <sys/device.h>
-
-#include <vm/vm.h>
-#include <vm/vm_map.h>
-#include <vm/vm_kern.h>
-
-#include <dev/ramdisk.h>
-
-#ifndef RAMDISK_SIZE
-#define RAMDISK_SIZE 0
-#endif
-
-/*extern int boothowto;*/
-extern u_int ramdisc_size;
-struct rd_conf *bootrd = NULL;
-
-int load_ramdisc_from_floppy __P((struct rd_conf *rd, dev_t dev));
-
-/*
- * This is called during autoconfig.
- */
-int
-rd_match_hook(parent, self, aux)
- struct device *parent;
- void *self;
- void *aux;
-{
- return (1);
-}
-
-void
-rd_attach_hook(unit, rd)
- int unit;
- struct rd_conf *rd;
-{
- if (unit == 0) {
- if (ramdisc_size == 0 && RAMDISK_SIZE)
- ramdisc_size = (RAMDISK_SIZE * 1024);
-
- if (ramdisc_size != 0) {
- rd->rd_size = round_page(ramdisc_size);
- rd->rd_addr = (caddr_t)kmem_alloc(kernel_map, ramdisc_size);
- rd->rd_type = RD_KMEM_FIXED;
- bootrd = rd;
- }
- }
- printf("rd%d: allocated %dK (%d blocks)\n", unit, rd->rd_size / 1024, rd->rd_size / DEV_BSIZE);
-}
-
-
-/*
- * This is called during open (i.e. mountroot)
- */
-
-void
-rd_open_hook(unit, rd)
- int unit;
- struct rd_conf *rd;
-{
-/* I use the ramdisc for other testing ... */
-#if 0
- if (unit == 0) {
- /* The root ramdisk only works single-user. */
- boothowto |= RB_SINGLE;
- }
-#endif
-}
diff --git a/sys/arch/arm32/doc/bootloader b/sys/arch/arm32/doc/bootloader
deleted file mode 100644
index 4bab605b630..00000000000
--- a/sys/arch/arm32/doc/bootloader
+++ /dev/null
@@ -1,12 +0,0 @@
-Currently the bootloader can only be built under RiscOS as this
-is the platform which it runs on. A spark file version of the
-bootloader source code is also available
-
-[ From boot/README ]
-Ok, this is the bootloader source that can be used to boot NetBSD/arm32
-from RISCOS. This code was written for use with Norcroft C and
-objasm under RISCOS. It has been modified to compile under NetBSD/arm32
-but is as yet untested.
-
-It is provided here for the moment as example code for a boot loader
-and will be updated shortly to compile under NetBSD/arm32
diff --git a/sys/arch/arm32/doc/history b/sys/arch/arm32/doc/history
deleted file mode 100644
index 5180a93e7b1..00000000000
--- a/sys/arch/arm32/doc/history
+++ /dev/null
@@ -1,451 +0,0 @@
-3135 - fixed mode selection on boot
- - page up/down, insert and delete now generate the correct codes in
- the console
- - the configured modesare now compiled in a separate file rather
- than in vidcconsole.c
- - The eb timeout reduced to 30 secs
-
- - clreos problems fixed
- - / on the keypad generated the correct code
- - the block cursor hove down 2 scan lines to align with characters
- - extended irq renamed netslot
- - extra double mapping of kstack removed
- - kstack located at efbfe000
- - implementation of cpu_swapin() to remap the kstack
- - patch to vm_glue to use kmem_alloc for the kstack
- - extra pmap debugging code added with DEBUG669
- - the pventry tables can not be dumped from the kshell
- or from a running system.
-
- - merged console code v133 into kernel
- - the disklabel code no longer prints a warning if a HD is found
- without a adfs partition
- - the kbd driver now is capable of setting the keyboard leds.
- - added ioctl to set the keyboard leds.
- - added a routine to read the keyboard state.
- - added a routine to set the keyboard state.
- - added some prototypes to kbd.h
- - implmented irq_setmasks() as an assembly function.
- - added an extra disable irq mask
- - the irq bits from IOMD reg A are cleared as soon as req A is read
- - Debugged the plip driver. The ip packet is now word aligned when
- passed to the upper network levels
-
-20/09/95
- - the cpu_switch routine checks the amount of stack space used when
- swapping in a task and prints a warning when 6K has been used
- - removed the remnants of the old kstack double mapping
- - a separate message is printed for umounts during a halt.
- - added extra validation in copyin() copyout() copyinstr() and
- copyoutstr()
- - podule irq handler no longer panics
- - Lark A16 podule now recognised
- - section permission faults now cause bus errors
- - the syscall handler now correctly uses bcopy to copy the register
- passed parameters
- - the copyin() function now validates the uaddrs argumant
- - the kstack is filled with a know pattern on a fork()
- - the postmortem code will check the size of the kstack fill pattern
- - the assembly bcopyinout() now returns EFAULT on error
- - the copyin() copyout() copyinstr() copyoutstr() now return EFAULT
- if the validation checks fail.
-23/09/95
- - the fault handler will report faults from (fu/su)iwintr()
- - added new pmap function to return the address of the next physical
- page (pmap_next_phys_page).
- - added code to machdep.c to compare the page number against
- pmap_next_phys_page() to try and locate source to kernel size
- limit
- - added option to syscall_special (32) to return the address of the
- next physical page.
- - fixed the primary bootstrap to map more memory for the secondary
- bootstrap to use.
- - The 936K kernel size limit has been removed.
- - Added support for KTRACE in syscall.c
- - Seondary bootstrap now zeros down its memory
- - cpu_switch now zeros curpcb while there is no valid process
- -
-1/10/95
- - cpuswitch now detects trahsed stacks.
- - new compile option for generation of enhanced postmortem debugging
- - merged console code 183b
- - implemented a memcpy routine
- - removed remnants of the kstackpte's
- - cleaned old commented debugging code out of cpu_switch
- - Added new comments in exception.S
- - userret() check for a non-zero proc pointer
- - extended postmortem debug for cpu_switch bug
- - updated prototype declarations in machdep.c
- - fixed passing of proc0 pointer into cpu_switch from switch_exit
- - podulebus now recognised Lingenuity podules
- - Lingenuity 16bit SCSI card recognised
-
-3/10/95
- - new compile option ROTTEN_INARDS to dump full debugging info on
- postmortem
- - Rewritten postmortem debug information printout
- - Postmortem will now examine the IRQ stack for traceback info
- - Fix cpu_exit() bug thus could result in the idle being entered at
- splhigh()
- - Added function prototypes for functions called in vm_machdep.c
- - boot0() now makes sure IRQ's and FIQ's have been disabled
- - The ARM700 FPA is now correctly turned off during boot
- - A major has been allocated for the vidcaudio device (36)
- - vidcaudio.c added to mainbus/ and associated support added in
- conf/ and conf.c
- - Patch to the console code to report the version number
- - Latest version of dev/isa/com.c merged into mainbus/com.c
- - Latest version of dev/isa/lpt.c merged into mainbus/lpt.c
- - Latest version of dev/isa/wd.c merged into mainbus/wd.c
- - new assembly version of copystr added
- - buffer address for beep0 removed from attach message
- - unrecognised undefined instructions are now logged as errors to
- syslog
- - fpe now attaches a coproc2 handler to stap coproc2 FP instructions
- and report an error
- - New compile option FPE_INLINE added to fpe.c to inline some of the
- conversion functions
- - Added new compile option FPE_PROF to fpe.c to compile in FP profiling
- code
- -
-
-14/10/95
- - added podule id for laser direct card
- - added podule id for morley SCSI card
- - added podule id for AXRE SCSI card
- - added podule id for CC midi max card
- - modified primary/secondary bootstraps to reserve special boot
- - memory for hydra board
- - added hydra device
- - Added cpu identification for all hydra processors
- - Private stacks are allocated to all slave processors
- - All hydra processors are halted on reboot
- - podule code checks for chunk directories but does not try to read
- them yet.
- - polling, immediate execution asc driver written for Acorn SCSI
- card
- - new special syscalls added to aid development of hydra software
-
-01/11/95
- - kernel built with new netbsd-current source tree
- - arm32 source updated to conform to latest netbsd-current source
- tree
-
-03/11/95
- - ALT-Cursor Left/Right now work the correct way round
- - ALT-F6 now gernerates the correct code
- - alpha version of the cumana SCSI II driver added
- - alpha version of the ether1 driver added
- - console code upgraded to V191
- - driver directory structure changed.
- - ./src/patch directory updated
- - alpha version of ATAPI CDROM driver added
- - mainbus and podulebus directories split in to public and private
- directories.
- - warnings from validate_trapframe() are prefixed with "VTF"
- - old rpc console stuff removed from files.arm32 and source moved to
- arch/arm32/old/
- - the arch/arm32/pmap_stuff dir has been moved to arch/arm32/old/
- - the _mcount.S and belgium.S files have been moved to old and
- removed from files.arm32
- - the device name to major code in autoconf.c now recognised /dev/cd
- and /dev/wcd
- - the mountroot code in stubs.c will call cd9660_mountroot() instead
- of ffs_mountroot() is the root dev is a CDROM major.
- - major 36 allocated to audio device
- - major 37 allocated to vidcvideo device
- - major 38 allocated to hydra device
-
-
-07/11/95
- - cpu_fork() now maps in a page table for each process covering the
- 0M-4M block of memory.
- - VM_MIN_ADDRESS lowered to 0x1000
- - cpu_swapout() unmaps the system page at 0x00000000 from its page
- table
- - cpu_swapin() wires down the pagetable covering 0x00000000 and
- maps in the system page at 0x00000000
- - cpu_swapin() and cpu_swapout() moved to vm_machdep.c
- - pmap_enter_pv() no longer panics on duplicate mapping, it just
- prints an warning.
- - alpha version of the powertec SCSI driver
-
-15/11/95
- - switch_exit now unmaps the system page.
- - added newline to printf in disksubr.c
- - the console code has been moved to the dev directory
- - cumana SCSI II driver upgraded to support interrupts
- - powertec SCSI II driver upgraded to support interrupts
- - the mount root code in stubs.c will attempt to mount
- a hd partition as cd9660 if the ffs_mountroot() fails.
- - added missing copyright notices
- - updated some declarations in header files
- - removed DEBUG669 code from pmap.c
- - new syncing routine written for boot()
- - syncing no longer requires kshell support
- - Added extra comments to the boot() function
- - Implemented cpu_sysctl() function (just returns not supported
- error)
- - The nosync kernel interrupt now correctly uses RB_NOSYNC
- -
-
-20/11/95
- - restructure of directories contains device files
- - fixed bug in pmap_pte() that could result in non-word
- aligned pointers being returned in a off page boundry virtual
- address was specified.
- -
-
-24/11/95
- - merged in new netbsd-current source tree
- - removed all the validate_trapframe() calls
- - the ioctl CONSOLE_BLANKTIME now reloads the blank timer
- - the ioctl CONSOLE_BLANKTIME uses the default blank time if a
- negative time is specified.
- - the machine id is now passed in the bootconfig structure
- - the eb0 driver will set the MAC address from the machine id
- if the address has not already been set.
-
-26/11/95
- - Fixed the definition of va_dcl in arm32/include/varargs.h
- -
-
-02/12/95
- - Fixed the WriteShort() macro
- - Removed some redundant code from machdep.c
- - cpu_sysctl is now declared to return an int
- - stubs.c now has prototypes for the floppy driver functions it
- calls when loading the ramdisc.
- - further debugging work on the ether3 driver
-
-10/12/95
- - Added uk device for unknown scsi devices to configuration files
- and conf.c
- - Alpha version of the ether3 ea device driver
-
-14/12/95
- - Merged in beta version of the ether1 (ie) device driver
- - added ifdefs to stubs.c so the cd9660_mountroot() is only called
- when the kernel is compiled with CD9660
- - created new text file to track all major and minor numbers
-
-16/12/95
- - define __FORK_BRAINDAMAGE for compilation with the latest NetBSD
- sources
- - boot() now calls doshutdownhooks()
- - merged in frank's new debugger code (process_machdep.c, ptrace.h,
- regs.h)
- - patches stub.c to take account of frank's new code
- - patch cpu.h to give more detail on the PSR bits
- - fixed the setting of p->p_mdregs to point to the trapframe in
- the kernel mapping of kstack rather than the current mapping.
- - removed some redundant code from mem.c
- - commented out all the trace_debug code
- - cpu_coredump moved from stubs.c to vm_machdep.c
- - implemented ptrace.S in libc
- - boot() no longer sets the curproc to proc0 if it was zero.
- - spl's added to the console locking code
- -
-
-19/12/95
- - merged in new console code (V203) from Nut
- - dosoftints() now calls pppintr()
-
-21/12/95
- - sys_sysarch() no longer panics but returns EINVAL instead.
- - added 3 new debugging syscalls for tracing the vnode bug
- - identified what goes wrong with vnodes resulting in a lockup
- - fixed a number of source file headers
- - Added new comments to a number of routines.
- - readdisklabel() now sets the B_AGE flag on its buffer
- - ether3 drive now reports the controller chip type
- - removed all stand and glue code from kshell
- - added a new debugging syscall to all wakeup() to be called
-
-24/12/95
- - removed redundant physconinit() call in initarm().
- - updated comments in machdep.c
- - added support for mulitple swap devices to be specified at boot
- time
- - changed debugging output in userret()
- - added extra debugging
- - added new debugging syscalls for tracubg the vnode bug
- - added new debugging commands to the kshell
- - added a new insw16() function for faster block transfers
- - created a patch to fix p_nice
- - the wd driver now supports multisector transfers
- - added a new outsw16() function for faster block transfers but is
- currently untested
- - the existing arm32/fpe directory has been renamed to
- arm32/fpe-sp
- - started work on integrating the ARM FPE
- - a new fpe directory arm32/fpe-arm has been created for the new FPE
- - file arm32/cpu.S renamed to arm32/cpuswitch.S
- - created new mainbus device 'cpu' (mainbus/cpu.c)
- - created new header file include/cpus.h to hold macros and
- structure definitions for cpus.
- - all identify functions for the processor and FPA have been moved
- to mainbus/cpu.c
- - FPE is now attached during the cpu attachment during
- autoconfiguration
- - Identification of CPU and FPU split into separate functions in
- mainbus/cpu.c
- - Added new function initialise_fpe() to fpe-sp/fpe.c This is the
- new initialisation point for the FPE. All vector claiming is done
- in this routine. Routine is also responcible for IDing the FPE.
- - ramdisc memory allocation now only ever done in the ramdisc driver
- - cpu_model now declared in mainbus/cpu.c
- - rpc_configure() renamed to configure()
- - added function need_proftick() to clock.c
- - further development work ARM FPE driver
- - glue code for ARM FPE written and tested.
- - ARM FPE now gets first chance as being installed with
- the existing FPE installed as a fallback if the ARM FPE
- installation failed.
- - Hooks for the ARM FPE added in cpu_fork() cpu_exit() and
- cpu_switch()
- - Recoding of ether3 driver started.
- - More debugging code added to trace vnode bug
- - macro added to syscall.c to handle exit from the syscall handler
- for special development syscalls.
- - Vnode bug idenitfied as a corruption of the first word (v_flag)
- of certain vnodes.
- - Ether3 driver rewritten and debugged. Now a beta stage driver
- - Vnode corruption traced to console code.
- - Ether3 drive now has interface buffer memory tests
- - vnode corruption traced to do_scrolldown() routine in the
- console driver.
- - vnode corruption bug located and fixed. Incorrect loop start and
- end points when scrolling the character map down (writing beyond
- allocated memory).
- - Started work on rewriting the etherB driver
- - cleaned up various header files
- - removed stub.c as it was no longer needed
- - updated strstr.c
- - hydra code hooks now only compiled in if hydra device is
- configured
- - EtherB driver rewritten to match recoding of ether3 driver
- - EtherB driver now a beta stage driver
- - Work started on generic driver code for SEEQ EDLC's
- - vidcvideo device now supports multiple openings
- - EtherB driver now puts the controller to sleep when not active
- - strstr() replaced with version borrowed from libc/string/strstr.c
-
-05/01/96
- - Further development of ARM FPE
- - generic fas216 code no longer experimental/NDA
- - powertec scsi driver no longer experimental/NDA
- - entry to undefined instruction handlers is now indirected in
- exception.s
- - entry to the undefined instruction handlers is made a trapframe
- on the stack and r0-r12 preserved from exception.
- - bounce code added so the existing undefined instuction handler
- can be called with r0 pointing to the trapframe.
- - new function arm_fpe_copycontext created
- - fixed the use of FP instructions in sfas.c
- - fixed errors in the softint code
- - netns support can be be compiled in the kernel
- - fixed warnings in fpe-sp/fpe.c and mainbus/cpu.c
-
-10/01/96
- - exception.S updated pending new undefined instruction handling
- code
- - merged in new wd driver from NetBSD-current
- - merged in new com driver from NetBSD-current
- - merged in new fd driver from NetBSD-current
- - created new file sys_machdep.c for machine dependant syscall stuff
- - moved sys_sysctl from machdep.c to sys_machdep.c
- - fixed nested comments in iic.S
- - removed old bug tracing code from cpuswitch.S
- - debugged new fd driver
-
-13/01/96
- - undefined mode r13 added to the pcb structure
- - new version of the ARM fpe built
- - ARM FPE now has core deactivate routine accessable
- - Call back from ARM FPE added on instruction completion
- - cpu_switch() now switches UND32 mode r13
- - cpu_fork() now sets up UND32 mode r13 in pcb
- - undefined vector now calls stub routine that indirects
- via address held in data area.
- - data abort handler address now held in data area rather
- than text area.
- - prefetch abort handler address now held in data area rather
- than text area.
- - disabled warnings about soft errors from the fd driver
-
-17/01/96
- - implemented pmap_resident_count()
- - fixed the kernel avail_start and avail_end variable. This
- fixes the divide by zero bug in /bin/ps
- - ps now reports the correct resident size
-
-19/01/96
- - kernel now supports permission faults in UND32 mode.
- - kernel shell now has kshell> prompt instead of #
- - ramdisc loading code has been moved from stubs.c to fd.c
- - ramdisc loading code now uses a rd_conf structure to
- describe the ramdisc.
- - rd_hooks.c file added to the arm32/dev directory in
- order to support the generic ramdisk.
- - patch to generic ramdisc driver to allow a device match hook
- - mainbus/ramdisc.c removed.
- - generic ramdisc has now replaces to mainbus/ramdisc.
- - fault.c reformatted
- - new compile symbols introduced to comile in debug code for
- fault correction.
- - all remnants of the trace_debug code removed.
- - armfpe code moved from arm32/fpe-arm/arm32 to arm32/fpe-arm/
- - fu*() su*() functions moved from libkern into arm32/fusu.c
- - added code to locore.S to traceback frames on the user process
- stack
- - added variable to enable / disable tracing back of user process
- stacks
- - added syscall to control user stack trackbacks.
- - optimised ARM FPE exception delivery code
- - implemented ARM FPE post processing callback glue
- - ARM FPE post processor now calls user
- - ARM FPE post processor optimised to recover some of the
- performance lost by calling userret()
- - integrated alpha version of the etherH driver
- - updated ramdisc hooks to removed the need for a rd_match_hook()
- function
- - added Oak to the list of podule manufacturers
- - kernel now reconised Oak SCSI I cards.
- - Added generic NCR5380 SCSI driver code
- - integrating in alpha version of the oak SCSI driver
-
-26/01/96
- - merged in latest updates from the NetBSD-current source tree
-
-29/01/96
- - code updated for merging into NetBSD source tree
-
-02/02/96
- - assembly symbol file now names assym.h instead of assym.s
- - The symbol LOCORE has been replaced with _LOCORE
- - ramdisc loading code in now compiled in conditionally on
- RAMDISK_HOOKS
- - Further development of hydrabus device.
- - cpus can noe be attached to both the mainbus and the hydrabus
- - hooks for hydrabus device updated in pmap.c syscall.c and
- machdep.c
- - Extra comments added in exception.S
- - sizeof(struct trapframe) now defined in assym.h
- - register fixup for data transfer instruction aborts now handles
- LDC/STC instructions i.e. hardware executed LDF/STF
- - configuration files updated for latest devices
- - fixed use of mkdepend in makefile
- - fixed the bug that caused panics when issuing the mode change
- ioctl to the vidcvideo device
- - console code version number updated
- - Updated armfpe_post_proc() to take a trapframe pointer as the
- second argument
- - updated the armfpe_post_proc_glue() code to fake a trapframe
- structure from the FPE frame before calling the post proc handler
- so that sendsig has a valid trapframe in p->p_md.md_regs
- - updated the armfpe_post_proc_glue() code to patch the FPE frame
- with data from the trapframe on return from the post proc handler.
- - signal delivery is now working during FP instructions.
- - mondef code resurrected and renamed to setdisplay and moved to the
- stand directory.
diff --git a/sys/arch/arm32/doc/majors+minors b/sys/arch/arm32/doc/majors+minors
deleted file mode 100644
index e7db42e6d8c..00000000000
--- a/sys/arch/arm32/doc/majors+minors
+++ /dev/null
@@ -1,246 +0,0 @@
-/* $OpenBSD: majors+minors,v 1.2 2000/03/03 00:54:48 todd Exp $ */
-/* $NetBSD: majors+minors,v 1.3 1996/04/19 20:04:29 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * majors
- *
- * list of all allocated major numbers
- *
- * Created : 17/09/94
- * Last updated : 30/12/95
- *
- */
-
-List of allocated and reserved major and minor numbers
-
-The block and character major numbers are ALWAYS allocated together to the
-same device driver even if the driver does not require both.
-
- 0 B - reserved
- 0 C - memory device
- minor = 0 - /dev/mem
- minor = 1 - /dev/kmem
- minor = 2 - /dev/null
- minor = 3 - /dev/zero
- 1 B - swap device
- 1 C - psuedo swap device
- minor = 0 - /dev/drum
- 2 B - reserved
- 2 C - console device
- minor = 0 - /dev/console
- 3 B - reserved
- 3 C - controlling terminal
- minor = 0 - /dev/tty
- 4 B - reserved
- 4 C - virtual console
- /dev/ttyv{unit}
- unit = minor
- 5 B - reserved
- 5 C - kernel log device
- minor = 0 - /dev/klog
- 6 B - reserved
- 6 C - psuedo tty master
- /dev/pty{class}{unit}
- unit = minor % 16
- minor / 16 = 0 - class = p
- minor / 16 = 1 - class = q
- minor / 16 = 2 - class = r
- minor / 16 = 3 - class = s
- minor / 16 = 4 - class = t
- 7 B - reserved
- 7 C - psuedo tty slave
- /dev/tty{class}{unit}
- unit = minor % 16
- minor / 16 = 0 - class = p
- minor / 16 = 1 - class = q
- minor / 16 = 2 - class = r
- minor / 16 = 3 - class = s
- minor / 16 = 4 - class = t
- 8 B - reserved
- 8 C - parallel printer
- /dev/lp{class}{unit}
- unit = minor & 0x1f
- minor & 0x80 = 0x00 - class = t - interrupt driver
- minor & 0x80 = 0x80 - class = a - polling driver
- e.g.
- 0 - /dev/lpt0
- 128 - /dev/lpa0
- 9 B - reserved
- 9 C - quadrature mouse
- minor = 0 - /dev/quadmouse
-10 B - reserved
-10 C - beep device
- minor = 0 - /dev/beep
-11 B - reserved
-11 C - keyboard device
- minor = 0 - /dev/kbd
-12 B - reserved
-12 C - serial port
- /dev/tty0{unit}
- unit = minor
-13 B - reserver
-13 C - reserved
-14 B - reserved
-14 C - reserved
-15 B - reserved
-15 C - reserved
-16 B - ST506/ESDI/IDE disk
- /dev/wd{unit}{partition}
- partition = minor % 8
- unit = minor / 8
-16 C - ST506/ESDI/IDE disk
- /dev/rwd{unit}{partition}
- partition = minor % 8
- unit = minor / 8
-17 B - floppy disk
- /dev/fd{unit}{partition}
- partition = minor % 8
- unit = minor / 8
-17 C - floppy disk
- /dev/rfd{unit}{partition}
- partition = minor % 8
- unit = minor / 8
-18 B - ram disk
- /dev/rd{unit}{partition}
- partition = minor % 8
- unit = minor / 8
-18 C - ram disk
- /dev/rrd{unit}{partition}
- partition = minor % 8
- unit = minor / 8
-19 B - vnode disk driver
- /dev/vnd{unit}{partition}
- partition = minor % 8
- unit = minor / 8
-19 C - vnode disk driver
- /dev/rvnd{unit}{partition}
- partition = minor % 8
- unit = minor / 8
-20 B - reserved (ATAPI CDROM)
- /dev/wcd{unit}{partition}
- partition = minor % 8
- unit = minor / 8
-20 C - reserved (ATAPI CDROM)
- /dev/rwcd{unit}{partition}
- partition = minor % 8
- unit = minor / 8
-21 B - concatenated disk driver
- /dev/ccd{unit}{partition}
- partition = minor % 8
- unit = minor / 8
-21 C - concatenated disk driver
- /dev/rccd{unit}{partition}
- partition = minor % 8
- unit = minor / 8
-22 B - reserved
-22 C - reserved
-23 B - reserved
-23 C - reserved
-24 B - SCSI disk
- /dev/sd{unit}{partition}
- partition = minor % 8
- unit = minor / 8
-24 C - SCSI disk
- /dev/rsd{unit}{partition}
- partition = minor % 8
- unit = minor / 8
-25 B - SCSI tape
-25 C - SCSI tape
-26 B - SCSI cdrom
- /dev/cd{unit}{partition}
- partition = minor % 8
- unit = minor / 8
-26 C - SCSI cdrom
- /dev/rcd{unit}{partition}
- partition = minor % 8
- unit = minor / 8
-27 B - reserved
-27 C - SCSI autochanger
- /dev/ch{unit}
- unit = minor
-28 B - reserved
-28 C - SCSI unknown device
- /dev/uk{unit}
- unit = minor
-29 B - reserved
-29 C - SCSI scanner device
- /dev/ss{unit}
- unit = minor
-30 B - reserved
-30 C - reserved
-31 B - reserved
-31 C - reserved
-32 B - reserved
-32 C - Berkeley packet filter
- /dev/bpf{unit}
- unit = minor
- minor = 0 - /dev/bpf0
- minor = 1 - /dev/bpf1
- minor = 2 - /dev/bpf2
- minor = 3 - /dev/bpf3
-33 B - reserved
-33 C - network tunnel
- /dev/tun{unit}
- unit = minor
- minor = 0 - /dev/tun0
- minor = 1 - /dev/tun1
- minor = 2 - /dev/tun2
-34 B - reserved
-34 C - file descriptor pseudo-device
- minor = 0 - /dev/stdin
- minor = 1 - /dev/stdout
- minor = 2 - /dev/stderr
-35 B - reserved
-35 C - loadable module driver
- minor = 0 - /dev/lkm
-36 B - reserved
-36 C - generic audio device
-37 B - reserved
-37 C - vidcvideo device
- minor = 0 - /dev/vidcvideo
-38 B - reserved
-38 C - cpu/hydra
- minor = 0 - /dev/cpu0
-39 B - reserved
-39 C - reserved
-40 B - reserved
-40 C - PS2 mouse
- minor = 0 - /dev/pms
-41 B - reserved
-41 C - reserved
-42 B - reserved
-42 C - IIC device
-43 B - reserved
-43 C - RTC device
diff --git a/sys/arch/arm32/doc/note.users b/sys/arch/arm32/doc/note.users
deleted file mode 100644
index bfe56a9a2df..00000000000
--- a/sys/arch/arm32/doc/note.users
+++ /dev/null
@@ -1,13 +0,0 @@
-Ok there are a number of things that need to be done that I do not
-have time to do and am unlikely to have time to do them in the near
-future.
-These are currently being left in the hope that users will do them
-instead.
-
-1. replace netinet/in_cksum.c with an assembly version
-2. replace netns/ns_chsum.c with an assembly version
-3. drivers for currently unsupported podules
-4. replacing the C string functions in libc with assembly ones (work
- started but not finished)
-5. porting libpthread to arm32 architecture
-
diff --git a/sys/arch/arm32/fpe-arm/armfpe.h b/sys/arch/arm32/fpe-arm/armfpe.h
deleted file mode 100644
index fbcdaf46d10..00000000000
--- a/sys/arch/arm32/fpe-arm/armfpe.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * $NetBSD: armfpe.h,v 1.3 1996/03/18 19:54:53 mark Exp $
- *
- * Copyright (c) 1995 Neil A Carson.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * armfpe.h
- *
- * Details of functions and structures needed for ARM FP cor
- * support in RiscBSD
- *
- * Created : 04/01/96
- */
-
-#ifndef __ARM32_ARM_FPE_H
-#define __ARM32_ARM_FPE_H
-
-/************************************ Types ***********************************/
-
-/*
- * An extended precision floating point number
- */
-
-typedef struct {
- u_int32_t exponent;
- u_int32_t mantissa_hi;
- u_int32_t mantissa_lo;
-} fp_extended_precision_t;
-
-/*
- * Type for a saved FP context, if we want to translate the context to a
- * user-readable form
- */
-
-typedef struct fp_context_frame {
- u_int32_t fpsr;
- fp_extended_precision_t regs[8];
-} fp_context_frame_t;
-
-/************************************* Module *********************************/
-
-typedef struct {
- /*
- * Addresses of procedures/functions
- */
-
- u_int32_t core_abort_addr;
- u_int32_t core_initws_addr;
- u_int32_t core_initcontext_addr;
- u_int32_t core_changecontext_addr;
- u_int32_t core_shutdown_addr;
- u_int32_t core_activatecontext_addr;
- u_int32_t core_deactivatecontext_addr;
- u_int32_t core_savecontext_addr;
- u_int32_t core_loadcontext_addr;
- u_int32_t core_disable_addr;
- u_int32_t core_enable_addr;
-
- /*
- * Addresses of things that need to be filled in by the kernel on startup
- */
-
- u_int32_t *main_ws_ptr_addr;
- u_int32_t *local_handler_ptr_addr;
- u_int32_t *old_handler_ptr_addr;
- u_int32_t *exc_handler_ptr_addr;
- u_int32_t *fp_post_proc_addr;
-
- /*
- * Numbers that the kernel needs - these are not pointers so do not need to
- * be relocated!
- */
-
- u_int32_t WorkspaceLength;
- u_int32_t ContextLength;
-} arm_fpe_mod_hdr_t;
-
-/**************************** Procedures in arm_fpe.c *************************/
-
-#ifdef _KERNEL
-
-/* macro to return the FP context for a process */
-
-#define FP_CONTEXT(p) ((u_int)(((u_char *)(p)->p_addr) + sizeof(struct user)))
-
-/* Prototypes */
-
-void arm_fpe_mod_reloc __P((void));
-int arm_fpe_boot __P((void));
-int initialise_arm_fpe __P((cpu_t *cpu));
-void arm_fpe_postproc __P((u_int fpframe, struct trapframe *frame));
-void arm_fpe_exception __P((int exception, u_int pc, u_int fpframe));
-
-void arm_fpe_core_disable __P((void));
-void arm_fpe_core_enable __P((void));
-u_int arm_fpe_core_initws __P((u_int workspace, int handler1, int handler2));
-u_int arm_fpe_core_abort __P((u_int context, int r12, int pc));
-void arm_fpe_core_initcontext __P((u_int context));
-u_int arm_fpe_core_changecontext __P((u_int context));
-void arm_fpe_core_shutdown __P((void));
-void arm_fpe_core_activatecontext __P((u_int context));
-u_int arm_fpe_core_deactivatecontext __P((void));
-u_int arm_fpe_core_savecontext __P((u_int context, int *savearea, int pc));
-void arm_fpe_core_loadcontext __P((u_int context, int *loadarea));
-void arm_fpe_copycontext __P((u_int c1, u_int c2));
-#endif
-
-#endif
diff --git a/sys/arch/arm32/fpe-arm/armfpe.s b/sys/arch/arm32/fpe-arm/armfpe.s
deleted file mode 100644
index 71066caa95e..00000000000
--- a/sys/arch/arm32/fpe-arm/armfpe.s
+++ /dev/null
@@ -1,7459 +0,0 @@
-/* $NetBSD: armfpe.s,v 1.2 1996/03/18 19:54:55 mark Exp $ */
-
-/*
- * Copyright (c) 1996 Neil A Carson.
- * Copyright (c) 1996 Advanced Risc Machines Ltd.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD kernel team.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * armfpe.s
- *
- * ARM FPE core
- *
- * Created : 05/01/96
- */
-
-/* DO NOT MODIFY - THIS FILE IS AUTOMATICALLY GENERATED. */
-
-/* Generated from KernelFPE */
-
-.text
-.global _arm_fpe_mod
-_arm_fpe_mod:
- .word 0x00006cc0
- .word 0x00006e54
- .word 0x00006ebc
- .word 0x00006f5c
- .word 0x0000706c
- .word 0x00006fd8
- .word 0x00006f64
- .word 0x00007140
- .word 0x0000722c
- .word 0x0000707c
- .word 0x000070d0
- .word 0x000072e4
- .word 0x000072fc
- .word 0x00007314
- .word 0x00007364
- .word 0x000072e8
- .word 0x0000000c
- .word 0x00000088
- .word 0x00000000
- .word 0x00000000
- .word 0x00000000
- .word 0xe24dd040
- .word 0xe8cd7fff
- .word 0xe58de03c
- .word 0xe1a0c00d
- .word 0xe10fa000
- .word 0xe14f9000
- .word 0xe92d0600
- .word 0xe319000f
- .word 0xe24e9004
- .word 0x04b9b000
- .word 0x1599b000
- .word 0xe92d4000
- .word 0xeb001c90
- .word 0xe8bd0400
- .word 0xe8bd4000
- .word 0xe31b0302
- .word 0x0a000849
- .word 0xe20b9c0f
- .word 0xe3590c01
- .word 0x1a000015
- .word 0xe59aa000
- .word 0xee509110
- .word 0xe2098c0f
- .word 0xee307110
- .word 0xe08ff328
- .word 0x00000000
- .word 0xea001ca9
- .word 0xea001ca8
- .word 0xea001ca7
- .word 0xea001ca6
- .word 0xea000103
- .word 0xea0002b1
- .word 0xea00002e
- .word 0xea0002af
- .word 0xea00018f
- .word 0xea0002b8
- .word 0xea00018d
- .word 0xea0002b6
- .word 0xea0000fb
- .word 0xea0002ad
- .word 0xea000026
- .word 0xea0002ab
- .word 0xe3590c02
- .word 0x1a00082e
- .word 0xe59aa000
- .word 0xee509110
- .word 0xe2098c0f
- .word 0xee307110
- .word 0xe08ff328
- .word 0x00000000
- .word 0xea001c91
- .word 0xea001c90
- .word 0xea001c8f
- .word 0xea001c8e
- .word 0xea0000e7
- .word 0xea000299
- .word 0xea000008
- .word 0xea000297
- .word 0xea00081b
- .word 0xea0002a0
- .word 0xea000819
- .word 0xea00029e
- .word 0xea0000df
- .word 0xea000295
- .word 0xea000000
- .word 0xea000293
- .word 0xe3190010
- .word 0x13190601
- .word 0x0a00000d
- .word 0xe59c803c
- .word 0xe2488004
- .word 0xe58c803c
- .word 0xe91c0300
- .word 0xe129f009
- .word 0xe169f008
- .word 0xe1a0d00c
- .word 0xe8dc7fff
- .word 0xe1a00000
- .word 0xe28dd03c
- .word 0xe8fd8000
- .word 0xe3190010
- .word 0x13190601
- .word 0x1a00011d
- .word 0xe389b402
- .word 0xe3170b01
- .word 0x059c803c
- .word 0x02488004
- .word 0x058c803c
- .word 0xe10f8000
- .word 0xe3c88080
- .word 0xe129f008
- .word 0xe1a00000
- .word 0xe31b0901
- .word 0x0d2d020c
- .word 0x1d2d420c
- .word 0xe20b8a03
- .word 0xe0888088
- .word 0xe08d8528
- .word 0xe8980007
- .word 0xe28dd030
- .word 0xe3c03103
- .word 0xe2000103
- .word 0xe20b8301
- .word 0xe18335a8
- .word 0xe3530903
- .word 0x22433801
- .word 0xe20b50e0
- .word 0xe20b8702
- .word 0xe18555a8
- .word 0xe20b4201
- .word 0xe31b0102
- .word 0x02644000
- .word 0xea00001e
- .word 0x00003f81
- .word 0x0000407e
- .word 0x00003f81
- .word 0x0000407e
- .word 0x00003f81
- .word 0x0000407e
- .word 0x00003f81
- .word 0x0000407e
- .word 0x00003c01
- .word 0x000043fe
- .word 0x00003c01
- .word 0x000043fe
- .word 0x00003c01
- .word 0x000043fe
- .word 0x00003c01
- .word 0x000043fe
- .word 0x00000000
- .word 0x00007ffe
- .word 0x00000000
- .word 0x00007ffe
- .word 0x00000000
- .word 0x00007ffe
- .word 0x00000000
- .word 0x00007ffe
- .word 0xe3100101
- .word 0x1a00000f
- .word 0xe20b50e0
- .word 0xe20b8702
- .word 0xe18555a8
- .word 0xe3a04000
- .word 0xeb000bbe
- .word 0xe24f8084
- .word 0xe0888125
- .word 0xe8980300
- .word 0xe1530009
- .word 0xd1580003
- .word 0xca000015
- .word 0xe1800003
- .word 0xe3540000
- .word 0x11b08aa7
- .word 0x33877010
- .word 0x8b000d35
- .word 0xe92d0007
- .word 0xe20b8a07
- .word 0xe08f84a8
- .word 0xe1a0e00f
- .word 0xe288f044
- .word 0xee207110
- .word 0xe92d4000
- .word 0xeb001c01
- .word 0xe8bd4000
- .word 0xe91c0300
- .word 0xe129f009
- .word 0xe169f008
- .word 0xe1a0d00c
- .word 0xe8dc7fff
- .word 0xe1a00000
- .word 0xe28dd03c
- .word 0xe8fd8000
- .word 0xe24fe05c
- .word 0xe0588003
- .word 0xca000c8f
- .word 0xea000c18
- .word 0xecbd8203
- .word 0xe1a0f00e
- .word 0xecbd9203
- .word 0xe1a0f00e
- .word 0xecbda203
- .word 0xe1a0f00e
- .word 0xecbdb203
- .word 0xe1a0f00e
- .word 0xecbdc203
- .word 0xe1a0f00e
- .word 0xecbdd203
- .word 0xe1a0f00e
- .word 0xecbde203
- .word 0xe1a0f00e
- .word 0xecbdf203
- .word 0xe1a0f00e
- .word 0xe20b3a0f
- .word 0xe3530a0d
- .word 0x2a000011
- .word 0xe79c6523
- .word 0xeb000f16
- .word 0xe20b50e0
- .word 0xe20b8702
- .word 0xe18555a8
- .word 0xe3a04000
- .word 0xeb000b84
- .word 0xe1800003
- .word 0xe3540000
- .word 0x11b08aa7
- .word 0x33877010
- .word 0x8b000d01
- .word 0xe92d0007
- .word 0xe20b8807
- .word 0xe08f86a8
- .word 0xe1a0e00f
- .word 0xe248f08c
- .word 0xeaffffca
- .word 0xe3530a0f
- .word 0x0a00000c
- .word 0xe51c8008
- .word 0xe218800f
- .word 0x0affffe8
- .word 0xe3888090
- .word 0xe10f9000
- .word 0xe3c9601f
- .word 0xe1868008
- .word 0xe129f008
- .word 0xe3530a0d
- .word 0x01a0600d
- .word 0x11a0600e
- .word 0xe129f009
- .word 0xeaffffdf
- .word 0xe59c603c
- .word 0xe2866008
- .word 0xeaffffdc
- .word 0xe31b0702
- .word 0x131b0080
- .word 0x1a00076c
- .word 0xe31b0010
- .word 0x0a000042
- .word 0xe20b860f
- .word 0xe08ff928
- .word 0x00000000
- .word 0xeaffffcf
- .word 0xea0000a0
- .word 0xea000764
- .word 0xea000763
- .word 0xea000762
- .word 0xea000761
- .word 0xea000760
- .word 0xea00075f
- .word 0xea00075e
- .word 0xea000081
- .word 0xea00075c
- .word 0xea00007f
- .word 0xea00075a
- .word 0xea00007d
- .word 0xea000758
- .word 0xea00007b
- .word 0x00000000
- .word 0x00000000
- .word 0x00000000
- .word 0x00000000
- .word 0x00003fff
- .word 0x80000000
- .word 0x00000000
- .word 0x00000000
- .word 0x00004000
- .word 0x80000000
- .word 0x00000000
- .word 0x00000000
- .word 0x00004000
- .word 0xc0000000
- .word 0x00000000
- .word 0x00000000
- .word 0x00004001
- .word 0x80000000
- .word 0x00000000
- .word 0x00000000
- .word 0x00004001
- .word 0xa0000000
- .word 0x00000000
- .word 0x00000000
- .word 0x00003ffe
- .word 0x80000000
- .word 0x00000000
- .word 0x00000000
- .word 0x00004002
- .word 0xa0000000
- .word 0x00000000
- .word 0x00000000
- .word 0xe3190010
- .word 0x13190601
- .word 0x0a000003
- .word 0xeaffff21
- .word 0xe3190010
- .word 0x13190601
- .word 0x1a00004a
- .word 0xe389b402
- .word 0xe3170b01
- .word 0x059c803c
- .word 0x02488004
- .word 0x058c803c
- .word 0xe10f8000
- .word 0xe3c88080
- .word 0xe129f008
- .word 0xe1a00000
- .word 0xe31b0902
- .word 0x1a000020
- .word 0xed2d420c
- .word 0xed2d020c
- .word 0xe20b8807
- .word 0xe0888088
- .word 0xe08d8728
- .word 0xe8980007
- .word 0xe1b09e8b
- .word 0x208f8ca9
- .word 0x224880ec
- .word 0x308d8da9
- .word 0x30888d29
- .word 0xe8980038
- .word 0xe28dd060
- .word 0xe24fefb7
- .word 0xe20b860f
- .word 0xe08ff928
- .word 0x00000000
- .word 0xea0012b1
- .word 0xea0012e9
- .word 0xea0012af
- .word 0xea0012ae
- .word 0xea001327
- .word 0xea001326
- .word 0xea001616
- .word 0xea001615
- .word 0xea001120
- .word 0xea0012e1
- .word 0xea001321
- .word 0xea001320
- .word 0xea001912
- .word 0xea000706
- .word 0xea000705
- .word 0xea000704
- .word 0xe1b09e8b
- .word 0x208f8ca9
- .word 0x22488f56
- .word 0x2a000004
- .word 0x5d2d020c
- .word 0x4d2d420c
- .word 0xe3c99102
- .word 0xe08d8da9
- .word 0xe0888d29
- .word 0xe8980007
- .word 0x328dd030
- .word 0xe24fefd6
- .word 0xe20b860f
- .word 0xe08ff928
- .word 0x00000000
- .word 0xea0013d3
- .word 0xea0013d2
- .word 0xea0013d1
- .word 0xea0011f2
- .word 0xea00112c
- .word 0xea0014cf
- .word 0xea0014ce
- .word 0xea001582
- .word 0xea001709
- .word 0xea001708
- .word 0xea001842
- .word 0xea001799
- .word 0xea001798
- .word 0xea001916
- .word 0xea0013f8
- .word 0xea0013ea
- .word 0xe02b8009
- .word 0xe59f90f8
- .word 0xe1180009
- .word 0x1afffecf
- .word 0xe10f8000
- .word 0xe3c88080
- .word 0xe129f008
- .word 0xe1a00000
- .word 0xe31b0502
- .word 0x0a000016
- .word 0xed2d420c
- .word 0xed2d020c
- .word 0xe20b8807
- .word 0xe0888088
- .word 0xe08d8728
- .word 0xe8980007
- .word 0xe1b09e8b
- .word 0x208f8ca9
- .word 0x22488f85
- .word 0x308d8da9
- .word 0x30888d29
- .word 0xe8980038
- .word 0xe28dd060
- .word 0xeb0013fb
- .word 0xe20b3a0f
- .word 0xe3330a0f
- .word 0x1a000012
- .word 0xe51c8008
- .word 0xe3c8820f
- .word 0xe206620f
- .word 0xe1888006
- .word 0xe50c8008
- .word 0xeaffff0d
- .word 0xe1b09e8b
- .word 0x208f8ca9
- .word 0x22488f96
- .word 0x2a000004
- .word 0x5d2d020c
- .word 0x4d2d420c
- .word 0xe3c99102
- .word 0xe08d8da9
- .word 0xe0888d29
- .word 0xe8980007
- .word 0x328dd030
- .word 0xeb00141e
- .word 0xe20b3a0f
- .word 0xe3530a0d
- .word 0x2a000001
- .word 0xe78c6523
- .word 0xeafffefc
- .word 0xe3330a0f
- .word 0x0affffe6
- .word 0xe51c8008
- .word 0xe218800f
- .word 0x0afffff8
- .word 0xe3888090
- .word 0xe10f9000
- .word 0xe3c9401f
- .word 0xe1848008
- .word 0xe129f008
- .word 0xe3530a0d
- .word 0x01a0d006
- .word 0x11a0e006
- .word 0xe129f009
- .word 0xeafffeed
- .word 0x00ff00ff
- .word 0xe10f8000
- .word 0xe3c88080
- .word 0xe129f008
- .word 0xe1a00000
- .word 0xe31b0402
- .word 0x1affff2d
- .word 0xe20b5501
- .word 0xe1a05725
- .word 0xe20b8902
- .word 0xe1855428
- .word 0xe3550d06
- .word 0x0a00005f
- .word 0xe31b0901
- .word 0x0d2d020c
- .word 0x1d2d420c
- .word 0xe20b8a03
- .word 0xe0888088
- .word 0xe08d8528
- .word 0xe8980007
- .word 0xe28dd030
- .word 0xeb00069b
- .word 0xe20b380f
- .word 0xe51c8008
- .word 0xe218800f
- .word 0x1a00001b
- .word 0xe353080f
- .word 0x2a00000d
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe3550080
- .word 0xe4a40004
- .word 0x24a41004
- .word 0x84a42000
- .word 0xeafffec3
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xe3550080
- .word 0xe4a40004
- .word 0x24a41004
- .word 0x84a42000
- .word 0xeafffeb7
- .word 0xe353080d
- .word 0x2a00000d
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe3550080
- .word 0x38840001
- .word 0x08840003
- .word 0x88840007
- .word 0xeafffea7
- .word 0xe353080f
- .word 0x1a00000b
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xe3550080
- .word 0x38840001
- .word 0x08840003
- .word 0x88840007
- .word 0xeafffe99
- .word 0xe3888090
- .word 0xe10f9000
- .word 0xe3c9401f
- .word 0xe1848008
- .word 0xe129f008
- .word 0xe353080d
- .word 0x01a0400d
- .word 0x11a0400e
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0602
- .word 0x0a000002
- .word 0xe353080d
- .word 0x01a0d008
- .word 0x11a0e008
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe129f009
- .word 0xe3550080
- .word 0x38840001
- .word 0x08840003
- .word 0x88840007
- .word 0xeafffe80
- .word 0xe31b0601
- .word 0x1a00005e
- .word 0xe31b0901
- .word 0x0d2d020c
- .word 0x1d2d420c
- .word 0xe20b8a03
- .word 0xe0888088
- .word 0xe08d8528
- .word 0xe8980007
- .word 0xe28dd030
- .word 0xeb000775
- .word 0xe20b380f
- .word 0xe51c8008
- .word 0xe218800f
- .word 0x1a00001d
- .word 0xe353080f
- .word 0x2a00000e
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe3170b02
- .word 0xe4a40004
- .word 0xe4a41004
- .word 0xe4a42004
- .word 0x14a46000
- .word 0xeafffe60
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xe3170b02
- .word 0xe4a40004
- .word 0xe4a41004
- .word 0xe4a42004
- .word 0x14a46000
- .word 0xeafffe53
- .word 0xe353080d
- .word 0x2a00000c
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe3170b02
- .word 0x08840007
- .word 0x88840047
- .word 0xeafffe44
- .word 0xe353080f
- .word 0x1a00000a
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xe3170b02
- .word 0x08840007
- .word 0x88840047
- .word 0xeafffe37
- .word 0xe3888090
- .word 0xe10f9000
- .word 0xe3c9401f
- .word 0xe1848008
- .word 0xe129f008
- .word 0xe353080d
- .word 0x01a0400d
- .word 0x11a0400e
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0602
- .word 0x0a000002
- .word 0xe353080d
- .word 0x01a0d008
- .word 0x11a0e008
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe129f009
- .word 0xe3170b02
- .word 0x08840007
- .word 0x88840047
- .word 0xeafffe1f
- .word 0xe20b380f
- .word 0xe51c8008
- .word 0xe218800f
- .word 0x1a00001f
- .word 0xe353080f
- .word 0x2a000015
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe3170b02
- .word 0xe4b40004
- .word 0xe4b41004
- .word 0xe4b42004
- .word 0x14b46000
- .word 0xeb00085d
- .word 0xe92d0007
- .word 0xe20b8a07
- .word 0xe08f84a8
- .word 0xe288805c
- .word 0xe1a0e00f
- .word 0xe248fb02
- .word 0xeafffe03
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xeaffffea
- .word 0xe353080d
- .word 0x2a00000c
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe3170b02
- .word 0x08940007
- .word 0x88940047
- .word 0xeaffffe0
- .word 0xe353080f
- .word 0x1a000007
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xeafffff1
- .word 0xe3888090
- .word 0xe10f9000
- .word 0xe3c9401f
- .word 0xe1848008
- .word 0xe129f008
- .word 0xe353080d
- .word 0x01a0400d
- .word 0x11a0400e
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0602
- .word 0x0a000002
- .word 0xe353080d
- .word 0x01a0d008
- .word 0x11a0e008
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe129f009
- .word 0xeaffffdc
- .word 0xe59a9084
- .word 0xe3190c02
- .word 0x1afffd6c
- .word 0xeafffe48
- .word 0xee309110
- .word 0xe58a9080
- .word 0xed8a0200
- .word 0xed8a420c
- .word 0xe59a9084
- .word 0xe3c99b02
- .word 0xe58a9084
- .word 0xe59c903c
- .word 0xe2499004
- .word 0xe58c903c
- .word 0xea0019cf
- .word 0xe24dd040
- .word 0xe8cd7fff
- .word 0xe58de03c
- .word 0xe1a0c00d
- .word 0xe10fa000
- .word 0xe14f9000
- .word 0xe92d0600
- .word 0xe319000f
- .word 0xe24e9004
- .word 0x04b9b000
- .word 0x1599b000
- .word 0xe92d4000
- .word 0xeb0019af
- .word 0xe8bd0400
- .word 0xe8bd4000
- .word 0xe31b0302
- .word 0x0a000568
- .word 0xe20b9c0f
- .word 0xe3590c01
- .word 0x1a00048b
- .word 0xe59aa000
- .word 0xe59a8084
- .word 0xe3380000
- .word 0x1a000481
- .word 0xe10f8000
- .word 0xe3c88080
- .word 0xe129f008
- .word 0xe1a00000
- .word 0xe59a7080
- .word 0xe31b0402
- .word 0x1a0003bf
- .word 0xe1a0948b
- .word 0xe209920a
- .word 0xe31b0902
- .word 0x13899101
- .word 0xe20b380f
- .word 0xe353080f
- .word 0x23899201
- .word 0xe51c8008
- .word 0xe218800f
- .word 0x13899302
- .word 0xe2095103
- .word 0xe08ffca9
- .word 0x00000000
- .word 0xea00001e
- .word 0xea000039
- .word 0xea000063
- .word 0xea000070
- .word 0xea0001ab
- .word 0xea0001cc
- .word 0xea000207
- .word 0xea00020e
- .word 0xea000079
- .word 0xea000095
- .word 0xea0000bf
- .word 0xea0000cd
- .word 0xea000212
- .word 0xea000237
- .word 0xea000275
- .word 0xea00027c
- .word 0xea0000d6
- .word 0xea0000f3
- .word 0xea00011d
- .word 0xea00012c
- .word 0xea000280
- .word 0xea0002a3
- .word 0xea0002de
- .word 0xea0002e5
- .word 0xea000135
- .word 0xea000148
- .word 0xea000175
- .word 0xea000185
- .word 0xea0002e9
- .word 0xea0002fb
- .word 0xea000323
- .word 0xea00032a
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8980007
- .word 0xe1a05ba5
- .word 0xeb000535
- .word 0xe20b380f
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe4a40000
- .word 0xe58a7080
- .word 0xe92d4000
- .word 0xeb001964
- .word 0xe8bd4000
- .word 0xe91c0300
- .word 0xe129f009
- .word 0xe169f008
- .word 0xe1a0d00c
- .word 0xe8dc7fff
- .word 0xe1a00000
- .word 0xe28dd03c
- .word 0xe8fd8000
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8980007
- .word 0xe1a05ba5
- .word 0xeb000519
- .word 0xe20b380f
- .word 0xe353080d
- .word 0x2a00000a
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe8840001
- .word 0xea00031b
- .word 0xe51c8008
- .word 0xe218800f
- .word 0xe10f9000
- .word 0xe3888090
- .word 0xe3c9401f
- .word 0xe1848008
- .word 0xe129f008
- .word 0xe353080d
- .word 0x01a0400d
- .word 0x11a0400e
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x0a000002
- .word 0xe353080d
- .word 0x01a0d008
- .word 0x11a0e008
- .word 0xe129f009
- .word 0xe8840001
- .word 0xea000303
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8980007
- .word 0xe1a05ba5
- .word 0xeb0004ee
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xe4a40000
- .word 0xea0002f5
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8980007
- .word 0xe1a05ba5
- .word 0xeb0004e0
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xe8840001
- .word 0xea0002e7
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8980007
- .word 0xe1a05ba5
- .word 0xeb000527
- .word 0xe20b380f
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe4a40004
- .word 0xe4241004
- .word 0xe58a7080
- .word 0xe92d4000
- .word 0xeb001900
- .word 0xe8bd4000
- .word 0xe91c0300
- .word 0xe129f009
- .word 0xe169f008
- .word 0xe1a0d00c
- .word 0xe8dc7fff
- .word 0xe1a00000
- .word 0xe28dd03c
- .word 0xe8fd8000
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8980007
- .word 0xe1a05ba5
- .word 0xeb00050a
- .word 0xe20b380f
- .word 0xe353080d
- .word 0x2a00000a
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe8840003
- .word 0xea0002b7
- .word 0xe51c8008
- .word 0xe218800f
- .word 0xe10f9000
- .word 0xe3888090
- .word 0xe3c9401f
- .word 0xe1848008
- .word 0xe129f008
- .word 0xe353080d
- .word 0x01a0400d
- .word 0x11a0400e
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x0a000002
- .word 0xe353080d
- .word 0x01a0d008
- .word 0x11a0e008
- .word 0xe129f009
- .word 0xe8840003
- .word 0xea00029f
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8980007
- .word 0xe1a05ba5
- .word 0xeb0004df
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xe4a40004
- .word 0xe4241004
- .word 0xea000290
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8980007
- .word 0xe1a05ba5
- .word 0xeb0004d0
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xe8840003
- .word 0xea000282
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8980007
- .word 0xe1a05ba5
- .word 0xeb00051d
- .word 0xe20b380f
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe4a40004
- .word 0xe4a41004
- .word 0xe4242008
- .word 0xe58a7080
- .word 0xe92d4000
- .word 0xeb00189a
- .word 0xe8bd4000
- .word 0xe91c0300
- .word 0xe129f009
- .word 0xe169f008
- .word 0xe1a0d00c
- .word 0xe8dc7fff
- .word 0xe1a00000
- .word 0xe28dd03c
- .word 0xe8fd8000
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8980007
- .word 0xe1a05ba5
- .word 0xeb0004ff
- .word 0xe20b380f
- .word 0xe353080d
- .word 0x2a00000a
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe8840007
- .word 0xea000251
- .word 0xe51c8008
- .word 0xe218800f
- .word 0xe10f9000
- .word 0xe3888090
- .word 0xe3c9401f
- .word 0xe1848008
- .word 0xe129f008
- .word 0xe353080d
- .word 0x01a0400d
- .word 0x11a0400e
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x0a000002
- .word 0xe353080d
- .word 0x01a0d008
- .word 0x11a0e008
- .word 0xe129f009
- .word 0xe8840007
- .word 0xea000239
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8980007
- .word 0xe1a05ba5
- .word 0xeb0004d4
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xe4a40004
- .word 0xe4a41004
- .word 0xe4242008
- .word 0xea000229
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8980007
- .word 0xe1a05ba5
- .word 0xeb0004c4
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xe8840007
- .word 0xea00021b
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8980007
- .word 0xeb00053f
- .word 0xe20b380f
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe3170b02
- .word 0xe4a40004
- .word 0xe4a41004
- .word 0xe4a42004
- .word 0x14a46000
- .word 0xea000207
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8980007
- .word 0xeb00052b
- .word 0xe20b380f
- .word 0xe353080d
- .word 0x2a00000c
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe3170b02
- .word 0x08840007
- .word 0x18840047
- .word 0xea0001f3
- .word 0xe51c8008
- .word 0xe218800f
- .word 0xe10f9000
- .word 0xe3888090
- .word 0xe3c9401f
- .word 0xe1848008
- .word 0xe129f008
- .word 0xe353080d
- .word 0x01a0400d
- .word 0x11a0400e
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x0a000002
- .word 0xe353080d
- .word 0x01a0d008
- .word 0x11a0e008
- .word 0xe129f009
- .word 0xe3170b02
- .word 0x08840007
- .word 0x18840047
- .word 0xea0001d9
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8980007
- .word 0xeb0004fd
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xe3170b02
- .word 0xe4a40004
- .word 0xe4a41004
- .word 0xe4a42004
- .word 0x14a46000
- .word 0xea0001c8
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8980007
- .word 0xeb0004ec
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xe3170b02
- .word 0x08840007
- .word 0x18840047
- .word 0xea0001b9
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe4b40000
- .word 0xe1b00080
- .word 0xe1a01380
- .word 0xe1a00ba0
- .word 0x12800c7f
- .word 0xe1a00060
- .word 0x13811102
- .word 0xe3a02000
- .word 0xe1b08c80
- .word 0x323884fe
- .word 0x03800101
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8880007
- .word 0xe92d4000
- .word 0xeb0017cd
- .word 0xe8bd4000
- .word 0xe91c0300
- .word 0xe129f009
- .word 0xe169f008
- .word 0xe1a0d00c
- .word 0xe8dc7fff
- .word 0xe1a00000
- .word 0xe28dd03c
- .word 0xe8fd8000
- .word 0xe353080d
- .word 0x2a000021
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe8940001
- .word 0xe1b00080
- .word 0xe1a01380
- .word 0xe1a00ba0
- .word 0x12800c7f
- .word 0xe1a00060
- .word 0x13811102
- .word 0xe3a02000
- .word 0xe1b08c80
- .word 0x323884fe
- .word 0x03800101
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8880007
- .word 0xe92d4000
- .word 0xeb0017a9
- .word 0xe8bd4000
- .word 0xe91c0300
- .word 0xe129f009
- .word 0xe169f008
- .word 0xe1a0d00c
- .word 0xe8dc7fff
- .word 0xe1a00000
- .word 0xe28dd03c
- .word 0xe8fd8000
- .word 0xe51c8008
- .word 0xe218800f
- .word 0xe10f9000
- .word 0xe3888090
- .word 0xe3c9401f
- .word 0xe1848008
- .word 0xe129f008
- .word 0xe353080d
- .word 0x01a0400d
- .word 0x11a0400e
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x0a000002
- .word 0xe353080d
- .word 0x01a0d008
- .word 0x11a0e008
- .word 0xe129f009
- .word 0xe8940001
- .word 0xeaffffcf
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xeaffffa2
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xe8940001
- .word 0xeaffffbe
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe4b40004
- .word 0xe4342004
- .word 0xe1b00080
- .word 0x03320000
- .word 0xe1a01500
- .word 0xe1a00a20
- .word 0xe1811aa2
- .word 0xe1a02582
- .word 0x12800b1e
- .word 0xe1a00060
- .word 0x13811102
- .word 0xe1b08b00
- .word 0x32288103
- .word 0x323885ff
- .word 0x03800101
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8880007
- .word 0xe92d4000
- .word 0xeb00175a
- .word 0xe8bd4000
- .word 0xe91c0300
- .word 0xe129f009
- .word 0xe169f008
- .word 0xe1a0d00c
- .word 0xe8dc7fff
- .word 0xe1a00000
- .word 0xe28dd03c
- .word 0xe8fd8000
- .word 0xe353080d
- .word 0x2a000024
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe8940005
- .word 0xe1b00080
- .word 0x03320000
- .word 0xe1a01500
- .word 0xe1a00a20
- .word 0xe1811aa2
- .word 0xe1a02582
- .word 0x12800b1e
- .word 0xe1a00060
- .word 0x13811102
- .word 0xe1b08b00
- .word 0x32288103
- .word 0x323885ff
- .word 0x03800101
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8880007
- .word 0xe92d4000
- .word 0xeb001733
- .word 0xe8bd4000
- .word 0xe91c0300
- .word 0xe129f009
- .word 0xe169f008
- .word 0xe1a0d00c
- .word 0xe8dc7fff
- .word 0xe1a00000
- .word 0xe28dd03c
- .word 0xe8fd8000
- .word 0xe51c8008
- .word 0xe218800f
- .word 0xe10f9000
- .word 0xe3888090
- .word 0xe3c9401f
- .word 0xe1848008
- .word 0xe129f008
- .word 0xe353080d
- .word 0x01a0400d
- .word 0x11a0400e
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x0a000002
- .word 0xe353080d
- .word 0x01a0d008
- .word 0x11a0e008
- .word 0xe129f009
- .word 0xe8940005
- .word 0xeaffffcc
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xeaffff9b
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xe8940005
- .word 0xeaffffbb
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe4b40004
- .word 0xe4b41004
- .word 0xe4342008
- .word 0xe3c009fe
- .word 0xe3c005ff
- .word 0xe3110102
- .word 0x11e08000
- .word 0x11b08888
- .word 0x03800101
- .word 0x13c00101
- .word 0xe1818002
- .word 0xe1988880
- .word 0x03c00101
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8880007
- .word 0xe92d4000
- .word 0xeb0016e6
- .word 0xe8bd4000
- .word 0xe91c0300
- .word 0xe129f009
- .word 0xe169f008
- .word 0xe1a0d00c
- .word 0xe8dc7fff
- .word 0xe1a00000
- .word 0xe28dd03c
- .word 0xe8fd8000
- .word 0xe353080d
- .word 0x2a000021
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe8940007
- .word 0xe3c009fe
- .word 0xe3c005ff
- .word 0xe3110102
- .word 0x11e08000
- .word 0x11b08888
- .word 0x03800101
- .word 0x13c00101
- .word 0xe1818002
- .word 0xe1988880
- .word 0x03c00101
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8880007
- .word 0xe92d4000
- .word 0xeb0016c2
- .word 0xe8bd4000
- .word 0xe91c0300
- .word 0xe129f009
- .word 0xe169f008
- .word 0xe1a0d00c
- .word 0xe8dc7fff
- .word 0xe1a00000
- .word 0xe28dd03c
- .word 0xe8fd8000
- .word 0xe51c8008
- .word 0xe218800f
- .word 0xe10f9000
- .word 0xe3888090
- .word 0xe3c9401f
- .word 0xe1848008
- .word 0xe129f008
- .word 0xe353080d
- .word 0x01a0400d
- .word 0x11a0400e
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x0a000002
- .word 0xe353080d
- .word 0x01a0d008
- .word 0x11a0e008
- .word 0xe129f009
- .word 0xe8940007
- .word 0xeaffffcf
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xeaffffa0
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xe8940007
- .word 0xeaffffbe
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe3170b02
- .word 0xe4b40004
- .word 0xe4b41004
- .word 0xe4b42004
- .word 0x14b46000
- .word 0xeb0004cf
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8880007
- .word 0xea000050
- .word 0xe353080d
- .word 0x2a00000c
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe3170b02
- .word 0x08940007
- .word 0x18940047
- .word 0xeaffffeb
- .word 0xe51c8008
- .word 0xe218800f
- .word 0xe10f9000
- .word 0xe3888090
- .word 0xe3c9401f
- .word 0xe1848008
- .word 0xe129f008
- .word 0xe353080d
- .word 0x01a0400d
- .word 0x11a0400e
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x0a000002
- .word 0xe353080d
- .word 0x01a0d008
- .word 0x11a0e008
- .word 0xe129f009
- .word 0xe3170b02
- .word 0x08940007
- .word 0x18940047
- .word 0xeaffffd1
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xeaffffc4
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xe3170b02
- .word 0x08940007
- .word 0x18940047
- .word 0xeaffffbe
- .word 0xe3100101
- .word 0x1a00000f
- .word 0xe20b50e0
- .word 0xe20b8702
- .word 0xe18555a8
- .word 0xe3a04000
- .word 0xeb0005e4
- .word 0xe28f8070
- .word 0xe0888125
- .word 0xe8980300
- .word 0xe1530009
- .word 0xd1580003
- .word 0xca000013
- .word 0xe1800003
- .word 0xe3540000
- .word 0x11b08aa7
- .word 0x33877010
- .word 0x8b00075b
- .word 0xe20b8a07
- .word 0xe08a8428
- .word 0xe8880007
- .word 0xe58a7080
- .word 0xe92d4000
- .word 0xeb001629
- .word 0xe8bd4000
- .word 0xe91c0300
- .word 0xe129f009
- .word 0xe169f008
- .word 0xe1a0d00c
- .word 0xe8dc7fff
- .word 0xe1a00000
- .word 0xe28dd03c
- .word 0xe8fd8000
- .word 0xe24fe054
- .word 0xe0588003
- .word 0xca0006b7
- .word 0xea000640
- .word 0x00003f81
- .word 0x0000407e
- .word 0x00003f81
- .word 0x0000407e
- .word 0x00003f81
- .word 0x0000407e
- .word 0x00003f81
- .word 0x0000407e
- .word 0x00003c01
- .word 0x000043fe
- .word 0x00003c01
- .word 0x000043fe
- .word 0x00003c01
- .word 0x000043fe
- .word 0x00003c01
- .word 0x000043fe
- .word 0x00000000
- .word 0x00007ffe
- .word 0x00000000
- .word 0x00007ffe
- .word 0x00000000
- .word 0x00007ffe
- .word 0x00000000
- .word 0x00007ffe
- .word 0x00000000
- .word 0x00000000
- .word 0x00000000
- .word 0x00000000
- .word 0x00003fff
- .word 0x80000000
- .word 0x00000000
- .word 0x00000000
- .word 0x00004000
- .word 0x80000000
- .word 0x00000000
- .word 0x00000000
- .word 0x00004000
- .word 0xc0000000
- .word 0x00000000
- .word 0x00000000
- .word 0x00004001
- .word 0x80000000
- .word 0x00000000
- .word 0x00000000
- .word 0x00004001
- .word 0xa0000000
- .word 0x00000000
- .word 0x00000000
- .word 0x00003ffe
- .word 0x80000000
- .word 0x00000000
- .word 0x00000000
- .word 0x00004002
- .word 0xa0000000
- .word 0x00000000
- .word 0x00000000
- .word 0xe31b0702
- .word 0x131b0080
- .word 0x1a000193
- .word 0xe31b0010
- .word 0x1a000036
- .word 0xe31b0902
- .word 0x1a00001b
- .word 0xe20b8807
- .word 0xe08a8628
- .word 0xe8980007
- .word 0xe1b09e8b
- .word 0x208f8ca9
- .word 0x224880b4
- .word 0x308a8ca9
- .word 0xe8980038
- .word 0xe20b860f
- .word 0xe24fef6f
- .word 0xe08ff928
- .word 0x00000000
- .word 0xea00095b
- .word 0xea0009bf
- .word 0xea000959
- .word 0xea000958
- .word 0xea000a5c
- .word 0xea000a5b
- .word 0xea001085
- .word 0xea001084
- .word 0xea000b8f
- .word 0xea0009b7
- .word 0xea000a56
- .word 0xea000a55
- .word 0xea001381
- .word 0xea000175
- .word 0xea000174
- .word 0xea000173
- .word 0xe1b09e8b
- .word 0x208f8ca9
- .word 0x22488f46
- .word 0x308a8ca9
- .word 0xe8980007
- .word 0xe20b860f
- .word 0xe24fee22
- .word 0xe08ff928
- .word 0x00000000
- .word 0xea000c2b
- .word 0xea000c2a
- .word 0xea000c29
- .word 0xea000c67
- .word 0xea000ba1
- .word 0xea000f44
- .word 0xea000f43
- .word 0xea000ff7
- .word 0xea00117e
- .word 0xea00117d
- .word 0xea0012b7
- .word 0xea00120e
- .word 0xea00120d
- .word 0xea00138b
- .word 0xea000c38
- .word 0xea000c26
- .word 0xe20b860f
- .word 0xe08ff928
- .word 0x00000000
- .word 0xea000055
- .word 0xea00000d
- .word 0xea00003a
- .word 0xea000024
- .word 0xea000152
- .word 0xea000151
- .word 0xea000150
- .word 0xea00014f
- .word 0xea00014e
- .word 0xea00000c
- .word 0xea00014c
- .word 0xea00000a
- .word 0xea00014a
- .word 0xea000008
- .word 0xea000148
- .word 0xea000006
- .word 0xe1b09e8b
- .word 0x208f8ca9
- .word 0x22488f72
- .word 0x308a8ca9
- .word 0xe8980007
- .word 0xe28fe04c
- .word 0xea000cac
- .word 0xe20b8807
- .word 0xe08a8628
- .word 0xe8980007
- .word 0xe1b09e8b
- .word 0x208f8ca9
- .word 0x22488e1f
- .word 0x308a8ca9
- .word 0xe8980038
- .word 0xeb000c8a
- .word 0xe20b3a0f
- .word 0xe3330a0f
- .word 0x1a000007
- .word 0xe51c8008
- .word 0xe3c8820f
- .word 0xe206620f
- .word 0xe1888006
- .word 0xe50c8008
- .word 0xeaffff4f
- .word 0xe1a06007
- .word 0xe20b3a0f
- .word 0xe3530a0d
- .word 0x2a000001
- .word 0xe78c6523
- .word 0xeaffff49
- .word 0xe3330a0f
- .word 0x0afffff1
- .word 0xe51c8008
- .word 0xe218800f
- .word 0x0afffff8
- .word 0xe3888090
- .word 0xe10f9000
- .word 0xe3c9401f
- .word 0xe1848008
- .word 0xe129f008
- .word 0xe3530a0d
- .word 0x01a0d006
- .word 0x11a0e006
- .word 0xe129f009
- .word 0xeaffff3a
- .word 0xe20b3a0f
- .word 0xe3530a0d
- .word 0x2a000003
- .word 0xe79c6523
- .word 0xe3c664ff
- .word 0xe3867401
- .word 0xeaffff33
- .word 0xe3530a0f
- .word 0x0a00000c
- .word 0xe51c8008
- .word 0xe218800f
- .word 0x0afffff6
- .word 0xe3888090
- .word 0xe10f9000
- .word 0xe3c9601f
- .word 0xe1868008
- .word 0xe129f008
- .word 0xe3530a0d
- .word 0x01a0600d
- .word 0x11a0600e
- .word 0xe129f009
- .word 0xeaffffed
- .word 0xe59c603c
- .word 0xe2866008
- .word 0xeaffffea
- .word 0xe20b3a0f
- .word 0xe3530a0d
- .word 0x2a00000f
- .word 0xe79c6523
- .word 0xeb000880
- .word 0xe20b50e0
- .word 0xe20b8702
- .word 0xe18555a8
- .word 0xe3a04000
- .word 0xeb0004ee
- .word 0xe1800003
- .word 0xe3540000
- .word 0x11b08aa7
- .word 0x33877010
- .word 0x8b00066b
- .word 0xe20b8807
- .word 0xe08a8628
- .word 0xe8880007
- .word 0xeaffff0e
- .word 0xe3530a0f
- .word 0x0a00000c
- .word 0xe51c8008
- .word 0xe218800f
- .word 0x0affffea
- .word 0xe3888090
- .word 0xe10f9000
- .word 0xe3c9601f
- .word 0xe1868008
- .word 0xe129f008
- .word 0xe3530a0d
- .word 0x01a0600d
- .word 0x11a0600e
- .word 0xe129f009
- .word 0xeaffffe1
- .word 0xe59c603c
- .word 0xe2866008
- .word 0xeaffffde
- .word 0xe3a08000
- .word 0xe58a8084
- .word 0xe59c803c
- .word 0xe2488004
- .word 0xe58c803c
- .word 0xea00152f
- .word 0xe3590c02
- .word 0x1a0000d7
- .word 0xe59aa000
- .word 0xe59a8084
- .word 0xe3380000
- .word 0x1afffff3
- .word 0xe10f8000
- .word 0xe3c88080
- .word 0xe129f008
- .word 0xe1a00000
- .word 0xe31b0402
- .word 0x1a0000c9
- .word 0xe1a0958b
- .word 0xe2099102
- .word 0xe20b380f
- .word 0xe353080f
- .word 0x23899101
- .word 0xe51c8008
- .word 0xe218800f
- .word 0x13899202
- .word 0xe1a0548b
- .word 0xe2055102
- .word 0xe31b0902
- .word 0x13855101
- .word 0xe08ffda9
- .word 0x00000000
- .word 0xea000006
- .word 0xea00001a
- .word 0xea000045
- .word 0xea00004c
- .word 0xea000053
- .word 0xea000070
- .word 0xea0000a4
- .word 0xea0000ab
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe20b3a07
- .word 0xe1a03883
- .word 0xe28a9000
- .word 0xe0898ca3
- .word 0xe8980007
- .word 0xe4a40004
- .word 0xe4a41004
- .word 0xe4a42004
- .word 0xe2833202
- .word 0xe2555101
- .word 0x1afffff7
- .word 0xeafffec0
- .word 0xe353080d
- .word 0x2a000012
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe20b3a07
- .word 0xe1a03883
- .word 0xe28a9000
- .word 0xe0898ca3
- .word 0xe8980007
- .word 0xe8a40007
- .word 0xe2833202
- .word 0xe2555101
- .word 0x1afffff9
- .word 0xeafffeab
- .word 0xe51c8008
- .word 0xe218800f
- .word 0xe10f9000
- .word 0xe3888090
- .word 0xe3c9401f
- .word 0xe1848008
- .word 0xe129f008
- .word 0xe353080d
- .word 0x01a0400d
- .word 0x11a0400e
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x0a000002
- .word 0xe353080d
- .word 0x01a0d008
- .word 0x11a0e008
- .word 0xe129f009
- .word 0xeaffffde
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xeaffffbf
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xeaffffce
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe20b3a07
- .word 0xe1a03883
- .word 0xe28a9000
- .word 0xe4b40004
- .word 0xe4b41004
- .word 0xe4b42004
- .word 0xe3c009fe
- .word 0xe3c005ff
- .word 0xe3110102
- .word 0x11e08000
- .word 0x11b08888
- .word 0xe1818080
- .word 0x03800101
- .word 0xe1988002
- .word 0x03c00101
- .word 0xe0898ca3
- .word 0xe8880007
- .word 0xe2833202
- .word 0xe2555101
- .word 0x1affffee
- .word 0xeafffe66
- .word 0xe353080d
- .word 0x2a00001b
- .word 0xe79c4723
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x178c8723
- .word 0xe20b3a07
- .word 0xe1a03883
- .word 0xe28a9000
- .word 0xe8b40007
- .word 0xe3c009fe
- .word 0xe3c005ff
- .word 0xe3110102
- .word 0x11e08000
- .word 0x11b08888
- .word 0xe1818080
- .word 0x03800101
- .word 0xe1988002
- .word 0x03c00101
- .word 0xe0898ca3
- .word 0xe8880007
- .word 0xe2833202
- .word 0xe2555101
- .word 0x1afffff0
- .word 0xeafffe48
- .word 0xe51c8008
- .word 0xe218800f
- .word 0xe10f9000
- .word 0xe3888090
- .word 0xe3c9401f
- .word 0xe1848008
- .word 0xe129f008
- .word 0xe353080d
- .word 0x01a0400d
- .word 0x11a0400e
- .word 0xe20b80ff
- .word 0xe31b0502
- .word 0x10848108
- .word 0x00448108
- .word 0xe31b0401
- .word 0x11a04008
- .word 0xe31b0602
- .word 0x0a000002
- .word 0xe353080d
- .word 0x01a0d008
- .word 0x11a0e008
- .word 0xe129f009
- .word 0xeaffffd5
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xeaffffad
- .word 0xe59c403c
- .word 0xe2844004
- .word 0xe31b0401
- .word 0x120b80ff
- .word 0x10444108
- .word 0x131b0502
- .word 0x10844188
- .word 0xeaffffc5
- .word 0xe92d4000
- .word 0xeb001444
- .word 0xe8bd0400
- .word 0xe8bd4000
- .word 0xe91c0300
- .word 0xe129f009
- .word 0xe169f008
- .word 0xe59ab004
- .word 0xe59bb000
- .word 0xe59ca03c
- .word 0xe28c9040
- .word 0xe9090e00
- .word 0xe919ffff
- .word 0xe3550080
- .word 0x0a000093
- .word 0x8a0000b1
- .word 0xea000036
- .word 0xe3a05000
- .word 0xe3100101
- .word 0x1a000035
- .word 0xe3110102
- .word 0x01a0f00e
- .word 0xe3c03103
- .word 0xe2000102
- .word 0xe1924c01
- .word 0x1a00000a
- .word 0xe28f8fc9
- .word 0xe8980300
- .word 0xe1530009
- .word 0xd1580003
- .word 0xc92d4000
- .word 0xca000023
- .word 0xe1800421
- .word 0xe3c00502
- .word 0xe2438dfe
- .word 0xe1800b88
- .word 0xe1a0f00e
- .word 0xe92d4000
- .word 0xe3a04000
- .word 0xe3a06000
- .word 0xeb0003e2
- .word 0xe28f8fba
- .word 0xe8980300
- .word 0xe1530009
- .word 0xd1580003
- .word 0xca000015
- .word 0xe1800003
- .word 0xe3540000
- .word 0x11b08aa7
- .word 0x33877010
- .word 0x8b000540
- .word 0xe8bd4000
- .word 0xe1d18080
- .word 0x5a000006
- .word 0xe2300080
- .word 0xe1a08081
- .word 0xe1a084a8
- .word 0xe1880b80
- .word 0x53c00102
- .word 0x43800102
- .word 0xe1a0f00e
- .word 0xe1b007c0
- .word 0x33c10102
- .word 0x23810102
- .word 0xe1a00440
- .word 0x53c00102
- .word 0x43800102
- .word 0xe1a0f00e
- .word 0xe24fe05c
- .word 0xe0588003
- .word 0xca000502
- .word 0xea000429
- .word 0xe3100101
- .word 0x0affffc9
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0x4a00000e
- .word 0xe1918002
- .word 0x02000102
- .word 0x01a0f00e
- .word 0xe3c03103
- .word 0xe3110102
- .word 0x13530b0f
- .word 0x1affffe6
- .word 0xe2000102
- .word 0xe3110102
- .word 0x13c11102
- .word 0x12833001
- .word 0xe92d4000
- .word 0xeb000731
- .word 0xe8bd4000
- .word 0xeaffffb9
- .word 0xe1928081
- .word 0x0affffdc
- .word 0xe92d4000
- .word 0xeb000559
- .word 0xe3360000
- .word 0x5b000595
- .word 0xe8bd4000
- .word 0xeaffffcd
- .word 0xe3a05080
- .word 0xe3100101
- .word 0x1a00003b
- .word 0xe3110102
- .word 0x01a0f00e
- .word 0xe3c03103
- .word 0xe2000102
- .word 0xe1b04a82
- .word 0x1a00000c
- .word 0xe28f8f76
- .word 0xe8980300
- .word 0xe1530009
- .word 0xd1580003
- .word 0xc92d4000
- .word 0xca000029
- .word 0xe18005a1
- .word 0xe3c00601
- .word 0xe2438b0f
- .word 0xe1800a08
- .word 0xe1a01a81
- .word 0xe18115a2
- .word 0xe1a0f00e
- .word 0xe92d4000
- .word 0xe3a04000
- .word 0xe3a06000
- .word 0xeb00039e
- .word 0xe28f8f65
- .word 0xe8980300
- .word 0xe1530009
- .word 0xd1580003
- .word 0xca000019
- .word 0xe1800003
- .word 0xe3540000
- .word 0x11b08aa7
- .word 0x33877010
- .word 0x8b0004eb
- .word 0xe8bd4000
- .word 0xe1d18080
- .word 0x5a000008
- .word 0xe2300b01
- .word 0xe1a08081
- .word 0xe1a08628
- .word 0xe1880a00
- .word 0x53c00102
- .word 0x43800102
- .word 0xe1a01a81
- .word 0xe18115a2
- .word 0xe1a0f00e
- .word 0xe1b007c0
- .word 0x33c10102
- .word 0x23810102
- .word 0xe1a005c0
- .word 0x53c00102
- .word 0x43800102
- .word 0xe1a01a81
- .word 0xe18115a2
- .word 0xe1a0f00e
- .word 0xe24fe06c
- .word 0xe0588003
- .word 0xca0004a7
- .word 0xea0003ce
- .word 0xe3100101
- .word 0x0affffc3
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0x4a00000e
- .word 0xe1918002
- .word 0x02000102
- .word 0x01a0f00e
- .word 0xe3c03103
- .word 0xe3110102
- .word 0x13530dfe
- .word 0x1affffe4
- .word 0xe2000102
- .word 0xe3110102
- .word 0x13c11102
- .word 0x12833001
- .word 0xe92d4000
- .word 0xeb0006d6
- .word 0xe8bd4000
- .word 0xeaffffb3
- .word 0xe1928081
- .word 0x0affffda
- .word 0xe92d4000
- .word 0xeb0004fe
- .word 0xe3360000
- .word 0x5b00053a
- .word 0xe8bd4000
- .word 0xeaffffc9
- .word 0xe3a05c01
- .word 0xe3100101
- .word 0x01a0f00e
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0x4a00000b
- .word 0xe1918002
- .word 0x02000102
- .word 0x01a0f00e
- .word 0xe1a06880
- .word 0xe2000102
- .word 0xe3110102
- .word 0x13c11102
- .word 0x12866802
- .word 0xe3360000
- .word 0x1a00063d
- .word 0xe2000102
- .word 0xe1a0f00e
- .word 0xe1928081
- .word 0x0a000004
- .word 0xe92d4000
- .word 0xeb0004e2
- .word 0xe3360000
- .word 0x5b00051e
- .word 0xe8bd4000
- .word 0xe1110080
- .word 0xe3c00101
- .word 0x51a0f00e
- .word 0xe1928081
- .word 0x11a0f00e
- .word 0xe38000ff
- .word 0xe3800c7f
- .word 0xe3c11102
- .word 0xe1a0f00e
- .word 0x00003f81
- .word 0x0000407e
- .word 0x00003c01
- .word 0x000043fe
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0x4a00000d
- .word 0xe1916002
- .word 0x02000102
- .word 0x01a0f00e
- .word 0xe3c03103
- .word 0xe3110102
- .word 0x13c11102
- .word 0x12833001
- .word 0xe92d4000
- .word 0xeb000696
- .word 0xe8bd4000
- .word 0xe3c00101
- .word 0xe3c04103
- .word 0xe0444003
- .word 0xea000053
- .word 0xe1918002
- .word 0x0a000003
- .word 0xe3100101
- .word 0x1a000001
- .word 0xe3170801
- .word 0x1a0005b6
- .word 0xe1a085a2
- .word 0xe1888a81
- .word 0xe3c8820e
- .word 0xe3c15103
- .word 0xe1a05425
- .word 0xe1a04982
- .word 0xe3c44103
- .word 0xe1855b08
- .word 0xe1844528
- .word 0xe2000102
- .word 0xe38006ff
- .word 0xe3800aff
- .word 0xe1918002
- .word 0x13800b02
- .word 0xe3a06000
- .word 0xe3a02000
- .word 0xe3a01b02
- .word 0xe1a09005
- .word 0xe1a08125
- .word 0xe1888f04
- .word 0xe0555008
- .word 0xe0c44124
- .word 0xe1a08225
- .word 0xe1888e04
- .word 0xe0955008
- .word 0xe0a44224
- .word 0xe1a08425
- .word 0xe1888c04
- .word 0xe0955008
- .word 0xe0a44424
- .word 0xe1a08825
- .word 0xe1888804
- .word 0xe0955008
- .word 0xe0a44824
- .word 0xe0955004
- .word 0xe2a44000
- .word 0xe1a051a5
- .word 0xe1855e84
- .word 0xe1a041a4
- .word 0xe0858105
- .word 0xe0498088
- .word 0xe358000a
- .word 0x2248800a
- .word 0xe2b55000
- .word 0xe2a44000
- .word 0xe1b06226
- .word 0xe1866e02
- .word 0xe1a02222
- .word 0xe1822e01
- .word 0xe1a01221
- .word 0xe1811e08
- .word 0x3affffdc
- .word 0xe3170b02
- .word 0x0a000008
- .word 0xe1a06a26
- .word 0xe1866602
- .word 0xe1a02a22
- .word 0xe1822601
- .word 0xe1a01a21
- .word 0xe1811a00
- .word 0xe3800eff
- .word 0xe380000f
- .word 0xe1a0f00e
- .word 0xe1800a21
- .word 0xe1a01601
- .word 0xe1811a22
- .word 0xe1a02602
- .word 0xe1822a26
- .word 0xe1a0f00e
- .word 0x00003ffe
- .word 0x00013441
- .word 0xe3100101
- .word 0x1affff9d
- .word 0xe3c03103
- .word 0xe1916002
- .word 0x02000102
- .word 0x01a0f00e
- .word 0xe3a04000
- .word 0xe92d4000
- .word 0xe24f8030
- .word 0xe8980300
- .word 0xe0536008
- .word 0x82899001
- .word 0xe0090996
- .word 0xe1b06949
- .word 0x51a08006
- .word 0x0a000022
- .word 0x42668000
- .word 0xe24dd028
- .word 0xe1a09407
- .word 0xe3899003
- .word 0xe58d9000
- .word 0xe10f9000
- .word 0xe3899080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe3c7981f
- .word 0xe3c9901f
- .word 0xee209110
- .word 0xe28d901c
- .word 0xed490206
- .word 0xe8890007
- .word 0xed998200
- .word 0xe358001c
- .word 0xaa0000a7
- .word 0xe28f9fae
- .word 0xe0899208
- .word 0xedd91100
- .word 0xe3360000
- .word 0x5e480101
- .word 0x4e180101
- .word 0xee308110
- .word 0xe2088010
- .word 0xe28d901c
- .word 0xed898200
- .word 0xe8990007
- .word 0xed590206
- .word 0xe28dd028
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe3c03103
- .word 0xe0433004
- .word 0xe2000102
- .word 0xe3170b02
- .word 0x03a09011
- .word 0x13a09015
- .word 0xe2633002
- .word 0xe2833901
- .word 0xe263e020
- .word 0xe1a04e12
- .word 0xe1a02332
- .word 0xe1822e11
- .word 0xe1a01331
- .word 0xe3a03000
- .word 0xe311020f
- .word 0x1a00000a
- .word 0xe2466001
- .word 0xe0944004
- .word 0xe0b22002
- .word 0xe0a11001
- .word 0xe1a05f24
- .word 0xe0944104
- .word 0xe1a0ef22
- .word 0xe1855102
- .word 0xe0b22102
- .word 0xe18ee101
- .word 0xe0a1100e
- .word 0xe1a03203
- .word 0xe1833e21
- .word 0xe3c1120f
- .word 0xe2499001
- .word 0xe3340000
- .word 0x1affffef
- .word 0xe3a05000
- .word 0xe0922002
- .word 0xe0a11001
- .word 0xe1a0ef22
- .word 0xe0922102
- .word 0xe18ee101
- .word 0xe0a1100e
- .word 0xe1a04204
- .word 0xe1844e25
- .word 0xe1a05205
- .word 0xe1855e23
- .word 0xe1a03203
- .word 0xe1833e21
- .word 0xe3c1120f
- .word 0xe2599001
- .word 0x1afffff0
- .word 0xe1889001
- .word 0xe1899002
- .word 0xe1921281
- .word 0x3a000005
- .word 0x02031001
- .word 0x0a000003
- .word 0xe2933001
- .word 0xe203800f
- .word 0xe338000a
- .word 0x0a00003e
- .word 0xe3360000
- .word 0x43800101
- .word 0x42666000
- .word 0xe3a08000
- .word 0xe3560efa
- .word 0x22466efa
- .word 0x23888901
- .word 0xe3560e7d
- .word 0x22466e7d
- .word 0x23888a02
- .word 0xe3560ffa
- .word 0x22466ffa
- .word 0x23888a01
- .word 0xe3560e32
- .word 0x22466e32
- .word 0x23888b02
- .word 0xe3560e19
- .word 0x22466e19
- .word 0x23888b01
- .word 0xe35600c8
- .word 0x224660c8
- .word 0x23888c02
- .word 0xe3560064
- .word 0x22466064
- .word 0x23888c01
- .word 0xe3560050
- .word 0x22466050
- .word 0x23888080
- .word 0xe3560028
- .word 0x22466028
- .word 0x23888040
- .word 0xe3560014
- .word 0x22466014
- .word 0x23888020
- .word 0xe356000a
- .word 0x22866006
- .word 0xe0888006
- .word 0xe3170b02
- .word 0x0a00000b
- .word 0xe1800008
- .word 0xe1a01604
- .word 0xe1811a25
- .word 0xe1a02605
- .word 0xe1822a23
- .word 0xe1a06603
- .word 0xe3390000
- .word 0x08bd8000
- .word 0xe3170601
- .word 0x03877010
- .word 0x1b0003c6
- .word 0xe8bd8000
- .word 0xe1800608
- .word 0xe1800404
- .word 0xe1800c25
- .word 0xe1a01405
- .word 0xe1811c23
- .word 0xe1a02403
- .word 0xe3390000
- .word 0x08bd8000
- .word 0xe3170601
- .word 0x03877010
- .word 0x1b0003ad
- .word 0xe8bd8000
- .word 0xe3a01011
- .word 0xe1811401
- .word 0xe1811801
- .word 0xe1812081
- .word 0xe0828063
- .word 0xe02880a3
- .word 0xe0188181
- .word 0xe08330a8
- .word 0xe0833128
- .word 0x5affffb6
- .word 0xe2955001
- .word 0xe0828065
- .word 0xe02880a5
- .word 0xe0188181
- .word 0xe08550a8
- .word 0xe0855128
- .word 0x5affffaf
- .word 0xe2944001
- .word 0xe0828064
- .word 0xe02880a4
- .word 0xe0088181
- .word 0xe08440a8
- .word 0xe0844128
- .word 0xe1b08627
- .word 0x33140010
- .word 0x23140601
- .word 0x11a04224
- .word 0x12866001
- .word 0xeaffffa3
- .word 0xe1a090a8
- .word 0xeb000075
- .word 0xe3360000
- .word 0x5e480101
- .word 0x4e180101
- .word 0xe3180001
- .word 0x1e19110f
- .word 0xeaffff52
- .word 0x00003fff
- .word 0x80000000
- .word 0x00000000
- .word 0x00000000
- .word 0x00004002
- .word 0xa0000000
- .word 0x00000000
- .word 0x00000000
- .word 0x00004005
- .word 0xc8000000
- .word 0x00000000
- .word 0x00000000
- .word 0x00004008
- .word 0xfa000000
- .word 0x00000000
- .word 0x00000000
- .word 0x0000400c
- .word 0x9c400000
- .word 0x00000000
- .word 0x00000000
- .word 0x0000400f
- .word 0xc3500000
- .word 0x00000000
- .word 0x00000000
- .word 0x00004012
- .word 0xf4240000
- .word 0x00000000
- .word 0x00000000
- .word 0x00004016
- .word 0x98968000
- .word 0x00000000
- .word 0x00000000
- .word 0x00004019
- .word 0xbebc2000
- .word 0x00000000
- .word 0x00000000
- .word 0x0000401c
- .word 0xee6b2800
- .word 0x00000000
- .word 0x00000000
- .word 0x00004020
- .word 0x9502f900
- .word 0x00000000
- .word 0x00000000
- .word 0x00004023
- .word 0xba43b740
- .word 0x00000000
- .word 0x00000000
- .word 0x00004026
- .word 0xe8d4a510
- .word 0x00000000
- .word 0x00000000
- .word 0x0000402a
- .word 0x9184e72a
- .word 0x00000000
- .word 0x00000000
- .word 0x0000402d
- .word 0xb5e620f4
- .word 0x80000000
- .word 0x00000000
- .word 0x00004030
- .word 0xe35fa931
- .word 0xa0000000
- .word 0x00000000
- .word 0x00004034
- .word 0x8e1bc9bf
- .word 0x04000000
- .word 0x00000000
- .word 0x00004037
- .word 0xb1a2bc2e
- .word 0xc5000000
- .word 0x00000000
- .word 0x0000403a
- .word 0xde0b6b3a
- .word 0x76400000
- .word 0x00000000
- .word 0x0000403e
- .word 0x8ac72304
- .word 0x89e80000
- .word 0x00000000
- .word 0x00004041
- .word 0xad78ebc5
- .word 0xac620000
- .word 0x00000000
- .word 0x00004044
- .word 0xd8d726b7
- .word 0x177a8000
- .word 0x00000000
- .word 0x00004048
- .word 0x87867832
- .word 0x6eac9000
- .word 0x00000000
- .word 0x0000404b
- .word 0xa968163f
- .word 0x0a57b400
- .word 0x00000000
- .word 0x0000404e
- .word 0xd3c21bce
- .word 0xcceda100
- .word 0x00000000
- .word 0x00004052
- .word 0x84595161
- .word 0x401484a0
- .word 0x00000000
- .word 0x00004055
- .word 0xa56fa5b9
- .word 0x9019a5c8
- .word 0x00000000
- .word 0x00004058
- .word 0xcecb8f27
- .word 0xf4200f3a
- .word 0x00000000
- .word 0xe1a0000e
- .word 0xe3a01000
- .word 0xe1a02009
- .word 0xe352001c
- .word 0x21a020a2
- .word 0x22811001
- .word 0x2afffffb
- .word 0xe24fef79
- .word 0xe08e2202
- .word 0xedd21100
- .word 0xe3510001
- .word 0x31a0f000
- .word 0xee191101
- .word 0xe1b02139
- .word 0xe2411001
- .word 0x2e19110f
- .word 0xeafffff8
- .word 0xe92d4000
- .word 0xe1a08200
- .word 0xe3170b02
- .word 0x03a09004
- .word 0x13a09007
- .word 0xe3a05000
- .word 0xeb000141
- .word 0xe1b08627
- .word 0x23a09008
- .word 0x21b08001
- .word 0x21a01002
- .word 0x21a02006
- .word 0x33a09003
- .word 0x31b08a00
- .word 0xe1a06085
- .word 0x43866001
- .word 0xe3a05000
- .word 0xe3a04000
- .word 0xe3a03000
- .word 0xeb000134
- .word 0xe1a08001
- .word 0xe3a09008
- .word 0xeb000131
- .word 0xe1a08002
- .word 0xe3a09008
- .word 0xeb00012e
- .word 0xe3170b02
- .word 0x03a08c41
- .word 0x13a088fe
- .word 0xe15800a6
- .word 0x9a000111
- .word 0xe1a060a6
- .word 0xe1838004
- .word 0xe1988005
- .word 0x02000102
- .word 0x08bd8000
- .word 0xe3100101
- .word 0x12666000
- .word 0xe3170b02
- .word 0x02466012
- .word 0x12466017
- .word 0xe2000102
- .word 0xe2800901
- .word 0x0280003e
- .word 0x03a08000
- .word 0x1280004e
- .word 0x11a08805
- .word 0x11a05825
- .word 0x11855804
- .word 0x11a04824
- .word 0x11844803
- .word 0xe3340000
- .word 0x4a000004
- .word 0xe0988008
- .word 0xe0b55005
- .word 0xe0b44004
- .word 0xe2400001
- .word 0x5afffffa
- .word 0xe3380102
- .word 0x01f08f85
- .word 0x4a000003
- .word 0xe2955001
- .word 0xe2b44000
- .word 0x21a04064
- .word 0x22800001
- .word 0xe24dd034
- .word 0xe1a09407
- .word 0xe3899007
- .word 0xe58d9000
- .word 0xe10f9000
- .word 0xe3899080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe3c7981f
- .word 0xe3c9901f
- .word 0xee209110
- .word 0xe28d9028
- .word 0xed498209
- .word 0xe8890031
- .word 0xed998200
- .word 0xe3380000
- .word 0x1e309110
- .word 0x13899010
- .word 0x1e209110
- .word 0xe1b09006
- .word 0x4a000009
- .word 0x0a000011
- .word 0xe3590a01
- .word 0x8a000020
- .word 0xe359001c
- .word 0xb24f8fdd
- .word 0xb0888209
- .word 0xbdd81100
- .word 0xabffff90
- .word 0xee180101
- .word 0xea000008
- .word 0xe2699000
- .word 0xe3590a01
- .word 0x8a00006c
- .word 0xe359001c
- .word 0xb24f8fe7
- .word 0xb0888209
- .word 0xbdd81100
- .word 0xabffff86
- .word 0xee480101
- .word 0xee308110
- .word 0xe3180010
- .word 0xe28d9028
- .word 0xed898200
- .word 0xe8990007
- .word 0xed598209
- .word 0xe28dd034
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0x08bd8000
- .word 0xe3170601
- .word 0x03877010
- .word 0x13a04102
- .word 0x1b000262
- .word 0xe8bd8000
- .word 0xe3590a02
- .word 0x8a000028
- .word 0xe1a06009
- .word 0xe1a090a9
- .word 0xebffff6f
- .word 0xe28f9fa6
- .word 0xed99a200
- .word 0xee180102
- .word 0xee180101
- .word 0xe3160001
- .word 0x1e19110f
- .word 0xee181101
- .word 0xe28f9fa2
- .word 0xed998200
- .word 0xee190100
- .word 0xee309110
- .word 0xe3190004
- .word 0x0affffdc
- .word 0xee190102
- .word 0xee308110
- .word 0xe3180010
- .word 0xe28d9028
- .word 0xed898200
- .word 0xe8990007
- .word 0xed598209
- .word 0xe28dd034
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe3c03103
- .word 0xe2833a06
- .word 0xe2000102
- .word 0x03a04000
- .word 0x13a04102
- .word 0xe3a05002
- .word 0xeb000136
- .word 0xe3340000
- .word 0x08bd8000
- .word 0xe3170601
- .word 0x03877010
- .word 0x1b000237
- .word 0xe8bd8000
- .word 0xe3590901
- .word 0x2a000014
- .word 0xe1a06009
- .word 0xe1a09129
- .word 0xebffff44
- .word 0xe28f9f7b
- .word 0xed99a200
- .word 0xee180102
- .word 0xee180101
- .word 0xee180101
- .word 0xee180102
- .word 0xe3160002
- .word 0x1e19110f
- .word 0xee180101
- .word 0xe3160001
- .word 0x1e19110f
- .word 0xee180101
- .word 0xee309110
- .word 0xe3190004
- .word 0x0affffd3
- .word 0xe28d9028
- .word 0xed898200
- .word 0xe8990007
- .word 0xe28d9028
- .word 0xed598209
- .word 0xe28dd034
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe2000102
- .word 0xe3a01102
- .word 0xe3a02000
- .word 0xe3a03401
- .word 0xe3a04102
- .word 0xe3a05002
- .word 0xeb00010b
- .word 0xe3340000
- .word 0x08bd8000
- .word 0xe3170601
- .word 0x03877010
- .word 0x1b00020c
- .word 0xe8bd8000
- .word 0xe3590a02
- .word 0x8a000029
- .word 0xe1a06009
- .word 0xe1a090a9
- .word 0xebffff19
- .word 0xe28f9f53
- .word 0xed99a200
- .word 0xee180102
- .word 0xee480101
- .word 0xe3160001
- .word 0x1e19110f
- .word 0xee481101
- .word 0xe28f9f49
- .word 0xed998200
- .word 0xee190100
- .word 0xee309110
- .word 0xe3190008
- .word 0x0affff86
- .word 0xee190102
- .word 0xee308110
- .word 0xe3180010
- .word 0xe28d9028
- .word 0xed898200
- .word 0xe8990007
- .word 0xed598209
- .word 0xe28dd034
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe3c03103
- .word 0xe2433a06
- .word 0xe2000102
- .word 0x03a04000
- .word 0x13a04102
- .word 0xe3a05002
- .word 0xe2638000
- .word 0xeb000155
- .word 0xe3340000
- .word 0x08bd8000
- .word 0xe3170601
- .word 0x03877010
- .word 0x1b0001e0
- .word 0xe8bd8000
- .word 0xe3590901
- .word 0x2a000014
- .word 0xe1a06009
- .word 0xe1a09129
- .word 0xebfffeed
- .word 0xe28f909c
- .word 0xed99a200
- .word 0xee180102
- .word 0xee480101
- .word 0xee480101
- .word 0xee180102
- .word 0xe3160002
- .word 0x1e19110f
- .word 0xee480101
- .word 0xe3160001
- .word 0x1e19110f
- .word 0xee480101
- .word 0xee309110
- .word 0xe3190008
- .word 0x0affffd2
- .word 0xe28d9028
- .word 0xed898200
- .word 0xe8990007
- .word 0xe28d9028
- .word 0xed598209
- .word 0xe28dd034
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe2000102
- .word 0xe3a01102
- .word 0xe3a02000
- .word 0xe3a034ff
- .word 0xe3a04102
- .word 0xe3a05002
- .word 0xeb00012a
- .word 0xe3340000
- .word 0x08bd8000
- .word 0xe3170601
- .word 0x03877010
- .word 0x1b0001b5
- .word 0xe8bd8000
- .word 0x00000fff
- .word 0x80000000
- .word 0x00000000
- .word 0x00006fff
- .word 0x80000000
- .word 0x00000000
- .word 0x6f05b59d
- .word 0x3b200000
- .word 0x16ef0a57
- .word 0xb4000000
- .word 0xe3160001
- .word 0x0a000005
- .word 0xe3170b02
- .word 0x024f8024
- .word 0x124f8020
- .word 0xe8980006
- .word 0xe0555002
- .word 0xe0c44001
- .word 0xe1a08b25
- .word 0xe1888504
- .word 0xe3c8820e
- .word 0xe3c42103
- .word 0xe1a029a2
- .word 0xe1a01405
- .word 0xe3c11103
- .word 0xe1822588
- .word 0xe1811aa8
- .word 0xe2000102
- .word 0xe3800101
- .word 0xe3800c7f
- .word 0xe38000ff
- .word 0xe3160001
- .word 0x13811101
- .word 0xe1a0f00e
- .word 0xe1a03183
- .word 0xe1833ea4
- .word 0xe1a04184
- .word 0xe1844ea5
- .word 0xe1a05185
- .word 0xe0955125
- .word 0x20855f04
- .word 0x30955f04
- .word 0xe0b44124
- .word 0x20844f03
- .word 0x30944f03
- .word 0xe0a33123
- .word 0xe0955e28
- .word 0xe2b44000
- .word 0xe2a33000
- .word 0xe1a08208
- .word 0xe2599001
- .word 0x1affffed
- .word 0xe1a0f00e
- .word 0xe1b08425
- .word 0x2a000024
- .word 0x0a000010
- .word 0xe1b08086
- .word 0xe18082e5
- .word 0x23888101
- .word 0x13888202
- .word 0xe3340000
- .word 0x01b06f82
- .word 0x43888201
- .word 0xe28f6038
- .word 0xe7d66e68
- .word 0xe1b080a6
- .word 0x22922001
- .word 0x22911001
- .word 0x23a01102
- .word 0x22833001
- .word 0xe3160002
- .word 0x11a04c06
- .word 0xe1a0f00e
- .word 0xe1868002
- .word 0xe1988c81
- .word 0xe18082e5
- .word 0x23888101
- .word 0x13888202
- .word 0xe3340000
- .word 0x01b06b81
- .word 0x43888201
- .word 0xe3a02000
- .word 0xe3c110ff
- .word 0xe28f6068
- .word 0xe7d66e68
- .word 0xe1b080a6
- .word 0x22911c01
- .word 0x23a01102
- .word 0x22833001
- .word 0xe3160002
- .word 0x11a04c06
- .word 0xe1a0f00e
- .word 0xe1968b02
- .word 0xe18082e5
- .word 0x23888101
- .word 0x13888202
- .word 0xe3340000
- .word 0x01b06a02
- .word 0x43888201
- .word 0xe3c220ff
- .word 0xe3c22c07
- .word 0xe24f6020
- .word 0xe7d66e68
- .word 0xe1b080a6
- .word 0x22922b02
- .word 0x22911001
- .word 0x23a01102
- .word 0x22833001
- .word 0xe3160002
- .word 0x11a04c06
- .word 0xe1a0f00e
- .word 0xfefe0000
- .word 0x030303fe
- .word 0xfefe0000
- .word 0x030303fe
- .word 0x03030000
- .word 0x03030303
- .word 0xfefe0000
- .word 0xfefefefe
- .word 0xfefe0000
- .word 0xfefefefe
- .word 0x03030000
- .word 0x03030303
- .word 0xfefe0000
- .word 0xfefefefe
- .word 0xfefe0000
- .word 0xfefefefe
- .word 0x40007fff
- .word 0x00000000
- .word 0x00000000
- .word 0x0000407e
- .word 0xffffff00
- .word 0x00000000
- .word 0x000043fe
- .word 0xffffffff
- .word 0xfffff800
- .word 0x00007ffe
- .word 0xffffffff
- .word 0xffffffff
- .word 0xc0007fff
- .word 0x00000000
- .word 0x00000000
- .word 0x8000407e
- .word 0xffffff00
- .word 0x00000000
- .word 0x800043fe
- .word 0xffffffff
- .word 0xfffff800
- .word 0x80007ffe
- .word 0xffffffff
- .word 0xffffffff
- .word 0x00000030
- .word 0x00000000
- .word 0x0000003c
- .word 0x00000000
- .word 0x00000030
- .word 0x0000000c
- .word 0x0000003c
- .word 0x0000000c
- .word 0x00000030
- .word 0x00000000
- .word 0x00000048
- .word 0x00000000
- .word 0x00000030
- .word 0x00000018
- .word 0x00000048
- .word 0x00000018
- .word 0x00000030
- .word 0x00000000
- .word 0x00000054
- .word 0x00000000
- .word 0x00000030
- .word 0x00000024
- .word 0x00000054
- .word 0x00000024
- .word 0xe3170701
- .word 0x1a00000c
- .word 0xe3877004
- .word 0xe24f1074
- .word 0xe0811125
- .word 0xe8910006
- .word 0xe3100102
- .word 0xe24f00e4
- .word 0x10800001
- .word 0x00800002
- .word 0xe8900007
- .word 0xe3100101
- .word 0x13a04001
- .word 0x03e04000
- .word 0xe1a0f00e
- .word 0xe92d4c28
- .word 0xe3540102
- .word 0x13540000
- .word 0xc3a04001
- .word 0xb3e04000
- .word 0xee207110
- .word 0xe24dd004
- .word 0xe28f8e17
- .word 0xe20b9010
- .word 0xe7989129
- .word 0xe31b0902
- .word 0x11a09829
- .word 0xe20b860f
- .word 0xe1a08a28
- .word 0xe1a09839
- .word 0xe0099fa7
- .word 0xe1c99527
- .word 0xe0099cab
- .word 0xe3150c01
- .word 0x1a00002b
- .word 0xe3150080
- .word 0x1a000014
- .word 0xe24330c0
- .word 0xe59f8124
- .word 0xe1530008
- .word 0xd1800003
- .word 0xc28f0f43
- .word 0xc8900007
- .word 0xe92d0007
- .word 0xe1a03009
- .word 0xeb000fc2
- .word 0xe24dd010
- .word 0xe1a08407
- .word 0xe3888001
- .word 0xe58d8000
- .word 0xe10f8000
- .word 0xe3888080
- .word 0xe129f008
- .word 0xe1a00000
- .word 0xe28d8010
- .word 0xed088203
- .word 0xed980100
- .word 0xea000028
- .word 0xe2433c06
- .word 0xe59f80d4
- .word 0xe1530008
- .word 0xd1800003
- .word 0xc28f00b8
- .word 0xc8900007
- .word 0xe92d0007
- .word 0xe1a03009
- .word 0xeb000fad
- .word 0xe24dd010
- .word 0xe1a08407
- .word 0xe3888001
- .word 0xe58d8000
- .word 0xe10f8000
- .word 0xe3888080
- .word 0xe129f008
- .word 0xe1a00000
- .word 0xe28d8010
- .word 0xed088203
- .word 0xed988100
- .word 0xea000013
- .word 0xe2433a06
- .word 0xe59f8084
- .word 0xe1530008
- .word 0xd1800003
- .word 0xc28f0064
- .word 0xc8900007
- .word 0xe92d0007
- .word 0xe1a03009
- .word 0xeb000f98
- .word 0xe24dd010
- .word 0xe1a08407
- .word 0xe3888001
- .word 0xe58d8000
- .word 0xe10f8000
- .word 0xe3888080
- .word 0xe129f008
- .word 0xe1a00000
- .word 0xe28d8010
- .word 0xed088203
- .word 0xedd80100
- .word 0xee307110
- .word 0xe28d8010
- .word 0xed888200
- .word 0xe8980007
- .word 0xed188203
- .word 0xe28dd020
- .word 0xe10f8000
- .word 0xe3c88080
- .word 0xe129f008
- .word 0xe1a00000
- .word 0xe8bd8c28
- .word 0x40007fff
- .word 0x40000200
- .word 0x00000000
- .word 0x0000407e
- .word 0x000043fe
- .word 0x00007ffe
- .word 0xc0070e3f
- .word 0x00010001
- .word 0xe92d4000
- .word 0xe3170702
- .word 0x1a000025
- .word 0xe0833008
- .word 0xe1a092a8
- .word 0xe1c88289
- .word 0xe3590002
- .word 0x33390000
- .word 0xe2689020
- .word 0xe1a06912
- .word 0xe1a02832
- .word 0xe1822911
- .word 0xe1a01831
- .word 0x0a000003
- .word 0x11866106
- .word 0x11826126
- .word 0x11a02001
- .word 0x13a01000
- .word 0x3a000004
- .word 0x21866002
- .word 0x21866106
- .word 0x21816126
- .word 0x23a02000
- .word 0x23a01000
- .word 0xebfffef6
- .word 0xe3170c01
- .word 0x13310102
- .word 0x11918002
- .word 0x13a01000
- .word 0x13a02000
- .word 0x13e04000
- .word 0x03360000
- .word 0x13877008
- .word 0xe1916002
- .word 0x08bd8000
- .word 0xe3330000
- .word 0x1b000280
- .word 0x03110102
- .word 0x03800101
- .word 0xe1800003
- .word 0xe8bd8000
- .word 0xe92d4c28
- .word 0xe3540102
- .word 0x13540000
- .word 0xc3a04001
- .word 0xb3e04000
- .word 0xee207110
- .word 0xe24dd004
- .word 0xe24f80d0
- .word 0xe20b9010
- .word 0xe7989129
- .word 0xe31b0902
- .word 0x11a09829
- .word 0xe20b860f
- .word 0xe1a08a28
- .word 0xe1a09839
- .word 0xe0099fa7
- .word 0xe1c99527
- .word 0xe0099cab
- .word 0xe3150c01
- .word 0x1a000015
- .word 0xe3150080
- .word 0x1a000009
- .word 0xe28330c0
- .word 0xe59f8078
- .word 0xe1530008
- .word 0xa1800003
- .word 0xb28f0060
- .word 0xb8900007
- .word 0xe92d0007
- .word 0xe1a03009
- .word 0xeb000f34
- .word 0xeaffff6e
- .word 0xe2833c06
- .word 0xe59f8054
- .word 0xe1530008
- .word 0xa1800003
- .word 0xb28f0038
- .word 0xb8900007
- .word 0xe92d0007
- .word 0xe1a03009
- .word 0xeb000f2a
- .word 0xeaffff79
- .word 0xe2833a06
- .word 0xe3a08000
- .word 0xe1530008
- .word 0xa1800003
- .word 0xb28f0010
- .word 0xb8900007
- .word 0xe92d0007
- .word 0xe1a03009
- .word 0xeb000f20
- .word 0xeaffff84
- .word 0x40007fff
- .word 0x40000300
- .word 0x00000000
- .word 0x00003f81
- .word 0x00003c01
- .word 0xe92d4000
- .word 0xe3170702
- .word 0x1affffc3
- .word 0xe0833008
- .word 0xe1a092a8
- .word 0xe1c88289
- .word 0xe3590002
- .word 0x33390000
- .word 0xe2689020
- .word 0xe1a06912
- .word 0xe1a02832
- .word 0xe1822911
- .word 0xe1a01831
- .word 0x0a000003
- .word 0x11866106
- .word 0x11826126
- .word 0x11a02001
- .word 0x13a01000
- .word 0x3a000004
- .word 0x21866002
- .word 0x21866106
- .word 0x21816126
- .word 0x23a02000
- .word 0x23a01000
- .word 0xebfffe94
- .word 0xe3170c01
- .word 0x13310102
- .word 0x11918002
- .word 0x13a01000
- .word 0x13a02000
- .word 0x13e04000
- .word 0x03360000
- .word 0x13877008
- .word 0xe1916002
- .word 0x08bd8000
- .word 0xe3310102
- .word 0x13800101
- .word 0x13330000
- .word 0x12433001
- .word 0x13811102
- .word 0xe1800003
- .word 0xe8bd8000
- .word 0xe3a08000
- .word 0xea000004
- .word 0xe3a08001
- .word 0xea000002
- .word 0xe3a08002
- .word 0xea000000
- .word 0xe1a083a5
- .word 0xe92d4c28
- .word 0xe3540102
- .word 0x13540000
- .word 0xc3a04001
- .word 0xb3e04000
- .word 0xee207110
- .word 0xe24dd004
- .word 0xe92d0007
- .word 0xe24f8f9f
- .word 0xe20b3010
- .word 0xe7983123
- .word 0xe31b0902
- .word 0x11a03823
- .word 0xe20b860f
- .word 0xe1a08a28
- .word 0xe1a03833
- .word 0xe0033fa7
- .word 0xe1c33527
- .word 0xe0033cab
- .word 0xe3580001
- .word 0x8a000004
- .word 0x0a000001
- .word 0xeb000ed4
- .word 0xeaffff0c
- .word 0xeb000ed2
- .word 0xeaffff1f
- .word 0xeb000ed0
- .word 0xeaffff32
- .word 0xe92d4c28
- .word 0xe3540102
- .word 0x13540000
- .word 0xc3a04001
- .word 0xb3e04000
- .word 0xee207110
- .word 0xe24dd010
- .word 0xe3a03000
- .word 0xeb000ec6
- .word 0xee307110
- .word 0xe49d6010
- .word 0xe8bd8c28
- .word 0xe92d4c28
- .word 0xe3540102
- .word 0x13540000
- .word 0xc3a04001
- .word 0xb3e04000
- .word 0xee207110
- .word 0xe24dd010
- .word 0xe3a03000
- .word 0xeb000eba
- .word 0xee307110
- .word 0xe89d0007
- .word 0xe28dd010
- .word 0xe8bd8c28
- .word 0xe92d4c28
- .word 0xe3540102
- .word 0x13540000
- .word 0xc3a04001
- .word 0xb3e04000
- .word 0xee207110
- .word 0xe24dd010
- .word 0xe3a03000
- .word 0xeb000ead
- .word 0xee307110
- .word 0xe8bd0047
- .word 0xe8bd8c28
- .word 0xe3c08103
- .word 0xe3a090ff
- .word 0xe3899c43
- .word 0xe1580009
- .word 0x81a0648b
- .word 0x91e0648b
- .word 0x0006680b
- .word 0x11c6680b
- .word 0xe3360000
- .word 0x52176c02
- .word 0x11a0f00e
- .word 0xe1b06b08
- .word 0x31a06fa6
- .word 0x22026001
- .word 0xe31b0902
- .word 0x12266001
- .word 0xe31b0501
- .word 0x13a06000
- .word 0xe1a0f00e
- .word 0xe3c08103
- .word 0xe3a090ff
- .word 0xe3899c43
- .word 0xe1580009
- .word 0x81a0660b
- .word 0x91e0660b
- .word 0x00066c0b
- .word 0x11c66c0b
- .word 0xe3360000
- .word 0x52176c02
- .word 0x11a0f00e
- .word 0xe1b06b08
- .word 0x31a06fa6
- .word 0x22026001
- .word 0xe31b0080
- .word 0x12266001
- .word 0xe31b0702
- .word 0x13a06000
- .word 0xe1a0f00e
- .word 0xe1928081
- .word 0x0a000005
- .word 0xe3110101
- .word 0x0a000019
- .word 0xe1958084
- .word 0x0a000017
- .word 0xe3140101
- .word 0x1a000015
- .word 0xe2148101
- .word 0x1a000003
- .word 0xe3170801
- .word 0x1a00009b
- .word 0xe3877001
- .word 0xe3844101
- .word 0xe1a00003
- .word 0xe1a01004
- .word 0xe1a02005
- .word 0xea000011
- .word 0x0a000010
- .word 0xe2118101
- .word 0x1a00000e
- .word 0xe3170801
- .word 0x1a000053
- .word 0xea000009
- .word 0x0a00000a
- .word 0xe2118101
- .word 0x1a000008
- .word 0xe3170801
- .word 0x1a00002d
- .word 0xea000003
- .word 0xe2118101
- .word 0x1a000003
- .word 0xe3170801
- .word 0x1a000085
- .word 0xe3877001
- .word 0xe3811101
- .word 0xe31b0702
- .word 0x1a000010
- .word 0xe31b0080
- .word 0x1a000006
- .word 0xe2000103
- .word 0xe380007f
- .word 0xe3800901
- .word 0xe3a02000
- .word 0xe3c110ff
- .word 0xe3811102
- .word 0xe1a0f00e
- .word 0xe2000103
- .word 0xe38000ff
- .word 0xe3800c43
- .word 0xe1a025a2
- .word 0xe1a02582
- .word 0xe3811102
- .word 0xe1300000
- .word 0xe1a0f00e
- .word 0xe31b0c02
- .word 0x1a000005
- .word 0xe3c08103
- .word 0xe3a090ff
- .word 0xe3899c43
- .word 0xe1580009
- .word 0x33c22001
- .word 0x03822001
- .word 0xe2000103
- .word 0xe38000ff
- .word 0xe3800c7f
- .word 0xe1300000
- .word 0xe1a0f00e
- .word 0xe3170801
- .word 0x1a000004
- .word 0xe3877001
- .word 0xe28f0d0a
- .word 0xe8900007
- .word 0xe1811408
- .word 0xe1a0f00e
- .word 0xe92d4c30
- .word 0xee207110
- .word 0xe24dd00c
- .word 0xe92d0007
- .word 0xe28f8f9b
- .word 0xe20b3010
- .word 0xe7983123
- .word 0xe31b0902
- .word 0x11a03823
- .word 0xe20b860f
- .word 0xe1a08a28
- .word 0xe1a03833
- .word 0xe0033fa7
- .word 0xe1c33527
- .word 0xe0033cab
- .word 0xe31b0702
- .word 0x1a00002e
- .word 0xe31b0080
- .word 0x1a00001f
- .word 0xeb000e1d
- .word 0xe24dd010
- .word 0xe1a08407
- .word 0xe3888001
- .word 0xe58d8000
- .word 0xe10f8000
- .word 0xe3888080
- .word 0xe129f008
- .word 0xe1a00000
- .word 0xe28d8010
- .word 0xed088203
- .word 0xed980100
- .word 0xea00002b
- .word 0xe92d4c30
- .word 0xee207110
- .word 0xe24dd00c
- .word 0xe92d0007
- .word 0xe28f8f7b
- .word 0xe20b3010
- .word 0xe7983123
- .word 0xe31b0902
- .word 0x11a03823
- .word 0xe20b860f
- .word 0xe1a08a28
- .word 0xe1a03833
- .word 0xe0033fa7
- .word 0xe1c33527
- .word 0xe0033cab
- .word 0xe31b0501
- .word 0x1a00000e
- .word 0xe31b0902
- .word 0x0affffdf
- .word 0xeb000dfd
- .word 0xe24dd010
- .word 0xe1a08407
- .word 0xe3888001
- .word 0xe58d8000
- .word 0xe10f8000
- .word 0xe3888080
- .word 0xe129f008
- .word 0xe1a00000
- .word 0xe28d8010
- .word 0xed088203
- .word 0xed988100
- .word 0xea00000b
- .word 0xeb000df0
- .word 0xe24dd010
- .word 0xe1a08407
- .word 0xe3888001
- .word 0xe58d8000
- .word 0xe10f8000
- .word 0xe3888080
- .word 0xe129f008
- .word 0xe1a00000
- .word 0xe28d8010
- .word 0xed088203
- .word 0xedd80100
- .word 0xee307110
- .word 0xe28d8010
- .word 0xed888200
- .word 0xe8980007
- .word 0xed188203
- .word 0xe28dd028
- .word 0xe10f8000
- .word 0xe3c88080
- .word 0xe129f008
- .word 0xe1a00000
- .word 0xe2106101
- .word 0x03c03103
- .word 0x02000102
- .word 0xe3b08001
- .word 0xe8bd8c30
- .word 0xe3170801
- .word 0x0affff9d
- .word 0xe92d4c30
- .word 0xee207110
- .word 0xe92d003f
- .word 0xe28f80fc
- .word 0xe20b3010
- .word 0xe7983123
- .word 0xe31b0902
- .word 0x11a03823
- .word 0xe20b860f
- .word 0xe1a08a28
- .word 0xe1a03833
- .word 0xe0033fa7
- .word 0xe1c33527
- .word 0xe0033cab
- .word 0xe31b0702
- .word 0x1a000005
- .word 0xe31b0080
- .word 0x1a000001
- .word 0xeb000dc1
- .word 0xeaffffa2
- .word 0xeb000dbf
- .word 0xeaffffc0
- .word 0xeb000dbd
- .word 0xeaffffcb
- .word 0xe3170801
- .word 0x03877001
- .word 0x01a0f00e
- .word 0xe92d4c00
- .word 0xee207110
- .word 0xe24dd004
- .word 0xe92d0007
- .word 0xe3a03000
- .word 0xeb000db3
- .word 0xee307110
- .word 0xe49d6010
- .word 0xe8bd8c00
- .word 0xe3170801
- .word 0x03877001
- .word 0x01a0f00e
- .word 0xe92d4c00
- .word 0xee207110
- .word 0xe92d003f
- .word 0xe3a03000
- .word 0xeb000da8
- .word 0xee307110
- .word 0xe49d6018
- .word 0xe8bd8c00
- .word 0xe92d4c00
- .word 0xee207110
- .word 0xe24dd004
- .word 0xe92d0007
- .word 0xe3a03000
- .word 0xe3170b02
- .word 0x1a000003
- .word 0xeb000d9d
- .word 0xe8bd0007
- .word 0xe28dd004
- .word 0xea000001
- .word 0xeb000d99
- .word 0xe8bd0047
- .word 0xee307110
- .word 0xe8bd8c00
- .word 0x40007fff
- .word 0x00000000
- .word 0x00000000
- .word 0x40007fff
- .word 0x40000000
- .word 0x00000000
- .word 0xc0070e3f
- .word 0x00010001
- .word 0xe3170802
- .word 0x1a000004
- .word 0xe3877002
- .word 0xe24f0034
- .word 0xe8900007
- .word 0xe3800102
- .word 0xe1a0f00e
- .word 0xe92d4c30
- .word 0xee207110
- .word 0xe24dd00c
- .word 0xe92d0007
- .word 0xe24f803c
- .word 0xe20b3010
- .word 0xe7983123
- .word 0xe31b0902
- .word 0x11a03823
- .word 0xe20b860f
- .word 0xe1a08a28
- .word 0xe1a03833
- .word 0xe0033fa7
- .word 0xe1c33527
- .word 0xe0033cab
- .word 0xe31b0702
- .word 0x1a000005
- .word 0xe31b0080
- .word 0x1a000001
- .word 0xeb000d75
- .word 0xeaffff54
- .word 0xeb000d73
- .word 0xeaffff72
- .word 0xeb000d71
- .word 0xeaffff7d
- .word 0xe3170802
- .word 0x1a000006
- .word 0xe3877002
- .word 0xe0208003
- .word 0xe2088102
- .word 0xe24f00bc
- .word 0xe8900007
- .word 0xe1800008
- .word 0xe1a0f00e
- .word 0xe92d4c30
- .word 0xee207110
- .word 0xe92d003f
- .word 0xe24f80c0
- .word 0xe20b3010
- .word 0xe7983123
- .word 0xe31b0902
- .word 0x11a03823
- .word 0xe20b860f
- .word 0xe1a08a28
- .word 0xe1a03833
- .word 0xe0033fa7
- .word 0xe1c33527
- .word 0xe0033cab
- .word 0xe31b0702
- .word 0x1a000005
- .word 0xe31b0080
- .word 0x1a000001
- .word 0xeb000d54
- .word 0xeaffff33
- .word 0xeb000d52
- .word 0xeaffff51
- .word 0xeb000d50
- .word 0xeaffff5c
- .word 0xe2000102
- .word 0xe3310000
- .word 0x0a000017
- .word 0xe3a08000
- .word 0xe1b09821
- .word 0x01a01801
- .word 0x02888010
- .word 0xe1b09c21
- .word 0x01a01401
- .word 0x02888008
- .word 0xe1b09e21
- .word 0x01a01201
- .word 0x02888004
- .word 0xe1b09f21
- .word 0x01a01101
- .word 0x02888002
- .word 0xe1b09fa1
- .word 0x01a01081
- .word 0x02888001
- .word 0xe05898a6
- .word 0x81a01931
- .word 0x81a088a6
- .word 0xe2686020
- .word 0xe1811632
- .word 0xe1a02812
- .word 0x30400009
- .word 0xe1a0f00e
- .word 0xe3560501
- .word 0x3a000016
- .word 0xe1b01002
- .word 0x01a0f00e
- .word 0xe3a02000
- .word 0xe3a08020
- .word 0xe1b09821
- .word 0x01a01801
- .word 0x02888010
- .word 0xe1b09c21
- .word 0x01a01401
- .word 0x02888008
- .word 0xe1b09e21
- .word 0x01a01201
- .word 0x02888004
- .word 0xe1b09f21
- .word 0x01a01101
- .word 0x02888002
- .word 0xe1b09fa1
- .word 0x01a01081
- .word 0x02888001
- .word 0xe05898a6
- .word 0x81a01931
- .word 0x30400009
- .word 0xe1a0f00e
- .word 0xe1a088a6
- .word 0xe2689020
- .word 0xe1a01811
- .word 0xe1811932
- .word 0xe1a02812
- .word 0xe1a0f00e
- .word 0xe2033102
- .word 0xe3340000
- .word 0x0a000017
- .word 0xe3a08000
- .word 0xe1b09824
- .word 0x01a04804
- .word 0x02888010
- .word 0xe1b09c24
- .word 0x01a04404
- .word 0x02888008
- .word 0xe1b09e24
- .word 0x01a04204
- .word 0x02888004
- .word 0xe1b09f24
- .word 0x01a04104
- .word 0x02888002
- .word 0xe1b09fa4
- .word 0x01a04084
- .word 0x02888001
- .word 0xe05898a6
- .word 0x81a04934
- .word 0x81a088a6
- .word 0xe2686020
- .word 0xe1844635
- .word 0xe1a05815
- .word 0x30433009
- .word 0xe1a0f00e
- .word 0xe3560501
- .word 0x3a000016
- .word 0xe1b04005
- .word 0x01a0f00e
- .word 0xe3a05000
- .word 0xe3a08020
- .word 0xe1b09824
- .word 0x01a04804
- .word 0x02888010
- .word 0xe1b09c24
- .word 0x01a04404
- .word 0x02888008
- .word 0xe1b09e24
- .word 0x01a04204
- .word 0x02888004
- .word 0xe1b09f24
- .word 0x01a04104
- .word 0x02888002
- .word 0xe1b09fa4
- .word 0x01a04084
- .word 0x02888001
- .word 0xe05898a6
- .word 0x81a04934
- .word 0x30433009
- .word 0xe1a0f00e
- .word 0xe1a088a6
- .word 0xe2689020
- .word 0xe1a04814
- .word 0xe1844935
- .word 0xe1a05815
- .word 0xe1a0f00e
- .word 0xe3a02000
- .word 0xe2160102
- .word 0x12661000
- .word 0x01b01006
- .word 0x03a03000
- .word 0x01a0f00e
- .word 0xe3a03901
- .word 0xe383301e
- .word 0xe3a06000
- .word 0xe3310000
- .word 0x01a01002
- .word 0x03a02000
- .word 0x02433020
- .word 0xe3a08000
- .word 0xe1b09821
- .word 0x01a01801
- .word 0x02888010
- .word 0xe1b09c21
- .word 0x01a01401
- .word 0x02888008
- .word 0xe1b09e21
- .word 0x01a01201
- .word 0x02888004
- .word 0xe1b09f21
- .word 0x01a01101
- .word 0x02888002
- .word 0xe1b09fa1
- .word 0x01a01081
- .word 0x02888001
- .word 0xe2789020
- .word 0xe1811932
- .word 0xe1a02812
- .word 0xe0433008
- .word 0xe1a0f00e
- .word 0xe3340000
- .word 0x01a04005
- .word 0x03a05000
- .word 0x02433020
- .word 0xe3a08000
- .word 0xe1b09824
- .word 0x01a04804
- .word 0x02888010
- .word 0xe1b09c24
- .word 0x01a04404
- .word 0x02888008
- .word 0xe1b09e24
- .word 0x01a04204
- .word 0x02888004
- .word 0xe1b09f24
- .word 0x01a04104
- .word 0x02888002
- .word 0xe1b09fa4
- .word 0x01a04084
- .word 0x02888001
- .word 0xe2789020
- .word 0xe1844935
- .word 0xe1a05815
- .word 0xe0433008
- .word 0xe1a0f00e
- .word 0xe3310000
- .word 0x01a01002
- .word 0x03a02000
- .word 0x02833020
- .word 0xe3a08000
- .word 0xe1b09821
- .word 0x01a01801
- .word 0x02888010
- .word 0xe1b09c21
- .word 0x01a01401
- .word 0x02888008
- .word 0xe1b09e21
- .word 0x01a01201
- .word 0x02888004
- .word 0xe1b09f21
- .word 0x01a01101
- .word 0x02888002
- .word 0xe1b09fa1
- .word 0x01a01081
- .word 0x02888001
- .word 0xe2789020
- .word 0xe1811932
- .word 0xe1a02812
- .word 0xe0833008
- .word 0xe1a0f00e
- .word 0xe3100101
- .word 0x03130101
- .word 0x1a0003c1
- .word 0xe92d4000
- .word 0xe31b0602
- .word 0x12233102
- .word 0xe31b0601
- .word 0x12233102
- .word 0x12200102
- .word 0xe1a06880
- .word 0xe0568883
- .word 0xe020e003
- .word 0xe2000102
- .word 0xe1a038a6
- .word 0x8a00001a
- .word 0x01a09008
- .word 0x0a00002e
- .word 0xe2686000
- .word 0xe1a068a6
- .word 0xe0833006
- .word 0xe1a092a6
- .word 0xe1c66289
- .word 0xe3590002
- .word 0x33390000
- .word 0xe2669020
- .word 0xe1a08912
- .word 0xe1a02632
- .word 0xe1822911
- .word 0xe1a01631
- .word 0x0a000003
- .word 0x11888108
- .word 0x11828128
- .word 0x11a02001
- .word 0x13a01000
- .word 0x3a000004
- .word 0x21888002
- .word 0x21888108
- .word 0x21818128
- .word 0x23a02000
- .word 0x23a01000
- .word 0xe3a09000
- .word 0xea000015
- .word 0xe1a068a8
- .word 0xe1a082a6
- .word 0xe1c66288
- .word 0xe3580002
- .word 0x33380000
- .word 0xe2668020
- .word 0xe1a09815
- .word 0xe1a05635
- .word 0xe1855814
- .word 0xe1a04634
- .word 0x0a000003
- .word 0x11899109
- .word 0x11859129
- .word 0x11a05004
- .word 0x13a04000
- .word 0x3a000004
- .word 0x21899005
- .word 0x21899109
- .word 0x21849129
- .word 0x23a05000
- .word 0x23a04000
- .word 0xe3a08000
- .word 0xe31e0102
- .word 0x1a000009
- .word 0xe0986009
- .word 0xe0b22005
- .word 0xe0b11004
- .word 0x38bd8000
- .word 0xe2833001
- .word 0xe1b01061
- .word 0xe1b02062
- .word 0xe1866086
- .word 0xe1a06066
- .word 0xe8bd8000
- .word 0xe0586009
- .word 0xe0d22005
- .word 0xe0d11004
- .word 0x2a000003
- .word 0xe2200102
- .word 0xe2766000
- .word 0xe2f22000
- .word 0xe2e11000
- .word 0xe3110102
- .word 0x18bd8000
- .word 0xe0966006
- .word 0xe0b22002
- .word 0xe0a11001
- .word 0xe2433001
- .word 0xe3110102
- .word 0x18bd8000
- .word 0xe191e002
- .word 0x1bffff56
- .word 0x18bd8000
- .word 0xe20b8060
- .word 0xe3380040
- .word 0x03a00102
- .word 0x13a00000
- .word 0xe3a03000
- .word 0xe8bd8000
- .word 0xe3100101
- .word 0x03130101
- .word 0x1a000395
- .word 0xe0118004
- .word 0x5a0003b5
- .word 0xe3c08103
- .word 0xe3c39103
- .word 0xe0200003
- .word 0xe2000102
- .word 0xe0883009
- .word 0xe2433c3f
- .word 0xe24330fe
- .word 0xe31b0502
- .word 0x1a00007f
- .word 0xe3320000
- .word 0x0a00005d
- .word 0xe3350000
- .word 0x0a00003d
- .word 0xe92d4881
- .word 0xe1a00821
- .word 0xe1c17800
- .word 0xe1a06824
- .word 0xe1c48806
- .word 0xe0090690
- .word 0xe0060697
- .word 0xe0070798
- .word 0xe0977806
- .word 0xe0a99826
- .word 0xe0080890
- .word 0xe0977808
- .word 0xe0a90828
- .word 0xe1a0b822
- .word 0xe1c2e80b
- .word 0xe1a06825
- .word 0xe1c58806
- .word 0xe009069b
- .word 0xe006069e
- .word 0xe00e0e98
- .word 0xe09ee806
- .word 0xe0a99826
- .word 0xe008089b
- .word 0xe09ee808
- .word 0xe0a9b828
- .word 0xe097700b
- .word 0xe2a00000
- .word 0xe097b00e
- .word 0xe0b77000
- .word 0xe2a00000
- .word 0xe0518002
- .word 0xe3a01000
- .word 0xe3a06000
- .word 0x31e01001
- .word 0x30446005
- .word 0x10559004
- .word 0x03a01000
- .word 0x31e01001
- .word 0x30466008
- .word 0xe1a04828
- .word 0xe1c85804
- .word 0xe1a08829
- .word 0xe1c99808
- .word 0xe0226894
- .word 0xe0080895
- .word 0xe0060599
- .word 0xe0966808
- .word 0xe0a22828
- .word 0xe0090994
- .word 0xe0966809
- .word 0xe0a22829
- .word 0xe09b6006
- .word 0xe0b72002
- .word 0xe0b01001
- .word 0xe18ee10e
- .word 0xe186612e
- .word 0x48bd8881
- .word 0xe0966006
- .word 0xe0b22002
- .word 0xe0a11001
- .word 0xe2433001
- .word 0xe8bd8881
- .word 0xe1a05824
- .word 0xe1c46805
- .word 0xe1a08821
- .word 0xe1c19808
- .word 0xe0040895
- .word 0xe0080896
- .word 0xe0010699
- .word 0xe0911808
- .word 0xe0a44828
- .word 0xe0090995
- .word 0xe0911809
- .word 0xe0a44829
- .word 0xe1a08822
- .word 0xe1c29808
- .word 0xe0020895
- .word 0xe0080896
- .word 0xe0060699
- .word 0xe0966808
- .word 0xe0a22828
- .word 0xe0090995
- .word 0xe0966809
- .word 0xe0a25829
- .word 0xe0952001
- .word 0xe2b41000
- .word 0x41a0f00e
- .word 0xe0966006
- .word 0xe0b22002
- .word 0xe0a11001
- .word 0xe2433001
- .word 0xe1a0f00e
- .word 0xe3350000
- .word 0x0a00001d
- .word 0xe1a02821
- .word 0xe1c16802
- .word 0xe1a08824
- .word 0xe1c49808
- .word 0xe0010892
- .word 0xe0080896
- .word 0xe0040699
- .word 0xe0944808
- .word 0xe0a11828
- .word 0xe0090992
- .word 0xe0944809
- .word 0xe0a11829
- .word 0xe1a08825
- .word 0xe1c59808
- .word 0xe0050892
- .word 0xe0080896
- .word 0xe0060699
- .word 0xe0966808
- .word 0xe0a55828
- .word 0xe0090992
- .word 0xe0966809
- .word 0xe0a52829
- .word 0xe0922004
- .word 0xe2b11000
- .word 0x41a0f00e
- .word 0xe0966006
- .word 0xe0b22002
- .word 0xe0a11001
- .word 0xe2433001
- .word 0xe1a0f00e
- .word 0xe1a05824
- .word 0xe1c46805
- .word 0xe1a08821
- .word 0xe1c19808
- .word 0xe0010895
- .word 0xe0080896
- .word 0xe0020699
- .word 0xe0922808
- .word 0xe0a11828
- .word 0xe0090995
- .word 0xe0922809
- .word 0xe0b11829
- .word 0xe3a06000
- .word 0x41a0f00e
- .word 0xe0922002
- .word 0xe0a11001
- .word 0xe2433001
- .word 0xe1a0f00e
- .word 0xe3100101
- .word 0x03130101
- .word 0x1a000336
- .word 0xe0118004
- .word 0x5a000361
- .word 0xe31b0601
- .word 0x1a000008
- .word 0xe1a08000
- .word 0xe1a00003
- .word 0xe1a03008
- .word 0xe1a08001
- .word 0xe1a01004
- .word 0xe1a04008
- .word 0xe1a08002
- .word 0xe1a02005
- .word 0xe1a05008
- .word 0xe3c08103
- .word 0xe3c39103
- .word 0xe0200003
- .word 0xe2000102
- .word 0xe0493008
- .word 0xe2833c3f
- .word 0xe28330ff
- .word 0xe92d4889
- .word 0xe1a00821
- .word 0xe1c17800
- .word 0xe1a0b822
- .word 0xe1c2e80b
- .word 0xe28f6fd9
- .word 0xe7d66420
- .word 0xe0286690
- .word 0xe2688502
- .word 0xe0060698
- .word 0xe1a069a6
- .word 0xe2866002
- .word 0xe1a086a1
- .word 0xe0296698
- .word 0xe2699202
- .word 0xe1a08829
- .word 0xe1c99808
- .word 0xe0020699
- .word 0xe0010698
- .word 0xe0816822
- .word 0xe1a06326
- .word 0xe1b040a4
- .word 0xe1b05065
- .word 0x33a03000
- .word 0x23a03102
- .word 0xe1a087a4
- .word 0xe0090896
- .word 0xe1a09829
- .word 0xe0080b99
- .word 0xe0555008
- .word 0xe0080990
- .word 0xe0c44008
- .word 0xe0080e99
- .word 0xe0533808
- .word 0xe0d55828
- .word 0xe0080799
- .word 0x30455808
- .word 0x20555808
- .word 0xe0c44828
- .word 0xe1a01809
- .word 0xe1a08124
- .word 0xe0090896
- .word 0xe1a09829
- .word 0xe0080b99
- .word 0xe0533988
- .word 0xe0d556a8
- .word 0xe0080990
- .word 0x30455988
- .word 0x20555988
- .word 0xe0c446a8
- .word 0xe0080e99
- .word 0xe0533188
- .word 0xe0d55ea8
- .word 0xe0080799
- .word 0x30455188
- .word 0x20555188
- .word 0xe0c44ea8
- .word 0xe1a04d04
- .word 0xe1844325
- .word 0xe1a05d05
- .word 0xe1855323
- .word 0xe1a03d03
- .word 0xe0811189
- .word 0xe59d800c
- .word 0xe3180702
- .word 0x03180080
- .word 0x0a000094
- .word 0xe1a087a4
- .word 0xe0090896
- .word 0xe1a09829
- .word 0xe0080b99
- .word 0xe0555008
- .word 0xe0080990
- .word 0xe0c44008
- .word 0xe0080e99
- .word 0xe0533808
- .word 0xe0d55828
- .word 0xe0080799
- .word 0x30455808
- .word 0x20555808
- .word 0xe0c44828
- .word 0xe1a02b09
- .word 0xe0811529
- .word 0xe1a08124
- .word 0xe0090896
- .word 0xe1a09829
- .word 0xe0080b99
- .word 0xe0533988
- .word 0xe0d556a8
- .word 0xe0080990
- .word 0x30455988
- .word 0x20555988
- .word 0xe0c446a8
- .word 0xe0080e99
- .word 0xe0533188
- .word 0xe0d55ea8
- .word 0xe0080799
- .word 0x30455188
- .word 0x20555188
- .word 0xe0c44ea8
- .word 0xe1a04d04
- .word 0xe1844325
- .word 0xe1a05d05
- .word 0xe1855323
- .word 0xe1a03d03
- .word 0xe0922489
- .word 0xe2a11000
- .word 0xe59d800c
- .word 0xe3180702
- .word 0x0a00003f
- .word 0xe1a087a4
- .word 0xe0090896
- .word 0xe1a09829
- .word 0xe0080b99
- .word 0xe0555008
- .word 0xe0080990
- .word 0xe0c44008
- .word 0xe0080e99
- .word 0xe0533808
- .word 0xe0d55828
- .word 0xe0080799
- .word 0x30455808
- .word 0x20555808
- .word 0xe0c44828
- .word 0xe1a04704
- .word 0xe1844925
- .word 0xe1a05705
- .word 0xe1855923
- .word 0xe1a03703
- .word 0xe1a06e09
- .word 0xe0922229
- .word 0xe2a11000
- .word 0xe1870800
- .word 0xe18e780b
- .word 0xe3a0e000
- .word 0xe0559007
- .word 0xe0d48000
- .word 0x21a05009
- .word 0x21a04008
- .word 0xe0aee00e
- .word 0xe3a0b000
- .word 0xe0933003
- .word 0xe0b55005
- .word 0xe0b44004
- .word 0xe0abb00b
- .word 0xe0559007
- .word 0xe0d48000
- .word 0xe2dbb000
- .word 0x21a05009
- .word 0x21a04008
- .word 0xe0aee00e
- .word 0xe3a0b000
- .word 0xe0933003
- .word 0xe0b55005
- .word 0xe0b44004
- .word 0xe0abb00b
- .word 0xe0559007
- .word 0xe0d48000
- .word 0xe2dbb000
- .word 0x21a05009
- .word 0x21a04008
- .word 0xe0aee00e
- .word 0xe1948005
- .word 0x13866001
- .word 0xe0966e0e
- .word 0xe2b22000
- .word 0xe2b11000
- .word 0x48bd8889
- .word 0xe8bd4889
- .word 0xe0966006
- .word 0xe0b22002
- .word 0xe0a11001
- .word 0xe2433001
- .word 0xe1a0f00e
- .word 0xe1870800
- .word 0xe18e780b
- .word 0xe3a0e000
- .word 0xe0933003
- .word 0xe0b55005
- .word 0xe0a44004
- .word 0xe0559007
- .word 0xe0d48000
- .word 0x21a05009
- .word 0x21a04008
- .word 0xe0aee00e
- .word 0xe3a0b000
- .word 0xe0933003
- .word 0xe0b55005
- .word 0xe0b44004
- .word 0xe0abb00b
- .word 0xe0559007
- .word 0xe0d48000
- .word 0xe2dbb000
- .word 0x21a05009
- .word 0x21a04008
- .word 0xe0aee00e
- .word 0xe3a0b000
- .word 0xe0933003
- .word 0xe0b55005
- .word 0xe0b44004
- .word 0xe0abb00b
- .word 0xe0559007
- .word 0xe0d48000
- .word 0xe2dbb000
- .word 0x21a05009
- .word 0x21a04008
- .word 0xe0aee00e
- .word 0xe1846005
- .word 0xe092248e
- .word 0xe2b11000
- .word 0x48bd8889
- .word 0xe8bd4889
- .word 0xe0922002
- .word 0xe0a11001
- .word 0xe2433001
- .word 0xe1a0f00e
- .word 0xe1870800
- .word 0xe18e780b
- .word 0xe0933003
- .word 0xe0b55005
- .word 0xe0a44004
- .word 0xe0559007
- .word 0xe0d48000
- .word 0x21a05009
- .word 0x21a04008
- .word 0x22811020
- .word 0xe3a0b000
- .word 0xe0933003
- .word 0xe0b55005
- .word 0xe0b44004
- .word 0xe0abb00b
- .word 0xe0559007
- .word 0xe0d48000
- .word 0xe2dbb000
- .word 0x21a05009
- .word 0x21a04008
- .word 0x22811010
- .word 0xe3a0b000
- .word 0xe0933003
- .word 0xe0b55005
- .word 0xe0b44004
- .word 0xe0abb00b
- .word 0xe0559007
- .word 0xe0d48000
- .word 0xe2dbb000
- .word 0x21a05009
- .word 0x21a04008
- .word 0x22811008
- .word 0xe1846005
- .word 0xe3a02000
- .word 0xe3310000
- .word 0x48bd8889
- .word 0xe8bd4889
- .word 0xe1a01081
- .word 0xe2433001
- .word 0xe1a0f00e
- .word 0x7e7f8080
- .word 0x7a7b7c7d
- .word 0x76777879
- .word 0x73747576
- .word 0x70717172
- .word 0x6d6e6e6f
- .word 0x6a6b6c6c
- .word 0x6868696a
- .word 0x65666667
- .word 0x63636464
- .word 0x60616162
- .word 0x5e5f5f60
- .word 0x5c5d5d5e
- .word 0x5a5b5b5c
- .word 0x5859595a
- .word 0x56575758
- .word 0x55555556
- .word 0x53535454
- .word 0x51525252
- .word 0x50505051
- .word 0x4e4f4f4f
- .word 0x4d4d4d4e
- .word 0x4b4c4c4c
- .word 0x4a4a4b4b
- .word 0x4949494a
- .word 0x47484848
- .word 0x46474747
- .word 0x45454646
- .word 0x44444445
- .word 0x43434344
- .word 0x42424243
- .word 0x41414142
- .word 0xe3100101
- .word 0x03130101
- .word 0x1a00025f
- .word 0xe1946005
- .word 0x03a0800a
- .word 0x0afffc6c
- .word 0xe1916002
- .word 0x0a000297
- .word 0xe92d4000
- .word 0xe3c33103
- .word 0xe2433001
- .word 0xe3c06103
- .word 0xe0566003
- .word 0xe2000102
- .word 0xb0863003
- .word 0xb3a06000
- .word 0xb1a0f00e
- .word 0xe1a000c0
- .word 0xe3a0e000
- .word 0xea000002
- .word 0xe1a0efa1
- .word 0xe0922002
- .word 0xe0a11001
- .word 0xe0728005
- .word 0xe0f19004
- .word 0xe2fee000
- .word 0x2a000002
- .word 0xe0982005
- .word 0xe0a91004
- .word 0xe2200102
- .word 0xe2566001
- .word 0xaafffff3
- .word 0xe3a06000
- .word 0xe1918002
- .word 0x01a00080
- .word 0x03a03000
- .word 0x12000102
- .word 0x1bfffd52
- .word 0xe8bd8000
- .word 0xe3100101
- .word 0x1a00027f
- .word 0xe3110102
- .word 0x0a000293
- .word 0xe3c03103
- .word 0xe2100102
- .word 0x13a0800b
- .word 0x1afffbe1
- .word 0xe2833c3f
- .word 0xe28330ff
- .word 0xe1b030a3
- .word 0x32414102
- .word 0x22414101
- .word 0xe1a05002
- .word 0xe3a08202
- .word 0xe3a01102
- .word 0xe3a02000
- .word 0xe3a0928b
- .word 0xe1a069ab
- .word 0xe3160001
- .word 0x03a0926b
- .word 0x031b0080
- .word 0x03a09103
- .word 0x3a000005
- .word 0xe0955005
- .word 0xe0b44004
- .word 0xe1816008
- .word 0x31540006
- .word 0x20444006
- .word 0x21811088
- .word 0xe0955005
- .word 0xe0b44004
- .word 0xe18160a8
- .word 0x31540006
- .word 0x20444006
- .word 0x21811008
- .word 0xe0955005
- .word 0xe0b44004
- .word 0xe1816128
- .word 0x31540006
- .word 0x20444006
- .word 0x218110a8
- .word 0xe0955005
- .word 0xe0b44004
- .word 0xe18161a8
- .word 0x31540006
- .word 0x20444006
- .word 0x21811128
- .word 0xe0955005
- .word 0xe0b44004
- .word 0xe1816228
- .word 0x31540006
- .word 0x20444006
- .word 0x218111a8
- .word 0xe0955005
- .word 0xe0b44004
- .word 0xe18162a8
- .word 0x31540006
- .word 0x20444006
- .word 0x21811228
- .word 0xe2999201
- .word 0xe1a08368
- .word 0xbaffffd8
- .word 0xe1946005
- .word 0x13580020
- .word 0x01a0f00e
- .word 0xe92d4880
- .word 0xe0955005
- .word 0xe0b44004
- .word 0xe0aee00e
- .word 0xe1826008
- .word 0xe055b006
- .word 0xe0d47001
- .word 0x31b0e0ae
- .word 0x21a0500b
- .word 0x21a04007
- .word 0x21822088
- .word 0x21811fa8
- .word 0xe0955005
- .word 0xe0b44004
- .word 0xe0aee00e
- .word 0xe18260a8
- .word 0xe055b006
- .word 0xe0d47001
- .word 0x31b0e0ae
- .word 0x21a0500b
- .word 0x21a04007
- .word 0x21822008
- .word 0xe0955005
- .word 0xe0b44004
- .word 0xe0aee00e
- .word 0xe1826128
- .word 0xe055b006
- .word 0xe0d47001
- .word 0x31b0e0ae
- .word 0x21a0500b
- .word 0x21a04007
- .word 0x218220a8
- .word 0xe0955005
- .word 0xe0b44004
- .word 0xe0aee00e
- .word 0xe18261a8
- .word 0xe055b006
- .word 0xe0d47001
- .word 0x31b0e0ae
- .word 0x21a0500b
- .word 0x21a04007
- .word 0x21822128
- .word 0xe2599001
- .word 0xe1a08268
- .word 0x1affffd3
- .word 0xe1946005
- .word 0x13580080
- .word 0x08bd8880
- .word 0xe0955005
- .word 0xe0b44004
- .word 0xe0aee00e
- .word 0xe2788000
- .word 0xe0f2b005
- .word 0xe0f17004
- .word 0x31b0e0ae
- .word 0x21a0500b
- .word 0x21a04007
- .word 0x33a08000
- .word 0x23822001
- .word 0xe3a06106
- .word 0xe0988008
- .word 0xe0b55005
- .word 0xe0b44004
- .word 0x28bd8880
- .word 0xe0d5b002
- .word 0xe0d4b001
- .word 0x33a06001
- .word 0xe8bd8880
- .word 0xe3100101
- .word 0x1a00021a
- .word 0xe3c03103
- .word 0xe2000102
- .word 0xe3a06000
- .word 0xe31b0601
- .word 0x12200102
- .word 0xe31b0602
- .word 0x13c00102
- .word 0xe1a0f00e
- .word 0xe3100101
- .word 0x1a000236
- .word 0xe3c03103
- .word 0xe3110102
- .word 0x1a000008
- .word 0xe1918002
- .word 0x03a03000
- .word 0x0a000005
- .word 0xe92d4000
- .word 0xe0116080
- .word 0x43c11102
- .word 0x42833001
- .word 0xebfffcb4
- .word 0xe8bd4000
- .word 0xe2000102
- .word 0xe3a06000
- .word 0xe1a0f00e
- .word 0xe3100101
- .word 0x1a000232
- .word 0xe3c06103
- .word 0xe2000102
- .word 0xe3a03016
- .word 0xe31b0080
- .word 0x13a03033
- .word 0xe31b0702
- .word 0x13a0303e
- .word 0xe3833901
- .word 0xe0538006
- .word 0x9a000014
- .word 0xe1a092a8
- .word 0xe1c88289
- .word 0xe3590002
- .word 0x33390000
- .word 0xe2689020
- .word 0xe1a06912
- .word 0xe1a02832
- .word 0xe1822911
- .word 0xe1a01831
- .word 0x0a000003
- .word 0x11866106
- .word 0x11826126
- .word 0x11a02001
- .word 0x13a01000
- .word 0x3a000004
- .word 0x21866002
- .word 0x21866106
- .word 0x21816126
- .word 0x23a02000
- .word 0x23a01000
- .word 0xe1a0f00e
- .word 0xe1a03006
- .word 0xe3a06000
- .word 0xe1a0f00e
- .word 0xe3100101
- .word 0x1a000219
- .word 0xe3c03103
- .word 0xe2000102
- .word 0xe3110102
- .word 0x0a000049
- .word 0x13a0603e
- .word 0xe3866901
- .word 0xe0568003
- .word 0xda000045
- .word 0xe2789020
- .word 0xba000017
- .word 0xe1b08912
- .word 0x0a000041
- .word 0xe1b08080
- .word 0x231b0020
- .word 0x331b0040
- .word 0x1a000007
- .word 0xe31b0060
- .word 0x1a00000a
- .word 0xe2898001
- .word 0xe1b08812
- .word 0x1a000001
- .word 0xe1b080a1
- .word 0xe1b08912
- .word 0x2a000004
- .word 0xe2699020
- .word 0xe1a02932
- .word 0xe1a02912
- .word 0xe3a06101
- .word 0xe1a0f00e
- .word 0xe2699020
- .word 0xe1e02932
- .word 0xe1e02912
- .word 0xe3a06103
- .word 0xe1a0f00e
- .word 0xe2789040
- .word 0xba00001a
- .word 0xe1928911
- .word 0x0a000027
- .word 0xe1b08080
- .word 0x231b0020
- .word 0x331b0040
- .word 0x1a000007
- .word 0xe31b0060
- .word 0x1a00000c
- .word 0xe2898001
- .word 0xe1928811
- .word 0x1a000001
- .word 0xe3590001
- .word 0x21b08911
- .word 0x2a000006
- .word 0xe2699020
- .word 0xe1a01931
- .word 0xe1b01911
- .word 0xe3a02000
- .word 0x03a03000
- .word 0xe3a06101
- .word 0xe1a0f00e
- .word 0xe2699020
- .word 0xe1e01931
- .word 0xe1e01911
- .word 0xe3e02000
- .word 0xe3a06103
- .word 0xe1a0f00e
- .word 0xe0208d0b
- .word 0xe0209c8b
- .word 0xe1d88009
- .word 0x4a000004
- .word 0xe3a01000
- .word 0xe3a02000
- .word 0xe3a03000
- .word 0xe3a06101
- .word 0xe1a0f00e
- .word 0xe3e01000
- .word 0xe3e02000
- .word 0xe3a03c3f
- .word 0xe38330fe
- .word 0xe3a06103
- .word 0xe1a0f00e
- .word 0xe3a06000
- .word 0xe1a0f00e
- .word 0xe3100101
- .word 0x03130101
- .word 0x1a0001d7
- .word 0xe31b0602
- .word 0x02233102
- .word 0xe1a08880
- .word 0xe1580883
- .word 0x01510004
- .word 0x01520005
- .word 0x0a000004
- .word 0x23300000
- .word 0x33330000
- .word 0x53a06202
- .word 0x43a06102
- .word 0xe1a0f00e
- .word 0xe0309003
- .word 0xe3a06206
- .word 0x41a0f00e
- .word 0xe1888001
- .word 0xe1988002
- .word 0x01a0f00e
- .word 0xe3100102
- .word 0x03a06202
- .word 0x13a06102
- .word 0xe1a0f00e
- .word 0xe3100101
- .word 0x1a0001f9
- .word 0xe3c06103
- .word 0xe2000102
- .word 0xe92d4000
- .word 0xe3a03901
- .word 0xe383303e
- .word 0xe0538006
- .word 0x9a000023
- .word 0xe1a092a8
- .word 0xe1c88289
- .word 0xe3590002
- .word 0x33390000
- .word 0xe2689020
- .word 0xe1a06912
- .word 0xe1a02832
- .word 0xe1822911
- .word 0xe1a01831
- .word 0x0a000003
- .word 0x11866106
- .word 0x11826126
- .word 0x11a02001
- .word 0x13a01000
- .word 0x3a000004
- .word 0x21866002
- .word 0x21866106
- .word 0x21816126
- .word 0x23a02000
- .word 0x23a01000
- .word 0xe20b5060
- .word 0xe3855c01
- .word 0xe3a04000
- .word 0xebfff86d
- .word 0xe1b08080
- .word 0x21e01001
- .word 0x22722000
- .word 0x22811001
- .word 0xe1310fc2
- .word 0x1a000005
- .word 0xe1a06002
- .word 0xe3540000
- .word 0x11b08aa7
- .word 0x33877010
- .word 0x8bfff9fe
- .word 0xe8bd8000
- .word 0xe8bd4000
- .word 0xe3e06102
- .word 0xe0266fc0
- .word 0xe3a0800e
- .word 0xeafffb03
- .word 0xe1a09883
- .word 0xe3790802
- .word 0x30099004
- .word 0xe0199083
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0x4a000014
- .word 0xe3190102
- .word 0x1a000022
- .word 0xe92d4000
- .word 0xe0116080
- .word 0x43c11102
- .word 0x42800001
- .word 0xe0146083
- .word 0x43c44102
- .word 0x42833001
- .word 0xe3100101
- .word 0x11b06880
- .word 0x1bfffb5d
- .word 0xe3130101
- .word 0x11b06883
- .word 0x1bfffb94
- .word 0xebfffc24
- .word 0xe3110102
- .word 0x18bd8000
- .word 0xe191e002
- .word 0x1bfffbd2
- .word 0xe8bd8000
- .word 0xe3190102
- .word 0x0a000009
- .word 0xe1828081
- .word 0xe1888005
- .word 0xe1988084
- .word 0x1afffa1f
- .word 0xe023850b
- .word 0xe0388000
- .word 0x52008102
- .word 0x5a00000a
- .word 0xe3a08004
- .word 0xeafffabf
- .word 0xe1928081
- .word 0x1afffa35
- .word 0xe2008102
- .word 0xea000004
- .word 0xe1958084
- .word 0x1afffa1b
- .word 0xe2038102
- .word 0xe31b0602
- .word 0x12288102
- .word 0xe31b0601
- .word 0x12288102
- .word 0xe28f0fe6
- .word 0xe8900007
- .word 0xe1800008
- .word 0xe1a0f00e
- .word 0xe1a09883
- .word 0xe3790802
- .word 0x30099004
- .word 0xe0199083
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0x4a00001f
- .word 0xe3190102
- .word 0x1a00002f
- .word 0xe1918002
- .word 0x11948005
- .word 0x0a000013
- .word 0xe0116080
- .word 0x43c11102
- .word 0x42800001
- .word 0xe0146083
- .word 0x43c44102
- .word 0x42833001
- .word 0xe3c08103
- .word 0xe3c39103
- .word 0xe0200003
- .word 0xe2000102
- .word 0xe0883009
- .word 0xe2433c3f
- .word 0xe24330fe
- .word 0xe92d4000
- .word 0xe3110102
- .word 0x0bfffb98
- .word 0xe3140102
- .word 0x0bfffbaf
- .word 0xe8bd4000
- .word 0xeafffc50
- .word 0xe0200003
- .word 0xe2000102
- .word 0xe3a01000
- .word 0xe3a02000
- .word 0xe3a03000
- .word 0xe3a06000
- .word 0xe1a0f00e
- .word 0xe3190102
- .word 0x0a000009
- .word 0xe1828081
- .word 0xe1888005
- .word 0xe1988084
- .word 0x1afff9db
- .word 0xe0208003
- .word 0xe2088102
- .word 0xe28f0fb1
- .word 0xe8900007
- .word 0xe1800008
- .word 0xe1a0f00e
- .word 0xe1928081
- .word 0x1afff9f1
- .word 0xe1948005
- .word 0x1afffff5
- .word 0xe3a08005
- .word 0xeafffa75
- .word 0xe1958084
- .word 0x1afff9d5
- .word 0xe1918002
- .word 0x1affffef
- .word 0xe3a08006
- .word 0xeafffa6f
- .word 0xe1a09883
- .word 0xe3790802
- .word 0x30099004
- .word 0xe0199083
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0x4a000036
- .word 0xe3190102
- .word 0x1a000048
- .word 0xe1918002
- .word 0x11948005
- .word 0x0a00001e
- .word 0xe31b0601
- .word 0x1a000008
- .word 0xe1a08000
- .word 0xe1a00003
- .word 0xe1a03008
- .word 0xe1a08001
- .word 0xe1a01004
- .word 0xe1a04008
- .word 0xe1a08002
- .word 0xe1a02005
- .word 0xe1a05008
- .word 0xe0116080
- .word 0x43c11102
- .word 0x42800001
- .word 0xe0146083
- .word 0x43c44102
- .word 0x42833001
- .word 0xe3c08103
- .word 0xe3c39103
- .word 0xe0200003
- .word 0xe2000102
- .word 0xe0493008
- .word 0xe2833c3f
- .word 0xe28330ff
- .word 0xe92d4000
- .word 0xe3110102
- .word 0x0bfffb7e
- .word 0xe3140102
- .word 0x0bfffb63
- .word 0xe8bd4000
- .word 0xeafffcaf
- .word 0xe3a08007
- .word 0xe31b0601
- .word 0x1a00000a
- .word 0xe1919002
- .word 0x1afffaa5
- .word 0xe1949005
- .word 0x0afffa3b
- .word 0xe0200003
- .word 0xe2000102
- .word 0xe3a01000
- .word 0xe3a02000
- .word 0xe3a03000
- .word 0xe3a06000
- .word 0xe1a0f00e
- .word 0xe1919002
- .word 0x1afffff6
- .word 0xe1949005
- .word 0x1afffa98
- .word 0xeafffa2f
- .word 0xe3190102
- .word 0x0a000005
- .word 0xe1828081
- .word 0xe1888005
- .word 0xe1988084
- .word 0x1afff983
- .word 0xe3a08008
- .word 0xeafffa27
- .word 0xe1928081
- .word 0x1afff99d
- .word 0xe0208003
- .word 0xe2088102
- .word 0xe31b0601
- .word 0x028f0e15
- .word 0x128f0d05
- .word 0xe8900007
- .word 0xe1800008
- .word 0xe3a03000
- .word 0xe3a06000
- .word 0xe1a0f00e
- .word 0xe1958084
- .word 0x1afff97b
- .word 0xe0208003
- .word 0xe2088102
- .word 0xe31b0601
- .word 0x128f0e12
- .word 0x028f0e11
- .word 0xe8900007
- .word 0xe1800008
- .word 0xe3a03000
- .word 0xe3a06000
- .word 0xe1a0f00e
- .word 0xe1a09883
- .word 0xe3790802
- .word 0x30099004
- .word 0xe0199083
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0x4a000017
- .word 0xe3190102
- .word 0x1a000021
- .word 0xe1948005
- .word 0x03a0800a
- .word 0x0afffa01
- .word 0xe1916002
- .word 0x0a00002c
- .word 0xe0116080
- .word 0x43c11102
- .word 0x42800001
- .word 0xe0146083
- .word 0x43c44102
- .word 0x42833001
- .word 0xe92d4000
- .word 0xe3c33103
- .word 0xe3140102
- .word 0x0bfffb14
- .word 0xe2439001
- .word 0xe3c03103
- .word 0xe3140102
- .word 0x0bfffaf7
- .word 0xe0536009
- .word 0xe1a03009
- .word 0xeafffd88
- .word 0xe3190102
- .word 0x0a000005
- .word 0xe1828081
- .word 0xe1888005
- .word 0xe1988084
- .word 0x1afff942
- .word 0xe3a08009
- .word 0xeafff9e6
- .word 0xe1928081
- .word 0x1afff95c
- .word 0xe3a08009
- .word 0xeafff9e2
- .word 0xe1958084
- .word 0x1afff942
- .word 0xe3100101
- .word 0x03c03103
- .word 0x02000102
- .word 0x03a06000
- .word 0x01a0f00e
- .word 0xe1916002
- .word 0x0a000006
- .word 0xe3c03103
- .word 0xe2000102
- .word 0xe3110102
- .word 0x13c11102
- .word 0x12833001
- .word 0xe3a06000
- .word 0xeafffad8
- .word 0xe2000102
- .word 0xe3a03000
- .word 0xe1a0f00e
- .word 0x00000000
- .word 0x00000000
- .word 0x00000000
- .word 0x40007fff
- .word 0x00000000
- .word 0x00000000
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0x4a000013
- .word 0xe1918002
- .word 0x02000102
- .word 0x0a00000d
- .word 0xe3c03103
- .word 0xe2100102
- .word 0x13a0800b
- .word 0x1afff95b
- .word 0xe92d4000
- .word 0xe3110102
- .word 0x13c11102
- .word 0x12833001
- .word 0xebfffabe
- .word 0xe2833c3f
- .word 0xe28330ff
- .word 0xe1b030a3
- .word 0xe8bd4000
- .word 0xeafffd72
- .word 0xe3a03000
- .word 0xe3a06000
- .word 0xe1a0f00e
- .word 0xe1928081
- .word 0x1afff921
- .word 0xe3100102
- .word 0x13a0800b
- .word 0x1afff949
- .word 0xe24f008c
- .word 0xe8900007
- .word 0xe1a0f00e
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0x4a00000a
- .word 0xe1918002
- .word 0x03a03000
- .word 0x0afffddd
- .word 0xe3c03103
- .word 0xe92d4000
- .word 0xe0116080
- .word 0x43c11102
- .word 0x42833001
- .word 0xebfffaa0
- .word 0xe8bd4000
- .word 0xeafffdd5
- .word 0xe1928081
- .word 0x1a000008
- .word 0xe2008102
- .word 0xe31b0601
- .word 0x12288102
- .word 0xe31b0602
- .word 0x13c88102
- .word 0xe24f00f4
- .word 0xe8900007
- .word 0xe1800008
- .word 0xe1a0f00e
- .word 0xe92d4000
- .word 0xebfff8d2
- .word 0xe3360000
- .word 0x4a000001
- .word 0xebfff8fa
- .word 0x18bd8000
- .word 0xe31b0601
- .word 0x12200102
- .word 0xe31b0602
- .word 0x13c00102
- .word 0xe8bd8000
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0x53c03103
- .word 0x5afffdc5
- .word 0xe1928081
- .word 0x1afff8ed
- .word 0xe2008102
- .word 0xe24f0f55
- .word 0xe8900007
- .word 0xe1800008
- .word 0xe1a0f00e
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0x4afffff3
- .word 0xe3c06103
- .word 0xe2000102
- .word 0xe3110102
- .word 0x13c11102
- .word 0x12866001
- .word 0xeafffdc3
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0x4affffe8
- .word 0xe1913002
- .word 0x02000102
- .word 0x0afffe2b
- .word 0xe3c03103
- .word 0xe2000102
- .word 0xe92d4000
- .word 0xe3110102
- .word 0x13c11102
- .word 0x12833001
- .word 0xebfffa61
- .word 0xe8bd4000
- .word 0xeafffdd8
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0xe1a09883
- .word 0xe3790802
- .word 0x30099004
- .word 0xe0199083
- .word 0xe3180102
- .word 0x11926081
- .word 0x1a00001b
- .word 0xe3190102
- .word 0x11956084
- .word 0x1a000018
- .word 0xe92d4000
- .word 0xe3180102
- .word 0x12000102
- .word 0x138000ff
- .word 0x13800c7f
- .word 0x13c11102
- .word 0xe3190102
- .word 0x12033102
- .word 0x138330ff
- .word 0x13833c7f
- .word 0x13c44102
- .word 0xe0116080
- .word 0x43c11102
- .word 0x42800001
- .word 0xe0146083
- .word 0x43c44102
- .word 0x42833001
- .word 0xe3100101
- .word 0x11b06880
- .word 0x1bfff9c0
- .word 0xe3130101
- .word 0x11b06883
- .word 0x1bfff9f7
- .word 0xe8bd4000
- .word 0xeafffe00
- .word 0xe3170a01
- .word 0x03a06201
- .word 0x13a06203
- .word 0xe3180102
- .word 0x11928081
- .word 0x0a000004
- .word 0xe2118101
- .word 0x0afff950
- .word 0xe3190102
- .word 0x11958084
- .word 0x0a000001
- .word 0xe2148101
- .word 0x0afff94b
- .word 0xe31b0501
- .word 0x01a0f00e
- .word 0xe3a0800f
- .word 0xeafff947
- .word 0xe3100101
- .word 0x0afffe05
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0x4a000005
- .word 0xe3c06103
- .word 0xe2000102
- .word 0xe3110102
- .word 0x13c11102
- .word 0x12866001
- .word 0xeafffdfc
- .word 0xe3110101
- .word 0x03a08000
- .word 0x13a0800c
- .word 0xe1926081
- .word 0x03a0800d
- .word 0xe3a06102
- .word 0xeafff927
- .word 0xedd8a200
- .word 0xee181102
- .word 0xee106111
- .word 0xee308110
- .word 0xe3180005
- .word 0x0e016110
- .word 0x0e192103
- .word 0x0e280102
- .word 0x0e192104
- .word 0x0e280102
- .word 0xe1a0f009
- .word 0xecb8a203
- .word 0xe2466001
- .word 0xecb8b203
- .word 0xee1a2101
- .word 0xee0a2103
- .word 0xe2566001
- .word 0x1afffffa
- .word 0xee1a2101
- .word 0xe1a0f009
- .word 0xecb8b203
- .word 0xee094103
- .word 0xe2566001
- .word 0x01a0f009
- .word 0xecb8b203
- .word 0xee1c4101
- .word 0xee0c4103
- .word 0xe2566001
- .word 0x1afffffa
- .word 0xe1a0f009
- .word 0xee08a109
- .word 0xee108111
- .word 0xe0389048
- .word 0xe2a99000
- .word 0xe3a06902
- .word 0xe1190006
- .word 0x01a060a6
- .word 0x0afffffc
- .word 0xe3580000
- .word 0xba00000e
- .word 0xea000002
- .word 0xee1a2102
- .word 0xe1190086
- .word 0x1e1a2100
- .word 0xe1b060a6
- .word 0x1afffffa
- .word 0xee1a3102
- .word 0xe3190001
- .word 0x0e1a2162
- .word 0x1e1b2160
- .word 0x1e1b3100
- .word 0xea000009
- .word 0xee1a2102
- .word 0xe1190086
- .word 0x1e4a2100
- .word 0xe1b060a6
- .word 0x1afffffa
- .word 0xee1a3102
- .word 0xe3190001
- .word 0x0e1a2162
- .word 0x1e4b2160
- .word 0x1e4b3100
- .word 0xee308110
- .word 0xe318000c
- .word 0x1a0001b7
- .word 0xee92f113
- .word 0x03a06101
- .word 0x13a06103
- .word 0xe3180010
- .word 0x03a06000
- .word 0xee088102
- .word 0xea00010c
- .word 0x80003ffe
- .word 0xca20ad9a
- .word 0xb5e946e9
- .word 0x00004003
- .word 0x83125100
- .word 0xb57f6509
- .word 0x80004005
- .word 0x803ff895
- .word 0x9dacd228
- .word 0x80004004
- .word 0x8eac025b
- .word 0x3e7076bb
- .word 0x00004007
- .word 0x9c041fd0
- .word 0xa933ef60
- .word 0x80004008
- .word 0xc05ff4e0
- .word 0x6c83bb96
- .word 0x00003ffe
- .word 0xb17217f7
- .word 0xd1cf0000
- .word 0x00003fcd
- .word 0xf35793c0
- .word 0x00000000
- .word 0x00003ffe
- .word 0xb504f333
- .word 0xf9de6484
- .word 0x00003ffd
- .word 0xde5bd8a9
- .word 0x37287195
- .word 0xe3100101
- .word 0x1a000079
- .word 0xe1918002
- .word 0x0afff8eb
- .word 0xe3100102
- .word 0x13a08018
- .word 0x1afff83e
- .word 0xe3c03103
- .word 0xe3a00c3f
- .word 0xe38000fe
- .word 0xe0433000
- .word 0xe92d4000
- .word 0xe24dd04c
- .word 0xe1a09407
- .word 0xe389901f
- .word 0xe58d9000
- .word 0xe10f9000
- .word 0xe3899080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe3c7981f
- .word 0xe3c9901f
- .word 0xee209110
- .word 0xe28d9040
- .word 0xed09020f
- .word 0xed09c203
- .word 0xe8890007
- .word 0xed998200
- .word 0xe31b0601
- .word 0x0a000011
- .word 0xe2838001
- .word 0xe0889108
- .word 0xe0689109
- .word 0xe1a09349
- .word 0xe359001c
- .word 0x2a000010
- .word 0xe24f8b0b
- .word 0xe2488feb
- .word 0xe0888209
- .word 0xe8980130
- .word 0xe1320008
- .word 0x01310005
- .word 0x00444003
- .word 0x01300004
- .word 0x1a000007
- .word 0xe3a06000
- .word 0xee019110
- .word 0xea00003e
- .word 0xe3530001
- .word 0x0e90f11e
- .word 0x03a06000
- .word 0x0e089108
- .word 0x0a000039
- .word 0xed5f113d
- .word 0xee90f111
- .word 0xd2433001
- .word 0xde28010e
- .word 0xee18110e
- .word 0xee09110e
- .word 0xce280109
- .word 0xee480101
- .word 0xee181100
- .word 0xe24f8f5e
- .word 0xe3a06003
- .word 0xe1a0900f
- .word 0xeaffff62
- .word 0xe24f8f59
- .word 0xe3a06003
- .word 0xe1a0900f
- .word 0xeaffff67
- .word 0xee4a2104
- .word 0xee1a1100
- .word 0xee091100
- .word 0xe3330000
- .word 0x1a000008
- .word 0xe31b0601
- .word 0x1a000017
- .word 0xee1a2160
- .word 0xee0a0160
- .word 0xee91f110
- .word 0x03a06101
- .word 0x13a06103
- .word 0x1e089100
- .word 0xea00001a
- .word 0xee083110
- .word 0xed5f2263
- .word 0xee1a2100
- .word 0xee1b3100
- .word 0xee090102
- .word 0xee282102
- .word 0xee2a2101
- .word 0xee0a2103
- .word 0xee081102
- .word 0xe31b0601
- .word 0x1a000005
- .word 0xee080162
- .word 0xee91f110
- .word 0x03a06101
- .word 0x13a06103
- .word 0x1e089100
- .word 0xea000009
- .word 0xee08a101
- .word 0xed5f016b
- .word 0xee181162
- .word 0xe3a06101
- .word 0xe31b00e0
- .word 0x1a000003
- .word 0xe31b0702
- .word 0x1e180102
- .word 0x1e90f111
- .word 0x13a06103
- .word 0xe28d9040
- .word 0xed899200
- .word 0xe8990007
- .word 0xed19020f
- .word 0xed19c203
- .word 0xe28dd04c
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe3c03103
- .word 0xe2000102
- .word 0xe8bd8000
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0x4a00000c
- .word 0xe1918002
- .word 0x0afff86c
- .word 0xe3c03103
- .word 0xe3100102
- .word 0x13a08018
- .word 0x1afff7be
- .word 0xe92d4000
- .word 0xe3110102
- .word 0x13c11102
- .word 0x12833001
- .word 0xebfff921
- .word 0xe8bd4000
- .word 0xeaffff79
- .word 0xe1928081
- .word 0x1afff78a
- .word 0xe3100102
- .word 0x13a08018
- .word 0x1afff7b2
- .word 0xe24f0b01
- .word 0xe2400fba
- .word 0xe8900007
- .word 0xe1a0f00e
- .word 0x00003fff
- .word 0xb8aa3b29
- .word 0x5c17f0bc
- .word 0x00003ffe
- .word 0xb1800000
- .word 0x00000000
- .word 0x80003ff2
- .word 0xde8082e3
- .word 0x08654362
- .word 0x00003ff1
- .word 0x845a2157
- .word 0x3490f106
- .word 0x00003ff8
- .word 0xf83a5f91
- .word 0x50952c99
- .word 0x00003feb
- .word 0xc99b1867
- .word 0x2822a93e
- .word 0x00003ff5
- .word 0xa57862e1
- .word 0x46a6fb39
- .word 0x00003ffb
- .word 0xe8b9428e
- .word 0xfecff592
- .word 0x00003fbd
- .word 0x80000000
- .word 0x00000000
- .word 0x00003ffd
- .word 0xffffffff
- .word 0xffffffff
- .word 0xe3100101
- .word 0x1a00005f
- .word 0xe1916002
- .word 0x0a00005a
- .word 0xe1a05000
- .word 0xe92d4000
- .word 0xe24dd04c
- .word 0xe1a09407
- .word 0xe389901f
- .word 0xe58d9000
- .word 0xe10f9000
- .word 0xe3899080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe3c7981f
- .word 0xe3c9901f
- .word 0xee209110
- .word 0xe28d9040
- .word 0xed09020f
- .word 0xed09c203
- .word 0xe8890007
- .word 0xed998200
- .word 0xe3a04000
- .word 0xe24f80dc
- .word 0xe1a0900f
- .word 0xeafffeca
- .word 0x02868801
- .word 0x01b088a8
- .word 0x1a000030
- .word 0xe2866001
- .word 0xe1844086
- .word 0xed5f1127
- .word 0xee28a100
- .word 0xee92f111
- .word 0xba000024
- .word 0xee181100
- .word 0xe24f80d4
- .word 0xe3a06003
- .word 0xe1a0900f
- .word 0xeafffec7
- .word 0xee0a4109
- .word 0xe24f8c01
- .word 0xe3a06002
- .word 0xe1a0900f
- .word 0xeafffec2
- .word 0xee0a210e
- .word 0xee1a2100
- .word 0xee2c4102
- .word 0xee4a1104
- .word 0xee09016e
- .word 0xe3a06101
- .word 0xe31b00e0
- .word 0x1a000004
- .word 0xe31b0702
- .word 0x0a000002
- .word 0xee09110e
- .word 0xee90f111
- .word 0x13a06103
- .word 0xe28d9040
- .word 0xed898200
- .word 0xe8990007
- .word 0xed19020f
- .word 0xed19c203
- .word 0xe28dd04c
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe3c03103
- .word 0xe08330c4
- .word 0xe1a00f84
- .word 0xe8bd8000
- .word 0xee90f118
- .word 0xae08810e
- .word 0xa3a06101
- .word 0xbd5f0150
- .word 0xb3a06103
- .word 0xeaffffeb
- .word 0xe28d9040
- .word 0xed19020f
- .word 0xed19c203
- .word 0xe28dd04c
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe28f0b01
- .word 0xe2800f05
- .word 0xe8900007
- .word 0xe1800f84
- .word 0xe3a03601
- .word 0xe3150102
- .word 0x12633000
- .word 0xe3a06101
- .word 0xe8bd8000
- .word 0xe28f0e3f
- .word 0xe890000f
- .word 0xe1a0f00e
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0x5affff9a
- .word 0xe1928081
- .word 0x1afff6fc
- .word 0xe3a04000
- .word 0xe3100102
- .word 0x024f0b02
- .word 0x02400f47
- .word 0x08900007
- .word 0x13a00000
- .word 0x13a01000
- .word 0x13a03000
- .word 0x13a06000
- .word 0xe1800f84
- .word 0xe1a0f00e
- .word 0xe92d4000
- .word 0xe24dd04c
- .word 0xe1a09407
- .word 0xe389901f
- .word 0xe58d9000
- .word 0xe10f9000
- .word 0xe3899080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe3c7981f
- .word 0xe3c9901f
- .word 0xee209110
- .word 0xe28d9040
- .word 0xed09020f
- .word 0xed09c203
- .word 0xe31b0601
- .word 0xe8890007
- .word 0x0d998200
- .word 0x1d999200
- .word 0xe8890038
- .word 0x0d999200
- .word 0x1d998200
- .word 0xe3100101
- .word 0x03130101
- .word 0x1a000096
- .word 0xeee8a101
- .word 0xeef8a102
- .word 0xee91f112
- .word 0x1a000044
- .word 0xe31b0601
- .word 0x01a08fa0
- .word 0x11a08fa3
- .word 0xe3180001
- .word 0x1e19210e
- .word 0x1ee8b102
- .word 0x1ef8b103
- .word 0x1e92f113
- .word 0x03a08000
- .word 0xee91f118
- .word 0xca000002
- .word 0x0a000069
- .word 0xee90f118
- .word 0x0a000026
- .word 0xee90f118
- .word 0xbe188100
- .word 0x0a000015
- .word 0xee90f119
- .word 0x0a000006
- .word 0xe1a04008
- .word 0xe28f9fbd
- .word 0xedd92100
- .word 0xee92f111
- .word 0xceb2f111
- .word 0xcafffe58
- .word 0xea000032
- .word 0xe28d9040
- .word 0xed19020f
- .word 0xed19c203
- .word 0xe28dd04c
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe28f0e2a
- .word 0xe890000f
- .word 0xe1800f88
- .word 0xe3a06000
- .word 0xe8bd8000
- .word 0xe28d9040
- .word 0xed19020f
- .word 0xed19c203
- .word 0xe28dd04c
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe1a00f88
- .word 0xe3a01000
- .word 0xe3a02000
- .word 0xe3a03000
- .word 0xe3a06000
- .word 0xe8bd8000
- .word 0xe28d9040
- .word 0xed19020f
- .word 0xed19c203
- .word 0xe28dd04c
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe3170802
- .word 0x1afff793
- .word 0xe3877002
- .word 0xe24f0b02
- .word 0xe2400fad
- .word 0xe8900007
- .word 0xe1800f88
- .word 0xe8bd8000
- .word 0xee90f118
- .word 0xb3a08019
- .word 0xba000107
- .word 0x0a000038
- .word 0xee90f119
- .word 0x1e91f118
- .word 0x0a000021
- .word 0xe3a04000
- .word 0xee688100
- .word 0xee180101
- .word 0xe28d8040
- .word 0xed888200
- .word 0xe5985000
- .word 0xee309110
- .word 0xe3190004
- .word 0x1affff67
- .word 0xee90f118
- .word 0x0a000010
- .word 0xe24f8b02
- .word 0xe2488e31
- .word 0xedd81100
- .word 0xee90f111
- .word 0x1eb0f111
- .word 0x1affff28
- .word 0xe28d9040
- .word 0xed19020f
- .word 0xed19c203
- .word 0xe28dd04c
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe8bd4000
- .word 0xe1a00005
- .word 0xeaffff70
- .word 0xe3150102
- .word 0x0e088109
- .word 0x03a06101
- .word 0x1ddf0163
- .word 0x13a06103
- .word 0xeaffff3a
- .word 0xe24f8b02
- .word 0xe2488fdb
- .word 0xedd82100
- .word 0xee90f112
- .word 0x1e91f112
- .word 0x1eb1f112
- .word 0x03a0801b
- .word 0x0a0000d9
- .word 0xe28d9040
- .word 0xed19020f
- .word 0xed19c203
- .word 0xe28dd04c
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe28f0e13
- .word 0xe890000f
- .word 0xe3a06000
- .word 0xe8bd8000
- .word 0xee91f118
- .word 0xd3a0801a
- .word 0xda0000ca
- .word 0xe28d9040
- .word 0xed898200
- .word 0xe8990007
- .word 0xed19020f
- .word 0xed19c203
- .word 0xe28dd04c
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe2000102
- .word 0xe3a03000
- .word 0xe3a06000
- .word 0xe8bd8000
- .word 0xe1a09883
- .word 0xe3790802
- .word 0x30099004
- .word 0xe0199083
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0x4a000010
- .word 0xe3190102
- .word 0x0affff5d
- .word 0xe1958084
- .word 0x1a000002
- .word 0xe31b0601
- .word 0x0affffa2
- .word 0xeaffff58
- .word 0xe28d9040
- .word 0xed19020f
- .word 0xed19c203
- .word 0xe28dd04c
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe8bd4000
- .word 0xeafff616
- .word 0xe3190102
- .word 0x0a00000d
- .word 0xe1828081
- .word 0xe1888005
- .word 0xe1988084
- .word 0x0affff91
- .word 0xe28d9040
- .word 0xed19020f
- .word 0xed19c203
- .word 0xe28dd04c
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe8bd4000
- .word 0xeafff5fe
- .word 0xe1928081
- .word 0x1a000002
- .word 0xe31b0601
- .word 0x1affff83
- .word 0xeaffff39
- .word 0xe28d9040
- .word 0xed19020f
- .word 0xed19c203
- .word 0xe28dd04c
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe8bd4000
- .word 0xeafff60d
- .word 0x00000000
- .word 0x80000000
- .word 0x00000000
- .word 0x00003fff
- .word 0x00003ffe
- .word 0xffffffff
- .word 0xffffffff
- .word 0x0000400f
- .word 0x80000000
- .word 0x00000000
- .word 0x00003ffd
- .word 0xa2f9836e
- .word 0x4e44152a
- .word 0x00004000
- .word 0xc9100000
- .word 0x00000000
- .word 0x80003fee
- .word 0x95777a5c
- .word 0xf72cece6
- .word 0x00003fce
- .word 0xc407fb4c
- .word 0x9efca5fe
- .word 0x80003fd6
- .word 0xd72106e0
- .word 0x424cdf56
- .word 0x00003fde
- .word 0xb091e343
- .word 0x56a17fa8
- .word 0x80003fe5
- .word 0xd7322a5a
- .word 0xee055b44
- .word 0x00003fec
- .word 0xb8ef1d29
- .word 0x27831824
- .word 0x80003ff2
- .word 0xd00d00d0
- .word 0x09f0d114
- .word 0x00003ff8
- .word 0x88888888
- .word 0x88858061
- .word 0x80003ffc
- .word 0xaaaaaaaa
- .word 0xaaaaa603
- .word 0xe3100101
- .word 0x1a00004d
- .word 0xe1916002
- .word 0x0a000043
- .word 0xe92d4000
- .word 0xe24dd04c
- .word 0xe1a09407
- .word 0xe389901f
- .word 0xe58d9000
- .word 0xe10f9000
- .word 0xe3899080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe3c7981f
- .word 0xe3c9901f
- .word 0xee209110
- .word 0xe28d9040
- .word 0xed09020f
- .word 0xed09c203
- .word 0xe8890007
- .word 0xed998200
- .word 0xee90f118
- .word 0xe0a44004
- .word 0xbe188100
- .word 0xe31b0601
- .word 0x1ddf1172
- .word 0x1e080101
- .word 0x13a04001
- .word 0xe24f80fc
- .word 0xe1a0900f
- .word 0xeafffd3d
- .word 0x13a08010
- .word 0x1a000037
- .word 0xe0244006
- .word 0xee90f118
- .word 0xbe188100
- .word 0xa2244001
- .word 0xeddf1169
- .word 0xee90f111
- .word 0xba00001b
- .word 0xee181100
- .word 0xe24f8f43
- .word 0xe3a06008
- .word 0xe1a0900f
- .word 0xeafffd3a
- .word 0xee1a1140
- .word 0xee091140
- .word 0xe3a06101
- .word 0xe31b00e0
- .word 0x1a000004
- .word 0xe31b0702
- .word 0x1e1a2100
- .word 0x1e0a0100
- .word 0x1e90f111
- .word 0x13a06103
- .word 0xe28d9040
- .word 0xed899200
- .word 0xe8990007
- .word 0xed19020f
- .word 0xed19c203
- .word 0xe28dd04c
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe1a03000
- .word 0xe1a00f84
- .word 0xe8bd8000
- .word 0xed5f116d
- .word 0xee181161
- .word 0xe3a06103
- .word 0xeaffffee
- .word 0xe31b0601
- .word 0x1a000002
- .word 0xe2000102
- .word 0xe3a03000
- .word 0xe1a0f00e
- .word 0xe24f0f7a
- .word 0xe890000f
- .word 0xe1a0f00e
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0x5affffac
- .word 0xe1928081
- .word 0x1afff586
- .word 0xe3a08011
- .word 0xeafff5af
- .word 0xe28d9040
- .word 0xed19020f
- .word 0xed19c203
- .word 0xe28dd04c
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe8bd4000
- .word 0xeafff5a5
- .word 0x80003ffe
- .word 0xb25dedaf
- .word 0x30f3242c
- .word 0x00004002
- .word 0xa270bb27
- .word 0x61c93957
- .word 0x80004004
- .word 0x9ec1654d
- .word 0x36d4f820
- .word 0x00004004
- .word 0xe4d539b0
- .word 0x56a451ad
- .word 0x80004003
- .word 0xdaf2ad41
- .word 0xd05311c4
- .word 0x80004003
- .word 0xbe974377
- .word 0xcc30f9e6
- .word 0x00004006
- .word 0x96f3e4b2
- .word 0xc8e37cbc
- .word 0x80004007
- .word 0xbeee77e2
- .word 0xb5423cf3
- .word 0x00004007
- .word 0xd0927880
- .word 0xf5c2170b
- .word 0x80004006
- .word 0xa43601f1
- .word 0x5c3e6196
- .word 0x00003fff
- .word 0xc90fdaa2
- .word 0x2168c234
- .word 0x00003fbf
- .word 0xc4c68000
- .word 0x00000000
- .word 0x00004000
- .word 0xc90fdaa2
- .word 0x2168c234
- .word 0x00003fc0
- .word 0xc4c68000
- .word 0x00000000
- .word 0x00003fff
- .word 0xc90fdaa2
- .word 0x2168c235
- .word 0x00003fdf
- .word 0x80000000
- .word 0x00000000
- .word 0xe3100101
- .word 0x1a000075
- .word 0xe31b0501
- .word 0x01916002
- .word 0x0a00006f
- .word 0xe92d4000
- .word 0xe24dd04c
- .word 0xe1a09407
- .word 0xe389901f
- .word 0xe58d9000
- .word 0xe10f9000
- .word 0xe3899080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe3c7981f
- .word 0xe3c9901f
- .word 0xee209110
- .word 0xe28d9040
- .word 0xed09020f
- .word 0xed09c203
- .word 0xe8890007
- .word 0xed998200
- .word 0xee90f118
- .word 0xe0a44004
- .word 0xbe188100
- .word 0xee90f11e
- .word 0xba000044
- .word 0xee90f119
- .word 0xba000004
- .word 0xc3a08014
- .word 0xcaffffa6
- .word 0xe31b0501
- .word 0x13140001
- .word 0x1a00004f
- .word 0xe3a0520d
- .word 0xe3140001
- .word 0x13a05103
- .word 0xe31b0501
- .word 0x13a0520e
- .word 0x13140001
- .word 0x13a05000
- .word 0xee381109
- .word 0xee19110e
- .word 0xee488101
- .word 0xee080100
- .word 0xe24f8f5f
- .word 0xe3a06005
- .word 0xe1a0900f
- .word 0xeafffca3
- .word 0xe24f8e15
- .word 0xe3a06005
- .word 0xe1a0900f
- .word 0xeafffca8
- .word 0xee4a2104
- .word 0xe3150102
- .word 0x1e188100
- .word 0xee1a1100
- .word 0xee091100
- .word 0xe1b04105
- .word 0x2a000006
- .word 0xee1a2160
- .word 0xee0a0160
- .word 0xee91f110
- .word 0x03a06101
- .word 0x13a06103
- .word 0x1e089100
- .word 0xea00000d
- .word 0x5d5f2257
- .word 0x4d5f2252
- .word 0xee090102
- .word 0xee282102
- .word 0xee2a2101
- .word 0xee0a2103
- .word 0xee081162
- .word 0xe3a06101
- .word 0xe31b00e0
- .word 0x1a000003
- .word 0xe31b0702
- .word 0x1e080102
- .word 0x1e90f111
- .word 0x13a06103
- .word 0xe3150201
- .word 0x1e189101
- .word 0xe28d9040
- .word 0xed899200
- .word 0xe8990007
- .word 0xed19020f
- .word 0xed19c203
- .word 0xe28dd04c
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe3c03103
- .word 0xe2000102
- .word 0xe8bd8000
- .word 0xe3a05201
- .word 0xe3140001
- .word 0x13a05000
- .word 0xe31b0501
- .word 0x13a05101
- .word 0x13140001
- .word 0x13a05103
- .word 0xed5f116c
- .word 0xee90f111
- .word 0xae181100
- .word 0xaaffffc1
- .word 0xe3150102
- .word 0x1e188100
- .word 0xee089100
- .word 0xe1b04105
- .word 0x2affffd2
- .word 0xe3a06101
- .word 0xeaffffde
- .word 0xee089108
- .word 0xe3a06000
- .word 0xeaffffdd
- .word 0xe2000102
- .word 0xe3a03000
- .word 0xe1a0f00e
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0x5affff84
- .word 0xe1928081
- .word 0x1afff4cb
- .word 0xe3a08015
- .word 0xeafff4f4
- .word 0x00003ffe
- .word 0xa2f9836e
- .word 0x4e44152a
- .word 0x00003fff
- .word 0xc9100000
- .word 0x00000000
- .word 0x80003fed
- .word 0x95777a5c
- .word 0xf72cece6
- .word 0x80003fef
- .word 0x95d5b975
- .word 0x16391da8
- .word 0x00003ff6
- .word 0xe0741531
- .word 0xdd56f650
- .word 0x80003ffc
- .word 0x8895af2a
- .word 0x6847fcd5
- .word 0x00003fea
- .word 0x85bba783
- .word 0xb3c748a9
- .word 0x80003ff3
- .word 0xa37b24c8
- .word 0x4a42092e
- .word 0x00003ff9
- .word 0xd23cf50b
- .word 0xf10aca84
- .word 0x80003ffd
- .word 0xeef5823f
- .word 0xdecea969
- .word 0x00000000
- .word 0x80000000
- .word 0x00000000
- .word 0x00003ffe
- .word 0xffffffff
- .word 0xffffffff
- .word 0x00005fff
- .word 0x80000000
- .word 0x00000000
- .word 0xe3100101
- .word 0x1a00005c
- .word 0xe1916002
- .word 0x0a000057
- .word 0xe92d4000
- .word 0xe24dd04c
- .word 0xe1a09407
- .word 0xe389901f
- .word 0xe58d9000
- .word 0xe10f9000
- .word 0xe3899080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe3c7981f
- .word 0xe3c9901f
- .word 0xee209110
- .word 0xe28d9040
- .word 0xed09020f
- .word 0xed09c203
- .word 0xe8890007
- .word 0xed998200
- .word 0xe24f80f8
- .word 0xe1a0900f
- .word 0xeafffc09
- .word 0x13a08012
- .word 0x1affff03
- .word 0xe1a04006
- .word 0xeddf1163
- .word 0xee28a100
- .word 0xee92f111
- .word 0xba000028
- .word 0xee181100
- .word 0xe24f8c01
- .word 0xe3a06003
- .word 0xe1a0900f
- .word 0xeafffc08
- .word 0xee0a2109
- .word 0xee184102
- .word 0xe24f80f4
- .word 0xe3a06004
- .word 0xe1a0900f
- .word 0xeafffc02
- .word 0xee0a2109
- .word 0xe3140001
- .word 0x0e4c0142
- .word 0x1e18c104
- .word 0x1e4a0144
- .word 0xe3a06101
- .word 0xe31b00e0
- .word 0x1a000006
- .word 0xe31b0702
- .word 0x0a000004
- .word 0xe3140001
- .word 0x0e4c1102
- .word 0x1e4a1104
- .word 0xee90f111
- .word 0x13a06103
- .word 0xe3a04000
- .word 0xe28d9040
- .word 0xed898200
- .word 0xe8990007
- .word 0xed19020f
- .word 0xed19c203
- .word 0xe28dd04c
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe3c03103
- .word 0xe0833004
- .word 0xe2000102
- .word 0xe8bd8000
- .word 0xed5fa253
- .word 0xee289100
- .word 0xe3140001
- .word 0x1a000006
- .word 0xe3a06101
- .word 0xee91f112
- .word 0xaaffffe9
- .word 0xee180104
- .word 0xe3a04a02
- .word 0xe2644000
- .word 0xeaffffe6
- .word 0xe3a06103
- .word 0xee91f112
- .word 0xbe180104
- .word 0xee188100
- .word 0xee580109
- .word 0xee180163
- .word 0xaaffffde
- .word 0xe3a04a02
- .word 0xeaffffdd
- .word 0xe2000102
- .word 0xe3a03000
- .word 0xe1a0f00e
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0x5affff9d
- .word 0xe1928081
- .word 0x1afff43c
- .word 0xe3a08013
- .word 0xeafff465
- .word 0x80003ffe
- .word 0xd66bd6cd
- .word 0x8c3de934
- .word 0x80004002
- .word 0x87e9fae4
- .word 0x6b531a29
- .word 0x80004003
- .word 0xa40bfdcf
- .word 0x15e65691
- .word 0x80004002
- .word 0xdb053288
- .word 0x30e70eb4
- .word 0x00004002
- .word 0xf0624f0a
- .word 0x56388310
- .word 0x00004004
- .word 0xee505190
- .word 0x6d1eb4e8
- .word 0x00004005
- .word 0xac509020
- .word 0x5b6d243b
- .word 0x00004004
- .word 0xa443e5e6
- .word 0x24ad4b90
- .word 0x00003fdf
- .word 0x80000000
- .word 0x00000000
- .word 0x00003ffe
- .word 0xffffffff
- .word 0xffffffff
- .word 0x00003ffd
- .word 0x8930a2f4
- .word 0xf66ab18a
- .word 0x00003ffe
- .word 0x860a91c1
- .word 0x6b9b2c23
- .word 0x00003fbc
- .word 0xb766aaaa
- .word 0xaaaaaaab
- .word 0x00003fff
- .word 0x860a91c1
- .word 0x6b9b2c23
- .word 0x00003fbd
- .word 0xb766aaaa
- .word 0xaaaaaaab
- .word 0x00003fff
- .word 0xc90fdaa2
- .word 0x2168c234
- .word 0x00003fbf
- .word 0xc4c68000
- .word 0x00000000
- .word 0x00003fff
- .word 0xc90fdaa2
- .word 0x2168c234
- .word 0x00003fbf
- .word 0xc4c68000
- .word 0x00000000
- .word 0x00004000
- .word 0x860a91c1
- .word 0x6b9b2c23
- .word 0x00003fbe
- .word 0xb766aaaa
- .word 0xaaaaaaab
- .word 0x00004000
- .word 0xa78d3631
- .word 0xc681f72b
- .word 0x00003fc0
- .word 0xd6ecd555
- .word 0x55555555
- .word 0x00004000
- .word 0xc90fdaa2
- .word 0x2168c234
- .word 0x00003fc0
- .word 0xc4c68000
- .word 0x00000000
- .word 0xe3100101
- .word 0x03130101
- .word 0x1a00008b
- .word 0xe1946005
- .word 0x1a000005
- .word 0xe1918002
- .word 0x03a08016
- .word 0x0afff474
- .word 0xe3100102
- .word 0x01a00003
- .word 0x0a00007e
- .word 0xe2036102
- .word 0xe3100102
- .word 0x12266007
- .word 0xe3c00102
- .word 0xe3c33102
- .word 0xe92d4000
- .word 0xe24dd058
- .word 0xe1a09407
- .word 0xe389901f
- .word 0xe58d9000
- .word 0xe10f9000
- .word 0xe3899080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe3c7981f
- .word 0xe3c9901f
- .word 0xee209110
- .word 0xe28d9040
- .word 0xed09020f
- .word 0xed09c203
- .word 0xe889003f
- .word 0xedd90200
- .word 0xe1a05006
- .word 0xee490100
- .word 0xea000016
- .word 0xe3100101
- .word 0x1a000083
- .word 0xe1916002
- .word 0x0a000061
- .word 0xe2005102
- .word 0xe3c00102
- .word 0xe92d4000
- .word 0xe24dd058
- .word 0xe1a09407
- .word 0xe389901f
- .word 0xe58d9000
- .word 0xe10f9000
- .word 0xe3899080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe3c7981f
- .word 0xe3c9901f
- .word 0xee209110
- .word 0xe28d9040
- .word 0xed09020f
- .word 0xed09c203
- .word 0xe8890007
- .word 0xed998200
- .word 0xee90f119
- .word 0xce580109
- .word 0xc2255003
- .word 0xed5f116d
- .word 0xee90f111
- .word 0xda000007
- .word 0xee393109
- .word 0xee182103
- .word 0xee2a2109
- .word 0xee0a2100
- .word 0xee39110a
- .word 0xee091100
- .word 0xee4a0101
- .word 0xe2255001
- .word 0xed5f217e
- .word 0xee289100
- .word 0xeed1f112
- .word 0xba000035
- .word 0xee181100
- .word 0xe24f8f9b
- .word 0xe3a06004
- .word 0xe1a0900f
- .word 0xeafffb27
- .word 0xe24f8f93
- .word 0xe3a06004
- .word 0xe1a0900f
- .word 0xeafffb2c
- .word 0xee4a2104
- .word 0xee1a1100
- .word 0xee091100
- .word 0xe3150002
- .word 0x1e189101
- .word 0xe3150007
- .word 0x1a000006
- .word 0xee1a2160
- .word 0xee0a0160
- .word 0xee91f110
- .word 0x03a06101
- .word 0x13a06103
- .word 0x1e089100
- .word 0xea00000f
- .word 0xe24f8f96
- .word 0xe0859085
- .word 0xe0888189
- .word 0xedd82200
- .word 0xee090102
- .word 0xee282102
- .word 0xee2a2101
- .word 0xee0a2103
- .word 0xee081162
- .word 0xe3a06101
- .word 0xe31b00e0
- .word 0x1a000003
- .word 0xe31b0702
- .word 0x1e080102
- .word 0x1e90f111
- .word 0x13a06103
- .word 0xe3150102
- .word 0x1e189101
- .word 0xe28d9040
- .word 0xed899200
- .word 0xe8990007
- .word 0xed19020f
- .word 0xed19c203
- .word 0xe28dd058
- .word 0xe10f9000
- .word 0xe3c99080
- .word 0xe129f009
- .word 0xe1a00000
- .word 0xe3c03103
- .word 0xe2000102
- .word 0xe8bd8000
- .word 0xe3150007
- .word 0x1e089100
- .word 0x1affffd2
- .word 0xed5f11b8
- .word 0xee191160
- .word 0xe3a06103
- .word 0xeaffffe9
- .word 0xe3a01000
- .word 0xe3a02000
- .word 0xe2000102
- .word 0xe3a03000
- .word 0xe1a0f00e
- .word 0xe1a09883
- .word 0xe3790802
- .word 0x30099004
- .word 0xe0199083
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0x4a000005
- .word 0xe3190102
- .word 0x0affff68
- .word 0xe1958084
- .word 0x1afff342
- .word 0xe3a04102
- .word 0xeaffff64
- .word 0xe3190102
- .word 0x0a000005
- .word 0xe1828081
- .word 0xe1888005
- .word 0xe1988084
- .word 0x1afff332
- .word 0xe3a08017
- .word 0xeafff3d6
- .word 0xe1928081
- .word 0x1afff34c
- .word 0xe3a01102
- .word 0xeaffff58
- .word 0xe1a08880
- .word 0xe3780802
- .word 0x30088001
- .word 0xe0188080
- .word 0x5affff76
- .word 0xe1928081
- .word 0x1afff33e
- .word 0xe3a01102
- .word 0xeaffff72
- .word 0x00000000
- .word 0x00000000
- .word 0x00000000
- .word 0x00000000
- .word 0x00000000
- .word 0x00000000
- .word 0xe59a2080
- .word 0xe3320000
- .word 0x5a00002b
- .word 0xe92d4000
- .word 0xeb00017d
- .word 0xe8bd0004
- .word 0xe8bd4000
- .word 0xe5922000
- .word 0xe132000a
- .word 0x0e502110
- .word 0xe59a2084
- .word 0xe3c22b01
- .word 0xe58a2084
- .word 0xe24f2b1b
- .word 0xe2422f2a
- .word 0xe24f3d01
- .word 0xe2433f05
- .word 0xe1510002
- .word 0xa1530001
- .word 0xb1a0f00e
- .word 0xe590103c
- .word 0xe1510002
- .word 0xa1530001
- .word 0xb1a0f00e
- .word 0xe2804044
- .word 0xe5145004
- .word 0xe3150001
- .word 0x1cb48203
- .word 0xe3150002
- .word 0x1cb49203
- .word 0xe3150004
- .word 0x1cb4a203
- .word 0xe3150008
- .word 0x1cb4b203
- .word 0xe3150010
- .word 0x1cb4c203
- .word 0xe3150020
- .word 0x1cb4d203
- .word 0xe3150040
- .word 0x1cb4e203
- .word 0xe3150080
- .word 0x1cb4f203
- .word 0xe1a052a5
- .word 0xe3855481
- .word 0xee205110
- .word 0xe5900030
- .word 0xeaffffe4
- .word 0xe24f2a06
- .word 0xe2422ed3
- .word 0xe24f3d03
- .word 0xe2433f07
- .word 0xe1510002
- .word 0xa1530001
- .word 0xb1a0f00e
- .word 0xe590103c
- .word 0xe1510002
- .word 0xa1530001
- .word 0xb1a0f00e
- .word 0xe28a3000
- .word 0xe2804044
- .word 0xe5145004
- .word 0xe3150001
- .word 0x18b400c2
- .word 0x188300c2
- .word 0xe2833010
- .word 0xe3150002
- .word 0x18b400c2
- .word 0x188300c2
- .word 0xe2833010
- .word 0xe3150004
- .word 0x18b400c2
- .word 0x188300c2
- .word 0xe2833010
- .word 0xe3150008
- .word 0x18b400c2
- .word 0x188300c2
- .word 0xe2833010
- .word 0xe3150010
- .word 0x18b400c2
- .word 0x188300c2
- .word 0xe2833010
- .word 0xe3150020
- .word 0x18b400c2
- .word 0x188300c2
- .word 0xe2833010
- .word 0xe3150040
- .word 0x18b400c2
- .word 0x188300c2
- .word 0xe2833010
- .word 0xe3150080
- .word 0x18b400c2
- .word 0x188300c2
- .word 0xe24f3c01
- .word 0xe2433f22
- .word 0xe1a052a5
- .word 0xe3855401
- .word 0xe58a5080
- .word 0xe5900030
- .word 0xeaffffd2
- .word 0xe3e00000
- .word 0xe1b0f00e
- .word 0xe92d401e
- .word 0xe58a1004
- .word 0xe3a0e000
- .word 0xe58ae000
- .word 0xe10f3000
- .word 0xe3830080
- .word 0xe129f000
- .word 0xe24f102c
- .word 0xeb00011c
- .word 0xe3a00000
- .word 0xee504110
- .word 0xe3300000
- .word 0x158a0008
- .word 0x1a000008
- .word 0xe3a02102
- .word 0xee302110
- .word 0xe1a00c22
- .word 0xe58a0008
- .word 0xe3300081
- .word 0x03a04c0d
- .word 0x0e008109
- .word 0x0e100100
- .word 0xee404110
- .word 0xeb000112
- .word 0xe129f003
- .word 0xe8bd801e
- .word 0xe92d400f
- .word 0xe3a00000
- .word 0xe58a0084
- .word 0xe92d4000
- .word 0xeb0000fe
- .word 0xe8bd0001
- .word 0xe8bd4000
- .word 0xe5900008
- .word 0xe3300081
- .word 0x1a00000d
- .word 0xe24f0f8e
- .word 0xe890000e
- .word 0xe28a0000
- .word 0xe8a0000e
- .word 0xe8a0000e
- .word 0xe8a0000e
- .word 0xe8a0000e
- .word 0xe8a0000e
- .word 0xe8a0000e
- .word 0xe8a0000e
- .word 0xe8a0000e
- .word 0xe59f003c
- .word 0xe58a0080
- .word 0xe8bd800f
- .word 0xe24f0e27
- .word 0xe890000e
- .word 0xe28a0000
- .word 0xe8a0001e
- .word 0xe8a0001e
- .word 0xe8a0001e
- .word 0xe8a0001e
- .word 0xe8a0001e
- .word 0xe8a0001e
- .word 0xe8a0001e
- .word 0xe8a0001e
- .word 0xe59f0008
- .word 0xe58a0080
- .word 0xe8bd800f
- .word 0x81070000
- .word 0x01070000
- .word 0xe92d4007
- .word 0xe28fe074
- .word 0xe92d4000
- .word 0xeb0000d7
- .word 0xe8bd0001
- .word 0xe8bd4000
- .word 0xe5900000
- .word 0xe3300000
- .word 0x01a0f00e
- .word 0xe5901080
- .word 0xe3310000
- .word 0x5a00000e
- .word 0xe92d4002
- .word 0xee501110
- .word 0xe3110c01
- .word 0x01a0e001
- .word 0x1590e084
- .word 0xe3ceec0d
- .word 0xe3110b01
- .word 0x138eec05
- .word 0xe580e084
- .word 0xee301110
- .word 0xe5801080
- .word 0xed800200
- .word 0xed80420c
- .word 0xee40e110
- .word 0xe8bd8002
- .word 0xe92d4000
- .word 0xe3a0e000
- .word 0xe580e084
- .word 0xe8bd8000
- .word 0xe92d4007
- .word 0xe92d4000
- .word 0xeb0000b9
- .word 0xe8bd0001
- .word 0xe8bd4000
- .word 0xe580a000
- .word 0xe5900008
- .word 0xe3300081
- .word 0x0e501110
- .word 0xe33a0000
- .word 0x0a000014
- .word 0xe3300081
- .word 0x1a00000b
- .word 0xe59a1080
- .word 0xee201110
- .word 0xed9a0200
- .word 0xed9a420c
- .word 0xe24f1a06
- .word 0xe2411efd
- .word 0xeb0000b0
- .word 0xe59a1084
- .word 0xe3110b01
- .word 0x13a01c05
- .word 0x1e401110
- .word 0xe8bd8007
- .word 0xe3300081
- .word 0x03a01c0d
- .word 0x0e401110
- .word 0xe24f1b19
- .word 0xe2411f1e
- .word 0xeb0000a5
- .word 0xe8bd8007
- .word 0xe3300081
- .word 0x03a01c0d
- .word 0x0e401110
- .word 0xe8bd4007
- .word 0xea0000a4
- .word 0xe92d4400
- .word 0xe3a0a000
- .word 0xebffffd7
- .word 0xe8bd8400
- .word 0xe92d4000
- .word 0xeb000091
- .word 0xe8bd0001
- .word 0xe8bd4000
- .word 0xe5900000
- .word 0xe3300000
- .word 0x01a0f00e
- .word 0xe5901080
- .word 0xe3310000
- .word 0x5a000007
- .word 0xee501110
- .word 0xe3110c01
- .word 0x01a02001
- .word 0x15902084
- .word 0xe3822c09
- .word 0xe5802084
- .word 0xee402110
- .word 0xe1a0f00e
- .word 0xe3a01001
- .word 0xe5801084
- .word 0xe1a0f00e
- .word 0xe92d4000
- .word 0xeb00007c
- .word 0xe8bd0001
- .word 0xe8bd4000
- .word 0xe5900000
- .word 0xe3300000
- .word 0x01a0f00e
- .word 0xe5901080
- .word 0xe3310000
- .word 0x5a00000e
- .word 0xee501110
- .word 0xe3110b01
- .word 0x01a0f00e
- .word 0xe3110c01
- .word 0x01a02001
- .word 0x15902084
- .word 0xe3822c01
- .word 0xe3c22b02
- .word 0xe5802084
- .word 0xee301110
- .word 0xe5801080
- .word 0xed800200
- .word 0xed80420c
- .word 0xee402110
- .word 0xe1a0f00e
- .word 0xe3a01000
- .word 0xe5801084
- .word 0xe1a0f00e
- .word 0xe92d40fe
- .word 0xe59a2080
- .word 0xe3320000
- .word 0x5a000010
- .word 0xe3a0700c
- .word 0xe92d4000
- .word 0xeb00005b
- .word 0xe8bd0004
- .word 0xe8bd4000
- .word 0xe5922000
- .word 0xe132000a
- .word 0x159a6084
- .word 0x1a000005
- .word 0xee506110
- .word 0xee302110
- .word 0xe58a2080
- .word 0xed8a0200
- .word 0xed8a420c
- .word 0xee406110
- .word 0xe2066b01
- .word 0xea000001
- .word 0xe3a07010
- .word 0xe3a06000
- .word 0xe59a2080
- .word 0xe4802004
- .word 0xe3a02008
- .word 0xe89a0038
- .word 0xe08aa007
- .word 0xe3130101
- .word 0x0a000009
- .word 0xe3c33101
- .word 0xe3140102
- .word 0x0a000008
- .word 0xe3c44102
- .word 0xe3130901
- .word 0x02833001
- .word 0x0a000004
- .word 0xe38330ff
- .word 0xe3833c7f
- .word 0xea000006
- .word 0xe3140102
- .word 0x1a000004
- .word 0xe92d0340
- .word 0xe1a06883
- .word 0xe2968802
- .word 0x1bfff338
- .word 0xe8bd0340
- .word 0xe8a00038
- .word 0xe2522001
- .word 0x1affffe7
- .word 0xe24f2a07
- .word 0xe2422f6f
- .word 0xe24f3b01
- .word 0xe2433f5a
- .word 0xe1510002
- .word 0xa1530001
- .word 0xa3a00001
- .word 0xb1a00006
- .word 0xe8bd80fe
- .word 0xe92d40ff
- .word 0xe59a1080
- .word 0xe3310000
- .word 0x53a07010
- .word 0x43a0700c
- .word 0xe4902004
- .word 0xe3c224ff
- .word 0x53822401
- .word 0x43822481
- .word 0xe58a2080
- .word 0xe3a02008
- .word 0xe8b00038
- .word 0xe1846005
- .word 0xe1966083
- .word 0x0a000003
- .word 0xe1a06883
- .word 0xe2966802
- .word 0x13140102
- .word 0x03833101
- .word 0xe88a0038
- .word 0xe08aa007
- .word 0xe2522001
- .word 0x1afffff3
- .word 0xe04aa187
- .word 0xe3310000
- .word 0x58bd80ff
- .word 0xe92d4000
- .word 0xeb00000b
- .word 0xe8bd0004
- .word 0xe8bd4000
- .word 0xe5922000
- .word 0xe132000a
- .word 0x18bd80ff
- .word 0xee506110
- .word 0xe59a2080
- .word 0xee202110
- .word 0xed9a0200
- .word 0xed9a420c
- .word 0xee406110
- .word 0xe8bd80ff
- .word 0xe24dd008
- .word 0xe58d0000
- .word 0xe59f0008
- .word 0xe58d0004
- .word 0xe49d0004
- .word 0xe1a0f00e
- .word 0x00000000
- .word 0x00000000
- .word 0xe92d4003
- .word 0xe59f0004
- .word 0xe5801000
- .word 0xe8bd8003
- .word 0x00000000
- .word 0xe92d4007
- .word 0xe51f0010
- .word 0xe59f1004
- .word 0xe5801000
- .word 0xe8bd8007
- .word 0x00000000
- .word 0xe1a0d00c
- .word 0xe8dd7fff
- .word 0xe0000000
- .word 0xe28dd03c
- .word 0xe8bd8000
- .word 0xe3a00000
- .word 0xea000009
- .word 0xe3a00001
- .word 0xea000007
- .word 0xe3a00002
- .word 0xea000005
- .word 0xe3a00003
- .word 0xea000003
- .word 0xe3a00004
- .word 0xea000001
- .word 0xe3e00000
- .word 0xeaffffff
- .word 0xe59f1000
- .word 0xe1a0f001
- .word 0x00000000
- .word 0xe3a00005
- .word 0xeafffffa
- .word 0xe1a00000
- .word 0xe59f1030
- .word 0xe24fb010
- .word 0xe05b1001
- .word 0x01a0f00e
- .word 0xe59fb024
- .word 0xe08bb001
- .word 0xe28f2020
- .word 0xe4920004
- .word 0xe3700001
- .word 0xd1a0f00e
- .word 0xe79b3000
- .word 0xe0833001
- .word 0xe78b3000
- .word 0xeafffff8
- .word 0x0000f370
- .word 0x00008000
- .word 0x000073ac
- .word 0x000073b0
- .word 0xffffffff
-
diff --git a/sys/arch/arm32/fpe-arm/armfpe_glue.S b/sys/arch/arm32/fpe-arm/armfpe_glue.S
deleted file mode 100644
index bd824f701b5..00000000000
--- a/sys/arch/arm32/fpe-arm/armfpe_glue.S
+++ /dev/null
@@ -1,411 +0,0 @@
-/* $NetBSD: armfpe_glue.S,v 1.6 1996/03/18 19:54:59 mark Exp $ */
-
-/*
- * Copyright (c) 1996 Mark Brinicombe
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * arm_fpe_glue.S
- *
- * Glue code for calling the ARM FPE core code
- *
- * Created : 21/12/95
- */
-
-#include "assym.h"
-#include <machine/cpu.h>
-
-sp .req r13
-lr .req r14
-pc .req r15
-
-/* Offsets into fpe core for function addresses */
-
-#define ARM_FPE_CORE_ABORT 0
-#define ARM_FPE_CORE_INITWS 4
-#define ARM_FPE_CORE_INITCONTEXT 8
-#define ARM_FPE_CORE_CHANGECONTEXT 12
-#define ARM_FPE_CORE_SHUTDOWN 16
-#define ARM_FPE_CORE_ACTIVATECONTEXT 20
-#define ARM_FPE_CORE_DEACTIVATECONTEXT 24
-#define ARM_FPE_CORE_SAVECONTEXT 28
-#define ARM_FPE_CORE_LOADCONTEXT 32
-#define ARM_FPE_CORE_DISABLE 36
-#define ARM_FPE_CORE_ENABLE 40
-
-/*
- * Ok Lots of little stubs for calling the fpe core
- * routines from C
- */
-
- .text
- .align
-
-arm_fpe_header:
- .word _arm_fpe_mod
-
- .global _arm_fpe_core_disable
-_arm_fpe_core_disable:
- stmfd sp!, {r0-r7, lr}
- ldr r0, [pc, #arm_fpe_header - . - 8]
- ldr r0, [r0, #ARM_FPE_CORE_DISABLE]
-
- add lr, pc, #L1 - . - 8
- mov pc, r0
-L1:
- ldmfd sp!, {r0-r7, pc}
-
-
- .global _arm_fpe_core_enable
-_arm_fpe_core_enable:
- stmfd sp!, {r0-r7, lr}
- ldr r0, [pc, #arm_fpe_header - . - 8]
- ldr r0, [r0, #ARM_FPE_CORE_ENABLE]
-
- add lr, pc, #L2 - . - 8
- mov pc, r0
-L2:
- ldmfd sp!, {r0-r7, pc}
-
-
- .global _arm_fpe_core_initws
-_arm_fpe_core_initws:
- stmfd sp!, {r10, lr}
- mov r10, r0
- ldr r3, [pc, #arm_fpe_header - . - 8]
- ldr r3, [r3, #ARM_FPE_CORE_INITWS]
-
- add lr, pc, #L3 - . - 8
- mov pc, r3
-L3:
- ldmfd sp!, {r10, pc}
-
-
- .global _arm_fpe_core_abort
-_arm_fpe_core_abort:
- stmfd sp!, {r1-r7, r10, lr}
- mov r10, r0
- mov r0, r1
- mov r1, r2
- ldr r3, [pc, #arm_fpe_header - . - 8]
- ldr r3, [r3, #ARM_FPE_CORE_ABORT]
-
- add lr, pc, #L4 - . - 8
- mov pc, r3
-L4:
- ldmfd sp!, {r1-r7, r10, pc}
-
-
-/* Only needs to preserve r10 */
-
- .global _arm_fpe_core_initcontext
-_arm_fpe_core_initcontext:
- stmfd sp!, {r0-r7, r10, lr}
- mov r10, r0
- ldr r3, [pc, #arm_fpe_header - . - 8]
- ldr r3, [r3, #ARM_FPE_CORE_INITCONTEXT]
-
- add lr, pc, #L5 - . - 8
- mov pc, r3
-L5:
- ldmfd sp!, {r0-r7, r10, pc}
-
-
-/* Only needs to preserve r10 */
-
- .global _arm_fpe_core_changecontext
-_arm_fpe_core_changecontext:
- stmfd sp!, {r1-r7, r10, lr}
- mov r10, r0
- ldr r3, [pc, #arm_fpe_header - . - 8]
- ldr r3, [r3, #ARM_FPE_CORE_CHANGECONTEXT]
-
- add lr, pc, #L6 - . - 8
- mov pc, r3
-L6:
- ldmfd sp!, {r1-r7, r10, pc}
-
-
-/* All regs preerved */
-
- .global _arm_fpe_core_shutdown
-_arm_fpe_core_shutdown:
- stmfd sp!, {r0-r7, r10, lr}
- ldr r3, [pc, #arm_fpe_header - . - 8]
- ldr r3, [r3, #ARM_FPE_CORE_SHUTDOWN]
-
- add lr, pc, #L7 - . - 8
- mov pc, r3
-L7:
- ldmfd sp!, {r0-r7, r10, pc}
-
-
-/* Preserve r10 */
- .global _arm_fpe_core_savecontext
-_arm_fpe_core_savecontext:
- stmfd sp!, {r1-r7, r10, lr}
- mov r10, r0
- mov r0, r1
- mov r1, r2
- ldr r3, [pc, #arm_fpe_header - . - 8]
- ldr r3, [r3, #ARM_FPE_CORE_SAVECONTEXT]
-
- add lr, pc, #L8 - . - 8
- mov pc, r3
-L8:
- ldmfd sp!, {r1-r7, r10, pc}
-
-
-/* Preserve r10 */
-
- .global _arm_fpe_core_loadcontext
-_arm_fpe_core_loadcontext:
- stmfd sp!, {r0-r7, r10, lr}
- mov r10, r0
- mov r0, r1
- ldr r3, [pc, #arm_fpe_header - . - 8]
- ldr r3, [r3, #ARM_FPE_CORE_LOADCONTEXT]
-
- add lr, pc, #L9 - . - 8
- mov pc, r3
-L9:
- ldmfd sp!, {r0-r7, r10, pc}
-
-
-/* Only needs to preserve r10 */
-
- .global _arm_fpe_core_activatecontext
-_arm_fpe_core_activatecontext:
- stmfd sp!, {r0-r7, r10, lr}
- mov r10, r0
- ldr r3, [pc, #arm_fpe_header - . - 8]
- ldr r3, [r3, #ARM_FPE_CORE_ACTIVATECONTEXT]
-
- add lr, pc, #L10 - . - 8
- mov pc, r3
-L10:
- ldmfd sp!, {r0-r7, r10, pc}
-
-
-/* Only needs to preserve r10 */
-
- .global _arm_fpe_core_deactivatecontext
-_arm_fpe_core_deactivatecontext:
- stmfd sp!, {r1-r7, r10, lr}
- ldr r3, [pc, #arm_fpe_header - . - 8]
- ldr r3, [r3, #ARM_FPE_CORE_DEACTIVATECONTEXT]
-
- add lr, pc, #L11 - . - 8
- mov pc, r3
-L11:
- ldmfd sp!, {r1-r7, r10, pc}
-
-
-/* Simple call back function that panics */
-
- .global _arm_fpe_panic
-_arm_fpe_panic:
- adr r0, fpe_panic_text
- b _panic
-
-fpe_panic_text:
- .asciz "armfpe: we are panicing"
- .align 0
-
-
-/*
- * Call back routine from FPE on completion of an instruction
- */
-
- .global _arm_fpe_post_proc_glue
-_arm_fpe_post_proc_glue:
- stmfd sp!, {r0-r6, r10-r12, lr}
-
-/* This could be optimised as we are going from UND32->SVC32 mode */
-
- mrs r4, cpsr_all
- bic r3, r4, #(PSR_MODE)
- orr r3, r3, #(PSR_SVC32_MODE)
- msr cpsr_all, r3
-
- mov r0, r12
-
-/* Reserve a trapframe on the SVC stack */
-
- sub sp, sp, #(TRAPFRAMESIZE)
- mov r1, sp
-
- ldr r2, [r0, #-0x0008] /* Copy spsr */
- str r2, [r1, #0x0000]
-
- ldr r2, [r0, #0x0000] /* Copy r0 */
- str r2, [r1, #0x0004]
- ldr r2, [r0, #0x0004]
- str r2, [r1, #0x0008]
- ldr r2, [r0, #0x0008]
- str r2, [r1, #0x000c]
- ldr r2, [r0, #0x000c]
- str r2, [r1, #0x0010]
- ldr r2, [r0, #0x0010]
- str r2, [r1, #0x0014]
- ldr r2, [r0, #0x0014]
- str r2, [r1, #0x0018]
- ldr r2, [r0, #0x0018]
- str r2, [r1, #0x001c]
- ldr r2, [r0, #0x001c]
- str r2, [r1, #0x0020]
- ldr r2, [r0, #0x0020]
- str r2, [r1, #0x0024]
- ldr r2, [r0, #0x0024]
- str r2, [r1, #0x0028]
- ldr r2, [r0, #0x0028]
- str r2, [r1, #0x002c]
- ldr r2, [r0, #0x002c]
- str r2, [r1, #0x0030]
- ldr r2, [r0, #0x0030] /* Copy r12 */
- str r2, [r1, #0x0034]
- ldr r2, [r0, #0x0034] /* Copy usr r13 */
- str r2, [r1, #0x0038]
- ldr r2, [r0, #0x0038] /* Copy usr r14 */
- str r2, [r1, #0x003c]
- ldr r2, [r0, #0x003c] /* Copy old pc */
- str r2, [r1, #0x0044]
-
- str r14, [r1, #0x0040] /* SVC r14 */
-
-/*
- * OK Question Time ...
- *
- * Do I need to save SVC r14 ?
- * It only needs saving if this routine can interrupt something already
- * running in SVC mode. Since FP is only valid from USR32 mode this
- * should not happen.
- */
-
- mov r5, r14
- mov r6, r12
-
-/* More optimisation ... Need to code a assembly version of userret() */
-
- bl _arm_fpe_postproc
-
-/* Release the trapframe on the SVC stack */
-
- ldr r2, [sp, #0x0000] /* Copy spsr */
- str r2, [r6, #-0x0008]
-
- ldr r2, [sp, #0x0004] /* Copy r0 */
- str r2, [r6, #0x0000]
- ldr r2, [sp, #0x0008] /* Copy r1 */
- str r2, [r6, #0x0004]
- ldr r2, [sp, #0x000c] /* Copy r2 */
- str r2, [r6, #0x0008]
- ldr r2, [sp, #0x0010] /* Copy r3 */
- str r2, [r6, #0x000c]
- ldr r2, [sp, #0x0014] /* Copy r4 */
- str r2, [r6, #0x0010]
- ldr r2, [sp, #0x0018] /* Copy r5 */
- str r2, [r6, #0x0014]
- ldr r2, [sp, #0x001c] /* Copy r6 */
- str r2, [r6, #0x0018]
- ldr r2, [sp, #0x0020] /* Copy r7 */
- str r2, [r6, #0x001c]
- ldr r2, [sp, #0x0024] /* Copy r8 */
- str r2, [r6, #0x0020]
- ldr r2, [sp, #0x0028] /* Copy r9 */
- str r2, [r6, #0x0024]
- ldr r2, [sp, #0x002c] /* Copy r10 */
- str r2, [r6, #0x0028]
- ldr r2, [sp, #0x0030] /* Copy r11 */
- str r2, [r6, #0x002c]
- ldr r2, [sp, #0x0034] /* Copy r12 */
- str r2, [r6, #0x0030]
- ldr r2, [sp, #0x0038] /* Copy usr r13 */
- str r2, [r6, #0x0034]
- ldr r2, [sp, #0x003c] /* Copy usr r14 */
- str r2, [r6, #0x0038]
- ldr r2, [sp, #0x0044] /* Copy pc */
- str r2, [r6, #0x003c]
-
- add sp, sp, #(TRAPFRAMESIZE)
-
- mov r14, r5
-
- msr cpsr_all, r4
-
- ldmfd sp!, {r0-r6, r10-r12, pc}
-
-
-/*
- * Call back routine from FPE when the an exception occurs
- */
-
- .global _arm_fpe_exception_glue
-_arm_fpe_exception_glue:
- stmfd sp!, {r0-r5, r10-r12, lr}
-
-/* This could be optimised as we are going from UND32->SVC32 mode */
-
- mrs r4, cpsr_all
- bic r3, r4, #(PSR_MODE)
- orr r3, r3, #(PSR_SVC32_MODE)
- msr cpsr_all, r3
-
- ldr r1, [r12, #15*4]
- mov r2, r12
-
- mov r5, r14
-
- bl _arm_fpe_exception
-
- mov r14, r5
-
- msr cpsr_all, r4
-
- ldmfd sp!, {r0-r5, r10-r12, lr}
-
-/* Now pull the original trapframe that the FPE pushed off the stack */
-
- ldmdb r12, {r0, r1}
-
- msr cpsr_all, r1
- msr spsr_all, r0
-
- mov sp, r12
-
- ldmia sp, {r0-r14}^
- mov r0, r0
- add sp, sp, #15*4
- ldmfd sp!, {pc}^
-
- .global _fpe_nexthandler
-_fpe_nexthandler:
- .word _undefinedinstruction_bounce
diff --git a/sys/arch/arm32/fpe-arm/armfpe_init.c b/sys/arch/arm32/fpe-arm/armfpe_init.c
deleted file mode 100644
index f1a02ebfc11..00000000000
--- a/sys/arch/arm32/fpe-arm/armfpe_init.c
+++ /dev/null
@@ -1,333 +0,0 @@
-/* $NetBSD: armfpe_init.c,v 1.6 1996/03/18 19:55:01 mark Exp $ */
-
-/*
- * Copyright (C) 1996 Mark Brinicombe
- * Copyright (C) 1995 Neil A Carson.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * arm_fpe.c
- *
- * Stuff needed to interface the ARM floating point emulator module to RiscBSD.
- *
- * Created : 22/10/95
- */
-
-/*#define DEBUG*/
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/user.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-#include <sys/acct.h>
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_param.h>
-
-#include <machine/cpu.h>
-#include <machine/cpus.h>
-#include <machine/katelib.h>
-#include <machine/frame.h>
-
-#include "armfpe.h" /* Prototypes for things */
-
-extern int want_resched;
-extern u_int fpe_nexthandler;
-
-void undefinedinstruction_bounce __P(());
-void arm_fpe_exception_glue __P((int exception));
-void arm_fpe_panic __P(());
-void undefined_entry __P(());
-void arm_fpe_post_proc_glue __P(());
-
-/*
- * A module header, pointing into the module
- */
-
-extern u_int arm_fpe_mod[];
-extern u_int undefined_handler_address;
-
-/*
- * Error messages for the various exceptions, numbered 0-5
- */
-
-static char *exception_errors[] = {
- "Floating point invalid operation",
- "Floating point division by zero (0)",
- "Floating point overflow",
- "Floating point underflow",
- "Floating point operation inexact",
- "Floating point major faliure... core fault trapped... not good!"
-};
-
-/*
- * Relocate the FPE.
- */
-
-void
-arm_fpe_mod_reloc(void)
-{
- int cnt;
- arm_fpe_mod_hdr_t *arm_fpe_mod_hdr = (arm_fpe_mod_hdr_t *)arm_fpe_mod;
-
- /* Go through the module header, and convert all offsets into absolute
- * addresses. Careful here - the last two fields of the header do _NOT_
- * want to be relocated!
- */
-
- for (cnt = 0; cnt < (sizeof(arm_fpe_mod_hdr_t) >> 2) - 2; cnt ++) {
-#ifdef DEBUG
- printf("FPE: entry %02x = %08x ", cnt, arm_fpe_mod[cnt]);
-#endif
- arm_fpe_mod[cnt] += (u_int) arm_fpe_mod;
-#ifdef DEBUG
- printf(" reloc=%08x\n", arm_fpe_mod[cnt]);
-#endif
- }
- /* Print a startup message, and a couple of variables needed, these may need
- * checking to make *sure* they are OK!
- */
-
-#ifdef DEBUG
- printf("FPE: global workspace size = %d bytes, context size = %d bytes\n",
- arm_fpe_mod_hdr->WorkspaceLength, arm_fpe_mod_hdr->ContextLength);
- printf("FPE: base=%08x\n", (u_int)arm_fpe_mod);
-#endif
-}
-
-/*
- * Initialisation point. The kernel calls this during the configuration of the cpu
- * in order to install the FPE.
- * The FPE specification needs to be filled in the specified cpu_t structure
- * and the FPE needs to be installed on the CPU undefined instruction vector.
- */
-
-int
-initialise_arm_fpe(cpu)
- cpu_t *cpu;
-{
- int error;
-
- cpu->fpu_class = FPU_CLASS_FPE;
- cpu->fpu_type = FPU_TYPE_ARMLTD_FPE;
- strcpy(cpu->fpu_model, "Advanced RISC Machines floating point emulator");
- error = arm_fpe_boot();
- if (error != 0) {
- strcat(cpu->fpu_model, " - boot failed");
- return(1);
- }
-
-/* Return with start failure so the old FPE is installed */
-
-/* strcat(cpu->fpu_model, " - boot aborted");*/
-
- return(0);
-}
-
-/*
- * The actual FPE boot routine.
- * This has to do a number of things :
- * 1. Relocate the FPE - Note this requires write access to the kernel text area
- * 2. Allocated memory for the FPE
- * 3. Initialise the FPE
- */
-
-int
-arm_fpe_boot(void)
-{
- u_int workspace;
- int id;
- arm_fpe_mod_hdr_t *arm_fpe_mod_hdr = (arm_fpe_mod_hdr_t *)arm_fpe_mod;
-
- /* First things first ... Relocate the FPE pointers */
-
- arm_fpe_mod_reloc();
-
- /* Now we must do some memory allocation */
-
- workspace = (u_int)malloc(arm_fpe_mod_hdr->WorkspaceLength, M_DEVBUF, M_NOWAIT);
-#ifdef DEBUG
- printf("Gloabl workspace at 0x%08x\n", workspace);
-#endif
-
- if (!workspace)
- return(ENOMEM);
-
- *arm_fpe_mod_hdr->main_ws_ptr_addr = workspace;
-
- *arm_fpe_mod_hdr->local_handler_ptr_addr = (u_int)&undefined_handler_address;
- *arm_fpe_mod_hdr->old_handler_ptr_addr = undefined_handler_address;
-
- /* Initialise out gloable workspace */
-
-#ifdef DEBUG
- printf("Initing workspace ");
-#endif
-
- id = arm_fpe_core_initws(workspace, (u_int)&fpe_nexthandler, (u_int)&fpe_nexthandler);
-
-#ifdef DEBUG
- printf("id=%08x\n", id);
-#endif
-
- /* Set up an exception handler */
-
- *arm_fpe_mod_hdr->exc_handler_ptr_addr = (u_int)arm_fpe_exception_glue;
-
- /* Set up post instruction handler */
-#if defined(CPU_ARM6) || defined(CPU_ARM7)
- *arm_fpe_mod_hdr->fp_post_proc_addr = (((((u_int)arm_fpe_post_proc_glue -
- (u_int)arm_fpe_mod_hdr->fp_post_proc_addr - 8)>>2) & 0x00ffffff) | 0xea000000);
-#ifdef DEBUG
- printf("arm_fpe_mod_hdr->fp_post_proc_addr = %08x (%08x)",
- arm_fpe_mod_hdr->fp_post_proc_addr,
- *arm_fpe_mod_hdr->fp_post_proc_addr);
-#endif
-#else
-#error ARMFPE currently only supports ARM6 and ARM7
-#endif
-
-#ifdef DEBUG
- printf("Initialising proc0 FPE context\n");
-#endif
-
- /* Initialise proc0's FPE context */
-
- arm_fpe_core_initcontext(FP_CONTEXT(&proc0));
- arm_fpe_core_changecontext(FP_CONTEXT(&proc0));
-
- return(0);
-}
-
-
-/*
- * Callback routine from the FPE when instruction emulation completes
- */
-
-void
-arm_fpe_postproc(fpframe, frame)
- u_int fpframe;
- struct trapframe *frame;
-{
- register u_int s;
- register int sig;
- register struct proc *p;
-
- p = curproc;
- p->p_md.md_regs = frame;
-
-/* take pending signals */
-
- while ((sig = (CURSIG(p))) != 0) {
- postsig(sig);
- }
-
- p->p_priority = p->p_usrpri;
-
- if (want_resched) {
- /*
- * Since we are curproc, a clock interrupt could
- * change our priority without changing run queues
- * (the running process is not kept on a run queue).
- * If this happened after we setrunqueue ourselves but
- * before we switch()'ed, we might not be on the queue
- * indicated by our priority
- */
-
- s = splstatclock();
- setrunqueue(p);
- p->p_stats->p_ru.ru_nivcsw++;
-
- mi_switch();
-
- (void)splx(s);
- while ((sig = (CURSIG(p))) != 0) {
- postsig(sig);
- }
- }
-
-/* Profiling. */
-
- if (p->p_flag & P_PROFIL) {
- extern int psratio;
- u_int pc;
-
- pc = ReadWord(fpframe + 15*4);
-
- if (pc <0x1000 || pc > 0xefc00000)
- printf("armfpe_postproc: pc=%08x\n", pc);
-
-/* addupc_task(p, pc, (int)(p->p_sticks - sticks) * psratio);*/
- addupc_task(p, pc, (int)(p->p_sticks - p->p_sticks) * psratio);
- }
-
- curpriority = p->p_priority;
-}
-
-
-/*
- * Callback routine from the FPE when an exception occurs.
- */
-
-void
-arm_fpe_exception(exception, pc, fpframe)
- int exception;
- u_int pc;
- u_int fpframe;
-{
- if (exception >= 0 && exception < 6)
- printf("fpe exception: %d - %s\n", exception, exception_errors[exception]);
- else
- printf("fpe exception: %d - unknown\n", exception);
-
- trapsignal(curproc, SIGFPE, exception);
-
- printf("PC=%08x\n", ReadWord(fpframe + 60));
-
- userret(curproc, pc, curproc->p_sticks);
-}
-
-
-void
-arm_fpe_copycontext(c1, c2)
- u_int c1;
- u_int c2;
-{
- fp_context_frame_t fpcontext;
-
- arm_fpe_core_savecontext(c1, (int *)&fpcontext, 0);
- arm_fpe_core_loadcontext(c2, (int *)&fpcontext);
-}
-
-/* End of armfpe_init.c */
diff --git a/sys/arch/arm32/fpe-sp/fpe.c b/sys/arch/arm32/fpe-sp/fpe.c
deleted file mode 100644
index 84b79dcc538..00000000000
--- a/sys/arch/arm32/fpe-sp/fpe.c
+++ /dev/null
@@ -1,1321 +0,0 @@
-/* $NetBSD: fpe.c,v 1.2 1996/03/18 19:58:09 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- * Copyright (c) 1995 Neil Carson.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD kernel team.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * fpe.c
- *
- * Floating Point Emulator
- *
- * Currently calculations are only performed to single precision
- *
- * Created : 11/02/95
- */
-
-/* FPE Compile options
- *
- * FPE_SPEEDUPS - use assembly speedups in place of C routines
- * FPE_NODEBUG - don't compile in the debugging code
- * FPE_PROF - compile in FPE profiling code
- * FPE_INLINE - define this as inline to inline some functions
- */
-
-#define FPE_SPEEDUPS
-#define FPE_NODEBUG
-/*#define FPE_PROF*/
-#define FPE_INLINE __inline
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-#include <sys/syslog.h>
-
-#include <machine/cpu.h>
-#include <machine/cpus.h>
-#include <machine/katelib.h>
-#include <machine/frame.h>
-#include <machine/undefined.h>
-#include <machine/fp.h>
-
-typedef struct {
- int opcode;
- int precision;
- int rounding;
- int fpregm;
- int fpregn;
- int fpregd;
- int regd;
-} fp_op_data_t;
-
-/* Types and stuctures used to hold floating point numbers */
-
-typedef struct {
- u_int32_t exponent;
- u_int32_t mantissa_hi;
- u_int32_t mantissa_lo;
-} fpe_reg_t;
-
-typedef struct {
- u_int mantissa:23;
- u_int exponent:8;
- u_int sign:1;
-} fpe_sprec_t;
-
-typedef struct {
- u_int mantissa_hi:20;
- u_int exponent:11;
- u_int sign:1;
- u_int32_t mantissa_lo;
-} fpe_dprec_t;
-
-typedef struct {
- u_int32_t exponent;
- u_int32_t mantissa_hi;
- u_int32_t mantissa_lo;
-} fpe_eprec_t;
-
-typedef struct {
- u_int32_t word1;
- u_int32_t word2;
- u_int32_t word3;
-} fpe_pprec_t;
-
-typedef struct {
- u_int32_t exponent;
- u_int64_t mantissa;
-} fpe_qreg_t;
-
-/* FPE status and control registers */
-
-u_int fpe_status = 0x02000000;
-u_int fpe_control = 0x00000000;
-
-#define FPE_STATUS_MASK 0x001f1f1f
-#define FPE_CONTROL_MASK 0x9cffffff
-
-/* Array containing the emulated registers */
-
-fpe_reg_t fpe_registers[16] = {
- { 0, 0, 0 }, /* f0 */
- { 0, 0, 0 }, /* f1 */
- { 0, 0, 0 }, /* f2 */
- { 0, 0, 0 }, /* f3 */
- { 0, 0, 0 }, /* f4 */
- { 0, 0, 0 }, /* f5 */
- { 0, 0, 0 }, /* f6 */
- { 0, 0, 0 }, /* f7 */
- { 0x0000, 0x00000000, 0x00000000 }, /* 0.0 */
- { 0x3fff, 0x80000000, 0x00000000 }, /* 1.0 */
- { 0x4000, 0x80000000, 0x00000000 }, /* 2.0 */
- { 0x4000, 0xc0000000, 0x00000000 }, /* 3.0 */
- { 0x4001, 0x80000000, 0x00000000 }, /* 4.0 */
- { 0x4001, 0xa0000000, 0x00000000 }, /* 5.0 */
- { 0x3ffe, 0x80000000, 0x00000000 }, /* 0.5 */
- { 0x4002, 0xa0000000, 0x00000000 }, /* 10.0 */
-};
-
-fpe_reg_t *fpregs;
-
-/* Prototypes for instruction emulation functions */
-
-typedef int (*fpe_handler_t) __P((unsigned int, trapframe_t *));
-typedef int (*fpe_dop_handler_t) __P((fp_op_data_t *, trapframe_t *));
-
-int fpe_mvf __P((fp_op_data_t *, trapframe_t *));
-int fpe_mnf __P((fp_op_data_t *, trapframe_t *));
-int fpe_adf __P((fp_op_data_t *, trapframe_t *));
-int fpe_muf __P((fp_op_data_t *, trapframe_t *));
-int fpe_suf __P((fp_op_data_t *, trapframe_t *));
-int fpe_dvf __P((fp_op_data_t *, trapframe_t *));
-int fpe_muf __P((fp_op_data_t *, trapframe_t *));
-int fpe_rdf __P((fp_op_data_t *, trapframe_t *));
-int fpe_rsf __P((fp_op_data_t *, trapframe_t *));
-int fpe_abs __P((fp_op_data_t *, trapframe_t *));
-
-/* Table of handler functions for register to registers operations */
-
-fpe_dop_handler_t fpe_dops[32] = {
- fpe_adf, /* 00000 ADF Add */
- fpe_mvf, /* 00001 MVF Move */
- fpe_muf, /* 00010 MUL Multiply */
- fpe_mnf, /* 00011 MNF Move negated */
- fpe_suf, /* 00100 SUF Subtract */
- fpe_abs, /* 00101 ABS Absolute value */
- fpe_rsf, /* 00110 RSF Reverse subtract */
- NULL, /* 00111 RND Round to integer */
- fpe_dvf, /* 01000 DVF Divide */
- NULL, /* 01001 SQT Square root */
- fpe_rdf, /* 01010 RDF Reverse divide */
- NULL, /* 01011 LOG Logarithm to base 10 */
- NULL, /* 01100 POW Power */
- NULL, /* 01101 LGN Logarithm to base e */
- NULL, /* 01110 RPW Reverse power */
- NULL, /* 01111 EXP Exponent */
- NULL, /* 10000 RMF Remainder */
- NULL, /* 10001 SIN Sine */
- fpe_muf, /* 10010 FML Fast multiply */
- NULL, /* 10011 COS Cosine */
- fpe_dvf, /* 10100 FDV Fast divide */
- NULL, /* 10101 TAN Tangent */
- fpe_rdf, /* 10110 FRD Fast reverse divide */
- NULL, /* 10111 ASN Arc sine */
- NULL, /* 11000 ROL Rolar angle */
- NULL, /* 11001 ACS Arc cosine */
- NULL, /* 11010 undefined */
- NULL, /* 11011 ATN Arc tangent */
- NULL, /* 11100 undefined */
- NULL, /* 11101 undefined */
- NULL, /* 11110 undefined */
- NULL, /* 11111 undefined */
-};
-
-/* Prototypes for instruction emulation functions */
-
-int fpe_flt __P((fp_op_data_t *, trapframe_t *));
-int fpe_fix __P((fp_op_data_t *, trapframe_t *));
-int fpe_wfs __P((fp_op_data_t *, trapframe_t *));
-int fpe_rfs __P((fp_op_data_t *, trapframe_t *));
-int fpe_wfc __P((fp_op_data_t *, trapframe_t *));
-int fpe_rfc __P((fp_op_data_t *, trapframe_t *));
-int fpe_cmf __P((fp_op_data_t *, trapframe_t *));
-int fpe_cnf __P((fp_op_data_t *, trapframe_t *));
-
-/* Table of handler functions for fp register transfer operations */
-
-fpe_dop_handler_t fpe_regtrans[16] = {
- fpe_flt, /* 0000 FLT Integer to FP */
- fpe_fix, /* 0001 FIX FP to Integer */
- fpe_wfs, /* 0010 Write FP status */
- fpe_rfs, /* 0011 Read FP status */
- fpe_wfc, /* 0100 Write FP control */
- fpe_rfc, /* 0101 Read FP control */
- NULL, /* 0110 undefined */
- NULL, /* 0111 undefined */
- NULL, /* 1000 undefined */
- fpe_cmf, /* 1001 Compare FP */
- NULL, /* 1010 undefined */
- fpe_cnf, /* 1011 Compare negated FP */
- NULL, /* 1100 undefined */
- fpe_cmf, /* 1101 Compare FP with exception */
- NULL, /* 1110 undefined */
- fpe_cnf, /* 1111 Compare negated FP with exception */
-};
-
-/* Prototypes for instruction emulation functions */
-
-int fpe_ldfstf __P((unsigned int address, trapframe_t *));
-
-FPE_INLINE int stofpe __P((u_int32_t */*address*/, fpe_reg_t */*fpreg*/));
-int dtofpe __P((u_int32_t *, fpe_reg_t *));
-int etofpe __P((u_int32_t *, fpe_reg_t *));
-int ptofpe __P((u_int32_t *, fpe_reg_t *));
-FPE_INLINE int fpetos __P((u_int32_t *, fpe_reg_t *));
-int fpetod __P((u_int32_t *, fpe_reg_t *));
-int fpetoe __P((u_int32_t *, fpe_reg_t *));
-int fpetop __P((u_int32_t *, fpe_reg_t *));
-
-int fpe_dump(void);
-
-int coproc1_handler __P((unsigned int, unsigned int, trapframe_t *));
-int coproc2_handler __P((unsigned int, unsigned int, trapframe_t *));
-
-/* Prototypes for assembly functions */
-
-u_int32_t nc_fp_add __P((u_int32_t, u_int32_t));
-u_int32_t nc_fp_sub __P((u_int32_t, u_int32_t));
-u_int32_t nc_fp_mul __P((u_int32_t, u_int32_t));
-u_int32_t nc_fp_div __P((u_int32_t, u_int32_t));
-u_int32_t nc_fp_fix __P((u_int32_t));
-u_int32_t nc_fp_cmp __P((u_int32_t, u_int32_t));
-
-#define FPP_ADD 0
-#define FPP_SUB 1
-#define FPP_MUL 2
-#define FPP_DIV 3
-#define FPP_CMF 4
-#define FPP_CNF 5
-#define FPP_FIX 6
-#define FPP_FLT 7
-#define FPP_ABS 8
-#define FPP_MOV 9
-#define FPP_MVN 10
-#define FPP_RDV 11
-#define FPP_RSB 12
-#define FPP_STRS 13
-#define FPP_STRD 14
-#define FPP_STRE 15
-#define FPP_STRP 16
-#define FPP_LDRS 17
-#define FPP_LDRD 18
-#define FPP_LDRE 19
-#define FPP_LDRP 20
-#define FPP_MAX 21
-
-#ifdef FPE_PROF
-u_int fp_profile[FPP_MAX];
-
-#define FPP_INC(x) ++fp_profile[x]
-#else
-#define FPP_INC(x)
-#endif
-
-/*
-* If FPE is defined then we are being built into the kernel.
-* If not then we are being built as a standalone loadable module.
-*/
-
-#ifdef FPE
-#define PRINTF(x) ;
-#define FPE_DUMP() ;
-#else
-#define PRINTF(x) (*printf_store)(x)
-#define FPE_DUMP() fpe_dump()
-
-void (*printf_store)();
-void (*install_coproc_store)();
-
-#ifdef NOTEXT
-void
-fpe_printf(char *a, ...)
-{
-}
-#endif
-
-/* Standalone initialisation point */
-
-int
-init_fpe(printf_handler, coproc_handler)
- void (*printf_handler)();
- void (*coproc_handler)();
-{
- int loop;
-
- printf_store = printf_handler;
- install_coproc_store = coproc_handler;
-#ifdef NOTEXT
- printf_store = fpe_printf;
-#endif
- (*install_coproc_store)(FP_COPROC, coproc1_handler);
- (*install_coproc_store)(FP_COPROC2, coproc2_handler);
-
-#ifdef FPE_PROF
- for (loop = 0; loop < FPP_MAX; ++loop)
- fp_profile[loop] = 0;
-#endif
-
- PRINTF(("FPE installed\n"));
- return(0);
-}
-#endif
-
-
-/*
- * Main entry point after an undefined instruction.
- * The instruction has been identified as a co-proc 2 instruction.
- * We get the address of the instruction, the instruction itself and
- * and pointer to the trap frame.
- * Currently we do support this (LFM/SFM) so its gallows time
- */
-
-int
-coproc2_handler(address, instruction, frame)
- unsigned int address;
- unsigned int instruction;
- trapframe_t *frame;
-{
- log(LOG_ERR, "Coprocessor 2 FP instruction 0x%08x not supported yet.", instruction);
- return(1);
-}
-
-
-void
-init_fpe_state(p)
- struct proc *p;
-{
- struct fp_state *fpstate;
- int loop;
-
- fpstate = &p->p_addr->u_pcb.pcb_fpstate;
- fpstate->fp_flags |= 1;
-
- for (loop = 8; loop < 16; ++loop)
- fpstate->fp_registers[loop] = *((fp_reg_t *)&fpe_registers[loop]);
-}
-
-
-int
-initialise_fpe(cpu)
- cpu_t *cpu;
-{
- cpu->fpu_class = FPU_CLASS_FPE;
- cpu->fpu_type = FPU_TYPE_SP_FPE;
- strcpy(cpu->fpu_model, "Single precision floating point emulator");
- install_coproc_handler(FP_COPROC, coproc1_handler);
- install_coproc_handler(FP_COPROC2, coproc2_handler);
- init_fpe_state(curproc);
- return(0);
-}
-
-
-/*
- * Main entry point after an undefined instruction.
- * The instruction has been identified as a co-proc 1 instruction.
- * We get the address of the instruction, the instruction itself and
- * and pointer to the trap frame.
- */
-
-int
-coproc1_handler(address, instruction, frame)
- unsigned int address;
- unsigned int instruction;
- trapframe_t *frame;
-{
- struct fp_state *fpstate;
- PRINTF(("FPE instruction 0x%08x -> 0x%08x\n",
- address, instruction));
-
-/* Get the fp registers pointer */
-
- fpstate = &curproc->p_addr->u_pcb.pcb_fpstate;
-
- fpstate->fp_flags |= 2; /* so statclock can tell if we are spending time in the fpe */
-
- if (fpstate->fp_flags & 1)
- fpregs = (fpe_reg_t *) &fpstate->fp_registers;
- else
- fpregs = fpe_registers;
-
-/* Test for a FP data transfer operation */
-
- if ((instruction & (1 << 25)) == 0) {
- int err;
-
- PRINTF(("FP data transfer\n"));
- err = fpe_ldfstf(instruction, frame);
- FPE_DUMP();
- fpstate->fp_flags &= ~2;
- return(err);
- }
-
-/* Test for a FP data operation */
-
- else if ((instruction & (1 << 4)) == 0) {
- fp_op_data_t op_data;
-
- op_data.opcode = (instruction >> 19) & 0x1e;
- if (instruction & 0x00008000)
- op_data.opcode |= 0x01;
-
- op_data.precision = ((instruction & (1<<19)) ? 2 : 0)
- | ((instruction & (1<<7)) ? 1 : 0);
- op_data.rounding = (instruction >> 5) & 3;
- op_data.fpregm = (instruction) & 15;
- op_data.fpregn = (instruction >> 16) & 7;
- op_data.fpregd = (instruction >> 12) & 7;
-
- PRINTF(("FP data op = %d\n", op_data.opcode));
- if (fpe_dops[op_data.opcode]) {
- int err;
- err = (*fpe_dops[op_data.opcode])(&op_data, frame);
-#ifndef FPE_NODEBUG
- if (err == 0)
- FPE_DUMP();
-#endif
- fpstate->fp_flags &= ~2;
- return(err);
- }
- else {
- fpstate->fp_flags &= ~2;
- return(1);
- }
- }
-
-/* Test for a FP register transfer operation */
-
- else {
- fp_op_data_t op_data;
-
- op_data.opcode = (instruction >> 20) & 0x0f;
-
- op_data.precision = ((instruction & (1<<19)) ? 2 : 0)
- | ((instruction & (1<<7)) ? 1 : 0);
- op_data.rounding = (instruction >> 5) & 3;
- op_data.fpregm = (instruction) & 15;
- op_data.fpregn = (instruction >> 16) & 7;
- op_data.regd = (instruction >> 12) & 15;
-
- PRINTF(("FP reg trans = %d\n", op_data.opcode));
- if (fpe_regtrans[op_data.opcode]) {
- int err;
-
- PRINTF(("FP reg trans op = %d\n", op_data.opcode));
- err = (*fpe_regtrans[op_data.opcode])(&op_data, frame);
-#ifndef FPE_NODEBUG
- if (err == 0 && (op_data.opcode == 0 || op_data.opcode == 2
- || op_data.opcode == 4))
- FPE_DUMP();
-#endif
- fpstate->fp_flags &= ~2;
- return(err);
- }
- else {
- fpstate->fp_flags &= ~2;
- return(1);
- }
- }
-
-/* Well if it gets here then it was not a decodable FP instruction */
-
- fpstate->fp_flags &= ~2;
- return(1);
-}
-
-
-/* Precision convertion routines */
-
-FPE_INLINE int
-stofpe(address, fpreg)
- u_int32_t *address;
- fpe_reg_t *fpreg;
-{
- fpe_sprec_t real;
- u_int32_t *words = (u_int32_t *)&real;
-
- if ((address[0] & ~(1<<31)) == 0) {
- PRINTF(("single=0\n"));
-
- fpreg->mantissa_hi = 0;
- fpreg->mantissa_lo = 0;
- fpreg->exponent = address[0] & (1<<31);
- return(0);
- }
-
- words[0] = address[0];
- PRINTF(("word=%08x\n", address[0]));
-
- PRINTF(("sign = %d exponent=%08x mantissa=%08x\n", real.sign,
- real.exponent, real.mantissa));
- fpreg->mantissa_hi = real.mantissa << 8;
- fpreg->mantissa_lo = 0;
- fpreg->exponent = ((int)real.exponent - 0x80) + 0x4000;
- fpreg->exponent |= (real.sign << 31);
- return(0);
-}
-
-
-int
-dtofpe(address, fpreg)
- u_int32_t *address;
- fpe_reg_t *fpreg;
-{
- fpe_dprec_t real;
-
- if ((address[0] & ~(1<<31)) == 0 && address[1] == 0) {
- PRINTF(("double=0\n"));
-
- fpreg->mantissa_hi = 0;
- fpreg->mantissa_lo = 0;
- fpreg->exponent = address[0] & (1<<31);
- return(0);
- }
-
- real = *(fpe_dprec_t *)address;
- PRINTF(("sign = %d exponent=%08x mantissa=%08x %08x\n", real.sign,
- real.exponent, real.mantissa_lo, real.mantissa_hi));
- fpreg->mantissa_hi = real.mantissa_hi << 11;
- fpreg->mantissa_hi |= real.mantissa_lo >> 21;
- fpreg->mantissa_lo = real.mantissa_lo << 11;
- fpreg->exponent = (real.exponent - 0x400) + 0x4000;
- fpreg->exponent |= (real.sign << 31);
-
- return(0);
-}
-
-
-#ifndef FPE_SPEEDUPS
-int
-etofpe(address, fpreg)
- u_int32_t *address;
- fpe_reg_t *fpreg;
-{
- bcopy((char *)address, (char *)fpreg, 12);
- return(0);
-}
-#endif
-
-
-int
-ptofpe(address, fpreg)
- u_int32_t *address;
- fpe_reg_t *fpreg;
-{
- fpe_pprec_t real;
-
- real = *(fpe_pprec_t *)address;
- return(1);
-}
-
-
-FPE_INLINE int
-fpetos(address, fpreg)
- u_int32_t *address;
- fpe_reg_t *fpreg;
-{
- fpe_sprec_t real;
- int exp;
-
- if (fpreg->mantissa_hi == 0 && fpreg->mantissa_lo == 0
- && (fpreg->exponent & ~(1<<31)) == 0) {
- PRINTF(("single=0\n"));
-
- address[0] = fpreg->exponent & (1<<31);
- return(0);
- }
-
- real.sign = (fpreg->exponent >> 31) & 1;
- real.mantissa = (fpreg->mantissa_hi >> 8);
- exp = ((int)(fpreg->exponent & 0x7fff) - 0x4000) + 0x80;
-
- if (exp < 0 || exp > 0xff) {
- PRINTF(("ermm exponent out of range !\n"));
- exp = 0x80;
- }
-
- real.exponent = exp;
-
- PRINTF(("single=%08x\n", *((unsigned int *)&real)));
-
- *(fpe_sprec_t *)address = real;
- if (real.sign == 1 && real.mantissa == 0 && real.exponent == 0)
- printf("single result = %08x", *address);
- return(0);
-}
-
-
-int
-fpetod(address, fpreg)
- u_int32_t *address;
- fpe_reg_t *fpreg;
-{
- fpe_dprec_t real;
- u_int32_t *words = (u_int32_t *)&real;
- int exp;
-
- if (fpreg->mantissa_lo == 0 && (fpreg->exponent & ~(1<<31)) == 0) {
- PRINTF(("double=0\n"));
-
- address[0] = fpreg->exponent & (1<<31);
- address[1] = 0;
- return(0);
- }
-
- real.sign = (fpreg->exponent >> 31) & 1;
- real.mantissa_hi = (fpreg->mantissa_hi >> 11);
- real.mantissa_lo = (fpreg->mantissa_hi << 21) | (fpreg->mantissa_lo >> 11);
- exp = ((int)(fpreg->exponent & 0x7fff) - 0x4000) + 0x400;
-
- if (exp < 0 || exp > 0x7ff) {
- PRINTF(("ermm exponent out of range !\n"));
- exp = 0x400;
- }
-
- real.exponent = exp;
-
- PRINTF(("double=%08x%08x\n", words[0], words[1]));
-
- address[0] = words[0];
- address[1] = words[1];
- return(0);
-}
-
-#ifndef FPE_SPEEDUPS
-int
-fpetoe(address, fpreg)
- u_int32_t *address;
- fpe_reg_t *fpreg;
-{
- bcopy((char *)fpreg, (char *)address, 12);
- return(0);
-}
-#endif
-
-
-int
-fpetop(address, fpreg)
- u_int32_t *address;
- fpe_reg_t *fpreg;
-{
- return(1);
-}
-
-
-/* Unary fp data operations */
-
-/*
- * int fpe_mvf(fp_op_data_t *op, trapframe_t *frame)
- *
- * MVF - Move FP register to FP register
- */
-
-int
-fpe_mvf(op, frame)
- fp_op_data_t *op;
- trapframe_t *frame;
-{
- FPP_INC(FPP_MOV);
- PRINTF(("MVF prec=%d rnd=%d fd=%d fn=%d fm=%d\n",
- op->precision, op->rounding, op->fpregd, op->fpregn, op->fpregm));
- fpregs[op->fpregd] = fpregs[op->fpregm];
- return(0);
-}
-
-
-/*
-* int fpe_mnf(fp_op_data_t *op, trapframe_t *frame)
-*
-* MNF - Move FP register to FP register negated
-*/
-
-int
-fpe_mnf(op, frame)
- fp_op_data_t *op;
- trapframe_t *frame;
-{
- fpe_qreg_t real1 = *(fpe_qreg_t *)&fpregs[8];
- fpe_qreg_t real2 = *(fpe_qreg_t *)&fpregs[op->fpregm];
- fpe_qreg_t result;
- u_int32_t single_a, single_b, single_result;
-
- FPP_INC(FPP_MVN);
- PRINTF(("MNF prec=%d rnd=%d fd=%d fn=%d fm=%d\n",
- op->precision, op->rounding, op->fpregd, op->fpregn, op->fpregm));
-
- fpetos(&single_a, (fpe_reg_t *) &real1);
- fpetos(&single_b, (fpe_reg_t *) &real2);
- single_result = nc_fp_sub(single_a, single_b);
- stofpe(&single_result, (fpe_reg_t *) &result);
-
- fpregs[op->fpregd] = *(fpe_reg_t *) &result;
- return(0);
-}
-
-
-/*
-* int fpe_abs(fp_op_data_t *op, trapframe_t *frame)
-*
-* ABS - Absolute value of a FP register
-*/
-
-int
-fpe_abs(op, frame)
- fp_op_data_t *op;
- trapframe_t *frame;
-{
- fpe_qreg_t real1 = *(fpe_qreg_t *)&fpregs[8];
- fpe_qreg_t real2 = *(fpe_qreg_t *)&fpregs[op->fpregm];
- fpe_qreg_t result;
- u_int32_t single_a, single_b, single_result;
-
- FPP_INC(FPP_ABS);
- PRINTF(("ABS prec=%d rnd=%d fd=%d fn=%d fm=%d\n",
- op->precision, op->rounding, op->fpregd, op->fpregn, op->fpregm));
-
- fpetos(&single_a, (fpe_reg_t *) &real2);
- fpetos(&single_b, (fpe_reg_t *) &real1);
- single_result = nc_fp_cmp(single_a, single_b);
- if (single_result & 0x80000000) {
- fpetos(&single_a, (fpe_reg_t *) &real1);
- fpetos(&single_b, (fpe_reg_t *) &real2);
- single_result = nc_fp_sub(single_a, single_b);
- stofpe(&single_result, (fpe_reg_t *) &result);
-
- fpregs[op->fpregd] = *(fpe_reg_t *) &result;
- } else {
- fpregs[op->fpregd] = fpregs[op->fpregm];
- }
-
- return(0);
-}
-
-
-/* Binary fp data operations */
-
-/*
- * int fpe_adf(fp_op_data_t *op, trapframe_t *frame)
- *
- * ADF - Floating point add
- */
-
-int
-fpe_adf(op, frame)
- fp_op_data_t *op;
- trapframe_t *frame;
-{
- fpe_qreg_t real1 = *(fpe_qreg_t *)&fpregs[op->fpregn];
- fpe_qreg_t real2 = *(fpe_qreg_t *)&fpregs[op->fpregm];
- fpe_qreg_t result;
- u_int32_t single_a, single_b, single_result;
-
- FPP_INC(FPP_ADD);
- PRINTF(("ADF prec=%d rnd=%d fd=%d fn=%d fm=%d\n",
- op->precision, op->rounding, op->fpregd, op->fpregn, op->fpregm));
-
- fpetos(&single_a, (fpe_reg_t *) &real1);
- fpetos(&single_b, (fpe_reg_t *) &real2);
- single_result = nc_fp_add(single_a, single_b);
- stofpe(&single_result, (fpe_reg_t *) &result);
- fpregs[op->fpregd] = *(fpe_reg_t *) &result;
- return(0);
-}
-
-
-/*
- * int fpe_suf(fp_op_data_t *op, trapframe_t *frame)
- *
- * SUF - Floating point subtract
- */
-
-int
-fpe_suf(op, frame)
- fp_op_data_t *op;
- trapframe_t *frame;
-{
- fpe_qreg_t real1 = *(fpe_qreg_t *)&fpregs[op->fpregn];
- fpe_qreg_t real2 = *(fpe_qreg_t *)&fpregs[op->fpregm];
- fpe_qreg_t result;
- u_int32_t single_a, single_b, single_result;
-
- FPP_INC(FPP_SUB);
- PRINTF(("SUF prec=%d rnd=%d fd=%d fn=%d fm=%d\n",
- op->precision, op->rounding, op->fpregd, op->fpregn, op->fpregm));
-
- fpetos(&single_a, (fpe_reg_t *) &real1);
- fpetos(&single_b, (fpe_reg_t *) &real2);
- single_result = nc_fp_sub(single_a, single_b);
- stofpe(&single_result, (fpe_reg_t *) &result);
- fpregs[op->fpregd] = *(fpe_reg_t *) &result;
- return(0);
-}
-
-
-/*
- * int fpe_muf(fp_op_data_t *op, trapframe_t *frame)
- *
- * MUF - Floating point multiply
- */
-
-int
-fpe_muf(op, frame)
- fp_op_data_t *op;
- trapframe_t *frame;
-{
- fpe_qreg_t real1 = *(fpe_qreg_t *)&fpregs[op->fpregn];
- fpe_qreg_t real2 = *(fpe_qreg_t *)&fpregs[op->fpregm];
- fpe_qreg_t result;
- u_int32_t single_a, single_b, single_result;
-
- FPP_INC(FPP_MUL);
- PRINTF(("MUF prec=%d rnd=%d fd=%d fn=%d fm=%d\n",
- op->precision, op->rounding, op->fpregd, op->fpregn, op->fpregm));
-
- fpetos(&single_a, (fpe_reg_t *) &real1);
- fpetos(&single_b, (fpe_reg_t *) &real2);
- single_result = nc_fp_mul(single_a, single_b);
- stofpe(&single_result, (fpe_reg_t *) &result);
- fpregs[op->fpregd] = *(fpe_reg_t *) &result;
- return(0);
-}
-
-
-/*
- * int fpe_dvf(fp_op_data_t *op, trapframe_t *frame)
- *
- * DVF - Floating point divide
- */
-
-int fpe_dvf(fp_op_data_t *op, trapframe_t *frame)
-{
- fpe_qreg_t real1 = *(fpe_qreg_t *)&fpregs[op->fpregn];
- fpe_qreg_t real2 = *(fpe_qreg_t *)&fpregs[op->fpregm];
- fpe_qreg_t result;
- u_int32_t single_a, single_b, single_result;
-
- FPP_INC(FPP_DIV);
- PRINTF(("DVF prec=%d rnd=%d fd=%d fn=%d fm=%d\n", op->precision, op->rounding, op->fpregd, op->fpregn, op->fpregm));
-
- fpetos(&single_a, (fpe_reg_t *) &real1);
- fpetos(&single_b, (fpe_reg_t *) &real2);
- single_result = nc_fp_div(single_a, single_b);
- stofpe(&single_result, (fpe_reg_t *) &result);
- fpregs[op->fpregd] = *(fpe_reg_t *) &result;
- return(0);
-}
-
-
-/*
- * int fpe_rdf(fp_op_data_t *op, trapframe_t *frame)
- *
- * RDF - Floating point reverse divide
- */
-
-int
-fpe_rdf(op, frame)
- fp_op_data_t *op;
- trapframe_t *frame;
-{
- fpe_qreg_t real1 = *(fpe_qreg_t *)&fpregs[op->fpregm];
- fpe_qreg_t real2 = *(fpe_qreg_t *)&fpregs[op->fpregn];
- fpe_qreg_t result;
- u_int32_t single_a, single_b, single_result;
-
- FPP_INC(FPP_RDV);
- PRINTF(("RDF prec=%d rnd=%d fd=%d fn=%d fm=%d\n",
- op->precision, op->rounding, op->fpregd, op->fpregn, op->fpregm));
-
- fpetos(&single_a, (fpe_reg_t *) &real1);
- fpetos(&single_b, (fpe_reg_t *) &real2);
- single_result = nc_fp_div(single_a, single_b);
- stofpe(&single_result, (fpe_reg_t *) &result);
- fpregs[op->fpregd] = *(fpe_reg_t *) &result;
- return(0);
-}
-
-
-/*
- * int fpe_rsf(fp_op_data_t *op, trapframe_t *frame)
- *
- * RSF - Floating point reverse subtract
- */
-
-int
-fpe_rsf(op, frame)
- fp_op_data_t *op;
- trapframe_t *frame;
-{
- fpe_qreg_t real1 = *(fpe_qreg_t *)&fpregs[op->fpregm];
- fpe_qreg_t real2 = *(fpe_qreg_t *)&fpregs[op->fpregn];
- fpe_qreg_t result;
- u_int32_t single_a, single_b, single_result;
-
- FPP_INC(FPP_RSB);
- PRINTF(("RSF prec=%d rnd=%d fd=%d fn=%d fm=%d\n",
- op->precision, op->rounding, op->fpregd, op->fpregn, op->fpregm));
-
- fpetos(&single_a, (fpe_reg_t *) &real1);
- fpetos(&single_b, (fpe_reg_t *) &real2);
- single_result = nc_fp_sub(single_a, single_b);
- stofpe(&single_result, (fpe_reg_t *) &result);
- fpregs[op->fpregd] = *(fpe_reg_t *) &result;
- return(0);
-}
-
-
-/* FPE Register transfer instructions */
-
-/*
-* int fpe_flt(fp_op_data_t *op, trapframe_t *frame)
-*
-* FLT - Integer register to float register
-*/
-
-int
-fpe_flt(op, frame)
- fp_op_data_t *op;
- trapframe_t *frame;
-{
- int regd;
- fpe_reg_t real;
- int *regs = &frame->tf_r0;
-
- FPP_INC(FPP_FLT);
- PRINTF(("FLT prec=%d rnd=%d rd=%d fn=%d fm=%d\n",
- op->precision, op->rounding, op->regd, op->fpregn, op->fpregm));
-
- regd = regs[op->regd];
-
- if (regd > 0)
- real.mantissa_lo = regd;
- else
- real.mantissa_lo = -regd;
- real.mantissa_hi = 0;
-
- if (regd == 0)
- real.exponent = 0;
- else {
- real.exponent = 16383 + 63;
-
- while ((real.mantissa_hi & (1 << 31)) == 0) {
- --real.exponent;
- real.mantissa_hi = real.mantissa_hi << 1;
- if (real.mantissa_lo & (1 << 31))
- real.mantissa_hi |= 1;
- real.mantissa_lo = real.mantissa_lo << 1;
- }
- }
-
- if (regd < 0)
- real.exponent |= (1 <<31);
-
- fpregs[op->fpregn] = real;
-
- return(0);
-}
-
-
-/*
- * int fpe_fix(fp_op_data_t *op, trapframe_t *frame)
- *
- * FIX - Float register to integer register
- */
-
-int
-fpe_fix(op, frame)
- fp_op_data_t *op;
- trapframe_t *frame;
-{
- fpe_qreg_t src = *(fpe_qreg_t *) &fpregs[op->fpregm];
- u_int32_t single_argument;
- unsigned int *regs = &frame->tf_r0;
-
- FPP_INC(FPP_FIX);
- PRINTF(("FIX prec=%d rnd=%d rd=%d fn=%d fm=%d\n",
- op->precision, op->rounding, op->regd, op->fpregn, op->fpregm));
-
- fpetos(&single_argument, (fpe_reg_t *) &src);
-
-/*
- * Call the assembler (32-bit) code for now
- */
- regs[op->regd] = nc_fp_fix(single_argument);
- return(0);
-}
-
-
-/*
- * int fpe_wfs(fp_op_data_t *op, trapframe_t *frame)
- *
- * WFS - Write FP status register
- */
-
-int fpe_wfs(op, frame)
- fp_op_data_t *op;
- trapframe_t *frame;
-{
- unsigned int *regs = &frame->tf_r0;
-
- PRINTF(("WFS rd=%d\n", op->regd));
-
- fpe_status = (fpe_status & ~FPE_STATUS_MASK)
- | (regs[op->regd] & FPE_STATUS_MASK);
-
- return(0);
-}
-
-
-/*
-* int fpe_rfs(fp_op_data_t *op, trapframe_t *frame)
-*
-* RFS - Read FP status register
-*/
-
-int
-fpe_rfs(op, frame)
- fp_op_data_t *op;
- trapframe_t *frame;
-{
- unsigned int *regs = &frame->tf_r0;
-
- PRINTF(("RFS rd=%d\n", op->regd));
-
- regs[op->regd] = fpe_status;
-
- return(0);
-}
-
-
-/*
- * int fpe_wfc(fp_op_data_t *op, trapframe_t *frame)
- *
- * WFC - Write FP control register
- */
-
-int
-fpe_wfc(op, frame)
- fp_op_data_t *op;
- trapframe_t *frame;
-{
- unsigned int *regs = &frame->tf_r0;
-
- PRINTF(("WFC rd=%d\n", op->regd));
-
- fpe_control = (fpe_control & ~FPE_CONTROL_MASK)
- | (regs[op->regd] & FPE_CONTROL_MASK);
-
- return(0);
-}
-
-
-/*
- * int fpe_rfc(fp_op_data_t *op, trapframe_t *frame)
- *
- * RFC - Read FP control register
- */
-
-int
-fpe_rfc(op, frame)
- fp_op_data_t *op;
- trapframe_t *frame;
-{
- unsigned int *regs = &frame->tf_r0;
-
- PRINTF(("RFC rd=%d\n", op->regd));
-
- regs[op->regd] = fpe_control;
-
- return(0);
-}
-
-
-/*
- * int fpe_cmf(fp_op_data_t *op, trapframe_t *frame)
- *
- * CMF - FP compare
- */
-
-int
-fpe_cmf(op, frame)
- fp_op_data_t *op;
- trapframe_t *frame;
-{
- fpe_qreg_t real1 = *(fpe_qreg_t *)&fpregs[op->fpregn];
- fpe_qreg_t real2 = *(fpe_qreg_t *)&fpregs[op->fpregm];
- u_int32_t single_a, single_b, single_result;
-
- FPP_INC(FPP_CMF);
- PRINTF(("CMF prec=%d rnd=%d rd=%d fn=%d fm=%d\n",
- op->precision, op->rounding, op->regd, op->fpregn, op->fpregm));
-
- fpetos(&single_a, (fpe_reg_t *) &real1);
- fpetos(&single_b, (fpe_reg_t *) &real2);
- single_result = nc_fp_cmp(single_a, single_b);
- frame->tf_spsr = (frame->tf_spsr & ~0xf0000000) | (single_result & 0xf0000000);
- return(0);
-}
-
-
-/*
- * int fpe_cnf(fp_op_data_t *op, trapframe_t *frame)
- *
- * CNF - FP compare negated
- */
-
-int
-fpe_cnf(op, frame)
- fp_op_data_t *op;
- trapframe_t *frame;
-{
- fpe_qreg_t real0 = *(fpe_qreg_t *)&fpregs[8];
- fpe_qreg_t real1 = *(fpe_qreg_t *)&fpregs[op->fpregn];
- fpe_qreg_t real2 = *(fpe_qreg_t *)&fpregs[op->fpregm];
- u_int32_t single_a, single_b, single_result;
-
- FPP_INC(FPP_CNF);
- PRINTF(("CNF prec=%d rnd=%d rd=%d fn=%d fm=%d\n",
- op->precision, op->rounding, op->regd, op->fpregn, op->fpregm));
-
- fpetos(&single_a, (fpe_reg_t *) &real0);
- fpetos(&single_b, (fpe_reg_t *) &real2);
- single_b = nc_fp_sub(single_a, single_b);
-
- fpetos(&single_a, (fpe_reg_t *) &real1);
- single_result = nc_fp_cmp(single_a, single_b);
- frame->tf_spsr = (frame->tf_spsr & ~0xf0000000) | (single_result & 0xf0000000);
- return(0);
-}
-
-
-/*
- * int fpe_ldfstf(unsigned in instruction, trapframe_t *frame)
- *
- * LDF/STF - Load / store FP registers to / from memory
- */
-
-
-int
-fpe_ldfstf(instruction, frame)
- unsigned int instruction;
- trapframe_t *frame;
-{
- unsigned int *regs = &frame->tf_r0;
- int offset;
- int fpreg;
- int reg;
- u_int32_t address;
- int precision;
- int error = 0;
-
- offset = (instruction & 0xff) << 2;
-
- fpreg = (instruction >> 12) & 0x07;
- reg = (instruction >> 16) & 0x0f;
- precision = ((instruction & (1<<22)) ? 2 : 0)
- | ((instruction & (1<<15)) ? 1 : 0);
-
- if (!(instruction & (1<<23)))
- offset = -offset;
-
- if (reg == 15)
- printf("WARNING: LDF/STF using r15\n");
-
- address = regs[reg];
-
- if ((instruction & (1<<24)))
- address += offset;
-
- if (!(instruction & (1 << 20))) {
- PRINTF(("STF rd=%d fd=%d prec=%d offset=%d address = %08x\n",
- reg, fpreg, precision, offset, address));
-
- switch(precision) {
- case 0 :
- FPP_INC(FPP_STRS);
- error = fpetos((u_int32_t *)address, &fpregs[fpreg]);
- break;
- case 1 :
- FPP_INC(FPP_STRD);
- error = fpetod((u_int32_t *)address, &fpregs[fpreg]);
- break;
- case 2 :
- FPP_INC(FPP_STRE);
- error = fpetoe((u_int32_t *)address, &fpregs[fpreg]);
- break;
- case 3 :
- FPP_INC(FPP_STRP);
- error = fpetop((u_int32_t *)address, &fpregs[fpreg]);
- break;
- }
- } else {
- PRINTF(("LDF rd=%d fd=%d prec=%d offset=%d address = %08x\n",
- reg, fpreg, precision, offset, address));
-
- switch(precision) {
- case 0 :
- FPP_INC(FPP_LDRS);
- error = stofpe((u_int32_t *)address, &fpregs[fpreg]);
- break;
- case 1 :
- FPP_INC(FPP_LDRD);
- error = dtofpe((u_int32_t *)address, &fpregs[fpreg]);
- break;
- case 2 :
- FPP_INC(FPP_LDRE);
- error = etofpe((u_int32_t *)address, &fpregs[fpreg]);
- break;
- case 3 :
- FPP_INC(FPP_LDRP);
- error = ptofpe((u_int32_t *)address, &fpregs[fpreg]);
- break;
- }
- }
-
- if (!(instruction & (1<<24)))
- address += offset;
-
- if ((instruction & (1<<21)))
- regs[reg] = address;
-
- return(error);
-}
-
-
-/* Debugging functions */
-
-int
-fpe_dump()
-{
- int loop;
-
- for (loop = 0; loop < 8; loop+=2) {
- PRINTF(("f%2d : %08x %08x %08x f%2d : %08x %08x %08x\n",
- loop, fpregs[loop].mantissa_hi,
- fpregs[loop].mantissa_lo, fpregs[loop].exponent,
- loop+1, fpregs[loop+1].mantissa_hi,
- fpregs[loop+1].mantissa_lo, fpregs[loop+1].exponent));
- }
- PRINTF(("\x1b[0mFPSR=%08x FPCR=%08x\n", fpe_status, fpe_control));
- return(0);
-}
-
-
-#ifdef FPE_PROF
-void
-fpe_dump_prof()
-{
- printf("adf : %6d\n", fp_profile[FPP_ADD]);
- printf("suf : %6d\n", fp_profile[FPP_SUB]);
- printf("muf : %6d\n", fp_profile[FPP_MUL]);
- printf("dvf : %6d\n", fp_profile[FPP_DIV]);
- printf("cmf : %6d\n", fp_profile[FPP_CMF]);
- printf("cnf : %6d\n", fp_profile[FPP_CNF]);
- printf("fix : %6d\n", fp_profile[FPP_FIX]);
- printf("flt : %6d\n", fp_profile[FPP_FLT]);
- printf("abs : %6d\n", fp_profile[FPP_ABS]);
- printf("mvf : %6d\n", fp_profile[FPP_MOV]);
- printf("mnf : %6d\n", fp_profile[FPP_MVN]);
- printf("rdf : %6d\n", fp_profile[FPP_RDV]);
- printf("rsf : %6d\n", fp_profile[FPP_RSB]);
- printf("strs: %6d\n", fp_profile[FPP_STRS]);
- printf("strd: %6d\n", fp_profile[FPP_STRD]);
- printf("stre: %6d\n", fp_profile[FPP_STRE]);
- printf("strp: %6d\n", fp_profile[FPP_STRP]);
- printf("ldrs: %6d\n", fp_profile[FPP_LDRS]);
- printf("ldrd: %6d\n", fp_profile[FPP_LDRD]);
- printf("ldre: %6d\n", fp_profile[FPP_LDRE]);
- printf("ldrp: %6d\n", fp_profile[FPP_LDRP]);
-}
-#else
-void
-fpe_dump_prof()
-{
- printf("kernel not compiled with FPE profiling\n");
-}
-#endif
-
-/* End of fpe.c */
diff --git a/sys/arch/arm32/fpe-sp/fpeadd.S b/sys/arch/arm32/fpe-sp/fpeadd.S
deleted file mode 100644
index 395c4419679..00000000000
--- a/sys/arch/arm32/fpe-sp/fpeadd.S
+++ /dev/null
@@ -1,121 +0,0 @@
-/* $NetBSD: fpeadd.S,v 1.2 1996/03/18 19:58:12 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- * Copyright (c) 1995 Neil Carson.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD kernel team.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * fpeadd.S
- *
- * FP addition
- *
- * Created : 11/02/95
- */
-
-/* std. registers
- */
-sp .req r13
-lr .req r14
-pc .req r15
-
-
-.global _nc_fp_add
-
-mant1 .req r2
-xp1 .req r3
-mant2 .req r4
-xp2 .req r5
-wrk1 .req r14
-
-_nc_fp_add:
- stmfd r13!,{r2-r5,r14}
- mov xp1,r0,lsr #23 /* get exponent+sign */
- bic mant1,r0,xp1,lsl #23 /* get mantissa */
- cmp r0,#0
- orrne mant1,mant1,#1<<23 /* set on bit to left of point */
- and xp1,xp1,#255 /* remove sign */
-
- mov xp2,r1,lsr #23 /* get exponent+sign */
- bic mant2,r1,xp2,lsl #23 /* get mantissa */
- cmp r1,#0
- orrne mant2,mant2,#1<<23 /* set on bit to left of point */
- and xp2,xp2,#255 /* remove sign */
-
- eors wrk1,r0,r1 /* both +ve/-ve? */
- bmi fp_add_neg /* no, unequal signs */
-
- subs wrk1,xp1,xp2 /* exp. difference */
- addpl mant1,mant1,mant2,lsr wrk1 /* xp1>exp2, round mant2 down */
- rsbmi wrk1,wrk1,#0 /* as +ve difference */
- addmi mant1,mant2,mant1,lsr wrk1 /* xp1<exp2, round mant1 down */
- movmi xp1,xp2 /* exponent of result */
- and r0,r0,#1<<31 /* set sign of result */
- /* normalise mantissa & exponent */
-fp_add_rounddown:
- cmp mant1,#1<<24
- blt fp_add_normexit
- add xp1,xp1,#1
- mov mant1,mant1,lsr #1
- b fp_add_rounddown
-
- /* r0 or r1 is -ve */
-fp_add_neg:
- subs wrk1,xp1,xp2 /* exp. difference */
- movpl mant2,mant2,lsr wrk1 /* exp1>xp2, round mant2 */
- rsbmi wrk1,wrk1,#0 /* as +ve difference */
- movmi mant1,mant1,lsr wrk1 /* exp1<exp2, round mant1 */
- movmi xp1,xp2 /* exponent of result */
-
- tst r0,#1<<31 /* r0 -ve? */
- subeq mant1,mant1,mant2 /* no, r0=r0-r1 */
- subne mant1,mant2,mant1 /* yes, r0=r1-r0 */
- cmp mant1,#0
- rsbmi mant1,mant1,#0 /* +ve mantissa */
- movmi r0,#1<<31 /* -ve result */
- movpl r0,#0 /* +ve result */
- /* normalise result - adjust mantissa & exponent */
- cmp mant1,#0 /* check for 0 - special case */
- moveq r0,#0
- beq fp_add_exit
-fp_add_roundup:
- tst mant1,#1<<23
- bne fp_add_normexit
- sub xp1,xp1,#1
- mov mant1,mant1,lsl #1
- b fp_add_roundup
- /* combine result */
-fp_add_normexit:
- orr r0,r0,xp1,lsl #23 /* set exponent */
- bic mant1,mant1,#1<<23 /* clear hi-order */
- orr r0,r0,mant1 /* full result */
-fp_add_exit:
- ldmfd r13!,{r2-r5,pc}
diff --git a/sys/arch/arm32/fpe-sp/fpecmf.S b/sys/arch/arm32/fpe-sp/fpecmf.S
deleted file mode 100644
index 088c5b23781..00000000000
--- a/sys/arch/arm32/fpe-sp/fpecmf.S
+++ /dev/null
@@ -1,67 +0,0 @@
-/* $NetBSD: fpecmf.S,v 1.2 1996/03/18 19:58:13 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- * Copyright (c) 1995 Neil Carson.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD kernel team.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * fpecmf.S
- *
- * FP compare
- *
- * Created : 11/02/95
- */
-
-pc .req r15
-
-/* compare r0 with r1. sets status bits (in arm!) for result.*/
-
- .global _nc_fp_cmp
-
-_nc_fp_cmp:
- cmp r1,#0 /* r1 -ve? */
- bmi fp_cmp_r0
- cmp r0,r1 /* no - do normal cmp */
- mrs r0, cpsr_all
- mov pc, r14
-fp_cmp_r0:
- cmp r0,#0 /* r0 -ve? */
- bmi fp_cmp_neg /* r0 & r1 -ve */
- cmp r0,r1
- mrs r0, cpsr_all
- mov pc, r14
-fp_cmp_neg:
- cmp r1,r0 /* opposite compare */
-
- mrs r0, cpsr_all
- mov pc, r14
-
diff --git a/sys/arch/arm32/fpe-sp/fpediv.S b/sys/arch/arm32/fpe-sp/fpediv.S
deleted file mode 100644
index 330d47fd64c..00000000000
--- a/sys/arch/arm32/fpe-sp/fpediv.S
+++ /dev/null
@@ -1,99 +0,0 @@
-/* $NetBSD: fpediv.S,v 1.2 1996/03/18 19:58:14 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- * Copyright (c) 1995 Neil Carson.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD kernel team.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * fpediv.S
- *
- * FP divide
- *
- * Created : 11/02/95
- */
-
-.global _nc_fp_div
-
-pc .req r15
-
-mant1 .req r2
-xp1 .req r3
-mant2 .req r4
-xp2 .req r14
-q .req r1
-p .req r14
-
-_nc_fp_div:
- stmfd r13!,{r2-r4,r14}
- /* check for null result */
- cmp r0,#0
- cmpne r1,#0
- moveq r0,#0
- beq fp_div_exit
-
- mov xp1,r0,lsr #23 /* get exponent+sign */
- bic mant1,r0,xp1,lsl #23 /* get mantissa */
- orr mant1,mant1,#1<<23 /* set on bit to left of point */
- and xp1,xp1,#255 /* remove sign */
-
- mov xp2,r1,lsr #23 /* get exponent+sign */
- bic mant2,r1,xp2,lsl #23 /* get mantissa */
- orr mant2,mant2,#1<<23 /* set on bit to left of point */
- and xp2,xp2,#255 /* remove sign */
-
- sub xp1,xp1,xp2
- adds xp1,xp1,#127 /* exponent result */
- movmi r0,#0 /* underflow */
- bmi fp_div_exit
- eor r0,r0,r1 /* sign of result */
- and r0,r0,#1<<31 /* clear rest of result */
- /* do the divide to full precision */
- mov q,#0 /* quotient */
- mov p,#1<<23 /* number binary places to do */
-fp_divloop: /* do binary places */
- cmp mant1,mant2 /* number>divisor? */
- orrcs q,q,p /* yes - set bit in binary place */
- subcs mant1,mant1,mant2 /* discard accounted value */
- movs mant1,mant1,lsl #1 /* shift up remainder, if any */
- movnes p,p,lsr#1 /* next binary place, if remainder */
- bne fp_divloop /* next place if any */
-
- cmp q,#1<<23 /* normalise? */
- sublt xp1,xp1,#1 /* yes, adjust exponent */
- movlt q,q,lsl #1 /* & mantissa */
- /* combine result */
- orr r0,r0,xp1,lsl #23 /* set exponent */
- bic q,q,#1<<23 /* clear hi-order */
- orr r0,r0,q /* result */
-fp_div_exit:
- ldmfd r13!,{r2-r4,pc}
-
diff --git a/sys/arch/arm32/fpe-sp/fpefix.S b/sys/arch/arm32/fpe-sp/fpefix.S
deleted file mode 100644
index 95c7c20f5ac..00000000000
--- a/sys/arch/arm32/fpe-sp/fpefix.S
+++ /dev/null
@@ -1,72 +0,0 @@
-/* $NetBSD: fpefix.S,v 1.2 1996/03/18 19:58:15 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- * Copyright (c) 1995 Neil Carson.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD kernel team.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * fpefix.S
- *
- * FP register to integer
- *
- * Created : 11/02/95
- */
-
-/* std. registers
- */
-sp .req r13
-lr .req r14
-pc .req r15
-
-
-mant1 .req r0
-xp1 .req r1
-
- .global _nc_fp_fix
-
-_nc_fp_fix:
- cmp r0,#0
- moveq pc,r14
- mov xp1,r0,lsr #23
- bic mant1,r0,xp1,lsl #23
- orr mant1,mant1,#1<<23
- tst xp1,#1<<8
- rsbne mant1,mant1,#0
- bic xp1,xp1,#1<<8
- subs xp1,xp1,#127
- movmi r0,#0
- movmi pc,r14
- rsbs xp1,xp1,#23
- movpl mant1,mant1,asr xp1
- rsbmi xp1,xp1,#0
- movmi mant1,mant1,asl xp1
- mov pc,r14
diff --git a/sys/arch/arm32/fpe-sp/fpemul.S b/sys/arch/arm32/fpe-sp/fpemul.S
deleted file mode 100644
index 43c4f23365b..00000000000
--- a/sys/arch/arm32/fpe-sp/fpemul.S
+++ /dev/null
@@ -1,99 +0,0 @@
-/* $NetBSD: fpemul.S,v 1.2 1996/03/18 19:58:16 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- * Copyright (c) 1995 Neil Carson.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD kernel team.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * fpemul.S
- *
- * FP multiply
- *
- * Created : 11/02/95
- */
-
-.global _nc_fp_mul
-
-pc .req r15
-
-mant1 .req r2
-xp1 .req r3
-mant2 .req r1
-xp2 .req r4
-wrk1 .req r14
-reshigh .req r4
-
-_nc_fp_mul:
- stmfd r13!,{r2-r4,r14}
- /* check for null result - bloody lucky but you never know... */
- cmp r0,#0
- cmpne r1,#0
- moveq r0,#0
- beq fp_mul_exit
-
- mov xp1,r0,lsr #23 /* get exponent+sign */
- bic mant1,r0,xp1,lsl #23 /* get mantissa */
- orr mant1,mant1,#1<<23 /* set on bit to left of point */
- and xp1,xp1,#255 /* remove sign */
-
- eor r0,r0,r1 /* sign of result */
- and r0,r0,#1<<31 /* clear rest of result */
-
- mov xp2,r1,lsr #23 /* get exponent+sign */
- bic mant2,r1,xp2,lsl #23 /* get mantissa */
- orr mant2,mant2,#1<<23 /* set on bit to left of point */
- and xp2,xp2,#255 /* remove sign */
-
- add xp1,xp1,xp2
- subs xp1,xp1,#127 /* exponent result */
- movmi r0,#0 /* underflow */
- bmi fp_mul_exit
- /* do the multiply to 30 bits precision */
- mov wrk1,mant1,lsr#9 /* top 15 bits */
- mov reshigh,mant2,lsr#9 /* top 15 bits */
- bic mant1,mant1,wrk1,lsl#9 /* low 9 bits */
- bic mant2,mant2,reshigh,lsl#9 /* low 9 bits */
- mul mant2,wrk1,mant2 /* top*low */
- mul mant1,reshigh,mant1 /* low*top */
- mul reshigh,wrk1,reshigh /* top*top */
- add reshigh,reshigh,mant1,lsr#9 /* top + middle bit1 */
- add reshigh,reshigh,mant2,lsr#9 /* top + middle bit2 */
- /* adjust for carry */
- tst reshigh,#1<<29
- addne xp1,xp1,#1 /* adjust exponent */
- movne reshigh,reshigh,lsr#1 /* shift result right */
- /* combine result */
- orr r0,r0,xp1,lsl #23 /* set exponent */
- bic reshigh,reshigh,#1<<28 /* clear hi-order */
- orr r0,r0,reshigh,lsr #5 /* top 23 bits */
-fp_mul_exit:
- ldmfd r13!,{r2-r4,pc}
diff --git a/sys/arch/arm32/fpe-sp/fpesub.S b/sys/arch/arm32/fpe-sp/fpesub.S
deleted file mode 100644
index c1f62b03703..00000000000
--- a/sys/arch/arm32/fpe-sp/fpesub.S
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $NetBSD: fpesub.S,v 1.2 1996/03/18 19:58:18 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- * Copyright (c) 1995 Neil Carson.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD kernel team.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * fpesub.S
- *
- * FP subtract
- *
- * Created : 11/02/95
- */
-
-.global _nc_fp_sub
-
-pc .req r15
-
-mant1 .req r2
-xp1 .req r3
-mant2 .req r4
-xp2 .req r5
-wrk1 .req r14
-
-_nc_fp_sub:
- stmfd r13!,{r2-r5,r14}
- mov xp1,r0,lsr #23 /* get exponent+sign */
- bic mant1,r0,xp1,lsl #23 /* get mantissa */
- cmp r0,#0
- orrne mant1,mant1,#1<<23 /* set on bit to left of point */
- and xp1,xp1,#255 /* remove sign */
-
- mov xp2,r1,lsr #23 /* get exponent+sign */
- bic mant2,r1,xp2,lsl #23 /* get mantissa */
- cmp r1,#0
- orrne mant2,mant2,#1<<23 /* set on bit to left of point */
- and xp2,xp2,#255 /* remove sign */
-
- eors wrk1,r0,r1 /* both +ve/-ve? */
- bmi fp_sub_unequal /* no - special case */
-
- subs wrk1,xp1,xp2 /* exp. difference */
- subpl mant1,mant1,mant2,lsr wrk1 /* exp1>exp2, round mant2 & subtract */
- rsbmi wrk1,wrk1,#0 /* as +ve difference */
- rsbmi mant1,mant2,mant1,lsr wrk1 /* exp1<exp2, round mant1 & subtract */
- movmi xp1,xp2 /* exponent of result */
- and r0,r0,#1<<31 /* default sign of result */
- cmp mant1,#0 /* flip sign? */
- rsbmi mant1,mant1,#0 /* yes - flip mantissa */
- eormi r0,r0,#1<<31 /* and final sign */
- /* normalise result - adjust mantissa & exponent */
- cmp mant1,#0 /* check for 0 - special case */
- moveq r0,#0
- beq fp_sub_exit
-fp_sub_roundup:
- tst mant1,#1<<23
- bne fp_sub_normexit
- sub xp1,xp1,#1
- mov mant1,mant1,lsl #1
- b fp_sub_roundup
-
- /* r0 & r1 have different signs - add */
-fp_sub_unequal:
- subs wrk1,xp1,xp2 /* exp. difference */
- addpl mant1,mant1,mant2,lsr wrk1 /* exp1>exp2, round mant2 & add */
- rsbmi wrk1,wrk1,#0 /* as +ve difference */
- addmi mant1,mant2,mant1,lsr wrk1 /* exp1<exp2, round mant1 & add */
- movmi xp1,xp2 /* exponent of result */
- and r0,r0,#1<<31 /* sign of result */
- /* normalise result - adjust mantissa & exponent */
-fp_sub_rounddown:
- cmp mant1,#1<<24
- blt fp_sub_normexit
- add xp1,xp1,#1
- mov mant1,mant1,lsr #1
- b fp_sub_rounddown
- /* combine result */
-fp_sub_normexit:
- orr r0,r0,xp1,lsl #23 /* set exponent */
- bic mant1,mant1,#1<<23 /* clear hi-order */
- orr r0,r0,mant1 /* full result */
-fp_sub_exit:
- ldmfd r13!,{r2-r5,pc}
-
diff --git a/sys/arch/arm32/fpe-sp/fpetoe.S b/sys/arch/arm32/fpe-sp/fpetoe.S
deleted file mode 100644
index ba5ca1e2673..00000000000
--- a/sys/arch/arm32/fpe-sp/fpetoe.S
+++ /dev/null
@@ -1,62 +0,0 @@
-/* $NetBSD: fpetoe.S,v 1.2 1996/03/18 19:58:19 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- * Copyright (c) 1995 Neil Carson.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD kernel team.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * fpetoe.S
- *
- * optimised functions for coping extended precision registers
- *
- * Created : 11/02/95
- */
-
-lr .req r14
-pc .req r15
-
- .text
- .align 0
- .global _etofpe
-_etofpe:
- ldmia r0, {r0, r2-r3}
- stmia r1, {r0, r2-r3}
- mov r0, #0
- mov pc, r14
-
- .align 0
- .global _fpetoe
-_fpetoe:
- ldmia r1, {r1, r2-r3}
- stmia r0, {r1, r2-r3}
- mov r0, #0
- mov pc, r14
diff --git a/sys/arch/arm32/include/ansi.h b/sys/arch/arm32/include/ansi.h
deleted file mode 100644
index 95fd820ba5d..00000000000
--- a/sys/arch/arm32/include/ansi.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* $NetBSD: ansi.h,v 1.4 1996/11/15 22:38:49 jtc Exp $ */
-
-/*
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)ansi.h 8.2 (Berkeley) 1/4/94
- */
-
-#ifndef _ANSI_H_
-#define _ANSI_H_
-
-/*
- * Types which are fundamental to the implementation and may appear in
- * more than one standard header are defined here. Standard headers
- * then use:
- * #ifdef _BSD_SIZE_T_
- * typedef _BSD_SIZE_T_ size_t;
- * #undef _BSD_SIZE_T_
- * #endif
- */
-#define _BSD_CLOCK_T_ unsigned long /* clock() */
-#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */
-#define _BSD_SIZE_T_ unsigned int /* sizeof() */
-#define _BSD_SSIZE_T_ int /* byte count or error */
-#define _BSD_TIME_T_ int /* time() */
-#define _BSD_VA_LIST_ char * /* va_list */
-#define _BSD_CLOCKID_T_ int
-#define _BSD_TIMER_T_ int
-
-/*
- * Runes (wchar_t) is declared to be an ``int'' instead of the more natural
- * ``unsigned long'' or ``long''. Two things are happening here. It is not
- * unsigned so that EOF (-1) can be naturally assigned to it and used. Also,
- * it looks like 10646 will be a 31 bit standard. This means that if your
- * ints cannot hold 32 bits, you will be in trouble. The reason an int was
- * chosen over a long is that the is*() and to*() routines take ints (says
- * ANSI C), but they use _RUNE_T_ instead of int. By changing it here, you
- * lose a bit of ANSI conformance, but your programs will still work.
- *
- * Note that _WCHAR_T_ and _RUNE_T_ must be of the same type. When wchar_t
- * and rune_t are typedef'd, _WCHAR_T_ will be undef'd, but _RUNE_T remains
- * defined for ctype.h.
- */
-#define _BSD_WCHAR_T_ int /* wchar_t */
-#define _BSD_WINT_T_ int /* wint_t */
-#define _BSD_RUNE_T_ int /* rune_t */
-
-/*
- * We describe off_t here so its declaration can be visible to
- * stdio without pulling in all of <sys/type.h>, thus appeasing ANSI.
- */
-#define _BSD_OFF_T_ long long /* file offset */
-
-#endif /* _ANSI_H_ */
diff --git a/sys/arch/arm32/include/asm.h b/sys/arch/arm32/include/asm.h
deleted file mode 100644
index fab79a2bbd7..00000000000
--- a/sys/arch/arm32/include/asm.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* $NetBSD: asm.h,v 1.2 1996/03/14 23:11:03 mark Exp $ */
-
-/*
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)asm.h 5.5 (Berkeley) 5/7/91
- */
-
-#ifndef _ARM32_ASM_H_
-#define _ARM32_ASM_H_
-
-#ifdef PROF
-/*
- * XXX assumes that arguments are not passed in %eax
- */
-# define _BEGIN_ENTRY /*.data; 1:; .long 0;*/ .text; .align 0
-# define _END_ENTRY /*movl $1b,%eax; call PIC_PLT(mcount)*/
-#else
-# define _BEGIN_ENTRY .text; .align 0
-# define _END_ENTRY
-#endif
-
-#ifdef __STDC__
-# define _C_FUNC(x) _ ## x
-#else
-# define _C_FUNC(x) _/**/x
-#endif
-#define _ASM_FUNC(x) x
-
-#define _ENTRY(x) .globl x; /*.type x,@function;*/ x:
-
-#define ENTRY(y) _BEGIN_ENTRY; _ENTRY(_C_FUNC(y)); _END_ENTRY
-#define TWOENTRY(y,z) _BEGIN_ENTRY; _ENTRY(_C_FUNC(y)); _ENTRY(_C_FUNC(z)); \
- _END_ENTRY
-#define ASENTRY(y) _BEGIN_ENTRY; _ENTRY(_ASM_FUNC(y)); _END_ENTRY
-
-#define ASMSTR .asciz
-
-#define RCSID(x) .text; .asciz x
-
-#endif /* !_ARM_ASM_H_ */
diff --git a/sys/arch/arm32/include/beep.h b/sys/arch/arm32/include/beep.h
deleted file mode 100644
index 64fcd37f590..00000000000
--- a/sys/arch/arm32/include/beep.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* $NetBSD: beep.h,v 1.2 1996/03/14 23:11:04 mark Exp $ */
-
-/*
- * Copyright (c) Mark Brinicombe 1995 All rights reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD team.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/types.h>
-
-struct wavebuffer {
- caddr_t addr;
- int size;
-};
-
-#define BEEP_GENERATE _IO ( 'B', 100)
-#define BEEP_SETRATE _IO ( 'B', 101)
-#define BEEP_SET _IOW ( 'B', 102, struct wavebuffer )
-
-/* End of beep.h */
diff --git a/sys/arch/arm32/include/bootconfig.h b/sys/arch/arm32/include/bootconfig.h
deleted file mode 100644
index d7acfddc042..00000000000
--- a/sys/arch/arm32/include/bootconfig.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* $NetBSD: bootconfig.h,v 1.2 1996/03/14 23:11:06 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * bootconfig.h
- *
- * boot configuration structure
- *
- * Created : 12/09/94
- *
- * Based on kate/boot/bootconfig.h
- */
-
-typedef struct _PhysMem {
- u_int address;
- u_int pages;
-} PhysMem;
-
-typedef struct _BootConfig {
- u_int kernvirtualbase;
- u_int kernphysicalbase;
- u_int kernsize;
- u_int argvirtualbase;
- u_int argphysicalbase;
- u_int argsize;
- u_int scratchvirtualbase;
- u_int scratchphysicalbase;
- u_int scratchsize;
-
- u_int display_start;
- u_int display_size;
- u_int width;
- u_int height;
- u_int bitsperpixel;
-
- PhysMem dram[4];
- PhysMem vram[1];
-
- u_int dramblocks;
- u_int vramblocks;
- u_int pagesize;
- u_int drampages;
- u_int vrampages;
-
- char kernelname[80];
-
- u_int framerate;
- u_char machine_id[4];
-} BootConfig;
-
-#ifdef _KERNEL
-extern BootConfig bootconfig;
-#endif
-
-/* End of bootconfig.h */
diff --git a/sys/arch/arm32/include/cdefs.h b/sys/arch/arm32/include/cdefs.h
deleted file mode 100644
index 36ffac68bf3..00000000000
--- a/sys/arch/arm32/include/cdefs.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* $NetBSD: cdefs.h,v 1.1 1996/01/31 23:21:36 mark Exp $ */
-
-/*
- * Written by J.T. Conklin <jtc@wimsey.com> 01/17/95.
- * Public domain.
- */
-
-#ifndef _MACHINE_CDEFS_H_
-#define _MACHINE_CDEFS_H_
-
-#ifdef __STDC__
-#define _C_LABEL(x) _STRING(_ ## x)
-#else
-#define _C_LABEL(x) _STRING(_/**/x)
-#endif
-
-#ifdef __GNUC__
-#ifdef __STDC__
-#define __weak_reference(sym,alias) \
- __asm__(".stabs \"_" #alias "\",11,0,0,0"); \
- __asm__(".stabs \"_" #sym "\",1,0,0,0")
-#define __warn_references(sym,msg) \
- __asm__(".stabs \"" msg "\",30,0,0,0"); \
- __asm__(".stabs \"_" #sym "\",1,0,0,0")
-#else
-#define __weak_reference(sym,alias) \
- __asm__(".stabs \"_/**/alias\",11,0,0,0"); \
- __asm__(".stabs \"_/**/sym\",1,0,0,0")
-#define __warn_references(sym,msg) \
- __asm__(".stabs msg,30,0,0,0"); \
- __asm__(".stabs \"_/**/sym\",1,0,0,0")
-#endif
-#endif
-
-#endif /* !_MACHINE_CDEFS_H_ */
diff --git a/sys/arch/arm32/include/cpu.h b/sys/arch/arm32/include/cpu.h
deleted file mode 100644
index 3d79f4d7417..00000000000
--- a/sys/arch/arm32/include/cpu.h
+++ /dev/null
@@ -1,204 +0,0 @@
-/* $NetBSD: cpu.h,v 1.6 1996/04/02 21:45:25 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1996 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * cpu.h
- *
- * CPU specific symbols
- *
- * Created : 18/09/94
- *
- * Based on kate/katelib/arm6.h
- */
-
-#ifndef _ARM32_CPU_H_
-#define _ARM32_CPU_H_
-
-#ifndef _LOCORE
-#include <machine/frame.h>
-#endif
-#include <machine/psl.h>
-
-/*
- * If we are not an ARM6 then we MUST use late aborts as only the ARM6
- * supports early aborts.
- * For the ARM6 we will use early abort unless otherwise configured
- * This reduces the overheads of LDR/STR aborts and no correction is required.
- */
-
-#ifndef CPU_ARM6
-#define CPU_LATE_ABORTS
-#endif
-
-#define COPY_SIGCODE /* copy sigcode above user stack in exec */
-
-/*
- * ARM Process Status Register
- *
- * The picture in the ARM manuals looks like this:
- * 3 3 2 2 2
- * 1 0 9 8 7 8 7 6 5 4 0
- * +-------+---------------------------------------+-+-+-+---------+
- * | flags | reserved |I|F| |M M M M M|
- * |n z c v| | | | |4 3 2 1 0|
- * +-------+---------------------------------------+-+-+-+---------+
- */
-
-#define PSR_FLAGS 0xf0000000 /* flags */
-#define PSR_N_bit (1 << 31) /* negative */
-#define PSR_Z_bit (1 << 30) /* zero */
-#define PSR_C_bit (1 << 29) /* carry */
-#define PSR_V_bit (1 << 28) /* overflow */
-
-#define I32_bit (1 << 7)
-#define F32_bit (1 << 6)
-
-#define PSR_MODE 0x0000001f
-#define PSR_USR32_MODE 0x00000010
-#define PSR_FIQ32_MODE 0x00000011
-#define PSR_IRQ32_MODE 0x00000012
-#define PSR_SVC32_MODE 0x00000013
-#define PSR_ABT32_MODE 0x00000017
-#define PSR_UND32_MODE 0x0000001b
-
-#define CPU_ID_DESIGNER_MASK 0xff000000
-#define CPU_ID_ARM_LTD 0x41000000
-#define CPU_ID_DEC 0x44000000
-#define CPU_ID_MAKER_MASK 0x00ff0000
-#define CPU_ID_GPS 0x00560000
-#define CPU_ID_VLSI 0x00000000
-#define CPU_ID_CPU_MASK 0x0000fff0
-#define ID_ARM610 0x00000610
-#define ID_ARM700 0x00007000
-#define ID_ARM710 0x00007100
-#define ID_SARM110 0x0000a100
-#define CPU_ID_REVISION_MASK 0x0000000f
-
-#define CPU_CONTROL_MMU_ENABLE 0x0001
-#define CPU_CONTROL_AFLT_ENABLE 0x0002
-#define CPU_CONTROL_DC_ENABLE 0x0004
-#define CPU_CONTROL_WBUF_ENABLE 0x0008
-#define CPU_CONTROL_32BP_ENABLE 0x0010
-#define CPU_CONTROL_32BD_ENABLE 0x0020
-#define CPU_CONTROL_LABT_ENABLE 0x0040
-#define CPU_CONTROL_BEND_ENABLE 0x0080
-#define CPU_CONTROL_SYST_ENABLE 0x0100
-#define CPU_CONTROL_ROM_ENABLE 0x0200
-#define CPU_CONTROL_CPCLK 0x0400
-#define CPU_CONTROL_IC_ENABLE 0x1000
-
-/* StrongARM has separate instruction and data caches */
-
-#ifdef CPU_SA
-#define CPU_CONTROL_IDC_ENABLE (CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE)
-#else
-#define CPU_CONTROL_IDC_ENABLE CPU_CONTROL_DC_ENABLE
-#endif
-
-#define FAULT_TYPE_MASK 0x0f
-#define FAULT_USER 0x10
-
-#define FAULT_WRTBUF_0 0x00
-#define FAULT_WRTBUF_1 0x02
-#define FAULT_BUSERR_0 0x04
-#define FAULT_BUSERR_1 0x06
-#define FAULT_BUSERR_2 0x08
-#define FAULT_BUSERR_3 0x0a
-#define FAULT_ALIGN_0 0x01
-#define FAULT_ALIGN_1 0x03
-#define FAULT_BUSTRNL1 0x0c
-#define FAULT_BUSTRNL2 0x0e
-#define FAULT_TRANS_S 0x05
-#define FAULT_TRANS_P 0x07
-#define FAULT_DOMAIN_S 0x09
-#define FAULT_DOMAIN_P 0x0b
-#define FAULT_PERM_S 0x0d
-#define FAULT_PERM_P 0x0f
-
-#ifdef _LOCORE
-#define IRQdisable \
- stmfd sp!, {r0} ; \
- mrs r0, cpsr_all ; \
- orr r0, r0, #(I32_bit | F32_bit) ; \
- msr cpsr_all, r0 ; \
- ldmfd sp!, {r0}
-
-#define IRQenable \
- stmfd sp!, {r0} ; \
- mrs r0, cpsr_all ; \
- bic r0, r0, #(I32_bit | F32_bit) ; \
- msr cpsr_all, r0 ; \
- ldmfd sp!, {r0}
-
-#else
-#define IRQdisable SetCPSR(I32_bit | F32_bit, I32_bit | F32_bit);
-#define IRQenable SetCPSR(I32_bit | F32_bit, 0);
-#endif /* _LOCORE */
-
-/*
- * Return TRUE/FALSE (1/0) depending on whether the frame came from USR
- * mode or not.
- */
-
-#define CLKF_USERMODE(frame) ((frame->if_spsr & PSR_MODE) == PSR_USR32_MODE)
-
-#define CLKF_BASEPRI(frame) (1)
-
-#define CLKF_PC(frame) (frame->if_pc)
-
-/*#define CLKF_INTR(frame) ((frame->if_spsr & PSR_MODE) == PSR_IRQ32_MODE)*/
-
-/* Hack to treat FPE time as interrupt time so we can measure it */
-#define CLKF_INTR(frame) ((frame->if_spsr & PSR_MODE) == PSR_UND32_MODE)
-
-/*
- * definitions of cpu-dependent requirements
- * referenced in generic code
- */
-
-#define cpu_wait(p) /* nothing */
-
-/*
- * Notify the current process (p) that it has a signal pending,
- * process as soon as possible.
- */
-
-#define signotify(p) setsoftast()
-
-#endif /* _ARM32_CPU_H_ */
-
-/* End of cpu.h */
diff --git a/sys/arch/arm32/include/cpus.h b/sys/arch/arm32/include/cpus.h
deleted file mode 100644
index 26ca72ce899..00000000000
--- a/sys/arch/arm32/include/cpus.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/* $NetBSD: cpus.h,v 1.3 1996/03/14 23:11:08 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- * Copyright (c) 1995 Brini.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * cpus.h
- *
- * cpu device header file
- *
- * Created : 26/12/95
- */
-
-#ifndef _LOCORE
-#include <sys/param.h>
-#endif
-
-/* If hydra is defined then we take into consideration the slave CPU's available */
-
-#ifdef HYDRA
-#define MAX_CPUS 6
-#define MAX_SLAVE_CPUS 4
-#define MAX_FOREIGN_CPUS 1
-#else
-#define MAX_CPUS 2
-#define MAX_SLAVE_CPUS 0
-#define MAX_FOREIGN_CPUS 1
-#endif
-
-#define CPU_MASTER 0
-#define CPU_486 1
-#define CPU_SLAVE 2
-
-#define CPU_CLASS_NONE 0 /* No CPU */
-#define CPU_CLASS_ARM 1 /* ARM 6/7/8 */
-#define CPU_CLASS_SARM 2 /* Guess */
-#define CPU_CLASS_I486 3 /* 486/586 */
-
-#define CPU_HOST_NONE 0 /* No host */
-#define CPU_HOST_MAINBUS 1 /* Hosted via motherboard */
-#define CPU_HOST_HYDRA 2 /* Hosted via hydra multiprocessor board */
-
-#define CPU_FLAG_PRESENT 0x01
-#define CPU_FLAG_HALTED 0x02
-
-#define FPU_CLASS_NONE 0 /* no Floating point support */
-#define FPU_CLASS_FPE 1 /* Floating point emulator installed */
-#define FPU_CLASS_FPA 2 /* Floating point accelerator installed */
-#define FPU_CLASS_FPU 3 /* Floating point unit installed */
-
-#define FPU_TYPE_SP_FPE 1 /* Single precision FPE */
-#define FPU_TYPE_ARMLTD_FPE 2 /* ARM Ltd FPE */
-#define FPU_TYPE_FPA11 0x81 /* ID of FPA11 */
-
-#ifndef _LOCORE
-
-/* Define the structure used to describe a cpu */
-
-typedef struct cpu_arm {
- u_int cpu_id; /* The CPU id */
- u_int cpu_ctrl; /* The CPU control register */
-
- u_int cpu_svc_r13; /* local data */
- u_int cpu_und_r13; /* local data */
- u_int cpu_abt_r13; /* local data */
- u_int cpu_irq_r13; /* local data */
-} cpu_arm_t;
-
-typedef struct cpu_sarm {
- u_int cpu_id; /* The CPU id */
- u_int cpu_ctrl; /* The CPU control register */
-} cpu_sarm_t;
-
-typedef struct cpu_i486 {
- u_int cpu_id; /* The CPU id */
- u_int cpu_ctrl; /* The CPU control register */
-} cpu_i486_t;
-
-
-typedef struct _cpu {
-/* These are generic CPU variables */
-
- u_int cpu_class; /* The CPU class */
- u_int cpu_type; /* The CPU type */
- u_int cpu_host; /* The CPU host interface */
- u_int cpu_flags; /* The CPU flags */
- char cpu_model[256]; /* Text description of CPU */
-
-/* These are generic FPU variables */
-
- u_int fpu_class; /* The FPU class */
- u_int fpu_type; /* The FPU type */
- u_int fpu_flags; /* The FPU flags */
- char fpu_model[256]; /* Text description of FPU */
-
-/* These are ARM specific variables */
-
- u_int cpu_id; /* The CPU id */
- u_int cpu_ctrl; /* The CPU control register */
-
- u_int cpu_svc_r13; /* local data */
- u_int cpu_und_r13; /* local data */
- u_int cpu_abt_r13; /* local data */
- u_int cpu_irq_r13; /* local data */
-
-/* Not used yet */
-
- union {
- cpu_arm_t cpu_arm;
- cpu_sarm_t cpu_sarm;
- cpu_i486_t cpu_i486;
- } cpu_local;
-} cpu_t;
-
-
-struct cpu_softc {
- struct device sc_device;
- int sc_open;
-};
-
-#ifdef _KERNEL
-
-/* Array of cpu structures, one per possible cpu */
-
-extern cpu_t cpus[MAX_CPUS];
-
-#endif /* _KERNEL */
-#endif /* _LOCORE */
-
-/* End of hydra.h */
diff --git a/sys/arch/arm32/include/db_machdep.h b/sys/arch/arm32/include/db_machdep.h
deleted file mode 100644
index 2000290856f..00000000000
--- a/sys/arch/arm32/include/db_machdep.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* $NetBSD: db_machdep.h,v 1.2 1996/03/06 23:16:54 mark Exp $ */
-
-/*
- * Copyright (c) 1996 Scott K Stevens
- *
- * Mach Operating System
- * Copyright (c) 1991,1990 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-
-#ifndef _ARM32_DB_MACHDEP_H_
-#define _ARM32_DB_MACHDEP_H_
-
-/*
- * Machine-dependent defines for new kernel debugger.
- */
-
-
-#include <vm/vm.h>
-#include <machine/frame.h>
-#include <machine/psl.h>
-#include <machine/reg.h>
-
-/* end of mangling */
-
-typedef vm_offset_t db_addr_t; /* address - unsigned */
-typedef int db_expr_t; /* expression - signed */
-
-typedef struct {
- trapframe_t ddb_tf;
-} db_regs_t;
-
-db_regs_t ddb_regs; /* register state */
-#define DDB_REGS (&ddb_regs)
-#define DDB_TF (&ddb_regs.ddb_tf)
-
-#define PC_REGS(regs) ((db_addr_t)(regs)->ddb_tf.tf_pc)
-
-#define BKPT_INST (0xe7ffffff) /* breakpoint instruction */
-#define BKPT_SIZE (4) /* size of breakpoint inst */
-#define BKPT_SET(inst) (BKPT_INST)
-
-/*#define db_clear_single_step(regs) (0)
-#define db_set_single_step(regs) (0)*/
-
-#define T_BREAKPOINT (1)
-
-#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BREAKPOINT)
-#define IS_WATCHPOINT_TRAP(type, code) (0)
-
-#define inst_trap_return(ins) ((ins)&0)
-#define inst_return(ins) ((ins)&0)
-#define inst_call(ins) (((ins) & 0x0f000000) == 0x0b000000)
-#define inst_branch(ins) (((ins) & 0x0f000000) == 0x0a000000)
-#define inst_load(ins) 0
-#define inst_store(ins) 0
-
-#define getreg_val (0)
-#define next_instr_address(pc, bd) (pc + 4)
-
-#define DB_MACHINE_COMMANDS
-
-#define SOFTWARE_SSTEP
-
-#endif /* _ARM32_DB_MACHDEP_H_ */
diff --git a/sys/arch/arm32/include/disklabel.h b/sys/arch/arm32/include/disklabel.h
deleted file mode 100644
index cdf8e09bb3f..00000000000
--- a/sys/arch/arm32/include/disklabel.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/* $NetBSD: disklabel.h,v 1.2 1996/03/06 23:17:51 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * disklabel.h
- *
- * machine specific disk label info
- *
- * Created : 04/10/94
- */
-
-#ifndef _ARM32_DISKLABEL_H_
-#define _ARM32_DISKLABEL_H_
-
-#define LABELSECTOR 1 /* sector containing label */
-#define LABELOFFSET 0 /* offset of label in sector */
-#define MAXPARTITIONS 8 /* number of partitions */
-#define RAW_PART 2 /* raw partition: XX?c */
-
-#define NRISCBSD_PARTITIONS MAXPARTITIONS
-
-#define PARTITION_TYPE_UNUSED 0
-#define PARTITION_TYPE_ADFS 1
-#define PARTITION_TYPE_RISCIX 2
-
-#define PARTITION_FORMAT_RISCIX 2
-#define PARTITION_FORMAT_RISCBSD 0x42
-
-#define FILECORE_BOOT_SECTOR 6
-
-/* Stuff to deal with RISCiX partitions */
-
-#define NRISCIX_PARTITIONS 8
-#define RISCIX_PARTITION_OFFSET 8
-
-struct riscix_partition {
- u_int rp_start;
- u_int rp_length;
- u_int rp_type;
- char rp_name[16];
-};
-
-struct riscix_partition_table {
- u_int pad0;
- u_int pad1;
- struct riscix_partition partitions[NRISCIX_PARTITIONS];
-};
-
-
-#include <sys/dkbad.h>
-
-struct riscbsd_partition {
- u_int rp_start;
- u_int rp_length;
- u_int rp_type;
- char rp_name[16];
-};
-
-struct cpu_disklabel {
- u_int pad0;
- u_int pad1;
- struct riscbsd_partition partitions[NRISCBSD_PARTITIONS];
- struct dkbad bad;
-};
-
-#define DKBAD(x) ((x)->bad)
-
-struct filecore_bootblock {
- u_char padding0[0x1c0];
- u_char log2secsize;
- u_char secspertrack;
- u_char heads;
- u_char density;
- u_char idlen;
- u_char log2bpmb;
- u_char skew;
- u_char bootoption;
- u_char lowsector;
- u_char nzones;
- u_short zone_spare;
- u_int root;
- u_int disc_size;
- u_short disc_id;
- u_char disc_name[10];
- u_int disc_type;
-
- u_char padding1[24];
-
- u_char partition_type;
- u_char partition_cyl_low;
- u_char partition_cyl_high;
- u_char checksum;
-};
-
-#endif /* _ARM32_DISKLABEL_H_ */
-
-/* End of disklabel.h */
diff --git a/sys/arch/arm32/include/endian.h b/sys/arch/arm32/include/endian.h
deleted file mode 100644
index ace03be3355..00000000000
--- a/sys/arch/arm32/include/endian.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* $OpenBSD: endian.h,v 1.6 1999/05/10 16:02:08 espie Exp $ */
-
-/*-
- * Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Niklas Hallqvist.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _ARM32_ENDIAN_H_
-#define _ARM32_ENDIAN_H_
-
-#define BYTE_ORDER LITTLE_ENDIAN
-#include <sys/endian.h>
-
-#endif /* _ARM32_ENDIAN_H_ */
diff --git a/sys/arch/arm32/include/exec.h b/sys/arch/arm32/include/exec.h
deleted file mode 100644
index 6225b1ce45a..00000000000
--- a/sys/arch/arm32/include/exec.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* $NetBSD: exec.h,v 1.2 1996/03/14 23:11:12 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD team.
- * 4. The name "RiscBSD" nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _ARM32_EXEC_H_
-#define _ARM32_EXEC_H_
-
-#define __LDPGSZ 4096
-
-/* Relocation format. */
-
-struct relocation_info_arm6 {
- int r_address; /* offset in text or data segment */
- unsigned int r_symbolnum : 24, /* ordinal number of add symbol */
- r_pcrel : 1, /* 1 if value should be pc-relative */
- r_length : 2, /* log base 2 of value's width */
- r_extern : 1, /* 1 if need to add symbol to value */
- r_baserel : 1, /* linkage table relative */
- r_jmptable : 1, /* relocate to jump table */
- r_relative : 1, /* load address relative */
- r_copy : 1; /* run time copy */
-};
-
-#define relocation_info relocation_info_arm6
-
-/* No special executable format */
-#define cpu_exec_aout_makecmds(a, b) ENOEXEC
-
-#define ARCH_ELFSIZE 32
-
-#define ELF_TARG_CLASS ELFCLASS32
-#define ELF_TARG_DATA ELFDATA2LSB
-#define ELF_TARG_MACH EM_ARM
-
-#define _NLIST_DO_AOUT
-
-#define _KERN_DO_AOUT
-
-#endif /* _ARM_EXEC_H_ */
diff --git a/sys/arch/arm32/include/float.h b/sys/arch/arm32/include/float.h
deleted file mode 100644
index c9fe666973c..00000000000
--- a/sys/arch/arm32/include/float.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* $NetBSD: float.h,v 1.2 1996/03/14 23:11:13 mark Exp $ */
-
-/*
- * Copyright (c) 1989 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)float.h 7.1 (Berkeley) 5/8/90
- */
-
-/*extern int __flt_rounds();*/
-#define FLT_RADIX 2 /* b */
-/*#define FLT_ROUNDS __flt_rounds()*/
-#define FLT_ROUNDS 1
-
-#define FLT_MANT_DIG 24 /* p */
-#define FLT_EPSILON 1.19209290E-07F /* b**(1-p) */
-#define FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */
-#define FLT_MIN_EXP (-125) /* emin */
-#define FLT_MIN 1.17549435E-38F /* b**(emin-1) */
-#define FLT_MIN_10_EXP (-37) /* ceil(log10(b**(emin-1))) */
-#define FLT_MAX_EXP 128 /* emax */
-#define FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */
-#define FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */
-
-#define DBL_MANT_DIG 53
-#define DBL_EPSILON 2.2204460492503131E-16
-#define DBL_DIG 15
-#define DBL_MIN_EXP (-1021)
-#define DBL_MIN 2.2250738585072014E-308
-#define DBL_MIN_10_EXP (-307)
-#define DBL_MAX_EXP 1024
-#define DBL_MAX 1.7976931348623157E+308
-#define DBL_MAX_10_EXP 308
-
-#define LDBL_MANT_DIG DBL_MANT_DIG
-#define LDBL_EPSILON DBL_EPSILON
-#define LDBL_DIG DBL_DIG
-#define LDBL_MIN_EXP DBL_MIN_EXP
-#define LDBL_MIN DBL_MIN
-#define LDBL_MIN_10_EXP DBL_MIN_10_EXP
-#define LDBL_MAX_EXP DBL_MAX_EXP
-#define LDBL_MAX DBL_MAX
-#define LDBL_MAX_10_EXP DBL_MAX_10_EXP
diff --git a/sys/arch/arm32/include/fp.h b/sys/arch/arm32/include/fp.h
deleted file mode 100644
index c32c9239c93..00000000000
--- a/sys/arch/arm32/include/fp.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $NetBSD: fp.h,v 1.2 1996/03/14 23:11:15 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- * Copyright (c) 1995 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * fp.h
- *
- * FP info
- *
- * Created : 10/10/95
- */
-
-#ifndef __ARM32_FP_H
-#define __ARM32_FP_H
-
-typedef struct {
- u_int32_t fp_exp;
- u_int32_t fp_man_hi;
- u_int32_t fp_man_lo;
-} fp_reg_t;
-
-struct fp_state {
- unsigned int fp_flags;
- unsigned int fp_sr;
- unsigned int fp_cr;
- fp_reg_t fp_registers[16];
-};
-
-#endif
-
-/* End of fp.h */
diff --git a/sys/arch/arm32/include/frame.h b/sys/arch/arm32/include/frame.h
deleted file mode 100644
index 60b06de6387..00000000000
--- a/sys/arch/arm32/include/frame.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/* $NetBSD: frame.h,v 1.3 1996/03/13 21:06:34 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1996 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * frame.h
- *
- * Stack frames structures
- *
- * Created : 30/09/94
- */
-
-#ifndef _ARM32_FRAME_H_
-#define _ARM32_FRAME_H_
-
-#include <sys/signal.h>
-
-/*
- * System stack frames.
- */
-
-typedef struct irqframe {
- unsigned int if_spsr;
- unsigned int if_r0;
- unsigned int if_r1;
- unsigned int if_r2;
- unsigned int if_r3;
- unsigned int if_r4;
- unsigned int if_r5;
- unsigned int if_r6;
- unsigned int if_r7;
- unsigned int if_r8;
- unsigned int if_r9;
- unsigned int if_r10;
- unsigned int if_r11;
- unsigned int if_r12;
- unsigned int if_usr_sp;
- unsigned int if_usr_lr;
- unsigned int if_svc_lr;
- unsigned int if_pc;
-} irqframe_t;
-
-#define clockframe irqframe
-
-typedef struct trapframe {
- unsigned int tf_spsr;
- unsigned int tf_r0;
- unsigned int tf_r1;
- unsigned int tf_r2;
- unsigned int tf_r3;
- unsigned int tf_r4;
- unsigned int tf_r5;
- unsigned int tf_r6;
- unsigned int tf_r7;
- unsigned int tf_r8;
- unsigned int tf_r9;
- unsigned int tf_r10;
- unsigned int tf_r11;
- unsigned int tf_r12;
- unsigned int tf_usr_sp;
- unsigned int tf_usr_lr;
- unsigned int tf_svc_lr;
- unsigned int tf_pc;
-} trapframe_t;
-
-/*
- * Signal frame
- */
-
-struct sigframe {
- int sf_signum;
- int sf_code;
- struct sigcontext *sf_scp;
- sig_t sf_handler;
- struct sigcontext sf_sc;
-};
-
-/*
- * Switch frame
- */
-
-struct switchframe {
- int sf_spl;
- u_int sf_r4;
- u_int sf_r5;
- u_int sf_r6;
- u_int sf_r7;
- u_int sf_pc;
-};
-
-/*
- * Stack frame. Used during stack traces (db_trace.c)
- */
-struct frame {
- u_int fr_fp;
- u_int fr_sp;
- u_int fr_lr;
- u_int fr_pc;
-};
-
-#ifdef _KERNEL
-void validate_trapframe __P((trapframe_t *, int));
-#endif /* _KERNEL */
-
-#endif /* _ARM32_FRAME_H_ */
-
-/* End of frame.h */
diff --git a/sys/arch/arm32/include/iic.h b/sys/arch/arm32/include/iic.h
deleted file mode 100644
index 837576f4c62..00000000000
--- a/sys/arch/arm32/include/iic.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* $NetBSD: iic.h,v 1.1 1996/04/19 19:52:46 mark Exp $ */
-
-/*
- * Copyright (c) 1996 Mark Brinicombe.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * iic.h
- *
- * header file for IIC
- *
- * Created : 15/04/96
- */
-
-/*
- * IIC bus driver attach arguments
- */
-
-#ifdef _KERNEL
-
-struct iicbus_attach_args {
- u_int ib_addr; /* i/o address */
- void *ib_aux; /* driver specific */
-};
-
-#define iic_bitdelay 10
-
-#define IIC_WRITE 0x00
-#define IIC_READ 0x01
-
-/* Prototypes for assembly functions */
-
-void iic_set_state __P((int data, int clock));
-void iic_set_state_and_ack __P((int data, int clock));
-void iic_delay __P((int delay));
-
-/* Prototype for kernel interface to IIC bus */
-
-int iic_control __P((u_char address, u_char *buffer, int count));
-
-#endif /* _KERNEL */
-
-/* End of iic.h */
diff --git a/sys/arch/arm32/include/io.h b/sys/arch/arm32/include/io.h
deleted file mode 100644
index 6b8ed7c7a7e..00000000000
--- a/sys/arch/arm32/include/io.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/* $NetBSD: io.h,v 1.3 1996/03/28 21:28:21 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * io.h
- *
- * IO registers
- *
- * Created : 10/10/94
- */
-
-/* Some of these addresses are frightening and need cleaning up */
-
-/*
- * The podule addresses should be removed and localised for the podules.
- * This is difficuly as the podule addresses are interleaved with the
- * other IO devices thus making it difficult to separate them.
- */
-
-#define IO_CONF_BASE 0xf6000000
-
-#define IO_HW_BASE 0x03000000
-
-#define IO_BASE 0xf6200000
-
-#define COMBO_BASE 0xf6210000
-
-#define IDE_CONTROLLER_BASE 0xf62107c0
-
-#define FLOPPY_CONTROLLER_BASE 0xf6210fc0
-
-#define FLOPPY_DACK 0x00002000
-
-#define SERIAL0_CONTROLLER_BASE 0xf6210fe0
-
-#define SERIAL1_CONTROLLER_BASE 0xf6210be0
-
-#define PARALLEL_CONTROLLER_BASE 0xf62109e0
-
-#define IO_MOUSE_BUTTONS 0xf6010000
-
-#ifdef RC7500
-
-#define IDE_CONTROLLER_BASE2 0xf622B000
-
-/*
- * a bit low turns attached LED on
- */
-#define LEDPORT (IO_BASE + 0x0002B060)
-#define LED0 0x01
-#define LED1 0x02
-#define LED2 0x04
-#define LED3 0x08
-#define LED4 0x10
-#define LED5 0x20
-#define LED6 0x40
-#define LED7 0x80
-#define LEDOFF 0x00
-#define LEDALL 0xFF
-#endif
-
-
-#define EASI_HW_BASE 0x08000000
-#define EASI_BASE 0xf8000000
-#define EASI_SIZE 0x01000000
-
-#define SIMPLE_PODULE_SIZE 0x00004000
-
-#define MOD_PODULE_BASE 0xf6200000
-#define SYNC_PODULE_BASE 0xf63c0000
-#define SYNC_PODULE_HW_BASE 0x033c0000
-#define FAST_PODULE_BASE 0xf6340000
-#define MEDIUM_PODULE_BASE 0xf60c0000
-#define SLOW_PODULE_BASE 0xf6040000
-
-#define PODULE_GAP 0x00020000
-#define MAX_PODULES 8
-
-#define NETSLOT_BASE 0xf622b000
-#define MAX_NETSLOTS 1
-
-#define MOUSE_BUTTON_RIGHT 0x10
-#define MOUSE_BUTTON_MIDDLE 0x20
-#define MOUSE_BUTTON_LEFT 0x40
-
-/* End of io.h */
diff --git a/sys/arch/arm32/include/iomd.h b/sys/arch/arm32/include/iomd.h
deleted file mode 100644
index 876c6df4749..00000000000
--- a/sys/arch/arm32/include/iomd.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/* $NetBSD: iomd.h,v 1.3 1996/03/28 21:26:05 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * iomd.h
- *
- * IOMD registers
- *
- * Created : 18/09/94
- *
- * Based on kate/display/iomd.h
- */
-
-#define IOMD_HW_BASE 0x03200000
-
-#define IOMD_BASE 0xf6000000
-
-#define IOMD_IOCR (IOMD_BASE + 0x00000000)
-#define IOMD_KBDDAT (IOMD_BASE + 0x00000004)
-#define IOMD_KBDCR (IOMD_BASE + 0x00000008)
-
-#define IOMD_IRQSTA (IOMD_BASE + 0x00000010)
-#define IOMD_IRQRQA (IOMD_BASE + 0x00000014)
-#define IOMD_IRQMSKA (IOMD_BASE + 0x00000018)
-#define IOMD_SUSPEND (IOMD_BASE + 0x0000001C) /* ARM7500 */
-
-#define IOMD_IRQSTB (IOMD_BASE + 0x00000020)
-#define IOMD_IRQRQB (IOMD_BASE + 0x00000024)
-#define IOMD_IRQMSKB (IOMD_BASE + 0x00000028)
-
-#define IOMD_FIQST (IOMD_BASE + 0x00000030)
-#define IOMD_FIQRQ (IOMD_BASE + 0x00000034)
-#define IOMD_FIQMSK (IOMD_BASE + 0x00000038)
-
-#define IOMD_T0LOW (IOMD_BASE + 0x00000040)
-#define IOMD_T0HIGH (IOMD_BASE + 0x00000044)
-#define IOMD_T0GO (IOMD_BASE + 0x00000048)
-#define IOMD_T0LATCH (IOMD_BASE + 0x0000004c)
-
-#define IOMD_T1LOW (IOMD_BASE + 0x00000050)
-#define IOMD_T1HIGH (IOMD_BASE + 0x00000054)
-#define IOMD_T1GO (IOMD_BASE + 0x00000058)
-#define IOMD_T1LATCH (IOMD_BASE + 0x0000005c)
-
-/*
- * For RC7500, it's not really a IOMD device.
- */
-#define IOMD_IRQSTC (IOMD_BASE + 0x00000060) /* ARM7500 */
-#define IOMD_IRQRQC (IOMD_BASE + 0x00000064) /* ARM7500 */
-#define IOMD_IRQMSKC (IOMD_BASE + 0x00000068) /* ARM7500 */
-#define IOMD_VIDMUX (IOMD_BASE + 0x0000006C) /* ARM7500 */
-
-#define IOMD_IRQSTD (IOMD_BASE + 0x00000070) /* ARM7500 */
-#define IOMD_IRQRQD (IOMD_BASE + 0x00000074) /* ARM7500 */
-#define IOMD_IRQMSKD (IOMD_BASE + 0x00000078) /* ARM7500 */
-
-#define IOMD_ROMCR0 (IOMD_BASE + 0x00000080)
-#define IOMD_ROMCR1 (IOMD_BASE + 0x00000084)
-#define IOMD_DRAMCR (IOMD_BASE + 0x00000088)
-#define IOMD_VREFCR (IOMD_BASE + 0x0000008c)
-#define IOMD_FSIZE (IOMD_BASE + 0x00000090)
-#define IOMD_ID0 (IOMD_BASE + 0x00000094)
-#define IOMD_ID1 (IOMD_BASE + 0x00000098)
-#define IOMD_VERSION (IOMD_BASE + 0x0000009c)
-
-#define IOMD_MOUSEX (IOMD_BASE + 0x000000a0)
-#define IOMD_MOUSEY (IOMD_BASE + 0x000000a4)
-
-#define IOMD_MSDATA (IOMD_BASE + 0x000000a8) /* ARM7500 */
-#define IOMD_MSCR (IOMD_BASE + 0x000000ac) /* ARM7500 */
-
-#define IOMD_IOTCR (IOMD_BASE + 0x000000C4) /* ARM7500 */
-#define IOMD_ECTCR (IOMD_BASE + 0x000000C8) /* ARM7500 */
-#define IOMD_ASTCR (IOMD_BASE + 0x000000CC) /* ARM7500 */
-
-#define IOMD_DRAMWID (IOMD_BASE + 0x000000D0) /* ARM7500 */
-#define IOMD_SELFREF (IOMD_BASE + 0x000000D4) /* ARM7500 */
-
-#define IOMD_ATODICR (IOMD_BASE + 0x000000E0) /* ARM7500 */
-#define IOMD_ATODSR (IOMD_BASE + 0x000000E4) /* ARM7500 */
-#define IOMD_ATODCR (IOMD_BASE + 0x000000E8) /* ARM7500 */
-#define IOMD_ATODCNT1 (IOMD_BASE + 0x000000EC) /* ARM7500 */
-#define IOMD_ATODCNT2 (IOMD_BASE + 0x000000F0) /* ARM7500 */
-#define IOMD_ATODCNT3 (IOMD_BASE + 0x000000F4) /* ARM7500 */
-#define IOMD_ATODCNT4 (IOMD_BASE + 0x000000F8) /* ARM7500 */
-
-#define IOMD_SD0CURA (IOMD_BASE + 0x00000180)
-#define IOMD_SD0ENDA (IOMD_BASE + 0x00000184)
-#define IOMD_SD0CURB (IOMD_BASE + 0x00000188)
-#define IOMD_SD0ENDB (IOMD_BASE + 0x0000018c)
-#define IOMD_SD0CR (IOMD_BASE + 0x00000190)
-#define IOMD_SD0ST (IOMD_BASE + 0x00000194)
-
-#define IOMD_SD1CURA (IOMD_BASE + 0x000001a0)
-#define IOMD_SD1ENDA (IOMD_BASE + 0x000001a4)
-#define IOMD_SD1CURB (IOMD_BASE + 0x000001a8)
-#define IOMD_SD1ENDB (IOMD_BASE + 0x000001ac)
-#define IOMD_SD1CR (IOMD_BASE + 0x000001b0)
-#define IOMD_SD1ST (IOMD_BASE + 0x000001b4)
-
-#define IOMD_CURSCUR (IOMD_BASE + 0x000001c0)
-#define IOMD_CURSINIT (IOMD_BASE + 0x000001c4)
-
-#define IOMD_VIDCUR (IOMD_BASE + 0x000001d0)
-#define IOMD_VIDEND (IOMD_BASE + 0x000001d4)
-#define IOMD_VIDSTART (IOMD_BASE + 0x000001d8)
-#define IOMD_VIDINIT (IOMD_BASE + 0x000001dc)
-#define IOMD_VIDCR (IOMD_BASE + 0x000001e0)
-
-#define IOMD_DMAST (IOMD_BASE + 0x000001f0)
-#define IOMD_DMARQ (IOMD_BASE + 0x000001f4)
-#define IOMD_DMAMSK (IOMD_BASE + 0x000001f8)
-
-#define IO_MOUSE_BUTTONS 0xf6010000
-
-#define MOUSE_BUTTON_RIGHT 0x10
-#define MOUSE_BUTTON_MIDDLE 0x20
-#define MOUSE_BUTTON_LEFT 0x40
-
-#define RPC600_IOMD_ID 0xd4e7
-#define RC7500_IOC_ID 0x5B98
-
-#define FREQCON (IOMD_BASE + 0x40000)
-
-/* End of iomd.h */
diff --git a/sys/arch/arm32/include/irqhandler.h b/sys/arch/arm32/include/irqhandler.h
deleted file mode 100644
index 3b506c9510a..00000000000
--- a/sys/arch/arm32/include/irqhandler.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* $NetBSD: irqhandler.h,v 1.4 1996/03/28 21:29:32 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1996 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * irq.h
- *
- * IRQ related stuff
- *
- * Created : 30/09/94
- */
-
-#include <sys/types.h>
-
-typedef struct irqhandler {
- int (*ih_func)(); /* handler function */
- void *ih_arg; /* Argument to handler */
- int ih_level; /* Interrupt level */
- int ih_num; /* Interrupt number (for accounting) */
- char *ih_name; /* Name of interrupt (for vmstat -i) */
- unsigned int ih_flags; /* Interrupt flags */
- unsigned int *ih_irqmask; /* mask location for expansion cards */
- unsigned int ih_irqbit; /* interrupt bit for expansion cards */
- struct irqhandler *ih_next; /* next handler */
-} irqhandler_t;
-
-#define IRQ_FLAG_ACTIVE 0x00000001 /* This is the active handler in list */
-
-/* Define the IRQ bits */
-
-
-
-#ifdef RC7500
-
-/*#define IRQ_PRINTER 0x00*/
-#define IRQ_RESERVED0 0x01
-#define IRQ_BUTTON 0x02
-#define IRQ_FLYBACK 0x03
-#define IRQ_POR 0x04
-#define IRQ_TIMER0 0x05
-#define IRQ_TIMER1 0x06
-#define IRQ_FIQDOWN 0x07
-
-#define IRQ_DREQ3 0x08
-/*#define IRQ_HD1 0x09*/
-/*#define IRQ_HD IRQ_HD1*/
-#define IRQ_DREQ2 0x0A
-#define IRQ_ETHERNET 0x0B
-/*#define IRQ_FLOPPY 0x0C*/
-/*#define IRQ_SERIAL 0x0D*/
-#define IRQ_KBDTX 0x0E
-#define IRQ_KBDRX 0x0F
-
-#define IRQ_IRQ3 0x10
-#define IRQ_IRQ4 0x11
-#define IRQ_IRQ5 0x12
-#define IRQ_IRQ6 0x13
-#define IRQ_IRQ7 0x14
-#define IRQ_IRQ9 0x15
-#define IRQ_IRQ10 0x16
-#define IRQ_HD2 0x17
-
-#define IRQ_MSDRX 0x18
-#define IRQ_MSDTX 0x19
-#define IRQ_ATOD 0x1A
-#define IRQ_CLOCK 0x1B
-#define IRQ_PANIC 0x1C
-#define IRQ_RESERVED2 0x1D
-#define IRQ_RESERVED3 0x1E
-#define IRQ_RESERVED1 IRQ_RESERVED2
-
-/*
- * Note that Sound DMA IRQ is on the 31st vector.
- * It's not part of the IRQD.
- */
-#define IRQ_SDMA 0x1F
-
-#else /* RC7500 */
-
-
-
-
-/*#define IRQ_PRINTER 0x00*/
-#define IRQ_RESERVED0 0x01
-/*#define IRQ_FLOPPYIDX 0x02*/
-#define IRQ_FLYBACK 0x03
-#define IRQ_POR 0x04
-#define IRQ_TIMER0 0x05
-#define IRQ_TIMER1 0x06
-#define IRQ_RESERVED1 0x07
-
-#define IRQ_RESERVED2 0x08
-/*#define IRQ_HD 0x09*/
-/*#define IRQ_SERIAL 0x0A*/
-#define IRQ_EXTENDED 0x0B
-/*#define IRQ_FLOPPY 0x0C*/
-#define IRQ_PODULE 0x0D
-#define IRQ_KBDTX 0x0E
-#define IRQ_KBDRX 0x0F
-
-#define IRQ_DMACH0 0x10
-#define IRQ_DMACH1 0x11
-#define IRQ_DMACH2 0x12
-#define IRQ_DMACH3 0x13
-#define IRQ_DMASCH0 0x14
-#define IRQ_DMASCH1 0x15
-#define IRQ_RESERVED3 0x16
-#define IRQ_RESERVED4 0x17
-
-#define IRQ_EXPCARD0 0x18
-#define IRQ_EXPCARD1 0x19
-#define IRQ_EXPCARD2 0x1A
-#define IRQ_EXPCARD3 0x1B
-#define IRQ_EXPCARD4 0x1C
-#define IRQ_EXPCARD5 0x1D
-#define IRQ_EXPCARD6 0x1E
-#define IRQ_EXPCARD7 0x1F
-
-#endif /* RC7500 */
-
-#define IRQ_VSYNC IRQ_FLYBACK /* Aliased */
-#define IRQ_NETSLOT IRQ_EXTENDED
-
-#define IRQ_SOFTNET IRQ_RESERVED0 /* Emulated */
-#define IRQMASK_SOFTNET (1 << IRQ_SOFTNET)
-#define IRQ_SOFTCLOCK IRQ_RESERVED1 /* Emulated */
-#define IRQMASK_SOFTCLOCK (1 << IRQ_SOFTCLOCK)
-
-#define IRQ_INSTRUCT -1
-#define NIRQS 0x20
-
-/* Define the various Interrupt Priority Levels */
-
-/* Interrupt Priority Levels are not mutually exclusive. */
-
-#define IPL_NONE -1
-#define IPL_BIO 0 /* block I/O */
-#define IPL_NET 1 /* network */
-#define IPL_TTY 2 /* terminal */
-#define IPL_CLOCK 3 /* clock */
-#define IPL_IMP 4 /* memory allocation */
-
-#define IRQ_LEVELS 5
-
-#ifdef _KERNEL
-extern u_int irqmasks[IRQ_LEVELS];
-
-void irq_init __P(());
-int irq_claim __P((int, irqhandler_t *));
-int irq_release __P((int, irqhandler_t *));
-void irq_setmasks __P((void));
-void disable_irq __P((int));
-void enable_irq __P((int));
-u_int enable_interrupts __P((u_int));
-u_int disable_interrupts __P((u_int));
-u_int restore_interrupts __P((u_int));
-#endif
-
-typedef struct fiqhandler {
- void (*fh_func)(); /* handler function */
- u_int fh_size; /* Size of handler function */
- u_int fh_mask; /* FIQ mask */
- u_int fh_r8; /* FIQ mode r8 */
- u_int fh_r9; /* FIQ mode r9 */
- u_int fh_r10; /* FIQ mode r10 */
- u_int fh_r11; /* FIQ mode r11 */
- u_int fh_r12; /* FIQ mode r12 */
- u_int fh_r13; /* FIQ mode r13 */
-} fiqhandler_t;
-
-#ifdef RC7500
-int fiq_claim __P((int, fiqhandler_t *));
-int fiq_release __P((int, fiqhandler_t *));
-#else
-int fiq_claim __P((fiqhandler_t *));
-int fiq_release __P((fiqhandler_t *));
-#endif
-
-/* End of irqhandler.h */
diff --git a/sys/arch/arm32/include/katelib.h b/sys/arch/arm32/include/katelib.h
deleted file mode 100644
index 3fe6f061d42..00000000000
--- a/sys/arch/arm32/include/katelib.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/* $NetBSD: katelib.h,v 1.5 1996/03/28 21:35:51 mark Exp $ */
-
-/*
- * Copyright (c) 1994,1995 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * katelib.h
- *
- * Prototypes for machine specific functions. Most of these
- * could be inlined.
- *
- * This should not really be a separate header file. Eventually I will merge
- * this into other header files once I have decided where the declarations
- * should go.
- *
- * Created : 18/09/94
- *
- * Based on kate/katelib/prototypes.h
- */
-
-#include <sys/types.h>
-
-#ifdef _KERNEL
-
-/* Assembly modules */
-
-/* In setcpsr.S */
-
-u_int SetCPSR __P((u_int, u_int));
-u_int GetCPSR __P((void));
-
-/* In coproc15.S */
-
-void tlbflush __P((void));
-void tlbpurge __P((u_int));
-void idcflush __P((void));
-void cpu_control __P((u_int));
-void cpu_domains __P((u_int));
-void setttb __P((u_int));
-
-u_int cpu_id __P((void));
-u_int cpu_faultstatus __P((void));
-u_int cpu_faultaddress __P((void));
-
-/* In setstack.S */
-
-void set_stackptr __P((u_int, u_int));
-u_int get_stackptr __P((u_int));
-
-/* In blockio.S */
-
-void insw __P((u_int /*io*/, u_int /*dest*/, u_int /*size*/));
-void outsw __P((u_int /*io*/, u_int /*src*/, u_int /*size*/));
-void insw16 __P((u_int /*io*/, u_int /*dest*/, u_int /*size*/));
-void outsw16 __P((u_int /*io*/, u_int /*src*/, u_int /*size*/));
-
-/* Macros for reading and writing words, shorts, bytes */
-
-#define WriteWord(a, b) \
-*((volatile unsigned int *)(a)) = (b)
-
-#define ReadWord(a) \
-(*((volatile unsigned int *)(a)))
-
-#define WriteShort(a, b) \
-*((volatile unsigned int *)(a)) = ((b) | ((b) << 16))
-
-#define ReadShort(a) \
-((*((volatile unsigned int *)(a))) & 0xffff)
-
-#define WriteByte(a, b) \
-*((volatile unsigned char *)(a)) = (b)
-
-#define ReadByte(a) \
-(*((volatile unsigned char *)(a)))
-
-/* Define in/out macros */
-
-#define inb(port) ReadByte((port))
-#define outb(port, byte) WriteByte((port), (byte))
-#define inw(port) ReadShort((port))
-#define outw(port, word) WriteShort((port), (word))
-#define inl(port) ReadWord((port))
-#define outl(port, lword) WriteWord((port), (lword))
-
-/* Prototypes that are wandering the streets */
-
-#ifdef _ARM32_FRAME_H
-void postmortem __P((trapframe_t */*frame*/));
-#endif
-u_int traceback __P(());
-u_int simpletraceback __P(());
-u_int irqtraceback __P((u_int, u_int));
-int shell __P(());
-void kstack_stuff __P((struct proc */*p*/));
-void boot0 __P(());
-void bootsync __P((void));
-#endif
-
-/* End of katelib.h */
diff --git a/sys/arch/arm32/include/kbd.h b/sys/arch/arm32/include/kbd.h
deleted file mode 100644
index a2023083785..00000000000
--- a/sys/arch/arm32/include/kbd.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* $NetBSD: kbd.h,v 1.2 1996/03/14 23:11:21 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * kbd.h
- *
- * Keyboard ioctls
- *
- * Created : 21/07/95
- */
-
-struct kbd_data {
- int keycode;
- struct timeval event_time;
-};
-
-struct kbd_autorepeat {
- int ka_delay;
- int ka_rate;
-};
-
-#define KBD_GETAUTOREPEAT _IOR( 'k', 100, struct kbd_autorepeat)
-#define KBD_SETAUTOREPEAT _IOW( 'k', 101, struct kbd_autorepeat)
-#define KBD_SETLEDS _IOW( 'k', 102, int)
-#define KBD_XXX _IOW( 'k', 103, int)
-
-#define KBD_LED_SCROLL_LOCK 0x01
-#define KBD_LED_NUM_LOCK 0x02
-#define KBD_LED_CAPS_LOCK 0x04
-
-#ifdef _KERNEL
-void kbdsetstate __P((int /*state*/));
-int kbdgetstate __P(());
-#endif
-
-/* End of kbd.h */
diff --git a/sys/arch/arm32/include/kgdb.h b/sys/arch/arm32/include/kgdb.h
deleted file mode 100644
index 3f875e76bb5..00000000000
--- a/sys/arch/arm32/include/kgdb.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $NetBSD: kgdb.h,v 1.2 1996/03/14 23:11:23 mark Exp $ */
-
-/*
- * Copyright (C) 1993, 1994 Wolfgang Solfrank.
- * Copyright (C) 1993, 1994 TooLs GmbH.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by TooLs GmbH.
- * 4. The name of TooLs GmbH may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* define certain registers */
-#define SP 13
-#define LR 14
-#define PC 15
-#define PSR 16
-#define SPSR 17
-#define NREG 18
-
-extern int kgdbregs[NREG];
-
-extern int *kgdb_find_stack();
-extern void kgdb_free_stack __P((int *));
diff --git a/sys/arch/arm32/include/limits.h b/sys/arch/arm32/include/limits.h
deleted file mode 100644
index 0f5165be066..00000000000
--- a/sys/arch/arm32/include/limits.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $NetBSD: limits.h,v 1.2 1996/03/14 23:11:25 mark Exp $ */
-
-/*
- * Copyright (c) 1988 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)limits.h 7.2 (Berkeley) 6/28/90
- */
-
-#ifndef _ARM32_LIMITS_H_
-#define _ARM32_LIMITS_H_
-
-#define CHAR_BIT 8 /* number of bits in a char */
-#define MB_LEN_MAX 1 /* no multibyte characters */
-
-#define SCHAR_MIN (-0x7f-1) /* max value for a signed char */
-#define SCHAR_MAX 0x7f /* min value for a signed char */
-
-#define UCHAR_MAX 0xff /* max value for an unsigned char */
-#define CHAR_MAX 0x7f /* max value for a char */
-#define CHAR_MIN (-0x7f-1) /* min value for a char */
-
-#define USHRT_MAX 0xffff /* max value for an unsigned short */
-#define SHRT_MAX 0x7fff /* max value for a short */
-#define SHRT_MIN (-0x7fff-1) /* min value for a short */
-
-#define UINT_MAX 0xffffffff /* max value for an unsigned int */
-#define INT_MAX 0x7fffffff /* max value for an int */
-#define INT_MIN (-0x7fffffff-1) /* min value for an int */
-
-#define ULONG_MAX 0xffffffff /* max value for an unsigned long */
-#define LONG_MAX 0x7fffffff /* max value for a long */
-#define LONG_MIN (-0x7fffffff-1) /* min value for a long */
-
-#if !defined(_ANSI_SOURCE)
-#define SSIZE_MAX INT_MAX /* max value for a ssize_t */
-
-#if !defined(_POSIX_SOURCE)
-#define SIZE_T_MAX UINT_MAX /* max value for a size_t */
-
-#define UID_MAX UINT_MAX /* max value for a uid_t */
-#define GID_MAX UINT_MAX /* max value for a gid_t */
-
-#define UQUAD_MAX 0xffffffffffffffffLL /* max unsigned quad */
-#define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */
-#define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */
-#define ULLONG_MAX (UQUAD_MAX) /* max value for unsigned long long */
-#define LLONG_MAX (QUAD_MAX) /* max value for a signed long long */
-#define LLONG_MIN (QUAD_MIN) /* min value for a signed long long */
-
-#endif /* !_POSIX_SOURCE */
-#endif /* !_ANSI_SOURCE */
-#endif /* _ARM_LIMITS_H_ */
diff --git a/sys/arch/arm32/include/mouse.h b/sys/arch/arm32/include/mouse.h
deleted file mode 100644
index 1187afffa05..00000000000
--- a/sys/arch/arm32/include/mouse.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* $NetBSD: mouse.h,v 1.1 1996/03/27 20:57:18 mark Exp $ */
-
-/*
- * Copyright (c) Mark Brinicombe 1996 All rights reserved
- * Copyright (c) Scott Stevens 1995 All rights reserved
- * Copyright (c) Melvin Tang-Richardson 1995 All rights reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD team.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
-#define MOUSE_BUTTON_RIGHT 0x10
-#define MOUSE_BUTTON_MIDDLE 0x20
-#define MOUSE_BUTTON_LEFT 0x40
-*/
-
-/* Used in pms.c */
-
-#define BUTSTATMASK 0x07 /* Any mouse button down if any bit set */
-#define BUTCHNGMASK 0x38 /* Any mouse button changed if any bit set */
-
-#define BUT3STAT 0x01 /* Button 3 down if set */
-#define BUT2STAT 0x02 /* Button 2 down if set */
-#define BUT1STAT 0x04 /* Button 1 down if set */
-#define BUT3CHNG 0x08 /* Button 3 changed if set */
-#define BUT2CHNG 0x10 /* Button 2 changed if set */
-#define BUT1CHNG 0x20 /* Button 1 changed if set */
-#define MOVEMENT 0x40 /* Mouse movement detected */
-
-/* Define user visible mouse structures */
-
-struct mouseinfo {
- u_int status;
- int xmotion, ymotion;
-};
-
-struct mousebufrec {
- int status;
- int x,y;
- struct timeval event_time;
-};
-
-struct mouse_state {
- signed short x, y;
- int buttons;
-};
-
-struct mouse_boundingbox {
- int x, y, a, b;
-};
-
-struct mouse_origin {
- int x, y;
-};
-
-/* Define mouse ioctls */
-
-#define MOUSEIOC_WRITEX _IO ( 'M', 100 )
-#define MOUSEIOC_WRITEY _IO ( 'M', 101 )
-
-#define MOUSEIOC_SETSTATE _IOW ( 'M', 102, struct mouse_state )
-#define MOUSEIOC_SETBOUNDS _IOW ( 'M', 103, struct mouse_boundingbox )
-#define MOUSEIOC_SETORIGIN _IOW ( 'M', 104, struct mouse_origin )
-
-#define MOUSEIOC_GETSTATE _IOR ( 'M', 105, struct mouse_state )
-#define MOUSEIOC_READ MOUSEIOC_GETSTATE
-#define MOUSEIOC_GETBOUNDS _IOR ( 'M', 106, struct mouse_boundingbox )
-#define MOUSEIOC_GETORIGIN _IOR ( 'M', 107, struct mouse_origin )
-
-/*
- * For backwards compatibility with the current Xserver.
- * Eventually these will be removed.
- */
-
-#define QUADMOUSE_WRITEX MOUSEIOC_WRITEX
-#define QUADMOUSE_WRITEY MOUSEIOC_WRITEY
-
-#define QUADMOUSE_SETSTATE MOUSEIOC_SETSTATE
-#define QUADMOUSE_SETBOUNDS MOUSEIOC_SETBOUNDS
-#define QUADMOUSE_SETORIGIN MOUSEIOC_SETORIGIN
-
-#define QUADMOUSE_GETSTATE MOUSEIOC_GETSTATE
-#define QUADMOUSE_GETBOUNDS MOUSEIOC_GETBOUNDS
-#define QUADMOUSE_GETORIGIN MOUSEIOC_GETORIGIN
-
-#define QUADMOUSE_SETFORMAT _IOW ( 'M', 108, char[20] )
-
-/* End of mouse.h */
diff --git a/sys/arch/arm32/include/param.h b/sys/arch/arm32/include/param.h
deleted file mode 100644
index 5b737d6b53b..00000000000
--- a/sys/arch/arm32/include/param.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/* $NetBSD: param.h,v 1.6 1996/03/14 23:11:27 mark Exp $ */
-
-/*
- * Copyright (c) 1994,1995 Mark Brinicombe.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD team.
- * 4. The name "RiscBSD" nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _ARM32_PARAM_H_
-#define _ARM32_PARAM_H_
-
-#ifdef _KERNEL
-# include <machine/cpu.h>
-#endif
-
-/*
- * Machine dependent constants for ARM6+ processors
- */
-/*#define ovbcopy bcopy */ /* XXX should probably have long gone by now */
-
-#define _MACHINE arm32
-#define MACHINE "arm32"
-#define _MACHINE_ARCH arm32
-#define MACHINE_ARCH "arm32"
-#define MID_MACHINE MID_ARM6
-
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value
- * for all data types (int, long, ...). The result is u_int and
- * must be cast to any desired pointer type.
- */
-#define ALIGNBYTES (sizeof(int) - 1)
-#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
-
-#define PGSHIFT 12 /* LOG2(NBPG) */
-#define NBPG (1 << PGSHIFT) /* bytes/page */
-#define PGOFSET (NBPG-1) /* byte offset into page */
-#define NPTEPG (NBPG/(sizeof (pt_entry_t)))
-
-
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define DEV_BSIZE (1 << DEV_BSHIFT)
-#define BLKDEV_IOSIZE 2048
-#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
-
-#define CLSIZELOG2 0
-#define CLSIZE (1 << CLSIZELOG2)
-
-/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
-#define SSIZE 1 /* initial stack size/NBPG */
-#define SINCR 1 /* increment of stack/NBPG */
-#define UPAGES 2 /* pages of u-area */
-#define USPACE (UPAGES * NBPG) /* total size of u-area */
-
-/*
- * Constants related to network buffer management.
- * MCLBYTES must be no larger than CLBYTES (the software page size), and,
- * on machines that exchange pages of input or output buffers with mbuf
- * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
- * of the hardware page size.
- */
-#define MSIZE 128 /* size of an mbuf */
-#define MCLSHIFT 11 /* convert bytes to m_buf clusters */
-#define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */
-#define MCLOFSET (MCLBYTES - 1) /* offset within a m_buf cluster */
-
-#ifndef NMBCLUSTERS
-#ifdef GATEWAY
-#define NMBCLUSTERS 512 /* map size, max cluster allocation */
-#else
-#define NMBCLUSTERS 256 /* map size, max cluster allocation */
-#endif
-#endif
-
-/*
- * Size of kernel malloc arena in CLBYTES-sized logical pages
- */
-#ifndef NKMEMCLUSTERS
-#define NKMEMCLUSTERS (6 * 1024 * 1024 / CLBYTES)
-#endif
-
-/* pages ("clicks") (4096 bytes) to disk blocks */
-#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
-/*#define dtob(x) ((x) << DEV_BSHIFT)*/
-
-#define ctob(x) ((x) << PGSHIFT)
-
-/* bytes to pages */
-#define btoc(x) (((unsigned)(x) + PGOFSET) >> PGSHIFT)
-
-#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
- ((unsigned)(bytes) >> DEV_BSHIFT)
-#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
- ((unsigned)(db) << DEV_BSHIFT)
-
-/*
- * Map a ``block device block'' to a file system block.
- * This should be device dependent, and should use the bsize
- * field from the disk label.
- * For now though just use DEV_BSIZE.
- */
-#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE / DEV_BSIZE))
-
-/* Define various base addresses */
-
-#define KERNEL_BASE 0xf0000000
-#define KERNEL_VM_BASE 0xf1000000
-#define PAGE_DIRS_BASE 0xf3000000
-#define ALT_PAGE_TBLS_BASE 0xf3c00000
-#define CURRENT_PAGEDIR_BASE 0xeffd4000
-#define PROCESS_PAGE_TBLS_BASE 0xefc00000
-
-#define KERNBASE KERNEL_BASE
-
-/* Constants used to divide the USPACE area */
-
-/*
- * The USPACE area contains :
- * 1. the user structure for the process
- * 2. the fp context for FP emulation
- * 3. the kernel (svc) stack
- * 4. the undefined instruction stack
- *
- * The layout of the area looks like this
- *
- * | user area | FP context | undefined stack | kernel stack |
- *
- * The size of the user area is known.
- * The size of the FP context is variable depending of the FP emulator
- * in use and whether there is hardware FP support. However we can put
- * an upper limit on it.
- * The undefined stack needs to be at least 512 bytes. This is a requirement
- * if the FP emulators
- * The kernel stack should be at least 4K is size.
- *
- * The stack top addresses are used to set the stack pointers. The stack bottom
- * addresses at the addresses monitored by the diagnostic code for stack overflows
- *
- */
-
-#define FPCONTEXTSIZE (0x100)
-#define USPACE_SVC_STACK_TOP (USPACE)
-#define USPACE_SVC_STACK_BOTTOM (USPACE_SVC_STACK_TOP - 0x1000)
-#define USPACE_UNDEF_STACK_TOP (USPACE_SVC_STACK_BOTTOM - 0x10)
-#define USPACE_UNDEF_STACK_BOTTOM (sizeof(struct user) + FPCONTEXTSIZE + 10)
-
-#define arm_byte_to_page(x) (x >> PGSHIFT)
-#define arm_page_to_byte(x) (x << PGSHIFT)
-
-#ifdef _KERNEL
-#ifndef _LOCORE
-void delay __P((unsigned));
-#define DELAY(x) delay(x)
-#endif
-#endif
-
-#endif /* _ARM_PARAM_H_ */
diff --git a/sys/arch/arm32/include/pcb.h b/sys/arch/arm32/include/pcb.h
deleted file mode 100644
index 00c04a84199..00000000000
--- a/sys/arch/arm32/include/pcb.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* $NetBSD: pcb.h,v 1.2 1996/03/13 21:08:36 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD team.
- * 4. The name "RiscBSD" nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _ARM32_PCB_H_
-#define _ARM32_PCB_H_
-
-#include <machine/pte.h>
-#include <machine/fp.h>
-
-struct pcb {
- pd_entry_t *pcb_pagedir; /* PT hooks */
- u_int pcb_flags; /* Flags */
- u_int pcb_spsr;
- u_int pcb_r0; /* Space for register dump */
- u_int pcb_r1;
- u_int pcb_r2;
- u_int pcb_r3;
- u_int pcb_r4;
- u_int pcb_r5;
- u_int pcb_r6;
- u_int pcb_r7;
- u_int pcb_r8; /* used */
- u_int pcb_r9; /* used */
- u_int pcb_r10; /* used */
- u_int pcb_r11; /* used */
- u_int pcb_r12; /* used */
- u_int pcb_sp; /* used */
- u_int pcb_lr;
- u_int pcb_pc;
- u_int pcb_und_sp;
- caddr_t pcb_onfault; /* On fault handler */
- struct fp_state pcb_fpstate; /* Floating Point state */
-};
-
-/*
- * No additional data for core dumps.
- */
-struct md_coredump {
- int md_empty;
-};
-
-#ifdef _KERNEL
-extern struct pcb *curpcb;
-#endif /* _KERNEL */
-
-#endif /* _ARM32_PCB_H_ */
-
-/* End of pcb.h */
diff --git a/sys/arch/arm32/include/pmap.h b/sys/arch/arm32/include/pmap.h
deleted file mode 100644
index 888c7a2844a..00000000000
--- a/sys/arch/arm32/include/pmap.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/* $NetBSD: pmap.h,v 1.3 1996/03/14 23:11:29 mark Exp $ */
-
-/*
- * Copyright (c) 1994,1995 Mark Brinicombe.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD team.
- * 4. The name "RiscBSD" nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _ARM32_PMAP_H_
-#define _ARM32_PMAP_H_
-
-#include <machine/pte.h>
-
-/*
- * virtual address to page table entry and
- * to physical address.
- */
-
-#define vtopte(va) \
- ((pt_entry_t *)(PROCESS_PAGE_TBLS_BASE + (arm_byte_to_page((unsigned int)(va)) << 2)))
-
-
-#define vtophys(va) \
- ((*vtopte(va) & PG_FRAME) | ((unsigned int)(va) & ~PG_FRAME))
-
-/*
- * Pmap stuff
- */
-struct pmap {
- pd_entry_t *pm_pdir; /* KVA of page directory */
- vm_offset_t pm_pptpt; /* PA of pt's page table */
- vm_offset_t pm_vptpt; /* VA of pt's page table */
- boolean_t pm_pdchanged; /* pdir changed */
- short pm_dref; /* page directory ref count */
- short pm_count; /* pmap reference count */
- simple_lock_data_t pm_lock; /* lock on pmap */
- struct pmap_statistics pm_stats; /* pmap statistics */
-};
-
-typedef struct pmap *pmap_t;
-
-/*
- * For speed we store the both the virtual address and the page table
- * entry address for each page hook.
- */
-
-typedef struct {
- vm_offset_t va;
- pt_entry_t *pte;
-} pagehook_t;
-
-/*
- * For each vm_page_t, there is a list of all currently valid virtual
- * mappings of that page. An entry is a pv_entry_t, the list is pv_table.
- */
-
-typedef struct pv_entry {
- struct pv_entry *pv_next; /* next pv_entry */
- pmap_t pv_pmap; /* pmap where mapping lies */
- vm_offset_t pv_va; /* virtual address for mapping */
- int pv_flags; /* flags */
-} *pv_entry_t;
-
-struct pv_page;
-
-struct pv_page_info {
- TAILQ_ENTRY(pv_page) pgi_list;
- struct pv_entry *pgi_freelist;
- int pgi_nfree;
-};
-
-/*
- * This is basically:
- * ((NBPG - sizeof(struct pv_page_info)) / sizeof(struct pv_entry))
- */
-
-#define NPVPPG ((NBPG - sizeof(struct pv_page_info)) / sizeof(struct pv_entry))
-
-struct pv_page {
- struct pv_page_info pvp_pgi;
- struct pv_entry pvp_pv[NPVPPG];
-};
-
-#ifdef _KERNEL
-pv_entry_t pv_table; /* array of entries, one per page */
-extern pmap_t kernel_pmap;
-extern struct pmap kernel_pmap_store;
-
-#define pmap_kernel() (&kernel_pmap_store)
-#define pmap_update() tlbflush()
-#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
-
-boolean_t pmap_testbit __P((vm_offset_t, int));
-void pmap_changebit __P((vm_offset_t, int, int));
-
-static __inline vm_offset_t
-pmap_phys_address(int ppn)
-{
- return(arm_page_to_byte(ppn));
-}
-
-#endif
-
-#endif
-
-/* End of pmap.h */
diff --git a/sys/arch/arm32/include/podule.h b/sys/arch/arm32/include/podule.h
deleted file mode 100644
index 5561d458868..00000000000
--- a/sys/arch/arm32/include/podule.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* $NetBSD: podule.h,v 1.2 1996/03/14 23:11:31 mark Exp $ */
-
-/*
- * Copyright (C) 1994 Wolfgang Solfrank.
- * Copyright (C) 1994 TooLs GmbH.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by TooLs GmbH.
- * 4. The name of TooLs GmbH may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _ARM32_PODULE_H_
-#define _ARM32_PODULE_H_
-
-/*
- * Generic defines for Acorn Podules
- */
-#define IO_SPACE_PHYS 0x03000000 /* physical I/O space location */
-#define IO_SPACE_VIRT 0xf8000000 /* virtual I/O space location */
-#define IO_SPACE_SIZE 0x01000000 /* size of I/O space */
-
-#define PODULE_SLOW_MEM ((volatile void *)(IO_SPACE_VIRT + 0x240000))
-#define PODULE_MED_MEM ((volatile void *)(IO_SPACE_VIRT + 0x2c0000))
-#define PODULE_FAST_MEM ((volatile void *)(IO_SPACE_VIRT + 0x340000))
-#define PODULE_SYNC_MEM ((volatile void *)(IO_SPACE_VIRT + 0x3c0000))
-
-#define PODULE_SLOT2MEM(slot,mem) ((slot)*0x4000 + (mem))
-
-/*
- * Access 8 bit wide memory on podule
- */
-#define PODULE_GET_BYTE(sp,off) (((volatile u_char *)(sp))[(off) * 4])
-#define PODULE_SET_BYTE(sp,off,byte) (((volatile u_int *)(sp))[(off)] \
- = ((u_char)(byte) << 24) \
- | ((u_char)(byte) << 16) \
- | ((u_char)(byte) << 8) \
- | (u_char)(byte))
-/*
- * Access 16 bit wide memory on podule
- */
-#define PODULE_GET_SHORT(sp,off) (((volatile u_short *)(sp))[(off)])
-#define PODULE_SET_SHORT(sp,off,word) (((volatile u_int *)(sp))[(off) / 2] \
- = ((u_short)(word) << 16) \
- | (u_short)(word))
-
-/*
- * Known offsets in any podule
- */
-#define PODULE_IRQ_BYTE 0
-#define PODULE_IRQ_PEND 1
-#define PODULE_FIQ_PEND 2
-
-#define PODULE_ID_BYTE 3
-#define PODULE_ID_SCSI 2
-#define PODULE_ID_ETHER 3
-
-extern void podule_get_bytes __P((volatile void *sp, void *dp, int cnt));
-extern void podule_set_bytes __P((void *sp, volatile void *dp, int cnt));
-
-extern void podule_get_shorts __P((volatile void *sp, void *dp, int cnt));
-extern void podule_set_shorts __P((void *sp, volatile void *dp, int cnt));
-
-/* XXX Shouldn't this be somewhere else? */
-#define offsetof(type, member) ((size_t)&((type *)0)->member)
-
-#endif /* _ARM_PODULE_H_ */
diff --git a/sys/arch/arm32/include/proc.h b/sys/arch/arm32/include/proc.h
deleted file mode 100644
index ff2531b168e..00000000000
--- a/sys/arch/arm32/include/proc.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $NetBSD: proc.h,v 1.2 1996/03/14 23:11:33 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD team.
- * 4. The name "RiscBSD" nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _ARM32_PROC_H_
-#define _ARM32_PROC_H_
-
-/*
- * Machine-dependent part of the proc structure for arm.
- */
-struct mdproc {
- struct trapframe *md_regs; /* registers on current frame */
- int __spare;
-};
-#endif
diff --git a/sys/arch/arm32/include/profile.h b/sys/arch/arm32/include/profile.h
deleted file mode 100644
index 3070ff6f8b2..00000000000
--- a/sys/arch/arm32/include/profile.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $NetBSD: profile.h,v 1.3 1996/03/14 23:11:34 mark Exp $ */
-
-/*
- * Copyright (c) 1995-1996 Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define _MCOUNT_DECL static inline void _mcount
-
-/* Cannot implement mcount in C as GCC uses the ip register to pass the
- * frompcindex variable. GCC also uses ip during the register pushing
- * at the beginning of any C function.
- */
-#define MCOUNT \
-extern void mcount __P((void)) asm("mcount"); \
-void \
-mcount() \
-{ \
- register int selfpc, frompcindex; \
- /* \
- * find the return address for mcount, \
- * and the return address for mcount's caller. \
- * \
- * selfpc = pc pushed by mcount call \
- */ \
- asm("mov %0, lr" : "=r" (selfpc)); \
- /* \
- * frompcindex = pc pushed by call into self. \
- */ \
- asm("mov %0, ip" : "=r" (frompcindex)); \
- _mcount(frompcindex, selfpc); \
-}
-
-#ifdef _KERNEL
-/*
- * Note that we assume splhigh() and splx() cannot call mcount()
- * recursively.
- */
-#define MCOUNT_ENTER s = splhigh()
-#define MCOUNT_EXIT splx(s)
-#endif /* _KERNEL */
diff --git a/sys/arch/arm32/include/psl.h b/sys/arch/arm32/include/psl.h
deleted file mode 100644
index b7ffcf17757..00000000000
--- a/sys/arch/arm32/include/psl.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* $NetBSD: psl.h,v 1.2 1996/03/08 16:35:17 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * psl.h
- *
- * spl prototypes.
- * Eventually this will become a set of defines.
- *
- * Created : 21/07/95
- */
-
-/*
- * These are the different SPL states
- *
- * Each state has an interrupt mask associated with it which
- * indicate which interrupts are allowed.
- */
-
-#define SPL_0 0
-#define SPL_SOFT 1
-#define SPL_BIO 2
-#define SPL_NET 3
-#define SPL_TTY 4
-#define SPL_CLOCK 5
-#define SPL_IMP 6
-#define SPL_HIGH 7
-#define SPL_LEVELS 8
-
-#define spl0() splx(SPL_0)
-#define splhigh() splx(SPL_HIGH)
-#define splbio() raisespl(SPL_BIO)
-#define splnet() raisespl(SPL_NET)
-#define spltty() raisespl(SPL_TTY)
-#define splimp() raisespl(SPL_IMP)
-#define splclock() raisespl(SPL_CLOCK)
-#define splstatclock() raisespl(SPL_CLOCK)
-#define splsoftnet() raisespl(SPL_SOFT)
-
-#ifndef _LOCORE
-int raisespl __P((int));
-int lowerspl __P((int));
-int splx __P((int));
-int splsoftclock __P(());
-
-#ifdef _KERNEL
-extern int current_spl_level;
-
-extern u_int spl_masks[SPL_LEVELS];
-#endif /* _KERNEL */
-#endif /* _LOCORE */
-
-/* End of psl.h */
diff --git a/sys/arch/arm32/include/pte.h b/sys/arch/arm32/include/pte.h
deleted file mode 100644
index 73a087399ec..00000000000
--- a/sys/arch/arm32/include/pte.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* $NetBSD: pte.h,v 1.3 1996/03/14 23:11:36 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD team.
- * 4. The name "RiscBSD" nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _ARM32_PTE_H_
-#define _ARM32_PTE_H_
-
-#define PDSHIFT 20 /* LOG2(NBPDR) */
-#define NBPD (1 << PDSHIFT) /* bytes/page dir */
-/*# define PDOFSET (NBPD-1)*/ /* byte offset into page dir */
-#define NPTEPD (NBPD / NBPG)
-
-#ifndef _LOCORE
-typedef int pd_entry_t; /* page directory entry */
-typedef int pt_entry_t; /* page table entry */
-#endif
-
-#define PD_MASK 0xfff00000 /* page directory address bits */
-#define PT_MASK 0x000ff000 /* page table address bits */
-
-#define PG_FRAME 0xfffff000
-
-/* The PT_SIZE definition is misleading... A page table is only 0x400
- * bytes long. But since VM mapping can only be done to 0x1000 a single
- * 1KB blocks cannot be steered to a va by itself. Therefore the
- * pages tables are allocated in blocks of 4. i.e. if a 1 KB block
- * was allocated for a PT then the other 3KB would also get mapped
- * whenever the 1KB was mapped.
- */
-
-#define PT_SIZE 0x1000
-#define PD_SIZE 0x4000
-
-#define AP_KR 0x00
-#define AP_KRW 0x01
-#define AP_KRWUR 0x02
-#define AP_KRWURW 0x03
-
-#define AP_W 0x01
-#define AP_U 0x02
-
-#define PT_B 0x04 /* Phys - Buffered (write) */
-#define PT_C 0x08 /* Phys - Cacheable */
-#define PT_U 0x10 /* Phys - Updateable */
-
-#define PT_M 0x01 /* Virt - Modified */
-#define PT_H 0x02 /* Virt - Handled (Used) */
-#define PT_W 0x40 /* Virt - Wired */
-#define PT_Wr 0x10 /* Virt / Phys Write */
-#define PT_Us 0x20 /* Virt / Phys User */
-
-#define PT_AP(x) ((x << 10) | (x << 8) | (x << 6) | (x << 4))
-
-#define AP_SECTION_SHIFT 10
-
-#define L1_PAGE 0x01
-#define L1_SECTION 0x02
-#define L2_LPAGE 0x01
-#define L2_SPAGE 0x02
-#define L2_MASK 0x03
-#define L2_INVAL 0x00
-
-#define L2_PTE(p, a) ((p) | PT_AP(a) | L2_SPAGE | PT_C | PT_B)
-#define L2_PTE_NC(p, a) ((p) | PT_AP(a) | L2_SPAGE | PT_B)
-
-#define L1_PTE(p) ((p) | 0x00 | PT_U | L1_PAGE)
-
-#define L1_SEC(p) ((p) | (AP_KRW << AP_SECTION_SHIFT) | PT_U | L1_SECTION)
-
-#define DOMAIN_FAULT 0x00
-#define DOMAIN_CLIENT 0x01
-#define DOMAIN_RESERVED 0x02
-#define DOMAIN_MANAGER 0x03
-
-#endif
-
-/* End of pte.h */
diff --git a/sys/arch/arm32/include/ptrace.h b/sys/arch/arm32/include/ptrace.h
deleted file mode 100644
index 8eb446a943c..00000000000
--- a/sys/arch/arm32/include/ptrace.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* $NetBSD: ptrace.h,v 1.2 1996/03/14 23:11:38 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Frank Lancaster
- * Copyright (c) 1995 Tools GmbH
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christopher G. Demetriou.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * arm-dependent ptrace definitions
- */
-#define PT_STEP (PT_FIRSTMACH + 0)
-#define PT_GETREGS (PT_FIRSTMACH + 1)
-#define PT_SETREGS (PT_FIRSTMACH + 2)
-#define PT_GETFPREGS (PT_FIRSTMACH + 3)
-#define PT_SETFPREGS (PT_FIRSTMACH + 4)
diff --git a/sys/arch/arm32/include/qmouse.h b/sys/arch/arm32/include/qmouse.h
deleted file mode 100644
index 1d776a55455..00000000000
--- a/sys/arch/arm32/include/qmouse.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* $NetBSD: qmouse.h,v 1.2 1996/03/14 23:11:40 mark Exp $ */
-
-/*
- * Copyright (c) Scott Stevens 1995 All rights reserved
- * Copyright (c) Melvin Tang-Richardson 1995 All rights reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD team.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define MOVEEVENT 0x40
-#define B1TRANS 0x20
-#define B2TRANS 0x10
-#define B3TRANS 0x08
-#define BTRANSMASK 0x38
-#define B1VAL 0x04
-#define B2VAL 0x02
-#define B3VAL 0x01
-#define BVALMASK 0x07
-
-struct mousebufrec {
- int status;
- int x,y;
- struct timeval event_time;
-};
-
-struct mouse_state {
- signed short x, y;
- int buttons;
-};
-
-struct mouse_boundingbox {
- int x, y, a, b;
-};
-
-struct mouse_origin {
- int x, y;
-};
-
-#define QUADMOUSE_WRITEX _IO ( 'M', 100 )
-#define QUADMOUSE_WRITEY _IO ( 'M', 101 )
-
-#define QUADMOUSE_SETSTATE _IOW ( 'M', 102, struct mouse_state )
-#define QUADMOUSE_SETBOUNDS _IOW ( 'M', 103, struct mouse_boundingbox )
-#define QUADMOUSE_SETORIGIN _IOW ( 'M', 104, struct mouse_origin )
-
-#define QUADMOUSE_GETSTATE _IOR ( 'M', 105, struct mouse_state )
-#define QUADMOUSE_GETBOUNDS _IOR ( 'M', 106, struct mouse_boundingbox )
-#define QUADMOUSE_GETORIGIN _IOR ( 'M', 107, struct mouse_origin )
-
-#define QUADMOUSE_SETFORMAT _IOW ( 'M', 108, char[20] )
-
-/* End of qmouse.h */
diff --git a/sys/arch/arm32/include/reg.h b/sys/arch/arm32/include/reg.h
deleted file mode 100644
index 840a9d6a453..00000000000
--- a/sys/arch/arm32/include/reg.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $NetBSD: reg.h,v 1.2 1996/03/14 23:11:41 mark Exp $ */
-
-/*
- * Copyright (C) 1994, 1995 Frank Lancaster
- * Copyright (C) 1994, 1995 TooLs GmbH.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by TooLs GmbH.
- * 4. The name of TooLs GmbH may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * @(#)reg.h 5.5 (Berkeley) 1/18/91
- */
-
-#ifndef _ARM32_REG_H_
-#define _ARM32_REG_H_
-
-#include <machine/fp.h>
-
-struct reg {
- unsigned int r[13];
- unsigned int r_sp;
- unsigned int r_lr;
- unsigned int r_pc;
- unsigned int r_cpsr;
-};
-
-/* this is identical to fp_state */
-struct fpreg {
- unsigned int fpr_flags;
- unsigned int fpr_sr;
- unsigned int fpr_cr;
- fp_reg_t fpr[16];
-};
-
-#endif /* !_ARM32_REG_H_ */
-
diff --git a/sys/arch/arm32/include/rtc.h b/sys/arch/arm32/include/rtc.h
deleted file mode 100644
index 7f9e689a8ed..00000000000
--- a/sys/arch/arm32/include/rtc.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* $NetBSD: rtc.h,v 1.3 1996/04/19 19:51:48 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * rtc.h
- *
- * Header file for RTC / CMOS stuff
- *
- * Created : 13/10/94
- *
- * Based of kate/display/iiccontrol.c
- */
-
-/*
- * IIC addresses for RTC chip
- * Two PCF8583 chips are supported on the IIC bus
- */
-
-#define IIC_PCF8583_MASK 0xfc
-#define IIC_PCF8583_ADDR 0xa0
-
-#define RTC_Write (IIC_PCF8583_ADDR | IIC_WRITE)
-#define RTC_Read (IIC_PCF8583_ADDR | IIC_READ)
-
-typedef struct {
- u_char rtc_micro;
- u_char rtc_centi;
- u_char rtc_sec;
- u_char rtc_min;
- u_char rtc_hour;
- u_char rtc_day;
- u_char rtc_mon;
- u_char rtc_year;
- u_char rtc_cen;
-} rtc_t;
-
-#define RTC_ADDR_BOOTOPTS 0x90
-#define RTC_ADDR_REBOOTCNT 0x91
-#define RTC_ADDR_YEAR 0xc0
-#define RTC_ADDR_CENT 0xc1
-
-#ifdef _KERNEL
-int cmos_read __P((int));
-int cmos_write __P((int, int));
-int rtc_read __P((rtc_t *));
-int rtc_write __P((rtc_t *));
-#endif /* _KERNEL */
-
-/* End of rtc.h */
diff --git a/sys/arch/arm32/include/setjmp.h b/sys/arch/arm32/include/setjmp.h
deleted file mode 100644
index bac98596c8f..00000000000
--- a/sys/arch/arm32/include/setjmp.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* $NetBSD: setjmp.h,v 1.2 1996/03/14 23:11:45 mark Exp $ */
-
-/*
- * machine/setjmp.h: machine dependent setjmp-related information.
- */
-
-#define _JBLEN 26 /* size, in longs, of a jmp_buf */
diff --git a/sys/arch/arm32/include/signal.h b/sys/arch/arm32/include/signal.h
deleted file mode 100644
index 2cae693614d..00000000000
--- a/sys/arch/arm32/include/signal.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* $NetBSD: signal.h,v 1.3 1996/03/14 23:11:47 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1996 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * signal.h
- *
- * Architecture dependant signal types and structures
- *
- * Created : 30/09/94
- */
-
-#ifndef _ARM32_SIGNAL_H_
-#define _ARM32_SIGNAL_H_
-
-#ifndef _LOCORE
-
-typedef int sig_atomic_t;
-
-/*
- * Information pushed on stack when a signal is delivered.
- * This is used by the kernel to restore state following
- * execution of the signal handler. It is also made available
- * to the handler to allow it to restore state properly if
- * a non-standard exit is performed.
- */
-
-struct sigcontext {
- int sc_onstack; /* sigstack state to restore */
- int sc_mask; /* signal mask to restore */
-
- unsigned int sc_spsr;
- unsigned int sc_r0;
- unsigned int sc_r1;
- unsigned int sc_r2;
- unsigned int sc_r3;
- unsigned int sc_r4;
- unsigned int sc_r5;
- unsigned int sc_r6;
- unsigned int sc_r7;
- unsigned int sc_r8;
- unsigned int sc_r9;
- unsigned int sc_r10;
- unsigned int sc_r11;
- unsigned int sc_r12;
- unsigned int sc_usr_sp;
- unsigned int sc_usr_lr;
- unsigned int sc_svc_lr;
- unsigned int sc_pc;
-};
-
-#endif
-
-#endif /* _ARM_SIGNAL_H_ */
-
-/* End of signal.h */
diff --git a/sys/arch/arm32/include/stdarg.h b/sys/arch/arm32/include/stdarg.h
deleted file mode 100644
index b0c4350caaa..00000000000
--- a/sys/arch/arm32/include/stdarg.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $NetBSD: stdarg.h,v 1.2 1996/03/14 23:11:49 mark Exp $ */
-
-/*
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)stdarg.h 8.1 (Berkeley) 6/10/93
- */
-
-#ifndef _STDARG_H_
-#define _STDARG_H_
-
-typedef char *va_list;
-
-#define __va_promote(type) \
- (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
-
-#define va_start(ap, last) \
- (ap = ((char *)&(last) + __va_promote(last)))
-
-#ifdef _KERNEL
-#define va_arg(ap, type) \
- ((type *)(ap += sizeof(type)))[-1]
-#else
-#define va_arg(ap, type) \
- ((type *)(ap += sizeof(type) < sizeof(int) ? \
- (abort(), 0) : sizeof(type)))[-1]
-#endif
-
-#define va_end(ap)
-
-#endif /* !_STDARG_H_ */
diff --git a/sys/arch/arm32/include/types.h b/sys/arch/arm32/include/types.h
deleted file mode 100644
index 7c1d92e41f5..00000000000
--- a/sys/arch/arm32/include/types.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* $NetBSD: types.h,v 1.2 1996/03/06 23:04:04 mark Exp $ */
-/* $OpenBSD: types.h,v 1.4 1999/07/07 23:16:40 art Exp $ */
-
-/*
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)types.h 7.5 (Berkeley) 3/9/91
- */
-
-#ifndef _ARM32_TYPES_H_
-#define _ARM32_TYPES_H_
-
-#include <sys/cdefs.h>
-
-typedef struct _physadr {
- int r[1];
-} *physadr;
-
-typedef struct label_t { /* Used by setjmp & longjmp */
- int val[11];
-} label_t;
-
-typedef unsigned long vm_offset_t;
-typedef unsigned long vm_size_t;
-
-typedef unsigned long vaddr_t;
-typedef unsigned long paddr_t;
-typedef unsigned long vsize_t;
-typedef unsigned long psize_t;
-
-/*
- * Basic integral types. Omit the typedef if
- * not possible for a machine/compiler combination.
- */
-#define __BIT_TYPES_DEFINED__
-typedef __signed char int8_t;
-typedef unsigned char u_int8_t;
-typedef unsigned char uint8_t;
-typedef short int16_t;
-typedef unsigned short u_int16_t;
-typedef unsigned short uint16_t;
-typedef int int32_t;
-typedef unsigned int u_int32_t;
-typedef unsigned int uint32_t;
-typedef long long int64_t;
-typedef unsigned long long u_int64_t;
-typedef unsigned long long uint64_t;
-
-typedef int32_t register_t;
-
-#endif /* _ARM32_TYPES_H_ */
diff --git a/sys/arch/arm32/include/undefined.h b/sys/arch/arm32/include/undefined.h
deleted file mode 100644
index c27b4c11cb2..00000000000
--- a/sys/arch/arm32/include/undefined.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $NetBSD: undefined.h,v 1.2 1996/03/14 23:11:51 mark Exp $ */
-
-/*
- * Copyright (c) 1995-1996 Mark Brinicombe.
- * Copyright (c) 1995 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * undefined.h
- *
- * Undefined instruction types, symbols and prototypes
- *
- * Created : 08/02/95
- */
-
-#ifdef _KERNEL
-
-typedef int (*undef_handler_t) __P((unsigned int, unsigned int, trapframe_t *));
-
-#define FP_COPROC 1
-#define FP_COPROC2 2
-#define MAX_COPROCS 16
-
-extern undef_handler_t undefined_handlers[MAX_COPROCS];
-
-/* Prototypes for undefined.c */
-
-int install_coproc_handler __P((int, undef_handler_t));
-void undefined_init __P((void));
-
-#endif
-
-/* End of undefined.h */
diff --git a/sys/arch/arm32/include/varargs.h b/sys/arch/arm32/include/varargs.h
deleted file mode 100644
index 7f0c6bc468b..00000000000
--- a/sys/arch/arm32/include/varargs.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $NetBSD: varargs.h,v 1.2 1996/03/14 23:11:53 mark Exp $ */
-
-/*
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)varargs.h 8.2 (Berkeley) 3/22/94
- */
-
-#ifndef _MACHINE_VARARGS_H_
-#define _MACHINE_VARARGS_H_
-
-typedef char *va_list;
-
-#define va_dcl int va_alist; ...
-
-#define va_start(ap) \
- ap = (char *)&va_alist
-
-#ifdef _KERNEL
-#define va_arg(ap, type) \
- ((type *)(ap += sizeof(type)))[-1]
-#else
-#define va_arg(ap, type) \
- ((type *)(ap += sizeof(type) < sizeof(int) ? \
- (abort(), 0) : sizeof(type)))[-1]
-#endif
-
-#define va_end(ap)
-
-#endif /* !_MACHINE_VARARGS_H_ */
diff --git a/sys/arch/arm32/include/vconsole.h b/sys/arch/arm32/include/vconsole.h
deleted file mode 100644
index fa4f66dc3c9..00000000000
--- a/sys/arch/arm32/include/vconsole.h
+++ /dev/null
@@ -1,294 +0,0 @@
-/* $OpenBSD: vconsole.h,v 1.2 2000/03/03 00:54:48 todd Exp $ */
-/* $NetBSD: vconsole.h,v 1.1 1996/01/31 23:23:29 mark Exp $ */
-
-/*
- * Copyright (c) 1994,1995 Melvyn Tang-Richardson
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD team
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * vconsole.h
- *
- * Virtual console header
- *
- * Created : 18/09/94
- * Last updated : 10/01/96
- *
- */
-
-#ifdef _KERNEL
-#define LOSSY 1
-#define FIXEDRES 2
-
-#define BOLD (1<<15)
-#define UNDERLINE (1<<16)
-#define REVERSE (1<<17)
-#define BLINKING (1<<18)
-
-#include <machine/vidc.h>
-
-struct vconsole;
-
-/*
- * Render routines and terminal drivers which conform to version 1.00
- * of the spec should always be present. This is the lowest common
- * denominator, which enables the driver to always find something that
- * will work.
- *
- * Prefered drivers can be added required in the tables.
- */
-
-struct render_engine {
- char * name;
- int ( *init ) __P(( struct vconsole *vc ));
- void ( *putchar ) __P(( dev_t dev, char c, struct vconsole *vc ));
- int ( *spawn ) __P(( struct vconsole *vc ));
- int ( *swapin ) __P(( struct vconsole *vc ));
- int ( *mmap ) __P(( struct vconsole *vc, int offset, int nprot ));
- void ( *render ) __P(( struct vconsole *vc, char c));
- void ( *scrollup ) __P(( struct vconsole *vc, int low, int high ));
- void ( *scrolldown ) __P(( struct vconsole *vc, int low, int high ));
- void ( *cls ) __P(( struct vconsole *vc ));
- void ( *update ) __P(( struct vconsole *vc ));
- int ( *scrollback ) __P(( struct vconsole *vc ));
- int ( *scrollforward ) __P(( struct vconsole *vc ));
- int ( *scrollbackend ) __P(( struct vconsole *vc ));
- int ( *clreos ) __P(( struct vconsole *vc, int code ));
- int ( *debugprint ) __P(( struct vconsole *vc ));
- int ( *cursorupdate ) __P(( struct vconsole *vc ));
- int ( *cursorflashrate ) __P(( struct vconsole *vc, int rate ));
- int ( *setfgcol ) __P(( struct vconsole *vc, int col ));
- int ( *setbgcol ) __P(( struct vconsole *vc, int col ));
- int ( *textpalette ) __P(( struct vconsole *vc ));
- int ( *sgr ) __P(( struct vconsole *vc, int type ));
- int ( *blank ) __P(( struct vconsole *vc, int type ));
- int ( *ioctl ) __P(( struct vconsole *vc, dev_t dev, int cmd,
- caddr_t data, int flag, struct proc *p));
- int ( *redraw ) __P(( struct vconsole *vc, int x, int y, int a, int b ));
- int ( *attach ) __P(( struct vconsole *vc, struct device *dev, struct device *dev1, void * arg));
- int ( *flash ) __P(( struct vconsole *vc, int flash ));
- int ( *cursor_flash ) __P(( struct vconsole *vc, int flash ));
-};
-
-/* Blank types. VESA defined */
-
-/* Blank type 3 is suported by default */
-
-#define BLANK_NONE 0 /* Not really blanked */
-#define BLANK_IDLE 1 /* Vsync dropped for fast reactivation */
-#define BLANK_UNUSED 2 /* Hsync dropped for semi fast reactivation */
-#define BLANK_OFF 3 /* All signals removed slowest reactivation */
-
-#define R_NAME render_engine->name
-#define SPAWN render_engine->spawn
-#define SCROLLUP render_engine->scrollup
-#define SCROLLDOWN render_engine->scrolldown
-#define RENDER render_engine->render
-#define R_SWAPIN render_engine->swapin
-#define CLS render_engine->cls
-#define R_INIT render_engine->init
-#define PUTCHAR render_engine->putchar
-#define R_SWAPIN render_engine->swapin
-#define MMAP render_engine->mmap
-#define R_SCROLLBACK render_engine->scrollback
-#define R_SCROLLFORWARD render_engine->scrollforward
-#define R_SCROLLBACKEND render_engine->scrollbackend
-#define R_CLREOS render_engine->clreos
-#define R_DEBUGPRINT render_engine->debugprint
-#define CURSORUPDATE render_engine->cursorupdate
-#define CURSORFLASHRATE render_engine->cursorflashrate
-#define SETFGCOL render_engine->setfgcol
-#define SETBGCOL render_engine->setbgcol
-#define TEXTPALETTE render_engine->textpalette
-#define SGR render_engine->sgr
-#define BLANK render_engine->blank
-#define IOCTL render_engine->ioctl
-#define REDRAW render_engine->redraw
-#define R_ATTACH render_engine->attach
-#define FLASH render_engine->flash
-#define CURSOR_FLASH render_engine->cursor_flash
-
-/*
- * The terminal emulator's scroll back is only used as a last resort for
- * cases when a render engine can't scrollback. In most cases though, the
- * terminal emulator won't allocate enough chapmap to perform scrollback.
- */
-
-struct terminal_emulator {
- char *name;
- /* Terminal emulation routines */
- int (*term_init) __P((struct vconsole *vc));
- int (*putstring) __P((char *string, int length, struct vconsole *vc));
- int (*swapin) __P((struct vconsole *vc));
- int (*swapout) __P((struct vconsole *vc));
- int (*sleep) __P((struct vconsole *vc));
- int (*wake) __P((struct vconsole *vc));
- int ( *scrollback) __P(( struct vconsole *vc ));
- int ( *scrollforward) __P(( struct vconsole *vc ));
- int ( *scrollbackend) __P(( struct vconsole *vc ));
- int ( *debugprint) __P(( struct vconsole *vc ));
- int ( *modechange) __P(( struct vconsole *vc ));
- int ( *attach ) __P(( struct vconsole *vc, struct device *dev, struct device *dev1, void *arg ));
-};
-
-#define T_NAME terminal_emulator->name
-#define TERM_INIT terminal_emulator->term_init
-#define T_SWAPIN terminal_emulator->swapin
-#define PUTSTRING terminal_emulator->putstring
-#define SLEEP terminal_emulator->sleep
-#define WAKE terminal_emulator->wake
-#define T_SCROLLBACK terminal_emulator->scrollback
-#define T_SCROLLFORWARD terminal_emulator->scrollforward
-#define T_SCROLLBACKEND terminal_emulator->scrollbackend
-#define T_DEBUGPRINT terminal_emulator->debugprint
-#define MODECHANGE terminal_emulator->modechange
-#define T_ATTACH terminal_emulator->attach
-
-struct vconsole {
- /* Management of consoles */
-
- struct vconsole *next;
- int number;
- int opened;
- struct tty *tp;
- struct proc *proc;
- int flags;
-
- /* Data structures */
- char *data;
- char *r_data;
-
- /* Structures required for the generic character map */
- int xchars, ychars;
- int *charmap;
- int xcur, ycur;
-
- /* This is the end of the old stuff */
-
- struct render_engine *render_engine;
- struct terminal_emulator *terminal_emulator;
-
- int t_scrolledback;
- int r_scrolledback;
-
- int blanked;
-
- int vtty;
-};
-
-extern int vconsole_pending;
-extern int vconsole_blankinit;
-extern int vconsole_blankcounter;
-
-extern struct vconsole *vconsole_current;
-
-extern struct render_engine *render_engine_tab[];
-extern struct terminal_emulator *terminal_emulator_tab[];
-
-#endif
-
-/* ioctls for switching between vconsoles */
-
-#define CONSOLE_SWITCHUP _IO( 'n', 0 )
-#define CONSOLE_SWITCHDOWN _IO( 'n', 1 )
-#define CONSOLE_SWITCHTO _IOW( 'n', 2, int )
-#define CONSOLE_SWITCHPREV _IO( 'n', 3 )
-
-/* ioctls for creating new virtual consoles */
-
-#define CONSOLE_CREATE _IOW( 'n', 10, int )
-#define CONSOLE_RENDERTYPE _IOR( 'n', 11, 20 )
-#define CONSOLE_TERMTYPE _IOR( 'n', 12, 20 )
-
-/* ioctls for locking in the current console. Kinky eh ? */
-
-#define CONSOLE_LOCK _IO( 'n', 20 )
-#define CONSOLE_UNLOCK _IO( 'n', 21 )
-
-/* ioctls for animation, multimedia and games */
-
-#define CONSOLE_SWOP _IO( 'n', 30 ) /* Screen Banking */
-
-#ifdef CONSOLEGFX
-struct console_line {
- int len;
- char data[128];
-};
-
-struct console_coords {
- int x, y;
-};
-
-#define CONSOLE_DRAWGFX _IOW( 'n', 31, struct console_line ) /* Screen Banking */
-#define CONSOLE_MOVE _IOW( 'n', 32, struct console_coords )
-#endif
-
-/* ioctls for configuration and control */
-
-#define CONSOLE_CURSORFLASHRATE _IOW ( 'n', 40, int )
-#define CONSOLE_MODE _IOW ( 'n', 41, struct vidc_mode )
-#define CONSOLE_MODE_ALL _IOW ( 'n', 42, struct vidc_mode )
-
-#define CONSOLE_BLANKTIME _IOW ( 'n', 44, int )
-
-/* ioctls for developers *DO NOT USE * */
-
-#define CONSOLE_SPAWN_VIDC _IOW( 'n', 100, int )
-#define CONSOLE_DEBUGPRINT _IOW( 'n', 101, int )
-
-
-/* structures and ioctls added by mark for the Xserver development */
-
-struct console_info {
- videomemory_t videomemory;
- int width;
- int height;
- int bpp;
-};
-
-struct console_palette {
- int entry;
- int red;
- int green;
- int blue;
-};
-
-#define CONSOLE_RESETSCREEN _IO( 'n', 102)
-#define CONSOLE_RESTORESCREEN _IO( 'n', 103)
-#define CONSOLE_GETINFO _IOR( 'n', 104, struct console_info )
-#define CONSOLE_PALETTE _IOW( 'n', 105, struct console_palette )
-#define CONSOLE_GETVC _IOR( 'n', 106, int )
-
-#define CONSOLE_IOCTL_COMPAT_N _IO( 'n', 107 )
-#define CONSOLE_IOCTL_COMPAT_T _IO( 't', 107 )
-
-/* End of vconsole.h */
diff --git a/sys/arch/arm32/include/vidc.h b/sys/arch/arm32/include/vidc.h
deleted file mode 100644
index d6a03030ef4..00000000000
--- a/sys/arch/arm32/include/vidc.h
+++ /dev/null
@@ -1,269 +0,0 @@
-/* $OpenBSD: vidc.h,v 1.2 2000/03/03 00:54:48 todd Exp $ */
-/* $NetBSD: vidc.h,v 1.2 1996/03/28 21:22:24 mark Exp $ */
-
-/*
- * Copyright (c) 1994,1995 Mark Brinicombe.
- * Copyright (c) 1994,1995 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * vidc.h
- *
- * VIDC20 registers
- *
- * Created : 18/09/94
- * Last updated : 08/03/95
- *
- * Based on kate/display/vidc.h
- *
- */
-
-#ifndef __vidc_h
-#define __vidc_h
-
-/* VIDC20 Base addresses */
-
-#define VIDC_HW_BASE 0x03400000
-
-#define VIDC_BASE 0xf6100000
-
-/* Video registers */
-
-#define VIDC_PALETTE 0x00000000
-#define VIDC_PALREG 0x10000000
-
-#define VIDC_BCOL 0x40000000
-#define VIDC_CP0 0x40000000
-#define VIDC_CP1 0x50000000
-#define VIDC_CP2 0x60000000
-#define VIDC_CP3 0x70000000
-
-#define VIDC_HCR 0x80000000
-#define VIDC_HSWR 0x81000000
-#define VIDC_HBSR 0x82000000
-#define VIDC_HDSR 0x83000000
-#define VIDC_HDER 0x84000000
-#define VIDC_HBER 0x85000000
-#define VIDC_HCSR 0x86000000
-#define VIDC_HIR 0x87000000
-
-#define VIDC_VCR 0x90000000
-#define VIDC_VSWR 0x91000000
-#define VIDC_VBSR 0x92000000
-#define VIDC_VDSR 0x93000000
-#define VIDC_VDER 0x94000000
-#define VIDC_VBER 0x95000000
-#define VIDC_VCSR 0x96000000
-#define VIDC_VCER 0x97000000
-
-#define VIDC_EREG 0xc0000000
-#define VIDC_FSYNREG 0xd0000000
-#define VIDC_CONREG 0xe0000000
-#define VIDC_DCTL 0xf0000000
-
-/* VIDC palette macros */
-
-#define VIDC_RED(r) (r)
-#define VIDC_GREEN(g) (g << 8)
-#define VIDC_BLUE(b) (b << 16)
-#define VIDC_COL(r, g, b) (VIDC_RED(r) | VIDC_GREEN(g) | VIDC_BLUE(b))
-
-#ifdef RC7500
-/*
- * Video frequency definitions
- */
-#define VIDFREQ_25_18 0x00
-#define VIDFREQ_28_32 0x01
-#define VIDFREQ_40_00 0x02
-#define VIDFREQ_72_00 0x03
-#define VIDFREQ_50_00 0x04
-#define VIDFREQ_77_00 0x05
-#define VIDFREQ_36_00 0x06
-#define VIDFREQ_44_90 0x07
-#define VIDFREQ_130_0 0x08
-#define VIDFREQ_120_0 0x09
-#define VIDFREQ_80_00 0x0A
-#define VIDFREQ_31_50 0x0B
-#define VIDFREQ_110_0 0x0C
-#define VIDFREQ_65_00 0x0D
-#define VIDFREQ_75_00 0x0E
-#define VIDFREQ_94_50 0x0F
-#endif
-
-
-/* Sound registers */
-
-#define VIDC_SIR0 0xa0000000
-#define VIDC_SIR1 0xa1000000
-#define VIDC_SIR2 0xa2000000
-#define VIDC_SIR3 0xa3000000
-#define VIDC_SIR4 0xa4000000
-#define VIDC_SIR5 0xa5000000
-#define VIDC_SIR6 0xa6000000
-#define VIDC_SIR7 0xa7000000
-
-#define VIDC_SFR 0xb0000000
-#define VIDC_SCR 0xb1000000
-
-#define SIR_LEFT_100 0x01
-#define SIR_LEFT_83 0x02
-#define SIR_LEFT_67 0x03
-#define SIR_CENTRE 0x04
-#define SIR_RIGHT_67 0x05
-#define SIR_RIGHT_83 0x06
-#define SIR_RIGHT_100 0x07
-
-/* Video display addresses */
-
-/* Where the display memory is mapped */
-
-#define VMEM_VBASE 0xf4000000
-
-/* Where the VRAM will be found */
-
-#define VRAM_BASE 0x02000000
-
-/* Video memory descriptor */
-
-typedef struct
- {
- u_int vidm_vbase; /* virtual base of video memory */
- u_int vidm_pbase; /* physical base of video memory */
- u_int vidm_size; /* video memory size */
- int vidm_type; /* video memory type */
- } videomemory_t;
-
-#define VIDEOMEM_TYPE_VRAM 0x01
-#define VIDEOMEM_TYPE_DRAM 0x02
-
-/* Structures and prototypes for vidc handling functions */
-
-struct vidc_state {
- int palette[256];
- int palreg;
- int bcol;
- int cp1;
- int cp2;
- int cp3;
- int hcr, hswr, hbsr, hdsr, hder, hber, hcsr;
- int hir;
- int vcr, vswr, vbsr, vdsr, vder, vber, vcsr, vcer;
- int ereg;
- int fsynreg;
- int conreg;
- int dctl;
-};
-
-#define VIDC_FREF 24000000
-
-#ifdef _KERNEL
-extern int vidc_write __P((u_int /*reg*/, int /*value*/));
-extern void vidc_setstate __P((struct vidc_state */*vidc*/));
-extern void vidc_setpalette __P((struct vidc_state */*vidc*/));
-extern void vidc_stdpalette __P(());
-extern int vidc_col __P((int /*red*/, int /*green*/, int /*blue*/));
-extern struct vidc_state vidc_current[];
-#endif
-
-struct vidc_mode {
- int pixel_rate;
- int hswr, hbsr, hdsr, hder, hber, hcr;
- int vswr, vbsr, vdsr, vder, vber, vcr;
- int bitsperpixel;
- int sync_pol;
- int frame_rate;
-};
-
-typedef struct
- {
- int chars; /* Number of characters defined in font */
- int width; /* Defined width of characters in bytes */
- int height; /* Defined height of characters in lines */
- int pixel_width; /* Width of characters in pixels */
- int pixel_height; /* Height of characters in pixels */
- int x_spacing; /* Spacing in pixels between chars */
- int y_spacing; /* Spacing in pixels between lines */
- int data_size; /* Allocated data size */
- unsigned char *data; /* Font data */
- } font_struct;
-
-#define XRES mode.hder
-#define YRES mode.vder
-#define BITSPERPIXEL mode.bitsperpixel
-
-struct vidc_info
- {
- struct vidc_mode mode;
- struct vidc_state vidc;
- font_struct *font; /* pointer to current font_struct */
- font_struct *normalfont; /* pointer to normal font struct */
- font_struct *italicfont; /* pointer to italic font struct */
- font_struct *boldfont; /* pointer to bold font struct */
- int xfontsize, yfontsize;
- int text_width, text_height;
- int bytes_per_line;
- int bytes_per_scroll;
- int pixelsperbyte;
- int screensize;
- int fast_render;
- int forecolour, forefillcolour;
- int backcolour, backfillcolour;
- int text_colours;
- int frontporch;
- int topporch; /* ;) */
- int bold;
- int reverse;
- int n_forecolour;
- int n_backcolour;
- int blanked;
- int scrollback_end;
- int flash;
- int cursor_flash;
- };
-
-#define COLOUR_BLACK_1 0x00
-#define COLOUR_WHITE_1 0x01
-
-#define COLOUR_BLACK_2 0x00
-#define COLOUR_WHITE_2 0x03
-
-#define COLOUR_BLACK_4 0x00
-#define COLOUR_WHITE_4 0x07
-
-#define COLOUR_BLACK_8 0x00
-#define COLOUR_WHITE_8 0x07
-
-#endif
-
-/* End of vidc.h */
-
diff --git a/sys/arch/arm32/include/vmparam.h b/sys/arch/arm32/include/vmparam.h
deleted file mode 100644
index 1eee5defba7..00000000000
--- a/sys/arch/arm32/include/vmparam.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* $OpenBSD: vmparam.h,v 1.2 2000/03/03 00:54:48 todd Exp $ */
-/* $NetBSD: vmparam.h,v 1.1 1996/01/31 23:23:37 mark Exp $ */
-
-/*
- * Copyright (c) 1988 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#ifndef _ARM32_VMPARAM_H_
-#define _ARM32_VMPARAM_H_
-
-#define USRTEXT VM_MIN_ADDRESS
-#define USRSTACK VM_MAXUSER_ADDRESS
-
-/*
- * Note that MAXTSIZ mustn't be greater than 32M. Otherwise you'd have
- * to change the compiler to not generate bl instructions
- */
-#define MAXTSIZ (8*1024*1024) /* max text size */
-#ifndef DFLDSIZ
-#define DFLDSIZ (16*1024*1024) /* initial data size limit */
-#endif
-#ifndef MAXDSIZ
-#define MAXDSIZ (256*1024*1024) /* max data size */
-#endif
-#ifndef DFLSSIZ
-#define DFLSSIZ (512*1024) /* initial stack size limit */
-#endif
-#ifndef MAXSSIZ
-#define MAXSSIZ (8*1024*1024) /* max stack size */
-#endif
-
-/*
- * Default sizes of swap allocation chunks (see dmap.h).
- * The actual values may be changed in vminit() based on MAXDSIZ.
- * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024.
- */
-#define DMMIN 32 /* smallest swap allocation */
-#define DMMAX 4096 /* largest potential swap allocation */
-#define DMTEXT 1024 /* swap allocation for text */
-
-/*
- * Size of shared memory map
- */
-#ifndef SHMMAXPGS
-#define SHMMAXPGS 1024
-#endif
-
-/*
- * The time for a process to be blocked before being very swappable.
- * This is a number of seconds which the system takes as being a non-trivial
- * amount of real time. You probably shouldn't change this;
- * it is used in subtle ways (fractions and multiples of it are, that is, like
- * half of a `long time'', almost a long time, etc.)
- * It is related to human patience and other factors which don't really
- * change over time.
- */
-#define MAXSLP 20
-
-/*
- * Mach derived constants
- */
-
-/*#define VM_MIN_ADDRESS ((vm_offset_t)0x00400000)*/
-#define VM_MIN_ADDRESS ((vm_offset_t)0x00001000)
-#define VM_MAXUSER_ADDRESS ((vm_offset_t)0xefc00000 - UPAGES * NBPG)
-#define VM_MAX_ADDRESS ((vm_offset_t)0xeffc0000)
-
-#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)0xf0000000)
-#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)0xffffffff)
-
-/*
- * Size of User Raw I/O map
- */
-
-#define USRIOSIZE 300
-
-/* virtual sizes (bytes) for various kernel submaps */
-
-#define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES)
-#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES)
-#define VM_PHYS_SIZE (USRIOSIZE*CLBYTES)
-
-#endif
-
-/* End of vmparam.h */
-
diff --git a/sys/arch/arm32/kshell/dumphex.c b/sys/arch/arm32/kshell/dumphex.c
deleted file mode 100644
index d45947b627a..00000000000
--- a/sys/arch/arm32/kshell/dumphex.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $NetBSD: dumphex.c,v 1.2 1996/03/18 20:32:31 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * dumphex.c
- *
- * Hex memory dump routines
- *
- * Created : 17/09/94
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-
-/* dumpb - dumps memory in bytes*/
-
-void
-dumpb(addr, count)
- u_char *addr;
- int count;
-{
- u_int byte;
- int loop;
-
- for (; count > 0; count -= 16) {
- printf("%08x: ", (int)addr);
-
- for (loop = 0; loop < 16; ++loop) {
- byte = addr[loop];
- printf("%02x ", byte);
- }
-
- printf(" ");
-
- for (loop = 0; loop < 16; ++loop) {
- byte = addr[loop];
- if (byte < 0x20)
- printf("\x1b[31m%c\x1b[0m", byte + '@');
- else if (byte == 0x7f)
- printf("\x1b[31m?\x1b[0m");
- else if (byte < 0x80)
- printf("%c", byte);
- else if (byte < 0xa0)
- printf("\x1b[32m%c\x1b[0m", byte - '@');
- else if (byte == 0xff)
- printf("\x1b[32m?\x1b[0m");
- else
- printf("%c", byte & 0x7f);
- }
-
- printf("\r\n");
- addr += 16;
- }
-}
-
-
-/* dumpw - dumps memory in bytes*/
-
-void
-dumpw(addr, count)
- u_char *addr;
- int count;
-{
- u_int byte;
- int loop;
-
- for (; count > 0; count -= 32) {
- printf("%08x: ", (int)addr);
-
- for (loop = 0; loop < 8; ++loop) {
- byte = ((u_int *)addr)[loop];
- printf("%08x ", byte);
- }
-
- printf(" ");
-
- for (loop = 0; loop < 32; ++loop) {
- byte = addr[loop];
- if (byte < 0x20)
- printf("\x1b[31m%c\x1b[0m", byte + '@');
- else if (byte == 0x7f)
- printf("\x1b[31m?\x1b[0m");
- else if (byte < 0x80)
- printf("%c", byte);
- else if (byte < 0xa0)
- printf("\x1b[32m%c\x1b[0m", byte - '@');
- else if (byte == 0xff)
- printf("\x1b[32m?\x1b[0m");
- else
- printf("%c", byte & 0x7f);
- }
-
- printf("\r\n");
- addr += 32;
- }
-}
-
-/* End of dumphex.c */
diff --git a/sys/arch/arm32/kshell/shell_disassem.c b/sys/arch/arm32/kshell/shell_disassem.c
deleted file mode 100644
index 6de632e932c..00000000000
--- a/sys/arch/arm32/kshell/shell_disassem.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/* $NetBSD: shell_disassem.c,v 1.2 1996/03/06 23:52:15 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * shell_disassem.c
- *
- * Debug / Monitor shell disassembler
- *
- * Created : 09/10/94
- */
-
-/* Include standard header files */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-/* Local header files */
-
-#include <machine/katelib.h>
-
-/* Declare external variables */
-
-/* Local function prototypes */
-
-u_int disassemble __P((u_char *));
-u_int do_disassemble __P((u_char *));
-
-/* Now for the main code */
-
-/* dis - disassembles memory */
-
-void
-shell_disassem(argc, argv)
- int argc;
- char *argv[];
-{
- u_char *addr;
-
- if (argc < 2) {
- printf("Syntax: dis <addr>\n\r");
- return;
- }
-
-/* Decode the one argument */
-
- addr = (u_char *)readhex(argv[1]);
-
- printf("Interactive disassembly\n\r");
-
- do_disassemble(addr);
-}
-
-
-u_int
-do_disassemble(addr)
- u_char *addr;
-{
- u_int result;
- int quit = 0;
- int key;
- int count = 1;
-
- do {
- result = disassemble(addr);
-
- --count;
-
- if (count == 0) {
- count = 1;
-
- key = cngetc();
-
- switch (key) {
- case 'Q' :
- case 'q' :
- case 0x1b :
- case 0x03 :
- case 0x04 :
- case 0x10b :
- quit = 1;
- break;
- case 0x09 :
- case 'r' :
- case 'R' :
- case 0x103 :
- count = 16;
- addr += 4;
- break;
-
- case 0x102 :
- count = 16;
- addr -= 124;
- break;
-
- case 0x0d :
- case 0x101 :
- addr = addr + 4;
- break;
-
- case 'B' :
- case 'b' :
- case 0x100:
- addr = addr - 4;
- break;
-
- case '+' :
- case '=' :
- case 0x104 :
- addr = addr + 0x80;
- break;
-
- case '-' :
- case '_' :
- case 0x105 :
- addr = addr - 0x80;
- break;
-
- case ' ' :
- quit = do_disassemble((u_char *)result);
- break;
-
- case 'J' :
- case 'j' :
- addr = (u_char *)result;
- break;
-
- case '/' :
- case '?' :
- printf("\'\xe3\' - Backwards 1 word\n\r");
- printf("\'\xe4\' - Forwards 1 word\n\r");
- printf("\'\xe5\' - Backwords 16 words\n\r");
- printf("\'\xe6\' - Forwards 16 words\n\r");
- printf("\'Q\' - Quit\n\r");
- printf("\'B\' - Back a word\n\r");
- printf("\'R\' - Disassemble 16 words\n\r");
- printf("\'J\' - Jump to address\n\r");
- printf("\' \' - Branch to address\n\r");
- printf("<BS> - Return from branch\n\r");
- printf("\'-\' - Skip backwards 128 words\n\r");
- printf("\'+\' - Skip forwards 128 words\n\r");
- break;
-
- }
- } else {
- addr += 4;
- }
- } while (!quit && key != 0x08);
-
- return(quit);
-}
-
-/* End of shell_disassem.c */
diff --git a/sys/arch/arm32/kshell/shell_input.c b/sys/arch/arm32/kshell/shell_input.c
deleted file mode 100644
index 07cbd576e3c..00000000000
--- a/sys/arch/arm32/kshell/shell_input.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/* $NetBSD: shell_input.c,v 1.2 1996/03/06 23:44:07 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * shell_input.c
- *
- * string input functions
- *
- * Created : 09/10/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-
-/*#define SOFT_CURSOR*/
-
-/* Declare global variables */
-
-/* Prototype declarations */
-
-char *strchr __P((const char *, int));
-
-void deleteline __P((int, int));
-
-/*
- * Reads a line from the keyboard into an input buffer allowing
- * cursor editing and input history.
- */
-
-int
-readstring(string, length, valid_string, insert)
- char *string;
- int length;
- char *valid_string;
- char *insert;
-{
- int key;
- int loop;
- int entered;
- int insert_mode = 1;
-
-/*
- * If we have text to preinsert into the buffer enter it and echo it
- * to the display.
- */
-
- if (insert && insert[0] != 0) {
- strcpy(string, insert);
- loop = strlen(insert);
- printf("%s", insert);
- } else
- loop = 0;
-
- entered = loop;
-
-/*
- * The main loop.
- * Keep looping until return or CTRL-D is pressed.
- */
-
- do {
-#ifdef SOFT_CURSOR
-/*
- * Display the cursor depending on what mode we are in
- */
- if (!insert_mode)
- printf("\xe2");
- else
- printf("\xe1");
-#endif
-
-/*
- * Read the keyboard
- */
-
- key = cngetc();
-
-#ifdef SOFT_CURSOR
-/*
- * Remove the cursor, restoring the text under it if necessary.
- */
-
- if (loop == entered || entered == 0)
- printf("\x7f");
- else
- printf("\x08%c\x08", string[loop]);
-#endif
-
-/*
- * Decode the key
- */
-
- switch (key) {
-/*
- * DELETE
- */
-
- case 0x109 :
- case 0x7f :
- {
- int loop1;
-
- if (loop == entered) break;
- for (loop1 = loop; loop1 < (entered - 1); ++loop1) {
- string[loop1] = string[loop1+1];
- }
- --entered;
- string[entered] = 0;
-/* printf("\x1b[s%s \x1b[u", &string[loop]);*/
- printf("\r%s \r", string);
- for (loop1 = 0; loop1 <= loop; ++loop1)
- printf("\x09");
- }
- break;
-
-/*
- * BACKSPACE
- */
-
- case 0x08 :
- {
- int loop1;
-
- if (loop == 0) {
- printf("\x07");
- break;
- }
- for (loop1 = loop-1; loop1 < (entered - 1); ++loop1) {
- string[loop1] = string[loop1+1];
- }
- --loop;
- --entered;
- string[entered] = 0;
-/* printf("\x1b[D\x1b[s%s \x1b[u", &string[loop]);*/
- printf("\r%s \r", string);
- for (loop1 = 0; loop1 < loop; ++loop1)
- printf("\x09");
- }
- break;
-
-/*
- * CTRL-U
- */
- case 0x15 :
- deleteline(loop, entered);
- loop = 0;
- entered = 0;
- break;
-
-/*
- * CTRL-A
- */
- case 0x01 :
- insert_mode = !insert_mode;
- break;
-
-/*
- * CTRL-D
- */
- case 0x04 :
- return(-1);
- break;
-
-/*
- * CURSOR LEFT
- */
-
- case 0x102 :
- --loop;
- if (loop < 0)
- loop = 0;
- else
- printf("\x1b[D");
- break;
-
-/*
- * CURSOR RIGHT
- */
-
- case 0x103 :
- ++loop;
- if (loop > entered)
- loop = entered;
- else
- printf("\x1b[C");
- break;
-
-/*
- * RETURN
- */
-
- case 0x0d :
- case 0x0a :
- break;
-
-/*
- * Another key
- */
-
- default :
-
-/*
- * Check for a valid key to enter
- */
-
- if (key < 0x100 && key > 0x1f
- && (valid_string == NULL || strchr(valid_string, key))) {
- if (!insert_mode && loop < length) {
- string[loop] = key;
- printf("%c", key);
- ++loop;
- if (loop > entered) entered = loop;
- }
- else if (entered < length) {
- int loop1;
-
- for (loop1 = entered; loop1 >= loop; --loop1) {
- string[loop1+1] = string[loop1];
- }
- string[loop] = key;
- ++loop;
- ++entered;
- string[entered] = 0;
- if (loop != entered) printf("\x1b[s");
- printf("%s", &string[loop-1]);
- if (loop != entered) printf("\x1b[u\x1b[C");
- } else {
- printf("\x07");
- }
- }
- break;
- }
- } while (key != 0x0d && key != 0x0a);
-
- printf("\n\r");
-
- string[entered] = 0;
-
- return(entered);
-}
-
-
-/* This erases a line of text */
-
-void
-deleteline(loop, entered)
- int loop;
- int entered;
-{
- while (loop < entered) {
- ++loop;
- printf("\x1b[C");
- }
-
- while (loop > 0) {
- --loop;
- --entered;
- printf("\x7f");
- }
-}
-
-/* End of shell_input.c */
diff --git a/sys/arch/arm32/kshell/shell_shell.c b/sys/arch/arm32/kshell/shell_shell.c
deleted file mode 100644
index 870e4a1434a..00000000000
--- a/sys/arch/arm32/kshell/shell_shell.c
+++ /dev/null
@@ -1,662 +0,0 @@
-/* $NetBSD: shell_shell.c,v 1.5 1996/04/19 20:15:36 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1996 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * shell_shell.c
- *
- * Debug / Monitor shell entry and commands
- *
- * Created : 09/10/94
- */
-
-/* Include standard header files */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/proc.h>
-#include <sys/device.h>
-#include <sys/vnode.h>
-#include <vm/vm.h>
-
-/* Local header files */
-
-#include <machine/pmap.h>
-#include <machine/katelib.h>
-#include <machine/vidc.h>
-#include <machine/rtc.h>
-
-/* Declare global variables */
-
-/* Local function prototypes */
-
-char *strchr __P((const char *, int));
-
-void dumpb __P((u_char */*addr*/, int /*count*/));
-void dumpw __P((u_char */*addr*/, int /*count*/));
-
-int readstring __P((char *, int, char *, char *));
-
-void debug_show_q_details __P((void));
-void shell_disassem __P((int argc, char *argv[]));
-void shell_devices __P((int argc, char *argv[]));
-void shell_vmmap __P((int argc, char *argv[]));
-void shell_flush __P((int argc, char *argv[]));
-void shell_pextract __P((int argc, char *argv[]));
-void shell_vnode __P((int argc, char *argv[]));
-void debug_show_all_procs __P((int argc, char *argv[]));
-void debug_show_callout __P((int argc, char *argv[]));
-void debug_show_fs __P((int argc, char *argv[]));
-void debug_show_vm_map __P((vm_map_t map, char *text));
-void debug_show_pmap __P((pmap_t pmap));
-void pmap_dump_pvs __P((void));
-void bootsync __P((void));
-
-/* Now for the main code */
-
-/* readhex
- *
- * This routine interprets the input string as a sequence of hex characters
- * and returns it as an integer.
- */
-
-int
-readhex(buf)
- char *buf;
-{
- int value;
- int nibble;
-
- if (buf == NULL)
- return(0);
-
-/* skip any spaces */
-
- while (*buf == ' ')
- ++buf;
-
-/* return 0 if a zero length string is passed */
-
- if (*buf == 0)
- return(0);
-
-/* Convert the characters */
-
- value = 0;
-
- while (*buf != 0 && strchr("0123456789abcdefABCDEF", *buf) != 0) {
- nibble = (*buf - '0');
- if (nibble > 9) nibble -= 7;
- if (nibble > 15) nibble -= 32;
- value = (value << 4) | nibble;
- ++buf;
- }
-
- return(value);
-}
-
-
-/* poke - writes a byte/word to memory */
-
-void
-shell_poke(argc, argv)
- int argc;
- char *argv[];
-{
- u_int addr;
- u_int data;
-
- if (argc < 3) {
- printf("Syntax: poke[bw] <addr> <data>\n\r");
- return;
- }
-
-/* Decode the two arguments */
-
- addr = readhex(argv[1]);
- data = readhex(argv[2]);
-
- if (argv[0][4] == 'b')
- WriteByte(addr, data);
- if (argv[0][4] == 'w')
- WriteWord(addr, data);
-}
-
-
-/* peek - reads a byte/word from memory*/
-
-void
-shell_peek(argc, argv)
- int argc;
- char *argv[];
-{
- u_int addr;
- u_int data;
-
- if (argc < 2) {
- printf("Syntax: peek[bw] <addr>\n\r");
- return;
- }
-
-/* Decode the one argument */
-
- addr = readhex(argv[1]);
-
- if (argv[0][4] == 'b')
- data = ReadByte(addr);
- if (argv[0][4] == 'w')
- data = ReadWord(addr);
-
- printf("%08x : %08x\n\r", addr, data);
-}
-
-
-/* dumpb - dumps memory in bytes*/
-
-void
-shell_dumpb(argc, argv)
- int argc;
- char *argv[];
-{
- u_char *addr;
- int count;
-
- if (argc < 2) {
- printf("Syntax: dumpb <addr> [<bytes>]\n\r");
- return;
- }
-
-/* Decode the one argument */
-
- addr = (u_char *)readhex(argv[1]);
-
- if (argc > 2)
- count = readhex(argv[2]);
- else
- count = 0x80;
-
- dumpb(addr, count);
-}
-
-
-/* dumpw - dumps memory in bytes*/
-
-void
-shell_dumpw(argc, argv)
- int argc;
- char *argv[];
-{
- u_char *addr;
- int count;
-
- if (argc < 2) {
- printf("Syntax: dumpw <addr> [<bytes>]\n\r");
- return;
- }
-
-/* Decode the one argument */
-
- addr = (u_char *)readhex(argv[1]);
-
- if (argc > 2)
- count = readhex(argv[2]);
- else
- count = 0x80;
-
- dumpw(addr, count);
-}
-
-
-/* vmmap - dumps the vmmap */
-
-void
-shell_vmmap(argc, argv)
- int argc;
- char *argv[];
-{
- u_char *addr;
-
- if (argc < 2) {
- printf("Syntax: vmmap <map addr>\n\r");
- return;
- }
-
-/* Decode the one argument */
-
- addr = (u_char *)readhex(argv[1]);
-
- debug_show_vm_map((vm_map_t)addr, argv[1]);
-}
-
-
-/* pmap - dumps the pmap */
-
-void
-shell_pmap(argc, argv)
- int argc;
- char *argv[];
-{
- u_char *addr;
-
- if (argc < 2) {
- printf("Syntax: pmap <pmap addr>\n\r");
- return;
- }
-
-/* Decode the one argument */
-
- addr = (u_char *)readhex(argv[1]);
-
- debug_show_pmap((pmap_t)addr);
-}
-
-
-/*
- * void shell_devices(int argc, char *argv[])
- *
- * Display all the devices
- */
-
-extern struct cfdata cfdata[];
-
-void
-shell_devices(argc, argv)
- int argc;
- char *argv[];
-{
- struct cfdata *cf;
- struct cfdriver *cd;
- struct device *dv;
- int loop;
- char *state;
-
- printf(" driver unit state name\n");
- for (cf = cfdata; cf->cf_driver; ++cf) {
- cd = cf->cf_driver;
- if (cf->cf_fstate & FSTATE_FOUND)
- state = "FOUND ";
- else
- state = "NOT FOUND";
-
- printf("%08x %2d %s %s\n", (u_int)cd, (u_int)cf->cf_unit,
- state, cd->cd_name);
-
- if (cf->cf_fstate & FSTATE_FOUND) {
- for (loop = 0; loop < cd->cd_ndevs; ++loop) {
- dv = (struct device *)cd->cd_devs[loop];
- if (dv != 0)
- printf(" %s (%08x)\n",
- dv->dv_xname, (u_int) dv);
- }
- }
- printf("\n");
- }
-}
-
-
-void
-shell_reboot(argc, argv)
- int argc;
- char *argv[];
-{
- printf("Running shutdown hooks ...\n");
- doshutdownhooks();
-
- IRQdisable;
- boot0();
-}
-
-void
-forceboot(argc, argv)
- int argc;
- char *argv[];
-{
- cmos_write(0x90, cmos_read(0x90) | 0x02);
- shell_reboot(0, NULL);
-}
-
-
-void
-shell_flush(argc, argv)
- int argc;
- char *argv[];
-{
- idcflush();
- tlbflush();
-}
-
-
-void
-shell_vmstat(argc, argv)
- int argc;
- char *argv[];
-{
- struct vmmeter sum;
-
- sum = cnt;
- (void)printf("%9u cpu context switches\n", sum.v_swtch);
- (void)printf("%9u device interrupts\n", sum.v_intr);
- (void)printf("%9u software interrupts\n", sum.v_soft);
- (void)printf("%9u traps\n", sum.v_trap);
- (void)printf("%9u system calls\n", sum.v_syscall);
- (void)printf("%9u total faults taken\n", sum.v_faults);
- (void)printf("%9u swap ins\n", sum.v_swpin);
- (void)printf("%9u swap outs\n", sum.v_swpout);
- (void)printf("%9u pages swapped in\n", sum.v_pswpin / CLSIZE);
- (void)printf("%9u pages swapped out\n", sum.v_pswpout / CLSIZE);
- (void)printf("%9u page ins\n", sum.v_pageins);
- (void)printf("%9u page outs\n", sum.v_pageouts);
- (void)printf("%9u pages paged in\n", sum.v_pgpgin);
- (void)printf("%9u pages paged out\n", sum.v_pgpgout);
- (void)printf("%9u pages reactivated\n", sum.v_reactivated);
- (void)printf("%9u intransit blocking page faults\n", sum.v_intrans);
- (void)printf("%9u zero fill pages created\n", sum.v_nzfod / CLSIZE);
- (void)printf("%9u zero fill page faults\n", sum.v_zfod / CLSIZE);
- (void)printf("%9u pages examined by the clock daemon\n", sum.v_scan);
- (void)printf("%9u revolutions of the clock hand\n", sum.v_rev);
- (void)printf("%9u VM object cache lookups\n", sum.v_lookups);
- (void)printf("%9u VM object hits\n", sum.v_hits);
- (void)printf("%9u total VM faults taken\n", sum.v_vm_faults);
- (void)printf("%9u copy-on-write faults\n", sum.v_cow_faults);
- (void)printf("%9u pages freed by daemon\n", sum.v_dfree);
- (void)printf("%9u pages freed by exiting processes\n", sum.v_pfree);
- (void)printf("%9u pages free\n", sum.v_free_count);
- (void)printf("%9u pages wired down\n", sum.v_wire_count);
- (void)printf("%9u pages active\n", sum.v_active_count);
- (void)printf("%9u pages inactive\n", sum.v_inactive_count);
- (void)printf("%9u bytes per page\n", sum.v_page_size);
-}
-
-
-void
-shell_pextract(argc, argv)
- int argc;
- char *argv[];
-{
- u_char *addr;
- vm_offset_t pa;
- int pind;
-
- if (argc < 2) {
- printf("Syntax: pextract <addr>\n\r");
- return;
- }
-
-/* Decode the one argument */
-
- addr = (u_char *)readhex(argv[1]);
-
- pa = pmap_extract(kernel_pmap, (vm_offset_t)addr);
- pind = pmap_page_index(pa);
-
- printf("va=%08x pa=%08x pind=%d\n", (u_int)addr, (u_int)pa, pind);
-}
-
-
-void
-shell_vnode(argc, argv)
- int argc;
- char *argv[];
-{
- struct vnode *vp;
-
- if (argc < 2) {
- printf("Syntax: vnode <vp>\n\r");
- return;
- }
-
-/* Decode the one argument */
-
- vp = (struct vnode *)readhex(argv[1]);
-
- printf("vp = %08x\n", (u_int)vp);
- printf("vp->v_type = %d\n", vp->v_type);
- printf("vp->v_flag = %ld\n", vp->v_flag);
- printf("vp->v_usecount = %d\n", vp->v_usecount);
- printf("vp->v_writecount = %d\n", vp->v_writecount);
- printf("vp->v_numoutput = %ld\n", vp->v_numoutput);
-
- vprint("vnode:", vp);
-}
-
-#if 0
-void
-shell_vndbuf(argc, argv)
- int argc;
- char *argv[];
-{
- struct vnode *vp;
-
- if (argc < 2) {
- printf("Syntax: vndbuf <vp>\n\r");
- return;
- }
-
-/* Decode the one argument */
-
- vp = (struct vnode *)readhex(argv[1]);
-
- dumpvndbuf(vp);
-}
-
-
-void
-shell_vncbuf(argc, argv)
- int argc;
- char *argv[];
-{
- struct vnode *vp;
-
- if (argc < 2) {
- printf("Syntax: vndbuf <vp>\n\r");
- return;
- }
-
-/* Decode the one argument */
-
- vp = (struct vnode *)readhex(argv[1]);
-
- dumpvncbuf(vp);
-}
-#endif
-
-/* shell - a crude shell */
-
-int
-shell()
-{
- int quit = 0;
- char buffer[200];
- char *ptr;
- char *ptr1;
- int args;
- char *argv[20];
-
- printf("\nRiscBSD debug/monitor shell\n");
- printf("CTRL-D, exit or reboot to terminate\n\n");
-
- do {
-/* print prompt */
-
- printf("kshell> ");
-
-/* Read line from keyboard */
-
- if (readstring(buffer, 200, NULL, NULL) == -1)
- return(0);
-
- ptr = buffer;
-
-/* Slice leading spaces */
-
- while (*ptr == ' ')
- ++ptr;
-
-/* Loop back if zero length string */
-
- if (*ptr == 0)
- continue;
-
-/* Count the number of space separated args */
-
- args = 0;
- ptr1 = ptr;
-
- while (*ptr1 != 0) {
- if (*ptr1 == ' ') {
- ++args;
- while (*ptr1 == ' ')
- ++ptr1;
- } else
- ++ptr1;
- }
-
-/*
- * Construct the array of pointers to the args and terminate
- * each argument with 0x00
- */
-
- args = 0;
- ptr1 = ptr;
-
- while (*ptr1 != 0) {
- argv[args] = ptr1;
- ++args;
- while (*ptr1 != ' ' && *ptr1 != 0)
- ++ptr1;
-
- while (*ptr1 == ' ') {
- *ptr1 = 0;
- ++ptr1;
- }
- }
-
- argv[args] = NULL;
-
-/* Interpret commands */
-
- if (strcmp(argv[0], "exit") == 0)
- quit = 1;
-#ifdef DDB
- else if (strcmp(argv[0], "deb") == 0)
- Debugger();
-#endif
- else if (strcmp(argv[0], "peekb") == 0)
- shell_peek(args, argv);
- else if (strcmp(argv[0], "pokeb") == 0)
- shell_poke(args, argv);
- else if (strcmp(argv[0], "peekw") == 0)
- shell_peek(args, argv);
- else if (strcmp(argv[0], "pokew") == 0)
- shell_poke(args, argv);
- else if (strcmp(argv[0], "dumpb") == 0)
- shell_dumpb(args, argv);
- else if (strcmp(argv[0], "reboot") == 0)
- shell_reboot(args, argv);
- else if (strcmp(argv[0], "dumpw") == 0)
- shell_dumpw(args, argv);
- else if (strcmp(argv[0], "dump") == 0)
- shell_dumpw(args, argv);
- else if (strcmp(argv[0], "dis") == 0)
- shell_disassem(args, argv);
- else if (strcmp(argv[0], "qs") == 0)
- debug_show_q_details();
- else if (strcmp(argv[0], "ps") == 0)
- debug_show_all_procs(args, argv);
- else if (strcmp(argv[0], "callouts") == 0)
- debug_show_callout(args, argv);
- else if (strcmp(argv[0], "devices") == 0)
- shell_devices(args, argv);
- else if (strcmp(argv[0], "listfs") == 0)
- debug_show_fs(args, argv);
- else if (strcmp(argv[0], "vmmap") == 0)
- shell_vmmap(args, argv);
- else if (strcmp(argv[0], "pmap") == 0)
- shell_pmap(args, argv);
- else if (strcmp(argv[0], "flush") == 0)
- shell_flush(args, argv);
- else if (strcmp(argv[0], "vmstat") == 0)
- shell_vmstat(args, argv);
- else if (strcmp(argv[0], "pdstat") == 0)
- pmap_pagedir_dump();
- else if (strcmp(argv[0], "traceback") == 0)
- traceback();
- else if (strcmp(argv[0], "forceboot") == 0)
- forceboot(args, argv);
- else if (strcmp(argv[0], "dumppvs") == 0)
- pmap_dump_pvs();
- else if (strcmp(argv[0], "pextract") == 0)
- shell_pextract(args, argv);
- else if (strcmp(argv[0], "vnode") == 0)
- shell_vnode(args, argv);
- else if (strcmp(argv[0], "ascdump") == 0)
- asc_dump();
- else if (strcmp(argv[0], "help") == 0
- || strcmp(argv[0], "?") == 0) {
- printf("peekb <hexaddr>\r\n");
- printf("pokeb <hexaddr> <data>\r\n");
- printf("peekw <hexaddr>\r\n");
- printf("pokew <hexaddr <data>\r\n");
- printf("dis <hexaddr>\r\n");
- printf("dumpb <hexaddr> [length]\r\n");
- printf("dumpw <hexaddr> [length]\r\n");
- printf("dump <hexaddr> [length]\r\n");
- printf("reboot\r\n");
- printf("qs\r\n");
- printf("ps [m]\r\n");
- printf("vmstat\n");
- printf("listfs\n");
- printf("devices\n");
- printf("callouts\n");
- printf("prompt\r\n");
- printf("vmmap <vmmap addr>\r\n");
- printf("pmap <pmap addr>\r\n");
- printf("pdstat\r\n");
- printf("flush\r\n");
- printf("exit\r\n");
- printf("forceboot\r\n");
- printf("dumppvs\r\n");
- printf("pextract <phys addr>\r\n");
- printf("vnode <vp>\r\n");
- printf("ascdump\r\n");
- }
- } while (!quit);
-
- return(0);
-}
-
-/* End of shell_shell.c */
diff --git a/sys/arch/arm32/kshell/strchr.c b/sys/arch/arm32/kshell/strchr.c
deleted file mode 100644
index 8caae137277..00000000000
--- a/sys/arch/arm32/kshell/strchr.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* $NetBSD: strchr.c,v 1.2 1996/03/18 20:32:34 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD kernel team.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#include <sys/param.h>
-
-char *
-strchr(s, c)
- register char *s;
- int c;
-{
- do {
- if (*s == c) {
- return (s);
- }
- } while (*s++);
- return (0);
-}
-
-/* End of strchr.c */
diff --git a/sys/arch/arm32/mainbus/beep.c b/sys/arch/arm32/mainbus/beep.c
deleted file mode 100644
index fd4adaa3ea6..00000000000
--- a/sys/arch/arm32/mainbus/beep.c
+++ /dev/null
@@ -1,369 +0,0 @@
-/* $NetBSD: beep.c,v 1.4 1996/03/27 22:08:36 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD team.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Simple beep sounds using VIDC
- */
-
-/*
- * To use the driver, open /dev/beep and write lines.
- * Each write will generate a beep
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/kernel.h>
-#include <sys/types.h>
-#include <sys/device.h>
-#include <sys/proc.h>
-#include <sys/time.h>
-#include <sys/errno.h>
-#include <dev/cons.h>
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-
-#include <machine/irqhandler.h>
-#include <machine/katelib.h>
-#include <machine/iomd.h>
-#include <machine/vidc.h>
-#include <machine/pmap.h>
-#include <machine/beep.h>
-#include <arm32/mainbus/mainbus.h>
-#include <arm32/mainbus/waveform.h>
-
-#include "beep.h"
-
-struct beep_softc {
- struct device sc_device;
- irqhandler_t sc_ih;
- int sc_iobase;
- int sc_open;
- int sc_count;
- u_int sc_sound_cur0;
- u_int sc_sound_end0;
- u_int sc_sound_cur1;
- u_int sc_sound_end1;
- vm_offset_t sc_buffer0;
- vm_offset_t sc_buffer1;
-};
-
-int beepprobe __P((struct device *parent, void *match, void *aux));
-void beepattach __P((struct device *parent, struct device *self, void *aux));
-int beepopen __P((dev_t, int, int, struct proc *));
-int beepclose __P((dev_t, int, int, struct proc *));
-int beepintr __P((struct beep_softc *sc));
-void beepdma __P((struct beep_softc *sc, int buf));
-
-struct cfattach beep_ca = {
- sizeof(struct beep_softc), beepprobe, beepattach
-};
-
-struct cfdriver beep_cd = {
- NULL, "beep", DV_TTY
-};
-
-
-int
-beepprobe(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
-{
-/* struct mainbus_attach_args *mb = aux;*/
- int id;
-
-/* Make sure we have an IOMD we understand */
-
- id = ReadByte(IOMD_ID0) | (ReadByte(IOMD_ID1) << 8);
-
-/* So far I only know about this IOMD */
-
- switch (id) {
- case RPC600_IOMD_ID:
- return(1);
- break;
- default:
- printf("beep: Unknown IOMD id=%04x", id);
- break;
- }
- return(0);
-}
-
-
-void
-beepattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct beep_softc *sc = (void *)self;
- struct mainbus_attach_args *mb = aux;
-
- sc->sc_iobase = mb->mb_iobase;
- sc->sc_open = 0;
- sc->sc_count = 0;
-
- sc->sc_buffer0 = kmem_alloc(kernel_map, NBPG);
- if (sc->sc_buffer0 == 0)
- panic("beep: Cannot allocate buffer memory");
- if ((sc->sc_buffer0 & (NBPG -1)) != 0)
- panic("beep: Cannot allocate page aligned buffer");
- sc->sc_buffer1 = sc->sc_buffer0;
-
- sc->sc_sound_cur0 = pmap_extract(kernel_pmap,
- (vm_offset_t)sc->sc_buffer0 & PG_FRAME);
- sc->sc_sound_end0 = (sc->sc_sound_cur0 + NBPG - 16) | 0x00000000;
- sc->sc_sound_cur1 = pmap_extract(kernel_pmap,
- (vm_offset_t)sc->sc_buffer1 & PG_FRAME);
- sc->sc_sound_end1 = (sc->sc_sound_cur1 + NBPG - 16) | 0x00000000;
-
- bcopy(beep_waveform, (void *)sc->sc_buffer0, sizeof(beep_waveform));
-
-/* Reset the sound DMA channel */
-
- WriteWord(IOMD_SD0CURA, sc->sc_sound_cur0);
- WriteWord(IOMD_SD0ENDA, sc->sc_sound_end0 | 0xc0000000);
- WriteWord(IOMD_SD0CURB, sc->sc_sound_cur1);
- WriteWord(IOMD_SD0ENDB, sc->sc_sound_end1 | 0xc0000000);
-
- WriteByte(IOMD_SD0CR, 0x90);
-
-/* Install an IRQ handler */
-
- sc->sc_ih.ih_func = beepintr;
- sc->sc_ih.ih_arg = sc;
- sc->sc_ih.ih_level = IPL_NONE;
- sc->sc_ih.ih_name = "dma snd ch 0";
-
- if (irq_claim(IRQ_DMASCH0, &sc->sc_ih))
- panic("Cannot claim DMASCH0 IRQ for beep%d", parent->dv_unit);
-
- disable_irq(IRQ_DMASCH0);
-
-/*
- printf(" [ buf0=%08x:%08x->%08x buf1=%08x:%08x->%08x ]",
- (u_int)sc->sc_buffer0, sc->sc_sound_cur0, sc->sc_sound_end0,
- (u_int)sc->sc_buffer1, sc->sc_sound_cur1, sc->sc_sound_end1);
-*/
- printf("\n");
-
-/* Set sample rate to 32us */
-
- WriteWord(VIDC_BASE, VIDC_SFR | 32);
-
-/* Set the stereo postions to centred for all channels */
-
- WriteWord(VIDC_BASE, VIDC_SIR0 | SIR_CENTRE);
- WriteWord(VIDC_BASE, VIDC_SIR1 | SIR_CENTRE);
- WriteWord(VIDC_BASE, VIDC_SIR2 | SIR_CENTRE);
- WriteWord(VIDC_BASE, VIDC_SIR3 | SIR_CENTRE);
- WriteWord(VIDC_BASE, VIDC_SIR4 | SIR_CENTRE);
- WriteWord(VIDC_BASE, VIDC_SIR5 | SIR_CENTRE);
- WriteWord(VIDC_BASE, VIDC_SIR6 | SIR_CENTRE);
- WriteWord(VIDC_BASE, VIDC_SIR7 | SIR_CENTRE);
-}
-
-
-int
-beepopen(dev, flag, mode, p)
- dev_t dev;
- int flag;
- int mode;
- struct proc *p;
-{
- struct beep_softc *sc;
- int unit = minor(dev);
- int s;
-
- if (unit >= beep_cd.cd_ndevs)
- return(ENXIO);
-
- sc = beep_cd.cd_devs[unit];
- if (!sc) return(ENXIO);
-
-/* HACK hack hack */
-
- s = splhigh();
- if (sc->sc_open) {
- (void)splx(s);
- return(EBUSY);
- }
-
- ++sc->sc_open;
- (void)splx(s);
-
- return(0);
-}
-
-
-int
-beepclose(dev, flag, mode, p)
- dev_t dev;
- int flag;
- int mode;
- struct proc *p;
-{
- int unit = minor(dev);
- struct beep_softc *sc = beep_cd.cd_devs[unit];
- int s;
-
- if (sc->sc_open == 0) return(ENXIO);
-
-/* HACK hack hack */
-
- s = splhigh();
- --sc->sc_open;
- (void)splx(s);
-
- return(0);
-}
-
-
-void
-beep_generate(void)
-{
- struct beep_softc *sc = beep_cd.cd_devs[0];
-/* int status;*/
-
- if (sc->sc_count > 0) {
-/* printf("beep: active\n");*/
- return;
- }
-/* printf("beep: generate ");*/
- ++sc->sc_count;
-
-/* status = ReadByte(IOMD_SD0ST);
- printf("st=%02x\n", status);*/
- WriteByte(IOMD_SD0CR, 0x90);
- WriteByte(IOMD_SD0CR, 0x30);
- beepdma(sc, 0);
-}
-
-
-int
-beepioctl(dev, cmd, data, flag, p)
- dev_t dev;
- int cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- struct beep_softc *sc = beep_cd.cd_devs[minor(dev)];
- int rate;
- struct wavebuffer *wave = (struct wavebuffer *)data;
-
- switch (cmd) {
- case BEEP_GENERATE:
- beep_generate();
- break;
-
- case BEEP_SETRATE:
- rate = *(int *)data;
-
- if (rate < 3 || rate > 255)
- return(EINVAL);
-
- WriteWord(VIDC_BASE, VIDC_SFR | rate);
- break;
-
- case BEEP_SET:
- printf("set %08x\n", (u_int)data);
- printf("set %08x %08x\n", (u_int)wave->addr, wave->size);
- if (wave->size < 16 || wave->size > NBPG)
- return(ENXIO);
- copyin(wave->addr, (char *)sc->sc_buffer0, wave->size);
- sc->sc_sound_end0 = (sc->sc_sound_cur0 + wave->size - 16);
- sc->sc_sound_end1 = (sc->sc_sound_cur1 + wave->size - 16);
- break;
-
- default:
- return(ENXIO);
- break;
- }
-
- return(0);
-}
-
-
-int
-beepintr(sc)
- struct beep_softc *sc;
-{
-/* printf("beepintr: %02x,%02x,%02x,%d\n", ReadByte(IOMD_DMARQ),
- ReadByte(IOMD_SD0CR), ReadByte(IOMD_SD0ST), sc->sc_count);*/
- WriteByte(IOMD_DMARQ, 0x10);
- --sc->sc_count;
- if (sc->sc_count <= 0) {
- WriteWord(IOMD_SD0CURB, sc->sc_sound_cur1);
- WriteWord(IOMD_SD0ENDB, sc->sc_sound_end1 | (1 << 30));
- disable_irq(IRQ_DMASCH0);
-/* printf("stop:st=%02x\n", ReadByte(IOMD_SD0ST));*/
- return(1);
- }
-
- beepdma(sc, sc->sc_count & 1);
- return(1);
-}
-
-
-void
-beepdma(sc, buf)
- struct beep_softc *sc;
- int buf;
-{
- int status;
-/* printf("beep:dma %d", buf); */
- status = ReadByte(IOMD_SD0ST);
-/* printf("st=%02x\n", status);*/
-
- if (buf == 0) {
- WriteWord(IOMD_SD0CURA, sc->sc_sound_cur0);
- WriteWord(IOMD_SD0ENDA, sc->sc_sound_end0);
- WriteWord(IOMD_SD0CURB, sc->sc_sound_cur1);
- WriteWord(IOMD_SD0ENDB, sc->sc_sound_end1 | (1 << 30));
- }
-
- if (buf == 1) {
- WriteWord(IOMD_SD0CURB, sc->sc_sound_cur1);
- WriteWord(IOMD_SD0ENDB, sc->sc_sound_end1 | (1 << 30));
- }
-
-/* status = ReadByte(IOMD_SD0ST);
- printf("st=%02x\n", status);*/
-
- enable_irq(IRQ_DMASCH0);
-}
-
-/* End of beep.c */
diff --git a/sys/arch/arm32/mainbus/com.c b/sys/arch/arm32/mainbus/com.c
deleted file mode 100644
index a22a93c076c..00000000000
--- a/sys/arch/arm32/mainbus/com.c
+++ /dev/null
@@ -1,1034 +0,0 @@
-/* $NetBSD: com.c,v 1.5 1996/03/28 21:52:32 mark Exp $ */
-
-/*-
- * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved.
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)com.c 7.5 (Berkeley) 5/16/91
- */
-
-/*
- * COM driver, based on HP dca driver
- * uses National Semiconductor NS16450/NS16550AF UART
- */
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/select.h>
-#include <sys/tty.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/uio.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/types.h>
-#include <sys/device.h>
-
-#include <machine/cpu.h>
-#include <machine/katelib.h>
-#include <machine/irqhandler.h>
-#include <machine/io.h>
-#include <arm32/mainbus/comreg.h>
-#include <arm32/mainbus/mainbus.h>
-
-#define com_lcr com_cfcr
-
-#define COM_IBUFSIZE (2 * 256)
-#define COM_IHIGHWATER ((3 * COM_IBUFSIZE) / 4)
-
-struct com_softc {
- struct device sc_dev;
- irqhandler_t sc_ih;
- struct tty *sc_tty;
-
- int sc_overflows;
- int sc_floods;
- int sc_errors;
-
- int sc_iobase;
- u_char sc_hwflags;
-#define COM_HW_NOIEN 0x01
-#define COM_HW_FIFO 0x02
-#define COM_HW_CONSOLE 0x40
- u_char sc_swflags;
-#define COM_SW_SOFTCAR 0x01
-#define COM_SW_CLOCAL 0x02
-#define COM_SW_CRTSCTS 0x04
-#define COM_SW_MDMBUF 0x08
- u_char sc_msr, sc_mcr, sc_lcr;
- u_char sc_dtr;
-
- u_char *sc_ibuf, *sc_ibufp, *sc_ibufhigh, *sc_ibufend;
- u_char sc_ibufs[2][COM_IBUFSIZE];
-};
-
-int comprobe __P((struct device *, void *, void *));
-void comattach __P((struct device *, struct device *, void *));
-int comopen __P((dev_t, int, int, struct proc *));
-int comclose __P((dev_t, int, int, struct proc *));
-void comdiag __P((void *));
-int comintr __P((void *));
-void compoll __P((void *));
-int comparam __P((struct tty *, struct termios *));
-void comstart __P((struct tty *));
-
-struct cfattach com_ca = {
- sizeof(struct com_softc), comprobe, comattach
-};
-
-struct cfdriver com_cd = {
- NULL, "com", DV_TTY
-};
-
-int comdefaultrate = TTYDEF_SPEED;
-#ifdef COMCONSOLE
-int comconsole = COMCONSOLE;
-#else
-int comconsole = -1;
-#endif
-int comconsinit;
-int commajor;
-int comsopen = 0;
-int comevents = 0;
-
-#ifdef KGDB
-#include <machine/remote-sl.h>
-extern int kgdb_dev;
-extern int kgdb_rate;
-extern int kgdb_debug_init;
-#endif
-
-#define COMUNIT(x) (minor(x))
-
-/* Macros to clear/set/test flags. */
-#define SET(t, f) (t) |= (f)
-#define CLR(t, f) (t) &= ~(f)
-#define ISSET(t, f) ((t) & (f))
-
-int
-comspeed(speed)
- long speed;
-{
-#define divrnd(n, q) (((n)*2/(q)+1)/2) /* divide and round off */
-
- int x, err;
-
- if (speed == 0)
- return 0;
- if (speed < 0)
- return -1;
- x = divrnd((COM_FREQ / 16), speed);
- if (x <= 0)
- return -1;
- err = divrnd((COM_FREQ / 16) * 1000, speed * x) - 1000;
- if (err < 0)
- err = -err;
- if (err > COM_TOLERANCE)
- return -1;
- return x;
-
-#undef divrnd(n, q)
-}
-
-int
-comprobe1(iobase)
- int iobase;
-{
-
- /* force access to id reg */
- outb(iobase + com_lcr, 0);
- outb(iobase + com_iir, 0);
- if (inb(iobase + com_iir) & 0x38)
- return 0;
-
- return 1;
-}
-
-int
-comprobe(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct mainbus_attach_args *mb = aux;
- int iobase = mb->mb_iobase;
-
- if (!comprobe1(iobase))
- return 0;
-
- mb->mb_iosize = COM_NPORTS;
- return 1;
-}
-
-void
-comattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct com_softc *sc = (void *)self;
- struct mainbus_attach_args *mb = aux;
- struct cfdata *cf = sc->sc_dev.dv_cfdata;
- int iobase = mb->mb_iobase;
- struct tty *tp;
-
- sc->sc_iobase = iobase;
- sc->sc_hwflags = ISSET(cf->cf_flags, COM_HW_NOIEN);
- sc->sc_swflags = 0;
-
- if (sc->sc_dev.dv_unit == comconsole)
- delay(1000);
-
- /* look for a NS 16550AF UART with FIFOs */
- outb(iobase + com_fifo,
- FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_14);
- delay(100);
- if (ISSET(inb(iobase + com_iir), IIR_FIFO_MASK) == IIR_FIFO_MASK)
- if (ISSET(inb(iobase + com_fifo), FIFO_TRIGGER_14) == FIFO_TRIGGER_14) {
- SET(sc->sc_hwflags, COM_HW_FIFO);
- printf(": ns16550a, working fifo\n");
- } else
- printf(": ns16550, broken fifo\n");
- else
- printf(": ns8250 or ns16450, no fifo\n");
- outb(iobase + com_fifo, 0);
-
- /* disable interrupts */
- outb(iobase + com_ier, 0);
- outb(iobase + com_mcr, 0);
-
- sc->sc_ih.ih_func = comintr;
- sc->sc_ih.ih_arg = sc;
- sc->sc_ih.ih_level = IPL_TTY;
- sc->sc_ih.ih_name = "serial";
- if (mb->mb_irq != IRQUNK)
- if (irq_claim(mb->mb_irq, &sc->sc_ih))
- panic("Cannot claim IRQ %d for com%d", mb->mb_irq, sc->sc_dev.dv_unit);
-
-#ifdef KGDB
- if (kgdb_dev == makedev(commajor, unit)) {
- if (comconsole == unit)
- kgdb_dev = -1; /* can't debug over console port */
- else {
- (void) cominit(unit, kgdb_rate);
- if (kgdb_debug_init) {
- /*
- * Print prefix of device name,
- * let kgdb_connect print the rest.
- */
- printf("%s: ", sc->sc_dev.dv_xname);
- kgdb_connect(1);
- } else
- printf("%s: kgdb enabled\n",
- sc->sc_dev.dv_xname);
- }
- }
-#endif
-
- if (sc->sc_dev.dv_unit == comconsole) {
- /*
- * Need to reset baud rate, etc. of next print so reset
- * comconsinit. Also make sure console is always "hardwired".
- */
- comconsinit = 0;
- SET(sc->sc_hwflags, COM_HW_CONSOLE);
- SET(sc->sc_swflags, COM_SW_SOFTCAR);
- }
-}
-
-int
-comopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- int unit = COMUNIT(dev);
- struct com_softc *sc;
- int iobase;
- struct tty *tp;
- int s;
- int error = 0;
-
- if (unit >= com_cd.cd_ndevs)
- return ENXIO;
- sc = com_cd.cd_devs[unit];
- if (!sc)
- return ENXIO;
-
- if (!sc->sc_tty)
- tp = sc->sc_tty = ttymalloc();
- else
- tp = sc->sc_tty;
-
- tp->t_oproc = comstart;
- tp->t_param = comparam;
- tp->t_dev = dev;
- if (!ISSET(tp->t_state, TS_ISOPEN)) {
- SET(tp->t_state, TS_WOPEN);
- ttychars(tp);
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- tp->t_cflag = TTYDEF_CFLAG;
- if (ISSET(sc->sc_swflags, COM_SW_CLOCAL))
- SET(tp->t_cflag, CLOCAL);
- if (ISSET(sc->sc_swflags, COM_SW_CRTSCTS))
- SET(tp->t_cflag, CRTSCTS);
- if (ISSET(sc->sc_swflags, COM_SW_MDMBUF))
- SET(tp->t_cflag, MDMBUF);
- tp->t_lflag = TTYDEF_LFLAG;
- tp->t_ispeed = tp->t_ospeed = comdefaultrate;
-
- s = spltty();
-
- comparam(tp, &tp->t_termios);
- ttsetwater(tp);
-
- if (comsopen++ == 0)
- timeout(compoll, NULL, 1);
-
- sc->sc_ibufp = sc->sc_ibuf = sc->sc_ibufs[0];
- sc->sc_ibufhigh = sc->sc_ibuf + COM_IHIGHWATER;
- sc->sc_ibufend = sc->sc_ibuf + COM_IBUFSIZE;
-
- iobase = sc->sc_iobase;
- /* Set the FIFO threshold based on the receive speed. */
- if (ISSET(sc->sc_hwflags, COM_HW_FIFO))
- outb(iobase + com_fifo,
- FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST |
- (tp->t_ispeed <= 1200 ? FIFO_TRIGGER_1 : FIFO_TRIGGER_8));
- /* flush any pending I/O */
- while (ISSET(inb(iobase + com_lsr), LSR_RXRDY))
- (void) inb(iobase + com_data);
- /* you turn me on, baby */
- sc->sc_mcr = MCR_DTR | MCR_RTS;
- if (!ISSET(sc->sc_hwflags, COM_HW_NOIEN))
- SET(sc->sc_mcr, MCR_IENABLE);
- outb(iobase + com_mcr, sc->sc_mcr);
- outb(iobase + com_ier,
- IER_ERXRDY | IER_ETXRDY | IER_ERLS | IER_EMSC);
-
- sc->sc_msr = inb(iobase + com_msr);
- if (ISSET(sc->sc_swflags, COM_SW_SOFTCAR) ||
- ISSET(sc->sc_msr, MSR_DCD) || ISSET(tp->t_cflag, MDMBUF))
- SET(tp->t_state, TS_CARR_ON);
- else
- CLR(tp->t_state, TS_CARR_ON);
- } else if (ISSET(tp->t_state, TS_XCLUDE) && p->p_ucred->cr_uid != 0)
- return EBUSY;
- else
- s = spltty();
-
- /* wait for carrier if necessary */
- if (!ISSET(flag, O_NONBLOCK))
- while (!ISSET(tp->t_cflag, CLOCAL) &&
- !ISSET(tp->t_state, TS_CARR_ON)) {
- SET(tp->t_state, TS_WOPEN);
- error = ttysleep(tp, &tp->t_rawq, TTIPRI | PCATCH,
- ttopen, 0);
- if (error) {
- /* XXX should turn off chip if we're the
- only waiter */
- splx(s);
- return error;
- }
- }
- splx(s);
-
- return (*linesw[tp->t_line].l_open)(dev, tp);
-}
-
-int
-comclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- int unit = COMUNIT(dev);
- struct com_softc *sc = com_cd.cd_devs[unit];
- struct tty *tp = sc->sc_tty;
- int iobase = sc->sc_iobase;
- int s;
-
- /* XXX This is for cons.c. */
- if (!ISSET(tp->t_state, TS_ISOPEN))
- return 0;
-
- (*linesw[tp->t_line].l_close)(tp, flag);
- s = spltty();
- CLR(sc->sc_lcr, LCR_SBREAK);
- outb(iobase + com_lcr, sc->sc_lcr);
- outb(iobase + com_ier, 0);
- if (ISSET(tp->t_cflag, HUPCL) &&
- !ISSET(sc->sc_swflags, COM_SW_SOFTCAR)) {
- /* XXX perhaps only clear DTR */
- outb(iobase + com_mcr, 0);
- }
- CLR(tp->t_state, TS_BUSY | TS_FLUSH);
- if (--comsopen == 0)
- untimeout(compoll, NULL);
- splx(s);
- ttyclose(tp);
-#ifdef notyet /* XXXX */
- if (unit != comconsole) {
- ttyfree(tp);
- sc->sc_tty = 0;
- }
-#endif
- return 0;
-}
-
-int
-comread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- struct com_softc *sc = com_cd.cd_devs[COMUNIT(dev)];
- struct tty *tp = sc->sc_tty;
-
- return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
-}
-
-int
-comwrite(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- struct com_softc *sc = com_cd.cd_devs[COMUNIT(dev)];
- struct tty *tp = sc->sc_tty;
-
- return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
-}
-
-struct tty *
-comtty(dev)
- dev_t dev;
-{
- struct com_softc *sc = com_cd.cd_devs[COMUNIT(dev)];
- struct tty *tp = sc->sc_tty;
-
- return (tp);
-}
-
-static u_char
-tiocm_xxx2mcr(data)
- int data;
-{
- u_char m = 0;
-
- if (ISSET(data, TIOCM_DTR))
- SET(m, MCR_DTR);
- if (ISSET(data, TIOCM_RTS))
- SET(m, MCR_RTS);
- return m;
-}
-
-int
-comioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- int unit = COMUNIT(dev);
- struct com_softc *sc = com_cd.cd_devs[unit];
- struct tty *tp = sc->sc_tty;
- int iobase = sc->sc_iobase;
- int error;
-
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
- if (error >= 0)
- return error;
- error = ttioctl(tp, cmd, data, flag, p);
- if (error >= 0)
- return error;
-
- switch (cmd) {
- case TIOCSBRK:
- SET(sc->sc_lcr, LCR_SBREAK);
- outb(iobase + com_lcr, sc->sc_lcr);
- break;
- case TIOCCBRK:
- CLR(sc->sc_lcr, LCR_SBREAK);
- outb(iobase + com_lcr, sc->sc_lcr);
- break;
- case TIOCSDTR:
- SET(sc->sc_mcr, sc->sc_dtr);
- outb(iobase + com_mcr, sc->sc_mcr);
- break;
- case TIOCCDTR:
- CLR(sc->sc_mcr, sc->sc_dtr);
- outb(iobase + com_mcr, sc->sc_mcr);
- break;
- case TIOCMSET:
- CLR(sc->sc_mcr, MCR_DTR | MCR_RTS);
- case TIOCMBIS:
- SET(sc->sc_mcr, tiocm_xxx2mcr(*(int *)data));
- outb(iobase + com_mcr, sc->sc_mcr);
- break;
- case TIOCMBIC:
- CLR(sc->sc_mcr, tiocm_xxx2mcr(*(int *)data));
- outb(iobase + com_mcr, sc->sc_mcr);
- break;
- case TIOCMGET: {
- u_char m;
- int bits = 0;
-
- m = sc->sc_mcr;
- if (ISSET(m, MCR_DTR))
- SET(bits, TIOCM_DTR);
- if (ISSET(m, MCR_RTS))
- SET(bits, TIOCM_RTS);
- m = sc->sc_msr;
- if (ISSET(m, MSR_DCD))
- SET(bits, TIOCM_CD);
- if (ISSET(m, MSR_CTS))
- SET(bits, TIOCM_CTS);
- if (ISSET(m, MSR_DSR))
- SET(bits, TIOCM_DSR);
- if (ISSET(m, MSR_RI | MSR_TERI))
- SET(bits, TIOCM_RI);
- if (inb(iobase + com_ier))
- SET(bits, TIOCM_LE);
- *(int *)data = bits;
- break;
- }
- case TIOCGFLAGS: {
- int driverbits, userbits = 0;
-
- driverbits = sc->sc_swflags;
- if (ISSET(driverbits, COM_SW_SOFTCAR))
- SET(userbits, TIOCFLAG_SOFTCAR);
- if (ISSET(driverbits, COM_SW_CLOCAL))
- SET(userbits, TIOCFLAG_CLOCAL);
- if (ISSET(driverbits, COM_SW_CRTSCTS))
- SET(userbits, TIOCFLAG_CRTSCTS);
- if (ISSET(driverbits, COM_SW_MDMBUF))
- SET(userbits, TIOCFLAG_MDMBUF);
-
- *(int *)data = userbits;
- break;
- }
- case TIOCSFLAGS: {
- int userbits, driverbits = 0;
-
- error = suser(p->p_ucred, &p->p_acflag);
- if (error != 0)
- return(EPERM);
-
- userbits = *(int *)data;
- if (ISSET(userbits, TIOCFLAG_SOFTCAR) ||
- ISSET(sc->sc_hwflags, COM_HW_CONSOLE))
- SET(driverbits, COM_SW_SOFTCAR);
- if (ISSET(userbits, TIOCFLAG_CLOCAL))
- SET(driverbits, COM_SW_CLOCAL);
- if (ISSET(userbits, TIOCFLAG_CRTSCTS))
- SET(driverbits, COM_SW_CRTSCTS);
- if (ISSET(userbits, TIOCFLAG_MDMBUF))
- SET(driverbits, COM_SW_MDMBUF);
-
- sc->sc_swflags = driverbits;
- break;
- }
- default:
- return ENOTTY;
- }
-
- return 0;
-}
-
-int
-comparam(tp, t)
- struct tty *tp;
- struct termios *t;
-{
- struct com_softc *sc = com_cd.cd_devs[COMUNIT(tp->t_dev)];
- int iobase = sc->sc_iobase;
- int ospeed = comspeed(t->c_ospeed);
- u_char lcr;
- tcflag_t oldcflag;
- int s;
-
- /* check requested parameters */
- if (ospeed < 0 || (t->c_ispeed && t->c_ispeed != t->c_ospeed))
- return EINVAL;
-
- lcr = sc->sc_lcr & LCR_SBREAK;
-
- switch (ISSET(t->c_cflag, CSIZE)) {
- case CS5:
- SET(lcr, LCR_5BITS);
- break;
- case CS6:
- SET(lcr, LCR_6BITS);
- break;
- case CS7:
- SET(lcr, LCR_7BITS);
- break;
- case CS8:
- SET(lcr, LCR_8BITS);
- break;
- }
- if (ISSET(t->c_cflag, PARENB)) {
- SET(lcr, LCR_PENAB);
- if (!ISSET(t->c_cflag, PARODD))
- SET(lcr, LCR_PEVEN);
- }
- if (ISSET(t->c_cflag, CSTOPB))
- SET(lcr, LCR_STOPB);
-
- sc->sc_lcr = lcr;
-
- s = spltty();
-
- if (ospeed == 0) {
- CLR(sc->sc_mcr, MCR_DTR);
- outb(iobase + com_mcr, sc->sc_mcr);
- }
-
- /*
- * Set the FIFO threshold based on the receive speed, if we are
- * changing it.
- */
- if (tp->t_ispeed != t->c_ispeed) {
- if (ISSET(sc->sc_hwflags, COM_HW_FIFO))
- outb(iobase + com_fifo,
- FIFO_ENABLE |
- (t->c_ispeed <= 1200 ? FIFO_TRIGGER_1 : FIFO_TRIGGER_8));
- }
-
- if (ospeed != 0) {
- outb(iobase + com_lcr, lcr | LCR_DLAB);
- outb(iobase + com_dlbl, ospeed);
- outb(iobase + com_dlbh, ospeed >> 8);
- outb(iobase + com_lcr, lcr);
- SET(sc->sc_mcr, MCR_DTR);
- outb(iobase + com_mcr, sc->sc_mcr);
- } else
- outb(iobase + com_lcr, lcr);
-
- /* When not using CRTSCTS, RTS follows DTR. */
- if (!ISSET(t->c_cflag, CRTSCTS)) {
- if (ISSET(sc->sc_mcr, MCR_DTR)) {
- if (!ISSET(sc->sc_mcr, MCR_RTS)) {
- SET(sc->sc_mcr, MCR_RTS);
- outb(iobase + com_mcr, sc->sc_mcr);
- }
- } else {
- if (ISSET(sc->sc_mcr, MCR_RTS)) {
- CLR(sc->sc_mcr, MCR_RTS);
- outb(iobase + com_mcr, sc->sc_mcr);
- }
- }
- sc->sc_dtr = MCR_DTR | MCR_RTS;
- } else
- sc->sc_dtr = MCR_DTR;
-
- /* and copy to tty */
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- oldcflag = tp->t_cflag;
- tp->t_cflag = t->c_cflag;
-
- /*
- * If DCD is off and MDMBUF is changed, ask the tty layer if we should
- * stop the device.
- */
- if (!ISSET(sc->sc_msr, MSR_DCD) &&
- !ISSET(sc->sc_swflags, COM_SW_SOFTCAR) &&
- ISSET(oldcflag, MDMBUF) != ISSET(tp->t_cflag, MDMBUF) &&
- (*linesw[tp->t_line].l_modem)(tp, 0) == 0) {
- CLR(sc->sc_mcr, sc->sc_dtr);
- outb(iobase + com_mcr, sc->sc_mcr);
- }
-
- splx(s);
- return 0;
-}
-
-void
-comstart(tp)
- struct tty *tp;
-{
- struct com_softc *sc = com_cd.cd_devs[COMUNIT(tp->t_dev)];
- int iobase = sc->sc_iobase;
- int s;
-
- s = spltty();
- if (ISSET(tp->t_state, TS_TTSTOP | TS_BUSY))
- goto out;
- if (ISSET(tp->t_cflag, CRTSCTS) && !ISSET(sc->sc_msr, MSR_CTS))
- goto out;
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (ISSET(tp->t_state, TS_ASLEEP)) {
- CLR(tp->t_state, TS_ASLEEP);
- wakeup(&tp->t_outq);
- }
- if (tp->t_outq.c_cc == 0)
- goto out;
- selwakeup(&tp->t_wsel);
- }
- SET(tp->t_state, TS_BUSY);
- if (ISSET(sc->sc_hwflags, COM_HW_FIFO)) {
- u_char buffer[16], *cp = buffer;
- int n = q_to_b(&tp->t_outq, cp, sizeof buffer);
- do {
- outb(iobase + com_data, *cp++);
- } while (--n);
- } else
- outb(iobase + com_data, getc(&tp->t_outq));
-out:
- splx(s);
-}
-
-/*
- * Stop output on a line.
- */
-void
-comstop(tp, flag)
- struct tty *tp;
-{
- int s;
-
- s = spltty();
- if (ISSET(tp->t_state, TS_BUSY))
- if (!ISSET(tp->t_state, TS_TTSTOP))
- SET(tp->t_state, TS_FLUSH);
- splx(s);
-}
-
-void
-comdiag(arg)
- void *arg;
-{
- struct com_softc *sc = arg;
- int overflows, floods;
- int s;
-
- s = spltty();
- sc->sc_errors = 0;
- overflows = sc->sc_overflows;
- sc->sc_overflows = 0;
- floods = sc->sc_floods;
- sc->sc_floods = 0;
- splx(s);
-
- log(LOG_WARNING, "%s: %d silo overflow%s, %d ibuf overflow%s\n",
- sc->sc_dev.dv_xname,
- overflows, overflows == 1 ? "" : "s",
- floods, floods == 1 ? "" : "s");
-}
-
-void
-compoll(arg)
- void *arg;
-{
- int unit;
- struct com_softc *sc;
- struct tty *tp;
- register u_char *ibufp;
- u_char *ibufend;
- register int c;
- int s;
- static int lsrmap[8] = {
- 0, TTY_PE,
- TTY_FE, TTY_PE|TTY_FE,
- TTY_FE, TTY_PE|TTY_FE,
- TTY_FE, TTY_PE|TTY_FE
- };
-
- s = spltty();
- if (comevents == 0) {
- splx(s);
- goto out;
- }
- comevents = 0;
- splx(s);
-
- for (unit = 0; unit < com_cd.cd_ndevs; unit++) {
- sc = com_cd.cd_devs[unit];
- if (sc == 0 || sc->sc_ibufp == sc->sc_ibuf)
- continue;
-
- tp = sc->sc_tty;
-
- s = spltty();
-
- ibufp = sc->sc_ibuf;
- ibufend = sc->sc_ibufp;
-
- if (ibufp == ibufend) {
- splx(s);
- continue;
- }
-
- sc->sc_ibufp = sc->sc_ibuf = (ibufp == sc->sc_ibufs[0]) ?
- sc->sc_ibufs[1] : sc->sc_ibufs[0];
- sc->sc_ibufhigh = sc->sc_ibuf + COM_IHIGHWATER;
- sc->sc_ibufend = sc->sc_ibuf + COM_IBUFSIZE;
-
- if (tp == 0 || !ISSET(tp->t_state, TS_ISOPEN)) {
- splx(s);
- continue;
- }
-
- if (ISSET(tp->t_cflag, CRTSCTS) &&
- !ISSET(sc->sc_mcr, MCR_RTS)) {
- /* XXX */
- SET(sc->sc_mcr, MCR_RTS);
- outb(sc->sc_iobase + com_mcr, sc->sc_mcr);
- }
-
- splx(s);
-
- while (ibufp < ibufend) {
- c = *ibufp++;
- if (*ibufp & LSR_OE) {
- sc->sc_overflows++;
- if (sc->sc_errors++ == 0)
- timeout(comdiag, sc, 60 * hz);
- }
- /* This is ugly, but fast. */
- c |= lsrmap[(*ibufp++ & (LSR_BI|LSR_FE|LSR_PE)) >> 2];
- (*linesw[tp->t_line].l_rint)(c, tp);
- }
- }
-
-out:
- timeout(compoll, NULL, 1);
-}
-
-int
-comintr(arg)
- void *arg;
-{
- struct com_softc *sc = arg;
- int iobase = sc->sc_iobase;
- struct tty *tp;
- u_char lsr, data, msr, delta;
-
- if (ISSET(inb(iobase + com_iir), IIR_NOPEND))
- return (0);
-
- tp = sc->sc_tty;
-
- for (;;) {
- lsr = inb(iobase + com_lsr);
-
- if (ISSET(lsr, LSR_RCV_MASK)) {
- register u_char *p = sc->sc_ibufp;
-
- comevents = 1;
- do {
- data = ISSET(lsr, LSR_RXRDY) ?
- inb(iobase + com_data) : 0;
- if (ISSET(lsr, LSR_BI)) {
-#ifdef DDB
- if (sc->sc_dev.dv_unit == comconsole) {
- Debugger();
- goto next;
- }
-#endif
- data = '\0';
- }
- if (p >= sc->sc_ibufend) {
- sc->sc_floods++;
- if (sc->sc_errors++ == 0)
- timeout(comdiag, sc, 60 * hz);
- } else {
- *p++ = data;
- *p++ = lsr;
- if (p == sc->sc_ibufhigh &&
- ISSET(tp->t_cflag, CRTSCTS)) {
- /* XXX */
- CLR(sc->sc_mcr, MCR_RTS);
- outb(iobase + com_mcr,
- sc->sc_mcr);
- }
- }
- next:
- lsr = inb(iobase + com_lsr);
- } while (ISSET(lsr, LSR_RCV_MASK));
-
- sc->sc_ibufp = p;
- }
-#if 0
- else if (ISSET(lsr, LSR_BI|LSR_FE|LSR_PE|LSR_OE))
- printf("weird lsr %02x\n", lsr);
-#endif
-
- msr = inb(iobase + com_msr);
-
- if (msr != sc->sc_msr) {
- delta = msr ^ sc->sc_msr;
- sc->sc_msr = msr;
- if (ISSET(delta, MSR_DCD) &&
- !ISSET(sc->sc_swflags, COM_SW_SOFTCAR) &&
- (*linesw[tp->t_line].l_modem)(tp, ISSET(msr, MSR_DCD)) == 0) {
- CLR(sc->sc_mcr, sc->sc_dtr);
- outb(iobase + com_mcr, sc->sc_mcr);
- }
- if (ISSET(delta & msr, MSR_CTS) &&
- ISSET(tp->t_cflag, CRTSCTS)) {
- /* the line is up and we want to do rts/cts flow control */
- (*linesw[tp->t_line].l_start)(tp);
- }
- }
-
- if (ISSET(lsr, LSR_TXRDY) && ISSET(tp->t_state, TS_BUSY)) {
- CLR(tp->t_state, TS_BUSY);
- if (ISSET(tp->t_state, TS_FLUSH))
- CLR(tp->t_state, TS_FLUSH);
- else
- (*linesw[tp->t_line].l_start)(tp);
- }
-
- if (ISSET(inb(iobase + com_iir), IIR_NOPEND))
- return (1);
- }
-}
-
-/*
- * Following are all routines needed for COM to act as console
- */
-#include <dev/cons.h>
-
-void
-comcnprobe(cp)
- struct consdev *cp;
-{
-
- if (!comprobe1(CONADDR)) {
- cp->cn_pri = CN_DEAD;
- return;
- }
-
- /* locate the major number */
- for (commajor = 0; commajor < nchrdev; commajor++)
- if (cdevsw[commajor].d_open == comopen)
- break;
-
- /* initialize required fields */
- cp->cn_dev = makedev(commajor, CONUNIT);
-#ifdef COMCONSOLE
- cp->cn_pri = CN_REMOTE; /* Force a serial port console */
-#else
- cp->cn_pri = CN_NORMAL;
-#endif
-}
-
-void
-comcninit(cp)
- struct consdev *cp;
-{
-
- cominit(CONUNIT, comdefaultrate);
- comconsole = CONUNIT;
- comconsinit = 0;
-}
-
-cominit(unit, rate)
- int unit, rate;
-{
- int s = splhigh();
- int iobase = CONADDR;
- u_char stat;
-
- outb(iobase + com_lcr, LCR_DLAB);
- rate = comspeed(comdefaultrate);
- outb(iobase + com_dlbl, rate);
- outb(iobase + com_dlbh, rate >> 8);
- outb(iobase + com_lcr, LCR_8BITS);
- outb(iobase + com_ier, IER_ERXRDY | IER_ETXRDY);
- outb(iobase + com_fifo, FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_4);
- stat = inb(iobase + com_iir);
- splx(s);
-}
-
-comcngetc(dev)
- dev_t dev;
-{
- int s = splhigh();
- int iobase = CONADDR;
- u_char stat, c;
-
- while (!ISSET(stat = inb(iobase + com_lsr), LSR_RXRDY))
- ;
- c = inb(iobase + com_data);
- stat = inb(iobase + com_iir);
- splx(s);
- return c;
-}
-
-/*
- * Console kernel output character routine.
- */
-void
-comcnputc(dev, c)
- dev_t dev;
- int c;
-{
- int s = splhigh();
- int iobase = CONADDR;
- u_char stat;
- register int timo;
-
-#ifdef KGDB
- if (dev != kgdb_dev)
-#endif
- if (comconsinit == 0) {
- (void) cominit(COMUNIT(dev), comdefaultrate);
- comconsinit = 1;
- }
- /* wait for any pending transmission to finish */
- timo = 50000;
- while (!ISSET(stat = inb(iobase + com_lsr), LSR_TXRDY) && --timo)
- ;
- outb(iobase + com_data, c);
- /* wait for this transmission to complete */
- timo = 1500000;
- while (!ISSET(stat = inb(iobase + com_lsr), LSR_TXRDY) && --timo)
- ;
- /* clear any interrupts generated by this transmission */
- stat = inb(iobase + com_iir);
- splx(s);
-}
-
-void
-comcnpollc(dev, on)
- dev_t dev;
- int on;
-{
-
-}
diff --git a/sys/arch/arm32/mainbus/comreg.h b/sys/arch/arm32/mainbus/comreg.h
deleted file mode 100644
index 7b1464d0a68..00000000000
--- a/sys/arch/arm32/mainbus/comreg.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $NetBSD: comreg.h,v 1.1 1996/01/31 23:24:29 mark Exp $ */
-
-/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)comreg.h 7.2 (Berkeley) 5/9/91
- */
-
-/*
- * NS16550 UART registers
- */
-
-#define com_data 0 /* data register (R/W) */
-#define com_dlbl 0 /* divisor latch low (W) */
-#define com_dlbh 4 /* divisor latch high (W) */
-#define com_ier 4 /* interrupt enable (W) */
-#define com_iir 8 /* interrupt identification (R) */
-#define com_fifo 8 /* FIFO control (W) */
-#define com_lctl 12 /* line control register (R/W) */
-#define com_cfcr 12 /* line control register (R/W) */
-#define com_mcr 16 /* modem control register (R/W) */
-#define com_lsr 20 /* line status register (R/W) */
-#define com_msr 24 /* modem status register (R/W) */
-#define com_scratch 28 /* scratch register (R/W) */
-
-#define COM_FREQ 1843200 /* 16-bit baud rate divisor */
-#define COM_TOLERANCE 30 /* baud rate tolerance, in 0.1% units */
-
-/* interrupt enable register */
-#define IER_ERXRDY 0x1
-#define IER_ETXRDY 0x2
-#define IER_ERLS 0x4
-#define IER_EMSC 0x8
-
-/* interrupt identification register */
-#define IIR_IMASK 0xf
-#define IIR_RXTOUT 0xc
-#define IIR_RLS 0x6
-#define IIR_RXRDY 0x4
-#define IIR_TXRDY 0x2
-#define IIR_NOPEND 0x1
-#define IIR_MLSC 0x0
-#define IIR_FIFO_MASK 0xc0 /* set if FIFOs are enabled */
-
-/* fifo control register */
-#define FIFO_ENABLE 0x01
-#define FIFO_RCV_RST 0x02
-#define FIFO_XMT_RST 0x04
-#define FIFO_DMA_MODE 0x08
-#define FIFO_TRIGGER_1 0x00
-#define FIFO_TRIGGER_4 0x40
-#define FIFO_TRIGGER_8 0x80
-#define FIFO_TRIGGER_14 0xc0
-
-/* line control register */
-#define LCR_DLAB 0x80
-#define LCR_SBREAK 0x40
-#define LCR_PZERO 0x30
-#define LCR_PONE 0x20
-#define LCR_PEVEN 0x10
-#define LCR_PODD 0x00
-#define LCR_PENAB 0x08
-#define LCR_STOPB 0x04
-#define LCR_8BITS 0x03
-#define LCR_7BITS 0x02
-#define LCR_6BITS 0x01
-#define LCR_5BITS 0x00
-
-/* modem control register */
-#define MCR_LOOPBACK 0x10
-#define MCR_IENABLE 0x08
-#define MCR_DRS 0x04
-#define MCR_RTS 0x02
-#define MCR_DTR 0x01
-
-/* line status register */
-#define LSR_RCV_FIFO 0x80
-#define LSR_TSRE 0x40
-#define LSR_TXRDY 0x20
-#define LSR_BI 0x10
-#define LSR_FE 0x08
-#define LSR_PE 0x04
-#define LSR_OE 0x02
-#define LSR_RXRDY 0x01
-#define LSR_RCV_MASK 0x1f
-
-/* modem status register */
-#define MSR_DCD 0x80
-#define MSR_RI 0x40
-#define MSR_DSR 0x20
-#define MSR_CTS 0x10
-#define MSR_DDCD 0x08
-#define MSR_TERI 0x04
-#define MSR_DDSR 0x02
-#define MSR_DCTS 0x01
-
-#define COM_NPORTS 32
-
-/*
- * WARNING: Serial console is assumed to be at COM1 address
- * and CONUNIT must be 0.
- */
-#define CONADDR (SERIAL0_CONTROLLER_BASE)
-#define CONUNIT (0)
diff --git a/sys/arch/arm32/mainbus/cpu.c b/sys/arch/arm32/mainbus/cpu.c
deleted file mode 100644
index b5b8551dbdd..00000000000
--- a/sys/arch/arm32/mainbus/cpu.c
+++ /dev/null
@@ -1,500 +0,0 @@
-/* $NetBSD: cpu.c,v 1.4 1996/03/18 20:50:00 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- * Copyright (c) 1995 Brini.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * cpu.c
- *
- * Probing and configuration for the master cpu
- *
- * Created : 10/10/95
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/conf.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <vm/vm_kern.h>
-#include <machine/io.h>
-#include <machine/katelib.h>
-#include <machine/cpu.h>
-#include <machine/pte.h>
-#include <machine/undefined.h>
-#include <machine/cpus.h>
-
-#include "cpu.h"
-#if NCPU < 1
-#error Need at least 1 CPU configured
-#endif
-
-/* Array of cpu structures, one per possible cpu */
-
-cpu_t cpus[MAX_CPUS];
-
-char cpu_model[48];
-extern int cpu_ctrl; /* Control bits for boot CPU */
-volatile int undefined_test; /* Used for FPA test */
-
-extern char *boot_args;
-
-/* Declare prototypes */
-
-/* Prototypes */
-
-void identify_master_cpu __P((int /*cpu_number*/));
-void identify_arm_cpu __P((int /*cpu_number*/));
-void identify_arm_fpu __P((int /*cpu_number*/));
-char *strstr __P((char */*s1*/, char */*s2*/));
-
-
-/*
- * int cpumatch(struct device *parent, void *match, void *aux)
- *
- * Probe for the main cpu. Currently all this does is return 1 to
- * indicate that the cpu was found.
- */
-
-int
-cpumatch(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
-{
- struct device *dev = match;
-
- if (dev->dv_unit == 0)
- return(1);
- return(0);
-}
-
-
-/*
- * void cpusattach(struct device *parent, struct device *dev, void *aux)
- *
- * Attach the main cpu
- */
-
-void
-cpuattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- int loop;
-
- for (loop = 0; loop < MAX_CPUS; ++loop)
- bzero(&cpus[loop], sizeof(cpu_t));
-
- identify_master_cpu(CPU_MASTER);
-}
-
-struct cfattach cpu_ca = {
- sizeof(struct cpu_softc), cpumatch, cpuattach
-};
-
-struct cfdriver cpu_cd = {
- NULL, "cpu", DV_DULL, 1
-};
-
-
-/*
- * Used to test for an FPA. The following function is installed as a coproc1 handler
- * on the undefined instruction vector and then we issue a FPA instruction.
- * If undefined_test is non zero then the FPA did not handle the instruction so
- * must be absent.
- */
-
-int
-fpa_test(address, instruction, frame)
- u_int address;
- u_int instruction;
- trapframe_t *frame;
-{
- ++undefined_test;
- return(0);
-}
-
-/*
- * If an FPA was found then this function is installed as the coproc1 handler
- * on the undefined instruction vector. Currently we don't support FPA's
- * so this just triggers an exception.
- */
-
-int
-fpa_handler(address, instruction, frame)
- u_int address;
- u_int instruction;
- trapframe_t *frame;
-{
- u_int fpsr;
-
- __asm __volatile("stmfd sp!, {r0}; .word 0xee300110; mov %0, r0; ldmfd sp!, {r0}" : "=r" (fpsr));
-
- printf("FPA exception: fpsr = %08x\n", fpsr);
-
- return(1);
-}
-
-
-/*
- * Identify the master (boot) CPU
- * This also probes for an FPU and will install an FPE if necessary
- */
-
-void
-identify_master_cpu(cpu_number)
- int cpu_number;
-{
- u_int fpsr;
-
- cpus[cpu_number].cpu_class = CPU_CLASS_ARM;
- cpus[cpu_number].cpu_host = CPU_HOST_MAINBUS;
- cpus[cpu_number].cpu_flags = CPU_FLAG_PRESENT;
- cpus[cpu_number].cpu_ctrl = cpu_ctrl;
-
-/* Get the cpu ID from coprocessor 15 */
-
- cpus[cpu_number].cpu_id = cpu_id();
-
- identify_arm_cpu(cpu_number);
- strcpy(cpu_model, cpus[cpu_number].cpu_model);
-
-/*
- * Ok now we test for an FPA
- * At this point no floating point emulator has been installed.
- * This means any FP instruction will cause undefined exception.
- * We install a temporay coproc 1 handler which will modify undefined_test
- * if it is called.
- * We then try to read the FP status register. If undefined_test has been
- * decremented then the instruction was not handled by an FPA so we know
- * the FPA is missing. If undefined_test is still 1 then we know the
- * instruction was handled by an FPA.
- * We then remove our test handler and look at the
- * FP status register for identification.
- */
-
- install_coproc_handler(FP_COPROC, fpa_test);
-
- undefined_test = 0;
-
- __asm __volatile("stmfd sp!, {r0}; .word 0xee300110; mov %0, r0; ldmfd sp!, {r0}" : "=r" (fpsr));
-
- if (undefined_test == 0) {
- cpus[cpu_number].fpu_type = (fpsr >> 24);
- switch (fpsr >> 24) {
- case 0x81 :
- cpus[cpu_number].fpu_class = FPU_CLASS_FPA;
-
-#if 0
-/* Experimental stuff used when playing with an ARM700+FPA11 */
- printf("FPA11: FPSR=%08x\n", fpsr);
- fpsr=0x00070400;
- __asm __volatile("wfs %0" : "=r" (fpsr));
- __asm __volatile("rfc %0" : "=r" (fpsr));
- printf("FPA11: FPCR=%08x", fpsr);
- __asm __volatile("stmfd sp!, {r0}; mov r0, #0x00000e00 ; wfc r0; ldmfd sp!, {r0}");
- __asm __volatile("rfc %0" : "=r" (fpsr));
- printf("FPA11: FPCR=%08x", fpsr);
-#endif
- break;
-
- default :
- cpus[cpu_number].fpu_class = FPU_CLASS_FPU;
- break;
- }
- cpus[cpu_number].fpu_flags = 0;
- install_coproc_handler(FP_COPROC, fpa_handler);
- } else {
- cpus[cpu_number].fpu_class = FPU_CLASS_NONE;
- cpus[cpu_number].fpu_flags = 0;
-
-/* Ok if ARMFPE is defined and the boot options request the ARM FPE then it will
- * be installed as the FPE. If the installation fails the existing FPE is used as
- * a fall back.
- * If either ARMFPE is not defined or the boot args did not request it the old FPE
- * is installed.
- * This is just while I work on integrating the new FPE.
- * It means the new FPE gets installed if compiled int (ARMFPE defined)
- * and also gives me a on/off option when I boot in case the new FPE is
- * causing panics.
- * In all cases it falls back on the existing FPE is the ARMFPE was not successfully
- * installed.
- */
-
-#ifdef ARMFPE
- if (boot_args) {
- char *ptr;
-
- ptr = strstr(boot_args, "noarmfpe");
- if (!ptr) {
- if (initialise_arm_fpe(&cpus[cpu_number]) != 0) {
- identify_arm_fpu(cpu_number);
-#ifdef FPE
- initialise_fpe(&cpus[cpu_number]);
-#endif
- }
-#ifdef FPE
- } else
- initialise_fpe(&cpus[cpu_number]);
-
- } else
- initialise_fpe(&cpus[cpu_number]);
-#else
- }
- }
-#endif
-
-#else
-#ifdef FPE
- initialise_fpe(&cpus[cpu_number]);
-#else
-#error No FPE built in
-#endif
-#endif
- }
-
- identify_arm_fpu(cpu_number);
-}
-
-
-
-/*
- * Report the type of the specifed arm processor. This uses the generic and arm specific
- * information in the cpu structure to identify the processor. The remaining fields
- * in the cpu structure are filled in appropriately.
- */
-
-void
-identify_arm_cpu(cpu_number)
- int cpu_number;
-{
- cpu_t *cpu;
- u_int cpuid;
-
- cpu = &cpus[cpu_number];
- if (cpu->cpu_host == CPU_HOST_NONE || cpu->cpu_class == CPU_CLASS_NONE) {
- printf("No installed processor\n");
- return;
- }
- if (cpu->cpu_class != CPU_CLASS_ARM) {
- printf("identify_arm_cpu: Can only identify ARM CPU's\n");
- return;
- }
- cpuid = cpu->cpu_id;
-
- if (cpuid == 0) {
- printf("Processor failed probe - no CPU ID\n");
- return;
- }
-
- if ((cpuid & CPU_ID_DESIGNER_MASK) != CPU_ID_ARM_LTD)
- printf("Unrecognised designer ID = %08x\n", cpuid);
-
- switch (cpuid & CPU_ID_CPU_MASK) {
- case ID_ARM610:
- cpu->cpu_type = cpuid & CPU_ID_CPU_MASK;
- break;
-
- case ID_ARM710 :
- case ID_ARM700 :
- cpu->cpu_type = (cpuid & CPU_ID_CPU_MASK) >> 4;
- break;
-
- default :
- printf("Unrecognised processor ID = %08x\n", cpuid);
- cpu->cpu_type = cpuid & CPU_ID_CPU_MASK;
- break;
- }
-
- sprintf(cpu->cpu_model, "ARM%x rev %d", cpu->cpu_type, cpuid & CPU_ID_REVISION_MASK);
-
- if ((cpu->cpu_ctrl & CPU_CONTROL_IDC_ENABLE) == 0)
- strcat(cpu->cpu_model, " IDC disabled");
- else
- strcat(cpu->cpu_model, " IDC enabled");
-
- if ((cpu->cpu_ctrl & CPU_CONTROL_WBUF_ENABLE) == 0)
- strcat(cpu->cpu_model, " WB disabled");
- else
- strcat(cpu->cpu_model, " WB enabled");
-
- if (cpu->cpu_ctrl & CPU_CONTROL_LABT_ENABLE)
- strcat(cpu->cpu_model, " LABT");
- else
- strcat(cpu->cpu_model, " EABT");
-
-/* Print the info */
-
- printf(": %s\n", cpu->cpu_model);
-}
-
-
-/*
- * Report the type of the specifed arm fpu. This uses the generic and arm specific
- * information in the cpu structure to identify the fpu. The remaining fields
- * in the cpu structure are filled in appropriately.
- */
-
-void
-identify_arm_fpu(cpu_number)
- int cpu_number;
-{
- cpu_t *cpu;
-
- cpu = &cpus[cpu_number];
- if (cpu->cpu_host == CPU_HOST_NONE || cpu->cpu_class == CPU_CLASS_NONE) {
- printf("No installed processor\n");
- return;
- }
-
- if (cpu->cpu_class != CPU_CLASS_ARM) {
- printf("identify_arm_cpu: Can only identify ARM FPU's\n");
- return;
- }
-
-/* Now for the FP info */
-
- switch (cpu->fpu_class) {
- case FPU_CLASS_NONE :
- strcpy(cpu->fpu_model, "None");
- break;
- case FPU_CLASS_FPE :
- printf("fpe%d at cpu%d: %s\n", cpu_number, cpu_number, cpu->fpu_model);
- printf("fpe%d: no hardware found\n", cpu_number);
- break;
- case FPU_CLASS_FPA :
- printf("fpe%d at cpu%d: %s\n", cpu_number, cpu_number, cpu->fpu_model);
- if (cpu->fpu_type == FPU_TYPE_FPA11) {
- strcpy(cpu->fpu_model, "FPA11");
- printf("fpe%d: fpa11 found\n", cpu_number);
- } else {
- strcpy(cpu->fpu_model, "FPA");
- printf("fpe%d: fpa10 found\n", cpu_number);
- }
- if ((cpu->fpu_flags & 4) == 0)
- strcat(cpu->fpu_model, "");
- else
- strcat(cpu->fpu_model, " clk/2");
- break;
- case FPU_CLASS_FPU :
- sprintf(cpu->fpu_model, "Unknown FPU (ID=%02x)\n", cpu->fpu_type);
- printf("fpu%d at cpu%d: %s\n", cpu_number, cpu_number, cpu->fpu_model);
- break;
- }
-}
-
-
-int
-cpuopen(dev, flag, mode, p)
- dev_t dev;
- int flag;
- int mode;
- struct proc *p;
-{
- struct cpu_softc *sc;
- int unit;
- int s;
-
- unit = minor(dev);
- if (unit >= cpu_cd.cd_ndevs)
- return(ENXIO);
-
- sc = cpu_cd.cd_devs[unit];
- if (!sc) return(ENXIO);
-
- s = splhigh();
- if (sc->sc_open) {
- (void)splx(s);
- return(EBUSY);
- }
-
- ++sc->sc_open;
- (void)splx(s);
-
- return(0);
-}
-
-
-int
-cpuclose(dev, flag, mode, p)
- dev_t dev;
- int flag;
- int mode;
- struct proc *p;
-{
- struct cpu_softc *sc;
- int unit;
- int s;
-
- unit = minor(dev);
- sc = cpu_cd.cd_devs[unit];
-
- if (sc->sc_open == 0) return(ENXIO);
-
- s = splhigh();
- --sc->sc_open;
- (void)splx(s);
-
- return(0);
-}
-
-
-int
-cpuioctl(dev, cmd, data, flag, p)
- dev_t dev;
- int cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- struct cpu_softc *sc;
- int unit;
-
- unit = minor(dev);
- sc = cpu_cd.cd_devs[unit];
-
- switch (cmd) {
- default:
- return(ENXIO);
- break;
- }
-
- return(0);
-}
-
-/* End of cpu.c */
diff --git a/sys/arch/arm32/mainbus/fd.c b/sys/arch/arm32/mainbus/fd.c
deleted file mode 100644
index efdca4fc236..00000000000
--- a/sys/arch/arm32/mainbus/fd.c
+++ /dev/null
@@ -1,1339 +0,0 @@
-/* $NetBSD: fd.c,v 1.5 1996/03/28 21:52:41 mark Exp $ */
-
-/*-
- * Copyright (c) 1993, 1994, 1995 Charles Hannum.
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Don Ahn.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fd.c 7.4 (Berkeley) 5/25/91
- */
-
-/* The new config stuff do no use to use and need to be pulled out */
-
-#undef NEWCONFIG
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/ioctl.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-#include <sys/dkstat.h>
-#include <sys/disk.h>
-#include <sys/buf.h>
-#include <sys/uio.h>
-#include <sys/syslog.h>
-#include <sys/queue.h>
-
-
-#include <machine/cpu.h>
-#include <machine/irqhandler.h>
-#include <machine/iomd.h>
-#include <machine/io.h>
-#include <machine/katelib.h>
-
-#include <arm32/mainbus/mainbus.h>
-#include <arm32/mainbus/fdreg.h>
-
-#define FDUNIT(dev) (minor(dev) / 8)
-#define FDTYPE(dev) (minor(dev) % 8)
-
-#define b_cylin b_resid
-
-enum fdc_state {
- DEVIDLE = 0,
- MOTORWAIT,
- DOSEEK,
- SEEKWAIT,
- SEEKTIMEDOUT,
- SEEKCOMPLETE,
- DOIO,
- IOCOMPLETE,
- IOTIMEDOUT,
- DORESET,
- RESETCOMPLETE,
- RESETTIMEDOUT,
- DORECAL,
- RECALWAIT,
- RECALTIMEDOUT,
- RECALCOMPLETE,
-};
-
-/* software state, per controller */
-struct fdc_softc {
- struct device sc_dev; /* boilerplate */
- irqhandler_t sc_ih;
-
- int sc_iobase;
- int sc_drq;
-
- struct fd_softc *sc_fd[4]; /* pointers to children */
- TAILQ_HEAD(drivehead, fd_softc) sc_drives;
- enum fdc_state sc_state;
- int sc_errors; /* number of retries so far */
- u_char sc_status[7]; /* copy of registers */
-};
-
-/* controller driver configuration */
-int fdcprobe __P((struct device *, void *, void *));
-#ifdef NEWCONFIG
-void fdcforceintr __P((void *));
-#endif
-void fdcattach __P((struct device *, struct device *, void *));
-
-static fiqhandler_t fiqhandler;
-
-void floppy_read_fiq __P((void));
-void floppy_write_fiq __P((void));
-
-struct cfattach fdc_ca = {
- sizeof(struct fdc_softc), fdcprobe, fdcattach
-};
-
-struct cfdriver fdc_cd = {
- NULL, "fdc", DV_DULL
-};
-
-/*
- * Floppies come in various flavors, e.g., 1.2MB vs 1.44MB; here is how
- * we tell them apart.
- */
-struct fd_type {
- int sectrac; /* sectors per track */
- int heads; /* number of heads */
- int seccyl; /* sectors per cylinder */
- int secsize; /* size code for sectors */
- int datalen; /* data len when secsize = 0 */
- int steprate; /* step rate and head unload time */
- int gap1; /* gap len between sectors */
- int gap2; /* formatting gap */
- int tracks; /* total num of tracks */
- int size; /* size of disk in sectors */
- int step; /* steps per cylinder */
- int rate; /* transfer speed code */
- char *name;
-};
-
-/* The order of entries in the following table is important -- BEWARE! */
-struct fd_type fd_types[] = {
- { 18,2,36,2,0xff,0xcf,0x1b,0x6c,80,2880,1,FDC_500KBPS,"1.44MB" }, /* 1.44MB diskette */
- { 15,2,30,2,0xff,0xdf,0x1b,0x54,80,2400,1,FDC_500KBPS, "1.2MB" }, /* 1.2 MB AT-diskettes */
- { 9,2,18,2,0xff,0xdf,0x23,0x50,40, 720,2,FDC_300KBPS, "360KB/AT" }, /* 360kB in 1.2MB drive */
- { 9,2,18,2,0xff,0xdf,0x2a,0x50,40, 720,1,FDC_250KBPS, "360KB/PC" }, /* 360kB PC diskettes */
- { 9,2,18,2,0xff,0xdf,0x2a,0x50,80,1440,1,FDC_250KBPS, "720KB" }, /* 3.5" 720kB diskette */
- { 9,2,18,2,0xff,0xdf,0x23,0x50,80,1440,1,FDC_300KBPS, "720KB/x" }, /* 720kB in 1.2MB drive */
- { 9,2,18,2,0xff,0xdf,0x2a,0x50,40, 720,2,FDC_250KBPS, "360KB/x" }, /* 360kB in 720kB drive */
-};
-
-/* software state, per disk (with up to 4 disks per ctlr) */
-struct fd_softc {
- struct device sc_dev;
- struct disk sc_dk;
-
- struct fd_type *sc_deftype; /* default type descriptor */
- struct fd_type *sc_type; /* current type descriptor */
-
- daddr_t sc_blkno; /* starting block number */
- int sc_bcount; /* byte count left */
- int sc_skip; /* bytes already transferred */
- int sc_nblks; /* number of blocks currently tranferring */
- int sc_nbytes; /* number of bytes currently tranferring */
-
- int sc_drive; /* physical unit number */
- int sc_flags;
-#define FD_OPEN 0x01 /* it's open */
-#define FD_MOTOR 0x02 /* motor should be on */
-#define FD_MOTOR_WAIT 0x04 /* motor coming up */
- int sc_cylin; /* where we think the head is */
-
- void *sc_sdhook; /* saved shutdown hook for drive. */
-
- TAILQ_ENTRY(fd_softc) sc_drivechain;
- int sc_ops; /* I/O ops since last switch */
- struct buf sc_q; /* head of buf chain */
-};
-
-/* floppy driver configuration */
-int fdprobe __P((struct device *, void *, void *));
-void fdattach __P((struct device *, struct device *, void *));
-
-struct cfattach fd_ca = {
- sizeof(struct fd_softc), fdprobe, fdattach
-};
-
-struct cfdriver fd_cd = {
- NULL, "fd", DV_DISK
-};
-
-void fdgetdisklabel __P((struct fd_softc *));
-int fd_get_parms __P((struct fd_softc *));
-void fdstrategy __P((struct buf *));
-void fdstart __P((struct fd_softc *));
-
-struct dkdriver fddkdriver = { fdstrategy };
-
-struct fd_type *fd_nvtotype __P((char *, int, int));
-void fd_set_motor __P((struct fdc_softc *fdc, int reset));
-void fd_motor_off __P((void *arg));
-void fd_motor_on __P((void *arg));
-int fdcresult __P((struct fdc_softc *fdc));
-int out_fdc __P((int iobase, u_char x));
-void fdcstart __P((struct fdc_softc *fdc));
-void fdcstatus __P((struct device *dv, int n, char *s));
-void fdctimeout __P((void *arg));
-void fdcpseudointr __P((void *arg));
-int fdcintr __P((void *));
-void fdcretry __P((struct fdc_softc *fdc));
-void fdfinish __P((struct fd_softc *fd, struct buf *bp));
-
-int
-fdcprobe(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- register struct mainbus_attach_args *mb = aux;
- int iobase = mb->mb_iobase;
-
- /* reset */
- outb(iobase + fdout, 0);
- delay(100);
- outb(iobase + fdout, FDO_FRST);
-
- /* see if it can handle a command */
- if (out_fdc(iobase, NE7CMD_SPECIFY) < 0)
- return 0;
- out_fdc(iobase, 0xdf);
- out_fdc(iobase, 6/*2*/); /* Don't remember why - mark */
-
-#ifdef NEWCONFIG
- if (iobase == IOBASEUNK || ia->ia_drq == DRQUNK)
- return 0;
-
- if (ia->ia_irq == IRQUNK) {
- ia->ia_irq = isa_discoverintr(fdcforceintr, aux);
- if (ia->ia_irq == IRQNONE)
- return 0;
-
- /* reset it again */
- outb(iobase + fdout, 0);
- delay(100);
- outb(iobase + fdout, FDO_FRST);
- }
-#endif
-
- mb->mb_iosize = FDC_NPORT;
- return 1;
-}
-
-#ifdef NEWCONFIG
-void
-fdcforceintr(aux)
- void *aux;
-{
- struct mainbus_attach_args *mb = aux;
- int iobase = mb->mb_iobase;
-
- /* the motor is off; this should generate an error with or
- without a disk drive present */
- out_fdc(iobase, NE7CMD_SEEK);
- out_fdc(iobase, 0);
- out_fdc(iobase, 0);
-}
-#endif
-
-/*
- * Arguments passed between fdcattach and fdprobe.
- */
-struct fdc_attach_args {
- int fa_drive;
- struct fd_type *fa_deftype;
-};
-
-/*
- * Print the location of a disk drive (called just before attaching the
- * the drive). If `fdc' is not NULL, the drive was found but was not
- * in the system config file; print the drive name as well.
- * Return QUIET (config_find ignores this if the device was configured) to
- * avoid printing `fdN not configured' messages.
- */
-int
-fdprint(aux, fdc)
- void *aux;
- const char *fdc;
-{
- register struct fdc_attach_args *fa = aux;
-
- if (!fdc)
- printf(" drive %d", fa->fa_drive);
- return QUIET;
-}
-
-void
-fdcattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct fdc_softc *fdc = (void *)self;
- struct mainbus_attach_args *mb = aux;
- struct fdc_attach_args fa;
- int type;
-
- fdc->sc_iobase = mb->mb_iobase;
- fdc->sc_drq = mb->mb_iobase + mb->mb_drq;
- fdc->sc_state = DEVIDLE;
- TAILQ_INIT(&fdc->sc_drives);
-
- printf("\n");
-
-/*#ifdef NEWCONFIG
- at_setup_dmachan(fdc->sc_drq, FDC_MAXIOSIZE);
- isa_establish(&fdc->sc_id, &fdc->sc_dev);
-#endif*/
-
- fdc->sc_ih.ih_func = fdcintr;
- fdc->sc_ih.ih_arg = fdc;
- fdc->sc_ih.ih_level = IPL_BIO;
- fdc->sc_ih.ih_name = "fdc";
- if (irq_claim(mb->mb_irq, &fdc->sc_ih))
- panic("Cannot claim IRQ %d for fdc%d", mb->mb_irq, parent->dv_unit);
-
- /*
- * The NVRAM info only tells us about the first two disks on the
- * `primary' floppy controller.
- */
-/* if (fdc->sc_dev.dv_unit == 0)
- type = mc146818_read(NULL, NVRAM_DISKETTE);
- else
- type = -1;*/
-
- type = 0x10;
-
- /* physical limit: four drives per controller. */
- for (fa.fa_drive = 0; fa.fa_drive < 4; fa.fa_drive++) {
- if (type >= 0 && fa.fa_drive < 2)
- fa.fa_deftype = fd_nvtotype(fdc->sc_dev.dv_xname,
- type, fa.fa_drive);
- else
- fa.fa_deftype = NULL; /* unknown */
- (void)config_found(self, (void *)&fa, fdprint);
- }
-}
-
-int
-fdprobe(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct fdc_softc *fdc = (void *)parent;
- struct cfdata *cf = match;
- struct fdc_attach_args *fa = aux;
- int drive = fa->fa_drive;
- int iobase = fdc->sc_iobase;
- int n;
-
- if (cf->cf_loc[0] != -1 && cf->cf_loc[0] != drive)
- return 0;
- /*
- * XXX
- * This is to work around some odd interactions between this driver
- * and SMC Ethernet cards.
- */
-
- /* Don't need this for arm32 port but leave for the time being (it won't hurt) */
-
- if (cf->cf_loc[0] == -1 && drive >= 2)
- return 0;
-
- /* select drive and turn on motor */
- outb(iobase + fdout, drive | FDO_FRST | FDO_MOEN(drive));
- /* wait for motor to spin up */
- delay(250000);
- out_fdc(iobase, NE7CMD_RECAL);
- out_fdc(iobase, drive);
- /* wait for recalibrate */
- delay(2000000);
- out_fdc(iobase, NE7CMD_SENSEI);
- n = fdcresult(fdc);
-#ifdef FD_DEBUG
- {
- int i;
- printf("fdprobe: status");
- for (i = 0; i < n; i++)
- printf(" %x", fdc->sc_status[i]);
- printf("\n");
- }
-#endif
- if (n != 2 || (fdc->sc_status[0] & 0xf8) != 0x20)
- return 0;
- /* turn off motor */
- outb(iobase + fdout, FDO_FRST);
-
- return 1;
-}
-
-/*
- * Controller is working, and drive responded. Attach it.
- */
-void
-fdattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct fdc_softc *fdc = (void *)parent;
- struct fd_softc *fd = (void *)self;
- struct fdc_attach_args *fa = aux;
- struct fd_type *type = fa->fa_deftype;
- int drive = fa->fa_drive;
-
- /* XXX Allow `flags' to override device type? */
-
- if (type)
- printf(": %s %d cyl, %d head, %d sec\n", type->name,
- type->tracks, type->heads, type->sectrac);
- else
- printf(": density unknown\n");
-
- fd->sc_cylin = -1;
- fd->sc_drive = drive;
- fd->sc_deftype = type;
- fdc->sc_fd[drive] = fd;
-
- /*
- * Initialize and attach the disk structure.
- */
- fd->sc_dk.dk_name = fd->sc_dev.dv_xname;
- fd->sc_dk.dk_driver = &fddkdriver;
- disk_attach(&fd->sc_dk);
-
-#ifdef NEWCONFIG
- /* XXX Need to do some more fiddling with sc_dk. */
- dk_establish(&fd->sc_dk, &fd->sc_dev);
-#endif
- /* Needed to power off if the motor is on when we halt. */
- fd->sc_sdhook = shutdownhook_establish(fd_motor_off, fd);
-}
-
-/*
- * Translate nvram type into internal data structure. Return NULL for
- * none/unknown/unusable.
- */
-struct fd_type *
-fd_nvtotype(fdc, nvraminfo, drive)
- char *fdc;
- int nvraminfo, drive;
-{
- int type;
-
- type = (drive == 0 ? nvraminfo : nvraminfo << 4) & 0xf0;
- switch (type) {
-/* case 0x00 :
- return NULL;*/
- case 0x10 :
- return &fd_types[0];
- default:
- printf("%s: drive %d: unknown device type 0x%x\n",
- fdc, drive, type);
- return NULL;
- }
-}
-
-inline struct fd_type *
-fd_dev_to_type(fd, dev)
- struct fd_softc *fd;
- dev_t dev;
-{
- int type = FDTYPE(dev);
-
- if (type > (sizeof(fd_types) / sizeof(fd_types[0])))
- return NULL;
- return type ? &fd_types[type - 1] : fd->sc_deftype;
-}
-
-void
-fdstrategy(bp)
- register struct buf *bp; /* IO operation to perform */
-{
- struct fd_softc *fd;
- int unit = FDUNIT(bp->b_dev);
- int sz;
- int s;
-
-/* printf("fdstrategy: bp=%08x\n", bp);*/
-
- /* Valid unit, controller, and request? */
- if (unit >= fd_cd.cd_ndevs ||
- (fd = fd_cd.cd_devs[unit]) == 0 ||
- bp->b_blkno < 0 ||
- (bp->b_bcount % FDC_BSIZE) != 0) {
- bp->b_error = EINVAL;
- goto bad;
- }
-
- /* If it's a null transfer, return immediately. */
- if (bp->b_bcount == 0)
- goto done;
-
- sz = howmany(bp->b_bcount, FDC_BSIZE);
-
- if (bp->b_blkno + sz > fd->sc_type->size) {
- sz = fd->sc_type->size - bp->b_blkno;
- if (sz == 0) {
- /* If exactly at end of disk, return EOF. */
- bp->b_resid = bp->b_bcount;
- goto done;
- }
- if (sz < 0) {
- /* If past end of disk, return EINVAL. */
- bp->b_error = EINVAL;
- goto bad;
- }
- /* Otherwise, truncate request. */
- bp->b_bcount = sz << DEV_BSHIFT;
- }
-
- bp->b_cylin = bp->b_blkno / (FDC_BSIZE / DEV_BSIZE) / fd->sc_type->seccyl;
-
-#ifdef FD_DEBUG
- printf("fdstrategy: b_blkno %d b_bcount %d blkno %d cylin %d sz %d\n",
- bp->b_blkno, bp->b_bcount, fd->sc_blkno, bp->b_cylin, sz);
-#endif
-
- /* Queue transfer on drive, activate drive and controller if idle. */
- s = splbio();
- disksort(&fd->sc_q, bp);
- untimeout(fd_motor_off, fd); /* a good idea */
- /* Instrumentation. */
- disk_busy(&fd->sc_dk);
- if (!fd->sc_q.b_active)
- fdstart(fd);
-#ifdef DIAGNOSTIC
- else {
- struct fdc_softc *fdc = (void *)fd->sc_dev.dv_parent;
- if (fdc->sc_state == DEVIDLE) {
- printf("fdstrategy: controller inactive\n");
- fdcstart(fdc);
- }
- }
-#endif
- splx(s);
- return;
-
-bad:
- bp->b_flags |= B_ERROR;
-done:
- /* Toss transfer; we're done early. */
- biodone(bp);
-}
-
-void
-fdstart(fd)
- struct fd_softc *fd;
-{
- struct fdc_softc *fdc = (void *)fd->sc_dev.dv_parent;
- int active = fdc->sc_drives.tqh_first != 0;
-
-/* printf("fdstart:\n");*/
-
- /* Link into controller queue. */
- fd->sc_q.b_active = 1;
- TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain);
-
- /* Instrumentation. */
-/* disk_busy(&fd->sc_dk);*/
-
- /* If controller not already active, start it. */
- if (!active)
- fdcstart(fdc);
-}
-
-void
-fdfinish(fd, bp)
- struct fd_softc *fd;
- struct buf *bp;
-{
- struct fdc_softc *fdc = (void *)fd->sc_dev.dv_parent;
-
- /*
- * Move this drive to the end of the queue to give others a `fair'
- * chance. We only force a switch if N operations are completed while
- * another drive is waiting to be serviced, since there is a long motor
- * startup delay whenever we switch.
- */
- if (fd->sc_drivechain.tqe_next && ++fd->sc_ops >= 8) {
- fd->sc_ops = 0;
- TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
- if (bp->b_actf) {
- TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain);
- } else
- fd->sc_q.b_active = 0;
- }
- bp->b_resid = fd->sc_bcount;
- fd->sc_skip = 0;
- fd->sc_q.b_actf = bp->b_actf;
-
-/* printf("fdfinish: fd=%08x buf=%08x busy=%d\n", (u_int)fd, (u_int)bp, fd->sc_dk.dk_busy);*/
-
- disk_unbusy(&fd->sc_dk, (bp->b_bcount - bp->b_resid));
-
- biodone(bp);
- /* turn off motor 5s from now */
- timeout(fd_motor_off, fd, 5 * hz);
- fdc->sc_state = DEVIDLE;
-}
-
-int
-fdread(dev, uio)
- dev_t dev;
- struct uio *uio;
-{
-
- return (physio(fdstrategy, NULL, dev, B_READ, minphys, uio));
-}
-
-int
-fdwrite(dev, uio)
- dev_t dev;
- struct uio *uio;
-{
-
- return (physio(fdstrategy, NULL, dev, B_WRITE, minphys, uio));
-}
-
-void
-fd_set_motor(fdc, reset)
- struct fdc_softc *fdc;
- int reset;
-{
- struct fd_softc *fd;
- u_char status;
- int n;
-
- if (fd = fdc->sc_drives.tqh_first)
- status = fd->sc_drive;
- else
- status = 0;
- if (!reset)
- status |= FDO_FRST | FDO_FDMAEN;
- for (n = 0; n < 4; n++)
- if ((fd = fdc->sc_fd[n]) && (fd->sc_flags & FD_MOTOR))
- status |= FDO_MOEN(n);
- outb(fdc->sc_iobase + fdout, status);
-}
-
-void
-fd_motor_off(arg)
- void *arg;
-{
- struct fd_softc *fd = arg;
- int s;
-
- s = splbio();
- fd->sc_flags &= ~(FD_MOTOR | FD_MOTOR_WAIT);
- fd_set_motor((struct fdc_softc *)fd->sc_dev.dv_parent, 0);
- splx(s);
-}
-
-void
-fd_motor_on(arg)
- void *arg;
-{
- struct fd_softc *fd = arg;
- struct fdc_softc *fdc = (void *)fd->sc_dev.dv_parent;
- int s;
-
- s = splbio();
- fd->sc_flags &= ~FD_MOTOR_WAIT;
- if ((fdc->sc_drives.tqh_first == fd) && (fdc->sc_state == MOTORWAIT))
- (void) fdcintr(fdc);
- splx(s);
-}
-
-int
-fdcresult(fdc)
- struct fdc_softc *fdc;
-{
- int iobase = fdc->sc_iobase;
- u_char i;
- int j = 100000,
- n = 0;
-
- for (; j; j--) {
- i = inb(iobase + fdsts) & (NE7_DIO | NE7_RQM | NE7_CB);
- if (i == NE7_RQM)
- return n;
- if (i == (NE7_DIO | NE7_RQM | NE7_CB)) {
- if (n >= sizeof(fdc->sc_status)) {
- log(LOG_ERR, "fdcresult: overrun\n");
- return -1;
- }
- fdc->sc_status[n++] = inb(iobase + fddata);
- }
- }
- log(LOG_ERR, "fdcresult: timeout\n");
- return -1;
-}
-
-int
-out_fdc(iobase, x)
- int iobase;
- u_char x;
-{
- int i = 100000;
-
- while ((inb(iobase + fdsts) & NE7_DIO) && i-- > 0);
- if (i <= 0)
- return -1;
- while ((inb(iobase + fdsts) & NE7_RQM) == 0 && i-- > 0);
- if (i <= 0)
- return -1;
- outb(iobase + fddata, x);
- return 0;
-}
-
-int
-fdopen(dev, flags)
- dev_t dev;
- int flags;
-{
- int unit;
- struct fd_softc *fd;
- struct fd_type *type;
-
- unit = FDUNIT(dev);
- if (unit >= fd_cd.cd_ndevs)
- return ENXIO;
- fd = fd_cd.cd_devs[unit];
- if (fd == 0)
- return ENXIO;
- type = fd_dev_to_type(fd, dev);
- if (type == NULL)
- return ENXIO;
-
- if ((fd->sc_flags & FD_OPEN) != 0 &&
- fd->sc_type != type)
- return EBUSY;
-
- fd->sc_type = type;
- fd->sc_cylin = -1;
- fd->sc_flags |= FD_OPEN;
-
- return 0;
-}
-
-int
-fdclose(dev, flags)
- dev_t dev;
- int flags;
-{
- struct fd_softc *fd = fd_cd.cd_devs[FDUNIT(dev)];
-
- fd->sc_flags &= ~FD_OPEN;
- return 0;
-}
-
-void
-fdcstart(fdc)
- struct fdc_softc *fdc;
-{
-
-#ifdef DIAGNOSTIC
- /* only got here if controller's drive queue was inactive; should
- be in idle state */
- if (fdc->sc_state != DEVIDLE) {
- printf("fdcstart: not idle\n");
- return;
- }
-#endif
- (void) fdcintr(fdc);
-}
-
-void
-fdcstatus(dv, n, s)
- struct device *dv;
- int n;
- char *s;
-{
- struct fdc_softc *fdc = (void *)dv->dv_parent;
- int iobase = fdc->sc_iobase;
-
- if (n == 0) {
- out_fdc(fdc->sc_iobase, NE7CMD_SENSEI);
- (void) fdcresult(fdc);
- n = 2;
- }
-
- printf("%s: %s", dv->dv_xname, s);
-
- switch (n) {
- case 0:
- printf("\n");
- break;
- case 2:
- printf(" (st0 %b cyl %d)\n",
- fdc->sc_status[0], NE7_ST0BITS,
- fdc->sc_status[1]);
- break;
- case 7:
- printf(" (st0 %b st1 %b st2 %b cyl %d head %d sec %d)\n",
- fdc->sc_status[0], NE7_ST0BITS,
- fdc->sc_status[1], NE7_ST1BITS,
- fdc->sc_status[2], NE7_ST2BITS,
- fdc->sc_status[3], fdc->sc_status[4], fdc->sc_status[5]);
- break;
-#ifdef DIAGNOSTIC
- default:
- printf("\nfdcstatus: weird size");
- break;
-#endif
- }
-}
-
-void
-fdctimeout(arg)
- void *arg;
-{
- struct fdc_softc *fdc = arg;
- struct fd_softc *fd = fdc->sc_drives.tqh_first;
- int s;
-
- s = splbio();
- fdcstatus(&fd->sc_dev, 0, "timeout");
-
- if (fd->sc_q.b_actf)
- fdc->sc_state++;
- else
- fdc->sc_state = DEVIDLE;
-
- (void) fdcintr(fdc);
- splx(s);
-}
-
-void
-fdcpseudointr(arg)
- void *arg;
-{
- int s;
-
- /* Just ensure it has the right spl. */
- s = splbio();
- (void) fdcintr(arg);
- splx(s);
-}
-
-int
-fdcintr(arg)
- void *arg;
-{
- struct fdc_softc *fdc = arg;
-#define st0 fdc->sc_status[0]
-#define cyl fdc->sc_status[1]
- struct fd_softc *fd;
- struct buf *bp;
- int iobase = fdc->sc_iobase;
- int read, head, trac, sec, i, s, nblks;
- struct fd_type *type;
-
-loop:
- /* Is there a drive for the controller to do a transfer with? */
- fd = fdc->sc_drives.tqh_first;
- if (fd == NULL) {
- fdc->sc_state = DEVIDLE;
- return 1;
- }
-
- /* Is there a transfer to this drive? If not, deactivate drive. */
- bp = fd->sc_q.b_actf;
- if (bp == NULL) {
- fd->sc_ops = 0;
- TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
- fd->sc_q.b_active = 0;
- goto loop;
- }
-
- switch (fdc->sc_state) {
- case DEVIDLE:
- fdc->sc_errors = 0;
- fd->sc_skip = 0;
- fd->sc_bcount = bp->b_bcount;
- fd->sc_blkno = bp->b_blkno / (FDC_BSIZE / DEV_BSIZE);
- untimeout(fd_motor_off, fd);
- if ((fd->sc_flags & FD_MOTOR_WAIT) != 0) {
- fdc->sc_state = MOTORWAIT;
- return 1;
- }
- if ((fd->sc_flags & FD_MOTOR) == 0) {
- /* Turn on the motor, being careful about pairing. */
- struct fd_softc *ofd = fdc->sc_fd[fd->sc_drive ^ 1];
- if (ofd && ofd->sc_flags & FD_MOTOR) {
- untimeout(fd_motor_off, ofd);
- ofd->sc_flags &= ~(FD_MOTOR | FD_MOTOR_WAIT);
- }
- fd->sc_flags |= FD_MOTOR | FD_MOTOR_WAIT;
- fd_set_motor(fdc, 0);
- fdc->sc_state = MOTORWAIT;
- /* Allow .25s for motor to stabilize. */
- timeout(fd_motor_on, fd, hz / 4);
- return 1;
- }
- /* Make sure the right drive is selected. */
- fd_set_motor(fdc, 0);
-
- /* fall through */
- case DOSEEK:
- doseek:
- if (fd->sc_cylin == bp->b_cylin)
- goto doio;
-
- out_fdc(iobase, NE7CMD_CONFIGURE);/* configure command */
- out_fdc(iobase, 0);
- out_fdc(iobase, 0x1a);
- out_fdc(iobase, 0);
-
- out_fdc(iobase, NE7CMD_SPECIFY);/* specify command */
- out_fdc(iobase, fd->sc_type->steprate);
- out_fdc(iobase, 6); /* XXX head load time == 6ms */
-
- out_fdc(iobase, NE7CMD_SEEK); /* seek function */
- out_fdc(iobase, fd->sc_drive); /* drive number */
- out_fdc(iobase, bp->b_cylin * fd->sc_type->step);
-
- fd->sc_cylin = -1;
- fdc->sc_state = SEEKWAIT;
- timeout(fdctimeout, fdc, 4 * hz);
- return 1;
-
- case DOIO:
- doio:
- type = fd->sc_type;
- sec = fd->sc_blkno % type->seccyl;
- nblks = type->seccyl - sec;
- nblks = min(nblks, fd->sc_bcount / FDC_BSIZE);
- nblks = min(nblks, FDC_MAXIOSIZE / FDC_BSIZE);
- fd->sc_nblks = nblks;
- fd->sc_nbytes = nblks * FDC_BSIZE;
- head = sec / type->sectrac;
- sec -= head * type->sectrac;
-#ifdef DIAGNOSTIC
- {int block;
- block = (fd->sc_cylin * type->heads + head) * type->sectrac + sec;
- if (block != fd->sc_blkno) {
- printf("fdcintr: block %d != blkno %d\n", block, fd->sc_blkno);
-#ifdef DDB
- Debugger();
-#endif
- }}
-#endif
- read = bp->b_flags & B_READ;
-/*#ifdef NEWCONFIG
- at_dma(read, bp->b_data + fd->sc_skip, fd->sc_nbytes,
- fdc->sc_drq);
-#else
- isa_dmastart(read, bp->b_data + fd->sc_skip, fd->sc_nbytes,
- fdc->sc_drq);
-#endif*/
- if (read)
- fiqhandler.fh_func = floppy_read_fiq;
- else
- fiqhandler.fh_func = floppy_write_fiq;
- fiqhandler.fh_r11 = nblks * FDC_BSIZE;
- fiqhandler.fh_r12 = (int)bp->b_data + (int)fd->sc_skip;
- fiqhandler.fh_r13 = fdc->sc_drq;
- fiqhandler.fh_mask = 0x01;
- if (fiq_claim(&fiqhandler) == -1)
- panic("Cannot claim FIQ vector");
-
- outb(iobase + fdctl, type->rate);
-#ifdef FD_DEBUG
- printf("fdcintr: %s drive %d track %d head %d sec %d nblks %d\n",
- read ? "read" : "write", fd->sc_drive, fd->sc_cylin, head,
- sec, nblks);
-#endif
- if (read)
- out_fdc(iobase, NE7CMD_READ); /* READ */
- else
- out_fdc(iobase, NE7CMD_WRITE); /* WRITE */
- out_fdc(iobase, (head << 2) | fd->sc_drive);
- out_fdc(iobase, fd->sc_cylin); /* track */
- out_fdc(iobase, head);
- out_fdc(iobase, sec + 1); /* sector +1 */
- out_fdc(iobase, type->secsize); /* sector size */
- out_fdc(iobase, type->sectrac); /* sectors/track */
- out_fdc(iobase, type->gap1); /* gap1 size */
- out_fdc(iobase, type->datalen); /* data length */
- fdc->sc_state = IOCOMPLETE;
- /* allow 2 seconds for operation */
- timeout(fdctimeout, fdc, 2 * hz);
- return 1; /* will return later */
-
- case SEEKWAIT:
- untimeout(fdctimeout, fdc);
- fdc->sc_state = SEEKCOMPLETE;
- /* allow 1/50 second for heads to settle */
-/* timeout(fdcpseudointr, fdc, hz / 50);*/
- return 1;
-
- case SEEKCOMPLETE:
- /* Make sure seek really happened. */
- out_fdc(iobase, NE7CMD_SENSEI);
- if (fdcresult(fdc) != 2 || (st0 & 0xf8) != 0x20 ||
- cyl != bp->b_cylin * fd->sc_type->step) {
-#ifdef FD_DEBUG
- fdcstatus(&fd->sc_dev, 2, "seek failed");
-#endif
- fdcretry(fdc);
- goto loop;
- }
- fd->sc_cylin = bp->b_cylin;
- goto doio;
-
- case IOTIMEDOUT:
-/*#ifdef NEWCONFIG
- at_dma_abort(fdc->sc_drq);
-#else
- isa_dmaabort(fdc->sc_drq);
-#endif*/
- if (fiq_release(&fiqhandler) == -1)
- panic("Cannot release FIQ vector");
- case SEEKTIMEDOUT:
- case RECALTIMEDOUT:
- case RESETTIMEDOUT:
- fdcretry(fdc);
- goto loop;
-
- case IOCOMPLETE: /* IO DONE, post-analyze */
- untimeout(fdctimeout, fdc);
- if (fdcresult(fdc) != 7 || (st0 & 0xf8) != 0) {
-/*#ifdef NEWCONFIG
- at_dma_abort(fdc->sc_drq);
-#else
- isa_dmaabort(fdc->sc_drq);
-#endif*/
- if (fiq_release(&fiqhandler) == -1)
- panic("Cannot release FIQ vector");
-#ifdef FD_DEBUG
- fdcstatus(&fd->sc_dev, 7, bp->b_flags & B_READ ?
- "read failed" : "write failed");
- printf("blkno %d nblks %d\n",
- fd->sc_blkno, fd->sc_nblks);
-#endif
- fdcretry(fdc);
- goto loop;
- }
-/*#ifdef NEWCONFIG
- at_dma_terminate(fdc->sc_drq);
-#else
- read = bp->b_flags & B_READ;
- isa_dmadone(read, bp->b_data + fd->sc_skip, fd->sc_nbytes,
- fdc->sc_drq);
-#endif*/
- if (fiq_release(&fiqhandler) == -1)
- panic("Cannot release FIQ vector");
-
- if (fdc->sc_errors) {
-/* diskerr(bp, "fd", "soft error", LOG_PRINTF,
- fd->sc_skip / FDC_BSIZE, (struct disklabel *)NULL);
- printf("\n");*/
- fdc->sc_errors = 0;
- }
- fd->sc_blkno += fd->sc_nblks;
- fd->sc_skip += fd->sc_nbytes;
- fd->sc_bcount -= fd->sc_nbytes;
- if (fd->sc_bcount > 0) {
- bp->b_cylin = fd->sc_blkno / fd->sc_type->seccyl;
- goto doseek;
- }
-/* printf("IOCOMPLETE:calling fdfinish fd=%08x bp=%08x blkno=%d\n", (u_int)fd, (u_int)bp, fd->sc_blkno);*/
- fdfinish(fd, bp);
- goto loop;
-
- case DORESET:
- /* try a reset, keep motor on */
- fd_set_motor(fdc, 1);
- delay(100);
- fd_set_motor(fdc, 0);
- fdc->sc_state = RESETCOMPLETE;
- timeout(fdctimeout, fdc, hz / 2);
- return 1; /* will return later */
-
- case RESETCOMPLETE:
- untimeout(fdctimeout, fdc);
- /* clear the controller output buffer */
- for (i = 0; i < 4; i++) {
- out_fdc(iobase, NE7CMD_SENSEI);
- (void) fdcresult(fdc);
- }
-
- /* fall through */
- case DORECAL:
- out_fdc(iobase, NE7CMD_RECAL); /* recalibrate function */
- out_fdc(iobase, fd->sc_drive);
- fdc->sc_state = RECALWAIT;
- timeout(fdctimeout, fdc, 5 * hz);
- return 1; /* will return later */
-
- case RECALWAIT:
- untimeout(fdctimeout, fdc);
- fdc->sc_state = RECALCOMPLETE;
- /* allow 1/30 second for heads to settle */
-/* timeout(fdcpseudointr, fdc, hz / 30);*/
- return 1; /* will return later */
-
- case RECALCOMPLETE:
- out_fdc(iobase, NE7CMD_SENSEI);
- if (fdcresult(fdc) != 2 || (st0 & 0xf8) != 0x20 || cyl != 0) {
-#ifdef FD_DEBUG
- fdcstatus(&fd->sc_dev, 2, "recalibrate failed");
-#endif
- fdcretry(fdc);
- goto loop;
- }
- fd->sc_cylin = 0;
- goto doseek;
-
- case MOTORWAIT:
- if (fd->sc_flags & FD_MOTOR_WAIT)
- return 1; /* time's not up yet */
- goto doseek;
-
- default:
- fdcstatus(&fd->sc_dev, 0, "stray interrupt");
- return 1;
- }
-#ifdef DIAGNOSTIC
- panic("fdcintr: impossible");
-#endif
-#undef st0
-#undef cyl
-}
-
-void
-fdcretry(fdc)
- struct fdc_softc *fdc;
-{
- struct fd_softc *fd;
- struct buf *bp;
-
- fd = fdc->sc_drives.tqh_first;
- bp = fd->sc_q.b_actf;
-
- switch (fdc->sc_errors) {
- case 0:
- /* try again */
-/* fdc->sc_state = SEEKCOMPLETE;*/
- fdc->sc_state = DOSEEK;
- break;
-
- case 1: case 2: case 3:
- /* didn't work; try recalibrating */
- fdc->sc_state = DORECAL;
- break;
-
- case 4:
- /* still no go; reset the bastard */
- fdc->sc_state = DORESET;
- break;
-
- default:
- diskerr(bp, "fd", "hard error", LOG_PRINTF,
- fd->sc_skip / FDC_BSIZE, (struct disklabel *)NULL);
- printf(" (st0 %b st1 %b st2 %b cyl %d head %d sec %d)\n",
- fdc->sc_status[0], NE7_ST0BITS,
- fdc->sc_status[1], NE7_ST1BITS,
- fdc->sc_status[2], NE7_ST2BITS,
- fdc->sc_status[3], fdc->sc_status[4], fdc->sc_status[5]);
-
- bp->b_flags |= B_ERROR;
- bp->b_error = EIO;
- fdfinish(fd, bp);
- }
- fdc->sc_errors++;
-}
-
-int
-fdsize(dev)
- dev_t dev;
-{
-
- /* Swapping to floppies would not make sense. */
- return -1;
-}
-
-int
-fddump(dev, blkno, va, size)
- dev_t dev;
- daddr_t blkno;
- caddr_t va;
- size_t size;
-{
-
- /* Not implemented. */
- return ENXIO;
-}
-
-int
-fdioctl(dev, cmd, addr, flag)
- dev_t dev;
- u_long cmd;
- caddr_t addr;
- int flag;
-{
- struct fd_softc *fd = fd_cd.cd_devs[FDUNIT(dev)];
- struct disklabel buffer;
- int error;
-
- switch (cmd) {
- case DIOCGDINFO:
- bzero(&buffer, sizeof(buffer));
-
- buffer.d_secpercyl = fd->sc_type->seccyl;
- buffer.d_type = DTYPE_FLOPPY;
- buffer.d_secsize = FDC_BSIZE;
-
- if (readdisklabel(dev, fdstrategy, &buffer, NULL, 0) != NULL)
- return EINVAL;
-
- *(struct disklabel *)addr = buffer;
- return 0;
-
- case DIOCWLABEL:
- if ((flag & FWRITE) == 0)
- return EBADF;
- /* XXX do something */
- return 0;
-
- case DIOCWDINFO:
- if ((flag & FWRITE) == 0)
- return EBADF;
-
- error = setdisklabel(&buffer, (struct disklabel *)addr, 0, NULL);
- if (error)
- return error;
-
- error = writedisklabel(dev, fdstrategy, &buffer, NULL);
- return error;
-
- default:
- return ENOTTY;
- }
-
-#ifdef DIAGNOSTIC
- panic("fdioctl: impossible");
-#endif
-}
-
-
-#include "rd.h"
-#if NRD > 0
-
-#include <dev/ramdisk.h>
-
-int
-load_ramdisc_from_floppy(rd, dev)
- struct rd_conf *rd;
- dev_t dev;
-{
- struct buf *bp;
- int loop;
- int s;
- int type;
- int floppysize;
-
- if (major(dev) != 17)
- return(EINVAL);
-
- if (rd->rd_type == RD_UNCONFIGURED || rd->rd_addr == 0)
- return(EBUSY);
-
- type = FDTYPE(dev) - 1;
- if (type < 0) type = 0;
- floppysize = fd_types[type].size << (fd_types[type].secsize + 7);
-
- if (rd->rd_size < floppysize) {
- printf("Ramdisc not big enough for floppy image\n");
- return(EINVAL);
- }
-
-/* We have the ramdisk ! */
-
- printf("Loading ramdisc : %4dK ", 0);
-
-/* obtain a buffer */
-
- bp = geteblk(fd_types[type].sectrac * DEV_BSIZE);
-
-/* request no partition relocation by driver on I/O operations */
-
- bp->b_dev = dev;
-
- s = spl0();
-
- if (fdopen(bp->b_dev, 0) != 0) {
- brelse(bp);
- printf("Cannot open floppy device\n");
- return(EINVAL);
- }
-
- for (loop = 0;
- loop < (floppysize / DEV_BSIZE / fd_types[type].sectrac);
- ++loop) {
- printf("\x08\x08\x08\x08\x08\x08%4dK ",
- loop * fd_types[type].sectrac * DEV_BSIZE / 1024);
- bp->b_blkno = loop * fd_types[type].sectrac;
- bp->b_bcount = fd_types[type].sectrac * DEV_BSIZE;
- bp->b_flags = B_BUSY | B_READ;
- bp->b_error = 0;
- bp->b_resid = 0;
- fdstrategy(bp);
-
- if (biowait(bp))
- panic("Cannot load floppy image");
-
- bcopy((caddr_t)bp->b_data, (caddr_t)rd->rd_addr
- + loop * fd_types[type].sectrac * DEV_BSIZE,
- fd_types[type].sectrac * DEV_BSIZE);
- }
- printf("\x08\x08\x08\x08\x08\x08%4dK done\n",
- loop * fd_types[type].sectrac * DEV_BSIZE / 1024);
-
- fdclose(bp->b_dev, 0);
-
- brelse(bp);
-
- splx(s);
- return(0);
-}
-
-#endif
diff --git a/sys/arch/arm32/mainbus/fdreg.h b/sys/arch/arm32/mainbus/fdreg.h
deleted file mode 100644
index bdfd8fe2760..00000000000
--- a/sys/arch/arm32/mainbus/fdreg.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* $NetBSD: fdreg.h,v 1.2 1996/03/18 20:50:02 mark Exp $ */
-
-/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fdreg.h 7.1 (Berkeley) 5/9/91
- */
-
-/*
- * AT floppy controller registers and bitfields
- */
-
-
-/*
- * Nec 765 floppy disc controller definitions
- */
-
-/* Main status register */
-#define NE7_DAB 0x01 /* Diskette drive A is seeking, thus busy */
-#define NE7_DBB 0x02 /* Diskette drive B is seeking, thus busy */
-#define NE7_CB 0x10 /* Diskette Controller Busy */
-#define NE7_NDM 0x20 /* Diskette Controller in Non Dma Mode */
-#define NE7_DIO 0x40 /* Diskette Controller Data register I/O */
-#define NE7_RQM 0x80 /* Diskette Controller ReQuest for Master */
-
-/* Status register ST0 */
-#define NE7_ST0BITS "\020\010invld\007abnrml\006seek_cmplt\005drv_chck\004drive_rdy\003top_head"
-
-/* Status register ST1 */
-#define NE7_ST1BITS "\020\010end_of_cyl\006bad_crc\005data_overrun\003sec_not_fnd\002write_protect\001no_am"
-
-/* Status register ST2 */
-#define NE7_ST2BITS "\020\007ctrl_mrk\006bad_crc\005wrong_cyl\004scn_eq\003scn_not_fnd\002bad_cyl\001no_dam"
-
-/* Status register ST3 */
-#define NE7_ST3BITS "\020\010fault\007write_protect\006drdy\005tk0\004two_side\003side_sel\002"
-
-/* Commands */
-#define NE7CMD_SPECIFY 3 /* specify drive parameters - requires unit
- parameters byte */
-#define NE7CMD_SENSED 4 /* sense drive - requires unit select byte */
-#define NE7CMD_WRITE 0xc5 /* write - requires eight additional bytes */
-#define NE7CMD_READ 0xe6 /* read - requires eight additional bytes */
-#define NE7CMD_FORMAT 0x4c /* format - requires five additional bytes */
-#define NE7CMD_RECAL 7 /* recalibrate drive - requires
- unit select byte */
-#define NE7CMD_SENSEI 8 /* sense controller interrupt status */
-#define NE7CMD_SEEK 15 /* seek drive - requires unit select byte
- and new cyl byte */
-#define NE7CMD_CONFIGURE 0x13
-
-/* registers */
-#define fdout 8 /* Digital Output Register (W) */
-#define FDO_FDSEL 0x03 /* floppy device select */
-#define FDO_FRST 0x04 /* floppy controller reset */
-#define FDO_FDMAEN 0x08 /* enable floppy DMA and Interrupt */
-#define FDO_MOEN(n) ((1 << n) * 0x10) /* motor enable */
-
-#define fdsts 16 /* NEC 765 Main Status Register (R) */
-#define fddata 20 /* NEC 765 Data Register (R/W) */
-
-#define fdctl 28 /* Control Register (W) */
-#define FDC_500KBPS 0x00 /* 500KBPS MFM drive transfer rate */
-#define FDC_300KBPS 0x01 /* 300KBPS MFM drive transfer rate */
-#define FDC_250KBPS 0x02 /* 250KBPS MFM drive transfer rate */
-#define FDC_125KBPS 0x03 /* 125KBPS FM drive transfer rate */
-
-#define fdin 28 /* Digital Input Register (R) */
-#define FDI_DCHG 0x80 /* diskette has been changed */
-
-#define FDC_BSIZE 512
-#define FDC_NPORT 32
-#define FDC_MAXIOSIZE NBPG /* XXX should be MAXBSIZE */
diff --git a/sys/arch/arm32/mainbus/iic.c b/sys/arch/arm32/mainbus/iic.c
deleted file mode 100644
index b416a035104..00000000000
--- a/sys/arch/arm32/mainbus/iic.c
+++ /dev/null
@@ -1,403 +0,0 @@
-/* $NetBSD: iic.c,v 1.1 1996/04/19 19:49:03 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1996 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * iic.c
- *
- * Routines to communicate with IIC devices
- *
- * Created : 13/10/94
- *
- * Based of kate/display/iiccontrol.c
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/conf.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-
-#include <machine/io.h>
-#include <machine/iomd.h>
-#include <machine/katelib.h>
-#include <machine/cpu.h>
-#include <machine/irqhandler.h>
-#include <machine/iic.h>
-#include <arm32/mainbus/mainbus.h>
-
-/* Local function prototypes */
-
-static int iic_getack __P((void));
-static void iic_write_bit __P((int bit));
-static int iic_write_byte __P((u_char value));
-static u_char iic_read_byte __P((void));
-static void iic_start_bit __P((void));
-static void iic_stop_bit __P((void));
-
-struct iic_softc {
- struct device sc_dev;
- int sc_flags;
-#define IIC_BROKEN 1
-#define IIC_OPEN 2
-#define IIC_BUSY 4
-};
-
-void iicattach __P((struct device *parent, struct device *self, void *aux));
-int iicmatch __P((struct device *parent, void *match, void *aux));
-
-/*
- * Main entry to IIC driver.
- */
-
-int
-iic_control(address, buffer, count)
- u_char address;
- u_char *buffer;
- int count;
-{
- int loop;
-
-/* Send the start bit */
-
- iic_start_bit();
-
-/* Send the address */
-
- if (!iic_write_byte(address)) {
- iic_stop_bit();
- return(-1);
- }
-
-/* Read or write the data as required */
-
- if ((address & 1) == 0) {
-/* Write bytes */
- for (loop = 0; loop < count; ++loop) {
- if (!iic_write_byte(buffer[loop])) {
- iic_stop_bit();
- return(-1);
- }
- }
- }
- else {
-/* Read bytes */
- for (loop = 0; loop < count; ++loop) {
- buffer[loop] = iic_read_byte();
-
-/* Send final acknowledge */
-
- if (loop == (count - 1))
- iic_write_bit(1);
- else
- iic_write_bit(0);
- }
- }
-
-/* Send stop bit */
-
- iic_stop_bit();
-
- return(0);
-}
-
-
-static int
-iic_getack()
-{
- u_int oldirqstate;
- int ack;
-
- iic_set_state(1, 0);
- oldirqstate = disable_interrupts(I32_bit);
- iic_set_state_and_ack(1, 1);
- ack = ReadByte(IOMD_IOCR);
- iic_set_state(1, 0);
- restore_interrupts(oldirqstate);
-
- return((ack & 1) == 0);
-}
-
-
-static void
-iic_write_bit(bit)
- int bit;
-{
- u_int oldirqstate;
-
- iic_set_state(bit, 0);
- oldirqstate = disable_interrupts(I32_bit);
- iic_set_state_and_ack(bit, 1);
- iic_set_state(bit, 0);
- restore_interrupts(oldirqstate);
-}
-
-
-static int
-iic_write_byte(value)
- u_char value;
-{
- int loop;
- int bit;
-
- for (loop = 0x80; loop != 0; loop = loop >> 1) {
- bit = ((value & loop) != 0);
- iic_write_bit(bit);
- }
-
- return(iic_getack());
-}
-
-
-static u_char
-iic_read_byte()
-{
- int loop;
- u_char byte;
- u_int oldirqstate;
-
- iic_set_state(1,0);
-
- byte = 0;
-
- for (loop = 0; loop < 8; ++loop) {
- oldirqstate = disable_interrupts(I32_bit);
- iic_set_state_and_ack(1, 1);
- byte = (byte << 1) + (ReadByte(IOMD_IOCR) & 1);
- iic_set_state(1, 0);
- restore_interrupts(oldirqstate);
- }
-
- return(byte);
-}
-
-
-static void
-iic_start_bit()
-{
- iic_set_state(1, 1);
- iic_set_state(0, 1);
- iic_delay(10);
- iic_set_state(0, 0);
-}
-
-
-static void
-iic_stop_bit()
-{
- iic_set_state(0, 1);
- iic_set_state(1, 1);
-}
-
-
-struct cfattach iic_ca = {
- sizeof(struct iic_softc), iicmatch, iicattach
-};
-
-struct cfdriver iic_cd = {
- NULL, "iic", DV_DULL, 0
-};
-
-int
-iicmatch(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
-{
- int id;
-
-/* Make sure we have an IOMD we understand */
-
- id = ReadByte(IOMD_ID0) | (ReadByte(IOMD_ID1) << 8);
-
-/* So far I only know about this IOMD */
-
- switch (id) {
- case RPC600_IOMD_ID:
- case RC7500_IOC_ID:
- return(1);
- break;
- default:
- printf("iic: Unknown IOMD id=%04x", id);
- break;
- }
-
- return(0);
-}
-
-int
-iicprint(aux, name)
- void *aux;
- const char *name;
-{
- struct iicbus_attach_args *ib = aux;
-
- if (!name) {
- if (ib->ib_addr)
- printf(" addr 0x%02x", ib->ib_addr);
- }
-
-/* XXXX print flags */
- return (QUIET);
-}
-
-
-int
-iicsubmatch(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
-{
- struct cfdata *cf = match;
- struct iicbus_attach_args *ib = aux;
-
- if (cf->cf_fstate == FSTATE_STAR)
- panic("eekkk, I'm stuffed");
-
- ib->ib_addr = cf->cf_loc[0];
-
- if (ib->ib_addr == -1)
- return(0);
-
- return((*cf->cf_attach->ca_match)(parent, match, aux));
-}
-
-void
-iicattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct iicbus_attach_args iaa;
-
- printf("\n");
-
- while (config_found_sm(self, &iaa, iicprint, iicsubmatch));
-}
-
-
-int
-iicopen(dev, flag, mode, p)
- dev_t dev;
- int flag;
- int mode;
- struct proc *p;
-{
- struct iic_softc *sc;
- int unit = minor(dev);
-
- if (unit >= iic_cd.cd_ndevs)
- return(ENXIO);
-
- sc = iic_cd.cd_devs[unit];
-
- if (!sc) return(ENXIO);
-
- if (sc->sc_flags & IIC_OPEN) return(EBUSY);
-
- sc->sc_flags |= IIC_OPEN;
-
- return(0);
-}
-
-
-int
-iicclose(dev, flag, mode, p)
- dev_t dev;
- int flag;
- int mode;
- struct proc *p;
-{
- int unit = minor(dev);
- struct iic_softc *sc = iic_cd.cd_devs[unit];
-
- sc->sc_flags &= ~IIC_OPEN;
-
- return(0);
-}
-
-
-int
-iicread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- int unit = minor(dev);
- struct iic_softc *sc = iic_cd.cd_devs[unit];
-
- return(ENXIO);
-}
-
-
-int
-iicwrite(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- int unit = minor(dev);
- struct iic_softc *sc = iic_cd.cd_devs[unit];
-
- return(ENXIO);
-}
-
-
-int
-iicioctl(dev, cmd, data, flag, p)
- dev_t dev;
- int cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- struct iic_softc *sc = iic_cd.cd_devs[minor(dev)];
-
-/*
- switch (cmd) {
- case IICIOC_CONTROL:
- if (iiccontrol() != 0) {
- return(EIO);
- }
- return(0);
- }
-*/
-
- return(EINVAL);
-}
-
-/* End of iic.c */
diff --git a/sys/arch/arm32/mainbus/iic_asm.S b/sys/arch/arm32/mainbus/iic_asm.S
deleted file mode 100644
index 10ceb8a0238..00000000000
--- a/sys/arch/arm32/mainbus/iic_asm.S
+++ /dev/null
@@ -1,239 +0,0 @@
-/* $NetBSD: iic_asm.S,v 1.1 1996/04/19 19:49:04 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1996 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * iic.s
- *
- * Low level routines to with IIC devices
- *
- * Created : 13/10/94
- *
- * Based of kate/display/iic.s
- */
-
-#include <machine/cpu.h>
-#include <machine/iomd.h>
-
-#define IIC_BITDELAY 10
-
-sp .req r13
-lr .req r14
-pc .req r15
-
-.text
-
- .global _iic_set_state
-
-_iic_set_state:
-/*
- * Parameters
- * r0 - IIC data bit
- * r1 - IIC clock bit
- */
-
-/* Store temporary register */
-/* stmfd sp!, {r4}*/
-
-/*
- * Mask the data and clock bits
- * Since these routines are only called from iiccontrol.c this is not
- * really needed
- */
- and r0, r0, #0x00000001
- and r1, r1, #0x00000001
-
-/* Get address of IOMD control register */
-
- mov r2, #(IOMD_BASE)
-
-/* Get the current CPSR */
-/* mrs r4, cpsr_all
- orr r3, r4, #(I32_bit | F32_bit)
- msr cpsr_all, r3
-*/
-
- IRQdisable
-
-/* Get current value of control register */
-
- ldrb r3, [r2, #(IOMD_IOCR - IOMD_BASE)]
-
-/* Preserve non-IIC bits */
-
- bic r3, r3, #0x00000003
- orr r3, r3, #0x000000c0
-
-/* Set the IIC clock and data bits */
-
- orr r3, r3, r0
- orr r3, r3, r1, lsl #1
-
-/* Store the new value of control register */
-
- strb r3, [r2, #(IOMD_IOCR - IOMD_BASE)]
-
-/* Restore CPSR state */
-/* msr cpsr_all, r4 */
-
- IRQenable
-
-/* Restore temporary register */
-/* ldmfd sp!, {r4} */
-
-/* Pause a bit */
-
- mov r0, #(IIC_BITDELAY)
-
-/* Exit via iic_delay routine */
- b _iic_delay
-
-
- .global _iic_set_state_and_ack
-
-_iic_set_state_and_ack:
-/*
- * Parameters
- * r0 - IIC data bit
- * r1 - IIC clock bit
- */
-/* Store temporary register */
-/* stmfd sp!, {r4} */
-
-/*
- * Mask the data and clock bits
- * Since these routines are only called from iiccontrol.c this is not
- * really needed
- */
-
- and r0, r0, #0x00000001
- and r1, r1, #0x00000001
-
-/* Get address of IOMD control register */
-
- mov r2, #(IOMD_BASE)
-
-/* Get the current CPSR */
-/* mrs r4, cpsr_all
- orr r3, r4, #(I32_bit | F32_bit)
- msr cpsr_all, r3
-*/
- IRQdisable
-
-/* Get current value of control register */
-
- ldrb r3, [r2, #(IOMD_IOCR - IOMD_BASE)]
-
-/* Preserve non-IIC bits */
-
- bic r3, r3, #0x00000003
- orr r3, r3, #0x000000c0
-
-/* Set the IIC clock and data bits */
-
- orr r3, r3, r0
- orr r3, r3, r1, lsl #1
-
-/* Store the new value of control register */
-
- strb r3, [r2, #(IOMD_IOCR - IOMD_BASE)]
-
-iic_set_state_and_ack_loop:
- ldrb r3, [r2, #(IOMD_IOCR - IOMD_BASE)]
- tst r3, #0x00000002
- beq iic_set_state_and_ack_loop
-
-/* Restore CPSR state */
-/* msr cpsr_all, r4 */
-
- IRQenable
-
-/* Restore temporary register */
-/* ldmfd sp!, {r4} */
-
-/* Pause a bit */
-
- mov r0, #(IIC_BITDELAY)
-
-/* Exit via iic_delay routine */
- b _iic_delay
-
-
- .global _iic_delay
-
-_iic_delay:
-/*
- * Parameters
- * r0 - time to wait
- */
-
-/* Load address of IOMD */
-
- mov r2, #(IOMD_BASE)
-
-/* Latch current value of timer 1 */
-
- strb r2, [r2, #(IOMD_T0LATCH - IOMD_BASE)]
-
-/* Get the latched value */
-
- ldrb r1, [r2, #(IOMD_T0LOW - IOMD_BASE)]
-
-/* Loop until timer reaches end value */
-
-iic_delay_loop:
-
-/* Latch the current value of timer1 */
-
- strb r2, [r2, #(IOMD_T0LATCH - IOMD_BASE)]
-
-/* Get the latched value */
-
- ldrb r3, [r2, #(IOMD_T0LOW - IOMD_BASE)]
-
-/* Loop until timer reached expected value */
-
- teq r3, r1
- movne r1, r3
- beq iic_delay_loop
-
- subs r0, r0, #0x00000001
- bne iic_delay_loop
-
-/* Exit */
- mov pc, lr
-
-/* End of iic_asm.S */
diff --git a/sys/arch/arm32/mainbus/kbd.c b/sys/arch/arm32/mainbus/kbd.c
deleted file mode 100644
index 5dd3ea7ce86..00000000000
--- a/sys/arch/arm32/mainbus/kbd.c
+++ /dev/null
@@ -1,1357 +0,0 @@
-/* $NetBSD: kbd.c,v 1.7 1996/03/28 21:55:15 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * kbd.c
- *
- * Keyboard driver functions
- *
- * Created : 09/10/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/conf.h>
-#include <sys/proc.h>
-#include <sys/reboot.h>
-#include <sys/device.h>
-#include <sys/ioctl.h>
-#include <sys/malloc.h>
-#include <sys/tty.h>
-#include <sys/vnode.h>
-#include <sys/select.h>
-#include <sys/fcntl.h>
-#include <sys/signalvar.h>
-#include <sys/time.h>
-
-#include <machine/irqhandler.h>
-#include <machine/iomd.h>
-#include <machine/vidc.h>
-#include <machine/katelib.h>
-#include <machine/kbd.h>
-#include <arm32/mainbus/mainbus.h>
-#include "vt.h"
-#include "kbd.h"
-
-/* Declare global variables */
-
-/* Declare external variables */
-
-/* Local function prototypes */
-
-/* Now for the main code */
-
-/* Define the key_struct structure */
-
-typedef struct {
- int base_code; /* Base ASCII code */
- int shift_code; /* Shifted ASCII code */
- int ctrl_code; /* CTRL code */
- int alt_code; /* Alt code */
- int flags; /* Flags field */
-} key_struct;
-
-/* Define mappings for each possible code */
-
-key_struct keys[256] = {
-/* 0x00 - 0x0f */
- { 0x00, 0x00, 0x00, 0x00, 0x80 },
- { 0x89, 0x99, 0x00, 0x489, 0x00 },
- { 0x8a, 0x9a, 0x00, 0x00, 0x00 },
- { 0x85, 0x95, 0x00, 0x485, 0x00 },
- { 0x83, 0x93, 0x00, 0x483, 0x00 },
- { 0x81, 0x91, 0x00, 0x481, 0x00 },
- { 0x82, 0x92, 0x00, 0x482, 0x00 },
- { 0x8c, 0x9c, 0x00, 0x48c, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x88, 0x98, 0x00, 0x488, 0x00 },
- { 0x86, 0x96, 0x00, 0x486, 0x00 },
- { 0x84, 0x94, 0x00, 0x484, 0x00 },
- { 0x09, 0x09, 0x09, 0x09, 0x00 },
- { 0x60, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-
-/* 0x10 - 0x1f */
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x84 },
- { 0x00, 0x00, 0x00, 0x00, 0x82 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x81 },
- { 0x71, 0x51, 0x11, 0x00, 0x40 },
- { 0x31, 0x21, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x7a, 0x5a, 0x1a, 0x00, 0x40 },
- { 0x73, 0x53, 0x13, 0x00, 0x40 },
- { 0x61, 0x41, 0x01, 0x00, 0x40 },
- { 0x77, 0x57, 0x17, 0x00, 0x40 },
- { 0x32, 0x22, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-
-/* 0x20 - 0x2f */
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x63, 0x43, 0x03, 0x00, 0x40 },
- { 0x78, 0x58, 0x18, 0x00, 0x40 },
- { 0x64, 0x44, 0x04, 0x00, 0x40 },
- { 0x65, 0x45, 0x05, 0x00, 0x40 },
- { 0x34, 0x24, 0x00, 0x00, 0x00 },
- { 0x33, 0x23, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x20, 0x20, 0x20, 0x20, 0x00 },
- { 0x76, 0x56, 0x16, 0x00, 0x40 },
- { 0x66, 0x46, 0x06, 0x00, 0x40 },
- { 0x74, 0x54, 0x14, 0x00, 0x40 },
- { 0x72, 0x52, 0x12, 0x00, 0x40 },
- { 0x35, 0x25, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-
-/* 0x30 - 0x3f */
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x6e, 0x4e, 0x0e, 0x00, 0x40 },
- { 0x62, 0x42, 0x02, 0x00, 0x40 },
- { 0x68, 0x48, 0x08, 0x00, 0x40 },
- { 0x67, 0x47, 0x07, 0x00, 0x40 },
- { 0x79, 0x59, 0x19, 0x00, 0x40 },
- { 0x36, 0x5e, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x6d, 0x4d, 0x0d, 0x00, 0x40 },
- { 0x6a, 0x4a, 0x0a, 0x00, 0x40 },
- { 0x75, 0x55, 0x15, 0x00, 0x40 },
- { 0x37, 0x26, 0x00, 0x00, 0x00 },
- { 0x38, 0x2a, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-
-/* 0x40 - 0x4f */
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x2c, 0x3c, 0x00, 0x00, 0x00 },
- { 0x6b, 0x4b, 0x0b, 0x00, 0x40 },
- { 0x69, 0x49, 0x09, 0x00, 0x40 },
- { 0x6f, 0x4f, 0x0f, 0x00, 0x40 },
- { 0x30, 0x29, 0x00, 0x00, 0x00 },
- { 0x39, 0x28, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x2e, 0x3e, 0x00, 0x00, 0x00 },
- { 0x2f, 0x3f, 0x00, 0x00, 0x00 },
- { 0x6c, 0x4c, 0x0c, 0x00, 0x40 },
- { 0x3b, 0x3a, 0x00, 0x00, 0x00 },
- { 0x70, 0x50, 0x10, 0x00, 0x40 },
- { 0x2d, 0x5f, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-
-/* 0x50 - 0x5f */
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x27, 0x40, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x5b, 0x7b, 0x00, 0x00, 0x00 },
- { 0x3d, 0x2b, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0xa0 },
- { 0x00, 0x00, 0x00, 0x00, 0x82 },
- { 0x0d, 0x0d, 0x0d, 0x00, 0x00 },
- { 0x5d, 0x7d, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x23, 0x7e, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-
-/* 0x60 - 0x6f */
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x5c, 0x7c, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x08, 0x7f, 0x08, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x31, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x34, 0x00, 0x00, 0x00, 0x00 },
- { 0x37, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-
-/* 0x70 - 0x7f */
- { 0x30, 0x00, 0x00, 0x00, 0x00 },
- { 0x2e, 0x00, 0x00, 0x00, 0x00 },
- { 0x32, 0x00, 0x00, 0x00, 0x00 },
- { 0x35, 0x00, 0x00, 0x00, 0x00 },
- { 0x36, 0x00, 0x00, 0x00, 0x00 },
- { 0x38, 0x00, 0x00, 0x00, 0x00 },
- { 0x1b, 0x1b, 0x21b, 0x1b, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x90 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x2b, 0x00, 0x00, 0x22b, 0x00 },
- { 0x33, 0x00, 0x00, 0x00, 0x00 },
- { 0x2d, 0x00, 0x00, 0x22d, 0x00 },
- { 0x2a, 0x00, 0x00, 0x00, 0x00 },
- { 0x39, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x88 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-
-/* 0x80 - 0x8f */
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x87, 0x97, 0x00, 0x487, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-
-/* 0x90 - 0x9f */
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-
-/* 0xa0 - 0xaf */
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-
-/* 0xb0 - 0xbf */
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-
-/* 0xc0 - 0xcf */
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-
-/* 0xd0 - 0xdf */
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-
-/* 0xe0 - 0xef */
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-
-/* 0xf0 - 0xff */
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 }
-};
-
-/* Define mappings for each possible code */
-
-key_struct E0keys[128] = {
-
-/* 0x00 - 0x0f */
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-
-/* 0x10 - 0x1f */
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x84 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x81 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-
-/* 0x20 - 0x2f */
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-
-/* 0x30 - 0x3f */
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-
-/* 0x40 - 0x4f */
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x2f, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-
-/* 0x50 - 0x5f */
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x0d, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-
-/* 0x60 - 0x6f */
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x10b, 0x00, 0x00, 0x20b, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x102, 0x00, 0x00, 0x202, 0x00 },
- { 0x10a, 0x00, 0x00, 0x20a, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-
-/* 0x70 - 0x7f */
- { 0x108, 0x00, 0x00, 0x208, 0x00 },
- { 0x109, 0x00, 0x00, 0x209, 0x00 },
- { 0x101, 0x105, 0x00, 0x201, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x103, 0x00, 0x00, 0x203, 0x00 },
- { 0x100, 0x104, 0x00, 0x200, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x104, 0x100, 0x00, 0x204, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x105, 0x101, 0x00, 0x205, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x00, 0x00, 0x00, 0x00, 0x00 },
-};
-
-/* Special keycodes */
-
-#define KEYCODE_UP 0x100
-#define KEYCODE_DOWN 0x101
-#define KEYCODE_LEFT 0x102
-#define KEYCODE_RIGHT 0x103
-#define KEYCODE_PGUP 0x104
-#define KEYCODE_PGDN 0x105
-#define KEYCODE_INSERT 0x108
-#define KEYCODE_DELETE 0x109
-#define KEYCODE_HOME 0x10a
-#define KEYCODE_END 0x10b
-
-/* Key modifiers flags */
-
-#define MODIFIER_CTRL 0x01
-#define MODIFIER_SHIFT 0x02
-#define MODIFIER_ALT 0x04
-#define MODIFIER_MASK 0x07
-
-#define MODIFIER_CAPS 0x20
-#define MODIFIER_NUM 0x10
-#define MODIFIER_SCROLL 0x08
-#define MODIFIER_LOCK_MASK 0x38
-
-#define MODIFIER_CAPSLOCK 0x40
-#define MODIFIER_NORETURN 0x80
-
-/* Keyboard buffer variables */
-
-#define BUFFER_SIZE 32
-#define RAWKBD_BSIZE 128
-
-static int autorepeatkey = -1;
-static struct kbd_autorepeat kbdautorepeat = { 5, 20 };
-static int rawkbd_device = 0;
-int modifiers = 0;
-static int kbd_ack = 0;
-static int kbd_resend = 0;
-
-extern int pmap_debug_level;
-
-struct kbd_softc {
- struct device sc_device;
- irqhandler_t sc_ih;
-
- int sc_state;
-#define RAWKBD_OPEN 0x01
-#define KBD_OPEN 0x02
-#define RAWKBD_ASLEEP 0x04
- int sc_iobase;
- struct clist sc_q;
- struct selinfo sc_rsel;
- struct proc *sc_proc;
-};
-
-#define KBDUNIT(u) (minor(u) / 2)
-#define KBDFLAG(u) (minor(u) % 2)
-
-#define KBDFLAG_RAWUNIT 0
-#define KBDFLAG_CONUNIT 1
-
-int kbdprobe __P((struct device *, void *, void *));
-void kbdattach __P((struct device *, struct device *, void *));
-
-int kbdopen __P((dev_t, int, int, struct proc *));
-int kbdclose __P((dev_t, int, int, struct proc *));
-int kbdread __P((dev_t, struct uio *, int));
-int kbdselect __P((dev_t, int, struct proc *));
-int kbdioctl __P((dev_t, int, caddr_t, int, struct proc *));
-
-void kbdinit __P((struct kbd_softc *sc));
-void kbdsetleds __P((int /*leds*/));
-
-int PollKeyboard __P((int));
-int kbddecodekey __P((struct kbd_softc *, int));
-int kbdintr __P((struct kbd_softc *));
-
-void autorepeatstart __P((void *));
-void autorepeat __P((void *));
-
-struct cfattach kbd_ca = {
- sizeof(struct kbd_softc), kbdprobe, kbdattach
-};
-
-struct cfdriver kbd_cd = {
- NULL, "kbd", DV_TTY
-};
-
-
-int
-kbdprobe(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
-{
-/* struct mainbus_attach_args *mb = aux;*/
- int id;
-
-/* Make sure we have an IOMD we understand */
-
- id = ReadByte(IOMD_ID0) | (ReadByte(IOMD_ID1) << 8);
-
-/* So far I only know about this IOMD */
-
- switch (id) {
- case RPC600_IOMD_ID:
- case RC7500_IOC_ID:
- return(1);
- break;
- default:
- printf("kbd: Unknown IOMD id=%04x", id);
- break;
- }
-
- return(0);
-}
-
-
-void
-kbdattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct kbd_softc *sc = (void *)self;
- struct mainbus_attach_args *mb = aux;
-
- sc->sc_iobase = mb->mb_iobase;
-
- kbdinit(sc);
-
- printf("\n");
-}
-
-
-int
-kbdopen(dev, flag, mode, p)
- dev_t dev;
- int flag;
- int mode;
- struct proc *p;
-{
- struct kbd_softc *sc;
- int unit = KBDUNIT(dev);
-
- if (unit >= kbd_cd.cd_ndevs)
- return(ENXIO);
-
- sc = kbd_cd.cd_devs[unit];
-
- if (!sc) return(ENXIO);
-
- switch (KBDFLAG(dev)) {
- case KBDFLAG_RAWUNIT :
- if (sc->sc_state & RAWKBD_OPEN)
- return(EBUSY);
- sc->sc_state |= RAWKBD_OPEN;
- if (clalloc(&sc->sc_q, RAWKBD_BSIZE, 0) == -1)
- return(ENOMEM);
- sc->sc_proc = p;
- rawkbd_device = 1;
- break;
- case KBDFLAG_CONUNIT :
- if (sc->sc_state & KBD_OPEN)
- return(EBUSY);
- sc->sc_state |= KBD_OPEN;
- break;
- }
-
-/* Kill any active autorepeat */
-
- untimeout(autorepeatstart, &autorepeatkey);
- untimeout(autorepeat, &autorepeatkey);
-
- return(0);
-}
-
-
-int
-kbdclose(dev, flag, mode, p)
- dev_t dev;
- int flag;
- int mode;
- struct proc *p;
-{
- int unit = KBDUNIT(dev);
- struct kbd_softc *sc = kbd_cd.cd_devs[unit];
-
- switch (KBDFLAG(dev)) {
- case KBDFLAG_RAWUNIT :
- if (!(sc->sc_state & RAWKBD_OPEN))
- return(EINVAL);
- sc->sc_state &= ~RAWKBD_OPEN;
- clfree(&sc->sc_q);
- sc->sc_proc = NULL;
- rawkbd_device = 0;
- break;
- case KBDFLAG_CONUNIT :
- if (!(sc->sc_state & KBD_OPEN))
- return(EINVAL);
- sc->sc_state &= ~KBD_OPEN;
- break;
- }
-
- return(0);
-}
-
-
-int
-kbdread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- struct kbd_softc *sc = kbd_cd.cd_devs[KBDUNIT(dev)];
- int s;
- int error = 0;
- size_t length;
- u_char buffer[128];
-
- if (KBDFLAG(dev) == KBDFLAG_CONUNIT)
- return(ENXIO);
-
- /* Block until keyboard activity occured. */
-
- s = spltty();
- while (sc->sc_q.c_cc == 0) {
- if (flag & IO_NDELAY) {
- splx(s);
- return EWOULDBLOCK;
- }
- sc->sc_state |= RAWKBD_ASLEEP;
- if ((error = tsleep((caddr_t)sc, PZERO | PCATCH, "kbdread", 0))) {
- sc->sc_state &= (~RAWKBD_ASLEEP);
- splx(s);
- return error;
- }
- }
- splx(s);
-
- /* Transfer as many chunks as possible. */
-
- while (sc->sc_q.c_cc > 0 && uio->uio_resid > 0) {
- length = min(sc->sc_q.c_cc, uio->uio_resid);
- if (length > sizeof(buffer))
- length = sizeof(buffer);
-
- /* Remove a small chunk from the input queue. */
- (void) q_to_b(&sc->sc_q, buffer, length);
-
- /* Copy the data to the user process. */
- if ((error = (uiomove(buffer, length, uio))))
- break;
- }
- return error;
-}
-
-int
-kbdselect(dev, rw, p)
- dev_t dev;
- int rw;
- struct proc *p;
-{
- struct kbd_softc *sc = kbd_cd.cd_devs[KBDUNIT(dev)];
- int s;
- int ret;
-
- if (KBDFLAG(dev) == KBDFLAG_CONUNIT)
- return(ENXIO);
-
- if (rw == FWRITE)
- return 0;
-
- s = spltty();
- if (!sc->sc_q.c_cc) {
- selrecord(p, &sc->sc_rsel);
- ret = 0;
- } else
- ret = 1;
- splx(s);
- return ret;
-}
-
-
-int
-kbdioctl(dev, cmd, data, flag, p)
- dev_t dev;
- int cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
-/* struct kbd_softc *sc = kbd_cd.cd_devs[KBDUNIT(dev)];*/
- struct kbd_autorepeat *kbdar = (void *)data;
- int *leds = (int *)data;
- int s;
-
- switch (cmd) {
- case KBD_GETAUTOREPEAT:
-/* if (KBDFLAG(dev) == KBDFLAG_RAWUNIT)
- return(EINVAL);*/
-
- *kbdar = kbdautorepeat;
- break;
- case KBD_SETAUTOREPEAT:
-/* if (KBDFLAG(dev) == KBDFLAG_RAWUNIT)
- return(EINVAL);*/
- s = spltty();
- kbdautorepeat = *kbdar;
- if (kbdautorepeat.ka_rate < 1)
- kbdautorepeat.ka_rate = 1;
- if (kbdautorepeat.ka_rate > 50)
- kbdautorepeat.ka_rate = 50;
- if (kbdautorepeat.ka_delay > 50)
- kbdautorepeat.ka_delay = 50;
- if (kbdautorepeat.ka_delay < 1)
- kbdautorepeat.ka_delay = 1;
- (void)splx(s);
- break;
- case KBD_SETLEDS:
- kbdsetleds(*leds);
- break;
- default:
- return(ENXIO);
- }
- return(0);
-}
-
-
-void
-kbdsetleds(leds)
- int leds;
-{
- int loop;
-
- if ((ReadByte(IOMD_KBDCR) & 0x80)) {
- WriteByte(IOMD_KBDDAT, 0xed);
- loop = 10000;
- while ((ReadByte(IOMD_KBDCR) & 0x40) && loop > 0)
- --loop;
- if ((ReadByte(IOMD_KBDCR) & 0x80)) {
- WriteByte(IOMD_KBDDAT, leds);
- loop = 10000;
- while ((ReadByte(IOMD_KBDCR) & 0x40) && loop > 0)
- --loop;
- }
- }
-}
-
-
-void
-kbdsetstate(state)
- int state;
-{
- modifiers = state & MODIFIER_LOCK_MASK;
-}
-
-
-int
-kdbgetstate()
-{
- return(modifiers);
-}
-
-
-void
-kbdinit(sc)
- struct kbd_softc *sc;
-{
- sc->sc_ih.ih_func = kbdintr;
- sc->sc_ih.ih_arg = sc;
- sc->sc_ih.ih_level = IPL_TTY;
- sc->sc_ih.ih_name = "kbd rx";
- if (irq_claim(IRQ_KBDRX, &sc->sc_ih))
- panic("Cannot claim IRQ for kbd%d", sc->sc_device.dv_unit);
-
- modifiers = 0;
- kbdsetleds((modifiers >> 3) & 7);
-}
-
-
-int
-getkey_polled()
-{
- int code;
- int key;
- int up;
- key_struct *ks;
- int s;
-
- s = splhigh();
-
- key = 0;
-
- do {
- while ((ReadByte(IOMD_KBDCR) & (1<<5)) == 0) ;
-
-/* Read the IOMD keyboard register and process the key */
-
- code = PollKeyboard(ReadByte(IOMD_KBDDAT));
-
- if (code != 0) {
- up = (code & 0x100);
- key = code & 0xff;
-
-/* printf("code=%04x mod=%04x\n", code, modifiers);*/
-
-/* By default we use the main keycode lookup table */
-
- ks = keys;
-
-/* If we have an E0 or E1 sqeuence we use the extended table */
-
- if (code > 0x1ff)
- ks = E0keys;
-
-/* Is the key a temporary modifier ? */
-
- if (ks[key].flags & MODIFIER_MASK) {
- if (up)
- modifiers &= ~ks[key].flags;
- else
- modifiers |= ks[key].flags;
- key = 0;
- continue;
- }
-
-/* Is the key a locking modifier ? */
-
- if (ks[key].flags & MODIFIER_LOCK_MASK) {
- if (!up) {
- modifiers ^= ks[key].flags;
- kbdsetleds((modifiers >> 3) & 7);
- }
- key = 0;
- continue;
- }
-
-/* Lookup the correct key code */
-
- if (modifiers & 0x01)
- key = ks[key].ctrl_code;
- else if (modifiers & 0x02)
- key = ks[key].shift_code;
- else if (modifiers & 0x04)
- key = ks[key].alt_code;
- else
- key = ks[key].base_code;
-
- if (modifiers & MODIFIER_CAPS) {
- if ((key >= 'A' && key <= 'Z') || (key >= 'a' && key <= 'z'))
- key ^= 0x20;
- }
-
- if (up)
- key = 0;
- if (!up && key >= 0x200) {
-
-#if (NVT > 0)
- if ((key & ~0x0f) == 0x480)
- console_switch((key & 0x0f) - 1);
- else
-#endif
- switch (key) {
-#if (NVT > 0)
- case 0x201:
- console_scrollforward();
- break;
- case 0x200:
- console_scrollback();
- break;
-#endif
- default:
- break;
- }
- key = 0;
- }
- }
- } while (key == 0);
-
- if (key == '\r')
- key = '\n';
-
- splx(s);
- return(key);
-}
-
-
-/* Keyboard IRQ handler */
-
-int
-kbdintr(sc)
- struct kbd_softc *sc;
-{
- int key;
-
-/* Read the IOMD keyboard register and process the key */
-
- key = PollKeyboard(ReadByte(IOMD_KBDDAT));
-
-/* If we have a raw keycode convert it to an ASCII code */
-
- if (key != 0)
- kbddecodekey(sc, key);
- return(1);
-}
-
-
-/* Flags used to decode the raw keys */
-
-#define FLAG_KEYUP 0x01
-#define FLAG_E0 0x02
-#define FLAG_E1 0x04
-
-static int flags = 0;
-
-/*
- * This function is now misnamed.
- * It processes the raw key codes from the keyboard and generates
- * a unique code that can be decoded with the key translation array.
- */
-
-int
-PollKeyboard(code)
- int code;
-{
-/* printf("%02x.", code);*/
-
-/*
- * Set the keyup flag if this is the release code.
- */
-
- if (code == 0xf0) {
- flags |= FLAG_KEYUP;
- return(0);
- }
-
-/* If it is a special code ignore it */
-
- if (code == 0xff || code == 0x00) {
- flags = 0;
- return(0);
- }
-
-/* If it is a resend code note it down */
-
- if (code == 0xfe) {
- printf("kbd:resend\n");
- kbd_resend = 1;
- return(0);
- }
-
-/* If it is an ack code note it down */
-
- if (code == 0xfa) {
-/* printf("kbd:ack\n");*/
- kbd_ack = 1;
- return(0);
- }
-
-/* Flag the start of an E0 sequence. */
-
- if (code == 0xe0) {
- flags |= FLAG_E0;
- return(0);
- }
-
-/* Flag the start of an E1 sequence. */
-
- if (code == 0xe1) {
- flags |= FLAG_E1;
- return(0);
- }
-
-/* Ignore any other invalid codes */
-
- if (code > 0x8f) {
- flags = 0;
- return(0);
- }
-
-/* printf("%02x:%02x.", code, flags);*/
-
-/* Mark the code appropriately if it is part of an E0 sequence */
-
- if (flags & FLAG_E0) {
- flags &= ~FLAG_E0;
- if (code == 0x12) {
- flags &= ~FLAG_KEYUP;
- return(0);
- }
- code |= 0x200;
- }
-
-/* Mark the key if it is the upcode */
-
- if (flags & FLAG_KEYUP) {
- flags &= ~FLAG_KEYUP;
- code |= 0x100;
- }
-
-/* Mark the code appropriately if it is part of an E1 sequence */
-
- if (flags & FLAG_E1) {
- if ((code & 0xff) == 0x14) {
- return(0);
- }
- flags &= ~FLAG_E1;
- code |= 0x400;
- flags &= ~FLAG_KEYUP;
- }
-
- return(code);
-}
-
-
-/*
- * This routine decodes the unique keycode and generates an ASCII code
- * if necessary.
- */
-
-int
-kbddecodekey(sc, code)
- struct kbd_softc *sc;
- int code;
-{
- key_struct *ks;
- int up;
- int key;
-
- console_unblank();
-
-/* Do we have the raw kbd device open ... */
-
- if (rawkbd_device == 1 && code != 0) {
- struct kbd_data buffer;
- int s;
-
- /* Add this event to the queue. */
-
- buffer.keycode = code;
- microtime(&buffer.event_time);
- s=spltty();
- (void) b_to_q((char *)&buffer, sizeof(buffer), &sc->sc_q);
- splx(s);
- selwakeup(&sc->sc_rsel);
-
- if (sc->sc_state & RAWKBD_ASLEEP) {
- sc->sc_state &= ~RAWKBD_ASLEEP;
- wakeup((caddr_t)sc);
- }
-
- psignal(sc->sc_proc, SIGIO);
- return(1);
- }
-
- up = (code & 0x100);
- key = code & 0xff;
-
-/* By default we use the main keycode lookup table */
-
- ks = keys;
-
-/* If we have an E0 or E1 sqeuence we use the extended table */
-
- if (code > 0x1ff)
- ks = E0keys;
-
-/* Is the key a temporary modifier ? */
-
- if (ks[key].flags & MODIFIER_MASK) {
- if (up)
- modifiers &= ~ks[key].flags;
- else
- modifiers |= ks[key].flags;
- return(0);
- }
-
-/* Is the key a locking modifier ? */
-
- if (ks[key].flags & MODIFIER_LOCK_MASK) {
- if (!up) {
- modifiers ^= ks[key].flags;
- kbdsetleds((modifiers >> 3) & 7);
- }
- return(0);
- }
-
-/* Lookup the correct key code */
-
- if (modifiers & 0x01)
- key = ks[key].ctrl_code;
- else if (modifiers & 0x02)
- key = ks[key].shift_code;
- else if (modifiers & 0x04)
- key = ks[key].alt_code;
- else
- key = ks[key].base_code;
-
- if (modifiers & MODIFIER_CAPS) {
- if ((key >= 'A' && key <= 'Z') || (key >= 'a' && key <= 'z'))
- key ^= 0x20;
- }
-
-/* If no valid code the key is not yet mapped so report error */
-
-#ifdef DEBUG_TERM
-/* if (key == 0) {
- char err[80];
-
- sprintf(err, "\n\rUnknown keycode %04x\n\r", code);
- dprintf(err);
-
- }*/
-#endif
-
-/* If we have an ASCII code insert it into the keyboard buffer */
-
- if (!up && key != 0) {
- if (key >= 0x200) {
-
- untimeout(autorepeatstart, &autorepeatkey);
- untimeout(autorepeat, &autorepeatkey);
- autorepeatkey = -1;
-#if (NVT > 0)
- if ((key & ~0x0f) == 0x480)
- console_switch((key & 0x0f) - 1);
- else
-#endif
- switch (key) {
- case 0x22b:
- pmap_debug(pmap_debug_level + 1);
- break;
- case 0x22d:
- pmap_debug(pmap_debug_level - 1);
- break;
-#if (NVT > 0)
- case 0x201:
- console_scrollforward();
- break;
- case 0x200:
- console_scrollback();
- break;
- case 0x202:
- console_switchdown();
- break;
- case 0x203:
- console_switchup();
- break;
-#endif
- case 0x204:
- --kbdautorepeat.ka_rate;
- if (kbdautorepeat.ka_rate < 1)
- kbdautorepeat.ka_rate = 1;
- break;
- case 0x205:
- ++kbdautorepeat.ka_rate;
- if (kbdautorepeat.ka_rate > 50)
- kbdautorepeat.ka_rate = 50;
- break;
- case 0x20a:
- ++kbdautorepeat.ka_delay;
- if (kbdautorepeat.ka_delay > 50)
- kbdautorepeat.ka_delay = 50;
- break;
- case 0x20b:
- --kbdautorepeat.ka_delay;
- if (kbdautorepeat.ka_delay < 1)
- kbdautorepeat.ka_delay = 1;
- break;
-#ifdef DDB
- case 0x208:
- Debugger();
- break;
-#endif
- case 0x21b:
- printf("Kernel interruption\n");
- boot(RB_HALT);
- break;
- case 0x209:
- printf("Kernel interruption - nosync\n");
- boot(RB_NOSYNC | RB_HALT);
- break;
-
- default:
- printf("Special key %04x\n", key);
- break;
- }
- } else {
- if (physconkbd(key) == 0 && rawkbd_device == 0) {
- if (autorepeatkey != key) {
- untimeout(autorepeatstart, &autorepeatkey);
- untimeout(autorepeat, &autorepeatkey);
- autorepeatkey = key;
- timeout(autorepeatstart, &autorepeatkey, hz/kbdautorepeat.ka_delay);
- }
- }
-
- return(1);
- }
- } else {
- untimeout(autorepeatstart, &autorepeatkey);
- untimeout(autorepeat, &autorepeatkey);
- autorepeatkey = -1;
- }
- return(0);
-}
-
-
-void
-autorepeatstart(key)
- void *key;
-{
- physconkbd(*((int *)key));
- timeout(autorepeat, key, hz/kbdautorepeat.ka_rate);
-}
-
-
-void
-autorepeat(key)
- void *key;
-{
- physconkbd(*((int *)key));
- timeout(autorepeat, key, hz/kbdautorepeat.ka_rate);
-}
-
-/* End of kbd.c */
diff --git a/sys/arch/arm32/mainbus/lpt.c b/sys/arch/arm32/mainbus/lpt.c
deleted file mode 100644
index f379e3a60e3..00000000000
--- a/sys/arch/arm32/mainbus/lpt.c
+++ /dev/null
@@ -1,1314 +0,0 @@
-/* $NetBSD: lpt.c,v 1.6 1996/03/28 21:52:47 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe
- * Copyright (c) 1993, 1994 Charles Hannum.
- * Copyright (c) 1990 William F. Jolitz, TeleMuse
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This software is a component of "386BSD" developed by
- * William F. Jolitz, TeleMuse.
- * 4. Neither the name of the developer nor the name "386BSD"
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS A COMPONENT OF 386BSD DEVELOPED BY WILLIAM F. JOLITZ
- * AND IS INTENDED FOR RESEARCH AND EDUCATIONAL PURPOSES ONLY. THIS
- * SOFTWARE SHOULD NOT BE CONSIDERED TO BE A COMMERCIAL PRODUCT.
- * THE DEVELOPER URGES THAT USERS WHO REQUIRE A COMMERCIAL PRODUCT
- * NOT MAKE USE OF THIS WORK.
- *
- * FOR USERS WHO WISH TO UNDERSTAND THE 386BSD SYSTEM DEVELOPED
- * BY WILLIAM F. JOLITZ, WE RECOMMEND THE USER STUDY WRITTEN
- * REFERENCES SUCH AS THE "PORTING UNIX TO THE 386" SERIES
- * (BEGINNING JANUARY 1991 "DR. DOBBS JOURNAL", USA AND BEGINNING
- * JUNE 1991 "UNIX MAGAZIN", GERMANY) BY WILLIAM F. JOLITZ AND
- * LYNNE GREER JOLITZ, AS WELL AS OTHER BOOKS ON UNIX AND THE
- * ON-LINE 386BSD USER MANUAL BEFORE USE. A BOOK DISCUSSING THE INTERNALS
- * OF 386BSD ENTITLED "386BSD FROM THE INSIDE OUT" WILL BE AVAILABLE LATE 1992.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE DEVELOPER BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from:$NetBSD: lpt.c,v 1.6 1996/03/28 21:52:47 mark Exp $
- */
-
-/*
- * Device Driver for AT parallel printer port
- */
-/*
- * PLIP driver code added by Mark Brinicombe
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/buf.h>
-#include <sys/kernel.h>
-#include <sys/ioctl.h>
-#include <sys/uio.h>
-#include <sys/device.h>
-#include <sys/syslog.h>
-
-#if defined(INET) && defined(PLIP)
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <net/if_types.h>
-#include <net/netisr.h>
-#include <net/route.h>
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/in_var.h>
-#include <netinet/ip.h>
-#include <netinet/if_ether.h>
-#include "bpfilter.h"
-#if NBPFILTER > 0
-#include <sys/time.h>
-#include <net/bpf.h>
-#endif
-#endif
-
-#include <machine/cpu.h>
-#include <machine/katelib.h>
-#include <machine/irqhandler.h>
-#include <machine/io.h>
-#include <arm32/mainbus/lptreg.h>
-#include <arm32/mainbus/mainbus.h>
-
-#define TIMEOUT hz*16 /* wait up to 16 seconds for a ready */
-#define STEP hz/4
-
-#define LPTPRI (PZERO+8)
-#define LPT_BSIZE 1024
-
-#if defined(INET) && defined(PLIP)
-#ifndef PLIPMTU /* MTU for the plip# interfaces */
-#if defined(COMPAT_PLIP10)
-#define PLIPMTU 1600
-#else
-#define PLIPMTU (ETHERMTU - ifp->if_hdrlen)
-#endif
-#endif
-
-#ifndef PLIPMXSPIN1 /* DELAY factor for the plip# interfaces */
-#define PLIPMXSPIN1 2000 /* Spinning for remote intr to happen */
-#endif
-
-#ifndef PLIPMXSPIN2 /* DELAY factor for the plip# interfaces */
-#define PLIPMXSPIN2 6000 /* Spinning for remote handshake to happen */
-#endif
-
-#ifndef PLIPMXERRS /* Max errors before !RUNNING */
-#define PLIPMXERRS 100
-#endif
-#ifndef PLIPMXRETRY
-#define PLIPMXRETRY 10 /* Max number of retransmits */
-#endif
-#ifndef PLIPRETRY
-#define PLIPRETRY hz/10 /* Time between retransmits */
-#endif
-#endif
-
-#if !defined(DEBUG) || !defined(notdef)
-#define lprintf
-#else
-#define lprintf if (lptdebug) printf
-int lptdebug = 1;
-#endif
-
-struct lpt_softc {
- struct device sc_dev;
- irqhandler_t sc_ih;
-
- size_t sc_count;
- struct buf *sc_inbuf;
- u_char *sc_cp;
- int sc_spinmax;
- int sc_iobase;
- int sc_irq;
- u_char sc_state;
-#define LPT_OPEN 0x01 /* device is open */
-#define LPT_OBUSY 0x02 /* printer is busy doing output */
-#define LPT_INIT 0x04 /* waiting to initialize for open */
-#define LPT_PLIP 0x08 /* busy with PLIP */
- u_char sc_flags;
-#define LPT_AUTOLF 0x20 /* automatic LF on CR */
-#define LPT_NOPRIME 0x40 /* don't prime on open */
-#define LPT_NOINTR 0x80 /* do not use interrupt */
- u_char sc_control;
- u_char sc_laststatus;
-#if defined(INET) && defined(PLIP)
- struct arpcom sc_arpcom;
- u_char *sc_ifbuf;
- int sc_iferrs;
- int sc_ifretry;
-#if defined(COMPAT_PLIP10)
- u_char sc_adrcksum;
-#endif
-#endif
-};
-
-int lptprobe __P((struct device *, void *, void *));
-void lptattach __P((struct device *, struct device *, void *));
-int lptintr __P((void *));
-
-#if defined(INET) && defined(PLIP)
-/* Functions for the plip# interface */
-static void plipattach(struct lpt_softc *,int);
-static int plipioctl(struct ifnet *, u_long, caddr_t);
-static void plipstart(struct ifnet *);
-static int plipintr(struct lpt_softc *);
-#endif
-
-struct cfattach lpt_ca = {
- sizeof(struct lpt_softc), lptprobe, lptattach
-};
-
-struct cfdriver lpt_cd = {
- NULL, "lpt", DV_TTY
-};
-
-#define LPTUNIT(s) (minor(s) & 0x1f)
-#define LPTFLAGS(s) (minor(s) & 0xe0)
-
-#define LPS_INVERT (LPS_SELECT|LPS_NERR|LPS_NBSY|LPS_NACK)
-#define LPS_MASK (LPS_SELECT|LPS_NERR|LPS_NBSY|LPS_NACK|LPS_NOPAPER)
-#define NOT_READY() ((inb(iobase + lpt_status) ^ LPS_INVERT) & LPS_MASK)
-#define NOT_READY_ERR() not_ready(inb(iobase + lpt_status), sc)
-static int not_ready __P((u_char, struct lpt_softc *));
-
-static void lptwakeup __P((void *arg));
-static int pushbytes __P((struct lpt_softc *));
-
-/*
- * Internal routine to lptprobe to do port tests of one byte value.
- */
-int
-lpt_port_test(port, data, mask)
- int port;
- u_char data, mask;
-{
- int timeout;
- u_char temp;
-
- data &= mask;
- outb(port, data);
- timeout = 1000;
- do {
- delay(10);
- temp = inb(port) & mask;
- } while (temp != data && --timeout);
- lprintf("lpt: port=0x%x out=0x%x in=0x%x timeout=%d\n", port, data,
- temp, timeout);
- return (temp == data);
-}
-
-/*
- * Logic:
- * 1) You should be able to write to and read back the same value
- * to the data port. Do an alternating zeros, alternating ones,
- * walking zero, and walking one test to check for stuck bits.
- *
- * 2) You should be able to write to and read back the same value
- * to the control port lower 5 bits, the upper 3 bits are reserved
- * per the IBM PC technical reference manauls and different boards
- * do different things with them. Do an alternating zeros, alternating
- * ones, walking zero, and walking one test to check for stuck bits.
- *
- * Some printers drag the strobe line down when the are powered off
- * so this bit has been masked out of the control port test.
- *
- * XXX Some printers may not like a fast pulse on init or strobe, I
- * don't know at this point, if that becomes a problem these bits
- * should be turned off in the mask byte for the control port test.
- *
- * 3) Set the data and control ports to a value of 0
- */
-int
-lptprobe(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct mainbus_attach_args *mb = aux;
- int iobase = mb->mb_iobase;
- int port;
- u_char mask, data;
- int i;
-
-#ifdef DEBUG
-#define ABORT do {printf("lptprobe: mask %x data %x failed\n", mask, data); \
- return 0;} while (0)
-#else
-#define ABORT return 0
-#endif
-
- port = iobase + lpt_data;
- mask = 0xff;
-
- data = 0x55; /* Alternating zeros */
- if (!lpt_port_test(port, data, mask))
- ABORT;
-
- data = 0xaa; /* Alternating ones */
- if (!lpt_port_test(port, data, mask))
- ABORT;
-
- for (i = 0; i < CHAR_BIT; i++) { /* Walking zero */
- data = ~(1 << i);
- if (!lpt_port_test(port, data, mask))
- ABORT;
- }
-
- for (i = 0; i < CHAR_BIT; i++) { /* Walking one */
- data = (1 << i);
- if (!lpt_port_test(port, data, mask))
- ABORT;
- }
-
- outb(iobase + lpt_data, 0);
- outb(iobase + lpt_control, 0);
-
- mb->mb_iosize = LPT_NPORTS;
- return 1;
-}
-
-void
-lptattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct lpt_softc *sc = (void *)self;
- struct mainbus_attach_args *mb = aux;
- int iobase = mb->mb_iobase;
-
- if (mb->mb_irq != IRQUNK)
- printf("\n");
- else
- printf(": polled\n");
-
- sc->sc_iobase = iobase;
- sc->sc_irq = mb->mb_irq;
- sc->sc_state = 0;
- outb(iobase + lpt_control, LPC_NINIT);
-
- if (mb->mb_irq != IRQUNK) {
- sc->sc_ih.ih_func = lptintr;
- sc->sc_ih.ih_arg = sc;
-#if defined(INET) && defined(PLIP)
- sc->sc_ih.ih_level = IPL_NET;
- sc->sc_ih.ih_name = "lpt/plip";
- plipattach(sc, self->dv_unit);
-#else
- sc->sc_ih.ih_level = IPL_NONE;
- sc->sc_ih.ih_name = "lpt";
-#endif
- if (irq_claim(mb->mb_irq, &sc->sc_ih))
- panic("Cannot claim IRQ %d for lpt%d", mb->mb_irq, sc->sc_dev.dv_unit);
-
- }
-#if defined(INET) && defined(PLIP)
- else {
- printf("Warning PLIP device needs IRQ driven lpt driver\n");
- }
-#endif
-}
-
-/*
- * Reset the printer, then wait until it's selected and not busy.
- */
-int
-lptopen(dev, flag)
- dev_t dev;
- int flag;
-{
- int unit = LPTUNIT(dev);
- u_char flags = LPTFLAGS(dev);
- struct lpt_softc *sc;
- int iobase;
- u_char control;
- int error;
- int spin;
-
- if (unit >= lpt_cd.cd_ndevs)
- return ENXIO;
- sc = lpt_cd.cd_devs[unit];
- if (!sc)
- return ENXIO;
-
- if (sc->sc_irq == IRQUNK && (flags & LPT_NOINTR) == 0)
- return ENXIO;
-
-#ifdef DIAGNOSTIC
- if (sc->sc_state)
- printf("%s: stat=0x%x not zero\n", sc->sc_dev.dv_xname,
- sc->sc_state);
-#endif
-
- if (sc->sc_state)
- return EBUSY;
-
- sc->sc_state = LPT_INIT;
- sc->sc_flags = flags;
- lprintf("%s: open: flags=0x%x\n", sc->sc_dev.dv_xname, flags);
- iobase = sc->sc_iobase;
-
- if ((flags & LPT_NOPRIME) == 0) {
- /* assert INIT for 100 usec to start up printer */
- outb(iobase + lpt_control, LPC_SELECT);
- delay(100);
- }
-
- control = LPC_SELECT | LPC_NINIT;
- outb(iobase + lpt_control, control);
-
- /* wait till ready (printer running diagnostics) */
- for (spin = 0; NOT_READY_ERR(); spin += STEP) {
- if (spin >= TIMEOUT) {
- sc->sc_state = 0;
- return EBUSY;
- }
-
- /* wait 1/4 second, give up if we get a signal */
- if (error = tsleep((caddr_t)sc, LPTPRI | PCATCH, "lptopen",
- STEP) != EWOULDBLOCK) {
- sc->sc_state = 0;
- return error;
- }
- }
-
- if ((flags & LPT_NOINTR) == 0)
- control |= LPC_IENABLE;
- if (flags & LPT_AUTOLF)
- control |= LPC_AUTOLF;
- sc->sc_control = control;
- outb(iobase + lpt_control, control);
-
- sc->sc_inbuf = geteblk(LPT_BSIZE);
- sc->sc_count = 0;
- sc->sc_state = LPT_OPEN;
-
- if ((sc->sc_flags & LPT_NOINTR) == 0)
- lptwakeup(sc);
-
- lprintf("%s: opened\n", sc->sc_dev.dv_xname);
- return 0;
-}
-
-int
-not_ready(status, sc)
- u_char status;
- struct lpt_softc *sc;
-{
- u_char new;
-
- status = (status ^ LPS_INVERT) & LPS_MASK;
- new = status & ~sc->sc_laststatus;
- sc->sc_laststatus = status;
-
- if (new & LPS_SELECT)
- log(LOG_NOTICE, "%s: offline\n", sc->sc_dev.dv_xname);
- else if (new & LPS_NOPAPER)
- log(LOG_NOTICE, "%s: out of paper\n", sc->sc_dev.dv_xname);
- else if (new & LPS_NERR)
- log(LOG_NOTICE, "%s: output error\n", sc->sc_dev.dv_xname);
-
- return status;
-}
-
-
-void
-lptwakeup(arg)
- void *arg;
-{
- struct lpt_softc *sc = arg;
- int s;
-
- s = spltty();
- lptintr(sc);
- splx(s);
-
- timeout(lptwakeup, sc, STEP);
-}
-
-/*
- * Close the device, and free the local line buffer.
- */
-lptclose(dev, flag)
- dev_t dev;
- int flag;
-{
- int unit = LPTUNIT(dev);
- struct lpt_softc *sc = lpt_cd.cd_devs[unit];
- int iobase = sc->sc_iobase;
-
- if (sc->sc_count)
- (void) pushbytes(sc);
-
- if ((sc->sc_flags & LPT_NOINTR) == 0)
- untimeout(lptwakeup, sc);
-
- outb(iobase + lpt_control, LPC_NINIT);
- sc->sc_state = 0;
- outb(iobase + lpt_control, LPC_NINIT);
- brelse(sc->sc_inbuf);
-
- lprintf("%s: closed\n", sc->sc_dev.dv_xname);
- return 0;
-}
-
-int
-pushbytes(sc)
- struct lpt_softc *sc;
-{
- int iobase = sc->sc_iobase;
- int error;
-
- if (sc->sc_flags & LPT_NOINTR) {
- int spin, tic;
- u_char control = sc->sc_control;
-
- while (sc->sc_count > 0) {
- spin = 0;
- while (NOT_READY()) {
- if (++spin < sc->sc_spinmax)
- continue;
- tic = 0;
- /* adapt busy-wait algorithm */
- sc->sc_spinmax++;
- while (NOT_READY_ERR()) {
- /* exponential backoff */
- tic = tic + tic + 1;
- if (tic > TIMEOUT)
- tic = TIMEOUT;
- error = tsleep((caddr_t)sc,
- LPTPRI | PCATCH, "lptpsh", tic);
- if (error != EWOULDBLOCK)
- return error;
- }
- break;
- }
-
- outb(iobase + lpt_data, *sc->sc_cp++);
- outb(iobase + lpt_control, control | LPC_STROBE);
- sc->sc_count--;
- outb(iobase + lpt_control, control);
-
- /* adapt busy-wait algorithm */
- if (spin*2 + 16 < sc->sc_spinmax)
- sc->sc_spinmax--;
- }
- } else {
- int s;
-
- while (sc->sc_count > 0) {
- /* if the printer is ready for a char, give it one */
- if ((sc->sc_state & LPT_OBUSY) == 0) {
- lprintf("%s: write %d\n", sc->sc_dev.dv_xname,
- sc->sc_count);
- s = spltty();
- (void) lptintr(sc);
- splx(s);
- }
- if (error = tsleep((caddr_t)sc, LPTPRI | PCATCH,
- "lptwrite2", 0))
- return error;
- }
- }
- return 0;
-}
-
-/*
- * Copy a line from user space to a local buffer, then call putc to get the
- * chars moved to the output queue.
- */
-lptwrite(dev, uio)
- dev_t dev;
- struct uio *uio;
-{
- struct lpt_softc *sc = lpt_cd.cd_devs[LPTUNIT(dev)];
- size_t n;
- int error = 0;
-
- while (n = min(LPT_BSIZE, uio->uio_resid)) {
- uiomove(sc->sc_cp = sc->sc_inbuf->b_data, n, uio);
- sc->sc_count = n;
- error = pushbytes(sc);
- if (error) {
- /*
- * Return accurate residual if interrupted or timed
- * out.
- */
- uio->uio_resid += sc->sc_count;
- sc->sc_count = 0;
- return error;
- }
- }
- return 0;
-}
-
-/*
- * Handle printer interrupts which occur when the printer is ready to accept
- * another char.
- */
-int
-lptintr(arg)
- void *arg;
-{
- struct lpt_softc *sc = arg;
- int iobase = sc->sc_iobase;
-
-/*printf("lptintr:\n");*/
-
-#if defined(INET) && defined(PLIP)
- if (sc->sc_arpcom.ac_if.if_flags & IFF_UP) {
- return(plipintr(sc));
- }
-#endif
-
-#if 0
- if ((sc->sc_state & LPT_OPEN) == 0)
- return 0;
-#endif
-
- /* is printer online and ready for output */
- if (NOT_READY() && NOT_READY_ERR())
- return 0;
-
- if (sc->sc_count) {
- u_char control = sc->sc_control;
- /* send char */
- outb(iobase + lpt_data, *sc->sc_cp++);
- outb(iobase + lpt_control, control | LPC_STROBE);
- sc->sc_count--;
- outb(iobase + lpt_control, control);
- sc->sc_state |= LPT_OBUSY;
- } else
- sc->sc_state &= ~LPT_OBUSY;
-
- if (sc->sc_count == 0) {
- /* none, wake up the top half to get more */
- wakeup((caddr_t)sc);
- }
-
- return(1);
-}
-
-int
-lptioctl(dev, cmd, data, flag)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
-{
- int error = 0;
-
- switch (cmd) {
- default:
- error = ENODEV;
- }
-
- return error;
-}
-
-
-#if defined(INET) && defined(PLIP)
-
-#define PLIP_INTR_ENABLE (LPC_NINIT | LPC_SELECT | LPC_IENABLE)
-#define PLIP_INTR_DISABLE (LPC_NINIT | LPC_SELECT)
-#define PLIP_DATA (iobase + lpt_data)
-#define PLIP_STATUS (iobase + lpt_status)
-#define PLIP_CONTROL (iobase + lpt_control)
-#define PLIP_REMOTE_TRIGGER 0x08
-#define PLIP_DELAY_UNIT 50
-#if PLIP_DELAY_UNIT > 0
-#define PLIP_DELAY DELAY(PLIP_DELAY_UNIT)
-#else
-#define PLIP_DELAY
-#endif
-#define PLIP_DEBUG_RX 0x01
-#define PLIP_DEBUG_TX 0x02
-#define PLIP_DEBUG_IF 0x04
-#define PLIP_DEBUG 0x07
-#if PLIP_DEBUG != 0
-static int plip_debug = PLIP_DEBUG;
-#endif
-
-static void
-plipattach(struct lpt_softc *sc, int unit)
-{
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
-
- sc->sc_ifbuf = NULL;
- ifp->if_unit = unit;
- ifp->if_name = "plip";
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS;
- ifp->if_output = ether_output;
- ifp->if_start = plipstart;
- ifp->if_ioctl = plipioctl;
- ifp->if_watchdog = 0;
-
- ifp->if_type = IFT_ETHER;
- ifp->if_addrlen = 6;
- ifp->if_hdrlen = 14;
- ifp->if_mtu = PLIPMTU;
-
- if_attach(ifp);
- ether_ifattach(ifp);
-
- printf("plip%d at lpt%d: mtu=%d,%d,%d", unit, unit, (int) ifp->if_mtu,
- ifp->if_hdrlen, ifp->if_addrlen);
- if (sizeof(struct ether_header) != 14)
- printf(" ethhdr super kludge mode enabled\n");
- else
- printf("\n");
-
-#if NBPFILTER > 0
- bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
-#endif
-}
-
-/*
- * Process an ioctl request.
- */
-static int
-plipioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
-{
- struct proc *p = curproc;
- struct lpt_softc *sc = (struct lpt_softc *) lpt_cd.cd_devs[ifp->if_unit];
- unsigned int iobase = sc->sc_iobase;
- struct ifaddr *ifa = (struct ifaddr *)data;
- struct ifreq *ifr = (struct ifreq *)data;
- int s;
- int error = 0;
-
-#if PLIP_DEBUG > 0
- printf("plipioctl: cmd=%08x ifp=%08x data=%08x\n", cmd, ifp, data);
- printf("plipioctl: ifp->flags=%08x\n", ifp->if_flags);
-#endif
-
- switch (cmd) {
-
- case SIOCSIFFLAGS:
- if (((ifp->if_flags & IFF_UP) == 0) &&
- (ifp->if_flags & IFF_RUNNING)) {
- ifp->if_flags &= ~IFF_RUNNING;
-/* Deactive the parallel port */
-#if PLIP_DEBUG != 0
- if (plip_debug & PLIP_DEBUG_IF)
- printf("plip: Disabling lpt irqs\n");
-#endif
- outb(PLIP_DATA, 0x00);
- outb(PLIP_CONTROL, PLIP_INTR_DISABLE);
- sc->sc_state = 0;
-
- if (sc->sc_ifbuf)
- free(sc->sc_ifbuf, M_DEVBUF);
-
- sc->sc_ifbuf = NULL;
- }
- if (((ifp->if_flags & IFF_UP)) &&
- ((ifp->if_flags & IFF_RUNNING) == 0)) {
- if (sc->sc_state) {
- error = EBUSY;
- break;
- }
-/* if (!(ifp->if_flags & IFF_DEBUG))
- plip_debug = PLIP_DEBUG;
- else
- plip_debug = 0;*/
- sc->sc_state = LPT_OPEN | LPT_PLIP;
- if (!sc->sc_ifbuf)
- sc->sc_ifbuf =
- malloc(ifp->if_mtu + ifp->if_hdrlen,
- M_DEVBUF, M_WAITOK);
- ifp->if_flags |= IFF_RUNNING;
-/* This starts it running */
-/* Enable lpt interrupts */
-
-#if PLIP_DEBUG != 0
- if (plip_debug & PLIP_DEBUG_IF)
- printf("plip: Enabling lpt irqs\n");
-#endif
- outb(PLIP_CONTROL, PLIP_INTR_ENABLE);
- outb(PLIP_DATA, 0x00);
- }
- break;
-
- case SIOCSIFADDR:
- if (ifa->ifa_addr->sa_family == AF_INET) {
- if (!sc->sc_ifbuf)
- sc->sc_ifbuf =
- malloc(PLIPMTU + ifp->if_hdrlen,
- M_DEVBUF, M_WAITOK);
-
- sc->sc_arpcom.ac_enaddr[0] = 0xfc;
- sc->sc_arpcom.ac_enaddr[1] = 0xfc;
- bcopy((caddr_t)&IA_SIN(ifa)->sin_addr,
- (caddr_t)&sc->sc_arpcom.ac_enaddr[2], 4);
- sc->sc_arpcom.ac_ipaddr = IA_SIN(ifa)->sin_addr;
-#if defined(COMPAT_PLIP10)
- if (ifp->if_flags & IFF_LINK0) {
- int i;
- sc->sc_arpcom.ac_enaddr[0] = 0xfd;
- sc->sc_arpcom.ac_enaddr[1] = 0xfd;
- for (i = sc->sc_adrcksum = 0; i < 5; i++)
- sc->sc_adrcksum += sc->sc_arpcom.ac_enaddr[i];
- sc->sc_adrcksum *= 2;
- }
-#endif
- ifp->if_flags |= IFF_RUNNING | IFF_UP;
-#if 0
- for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) {
- struct sockaddr_dl *sdl;
- if ((sdl = (struct sockaddr_dl *)ifa->ifa_addr) &&
- sdl->sdl_family == AF_LINK) {
- sdl->sdl_type = IFT_ETHER;
- sdl->sdl_alen = ifp->if_addrlen;
- bcopy((caddr_t)((struct arpcom *)ifp)->ac_enaddr,
- LLADDR(sdl), ifp->if_addrlen);
- break;
- }
- }
-#endif
-/* Looks the same as the start condition above */
-/* Enable lpt interrupts */
-
-#if PLIP_DEBUG != 0
- if (plip_debug & PLIP_DEBUG_IF)
- printf("plip: Enabling lpt irqs\n");
-#endif
- outb(PLIP_CONTROL, PLIP_INTR_ENABLE);
- outb(PLIP_DATA, 0x00);
-
- arp_ifinit(&sc->sc_arpcom, ifa);
- } else
- error = EAFNOSUPPORT;
- break;
-
- case SIOCAIFADDR:
- case SIOCDIFADDR:
- case SIOCSIFDSTADDR:
- if (ifa->ifa_addr->sa_family != AF_INET)
- error = EAFNOSUPPORT;
- break;
-
- case SIOCSIFMTU:
- if ((error = suser(p->p_ucred, &p->p_acflag)))
- return(error);
- if (ifp->if_mtu != ifr->ifr_metric) {
- ifp->if_mtu = ifr->ifr_metric;
- if (sc->sc_ifbuf) {
- s = splimp();
-
- free(sc->sc_ifbuf, M_DEVBUF);
- sc->sc_ifbuf =
- malloc(ifp->if_mtu + ifp->if_hdrlen,
- M_DEVBUF, M_WAITOK);
- splx(s);
- }
- }
- break;
-
- case SIOCGIFMTU:
- ifr->ifr_metric = ifp->if_mtu;
- break;
-
- default:
- error = EINVAL;
- }
- return (error);
-}
-
-static int
-plipreceive(unsigned int iobase, u_char *buf, int len)
-{
- int i;
- u_char cksum = 0, c;
- u_char c0, c1;
-
-#if PLIP_DEBUG != 0
- if (plip_debug & PLIP_DEBUG_RX)
- printf("Rx: ");
-#endif
-
- while (len--) {
- i = PLIPMXSPIN2;
-/* Receive a byte */
-
-/* Wait for a steady handshake */
- while (1) {
- c0 = inb(PLIP_STATUS);
- if ((c0 & LPS_NBSY) == 0) {
- c1 = inb(PLIP_STATUS);
- if (c0 == c1) break;
-#if PLIP_DEBUG != 0
- if (plip_debug & PLIP_DEBUG_RX)
- printf("rx: %02x-%02x ", c0, c1);
-#endif
- }
- --i;
- if (i < 0) {
-#if PLIP_DEBUG > 0
- printf("timeout rx lsn %02x\n", c0);
-#endif
- return(-1);
- }
- PLIP_DELAY;
- }
- c = (c0 >> 3) & 0x0f;
-
-/* Acknowledge */
- outb(PLIP_DATA, 0x10);
-
-/* Another handshake */
- i = PLIPMXSPIN2;
- while (1) {
- c0 = inb(PLIP_STATUS);
- if (c0 & LPS_NBSY) {
- c1 = inb(PLIP_STATUS);
- if (c0 == c1) break;
-#if PLIP_DEBUG != 0
- if (plip_debug & PLIP_DEBUG_RX)
- printf("rx: %02x-%02x ", c0, c1);
-#endif
- }
- --i;
- if (i < 0) {
-#if PLIP_DEBUG > 0
- printf("timeout rx msn %02x\n", c0);
-#endif
- return(-1);
- }
- PLIP_DELAY;
- }
- c = c | ((c0 << 1) & 0xf0);
-/* Acknowledge */
- outb(PLIP_DATA, 0x00);
-#if PLIP_DEBUG != 0
- if (plip_debug & PLIP_DEBUG_RX)
- printf("%02x ", c);
-#endif
-
- cksum += (*buf++ = c);
- }
-#if PLIP_DEBUG != 0
- if (plip_debug & PLIP_DEBUG_RX)
- printf("\n");
-#endif
- return(cksum);
-}
-
-static int
-plipintr(struct lpt_softc *sc)
-{
- extern struct mbuf *m_devget(char *, int, int, struct ifnet *, void (*)());
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
- unsigned int iobase = sc->sc_iobase;
- struct mbuf *m;
- struct ether_header *eh;
- u_char *p = sc->sc_ifbuf, minibuf[4];
- int c, s, len, cksum;
- u_char c0;
-
-printf("plipintr:\n");
-
-/* Get the status */
-
- c0 = inb(PLIP_STATUS);
-#if PLIP_DEBUG > 0
- if ((c0 & 0xf8) != 0xc0) {
- printf("st5=%02x ", c0);
- }
-#endif
-
-/* Don't want ints while receiving */
-
- outb(PLIP_CONTROL, PLIP_INTR_DISABLE);
-
- outb(PLIP_DATA, 0x01); /* send ACK */ /* via NERR */
-
-#if defined(COMPAT_PLIP10)
- if (ifp->if_flags & IFF_LINK0) {
- if (plipreceive(iobase, minibuf, 3) < 0) goto err;
- len = (minibuf[1] << 8) | minibuf[2];
- if (len > (ifp->if_mtu + ifp->if_hdrlen)) goto err;
-
- switch (minibuf[0]) {
- case 0xfc:
- p[0] = p[ 6] = ifp->ac_enaddr[0];
- p[1] = p[ 7] = ifp->ac_enaddr[1];
- p[2] = p[ 8] = ifp->ac_enaddr[2];
- p[3] = p[ 9] = ifp->ac_enaddr[3];
- p[4] = p[10] = ifp->ac_enaddr[4];
- p += 5;
- if ((cksum = plipreceive(iobase, p, 1)) < 0) goto err;
- p += 6;
- if ((c = plipreceive(iobase, p, len - 11)) < 0) goto err;
- cksum += c + sc->sc_adrcksum;
- c = p[1]; p[1] = p[2]; p[2] = c;
- cksum &= 0xff;
- break;
- case 0xfd:
- if ((cksum = plipreceive(iobase, p, len)) < 0) goto err;
- break;
- default:
- goto err;
- }
- } else
-#endif
- {
- if (plipreceive(iobase, minibuf, 2) < 0) goto err;
- len = (minibuf[1] << 8) | minibuf[0];
- if (len > (ifp->if_mtu + ifp->if_hdrlen)) {
- log(LOG_NOTICE, "plip%d: packet > MTU\n", ifp->if_unit);
- goto err;
- }
-#if PLIP_DEBUG != 0
- if (plip_debug & PLIP_DEBUG_RX)
- printf("len=%d ", len);
-#endif
- if (sizeof(struct ether_header) != 14) {
- if ((cksum = plipreceive(iobase, p, 14)) < 0) goto err;
- if ((c = plipreceive(iobase, p+16, len-14)) < 0) goto err;
- cksum += c;
- len += 2;
- }
- else
- if ((cksum = plipreceive(iobase, p, len)) < 0) goto err;
- }
-
- if (plipreceive(iobase, minibuf, 1) < 0) goto err;
- if ((cksum & 0xff) != minibuf[0]) {
- printf("cksum=%d, %d, %d\n", cksum, c, minibuf[0]);
- log(LOG_NOTICE, "plip%d: checksum error\n", ifp->if_unit);
- goto err;
- }
-
- outb(PLIP_DATA, 0x00); /* clear ACK */ /* via NERR */
-#if PLIP_DEBUG != 0
- if (plip_debug & PLIP_DEBUG_RX)
- printf("done\n");
-#endif
- s = splimp();
-
- eh = (struct ether_header *)sc->sc_ifbuf;
-
- if ((m = m_devget(sc->sc_ifbuf + sizeof(struct ether_header), len - sizeof(struct ether_header), 0, ifp, NULL))) {
- /* We assume that the header fit entirely in one mbuf. */
-/* eh = mtod(m, struct ether_header *);*/
-/* m->m_pkthdr.len -= sizeof(*eh);*/
-/* m->m_len -= sizeof(*eh);*/
-/* m->m_data += sizeof(*eh);*/
-/* printf("m->m_data=%08x ifbuf=%08x eh=%08x\n", m->m_data, sc->sc_ifbuf, eh);*/
-
-#if NBPFILTER > 0
-/*
- * Check if there's a BPF listener on this interface.
- * If so, hand off the raw packet to bpf.
- */
- if (sc->sc_arpcom.ac_if.if_bpf) {
- bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m);
- }
-#endif
- ether_input(ifp, eh, m);
- }
- splx(s);
- sc->sc_iferrs = 0;
- ifp->if_ipackets++;
-
-/* Allow ints again */
-
- outb(PLIP_CONTROL, PLIP_INTR_ENABLE);
- return(1);
-
-err:
- outb(PLIP_DATA, 0x00); /* clear ACK */ /* via NERR */
-
- ifp->if_ierrors++;
- sc->sc_iferrs++;
- if (sc->sc_iferrs > PLIPMXERRS
- || (sc->sc_iferrs > 5 && (inb(iobase + lpt_status) & LPS_NBSY))) {
- /* We are not able to send receive anything for now,
- * so stop wasting our time and leave the interrupt
- * disabled.
- */
- if (sc->sc_iferrs == PLIPMXERRS + 1)
- log(LOG_NOTICE, "plip%d: rx hard error\n", ifp->if_unit);
-/* xxx i8255->port_a |= LPA_ACTIVE;*/
- } else
-;
-/* xxx i8255->port_a |= LPA_ACKENABLE | LPA_ACTIVE;*/
-
-/* Allow ints again */
-
- outb(PLIP_CONTROL, PLIP_INTR_ENABLE);
- return(1);
-}
-
-static int
-pliptransmit(unsigned int iobase, u_char *buf, int len)
-{
- int i;
- u_char cksum = 0, c;
- u_char c0;
-#if PLIP_DEBUG != 0
- if (plip_debug & PLIP_DEBUG_TX)
- printf("tx: len=%d ", len);
-#endif
-
- while (len--) {
- i = PLIPMXSPIN2;
- cksum += (c = *buf++);
-#if PLIP_DEBUG != 0
- if (plip_debug & PLIP_DEBUG_TX)
- printf("%02x ", c);
-#endif
-/* xxx while ((i8255->port_c & LPC_NBUSY) == 0)
- if (i-- < 0) return -1;
- i8255->port_b = c & 0x0f;
- i8255->port_b = c & 0x0f | 0x10;
- c >>= 4;
- while ((i8255->port_c & LPC_NBUSY) != 0)
- if (i-- < 0) return -1;
- i8255->port_b = c | 0x10;
- i8255->port_b = c;
-*/
-
-/* Send the nibble + handshake */
-
- outb(PLIP_DATA, 0x00 | (c & 0x0f));
- outb(PLIP_DATA, 0x10 | (c & 0x0f));
-
- while (1) {
- c0 = inb(PLIP_STATUS);
- if ((c0 & LPS_NBSY) == 0)
- break;
- if (--i == 0) { /* time out */
-#if PLIP_DEBUG > 0
- printf("timeout tx lsn %02x ", c0);
-#endif
- return(-1);
- }
- PLIP_DELAY;
- }
-
- outb(PLIP_DATA, 0x10 | (c >> 4));
- outb(PLIP_DATA, 0x00 | (c >> 4));
- i = PLIPMXSPIN2;
- while (1) {
- c0 = inb(PLIP_STATUS);
- if ((c0 & LPS_NBSY) != 0)
- break;
- if (--i == 0) { /* time out */
-#if PLIP_DEBUG > 0
- printf("timeout tx msn %02x ", c0);
-#endif
- return(-1);
- }
- PLIP_DELAY;
- }
- }
-#if PLIP_DEBUG != 0
- if (plip_debug & PLIP_DEBUG_TX)
- printf("done\n");
-#endif
- return(cksum);
-}
-
-/*
- * Setup output on interface.
- */
-static void
-plipstart(struct ifnet *ifp)
-{
- struct lpt_softc *sc = (struct lpt_softc *) lpt_cd.cd_devs[ifp->if_unit];
- unsigned int iobase = sc->sc_iobase;
- struct mbuf *m0, *m;
- u_char minibuf[4], cksum;
- int len, i, s;
- u_char *p;
-
-#if PLIP_DEBUG != 0
- if (plip_debug & PLIP_DEBUG_TX)
- printf("plipstart: ");
-#endif
- if (ifp->if_flags & IFF_OACTIVE)
- return;
- ifp->if_flags |= IFF_OACTIVE;
-
- if (sc->sc_ifretry)
- untimeout((void (*)(void *))plipstart, ifp);
-
- for (;;) {
- s = splimp();
- IF_DEQUEUE(&ifp->if_snd, m0);
- splx(s);
- if (!m0)
- break;
-
- for (len = 0, m = m0; m; m = m->m_next) {
-#if PLIP_DEBUG > 0
- if (plip_debug & PLIP_DEBUG_TX)
- printf("len=%d %d\n", m->m_len, len);
-#endif
- len += m->m_len;
- }
-#if NBPFILTER > 0
- p = sc->sc_ifbuf;
- for (m = m0; m; m = m->m_next) {
- if (m->m_len == 0)
- continue;
- bcopy(mtod(m, u_char *), p, m->m_len);
- p += m->m_len;
- }
- if (sc->sc_arpcom.ac_if.if_bpf)
- bpf_tap(sc->sc_arpcom.ac_if.if_bpf, sc->sc_ifbuf, len);
-#endif
- if (sizeof(struct ether_header) != 14)
- len -= 2;
-#if defined(COMPAT_PLIP10)
- if (ifp->if_flags & IFF_LINK0) {
- minibuf[0] = 3;
- minibuf[1] = 0xfd;
- minibuf[2] = len >> 8;
- minibuf[3] = len;
- } else
-#endif
- {
- minibuf[0] = 2;
- minibuf[1] = len;
- minibuf[2] = len >> 8;
- }
-
-/*yyy for (i = PLIPMXSPIN1; (inb(PLIP_STATUS) & LPS_NERR) != 0; i--)
- if (i < 0) goto retry;*/
-
- /* Trigger remote interrupt */
-
-#if PLIP_DEBUG > 0
- if (plip_debug & PLIP_DEBUG_TX)
- printf("st=%02x ", inb(PLIP_STATUS));
-#endif
- if (inb(PLIP_STATUS) & LPS_NERR) {
- for (i = PLIPMXSPIN1; (inb(PLIP_STATUS) & LPS_NERR) != 0; i--)
- PLIP_DELAY;
-#if PLIP_DEBUG > 0
- if (plip_debug & PLIP_DEBUG_TX)
- printf("st1=%02x ", inb(PLIP_STATUS));
-#endif
- }
-
- outb(PLIP_DATA, PLIP_REMOTE_TRIGGER);
- for (i = PLIPMXSPIN1; (inb(PLIP_STATUS) & LPS_NERR) == 0; i--) {
- if (i < 0 || (i > PLIPMXSPIN1/3
- && inb(PLIP_STATUS) & LPS_NACK)) {
-#if PLIP_DEBUG > 0
- printf("trigger ack timeout\n");
-#endif
- goto retry;
- }
- PLIP_DELAY;
- }
-#if PLIP_DEBUG > 0
- if (plip_debug & PLIP_DEBUG_TX)
- printf("st3=%02x ", inb(PLIP_STATUS));
-#endif
-
-/* Don't want ints while transmitting */
-
- outb(PLIP_CONTROL, PLIP_INTR_DISABLE);
-
- if (pliptransmit(iobase, minibuf + 1, minibuf[0]) < 0) goto retry;
- for (cksum = 0, m = m0; m; m = m->m_next) {
- if (sizeof(struct ether_header) != 14 && m == m0) {
- i = pliptransmit(iobase, mtod(m, u_char *), 14);
- if (i < 0) goto retry;
- cksum += i;
- i = pliptransmit(iobase, mtod(m, u_char *)+16, m->m_len-16);
- if (i < 0) goto retry;
- }
- else
- i = pliptransmit(iobase, mtod(m, u_char *), m->m_len);
- if (i < 0) goto retry;
- cksum += i;
- }
- if (pliptransmit(iobase, &cksum, 1) < 0) goto retry;
- i = PLIPMXSPIN2;
- while ((inb(PLIP_STATUS) & LPS_NBSY) == 0)
- if (i-- < 0) goto retry;
-
- outb(iobase + lpt_data, 0x00);
-/* Re-enable ints */
-
- outb(PLIP_CONTROL, PLIP_INTR_ENABLE);
-
- ifp->if_opackets++;
- ifp->if_obytes += len + 4;
- sc->sc_ifretry = 0;
- s = splimp();
- m_freem(m0);
- splx(s);
- }
- ifp->if_flags &= ~IFF_OACTIVE;
- return;
-
-retry:
-#if PLIP_DEBUG > 0
- if (plip_debug & PLIP_DEBUG_TX)
- printf("retry: %02x", inb(iobase + lpt_status));
-#endif
- if (inb(PLIP_STATUS & LPS_NACK))
- ifp->if_collisions++;
- else
- ifp->if_oerrors++;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_UP)) == (IFF_RUNNING | IFF_UP)
- && sc->sc_ifretry < PLIPMXRETRY) {
- sc->sc_ifretry++;
- s = splimp();
- IF_PREPEND(&ifp->if_snd, m0);
- splx(s);
- timeout((void (*)(void *))plipstart, ifp, PLIPRETRY);
- } else {
- if (sc->sc_ifretry == PLIPMXRETRY) {
- sc->sc_ifretry++;
- log(LOG_NOTICE, "plip%d: tx hard error\n", ifp->if_unit);
- }
- s = splimp();
- m_freem(m0);
- splx(s);
- }
- ifp->if_flags &= ~IFF_OACTIVE;
- outb(PLIP_DATA, 0x00);
-
-/* Re-enable ints */
-
- outb(PLIP_CONTROL, PLIP_INTR_ENABLE);
-/*xxx if (sc->sc_iferrs > PLIPMXERRS)
- i8255->port_a |= LPA_ACTIVE;
- else
- i8255->port_a |= LPA_ACKENABLE | LPA_ACTIVE;*/
- return;
-}
-
-#endif
diff --git a/sys/arch/arm32/mainbus/lptreg.h b/sys/arch/arm32/mainbus/lptreg.h
deleted file mode 100644
index f909794337d..00000000000
--- a/sys/arch/arm32/mainbus/lptreg.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $NetBSD: lptreg.h,v 1.2 1996/03/18 20:50:03 mark Exp $ */
-
-/*
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)lptreg.h 1.1 (Berkeley) 12/19/90
- */
-
-/*
- * AT Parallel Port (for lineprinter)
- * Interface port and bit definitions
- * Written by William Jolitz 12/18/90
- * Copyright (C) William Jolitz 1990
- */
-
-#define lpt_data 0 /* Data to/from printer (R/W) */
-
-#define lpt_status 4 /* Status of printer (R) */
-#define LPS_NERR 0x08 /* printer no error */
-#define LPS_SELECT 0x10 /* printer selected */
-#define LPS_NOPAPER 0x20 /* printer out of paper */
-#define LPS_NACK 0x40 /* printer no ack of data */
-#define LPS_NBSY 0x80 /* printer no ack of data */
-
-#define lpt_control 8 /* Control printer (R/W) */
-#define LPC_STROBE 0x01 /* strobe data to printer */
-#define LPC_AUTOLF 0x02 /* automatic linefeed */
-#define LPC_NINIT 0x04 /* initialize printer */
-#define LPC_SELECT 0x08 /* printer selected */
-#define LPC_IENABLE 0x10 /* printer out of paper */
-
-#define LPT_NPORTS 32
diff --git a/sys/arch/arm32/mainbus/mainbus.c b/sys/arch/arm32/mainbus/mainbus.c
deleted file mode 100644
index 86556bb55f9..00000000000
--- a/sys/arch/arm32/mainbus/mainbus.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/* $NetBSD: mainbus.c,v 1.3 1996/03/20 18:38:00 mark Exp $ */
-
-/*
- * Copyright (c) 1994,1995 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * mainbus.c
- *
- * mainbus configuration
- *
- * Created : 15/12/94
- * Last updated : 03/07/95
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/conf.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-
-#include <arm32/mainbus/mainbus.h>
-#include <machine/io.h>
-
-int mainbusmatch __P((struct device *, void *, void *));
-void mainbusattach __P((struct device *, struct device *, void *));
-
-struct cfattach mainbus_ca = {
- sizeof(struct device), mainbusmatch, mainbusattach
-};
-
-struct cfdriver mainbus_cd = {
- NULL, "mainbus", DV_DULL, 1
-};
-
-int
-mainbusmatch(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
-{
- return (1);
-}
-
-int
-mainbusprint(aux, mainbus)
- void *aux;
- const char *mainbus;
-{
- struct mainbus_attach_args *mb = aux;
-
- if (mb->mb_iobase)
- printf(" base 0x%x", mb->mb_iobase);
- if (mb->mb_iosize > 1)
- printf("-0x%x", mb->mb_iobase + mb->mb_iosize - 1);
- if (mb->mb_irq != -1)
- printf(" irq %d", mb->mb_irq);
- if (mb->mb_drq != -1)
- printf(" drq 0x%08x", mb->mb_drq);
-
-/* XXXX print flags */
- return (QUIET);
-}
-
-
-void
-mainbusscan(parent, match)
- struct device *parent;
- void *match;
-{
- struct device *dev = match;
- struct cfdata *cf = dev->dv_cfdata;
- struct mainbus_attach_args mb;
-
- if (cf->cf_fstate == FSTATE_STAR)
- panic("eekkk, I'm stuffed");
-
- if (cf->cf_loc[0] == -1) {
- mb.mb_iobase = 0;
- mb.mb_iosize = 0;
- mb.mb_drq = -1;
- mb.mb_irq = -1;
- } else {
- mb.mb_iobase = cf->cf_loc[0] + IO_CONF_BASE;
- mb.mb_iosize = 0;
- mb.mb_drq = cf->cf_loc[1];
- mb.mb_irq = cf->cf_loc[2];
- }
- if ((*cf->cf_attach->ca_match)(parent, dev, &mb) > 0)
- config_attach(parent, dev, &mb, mainbusprint);
- else
- free(dev, M_DEVBUF);
-}
-
-void
-mainbusattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- printf("\n");
-
- config_scan(mainbusscan, self);
-}
-
-/* End of mainbus.c */
diff --git a/sys/arch/arm32/mainbus/mainbus.h b/sys/arch/arm32/mainbus/mainbus.h
deleted file mode 100644
index d0ae78e8c9b..00000000000
--- a/sys/arch/arm32/mainbus/mainbus.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* $NetBSD: mainbus.h,v 1.2 1996/03/18 20:50:05 mark Exp $ */
-
-/*
- * Copyright (c) 1994,1995 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * mainbus.c
- *
- * mainbus configuration
- *
- * Created : 15/12/94
- */
-
-/*
- * mainbus driver attach arguments
- */
-
-struct mainbus_attach_args {
- u_int mb_iobase; /* base i/o address */
- int mb_iosize; /* span of ports used */
- int mb_irq; /* interrupt request */
- int mb_drq; /* DMA request */
- void *mb_aux; /* driver specific */
-};
-
-#define DRQUNK -1
-#define INTUNK -1
-#define IRQUNK -1
-
-/* End of mainbus.h */
-
-
diff --git a/sys/arch/arm32/mainbus/pms.c b/sys/arch/arm32/mainbus/pms.c
deleted file mode 100644
index 8789074800d..00000000000
--- a/sys/arch/arm32/mainbus/pms.c
+++ /dev/null
@@ -1,612 +0,0 @@
-/* $NetBSD: pms.c,v 1.1 1996/03/28 21:50:19 mark Exp $ */
-
-/*-
- * Copyright (c) 1996 D.C. Tsen
- * Copyright (c) 1994 Charles Hannum.
- * Copyright (c) 1992, 1993 Erik Forsberg.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD team.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * from:pms.c,v 1.24 1995/12/24 02:30:28 mycroft Exp
- */
-
-/*
- * Ported from 386 version of PS/2 mouse driver.
- * D.C. Tsen
- */
-
-#include "pms.h"
-#if NPMS > 1
-#error Only one PS/2 style mouse may be configured into your system.
-#endif
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/malloc.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/file.h>
-#include <sys/select.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/vnode.h>
-#include <sys/device.h>
-
-#include <machine/cpu.h>
-#include <machine/katelib.h>
-#include <machine/irqhandler.h>
-#include <machine/iomd.h>
-#include <machine/mouse.h>
-#include <arm32/mainbus/mainbus.h>
-
-/* mouse commands */
-#define PMS_SET_SCALE11 0xe6 /* set scaling 1:1 */
-#define PMS_SET_SCALE21 0xe7 /* set scaling 2:1 */
-#define PMS_SET_RES 0xe8 /* set resolution */
-#define PMS_GET_SCALE 0xe9 /* get scaling factor */
-#define PMS_SET_STREAM 0xea /* set streaming mode */
-#define PMS_SET_SAMPLE 0xf3 /* set sampling rate */
-#define PMS_DEV_ENABLE 0xf4 /* mouse on */
-#define PMS_DEV_DISABLE 0xf5 /* mouse off */
-#define PMS_RESET 0xff /* reset */
-
-#define PMS_CHUNK 128 /* chunk size for read */
-#define PMS_BSIZE (20*64) /* buffer size */
-
-struct pms_softc { /* driver status information */
- struct device sc_dev;
- irqhandler_t sc_ih;
-
- struct proc *proc;
- struct clist sc_q;
- struct selinfo sc_rsel;
- u_int sc_state; /* mouse driver state */
-#define PMS_OPEN 0x01 /* device is open */
-#define PMS_ASLP 0x02 /* waiting for mouse data */
- u_int sc_status; /* mouse button status */
- int sc_x, sc_y; /* accumulated motion in the X,Y axis */
- int boundx, boundy, bounda, boundb; /* Bounding box. x,y is bottom left */
- int origx, origy;
- int lastx, lasty, lastb;
-};
-
-int pmsprobe __P((struct device *, void *, void *));
-void pmsattach __P((struct device *, struct device *, void *));
-int pmsintr __P((void *));
-
-struct cfattach pms_ca = {
- sizeof(struct pms_softc), pmsprobe, pmsattach
-};
-
-struct cfdriver pms_cd = {
- NULL, "pms", DV_DULL
-};
-
-#define PMSUNIT(dev) (minor(dev))
-
-static inline void
-pms_flush()
-{
- while (inb(IOMD_MSCR) & 0x20) {
- delay(6);
- (void) inb(IOMD_MSDATA);
- delay(6);
- (void) inb(IOMD_MSDATA);
- delay(6);
- (void) inb(IOMD_MSDATA);
- }
-}
-
-static void
-cmd_mouse(unsigned char cmd)
-{
- unsigned char c;
- int i = 0;
- int retry = 10;
-
- for (i = 0; i < 1000; i++) {
- if (inb(IOMD_MSCR) & 0x80)
- break;
- delay(2);
- }
- if (i == 1000)
- printf("Mouse transmit not ready\n");
-
-resend:
- outb(IOMD_MSDATA, cmd);
- delay(2);
- c = inb(IOMD_MSCR) & (unsigned char) 0xff;
- while (!(c & (unsigned char) 0x20)) {
- delay(1);
- c = inb(IOMD_MSCR);
- }
-
- delay(10000);
-
- c = inb(IOMD_MSDATA) & 0xff;
- if ((c == 0xFA) || (c == 0xEE))
- return;
-
- if (--retry) {
- pms_flush();
- goto resend;
- }
-
- printf("Mouse cmd failed, cmd = %x, status = %x\n", cmd, c);
- return;
-}
-
-int
-pmsprobe(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- /*struct mainbus_attach_args *mb = aux;*/
- int i, j;
- int mid;
- int id;
-
-/* Make sure we have an IOMD we understand */
-
- id = ReadByte(IOMD_ID0) | (ReadByte(IOMD_ID1) << 8);
-
-/* So far I only know about this IOMD */
-
- switch (id) {
- case RPC600_IOMD_ID:
- return(0);
- break;
- case RC7500_IOC_ID:
- break;
- default:
- printf("pms: Unknown IOMD id=%04x", id);
- return(0);
- break;
- }
-
- outb(IOMD_MSCR, 0x08); /* enable the mouse */
-
- i = 0;
- while ((inb(IOMD_MSCR) & 0x03) != 0x03) {
- if (i++ > 10) {
- printf("Mouse not found, status = <%x>.\n", inb(IOMD_MSCR));
- return(0);
- }
- pms_flush();
- delay(2);
- outb(IOMD_MSCR, 0x08);
- }
-
- pms_flush();
-
- /*
- * Disable, reset and enable the mouse.
- */
- cmd_mouse(PMS_DEV_DISABLE);
- cmd_mouse(PMS_RESET);
- delay(300000);
- j = 10;
- i = 0;
- while ((mid = inb(IOMD_MSDATA)) != 0xAA) {
- if (++i > 500) {
- if (--j < 0) {
- printf("Mouse Reset failed, status = <%x>.\n", mid);
- return(0);
- }
- pms_flush();
- cmd_mouse(PMS_RESET);
- i = 0;
- }
- delay(100000);
- }
- mid = inb(IOMD_MSDATA);
-#if 0
- cmd_mouse(PMS_SET_RES);
- cmd_mouse(3); /* 8 counts/mm */
- cmd_mouse(PMS_SET_SCALE21);
- cmd_mouse(PMS_SET_SAMPLE);
- cmd_mouse(100); /* 100 samples/sec */
- cmd_mouse(PMS_SET_STREAM);
-#endif
- cmd_mouse(PMS_DEV_ENABLE);
- return 1;
-}
-
-void
-pmsattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct pms_softc *sc = (void *)self;
- struct mainbus_attach_args *mb = aux;
-
- printf("\n");
-
- /* Other initialization was done by pmsprobe. */
- sc->sc_state = 0;
- sc->origx = 0;
- sc->origy = 0;
- sc->boundx = -4095;
- sc->boundy = -4095;
- sc->bounda = 4096;
- sc->boundb = 4096;
-
- sc->sc_ih.ih_func = pmsintr;
- sc->sc_ih.ih_arg = sc;
- sc->sc_ih.ih_level = IPL_TTY;
- sc->sc_ih.ih_name = "pms";
- if (mb->mb_irq != IRQUNK)
- sc->sc_ih.ih_num = mb->mb_irq;
- else
-#ifdef RC7500
- sc->sc_ih.ih_num = IRQ_MSDRX;
-#else
- panic("pms: No IRQ specified for pms interrupt handler");
-#endif
-}
-
-int
-pmsopen(dev, flag, mode, p)
- dev_t dev;
- int flag;
- int mode;
- struct proc *p;
-{
- int unit = PMSUNIT(dev);
- struct pms_softc *sc;
-
- if (unit >= pms_cd.cd_ndevs)
- return ENXIO;
- sc = pms_cd.cd_devs[unit];
- if (!sc)
- return ENXIO;
-
- if (sc->sc_state & PMS_OPEN)
- return EBUSY;
-
- if (clalloc(&sc->sc_q, PMS_BSIZE, 0) == -1)
- return ENOMEM;
-
- sc->proc = p;
- sc->sc_state |= PMS_OPEN;
- sc->sc_status = 0;
- sc->sc_x = sc->sc_y = 0;
- sc->lastx = -1;
- sc->lasty = -1;
- sc->lastb = -1;
-
- if (irq_claim(IRQ_INSTRUCT, &sc->sc_ih) == -1)
- panic("Cannot claim MOUSE IRQ");
-
- return 0;
-}
-
-int
-pmsclose(dev, flag, mode, p)
- dev_t dev;
- int flag;
- int mode;
- struct proc *p;
-{
- struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)];
-
- if (irq_release(IRQ_INSTRUCT, &sc->sc_ih) != 0)
- panic("Cannot release MOUSE IRQ");
-
- sc->proc = NULL;
- sc->sc_state &= ~PMS_OPEN;
- sc->sc_x = sc->sc_y = 0;
-
- clfree(&sc->sc_q);
-
- return 0;
-}
-
-int
-pmsread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)];
- int s;
- int error = 0;
- size_t length;
- u_char buffer[PMS_CHUNK];
-
- /* Block until mouse activity occured. */
-
- s = spltty();
- while (sc->sc_q.c_cc == 0) {
- if (flag & IO_NDELAY) {
- splx(s);
- return EWOULDBLOCK;
- }
- sc->sc_state |= PMS_ASLP;
- if (error = tsleep((caddr_t)sc, (PZERO | PCATCH), "pmsread", 0)) {
- sc->sc_state &= ~PMS_ASLP;
- splx(s);
- return error;
- }
- }
-
- /* Transfer as many chunks as possible. */
-
- while (sc->sc_q.c_cc > 0 && uio->uio_resid > 0) {
- length = min(sc->sc_q.c_cc, uio->uio_resid);
- if (length > sizeof(buffer))
- length = sizeof(buffer);
-
- /* Remove a small chunk from the input queue. */
- (void) q_to_b(&sc->sc_q, buffer, length);
-
- /* Copy the data to the user process. */
- if (error = uiomove(buffer, length, uio))
- break;
- }
- splx(s);
-
- return error;
-}
-
-int
-pmsioctl(dev, cmd, addr, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t addr;
- int flag;
- struct proc *p;
-{
- struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)];
- struct mouseinfo info;
- int s;
- int error = 0;
-
- s = spltty();
-
- switch (cmd) {
- case MOUSEIOC_SETSTATE:
- printf("MOUSEIOC_SETSTATE called\n");
- break;
- case MOUSEIOC_WRITEX:
- sc->sc_x = *(int *) addr;
- break;
- case MOUSEIOC_WRITEY:
- sc->sc_y = *(int *) addr;
- break;
- case MOUSEIOC_SETBOUNDS:
- {
- register struct mouse_boundingbox *bo = (void *) addr;
- sc->boundx = bo->x; sc->boundy = bo->y;
- sc->bounda = bo->a; sc->boundb = bo->b;
- break;
- }
- case MOUSEIOC_SETORIGIN:
- {
- register struct mouse_origin *oo = (void *) addr;
- sc->origx = oo->x;
- sc->origy = oo->y;
- break;
- }
- case MOUSEIOC_GETBOUNDS:
- {
- register struct mouse_boundingbox *bo = (void *) addr;
- bo->x = sc->boundx; bo->y = sc->boundy;
- bo->a = sc->bounda; bo->b = sc->boundb;
- break;
- }
- case MOUSEIOC_GETORIGIN:
- {
- register struct mouse_origin *oo = (void *) addr;
- oo->x = sc->origx;
- oo->y = sc->origy;
- break;
- }
- case MOUSEIOC_GETSTATE:
- printf("MOUSEIOC_GETSTATE called\n");
- /*
- * Fall through.
- */
-/* case MOUSEIOCREAD:*/
-
- info.status = sc->sc_status;
- if (sc->sc_x || sc->sc_y)
- info.status |= MOVEMENT;
-
-#if 1
- info.xmotion = sc->sc_x;
- info.ymotion = sc->sc_y;
-#else
- if (sc->sc_x > sc->bounda)
- info.xmotion = sc->bounda;
- else if (sc->sc_x < sc->boundx)
- info.xmotion = sc->boundx;
- else
- info.xmotion = sc->sc_x;
-
- if (sc->sc_y > sc->boundb)
- info.ymotion = sc->boundb;
- else if (sc->sc_y < sc->boundy)
- info.ymotion = sc->boundy;
- else
- info.ymotion = sc->sc_y;
-#endif
-
- /* Reset historical information. */
- sc->sc_x = sc->sc_y = 0;
- sc->sc_status &= ~BUTCHNGMASK;
- ndflush(&sc->sc_q, sc->sc_q.c_cc);
-
- error = copyout(&info, addr, sizeof(struct mouseinfo));
- break;
-
- default:
- error = EINVAL;
- break;
- }
- splx(s);
-
- return error;
-}
-
-/* Masks for the first byte of a packet */
-#define PS2LBUTMASK 0x01
-#define PS2RBUTMASK 0x02
-#define PS2MBUTMASK 0x04
-
-#define XNEG_MASK 0x10
-#define YNEG_MASK 0x20
-
-int
-pmsintr(arg)
- void *arg;
-{
- struct pms_softc *sc = arg;
- static int state = 0;
- static u_char buttons;
- u_char changed;
- static int dx, dy;
- int dosignal = 0;
- int s;
- u_char b;
- struct mousebufrec mbuffer;
-
- if ((sc->sc_state & PMS_OPEN) == 0) {
- /* Interrupts are not expected. Discard the byte. */
- pms_flush();
- return(-1);
- }
-
- switch (state) {
-
- case 0:
- buttons = inb(IOMD_MSDATA);
- if ((buttons & 0xc0) == 0)
- ++state;
- break;
-
- case 1:
- dx = inb(IOMD_MSDATA);
- dx = (buttons & XNEG_MASK) ? -dx : dx;
- ++state;
- break;
-
- case 2:
- dy = inb(IOMD_MSDATA);
- dy = (buttons & YNEG_MASK) ? -dy : dy;
- state = 0;
-
- buttons = ((buttons & PS2LBUTMASK) << 2) |
- ((buttons & (PS2RBUTMASK | PS2MBUTMASK)) >> 1);
- /*
- * Ahhh, the Xarm server interrupt button bits reversed.
- * If bit is set to 1, it means button is not pressed which is
- * not what PS/2 mouse button bits said. Since we are simulating
- * the quadmouse, that's not too picky about it.
- */
- buttons ^= BUTSTATMASK;
- changed = ((buttons ^ sc->sc_status) & BUTSTATMASK) << 3;
- sc->sc_status = buttons | (sc->sc_status & ~BUTSTATMASK) | changed;
-
- if (dx || dy || changed) {
- if (dx < 0)
- dx = -(256 + dx);
- if (dy < 0)
- dy = -(256 + dy);
-
- /* Update accumulated movements. */
- sc->sc_x += dx;
- sc->sc_y += dy;
-
- if (sc->sc_x > sc->bounda)
- sc->sc_x = sc->bounda;
- else if (sc->sc_x < sc->boundx)
- sc->sc_x = sc->boundx;
-
- if (sc->sc_y > sc->boundb)
- sc->sc_y = sc->boundb;
- else if (sc->sc_y < sc->boundy)
- sc->sc_y = sc->boundy;
-
- if (sc->sc_q.c_cc == 0) {
- dosignal = 1;
- }
-
- /* Add this event to the queue. */
- b = buttons & BUTSTATMASK;
- mbuffer.status = b | (b ^ sc->lastb) << 3
- | (((sc->sc_x==sc->lastx) && (sc->sc_y==sc->lasty))?0:0x40);
- mbuffer.x = sc->sc_x * 2;
- mbuffer.y = sc->sc_y * 2;
- microtime(&mbuffer.event_time);
- s = spltty();
- (void) b_to_q((char *)&mbuffer, sizeof(mbuffer), &sc->sc_q);
- (void) splx(s);
- sc->lastx = sc->sc_x;
- sc->lasty = sc->sc_y;
- sc->lastb = b;
-
- selwakeup(&sc->sc_rsel);
- if (sc->sc_state & PMS_ASLP) {
- sc->sc_state &= ~PMS_ASLP;
- wakeup((caddr_t)sc);
- }
- if (dosignal)
- psignal(sc->proc, SIGIO);
- }
-
- break;
- }
-
- return(0);
-}
-
-int
-pmsselect(dev, rw, p)
- dev_t dev;
- int rw;
- struct proc *p;
-{
- struct pms_softc *sc = pms_cd.cd_devs[PMSUNIT(dev)];
- int s;
- int ret;
-
- if (rw == FWRITE)
- return 0;
-
- s = spltty();
- if (!sc->sc_q.c_cc) {
- selrecord(p, &sc->sc_rsel);
- ret = 0;
- } else
- ret = 1;
- splx(s);
-
- return ret;
-}
diff --git a/sys/arch/arm32/mainbus/qmouse.c b/sys/arch/arm32/mainbus/qmouse.c
deleted file mode 100644
index 14842236425..00000000000
--- a/sys/arch/arm32/mainbus/qmouse.c
+++ /dev/null
@@ -1,440 +0,0 @@
-/* $NetBSD: qmouse.c,v 1.5 1996/03/28 21:56:40 mark Exp $ */
-
-/*
- * Copyright (c) Scott Stevens 1995 All rights reserved
- * Copyright (c) Melvin Tang-Richardson 1995 All rights reserved
- * Copyright (c) Mark Brinicombe 1995 All rights reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD team.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Quadrature mouse driver
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/kernel.h>
-#include <sys/types.h>
-#include <sys/device.h>
-#include <sys/proc.h>
-#include <sys/time.h>
-#include <sys/errno.h>
-#include <dev/cons.h>
-#include <sys/fcntl.h>
-#include <sys/signalvar.h>
-#include <sys/vnode.h>
-#include <sys/time.h>
-
-#include <arm32/mainbus/mainbus.h>
-#include <machine/irqhandler.h>
-#include <machine/katelib.h>
-#include <machine/iomd.h>
-#include <machine/mouse.h>
-
-#include "quadmouse.h"
-
-#define TIMER1_COUNT 40000 /* 50Hz */
-
-#define QMOUSE_BSIZE 12*64
-
-struct quadmouse_softc {
- struct device sc_device;
- irqhandler_t sc_ih;
- int sc_iobase;
- struct selinfo sc_rsel;
-#define QMOUSE_OPEN 0x01
-#define QMOUSE_ASLEEP 0x02
- int sc_state;
- int boundx, boundy, bounda, boundb; /* Bounding box. x,y is bottom left */
- int origx, origy;
- int xmult, ymult; /* Multipliers */
- int lastx, lasty, lastb;
- struct proc *proc;
- struct clist buffer;
-};
-
-int quadmouseprobe __P((struct device *, void *, void *));
-void quadmouseattach __P((struct device *, struct device *, void *));
-int quadmouseopen __P((dev_t, int, int, struct proc *));
-int quadmouseclose __P((dev_t, int, int, struct proc *));
-
-int strncmp __P((const char *, const char *, size_t));
-
-int quadmouseintr (struct quadmouse_softc *);
-
-struct cfattach quadmouse_ca = {
- sizeof(struct quadmouse_softc), quadmouseprobe, quadmouseattach
-};
-
-struct cfdriver quadmouse_cd = {
- NULL, "quadmouse", DV_DULL
-};
-
-
-int
-quadmouseprobe(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
-{
-/* struct mainbus_attach_args *mb = aux;*/
- int id;
-
-/* Make sure we have an IOMD we understand */
-
- id = ReadByte(IOMD_ID0) | (ReadByte(IOMD_ID1) << 8);
-
-/* So far I only know about this IOMD */
-
- switch (id) {
- case RPC600_IOMD_ID:
- return(1);
- break;
- default:
- printf("quadmouse: Unknown IOMD id=%04x", id);
- break;
- }
-
- return(0);
-}
-
-
-void
-quadmouseattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct quadmouse_softc *sc = (void *)self;
- struct mainbus_attach_args *mb = aux;
-
- sc->sc_iobase = mb->mb_iobase;
-
-/* Check for a known IOMD chip */
-
- sc->sc_ih.ih_func = quadmouseintr;
- sc->sc_ih.ih_arg = sc;
- sc->sc_ih.ih_level = IPL_TTY;
- sc->sc_ih.ih_name = "T1 quadmouse";
-
-/* Set up origin and multipliers */
-
- sc->origx = 0;
- sc->origy = 0;
- sc->xmult = 2;
- sc->ymult = 2;
-
-/* Set up bounding box */
-
- sc->boundx = -4095;
- sc->boundy = -4095;
- sc->bounda = 4096;
- sc->boundb = 4096;
-
- sc->sc_state = 0;
-
- WriteWord(IOMD_MOUSEX, sc->origx);
- WriteWord(IOMD_MOUSEY, sc->origy);
-
- printf("\n");
-}
-
-
-int
-quadmouseopen(dev, flag, mode, p)
- dev_t dev;
- int flag;
- int mode;
- struct proc *p;
-{
- struct quadmouse_softc *sc;
- int unit = minor(dev);
-
- if (unit >= quadmouse_cd.cd_ndevs)
- return(ENXIO);
-
- sc = quadmouse_cd.cd_devs[unit];
-
- if (!sc) return(ENXIO);
-
- if (sc->sc_state & QMOUSE_OPEN) return(EBUSY);
-
- sc->proc = p;
-
- sc->lastx = -1;
- sc->lasty = -1;
- sc->lastb = -1;
-
- /* initialise buffer */
- if (clalloc(&sc->buffer, QMOUSE_BSIZE, 0) == -1)
- return(ENOMEM);
-
- sc->sc_state |= QMOUSE_OPEN;
-
- WriteByte(IOMD_T1LOW, (TIMER1_COUNT >> 0) & 0xff);
- WriteByte(IOMD_T1HIGH, (TIMER1_COUNT >> 8) & 0xff);
- WriteByte(IOMD_T1GO, 0);
-
- if (irq_claim(IRQ_TIMER1, &sc->sc_ih))
- panic("Cannot claim TIMER1 IRQ for quadmouse%d", sc->sc_device.dv_unit);
-
- return(0);
-}
-
-
-int
-quadmouseclose(dev, flag, mode, p)
- dev_t dev;
- int flag;
- int mode;
- struct proc *p;
-{
- int unit = minor (dev);
- struct quadmouse_softc *sc = quadmouse_cd.cd_devs[unit];
-
- if (irq_release(IRQ_TIMER1, &sc->sc_ih) != 0)
- panic("Cannot release IRA");
-
- sc->proc = NULL;
- sc->sc_state = 0;
-
- clfree(&sc->buffer);
-
- return(0);
-}
-
-int
-quadmouseread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- int unit = minor(dev);
- struct quadmouse_softc *sc = quadmouse_cd.cd_devs[unit];
- int error;
- int s;
- int length;
- u_char buffer[128];
-
- s=spltty();
- while(sc->buffer.c_cc==0) {
- if(flag & IO_NDELAY) {
- (void)splx(s);
- return(EWOULDBLOCK);
- }
- sc->sc_state |= QMOUSE_ASLEEP;
- if((error = tsleep((caddr_t)sc, PZERO | PCATCH, "quadmouseread", 0))) {
- sc->sc_state &= ~QMOUSE_ASLEEP;
- (void)splx(s);
- return(error);
- }
- }
-
- while(sc->buffer.c_cc>0 && uio->uio_resid>0) {
- length=min(sc->buffer.c_cc, uio->uio_resid);
- if(length>sizeof(buffer))
- length=sizeof(buffer);
-
- (void) q_to_b(&sc->buffer, buffer, length);
-
- if(error = (uiomove(buffer, length, uio)))
- break;
- }
- (void)splx(s);
- return(error);
-}
-
-
-#define FMT_START int x = ReadWord(IOMD_MOUSEX)&0xffff; \
- int y = ReadWord(IOMD_MOUSEY)&0xffff; \
- int b = ReadByte(IO_MOUSE_BUTTONS)&0x70; \
- if(x&0x8000) x|=0xffff0000; \
- if(y&0x8000) y|=0xffff0000; \
- x = (x - sc->origx); \
- y = (y - sc->origy); \
- if (x<(sc->boundx)) x = sc->boundx; \
- WriteWord(IOMD_MOUSEX, x + sc->origx); \
- if (x>(sc->bounda)) x = sc->bounda; \
- WriteWord(IOMD_MOUSEX, x + sc->origx); \
- if (y<(sc->boundy)) y = sc->boundy; \
- WriteWord(IOMD_MOUSEY, y + sc->origy); \
- if (y>(sc->boundb)) y = sc->boundb; \
- WriteWord(IOMD_MOUSEY, y + sc->origy); \
- x=x*sc->xmult; \
- y=y*sc->ymult;
-
-#define FMT_END
-
-
-int
-quadmouseioctl(dev, cmd, data, flag, p)
- dev_t dev;
- int cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- struct quadmouse_softc *sc = quadmouse_cd.cd_devs[minor(dev)];
-
- switch (cmd) {
- case MOUSEIOC_WRITEX:
- WriteWord(IOMD_MOUSEX, *(int *)data+sc->origx);
- return 0;
- case MOUSEIOC_WRITEY:
- WriteWord(IOMD_MOUSEY, *(int *)data+sc->origy);
- return 0;
- case MOUSEIOC_SETSTATE:
- {
- register struct mouse_state *co = (void *)data;
- WriteWord(IOMD_MOUSEX, co->x);
- WriteWord(IOMD_MOUSEY, co->y);
-
- /* Silly, but here for completeness, just incase */
- /* the hardware supports it *giggle* */
-
-/* This is not writable -- mark -- technically this should fault */
-
-/* WriteWord ( IO_MOUSE_BUTTONS, co->buttons );*/
- return 0;
- }
- case MOUSEIOC_SETBOUNDS:
- {
- register struct mouse_boundingbox *bo = (void *)data;
- sc->boundx = bo->x; sc->boundy = bo->y;
- sc->bounda = bo->a; sc->boundb = bo->b;
- return 0;
- }
- case MOUSEIOC_SETORIGIN:
- {
- register struct mouse_origin *oo = (void *)data;
-/* int oldx, oldy;*/
- /* Need to fix up! */
- sc->origx = oo->x;
- sc->origy = oo->y;
- return 0;
- }
- case MOUSEIOC_GETSTATE:
- {
- register struct mouse_state *co = (void *)data;
- FMT_START
- co->x = x;
- co->y = y;
- co->buttons = b ^ 0x70;
- FMT_END
- return 0;
- }
- case MOUSEIOC_GETBOUNDS:
- {
- register struct mouse_boundingbox *bo = (void *)data;
- bo->x = sc->boundx; bo->y = sc->boundy;
- bo->a = sc->bounda; bo->b = sc->boundb;
- return 0;
- }
- case MOUSEIOC_GETORIGIN:
- {
- register struct mouse_origin *oo = (void *)data;
- oo->x = sc->origx;
- oo->y = sc->origy;
- return 0;
- }
- }
-
- return (EINVAL);
-}
-
-
-int
-quadmouseintr(sc)
- struct quadmouse_softc *sc;
-{
- int s;
- struct mousebufrec buffer;
- int dosignal=0;
-
- FMT_START
-
- b &= 0x70;
- b >>= 4;
- if (x != sc->lastx || y != sc->lasty || b != sc->lastb) {
- /* Mouse state changed */
- buffer.status = b | ( b ^ sc->lastb) << 3 | (((x==sc->lastx) && (y==sc->lasty))?0:0x40);
- buffer.x = x;
- buffer.y = y;
- microtime(&buffer.event_time);
-
- if(sc->buffer.c_cc==0)
- dosignal=1;
-
- s=spltty();
- (void) b_to_q((char *)&buffer, sizeof(buffer), &sc->buffer);
- (void)splx(s);
- selwakeup(&sc->sc_rsel);
-
- if(sc->sc_state & QMOUSE_ASLEEP) {
- sc->sc_state &= ~QMOUSE_ASLEEP;
- wakeup((caddr_t)sc);
- }
-
- if(dosignal)
- psignal(sc->proc, SIGIO);
-
- sc->lastx = x;
- sc->lasty = y;
- sc->lastb = b;
- }
-
- FMT_END
- return(0);
-}
-
-int
-quadmouseselect(dev, rw, p)
- dev_t dev;
- int rw;
- struct proc *p;
-{
- int unit = minor(dev);
- struct quadmouse_softc *sc = quadmouse_cd.cd_devs[unit];
- int s;
-
- if(rw == FWRITE)
- return 0;
-
- s=spltty();
- if(sc->buffer.c_cc > 0) {
- selrecord(p, &sc->sc_rsel);
- (void)splx(s);
- return 0;
- }
- (void)splx(s);
- return 1;
-}
-
-/* End of quadmouse.c */
diff --git a/sys/arch/arm32/mainbus/rtc.c b/sys/arch/arm32/mainbus/rtc.c
deleted file mode 100644
index d759294324c..00000000000
--- a/sys/arch/arm32/mainbus/rtc.c
+++ /dev/null
@@ -1,384 +0,0 @@
-/* $NetBSD: rtc.c,v 1.1 1996/04/19 19:49:06 mark Exp $ */
-
-/*
- * Copyright (c) 1994-1996 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * This code is derived from software written for Brini by Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * rtc.c
- *
- * Routines to read and write the RTC and CMOS RAM
- *
- * Created : 13/10/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/conf.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-#include <machine/iic.h>
-#include <machine/rtc.h>
-
-struct rtc_softc {
- struct device sc_dev;
- int sc_flags;
-#define RTC_BROKEN 1
-#define RTC_OPEN 2
-};
-
-void rtcattach __P((struct device *parent, struct device *self, void *aux));
-int rtcmatch __P((struct device *parent, void *match, void *aux));
-
-/* Read a byte from CMOS RAM */
-
-int
-cmos_read(location)
- int location;
-{
- u_char buff;
-
-/*
- * This commented code dates from when I was translating CMOS address
- * from the RISCOS addresses. Now all addresses are specifed as
- * actual addresses in the CMOS RAM
- */
-
-/*
- if (location > 0xF0)
- return(-1);
-
- if (location < 0xC0)
- buff = location + 0x40;
- else
- buff = location - 0xB0;
-*/
- buff = location;
-
- if (iic_control(RTC_Write, &buff, 1))
- return(-1);
- if (iic_control(RTC_Read, &buff, 1))
- return(-1);
-
- return(buff);
-}
-
-
-/* Write a byte to CMOS RAM */
-
-int
-cmos_write(location, value)
- int location;
- int value;
-{
- u_char buff[2];
-
-/*
- * This commented code dates from when I was translating CMOS address
- * from the RISCOS addresses. Now all addresses are specifed as
- * actual addresses in the CMOS RAM
- */
-
-/* if (location > 0xF0)
- return(-1);
-
- if (location < 0xC0)
- buff = location + 0x40;
- else
- buff = location - 0xB0;
-*/
- buff[0] = location;
- buff[1] = value;
-
- if (iic_control(RTC_Write, buff, 2))
- return(-1);
-
- return(0);
-}
-
-
-/* Hex to BCD and BCD to hex conversion routines */
-
-static inline int
-hexdectodec(n)
- u_char n;
-{
- return(((n >> 4) & 0x0F) * 10 + (n & 0x0F));
-}
-
-static inline int
-dectohexdec(n)
- u_char n;
-{
- return(((n / 10) << 4) + (n % 10));
-}
-
-
-/* Write the RTC data from an 8 byte buffer */
-
-int
-rtc_write(rtc)
- rtc_t *rtc;
-{
- u_char buff[8];
-
- buff[0] = 1;
-
- buff[1] = dectohexdec(rtc->rtc_centi);
- buff[2] = dectohexdec(rtc->rtc_sec);
- buff[3] = dectohexdec(rtc->rtc_min);
- buff[4] = dectohexdec(rtc->rtc_hour) & 0x3f;
- buff[5] = dectohexdec(rtc->rtc_day);
- buff[6] = dectohexdec(rtc->rtc_mon);
-
- if (iic_control(RTC_Write, buff, 7))
- return(0);
-
- cmos_write(RTC_ADDR_YEAR, rtc->rtc_year);
- cmos_write(RTC_ADDR_CENT, rtc->rtc_cen);
-
- return(1);
-}
-
-
-/* Read the RTC data into a 8 byte buffer */
-
-int
-rtc_read(rtc)
- rtc_t *rtc;
-{
- u_char buff[8];
- int byte;
-
- buff[0] = 0;
-
- if (iic_control(RTC_Write, buff, 1))
- return(0);
-
- if (iic_control(RTC_Read, buff, 8))
- return(0);
-
- rtc->rtc_micro = 0;
- rtc->rtc_centi = hexdectodec(buff[1] & 0xff);
- rtc->rtc_sec = hexdectodec(buff[2] & 0x7f);
- rtc->rtc_min = hexdectodec(buff[3] & 0x7f);
- rtc->rtc_hour = hexdectodec(buff[4] & 0x3f);
-
- /* If in 12 hour mode need to look at the AM/PM flag */
-
- if (buff[4] & 0x80)
- rtc->rtc_hour += (buff[4] & 0x40) ? 12 : 0;
-
- rtc->rtc_day = hexdectodec(buff[5] & 0x3f);
- rtc->rtc_mon = hexdectodec(buff[6] & 0x1f);
-
- byte = cmos_read(RTC_ADDR_YEAR);
- if (byte == -1)
- return(0);
- rtc->rtc_year = byte;
-
- byte = cmos_read(RTC_ADDR_CENT);
- if (byte == -1)
- return(0);
- rtc->rtc_cen = byte;
-
- return(1);
-}
-
-
-struct cfattach rtc_ca = {
- sizeof(struct rtc_softc), rtcmatch, rtcattach
-};
-
-struct cfdriver rtc_cd = {
- NULL, "rtc", DV_DULL, 0
-};
-
-int
-rtcmatch(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
-{
-/* struct iicbus_attach_args *ib = aux;*/
-
- return(1);
-}
-
-
-void
-rtcattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct rtc_softc *sc = (struct rtc_softc *)self;
- struct iicbus_attach_args *ib = aux;
- u_char buff[1];
-
- sc->sc_flags |= RTC_BROKEN;
- if ((ib->ib_addr & IIC_PCF8583_MASK) == IIC_PCF8583_ADDR) {
- printf(": PCF8583");
-
- buff[0] = 0;
-
- if (iic_control(RTC_Write, buff, 1))
- return;
-
- if (iic_control(RTC_Read, buff, 1))
- return;
-
- printf(" clock base ");
- switch (buff[0] & 0x30) {
- case 0x00:
- printf("32.768KHz");
- break;
- case 0x10:
- printf("50Hz");
- break;
- case 0x20:
- printf("event");
- break;
- case 0x30:
- printf("test mode");
- break;
- }
-
- if (buff[0] & 0x80)
- printf(" stopped");
- if (buff[0] & 0x04)
- printf(" alarm enabled");
- sc->sc_flags &= ~RTC_BROKEN;
- }
-
-
-/*
- * Initialise the time of day register.
- * This is normally left to the filing system to do but not all
- * filing systems call it e.g. cd9660
- */
-
- inittodr(0);
-
- printf("\n");
-}
-
-
-int
-rtcopen(dev, flag, mode, p)
- dev_t dev;
- int flag;
- int mode;
- struct proc *p;
-{
- struct rtc_softc *sc;
- int unit = minor(dev);
-
- if (unit >= rtc_cd.cd_ndevs)
- return(ENXIO);
-
- sc = rtc_cd.cd_devs[unit];
-
- if (!sc) return(ENXIO);
-
- if (sc->sc_flags & RTC_OPEN) return(EBUSY);
-
- sc->sc_flags |= RTC_OPEN;
-
- return(0);
-}
-
-
-int
-rtcclose(dev, flag, mode, p)
- dev_t dev;
- int flag;
- int mode;
- struct proc *p;
-{
- int unit = minor(dev);
- struct rtc_softc *sc = rtc_cd.cd_devs[unit];
-
- sc->sc_flags &= ~RTC_OPEN;
-
- return(0);
-}
-
-
-int
-rtcread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- int unit = minor(dev);
- struct rtc_softc *sc = rtc_cd.cd_devs[unit];
-
- return(ENXIO);
-}
-
-
-int
-rtcwrite(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- int unit = minor(dev);
- struct rtc_softc *sc = rtc_cd.cd_devs[unit];
-
- return(ENXIO);
-}
-
-
-int
-rtcioctl(dev, cmd, data, flag, p)
- dev_t dev;
- int cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- struct rtc_softc *sc = rtc_cd.cd_devs[minor(dev)];
-
-/* switch (cmd) {
- case RTCIOC_READ:
- return(0);
- } */
-
- return(EINVAL);
-}
-
-/* End of rtc.c */
diff --git a/sys/arch/arm32/mainbus/vidcaudio.c b/sys/arch/arm32/mainbus/vidcaudio.c
deleted file mode 100644
index dc215efa31f..00000000000
--- a/sys/arch/arm32/mainbus/vidcaudio.c
+++ /dev/null
@@ -1,870 +0,0 @@
-/* $NetBSD: vidcaudio.c,v 1.3 1996/03/17 01:24:37 thorpej Exp $ */
-
-/*
- * Copyright (c) 1995 Melvin Tang-Richardson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the RiscBSD team.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Yikes just had a look at this and realised that it does not conform
- * to Kernel Normal Form at all. I have fixed the first few functions
- * but there are a lot more still to do - mark
- */
-
-/*
- * vidcaudio driver for RiscBSD by Melvin Tang-Richardson (c) 1995
- *
- * Interfaces with the NetBSD generic audio driver to provide SUN
- * /dev/audio (partial) compatibility.
- *
- * Do not include me in conf.c. My interface is done by the generic
- * audio driver. Put me in config file and files.arm32. Do not put
- * the audio.c generic driver in them. I do the autoconfig for it.
- *
- * The following files need to be altered
- *
- * [files.arm32]
- * device vidcaudio at mainbus :audio
- * file arch/arm32/mainbus/vidcaudio.c vidcaudio needs-flag
- * major { audio=36 }
- *
- * [conf.c]
- * #include "audio.h"
- * cdev_decl(audio)
- *
- * cdev_audio_init(NAUDIO,audio) /* 36: generic audio I/O */
- *
- * [GENERIC]
- * vidcaudio0 at mainbus? base 0x00000000
- *
- */
-
-#include <sys/param.h> /* proc.h */
-#include <sys/types.h> /* dunno */
-#include <sys/conf.h> /* autoconfig functions */
-#include <sys/device.h> /* device calls */
-#include <sys/proc.h> /* device calls */
-#include <sys/audioio.h>
-#include <sys/errno.h>
-#include <sys/systm.h>
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-
-#include <dev/audio_if.h>
-
-#include <machine/irqhandler.h>
-#include <machine/iomd.h>
-#include <machine/vidc.h>
-#include <machine/katelib.h> /* ReadByte etc. */
-
-#include <arm32/mainbus/mainbus.h>
-#include "waveform.h"
-#include "vidcaudio.h"
-
-#undef DEBUG
-
-struct audio_general {
- int in_sr;
- int out_sr;
- vm_offset_t silence;
- irqhandler_t ih;
-
- void (*intr) ();
- void *arg;
-
- vm_offset_t next_cur;
- vm_offset_t next_end;
- void (*next_intr) ();
- void *next_arg;
-
- int buffer;
- int in_progress;
-
- int open;
-} ag;
-
-struct vidcaudio_softc {
- struct device device;
- int iobase;
-
- int open;
-
- u_int encoding;
- int inport;
- int outport;
-};
-
-int vidcaudio_probe __P((struct device *parent, struct device *match, void *aux));
-void vidcaudio_attach __P((struct device *parent, struct device *self, void *aux));
-int vidcaudio_open __P((dev_t dev, int flags));
-void vidcaudio_close __P((void *addr));
-
-int vidcaudio_intr __P((void *arg));
-int vidcaudio_dma_program __P((vm_offset_t cur, vm_offset_t end, void (*intr)(), void *arg));
-void vidcaudio_dummy_routine __P((void *arg));
-int vidcaudio_stereo __P((int channel, int position));
-int vidcaudio_rate __P((int rate));
-void vidcaudio_shutdown __P((void));
-int vidcaudio_hw_attach __P((struct vidcaudio_softc *sc));
-
-struct cfattach vidcaudio_ca = {
- sizeof(struct vidcaudio_softc), vidcaudio_probe, vidcaudio_attach
-};
-
-struct cfdriver vidcaudio_cd = {
- NULL, "vidcaudio", DV_DULL
-};
-
-
-void
-vidcaudio_beep_generate()
-{
- vidcaudio_dma_program ( ag.silence, ag.silence+sizeof(beep_waveform)-16,
- vidcaudio_dummy_routine, NULL );
-}
-
-
-int
-vidcaudio_probe(parent, match, aux)
- struct device *parent;
- struct device *match;
- void *aux;
-{
- int id;
-
- id = ReadByte(IOMD_ID0) | ReadByte(IOMD_ID1) << 8;
-
-/* So far I only know about this IOMD */
-
- switch (id) {
- case RPC600_IOMD_ID:
- return(1);
- break;
- default:
- printf("vidcaudio: Unknown IOMD id=%04x", id);
- break;
- }
-
- return (0);
-}
-
-
-void
-vidcaudio_attach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct mainbus_attach_args *mb = aux;
- struct vidcaudio_softc *sc = (void *)self;
-
- sc->iobase = mb->mb_iobase;
-
- sc->open = 0;
- sc->encoding = 0;
- sc->inport = 0;
- sc->outport = 0;
- ag.in_sr = 24*1024;
- ag.out_sr = 24*1024;
- ag.in_progress = 0;
-
- ag.next_cur = 0;
- ag.next_end = 0;
- ag.next_intr = NULL;
- ag.next_arg = NULL;
-
- vidcaudio_rate(32);
-
-/* Program the silence buffer and reset the DMA channel */
-
- ag.silence = kmem_alloc(kernel_map, NBPG);
- if (ag.silence == NULL)
- panic("vidcaudio: Cannot allocate memory");
-
- bzero((char *)ag.silence, NBPG);
- bcopy((char *)beep_waveform, (char *)ag.silence, sizeof(beep_waveform));
-
- ag.buffer = 0;
-
- /* Install the irq handler for the DMA interrupt */
- ag.ih.ih_func = vidcaudio_intr;
- ag.ih.ih_arg = NULL;
- ag.ih.ih_level = IPL_NONE;
-
- ag.intr = NULL;
- ag.nextintr = NULL;
-
- disable_irq(IRQ_DMASCH0);
-
- if (irq_claim(IRQ_DMASCH0, &(ag.ih)))
- panic("vidcaudio: couldn't claim IRQ_DMASCH0");
-
- disable_irq(IRQ_DMASCH0);
-
- vidcaudio_dma_program(ag.silence, ag.silence+NBPG-16,
- vidcaudio_dummy_routine, NULL);
-
- vidcaudio_hw_attach(sc);
-
-#ifdef DEBUG
- printf(" UNDER DEVELOPMENT (nuts)\n");
-#endif
-}
-
-int
-vidcaudio_open(dev, flags)
- dev_t dev;
- int flags;
-{
- struct vidcaudio_softc *sc;
- int unit = AUDIOUNIT (dev);
- int s;
-
-#ifdef DEBUG
- printf("DEBUG: vidcaudio_open called\n");
-#endif
-
- if (unit >= vidcaudio_cd.cd_ndevs)
- return ENODEV;
-
- sc = vidcaudio_cd.cd_devs[unit];
-
- if (!sc)
- return ENXIO;
-
- s = splhigh();
-
- if (sc->open != 0) {
- (void)splx(s);
- return EBUSY;
- }
-
- sc->open=1;
- ag.open=1;
-
- (void)splx(s);
- return 0;
-}
-
-void
-vidcaudio_close(addr)
- void *addr;
-{
- struct vidcaudio_softc *sc = addr;
-
- vidcaudio_shutdown ();
-
-#ifdef DEBUG
- printf("DEBUG: vidcaudio_close called\n");
-#endif
-
- sc->open = 0;
- ag.open = 0;
-}
-
-/* ************************************************************************* *
- | Interface to the generic audio driver |
- * ************************************************************************* */
-
-int vidcaudio_set_in_sr __P((void *, u_long));
-u_long vidcaudio_get_in_sr __P((void *));
-int vidcaudio_set_out_sr __P((void *, u_long));
-u_long vidcaudio_get_out_sr __P((void *));
-int vidcaudio_query_encoding __P((void *, struct audio_encoding *));
-int vidcaudio_set_encoding __P((void *, u_int));
-int vidcaudio_get_encoding __P((void *));
-int vidcaudio_set_precision __P((void *, u_int));
-int vidcaudio_getprecision __P((void *));
-int vidcaudio_set_channels __P((void *, int));
-int vidcaudio_get_channels __P((void *));
-int vidcaudio_round_blocksize __P((void *, int));
-int vidcaudio_set_out_port __P((void *, int));
-int vidcaudio_get_out_port __P((void *));
-int vidcaudio_set_in_port __P((void *, int));
-int vidcaudio_get_in_port __P((void *));
-int vidcaudio_commit_settings __P((void *));
-u_int vidcaudio_get_silence __P((int));
-void vidcaudio_sw_encode __P((int, u_char *, int));
-void vidcaudio_sw_decode __P((int, u_char *, int));
-int vidcaudio_start_output __P((void *, void *, int, void (*)(), void *));
-int vidcaudio_start_input __P((void *, void *, int, void (*)(), void *));
-int vidcaudio_halt_output __P((void *));
-int vidcaudio_halt_input __P((void *));
-int vidcaudio_cont_output __P((void *));
-int vidcaudio_cont_input __P((void *));
-int vidcaudio_speaker_ctl __P((void *, int));
-int vidcaudio_getdev __P((void *, struct audio_device *));
-int vidcaudio_setfd __P((void *, int));
-int vidcaudio_set_port __P((void *, mixer_ctrl_t *));
-int vidcaudio_get_port __P((void *, mixer_ctrl_t *));
-int vidcaudio_query_devinfo __P((void *, mixer_devinfo_t *));
-
-struct audio_device vidcaudio_device = {
- "VidcAudio 8-bit",
- "x",
- "vidcaudio"
-};
-
-int
-vidcaudio_set_in_sr(addr, sr)
- void *addr;
- u_long sr;
-{
- ag.in_sr = sr;
- return 0;
-}
-
-u_long
-vidcaudio_get_in_sr(addr)
- void *addr;
-{
- return ag.in_sr;
-}
-
-int
-vidcaudio_set_out_sr(addr, sr)
- void *addr;
- u_long sr;
-{
- ag.out_sr = sr;
- return 0;
-}
-
-u_long
-vidcaudio_get_out_sr(addr)
- void *addr;
-{
- return(ag.out_sr);
-}
-
-int vidcaudio_query_encoding ( void *addr, struct audio_encoding *fp )
-{
- switch ( fp->index )
- {
- case 0:
- strcpy (fp->name, "vidc" );
- fp->format_id = AUDIO_ENCODING_ULAW;
- break;
-
- default:
- return (EINVAL);
- }
- return 0;
-}
-
-int vidcaudio_set_encoding ( void *addr, u_int enc )
-{
- struct vidcaudio_softc *sc = addr;
-
- switch (enc)
- {
- case AUDIO_ENCODING_ULAW:
-#ifdef DEBUG
- printf ( "DEBUG: Set ulaw encoding\n" );
-#endif
- sc->encoding = enc;
- break;
-
- default:
- return (EINVAL);
- }
- return 0;
-}
-
-int vidcaudio_get_encoding ( void *addr )
-{
- struct vidcaudio_softc *sc = addr;
- return sc->encoding;
-}
-
-int vidcaudio_set_precision ( void *addr, u_int prec )
-{
- if (prec != 8)
- return EINVAL;
- return 0;
-}
-
-int vidcaudio_get_precision ( void *addr )
-{
- return (8);
-}
-
-int vidcaudio_set_channels ( void *addr, int chans )
-{
- if ( chans!=1 )
- return EINVAL;
-
- return 0;
-}
-
-int vidcaudio_get_channels ( void *addr )
-{
- return 1;
-}
-
-int vidcaudio_round_blocksize ( void *addr, int blk )
-{
- if (blk>NBPG) blk=NBPG;
- return blk;
-}
-
-int vidcaudio_set_out_port ( void *addr, int port )
-{
- struct vidcaudio_softc *sc = addr;
- sc->outport = port;
- return 0;
-}
-
-int vidcaudio_get_out_port ( void *addr )
-{
- struct vidcaudio_softc *sc = addr;
- return sc->outport;
-}
-
-int vidcaudio_set_in_port ( void *addr, int port )
-{
- struct vidcaudio_softc *sc = addr;
- sc->inport = port;
- return 0;
-}
-
-int vidcaudio_get_in_port ( void *addr )
-{
- struct vidcaudio_softc *sc = addr;
- return sc->inport;
-}
-
-int vidcaudio_commit_settings ( void *addr )
-{
-#ifdef DEBUG
-printf ( "DEBUG: committ_settings\n" );
-#endif
- return 0;
-}
-
-u_int vidcaudio_get_silence ( int enc )
-{
- switch (enc)
- {
- case AUDIO_ENCODING_ULAW:
- return 0x7f;
-
- default:
- return 0;
- }
- return 0;
-}
-
-void vidcaudio_sw_encode ( int e, u_char *p, int cc )
-{
-#ifdef DEBUG
- printf ( "DEBUG: sw_encode\n" );
-#endif
- return;
-}
-
-void vidcaudio_sw_decode ( int e, u_char *p, int cc )
-{
-#ifdef DEBUG
- printf ( "DEBUG: sw_decode\n" );
-#endif
-}
-
-#define ROUND(s) ( ((int)s) & (~(NBPG-1)) )
-
-int vidcaudio_start_output ( void *addr, void *p, int cc,
- void (*intr)(), void *arg )
-{
- /* I can only DMA inside 1 page */
-
-#ifdef DEBUG
- printf ( "vidcaudio_start_output (%d) %08x %08x\n", cc, intr, arg );
-#endif
-
- if ( ROUND(p) != ROUND(p+cc) )
- {
- /* If it's over a page I can fix it up by copying it into my buffer */
-
-#ifdef DEBUG
- printf ( "vidcaudio: DMA over page boundary requested. Fixing up\n" );
-#endif
- bcopy ( (char *)ag.silence, p, cc>NBPG ? NBPG : cc );
- p=(void *)ag.silence;
-
- /* I can't DMA any more than that, but it is possible to fix it up */
- /* by handling multiple buffers and only interrupting the audio */
- /* driver after sending out all the stuff it gave me. That it more */
- /* than I can be bothered to do right now and it probablly wont */
- /* happen so I'll just truncate the buffer and tell the user */
-
- if ( cc>NBPG )
- {
- printf ( "vidcaudio: DMA buffer truncated. I could fix this up\n" );
- cc=NBPG;
- }
- }
- vidcaudio_dma_program ( (vm_offset_t)p, (vm_offset_t)(p+cc), intr, arg );
- return 0;
-}
-
-int vidcaudio_start_input ( void *addr, void *p, int cc,
- void (*intr)(), void *arg )
-{
- return EIO;
-}
-
-int vidcaudio_halt_output ( void *addr )
-{
-#ifdef DEBUG
- printf ( "DEBUG: vidcaudio_halt_output\n" );
-#endif
- return EIO;
-}
-
-int vidcaudio_halt_input ( void *addr )
-{
-#ifdef DEBUG
- printf ( "DEBUG: vidcaudio_halt_output\n" );
-#endif
- return EIO;
-}
-
-int vidcaudio_cont_output ( void *addr )
-{
-#ifdef DEBUG
- printf ( "DEBUG: vidcaudio_halt_output\n" );
-#endif
- return EIO;
-}
-
-int vidcaudio_cont_input ( void *addr )
-{
-#ifdef DEBUG
- printf ( "DEBUG: vidcaudio_halt_output\n" );
-#endif
- return EIO;
-}
-
-int vidcaudio_speaker_ctl ( void *addr, int newstate )
-{
-#ifdef DEBUG
- printf ( "DEBUG: vidcaudio_speaker_ctl\n" );
-#endif
- return 0;
-}
-
-int vidcaudio_getdev ( void *addr, struct audio_device *retp )
-{
- *retp = vidcaudio_device;
- return 0;
-}
-
-
-int vidcaudio_setfd ( void *addr, int flag )
-{
- return ENOTTY;
-}
-
-int vidcaudio_set_port ( void *addr, mixer_ctrl_t *cp )
-{
- return EINVAL;
-}
-
-int vidcaudio_get_port ( void *addr, mixer_ctrl_t *cp )
-{
- return EINVAL;
-}
-
-int vidcaudio_query_devinfo ( void *addr, mixer_devinfo_t *dip )
-{
- return 0;
-}
-
-struct audio_hw_if vidcaudio_hw_if = {
- vidcaudio_open,
- vidcaudio_close,
- NULL,
- vidcaudio_set_in_sr,
- vidcaudio_get_in_sr,
- vidcaudio_set_out_sr,
- vidcaudio_get_out_sr,
- vidcaudio_query_encoding,
- vidcaudio_set_encoding,
- vidcaudio_get_encoding,
- vidcaudio_set_precision,
- vidcaudio_get_precision,
- vidcaudio_set_channels,
- vidcaudio_get_channels,
- vidcaudio_round_blocksize,
- vidcaudio_set_out_port,
- vidcaudio_get_out_port,
- vidcaudio_set_in_port,
- vidcaudio_get_in_port,
- vidcaudio_commit_settings,
- vidcaudio_get_silence,
- vidcaudio_sw_encode,
- vidcaudio_sw_decode,
- vidcaudio_start_output,
- vidcaudio_start_input,
- vidcaudio_halt_output,
- vidcaudio_halt_input,
- vidcaudio_cont_output,
- vidcaudio_cont_input,
- vidcaudio_speaker_ctl,
- vidcaudio_getdev,
- vidcaudio_setfd,
- vidcaudio_set_port,
- vidcaudio_get_port,
- vidcaudio_query_devinfo,
- 0, /* not full duplex */
- 0
-};
-
-void vidcaudio_dummy_routine ( void *arg )
-{
-#ifdef DEBUG
- printf ( "vidcaudio_dummy_routine\n" );
-#endif
-}
-
-int vidcaudio_hw_attach ( struct vidcaudio_softc *sc )
-{
- return ( audio_hardware_attach ( &vidcaudio_hw_if, sc ) );
-}
-
-int vidcaudio_rate ( int rate )
-{
- WriteWord ( VIDC_BASE, VIDC_SFR | rate );
- return 0;
-}
-
-int vidcaudio_stereo ( int channel, int position )
-{
- if ( channel<0 ) return EINVAL;
- if ( channel>7 ) return EINVAL;
- channel = channel<<24 | VIDC_SIR0;
- WriteWord ( VIDC_BASE, channel|position );
- return 0;
-}
-
-#define PHYS(x) (pmap_extract( kernel_pmap, ((x)&PG_FRAME) ))
-
-/*
- * Program the next buffer to be used
- * This function must be re-entrant, maximum re-entrancy of 2
- */
-
-#define FLAGS (0)
-
-int vidcaudio_dma_program ( vm_offset_t cur, vm_offset_t end,
- void (*intr)(), void *arg )
-{
- /* If there isn't a transfer in progress then start a new one */
- if ( ag.in_progress==0 )
- {
- ag.buffer = 0;
- WriteWord ( IOMD_SD0CR, 0x90 ); /* Reset State Machine */
- WriteWord ( IOMD_SD0CR, 0x30 ); /* Reset State Machine */
-
- WriteWord ( IOMD_SD0CURB, PHYS(cur) );
- WriteWord ( IOMD_SD0ENDB, PHYS(end-16)|FLAGS );
- WriteWord ( IOMD_SD0CURA, PHYS(cur) );
- WriteWord ( IOMD_SD0ENDA, PHYS(end-16)|FLAGS );
-
- ag.in_progress = 1;
-
- ag.next_cur = ag.next_end = 0;
- ag.next_intr = ag.next_arg = 0;
-
- ag.intr = intr;
- ag.arg = arg;
-
- /* The driver 'clicks' between buffer swaps, leading me to think */
- /* that the fifo is much small than on other sound cards. So */
- /* so I'm going to have to do some tricks here */
-
- (*ag.intr)(ag.arg); /* Schedule the next buffer */
- ag.intr = vidcaudio_dummy_routine; /* Already done this */
- ag.arg = NULL;
-
-#ifdef PRINT
-printf ( "vidcaudio: start output\n" );
-#endif
-#ifdef DEBUG
- printf ( "SE" );
-#endif
- enable_irq ( IRQ_DMASCH0 );
- }
- else
- {
- /* Otherwise schedule the next one */
- if ( ag.next_cur!=0 )
- {
- /* If there's one scheduled then complain */
- printf ( "vidcaudio: Buffer already Q'ed\n" );
- return EIO;
- }
- else
- {
- /* We're OK to schedule it now */
- ag.buffer = (++ag.buffer) & 1;
- ag.next_cur = PHYS(cur);
- ag.next_end = PHYS(end-16);
- ag.next_intr = intr;
- ag.next_arg = arg;
-#ifdef DEBUG
-printf ( "s" );
-#endif
- }
- }
- return 0;
-}
-
-void vidcaudio_shutdown ( void )
-{
- /* Shut down the channel */
- ag.intr = NULL;
- ag.in_progress = 0;
-#ifdef PRINT
-printf ( "vidcaudio: stop output\n" );
-#endif
- WriteWord ( IOMD_SD0CURB, ag.silence );
- WriteWord ( IOMD_SD0ENDB, (ag.silence + NBPG - 16) | (1<<30) );
- disable_irq ( IRQ_DMASCH0 );
-}
-
-int vidcaudio_intr ( void *arg )
-{
- int status = ReadByte(IOMD_SD0ST);
- void (*nintr)();
- void *narg;
- void (*xintr)();
- void *xarg;
- int xcur, xend;
- WriteWord ( IOMD_DMARQ, 0x10 );
-
-#ifdef PRINT
- printf ( "I" );
-#endif
-
- if ( ag.open==0 )
- {
- vidcaudio_shutdown ();
- return 0;
- }
-
- /* Have I got the generic audio device attached */
-
-#ifdef DEBUG
- printf ( "[B%01x]", status );
-#endif
-
- nintr=ag.intr;
- narg=ag.arg;
- ag.intr = NULL;
-
- xintr=ag.next_intr;
- xarg=ag.next_arg;
- xcur=ag.next_cur;
- xend=ag.next_end;
- ag.next_cur = 0;
- ag.intr = xintr;
- ag.arg = xarg;
-
- if ( nintr )
- {
-#ifdef DEBUG
- printf ( "i" );
-#endif
- (*nintr)(narg);
- }
-
- if ( xcur==0 )
- {
- vidcaudio_shutdown ();
- }
- else
- {
-#define OVERRUN (0x04)
-#define INTERRUPT (0x02)
-#define BANK_A (0x00)
-#define BANK_B (0x01)
- switch ( status&0x7 )
- {
- case (INTERRUPT|BANK_A):
-#ifdef PRINT
-printf( "B" );
-#endif
- WriteWord ( IOMD_SD0CURB, xcur );
- WriteWord ( IOMD_SD0ENDB, xend|FLAGS );
- break;
-
- case (INTERRUPT|BANK_B):
-#ifdef PRINT
-printf( "A" );
-#endif
- WriteWord ( IOMD_SD0CURA, xcur );
- WriteWord ( IOMD_SD0ENDA, xend|FLAGS );
- break;
-
- case (OVERRUN|INTERRUPT|BANK_A):
-#ifdef PRINT
-printf( "A" );
-#endif
- WriteWord ( IOMD_SD0CURA, xcur );
- WriteWord ( IOMD_SD0ENDA, xend|FLAGS );
- break;
-
- case (OVERRUN|INTERRUPT|BANK_B):
-#ifdef PRINT
-printf( "B" );
-#endif
- WriteWord ( IOMD_SD0CURB, xcur );
- WriteWord ( IOMD_SD0ENDB, xend|FLAGS );
- break;
- }
-/*
- ag.next_cur = 0;
- ag.intr = xintr;
- ag.arg = xarg;
-*/
- }
-#ifdef PRINT
-printf ( "i" );
-#endif
-
- if ( ag.next_cur==0 )
- {
- (*ag.intr)(ag.arg); /* Schedule the next buffer */
- ag.intr = vidcaudio_dummy_routine; /* Already done this */
- ag.arg = NULL;
- }
- return 0;
-}
-
-
diff --git a/sys/arch/arm32/mainbus/waveform.h b/sys/arch/arm32/mainbus/waveform.h
deleted file mode 100644
index 1508a71d2e3..00000000000
--- a/sys/arch/arm32/mainbus/waveform.h
+++ /dev/null
@@ -1,551 +0,0 @@
-/* $NetBSD: waveform.h,v 1.2 1996/03/18 20:50:06 mark Exp $ */
-
-/*
- * Copyright (c) 1994,1995 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-static unsigned char beep_waveform[] = {
- 0x00, 0x06, 0x18, 0x2a, 0x3e, 0x4a, 0x54, 0x60,
- 0x64, 0x68, 0x6a, 0x6a, 0x66, 0x62, 0x54, 0x3e,
- 0x00, 0x45, 0x61, 0x6f, 0x7f, 0x87, 0x8d, 0x91,
- 0x93, 0x95, 0x93, 0x91, 0x8b, 0x85, 0x73, 0x59,
- 0x00, 0x5c, 0x78, 0x8a, 0x96, 0xa0, 0xa6, 0xa8,
- 0xaa, 0xaa, 0xa8, 0xa6, 0xa2, 0x94, 0x86, 0x6a,
- 0x00, 0x6b, 0x8b, 0x9d, 0xa7, 0xaf, 0xb5, 0xb9,
- 0xbb, 0xbb, 0xb9, 0xb3, 0xad, 0xa5, 0x93, 0x77,
- 0x00, 0x78, 0x96, 0xa8, 0xb2, 0xbc, 0xc2, 0xc4,
- 0xc6, 0xc6, 0xc4, 0xc0, 0xb8, 0xac, 0x9e, 0x82,
- 0x00, 0x83, 0xa3, 0xb1, 0xbf, 0xc5, 0xcb, 0xcd,
- 0xcf, 0xcf, 0xcd, 0xc9, 0xc3, 0xb7, 0xa7, 0x89,
- 0x00, 0x88, 0xa8, 0xb8, 0xc4, 0xcc, 0xd0, 0xd4,
- 0xd6, 0xd4, 0xd2, 0xce, 0xc8, 0xbe, 0xac, 0x8e,
- 0x00, 0x8f, 0xaf, 0xc3, 0xcb, 0xd3, 0xd9, 0xdd,
- 0xdf, 0xdd, 0xdb, 0xd5, 0xcf, 0xc5, 0xb3, 0x95,
- 0x00, 0x96, 0xb4, 0xc6, 0xd0, 0xd8, 0xe0, 0xe2,
- 0xe4, 0xe2, 0xe2, 0xdc, 0xd2, 0xc8, 0xb8, 0x9a,
- 0x00, 0x9d, 0xbb, 0xcb, 0xd7, 0xe1, 0xe5, 0xe7,
- 0xe9, 0xe7, 0xe5, 0xe3, 0xd9, 0xcf, 0xbf, 0xa1,
- 0x00, 0xa2, 0xc0, 0xce, 0xdc, 0xe4, 0xe8, 0xea,
- 0xec, 0xea, 0xe8, 0xe4, 0xde, 0xd2, 0xc2, 0xa4,
- 0x00, 0xa5, 0xc5, 0xd5, 0xe3, 0xe7, 0xed, 0xef,
- 0xf1, 0xef, 0xed, 0xe9, 0xe3, 0xd7, 0xc7, 0xa9,
- 0x00, 0xa8, 0xc6, 0xd8, 0xe4, 0xea, 0xee, 0xf2,
- 0xf4, 0xf2, 0xf0, 0xec, 0xe6, 0xda, 0xc8, 0xaa,
- 0x00, 0xab, 0xcb, 0xdd, 0xe7, 0xef, 0xf3, 0xf7,
- 0xf9, 0xf7, 0xf5, 0xef, 0xe9, 0xdf, 0xcd, 0xaf,
- 0x00, 0xae, 0xcc, 0xe0, 0xea, 0xf0, 0xf6, 0xfa,
- 0xfc, 0xfa, 0xf8, 0xf2, 0xea, 0xe2, 0xd0, 0xb0,
- 0x00, 0xb1, 0xd1, 0xe3, 0xed, 0xf5, 0xfb, 0xff,
- 0xff, 0xff, 0xfb, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb4,
- 0x00, 0xb5, 0xd3, 0xe5, 0xef, 0xf7, 0xfd, 0xff,
- 0xff, 0xff, 0xfd, 0xf7, 0xef, 0xe5, 0xd3, 0xb5,
- 0x00, 0xb4, 0xd2, 0xe4, 0xee, 0xf6, 0xfc, 0xfe,
- 0xfe, 0xfe, 0xfc, 0xf6, 0xee, 0xe4, 0xd2, 0xb2,
- 0x00, 0xb3, 0xd3, 0xe5, 0xef, 0xf7, 0xfb, 0xff,
- 0xff, 0xff, 0xfb, 0xf5, 0xef, 0xe5, 0xd1, 0xb3,
- 0x00, 0xb2, 0xd0, 0xe4, 0xec, 0xf4, 0xfa, 0xfe,
- 0xfe, 0xfe, 0xfa, 0xf4, 0xec, 0xe4, 0xd0, 0xb2,
- 0x00, 0xb3, 0xd1, 0xe5, 0xed, 0xf5, 0xfb, 0xff,
- 0xff, 0xff, 0xfb, 0xf5, 0xed, 0xe5, 0xd1, 0xb3,
- 0x00, 0xb2, 0xd0, 0xe4, 0xec, 0xf4, 0xfa, 0xfc,
- 0xfe, 0xfc, 0xfa, 0xf4, 0xec, 0xe2, 0xd0, 0xb2,
- 0x00, 0xb3, 0xd1, 0xe3, 0xed, 0xf5, 0xf9, 0xfd,
- 0xff, 0xfd, 0xf9, 0xf5, 0xed, 0xe3, 0xd1, 0xb1,
- 0x00, 0xb0, 0xd0, 0xe2, 0xec, 0xf2, 0xf8, 0xfc,
- 0xfc, 0xfc, 0xf8, 0xf2, 0xec, 0xe2, 0xd0, 0xb0,
- 0x00, 0xb1, 0xcf, 0xe3, 0xed, 0xf3, 0xf9, 0xfd,
- 0xfd, 0xfd, 0xf9, 0xf3, 0xed, 0xe3, 0xcf, 0xb1,
- 0x00, 0xb0, 0xce, 0xe2, 0xea, 0xf2, 0xf8, 0xfa,
- 0xfc, 0xfa, 0xf8, 0xf2, 0xea, 0xe2, 0xce, 0xb0,
- 0x00, 0xb1, 0xcf, 0xe3, 0xeb, 0xf3, 0xf9, 0xfb,
- 0xfd, 0xfb, 0xf7, 0xf3, 0xeb, 0xe3, 0xcf, 0xb1,
- 0x00, 0xb0, 0xce, 0xe2, 0xea, 0xf2, 0xf6, 0xfa,
- 0xfa, 0xfa, 0xf6, 0xf2, 0xea, 0xe2, 0xce, 0xae,
- 0x00, 0xaf, 0xcf, 0xe3, 0xeb, 0xf1, 0xf7, 0xfb,
- 0xfb, 0xfb, 0xf7, 0xf1, 0xeb, 0xe1, 0xcf, 0xaf,
- 0x00, 0xae, 0xce, 0xe0, 0xea, 0xf0, 0xf6, 0xf8,
- 0xfa, 0xf8, 0xf6, 0xf0, 0xea, 0xe0, 0xcc, 0xae,
- 0x00, 0xaf, 0xcd, 0xe1, 0xeb, 0xf1, 0xf7, 0xf9,
- 0xfb, 0xf9, 0xf7, 0xf1, 0xe9, 0xe1, 0xcd, 0xaf,
- 0x00, 0xae, 0xcc, 0xe0, 0xe8, 0xf0, 0xf4, 0xf8,
- 0xf8, 0xf8, 0xf4, 0xf0, 0xe8, 0xe0, 0xcc, 0xae,
- 0x00, 0xaf, 0xcd, 0xe1, 0xe9, 0xf1, 0xf5, 0xf9,
- 0xf9, 0xf9, 0xf5, 0xf1, 0xe9, 0xdf, 0xcd, 0xad,
- 0x00, 0xac, 0xcc, 0xde, 0xe8, 0xee, 0xf4, 0xf6,
- 0xf8, 0xf6, 0xf4, 0xee, 0xe8, 0xde, 0xcc, 0xac,
- 0x00, 0xad, 0xcd, 0xdf, 0xe9, 0xef, 0xf5, 0xf7,
- 0xf9, 0xf7, 0xf5, 0xef, 0xe9, 0xdf, 0xcb, 0xad,
- 0x00, 0xac, 0xca, 0xde, 0xe8, 0xee, 0xf2, 0xf6,
- 0xf6, 0xf6, 0xf2, 0xee, 0xe8, 0xde, 0xca, 0xac,
- 0x00, 0xad, 0xcb, 0xdd, 0xe7, 0xef, 0xf3, 0xf7,
- 0xf7, 0xf7, 0xf3, 0xef, 0xe7, 0xdd, 0xcb, 0xad,
- 0x00, 0xac, 0xca, 0xdc, 0xe6, 0xee, 0xf2, 0xf4,
- 0xf6, 0xf4, 0xf2, 0xee, 0xe6, 0xdc, 0xca, 0xaa,
- 0x00, 0xab, 0xcb, 0xdd, 0xe7, 0xed, 0xf3, 0xf5,
- 0xf7, 0xf5, 0xf3, 0xed, 0xe7, 0xdd, 0xcb, 0xab,
- 0x00, 0xaa, 0xca, 0xdc, 0xe6, 0xec, 0xf2, 0xf4,
- 0xf4, 0xf4, 0xf0, 0xec, 0xe6, 0xda, 0xc8, 0xaa,
- 0x00, 0xab, 0xc9, 0xdb, 0xe7, 0xed, 0xf1, 0xf5,
- 0xf5, 0xf5, 0xf1, 0xed, 0xe7, 0xdb, 0xc9, 0xab,
- 0x00, 0xaa, 0xc8, 0xda, 0xe6, 0xec, 0xf0, 0xf4,
- 0xf4, 0xf2, 0xf0, 0xec, 0xe6, 0xda, 0xc8, 0xaa,
- 0x00, 0xab, 0xc9, 0xdb, 0xe5, 0xed, 0xf1, 0xf3,
- 0xf5, 0xf3, 0xf1, 0xeb, 0xe5, 0xdb, 0xc9, 0xa9,
- 0x00, 0xa8, 0xc8, 0xd8, 0xe4, 0xea, 0xf0, 0xf2,
- 0xf2, 0xf2, 0xf0, 0xea, 0xe4, 0xd8, 0xc8, 0xa8,
- 0x00, 0xa9, 0xc9, 0xd9, 0xe5, 0xeb, 0xef, 0xf3,
- 0xf3, 0xf3, 0xef, 0xeb, 0xe5, 0xd9, 0xc9, 0xa9,
- 0x00, 0xa8, 0xc6, 0xd8, 0xe4, 0xea, 0xee, 0xf2,
- 0xf2, 0xf2, 0xee, 0xea, 0xe4, 0xd8, 0xc6, 0xa8,
- 0x00, 0xa9, 0xc7, 0xd9, 0xe5, 0xeb, 0xef, 0xf1,
- 0xf3, 0xf1, 0xef, 0xeb, 0xe5, 0xd7, 0xc7, 0xa9,
- 0x00, 0xa8, 0xc6, 0xd6, 0xe4, 0xea, 0xee, 0xf0,
- 0xf0, 0xf0, 0xee, 0xe8, 0xe2, 0xd6, 0xc6, 0xa8,
- 0x00, 0xa7, 0xc7, 0xd7, 0xe3, 0xe9, 0xed, 0xf1,
- 0xf1, 0xf1, 0xed, 0xe9, 0xe3, 0xd7, 0xc7, 0xa7,
- 0x00, 0xa6, 0xc6, 0xd6, 0xe2, 0xe8, 0xec, 0xf0,
- 0xf0, 0xf0, 0xec, 0xe8, 0xe2, 0xd6, 0xc6, 0xa6,
- 0x00, 0xa7, 0xc5, 0xd7, 0xe3, 0xe9, 0xed, 0xef,
- 0xf1, 0xef, 0xed, 0xe9, 0xe3, 0xd5, 0xc5, 0xa7,
- 0x00, 0xa6, 0xc4, 0xd4, 0xe2, 0xe8, 0xec, 0xee,
- 0xee, 0xee, 0xec, 0xe8, 0xe2, 0xd4, 0xc4, 0xa6,
- 0x00, 0xa7, 0xc5, 0xd5, 0xe3, 0xe7, 0xed, 0xef,
- 0xef, 0xef, 0xeb, 0xe7, 0xe3, 0xd5, 0xc5, 0xa7,
- 0x00, 0xa6, 0xc4, 0xd4, 0xe0, 0xe6, 0xea, 0xee,
- 0xee, 0xee, 0xea, 0xe6, 0xe0, 0xd4, 0xc4, 0xa4,
- 0x00, 0xa5, 0xc5, 0xd3, 0xe1, 0xe7, 0xeb, 0xed,
- 0xef, 0xed, 0xeb, 0xe7, 0xe1, 0xd3, 0xc5, 0xa5,
- 0x00, 0xa4, 0xc4, 0xd2, 0xe0, 0xe6, 0xea, 0xec,
- 0xec, 0xec, 0xea, 0xe6, 0xe0, 0xd2, 0xc2, 0xa4,
- 0x00, 0xa5, 0xc3, 0xd3, 0xdf, 0xe7, 0xeb, 0xed,
- 0xed, 0xed, 0xeb, 0xe7, 0xdf, 0xd3, 0xc3, 0xa5,
- 0x00, 0xa4, 0xc2, 0xd2, 0xde, 0xe4, 0xe8, 0xec,
- 0xec, 0xec, 0xe8, 0xe4, 0xde, 0xd0, 0xc2, 0xa4,
- 0x00, 0xa5, 0xc3, 0xd1, 0xdf, 0xe5, 0xe9, 0xeb,
- 0xed, 0xeb, 0xe9, 0xe5, 0xdf, 0xd1, 0xc3, 0xa3,
- 0x00, 0xa2, 0xc2, 0xd0, 0xdc, 0xe4, 0xe8, 0xea,
- 0xea, 0xea, 0xe8, 0xe4, 0xdc, 0xd0, 0xc2, 0xa2,
- 0x00, 0xa3, 0xc3, 0xd1, 0xdd, 0xe5, 0xe9, 0xeb,
- 0xeb, 0xeb, 0xe9, 0xe5, 0xdd, 0xd1, 0xc1, 0xa3,
- 0x00, 0xa2, 0xc0, 0xce, 0xdc, 0xe4, 0xe6, 0xea,
- 0xea, 0xea, 0xe6, 0xe4, 0xda, 0xce, 0xc0, 0xa2,
- 0x00, 0xa3, 0xc1, 0xcf, 0xdb, 0xe3, 0xe7, 0xe9,
- 0xeb, 0xe9, 0xe7, 0xe3, 0xdb, 0xcf, 0xc1, 0xa3,
- 0x00, 0xa2, 0xc0, 0xce, 0xda, 0xe2, 0xe6, 0xe8,
- 0xe8, 0xe8, 0xe6, 0xe2, 0xda, 0xce, 0xbe, 0xa0,
- 0x00, 0xa1, 0xbf, 0xcf, 0xdb, 0xe3, 0xe7, 0xe9,
- 0xe9, 0xe9, 0xe7, 0xe3, 0xd9, 0xcd, 0xbf, 0xa1,
- 0x00, 0xa0, 0xbe, 0xcc, 0xd8, 0xe2, 0xe6, 0xe8,
- 0xe8, 0xe8, 0xe4, 0xe2, 0xd8, 0xcc, 0xbc, 0x9e,
- 0x00, 0x9f, 0xbd, 0xcd, 0xd9, 0xe3, 0xe5, 0xe7,
- 0xe9, 0xe7, 0xe5, 0xe1, 0xd9, 0xcd, 0xbd, 0x9f,
- 0x00, 0x9e, 0xbc, 0xcc, 0xd8, 0xe0, 0xe4, 0xe6,
- 0xe6, 0xe6, 0xe4, 0xe0, 0xd6, 0xcc, 0xbc, 0x9e,
- 0x00, 0x9f, 0xbd, 0xcd, 0xd7, 0xe1, 0xe5, 0xe7,
- 0xe7, 0xe7, 0xe5, 0xe1, 0xd7, 0xcb, 0xbb, 0x9d,
- 0x00, 0x9c, 0xba, 0xca, 0xd6, 0xde, 0xe4, 0xe6,
- 0xe6, 0xe6, 0xe4, 0xde, 0xd6, 0xca, 0xba, 0x9c,
- 0x00, 0x9d, 0xbb, 0xcb, 0xd5, 0xdf, 0xe3, 0xe5,
- 0xe7, 0xe5, 0xe3, 0xdf, 0xd5, 0xcb, 0xbb, 0x9d,
- 0x00, 0x9a, 0xb8, 0xca, 0xd4, 0xde, 0xe2, 0xe4,
- 0xe4, 0xe4, 0xe2, 0xdc, 0xd4, 0xca, 0xb8, 0x9a,
- 0x00, 0x9b, 0xb9, 0xc9, 0xd5, 0xdd, 0xe3, 0xe5,
- 0xe5, 0xe5, 0xe3, 0xdd, 0xd5, 0xc9, 0xb9, 0x9b,
- 0x00, 0x9a, 0xb8, 0xc8, 0xd2, 0xdc, 0xe2, 0xe4,
- 0xe4, 0xe4, 0xe2, 0xdc, 0xd2, 0xc8, 0xb6, 0x98,
- 0x00, 0x99, 0xb7, 0xc9, 0xd3, 0xdb, 0xe1, 0xe3,
- 0xe5, 0xe3, 0xe1, 0xdb, 0xd3, 0xc9, 0xb7, 0x99,
- 0x00, 0x98, 0xb6, 0xc8, 0xd2, 0xda, 0xe0, 0xe2,
- 0xe2, 0xe2, 0xe0, 0xda, 0xd2, 0xc6, 0xb6, 0x98,
- 0x00, 0x99, 0xb7, 0xc7, 0xd1, 0xd9, 0xdf, 0xe3,
- 0xe3, 0xe3, 0xdf, 0xd9, 0xd1, 0xc7, 0xb5, 0x97,
- 0x00, 0x96, 0xb4, 0xc6, 0xd0, 0xd8, 0xde, 0xe2,
- 0xe2, 0xe2, 0xde, 0xd8, 0xd0, 0xc6, 0xb4, 0x96,
- 0x00, 0x97, 0xb5, 0xc7, 0xd1, 0xd9, 0xdf, 0xe1,
- 0xe3, 0xe1, 0xdd, 0xd7, 0xcf, 0xc7, 0xb3, 0x95,
- 0x00, 0x94, 0xb2, 0xc4, 0xce, 0xd6, 0xdc, 0xe0,
- 0xe0, 0xe0, 0xdc, 0xd6, 0xce, 0xc4, 0xb2, 0x94,
- 0x00, 0x95, 0xb3, 0xc5, 0xcf, 0xd7, 0xdd, 0xdf,
- 0xe1, 0xdf, 0xdd, 0xd7, 0xcf, 0xc5, 0xb3, 0x95,
- 0x00, 0x94, 0xb2, 0xc4, 0xce, 0xd4, 0xda, 0xde,
- 0xde, 0xde, 0xda, 0xd4, 0xcc, 0xc4, 0xb0, 0x92,
- 0x00, 0x93, 0xb1, 0xc5, 0xcd, 0xd5, 0xdb, 0xdd,
- 0xdf, 0xdd, 0xdb, 0xd5, 0xcd, 0xc3, 0xb1, 0x93,
- 0x00, 0x92, 0xb0, 0xc2, 0xcc, 0xd4, 0xd8, 0xdc,
- 0xdc, 0xdc, 0xd8, 0xd2, 0xcc, 0xc2, 0xb0, 0x90,
- 0x00, 0x91, 0xaf, 0xc3, 0xcb, 0xd3, 0xd9, 0xdb,
- 0xdd, 0xdb, 0xd9, 0xd3, 0xcb, 0xc3, 0xaf, 0x91,
- 0x00, 0x90, 0xae, 0xc2, 0xca, 0xd2, 0xd6, 0xda,
- 0xda, 0xda, 0xd6, 0xd2, 0xca, 0xc2, 0xae, 0x90,
- 0x00, 0x91, 0xaf, 0xc3, 0xcb, 0xd1, 0xd7, 0xd9,
- 0xdb, 0xd9, 0xd7, 0xd1, 0xcb, 0xc1, 0xad, 0x8f,
- 0x00, 0x8e, 0xac, 0xc0, 0xc8, 0xd0, 0xd4, 0xd8,
- 0xd8, 0xd8, 0xd4, 0xd0, 0xc8, 0xc0, 0xac, 0x8e,
- 0x00, 0x8f, 0xad, 0xbf, 0xc9, 0xcf, 0xd5, 0xd7,
- 0xd9, 0xd7, 0xd5, 0xcf, 0xc9, 0xbf, 0xad, 0x8f,
- 0x00, 0x8c, 0xac, 0xbe, 0xc8, 0xce, 0xd2, 0xd6,
- 0xd6, 0xd6, 0xd2, 0xce, 0xc8, 0xbe, 0xaa, 0x8c,
- 0x00, 0x8d, 0xab, 0xbd, 0xc7, 0xcf, 0xd3, 0xd5,
- 0xd7, 0xd5, 0xd3, 0xcd, 0xc7, 0xbd, 0xab, 0x8d,
- 0x00, 0x8c, 0xaa, 0xbc, 0xc6, 0xcc, 0xd2, 0xd4,
- 0xd4, 0xd4, 0xd0, 0xcc, 0xc6, 0xba, 0xaa, 0x8a,
- 0x00, 0x8b, 0xa9, 0xbb, 0xc7, 0xcd, 0xd1, 0xd5,
- 0xd5, 0xd3, 0xd1, 0xcd, 0xc5, 0xbb, 0xa9, 0x8b,
- 0x00, 0x8a, 0xa8, 0xba, 0xc4, 0xca, 0xd0, 0xd2,
- 0xd2, 0xd2, 0xd0, 0xca, 0xc4, 0xb8, 0xa8, 0x8a,
- 0x00, 0x8b, 0xa9, 0xb9, 0xc5, 0xcb, 0xcf, 0xd3,
- 0xd3, 0xd1, 0xcf, 0xcb, 0xc5, 0xb9, 0xa7, 0x89,
- 0x00, 0x88, 0xa6, 0xb8, 0xc4, 0xca, 0xce, 0xd0,
- 0xd0, 0xd0, 0xce, 0xc8, 0xc2, 0xb6, 0xa6, 0x88,
- 0x00, 0x89, 0xa7, 0xb7, 0xc3, 0xc9, 0xcd, 0xd1,
- 0xd1, 0xcf, 0xcd, 0xc9, 0xc3, 0xb7, 0xa7, 0x87,
- 0x00, 0x86, 0xa6, 0xb4, 0xc2, 0xc8, 0xcc, 0xce,
- 0xce, 0xce, 0xcc, 0xc8, 0xc2, 0xb4, 0xa4, 0x86,
- 0x00, 0x87, 0xa5, 0xb5, 0xc3, 0xc7, 0xcb, 0xcf,
- 0xcf, 0xcf, 0xcb, 0xc7, 0xc1, 0xb5, 0xa5, 0x87,
- 0x00, 0x86, 0xa4, 0xb2, 0xc0, 0xc6, 0xca, 0xcc,
- 0xcc, 0xcc, 0xca, 0xc6, 0xc0, 0xb2, 0xa2, 0x84,
- 0x00, 0x85, 0xa3, 0xb3, 0xbf, 0xc5, 0xc9, 0xcd,
- 0xcd, 0xcd, 0xc9, 0xc5, 0xbf, 0xb1, 0xa3, 0x85,
- 0x00, 0x84, 0xa2, 0xb0, 0xbc, 0xc4, 0xc8, 0xca,
- 0xca, 0xca, 0xc8, 0xc4, 0xbc, 0xb0, 0xa2, 0x82,
- 0x00, 0x83, 0xa3, 0xb1, 0xbd, 0xc5, 0xc7, 0xcb,
- 0xcb, 0xcb, 0xc7, 0xc3, 0xbb, 0xaf, 0xa1, 0x83,
- 0x00, 0x82, 0xa0, 0xae, 0xba, 0xc2, 0xc6, 0xc8,
- 0xc8, 0xc8, 0xc6, 0xc2, 0xba, 0xae, 0x9e, 0x82,
- 0x00, 0x83, 0x9f, 0xaf, 0xb9, 0xc3, 0xc7, 0xc9,
- 0xc9, 0xc9, 0xc5, 0xc3, 0xb9, 0xad, 0x9f, 0x81,
- 0x00, 0x80, 0x9c, 0xac, 0xb8, 0xc0, 0xc4, 0xc6,
- 0xc6, 0xc6, 0xc4, 0xc0, 0xb6, 0xac, 0x9c, 0x7e,
- 0x00, 0x7f, 0x9d, 0xab, 0xb7, 0xbf, 0xc5, 0xc7,
- 0xc7, 0xc7, 0xc5, 0xbf, 0xb7, 0xab, 0x9b, 0x7d,
- 0x00, 0x7c, 0x9a, 0xaa, 0xb4, 0xbe, 0xc2, 0xc4,
- 0xc4, 0xc4, 0xc2, 0xbc, 0xb4, 0xaa, 0x98, 0x7c,
- 0x00, 0x7d, 0x99, 0xa9, 0xb5, 0xbd, 0xc3, 0xc5,
- 0xc5, 0xc5, 0xc3, 0xbb, 0xb3, 0xa9, 0x99, 0x7b,
- 0x00, 0x7a, 0x96, 0xa8, 0xb2, 0xba, 0xc0, 0xc2,
- 0xc2, 0xc2, 0xc0, 0xba, 0xb0, 0xa6, 0x96, 0x78,
- 0x00, 0x79, 0x97, 0xa7, 0xb1, 0xb9, 0xbf, 0xc3,
- 0xc3, 0xc3, 0xbf, 0xb9, 0xb1, 0xa7, 0x95, 0x77,
- 0x00, 0x76, 0x94, 0xa6, 0xae, 0xb6, 0xbc, 0xc0,
- 0xc0, 0xc0, 0xbc, 0xb6, 0xae, 0xa4, 0x92, 0x76,
- 0x00, 0x75, 0x93, 0xa5, 0xaf, 0xb5, 0xbb, 0xbf,
- 0xbf, 0xbf, 0xbb, 0xb5, 0xad, 0xa5, 0x91, 0x75,
- 0x00, 0x74, 0x90, 0xa4, 0xac, 0xb4, 0xb8, 0xbc,
- 0xbc, 0xbc, 0xb8, 0xb2, 0xac, 0xa2, 0x90, 0x72,
- 0x00, 0x73, 0x91, 0xa3, 0xab, 0xb3, 0xb7, 0xbb,
- 0xbb, 0xbb, 0xb7, 0xb1, 0xab, 0xa3, 0x8f, 0x71,
- 0x00, 0x70, 0x8e, 0xa0, 0xaa, 0xb0, 0xb4, 0xb8,
- 0xb8, 0xb8, 0xb4, 0xb0, 0xa8, 0xa0, 0x8c, 0x6e,
- 0x00, 0x6f, 0x8d, 0x9f, 0xa9, 0xaf, 0xb5, 0xb7,
- 0xb7, 0xb7, 0xb3, 0xaf, 0xa9, 0x9f, 0x8b, 0x6f,
- 0x00, 0x6e, 0x8a, 0x9c, 0xa6, 0xac, 0xb2, 0xb4,
- 0xb4, 0xb4, 0xb0, 0xac, 0xa6, 0x9a, 0x8a, 0x6c,
- 0x00, 0x6d, 0x89, 0x9b, 0xa5, 0xab, 0xb1, 0xb3,
- 0xb3, 0xb3, 0xaf, 0xab, 0xa5, 0x99, 0x89, 0x6b,
- 0x00, 0x6a, 0x88, 0x98, 0xa4, 0xaa, 0xae, 0xb0,
- 0xb0, 0xb0, 0xae, 0xa8, 0xa2, 0x96, 0x86, 0x68,
- 0x00, 0x69, 0x87, 0x97, 0xa3, 0xa9, 0xad, 0xaf,
- 0xaf, 0xaf, 0xad, 0xa7, 0xa3, 0x95, 0x85, 0x69,
- 0x00, 0x66, 0x84, 0x94, 0xa0, 0xa6, 0xaa, 0xac,
- 0xac, 0xac, 0xaa, 0xa6, 0x9e, 0x92, 0x84, 0x66,
- 0x00, 0x67, 0x83, 0x93, 0x9f, 0xa5, 0xa9, 0xab,
- 0xab, 0xab, 0xa9, 0xa5, 0x9d, 0x91, 0x83, 0x65,
- 0x00, 0x64, 0x82, 0x8e, 0x9a, 0xa2, 0xa6, 0xa8,
- 0xa8, 0xa8, 0xa6, 0xa2, 0x9a, 0x8e, 0x80, 0x62,
- 0x00, 0x63, 0x7f, 0x8d, 0x99, 0xa1, 0xa5, 0xa7,
- 0xa7, 0xa7, 0xa5, 0xa1, 0x97, 0x8d, 0x7d, 0x61,
- 0x00, 0x60, 0x7c, 0x8a, 0x94, 0x9e, 0xa2, 0xa4,
- 0xa4, 0xa4, 0xa2, 0x9c, 0x94, 0x8a, 0x7a, 0x5e,
- 0x00, 0x5f, 0x79, 0x89, 0x93, 0x9b, 0xa1, 0xa3,
- 0xa3, 0xa3, 0xa1, 0x9b, 0x91, 0x87, 0x77, 0x5b,
- 0x00, 0x5a, 0x76, 0x86, 0x90, 0x96, 0x9c, 0xa0,
- 0xa0, 0xa0, 0x9c, 0x96, 0x8e, 0x84, 0x72, 0x58,
- 0x00, 0x59, 0x73, 0x85, 0x8d, 0x95, 0x99, 0x9d,
- 0x9d, 0x9d, 0x99, 0x93, 0x8d, 0x83, 0x71, 0x55,
- 0x00, 0x54, 0x70, 0x82, 0x8a, 0x90, 0x96, 0x98,
- 0x98, 0x98, 0x94, 0x90, 0x88, 0x80, 0x6c, 0x52,
- 0x00, 0x51, 0x6d, 0x7f, 0x87, 0x8d, 0x93, 0x95,
- 0x95, 0x95, 0x91, 0x8d, 0x87, 0x7b, 0x6b, 0x4f,
- 0x00, 0x4e, 0x6a, 0x7a, 0x84, 0x8a, 0x8e, 0x90,
- 0x90, 0x90, 0x8c, 0x88, 0x82, 0x76, 0x66, 0x4a,
- 0x00, 0x4b, 0x67, 0x75, 0x83, 0x87, 0x8b, 0x8d,
- 0x8d, 0x8d, 0x8b, 0x87, 0x7f, 0x73, 0x65, 0x49,
- 0x00, 0x48, 0x62, 0x70, 0x7c, 0x82, 0x86, 0x88,
- 0x88, 0x88, 0x86, 0x82, 0x78, 0x6e, 0x60, 0x44,
- 0x00, 0x45, 0x5f, 0x6d, 0x77, 0x7f, 0x83, 0x85,
- 0x85, 0x85, 0x83, 0x7d, 0x75, 0x6b, 0x5b, 0x43,
- 0x00, 0x42, 0x58, 0x68, 0x70, 0x78, 0x7c, 0x80,
- 0x80, 0x7e, 0x7c, 0x76, 0x6e, 0x64, 0x54, 0x3c,
- 0x00, 0x3d, 0x53, 0x63, 0x6b, 0x73, 0x77, 0x79,
- 0x79, 0x79, 0x75, 0x6f, 0x69, 0x61, 0x4f, 0x37,
- 0x00, 0x34, 0x4c, 0x5c, 0x66, 0x6a, 0x6e, 0x70,
- 0x70, 0x70, 0x6c, 0x68, 0x62, 0x56, 0x48, 0x30,
- 0x00, 0x2f, 0x47, 0x55, 0x5f, 0x65, 0x67, 0x69,
- 0x69, 0x69, 0x65, 0x63, 0x59, 0x4f, 0x43, 0x2b,
- 0x00, 0x28, 0x40, 0x4a, 0x52, 0x5a, 0x5e, 0x60,
- 0x60, 0x5e, 0x5a, 0x54, 0x4c, 0x44, 0x36, 0x22,
- 0x00, 0x23, 0x33, 0x43, 0x49, 0x4d, 0x4f, 0x51,
- 0x51, 0x4f, 0x4d, 0x47, 0x43, 0x37, 0x2b, 0x19,
- 0x00, 0x16, 0x26, 0x30, 0x36, 0x3c, 0x40, 0x40,
- 0x40, 0x3c, 0x38, 0x32, 0x2c, 0x24, 0x1a, 0x0c,
- 0x00, 0x0b, 0x15, 0x1b, 0x21, 0x23, 0x23, 0x21,
- 0x1f, 0x19, 0x15, 0x0f, 0x09, 0x05, 0x03, 0x00,
-};
-
-/* End of waveform.h */
diff --git a/sys/arch/arm32/mainbus/wd.c b/sys/arch/arm32/mainbus/wd.c
deleted file mode 100644
index c1540197729..00000000000
--- a/sys/arch/arm32/mainbus/wd.c
+++ /dev/null
@@ -1,1765 +0,0 @@
-/* $NetBSD: wd.c,v 1.6 1996/03/28 21:52:52 mark Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
- *
- * DMA and multi-sector PIO handling are derived from code contributed by
- * Onno van der Linden.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles M. Hannum.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/buf.h>
-#include <sys/uio.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-#include <sys/disk.h>
-#include <sys/syslog.h>
-
-#include <vm/vm.h>
-
-#include <machine/cpu.h>
-
-#include <arm32/mainbus/wdreg.h>
-#include <arm32/mainbus/mainbus.h>
-#include <machine/irqhandler.h>
-#include <machine/io.h>
-#include <machine/katelib.h>
-
-extern int wdresethack;
-
-#define WAITTIME (4 * hz) /* time to wait for a completion */
-#define RECOVERYTIME (hz / 2) /* time to recover from an error */
-
-#define WDCDELAY 100
-#define WDCNDELAY 100000 /* delay = 100us; so 10s for a controller state change */
-#if 0
-/* If you enable this, it will report any delays more than 100us * N long. */
-#define WDCNDELAY_DEBUG 10
-#endif
-
-#define WDIORETRIES 5 /* number of retries before giving up */
-
-#define WDUNIT(dev) DISKUNIT(dev)
-#define WDPART(dev) DISKPART(dev)
-#define MAKEWDDEV(maj, unit, part) MAKEDISKDEV(maj, unit, part)
-
-#define WDLABELDEV(dev) (MAKEWDDEV(major(dev), WDUNIT(dev), RAW_PART))
-
-struct wd_softc {
- struct device sc_dev;
- struct disk sc_dk;
-
- /* Information about the current transfer: */
- daddr_t sc_blkno; /* starting block number */
- int sc_bcount; /* byte count left */
- int sc_skip; /* bytes already transferred */
- int sc_nblks; /* number of blocks currently transferring */
- int sc_nbytes; /* number of bytes currently transferring */
-
- /* Long-term state: */
- int sc_drive; /* physical unit number */
- int sc_state; /* control state */
-#define RECAL 0 /* recalibrate */
-#define RECAL_WAIT 1 /* done recalibrating */
-#define GEOMETRY 2 /* upload geometry */
-#define GEOMETRY_WAIT 3 /* done uploading geometry */
-#define MULTIMODE 4 /* set multiple mode */
-#define MULTIMODE_WAIT 5 /* done setting multiple mode */
-#define OPEN 6 /* done with open */
- int sc_mode; /* transfer mode */
-#define WDM_PIOSINGLE 0 /* single-sector PIO */
-#define WDM_PIOMULTI 1 /* multi-sector PIO */
-#define WDM_DMA 2 /* DMA */
- int sc_multiple; /* multiple for WDM_PIOMULTI */
- int sc_flags; /* drive characteistics found */
-#define WDF_LOCKED 0x01
-#define WDF_WANTED 0x02
-#define WDF_WLABEL 0x04 /* label is writable */
-#define WDF_LABELLING 0x08 /* writing label */
-/* XXX Nothing resets this yet, but disk change sensing will when ATAPI is
- implemented. */
-#define WDF_LOADED 0x10 /* parameters loaded */
-#define WDF_32BIT 0x20 /* can do 32-bit transfer */
-
- struct wdparams sc_params; /* ESDI/ATA drive parameters */
- daddr_t sc_badsect[127]; /* 126 plus trailing -1 marker */
-
- TAILQ_ENTRY(wd_softc) sc_drivechain;
- struct buf sc_q;
-};
-
-struct wdc_softc {
- struct device sc_dev;
- irqhandler_t sc_ih;
-
- int sc_iobase; /* I/O port base */
- int sc_drq; /* DMA channel */
-
- TAILQ_HEAD(drivehead, wd_softc) sc_drives;
- int sc_flags;
-#define WDCF_ACTIVE 0x01 /* controller is active */
-#define WDCF_SINGLE 0x02 /* sector at a time mode */
-#define WDCF_ERROR 0x04 /* processing a disk error */
-#define WDCF_WANTED 0x08 /* XXX locking for wd_get_parms() */
- int sc_errors; /* errors during current transfer */
- u_char sc_status; /* copy of status register */
- u_char sc_error; /* copy of error register */
-};
-
-int wdcprobe __P((struct device *, void *, void *));
-void wdcattach __P((struct device *, struct device *, void *));
-
-struct cfattach wdc_ca = {
- sizeof(struct wdc_softc), wdcprobe, wdcattach
-};
-
-struct cfdriver wdc_cd = {
- NULL, "wdc", DV_DULL
-};
-
-int wdprobe __P((struct device *, void *, void *));
-void wdattach __P((struct device *, struct device *, void *));
-
-struct cfattach wd_ca = {
- sizeof(struct wd_softc), wdprobe, wdattach
-};
-
-struct cfdriver wd_cd = {
- NULL, "wd", DV_DISK
-};
-
-void wdgetdisklabel __P((struct wd_softc *));
-int wd_get_parms __P((struct wd_softc *));
-void wdstrategy __P((struct buf *));
-void wdstart __P((struct wd_softc *));
-
-struct dkdriver wddkdriver = { wdstrategy };
-
-void wdfinish __P((struct wd_softc *, struct buf *));
-int wdcintr __P((void *));
-void wdcstart __P((struct wdc_softc *));
-int wdcommand __P((struct wd_softc *, int, int, int, int, int));
-int wdcommandshort __P((struct wdc_softc *, int, int));
-int wdcontrol __P((struct wd_softc *));
-int wdsetctlr __P((struct wd_softc *));
-static void bad144intern __P((struct wd_softc *));
-int wdcreset __P((struct wdc_softc *));
-void wdcrestart __P((void *arg));
-void wdcunwedge __P((struct wdc_softc *));
-void wdctimeout __P((void *arg));
-void wderror __P((void *, struct buf *, char *));
-int wdcwait __P((struct wdc_softc *, int));
-/* ST506 spec says that if READY or SEEKCMPLT go off, then the read or write
- command is aborted. */
-#define wait_for_drq(d) wdcwait(d, WDCS_DRDY | WDCS_DSC | WDCS_DRQ)
-#define wait_for_ready(d) wdcwait(d, WDCS_DRDY | WDCS_DSC)
-#define wait_for_unbusy(d) wdcwait(d, 0)
-
-int
-wdcprobe(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct wdc_softc *wdc = match;
- struct mainbus_attach_args *mb = aux;
- int iobase;
-
- wdc->sc_iobase = iobase = mb->mb_iobase;
-
- /* Check if we have registers that work. */
- outb(iobase+wd_error, 0x5a); /* Error register not writable, */
- outb(iobase+wd_cyl_lo, 0xa5); /* but all of cyllo are. */
- if (inb(iobase+wd_error) == 0x5a || inb(iobase+wd_cyl_lo) != 0xa5)
- return 0;
-
- if (wdcreset(wdc) != 0) {
- delay(500000);
- if (wdcreset(wdc) != 0)
- return 0;
- }
-
- /* Select drive 0. */
- outb(iobase+wd_sdh, WDSD_IBM | 0);
-
- /* Wait for controller to become ready. */
- if (wait_for_unbusy(wdc) < 0)
- return 0;
-
- /* Start drive diagnostics. */
- outb(iobase+wd_command, WDCC_DIAGNOSE);
-
- /* Wait for command to complete. */
- if (wait_for_unbusy(wdc) < 0)
- return 0;
-
- mb->mb_iosize = 32;
- return 1;
-}
-
-struct wdc_attach_args {
- int wa_drive;
-};
-
-int
-wdprint(aux, wdc)
- void *aux;
- const char *wdc;
-{
- struct wdc_attach_args *wa = aux;
-
- if (!wdc)
- printf(" drive %d", wa->wa_drive);
- return QUIET;
-}
-
-void
-wdcattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct wdc_softc *wdc = (void *)self;
- struct mainbus_attach_args *mb = aux;
- struct wdc_attach_args wa;
-
- TAILQ_INIT(&wdc->sc_drives);
- wdc->sc_drq = mb->mb_drq;
-
- printf("\n");
-
- wdc->sc_ih.ih_func = wdcintr;
- wdc->sc_ih.ih_arg = wdc;
- wdc->sc_ih.ih_level = IPL_BIO;
- wdc->sc_ih.ih_name = "wdc";
- if (irq_claim(mb->mb_irq, &wdc->sc_ih))
- panic("Cannot claim IRQ %d for wdc%d", mb->mb_irq, parent->dv_unit);
-
- for (wa.wa_drive = 0; wa.wa_drive < 2; wa.wa_drive++)
- (void)config_found(self, (void *)&wa, wdprint);
-}
-
-int
-wdprobe(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct wdc_softc *wdc = (void *)parent;
- struct cfdata *cf = match;
- struct wdc_attach_args *wa = aux;
- int drive = wa->wa_drive;
-
- if (cf->cf_loc[0] != -1 && cf->cf_loc[0] != drive)
- return 0;
-
- if (wdcommandshort(wdc, drive, WDCC_RECAL) != 0 ||
- wait_for_ready(wdc) != 0)
- return 0;
-
- return 1;
-}
-
-void
-wdattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct wd_softc *wd = (void *)self;
- struct wdc_softc *wdc = (void *)parent;
- struct wdc_attach_args *wa = aux;
- int i, blank;
- char buf[41], c, *p, *q;
-
- wd->sc_drive = wa->wa_drive;
-
- /*
- * Initialize and attach the disk structure.
- */
- wd->sc_dk.dk_driver = &wddkdriver;
- wd->sc_dk.dk_name = wd->sc_dev.dv_xname;
- disk_attach(&wd->sc_dk);
-
- wd_get_parms(wd);
- for (blank = 0, p = wd->sc_params.wdp_model, q = buf, i = 0;
- i < sizeof(wd->sc_params.wdp_model); i++) {
- c = *p++;
- if (c == '\0')
- break;
- if (c != ' ') {
- if (blank) {
- *q++ = ' ';
- blank = 0;
- }
- *q++ = c;
- } else
- blank = 1;
- }
- *q++ = '\0';
-
- printf(": %dMB, %d cyl, %d head, %d sec, %d bytes/sec <%s>\n",
- wd->sc_params.wdp_cylinders *
- (wd->sc_params.wdp_heads * wd->sc_params.wdp_sectors) /
- (1048576 / DEV_BSIZE),
- wd->sc_params.wdp_cylinders,
- wd->sc_params.wdp_heads,
- wd->sc_params.wdp_sectors,
- DEV_BSIZE,
- buf);
-
- if ((wd->sc_params.wdp_capabilities & WD_CAP_DMA) != 0 &&
- wdc->sc_drq != DRQUNK) {
- wd->sc_mode = WDM_DMA;
- } else if (wd->sc_params.wdp_maxmulti > 1) {
- wd->sc_mode = WDM_PIOMULTI;
- wd->sc_multiple = min(wd->sc_params.wdp_maxmulti, 16);
- } else {
- wd->sc_mode = WDM_PIOSINGLE;
- wd->sc_multiple = 1;
- }
-
- printf("%s: using", wd->sc_dev.dv_xname);
- if (wd->sc_mode == WDM_DMA)
- printf(" dma transfers,");
- else
- printf(" %d-sector %d-bit pio transfers,",
- wd->sc_multiple, (wd->sc_flags & WDF_32BIT) == 0 ? 16 : 32);
- if ((wd->sc_params.wdp_capabilities & WD_CAP_LBA) != 0)
- printf(" lba addressing\n");
- else
- printf(" chs addressing\n");
-}
-
-/*
- * Read/write routine for a buffer. Validates the arguments and schedules the
- * transfer. Does not wait for the transfer to complete.
- */
-void
-wdstrategy(bp)
- struct buf *bp;
-{
- struct wd_softc *wd = wd_cd.cd_devs[WDUNIT(bp->b_dev)];
- int s;
-
- /* Valid request? */
- if (bp->b_blkno < 0 ||
- (bp->b_bcount % wd->sc_dk.dk_label->d_secsize) != 0 ||
- (bp->b_bcount / wd->sc_dk.dk_label->d_secsize) >= (1 << NBBY)) {
- bp->b_error = EINVAL;
- goto bad;
- }
-
- /* If device invalidated (e.g. media change, door open), error. */
- if ((wd->sc_flags & WDF_LOADED) == 0) {
- bp->b_error = EIO;
- goto bad;
- }
-
- /* If it's a null transfer, return immediately. */
- if (bp->b_bcount == 0)
- goto done;
-
- /*
- * Do bounds checking, adjust transfer. if error, process.
- * If end of partition, just return.
- */
- if (WDPART(bp->b_dev) != RAW_PART &&
- bounds_check_with_label(bp, wd->sc_dk.dk_label,
- wd->sc_dk.dk_cpulabel,
- (wd->sc_flags & (WDF_WLABEL|WDF_LABELLING)) != 0) <= 0)
- goto done;
-
- /* Queue transfer on drive, activate drive and controller if idle. */
- s = splbio();
- disksort(&wd->sc_q, bp);
- if (!wd->sc_q.b_active)
- wdstart(wd);
-#if 0
- else {
- struct wdc_softc *wdc = (void *)wd->sc_dev.dv_parent;
- if ((wdc->sc_flags & (WDCF_ACTIVE|WDCF_ERROR)) == 0) {
- printf("wdstrategy: controller inactive\n");
- wdcstart(wdc);
- }
- }
-#endif
- splx(s);
- return;
-
-bad:
- bp->b_flags |= B_ERROR;
-done:
- /* Toss transfer; we're done early. */
- bp->b_resid = bp->b_bcount;
- biodone(bp);
-}
-
-/*
- * Queue a drive for I/O.
- */
-void
-wdstart(wd)
- struct wd_softc *wd;
-{
- struct wdc_softc *wdc = (void *)wd->sc_dev.dv_parent;
- int active = wdc->sc_drives.tqh_first != 0;
-
- /* Link onto controller queue. */
- wd->sc_q.b_active = 1;
- TAILQ_INSERT_TAIL(&wdc->sc_drives, wd, sc_drivechain);
-
- disk_busy(&wd->sc_dk);
-
- /* If controller not already active, start it. */
- if (!active)
- wdcstart(wdc);
-}
-
-/*
- * Finish an I/O operation. Clean up the drive and controller state, set the
- * residual count, and inform the upper layers that the operation is complete.
- */
-void
-wdfinish(wd, bp)
- struct wd_softc *wd;
- struct buf *bp;
-{
- struct wdc_softc *wdc = (void *)wd->sc_dev.dv_parent;
-
- wdc->sc_flags &= ~(WDCF_SINGLE | WDCF_ERROR);
- wdc->sc_errors = 0;
- /*
- * Move this drive to the end of the queue to give others a `fair'
- * chance.
- */
- if (wd->sc_drivechain.tqe_next) {
- TAILQ_REMOVE(&wdc->sc_drives, wd, sc_drivechain);
- if (bp->b_actf) {
- TAILQ_INSERT_TAIL(&wdc->sc_drives, wd, sc_drivechain);
- } else
- wd->sc_q.b_active = 0;
- }
- bp->b_resid = wd->sc_bcount;
- wd->sc_skip = 0;
- wd->sc_q.b_actf = bp->b_actf;
-
- disk_unbusy(&wd->sc_dk, (bp->b_bcount - bp->b_resid));
-
- if (!wd->sc_q.b_actf) {
- TAILQ_REMOVE(&wdc->sc_drives, wd, sc_drivechain);
- wd->sc_q.b_active = 0;
- } else
- disk_busy(&wd->sc_dk);
-
- biodone(bp);
-}
-
-int
-wdread(dev, uio)
- dev_t dev;
- struct uio *uio;
-{
-
- return (physio(wdstrategy, NULL, dev, B_READ, minphys, uio));
-}
-
-int
-wdwrite(dev, uio)
- dev_t dev;
- struct uio *uio;
-{
-
- return (physio(wdstrategy, NULL, dev, B_WRITE, minphys, uio));
-}
-
-/*
- * Start I/O on a controller. This does the calculation, and starts a read or
- * write operation. Called to from wdstart() to start a transfer, from
- * wdcintr() to continue a multi-sector transfer or start the next transfer, or
- * wdcrestart() after recovering from an error.
- */
-void
-wdcstart(wdc)
- struct wdc_softc *wdc;
-{
- struct wd_softc *wd;
- struct buf *bp;
- struct disklabel *lp;
- int nblks;
-
-#ifdef DIAGNOSTIC
- if ((wdc->sc_flags & WDCF_ACTIVE) != 0)
- panic("wdcstart: controller still active");
-#endif
-
- /*
- * XXX
- * This is a kluge. See comments in wd_get_parms().
- */
- if ((wdc->sc_flags & WDCF_WANTED) != 0) {
- wdc->sc_flags &= ~WDCF_WANTED;
- wakeup(wdc);
- return;
- }
-
-loop:
- /* Is there a drive for the controller to do a transfer with? */
- wd = wdc->sc_drives.tqh_first;
- if (wd == NULL)
- return;
-
- /* Is there a transfer to this drive? If not, deactivate drive. */
- bp = wd->sc_q.b_actf;
-
- if (wdc->sc_errors >= WDIORETRIES) {
- wderror(wd, bp, "hard error");
- bp->b_error = EIO;
- bp->b_flags |= B_ERROR;
- wdfinish(wd, bp);
- goto loop;
- }
-
- /* Do control operations specially. */
- if (wd->sc_state < OPEN) {
- /*
- * Actually, we want to be careful not to mess with the control
- * state if the device is currently busy, but we can assume
- * that we never get to this point if that's the case.
- */
- if (wdcontrol(wd) == 0) {
- /* The drive is busy. Wait. */
- return;
- }
- }
-
- /*
- * WDCF_ERROR is set by wdcunwedge() and wdcintr() when an error is
- * encountered. If we are in multi-sector mode, then we switch to
- * single-sector mode and retry the operation from the start.
- */
- if (wdc->sc_flags & WDCF_ERROR) {
- wdc->sc_flags &= ~WDCF_ERROR;
- if ((wdc->sc_flags & WDCF_SINGLE) == 0) {
- wdc->sc_flags |= WDCF_SINGLE;
- wd->sc_skip = 0;
- }
- }
-
- lp = wd->sc_dk.dk_label;
-
- /* When starting a transfer... */
- if (wd->sc_skip == 0) {
- int part = WDPART(bp->b_dev);
- daddr_t blkno;
-
-#ifdef WDDEBUG
- printf("\n%s: wdcstart %s %d@%d; map ", wd->sc_dev.dv_xname,
- (bp->b_flags & B_READ) ? "read" : "write", bp->b_bcount,
- bp->b_blkno);
-#endif
- wd->sc_bcount = bp->b_bcount;
- blkno = bp->b_blkno;
- if (part != RAW_PART)
- blkno += lp->d_partitions[part].p_offset;
- wd->sc_blkno = blkno / (lp->d_secsize / DEV_BSIZE);
- } else {
-#ifdef WDDEBUG
- printf(" %d)%x", wd->sc_skip, inb(wd->sc_iobase+wd_altsts));
-#endif
- }
-
- /* When starting a multi-sector transfer, or doing single-sector
- transfers... */
- if (wd->sc_skip == 0 || (wdc->sc_flags & WDCF_SINGLE) != 0 ||
- wd->sc_mode == WDM_DMA) {
- daddr_t blkno = wd->sc_blkno;
- long cylin, head, sector;
- int command;
-
- if ((wdc->sc_flags & WDCF_SINGLE) != 0)
- nblks = 1;
- else if (wd->sc_mode != WDM_DMA)
- nblks = wd->sc_bcount / lp->d_secsize;
- else
- nblks = min(wd->sc_bcount / lp->d_secsize, 8);
-
- /* Check for bad sectors and adjust transfer, if necessary. */
- if ((lp->d_flags & D_BADSECT) != 0
-#ifdef B_FORMAT
- && (bp->b_flags & B_FORMAT) == 0
-#endif
- ) {
- long blkdiff;
- int i;
-
- for (i = 0; (blkdiff = wd->sc_badsect[i]) != -1; i++) {
- blkdiff -= blkno;
- if (blkdiff < 0)
- continue;
- if (blkdiff == 0) {
- /* Replace current block of transfer. */
- blkno =
- lp->d_secperunit - lp->d_nsectors - i - 1;
- }
- if (blkdiff < nblks) {
- /* Bad block inside transfer. */
- wdc->sc_flags |= WDCF_SINGLE;
- nblks = 1;
- }
- break;
- }
- /* Tranfer is okay now. */
- }
-
- if ((wd->sc_params.wdp_capabilities & WD_CAP_LBA) != 0) {
- sector = (blkno >> 0) & 0xff;
- cylin = (blkno >> 8) & 0xffff;
- head = (blkno >> 24) & 0xf;
- head |= WDSD_LBA;
- } else {
- sector = blkno % lp->d_nsectors;
- sector++; /* Sectors begin with 1, not 0. */
- blkno /= lp->d_nsectors;
- head = blkno % lp->d_ntracks;
- blkno /= lp->d_ntracks;
- cylin = blkno;
- head |= WDSD_CHS;
- }
-
- if (wd->sc_mode == WDM_PIOSINGLE ||
- (wdc->sc_flags & WDCF_SINGLE) != 0)
- wd->sc_nblks = 1;
- else if (wd->sc_mode == WDM_PIOMULTI)
- wd->sc_nblks = min(nblks, wd->sc_multiple);
- else
- wd->sc_nblks = nblks;
- wd->sc_nbytes = wd->sc_nblks * lp->d_secsize;
-
-#ifdef B_FORMAT
- if (bp->b_flags & B_FORMAT) {
- sector = lp->d_gap3;
- nblks = lp->d_nsectors;
- command = WDCC_FORMAT;
- } else
-#endif
- switch (wd->sc_mode) {
- case WDM_DMA:
- command = (bp->b_flags & B_READ) ?
- WDCC_READDMA : WDCC_WRITEDMA;
- /* Start the DMA channel and bounce the buffer if
- necessary. */
-/* isa_dmastart(bp->b_flags & B_READ,
- bp->b_data + wd->sc_skip,
- wd->sc_nbytes, wdc->sc_drq);*/
- panic("wd cannot do DMA yet");
- break;
- case WDM_PIOMULTI:
- command = (bp->b_flags & B_READ) ?
- WDCC_READMULTI : WDCC_WRITEMULTI;
- break;
- case WDM_PIOSINGLE:
- command = (bp->b_flags & B_READ) ?
- WDCC_READ : WDCC_WRITE;
- break;
- }
-
- /* Initiate command! */
- if (wdcommand(wd, command, cylin, head, sector, nblks) != 0) {
- wderror(wd, NULL,
- "wdcstart: timeout waiting for unbusy");
- wdcunwedge(wdc);
- return;
- }
-
-#ifdef WDDEBUG
- printf("sector %d cylin %d head %d addr %x sts %x\n", sector,
- cylin, head, bp->b_data, 0/*inb(wd->sc_iobase+wd_altsts)*/);
-#endif
- } else if (wd->sc_nblks > 1) {
- /* The number of blocks in the last stretch may be smaller. */
- nblks = wd->sc_bcount / lp->d_secsize;
- if (wd->sc_nblks > nblks) {
- wd->sc_nblks = nblks;
- wd->sc_nbytes = wd->sc_bcount;
- }
- }
-
- /* If this was a write and not using DMA, push the data. */
- if (wd->sc_mode != WDM_DMA &&
- (bp->b_flags & (B_READ|B_WRITE)) == B_WRITE) {
- if (wait_for_drq(wdc) < 0) {
- wderror(wd, NULL, "wdcstart: timeout waiting for drq");
- wdcunwedge(wdc);
- return;
- }
-
- /* Push out data. */
- if ((wd->sc_flags & WDF_32BIT) == 0)
- outsw(wdc->sc_iobase+wd_data, (u_int) bp->b_data + wd->sc_skip,
- wd->sc_nbytes >> 1);
- else
- panic("wd cannot do 32 bit transfers");
-/* outsl(wdc->sc_iobase+wd_data, bp->b_data + wd->sc_skip,
- wd->sc_nbytes >> 2);*/
- }
-
- wdc->sc_flags |= WDCF_ACTIVE;
- timeout(wdctimeout, wdc, WAITTIME);
-}
-
-/*
- * Interrupt routine for the controller. Acknowledge the interrupt, check for
- * errors on the current operation, mark it done if necessary, and start the
- * next request. Also check for a partially done transfer, and continue with
- * the next chunk if so.
- */
-int
-wdcintr(arg)
- void *arg;
-{
- struct wdc_softc *wdc = arg;
- struct wd_softc *wd;
- struct buf *bp;
-
- if ((wdc->sc_flags & WDCF_ACTIVE) == 0) {
- /* Clear the pending interrupt and abort. */
- (void) inb(wdc->sc_iobase+wd_status);
- return 0;
- }
-
- wdc->sc_flags &= ~WDCF_ACTIVE;
- untimeout(wdctimeout, wdc);
-
- wd = wdc->sc_drives.tqh_first;
- bp = wd->sc_q.b_actf;
-
-#ifdef WDDEBUG
- printf("I%d ", ctrlr);
-#endif
-
- if (wait_for_unbusy(wdc) < 0) {
- wderror(wd, NULL, "wdcintr: timeout waiting for unbusy");
- wdc->sc_status |= WDCS_ERR; /* XXX */
- }
-
- /* Is it not a transfer, but a control operation? */
- if (wd->sc_state < OPEN) {
- if (wdcontrol(wd) == 0) {
- /* The drive is busy. Wait. */
- return 1;
- }
- wdcstart(wdc);
- return 1;
- }
-
- /* Turn off the DMA channel and unbounce the buffer. */
- if (wd->sc_mode == WDM_DMA)
- panic("wd cannot do DMA");
-/* isa_dmadone(bp->b_flags & B_READ, bp->b_data + wd->sc_skip,
- wd->sc_nbytes, wdc->sc_drq);*/
-
- /* Have we an error? */
- if (wdc->sc_status & WDCS_ERR) {
- lose:
-#ifdef WDDEBUG
- wderror(wd, NULL, "wdcintr");
-#endif
- if ((wdc->sc_flags & WDCF_SINGLE) == 0) {
- wdc->sc_flags |= WDCF_ERROR;
- goto restart;
- }
-
-#ifdef B_FORMAT
- if (bp->b_flags & B_FORMAT)
- goto bad;
-#endif
-
- if (++wdc->sc_errors < WDIORETRIES)
- goto restart;
- wderror(wd, bp, "hard error");
-
- bad:
- bp->b_error = EIO;
- bp->b_flags |= B_ERROR;
- goto done;
- }
-
- /* If this was a read and not using DMA, fetch the data. */
- if (wd->sc_mode != WDM_DMA &&
- (bp->b_flags & (B_READ|B_WRITE)) == B_READ) {
- if ((wdc->sc_status & (WDCS_DRDY | WDCS_DSC | WDCS_DRQ))
- != (WDCS_DRDY | WDCS_DSC | WDCS_DRQ)) {
- wderror(wd, NULL, "wdcintr: read intr before drq");
- wdcunwedge(wdc);
- return 1;
- }
-
- /* Pull in data. */
- if ((wd->sc_flags & WDF_32BIT) == 0)
- insw(wdc->sc_iobase+wd_data, (u_int) bp->b_data + wd->sc_skip,
- wd->sc_nbytes >> 1);
- else
- panic("wd cannot do 32 bit transfers");
-/* insl(wdc->sc_iobase+wd_data, bp->b_data + wd->sc_skip,
- wd->sc_nbytes >> 2);*/
- }
-
- /* If we encountered any abnormalities, flag it as a soft error. */
- if (wdc->sc_errors > 0 ||
- (wdc->sc_status & WDCS_CORR) != 0) {
- wderror(wd, bp, "soft error (corrected)");
- wdc->sc_errors = 0;
- }
-
- /* Adjust pointers for the next block, if any. */
- wd->sc_blkno += wd->sc_nblks;
- wd->sc_skip += wd->sc_nbytes;
- wd->sc_bcount -= wd->sc_nbytes;
-
- /* See if this transfer is complete. */
- if (wd->sc_bcount > 0)
- goto restart;
-
-done:
- /* Done with this transfer, with or without error. */
- wdfinish(wd, bp);
-
-restart:
- /* Start the next operation, if any. */
- wdcstart(wdc);
-
- return 1;
-}
-
-/*
- * Wait interruptibly for an exclusive lock.
- *
- * XXX
- * Several drivers do this; it should be abstracted and made MP-safe.
- */
-int
-wdlock(wd)
- struct wd_softc *wd;
-{
- int error;
-
- while ((wd->sc_flags & WDF_LOCKED) != 0) {
- wd->sc_flags |= WDF_WANTED;
- if ((error = tsleep(wd, PRIBIO | PCATCH, "wdlck", 0)) != 0)
- return error;
- }
- wd->sc_flags |= WDF_LOCKED;
- return 0;
-}
-
-/*
- * Unlock and wake up any waiters.
- */
-void
-wdunlock(wd)
- struct wd_softc *wd;
-{
-
- wd->sc_flags &= ~WDF_LOCKED;
- if ((wd->sc_flags & WDF_WANTED) != 0) {
- wd->sc_flags &= ~WDF_WANTED;
- wakeup(wd);
- }
-}
-
-int
-wdopen(dev, flag, fmt)
- dev_t dev;
- int flag, fmt;
-{
- struct wd_softc *wd;
- int unit, part;
- int error;
-
- unit = WDUNIT(dev);
- if (unit >= wd_cd.cd_ndevs)
- return ENXIO;
- wd = wd_cd.cd_devs[unit];
- if (wd == 0)
- return ENXIO;
-
- if (error = wdlock(wd))
- return error;
-
- if (wd->sc_dk.dk_openmask != 0) {
- /*
- * If any partition is open, but the disk has been invalidated,
- * disallow further opens.
- */
- if ((wd->sc_flags & WDF_LOADED) == 0) {
- error = EIO;
- goto bad3;
- }
- } else {
- if ((wd->sc_flags & WDF_LOADED) == 0) {
- wd->sc_flags |= WDF_LOADED;
-
- /* Load the physical device parameters. */
- if (wd_get_parms(wd) != 0) {
- error = ENXIO;
- goto bad2;
- }
-
- /* Load the partition info if not already loaded. */
- wdgetdisklabel(wd);
- }
- }
-
- part = WDPART(dev);
-
- /* Check that the partition exists. */
- if (part != RAW_PART &&
- (part >= wd->sc_dk.dk_label->d_npartitions ||
- wd->sc_dk.dk_label->d_partitions[part].p_fstype == FS_UNUSED)) {
- error = ENXIO;
- goto bad;
- }
-
- /* Insure only one open at a time. */
- switch (fmt) {
- case S_IFCHR:
- wd->sc_dk.dk_copenmask |= (1 << part);
- break;
- case S_IFBLK:
- wd->sc_dk.dk_bopenmask |= (1 << part);
- break;
- }
- wd->sc_dk.dk_openmask = wd->sc_dk.dk_copenmask | wd->sc_dk.dk_bopenmask;
-
- wdunlock(wd);
- return 0;
-
-bad2:
- wd->sc_flags &= ~WDF_LOADED;
-
-bad:
- if (wd->sc_dk.dk_openmask == 0) {
- }
-
-bad3:
- wdunlock(wd);
- return error;
-}
-
-int
-wdclose(dev, flag, fmt)
- dev_t dev;
- int flag, fmt;
-{
- struct wd_softc *wd = wd_cd.cd_devs[WDUNIT(dev)];
- int part = WDPART(dev);
- int error;
-
- if (error = wdlock(wd))
- return error;
-
- switch (fmt) {
- case S_IFCHR:
- wd->sc_dk.dk_copenmask &= ~(1 << part);
- break;
- case S_IFBLK:
- wd->sc_dk.dk_bopenmask &= ~(1 << part);
- break;
- }
- wd->sc_dk.dk_openmask = wd->sc_dk.dk_copenmask | wd->sc_dk.dk_bopenmask;
-
- if (wd->sc_dk.dk_openmask == 0) {
- /* XXXX Must wait for I/O to complete! */
- }
-
- wdunlock(wd);
- return 0;
-}
-
-/*
- * Fabricate a default disk label, and try to read the correct one.
- */
-void
-wdgetdisklabel(wd)
- struct wd_softc *wd;
-{
- struct disklabel *lp = wd->sc_dk.dk_label;
- char *errstring;
-
- bzero(lp, sizeof(struct disklabel));
- bzero(wd->sc_dk.dk_cpulabel, sizeof(struct cpu_disklabel));
-
- lp->d_secsize = DEV_BSIZE;
- lp->d_ntracks = wd->sc_params.wdp_heads;
- lp->d_nsectors = wd->sc_params.wdp_sectors;
- lp->d_ncylinders = wd->sc_params.wdp_cylinders;
- lp->d_secpercyl = lp->d_ntracks * lp->d_nsectors;
-
-#if 0
- strncpy(lp->d_typename, "ST506 disk", 16);
- lp->d_type = DTYPE_ST506;
-#endif
- strncpy(lp->d_packname, wd->sc_params.wdp_model, 16);
- lp->d_secperunit = lp->d_secpercyl * lp->d_ncylinders;
- lp->d_rpm = 3600;
- lp->d_interleave = 1;
- lp->d_flags = 0;
-
- lp->d_partitions[RAW_PART].p_offset = 0;
- lp->d_partitions[RAW_PART].p_size =
- lp->d_secperunit * (lp->d_secsize / DEV_BSIZE);
- lp->d_partitions[RAW_PART].p_fstype = FS_UNUSED;
- lp->d_npartitions = RAW_PART + 1;
-
- lp->d_magic = DISKMAGIC;
- lp->d_magic2 = DISKMAGIC;
- lp->d_checksum = dkcksum(lp);
-
- wd->sc_badsect[0] = -1;
-
- if (wd->sc_state > RECAL)
- wd->sc_state = RECAL;
- errstring = readdisklabel(MAKEWDDEV(0, wd->sc_dev.dv_unit, RAW_PART),
- wdstrategy, lp, wd->sc_dk.dk_cpulabel, 0);
- if (errstring) {
- /*
- * This probably happened because the drive's default
- * geometry doesn't match the DOS geometry. We
- * assume the DOS geometry is now in the label and try
- * again. XXX This is a kluge.
- */
- if (wd->sc_state > GEOMETRY)
- wd->sc_state = GEOMETRY;
- errstring = readdisklabel(MAKEWDDEV(0, wd->sc_dev.dv_unit, RAW_PART),
- wdstrategy, lp, wd->sc_dk.dk_cpulabel, 0);
- }
- if (errstring) {
- printf("%s: %s\n", wd->sc_dev.dv_xname, errstring);
- return;
- }
-
- if (wd->sc_state > GEOMETRY)
- wd->sc_state = GEOMETRY;
- if ((lp->d_flags & D_BADSECT) != 0)
- bad144intern(wd);
-}
-
-/*
- * Implement operations needed before read/write.
- * Returns 0 if operation still in progress, 1 if completed.
- */
-int
-wdcontrol(wd)
- struct wd_softc *wd;
-{
- struct wdc_softc *wdc = (void *)wd->sc_dev.dv_parent;
-
- switch (wd->sc_state) {
- case RECAL: /* Set SDH, step rate, do recal. */
- if (wdcommandshort(wdc, wd->sc_drive, WDCC_RECAL) != 0) {
- wderror(wd, NULL, "wdcontrol: recal failed (1)");
- goto bad;
- }
- wd->sc_state = RECAL_WAIT;
- break;
-
- case RECAL_WAIT:
- if (wdc->sc_status & WDCS_ERR) {
- wderror(wd, NULL, "wdcontrol: recal failed (2)");
- goto bad;
- }
- /* fall through */
- case GEOMETRY:
- if ((wd->sc_params.wdp_capabilities & WD_CAP_LBA) != 0)
- goto multimode;
- if (wdsetctlr(wd) != 0) {
- /* Already printed a message. */
- goto bad;
- }
- wd->sc_state = GEOMETRY_WAIT;
- break;
-
- case GEOMETRY_WAIT:
- if (wdc->sc_status & WDCS_ERR) {
- wderror(wd, NULL, "wdcontrol: geometry failed");
- goto bad;
- }
- /* fall through */
- case MULTIMODE:
- multimode:
- if (wd->sc_mode != WDM_PIOMULTI)
- goto open;
- outb(wdc->sc_iobase+wd_seccnt, wd->sc_multiple);
- if (wdcommandshort(wdc, wd->sc_drive, WDCC_SETMULTI) != 0) {
- wderror(wd, NULL, "wdcontrol: setmulti failed (1)");
- goto bad;
- }
- wd->sc_state = MULTIMODE_WAIT;
- break;
-
- case MULTIMODE_WAIT:
- if (wdc->sc_status & WDCS_ERR) {
- wderror(wd, NULL, "wdcontrol: setmulti failed (2)");
- goto bad;
- }
- /* fall through */
- case OPEN:
- open:
- wdc->sc_errors = 0;
- wd->sc_state = OPEN;
- /*
- * The rest of the initialization can be done by normal means.
- */
- return 1;
-
- bad:
- wdcunwedge(wdc);
- return 0;
- }
-
- wdc->sc_flags |= WDCF_ACTIVE;
- timeout(wdctimeout, wdc, WAITTIME);
- return 0;
-}
-
-/*
- * Wait for the drive to become ready and send a command.
- * Return -1 if busy for too long or 0 otherwise.
- * Assumes interrupts are blocked.
- */
-int
-wdcommand(wd, command, cylin, head, sector, count)
- struct wd_softc *wd;
- int command;
- int cylin, head, sector, count;
-{
- struct wdc_softc *wdc = (void *)wd->sc_dev.dv_parent;
- int iobase = wdc->sc_iobase;
- int stat;
-
- /* Select drive, head, and addressing mode. */
- outb(iobase+wd_sdh, WDSD_IBM | (wd->sc_drive << 4) | head);
-
- /* Wait for it to become ready to accept a command. */
- if (command == WDCC_IDP)
- stat = wait_for_unbusy(wdc);
- else
- stat = wdcwait(wdc, WDCS_DRDY);
- if (stat < 0)
- return -1;
-
- /* Load parameters. */
- if (wd->sc_dk.dk_label->d_type == DTYPE_ST506)
- outb(iobase+wd_precomp, wd->sc_dk.dk_label->d_precompcyl / 4);
- else
- outb(iobase+wd_features, 0);
- outb(iobase+wd_cyl_lo, cylin);
- outb(iobase+wd_cyl_hi, cylin >> 8);
- outb(iobase+wd_sector, sector);
- outb(iobase+wd_seccnt, count);
-
- /* Send command. */
- outb(iobase+wd_command, command);
-
- return 0;
-}
-
-/*
- * Simplified version of wdcommand().
- */
-int
-wdcommandshort(wdc, drive, command)
- struct wdc_softc *wdc;
- int drive;
- int command;
-{
- int iobase = wdc->sc_iobase;
-
- /* Select drive. */
- outb(iobase+wd_sdh, WDSD_IBM | (drive << 4));
-
- if (wdcwait(wdc, WDCS_DRDY) < 0)
- return -1;
-
- outb(iobase+wd_command, command);
-
- return 0;
-}
-
-/*
- * Tell the drive what geometry to use.
- */
-int
-wdsetctlr(wd)
- struct wd_softc *wd;
-{
- struct wdc_softc *wdc = (void *)wd->sc_dev.dv_parent;
-
-#ifdef WDDEBUG
- printf("wd(%d,%d) C%dH%dS%d\n", wd->sc_dev.dv_unit, wd->sc_drive,
- wd->sc_dk.dk_label->d_ncylinders, wd->sc_dk.dk_label->d_ntracks,
- wd->sc_dk.dk_label->d_nsectors);
-#endif
-
- if (wdcommand(wd, WDCC_IDP, wd->sc_dk.dk_label->d_ncylinders,
- wd->sc_dk.dk_label->d_ntracks - 1, 0,
- wd->sc_dk.dk_label->d_nsectors) != 0) {
- wderror(wd, NULL, "wdsetctlr: geometry upload failed");
- return -1;
- }
-
- return 0;
-}
-
-/*
- * Get the drive parameters, if ESDI or ATA, or create fake ones for ST506.
- */
-int
-wd_get_parms(wd)
- struct wd_softc *wd;
-{
- struct wdc_softc *wdc = (void *)wd->sc_dev.dv_parent;
- int i;
- char tb[DEV_BSIZE];
- int s, error;
-
- /*
- * XXX
- * The locking done here, and the length of time this may keep the rest
- * of the system suspended, is a kluge. This should be rewritten to
- * set up a transfer and queue it through wdstart(), but it's called
- * infrequently enough that this isn't a pressing matter.
- */
-
- s = splbio();
-
- while ((wdc->sc_flags & WDCF_ACTIVE) != 0) {
- wdc->sc_flags |= WDCF_WANTED;
- if ((error = tsleep(wdc, PRIBIO | PCATCH, "wdprm", 0)) != 0) {
- splx(s);
- return error;
- }
- }
-
- if (wdcommandshort(wdc, wd->sc_drive, WDCC_IDENTIFY) != 0 ||
- wait_for_drq(wdc) != 0) {
- /*
- * We `know' there's a drive here; just assume it's old.
- * This geometry is only used to read the MBR and print a
- * (false) attach message.
- */
- strncpy(wd->sc_dk.dk_label->d_typename, "ST506",
- sizeof wd->sc_dk.dk_label->d_typename);
- wd->sc_dk.dk_label->d_type = DTYPE_ST506;
-
- strncpy(wd->sc_params.wdp_model, "unknown",
- sizeof wd->sc_params.wdp_model);
- wd->sc_params.wdp_config = WD_CFG_FIXED;
- wd->sc_params.wdp_cylinders = 1024;
- wd->sc_params.wdp_heads = 8;
- wd->sc_params.wdp_sectors = 17;
- wd->sc_params.wdp_maxmulti = 0;
- wd->sc_params.wdp_usedmovsd = 0;
- wd->sc_params.wdp_capabilities = 0;
- } else {
- strncpy(wd->sc_dk.dk_label->d_typename, "ESDI/IDE",
- sizeof wd->sc_dk.dk_label->d_typename);
- wd->sc_dk.dk_label->d_type = DTYPE_ESDI;
-
- /* Read in parameter block. */
- insw(wdc->sc_iobase+wd_data, (u_int)tb, sizeof(tb) / sizeof(short));
- bcopy(tb, &wd->sc_params, sizeof(struct wdparams));
-
- /* Shuffle string byte order. */
- for (i = 0; i < sizeof(wd->sc_params.wdp_model); i += 2) {
- u_short *p;
- p = (u_short *)(wd->sc_params.wdp_model + i);
- *p = ntohs(*p);
- }
- }
-
- /* Clear any leftover interrupt. */
- (void) inb(wdc->sc_iobase+wd_status);
-
- /* Restart the queue. */
- wdcstart(wdc);
-
- splx(s);
- return 0;
-}
-
-int
-wdioctl(dev, cmd, addr, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t addr;
- int flag;
- struct proc *p;
-{
- struct wd_softc *wd = wd_cd.cd_devs[WDUNIT(dev)];
- int error;
-
- if ((wd->sc_flags & WDF_LOADED) == 0)
- return EIO;
-
- switch (cmd) {
- case DIOCSBAD:
- if ((flag & FWRITE) == 0)
- return EBADF;
- wd->sc_dk.dk_cpulabel->bad = *(struct dkbad *)addr;
- wd->sc_dk.dk_label->d_flags |= D_BADSECT;
- bad144intern(wd);
- return 0;
-
- case DIOCGDINFO:
- *(struct disklabel *)addr = *(wd->sc_dk.dk_label);
- return 0;
-
- case DIOCGPART:
- ((struct partinfo *)addr)->disklab = wd->sc_dk.dk_label;
- ((struct partinfo *)addr)->part =
- &wd->sc_dk.dk_label->d_partitions[WDPART(dev)];
- return 0;
-
- case DIOCWDINFO:
- case DIOCSDINFO:
- if ((flag & FWRITE) == 0)
- return EBADF;
-
- if (error = wdlock(wd))
- return error;
- wd->sc_flags |= WDF_LABELLING;
-
- error = setdisklabel(wd->sc_dk.dk_label,
- (struct disklabel *)addr, /*wd->sc_dk.dk_openmask : */0,
- wd->sc_dk.dk_cpulabel);
- if (error == 0) {
- if (wd->sc_state > GEOMETRY)
- wd->sc_state = GEOMETRY;
- if (cmd == DIOCWDINFO)
- error = writedisklabel(WDLABELDEV(dev),
- wdstrategy, wd->sc_dk.dk_label,
- wd->sc_dk.dk_cpulabel);
- }
-
- wd->sc_flags &= ~WDF_LABELLING;
- wdunlock(wd);
- return error;
-
- case DIOCWLABEL:
- if ((flag & FWRITE) == 0)
- return EBADF;
- if (*(int *)addr)
- wd->sc_flags |= WDF_WLABEL;
- else
- wd->sc_flags &= ~WDF_WLABEL;
- return 0;
-
-#ifdef notyet
- case DIOCWFORMAT:
- if ((flag & FWRITE) == 0)
- return EBADF;
- {
- register struct format_op *fop;
- struct iovec aiov;
- struct uio auio;
-
- fop = (struct format_op *)addr;
- aiov.iov_base = fop->df_buf;
- aiov.iov_len = fop->df_count;
- auio.uio_iov = &aiov;
- auio.uio_iovcnt = 1;
- auio.uio_resid = fop->df_count;
- auio.uio_segflg = 0;
- auio.uio_offset =
- fop->df_startblk * wd->sc_dk.dk_label->d_secsize;
- auio.uio_procp = p;
- error = physio(wdformat, NULL, dev, B_WRITE, minphys,
- &auio);
- fop->df_count -= auio.uio_resid;
- fop->df_reg[0] = wdc->sc_status;
- fop->df_reg[1] = wdc->sc_error;
- return error;
- }
-#endif
-
- default:
- return ENOTTY;
- }
-
-#ifdef DIAGNOSTIC
- panic("wdioctl: impossible");
-#endif
-}
-
-#ifdef B_FORMAT
-int
-wdformat(struct buf *bp)
-{
-
- bp->b_flags |= B_FORMAT;
- return wdstrategy(bp);
-}
-#endif
-
-int
-wdsize(dev)
- dev_t dev;
-{
- struct wd_softc *wd;
- int part;
- int size;
-
- if (wdopen(dev, 0, S_IFBLK) != 0)
- return -1;
- wd = wd_cd.cd_devs[WDUNIT(dev)];
- part = WDPART(dev);
- if (wd->sc_dk.dk_label->d_partitions[part].p_fstype != FS_SWAP)
- size = -1;
- else
- size = wd->sc_dk.dk_label->d_partitions[part].p_size;
- if (wdclose(dev, 0, S_IFBLK) != 0)
- return -1;
- return size;
-}
-
-
-#ifndef __BDEVSW_DUMP_OLD_TYPE
-/* #define WD_DUMP_NOT_TRUSTED if you just want to watch */
-static int wddoingadump;
-static int wddumprecalibrated;
-
-/*
- * Dump core after a system crash.
- */
-int
-wddump(dev, blkno, va, size)
- dev_t dev;
- daddr_t blkno;
- caddr_t va;
- size_t size;
-{
- struct wd_softc *wd; /* disk unit to do the I/O */
- struct wdc_softc *wdc; /* disk controller to do the I/O */
- struct disklabel *lp; /* disk's disklabel */
- int unit, part;
- int nblks; /* total number of sectors left to write */
-
- /* Check if recursive dump; if so, punt. */
- if (wddoingadump)
- return EFAULT;
- wddoingadump = 1;
-
- unit = WDUNIT(dev);
- if (unit >= wd_cd.cd_ndevs)
- return ENXIO;
- wd = wd_cd.cd_devs[unit];
- if (wd == 0)
- return ENXIO;
-
- part = WDPART(dev);
-
- /* Make sure it was initialized. */
- if (wd->sc_state < OPEN)
- return ENXIO;
-
- wdc = (void *)wd->sc_dev.dv_parent;
-
- /* Convert to disk sectors. Request must be a multiple of size. */
- lp = wd->sc_dk.dk_label;
- if ((size % lp->d_secsize) != 0)
- return EFAULT;
- nblks = size / lp->d_secsize;
- blkno = blkno / (lp->d_secsize / DEV_BSIZE);
-
- /* Check transfer bounds against partition size. */
- if ((blkno < 0) || ((blkno + nblks) > lp->d_partitions[part].p_size))
- return EINVAL;
-
- /* Offset block number to start of partition. */
- blkno += lp->d_partitions[part].p_offset;
-
- /* Recalibrate, if first dump transfer. */
- if (wddumprecalibrated == 0) {
- wddumprecalibrated = 1;
- if (wdcommandshort(wdc, wd->sc_drive, WDCC_RECAL) != 0 ||
- wait_for_ready(wdc) != 0 || wdsetctlr(wd) != 0 ||
- wait_for_ready(wdc) != 0) {
- wderror(wd, NULL, "wddump: recal failed");
- return EIO;
- }
- }
-
- while (nblks > 0) {
- daddr_t xlt_blkno = blkno;
- long cylin, head, sector;
-
- if ((lp->d_flags & D_BADSECT) != 0) {
- long blkdiff;
- int i;
-
- for (i = 0; (blkdiff = wd->sc_badsect[i]) != -1; i++) {
- blkdiff -= xlt_blkno;
- if (blkdiff < 0)
- continue;
- if (blkdiff == 0) {
- /* Replace current block of transfer. */
- xlt_blkno = lp->d_secperunit -
- lp->d_nsectors - i - 1;
- }
- break;
- }
- /* Tranfer is okay now. */
- }
-
- if ((wd->sc_params.wdp_capabilities & WD_CAP_LBA) != 0) {
- sector = (xlt_blkno >> 0) & 0xff;
- cylin = (xlt_blkno >> 8) & 0xffff;
- head = (xlt_blkno >> 24) & 0xf;
- head |= WDSD_LBA;
- } else {
- sector = xlt_blkno % lp->d_nsectors;
- sector++; /* Sectors begin with 1, not 0. */
- xlt_blkno /= lp->d_nsectors;
- head = xlt_blkno % lp->d_ntracks;
- xlt_blkno /= lp->d_ntracks;
- cylin = xlt_blkno;
- head |= WDSD_CHS;
- }
-
-#ifndef WD_DUMP_NOT_TRUSTED
- if (wdcommand(wd, WDCC_WRITE, cylin, head, sector, 1) != 0 ||
- wait_for_drq(wdc) != 0) {
- wderror(wd, NULL, "wddump: write failed");
- return EIO;
- }
-
- outsw(wdc->sc_iobase+wd_data, (u_int)va, lp->d_secsize >> 1);
-
- /* Check data request (should be done). */
- if (wait_for_ready(wdc) != 0) {
- wderror(wd, NULL, "wddump: timeout waiting for ready");
- return EIO;
- }
-#else /* WD_DUMP_NOT_TRUSTED */
- /* Let's just talk about this first... */
- printf("wd%d: dump addr 0x%x, cylin %d, head %d, sector %d\n",
- unit, va, cylin, head, sector);
- delay(500 * 1000); /* half a second */
-#endif
-
- /* update block count */
- nblks -= 1;
- blkno += 1;
- va += lp->d_secsize;
- }
-
- wddoingadump = 0;
- return 0;
-}
-#else /* __BDEVSW_DUMP_NEW_TYPE */
-int
-wddump(dev, blkno, va, size)
- dev_t dev;
- daddr_t blkno;
- caddr_t va;
- size_t size;
-{
-
- /* Not implemented. */
- return ENXIO;
-}
-#endif /* __BDEVSW_DUMP_NEW_TYPE */
-
-/*
- * Internalize the bad sector table.
- */
-void
-bad144intern(wd)
- struct wd_softc *wd;
-{
- struct dkbad *bt = &DKBAD(wd->sc_dk.dk_cpulabel);
- struct disklabel *lp = wd->sc_dk.dk_label;
- int i = 0;
-
- for (; i < 126; i++) {
- if (bt->bt_bad[i].bt_cyl == 0xffff)
- break;
- wd->sc_badsect[i] =
- bt->bt_bad[i].bt_cyl * lp->d_secpercyl +
- (bt->bt_bad[i].bt_trksec >> 8) * lp->d_nsectors +
- (bt->bt_bad[i].bt_trksec & 0xff);
- }
- for (; i < 127; i++)
- wd->sc_badsect[i] = -1;
-}
-
-int
-wdcreset(wdc)
- struct wdc_softc *wdc;
-{
- int iobase = wdc->sc_iobase;
-
- /* Reset the device. */
- if (wdresethack) {
- outb(iobase+wd_ctlr, WDCTL_RST | WDCTL_IDS);
- delay(1000);
- outb(iobase+wd_ctlr, WDCTL_IDS);
- delay(1000);
- (void) inb(iobase+wd_error);
- outb(iobase+wd_ctlr, WDCTL_4BIT);
- }
-
- if (wait_for_unbusy(wdc) < 0) {
- printf("%s: reset failed\n", wdc->sc_dev.dv_xname);
- return 1;
- }
-
- return 0;
-}
-
-void
-wdcrestart(arg)
- void *arg;
-{
- struct wdc_softc *wdc = arg;
- int s;
-
- s = splbio();
- wdcstart(wdc);
- splx(s);
-}
-
-/*
- * Unwedge the controller after an unexpected error. We do this by resetting
- * it, marking all drives for recalibration, and stalling the queue for a short
- * period to give the reset time to finish.
- * NOTE: We use a timeout here, so this routine must not be called during
- * autoconfig or dump.
- */
-void
-wdcunwedge(wdc)
- struct wdc_softc *wdc;
-{
- int unit;
-
- untimeout(wdctimeout, wdc);
- (void) wdcreset(wdc);
-
- /* Schedule recalibrate for all drives on this controller. */
- for (unit = 0; unit < wd_cd.cd_ndevs; unit++) {
- struct wd_softc *wd = wd_cd.cd_devs[unit];
- if (!wd || (void *)wd->sc_dev.dv_parent != wdc)
- continue;
- if (wd->sc_state > RECAL)
- wd->sc_state = RECAL;
- }
-
- wdc->sc_flags |= WDCF_ERROR;
- ++wdc->sc_errors;
-
- /* Wake up in a little bit and restart the operation. */
- timeout(wdcrestart, wdc, RECOVERYTIME);
-}
-
-int
-wdcwait(wdc, mask)
- struct wdc_softc *wdc;
- int mask;
-{
- int iobase = wdc->sc_iobase;
- int timeout = 0;
- u_char status;
- extern int cold;
-
- for (;;) {
- wdc->sc_status = status = inb(iobase+wd_status);
- if ((status & WDCS_BSY) == 0 && (status & mask) == mask)
- break;
- if (++timeout > WDCNDELAY)
- return -1;
- delay(WDCDELAY);
- }
- if (status & WDCS_ERR) {
- wdc->sc_error = inb(iobase+wd_error);
- return WDCS_ERR;
- }
-#ifdef WDCNDELAY_DEBUG
- /* After autoconfig, there should be no long delays. */
- if (!cold && timeout > WDCNDELAY_DEBUG)
- printf("%s: warning: busy-wait took %dus\n",
- wdc->sc_dev.dv_xname, WDCDELAY * timeout);
-#endif
- return 0;
-}
-
-void
-wdctimeout(arg)
- void *arg;
-{
- struct wdc_softc *wdc = (struct wdc_softc *)arg;
- int s;
-
- s = splbio();
- if ((wdc->sc_flags & WDCF_ACTIVE) != 0) {
- struct wd_softc *wd = wdc->sc_drives.tqh_first;
- struct buf *bp = wd->sc_q.b_actf;
-
- wdc->sc_flags &= ~WDCF_ACTIVE;
- wderror(wdc, NULL, "lost interrupt");
- printf("%s: lost interrupt: %sing %d@%s:%d\n",
- wdc->sc_dev.dv_xname,
- (bp->b_flags & B_READ) ? "read" : "writ",
- wd->sc_nblks, wd->sc_dev.dv_xname, wd->sc_blkno);
- wdcunwedge(wdc);
- } else
- wderror(wdc, NULL, "missing untimeout");
- splx(s);
-}
-
-void
-wderror(dev, bp, msg)
- void *dev;
- struct buf *bp;
- char *msg;
-{
- struct wd_softc *wd = dev;
- struct wdc_softc *wdc = dev;
-
- if (bp) {
- diskerr(bp, "wd", msg, LOG_PRINTF, wd->sc_skip / DEV_BSIZE,
- wd->sc_dk.dk_label);
- printf("\n");
- } else
- printf("%s: %s: status %b error %b\n", wdc->sc_dev.dv_xname,
- msg, wdc->sc_status, WDCS_BITS, wdc->sc_error, WDERR_BITS);
-}
diff --git a/sys/arch/arm32/mainbus/wdreg.h b/sys/arch/arm32/mainbus/wdreg.h
deleted file mode 100644
index 12311b76e60..00000000000
--- a/sys/arch/arm32/mainbus/wdreg.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/* $NetBSD: wdreg.h,v 1.1 1996/01/31 23:25:18 mark Exp $ */
-
-/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)wdreg.h 7.1 (Berkeley) 5/9/91
- */
-
-/*
- * Disk Controller register definitions.
- */
-#define wd_data 0x000 /* data register (R/W - 16 bits) */
-#define wd_error 0x004 /* error register (R) */
-#define wd_precomp 0x004 /* write precompensation (W) */
-#define wd_features 0x004 /* features (W) */
-#define wd_seccnt 0x008 /* sector count (R/W) */
-#define wd_sector 0x00c /* first sector number (R/W) */
-#define wd_cyl_lo 0x010 /* cylinder address, low byte (R/W) */
-#define wd_cyl_hi 0x014 /* cylinder address, high byte (R/W) */
-#define wd_sdh 0x018 /* sector size/drive/head (R/W) */
-#define wd_command 0x01c /* command register (W) */
-#define wd_status 0x01c /* immediate status (R) */
-
-#define wd_altsts 0x818 /* alternate fixed disk status (via 1015) (R) */
-#define wd_ctlr 0x818 /* fixed disk controller control (via 1015) (W) */
-#define WDCTL_4BIT 0x08 /* use four head bits (wd1003) */
-#define WDCTL_RST 0x04 /* reset the controller */
-#define WDCTL_IDS 0x02 /* disable controller interrupts */
-#define wd_digin 0x81c /* disk controller input (via 1015) (R) */
-
-/*
- * Status bits.
- */
-#define WDCS_BSY 0x80 /* busy */
-#define WDCS_DRDY 0x40 /* drive ready */
-#define WDCS_DWF 0x20 /* drive write fault */
-#define WDCS_DSC 0x10 /* drive seek complete */
-#define WDCS_DRQ 0x08 /* data request */
-#define WDCS_CORR 0x04 /* corrected data */
-#define WDCS_IDX 0x02 /* index */
-#define WDCS_ERR 0x01 /* error */
-#define WDCS_BITS "\020\010bsy\007drdy\006dwf\005dsc\004drq\003corr\002idx\001err"
-
-/*
- * Error bits.
- */
-#define WDCE_BBK 0x80 /* bad block detected */
-#define WDCE_UNC 0x40 /* uncorrectable data error */
-#define WDCE_MC 0x20 /* media changed */
-#define WDCE_IDNF 0x10 /* id not found */
-#define WDCE_ABRT 0x08 /* aborted command */
-#define WDCE_MCR 0x04 /* media change requested */
-#define WDCE_TK0NF 0x02 /* track 0 not found */
-#define WDCE_AMNF 0x01 /* address mark not found */
-#define WDERR_BITS "\020\010bbk\007unc\006mc\005idnf\004mcr\003abrt\002tk0nf\001amnf"
-
-/*
- * Commands for Disk Controller.
- */
-#define WDCC_RECAL 0x10 /* disk restore code -- resets cntlr */
-
-#define WDCC_READ 0x20 /* disk read code */
-#define WDCC_WRITE 0x30 /* disk write code */
-#define WDCC__LONG 0x02 /* modifier -- access ecc bytes */
-#define WDCC__NORETRY 0x01 /* modifier -- no retrys */
-
-#define WDCC_FORMAT 0x50 /* disk format code */
-#define WDCC_DIAGNOSE 0x90 /* controller diagnostic */
-#define WDCC_IDP 0x91 /* initialize drive parameters */
-
-#define WDCC_READMULTI 0xc4 /* read multiple */
-#define WDCC_WRITEMULTI 0xc5 /* write multiple */
-#define WDCC_SETMULTI 0xc6 /* set multiple mode */
-
-#define WDCC_READDMA 0xc8 /* read with DMA */
-#define WDCC_WRITEDMA 0xca /* write with DMA */
-
-#define WDCC_ACKMC 0xdb /* acknowledge media change */
-#define WDCC_LOCK 0xde /* lock drawer */
-#define WDCC_UNLOCK 0xdf /* unlock drawer */
-
-#define WDCC_IDENTIFY 0xec /* read parameters from controller */
-#define WDCC_CACHEC 0xef /* cache control */
-
-#define WDSD_IBM 0xa0 /* forced to 512 byte sector, ecc */
-#define WDSD_CHS 0x00 /* cylinder/head/sector addressing */
-#define WDSD_LBA 0x40 /* logical block addressing */
-
-
-#ifdef _KERNEL
-/*
- * read parameters command returns this:
- */
-struct wdparams {
- /* drive info */
- short wdp_config; /* general configuration */
-#define WD_CFG_REMOVABLE 0x0080
-#define WD_CFG_FIXED 0x0040
- short wdp_cylinders; /* number of non-removable cylinders */
- char __reserved1[2];
- short wdp_heads; /* number of heads */
- short wdp_unfbytespertrk; /* number of unformatted bytes/track */
- short wdp_unfbytespersec; /* number of unformatted bytes/sector */
- short wdp_sectors; /* number of sectors */
- char wdp_vendor1[6];
- /* controller info */
- char wdp_serial[20]; /* serial number */
- short wdp_buftype; /* buffer type */
-#define WD_BUF_SINGLEPORTSECTOR 1 /* single port, single sector buffer */
-#define WD_BUF_DUALPORTMULTI 2 /* dual port, multiple sector buffer */
-#define WD_BUF_DUALPORTMULTICACHE 3 /* above plus track cache */
- short wdp_bufsize; /* buffer size, in 512-byte units */
- short wdp_eccbytes; /* ecc bytes appended */
- char wdp_revision[8]; /* firmware revision */
- char wdp_model[40]; /* model name */
- u_char wdp_maxmulti; /* maximum sectors per interrupt */
- char wdp_vendor2[1];
- short wdp_usedmovsd; /* can use double word read/write? */
- char wdp_vendor3[1];
- char wdp_capabilities; /* capability flags */
-#define WD_CAP_LBA 0x02
-#define WD_CAP_DMA 0x01
- char __reserved2[2];
- char wdp_vendor4[1];
- char wdp_piotiming; /* PIO timing mode */
- char wdp_vendor5[1];
- char wdp_dmatiming; /* DMA timing mode */
-};
-#endif /* _KERNEL */
diff --git a/sys/arch/arm32/podulebus/asc.c b/sys/arch/arm32/podulebus/asc.c
deleted file mode 100644
index 57bc3aade4c..00000000000
--- a/sys/arch/arm32/podulebus/asc.c
+++ /dev/null
@@ -1,483 +0,0 @@
-/* $NetBSD: asc.c,v 1.5 1996/04/19 20:13:56 mark Exp $ */
-
-/*
- * Copyright (c) 1996 Mark Brinicombe
- * Copyright (c) 1982, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from:ahsc.c
- */
-
-/*
- * Ok this driver is not wonderful yet. It only supports POLLING mode
- * The Acorn SCSI card (or any WD3393 based card) does not support
- * DMA so the DMA section of this driver and the sbic driver needs
- * to be rewritten.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-#include <machine/io.h>
-#include <machine/irqhandler.h>
-#include <machine/katelib.h>
-#include <arm32/podulebus/podulebus.h>
-#include <arm32/podulebus/sbicreg.h>
-#include <arm32/podulebus/sbicvar.h>
-#include <arm32/podulebus/ascreg.h>
-#include <arm32/podulebus/ascvar.h>
-
-int ascprint __P((void *auxp, const char *));
-void ascattach __P((struct device *, struct device *, void *));
-int ascmatch __P((struct device *, void *, void *));
-
-void asc_enintr __P((struct sbic_softc *));
-void asc_dmastop __P((struct sbic_softc *));
-int asc_dmanext __P((struct sbic_softc *));
-int asc_dmaintr __P((struct sbic_softc *));
-int asc_dmago __P((struct sbic_softc *, char *, int, int));
-int asc_scsicmd __P((struct scsi_xfer *xs));
-int asc_intr __P((struct asc_softc *));
-
-char *strstr __P((char */*s1*/, char */*s2*/));
-
-struct scsi_adapter asc_scsiswitch = {
- asc_scsicmd,
- sbic_minphys,
- 0, /* no lun support */
- 0, /* no lun support */
-};
-
-struct scsi_device asc_scsidev = {
- NULL, /* use default error handler */
- NULL, /* do not have a start functio */
- NULL, /* have no async handler */
- NULL, /* Use default done routine */
-};
-
-
-#ifdef DEBUG
-int asc_dmadebug = 0;
-#endif
-
-struct cfattach asc_ca = {
- sizeof(struct asc_softc), ascmatch, ascattach
-};
-
-struct cfdriver asc_cd = {
- NULL, "asc", DV_DULL, NULL, 0
-};
-
-u_long scsi_nosync;
-int shift_nosync;
-
-#if ASC_POLL > 0
-int asc_poll = 1;
-
-extern char *boot_args;
-#endif
-
-int
-ascmatch(pdp, match, auxp)
- struct device *pdp;
- void *match, *auxp;
-{
- struct podule_attach_args *pa = (struct podule_attach_args *)auxp;
- int podule;
-
- podule = findpodule(0x00, 0x02, pa->pa_podule_number);
-
- if (podule == -1)
- return(0);
-
- pa->pa_podule_number = podule;
- pa->pa_podule = &podules[podule];
-
- return(1);
-}
-
-void
-ascattach(pdp, dp, auxp)
- struct device *pdp, *dp;
- void *auxp;
-{
- volatile struct sdmac *rp;
- struct asc_softc *sc;
- struct sbic_softc *sbic;
- struct podule_attach_args *pa;
-
- sc = (struct asc_softc *)dp;
-
- pa = (struct podule_attach_args *)auxp;
- sc->sc_podule_number = pa->pa_podule_number;
- if (sc->sc_podule_number == -1)
- panic("Podule has disappeared !");
-
- sc->sc_podule = &podules[sc->sc_podule_number];
- podules[sc->sc_podule_number].attached = 1;
-
-#if ASC_POLL > 0
- if (boot_args) {
- char *ptr;
-
- ptr = strstr(boot_args, "noascpoll");
- if (ptr)
- asc_poll = 0;
- }
-
- if (asc_poll)
- printf(" polling");
- else
- printf(" using interrupts");
-#endif
- printf("\n");
-
- sbic = &sc->sc_softc;
-
- sbic->sc_enintr = asc_enintr;
- sbic->sc_dmago = asc_dmago;
- sbic->sc_dmanext = asc_dmanext;
- sbic->sc_dmastop = asc_dmastop;
- sbic->sc_dmacmd = 0;
-
- /*
- * eveything is a valid dma address
- */
- sbic->sc_dmamask = 0;
- sbic->sc_sbicp = (sbic_regmap_p) (sc->sc_podule->mod_base + ASC_SBIC);
- sbic->sc_clkfreq = sbic_clock_override ? sbic_clock_override : 143;
-
- sbic->sc_link.adapter_softc = sbic;
- sbic->sc_link.adapter_target = 7;
- sbic->sc_link.adapter = &asc_scsiswitch;
- sbic->sc_link.device = &asc_scsidev;
- sbic->sc_link.openings = 1; /* was 2 */
-
- sc->sc_pagereg = sc->sc_podule->fast_base + ASC_PAGEREG;
- sc->sc_intstat = sc->sc_podule->fast_base + ASC_INTSTATUS;
-
- /* Reset the card */
-
- WriteByte(sc->sc_pagereg, 0x80);
- DELAY(500000);
- WriteByte(sc->sc_pagereg, 0x00);
- DELAY(250000);
-
- sbicinit(sbic);
-
-/* If we are polling only then we don't need a interrupt handler */
-
- sc->sc_ih.ih_func = asc_intr;
- sc->sc_ih.ih_arg = sc;
- sc->sc_ih.ih_level = IPL_BIO;
- sc->sc_ih.ih_name = "asc";
-
-#ifdef ASC_POLL
- if (!asc_poll)
-#endif
- if (irq_claim(IRQ_PODULE, &sc->sc_ih))
- panic("asc: Cannot claim podule IRQ");
-
- /*
- * attach all scsi units on us
- */
- config_found(dp, &sbic->sc_link, ascprint);
-}
-
-/*
- * print diag if pnp is NULL else just extra
- */
-int
-ascprint(auxp, pnp)
- void *auxp;
- const char *pnp;
-{
- if (pnp == NULL)
- return(UNCONF);
- return(QUIET);
-}
-
-
-void
-asc_enintr(sbicsc)
- struct sbic_softc *sbicsc;
-{
- struct asc_softc *sc = (struct asc_softc *)sbicsc;
-/* printf("asc_enintr\n");*/
-/*
- volatile struct sdmac *sdp;
-
- sdp = dev->sc_cregs;
-
- dev->sc_flags |= SBICF_INTR;
- sdp->CNTR = CNTR_PDMD | CNTR_INTEN;
-*/
- sbicsc->sc_flags |= SBICF_INTR;
- WriteByte(sc->sc_pagereg, 0x40);
-}
-
-
-int
-asc_dmago(dev, addr, count, flags)
- struct sbic_softc *dev;
- char *addr;
- int count, flags;
-{
- printf("asc_dmago\n");
-#ifdef DDB
- Debugger();
-#else
- panic("Hit a brick wall");
-#endif
-#if 0
- volatile struct sdmac *sdp;
-
- sdp = dev->sc_cregs;
- /*
- * Set up the command word based on flags
- */
- dev->sc_dmacmd = CNTR_PDMD | CNTR_INTEN;
- if ((flags & DMAGO_READ) == 0)
- dev->sc_dmacmd |= CNTR_DDIR;
-#ifdef DEBUG
- if (ahsc_dmadebug & DDB_IO)
- printf("ahsc_dmago: cmd %x\n", dev->sc_dmacmd);
-#endif
-
- dev->sc_flags |= SBICF_INTR;
- sdp->CNTR = dev->sc_dmacmd;
- sdp->ACR = (u_int) dev->sc_cur->dc_addr;
- sdp->ST_DMA = 1;
-
- return(dev->sc_tcnt);
-#endif
-}
-
-void
-asc_dmastop(dev)
- struct sbic_softc *dev;
-{
-/* printf("asc_dmastop\n");*/
-#if 0
- volatile struct sdmac *sdp;
- int s;
-
- sdp = dev->sc_cregs;
-
-#ifdef DEBUG
- if (ahsc_dmadebug & DDB_FOLLOW)
- printf("ahsc_dmastop()\n");
-#endif
- if (dev->sc_dmacmd) {
- s = splbio();
- if ((dev->sc_dmacmd & (CNTR_TCEN | CNTR_DDIR)) == 0) {
- /*
- * only FLUSH if terminal count not enabled,
- * and reading from peripheral
- */
- sdp->FLUSH = 1;
- while ((sdp->ISTR & ISTR_FE_FLG) == 0)
- ;
- }
- /*
- * clear possible interrupt and stop dma
- */
- sdp->CINT = 1;
- sdp->SP_DMA = 1;
- dev->sc_dmacmd = 0;
- splx(s);
- }
-#endif
-}
-
-int
-asc_dmaintr(dev)
- struct sbic_softc *dev;
-{
- panic("asc_dmaintr");
-#if 0
- volatile struct sdmac *sdp;
- int stat, found;
-
- sdp = dev->sc_cregs;
- stat = sdp->ISTR;
-
- if ((stat & (ISTR_INT_F|ISTR_INT_P)) == 0)
- return (0);
-
-#ifdef DEBUG
- if (ahsc_dmadebug & DDB_FOLLOW)
- printf("%s: dmaintr 0x%x\n", dev->sc_dev.dv_xname, stat);
-#endif
-
- /*
- * both, SCSI and DMA interrupts arrive here. I chose
- * arbitrarily that DMA interrupts should have higher
- * precedence than SCSI interrupts.
- */
- found = 0;
- if (stat & ISTR_E_INT) {
- ++found;
-
- sdp->CINT = 1; /* clear possible interrupt */
-
- /*
- * check for SCSI ints in the same go and
- * eventually save an interrupt
- */
- }
-
- if (dev->sc_flags & SBICF_INTR && stat & ISTR_INTS)
- found += sbicintr(dev);
- return(found);
-#endif
-}
-
-
-int
-asc_dmanext(dev)
- struct sbic_softc *dev;
-{
- printf("asc_dmanext\n");
-#ifdef DDB
- Debugger();
-#else
- panic("Hit a brick wall");
-#endif
-#if 0
- volatile struct sdmac *sdp;
- int i, stat;
-
- sdp = dev->sc_cregs;
-
- if (dev->sc_cur > dev->sc_last) {
- /* shouldn't happen !! */
- printf("ahsc_dmanext at end !!!\n");
- asc_dmastop(dev);
- return(0);
- }
- if ((dev->sc_dmacmd & (CNTR_TCEN | CNTR_DDIR)) == 0) {
- /*
- * only FLUSH if terminal count not enabled,
- * and reading from peripheral
- */
- sdp->FLUSH = 1;
- while ((sdp->ISTR & ISTR_FE_FLG) == 0)
- ;
- }
- /*
- * clear possible interrupt and stop dma
- */
- sdp->CINT = 1; /* clear possible interrupt */
- sdp->SP_DMA = 1; /* stop dma */
- sdp->CNTR = dev->sc_dmacmd;
- sdp->ACR = (u_int)dev->sc_cur->dc_addr;
- sdp->ST_DMA = 1;
-
- dev->sc_tcnt = dev->sc_cur->dc_count << 1;
- return(dev->sc_tcnt);
-#endif
-}
-
-void
-asc_dump()
-{
- int i;
-
- for (i = 0; i < asc_cd.cd_ndevs; ++i)
- if (asc_cd.cd_devs[i])
- sbic_dump(asc_cd.cd_devs[i]);
-}
-
-int
-asc_scsicmd(xs)
- struct scsi_xfer *xs;
-{
- struct scsi_link *sc_link = xs->sc_link;
-
- /* ensure command is polling for the moment */
-#if ASC_POLL > 0
- if (asc_poll)
- xs->flags |= SCSI_POLL;
-#endif
-
-/* printf("id=%d lun=%dcmdlen=%d datalen=%d opcode=%02x flags=%08x status=%02x blk=%02x %02x\n",
- sc_link->target, sc_link->lun, xs->cmdlen, xs->datalen, xs->cmd->opcode,
- xs->flags, xs->status, xs->cmd->bytes[0], xs->cmd->bytes[1]);*/
-
- return(sbic_scsicmd(xs));
-}
-
-
-int
-asc_intr(sc)
- struct asc_softc *sc;
-{
- int intr;
-
-/* printf("ascintr:");*/
- intr = ReadByte(sc->sc_intstat);
-/* printf("%02x\n", intr);*/
-
- if (intr & IS_SBIC_IRQ)
- sbicintr((struct sbic_softc *)sc);
- return(0);
-}
-
-
-int kvtop()
-{
- printf("kvtop\n");
-#ifdef DDB
- Debugger();
-#else
- panic("Hit a brick wall");
-#endif
- return(0);
-}
-
-void alloc_z2mem()
-{
- panic("allocz2mem");
-}
-
-void isztwomem()
-{
- panic("isz2mem");
-}
-
-void PREP_DMA_MEM()
-{
- panic("PREP_DMA_MEM");
-}
diff --git a/sys/arch/arm32/podulebus/ascreg.h b/sys/arch/arm32/podulebus/ascreg.h
deleted file mode 100644
index dba455eb84a..00000000000
--- a/sys/arch/arm32/podulebus/ascreg.h
+++ /dev/null
@@ -1,279 +0,0 @@
-/* $NetBSD: ascreg.h,v 1.4 1996/03/07 23:54:29 mark Exp $ */
-
-/*
- * Copyright (c) 1996 Mark Brinicombe
- * Copyright (c) 1994 Christian E. Hopps
- * Copyright (c) 1982, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from:ahscreg.h,v 1.2 1994/10/26 02:02:46
- */
-
-#ifndef _ASCREG_H_
-#define _ASCREG_H_
-
-/*
- * Hardware layout of the A3000 SDMAC. This also contains the
- * registers for the sbic chip, but in favor of separating DMA and
- * scsi, the scsi-driver doesn't make use of this dependency
- */
-
-#define v_char volatile char
-#define v_int volatile int
-#define vu_char volatile u_char
-#define vu_short volatile u_short
-#define vu_int volatile u_int
-
-struct sdmac {
- short pad0;
- vu_short DAWR; /* DACK Width Register WO */
- vu_int WTC; /* Word Transfer Count Register RW */
- short pad1;
- vu_short CNTR; /* Control Register RW */
- vu_int ACR; /* Address Count Register RW */
- short pad2;
- vu_short ST_DMA; /* Start DMA Transfers RW-Strobe */
- short pad3;
- vu_short FLUSH; /* Flush FIFO RW-Strobe */
- short pad4;
- vu_short CINT; /* Clear Interrupts RW-Strobe */
- short pad5;
- vu_short ISTR; /* Interrupt Status Register RO */
- int pad6[7];
- short pad7;
- vu_short SP_DMA; /* Stop DMA Transfers RW-Strobe */
- char pad8;
- vu_char SASR; /* sbic asr */
- char pad9;
- vu_char SCMD; /* sbic data */
-};
-
-/*
- * value to go into DAWR
- */
-#define DAWR_AHSC 3 /* according to A3000T service-manual */
-
-/*
- * bits defined for CNTR
- */
-#define CNTR_TCEN (1<<5) /* Terminal Count Enable */
-#define CNTR_PREST (1<<4) /* Perp Reset (not implemented :-((( ) */
-#define CNTR_PDMD (1<<3) /* Perp Device Mode Select (1=SCSI,0=XT/AT) */
-#define CNTR_INTEN (1<<2) /* Interrupt Enable */
-#define CNTR_DDIR (1<<1) /* Device Direction. 1==rd host, wr perp */
-#define CNTR_IO_DX (1<<0) /* IORDY & CSX1 Polarity Select */
-
-/*
- * bits defined for ISTR
- */
-#define ISTR_INTX (1<<8) /* XT/AT Interrupt pending */
-#define ISTR_INT_F (1<<7) /* Interrupt Follow */
-#define ISTR_INTS (1<<6) /* SCSI Peripheral Interrupt */
-#define ISTR_E_INT (1<<5) /* End-Of-Process Interrupt */
-#define ISTR_INT_P (1<<4) /* Interrupt Pending */
-#define ISTR_UE_INT (1<<3) /* Under-Run FIFO Error Interrupt */
-#define ISTR_OE_INT (1<<2) /* Over-Run FIFO Error Interrupt */
-#define ISTR_FF_FLG (1<<1) /* FIFO-Full Flag */
-#define ISTR_FE_FLG (1<<0) /* FIFO-Empty Flag */
-
-#define DMAGO_READ 0x01
-
-
-/* Addresses relative to podule base */
-
-#define ASC_INTSTATUS 0x2000
-#define ASC_CLRINT 0x2000
-#define ASC_PAGEREG 0x3000
-
-/* Addresses relative to module base */
-
-#define ASC_DMAC 0x3000
-#define ASC_SBIC 0x2000
-#define ASC_SRAM 0x0000
-
-#define ASC_SRAM_BLKSIZE 0x1000
-
-#define IS_IRQREQ 0x01
-#define IS_DMAC_IRQ 0x02
-#define IS_SBIC_IRQ 0x08
-
-#if 0
-/* SBIC Commands */
-
-#define SBIC_CMD_Reset 0x00 /* Reset the SBIC */
-#define SBIC_Abort 0x01 /* Abort command */
-#define SBIC_Sel_tx_wATN 0x08 /* Select and Transfer with ATN */
-#define SBIC_Sel_tx_woATN 0x09 /* Select and Transfer without ATN */
-
-/* SBIC status codes */
-
-#define SBIC_ResetOk 0x00
-#define SBIC_ResetAFOk 0x01
-
-/* SBIC registers bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 */
-
-#define SBIC_OWNID 0x00 /* RW FS1 FS0 0 EHP EAF ID2 ID1 ID0 */
-#define SBIC_CONTROL 0x01 /* RW DM2 DM1 DM0 HHP EDI IDI HA HSP */
-#define SBIC_TIMEREG 0x02 /* RW timeout period value = Tper*Ficlk/80d */
-#define SBIC_CDB1TSECT 0x03 /* RW CDB byte 1 & Total sectors per track */
-#define SBIC_CDB2THEAD 0x04 /* RW CDB byte 2 & Total number of heads */
-#define SBIC_CDB3TCYL1 0x05 /* RW CDB byte 3 & Total no. of cylinders MSB */
-#define SBIC_CDB4TCYL2 0x06 /* RW CDB byte 4 & Total no. of cylinders LSB */
-#define SBIC_CDB5LADR1 0x07 /* RW CDB byte 5 & Logical addr to translate */
-#define SBIC_CBD6LADR2 0x08 /* RW CDB byte 6 & Logical addr to translate */
-#define SBIC_CDB7LADR3 0x09 /* RW CDB byte 7 & Logical addr to translate */
-#define SBIC_CDB8LADR4 0x0A /* RW CDB byte 8 & Logical addr to translate */
-#define SBIC_CDB9SECT 0x0B /* RW CDB byte 9 & Translation sector result */
-#define SBIC_CDB10HEAD 0x0C /* RW CDB byte 10 & Translation head result */
-#define SBIC_CDB11CYL1 0x0D /* RW CDB byte 11 & Translation cyl result MSB*/
-#define SBIC_CDB12CYL2 0x0E /* RW CDB byte 12 & Translation cyl result LSB*/
-#define SBIC_TARGETLUN 0x0F /* RW TLV DOK 0 0 0 TL2 TL1 TL0 */
-#define SBIC_COMPHASE 0x10 /* RW Command Phase Register for multi-phase */
-#define SBIC_SYNCTX 0x11 /* RW 0 TP2 TP1 TP0 OF3 OF2 OF1 OF0 */
-#define SBIC_TXCOUNT1 0x12 /* RW Transfer count MSB */
-#define SBIC_TXCOUNT2 0x13 /* RW Transfer count */
-#define SBIC_TXCOUNT3 0x14 /* RW Transfer count LSB */
-#define SBIC_DESTID 0x15 /* RW SCC DPD 0 0 0 DI2 DI1 DI0 */
-#define SBIC_SOURCEID 0x16 /* RW ER ES DSP 0 SIV SI2 SI1 SI0 */
-#define SBIC_SCSISTAT 0x17 /* RO **Interrupt type*** **Int. qualifier** */
-#define SBIC_COMMAND 0x18 /* RW SBT *********Command code************* */
-#define SBIC_DATA 0x19 /* RW Access to data i/o FIFO for polled use */
-
-#define SBIC_ADDRREG 0x00
-#define SBIC_DATAREG 0x04
-#define SBIC_AUX_STATUS 0x00
-
-/*
- * My ID register, and/or CDB Size
- */
-
-#define SBIC_ID_FS_8_10 0x00 /* Input clock is 8-10 Mhz */
- /* 11 Mhz is invalid */
-#define SBIC_ID_FS_12_15 0x40 /* Input clock is 12-15 Mhz */
-#define SBIC_ID_FS_16_20 0x80 /* Input clock is 16-20 Mhz */
-#define SBIC_ID_EHP 0x10 /* Enable host parity */
-#define SBIC_ID_EAF 0x08 /* Enable Advanced Features */
-#define SBIC_ID_MASK 0x07
-#define SBIC_ID_CBDSIZE_MASK 0x0f /* if unk SCSI cmd group */
-
-/*
- * Control register
-*/
-
-#define SBIC_CTL_DMA 0x80 /* Single byte dma */
-#define SBIC_CTL_DBA_DMA 0x40 /* direct buffer acces (bus master)*/
-#define SBIC_CTL_BURST_DMA 0x20 /* continuous mode (8237) */
-#define SBIC_CTL_NO_DMA 0x00 /* Programmed I/O */
-#define SBIC_CTL_HHP 0x10 /* Halt on host parity error */
-#define SBIC_CTL_EDI 0x08 /* Ending disconnect interrupt */
-#define SBIC_CTL_IDI 0x04 /* Intermediate disconnect interrupt*/
-#define SBIC_CTL_HA 0x02 /* Halt on ATN */
-#define SBIC_CTL_HSP 0x01 /* Halt on SCSI parity error */
-
-/*
- * Destination ID register
- */
-
-#define SBIC_DID_DPD 0x40 /* Data Phase Direction */
-
-/*
- * Auxiliary Status Register
- */
-
-#define SBIC_ASR_INT 0x80 /* Interrupt pending */
-#define SBIC_ASR_LCI 0x40 /* Last command ignored */
-#define SBIC_ASR_BSY 0x20 /* Busy, only cmd/data/asr readable */
-#define SBIC_ASR_CIP 0x10 /* Busy, cmd unavail also */
-#define SBIC_ASR_xxx 0x0c
-#define SBIC_ASR_PE 0x02 /* Parity error (even) */
-#define SBIC_ASR_DBR 0x01 /* Data Buffer Ready */
-
-/* DMAC constants */
-
-#define DMAC_Bits 0x01
-#define DMAC_Ctrl1 0x60
-#define DMAC_Ctrl2 0x01
-#define DMAC_CLEAR_MASK 0x0E
-#define DMAC_SET_MASK 0x0F
-#define DMAC_DMA_RD_MODE 0x04
-#define DMAC_DMA_WR_MODE 0x08
-
-/* DMAC registers */
-
-#define DMAC_INITIALISE 0x0000 /* WO ---- ---- ---- ---- ---- ---- 16B RES */
-#define DMAC_CHANNEL 0x0200 /* R ---- ---- ---- BASE SEL3 SEL2 SEL1 SEL0 */
- /* W ---- ---- ---- ---- ---- BASE *SELECT** */
-#define DMAC_TXCNTLO 0x0004 /* RW C7 C6 C5 C4 C3 C2 C1 C0 */
-#define DMAC_TXCNTHI 0x0204 /* RW C15 C14 C13 C12 C11 C10 C9 C8 */
-#define DMAC_TXADRLO 0x0008 /* RW A7 A6 A5 A4 A3 A2 A1 A0 */
-#define DMAC_TXADRMD 0x0208 /* RW A15 A14 A13 A12 A11 A10 A9 A8 */
-#define DMAC_TXADRHI 0x000C /* RW A23 A22 A21 A20 A19 A18 A17 A16 */
-#define DMAC_DEVCON1 0x0010 /* RW AKL RQL EXW ROT CMP DDMA AHLD MTM */
-#define DMAC_DEVCON2 0x0210 /* RW ---- ---- ---- ---- ---- ---- WEV BHLD */
-#define DMAC_MODECON 0x0014 /* RW **TMODE** ADIR AUTI **TDIR*** ---- WORD */
-#define DMAC_STATUS 0x0214 /* RO RQ3 RQ2 RQ1 RQ0 TC3 TC2 TC1 TC0 */
-#if 0
-templo = dmac + 0x0018;/* RO T7 T6 T5 T4 T3 T2 T1 T0 */
-temphi = dmac + 0x0218;/* RO T15 T14 T13 T12 T11 T10 T9 T8 */
-#endif
-#define DMAC_REQREG 0x001C /* RW ---- ---- ---- ---- SRQ3 SRQ2 SRQ1 SRQ0 */
-#define DMAC_MASKREG 0x021C /* RW ---- ---- ---- ---- M3 M2 M1 M0 */
-
-#ifndef _LOCORE
-#define WriteSBIC(a, d) \
- WriteByte(sbic_base + SBIC_ADDRREG, a); \
- WriteByte(sbic_base + SBIC_DATAREG, d);
-
-/*
-#define ReadSBIC(a) \
- (WriteByte(sbic_base, a), ReadWord(sbic_base + 4) & 0xff)
-*/
-#define ReadSBIC(a) \
- ReadSBIC1(sbic_base, a)
-
-
-static inline int
-ReadSBIC1(sbic_base, a)
- u_int sbic_base;
- int a;
-{
- WriteByte(sbic_base + SBIC_ADDRREG, a);
- return(ReadByte(sbic_base + SBIC_DATAREG));
-}
-
-
-#define WriteDMAC(a, d) WriteByte(dmac_base + a, d)
-#define ReadDMAC(a) ReadByte(dmac_base + a)
-#endif
-
-
-#endif
-#endif /* _ASCREG_H_ */
diff --git a/sys/arch/arm32/podulebus/ascvar.h b/sys/arch/arm32/podulebus/ascvar.h
deleted file mode 100644
index a722f2f05dc..00000000000
--- a/sys/arch/arm32/podulebus/ascvar.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* $NetBSD: ascvar.h,v 1.1 1996/03/07 23:54:31 mark Exp $ */
-
-/*
- * Copyright (c) 1996 Mark Brinicombe
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe
- * for the NetBSD Project.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _ASCVAR_H_
-#define _ASCVAR_H_
-
-#include <arm32/podulebus/sbicvar.h>
-#include <arm32/podulebus/ascreg.h>
-
-#define ASC_POLL 1
-
-struct asc_softc {
- struct sbic_softc sc_softc;
-
- podule_t *sc_podule;
- int sc_podule_number;
- irqhandler_t sc_ih;
-
- vu_int sc_pagereg;
- vu_int sc_intstat;
- };
-
-#endif /* _ASCVAR_H_ */
diff --git a/sys/arch/arm32/podulebus/if_ea.c b/sys/arch/arm32/podulebus/if_ea.c
deleted file mode 100644
index 3cd4ea66e3f..00000000000
--- a/sys/arch/arm32/podulebus/if_ea.c
+++ /dev/null
@@ -1,1526 +0,0 @@
-/* $NetBSD: if_ea.c,v 1.4 1996/03/27 21:49:26 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * if_ea.c
- *
- * Ether3 device driver
- *
- * Created : 08/07/95
- */
-
-/*
- * SEEQ 8005 device driver
- */
-
-/*
- * Bugs/possible improvements:
- * - Does not currently support DMA
- * - Does not currently support multicasts
- * - Does not transmit multiple packets in one go
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/syslog.h>
-#include <sys/device.h>
-
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/if_types.h>
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/in_var.h>
-#include <netinet/ip.h>
-#include <netinet/if_ether.h>
-#endif
-
-#include "bpfilter.h"
-#if NBPFILTER > 0
-#include <net/bpf.h>
-#include <net/bpfdesc.h>
-#endif
-
-#include <machine/cpu.h>
-#include <machine/katelib.h>
-#include <machine/io.h>
-#include <machine/irqhandler.h>
-
-#include <arm32/podulebus/if_eareg.h>
-#include <arm32/podulebus/podulebus.h>
-
-#define ETHER_MIN_LEN 64
-#define ETHER_MAX_LEN 1514
-#define ETHER_ADDR_LEN 6
-
-#ifndef EA_TIMEOUT
-#define EA_TIMEOUT 60
-#endif
-
-/*#define EA_TX_DEBUG*/
-/*#define EA_RX_DEBUG*/
-/*#define EA_DEBUG*/
-/*#define EA_PACKET_DEBUG*/
-
-/* for debugging convenience */
-#ifdef EA_DEBUG
-#define dprintf(x) printf x
-#else
-#define dprintf(x)
-#endif
-
-#define MY_MANUFACTURER 0x11
-#define MY_PODULE 0xa4
-
-/*
- * per-line info and status
- */
-
-struct ea_softc {
- struct device sc_dev;
- irqhandler_t sc_ih;
- int sc_irq; /* IRQ number */
- podule_t *sc_podule; /* Our podule */
- int sc_podule_number; /* Our podule number */
- u_int sc_iobase; /* base I/O addr */
- struct arpcom sc_arpcom; /* ethernet common */
- char sc_pktbuf[EA_BUFSIZ]; /* frame buffer */
- int sc_config1; /* Current config1 bits */
- int sc_config2; /* Current config2 bits */
- int sc_command; /* Current command bits */
- int sc_irqclaimed; /* Whether we have an IRQ claimed */
- int sc_rx_ptr; /* Receive buffer pointer */
- int sc_tx_ptr; /* Transmit buffer pointer */
-};
-
-/*
- * prototypes
- */
-
-static int eaintr __P((void *));
-static int ea_init __P((struct ea_softc *));
-static int ea_ioctl __P((struct ifnet *, u_long, caddr_t));
-static void ea_start __P((struct ifnet *));
-static void ea_watchdog __P((int));
-static void ea_reinit __P((struct ea_softc *));
-static void ea_chipreset __P((struct ea_softc *));
-static void ea_ramtest __P((struct ea_softc *));
-static int ea_stoptx __P((struct ea_softc *));
-static int ea_stoprx __P((struct ea_softc *));
-static void ea_stop __P((struct ea_softc *));
-static void ea_writebuf __P((struct ea_softc *, u_char *, int, int));
-static void ea_readbuf __P((struct ea_softc *, u_char *, int, int));
-static void earead __P((struct ea_softc *, caddr_t, int));
-static struct mbuf *eaget __P((caddr_t, int, struct ifnet *));
-static void ea_hardreset __P((struct ea_softc *));
-static void eagetpackets __P((struct ea_softc *));
-static void eatxpacket __P((struct ea_softc *));
-
-int eaprobe __P((struct device *, void *, void *));
-void eaattach __P((struct device *, struct device *, void *));
-
-/* driver structure for autoconf */
-
-struct cfattach ea_ca = {
- sizeof(struct ea_softc), eaprobe, eaattach
-};
-
-struct cfdriver ea_cd = {
- NULL, "ea", DV_IFNET
-};
-
-#if 0
-
-/*
- * Dump the chip registers
- */
-
-void
-eadump(iobase)
- u_int iobase;
-{
- dprintf(("%08x: %04x %04x %04x %04x %04x %04x %04x %04x\n", iobase,
- ReadShort(iobase + 0x00), ReadShort(iobase + 0x40),
- ReadShort(iobase + 0x80), ReadShort(iobase + 0xc0),
- ReadShort(iobase + 0x100), ReadShort(iobase + 0x140),
- ReadShort(iobase + 0x180), ReadShort(iobase + 0x1c0)));
-}
-#endif
-
-/*
- * Dump the interface buffer
- */
-
-void
-ea_dump_buffer(sc, offset)
- struct ea_softc *sc;
- int offset;
-{
-#ifdef EA_PACKET_DEBUG
- u_int iobase = sc->sc_iobase;
- int addr;
- int loop;
- int size;
- int ctrl;
- int ptr;
-
- addr = offset;
-
- do {
- WriteShort(sc->sc_iobase + EA_8005_COMMAND, sc->sc_command | EA_CMD_FIFO_READ);
- WriteShort(iobase + EA_8005_CONFIG1, sc->sc_config1 | EA_BUFCODE_LOCAL_MEM);
- WriteShort(iobase + EA_8005_DMA_ADDR, addr);
-
- ptr = ReadShort(iobase + EA_8005_BUFWIN);
- ctrl = ReadShort(iobase + EA_8005_BUFWIN);
- ptr = ((ptr & 0xff) << 8) | ((ptr >> 8) & 0xff);
-
- if (ptr == 0) break;
- size = ptr - addr;
-
- printf("addr=%04x size=%04x ", addr, size);
- printf("cmd=%02x st=%02x\n", ctrl & 0xff, ctrl >> 8);
-
- for (loop = 0; loop < size - 4; loop += 2)
- printf("%04x ", ReadShort(iobase + EA_8005_BUFWIN));
- printf("\n");
- addr = ptr;
- } while (size != 0);
-#endif
-}
-
-/*
- * Probe routine.
- */
-
-/*
- * int eaprobe(struct device *parent, void *match, void *aux)
- *
- * Probe for the ether3 podule.
- */
-
-int
-eaprobe(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
-{
- struct podule_attach_args *pa = (void *)aux;
- int podule;
- u_int iobase;
-
-/* dprintf(("Probing for SEEQ 8005... \n"));*/
-
-/* Look for a network slot interface */
-
- podule = findpodule(MY_MANUFACTURER, MY_PODULE, pa->pa_podule_number);
-
-/* Fail if we did not find it */
-
- if (podule == -1)
- return(0);
-
- iobase = podules[podule].mod_base + EA_8005_BASE;
-
-/* Reset it - Why here ? */
-
- WriteShort(iobase + EA_8005_CONFIG2, EA_CFG2_RESET);
- delay(100);
-
-/* We found it */
-
- pa->pa_podule_number = podule;
- pa->pa_podule = &podules[podule];
-
- return(1);
-}
-
-
-/*
- * void eaattach(struct device *parent, struct device *dev, void *aux)
- *
- * Attach podule.
- */
-
-void
-eaattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct ea_softc *sc = (void *)self;
- struct podule_attach_args *pa = (void *)aux;
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
- int loop;
- int sum;
-
-/* dprintf(("Attaching %s...\n", sc->sc_dev.dv_xname));*/
-
-/* Note the podule number and validate */
-
- sc->sc_podule_number = pa->pa_podule_number;
- if (sc->sc_podule_number == -1)
- panic("Podule has disappeared !");
-
- sc->sc_podule = &podules[sc->sc_podule_number];
- podules[sc->sc_podule_number].attached = 1;
-
-/* Set the address of the controller for easy access */
-
- sc->sc_iobase = sc->sc_podule->mod_base + EA_8005_BASE;
-
- sc->sc_irqclaimed = 0;
-
-/* Set up the interrupt structure */
-
- sc->sc_ih.ih_func = eaintr;
- sc->sc_ih.ih_arg = sc;
- sc->sc_ih.ih_level = IPL_NET;
- sc->sc_ih.ih_name = "net: ea";
-
-/* Claim either a network slot interrupt or a podule interrupt */
-
- if (sc->sc_podule_number >= MAX_PODULES)
- sc->sc_irq = IRQ_NETSLOT;
- else
- sc->sc_irq = IRQ_PODULE /*+ sc->sc_podule_number*/;
-
- /* Stop the board. */
-
- ea_chipreset(sc);
- ea_stoptx(sc);
- ea_stoprx(sc);
-
- /* Initialise ifnet structure. */
-
- ifp->if_unit = sc->sc_dev.dv_unit;
- ifp->if_name = ea_cd.cd_name;
- ifp->if_start = ea_start;
- ifp->if_ioctl = ea_ioctl;
- ifp->if_watchdog = ea_watchdog;
- ifp->if_flags = IFF_BROADCAST | IFF_NOTRAILERS;
-
- /* Now we can attach the interface. */
-
-/* dprintf(("Attaching interface...\n"));*/
- if_attach(ifp);
- ether_ifattach(ifp);
-
-/* Read the station address - the receiver must be off */
-
- WriteShort(sc->sc_iobase + EA_8005_CONFIG1, EA_BUFCODE_STATION_ADDR0);
-
- for (sum = 0, loop = 0; loop < ETHER_ADDR_LEN; ++loop) {
- sc->sc_arpcom.ac_enaddr[loop] =
- ReadByte(sc->sc_iobase + EA_8005_BUFWIN);
- sum += sc->sc_arpcom.ac_enaddr[loop];
- }
-
-/*
- * Hard code the ether address if we don't have one.
- * Need to work out how I get the real address
- */
-
- if (sum == 0) {
- sc->sc_arpcom.ac_enaddr[0] = 0x00;
- sc->sc_arpcom.ac_enaddr[1] = 0x00;
- sc->sc_arpcom.ac_enaddr[2] = 0xa4;
- sc->sc_arpcom.ac_enaddr[3] = 0x10;
- sc->sc_arpcom.ac_enaddr[4] = 0x02;
- sc->sc_arpcom.ac_enaddr[5] = 0x87;
- }
-
- /* Print out some information for the user. */
-
- printf(" SEEQ8005 address %s", ether_sprintf(sc->sc_arpcom.ac_enaddr));
-
- /* Finally, attach to bpf filter if it is present. */
-
-#if NBPFILTER > 0
-/* dprintf(("Attaching to BPF...\n"));*/
- bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
-#endif
-
- /* Should test the RAM */
-
- ea_ramtest(sc);
-
-/* dprintf(("eaattach() finished.\n"));*/
-}
-
-
-/*
- * Test the RAM on the ethernet card. This does not work yet
- */
-
-void
-ea_ramtest(sc)
- struct ea_softc *sc;
-{
- register u_int iobase = sc->sc_iobase;
- register int loop;
- register u_int sum = 0;
-
-/* dprintf(("ea_ramtest()\n"));*/
-
- /*
- * Test the buffer memory on the board.
- * Write simple pattens to it and read them back.
- */
-
- /* Set up the whole buffer RAM for writing */
-
- WriteShort(iobase + EA_8005_CONFIG1, EA_BUFCODE_TX_EAP);
- WriteShort(iobase + EA_8005_BUFWIN, ((EA_BUFFER_SIZE >> 8) - 1));
- WriteShort(iobase + EA_8005_TX_PTR, 0x0000);
- WriteShort(iobase + EA_8005_RX_PTR, EA_BUFFER_SIZE - 2);
-
- /* Set the write start address and write a pattern */
-
- ea_writebuf(sc, NULL, 0x0000, 0);
-
- for (loop = 0; loop < EA_BUFFER_SIZE; loop += 2)
- WriteShort(iobase + EA_8005_BUFWIN, loop);
-
- /* Set the read start address and verify the pattern */
-
- ea_readbuf(sc, NULL, 0x0000, 0);
-
- for (loop = 0; loop < EA_BUFFER_SIZE; loop += 2)
- if (ReadShort(iobase + EA_8005_BUFWIN) != loop)
- ++sum;
-
- if (sum != 0)
- dprintf(("sum=%d\n", sum));
-
- /* Set the write start address and write a pattern */
-
- ea_writebuf(sc, NULL, 0x0000, 0);
-
- for (loop = 0; loop < EA_BUFFER_SIZE; loop += 2)
- WriteShort(iobase + EA_8005_BUFWIN, loop ^ (EA_BUFFER_SIZE - 1));
-
- /* Set the read start address and verify the pattern */
-
- ea_readbuf(sc, NULL, 0x0000, 0);
-
- for (loop = 0; loop < EA_BUFFER_SIZE; loop += 2)
- if (ReadShort(iobase + EA_8005_BUFWIN) != (loop ^ (EA_BUFFER_SIZE - 1)))
- ++sum;
-
- if (sum != 0)
- dprintf(("sum=%d\n", sum));
-
- /* Set the write start address and write a pattern */
-
- ea_writebuf(sc, NULL, 0x0000, 0);
-
- for (loop = 0; loop < EA_BUFFER_SIZE; loop += 2)
- WriteShort(iobase + EA_8005_BUFWIN, 0xaa55);
-
- /* Set the read start address and verify the pattern */
-
- ea_readbuf(sc, NULL, 0x0000, 0);
-
- for (loop = 0; loop < EA_BUFFER_SIZE; loop += 2)
- if (ReadShort(iobase + EA_8005_BUFWIN) != 0xaa55)
- ++sum;
-
- if (sum != 0)
- dprintf(("sum=%d\n", sum));
-
- /* Set the write start address and write a pattern */
-
- ea_writebuf(sc, NULL, 0x0000, 0);
-
- for (loop = 0; loop < EA_BUFFER_SIZE; loop += 2)
- WriteShort(iobase + EA_8005_BUFWIN, 0x55aa);
-
- /* Set the read start address and verify the pattern */
-
- ea_readbuf(sc, NULL, 0x0000, 0);
-
- for (loop = 0; loop < EA_BUFFER_SIZE; loop += 2)
- if (ReadShort(iobase + EA_8005_BUFWIN) != 0x55aa)
- ++sum;
-
- if (sum != 0)
- dprintf(("sum=%d\n", sum));
-
- /* Report */
-
- if (sum == 0)
- printf(" %dK buffer RAM\n", EA_BUFFER_SIZE / 1024);
- else
- printf(" buffer RAM failed self test, %d faults\n", sum);
-}
-
-
-/* Claim an irq for the board */
-
-void
-ea_claimirq(sc)
- struct ea_softc *sc;
-{
-/* Have we claimed one already ? */
-
- if (sc->sc_irqclaimed) return;
-
-/* Claim it */
-
- dprintf(("ea_claimirq(%d)\n", sc->sc_irq));
- if (irq_claim(sc->sc_irq, &sc->sc_ih))
- panic("Cannot install IRQ handler for IRQ %d", sc->sc_irq);
-
- sc->sc_irqclaimed = 1;
-}
-
-
-/* Release an irq */
-
-void
-ea_releaseirq(sc)
- struct ea_softc *sc;
-{
-/* Have we claimed one ? */
-
- if (!sc->sc_irqclaimed) return;
-
- dprintf(("ea_releaseirq(%d)\n", sc->sc_irq));
- if (irq_release(sc->sc_irq, &sc->sc_ih))
- panic("Cannot release IRQ handler for IRQ %d", sc->sc_irq);
-
- sc->sc_irqclaimed = 0;
-}
-
-
-/*
- * Stop and reinitialise the interface.
- */
-
-static void
-ea_reinit(sc)
- struct ea_softc *sc;
-{
- int s;
-
- dprintf(("eareinit()\n"));
-
-/* Stop and reinitialise the interface */
-
- s = splimp();
- ea_stop(sc);
- ea_init(sc);
- (void)splx(s);
-}
-
-
-/*
- * Stop the tx interface.
- *
- * Returns 0 if the tx was already stopped or 1 if it was active
- */
-
-static int
-ea_stoptx(sc)
- struct ea_softc *sc;
-{
- u_int iobase = sc->sc_iobase;
- int timeout;
- int status;
-
- dprintf(("ea_stoptx()\n"));
-
- status = ReadShort(iobase + EA_8005_STATUS);
- if (!(status & EA_STATUS_TX_ON))
- return(0);
-
-/* Stop any tx and wait for confirmation */
-
- WriteShort(iobase + EA_8005_COMMAND, sc->sc_command | EA_CMD_TX_OFF);
-
- timeout = 20000;
- do {
- status = ReadShort(iobase + EA_8005_STATUS);
- } while ((status & EA_STATUS_TX_ON) && --timeout > 0);
- if (timeout == 0)
- dprintf(("ea_stoptx: timeout waiting for tx termination\n"));
-
-/* Clear any pending tx interrupt */
-
- WriteShort(iobase + EA_8005_COMMAND, sc->sc_command | EA_CMD_TX_INTACK);
- return(1);
-}
-
-
-/*
- * Stop the rx interface.
- *
- * Returns 0 if the tx was already stopped or 1 if it was active
- */
-
-static int
-ea_stoprx(sc)
- struct ea_softc *sc;
-{
- u_int iobase = sc->sc_iobase;
- int timeout;
- int status;
-
- dprintf(("ea_stoprx()\n"));
-
- status = ReadShort(iobase + EA_8005_STATUS);
- if (!(status & EA_STATUS_RX_ON))
- return(0);
-
-/* Stop any rx and wait for confirmation */
-
- WriteShort(iobase + EA_8005_COMMAND, sc->sc_command | EA_CMD_RX_OFF);
-
- timeout = 20000;
- do {
- status = ReadShort(iobase + EA_8005_STATUS);
- } while ((status & EA_STATUS_RX_ON) && --timeout > 0);
- if (timeout == 0)
- dprintf(("ea_stoprx: timeout waiting for rx termination\n"));
-
-/* Clear any pending rx interrupt */
-
- WriteShort(iobase + EA_8005_COMMAND, sc->sc_command | EA_CMD_RX_INTACK);
- return(1);
-}
-
-
-/*
- * Stop interface.
- * Stop all IO and shut the interface down
- */
-
-static void
-ea_stop(sc)
- struct ea_softc *sc;
-{
- u_int iobase = sc->sc_iobase;
-
- dprintf(("ea_stop()\n"));
-
-/* Stop all IO */
-
- ea_stoptx(sc);
- ea_stoprx(sc);
-
-/* Disable rx and tx interrupts */
-
- sc->sc_command &= (EA_CMD_RX_INTEN | EA_CMD_TX_INTEN);
-
-/* Clear any pending interrupts */
-
- WriteShort(iobase + EA_8005_COMMAND, sc->sc_command
- | EA_CMD_RX_INTACK | EA_CMD_TX_INTACK | EA_CMD_DMA_INTACK
- | EA_CMD_BW_INTACK);
- dprintf(("st=%08x", ReadShort(iobase + EA_8005_STATUS)));
-
-/* Release the irq */
-
- ea_releaseirq(sc);
-
- /* Cancel any watchdog timer */
-
- sc->sc_arpcom.ac_if.if_timer = 0;
-}
-
-
-/*
- * Reset the chip
- * Following this the software registers are reset
- */
-
-static void
-ea_chipreset(sc)
- struct ea_softc *sc;
-{
- u_int iobase = sc->sc_iobase;
-
- dprintf(("ea_chipreset()\n"));
-
-/* Reset the controller. Min of 4us delay here */
-
- WriteShort(iobase + EA_8005_CONFIG2, EA_CFG2_RESET);
- delay(100);
-
- sc->sc_command = 0;
- sc->sc_config1 = 0;
- sc->sc_config2 = 0;
-}
-
-
-/*
- * Do a hardware reset of the board, and upload the ethernet address again in
- * case the board forgets.
- */
-
-static void
-ea_hardreset(sc)
- struct ea_softc *sc;
-{
- u_int iobase = sc->sc_iobase;
- int loop;
-
- dprintf(("ea_hardreset()\n"));
-
-/* Stop any activity */
-
- ea_stoptx(sc);
- ea_stoprx(sc);
-
- ea_chipreset(sc);
-
-/* Set up defaults for the registers */
-
- sc->sc_config2 = 0;
- WriteShort(iobase + EA_8005_CONFIG2, sc->sc_config2);
- sc->sc_command = 0x00;
- sc->sc_config1 = EA_CFG1_STATION_ADDR0 | EA_CFG1_DMA_BSIZE_1 | EA_CFG1_DMA_BURST_CONT;
- WriteShort(iobase + EA_8005_CONFIG1, sc->sc_config1);
- WriteShort(iobase + EA_8005_COMMAND, sc->sc_command);
-
- WriteShort(iobase + EA_8005_CONFIG1, EA_BUFCODE_TX_EAP);
- WriteShort(iobase + EA_8005_BUFWIN, ((EA_TX_BUFFER_SIZE >> 8) - 1));
-
-/* Write the station address - the receiver must be off */
-
- WriteShort(sc->sc_iobase + EA_8005_CONFIG1,
- sc->sc_config1 | EA_BUFCODE_STATION_ADDR0);
- for (loop = 0; loop < ETHER_ADDR_LEN; ++loop) {
- WriteByte(sc->sc_iobase + EA_8005_BUFWIN, sc->sc_arpcom.ac_enaddr[loop]);
- }
-}
-
-
-/*
- * write to the buffer memory on the interface
- *
- * If addr is within range for the interface buffer then the buffer
- * address is set to addr.
- * If len != 0 then data is copied from the address starting at buf
- * to the interface buffer.
- */
-
-static void
-ea_writebuf(sc, buf, addr, len)
- struct ea_softc *sc;
- u_char *buf;
- int addr;
- int len;
-{
- u_int iobase = sc->sc_iobase;
- int loop;
- int timeout;
-
- dprintf(("writebuf: st=%04x\n", ReadShort(iobase + EA_8005_STATUS)));
-
-/* If we have a valid buffer address set the buffer pointer and direction */
-
- if (addr >= 0 && addr < EA_BUFFER_SIZE) {
- WriteShort(iobase + EA_8005_CONFIG1, sc->sc_config1 | EA_BUFCODE_LOCAL_MEM);
- WriteShort(iobase + EA_8005_COMMAND, sc->sc_command | EA_CMD_FIFO_WRITE);
-
- /* Should wait here of FIFO empty flag */
-
- timeout = 20000;
- while ((ReadShort(iobase + EA_8005_STATUS) & EA_STATUS_FIFO_EMPTY) == 0 && --timeout > 0);
-
-
- WriteShort(iobase + EA_8005_DMA_ADDR, addr);
- }
-
- for (loop = 0; loop < len; loop += 2)
- WriteShort(iobase + EA_8005_BUFWIN, buf[loop] | buf[loop + 1] << 8);
-
-/* if (len > 0)
- outsw(iobase + EA_8005_BUFWIN, buf, len / 2);*/
-}
-
-
-/*
- * read from the buffer memory on the interface
- *
- * If addr is within range for the interface buffer then the buffer
- * address is set to addr.
- * If len != 0 then data is copied from the interface buffer to the
- * address starting at buf.
- */
-
-static void
-ea_readbuf(sc, buf, addr, len)
- struct ea_softc *sc;
- u_char *buf;
- int addr;
- int len;
-{
- u_int iobase = sc->sc_iobase;
- int loop;
- int word;
- int timeout;
-
- dprintf(("readbuf: st=%04x addr=%04x len=%d\n", ReadShort(iobase + EA_8005_STATUS), addr, len));
-
-/* If we have a valid buffer address set the buffer pointer and direction */
-
- if (addr >= 0 && addr < EA_BUFFER_SIZE) {
- if ((ReadShort(iobase + EA_8005_STATUS) & EA_STATUS_FIFO_DIR) == 0) {
- /* Should wait here of FIFO empty flag */
-
- timeout = 20000;
- while ((ReadShort(iobase + EA_8005_STATUS) & EA_STATUS_FIFO_EMPTY) == 0 && --timeout > 0);
- }
- WriteShort(iobase + EA_8005_CONFIG1, sc->sc_config1 | EA_BUFCODE_LOCAL_MEM);
- WriteShort(iobase + EA_8005_COMMAND, sc->sc_command | EA_CMD_FIFO_WRITE);
-
- /* Should wait here of FIFO empty flag */
-
- timeout = 20000;
- while ((ReadShort(iobase + EA_8005_STATUS) & EA_STATUS_FIFO_EMPTY) == 0 && --timeout > 0);
-
- WriteShort(iobase + EA_8005_DMA_ADDR, addr);
- WriteShort(iobase + EA_8005_COMMAND, sc->sc_command | EA_CMD_FIFO_READ);
-
- /* Should wait here of FIFO full flag */
-
- timeout = 20000;
- while ((ReadShort(iobase + EA_8005_STATUS) & EA_STATUS_FIFO_FULL) == 0 && --timeout > 0);
-
-
- }
-
- for (loop = 0; loop < len; loop += 2) {
- word = ReadShort(iobase + EA_8005_BUFWIN);
- buf[loop] = word & 0xff;
- buf[loop + 1] = word >> 8;
- }
-}
-
-
-/*
- * Initialize interface.
- *
- * This should leave the interface in a state for packet reception and transmission
- */
-
-static int
-ea_init(sc)
- struct ea_softc *sc;
-{
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
- u_int iobase = sc->sc_iobase;
- int s;
-
- dprintf(("ea_init()\n"));
-
- s = splimp();
-
-/* Grab an irq */
-
- ea_claimirq(sc);
-
- /* First, reset the board. */
-
- ea_hardreset(sc);
-
-/* Configure rx. */
-
- dprintf(("Configuring rx...\n"));
- if (ifp->if_flags & IFF_PROMISC)
- sc->sc_config1 = EA_CFG1_PROMISCUOUS;
- else
- sc->sc_config1 = EA_CFG1_BROADCAST;
-
- sc->sc_config1 |= EA_CFG1_DMA_BSIZE_8 | EA_CFG1_STATION_ADDR0 | EA_CFG1_DMA_BURST_CONT;
- WriteShort(iobase + EA_8005_CONFIG1, sc->sc_config1);
-
-/* Configure TX. */
-
- dprintf(("Configuring tx...\n"));
-
- WriteShort(iobase + EA_8005_CONFIG1, sc->sc_config1 | EA_BUFCODE_TX_EAP);
- WriteShort(iobase + EA_8005_BUFWIN, ((EA_TX_BUFFER_SIZE >> 8) - 1));
- WriteShort(iobase + EA_8005_TX_PTR, 0x0000);
-
- sc->sc_config2 |= EA_CFG2_OUTPUT;
- WriteShort(iobase + EA_8005_CONFIG2, sc->sc_config2);
-
-/* Place a NULL header at the beginning of the transmit area */
-
- ea_writebuf(sc, NULL, 0x0000, 0);
-
- WriteShort(iobase + EA_8005_BUFWIN, 0x0000);
- WriteShort(iobase + EA_8005_BUFWIN, 0x0000);
-
- sc->sc_command |= EA_CMD_TX_INTEN;
- WriteShort(iobase + EA_8005_COMMAND, sc->sc_command);
-
-/* Setup the Rx pointers */
-
- sc->sc_rx_ptr = EA_TX_BUFFER_SIZE;
-
- WriteShort(iobase + EA_8005_RX_PTR, sc->sc_rx_ptr);
- WriteShort(iobase + EA_8005_RX_END, (sc->sc_rx_ptr >> 8));
-
-/* Place a NULL header at the beginning of the receive area */
-
- ea_writebuf(sc, NULL, sc->sc_rx_ptr, 0);
-
- WriteShort(iobase + EA_8005_BUFWIN, 0x0000);
- WriteShort(iobase + EA_8005_BUFWIN, 0x0000);
-
-/* Turn on Rx */
-
- sc->sc_command |= EA_CMD_RX_INTEN;
- WriteShort(iobase + EA_8005_COMMAND, sc->sc_command | EA_CMD_RX_ON);
-
- /* Set flags appropriately. */
- ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
-
- dprintf(("init: st=%04x\n", ReadShort(iobase + EA_8005_STATUS)));
-
- /* And start output. */
- ea_start(ifp);
-
- (void)splx(s);
- return(0);
-}
-
-
-/*
- * Start output on interface. Get datagrams from the queue and output them,
- * giving the receiver a chance between datagrams. Call only from splimp or
- * interrupt level!
- */
-
-static void
-ea_start(ifp)
- struct ifnet *ifp;
-{
- struct ea_softc *sc = ea_cd.cd_devs[ifp->if_unit];
- int s;
-
- s = splimp();
-#ifdef EA_TX_DEBUG
- dprintf(("ea_start()...\n"));
-#endif
-
- /* Don't do anything if output is active. */
-
- if (sc->sc_arpcom.ac_if.if_flags & IFF_OACTIVE)
- return;
-
- /* Mark interface as output active */
-
- sc->sc_arpcom.ac_if.if_flags |= IFF_OACTIVE;
-
- /* tx packets */
-
- eatxpacket(sc);
- (void)splx(s);
-}
-
-
-/*
- * Transfer a packet to the interface buffer and start transmission
- *
- * Called at splimp()
- */
-
-void
-eatxpacket(sc)
- struct ea_softc *sc;
-{
- u_int iobase = sc->sc_iobase;
- struct mbuf *m, *m0;
- int len;
-
-/* Dequeue the next datagram. */
-
- IF_DEQUEUE(&sc->sc_arpcom.ac_if.if_snd, m0);
-
-/* If there's nothing to send, return. */
-
- if (!m0) {
- sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
- sc->sc_config2 |= EA_CFG2_OUTPUT;
- WriteShort(iobase + EA_8005_CONFIG2, sc->sc_config2);
-#ifdef EA_TX_DEBUG
- dprintf(("tx finished\n"));
-#endif
- return;
- }
-
- /* Give the packet to the bpf, if any. */
-#if NBPFILTER > 0
- if (sc->sc_arpcom.ac_if.if_bpf)
- bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m0);
-#endif
-
-#ifdef EA_TX_DEBUG
- dprintf(("Tx new packet\n"));
-#endif
-
-/*
- * Copy the datagram to the temporary buffer.
- *
- * Eventually we may as well just copy straight into the interface buffer
- */
-
- len = 0;
- for (m = m0; m; m = m->m_next) {
- if (m->m_len == 0)
- continue;
- bcopy(mtod(m, caddr_t), sc->sc_pktbuf + len, m->m_len);
- len += m->m_len;
- }
- m_freem(m0);
-
-/* If packet size is odd round up to the next 16 bit boundry */
-
- if (len % 2)
- ++len;
-
- len = max(len, ETHER_MIN_LEN);
-
- if (len > ETHER_MAX_LEN)
- log(LOG_WARNING, "ea: oversize packet = %d bytes\n", len);
-
-/* Ok we now have a packet len bytes long in our packet buffer */
-
-/* Transfer datagram to board. */
-
-#ifdef EA_TX_DEBUG
- dprintf(("ea: xfr pkt length=%d...\n", len));
-
- dprintf(("%s-->", ether_sprintf(sc->sc_pktbuf+6)));
- dprintf(("%s\n", ether_sprintf(sc->sc_pktbuf)));
-#endif
-
- sc->sc_config2 &= ~EA_CFG2_OUTPUT;
- WriteShort(iobase + EA_8005_CONFIG2, sc->sc_config2);
-
-/* dprintf(("st=%04x\n", ReadShort(iobase + EA_8005_STATUS)));*/
-
-/* Write the packet to the interface buffer, skipping the packet header */
-
- ea_writebuf(sc, sc->sc_pktbuf, 0x0004, len);
-
-/* Follow it with a NULL packet header */
-
- WriteShort(iobase + EA_8005_BUFWIN, 0x00);
- WriteShort(iobase + EA_8005_BUFWIN, 0x00);
-
-/* Write the packet header */
-
- ea_writebuf(sc, NULL, 0x0000, 0);
-
- WriteShort(iobase + EA_8005_BUFWIN, (((len+4) & 0xff00) >> 8) | (((len+4) & 0xff) << 8));
- WriteShort(iobase + EA_8005_BUFWIN, 0x00aa);
-
- WriteShort(iobase + EA_8005_TX_PTR, 0x0000);
-
-/* dprintf(("st=%04x\n", ReadShort(iobase + EA_8005_STATUS)));*/
-
-#ifdef EA_DEBUG
- ea_dump_buffer(sc, 0);
-#endif
-
-/* Now transmit the datagram. */
-
-/* dprintf(("st=%04x\n", ReadShort(iobase + EA_8005_STATUS)));*/
- WriteShort(iobase + EA_8005_COMMAND, sc->sc_command | EA_CMD_TX_ON);
-#ifdef EA_TX_DEBUG
- dprintf(("st=%04x\n", ReadShort(iobase + EA_8005_STATUS)));
- dprintf(("tx: queued\n"));
-#endif
-}
-
-
-/*
- * Ethernet controller interrupt.
- */
-
-int
-eaintr(arg)
- void *arg;
-{
- register struct ea_softc *sc = arg;
- u_int iobase = sc->sc_iobase;
- int status, s;
- u_int txstatus;
-
- dprintf(("eaintr: "));
-
-/* Get the controller status */
-
- status = ReadShort(iobase + EA_8005_STATUS);
- dprintf(("st=%04x ", status));
-
-/* Tx interrupt ? */
-
- if (status & EA_STATUS_TX_INT) {
- dprintf(("txint "));
-
-/* Acknowledge the interrupt */
-
- WriteShort(iobase + EA_8005_COMMAND, sc->sc_command
- | EA_CMD_TX_INTACK);
-
- ea_readbuf(sc, (u_char *)&txstatus, 0x0000, 4);
-
-#ifdef EA_TX_DEBUG
- dprintf(("txstatus=%08x\n", txstatus));
-#endif
- txstatus = (txstatus >> 24) & 0xff;
-
-/*
- * Did it succeed ? Did we collide ?
- *
- * The exact proceedure here is not clear. We should get
- * an interrupt on a sucessfull tx or on a collision.
- * The done flag is set after successfull tx or 16 collisions
- * We should thus get a interrupt for each of collision
- * and the done bit should not be set. However it does appear
- * to be set at the same time as the collision bit ...
- *
- * So we will count collisions and output errors and will assume
- * that if the done bit is set the packet was transmitted.
- * Stats may be wrong if 16 collisions occur on a packet
- * as the done flag should be set but the packet may not have been
- * transmitted. so the output count might not require incrementing
- * if the 16 collisions flags is set. I don;t know abou this until
- * it happens.
- */
-
- if (txstatus & EA_TXHDR_COLLISION) {
- sc->sc_arpcom.ac_if.if_collisions++;
- } else if (txstatus & EA_TXHDR_ERROR_MASK) {
- sc->sc_arpcom.ac_if.if_oerrors++;
- }
-
-/* if (txstatus & EA_TXHDR_ERROR_MASK) {
- log(LOG_WARNING, "tx packet error =%02x\n", txstatus);
- }*/
-
- if (txstatus & EA_PKTHDR_DONE) {
- sc->sc_arpcom.ac_if.if_opackets++;
-
- /* Tx next packet */
-
- s = splimp();
- eatxpacket(sc);
- (void)splx(s);
- }
- }
-
-/* Rx interrupt ? */
-
- if (status & EA_STATUS_RX_INT) {
- dprintf(("rxint "));
-
-/* Acknowledge the interrupt */
-
- WriteShort(iobase + EA_8005_COMMAND, sc->sc_command
- | EA_CMD_RX_INTACK);
-
-/* Install a watchdog timer needed atm to fixed rx lockups */
-
- sc->sc_arpcom.ac_if.if_timer = EA_TIMEOUT;
-
-/* Processes the received packets */
- eagetpackets(sc);
-
-/* Make sure the receiver is on */
-
-/* if ((status & EA_STATUS_RX_ON) == 0) {
- WriteShort(iobase + EA_8005_COMMAND, sc->sc_command
- | EA_CMD_RX_ON);
- printf("rxintr: rx is off st=%04x\n",status);
- }*/
- }
-
-#ifdef EA_DEBUG
- status = ReadShort(iobase + EA_8005_STATUS);
- dprintf(("st=%04x\n", status));
-#endif
- return(0);
-}
-
-void
-eagetpackets(sc)
- struct ea_softc *sc;
-{
- u_int iobase = sc->sc_iobase;
- int addr;
- int len;
- int ctrl;
- int ptr;
- int pack;
- int status;
- u_int rxstatus;
-
-/* We start from the last rx pointer position */
-
- addr = sc->sc_rx_ptr;
- sc->sc_config2 &= ~EA_CFG2_OUTPUT;
- WriteShort(iobase + EA_8005_CONFIG2, sc->sc_config2);
-
- do {
-/* Read rx header */
-
- ea_readbuf(sc, (u_char *)&rxstatus, addr, 4);
-
-/* Split the packet header */
-
- ptr = ((rxstatus & 0xff) << 8) | ((rxstatus >> 8) & 0xff);
- ctrl = (rxstatus >> 16) & 0xff;
- status = (rxstatus >> 24) & 0xff;
-
-#ifdef EA_RX_DEBUG
- dprintf(("addr=%04x ptr=%04x ctrl=%02x status=%02x\n", addr, ptr, ctrl, status));
-#endif
-
-/* Zero packet ptr ? then must be null header so exit */
-
- if (ptr == 0) break;
-
-/* Get packet length */
-
- len = (ptr - addr) - 4;
-
- if (len < 0) {
- len += EA_RX_BUFFER_SIZE;
- }
-
-#ifdef EA_RX_DEBUG
- dprintf(("len=%04x\n", len));
-#endif
-
-/* Has the packet rx completed ? if not then exit */
-
- if ((status & EA_PKTHDR_DONE) == 0)
- break;
-
-/* Did we have any errors ? then note error and go to next packet */
-
- if (status & 0x0f) {
- ++sc->sc_arpcom.ac_if.if_ierrors;
- printf("rx packet error (%02x) - dropping packet\n", status & 0x0f);
-/* sc->sc_config2 |= EA_CFG2_OUTPUT;
- WriteShort(iobase + EA_8005_CONFIG2, sc->sc_config2);
- ea_reinit(sc);
- return; */
- addr = ptr;
- continue;
- }
-
-/* Is the packet too big ? - this will probably be trapped above as a receive error */
-
- if (len > ETHER_MAX_LEN) {
- ++sc->sc_arpcom.ac_if.if_ierrors;
- printf("rx packet size error len=%d\n", len);
-/* sc->sc_config2 |= EA_CFG2_OUTPUT;
- WriteShort(iobase + EA_8005_CONFIG2, sc->sc_config2);
- ea_reinit(sc);
- return;*/
- addr = ptr;
- continue;
- }
-
- ea_readbuf(sc, sc->sc_pktbuf, addr + 4, len);
-
-#ifdef EA_RX_DEBUG
- dprintf(("%s-->", ether_sprintf(sc->sc_pktbuf+6)));
- dprintf(("%s\n", ether_sprintf(sc->sc_pktbuf)));
-#endif
- sc->sc_arpcom.ac_if.if_ipackets++;
- /* Pass data up to upper levels. */
- earead(sc, (caddr_t)sc->sc_pktbuf, len);
-
- addr = ptr;
- ++pack;
- } while (len != 0);
-
- sc->sc_config2 |= EA_CFG2_OUTPUT;
- WriteShort(iobase + EA_8005_CONFIG2, sc->sc_config2);
-
-#ifdef EA_RX_DEBUG
- dprintf(("new rx ptr=%04x\n", addr));
-#endif
-
-/* Store new rx pointer */
-
- sc->sc_rx_ptr = addr;
- WriteShort(iobase + EA_8005_RX_END, (sc->sc_rx_ptr >> 8));
-
-/* Make sure the receiver is on */
-
- WriteShort(iobase + EA_8005_COMMAND, sc->sc_command
- | EA_CMD_RX_ON);
-
-}
-
-
-/*
- * Pass a packet up to the higher levels.
- */
-
-static void
-earead(sc, buf, len)
- struct ea_softc *sc;
- caddr_t buf;
- int len;
-{
- register struct ether_header *eh;
- struct mbuf *m;
-
- eh = (struct ether_header *)buf;
- len -= sizeof(struct ether_header);
- if (len <= 0)
- return;
-
- /* Pull packet off interface. */
- m = eaget(buf, len, &sc->sc_arpcom.ac_if);
- if (m == 0)
- return;
-
-#if NBPFILTER > 0
- /*
- * Check if there's a BPF listener on this interface.
- * If so, hand off the raw packet to bpf.
- */
- if (sc->sc_arpcom.ac_if.if_bpf) {
- bpf_tap(sc->sc_arpcom.ac_if.if_bpf, buf, len + sizeof(struct ether_header));
-/* bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m);*/
-
- }
-#endif
-
- ether_input(&sc->sc_arpcom.ac_if, eh, m);
-}
-
-/*
- * Pull read data off a interface. Len is length of data, with local net
- * header stripped. We copy the data into mbufs. When full cluster sized
- * units are present we copy into clusters.
- */
-
-struct mbuf *
-eaget(buf, totlen, ifp)
- caddr_t buf;
- int totlen;
- struct ifnet *ifp;
-{
- struct mbuf *top, **mp, *m;
- int len;
- register caddr_t cp = buf;
- char *epkt;
-
- buf += sizeof(struct ether_header);
- cp = buf;
- epkt = cp + totlen;
-
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (m == 0)
- return 0;
- m->m_pkthdr.rcvif = ifp;
- m->m_pkthdr.len = totlen;
- m->m_len = MHLEN;
- top = 0;
- mp = &top;
-
- while (totlen > 0) {
- if (top) {
- MGET(m, M_DONTWAIT, MT_DATA);
- if (m == 0) {
- m_freem(top);
- return 0;
- }
- m->m_len = MLEN;
- }
- len = min(totlen, epkt - cp);
- if (len >= MINCLSIZE) {
- MCLGET(m, M_DONTWAIT);
- if (m->m_flags & M_EXT)
- m->m_len = len = min(len, MCLBYTES);
- else
- len = m->m_len;
- } else {
- /*
- * Place initial small packet/header at end of mbuf.
- */
- if (len < m->m_len) {
- if (top == 0 && len + max_linkhdr <= m->m_len)
- m->m_data += max_linkhdr;
- m->m_len = len;
- } else
- len = m->m_len;
- }
- bcopy(cp, mtod(m, caddr_t), (unsigned)len);
- cp += len;
- *mp = m;
- mp = &m->m_next;
- totlen -= len;
- if (cp == epkt)
- cp = buf;
- }
-
- return top;
-}
-
-/*
- * Process an ioctl request. This code needs some work - it looks pretty ugly.
- */
-static int
-ea_ioctl(ifp, cmd, data)
- register struct ifnet *ifp;
- u_long cmd;
- caddr_t data;
-{
- struct ea_softc *sc = ea_cd.cd_devs[ifp->if_unit];
- struct ifaddr *ifa = (struct ifaddr *)data;
-/* struct ifreq *ifr = (struct ifreq *)data;*/
- int s, error = 0;
-
- s = splimp();
-
- if ((error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data)) > 0) {
- splx(s);
- return error;
- }
-
- switch (cmd) {
-
- case SIOCSIFADDR:
- ifp->if_flags |= IFF_UP;
- dprintf(("if_flags=%08x\n", ifp->if_flags));
-
- switch (ifa->ifa_addr->sa_family) {
-#ifdef INET
- case AF_INET:
- arp_ifinit(&sc->sc_arpcom, ifa);
- dprintf(("Interface ea is coming up (AF_INET)\n"));
- ea_init(sc);
- break;
-#endif
- default:
- dprintf(("Interface ea is coming up (default)\n"));
- ea_init(sc);
- break;
- }
- break;
-
- case SIOCSIFFLAGS:
- dprintf(("if_flags=%08x\n", ifp->if_flags));
- if ((ifp->if_flags & IFF_UP) == 0 &&
- (ifp->if_flags & IFF_RUNNING) != 0) {
- /*
- * If interface is marked down and it is running, then
- * stop it.
- */
- dprintf(("Interface ea is stopping\n"));
- ea_stop(sc);
- ifp->if_flags &= ~IFF_RUNNING;
- } else if ((ifp->if_flags & IFF_UP) != 0 &&
- (ifp->if_flags & IFF_RUNNING) == 0) {
- /*
- * If interface is marked up and it is stopped, then
- * start it.
- */
- dprintf(("Interface ea is restarting(1)\n"));
- ea_init(sc);
- } else {
- /*
- * Some other important flag might have changed, so
- * reset.
- */
- dprintf(("Interface ea is reinitialising\n"));
- ea_reinit(sc);
- }
- break;
-
- default:
- error = EINVAL;
- break;
- }
-
- (void)splx(s);
- return error;
-}
-
-/*
- * Device timeout routine.
- *
- * Ok I am not sure exactly how the device timeout should work....
- * Currently what will happens is that that the device timeout is only
- * set when a packet it received. This indicates we are on an active
- * network and thus we should expect more packets. If non arrive in
- * in the timeout period then we reinitialise as we may have jammed.
- * We zero the timeout at this point so that we don't end up with
- * an endless stream of timeouts if the network goes down.
- */
-
-static void
-ea_watchdog(unit)
- int unit;
-{
- struct ea_softc *sc = ea_cd.cd_devs[unit];
-
- log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname);
- sc->sc_arpcom.ac_if.if_oerrors++;
- dprintf(("ea_watchdog: "));
- dprintf(("st=%04x\n", ReadShort(sc->sc_iobase + EA_8005_STATUS)));
-
- /* Kick the interface */
-
- ea_reinit(sc);
-
-/* sc->sc_arpcom.ac_if.if_timer = EA_TIMEOUT;*/
- sc->sc_arpcom.ac_if.if_timer = 0;
-}
-
-/* End of if_ea.c */
diff --git a/sys/arch/arm32/podulebus/if_eareg.h b/sys/arch/arm32/podulebus/if_eareg.h
deleted file mode 100644
index 7d069da6440..00000000000
--- a/sys/arch/arm32/podulebus/if_eareg.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/* $NetBSD: if_eareg.h,v 1.2 1996/03/18 21:23:09 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * if_eareg.h
- *
- * Ether3 device driver
- *
- * Created : 08/07/95
- */
-
-/*
- * SEEQ 8005 Register Definitions
- */
-
-#define EA_8005_BASE 0x000
-
-/*
- * SEEQ 8005 registers
- */
-
-
-#define EA_8005_COMMAND 0x000
-#define EA_8005_STATUS 0x000
-#define EA_8005_CONFIG1 0x040
-#define EA_8005_CONFIG2 0x080
-#define EA_8005_RX_END 0x0c0
-#define EA_8005_BUFWIN 0x100
-#define EA_8005_RX_PTR 0x140
-#define EA_8005_TX_PTR 0x180
-#define EA_8005_DMA_ADDR 0x1c0
-
-/* */
-
-#define EA_CMD_DMA_INTEN (1 << 0)
-#define EA_CMD_RX_INTEN (1 << 1)
-#define EA_CMD_TX_INTEN (1 << 2)
-#define EA_CMD_BW_INTEN (1 << 3)
-#define EA_CMD_DMA_INTACK (1 << 4)
-#define EA_CMD_RX_INTACK (1 << 5)
-#define EA_CMD_TX_INTACK (1 << 6)
-#define EA_CMD_BW_INTACK (1 << 7)
-#define EA_CMD_DMA_ON (1 << 8)
-#define EA_CMD_RX_ON (1 << 9)
-#define EA_CMD_TX_ON (1 << 10)
-#define EA_CMD_DMA_OFF (1 << 11)
-#define EA_CMD_RX_OFF (1 << 12)
-#define EA_CMD_TX_OFF (1 << 13)
-#define EA_CMD_FIFO_READ (1 << 14)
-#define EA_CMD_FIFO_WRITE (1 << 15)
-
-#define EA_STATUS_DMA_INT (1 << 4)
-#define EA_STATUS_RX_INT (1 << 5)
-#define EA_STATUS_TX_INT (1 << 6)
-#define EA_STATUS_RX_ON (1 << 9)
-#define EA_STATUS_TX_ON (1 << 10)
-#define EA_STATUS_FIFO_FULL (1 << 13)
-#define EA_STATUS_FIFO_EMPTY (1 << 14)
-#define EA_STATUS_FIFO_DIR (1 << 15)
-#define EA_STATUS_FIFO_READ (1 << 15)
-
-#define EA_CFG1_DMA_BURST_CONT 0x00
-#define EA_CFG1_DMA_BURST_800 0x10
-#define EA_CFG1_DMA_BURST_1600 0x20
-#define EA_CFG1_DMA_BURST_3200 0x30
-#define EA_CFG1_DMA_BSIZE_1 0x00
-#define EA_CFG1_DMA_BSIZE_4 0x40
-#define EA_CFG1_DMA_BSIZE_8 0x80
-#define EA_CFG1_DMA_BSIZE_16 0xc0
-
-#define EA_CFG1_STATION_ADDR0 (1 << 8)
-#define EA_CFG1_STATION_ADDR1 (1 << 9)
-#define EA_CFG1_STATION_ADDR2 (1 << 10)
-#define EA_CFG1_STATION_ADDR3 (1 << 11)
-#define EA_CFG1_STATION_ADDR4 (1 << 12)
-#define EA_CFG1_STATION_ADDR5 (1 << 13)
-#define EA_CFG1_SPECIFIC ((0 << 15) | (0 << 14))
-#define EA_CFG1_BROADCAST ((0 << 15) | (1 << 14))
-#define EA_CFG1_MULTICAST ((1 << 15) | (0 << 14))
-#define EA_CFG1_PROMISCUOUS ((1 << 15) | (1 << 14))
-
-#define EA_CFG2_BYTESWAP (1 << 0)
-#define EA_CFG2_CRC_ERR_ENABLE (1 << 3)
-#define EA_CFG2_DRIB_ERR_ENABLE (1 << 4)
-#define EA_CFG2_PASS_SHORT (1 << 5)
-#define EA_CFG2_SLOT_SELECT (1 << 6)
-#define EA_CFG2_PREAM_SELECT (1 << 7)
-#define EA_CFG2_ADDR_LENGTH (1 << 8)
-#define EA_CFG2_RX_CRC (1 << 9)
-#define EA_CFG2_NO_TX_CRC (1 << 10)
-#define EA_CFG2_LOOPBACK (1 << 11)
-#define EA_CFG2_OUTPUT (1 << 12)
-#define EA_CFG2_RESET (1 << 15)
-
-#define EA_BUFCODE_STATION_ADDR0 0x00
-#define EA_BUFCODE_STATION_ADDR1 0x01
-#define EA_BUFCODE_STATION_ADDR2 0x02
-#define EA_BUFCODE_STATION_ADDR3 0x03
-#define EA_BUFCODE_STATION_ADDR4 0x04
-#define EA_BUFCODE_STATION_ADDR5 0x05
-#define EA_BUFCODE_ADDRESS_PROM 0x06
-#define EA_BUFCODE_TX_EAP 0x07
-#define EA_BUFCODE_LOCAL_MEM 0x08
-#define EA_BUFCODE_INT_VECTOR 0x09
-/*#define EA_BUFCODE_MULTICAST 0x0f*/
-
-#define EA_PKTHDR_TX (1 << 7)
-#define EA_PKTHDR_RX (0 << 7)
-#define EA_PKTHDR_CHAIN_CONT (1 << 6)
-#define EA_PKTHDR_DATA_FOLLOWS (1 << 5)
-
-#define EA_PKTHDR_DONE (1 << 7)
-
-#define EA_TXHDR_BABBLE (1 << 0)
-#define EA_TXHDR_COLLISION (1 << 1)
-#define EA_TXHDR_COLLISION16 (1 << 2)
-
-#define EA_TXHDR_BABBLE_INT (1 << 0)
-#define EA_TXHDR_COLLISION_INT (1 << 1)
-#define EA_TXHDR_COLLISION16_INT (1 << 2)
-#define EA_TXHDR_XMIT_SUCCESS_INT (1 << 3)
-#define EA_TXHDR_ERROR_MASK (0x07)
-
-#define EA_RXHDR_OVERSIZE (1 << 0)
-#define EA_RXHDR_CRC_ERROR (1 << 1)
-#define EA_RXHDR_DRIBBLE_ERROR (1 << 2)
-#define EA_RXHDR_SHORT_FRAME (1 << 3)
-
-#define EA_BUFFER_SIZE 0x10000
-#define EA_TX_BUFFER_SIZE 0x4000
-#define EA_RX_BUFFER_SIZE 0xC000
-
-/* Packet buffer size */
-
-#define EA_BUFSIZ 2048
-
-/* End of if_eareg.h */
diff --git a/sys/arch/arm32/podulebus/if_eb.c b/sys/arch/arm32/podulebus/if_eb.c
deleted file mode 100644
index beba71bb46f..00000000000
--- a/sys/arch/arm32/podulebus/if_eb.c
+++ /dev/null
@@ -1,1544 +0,0 @@
-/* $NetBSD: if_eb.c,v 1.4 1996/03/27 21:49:31 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * if_eb.c
- *
- * EtherB device driver
- *
- * Created : 08/07/95
- */
-
-/*
- * SEEQ 80C04 device driver
- */
-
-/*
- * Bugs/possible improvements:
- * - Does not currently support DMA
- * - Does not currently support multicasts
- * - Does not transmit multiple packets in one go
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/syslog.h>
-#include <sys/device.h>
-
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/if_types.h>
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/in_var.h>
-#include <netinet/ip.h>
-#include <netinet/if_ether.h>
-#endif
-
-#include "bpfilter.h"
-#if NBPFILTER > 0
-#include <net/bpf.h>
-#include <net/bpfdesc.h>
-#endif
-
-#include <machine/cpu.h>
-#include <machine/katelib.h>
-#include <machine/io.h>
-#include <machine/irqhandler.h>
-#include <machine/bootconfig.h>
-
-#include <arm32/podulebus/if_ebreg.h>
-#include <arm32/podulebus/podulebus.h>
-
-#define ETHER_MIN_LEN 64
-#define ETHER_MAX_LEN 1514
-#define ETHER_ADDR_LEN 6
-
-#ifndef EB_TIMEOUT
-#define EB_TIMEOUT 60
-#endif
-
-/*#define EB_TX_DEBUG*/
-/*#define EB_RX_DEBUG*/
-/*#define EB_DEBUG*/
-/*#define EB_PACKET_DEBUG*/
-
-/* for debugging convenience */
-#ifdef EB_DEBUG
-#define dprintf(x) printf x
-#else
-#define dprintf(x)
-#endif
-
-#define MY_MANUFACTURER 0x53
-#define MY_PODULE 0xe4
-
-/*
- * per-line info and status
- */
-
-struct eb_softc {
- struct device sc_dev;
- irqhandler_t sc_ih;
- int sc_irq; /* IRQ number */
- podule_t *sc_podule; /* Our podule */
- int sc_podule_number; /* Our podule number */
- u_int sc_iobase; /* base I/O addr */
- struct arpcom sc_arpcom; /* ethernet common */
- char sc_pktbuf[EB_BUFSIZ]; /* frame buffer */
- int sc_config1; /* Current config1 bits */
- int sc_config2; /* Current config2 bits */
- int sc_command; /* Current command bits */
- int sc_irqclaimed; /* Whether we have an IRQ claimed */
- int sc_rx_ptr; /* Receive buffer pointer */
- int sc_tx_ptr; /* Transmit buffer pointer */
-};
-
-/*
- * prototypes
- */
-
-static int ebintr __P((void *));
-static int eb_init __P((struct eb_softc *));
-static int eb_ioctl __P((struct ifnet *, u_long, caddr_t));
-static void eb_start __P((struct ifnet *));
-static void eb_watchdog __P((int));
-static void eb_reinit __P((struct eb_softc *));
-static void eb_chipreset __P((struct eb_softc *));
-static void eb_ramtest __P((struct eb_softc *));
-static int eb_stoptx __P((struct eb_softc *));
-static int eb_stoprx __P((struct eb_softc *));
-static void eb_stop __P((struct eb_softc *));
-static void eb_writebuf __P((struct eb_softc *, u_char *, int, int));
-static void eb_readbuf __P((struct eb_softc *, u_char *, int, int));
-static void ebread __P((struct eb_softc *, caddr_t, int));
-static struct mbuf *ebget __P((caddr_t, int, struct ifnet *));
-static void eb_hardreset __P((struct eb_softc *));
-static void ebgetpackets __P((struct eb_softc *));
-static void ebtxpacket __P((struct eb_softc *));
-
-int ebprobe __P((struct device *, void *, void *));
-void ebattach __P((struct device *, struct device *, void *));
-
-/* driver structure for autoconf */
-
-struct cfattach eb_ca = {
- sizeof(struct eb_softc), ebprobe, ebattach
-};
-
-struct cfdriver eb_cd = {
- NULL, "eb", DV_IFNET
-};
-
-#if 0
-
-/*
- * Dump the chip registers
- */
-
-void
-ebdump(iobase)
- u_int iobase;
-{
- dprintf(("%08x: %04x %04x %04x %04x %04x %04x %04x %04x\n", iobase,
- ReadShort(iobase + 0x00), ReadShort(iobase + 0x40),
- ReadShort(iobase + 0x80), ReadShort(iobase + 0xc0),
- ReadShort(iobase + 0x100), ReadShort(iobase + 0x140),
- ReadShort(iobase + 0x180), ReadShort(iobase + 0x1c0)));
-}
-#endif
-
-/*
- * Dump the interface buffer
- */
-
-void
-eb_dump_buffer(sc, offset)
- struct eb_softc *sc;
- int offset;
-{
-#ifdef EB_PACKET_DEBUG
- u_int iobase = sc->sc_iobase;
- int addr;
- int loop;
- int size;
- int ctrl;
- int ptr;
-
- addr = offset;
-
- do {
- WriteShort(sc->sc_iobase + EB_8004_COMMAND, sc->sc_command | EB_CMD_FIFO_READ);
- WriteShort(iobase + EB_8004_CONFIG1, sc->sc_config1 | EB_BUFCODE_LOCAL_MEM);
- WriteShort(iobase + EB_8004_DMA_ADDR, addr);
-
- ptr = ReadShort(iobase + EB_8004_BUFWIN);
- ctrl = ReadShort(iobase + EB_8004_BUFWIN);
- ptr = ((ptr & 0xff) << 8) | ((ptr >> 8) & 0xff);
-
- if (ptr == 0) break;
- size = ptr - addr;
-
- printf("addr=%04x size=%04x ", addr, size);
- printf("cmd=%02x st=%02x\n", ctrl & 0xff, ctrl >> 8);
-
- for (loop = 0; loop < size - 4; loop += 2)
- printf("%04x ", ReadShort(iobase + EB_8004_BUFWIN));
- printf("\n");
- addr = ptr;
- } while (size != 0);
-#endif
-}
-
-/*
- * Probe routine.
- */
-
-/*
- * int ebprobe(struct device *parent, void *match, void *aux)
- *
- * Probe for the ether3 podule.
- */
-
-int
-ebprobe(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
-{
- struct podule_attach_args *pa = (void *)aux;
- int podule;
- u_int iobase;
-
-/* dprintf(("Probing for SEEQ 8004... \n"));*/
-
-/* Look for a network slot interface */
-
- podule = findpodule(MY_MANUFACTURER, MY_PODULE, pa->pa_podule_number);
-
-/* Fail if we did not find it */
-
- if (podule == -1)
- return(0);
-
- iobase = podules[podule].mod_base + EB_8004_BASE;
-
-/* Reset it - Why here ? */
-
- WriteShort(iobase + EB_8004_CONFIG2, EB_CFG2_RESET);
- delay(100);
-
-/* We found it */
-
- pa->pa_podule_number = podule;
- pa->pa_podule = &podules[podule];
-
- return(1);
-}
-
-
-/*
- * void ebattach(struct device *parent, struct device *dev, void *aux)
- *
- * Attach podule.
- */
-
-void
-ebattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct eb_softc *sc = (void *)self;
- struct podule_attach_args *pa = (void *)aux;
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
- int loop;
- int sum;
- int id;
-
-/* dprintf(("Attaching %s...\n", sc->sc_dev.dv_xname));*/
-
-/* Note the podule number and validate */
-
- sc->sc_podule_number = pa->pa_podule_number;
- if (sc->sc_podule_number == -1)
- panic("Podule has disappeared !");
-
- sc->sc_podule = &podules[sc->sc_podule_number];
- podules[sc->sc_podule_number].attached = 1;
-
-/* Set the address of the controller for easy access */
-
- sc->sc_iobase = sc->sc_podule->mod_base + EB_8004_BASE;
-
- sc->sc_irqclaimed = 0;
-
-/* Set up the interrupt structure */
-
- sc->sc_ih.ih_func = ebintr;
- sc->sc_ih.ih_arg = sc;
- sc->sc_ih.ih_level = IPL_NET;
- sc->sc_ih.ih_name = "net: eb";
-
-/* Claim either a network slot interrupt or a podule interrupt */
-
- if (sc->sc_podule_number >= MAX_PODULES)
- sc->sc_irq = IRQ_NETSLOT;
- else
- sc->sc_irq = IRQ_PODULE /*+ sc->sc_podule_number*/;
-
- /* Stop the board. */
-
- eb_chipreset(sc);
- eb_stoptx(sc);
- eb_stoprx(sc);
-
- /* Initialise ifnet structure. */
-
- ifp->if_unit = sc->sc_dev.dv_unit;
- ifp->if_name = eb_cd.cd_name;
- ifp->if_start = eb_start;
- ifp->if_ioctl = eb_ioctl;
- ifp->if_watchdog = eb_watchdog;
- ifp->if_flags = IFF_BROADCAST | IFF_NOTRAILERS;
-
- /* Now we can attach the interface. */
-
-/* dprintf(("Attaching interface...\n"));*/
- if_attach(ifp);
- ether_ifattach(ifp);
-
-/* Read the station address - the receiver must be off */
-
- WriteShort(sc->sc_iobase + EB_8004_CONFIG1, EB_BUFCODE_STATION_ADDR);
-
- for (sum = 0, loop = 0; loop < ETHER_ADDR_LEN; ++loop) {
- sc->sc_arpcom.ac_enaddr[loop] =
- ReadByte(sc->sc_iobase + EB_8004_BUFWIN);
- sum += sc->sc_arpcom.ac_enaddr[loop];
- }
-
-/*
- * Hard code the ether address if we don't have one.
- * Build the address from the machine id.
- */
-
- if (sum == 0) {
- sc->sc_arpcom.ac_enaddr[0] = 0x00;
- sc->sc_arpcom.ac_enaddr[1] = 0x00;
- sc->sc_arpcom.ac_enaddr[2] = bootconfig.machine_id[3];
- sc->sc_arpcom.ac_enaddr[3] = bootconfig.machine_id[2];
- sc->sc_arpcom.ac_enaddr[4] = bootconfig.machine_id[1];
- sc->sc_arpcom.ac_enaddr[5] = bootconfig.machine_id[0];
- }
-
- /* Get the product ID */
-
- WriteShort(sc->sc_iobase + EB_8004_CONFIG1, EB_BUFCODE_PRODUCTID);
- id = ReadByte(sc->sc_iobase + EB_8004_BUFWIN);
-
- /* Print out some information for the user. */
-
- if ((id & 0xf0) == 0xa0)
- printf(" SEEQ80C04 rev %x address %s", id & 0x0f, ether_sprintf(sc->sc_arpcom.ac_enaddr));
- else
- printf(" SEEQ???? rev %02x address %s", id, ether_sprintf(sc->sc_arpcom.ac_enaddr));
-
- /* Finally, attach to bpf filter if it is present. */
-
-#if NBPFILTER > 0
-/* dprintf(("Attaching to BPF...\n"));*/
- bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
-#endif
-
- /* Should test the RAM */
-
- eb_ramtest(sc);
-
-/* dprintf(("ebattach() finished.\n"));*/
-}
-
-
-/*
- * Test the RAM on the ethernet card. This does not work yet
- */
-
-void
-eb_ramtest(sc)
- struct eb_softc *sc;
-{
- register u_int iobase = sc->sc_iobase;
- register int loop;
- register u_int sum = 0;
-
-/* dprintf(("eb_ramtest()\n"));*/
-
- /*
- * Test the buffer memory on the board.
- * Write simple pattens to it and read them back.
- */
-
- /* Set up the whole buffer RAM for writing */
-
- WriteShort(iobase + EB_8004_CONFIG1, EB_BUFCODE_TX_EAP);
- WriteShort(iobase + EB_8004_BUFWIN, ((EB_BUFFER_SIZE >> 8) - 1));
- WriteShort(iobase + EB_8004_TX_PTR, 0x0000);
- WriteShort(iobase + EB_8004_RX_PTR, EB_BUFFER_SIZE - 2);
-
- /* Set the write start address and write a pattern */
-
- eb_writebuf(sc, NULL, 0x0000, 0);
-
- for (loop = 0; loop < EB_BUFFER_SIZE; loop += 2)
- WriteShort(iobase + EB_8004_BUFWIN, loop);
-
- /* Set the read start address and verify the pattern */
-
- eb_readbuf(sc, NULL, 0x0000, 0);
-
- for (loop = 0; loop < EB_BUFFER_SIZE; loop += 2)
- if (ReadShort(iobase + EB_8004_BUFWIN) != loop)
- ++sum;
-
- if (sum != 0)
- dprintf(("sum=%d\n", sum));
-
- /* Set the write start address and write a pattern */
-
- eb_writebuf(sc, NULL, 0x0000, 0);
-
- for (loop = 0; loop < EB_BUFFER_SIZE; loop += 2)
- WriteShort(iobase + EB_8004_BUFWIN, loop ^ (EB_BUFFER_SIZE - 1));
-
- /* Set the read start address and verify the pattern */
-
- eb_readbuf(sc, NULL, 0x0000, 0);
-
- for (loop = 0; loop < EB_BUFFER_SIZE; loop += 2)
- if (ReadShort(iobase + EB_8004_BUFWIN) != (loop ^ (EB_BUFFER_SIZE - 1)))
- ++sum;
-
- if (sum != 0)
- dprintf(("sum=%d\n", sum));
-
- /* Set the write start address and write a pattern */
-
- eb_writebuf(sc, NULL, 0x0000, 0);
-
- for (loop = 0; loop < EB_BUFFER_SIZE; loop += 2)
- WriteShort(iobase + EB_8004_BUFWIN, 0xaa55);
-
- /* Set the read start address and verify the pattern */
-
- eb_readbuf(sc, NULL, 0x0000, 0);
-
- for (loop = 0; loop < EB_BUFFER_SIZE; loop += 2)
- if (ReadShort(iobase + EB_8004_BUFWIN) != 0xaa55)
- ++sum;
-
- if (sum != 0)
- dprintf(("sum=%d\n", sum));
-
- /* Set the write start address and write a pattern */
-
- eb_writebuf(sc, NULL, 0x0000, 0);
-
- for (loop = 0; loop < EB_BUFFER_SIZE; loop += 2)
- WriteShort(iobase + EB_8004_BUFWIN, 0x55aa);
-
- /* Set the read start address and verify the pattern */
-
- eb_readbuf(sc, NULL, 0x0000, 0);
-
- for (loop = 0; loop < EB_BUFFER_SIZE; loop += 2)
- if (ReadShort(iobase + EB_8004_BUFWIN) != 0x55aa)
- ++sum;
-
- if (sum != 0)
- dprintf(("sum=%d\n", sum));
-
- /* Report */
-
- if (sum == 0)
- printf(" %dK buffer RAM\n", EB_BUFFER_SIZE / 1024);
- else
- printf(" buffer RAM failed self test, %d faults\n", sum);
-}
-
-
-/* Claim an irq for the board */
-
-void
-eb_claimirq(sc)
- struct eb_softc *sc;
-{
-/* Have we claimed one already ? */
-
- if (sc->sc_irqclaimed) return;
-
-/* Claim it */
-
- dprintf(("eb_claimirq(%d)\n", sc->sc_irq));
- if (irq_claim(sc->sc_irq, &sc->sc_ih))
- panic("Cannot install IRQ handler for IRQ %d", sc->sc_irq);
-
- sc->sc_irqclaimed = 1;
-}
-
-
-/* Release an irq */
-
-void
-eb_releaseirq(sc)
- struct eb_softc *sc;
-{
-/* Have we claimed one ? */
-
- if (!sc->sc_irqclaimed) return;
-
- dprintf(("eb_releaseirq(%d)\n", sc->sc_irq));
- if (irq_release(sc->sc_irq, &sc->sc_ih))
- panic("Cannot release IRQ handler for IRQ %d", sc->sc_irq);
-
- sc->sc_irqclaimed = 0;
-}
-
-
-/*
- * Stop and reinitialise the interface.
- */
-
-static void
-eb_reinit(sc)
- struct eb_softc *sc;
-{
- int s;
-
- dprintf(("eb_reinit()\n"));
-
-/* Stop and reinitialise the interface */
-
- s = splimp();
- eb_stop(sc);
- eb_init(sc);
- (void)splx(s);
-}
-
-
-/*
- * Stop the tx interface.
- *
- * Returns 0 if the tx was already stopped or 1 if it was active
- */
-
-static int
-eb_stoptx(sc)
- struct eb_softc *sc;
-{
- u_int iobase = sc->sc_iobase;
- int timeout;
- int status;
-
- dprintf(("eb_stoptx()\n"));
-
- status = ReadShort(iobase + EB_8004_STATUS);
- if (!(status & EB_STATUS_TX_ON))
- return(0);
-
-/* Stop any tx and wait for confirmation */
-
- WriteShort(iobase + EB_8004_COMMAND, sc->sc_command | EB_CMD_TX_OFF);
-
- timeout = 20000;
- do {
- status = ReadShort(iobase + EB_8004_STATUS);
- } while ((status & EB_STATUS_TX_ON) && --timeout > 0);
- if (timeout == 0)
- dprintf(("eb_stoptx: timeout waiting for tx termination\n"));
-
-/* Clear any pending tx interrupt */
-
- WriteShort(iobase + EB_8004_COMMAND, sc->sc_command | EB_CMD_TX_INTACK);
- return(1);
-}
-
-
-/*
- * Stop the rx interface.
- *
- * Returns 0 if the tx was already stopped or 1 if it was active
- */
-
-static int
-eb_stoprx(sc)
- struct eb_softc *sc;
-{
- u_int iobase = sc->sc_iobase;
- int timeout;
- int status;
-
- dprintf(("eb_stoprx()\n"));
-
- status = ReadShort(iobase + EB_8004_STATUS);
- if (!(status & EB_STATUS_RX_ON))
- return(0);
-
-/* Stop any rx and wait for confirmation */
-
- WriteShort(iobase + EB_8004_COMMAND, sc->sc_command | EB_CMD_RX_OFF);
-
- timeout = 20000;
- do {
- status = ReadShort(iobase + EB_8004_STATUS);
- } while ((status & EB_STATUS_RX_ON) && --timeout > 0);
- if (timeout == 0)
- dprintf(("eb_stoprx: timeout waiting for rx termination\n"));
-
-/* Clear any pending rx interrupt */
-
- WriteShort(iobase + EB_8004_COMMAND, sc->sc_command | EB_CMD_RX_INTACK);
- return(1);
-}
-
-
-/*
- * Stop interface.
- * Stop all IO and shut the interface down
- */
-
-static void
-eb_stop(sc)
- struct eb_softc *sc;
-{
- u_int iobase = sc->sc_iobase;
-
- dprintf(("eb_stop()\n"));
-
-/* Stop all IO */
-
- eb_stoptx(sc);
- eb_stoprx(sc);
-
- /* Disable rx and tx interrupts */
-
- sc->sc_command &= (EB_CMD_RX_INTEN | EB_CMD_TX_INTEN);
-
- /* Clear any pending interrupts */
-
- WriteShort(iobase + EB_8004_COMMAND, sc->sc_command
- | EB_CMD_RX_INTACK | EB_CMD_TX_INTACK | EB_CMD_TEST_INTACK
- | EB_CMD_BW_INTACK);
- dprintf(("st=%08x", ReadShort(iobase + EB_8004_STATUS)));
-
- /* Release the irq */
-
- eb_releaseirq(sc);
-
- /* Put the chip to sleep */
-
- WriteShort(iobase + EB_8004_CONFIG1, EB_BUFCODE_CONFIG3);
- WriteShort(iobase + EB_8004_BUFWIN, EB_CFG3_SLEEP);
-
- /* Cancel any watchdog timer */
-
- sc->sc_arpcom.ac_if.if_timer = 0;
-}
-
-
-/*
- * Reset the chip
- * Following this the software registers are reset
- */
-
-static void
-eb_chipreset(sc)
- struct eb_softc *sc;
-{
- u_int iobase = sc->sc_iobase;
-
- dprintf(("eb_chipreset()\n"));
-
-/* Reset the controller. Min of 4us delay here */
-
- WriteShort(iobase + EB_8004_CONFIG2, EB_CFG2_RESET);
- delay(100);
-
- sc->sc_command = 0;
- sc->sc_config1 = 0;
- sc->sc_config2 = 0;
-}
-
-
-/*
- * Do a hardware reset of the board, and upload the ethernet address again in
- * case the board forgets.
- */
-
-static void
-eb_hardreset(sc)
- struct eb_softc *sc;
-{
- u_int iobase = sc->sc_iobase;
- int loop;
-
- dprintf(("eb_hardreset()\n"));
-
-/* Stop any activity */
-
- eb_stoptx(sc);
- eb_stoprx(sc);
-
- eb_chipreset(sc);
-
-/* Set up defaults for the registers */
-
- sc->sc_config2 = 0;
- WriteShort(iobase + EB_8004_CONFIG2, sc->sc_config2);
- sc->sc_command = 0x00;
- sc->sc_config1 = 0;
- WriteShort(iobase + EB_8004_CONFIG1, sc->sc_config1);
- WriteShort(iobase + EB_8004_COMMAND, sc->sc_command);
-
- WriteShort(iobase + EB_8004_CONFIG1, EB_BUFCODE_TX_EAP);
- WriteShort(iobase + EB_8004_BUFWIN, ((EB_TX_BUFFER_SIZE >> 8) - 1));
-
-/* Write the station address - the receiver must be off */
-
- WriteShort(sc->sc_iobase + EB_8004_CONFIG1,
- sc->sc_config1 | EB_BUFCODE_STATION_ADDR);
- for (loop = 0; loop < ETHER_ADDR_LEN; ++loop) {
- WriteByte(sc->sc_iobase + EB_8004_BUFWIN, sc->sc_arpcom.ac_enaddr[loop]);
- }
-}
-
-
-/*
- * write to the buffer memory on the interface
- *
- * If addr is within range for the interface buffer then the buffer
- * address is set to addr.
- * If len != 0 then data is copied from the address starting at buf
- * to the interface buffer.
- */
-
-static void
-eb_writebuf(sc, buf, addr, len)
- struct eb_softc *sc;
- u_char *buf;
- int addr;
- int len;
-{
- u_int iobase = sc->sc_iobase;
- int loop;
- int timeout;
-
- dprintf(("writebuf: st=%04x\n", ReadShort(iobase + EB_8004_STATUS)));
-
-/* If we have a valid buffer address set the buffer pointer and direction */
-
- if (addr >= 0 && addr < EB_BUFFER_SIZE) {
- WriteShort(iobase + EB_8004_CONFIG1, sc->sc_config1 | EB_BUFCODE_LOCAL_MEM);
- WriteShort(iobase + EB_8004_COMMAND, sc->sc_command | EB_CMD_FIFO_WRITE);
-
- /* Should wait here of FIFO empty flag */
-
- timeout = 20000;
- while ((ReadShort(iobase + EB_8004_STATUS) & EB_STATUS_FIFO_EMPTY) == 0 && --timeout > 0);
-
-
- WriteShort(iobase + EB_8004_DMA_ADDR, addr);
- }
-
- for (loop = 0; loop < len; loop += 2)
- WriteShort(iobase + EB_8004_BUFWIN, buf[loop] | buf[loop + 1] << 8);
-
-
-/* if (len > 0)
- outsw(iobase + EB_8004_BUFWIN, buf, len / 2);*/
-}
-
-
-/*
- * read from the buffer memory on the interface
- *
- * If addr is within range for the interface buffer then the buffer
- * address is set to addr.
- * If len != 0 then data is copied from the interface buffer to the
- * address starting at buf.
- */
-
-static void
-eb_readbuf(sc, buf, addr, len)
- struct eb_softc *sc;
- u_char *buf;
- int addr;
- int len;
-{
- u_int iobase = sc->sc_iobase;
- int loop;
- int word;
- int timeout;
-
- dprintf(("readbuf: st=%04x addr=%04x len=%d\n", ReadShort(iobase + EB_8004_STATUS), addr, len));
-
-/* If we have a valid buffer address set the buffer pointer and direction */
-
- if (addr >= 0 && addr < EB_BUFFER_SIZE) {
- if ((ReadShort(iobase + EB_8004_STATUS) & EB_STATUS_FIFO_DIR) == 0) {
- /* Should wait here of FIFO empty flag */
-
- timeout = 20000;
- while ((ReadShort(iobase + EB_8004_STATUS) & EB_STATUS_FIFO_EMPTY) == 0 && --timeout > 0);
- }
- WriteShort(iobase + EB_8004_CONFIG1, sc->sc_config1 | EB_BUFCODE_LOCAL_MEM);
- WriteShort(iobase + EB_8004_COMMAND, sc->sc_command | EB_CMD_FIFO_WRITE);
-
- /* Should wait here of FIFO empty flag */
-
- timeout = 20000;
- while ((ReadShort(iobase + EB_8004_STATUS) & EB_STATUS_FIFO_EMPTY) == 0 && --timeout > 0);
-
- WriteShort(iobase + EB_8004_DMA_ADDR, addr);
- WriteShort(iobase + EB_8004_COMMAND, sc->sc_command | EB_CMD_FIFO_READ);
-
- /* Should wait here of FIFO full flag */
-
- timeout = 20000;
- while ((ReadShort(iobase + EB_8004_STATUS) & EB_STATUS_FIFO_FULL) == 0 && --timeout > 0);
-
-
- }
-
- for (loop = 0; loop < len; loop += 2) {
- word = ReadShort(iobase + EB_8004_BUFWIN);
- buf[loop] = word & 0xff;
- buf[loop + 1] = word >> 8;
- }
-
-/* if (len > 0)
- insw(iobase + EB_8004_BUFWIN, buf, len / 2);*/
-}
-
-
-/*
- * Initialize interface.
- *
- * This should leave the interface in a state for packet reception and transmission
- */
-
-static int
-eb_init(sc)
- struct eb_softc *sc;
-{
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
- u_int iobase = sc->sc_iobase;
- int s;
-
- dprintf(("eb_init()\n"));
-
- s = splimp();
-
-/* Grab an irq */
-
- eb_claimirq(sc);
-
- /* First, reset the board. */
-
- eb_hardreset(sc);
-
-/* Configure rx. */
-
- dprintf(("Configuring rx...\n"));
- if (ifp->if_flags & IFF_PROMISC)
- sc->sc_config1 = EB_CFG1_PROMISCUOUS;
- else
- sc->sc_config1 = EB_CFG1_BROADCAST;
-
- sc->sc_config1 |= 0;
- WriteShort(iobase + EB_8004_CONFIG1, sc->sc_config1);
-
-/* Configure TX. */
-
- dprintf(("Configuring tx...\n"));
-
- WriteShort(iobase + EB_8004_CONFIG1, sc->sc_config1 | EB_BUFCODE_TX_EAP);
- WriteShort(iobase + EB_8004_BUFWIN, ((EB_TX_BUFFER_SIZE >> 8) - 1));
- WriteShort(iobase + EB_8004_TX_PTR, 0x0000);
-
- sc->sc_config2 |= (EB_CFG2_OUTPUT | EB_CFG2_RX_TX_DISABLE);
- WriteShort(iobase + EB_8004_CONFIG2, sc->sc_config2);
-
-/* Place a NULL header at the beginning of the transmit area */
-
- eb_writebuf(sc, NULL, 0x0000, 0);
-
- WriteShort(iobase + EB_8004_BUFWIN, 0x0000);
- WriteShort(iobase + EB_8004_BUFWIN, 0x0000);
-
- sc->sc_command |= EB_CMD_TX_INTEN;
- WriteShort(iobase + EB_8004_COMMAND, sc->sc_command);
-
-/* Setup the Rx pointers */
-
- sc->sc_rx_ptr = EB_TX_BUFFER_SIZE;
-
- WriteShort(iobase + EB_8004_RX_PTR, sc->sc_rx_ptr);
- WriteShort(iobase + EB_8004_RX_END, (sc->sc_rx_ptr >> 8));
-
-/* Place a NULL header at the beginning of the receive area */
-
- eb_writebuf(sc, NULL, sc->sc_rx_ptr, 0);
-
- WriteShort(iobase + EB_8004_BUFWIN, 0x0000);
- WriteShort(iobase + EB_8004_BUFWIN, 0x0000);
-
-/* Turn on Rx */
-
- sc->sc_command |= EB_CMD_RX_INTEN;
- WriteShort(iobase + EB_8004_COMMAND, sc->sc_command | EB_CMD_RX_ON);
-
- /* Set flags appropriately. */
- ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
-
- dprintf(("init: st=%04x\n", ReadShort(iobase + EB_8004_STATUS)));
-
- /* And start output. */
- eb_start(ifp);
-
- (void)splx(s);
- return(0);
-}
-
-
-/*
- * Start output on interface. Get datagrams from the queue and output them,
- * giving the receiver a chance between datagrams. Call only from splimp or
- * interrupt level!
- */
-
-static void
-eb_start(ifp)
- struct ifnet *ifp;
-{
- struct eb_softc *sc = eb_cd.cd_devs[ifp->if_unit];
- int s;
-
- s = splimp();
-#ifdef EB_TX_DEBUG
- dprintf(("eb_start()...\n"));
-#endif
-
- /* Don't do anything if output is active. */
-
- if (sc->sc_arpcom.ac_if.if_flags & IFF_OACTIVE)
- return;
-
- /* Mark interface as output active */
-
- sc->sc_arpcom.ac_if.if_flags |= IFF_OACTIVE;
-
- /* tx packets */
-
- ebtxpacket(sc);
- (void)splx(s);
-}
-
-
-/*
- * Transfer a packet to the interface buffer and start transmission
- *
- * Called at splimp()
- */
-
-void
-ebtxpacket(sc)
- struct eb_softc *sc;
-{
- u_int iobase = sc->sc_iobase;
- struct mbuf *m, *m0;
- int len;
-
-/* Dequeue the next datagram. */
-
- IF_DEQUEUE(&sc->sc_arpcom.ac_if.if_snd, m0);
-
-/* If there's nothing to send, return. */
-
- if (!m0) {
- sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
- sc->sc_config2 |= EB_CFG2_OUTPUT;
- WriteShort(iobase + EB_8004_CONFIG2, sc->sc_config2);
-#ifdef EB_TX_DEBUG
- dprintf(("tx finished\n"));
-#endif
- return;
- }
-
- /* Give the packet to the bpf, if any. */
-#if NBPFILTER > 0
- if (sc->sc_arpcom.ac_if.if_bpf)
- bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m0);
-#endif
-
-#ifdef EB_TX_DEBUG
- dprintf(("Tx new packet\n"));
-#endif
-
-/*
- * Copy the datagram to the temporary buffer.
- *
- * Eventually we may as well just copy straight into the interface buffer
- */
-
- len = 0;
- for (m = m0; m; m = m->m_next) {
- if (m->m_len == 0)
- continue;
- bcopy(mtod(m, caddr_t), sc->sc_pktbuf + len, m->m_len);
- len += m->m_len;
- }
- m_freem(m0);
-
-/* If packet size is odd round up to the next 16 bit boundry */
-
- if (len % 2)
- ++len;
-
- len = max(len, ETHER_MIN_LEN);
-
- if (len > ETHER_MAX_LEN)
- log(LOG_WARNING, "ea: oversize packet = %d bytes\n", len);
-
-/* Ok we now have a packet len bytes long in our packet buffer */
-
-/* Transfer datagram to board. */
-
-#ifdef EB_TX_DEBUG
- dprintf(("eb: xfr pkt length=%d...\n", len));
-
- dprintf(("%s-->", ether_sprintf(sc->sc_pktbuf+6)));
- dprintf(("%s\n", ether_sprintf(sc->sc_pktbuf)));
-#endif
-
- sc->sc_config2 &= ~EB_CFG2_OUTPUT;
- WriteShort(iobase + EB_8004_CONFIG2, sc->sc_config2);
-
-/* dprintf(("st=%04x\n", ReadShort(iobase + EB_8004_STATUS)));*/
-
-/* Write the packet to the interface buffer, skipping the packet header */
-
- eb_writebuf(sc, sc->sc_pktbuf, 0x0004, len);
-
-/* Follow it with a NULL packet header */
-
- WriteShort(iobase + EB_8004_BUFWIN, 0x00);
- WriteShort(iobase + EB_8004_BUFWIN, 0x00);
-
-/* Write the packet header */
-
- eb_writebuf(sc, NULL, 0x0000, 0);
-
- WriteShort(iobase + EB_8004_BUFWIN, (((len+4) & 0xff00) >> 8) | (((len+4) & 0xff) << 8));
- WriteShort(iobase + EB_8004_BUFWIN, 0x00aa);
-
- WriteShort(iobase + EB_8004_TX_PTR, 0x0000);
-
-/* dprintf(("st=%04x\n", ReadShort(iobase + EB_8004_STATUS)));*/
-
-#ifdef EB_DEBUG
- eb_dump_buffer(sc, 0);
-#endif
-
-/* Now transmit the datagram. */
-
-/* dprintf(("st=%04x\n", ReadShort(iobase + EB_8004_STATUS)));*/
- WriteShort(iobase + EB_8004_COMMAND, sc->sc_command | EB_CMD_TX_ON);
-#ifdef EB_TX_DEBUG
- dprintf(("st=%04x\n", ReadShort(iobase + EB_8004_STATUS)));
- dprintf(("tx: queued\n"));
-#endif
-}
-
-
-/*
- * Ethernet controller interrupt.
- */
-
-int
-ebintr(arg)
- void *arg;
-{
- register struct eb_softc *sc = arg;
- u_int iobase = sc->sc_iobase;
- int status, s;
- u_int txstatus;
-
- dprintf(("ebintr: "));
-
-/* Get the controller status */
-
- status = ReadShort(iobase + EB_8004_STATUS);
- dprintf(("st=%04x ", status));
-
-/* Tx interrupt ? */
-
- if (status & EB_STATUS_TX_INT) {
- dprintf(("txint "));
-
-/* Acknowledge the interrupt */
-
- WriteShort(iobase + EB_8004_COMMAND, sc->sc_command
- | EB_CMD_TX_INTACK);
-
- eb_readbuf(sc, (u_char *)&txstatus, 0x0000, 4);
-
-#ifdef EB_TX_DEBUG
- dprintf(("txstatus=%08x\n", txstatus));
-#endif
- txstatus = (txstatus >> 24) & 0xff;
-
-/*
- * Did it succeed ? Did we collide ?
- *
- * The exact proceedure here is not clear. We should get
- * an interrupt on a sucessfull tx or on a collision.
- * The done flag is set after successfull tx or 16 collisions
- * We should thus get a interrupt for each of collision
- * and the done bit should not be set. However it does appear
- * to be set at the same time as the collision bit ...
- *
- * So we will count collisions and output errors and will assume
- * that if the done bit is set the packet was transmitted.
- * Stats may be wrong if 16 collisions occur on a packet
- * as the done flag should be set but the packet may not have been
- * transmitted. so the output count might not require incrementing
- * if the 16 collisions flags is set. I don;t know abou this until
- * it happens.
- */
-
- if (txstatus & EB_TXHDR_COLLISION) {
- sc->sc_arpcom.ac_if.if_collisions++;
- } else if (txstatus & EB_TXHDR_ERROR_MASK) {
- sc->sc_arpcom.ac_if.if_oerrors++;
- }
-
-/* if (txstatus & EB_TXHDR_ERROR_MASK) {
- log(LOG_WARNING, "tx packet error =%02x\n", txstatus);
- }*/
-
- if (txstatus & EB_PKTHDR_DONE) {
- sc->sc_arpcom.ac_if.if_opackets++;
-
- /* Tx next packet */
-
- s = splimp();
- ebtxpacket(sc);
- (void)splx(s);
- }
- }
-
-/* Rx interrupt ? */
-
- if (status & EB_STATUS_RX_INT) {
- dprintf(("rxint "));
-
-/* Acknowledge the interrupt */
-
- WriteShort(iobase + EB_8004_COMMAND, sc->sc_command
- | EB_CMD_RX_INTACK);
-
-/* Install a watchdog timer needed atm to fixed rx lockups */
-
- sc->sc_arpcom.ac_if.if_timer = EB_TIMEOUT;
-
-/* Processes the received packets */
- ebgetpackets(sc);
-
-/* Make sure the receiver is on */
-
-/* if ((status & EB_STATUS_RX_ON) == 0) {
- WriteShort(iobase + EB_8004_COMMAND, sc->sc_command
- | EB_CMD_RX_ON);
- printf("rxintr: rx is off st=%04x\n",status);
- }*/
- }
-
-#ifdef EB_DEBUG
- status = ReadShort(iobase + EB_8004_STATUS);
- dprintf(("st=%04x\n", status));
-#endif
- return(0);
-}
-
-void
-ebgetpackets(sc)
- struct eb_softc *sc;
-{
- u_int iobase = sc->sc_iobase;
- int addr;
- int len;
- int ctrl;
- int ptr;
- int pack;
- int status;
- u_int rxstatus;
-
-/* We start from the last rx pointer position */
-
- addr = sc->sc_rx_ptr;
- sc->sc_config2 &= ~EB_CFG2_OUTPUT;
- WriteShort(iobase + EB_8004_CONFIG2, sc->sc_config2);
-
- do {
-/* Read rx header */
-
- eb_readbuf(sc, (u_char *)&rxstatus, addr, 4);
-
-/* Split the packet header */
-
- ptr = ((rxstatus & 0xff) << 8) | ((rxstatus >> 8) & 0xff);
- ctrl = (rxstatus >> 16) & 0xff;
- status = (rxstatus >> 24) & 0xff;
-
-#ifdef EB_RX_DEBUG
- dprintf(("addr=%04x ptr=%04x ctrl=%02x status=%02x\n", addr, ptr, ctrl, status));
-#endif
-
-/* Zero packet ptr ? then must be null header so exit */
-
- if (ptr == 0) break;
-
-/* Get packet length */
-
- len = (ptr - addr) - 4;
-
- if (len < 0) {
- len += EB_RX_BUFFER_SIZE;
- }
-
-#ifdef EB_RX_DEBUG
- dprintf(("len=%04x\n", len));
-#endif
-
-/* Has the packet rx completed ? if not then exit */
-
- if ((status & EB_PKTHDR_DONE) == 0)
- break;
-
-/* Did we have any errors ? then note error and go to next packet */
-
- if (status & 0x0f) {
- ++sc->sc_arpcom.ac_if.if_ierrors;
- printf("rx packet error (%02x) - dropping packet\n", status & 0x0f);
-/* sc->sc_config2 |= EB_CFG2_OUTPUT;
- WriteShort(iobase + EB_8004_CONFIG2, sc->sc_config2);
- eb_reinit(sc);
- return; */
- addr = ptr;
- continue;
- }
-
-/* Is the packet too big ? - this will probably be trapped above as a receive error */
-
- if (len > ETHER_MAX_LEN) {
- ++sc->sc_arpcom.ac_if.if_ierrors;
- printf("rx packet size error len=%d\n", len);
-/* sc->sc_config2 |= EB_CFG2_OUTPUT;
- WriteShort(iobase + EB_8004_CONFIG2, sc->sc_config2);
- eb_reinit(sc);
- return;*/
- addr = ptr;
- continue;
- }
-
- eb_readbuf(sc, sc->sc_pktbuf, addr + 4, len);
-
-#ifdef EB_RX_DEBUG
- dprintf(("%s-->", ether_sprintf(sc->sc_pktbuf+6)));
- dprintf(("%s\n", ether_sprintf(sc->sc_pktbuf)));
-#endif
- sc->sc_arpcom.ac_if.if_ipackets++;
- /* Pass data up to upper levels. */
- ebread(sc, (caddr_t)sc->sc_pktbuf, len);
-
- addr = ptr;
- ++pack;
- } while (len != 0);
-
- sc->sc_config2 |= EB_CFG2_OUTPUT;
- WriteShort(iobase + EB_8004_CONFIG2, sc->sc_config2);
-
-#ifdef EB_RX_DEBUG
- dprintf(("new rx ptr=%04x\n", addr));
-#endif
-
-/* Store new rx pointer */
-
- sc->sc_rx_ptr = addr;
- WriteShort(iobase + EB_8004_RX_END, (sc->sc_rx_ptr >> 8));
-
-/* Make sure the receiver is on */
-
- WriteShort(iobase + EB_8004_COMMAND, sc->sc_command
- | EB_CMD_RX_ON);
-
-}
-
-
-/*
- * Pass a packet up to the higher levels.
- */
-
-static void
-ebread(sc, buf, len)
- struct eb_softc *sc;
- caddr_t buf;
- int len;
-{
- register struct ether_header *eh;
- struct mbuf *m;
-
- eh = (struct ether_header *)buf;
- len -= sizeof(struct ether_header);
- if (len <= 0)
- return;
-
- /* Pull packet off interface. */
- m = ebget(buf, len, &sc->sc_arpcom.ac_if);
- if (m == 0)
- return;
-
-#if NBPFILTER > 0
- /*
- * Check if there's a BPF listener on this interface.
- * If so, hand off the raw packet to bpf.
- */
- if (sc->sc_arpcom.ac_if.if_bpf) {
- bpf_tap(sc->sc_arpcom.ac_if.if_bpf, buf, len + sizeof(struct ether_header));
-/* bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m);*/
-
- }
-#endif
-
- ether_input(&sc->sc_arpcom.ac_if, eh, m);
-}
-
-/*
- * Pull read data off a interface. Len is length of data, with local net
- * header stripped. We copy the data into mbufs. When full cluster sized
- * units are present we copy into clusters.
- */
-
-struct mbuf *
-ebget(buf, totlen, ifp)
- caddr_t buf;
- int totlen;
- struct ifnet *ifp;
-{
- struct mbuf *top, **mp, *m;
- int len;
- register caddr_t cp = buf;
- char *epkt;
-
- buf += sizeof(struct ether_header);
- cp = buf;
- epkt = cp + totlen;
-
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (m == 0)
- return 0;
- m->m_pkthdr.rcvif = ifp;
- m->m_pkthdr.len = totlen;
- m->m_len = MHLEN;
- top = 0;
- mp = &top;
-
- while (totlen > 0) {
- if (top) {
- MGET(m, M_DONTWAIT, MT_DATA);
- if (m == 0) {
- m_freem(top);
- return 0;
- }
- m->m_len = MLEN;
- }
- len = min(totlen, epkt - cp);
- if (len >= MINCLSIZE) {
- MCLGET(m, M_DONTWAIT);
- if (m->m_flags & M_EXT)
- m->m_len = len = min(len, MCLBYTES);
- else
- len = m->m_len;
- } else {
- /*
- * Place initial small packet/header at end of mbuf.
- */
- if (len < m->m_len) {
- if (top == 0 && len + max_linkhdr <= m->m_len)
- m->m_data += max_linkhdr;
- m->m_len = len;
- } else
- len = m->m_len;
- }
- bcopy(cp, mtod(m, caddr_t), (unsigned)len);
- cp += len;
- *mp = m;
- mp = &m->m_next;
- totlen -= len;
- if (cp == epkt)
- cp = buf;
- }
-
- return top;
-}
-
-/*
- * Process an ioctl request. This code needs some work - it looks pretty ugly.
- */
-static int
-eb_ioctl(ifp, cmd, data)
- register struct ifnet *ifp;
- u_long cmd;
- caddr_t data;
-{
- struct eb_softc *sc = eb_cd.cd_devs[ifp->if_unit];
- struct ifaddr *ifa = (struct ifaddr *)data;
-/* struct ifreq *ifr = (struct ifreq *)data;*/
- int s, error = 0;
-
- s = splimp();
-
- if ((error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data)) > 0) {
- splx(s);
- return error;
- }
-
- switch (cmd) {
-
- case SIOCSIFADDR:
- ifp->if_flags |= IFF_UP;
- dprintf(("if_flags=%08x\n", ifp->if_flags));
-
- switch (ifa->ifa_addr->sa_family) {
-#ifdef INET
- case AF_INET:
- arp_ifinit(&sc->sc_arpcom, ifa);
- dprintf(("Interface eb is coming up (AF_INET)\n"));
- eb_init(sc);
- break;
-#endif
- default:
- dprintf(("Interface eb is coming up (default)\n"));
- eb_init(sc);
- break;
- }
- break;
-
- case SIOCSIFFLAGS:
- dprintf(("if_flags=%08x\n", ifp->if_flags));
- if ((ifp->if_flags & IFF_UP) == 0 &&
- (ifp->if_flags & IFF_RUNNING) != 0) {
- /*
- * If interface is marked down and it is running, then
- * stop it.
- */
- dprintf(("Interface ea is stopping\n"));
- eb_stop(sc);
- ifp->if_flags &= ~IFF_RUNNING;
- } else if ((ifp->if_flags & IFF_UP) != 0 &&
- (ifp->if_flags & IFF_RUNNING) == 0) {
- /*
- * If interface is marked up and it is stopped, then
- * start it.
- */
- dprintf(("Interface eb is restarting(1)\n"));
- eb_init(sc);
- } else {
- /*
- * Some other important flag might have changed, so
- * reset.
- */
- dprintf(("Interface eb is reinitialising\n"));
- eb_reinit(sc);
- }
- break;
-
- default:
- error = EINVAL;
- break;
- }
-
- (void)splx(s);
- return error;
-}
-
-/*
- * Device timeout routine.
- *
- * Ok I am not sure exactly how the device timeout should work....
- * Currently what will happens is that that the device timeout is only
- * set when a packet it received. This indicates we are on an active
- * network and thus we should expect more packets. If non arrive in
- * in the timeout period then we reinitialise as we may have jammed.
- * We zero the timeout at this point so that we don't end up with
- * an endless stream of timeouts if the network goes down.
- */
-
-static void
-eb_watchdog(unit)
- int unit;
-{
- struct eb_softc *sc = eb_cd.cd_devs[unit];
-
- log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname);
- sc->sc_arpcom.ac_if.if_oerrors++;
- dprintf(("eb_watchdog: "));
- dprintf(("st=%04x\n", ReadShort(sc->sc_iobase + EB_8004_STATUS)));
-
- /* Kick the interface */
-
- eb_reinit(sc);
-
- sc->sc_arpcom.ac_if.if_timer = 0;
-}
-
-/* End of if_ea.c */
diff --git a/sys/arch/arm32/podulebus/if_ebreg.h b/sys/arch/arm32/podulebus/if_ebreg.h
deleted file mode 100644
index b14bea7a503..00000000000
--- a/sys/arch/arm32/podulebus/if_ebreg.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/* $NetBSD: if_ebreg.h,v 1.2 1996/03/18 21:23:12 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * if_ebreg.h
- *
- * EtherB device driver
- *
- * Created : 08/07/95
- */
-
-/*
- * SEEQ 80C04 Register Definitions
- */
-
-#define EB_8004_BASE 0x800
-
-/*
- * SEEQ 80C04 registers
- */
-
-#define EB_8004_COMMAND 0x000
-#define EB_8004_STATUS 0x000
-#define EB_8004_CONFIG1 0x040
-#define EB_8004_CONFIG2 0x080
-#define EB_8004_RX_END 0x0c0
-#define EB_8004_BUFWIN 0x100
-#define EB_8004_RX_PTR 0x140
-#define EB_8004_TX_PTR 0x180
-#define EB_8004_DMA_ADDR 0x1c0
-
-/* */
-
-#define EB_CMD_TEST_INTEN (1 << 0)
-#define EB_CMD_RX_INTEN (1 << 1)
-#define EB_CMD_TX_INTEN (1 << 2)
-#define EB_CMD_TEST_INTACK (1 << 4)
-#define EB_CMD_RX_INTACK (1 << 5)
-#define EB_CMD_TX_INTACK (1 << 6)
-#define EB_CMD_BW_INTACK (1 << 7)
-#define EB_CMD_TEST_INT1 (1 << 8)
-#define EB_CMD_RX_ON (1 << 9)
-#define EB_CMD_TX_ON (1 << 10)
-#define EB_CMD_TEST_INT2 (1 << 11)
-#define EB_CMD_RX_OFF (1 << 12)
-#define EB_CMD_TX_OFF (1 << 13)
-#define EB_CMD_FIFO_READ (1 << 14)
-#define EB_CMD_FIFO_WRITE (1 << 15)
-
-#define EB_STATUS_TEST_INT (1 << 4)
-#define EB_STATUS_RX_INT (1 << 5)
-#define EB_STATUS_TX_INT (1 << 6)
-#define EB_STATUS_RX_ON (1 << 9)
-#define EB_STATUS_TX_ON (1 << 10)
-#define EB_STATUS_TX_NOFAIL (1 << 12)
-#define EB_STATUS_FIFO_FULL (1 << 13)
-#define EB_STATUS_FIFO_EMPTY (1 << 14)
-#define EB_STATUS_FIFO_DIR (1 << 15)
-#define EB_STATUS_FIFO_READ (1 << 15)
-
-#define EB_CFG1_SPECIFIC ((0 << 15) | (0 << 14))
-#define EB_CFG1_BROADCAST ((0 << 15) | (1 << 14))
-#define EB_CFG1_MULTICAST ((1 << 15) | (0 << 14))
-#define EB_CFG1_PROMISCUOUS ((1 << 15) | (1 << 14))
-
-#define EB_CFG2_BYTESWAP (1 << 0)
-#define EB_CFG2_REA_AUTOUPDATE (1 << 1)
-#define EB_CFG2_RX_TX_DISABLE (1 << 2)
-#define EB_CFG2_CRC_ERR_ENABLE (1 << 3)
-#define EB_CFG2_DRIB_ERR_ENABLE (1 << 4)
-#define EB_CFG2_PASS_LONGSHORT (1 << 5)
-#define EB_CFG2_PREAM_SELECT (1 << 7)
-#define EB_CFG2_RX_CRC (1 << 9)
-#define EB_CFG2_NO_TX_CRC (1 << 10)
-#define EB_CFG2_LOOPBACK (1 << 11)
-#define EB_CFG2_OUTPUT (1 << 12)
-#define EB_CFG2_RESET (1 << 15)
-
-#define EB_CFG3_SLEEP (1 << 3)
-
-#define EB_BUFCODE_STATION_ADDR 0x00
-#define EB_BUFCODE_ADDRESS_PROM 0x06
-#define EB_BUFCODE_TX_EAP 0x07
-#define EB_BUFCODE_LOCAL_MEM 0x08
-#define EB_BUFCODE_TX_COLLS 0x0b
-#define EB_BUFCODE_CONFIG3 0x0c
-#define EB_BUFCODE_PRODUCTID 0x0d
-#define EB_BUFCODE_TESTENABLE 0x0e
-#define EB_BUFCODE_MULTICAST 0x0f
-
-#define EB_PKTHDR_TX (1 << 7)
-#define EB_PKTHDR_RX (0 << 7)
-#define EB_PKTHDR_CHAIN_CONT (1 << 6)
-#define EB_PKTHDR_DATA_FOLLOWS (1 << 5)
-
-#define EB_PKTHDR_DONE (1 << 7)
-
-#define EB_TXHDR_BABBLE (1 << 0)
-#define EB_TXHDR_COLLISION (1 << 1)
-#define EB_TXHDR_COLLISION16 (1 << 2)
-#define EB_TXHDR_COLLISIONMASK (0x78)
-#define EB_TXHDR_ERROR_MASK (0x07)
-
-#define EB_TXHDR_BABBLE_INT (1 << 0)
-#define EB_TXHDR_COLLISION_INT (1 << 1)
-#define EB_TXHDR_COLLISION16_INT (1 << 2)
-#define EB_TXHDR_XMIT_SUCCESS_INT (1 << 3)
-#define EB_TXHDR_SQET_TEST_INT (1 << 3)
-
-#define EB_RXHDR_OVERSIZE (1 << 0)
-#define EB_RXHDR_CRC_ERROR (1 << 1)
-#define EB_RXHDR_DRIBBLE_ERROR (1 << 2)
-#define EB_RXHDR_SHORT_FRAME (1 << 3)
-
-#define EB_BUFFER_SIZE 0x10000
-#define EB_TX_BUFFER_SIZE 0x4000
-#define EB_RX_BUFFER_SIZE 0xC000
-
-/* Packet buffer size */
-
-#define EB_BUFSIZ 2048
-
-/* End of if_ebreg.h */
diff --git a/sys/arch/arm32/podulebus/if_eh.c b/sys/arch/arm32/podulebus/if_eh.c
deleted file mode 100644
index 4083515545f..00000000000
--- a/sys/arch/arm32/podulebus/if_eh.c
+++ /dev/null
@@ -1,1213 +0,0 @@
-/* $NetBSD: if_eh.c,v 1.6 1996/03/27 21:49:34 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Melvin Tang-Richardson.
- * All rights reserved.
- *
- * Essential things to do
- * - BPF and multicast support
- * - Testing
- * - 16-bit dma's
- * - Buffer overflow handling (This must be done a certain way) [Nuts]
- * - Enabling card interrupts (Need i cubed info)
- *
- * Other things to do
- * - Pipelined transmitts
- * - Dynamic buffer allocation
- * - Shared RAM if I cubed give me info
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by RiscBSD.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * if_eh.c
- *
- * Ether H driver.
- */
-
-/* Some system includes *****************************************************/
-
-#include <sys/types.h>
-#include <sys/cdefs.h>
-#include <sys/time.h>
-#include <sys/systm.h>
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/syslog.h>
-#include <sys/device.h>
-#include <machine/bootconfig.h>
-
-/* Hardware related include chip/card/bus ***********************************/
-
-#include <machine/io.h>
-#include <machine/irqhandler.h>
-#include <machine/katelib.h>
-#include <arm32/podulebus/podulebus.h>
-#include <arm32/podulebus/if_ehreg.h>
-
-/* Includes for interfacing with the network subsystem **********************/
-
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/mbuf.h>
-
-#include <net/if.h>
-#include <net/if_types.h>
-#include <net/if_dl.h>
-#include <net/netisr.h>
-#include <net/route.h>
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/in_var.h>
-#include <netinet/ip.h>
-#include <netinet/if_ether.h>
-#endif
-
-/****************************************************************************/
-/* Some useful definitions **************************************************/
-/****************************************************************************/
-
-#define MY_MANUFACTURER (0x46)
-#define MY_PODULE (0xec)
-
-#define TXBUF_SIZE (1522)
-#define NTXBUF (1)
-
-#define RXBUF_SIZE (256)
-#define NRXBUF (26)
-
-#define ETHER_MIN_LEN (64)
-#define ETHER_MAX_LEN (1522)
-
-#define PRINTF printf
-
-/****************************************************************************/
-/* Prototype internal data structures ***************************************/
-/****************************************************************************/
-
-struct eh_softc {
- /* Kernel interface variables */
- struct device sc_dev;
- int sc_podule_number;
- podule_t *sc_podule;
- irqhandler_t sc_ih;
-
- /* Network subsystem interface */
- struct arpcom sc_arpcom;
- int promisc;
-
- /* Driver defined state variables */
- int sc_flags;
-
- /* Hardware defined state */
- int sc_base;
- int sc_reg;
- int sc_nxtpkt;
-
- /* Card memory map */
- int sc_physstart;
- int sc_physend;
- int sc_tbs[NTXBUF]; /* Transmit buffer start */
- int sc_rbs;
- int sc_rbd;
-
- /* Txrx parameters */
- int sc_txcur; /* Fill this buffer next */
- int sc_txlst; /* Buffer in use */
-};
-
-/* sc_flags */
-
-#define MODE_MASK (3)
-#define MODE_DEAD (0)
-#define MODE_PIO (1)
-#define MODE_SHRAM (2)
-
-/****************************************************************************/
-/* Function and data prototypes *********************************************/
-/****************************************************************************/
-
-int ehprobe __P((struct device *parent, void *match, void *aux));
-void ehattach __P((struct device *parent, struct device *self, void *aux));
-void ehstart __P((struct ifnet *ifp));
-int ehioctl __P((struct ifnet *ifp, u_long cmd, caddr_t data));
-void ehwatchdog __P((int unit));
-void eh_stop_controller __P((struct eh_softc *sc));
-void eh_start_controller __P((struct eh_softc *sc));
-void eh_transmit_command __P((struct eh_softc *sc));
-int eh_copyin __P((struct eh_softc *sc, int src, char *dest, int len));
-int eh_copyout __P((struct eh_softc *sc, char *src, int dest, int len));
-void ehinit __P((struct eh_softc *sc));
-int ehstop __P((struct eh_softc *sc));
-int ehintr __P((void *arg));
-void eh_shutdown __P((void *arg));
-
-struct cfattach eh_ca = {
- sizeof(struct eh_softc), ehprobe, ehattach
-};
-
-struct cfdriver eh_cd = {
- NULL, "eh", DV_DULL, NULL, 0
-};
-
-/****************************************************************************/
-/* Some useful macros *******************************************************/
-/****************************************************************************/
-
-#define SetReg(r,v) WriteWord ( sc->sc_reg+(r), (v)|((v)<<16) )
-
-#define GetReg(r) ReadByte ( sc->sc_reg+(r) )
-
-#define PAGE(n) SetReg ( EH_COMMAND, \
- ((GetReg(EH_COMMAND)&COM_MASK_PAGE)|(n<<6)) )
-
-/* When initiating a remote dma, reset the TXP bit. This Does Not abort */
-/* the transmit, but allows us overlap this remote dma */
-
-#define REMOTE_DMA(n) SetReg ( EH_COMMAND, \
- ((GetReg(EH_COMMAND)&(COM_MASK_DMA))|n) )
-
-extern char *boot_args;
-char *strstr __P((char */*s1*/, char */*s2*/));
-
-/****************************************************************************/
-/* Bus attachment code ******************************************************/
-/****************************************************************************/
-
-int
-ehprobe(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
-{
- struct eh_softc *sc = (void *) match;
- struct podule_attach_args *pa = (void *) aux;
- int counter;
- int temp;
- int podule;
-
- podule = findpodule(MY_MANUFACTURER, MY_PODULE, pa->pa_podule_number);
-
- if (podule == -1)
- return 0;
-
- /* Start to fill in the softc with the trivial variables */
-
- sc->sc_flags = MODE_PIO; /* Select pio mode until I get info from i^3 */
- sc->sc_base = podules[podule].fast_base;
- sc->sc_reg = sc->sc_base + 0x800;
-
- /* The probe could be tidied up a little */
-
- /* Reset the card */
- SetReg(EH_RESET, 0xff);
- delay(10000);
-
- /* Explicitly abort remote DMA, mainly to set a legal state */
- PAGE(0);
- eh_stop_controller(sc);
- SetReg(EH_COMMAND, 0x20); /* This is wrong */
-
- SetReg(EH_ISR, 0xf ); /* Clear any previous work */
-
- temp = GetReg(EH_CONFIGA);
- temp = GetReg(EH_CONFIGA);
- temp &= ~0x38;
- SetReg(EH_CONFIGA, temp | 3<<3);
-
- temp = GetReg(EH_CONFIGA);
- temp = GetReg(EH_CONFIGA);
-
- /* Make the thing interrupt and test it */
-
- eh_start_controller(sc);
-
- /* Temporary initialisation, to allow a transmit test */
-
- SetReg(EH_PSTART, 16384 >> 8);
- SetReg(EH_PSTOP, 16896 >> 8);
- SetReg(EH_BNRY, 16384 >> 8);
-
- SetReg(EH_TCR, TCR_NORMALLOOP); /* Erk!! No, put us in loopback */
- SetReg(EH_DCR, DCR_WTS|DCR_LS|DCR_LAS);
- SetReg(EH_RCR, 0);
-
- /* Transmit some garbage into the loopback */
-
- SetReg(EH_TPSR, 0x5000);
- SetReg(EH_TBCR0, 0);
- SetReg(EH_TBCR1, 3);
-
- eh_transmit_command(sc);
-
- /* The card shouldn't be this quick, so use it as a test */
-
- if ((GetReg(EH_TSR)&TSR_DONE) != 0)
- PRINTF("eh: Card responded rather quickly %02x\n", GetReg(EH_TSR));
-
- for (counter=500; counter>0; counter--) {
- if ((GetReg(EH_TSR)&TSR_DONE) != 0)
- break;
-
- delay(500);
- }
-
- if (counter == 0) {
- PRINTF("eh: card did not respond\n");
- return 0;
- }
-
- /* Let it sleep since we're not doing anything with it for now */
-
- SetReg(EH_ISR, 0);
- SetReg(EH_DCR, DCR_WTS|DCR_LS|DCR_LAS);
-
-
- /* Test the board ram. This code will change */
-
- /*
- * Due to problems with some ether H cards the boot option ehbug
- * can be used to skip this test.
- * If you system hangs during the eh probe try this option.
- */
-
- #define NLEN (0x2000)
- #define NBASE (0x4000)
-
- if (boot_args) {
- char *ptr;
-
- ptr = strstr(boot_args, "ehbug");
- if (!ptr) {
- char *test_data;
- char *read_buffer;
- MALLOC(test_data, char *, NLEN, M_TEMP, M_NOWAIT);
- if (test_data == NULL)
- panic("Cannot allocate temporary memory for buffer test (1)");
- MALLOC(read_buffer, char *, NLEN, M_TEMP, M_NOWAIT);
- if (read_buffer == NULL)
- panic("Cannot allocate temporary memory for buffer test (1)");
-
- printf("1.");
-
- /* Fill the test_data block */
-
- for (counter=0; counter<NLEN; counter++) {
- test_data[counter] = (char)(counter&0xff);
- if (test_data[counter] == 0)
- test_data[counter]=0x23;
- }
-
- printf("2.");
-
- eh_copyout(sc, test_data, NBASE, NLEN);
- printf("3.");
- delay(10000);
- eh_copyin(sc, NBASE, read_buffer, NLEN);
- printf("4.");
-
- if (bcmp(test_data, read_buffer, NLEN))
- PRINTF("Block test failed\n");
- printf("5.");
- FREE(test_data, M_TEMP);
- FREE(read_buffer, M_TEMP);
- }
- }
- /* This is always true for our ether h */
-
- sc->sc_physstart = 0x4000;
- sc->sc_physend = 0x6000;
-
- /* Get out ethernet address */
- sc->sc_arpcom.ac_enaddr[0] = 0x00;
- sc->sc_arpcom.ac_enaddr[1] = 0x00;
- sc->sc_arpcom.ac_enaddr[2] = 0xc0;
- sc->sc_arpcom.ac_enaddr[3] = 0x41;
- sc->sc_arpcom.ac_enaddr[4] = bootconfig.machine_id[1];
- sc->sc_arpcom.ac_enaddr[5] = bootconfig.machine_id[0];
-
- /* Copy the ether addr cards filter */
-
- PAGE(1);
- for (counter=0; counter<6; counter++)
- SetReg(((counter+1)<<2), sc->sc_arpcom.ac_enaddr[counter]);
- PAGE(0);
-
- /* Tell the podule system about our successful probe */
- pa->pa_podule_number = podule;
- pa->pa_podule = &podules[podule];
-
- return 1;
-}
-
-void
-ehattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct eh_softc *sc = (void *) self;
- struct podule_attach_args *pa = (void *)aux;
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
- int irq;
- int temp;
-
- /* Check a few things about the attach args */
- sc->sc_podule_number = pa->pa_podule_number;
- if (sc->sc_podule_number == -1)
- panic("Podule has disappeared !");
-
- sc->sc_podule = &podules[sc->sc_podule_number];
- podules[sc->sc_podule_number].attached = 1;
-
- /* Fill in my application form to attach to the networking system */
-
- ifp->if_unit = sc->sc_dev.dv_unit;
- ifp->if_name = eh_cd.cd_name;
- ifp->if_start = ehstart;
- ifp->if_ioctl = ehioctl;
- ifp->if_watchdog = ehwatchdog;
- ifp->if_flags = IFF_BROADCAST | IFF_NOTRAILERS;
-
- /* Signed, dated then sent */
-
- if_attach(ifp);
- ether_ifattach(ifp);
-
- /* Not print some stuff for the attach line, starting with the address */
-
- PRINTF(" address %s", ether_sprintf(sc->sc_arpcom.ac_enaddr));
-
- /* Now the transfer mode we're operating in */
-
- switch (sc->sc_flags & MODE_MASK) {
- case MODE_PIO:
- PRINTF(" pio mode");
- break;
- case MODE_SHRAM:
- PRINTF(" ram mode");
- break;
- default:
- panic("Ether H probe set an unknown mode");
- }
-
- /* Get an irq handler installed */
-
- SetReg(EH_IMR, 0);
- SetReg(EH_ISR, 0xff);
-
- sc->sc_ih.ih_func = ehintr;
- sc->sc_ih.ih_arg = sc;
- sc->sc_ih.ih_level = IPL_NET;
- sc->sc_ih.ih_name = "net: eh";
-
- irq = (sc->sc_podule_number>=MAX_PODULES) ? IRQ_NETSLOT : IRQ_PODULE;
-
- if (irq_claim(irq, &sc->sc_ih))
- panic("Cannot install IRQ handler");
-
- /* This loopbacks the card on reset, and stops riscos locking */
-
- if (shutdownhook_establish(eh_shutdown, (void *)sc)==NULL)
- panic("Cannot install shutdown handler");
-
- /* Reprogram CONFIGA. I dont think we should do this any more */
-
- temp = GetReg(EH_CONFIGA);
- temp = GetReg(EH_CONFIGA);
- temp &= ~0x38;
- SetReg(EH_CONFIGA, temp | (3<<3));
-
- /* And that's it */
-
- PRINTF("\n");
-}
-
-/****************************************************************************/
-/* Net subsystem interface **************************************************/
-/****************************************************************************/
-
-#define NEXT_TXBUF (((sc->sc_txcur+1)>=NTXBUF) ? 0 : (sc->sc_txcur+1))
-
-void
-ehstart(ifp)
- struct ifnet *ifp;
-{
- struct eh_softc *sc = eh_cd.cd_devs[ifp->if_unit];
- int cur;
- struct mbuf *m0, *m;
- int nextbuf;
- char *buffer;
- char txbuf[TXBUF_SIZE];
- int len = 0;
-
- PAGE(0);
-
- if ((ifp->if_flags & IFF_OACTIVE) != 0)
- return;
-
-/* This is for pipelined transmit. At present just use 1 buffer */
-
- for (;;) {
-
-/* The #ifdef PIPELINE_TRANSMIT code is total screwed */
-
-#ifdef PIPELINE_TRANSMIT
- nextbuf = NEXT_TXBUF;
- if ( nextbuf == sc->sc_txlst )
- ifp->if_flags |= IFF_OACTIVE;
- break;
- }
-#else
- nextbuf = 0;
-#endif
-
- /*** Speed up - In future, copy the bufs direct to the card ***/
-
- /* Copy a frame out of the mbufs */
-
- IF_DEQUEUE(&sc->sc_arpcom.ac_if.if_snd, m);
- if ( !m )
- break;
-
- buffer = txbuf;
-
- len = 0;
- for ( m0=m; m && (len + m->m_len) < TXBUF_SIZE; m=m->m_next ) {
- bcopy(mtod(m,caddr_t), buffer, m->m_len);
- buffer+=m->m_len;
- len+=m->m_len;
- }
-
- m_freem(m0);
- len = max ( len, ETHER_MIN_LEN );
-
- /* And blat it to the card */
-
- eh_copyout ( sc, txbuf, sc->sc_tbs[nextbuf], len );
-
-#ifdef PIPELINE_TRANSMIT
- sc->sc_txlst = nextbuf;
-#endif
- PAGE(0);
-
- SetReg ( EH_TPSR, sc->sc_tbs[nextbuf]>>8 );
- SetReg ( EH_TBCR0, len&0xff );
- SetReg ( EH_TBCR1, (len>>8) & 0xff );
-
- cur = GetReg(EH_COMMAND);
-
- eh_transmit_command (sc );
-
- ifp->if_flags |= IFF_OACTIVE;
- ifp->if_timer = 30;
-
-#ifndef PIPELINE_TRANSMIT
- break;
-#endif
- }
-}
-
-#define IZSET(a,b) ((a->if_flags&b)!=0)
-#define IZCLR(a,b) ((a->if_flags&b)==0)
-#define DOSET(a,b) (a->if_flags|=b)
-#define DOCLR(a,b) (a->if_flags&=~b)
-
-int
-ehioctl(ifp, cmd, data)
- struct ifnet *ifp;
- u_long cmd;
- caddr_t data;
-{
- struct eh_softc *sc = eh_cd.cd_devs[ifp->if_unit];
- struct ifaddr *ifa = (struct ifaddr *)data;
- int s = splimp ();
- int error = 0;
-
- if ((error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data)) > 0) {
- splx(s);
- return error;
- }
-
- switch (cmd) {
- case SIOCSIFADDR:
- ifp->if_flags |= IFF_UP;
- switch ( ifa->ifa_addr->sa_family ) {
-#ifdef INET
- case AF_INET:
- ehinit(sc);
- arp_ifinit(&sc->sc_arpcom, ifa);
- break;
-#endif
- default:
- ehinit(sc);
- break;
- }
- break;
-
- case SIOCSIFFLAGS:
- sc->promisc = ifp->if_flags & ( IFF_PROMISC | IFF_ALLMULTI );
-
- if ( IZCLR(ifp,IFF_UP) && IZSET(ifp,IFF_RUNNING) ) {
- /* Interface marked down, but still running */
- ehstop(sc);
- DOCLR(ifp,IFF_RUNNING);
- } else if ( IZSET(ifp,IFF_UP) && IZCLR(ifp,IFF_RUNNING) ) {
- /* Just marked up, not running yet */
- ehinit(sc);
- } else {
- /* Reset to invoke changes in other registers */
- ehstop(sc);
- ehinit(sc);
- }
-
- default:
- error = EINVAL;
- }
-
- splx (s);
- return error;
-}
-
-void
-ehwatchdog(unit)
- int unit;
-{
- struct eh_softc *sc = eh_cd.cd_devs[unit];
-
- log (LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname );
- sc->sc_arpcom.ac_if.if_oerrors++;
-
- ehinit (sc);
-}
-
-/*
- * void eh_stop_controller ( struct eh_softc *sc )
- *
- * Software reset command, takes the controller offline, no packets will be
- * received or transmitted. Any reception or transmission inprogres will
- * continue to completion before entering the reset state.
- */
-
-void
-eh_stop_controller(sc)
- struct eh_softc *sc;
-{
- SetReg ( EH_COMMAND, ((GetReg(EH_COMMAND)&0xfc)|1) );
- delay ( 10000 ); /* Change this to wait on the ISR bit */
-}
-
-/*
- * void eh_start_controller ( struct eh_softc *sc )
- *
- * Activte the NIC core after either power up or when the NIC Core has
- * been placed in a reset mode by eh_stop_controller or an error.
- */
-
-void
-eh_start_controller(sc)
- struct eh_softc *sc;
-{
- int temp = GetReg(EH_COMMAND);
- SetReg ( EH_COMMAND, ( (temp&0xfc)|2) );
-}
-
-void
-eh_transmit_command(sc)
- struct eh_softc *sc;
-{
- /* Explicit set here. There is no other reasonable combination */
- SetReg ( EH_COMMAND, COM_ABORT|COM_STA|COM_TXP);
-}
-
-/****************************************************************************/
-/* Remote DMA handling ******************************************************/
-/****************************************************************************/
-
-/* Remote DMA handling is going to undergo a major overhaul real soon now */
-
-/* We musn't fail */
-
-inline void
-eh_ensure_dma_ok(sc)
- struct eh_softc *sc;
-{
- register int isr = GetReg ( EH_ISR );
- register int status = GetReg ( EH_COMMAND );
- int dummy;
-
- if ((status&COM_ABORT)==0) {
- SetReg ( EH_COMMAND, status|COM_ABORT );
- while ((isr&ISR_RDC)==0) {
- dummy = GetReg ( EH_DATA_PORT );
- delay(50);
- }
- }
-
- /* Reset the COM_TXP bit. This does not abort transmission */
-
- SetReg(EH_COMMAND, 0x22);
-}
-
-inline int
-eh_ensure_dma_competed(sc, type)
- struct eh_softc *sc;
- int type;
-{
- register int status = GetReg ( EH_COMMAND );
-
- if ( (status&COM_ABORT)==0 ) {
- int dummy=0;
- printf ( "EHDEBUG: Remote %d wasn't finished\n", type );
- SetReg ( EH_COMMAND, status|COM_ABORT );
- switch ( type ) {
- case COM_READ:
- dummy = GetReg ( EH_DATA_PORT );
- break;
- case COM_WRITE:
- SetReg ( EH_DATA_PORT, dummy );
- break;
- }
- ehinit (sc);
- return 1;
- }
- return 0;
-}
-
-/* Do an eh_copyin, but take into consideration ring wrap */
-
-int
-eh_copyring(sc, src, dest, len)
- struct eh_softc *sc;
- int src;
- char *dest;
- int len;
-{
- if ( (src+len)>sc->sc_rbd ) {
- register int in = sc->sc_rbd - src;
- if ( eh_copyin ( sc, src, dest, in )==0 ) {
- printf ( "copyring failed pass 1\n" );
- return 0;
- }
- if ( eh_copyin ( sc, sc->sc_rbs, dest+in, len-in )==0 ) {
- printf ( "copyring failed pass 2\n" );
- return 0;
- }
- } else {
- if ( eh_copyin ( sc, src, dest, len )==0 ) {
- printf ( "copyring faild on 1 pass copy\n" );
- return 0;
- }
- }
- return len;
-}
-
-int
-eh_copyin(sc, src, dest, len)
- struct eh_softc *sc;
- int src;
- char *dest;
- int len;
-{
- int counter;
- int s;
- short *dst = (short *)dest;
-
- s = splhigh(); /* Erm, maybe not needed now */
-
- if (len & 1)
- len++;
- if (src & 1) {
- printf ( "EHDEBUG: Copying from odd address\n" );
- src++;
- }
-
- /* Remote DMA to the DP83905 must be done with care. If we dont */
- /* do it exactly right, it punishes us by locking the bus. */
-
- eh_ensure_dma_ok (sc);
-
- /* Set up the DMA */
-
- SetReg ( EH_RSAR0, src & 0xff );
- SetReg ( EH_RSAR1, (src>>8) & 0xff );
- SetReg ( EH_RBCR0, len & 0xff );
- SetReg ( EH_RBCR1, (len>>8) & 0xff );
-
- /* Set the DMA running */
- /* REMOTE_DMA ( COM_READ ); */ /* SetReg ( EH_COMMAND, 0x0a ); */
- SetReg ( EH_COMMAND, COM_READ|COM_STA );
-
- for ( counter=0; counter<len; counter+=2 )
- *(dst++)=ReadShort ( sc->sc_reg + EH_DATA_PORT );
-
- splx(s);
-
- if ( eh_ensure_dma_competed ( sc, COM_READ ) )
- return 0;
-
- return len;
-}
-
-int
-eh_copyout(sc, src, dest, len)
- struct eh_softc *sc;
- char *src;
- int dest;
- int len;
-{
- int counter;
- int s;
- short *sr = (short *)src;
-
- if (len & 1)
- len++;
- if (dest & 1) {
- printf ( "EHDEBUG: Copying to odd address\n" );
- dest++;
- }
-
- s = splhigh(); /* Erm, maybe not needed now */
-
- /* Remote DMA to the DP83905 must be done with care. If we dont */
- /* do it exactly right, it punishes us by locking the bus. */
-
- eh_ensure_dma_ok (sc);
-
- /* Set up the DMA */
-
- SetReg ( EH_RSAR0, dest & 0xff );
- SetReg ( EH_RSAR1, (dest>>8) & 0xff );
- SetReg ( EH_RBCR0, len & 0xff );
- SetReg ( EH_RBCR1, (len>>8) & 0xff );
-
- /* Set the DMA running */
- /*REMOTE_DMA ( COM_WRITE );*/ /* SetReg ( EH_COMMAND, 0x0a ); */
- SetReg ( EH_COMMAND, COM_WRITE|COM_STA );
-
- for ( counter=0; counter<len; counter+=2 ) {
- WriteShort ( sc->sc_reg + EH_DATA_PORT, *(sr) );
- sr++;
- }
-
- splx(s);
-
- if ( eh_ensure_dma_competed ( sc, COM_WRITE ) )
- return 0;
-
- return len;
-}
-
-#define ALLOCBLK(v,s) (v)=card_freestart; \
- card_freestart+=((s)+0xff)&(~0xff)
-
-void
-ehinit(sc)
- struct eh_softc *sc;
-{
- int card_freestart;
- int counter;
-
- PAGE(0);
-
- /* Lay out the cards ram */
- card_freestart = sc->sc_physstart;
-
- /* Allocate receive buffers */
-
- ALLOCBLK ( sc->sc_rbs, (RXBUF_SIZE*NRXBUF) );
- sc->sc_rbd = card_freestart;
- sc->sc_nxtpkt = sc->sc_rbs + 0x100;
-
- /* Allocate transmit buffers */
- for ( counter=0; counter<NTXBUF; counter++ ) {
- ALLOCBLK ( sc->sc_tbs[counter], TXBUF_SIZE );
- }
-
- if ( card_freestart > sc->sc_physend ) {
- printf ( "eh: card short of ram %02x required %02x present\n",
- card_freestart, sc->sc_physstart );
- sc->sc_arpcom.ac_if.if_flags &= ~IFF_RUNNING;
- sc->sc_arpcom.ac_if.if_flags |= IFF_OACTIVE;
- return;
- }
-
- /*
- * Bring the controller up
- *
- * The ordering here is critical. Dont change unless you know what
- * you're doing
- */
-
- /* Reset the card */
-
- SetReg ( EH_RESET, 0xff );
- delay (50000);
- SetReg ( EH_RESET, 0x00 );
- delay (50000);
-
- /* 1. Program the command register for page 0 */
-
- SetReg ( EH_COMMAND, 0x21 );
-
- /* 2. Initialize the Data configuration register */
-
- SetReg ( EH_DCR, DCR_WTS|DCR_LS|(0<<5) );
-
- /* 3. Clear RBCR if using remote DMA */
-
- SetReg ( EH_RBCR0, 0 );
- SetReg ( EH_RBCR1, 0 );
-
- /* 4. Initialise RCR */
-
- SetReg ( EH_RCR, 0x04 );
-
- /* 5. Place the controller in loopback mode 1 or 2 TCR=02H or 04H */
-
- SetReg ( EH_TCR, 0x02 );
-
- /* 6. Initiliase Receive ring buffer BNDRY PSTART PSTOP */
-
- SetReg ( EH_BNRY, sc->sc_rbs >> 8 );
- SetReg ( EH_PSTART, sc->sc_rbs >> 8 );
- SetReg ( EH_PSTOP, sc->sc_rbd >> 8 );
-
- /* 7. Clear ISR */
-
- SetReg ( EH_ISR, 0xff );
-
- /* 8. Initialise IMR */
-
- SetReg ( EH_IMR, ISR_PRX|ISR_PTX|ISR_RXE|ISR_TXE|ISR_OVW|ISR_CNT );
-
- /* 9. Program command register for page 1 COM=0x61 */
- /* Initialise PAR MAR and CURR */
-
- PAGE(1);
-
- SetReg ( EH_CURR, sc->sc_nxtpkt >> 8 );
-
- for ( counter=0; counter<6; counter++ )
- SetReg ( ((counter+1)<<2), sc->sc_arpcom.ac_enaddr[counter] );
-
- /* Put controller into start mode COM = 0x22 */
-
- SetReg ( EH_COMMAND, 0x22 );
-
- /* Initialise the TCR */
-
- SetReg ( EH_TCR, TCR_NORMALLOOP );
-
- /* Interface is up */
-
- sc->sc_arpcom.ac_if.if_flags |= IFF_RUNNING;
- sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
-
- ehstart(&sc->sc_arpcom.ac_if);
-}
-
-int
-ehstop(sc)
- struct eh_softc *sc;
-{
- int s = splimp();
- eh_stop_controller(sc);
- SetReg(EH_DCR, DCR_LS|DCR_LAS);
- splx(s);
- return 0;
-}
-
-#define INTR_ACK(s) SetReg ( EH_ISR, s )
-
-/* In need of tidying */
-
-#undef MYTEST
-
-void
-eh_rint(sc)
- struct eh_softc *sc;
-{
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
- struct mbuf *top, **mp, *m;
- struct ether_header eh;
- struct eh_rxhdr hdr;
- int status = GetReg(EH_RSR);
- int rxstatus=0;
- int totlen, len;
- int ptr;
- int rbend;
- int thispacket;
- int bnry;
-
-#ifdef MYTEST
- int old;
-#endif
-
- /* Get the end of the ring buffer */
-
- PAGE(1);
- rbend = GetReg ( EH_CURR ) << 8;
- PAGE(0);
-
- /* If we have something to receive then receive it */
-
- if ( status&RSR_PRX ) {
- /* Remove all the packets from the ring buffer */
- for ( ptr=sc->sc_nxtpkt; ptr!=rbend ; ptr = sc->sc_nxtpkt ) {
-
- thispacket = ptr;
- /* Copy the ether h receive header */
-
- if ( eh_copyring ( sc, ptr, (char *)&hdr, 4 ) != 4 ) {
- printf ( "eh: Failed copying in header\n" );
- printf ( "eh: thispacket %02x\n", thispacket );
- ehinit (sc);
- return;
- }
-
- rxstatus = hdr.rx_status;
- totlen = (hdr.rx_rbc1<<8) + hdr.rx_rbc0;
-
- ptr+=4;
-
- /* Check the packet's status */
- if ( hdr.rx_status&(RSR_CRC|RSR_FAE|RSR_FO|RSR_MPA) ) {
- printf ( "eh: intact packet is corrupt %02x %04x\n",
- hdr.rx_status, ptr );
- }
-
- if (((hdr.rx_nxtpkt<<8)>sc->sc_rbd) || ((hdr.rx_nxtpkt<<8)<sc->sc_rbs)) {
- printf ( "eh: ring buffer empty %04x %04x\n",
- hdr.rx_nxtpkt, ptr );
- ehinit (sc);
- return;
- }
-
- if (0)
- printf ( "pulling packet at %08x, next at %08x\n", thispacket, sc->sc_nxtpkt );
-
- if ( totlen>ETHER_MAX_LEN ) {
- printf ( "eh: giant packet received %04x\n", totlen );
- totlen = ETHER_MAX_LEN;
- }
-
- /* Copy the ether header */
-
- if ((eh_copyring ( sc, ptr, (char *)&eh, sizeof (eh)))!=sizeof(eh)) {
- printf ( "eh: Failed copying in ethenet header\n" );
- return;
- }
- ptr+=sizeof(eh);
- totlen-=sizeof(eh);
-
- /* Copy the packet into mbufs */
-
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if ( m==0 )
- return;
- m->m_pkthdr.rcvif = ifp;
- m->m_pkthdr.len = totlen;
- len = MHLEN;
- top = 0;
- mp = &top;
-
- while ( totlen > 0 ) {
- if (top) {
- MGET(m, M_DONTWAIT, MT_DATA);
- if ( m==0 ) {
- m_freem(top);
- goto skip;
- }
- len = MLEN;
- }
- if ( totlen >= MINCLSIZE ) {
- MCLGET(m, M_DONTWAIT);
- if (m->m_flags & M_EXT)
- len = MCLBYTES;
- }
- m->m_len = len = min ( totlen, len );
-
- if ((eh_copyring ( sc, ptr, mtod(m, caddr_t), len))!=len)
- printf ( "eh: failed copying in buffer %d\n", len );
-
- ptr += len;
- totlen -= len;
- *mp = m;
- mp = &m->m_next;
- }
-
- m = top;
- ifp->if_ipackets++;
- ether_input(ifp, &eh, m );
-skip:
-
- /* Ok, I'm done with this packet */
-
- sc->sc_nxtpkt = hdr.rx_nxtpkt << 8;
-
- /* Set the boundary pointer on the ring buffer */
-
- bnry = (sc->sc_nxtpkt>>8)-1;
- if ( bnry < (sc->sc_rbs>>8) )
- bnry = (sc->sc_rbd>>8)-1;
- SetReg ( EH_BNRY, bnry );
-
- PAGE(1);
- rbend = GetReg ( EH_CURR ) << 8;
- PAGE(0);
- }
- }
-}
-
-int
-ehintr(arg)
- void *arg;
-{
- struct eh_softc *sc = arg;
- register int isr = GetReg ( EH_ISR ); /* Is char of int faster ? */
- register int times = 0;
-
- PAGE(0);
-
- if ( isr & ISR_RXE ) {
- int status = GetReg ( EH_RSR );
- PRINTF ( "eh: Receive Error:" );
- if ( status&RSR_PRX )
- PRINTF ( " packet received intact (this should happen)" );
- if ( status&RSR_CRC )
- PRINTF ( " crc error" );
- if ( status&RSR_FAE )
- PRINTF ( " frame alignment error" );
- if ( status&RSR_FO )
- PRINTF ( " fifo overrun" );
- if ( status&RSR_MPA )
- PRINTF ( " missed packet" );
- if ( status&RSR_DIS )
- PRINTF ( " receiver disabled" );
- printf ( "\n" );
- INTR_ACK ( ISR_RXE );
- ehinit (sc);
- return 0;
- }
-
- if ( isr & ISR_PRX ) {
- eh_rint (sc);
- INTR_ACK ( ISR_PRX );
- }
-
- if ( isr & ISR_PTX ) {
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
- int status;
- INTR_ACK ( ISR_PTX );
- ifp->if_timer=0;
- ifp->if_flags &= ~IFF_OACTIVE;
-
- status = GetReg ( EH_TSR );
-
- if ( status&TSR_PTX )
- ifp->if_opackets++;
-
- if ( status&TSR_COL )
- ifp->if_collisions+=GetReg(EH_NCR);
-
- if ( status&TSR_ABT )
- PRINTF ( "eh: too many collisions\n" );
-
- if ( status&TSR_CRS )
- PRINTF ( "eh: no carrier\n" );
-
- if ( status&TSR_CDH )
- PRINTF ( "eh: tranceiver failure, no heartbeat \n" );
-
- if ( status&TSR_OWC )
- PRINTF ( "eh: out of window \n" );
-
- if ( status&(TSR_ABT|TSR_CRS|TSR_FU|TSR_CDH|TSR_OWC) )
- ifp->if_oerrors++;
-
- ehstart(ifp);
- }
-
- if ( isr & ISR_TXE ) {
- INTR_ACK ( ISR_TXE );
- PRINTF ( "ehintr: Transmit error\n" );
- }
-
- if ( isr & ISR_OVW ) {
- INTR_ACK ( ISR_OVW );
- PRINTF ( "ehintr: Counter overflow\n" );
- }
-
- if ( isr & ISR_RST ) {
- INTR_ACK ( ISR_RST );
- PRINTF ( "ehintr: Reset status\n" );
- }
-
- if ((times++)>16) {
- PRINTF ( "eh: possible interrupt jammed on." );
- SetReg ( EH_IMR, 0x0 );
- }
-
- /* Dont do this for the mo until I'm sure.
-
- isr = GetReg ( EH_ISR );
-
- if ( (isr&GetReg(EH_IMR))!=0 )
- goto more;
- */
-
- if ( (isr&GetReg(EH_IMR))!=0 )
- printf ( "eh: Interrupt not serviced\n" );
-
- return 0;
-}
-
-/****************************************************************************/
-/* Auxilary routines ********************************************************/
-/****************************************************************************/
-
-void
-eh_shutdown(arg)
- void *arg;
-{
- struct eh_softc *sc = (struct eh_softc *)arg;
-
- /* On shutdown put us in loopback */
-
- SetReg(EH_DCR, DCR_LAS);
- SetReg(EH_TCR, TCR_NICMOD);
-
- /* and program remote dma so riscos doesnt lock */
-
- SetReg(EH_RSAR0, 0);
- SetReg(EH_RSAR1, 1);
- SetReg(EH_RBCR0, 0);
- SetReg(EH_RBCR1, 1);
-}
diff --git a/sys/arch/arm32/podulebus/if_ehreg.h b/sys/arch/arm32/podulebus/if_ehreg.h
deleted file mode 100644
index 8fbb18e964e..00000000000
--- a/sys/arch/arm32/podulebus/if_ehreg.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/* $NetBSD: if_ehreg.h,v 1.2 1996/03/08 16:24:51 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Melvin Tang-Richardson.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by RiscBSD.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * if_ehreg.h
- *
- * Ether H register definitions.
- */
-
-#define EH_RESET (0x18<<2)
-
-#define EH_DATA_PORT (0x10<<2)
-
-/* Special registers */
-
-#define EH_CONFIGA (0x0a<<2)
-
-/* Page 0 read registers */
-
-#define EH_COMMAND (0x00<<2)
-#define EH_CLAD0 (0x01<<2)
-#define EH_CLDA1 (0x02<<2)
-#define EH_BNRY (0x03<<2)
-#define EH_TSR (0x04<<2)
-#define EH_NCR (0x05<<2)
-#define EH_FIFO (0x06<<2)
-#define EH_ISR (0x07<<2)
-#define EH_CRDA0 (0x08<<2)
-#define EH_CRDA1 (0x09<<2)
-#define EH_RSR (0x0c<<2)
-
-/* Page 0 write registers */
-
-#define EH_PSTART (0x01<<2)
-#define EH_PSTOP (0x02<<2)
-#define EH_TPSR (0x04<<2)
-#define EH_TBCR0 (0x05<<2)
-#define EH_TBCR1 (0x06<<2)
-#define EH_RSAR0 (0x08<<2)
-#define EH_RSAR1 (0x09<<2)
-#define EH_RBCR0 (0x0a<<2)
-#define EH_RBCR1 (0x0b<<2)
-#define EH_RCR (0x0c<<2)
-#define EH_TCR (0x0d<<2)
-#define EH_DCR (0x0e<<2)
-#define EH_IMR (0x0f<<2)
-
-/* Page 1 write registers */
-
-#define EH_CURR (0x07<<2)
-
-/* Command bits */
-
-#define COM_STP (0x01)
-#define COM_STA (0x02)
-#define COM_TXP (0x04)
-#define COM_MASK_PAGE (0x3f)
-#define COM_READ (0x08)
-#define COM_WRITE (0x10)
-#define COM_SEND (0x18)
-#define COM_ABORT (0x20)
-#define COM_MASK_DMA (0xc7)
-#define COM_DMA_MASK (0x38)
-
-/* DCR bits */
-
-#define DCR_WTS (0x01)
-#define DCR_BOS (0x02)
-#define DCR_LAS (0x04)
-#define DCR_LS (0x08)
-#define DCR_ARM (0x10)
-
-/* TSR bits */
-
-#define TSR_PTX (0x01)
-#define TSR_COL (0x04)
-#define TSR_ABT (0x08)
-#define TSR_CRS (0x10)
-#define TSR_FU (0x20)
-#define TSR_CDH (0x40)
-#define TSR_OWC (0x80)
-#define TSR_DONE ((TSR_PTX)|(TSR_ABT))
-
-/* TCR bits */
-
-#define TCR_CRC (0x01)
-#define TCR_NORMALLOOP (0x00)
-#define TCR_NICMOD (0x02)
-#define TCR_ENDECMOD (0x04)
-#define TCR_EXTLOOP (0x06)
-#define TCR_ATD (0x08)
-#define TCR_OFST (0x10)
-
-/* ISR bits */
-
-#define ISR_PRX (0x01)
-#define ISR_PTX (0x02)
-#define ISR_RXE (0x04)
-#define ISR_TXE (0x08)
-#define ISR_OVW (0x10)
-#define ISR_CNT (0x20)
-#define ISR_RDC (0x40)
-#define ISR_RST (0x80)
-
-/* RSR bits */
-
-#define RSR_PRX (0x01)
-#define RSR_CRC (0x02)
-#define RSR_FAE (0x04)
-#define RSR_FO (0x08)
-#define RSR_MPA (0x10)
-#define RSR_PHY (0x20)
-#define RSR_DIS (0x40)
-#define RSR_DFR (0x80)
-
-struct eh_rxhdr {
- char rx_status;
- char rx_nxtpkt;
- char rx_rbc0;
- char rx_rbc1;
-};
-
diff --git a/sys/arch/arm32/podulebus/if_ie.c b/sys/arch/arm32/podulebus/if_ie.c
deleted file mode 100644
index 80d3199d222..00000000000
--- a/sys/arch/arm32/podulebus/if_ie.c
+++ /dev/null
@@ -1,1524 +0,0 @@
-/* $NetBSD: if_ie.c,v 1.5 1996/03/27 21:49:36 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Melvin Tang-Richardson.
- * All rights reserved.
- *
- * This driver is a major hash up of src/sys/dev/isa/if_ie.c and
- * src/sys/arch/arm32/podule/kgdb_ie.c Please refer to copyright
- * notices from them too.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by RiscBSD.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * if_ie.c
- *
- * Ether 1 podule driver
- *
- * Created : 26/06/95
- */
-
-/*
- * This driver is at it's last beta release. It should not cause
- * any problems (Touch wood)
- *
- * If it passes field tests again. This will constitute the realse
- * version.
- */
-
-#define IGNORE_ETHER1_IDROM_CHECKSUM
-
-/* Standard podule includes */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/conf.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-#include <machine/io.h>
-#include <machine/irqhandler.h>
-#include <machine/katelib.h>
-#include <arm32/podulebus/podulebus.h>
-
-/* Include for interface to the net and ethernet subsystems */
-
-#include <sys/socket.h>
-#include <sys/syslog.h>
-#include <sys/ioctl.h>
-#include <sys/mbuf.h>
-
-#include <net/if.h>
-#include <net/if_types.h>
-#include <net/if_dl.h>
-#include <net/netisr.h>
-#include <net/route.h>
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/in_var.h>
-#include <netinet/ip.h>
-#include <netinet/if_ether.h>
-#endif
-
-/* Import our data structres */
-
-#include "if_iereg.h"
-
-/* BPF support */
-
-#include "bpfilter.h"
-#if NBPFILTER > 0
-#include <net/bpf.h>
-#include <net/bpfdesc.h>
-#endif
-
-/* Some useful defines and macros */
-
-#define MY_MANUFACTURER 0x00
-#define MY_PODULE 0x03
-#define PODULE_IRQ_PENDING (1)
-#define NFRAMES (16) /* number of frame to allow for receive */
-#define NRXBUF (48) /* number of receive buffers to allocate */
-#define IE_RXBUF_SIZE (256) /* receive buf size */
-#define NTXBUF (2) /* number of transmit buffers to allocate */
-#define IE_TXBUF_SIZE (1522) /* size of tx buffer */
-
-#define ETHER_MIN_LEN (64)
-#define ETHER_MAX_LEN (1518)
-
-#define PWriteShort(a,b) WriteWord(a,(b)<<16|(b))
-
-#define offsetof(type, member) (((size_t)&((type *)0)->member)<<1)
-
-/* Some data structres local to this file */
-
-struct ie_softc {
- struct device sc_dev;
- int sc_podule_number;
- podule_t *sc_podule;
- irqhandler_t sc_ih;
- int sc_iobase;
- int sc_fastbase;
- int sc_rom;
- int sc_ram;
- int sc_control;
- struct arpcom sc_arpcom;
- int promisc;
- int sc_irqmode;
-
- u_long rframes[NFRAMES];
- u_long rbuffs[NRXBUF];
- u_long cbuffs[NRXBUF];
- int rfhead, rftail, rbhead, rbtail;
-
- u_long xmit_cmds[NTXBUF];
- u_long xmit_buffs[NTXBUF];
- u_long xmit_cbuffs[NTXBUF];
- int xmit_count;
- int xmit_free;
- int xchead;
- int xctail;
-};
-
-/* Function and data prototypes */
-
-static void host2ie ( struct ie_softc *sc, void *src, u_long dest, int size );
-static void ie2host ( struct ie_softc *sc, u_long src, void *dest, int size );
-static void iezero ( struct ie_softc *sc, u_long p, int size );
-void iereset ( struct ie_softc *sc );
-void iewatchdog ( int unit );
-int ieioctl ( struct ifnet *ifp, u_long cmd, caddr_t data );
-void iestart ( struct ifnet *ifp );
-int iestop ( struct ie_softc *sc );
-int ieinit ( struct ie_softc *sc );
-int ieintr ( void *arg );
-void ietint ( struct ie_softc *sc );
-
-/* A whopper of a function */
-static int command_and_wait ( struct ie_softc *sc, u_short cmd,
- struct ie_sys_ctl_block *pscb,
- void *pcmd, int ocmd, int scmd, int mask );
-
-struct cfattach ie_ca;
-
-struct cfdriver ie_cd;
-
-/* Let's go! */
-
-/*
- * Clear all pending interrupts from the i82586 chip
- */
-
-static __inline void ie_cli ( struct ie_softc *sc )
-{
- WriteByte ( sc->sc_fastbase + (IE_CONTROL<<2), IE_CONT_CLI );
-}
-
-/*
- * Cool down the i82586, like its namesake, it gets very hot
- */
-
-static __inline void ie_cooldown ( int temperature )
-{
-}
-
-/*
- * Wake the i82586 chip up and get it to do something
- */
-
-static __inline void ieattn ( struct ie_softc *sc )
-{
- WriteByte ( sc->sc_control + (IE_CONTROL<<2), IE_CONT_ATTN );
-}
-
-/*
- * Set the podule page register to bring a given address into view
- */
-
-static __inline void setpage ( struct ie_softc *sc, u_long off )
-{
- WriteByte ( sc->sc_control + (IE_PAGE<<2), IE_COFF2PAGE(off) );
-}
-
-/*
- * Ack the i82586
- */
-
-static void ie_ack ( struct ie_softc *sc, u_short mask )
-{
- u_short stat;
- int i;
- setpage(sc, IE_IBASE + IE_SCB_OFF );
-
- stat = ReadShort ( sc->sc_ram + IE_COFF2POFF(IE_IBASE+IE_SCB_OFF) +
- (offsetof(struct ie_sys_ctl_block, ie_status)) );
-
- PWriteShort ( sc->sc_ram + IE_COFF2POFF(IE_IBASE+IE_SCB_OFF) +
- (offsetof(struct ie_sys_ctl_block, ie_command)),
- stat & mask );
-
- ieattn(sc);
-
- for ( i=4000; --i>=0; ) {
- if ( !ReadShort(sc->sc_ram + IE_COFF2POFF(IE_IBASE+IE_SCB_OFF) +
- (offsetof(struct ie_sys_ctl_block, ie_command))) )
- break;
- delay(100);
- }
-
- if ( i<=0 )
- {
- printf ( "ie: command timed out\n" );
- }
- ie_cli(sc);
-}
-
-/*
- * This routine does the checksumming for the idrom
- */
-
-static u_long crc32(u_char *p, int l)
-{
- u_long crc=-1;
- int i, b;
- while ( --l >= 0 ) {
- b = *p++;
- for ( i=8; --i >= 0; b>>=1 )
- if ((b&1)^(crc>>31))
- crc=(crc<<1)^0x4c11db7;
- else
- crc<<=1;
- }
- return crc;
-}
-
-/*
- * Probe for the ether1 card. return 1 on success 0 on failure
- */
-
-int ieprobe ( struct device *parent, void *match, void *aux )
-{
- struct ie_softc *sc = (void *)match;
- struct podule_attach_args *pa = (void *)aux;
- int podule, i;
- char idrom[32];
- u_char *hwaddr = sc->sc_arpcom.ac_enaddr;
-
- /* Get the nice podulebus podule to find my podule in its table */
- podule = findpodule(MY_MANUFACTURER, MY_PODULE, pa->pa_podule_number);
-
- if (podule == -1)
- return(0);
-
- /* Index some podule areas */
- sc->sc_iobase = podules[podule].sync_base; /* OBSOLETE */
- sc->sc_fastbase = podules[podule].fast_base; /* OBSOLETE */
- sc->sc_rom = podules[podule].sync_base;
- sc->sc_control = podules[podule].fast_base;
- sc->sc_ram = podules[podule].fast_base + IE_MEMOFF;
-
- /* Set the page mask to something know and neutral */
- setpage(sc, IE_SCB_OFF);
-
- /* Fetch the first part of the idrom */
- for ( i=0; i<16; i++ ) {
- idrom[i] = ReadByte ( sc->sc_rom + (i<<2) );
- };
-
- /* Verify the podulebus probe incase RiscOS lied */
- if ( ReadByte ( sc->sc_rom + (3<<2) ) != 0x03 ) {
- panic ( "ie: Ether1 ROM probablly broken. ECID corrupt" );
- return 0;
- }
-
- /* Reset the 82586 */
- WriteByte ( sc->sc_fastbase + (IE_CONTROL<<2), IE_CONT_RESET );
- delay(1000);
- WriteByte ( sc->sc_fastbase + (IE_CONTROL<<2), 0 );
- delay(10000);
-
- /* Clear pending interrupts */
- ie_cli (sc);
-
- /* Setup SCP */
- {
- struct ie_sys_conf_ptr scp;
- bzero (&scp, sizeof(scp) );
- scp.ie_iscp_ptr = (caddr_t)IE_ISCP_ADDR;
- host2ie(sc, &scp, IE_SCP_ADDR, sizeof (scp) );
- }
-
- /* Setup ISCP */
- {
- struct ie_int_sys_conf_ptr iscp;
- bzero ( &iscp, sizeof(iscp) );
- iscp.ie_busy = 1;
- iscp.ie_base = (caddr_t)IE_IBASE;
- iscp.ie_scb_offset = IE_SCB_OFF;
- host2ie(sc, &iscp, IE_ISCP_ADDR, sizeof(iscp) );
- }
-
- /* Initialise the control block */
- iezero ( sc, IE_IBASE + IE_SCB_OFF, sizeof(struct ie_sys_ctl_block) );
- ieattn(sc);
-
- /* Wait for not busy */
- setpage ( sc, IE_ISCP_ADDR );
- for ( i=10000; --i>=0; ) {
- if ( !ReadShort( sc->sc_ram + IE_COFF2POFF(IE_ISCP_ADDR) +
- ( offsetof(struct ie_int_sys_conf_ptr, ie_busy)) ) )
- break;
- delay (10);
- }
-
- /* If the busy didn't go low, the i82586 is broken or too slow */
- if ( i<=0 )
- {
- printf ( "ie: ether1 chipset didn't respond\n" );
- return 0;
- }
-
- /* Ensure that the podule sends interrupts */
- for ( i=1000; --i>=0 ; ) {
- if ( ReadByte(sc->sc_rom + 0) & PODULE_IRQ_PENDING )
- break;
- delay (10);
- }
-
- /* If we didn't see the interrupt then the IRQ line is broken */
- if ( i<=0 )
- {
- printf ( "ie: interrupt from chipset didn't reach host\n" );
- return 0;
- }
-
- /* Ack our little test operation */
- ie_ack(sc,IE_ST_WHENCE);
- ie_cli (sc);
-
- /* Get second part of idrom */
- for ( i=16; i<32; i++ ) {
- idrom[i] = ReadByte ( sc->sc_rom + (i<<2) );
- };
-
- /* This checksum always fails. For some reason the first 16 */
- /* bytes are duplicated in the second 16 bytes, the checksum */
- /* should be at location 28 it is clearly not */
-
- /* It is possible that this ether1 card is buggered */
-
-#ifndef IGNORE_ETHER1_IDROM_CHECKSUM
- if ( crc32(idrom,28) != *(u_long *)(idrom+28) )
- {
- printf ( "ie: ether1 idrom failed checksum %08x!=%08x\n",
- crc32(idrom,28), *(u_long *)(idrom+28));
- for ( i=0; i<32; i+=8 ) {
- printf ( "IDROM: %02x %02x %02x %02x %02x %02x %02x %02x\n",
- idrom[0+i], idrom[1+i], idrom[2+i], idrom[3+i],
- idrom[4+i], idrom[5+i], idrom[6+i], idrom[7+i] );
- }
- printf ( "ie: I'll ignore this fact for now!\n" );
- }
-#endif
-
- /* Get our ethernet address. Do explicit copy */
- for ( i=0; i<ETHER_ADDR_LEN; i++ )
- hwaddr[i] = idrom[9+i];
-
- /* Tell the podule system about our successful probe */
- pa->pa_podule_number = podule;
- pa->pa_podule = &podules[podule];
-
- return(1);
-}
-
-/*
- * Attach our driver to the interfaces it uses
- */
-
-void ieattach ( struct device *parent, struct device *self, void *aux )
-{
- struct ie_softc *sc = (void *)self;
- struct podule_attach_args *pa = (void *)aux;
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
-
- /* Check a few things about the attach args */
- sc->sc_podule_number = pa->pa_podule_number;
- if (sc->sc_podule_number == -1)
- panic("Podule has disappeared !");
-
- sc->sc_podule = &podules[sc->sc_podule_number];
- podules[sc->sc_podule_number].attached = 1;
-
- /* Fill in my application form to attach to the inet system */
-
- ifp->if_unit = sc->sc_dev.dv_unit;
- ifp->if_name = ie_cd.cd_name;
- ifp->if_start = iestart;
- ifp->if_ioctl = ieioctl;
- ifp->if_watchdog = iewatchdog;
- ifp->if_flags = IFF_BROADCAST | IFF_NOTRAILERS;
-
- /* Signed, dated then sent */
- if_attach (ifp);
- ether_ifattach(ifp);
-
- /* "Hmm," said nuts, "what if the attach fails" */
-
- /* Write some pretty things on the annoucement line */
- printf ( " %s using %dk card ram",
- ether_sprintf(sc->sc_arpcom.ac_enaddr),
- ((NRXBUF*IE_RXBUF_SIZE)+(NTXBUF*IE_TXBUF_SIZE))/1024 );
-
-#if NBPFILTER > 0
- printf ( " BPF" );
- bpfattach ( &ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
-#endif
-
- sc->sc_ih.ih_func = ieintr;
- sc->sc_ih.ih_arg = sc;
- sc->sc_ih.ih_level = IPL_NET;
- sc->sc_ih.ih_name = "net: ie";
-
- if (irq_claim(IRQ_PODULE, &sc->sc_ih))
- {
- sc->sc_irqmode = 0;
- printf ( " POLLED" );
- panic("Cannot install IRQ handler");
- }
- else
- {
- sc->sc_irqmode = 1;
- printf ( " IRQ" );
- }
-
- printf ( "\n" );
-}
-
-
-/*
- * Our cfdriver structure for the autoconfig system to chew on
- */
-
-struct cfattach ie_ca = {
- sizeof(struct ie_softc), ieprobe, ieattach
-};
-
-struct cfdriver ie_cd = {
- NULL, "ie", DV_IFNET
-};
-
-/*
- * Oh no!! Where's my shorts!!! I'm sure I put them on this morning
- */
-
-void PWriteShorts ( char *src, char *dest, int cnt )
-{
- for ( cnt/=2; --cnt>=0; ) {
- PWriteShort ( dest, *(u_short *)src );
- src+=2;
- dest+=4;
- }
-}
-
-void ReadShorts ( char *src, char *dest, int cnt )
-{
- for ( cnt/=2; --cnt>=0; ) {
- *(u_short *)dest = ReadShort ( src );
- src+=4;
- dest+=2;
- }
-}
-
-/*
- * A bcopy or memcpy to adapter ram. It handles the page register for you
- * so you dont have to worry about the ram windowing
- */
-
-static void host2ie ( struct ie_softc *sc, void *src, u_long dest, int size )
-{
- int cnt;
-
- if (size&1)
- panic ( "host2ie" );
-
- while ( size>0 ) {
- cnt = IE_PAGESIZE - dest % IE_PAGESIZE;
- if ( cnt > size )
- cnt = size;
- setpage ( sc, dest );
- PWriteShorts ( src, (char *)sc->sc_ram + IE_COFF2POFF(dest), cnt );
- src+=cnt;
- dest+=cnt;
- size-=cnt;
- }
-}
-
-static void ie2host ( struct ie_softc *sc, u_long src, void *dest, int size )
-{
- int cnt;
-
- if (size&1)
- panic ( "ie2host" );
-
- while ( size>0 ) {
- cnt = IE_PAGESIZE - src % IE_PAGESIZE;
- if ( cnt > size )
- cnt = size;
- setpage ( sc, src );
- ReadShorts ( (char *)sc->sc_ram + IE_COFF2POFF(src), dest, cnt );
- src+=cnt;
- dest+=cnt;
- size-=cnt;
- }
-}
-
-/*
- * Like a bzero or memset 0 for adapter memory. It handles the page
- * register so you dont have to worry about it
- */
-
-static void iezero ( struct ie_softc *sc, u_long p, int size )
-{
- int cnt;
- while ( size > 0 ) {
- cnt = IE_PAGESIZE - p % IE_PAGESIZE;
- if ( cnt>size )
- cnt=size;
- setpage(sc, p);
- bzero((char *)sc->sc_ram + IE_COFF2POFF(p), 2*cnt );
- p += cnt;
- size -= cnt;
- }
-}
-
-/*
- * I/O Control interface to the kernel, entry point here
- */
-
-int ieioctl ( struct ifnet *ifp, u_long cmd, caddr_t data )
-{
- struct ie_softc *sc = ie_cd.cd_devs[ifp->if_unit];
- struct ifaddr *ifa = (struct ifaddr *)data;
-/* struct ifreq *ifr = (struct ifreq *)data;*/
- int s;
- int error=0;
-
- s=splimp();
-
- if ((error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data)) > 0) {
- splx(s);
- return error;
- }
-
- switch ( cmd )
- {
- case SIOCSIFADDR:
- ifp->if_flags |= IFF_UP;
- switch ( ifa->ifa_addr->sa_family ) {
-#ifdef INET
- case AF_INET:
- ieinit(sc);
- arp_ifinit(&sc->sc_arpcom, ifa );
- break;
-#endif
- default:
- ieinit(sc);
- break;
- }
- break;
-
-#define IZSET(a,b) ((a->if_flags&b)!=0)
-#define IZCLR(a,b) ((a->if_flags&b)==0)
-#define DOSET(a,b) (a->if_flags|=b)
-#define DOCLR(a,b) (a->if_flags&=~b)
-
- case SIOCSIFFLAGS:
- sc->promisc = ifp->if_flags & ( IFF_PROMISC | IFF_ALLMULTI );
-
- if ( IZCLR(ifp,IFF_UP) && IZSET(ifp,IFF_RUNNING) )
- {
- /* Interface was marked down and its running so stop it */
- iestop(sc);
- DOCLR(ifp,IFF_RUNNING);
- }
- else if ( IZSET(ifp,IFF_UP) && IZCLR(ifp,IFF_RUNNING) )
- {
- /* Just marked up and we're not running so start it */
- ieinit(sc);
- }
- else
- {
- /* else reset to invoke changes in other registers */
- iestop(sc);
- ieinit(sc);
- }
-
- default:
- error = EINVAL;
- }
- (void)splx(s);
- return error;
-}
-
-/*
- * Reset the card. Completely.
- */
-
-void iereset( struct ie_softc *sc )
-{
- struct ie_sys_ctl_block scb;
- int s = splimp();
-
- iestop(sc);
-
- ie2host ( sc, IE_IBASE + IE_SCB_OFF, &scb, sizeof scb );
-
- if ( command_and_wait(sc, IE_RU_ABORT|IE_CU_ABORT, 0, 0, 0, 0, 0) )
- printf ( "ie0: abort commands timed out\n" );
-
- if ( command_and_wait(sc, IE_RU_DISABLE|IE_CU_STOP, 0, 0, 0, 0, 0) )
- printf ( "ie0: abort commands timed out\n" );
-
- ieinit(sc);
-
- (void)splx(s);
-}
-
-/*
- * Watchdog entry point. This is the entry for the kernel to call us
- */
-
-void iewatchdog ( int unit )
-{
- struct ie_softc *sc = ie_cd.cd_devs[unit];
-
- /* WOOF WOOF */
- log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname );
- ++sc->sc_arpcom.ac_if.if_oerrors;
- iereset(sc);
-}
-
-/*
- * Start the time-domain-refloctometer running
- */
-
-static void run_tdr ( struct ie_softc *sc )
-{
- struct ie_sys_ctl_block scb;
- u_long ptr = IE_IBASE + IE_SCB_OFF + sizeof scb;
- struct ie_tdr_cmd cmd;
- int result;
-
- bzero ( &scb, sizeof(scb) );
- bzero ( &cmd, sizeof(cmd) );
-
- cmd.com.ie_cmd_status = 0;
- cmd.com.ie_cmd_cmd = IE_CMD_TDR | IE_CMD_LAST;
- cmd.com.ie_cmd_link = 0xffff;
- cmd.ie_tdr_time = 0;
-
- scb.ie_command_list = (u_short)ptr;
-
- result=0;
- if ( command_and_wait(sc, IE_CU_START, &scb, &cmd, ptr, sizeof cmd,
- IE_STAT_COMPL) )
- {
- result = 0x10000;
- }
- else if ( !(cmd.com.ie_cmd_status & IE_STAT_OK) )
- {
- result = 0x10000;
- }
-
- if ( result==0 )
- result = cmd.ie_tdr_time;
-
- ie_ack ( sc, IE_ST_WHENCE );
-
- if (result & IE_TDR_SUCCESS )
- return;
-
- /* Very messy. I'll tidy it later */
-
- if ( result & 0x10000 )
- {
- printf ( "ie: TDR command failed\n" );
- }
- else if ( result & IE_TDR_XCVR )
- {
- printf ( "ie: tranceiver problem. Is it plugged in?\n" );
- }
- else if ( result & IE_TDR_OPEN )
- {
- if ((result & IE_TDR_TIME)>0)
- printf ( "ie: TDR detected an open %d clocks away.\n",
- result & IE_TDR_TIME );
- }
- else if ( result & IE_TDR_SHORT )
- {
- if ((result & IE_TDR_TIME)>0)
- printf ( "ie: TDR detected a short %d clock away.\n",
- result & IE_TDR_TIME );
- }
- else
- {
- printf ( "ie: TDR returned unknown status %x\n", result );
- }
-}
-
-u_long setup_rfa ( struct ie_softc *sc, u_long ptr )
-{
- int i;
- {
- /* Receive frame descriptors */
- struct ie_recv_frame_desc rfd;
- bzero( &rfd, sizeof rfd );
- for ( i=0; i<NFRAMES; i++ )
- {
- sc->rframes[i] = ptr;
- rfd.ie_fd_next = ptr + sizeof rfd;
- host2ie(sc, (char *)&rfd, ptr, sizeof rfd);
- ptr += sizeof rfd;
- }
- rfd.ie_fd_next = sc->rframes[0];
- rfd.ie_fd_last |= IE_FD_LAST;
- host2ie(sc, (char *)&rfd, sc->rframes[NFRAMES-1], sizeof rfd );
-
- ie2host(sc, sc->rframes[0], (char *)&rfd, sizeof rfd );
- rfd.ie_fd_buf_desc = (u_short) ptr;
- host2ie(sc, (char *)&rfd, sc->rframes[0], sizeof rfd );
- }
-
- {
- /* Receive frame descriptors */
- struct ie_recv_buf_desc rbd;
- bzero(&rbd, sizeof rbd);
- for ( i=0; i<NRXBUF; i++ )
- {
- sc->rbuffs[i] = ptr;
- rbd.ie_rbd_length = IE_RXBUF_SIZE;
- rbd.ie_rbd_buffer = (caddr_t)(ptr + sizeof rbd);
- rbd.ie_rbd_next = (u_short)(ptr + sizeof rbd + IE_RXBUF_SIZE);
- host2ie(sc, &rbd, ptr, sizeof rbd);
- ptr+=sizeof rbd;
-
- sc->cbuffs[i] = ptr;
- ptr+=IE_RXBUF_SIZE;
- }
- rbd.ie_rbd_next = sc->rbuffs[0];
- rbd.ie_rbd_length |= IE_RBD_LAST;
- host2ie(sc, &rbd, sc->rbuffs[NRXBUF-1], sizeof rbd);
- }
-
- sc->rfhead = 0;
- sc->rftail = NFRAMES-1;
- sc->rbhead = 0;
- sc->rbtail = NRXBUF-1;
-
- {
- struct ie_sys_ctl_block scb;
- bzero ( &scb, sizeof scb );
- scb.ie_recv_list = (u_short)sc->rframes[0];
- host2ie(sc, (char *)&scb, (IE_IBASE + IE_SCB_OFF), sizeof scb );
- }
- return ptr;
-}
-
-static void start_receiver ( struct ie_softc *sc )
-{
- struct ie_sys_ctl_block scb;
- ie2host ( sc, IE_IBASE + IE_SCB_OFF, &scb, sizeof scb );
- scb.ie_recv_list = (u_short)sc->rframes[0];
- command_and_wait(sc, IE_RU_START, &scb, 0, 0, 0, 0);
- ie_ack(sc, IE_ST_WHENCE );
-}
-
-/*
- * Take our configuration and update all the other data structures that
- * require information from the driver.
- *
- * CALL AT SPLIMP OR HIGHER
- */
-
-int ieinit ( struct ie_softc *sc )
-{
- struct ie_sys_ctl_block scb;
- struct ie_config_cmd cmd;
- struct ie_iasetup_cmd iasetup_cmd;
- u_long ptr = IE_IBASE + IE_SCB_OFF + sizeof scb;
- int n;
-
- bzero ( &scb, sizeof(scb) );
-
- /* Send the configure command */
-
- cmd.com.ie_cmd_status = 0;
- cmd.com.ie_cmd_cmd = IE_CMD_CONFIG | IE_CMD_LAST;
- cmd.com.ie_cmd_link = 0xffff;
-
- cmd.ie_config_count = 0x0c;
- cmd.ie_fifo = 8;
- cmd.ie_save_bad = 0x40;
- cmd.ie_addr_len = 0x2e;
- cmd.ie_priority = 0;
- cmd.ie_ifs = 0x60;
- cmd.ie_slot_low = 0;
- cmd.ie_slot_high = 0xf2;
- cmd.ie_promisc = 0; /* Hey nuts, look at this! */
- cmd.ie_crs_cdt = 0;
- cmd.ie_min_len = 64;
- cmd.ie_junk = 0xff;
-
- scb.ie_command_list = (u_short)ptr;
-
- if ( command_and_wait(sc, IE_CU_START, &scb, &cmd, ptr, sizeof cmd,
- IE_STAT_COMPL) )
- {
- printf ( "%s: command failed: timeout\n", sc->sc_dev.dv_xname );
- return 0;
- }
-
- if ( !(cmd.com.ie_cmd_status & IE_STAT_OK) )
- {
- printf ( "%s: command failed: !IE_STAT_OK\n", sc->sc_dev.dv_xname );
- return 0;
- }
-
- /* Individual address setup command */
-
- iasetup_cmd.com.ie_cmd_status = 0;
- iasetup_cmd.com.ie_cmd_cmd = IE_CMD_IASETUP | IE_CMD_LAST;
- iasetup_cmd.com.ie_cmd_link = 0xffff;
-
- bcopy ( sc->sc_arpcom.ac_enaddr, (caddr_t) &iasetup_cmd.ie_address,
- sizeof (iasetup_cmd.ie_address) );
-
- if ( command_and_wait(sc, IE_CU_START, &scb, &iasetup_cmd, ptr, sizeof cmd,
- IE_STAT_COMPL) )
- {
- printf ( "%s: iasetup failed : timeout\n", sc->sc_dev.dv_xname );
- return 0;
- }
-
- if ( !(cmd.com.ie_cmd_status & IE_STAT_OK) )
- {
- printf ( "%s: iasetup failed : !IE_STAT_OK\n", sc->sc_dev.dv_xname );
- return 0;
- }
-
- ie_ack ( sc, IE_ST_WHENCE );
-
- /* Run the time-domain refloctometer */
- run_tdr ( sc );
-
- ie_ack ( sc, IE_ST_WHENCE );
-
- /* meminit */
- ptr = setup_rfa(sc, ptr);
-
- sc->sc_arpcom.ac_if.if_flags |= IFF_RUNNING;
- sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
-
- /* Setup transmit buffers */
-
- for ( n=0; n<NTXBUF; n++ ) {
- sc->xmit_cmds[n] = ptr;
- iezero(sc, ptr, sizeof(struct ie_xmit_cmd) );
- ptr += sizeof(struct ie_xmit_cmd);
-
- sc->xmit_buffs[n] = ptr;
- iezero(sc, ptr, sizeof(struct ie_xmit_buf));
- ptr += sizeof(struct ie_xmit_buf);
- }
-
- for ( n=0; n<NTXBUF; n++ ) {
- sc->xmit_cbuffs[n] = ptr;
- ptr += IE_TXBUF_SIZE;
- }
-
- sc->xmit_free = NTXBUF;
- sc->xchead = sc->xctail = 0;
-
- {
- struct ie_xmit_cmd xmcmd;
- bzero ( &xmcmd, sizeof xmcmd );
- xmcmd.ie_xmit_status = IE_STAT_COMPL;
- host2ie(sc, &xmcmd, sc->xmit_cmds[0], sizeof xmcmd);
- }
-
- start_receiver (sc);
-
- return 0;
-}
-
-int iestop ( struct ie_softc *sc )
-{
- struct ie_sys_ctl_block scb;
- int s = splimp();
-
- ie2host ( sc, IE_IBASE + IE_SCB_OFF, &scb, sizeof scb );
-
- if ( command_and_wait(sc, IE_RU_DISABLE, &scb, 0, 0, 0, 0) )
- printf ( "ie0: abort commands timed out\n" );
-
- (void)splx(s);
- return(0);
-}
-
-/*
- * Send a command to the card and awaits it's completion.
- * Timeout if it's taking too long
- */
-
-/*CAW*/
-
-static int command_and_wait ( struct ie_softc *sc, u_short cmd,
- struct ie_sys_ctl_block *pscb,
- void *pcmd, int ocmd, int scmd, int mask )
-{
- int i=0;
-
- /* Copy the command to the card */
-
- if ( pcmd )
- host2ie(sc, pcmd, ocmd, scmd); /* transfer the command to the card */
-
- /* Copy the scb to the card */
-
- if ( pscb ) {
- pscb->ie_command = cmd;
- host2ie(sc, pscb, IE_IBASE + IE_SCB_OFF, sizeof *pscb);
- }
- else
- {
- setpage ( sc, IE_IBASE + IE_SCB_OFF );
- PWriteShort ( sc->sc_ram + IE_COFF2POFF(IE_IBASE+IE_SCB_OFF) +
- (offsetof(struct ie_sys_ctl_block, ie_command)), cmd );
- }
-
- /* Prod the card to act on the newly loaded command */
- ieattn(sc);
-
- /* Wait for the command to complete */
- if ( IE_ACTION_COMMAND(cmd) && pcmd )
- {
- setpage(sc,ocmd);
- for ( i=4000; --i>=0; ) {
- if ( ReadShort(sc->sc_ram + IE_COFF2POFF(ocmd) +
- (offsetof(struct ie_config_cmd, ie_config_status))) & mask)
- break;
- delay(100);
- }
- }
- else
- {
- for ( i=4000; --i>=0; ) {
- if ( !ReadShort(sc->sc_ram + IE_COFF2POFF(IE_IBASE+IE_SCB_OFF) +
- (offsetof(struct ie_sys_ctl_block, ie_command))) )
- break;
- delay(100);
- }
- }
-
- /* Update the host structures to reflect the state on the card */
- if ( pscb )
- ie2host(sc, IE_IBASE + IE_SCB_OFF, pscb, sizeof *pscb );
- if ( pcmd )
- ie2host(sc, ocmd, pcmd, scmd);
-
- return i < 0;
-}
-
-#define READ_MEMBER(sc,type,member,ptr,dest) \
- setpage(sc, ptr); \
- dest = ReadShort(sc->sc_ram + IE_COFF2POFF(ptr) + \
- (offsetof(type, member)) );
-
-#define WRITE_MEMBER(sc,type,member,ptr,dest) \
- setpage(sc, ptr); \
- PWriteShort(sc->sc_ram + IE_COFF2POFF(ptr) + \
- (offsetof(type, member)), dest );
-
-static inline int ie_buflen ( struct ie_softc *sc, int head )
-{
- int actual;
- READ_MEMBER(sc,struct ie_recv_buf_desc, ie_rbd_actual,
- sc->rbuffs[head], actual );
-
- return ( actual & ( IE_RXBUF_SIZE | ( IE_RXBUF_SIZE-1 ) ) ) ;
-}
-
-static inline int ie_packet_len ( struct ie_softc *sc )
-{
- int i;
- int actual;
- int head = sc->rbhead;
- int acc=0;
-
- do {
- READ_MEMBER(sc,struct ie_recv_buf_desc, ie_rbd_actual,
- sc->rbuffs[sc->rbhead], actual );
- if (!(actual&IE_RBD_USED))
- {
- return (-1);
- }
-
- READ_MEMBER(sc,struct ie_recv_buf_desc, ie_rbd_actual,
- sc->rbuffs[head], i );
- i = i & IE_RBD_LAST;
-
- acc += ie_buflen(sc, head);
- head = (head+1) % NRXBUF;
- } while (!i);
-
- return acc;
-}
-
-struct mbuf *ieget(struct ie_softc *sc, struct ether_header *ehp, int *to_bpf )
-{
- struct mbuf *top, **mp, *m;
- int head;
- int resid, totlen, thisrboff, thismboff;
- int len;
-
- totlen = ie_packet_len(sc);
-
- if ( totlen > ETHER_MAX_LEN )
- {
- printf ( "ie: Gosh that packet was s-o-o-o big.\n" );
- return 0;
- }
-
- if ( totlen<=0 )
- return 0;
-
- head = sc->rbhead;
-
- /* Read the ethernet header */
- ie2host ( sc, sc->cbuffs[head], (caddr_t)ehp, sizeof *ehp );
-
- /* Check if the packet is for us */
-
- resid = totlen -= (thisrboff = sizeof *ehp);
-
- MGETHDR ( m, M_DONTWAIT, MT_DATA );
- if ( m==0 )
- return 0;
-
- m->m_pkthdr.rcvif = &sc->sc_arpcom.ac_if;
- m->m_pkthdr.len = totlen;
- len = MHLEN;
- top = 0;
- mp = &top;
-
- /*
- * This loop goes through and allocates mbufs for all the data we will
- * be copying in. It does not actually do the copying yet.
- */
- while (totlen > 0) {
- if (top) {
- MGET(m, M_DONTWAIT, MT_DATA);
- if (m == 0) {
- m_freem(top);
- return 0;
- }
- len = MLEN;
- }
- if (totlen >= MINCLSIZE) {
- MCLGET(m, M_DONTWAIT);
- if (m->m_flags & M_EXT)
- len = MCLBYTES;
- }
- m->m_len = len = min(totlen, len);
- totlen -= len;
- *mp = m;
- mp = &m->m_next;
- }
-
- m = top;
- thismboff = 0;
-
- /*
- * Now we take the mbuf chain (hopefully only one mbuf most of the
- * time) and stuff the data into it. There are no possible failures at
- * or after this point.
- */
- while (resid > 0) {
- int thisrblen = ie_buflen(sc, head) - thisrboff,
- thismblen = m->m_len - thismboff;
- len = min(thisrblen, thismblen);
-
-/* bcopy((caddr_t)(sc->cbuffs[head] + thisrboff),
- mtod(m, caddr_t) + thismboff, (u_int)len); */
-
-
- if ( len&1 )
- {
- ie2host(sc, sc->cbuffs[head]+thisrboff,
- mtod(m, caddr_t) + thismboff, (u_int)len+1);
- }
- else
- {
- ie2host(sc, sc->cbuffs[head]+thisrboff,
- mtod(m, caddr_t) + thismboff, (u_int)len);
- }
-
- resid -= len;
-
- if (len == thismblen) {
- m = m->m_next;
- thismboff = 0;
- } else
- thismboff += len;
-
- if (len == thisrblen) {
- head = (head + 1) % NRXBUF;
- thisrboff = 0;
- } else
- thisrboff += len;
- }
-
-
- return top;
-}
-
-void ie_drop_packet_buffer ( struct ie_softc *sc )
-{
- int i, actual, last;
-
- do {
- READ_MEMBER(sc,struct ie_recv_buf_desc, ie_rbd_actual,
- sc->rbuffs[sc->rbhead], actual );
- if (!(actual&IE_RBD_USED))
- {
- iereset(sc);
- return;
- }
-
- i = actual & IE_RBD_LAST;
-
- READ_MEMBER(sc,struct ie_recv_buf_desc,ie_rbd_length,
- sc->rbuffs[sc->rbhead], last );
- last |= IE_RBD_LAST;
- WRITE_MEMBER(sc,struct ie_recv_buf_desc,ie_rbd_length,
- sc->rbuffs[sc->rbhead], last );
-
- WRITE_MEMBER(sc,struct ie_recv_buf_desc,ie_rbd_actual,
- sc->rbuffs[sc->rbhead], 0 );
-
- sc->rbhead = ( sc->rbhead + 1 ) % NRXBUF;
-
- READ_MEMBER(sc,struct ie_recv_buf_desc,ie_rbd_length,
- sc->rbuffs[sc->rbtail], last );
- last &= ~IE_RBD_LAST;
- WRITE_MEMBER(sc,struct ie_recv_buf_desc,ie_rbd_length,
- sc->rbuffs[sc->rbtail], last );
-
- sc->rbtail = ( sc->rbtail + 1 ) % NRXBUF;
- } while (!i);
-}
-
-void ie_read_frame ( struct ie_softc *sc, int num )
-{
- int status;
- struct ie_recv_frame_desc rfd;
- struct mbuf *m=0;
- struct ether_header eh;
- int last;
-
- ie2host(sc, sc->rframes[num], &rfd, sizeof rfd );
- status = rfd.ie_fd_status;
-
- /* Advance the RFD list, since we're done with this descriptor */
-
- WRITE_MEMBER(sc,struct ie_recv_frame_desc,ie_fd_status,
- sc->rframes[num], 0 );
-
- READ_MEMBER(sc,struct ie_recv_frame_desc,ie_fd_last,
- sc->rframes[num], last );
- last |= IE_FD_LAST;
- WRITE_MEMBER(sc,struct ie_recv_frame_desc,ie_fd_last,
- sc->rframes[num], last );
-
- READ_MEMBER(sc,struct ie_recv_frame_desc,ie_fd_last,
- sc->rframes[sc->rftail], last );
- last &= ~IE_FD_LAST;
- WRITE_MEMBER(sc,struct ie_recv_frame_desc,ie_fd_last,
- sc->rframes[sc->rftail], last );
-
- sc->rftail = ( sc->rftail + 1 ) % NFRAMES;
- sc->rfhead = ( sc->rfhead + 1 ) % NFRAMES;
-
- if ( status & IE_FD_OK ) {
- m = ieget(sc, &eh, 0);
- ie_drop_packet_buffer(sc);
- }
-
- if ( m==0 ) {
- sc->sc_arpcom.ac_if.if_ierrors++;
- return;
- }
-
-/*
- printf ( "%s: frame from ether %s type %x\n", sc->sc_dev.dv_xname,
- ether_sprintf(eh.ether_shost), (u_int)eh.ether_type );
-*/
-
-#if NBFILTER > 0
- if ( sc->sc_arpcom.ac_if.if_bpf ) {
- bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m );
- };
-#endif
-
- ether_input ( &sc->sc_arpcom.ac_if, &eh, m );
- sc->sc_arpcom.ac_if.if_ipackets++;
-}
-
-void ierint ( struct ie_softc *sc )
-{
- int i;
- int times_thru = 1024;
- struct ie_sys_ctl_block scb;
- int status;
- int saftey_catch = 0;
-
- i = sc->rfhead;
- for (;;) {
-
- if ( (saftey_catch++)>100 )
- {
- printf ( "ie: ierint saftey catch tripped\n" );
- iereset(sc);
- return;
- }
-
- READ_MEMBER(sc,struct ie_recv_frame_desc,ie_fd_status,
- sc->rframes[i],status);
-
- if ((status&IE_FD_COMPLETE)&&(status&IE_FD_OK)) {
- if ( !--times_thru ) {
- printf ( "IERINT: Uh oh. Nuts, look at this bit!!!\n" );
- ie2host ( sc, IE_IBASE + IE_SCB_OFF, &scb, sizeof scb );
- sc->sc_arpcom.ac_if.if_ierrors += scb.ie_err_crc +
- scb.ie_err_align +
- scb.ie_err_resource +
- scb.ie_err_overrun;
- scb.ie_err_crc = scb.ie_err_align = 0;
- scb.ie_err_resource = scb.ie_err_overrun = 0;
- host2ie(sc, &scb, IE_SCP_ADDR, sizeof (scb) );
- }
- ie_read_frame(sc, i);
- } else {
- ie2host ( sc, IE_IBASE + IE_SCB_OFF, &scb, sizeof scb );
-
- if ( ((status&IE_FD_RNR)!=0) && ((scb.ie_status&IE_RU_READY)==0) )
- {
- WRITE_MEMBER(sc,struct ie_recv_frame_desc, ie_fd_buf_desc,
- sc->rframes[0], sc->rbuffs[0] );
-
- scb.ie_recv_list = sc->rframes[0];
- host2ie(sc, (char *)&scb, IE_IBASE + IE_SCB_OFF, sizeof (scb) );
- command_and_wait(sc, IE_RU_START, &scb, 0, 0, 0, 0);
- }
- break;
- }
- i = (i + 1) % NFRAMES;
- }
-}
-
-static int in_intr = 0;
-
-int ieintr ( void *arg )
-{
- struct ie_softc *sc = arg;
- u_short status;
- int saftey_catch = 0;
- static saftey_net = 0;
-
- if ( in_intr==1 )
- {
- panic ( "ie: INTERRUPT REENTERED" );
- }
-
- /* Clear the interrrupt */
- ie_cli (sc);
-
- setpage(sc, IE_IBASE + IE_SCB_OFF );
- status = ReadShort ( sc->sc_ram + IE_COFF2POFF(IE_IBASE+IE_SCB_OFF) +
- (offsetof(struct ie_sys_ctl_block, ie_status)) );
-
- status = status & IE_ST_WHENCE;
-
- if ( status==0 )
- {
- in_intr = 0;
- return 0;
- }
-
-loop:
-
- ie_ack(sc, status);
-
- if (status & (IE_ST_FR | IE_ST_RNR)) {
- ierint(sc);
- }
-
- if (status & IE_ST_CX) {
- ietint(sc);
- }
-
- if (status & IE_ST_RNR) {
- printf ( "ie: receiver not ready\n" );
- sc->sc_arpcom.ac_if.if_ierrors++;
- iereset(sc);
- }
-
- setpage(sc, IE_IBASE + IE_SCB_OFF );
- status = ReadShort ( sc->sc_ram + IE_COFF2POFF(IE_IBASE+IE_SCB_OFF) +
- (offsetof(struct ie_sys_ctl_block, ie_status)) );
- status = status & IE_ST_WHENCE;
-
- ie_cli(sc);
-
- if ( status==0 )
- {
- in_intr = 0;
- return 1;
- }
-
- /* This is prehaps a little over cautious */
- if ( saftey_catch++ > 10 )
- {
- printf ( "ie: Interrupt couldn't be cleared\n" );
- delay ( 1000 );
- ie_cli(sc);
- if ( saftey_net++ > 50 )
- {
- printf ( "ie: saftey net catches driver, shutting down\n" );
- disable_irq ( IRQ_PODULE );
- }
- in_intr = 0;
- return 1;
- }
-
- goto loop;
-}
-
-void iexmit ( struct ie_softc *sc )
-{
-/* int actual;*/
- struct ie_sys_ctl_block scb;
-
- struct ie_xmit_cmd xc;
- struct ie_xmit_buf xb;
-
- ie2host(sc, sc->xmit_buffs[sc->xctail], (char *)&xb, sizeof xb );
- xb.ie_xmit_flags |= IE_XMIT_LAST;
- xb.ie_xmit_next = 0xffff;
- xb.ie_xmit_buf = (caddr_t)sc->xmit_cbuffs[sc->xctail];
- host2ie(sc, &xb, sc->xmit_buffs[sc->xctail], sizeof xb );
-
- bzero ( &xc, sizeof xc );
- xc.com.ie_cmd_link = 0xffff;
- xc.com.ie_cmd_cmd = IE_CMD_XMIT | IE_CMD_INTR | IE_CMD_LAST;
- xc.ie_xmit_status = 0x0000;
- xc.ie_xmit_desc = sc->xmit_buffs[sc->xctail];
- host2ie(sc, (char *)&xc, sc->xmit_cmds[sc->xctail], sizeof xc );
-
- ie2host ( sc, IE_IBASE + IE_SCB_OFF, &scb, sizeof scb );
- scb.ie_command_list = sc->xmit_cmds[sc->xctail];
- host2ie(sc, (char *)&scb, (IE_IBASE + IE_SCB_OFF), sizeof scb );
-
- command_and_wait(sc, IE_CU_START, &scb, &xc, sc->xmit_cmds[sc->xctail]
- , sizeof xc, IE_STAT_COMPL);
-
- sc->sc_arpcom.ac_if.if_timer = 5;
-}
-/*
- * Start sending all the queued buffers.
- */
-
-void iestart( struct ifnet *ifp )
-{
- struct ie_softc *sc = ie_cd.cd_devs[ifp->if_unit];
- struct mbuf *m0, *m;
- u_char *buffer;
- u_short len;
- char txbuf[IE_TXBUF_SIZE];
- int saftey_catch = 0;
-
- if ((ifp->if_flags & IFF_OACTIVE) != 0)
- return;
-
- for (;;) {
- if ( (saftey_catch++)>100 )
- {
- printf ( "ie: iestart saftey catch tripped\n" );
- iereset(sc);
- return;
- }
- if (sc->xmit_free == 0) {
- ifp->if_flags |= IFF_OACTIVE;
- break;
- }
-
- IF_DEQUEUE(&sc->sc_arpcom.ac_if.if_snd, m);
- if (!m)
- break;
-
- /* TODO: Write directly to the card */
- len = 0;
- /* buffer = sc->xmit_cbuffs[sc->xchead]; */
- buffer = txbuf;
-
- for (m0 = m; m && (len + m->m_len) < IE_TXBUF_SIZE;
- m = m->m_next) {
- bcopy(mtod(m, caddr_t), buffer, m->m_len);
- buffer += m->m_len;
- len += m->m_len;
- }
-
- m_freem(m0);
- len = max(len, ETHER_MIN_LEN);
-
-#if NBPFILTER > 0
- if ( sc->sc_arpcom.ac_if.if_bpf )
- bpf_tap(sc->sc_arpcom.ac_if.if_bpf, txbuf, len);
-#endif
-
- /* When we write directly to the card we dont need this */
- if (len&1)
- host2ie(sc, txbuf, sc->xmit_cbuffs[sc->xchead], len+1 );
- else
- host2ie(sc, txbuf, sc->xmit_cbuffs[sc->xchead], len );
-
- /* sc->xmit_buffs[sc->xchead]->ie_xmit_flags = len; */
-
- WRITE_MEMBER(sc,struct ie_xmit_buf, ie_xmit_flags,
- sc->xmit_buffs[sc->xchead], len)
-
- /* Start the first packet transmitting. */
- if (sc->xmit_free == NTXBUF)
- iexmit(sc);
-
- sc->xchead = (sc->xchead + 1) % NTXBUF;
- sc->xmit_free--;
- }
-}
-
-void ietint ( struct ie_softc *sc )
-{
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
-
- int status;
-
- ifp->if_timer=0;
- ifp->if_flags &= ~IFF_OACTIVE;
-
- READ_MEMBER(sc,struct ie_xmit_cmd, ie_xmit_status,
- sc->xmit_cmds[sc->xctail], status );
-
- if (!(status&IE_STAT_COMPL) || (status & IE_STAT_BUSY) )
- printf ( "ietint: command still busy!\n" );
-
- if ( status & IE_STAT_OK ) {
- ifp->if_opackets++;
- ifp->if_collisions += status & IE_XS_MAXCOLL;
- } else {
- ifp->if_oerrors++;
- if ( status & IE_STAT_ABORT )
- printf ( "ie: send aborted\n" );
- if ( status & IE_XS_LATECOLL )
- printf ( "ie: late collision\n" );
- if ( status & IE_XS_NOCARRIER )
- printf ( "ie: no carrier\n" );
- if ( status & IE_XS_LOSTCTS )
- printf ( "ie: lost CTS\n" );
- if ( status & IE_XS_UNDERRUN )
- printf ( "ie: DMA underrun\n" );
- if ( status & IE_XS_EXCMAX )
- printf ( "ie: too many collisions\n" );
- ifp->if_collisions+=16;
- }
- /* Done with the buffer */
- sc->xmit_free++;
- sc->xctail = (sc->xctail + 1 ) % NTXBUF;
-
- /* Start the next packet transmitting, if any */
- if ( sc->xmit_free<NTXBUF )
- iexmit(sc);
-
- iestart(ifp);
-}
-
-
-/* End of if_ie.c */
diff --git a/sys/arch/arm32/podulebus/if_iereg.h b/sys/arch/arm32/podulebus/if_iereg.h
deleted file mode 100644
index cf3ad614780..00000000000
--- a/sys/arch/arm32/podulebus/if_iereg.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $NetBSD: if_iereg.h,v 1.2 1996/03/18 21:23:16 mark Exp $ */
-
-/*
- * Copyright (C) 1994 Wolfgang Solfrank.
- * Copyright (C) 1994 TooLs GmbH.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by TooLs GmbH.
- * 4. The name of TooLs GmbH may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define IE_PAGE 0
-
-#define IE_CONTROL 1
-#define IE_CONT_RESET 1
-#define IE_CONT_LOOP 2
-#define IE_CONT_ATTN 4
-#define IE_CONT_CLI 8
-
-#define IE_MEMSIZE 65536
-#define IE_PAGESIZE 4096
-#define IE_MEMOFF 0x2000
-#define IE_COFF2POFF(off) ((off) % IE_PAGESIZE * 2)
-#define IE_COFF2PAGE(off) (((off) % IE_MEMSIZE) / IE_PAGESIZE)
-
-#define IE_ISCP_ADDR (IE_SCP_ADDR - sizeof(struct ie_int_sys_conf_ptr))
-#define IE_IBASE (0x1000000 - IE_MEMSIZE)
-#define IE_SCB_OFF 0
-
-/* Steal most defines from PC driver: */
-#include <dev/ic/i82586reg.h>
diff --git a/sys/arch/arm32/podulebus/ncr5380reg.h b/sys/arch/arm32/podulebus/ncr5380reg.h
deleted file mode 100644
index 04b181d0db5..00000000000
--- a/sys/arch/arm32/podulebus/ncr5380reg.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/* $NetBSD: ncr5380reg.h,v 1.1 1996/01/31 23:26:04 mark Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1991,1990,1989 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-/*
- * HISTORY (mach3)
- * Revision 2.3 91/08/24 12:25:10 af
- * Moved padding of regmap in impl file.
- * [91/08/02 04:22:39 af]
- *
- * Revision 2.2 91/06/19 16:28:35 rvb
- * From the NCR data sheets
- * "NCR 5380 Family, SCSI Protocol Controller Data Manual"
- * NCR Microelectronics Division, Colorado Spring, 6/98 T01891L
- * [91/04/21 af]
- *
- */
-
-/*
- * File: scsi_5380.h
- * Author: Alessandro Forin, Carnegie Mellon University
- * Date: 5/91
- *
- * Defines for the NCR 5380 (SCSI chip), aka Am5380
- */
-
-/*
- * Register map: Note not declared here anymore!
- * All the 5380 registers are accessed through individual
- * pointers initialized by MD code. This allows the 5380
- * MI functions to be shared between MD drivers that have
- * different padding between the registers (i.e. amiga).
- */
-#if 0 /* example only */
-struct ncr5380regs {
- volatile u_char sci_r0;
- volatile u_char sci_r1;
- volatile u_char sci_r2;
- volatile u_char sci_r3;
- volatile u_char sci_r4;
- volatile u_char sci_r5;
- volatile u_char sci_r6;
- volatile u_char sci_r7;
-};
-#endif
-
-/*
- * Machine-independent code uses these names:
- */
-#define sci_data sci_r0 /* r: Current data */
-#define sci_odata sci_r0 /* w: Out data */
-
-#define sci_icmd sci_r1 /* rw: Initiator command */
-#define sci_mode sci_r2 /* rw: Mode */
-#define sci_tcmd sci_r3 /* rw: Target command */
-
-#define sci_bus_csr sci_r4 /* r: Bus Status */
-#define sci_sel_enb sci_r4 /* w: Select enable */
-
-#define sci_csr sci_r5 /* r: Status */
-#define sci_dma_send sci_r5 /* w: Start dma send data */
-
-#define sci_idata sci_r6 /* r: Input data */
-#define sci_trecv sci_r6 /* w: Start dma receive, target */
-
-#define sci_iack sci_r7 /* r: Interrupt Acknowledge */
-#define sci_irecv sci_r7 /* w: Start dma receive, initiator */
-
-
-/*
- * R1: Initiator command register
- */
-#define SCI_ICMD_DATA 0x01 /* rw: Assert data bus */
-#define SCI_ICMD_ATN 0x02 /* rw: Assert ATN signal */
-#define SCI_ICMD_SEL 0x04 /* rw: Assert SEL signal */
-#define SCI_ICMD_BSY 0x08 /* rw: Assert BSY signal */
-#define SCI_ICMD_ACK 0x10 /* rw: Assert ACK signal */
-#define SCI_ICMD_LST 0x20 /* r: Lost arbitration */
-#define SCI_ICMD_DIFF SCI_ICMD_LST /* w: Differential cable */
-#define SCI_ICMD_AIP 0x40 /* r: Arbitration in progress */
-#define SCI_ICMD_TEST SCI_ICMD_AIP /* w: Test mode */
-#define SCI_ICMD_RST 0x80 /* rw: Assert RST signal */
-/* Bits to keep when doing read/modify/write (leave out RST) */
-#define SCI_ICMD_RMASK 0x1F
-
-
-/*
- * R2: Mode register
- */
-#define SCI_MODE_ARB 0x01 /* rw: Start arbitration */
-#define SCI_MODE_DMA 0x02 /* rw: Enable DMA xfers */
-#define SCI_MODE_MONBSY 0x04 /* rw: Monitor BSY signal */
-#define SCI_MODE_DMA_IE 0x08 /* rw: Enable DMA complete interrupt */
-#define SCI_MODE_PERR_IE 0x10 /* rw: Interrupt on parity errors */
-#define SCI_MODE_PAR_CHK 0x20 /* rw: Check parity */
-#define SCI_MODE_TARGET 0x40 /* rw: Target mode (Initiator if 0) */
-#define SCI_MODE_BLOCKDMA 0x80 /* rw: Block-mode DMA handshake */
-
-
-/*
- * R3: Target command register
- */
-#define SCI_TCMD_IO 0x01 /* rw: Assert I/O signal */
-#define SCI_TCMD_CD 0x02 /* rw: Assert C/D signal */
-#define SCI_TCMD_MSG 0x04 /* rw: Assert MSG signal */
-#define SCI_TCMD_PHASE_MASK 0x07 /* r: Mask for current bus phase */
-#define SCI_TCMD_REQ 0x08 /* rw: Assert REQ signal */
-#define SCI_TCMD_LAST_SENT 0x80 /* ro: Last byte was xferred
- * (not on 5380/1) */
-
-#define SCI_TCMD_PHASE(x) ((x) & 0x7)
-
-/*
- * R4: Current (SCSI) Bus status (.sci_bus_csr)
- */
-#define SCI_BUS_DBP 0x01 /* r: Data Bus parity */
-#define SCI_BUS_SEL 0x02 /* r: SEL signal */
-#define SCI_BUS_IO 0x04 /* r: I/O signal */
-#define SCI_BUS_CD 0x08 /* r: C/D signal */
-#define SCI_BUS_MSG 0x10 /* r: MSG signal */
-#define SCI_BUS_REQ 0x20 /* r: REQ signal */
-#define SCI_BUS_BSY 0x40 /* r: BSY signal */
-#define SCI_BUS_RST 0x80 /* r: RST signal */
-
-#define SCI_BUS_PHASE(x) (((x) >> 2) & 7)
-
-/*
- * R5: Bus and Status register (.sci_csr)
- */
-#define SCI_CSR_ACK 0x01 /* r: ACK signal */
-#define SCI_CSR_ATN 0x02 /* r: ATN signal */
-#define SCI_CSR_DISC 0x04 /* r: Disconnected (BSY==0) */
-#define SCI_CSR_PHASE_MATCH 0x08 /* r: Bus and SCI_TCMD match */
-#define SCI_CSR_INT 0x10 /* r: Interrupt request */
-#define SCI_CSR_PERR 0x20 /* r: Parity error */
-#define SCI_CSR_DREQ 0x40 /* r: DMA request */
-#define SCI_CSR_DONE 0x80 /* r: DMA count is zero */
diff --git a/sys/arch/arm32/podulebus/ncr5380sbc.c b/sys/arch/arm32/podulebus/ncr5380sbc.c
deleted file mode 100644
index 9758419156e..00000000000
--- a/sys/arch/arm32/podulebus/ncr5380sbc.c
+++ /dev/null
@@ -1,2591 +0,0 @@
-/* $NetBSD: ncr5380sbc.c,v 1.2 1996/03/27 22:05:19 mark Exp $ */
-
-/*
- * Copyright (c) 1996 Melvin Tang-Richardson (Modified for weird regs)
- * Copyright (c) 1995 David Jones, Gordon W. Ross
- * Copyright (c) 1994 Jarle Greipsland
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the authors may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- * 4. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by
- * David Jones and Gordon Ross
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#undef DIAGNOSTIC
-
-/*
- * This is a machine-independent driver for the NCR5380
- * SCSI Bus Controller (SBC), also known as the Am5380.
- *
- * This code should work with any memory-mapped 5380,
- * and can be shared by multiple adapters that address
- * the 5380 with different register offset spacings.
- * (This can happen on the atari, for example.)
- * For porting/design info. see: ncr5380.doc
- *
- * Credits, history:
- *
- * David Jones is the author of most of the code that now
- * appears in this file, and was the architect of the
- * current overall structure (MI/MD code separation, etc.)
- *
- * Gordon Ross integrated the message phase code, added lots of
- * comments about what happens when and why (re. SCSI spec.),
- * debugged some reentrance problems, and added several new
- * "hooks" needed for the Sun3 "si" adapters.
- *
- * The message in/out code was taken nearly verbatim from
- * the aic6360 driver by Jarle Greipsland.
- *
- * Several other NCR5380 drivers were used for reference
- * while developing this driver, including work by:
- * The Alice Group (mac68k port) namely:
- * Allen K. Briggs, Chris P. Caputo, Michael L. Finch,
- * Bradley A. Grantham, and Lawrence A. Kesteloot
- * Michael L. Hitch (amiga drivers: sci.c)
- * Leo Weppelman (atari driver: ncr5380.c)
- * There are others too. Thanks, everyone.
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/errno.h>
-#include <sys/device.h>
-#include <sys/buf.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsi_debug.h>
-#include <scsi/scsi_message.h>
-#include <scsi/scsiconf.h>
-
-#define DEBUG XXX
-
-#define SetReg(l,d) *((volatile unsigned int *)((void *)l))=((d)|(((d)<<16)))
-
-#if 0 /* XXX - not yet... */
-#include <dev/ic/ncr5380reg.h>
-#include <dev/ic/ncr5380var.h>
-#else
-#include "ncr5380reg.h"
-#include "ncr5380var.h"
-#endif
-
-static int ncr5380_wait_req __P((struct ncr5380_softc *));
-static int ncr5380_wait_not_req __P((struct ncr5380_softc *));
-
-static void ncr5380_sched __P((struct ncr5380_softc *));
-static void ncr5380_done __P((struct ncr5380_softc *));
-
-static int ncr5380_select
- __P((struct ncr5380_softc *, struct sci_req *));
-static void ncr5380_reselect __P((struct ncr5380_softc *));
-
-static int ncr5380_msg_in __P((struct ncr5380_softc *));
-static int ncr5380_msg_out __P((struct ncr5380_softc *));
-static int ncr5380_data_xfer __P((struct ncr5380_softc *, int));
-static int ncr5380_command __P((struct ncr5380_softc *));
-static int ncr5380_status __P((struct ncr5380_softc *));
-static void ncr5380_machine __P((struct ncr5380_softc *));
-
-/*
- * Action flags returned by the info_tranfer functions:
- * (These determine what happens next.)
- */
-#define ACT_CONTINUE 0x00 /* No flags: expect another phase */
-#define ACT_DISCONNECT 0x01 /* Target is disconnecting */
-#define ACT_CMD_DONE 0x02 /* Need to call scsi_done() */
-#define ACT_RESET_BUS 0x04 /* Need bus reset (cmd timeout) */
-#define ACT_WAIT_DMA 0x10 /* Wait for DMA to complete */
-
-/*****************************************************************
- * Debugging stuff
- *****************************************************************/
-
-#ifndef DDB
-/* This is used only in recoverable places. */
-#define Debugger() printf("Debug: ncr5380.c:%d\n", __LINE__)
-#endif
-
-#ifdef DEBUG
-
-#define NCR_DBG_BREAK 1
-#define NCR_DBG_CMDS 2
-int ncr5380_debug = NCR_DBG_BREAK;
-#define NCR_BREAK() \
- do { if (ncr5380_debug & NCR_DBG_BREAK) Debugger(); } while (0)
-static void ncr5380_show_scsi_cmd __P((struct scsi_xfer *));
-static void ncr5380_show_sense __P((struct scsi_xfer *));
-#else /* DEBUG */
-#define NCR_BREAK() /* nada */
-#define ncr5380_show_scsi_cmd(xs) /* nada */
-#define ncr5380_show_sense(xs) /* nada */
-#endif /* DEBUG */
-
-static char *
-phase_names[8] = {
- "DATA_OUT",
- "DATA_IN",
- "COMMAND",
- "STATUS",
- "UNSPEC1",
- "UNSPEC2",
- "MSG_OUT",
- "MSG_IN",
-};
-
-/*****************************************************************
- * Actual chip control
- *****************************************************************/
-
-/*
- * XXX: These timeouts might need to be tuned...
- */
-
-/* This one is used when waiting for a phase change. (X100uS.) */
-int ncr5380_wait_phase_timo = 1000 * 10 * 300; /* 5 min. */
-
-/* These are used in the following inline functions. */
-int ncr5380_wait_req_timo = 1000 * 50; /* X2 = 100 mS. */
-int ncr5380_wait_nrq_timo = 1000 * 25; /* X2 = 50 mS. */
-
-/* Return zero on success. */
-static __inline__ int ncr5380_wait_req(sc)
- struct ncr5380_softc *sc;
-{
- register int timo = ncr5380_wait_req_timo;
- for (;;) {
- if (*sc->sci_bus_csr & SCI_BUS_REQ) {
- timo = 0; /* return 0 */
- break;
- }
- if (--timo < 0)
- break; /* return -1 */
- delay(2);
- }
- return (timo);
-}
-
-/* Return zero on success. */
-static __inline__ int ncr5380_wait_not_req(sc)
- struct ncr5380_softc *sc;
-{
- register int timo = ncr5380_wait_nrq_timo;
- for (;;) {
- if ((*sc->sci_bus_csr & SCI_BUS_REQ) == 0) {
- timo = 0; /* return 0 */
- break;
- }
- if (--timo < 0)
- break; /* return -1 */
- delay(2);
- }
- return (timo);
-}
-
-/* Ask the target for a MSG_OUT phase. */
-static __inline__ void
-ncr_sched_msgout(sc, msg_code)
- struct ncr5380_softc *sc;
- int msg_code;
-{
- /* First time, raise ATN line. */
- if (sc->sc_msgpriq == 0) {
- register u_char icmd;
- icmd = *sc->sci_icmd & SCI_ICMD_RMASK;
- SetReg ( sc->sci_icmd, icmd | SCI_ICMD_ATN );
-/* *sc->sci_icmd = icmd | SCI_ICMD_ATN; */
- delay(2);
- }
- sc->sc_msgpriq |= msg_code;
-}
-
-
-int
-ncr5380_pio_out(sc, phase, count, data)
- struct ncr5380_softc *sc;
- int phase, count;
- unsigned char *data;
-{
- register u_char icmd;
- register int resid;
- register int error;
-
- icmd = *(sc->sci_icmd) & SCI_ICMD_RMASK;
-
- icmd |= SCI_ICMD_DATA;
- SetReg ( sc->sci_icmd, icmd );
-/* *sc->sci_icmd = icmd; */
-
- resid = count;
- while (resid > 0) {
- if (!SCI_BUSY(sc)) {
- NCR_TRACE("pio_out: lost BSY, resid=%d\n", resid);
- break;
- }
- if (ncr5380_wait_req(sc)) {
- NCR_TRACE("pio_out: no REQ, resid=%d\n", resid);
- break;
- }
- if (SCI_BUS_PHASE(*sc->sci_bus_csr) != phase)
- break;
-
- /* Put the data on the bus. */
- SetReg ( sc->sci_odata, *data ); data++;
-/* *sc->sci_odata = *data++; */
-
- /* Tell the target it's there. */
- icmd |= SCI_ICMD_ACK;
- SetReg ( sc->sci_icmd, icmd );
-/* *sc->sci_icmd = icmd; */
-
- /* Wait for target to get it. */
- error = ncr5380_wait_not_req(sc);
-
- /* OK, it's got it (or we gave up waiting). */
- icmd &= ~SCI_ICMD_ACK;
- SetReg ( sc->sci_icmd, icmd );
-/* *sc->sci_icmd = icmd; */
-
- if (error) {
- NCR_TRACE("pio_out: stuck REQ, resid=%d\n", resid);
- break;
- }
-
- --resid;
- }
-
- /* Stop driving the data bus. */
- icmd &= ~SCI_ICMD_DATA;
- SetReg ( sc->sci_icmd, icmd );
-/* *sc->sci_icmd = icmd; */
-
- return (count - resid);
-}
-
-
-int
-ncr5380_pio_in(sc, phase, count, data)
- struct ncr5380_softc *sc;
- int phase, count;
- unsigned char *data;
-{
- register u_char icmd;
- register int resid;
- register int error;
-
- icmd = *(sc->sci_icmd) & SCI_ICMD_RMASK;
-
- resid = count;
- while (resid > 0) {
- if (!SCI_BUSY(sc)) {
- NCR_TRACE("pio_in: lost BSY, resid=%d\n", resid);
- break;
- }
- if (ncr5380_wait_req(sc)) {
- NCR_TRACE("pio_in: no REQ, resid=%d\n", resid);
- break;
- }
- /* A phase change is not valid until AFTER REQ rises! */
- if (SCI_BUS_PHASE(*sc->sci_bus_csr) != phase)
- break;
-
- /* Read the data bus. */
- *data++ = *sc->sci_data;
-
- /* Tell target we got it. */
- icmd |= SCI_ICMD_ACK;
- SetReg ( sc->sci_icmd, icmd );
-/* *sc->sci_icmd = icmd; */
-
- /* Wait for target to drop REQ... */
- error = ncr5380_wait_not_req(sc);
-
- /* OK, we can drop ACK. */
- icmd &= ~SCI_ICMD_ACK;
- SetReg ( sc->sci_icmd, icmd );
-/* *sc->sci_icmd = icmd; */
-
- if (error) {
- NCR_TRACE("pio_in: stuck REQ, resid=%d\n", resid);
- break;
- }
-
- --resid;
- }
-
- return (count - resid);
-}
-
-
-void
-ncr5380_init(sc)
- struct ncr5380_softc *sc;
-{
- int i, j;
-
-#ifdef DEBUG
- ncr5380_debug_sc = sc;
-#endif
-
- for (i = 0; i < SCI_OPENINGS; i++)
- sc->sc_ring[i].sr_xs = NULL;
- for (i = 0; i < 8; i++)
- for (j = 0; j < 8; j++)
- sc->sc_matrix[i][j] = NULL;
-
- sc->sc_link.openings = 2; /* XXX - Not SCI_OPENINGS */
- sc->sc_prevphase = PHASE_INVALID;
- sc->sc_state = NCR_IDLE;
-
- SetReg ( sc->sci_tcmd, PHASE_INVALID );
- SetReg ( sc->sci_icmd, 0 );
- SetReg ( sc->sci_mode, 0 );
- SetReg ( sc->sci_sel_enb, 0 );
-
-/* *sc->sci_tcmd = PHASE_INVALID;
- *sc->sci_icmd = 0;
- *sc->sci_mode = 0;
- *sc->sci_sel_enb = 0; */
- SCI_CLR_INTR(sc);
-
- /* XXX: Enable reselect interrupts... */
- SetReg ( sc->sci_sel_enb, 0x80 );
-/* *sc->sci_sel_enb = 0x80; */
-
- /* Another hack (Er.. hook!) for the sun3 si: */
- if (sc->sc_intr_on) {
- NCR_TRACE("init: intr ON\n", 0);
- sc->sc_intr_on(sc);
- }
-}
-
-
-void
-ncr5380_reset_scsibus(sc)
- struct ncr5380_softc *sc;
-{
-
- NCR_TRACE("reset_scsibus, cur=0x%x\n",
- (long) sc->sc_current);
-
- SetReg ( sc->sci_icmd, SCI_ICMD_RST );
-/* *sc->sci_icmd = SCI_ICMD_RST; */
- delay(500);
- SetReg ( sc->sci_icmd, 0 );
-/* *sc->sci_icmd = 0; */
-
- SetReg ( sc->sci_mode, 0 );
- SetReg ( sc->sci_tcmd, PHASE_INVALID );
-
-/* *sc->sci_mode = 0;
- *sc->sci_tcmd = PHASE_INVALID; */
-
- SCI_CLR_INTR(sc);
- /* XXX - Need long delay here! */
- delay(100000);
-
- /* XXX - Need to cancel disconnected requests. */
-}
-
-
-/*
- * Interrupt handler for the SCSI Bus Controller (SBC)
- * This may also called for a DMA timeout (at splbio).
- */
-int
-ncr5380_intr(sc)
- struct ncr5380_softc *sc;
-{
- int claimed = 0;
-
- /*
- * Do not touch SBC regs here unless sc_current == NULL
- * or it will complain about "register conflict" errors.
- * Instead, just let ncr5380_machine() deal with it.
- */
- NCR_TRACE("intr: top, state=%d\n", sc->sc_state);
-
- if (sc->sc_state == NCR_IDLE) {
- /*
- * Might be reselect. ncr5380_reselect() will check,
- * and set up the connection if so. This will verify
- * that sc_current == NULL at the beginning...
- */
-
- /* Another hack (Er.. hook!) for the sun3 si: */
- if (sc->sc_intr_off) {
- NCR_TRACE("intr: for reselect, intr off\n", 0);
- sc->sc_intr_off(sc);
- }
-
- ncr5380_reselect(sc);
- }
-
- /*
- * The remaining documented interrupt causes are phase mismatch and
- * disconnect. In addition, the sunsi controller may produce a state
- * where SCI_CSR_DONE is false, yet DMA is complete.
- *
- * The procedure in all these cases is to let ncr5380_machine()
- * figure out what to do next.
- */
- if (sc->sc_state & NCR_WORKING) {
- NCR_TRACE("intr: call machine, cur=0x%x\n",
- (long) sc->sc_current);
- /* This will usually free-up the nexus. */
- ncr5380_machine(sc);
- NCR_TRACE("intr: machine done, cur=0x%x\n",
- (long) sc->sc_current);
- claimed = 1;
- }
-
- /* Maybe we can run some commands now... */
- if (sc->sc_state == NCR_IDLE) {
- NCR_TRACE("intr: call sched, cur=0x%x\n",
- (long) sc->sc_current);
- ncr5380_sched(sc);
- NCR_TRACE("intr: sched done, cur=0x%x\n",
- (long) sc->sc_current);
- }
-
- return claimed;
-}
-
-
-/*
- * Abort the current command (i.e. due to timeout)
- */
-void
-ncr5380_abort(sc)
- struct ncr5380_softc *sc;
-{
-
- /*
- * Finish it now. If DMA is in progress, we
- * can not call ncr_sched_msgout() because
- * that hits the SBC (avoid DMA conflict).
- */
-
- /* Another hack (Er.. hook!) for the sun3 si: */
- if (sc->sc_intr_off) {
- NCR_TRACE("abort: intr off\n", 0);
- sc->sc_intr_off(sc);
- }
-
- sc->sc_state |= NCR_ABORTING;
- if ((sc->sc_state & NCR_DOINGDMA) == 0) {
- ncr_sched_msgout(sc, SEND_ABORT);
- }
- NCR_TRACE("abort: call machine, cur=0x%x\n",
- (long) sc->sc_current);
- ncr5380_machine(sc);
- NCR_TRACE("abort: machine done, cur=0x%x\n",
- (long) sc->sc_current);
-
- /* Another hack (Er.. hook!) for the sun3 si: */
- if (sc->sc_intr_on) {
- NCR_TRACE("abort: intr ON\n", 0);
- sc->sc_intr_on(sc);
- }
-}
-
-/*
- * Timeout handler, scheduled for each SCSI command.
- */
-void
-ncr5380_cmd_timeout(arg)
- void *arg;
-{
- struct sci_req *sr = arg;
- struct scsi_xfer *xs;
- struct scsi_link *sc_link;
- struct ncr5380_softc *sc;
- int s;
-
- s = splbio();
-
- /* Get all our variables... */
- xs = sr->sr_xs;
- if (xs == NULL) {
- printf("ncr5380_cmd_timeout: no scsi_xfer\n");
- goto out;
- }
- sc_link = xs->sc_link;
- sc = sc_link->adapter_softc;
-
- printf("%s: cmd timeout, targ=%d, lun=%d\n",
- sc->sc_dev.dv_xname,
- sr->sr_target, sr->sr_lun);
-
- /*
- * Mark the overdue job as failed, and arrange for
- * ncr5380_machine to terminate it. If the victim
- * is the current job, call ncr5380_machine() now.
- * Otherwise arrange for ncr5380_sched() to do it.
- */
- sr->sr_flags |= SR_OVERDUE;
- if (sc->sc_current == sr) {
- NCR_TRACE("cmd_tmo: call abort, sr=0x%x\n", (long) sr);
- ncr5380_abort(sc);
- } else {
- /*
- * The driver may be idle, or busy with another job.
- * Arrange for ncr5380_sched() to do the deed.
- */
- NCR_TRACE("cmd_tmo: clear matrix, t/l=0x%02x\n",
- (sr->sr_target << 4) | sr->sr_lun);
- sc->sc_matrix[sr->sr_target][sr->sr_lun] = NULL;
- }
-
- /*
- * We may have aborted the current job, or may have
- * already been idle. In either case, we should now
- * be idle, so try to start another job.
- */
- if (sc->sc_state == NCR_IDLE) {
- NCR_TRACE("cmd_tmo: call sched, cur=0x%x\n",
- (long) sc->sc_current);
- ncr5380_sched(sc);
- NCR_TRACE("cmd_tmo: sched done, cur=0x%x\n",
- (long) sc->sc_current);
- }
-
-out:
- splx(s);
-}
-
-
-/*****************************************************************
- * Interface to higher level
- *****************************************************************/
-
-
-/*
- * Enter a new SCSI command into the "issue" queue, and
- * if there is work to do, start it going.
- *
- * WARNING: This can be called recursively!
- * (see comment in ncr5380_done)
- */
-int
-ncr5380_scsi_cmd(xs)
- struct scsi_xfer *xs;
-{
- struct ncr5380_softc *sc;
- struct sci_req *sr;
- int s, rv, i, flags;
- extern int cold; /* XXX */
-
- sc = xs->sc_link->adapter_softc;
-
- flags = xs->flags;
- /*
- * XXX: Hack: During autoconfig, force polling mode.
- * Needed as long as sdsize() can be called while cold,
- * otherwise timeouts will never call back (grumble).
- */
- if (cold)
- flags |= SCSI_POLL;
-
- if (sc->sc_flags & NCR5380_FORCE_POLLING)
- flags |= SCSI_POLL;
-
- if (flags & SCSI_DATA_UIO)
- panic("ncr5380: scsi data uio requested");
-
- s = splbio();
-
- if (flags & SCSI_POLL) {
- /* Terminate any current command. */
- sr = sc->sc_current;
- if (sr) {
- printf("%s: polled request aborting %d/%d\n",
- sc->sc_dev.dv_xname,
- sr->sr_target, sr->sr_lun);
- ncr5380_abort(sc);
- }
- if (sc->sc_state != NCR_IDLE) {
- panic("ncr5380_scsi_cmd: polled request, abort failed");
- }
- }
-
- /*
- * Find lowest empty slot in ring buffer.
- * XXX: What about "fairness" and cmd order?
- */
- for (i = 0; i < SCI_OPENINGS; i++)
- if (sc->sc_ring[i].sr_xs == NULL)
- goto new;
-
- rv = TRY_AGAIN_LATER;
- NCR_TRACE("scsi_cmd: no openings, rv=%d\n", rv);
- goto out;
-
-new:
- /* Create queue entry */
- sr = &sc->sc_ring[i];
- sr->sr_xs = xs;
- sr->sr_target = xs->sc_link->target;
- sr->sr_lun = xs->sc_link->lun;
- sr->sr_dma_hand = NULL;
- sr->sr_dataptr = xs->data;
- sr->sr_datalen = xs->datalen;
- sr->sr_flags = (flags & SCSI_POLL) ? SR_IMMED : 0;
- sr->sr_status = -1; /* no value */
- sc->sc_ncmds++;
- rv = SUCCESSFULLY_QUEUED;
-
- NCR_TRACE("scsi_cmd: new sr=0x%x\n", (long)sr);
-
- if (flags & SCSI_POLL) {
- /* Force this new command to be next. */
- sc->sc_rr = i;
- }
-
- /*
- * If we were idle, run some commands...
- */
- if (sc->sc_state == NCR_IDLE) {
- NCR_TRACE("scsi_cmd: call sched, cur=0x%x\n",
- (long) sc->sc_current);
- ncr5380_sched(sc);
- NCR_TRACE("scsi_cmd: sched done, cur=0x%x\n",
- (long) sc->sc_current);
- }
-
- if (flags & SCSI_POLL) {
- /* Make sure ncr5380_sched() finished it. */
- if ((xs->flags & ITSDONE) == 0)
- panic("ncr5380_scsi_cmd: poll didn't finish");
- rv = COMPLETE;
- }
-
-out:
- splx(s);
- return (rv);
-}
-
-
-/*
- * POST PROCESSING OF SCSI_CMD (usually current)
- * Called by ncr5380_sched(), ncr5380_machine()
- */
-static void
-ncr5380_done(sc)
- struct ncr5380_softc *sc;
-{
- struct sci_req *sr;
- struct scsi_xfer *xs;
-
-#ifdef DIAGNOSTIC
- if ((getsr() & PSL_IPL) < PSL_IPL2)
- panic("ncr5380_done: bad spl");
- if (sc->sc_state == NCR_IDLE)
- panic("ncr5380_done: state=idle");
- if (sc->sc_current == NULL)
- panic("ncr5380_done: current=0");
-#endif
-
- sr = sc->sc_current;
- xs = sr->sr_xs;
-
- NCR_TRACE("done: top, cur=0x%x\n", (long) sc->sc_current);
-
- /*
- * Clean up DMA resources for this command.
- */
- if (sr->sr_dma_hand) {
- NCR_TRACE("done: dma_free, dh=0x%x\n",
- (long) sr->sr_dma_hand);
- (*sc->sc_dma_free)(sc);
- }
-#ifdef DIAGNOSTIC
- if (sr->sr_dma_hand)
- panic("ncr5380_done: dma free did not");
-#endif
-
- if (sc->sc_state & NCR_ABORTING) {
- NCR_TRACE("done: aborting, error=%d\n", xs->error);
- if (xs->error == XS_NOERROR)
- xs->error = XS_TIMEOUT;
- }
-
- NCR_TRACE("done: check error=%d\n", (long) xs->error);
-
- /* If error is already set, ignore sr_status value. */
- if (xs->error != XS_NOERROR)
- goto finish;
-
- NCR_TRACE("done: check status=%d\n", sr->sr_status);
-
- switch (sr->sr_status) {
- case SCSI_OK: /* 0 */
- if (sr->sr_flags & SR_SENSE) {
- if (ncr5380_debug & NCR_DBG_CMDS) {
- ncr5380_show_sense(xs);
- }
- xs->error = XS_SENSE;
- }
- break;
-
- case SCSI_CHECK:
- if (sr->sr_flags & SR_SENSE) {
- /* Sense command also asked for sense? */
- printf("ncr5380_done: sense asked for sense\n");
- NCR_BREAK();
- xs->error = XS_DRIVER_STUFFUP;
- break;
- }
- sr->sr_flags |= SR_SENSE;
- NCR_TRACE("done: get sense, sr=0x%x\n", (long) sr);
- /*
- * Leave queued, but clear sc_current so we start over
- * with selection. Guaranteed to get the same request.
- */
- sc->sc_state = NCR_IDLE;
- sc->sc_current = NULL;
- sc->sc_matrix[sr->sr_target][sr->sr_lun] = NULL;
- return; /* XXX */
-
- case SCSI_BUSY:
- xs->error = XS_BUSY;
- break;
-
- case -1:
- /* This is our "impossible" initial value. */
- /* fallthrough */
- default:
- printf("%s: target %d, bad status=%d\n",
- sc->sc_dev.dv_xname, sr->sr_target, sr->sr_status);
- xs->error = XS_DRIVER_STUFFUP;
- break;
- }
-
-finish:
-
- NCR_TRACE("done: finish, error=%d\n", xs->error);
-
- /*
- * Dequeue the finished command, but don't clear sc_state until
- * after the call to scsi_done(), because that may call back to
- * ncr5380_scsi_cmd() - unwanted recursion!
- *
- * Keeping sc->sc_state != idle terminates the recursion.
- */
-#ifdef DIAGNOSTIC
- if ((sc->sc_state & NCR_WORKING) == 0)
- panic("ncr5380_done: bad state");
-#endif
-
- /* Clear our pointers to the request. */
- sc->sc_current = NULL;
- sc->sc_matrix[sr->sr_target][sr->sr_lun] = NULL;
- untimeout(ncr5380_cmd_timeout, sr);
-
- /* Make the request free. */
- sr->sr_xs = NULL;
- sc->sc_ncmds--;
-
- /* Tell common SCSI code it is done. */
- xs->flags |= ITSDONE;
- scsi_done(xs);
-
- sc->sc_state = NCR_IDLE;
- /* Now ncr5380_sched() may be called again. */
-}
-
-
-/*
- * Schedule a SCSI operation. This routine should return
- * only after it achieves one of the following conditions:
- * Busy (sc->sc_state != NCR_IDLE)
- * No more work can be started.
- */
-static void
-ncr5380_sched(sc)
- struct ncr5380_softc *sc;
-{
- struct sci_req *sr;
- struct scsi_xfer *xs;
- int target, lun;
- int error, i;
-
-#ifdef DIAGNOSTIC
- if ((getsr() & PSL_IPL) < PSL_IPL2)
- panic("ncr5380_sched: bad spl");
-#endif
-
- /* Another hack (Er.. hook!) for the sun3 si: */
- if (sc->sc_intr_off) {
- NCR_TRACE("sched: top, intr off\n", 0);
- sc->sc_intr_off(sc);
- }
-
-next_job:
- /*
- * Grab the next job from queue. Must be idle.
- */
-#ifdef DIAGNOSTIC
- if (sc->sc_state != NCR_IDLE)
- panic("ncr5380_sched: not idle");
- if (sc->sc_current)
- panic("ncr5380_sched: current set");
-#endif
-
- /*
- * Always start the search where we last looked.
- * The REQUEST_SENSE logic depends on this to
- * choose the same job as was last picked, so it
- * can just clear sc_current and reschedule.
- * (Avoids loss of "contingent allegiance".)
- */
- i = sc->sc_rr;
- sr = NULL;
- do {
- if (sc->sc_ring[i].sr_xs) {
- target = sc->sc_ring[i].sr_target;
- lun = sc->sc_ring[i].sr_lun;
- if (sc->sc_matrix[target][lun] == NULL) {
- sc->sc_matrix[target][lun] =
- sr = &sc->sc_ring[i];
- sc->sc_rr = i;
- break;
- }
- }
- i++;
- if (i == SCI_OPENINGS)
- i = 0;
- } while (i != sc->sc_rr);
-
- if (sr == NULL) {
- NCR_TRACE("sched: no work, cur=0x%x\n",
- (long) sc->sc_current);
-
- /* Another hack (Er.. hook!) for the sun3 si: */
- if (sc->sc_intr_on) {
- NCR_TRACE("sched: ret, intr ON\n", 0);
- sc->sc_intr_on(sc);
- }
-
- return; /* No more work to do. */
- }
-
- NCR_TRACE("sched: select for t/l=0x%02x\n",
- (sr->sr_target << 4) | sr->sr_lun);
-
- sc->sc_state = NCR_WORKING;
- error = ncr5380_select(sc, sr);
- if (sc->sc_current) {
- /* Lost the race! reselected out from under us! */
- /* Work with the reselected job. */
- if (sr->sr_flags & SR_IMMED) {
- printf("%s: reselected while polling (abort)\n",
- sc->sc_dev.dv_xname);
- /* Abort the reselected job. */
- sc->sc_state |= NCR_ABORTING;
- sc->sc_msgpriq |= SEND_ABORT;
- }
- sr = sc->sc_current;
- xs = sr->sr_xs;
- NCR_TRACE("sched: reselect, new sr=0x%x\n", (long)sr);
- goto have_nexus;
- }
-
- /* Normal selection result */
- sc->sc_current = sr; /* connected */
- xs = sr->sr_xs;
-
- /*
- * Initialize pointers, etc. for this job
- */
- sc->sc_dataptr = sr->sr_dataptr;
- sc->sc_datalen = sr->sr_datalen;
- sc->sc_prevphase = PHASE_INVALID;
- sc->sc_msgpriq = SEND_IDENTIFY;
- sc->sc_msgoutq = 0;
- sc->sc_msgout = 0;
-
- NCR_TRACE("sched: select rv=%d\n", error);
-
- switch (error) {
- case XS_NOERROR:
- break;
-
- case XS_BUSY:
- /* XXX - Reset and try again. */
- printf("%s: SCSI bus busy, resetting...\n",
- sc->sc_dev.dv_xname);
- ncr5380_reset_scsibus(sc);
- /* fallthrough */
- case XS_SELTIMEOUT:
- default:
- xs->error = error; /* from select */
- NCR_TRACE("sched: call done, sr=0x%x\n", (long)sr);
- ncr5380_done(sc);
-
- /* Paranoia: clear everything. */
- sc->sc_dataptr = NULL;
- sc->sc_datalen = 0;
- sc->sc_prevphase = PHASE_INVALID;
- sc->sc_msgpriq = 0;
- sc->sc_msgoutq = 0;
- sc->sc_msgout = 0;
-
- goto next_job;
- }
-
- /*
- * Selection was successful. Normally, this means
- * we are starting a new command. However, this
- * might be the termination of an overdue job.
- */
- if (sr->sr_flags & SR_OVERDUE) {
- NCR_TRACE("sched: overdue, sr=0x%x\n", (long)sr);
- sc->sc_state |= NCR_ABORTING;
- sc->sc_msgpriq |= SEND_ABORT;
- goto have_nexus;
- }
-
- /*
- * This may be the continuation of some job that
- * completed with a "check condition" code.
- */
- if (sr->sr_flags & SR_SENSE) {
- NCR_TRACE("sched: get sense, sr=0x%x\n", (long)sr);
- /* Do not allocate DMA, nor set timeout. */
- goto have_nexus;
- }
-
- /*
- * OK, we are starting a new command.
- * Initialize and allocate resources for the new command.
- * Device reset is special (only uses MSG_OUT phase).
- * Normal commands start in MSG_OUT phase where we will
- * send and IDENDIFY message, and then expect CMD phase.
- */
- if (ncr5380_debug & NCR_DBG_CMDS) {
- printf("ncr5380_sched: begin, target=%d, LUN=%d\n",
- xs->sc_link->target, xs->sc_link->lun);
- ncr5380_show_scsi_cmd(xs);
- }
- if (xs->flags & SCSI_RESET) {
- NCR_TRACE("sched: cmd=reset, sr=0x%x\n", (long)sr);
- /* Not an error, so do not set NCR_ABORTING */
- sc->sc_msgpriq |= SEND_DEV_RESET;
- goto have_nexus;
- }
-
-#ifdef DIAGNOSTIC
- if ((xs->flags & (SCSI_DATA_IN | SCSI_DATA_OUT)) == 0) {
- if (sc->sc_dataptr) {
- printf("%s: ptr but no data in/out flags?\n");
- NCR_BREAK();
- sc->sc_dataptr = NULL;
- }
- }
-#endif
-
- /* Allocate DMA space (maybe) */
- if (sc->sc_dataptr && sc->sc_dma_alloc &&
- (sc->sc_datalen >= sc->sc_min_dma_len))
- {
- NCR_TRACE("sched: dma_alloc, len=%d\n", sc->sc_datalen);
- (*sc->sc_dma_alloc)(sc);
- }
-
- /*
- * Initialization hook called just after select,
- * at the beginning of COMMAND phase.
- * (but AFTER the DMA allocation is done)
- *
- * The evil Sun "si" adapter (OBIO variant) needs some
- * setup done to the DMA engine BEFORE the target puts
- * the SCSI bus into any DATA phase.
- */
- if (sr->sr_dma_hand && sc->sc_dma_setup) {
- NCR_TRACE("sched: dma_setup, dh=0x%x\n",
- (long) sr->sr_dma_hand);
- sc->sc_dma_setup(sc);
- }
-
- /*
- * Schedule a timeout for the job we are starting.
- */
- if ((sr->sr_flags & SR_IMMED) == 0) {
- i = (xs->timeout * hz) / 1000;
- NCR_TRACE("sched: set timeout=%d\n", i);
- timeout(ncr5380_cmd_timeout, sr, i);
- }
-
-have_nexus:
- NCR_TRACE("sched: call machine, cur=0x%x\n",
- (long) sc->sc_current);
- ncr5380_machine(sc);
- NCR_TRACE("sched: machine done, cur=0x%x\n",
- (long) sc->sc_current);
-
- /*
- * What state did ncr5380_machine() leave us in?
- * Hopefully it sometimes completes a job...
- */
- if (sc->sc_state == NCR_IDLE)
- goto next_job;
-
- return; /* Have work in progress. */
-}
-
-
-/*
- * Reselect handler: checks for reselection, and if we are being
- * reselected, it sets up sc->sc_current.
- *
- * We are reselected when:
- * SEL is TRUE
- * IO is TRUE
- * BSY is FALSE
- */
-void
-ncr5380_reselect(sc)
- struct ncr5380_softc *sc;
-{
- struct sci_req *sr;
- int target, lun, phase, timo;
- u_char bus, data, icmd, msg;
-
-#ifdef DIAGNOSTIC
- /*
- * Note: sc_state will be "idle" when ncr5380_intr()
- * calls, or "working" when ncr5380_select() calls.
- * (So don't test that in this DIAGNOSTIC)
- */
- if (sc->sc_current)
- panic("ncr5380_reselect: current set");
-#endif
-
- /*
- * First, check the select line.
- * (That has to be set first.)
- */
- bus = *(sc->sci_bus_csr);
- if ((bus & SCI_BUS_SEL) == 0) {
- /* Not a selection or reselection. */
- return;
- }
-
- /*
- * The target will assert BSY first (for bus arbitration),
- * then raise SEL, and finally drop BSY. Only then is the
- * data bus required to have valid selection ID bits set.
- * Wait for: SEL==1, BSY==0 before reading the data bus.
- */
- timo = ncr5380_wait_nrq_timo;
- for (;;) {
- if ((bus & SCI_BUS_BSY) == 0)
- break;
- /* Probably never get here... */
- if (--timo <= 0) {
- printf("%s: reselect, BSY stuck, bus=0x%x\n",
- sc->sc_dev.dv_xname, bus);
- /* Not much we can do. Reset the bus. */
- ncr5380_reset_scsibus(sc);
- return;
- }
- delay(10);
- bus = *(sc->sci_bus_csr);
- /* If SEL went away, forget it. */
- if ((bus & SCI_BUS_SEL) == 0)
- return;
- /* Still have SEL, check BSY. */
- }
- NCR_TRACE("reselect, valid data after %d loops\n",
- ncr5380_wait_nrq_timo - timo);
-
- /*
- * Good. We have SEL=1 and BSY=0. Now wait for a
- * "bus settle delay" before we sample the data bus
- */
- delay(2);
- data = *(sc->sci_data) & 0xFF;
- /* XXX - Should check parity... */
-
- /*
- * Is this a reselect (I/O == 1) or have we been
- * selected as a target? (I/O == 0)
- */
- if ((bus & SCI_BUS_IO) == 0) {
- printf("%s: selected as target, data=0x%x\n",
- sc->sc_dev.dv_xname, data);
- /* Not much we can do. Reset the bus. */
- ncr5380_reset_scsibus(sc);
- return;
- }
-
- /*
- * OK, this is a reselection.
- */
- for (target = 0; target < 7; target++)
- if (data & (1 << target))
- break;
-
- if ((data & 0x7F) != (1 << target)) {
- /* No selecting ID? or >2 IDs on bus? */
- printf("%s: bad reselect, data=0x%x\n",
- sc->sc_dev.dv_xname, data);
- return;
- }
-
- NCR_TRACE("reselect: target=0x%x\n", target);
-
- /* Raise BSY to acknowledge target reselection. */
- SetReg ( sc->sci_icmd, SCI_ICMD_BSY );
-/* *(sc->sci_icmd) = SCI_ICMD_BSY; */
-
- /* Wait for target to drop SEL. */
- timo = ncr5380_wait_nrq_timo;
- for (;;) {
- bus = *(sc->sci_bus_csr);
- if ((bus & SCI_BUS_SEL) == 0)
- break; /* success */
- if (--timo <= 0) {
- printf("%s: reselect, SEL stuck, bus=0x%x\n",
- sc->sc_dev.dv_xname, bus);
- NCR_BREAK();
- /* assume connected (fail later if not) */
- break;
- }
- delay(2);
- }
-
- /* Now we drop BSY, and we are connected. */
- SetReg ( sc->sci_icmd, 0 );
- SetReg ( sc->sci_sel_enb, 0 );
-/* *(sc->sci_icmd) = 0;
- *sc->sci_sel_enb = 0; */
- SCI_CLR_INTR(sc);
-
- /*
- * At this point the target should send an IDENTIFY message,
- * which will permit us to determine the reselecting LUN.
- * If not, we assume LUN 0.
- */
- lun = 0;
- /* Wait for REQ before reading bus phase. */
- if (ncr5380_wait_req(sc)) {
- printf("%s: reselect, no REQ\n",
- sc->sc_dev.dv_xname);
- /* Try to send an ABORT message. */
- goto abort;
- }
- phase = SCI_BUS_PHASE(*sc->sci_bus_csr);
- if (phase != PHASE_MSG_IN) {
- printf("%s: reselect, phase=%d\n",
- sc->sc_dev.dv_xname, phase);
- goto abort;
- }
-
- /* Ack. the change to PHASE_MSG_IN */
- SetReg ( sc->sci_tcmd, PHASE_MSG_IN );
-/* *(sc->sci_tcmd) = PHASE_MSG_IN; */
-
- /* Peek at the message byte without consuming it! */
- msg = *(sc->sci_data);
- if ((msg & 0x80) == 0) {
- printf("%s: reselect, not identify, msg=%d\n",
- sc->sc_dev.dv_xname, msg);
- goto abort;
- }
- lun = msg & 7;
-
- /* We now know target/LUN. Do we have the request? */
- sr = sc->sc_matrix[target][lun];
- if (sr) {
- /* We now have a nexus. */
- sc->sc_state |= NCR_WORKING;
- sc->sc_current = sr;
- NCR_TRACE("reselect: resume sr=0x%x\n", (long)sr);
-
- /* Implicit restore pointers message */
- sc->sc_dataptr = sr->sr_dataptr;
- sc->sc_datalen = sr->sr_datalen;
-
- sc->sc_prevphase = PHASE_INVALID;
- sc->sc_msgpriq = 0;
- sc->sc_msgoutq = 0;
- sc->sc_msgout = 0;
-
- /*
- * Another hack for the Sun3 "si", which needs
- * some setup done to its DMA engine before the
- * target puts the SCSI bus into any DATA phase.
- */
- if (sr->sr_dma_hand && sc->sc_dma_setup) {
- NCR_TRACE("reselect: call DMA setup, dh=0x%x\n",
- (long) sr->sr_dma_hand);
- sc->sc_dma_setup(sc);
- }
-
- /* Now consume the IDENTIFY message. */
- ncr5380_pio_in(sc, PHASE_MSG_IN, 1, &msg);
- return;
- }
-
- printf("%s: phantom reselect: target=%d, LUN=%d\n",
- sc->sc_dev.dv_xname, target, lun);
-abort:
- /*
- * Try to send an ABORT message. This makes us
- * temporarily busy, but no current command...
- */
- sc->sc_state |= NCR_ABORTING;
-
- /* Raise ATN, delay, raise ACK... */
- icmd = SCI_ICMD_ATN;
- SetReg ( sc->sci_icmd, icmd );
-/* *sc->sci_icmd = icmd; */
- delay(2);
-
- /* Now consume the IDENTIFY message. */
- ncr5380_pio_in(sc, PHASE_MSG_IN, 1, &msg);
-
- /* Finally try to send the ABORT. */
- sc->sc_prevphase = PHASE_INVALID;
- sc->sc_msgpriq = SEND_ABORT;
- ncr5380_msg_out(sc);
-
- SetReg ( sc->sci_tcmd, PHASE_INVALID );
- SetReg ( sc->sci_sel_enb, 0 );
-/* *(sc->sci_tcmd) = PHASE_INVALID;
- *sc->sci_sel_enb = 0; */
- SCI_CLR_INTR(sc);
- SetReg ( sc->sci_sel_enb, 0x80 );
-/* *sc->sci_sel_enb = 0x80; */
-
- sc->sc_state &= ~NCR_ABORTING;
-}
-
-
-/*
- * Select target: xs is the transfer that we are selecting for.
- * sc->sc_current should be NULL.
- *
- * Returns:
- * sc->sc_current != NULL ==> we were reselected (race!)
- * XS_NOERROR ==> selection worked
- * XS_BUSY ==> lost arbitration
- * XS_SELTIMEOUT ==> no response to selection
- */
-static int
-ncr5380_select(sc, sr)
- struct ncr5380_softc *sc;
- struct sci_req *sr;
-{
- int timo;
- u_char bus, data, icmd;
-
- /* Check for reselect */
- ncr5380_reselect(sc);
- if (sc->sc_current) {
- NCR_TRACE("select: reselect, cur=0x%x\n",
- (long) sc->sc_current);
- return XS_BUSY; /* reselected */
- }
-
- /*
- * Set phase bits to 0, otherwise the 5380 won't drive the bus during
- * selection.
- */
-
- SetReg ( sc->sci_tcmd, PHASE_DATA_OUT );
- SetReg ( sc->sci_icmd, 0 );
- SetReg ( sc->sci_mode, 0 );
-
-/* *sc->sci_tcmd = PHASE_DATA_OUT;
- *sc->sci_icmd = icmd = 0;
- *sc->sci_mode = 0; */
-
- /*
- * Arbitrate for the bus. The 5380 takes care of the
- * time-critical bus interactions. We set our ID bit
- * in the output data register and set MODE_ARB. The
- * 5380 watches for the required "bus free" period.
- * If and when the "bus free" period is detected, the
- * 5380 then drives BSY, drives the data bus, and sets
- * the "arbitration in progress" (AIP) bit to let us
- * know arbitration has started. We then wait for one
- * arbitration delay (2.2uS) and check the ICMD_LST bit,
- * which will be set if someone else drives SEL.
- */
-
- SetReg ( sc->sci_odata, 0x80 );
- SetReg ( sc->sci_mode, SCI_MODE_ARB );
-
-/* *(sc->sci_odata) = 0x80; */ /* OUR_ID */
-/* *(sc->sci_mode) = SCI_MODE_ARB; */
-
- /* Wait for ICMD_AIP. */
- timo = ncr5380_wait_req_timo;
- for (;;) {
- if (*(sc->sci_icmd) & SCI_ICMD_AIP)
- break;
- if (--timo <= 0) {
- /* Did not see any "bus free" period. */
- SetReg ( sc->sci_mode, 0 );
-/* *sc->sci_mode = 0; */
- NCR_TRACE("select: bus busy, rc=%d\n", XS_BUSY);
- return XS_BUSY;
- }
- delay(2);
- }
- NCR_TRACE("select: have AIP after %d loops\n",
- ncr5380_wait_req_timo - timo);
-
- /* Got AIP. Wait one arbitration delay (2.2 uS.) */
- delay(3);
-
- /* Check for ICMD_LST */
- if (*(sc->sci_icmd) & SCI_ICMD_LST) {
- /* Some other target asserted SEL. */
- SetReg ( sc->sci_mode, 0 );
-/* *sc->sci_mode = 0; */
- NCR_TRACE("select: lost one, rc=%d\n", XS_BUSY);
- ncr5380_reselect(sc); /* XXX */
- return XS_BUSY;
- }
-
- /*
- * No other device has declared itself the winner.
- * The spec. says to check for higher IDs, but we
- * are always the highest (ID=7) so don't bother.
- * We can now declare victory by asserting SEL.
- *
- * Note that the 5380 is asserting BSY because we
- * asked it to do arbitration. We will now hold
- * BSY directly so we can turn off ARB mode.
- */
- icmd = (SCI_ICMD_BSY | SCI_ICMD_SEL);
- SetReg ( sc->sci_icmd, icmd );
-/* *sc->sci_icmd = icmd; */
-
- /*
- * "The SCSI device that wins arbitration shall wait
- * at least a bus clear delay plus a bus settle delay
- * after asserting the SEL signal before changing
- * any [other] signal." (1.2uS. total)
- */
- delay(2);
-
-#if 1
- /*
- * XXX: Check one last time to see if we really
- * XXX: did win arbitration. (too paranoid?)
- */
- if (*(sc->sci_icmd) & SCI_ICMD_LST) {
- SetReg ( sc->sci_icmd, 0 );
- SetReg ( sc->sci_mode, 0 );
-/* *sc->sci_icmd = 0;
- *sc->sci_mode = 0; */
- NCR_TRACE("select: lost two, rc=%d\n", XS_BUSY);
- return XS_BUSY;
- }
-#endif
- /* Leave ARB mode Now that we drive BSY+SEL */
- SetReg ( sc->sci_mode, 0 );
- SetReg ( sc->sci_sel_enb, 0 );
-/* *sc->sci_mode = 0;
- *sc->sci_sel_enb = 0; */
-
- /*
- * Arbitration is complete. Now do selection:
- * Drive the data bus with the ID bits for both
- * the host and target. Also set ATN now, to
- * ask the target for a messgae out phase.
- */
- data = 0x80 | (1 << sr->sr_target);
- SetReg ( sc->sci_odata, data );
-/* *(sc->sci_odata) = data; */
- icmd |= (SCI_ICMD_DATA | SCI_ICMD_ATN);
- SetReg ( sc->sci_icmd, icmd );
- *(sc->sci_icmd) = icmd;
- delay(2); /* two deskew delays. */
-
- /* De-assert BSY (targets sample the data now). */
- icmd &= ~SCI_ICMD_BSY;
- SetReg ( sc->sci_icmd, icmd );
-/* *(sc->sci_icmd) = icmd; */
- delay(3); /* Bus settle delay. */
-
- /*
- * Wait for the target to assert BSY.
- * SCSI spec. says wait for 250 mS.
- */
- for (timo = 25000;;) {
- if (*sc->sci_bus_csr & SCI_BUS_BSY)
- goto success;
- if (--timo <= 0)
- break;
- delay(10);
- }
-
- /*
- * There is no reaction from the target. Start the selection
- * timeout procedure. We release the databus but keep SEL+ATN
- * asserted. After that we wait a 'selection abort time' (200
- * usecs) and 2 deskew delays (90 ns) and check BSY again.
- * When BSY is asserted, we assume the selection succeeded,
- * otherwise we release the bus.
- */
- icmd &= ~SCI_ICMD_DATA;
- SetReg ( sc->sci_icmd, icmd );
-/* *(sc->sci_icmd) = icmd; */
- delay(201);
- if ((*sc->sci_bus_csr & SCI_BUS_BSY) == 0) {
- /* Really no device on bus */
- SetReg ( sc->sci_tcmd, PHASE_INVALID );
- SetReg ( sc->sci_icmd, 0 );
- SetReg ( sc->sci_mode, 0 );
- SetReg ( sc->sci_sel_enb, 0 );
-/* *sc->sci_tcmd = PHASE_INVALID;
- *sc->sci_icmd = 0;
- *sc->sci_mode = 0;
- *sc->sci_sel_enb = 0; */
- SCI_CLR_INTR(sc);
- SetReg ( sc->sci_sel_enb, 0x80 );
- *sc->sci_sel_enb = 0x80;
- NCR_TRACE("select: device down, rc=%d\n", XS_SELTIMEOUT);
- return XS_SELTIMEOUT;
- }
-
-success:
- /*
- * The target is now driving BSY, so we can stop
- * driving SEL and the data bus (keep ATN true).
- * Configure the ncr5380 to monitor BSY, parity.
- */
- icmd &= ~(SCI_ICMD_DATA | SCI_ICMD_SEL);
- SetReg ( sc->sci_icmd, icmd );
-/* *sc->sci_icmd = icmd; */
-
- /* XXX - Make parity checking optional? */
- SetReg ( sc->sci_mode, (SCI_MODE_MONBSY) );
-/* SetReg ( sc->sci_mode, (SCI_MODE_MONBSY | SCI_MODE_PAR_CHK) ); */
-/* *sc->sci_mode = (SCI_MODE_MONBSY | SCI_MODE_PAR_CHK); */
-
- return XS_NOERROR;
-}
-
-
-/*****************************************************************
- * Functions to handle each info. transfer phase:
- *****************************************************************/
-
-/*
- * The message system:
- *
- * This is a revamped message system that now should easier accomodate
- * new messages, if necessary.
- *
- * Currently we accept these messages:
- * IDENTIFY (when reselecting)
- * COMMAND COMPLETE # (expect bus free after messages marked #)
- * NOOP
- * MESSAGE REJECT
- * SYNCHRONOUS DATA TRANSFER REQUEST
- * SAVE DATA POINTER
- * RESTORE POINTERS
- * DISCONNECT #
- *
- * We may send these messages in prioritized order:
- * BUS DEVICE RESET # if SCSI_RESET & xs->flags (or in weird sits.)
- * MESSAGE PARITY ERROR par. err. during MSGI
- * MESSAGE REJECT If we get a message we don't know how to handle
- * ABORT # send on errors
- * INITIATOR DETECTED ERROR also on errors (SCSI2) (during info xfer)
- * IDENTIFY At the start of each transfer
- * SYNCHRONOUS DATA TRANSFER REQUEST if appropriate
- * NOOP if nothing else fits the bill ...
- */
-
-#define IS1BYTEMSG(m) (((m) != 0x01 && (m) < 0x20) || (m) >= 0x80)
-#define IS2BYTEMSG(m) (((m) & 0xf0) == 0x20)
-#define ISEXTMSG(m) ((m) == 0x01)
-
-/*
- * Precondition:
- * The SCSI bus is already in the MSGI phase and there is a message byte
- * on the bus, along with an asserted REQ signal.
- *
- * Our return value determines whether our caller, ncr5380_machine()
- * will expect to see another REQ (and possibly phase change).
- */
-static int
-ncr5380_msg_in(sc)
- register struct ncr5380_softc *sc;
-{
- struct sci_req *sr = sc->sc_current;
- int n, phase, timo;
- int act_flags;
- register u_char icmd;
-
- /* acknowledge phase change */
- SetReg ( sc->sci_tcmd, PHASE_MSG_IN );
-/* *sc->sci_tcmd = PHASE_MSG_IN; */
-
- act_flags = ACT_CONTINUE;
- icmd = *sc->sci_icmd & SCI_ICMD_RMASK;
-
- if (sc->sc_prevphase == PHASE_MSG_IN) {
- /* This is a continuation of the previous message. */
- n = sc->sc_imp - sc->sc_imess;
- NCR_TRACE("msg_in: continuation, n=%d\n", n);
- goto nextbyte;
- }
-
- /* This is a new MESSAGE IN phase. Clean up our state. */
- sc->sc_state &= ~NCR_DROP_MSGIN;
-
-nextmsg:
- n = 0;
- sc->sc_imp = &sc->sc_imess[n];
-
-nextbyte:
- /*
- * Read a whole message, but don't ack the last byte. If we reject the
- * message, we have to assert ATN during the message transfer phase
- * itself.
- */
- for (;;) {
- /*
- * Read a message byte.
- * First, check BSY, REQ, phase...
- */
- if (!SCI_BUSY(sc)) {
- NCR_TRACE("msg_in: lost BSY, n=%d\n", n);
- /* XXX - Assume the command completed? */
- act_flags |= (ACT_DISCONNECT | ACT_CMD_DONE);
- return (act_flags);
- }
- if (ncr5380_wait_req(sc)) {
- NCR_TRACE("msg_in: BSY but no REQ, n=%d\n", n);
- /* Just let ncr5380_machine() handle it... */
- return (act_flags);
- }
- phase = SCI_BUS_PHASE(*sc->sci_bus_csr);
- if (phase != PHASE_MSG_IN) {
- /*
- * Target left MESSAGE IN, probably because it
- * a) noticed our ATN signal, or
- * b) ran out of messages.
- */
- return (act_flags);
- }
- /* Still in MESSAGE IN phase, and REQ is asserted. */
- if (*sc->sci_csr & SCI_CSR_PERR) {
- ncr_sched_msgout(sc, SEND_PARITY_ERROR);
- sc->sc_state |= NCR_DROP_MSGIN;
- }
-
- /* Gather incoming message bytes if needed. */
- if ((sc->sc_state & NCR_DROP_MSGIN) == 0) {
- if (n >= NCR_MAX_MSG_LEN) {
- ncr_sched_msgout(sc, SEND_REJECT);
- sc->sc_state |= NCR_DROP_MSGIN;
- } else {
- *sc->sc_imp++ = *sc->sci_data;
- n++;
- /*
- * This testing is suboptimal, but most
- * messages will be of the one byte variety, so
- * it should not affect performance
- * significantly.
- */
- if (n == 1 && IS1BYTEMSG(sc->sc_imess[0]))
- goto have_msg;
- if (n == 2 && IS2BYTEMSG(sc->sc_imess[0]))
- goto have_msg;
- if (n >= 3 && ISEXTMSG(sc->sc_imess[0]) &&
- n == sc->sc_imess[1] + 2)
- goto have_msg;
- }
- }
-
- /*
- * If we reach this spot we're either:
- * a) in the middle of a multi-byte message, or
- * b) dropping bytes.
- */
-
- /* Ack the last byte read. */
- icmd |= SCI_ICMD_ACK;
- SetReg ( sc->sci_icmd, icmd );
-/* *sc->sci_icmd = icmd; */
-
- if (ncr5380_wait_not_req(sc)) {
- NCR_TRACE("msg_in: drop, stuck REQ, n=%d\n", n);
- act_flags |= ACT_RESET_BUS;
- }
-
- icmd &= ~SCI_ICMD_ACK;
- SetReg ( sc->sci_icmd, icmd );
-/* *sc->sci_icmd = icmd; */
-
- if (act_flags != ACT_CONTINUE)
- return (act_flags);
-
- /* back to nextbyte */
- }
-
-have_msg:
- /* We now have a complete message. Parse it. */
-
- switch (sc->sc_imess[0]) {
- case MSG_CMDCOMPLETE:
- NCR_TRACE("msg_in: CMDCOMPLETE\n", 0);
- /* Target is about to disconnect. */
- act_flags |= (ACT_DISCONNECT | ACT_CMD_DONE);
- break;
-
- case MSG_DISCONNECT:
- NCR_TRACE("msg_in: DISCONNECT\n", 0);
- /* Target is about to disconnect. */
- act_flags |= ACT_DISCONNECT;
- break;
-
- case MSG_PARITY_ERROR:
- NCR_TRACE("msg_in: PARITY_ERROR\n", 0);
- /* Resend the last message. */
- ncr_sched_msgout(sc, sc->sc_msgout);
- break;
-
- case MSG_MESSAGE_REJECT:
- /* The target rejects the last message we sent. */
- NCR_TRACE("msg_in: got reject for 0x%x\n", sc->sc_msgout);
- switch (sc->sc_msgout) {
- case SEND_IDENTIFY:
- /* Really old target controller? */
- /* XXX ... */
- break;
- case SEND_INIT_DET_ERR:
- goto abort;
- }
- break;
-
- case MSG_NOOP:
- NCR_TRACE("msg_in: NOOP\n", 0);
- break;
-
- case MSG_SAVEDATAPOINTER:
- NCR_TRACE("msg_in: SAVE_PTRS\n", 0);
- sr->sr_dataptr = sc->sc_dataptr;
- sr->sr_datalen = sc->sc_datalen;
- break;
-
- case MSG_RESTOREPOINTERS:
- NCR_TRACE("msg_in: RESTORE_PTRS\n", 0);
- sc->sc_dataptr = sr->sr_dataptr;
- sc->sc_datalen = sr->sr_datalen;
- break;
-
- case MSG_EXTENDED:
- switch (sc->sc_imess[2]) {
- case MSG_EXT_SDTR:
- case MSG_EXT_WDTR:
- /* The ncr5380 can not do synchronous mode. */
- goto reject;
- default:
- printf("%s: unrecognized MESSAGE EXTENDED; sending REJECT\n",
- sc->sc_dev.dv_xname);
- NCR_BREAK();
- goto reject;
- }
- break;
-
- default:
- NCR_TRACE("msg_in: eh? imsg=0x%x\n", sc->sc_imess[0]);
- printf("%s: unrecognized MESSAGE; sending REJECT\n",
- sc->sc_dev.dv_xname);
- NCR_BREAK();
- /* fallthrough */
- reject:
- ncr_sched_msgout(sc, SEND_REJECT);
- break;
-
- abort:
- sc->sc_state |= NCR_ABORTING;
- ncr_sched_msgout(sc, SEND_ABORT);
- break;
- }
-
- /* Ack the last byte read. */
- icmd |= SCI_ICMD_ACK;
- SetReg ( sc->sci_icmd, icmd );
-/* *sc->sci_icmd = icmd; */
-
- if (ncr5380_wait_not_req(sc)) {
- NCR_TRACE("msg_in: last, stuck REQ, n=%d\n", n);
- act_flags |= ACT_RESET_BUS;
- }
-
- icmd &= ~SCI_ICMD_ACK;
- SetReg ( sc->sci_icmd, icmd );
-/* *sc->sci_icmd = icmd; */
-
- /* Go get the next message, if any. */
- if (act_flags == ACT_CONTINUE)
- goto nextmsg;
-
- return (act_flags);
-}
-
-
-/*
- * The message out (and in) stuff is a bit complicated:
- * If the target requests another message (sequence) without
- * having changed phase in between it really asks for a
- * retransmit, probably due to parity error(s).
- * The following messages can be sent:
- * IDENTIFY @ These 4 stem from SCSI command activity
- * SDTR @
- * WDTR @
- * DEV_RESET @
- * REJECT if MSGI doesn't make sense
- * PARITY_ERROR if parity error while in MSGI
- * INIT_DET_ERR if parity error while not in MSGI
- * ABORT if INIT_DET_ERR rejected
- * NOOP if asked for a message and there's nothing to send
- *
- * Note that we call this one with (sc_current == NULL)
- * when sending ABORT for unwanted reselections.
- */
-static int
-ncr5380_msg_out(sc)
- register struct ncr5380_softc *sc;
-{
- struct sci_req *sr = sc->sc_current;
- int n, phase, resel;
- int progress, act_flags;
- register u_char icmd;
-
- /* acknowledge phase change */
- SetReg ( sc->sci_tcmd, PHASE_MSG_OUT );
-/* *sc->sci_tcmd = PHASE_MSG_OUT; */
-
- progress = 0; /* did we send any messages? */
- act_flags = ACT_CONTINUE;
-
- /*
- * Set ATN. If we're just sending a trivial 1-byte message,
- * we'll clear ATN later on anyway. Also drive the data bus.
- */
- icmd = *sc->sci_icmd & SCI_ICMD_RMASK;
- icmd |= (SCI_ICMD_ATN | SCI_ICMD_DATA);
- SetReg ( sc->sci_icmd, icmd );
-/* *sc->sci_icmd = icmd; */
-
- if (sc->sc_prevphase == PHASE_MSG_OUT) {
- if (sc->sc_omp == sc->sc_omess) {
- /*
- * This is a retransmission.
- *
- * We get here if the target stayed in MESSAGE OUT
- * phase. Section 5.1.9.2 of the SCSI 2 spec indicates
- * that all of the previously transmitted messages must
- * be sent again, in the same order. Therefore, we
- * requeue all the previously transmitted messages, and
- * start again from the top. Our simple priority
- * scheme keeps the messages in the right order.
- */
- sc->sc_msgpriq |= sc->sc_msgoutq;
- NCR_TRACE("msg_out: retrans priq=0x%x\n", sc->sc_msgpriq);
- } else {
- /* This is a continuation of the previous message. */
- n = sc->sc_omp - sc->sc_omess;
- NCR_TRACE("msg_out: continuation, n=%d\n", n);
- goto nextbyte;
- }
- }
-
- /* No messages transmitted so far. */
- sc->sc_msgoutq = 0;
-
-nextmsg:
- /* Pick up highest priority message. */
- sc->sc_msgout = sc->sc_msgpriq & -sc->sc_msgpriq;
- sc->sc_msgpriq &= ~sc->sc_msgout;
- sc->sc_msgoutq |= sc->sc_msgout;
-
- /* Build the outgoing message data. */
- switch (sc->sc_msgout) {
- case SEND_IDENTIFY:
- NCR_TRACE("msg_out: SEND_IDENTIFY\n", 0);
- if (sr == NULL) {
- printf("%s: SEND_IDENTIFY while not connected; sending NOOP\n",
- sc->sc_dev.dv_xname);
- NCR_BREAK();
- goto noop;
- }
- resel = (sc->sc_flags & NCR5380_PERMIT_RESELECT) ? 1 : 0;
- resel &= (sr->sr_flags & (SR_IMMED | SR_SENSE)) ? 0 : 1;
- sc->sc_omess[0] = MSG_IDENTIFY(sr->sr_lun, resel);
- n = 1;
- break;
-
- case SEND_DEV_RESET:
- NCR_TRACE("msg_out: SEND_DEV_RESET\n", 0);
- /* Expect disconnect after this! */
- /* XXX: Kill jobs for this target? */
- act_flags |= (ACT_DISCONNECT | ACT_CMD_DONE);
- sc->sc_omess[0] = MSG_BUS_DEV_RESET;
- n = 1;
- break;
-
- case SEND_REJECT:
- NCR_TRACE("msg_out: SEND_REJECT\n", 0);
- sc->sc_omess[0] = MSG_MESSAGE_REJECT;
- n = 1;
- break;
-
- case SEND_PARITY_ERROR:
- NCR_TRACE("msg_out: SEND_PARITY_ERROR\n", 0);
- sc->sc_omess[0] = MSG_PARITY_ERROR;
- n = 1;
- break;
-
- case SEND_INIT_DET_ERR:
- NCR_TRACE("msg_out: SEND_INIT_DET_ERR\n", 0);
- sc->sc_omess[0] = MSG_INITIATOR_DET_ERR;
- n = 1;
- break;
-
- case SEND_ABORT:
- NCR_TRACE("msg_out: SEND_ABORT\n", 0);
- /* Expect disconnect after this! */
- /* XXX: Set error flag? */
- act_flags |= (ACT_DISCONNECT | ACT_CMD_DONE);
- sc->sc_omess[0] = MSG_ABORT;
- n = 1;
- break;
-
- case 0:
- printf("%s: unexpected MESSAGE OUT; sending NOOP\n",
- sc->sc_dev.dv_xname);
- NCR_BREAK();
- noop:
- NCR_TRACE("msg_out: send NOOP\n", 0);
- sc->sc_omess[0] = MSG_NOOP;
- n = 1;
- break;
-
- default:
- printf("%s: weird MESSAGE OUT; sending NOOP\n",
- sc->sc_dev.dv_xname);
- NCR_BREAK();
- goto noop;
- }
- sc->sc_omp = &sc->sc_omess[n];
-
-nextbyte:
- /* Send message bytes. */
- while (n > 0) {
- /*
- * Send a message byte.
- * First check BSY, REQ, phase...
- */
- if (!SCI_BUSY(sc)) {
- NCR_TRACE("msg_out: lost BSY, n=%d\n", n);
- goto out;
- }
- if (ncr5380_wait_req(sc)) {
- NCR_TRACE("msg_out: no REQ, n=%d\n", n);
- goto out;
- }
- phase = SCI_BUS_PHASE(*sc->sci_bus_csr);
- if (phase != PHASE_MSG_OUT) {
- /*
- * Target left MESSAGE OUT, possibly to reject
- * our message.
- */
- NCR_TRACE("msg_out: new phase=%d\n", phase);
- goto out;
- }
-
- /* Yes, we can send this message byte. */
- --n;
-
- /* Clear ATN before last byte if this is the last message. */
- if (n == 0 && sc->sc_msgpriq == 0) {
- icmd &= ~SCI_ICMD_ATN;
- SetReg ( sc->sci_icmd, icmd );
-/* *sc->sci_icmd = icmd; */
- /* 2 deskew delays */
- delay(2); /* XXX */
- }
-
- /* Put data on the bus. */
- sc->sc_omp--;
- SetReg ( sc->sci_odata, *sc->sc_omp );
-/* *sc->sci_odata = *--sc->sc_omp; */
-
- /* Raise ACK to tell target data is on the bus. */
- icmd |= SCI_ICMD_ACK;
- SetReg ( sc->sci_icmd, icmd );
-/* *sc->sci_icmd = icmd; */
-
- /* Wait for REQ to be negated. */
- if (ncr5380_wait_not_req(sc)) {
- NCR_TRACE("msg_out: stuck REQ, n=%d\n", n);
- act_flags |= ACT_RESET_BUS;
- }
-
- /* Finally, drop ACK. */
- icmd &= ~SCI_ICMD_ACK;
- SetReg ( sc->sci_icmd, icmd );
-/* *sc->sci_icmd = icmd; */
-
- /* Stuck bus or something... */
- if (act_flags & ACT_RESET_BUS)
- goto out;
-
- }
- progress++;
-
- /* We get here only if the entire message has been transmitted. */
- if (sc->sc_msgpriq != 0) {
- /* There are more outgoing messages. */
- goto nextmsg;
- }
-
- /*
- * The last message has been transmitted. We need to remember the last
- * message transmitted (in case the target switches to MESSAGE IN phase
- * and sends a MESSAGE REJECT), and the list of messages transmitted
- * this time around (in case the target stays in MESSAGE OUT phase to
- * request a retransmit).
- */
-
-out:
- /* Stop driving the data bus. */
- icmd &= ~SCI_ICMD_DATA;
- SetReg ( sc->sci_icmd, icmd );
-/* *sc->sci_icmd = icmd; */
-
- if (!progress)
- act_flags |= ACT_RESET_BUS;
-
- return (act_flags);
-}
-
-
-/*
- * Handle command phase.
- */
-static int
-ncr5380_command(sc)
- struct ncr5380_softc *sc;
-{
- struct sci_req *sr = sc->sc_current;
- struct scsi_xfer *xs = sr->sr_xs;
- struct scsi_sense rqs;
- int len;
-
- /* acknowledge phase change */
- SetReg ( sc->sci_tcmd, PHASE_COMMAND );
-/* *sc->sci_tcmd = PHASE_COMMAND; */
-
- if (sr->sr_flags & SR_SENSE) {
- rqs.opcode = REQUEST_SENSE;
- rqs.byte2 = xs->sc_link->lun << 5;
- rqs.length = sizeof(xs->sense);
-
- rqs.unused[0] = rqs.unused[1] = rqs.control = 0;
- len = ncr5380_pio_out(sc, PHASE_COMMAND, sizeof(rqs),
- (u_char *)&rqs);
- }
- else {
- /* Assume command can be sent in one go. */
- /* XXX: Do this using DMA, and get a phase change intr? */
- len = ncr5380_pio_out(sc, PHASE_COMMAND, xs->cmdlen,
- (u_char *)xs->cmd);
- }
-
- if (len != xs->cmdlen) {
-#ifdef DEBUG
- printf("ncr5380_command: short transfer: wanted %d got %d.\n",
- xs->cmdlen, len);
- ncr5380_show_scsi_cmd(xs);
- NCR_BREAK();
-#endif
- if (len < 6) {
- xs->error = XS_DRIVER_STUFFUP;
- sc->sc_state |= NCR_ABORTING;
- ncr_sched_msgout(sc, SEND_ABORT);
- }
-
- }
-
- return ACT_CONTINUE;
-}
-
-
-/*
- * Handle either data_in or data_out
- */
-static int
-ncr5380_data_xfer(sc, phase)
- struct ncr5380_softc *sc;
- int phase;
-{
- struct sci_req *sr = sc->sc_current;
- struct scsi_xfer *xs = sr->sr_xs;
- int expected_phase;
- int i, len;
-
- if (sr->sr_flags & SR_SENSE) {
- NCR_TRACE("data_xfer: get sense, sr=0x%x\n", (long)sr);
- if (phase != PHASE_DATA_IN) {
- printf("%s: sense phase error\n", sc->sc_dev.dv_xname);
- goto abort;
- }
- /* acknowledge phase change */
- SetReg ( sc->sci_tcmd, PHASE_DATA_IN );
-/* *sc->sci_tcmd = PHASE_DATA_IN; */
- len = ncr5380_pio_in(sc, phase, sizeof(xs->sense),
- (u_char *)&xs->sense);
- return ACT_CONTINUE;
- }
-
- /*
- * When aborting a command, disallow any data phase.
- */
- if (sc->sc_state & NCR_ABORTING) {
- printf("%s: aborting, but phase=%s (reset)\n",
- sc->sc_dev.dv_xname,
- phase_names[phase & 7]);
- return ACT_RESET_BUS; /* XXX */
- }
-
- /* Validate expected phase (data_in or data_out) */
- expected_phase = (xs->flags & SCSI_DATA_OUT) ?
- PHASE_DATA_OUT : PHASE_DATA_IN;
- if (phase != expected_phase) {
- printf("%s: data phase error\n",
- sc->sc_dev.dv_xname);
- goto abort;
- }
-
- /* Make sure we have some data to move. */
- if (sc->sc_datalen <= 0) {
- printf("%s: can not transfer more data\n",
- sc->sc_dev.dv_xname);
- goto abort;
- }
-
- /*
- * Attempt DMA only if dma_alloc gave us a DMA handle AND
- * there is enough left to transfer so DMA is worth while.
- */
- if (sr->sr_dma_hand &&
- (sc->sc_datalen >= sc->sc_min_dma_len))
- {
- /*
- * OK, really start DMA. Note, the MI start function
- * is responsible for setting the TCMD register, etc.
- * (Acknowledge the phase change there, not here.)
- */
- NCR_TRACE("data_xfer: dma_start, dh=0x%x\n",
- (long) sr->sr_dma_hand);
- (*sc->sc_dma_start)(sc);
- return ACT_WAIT_DMA;
- }
-
- NCR_TRACE("data_xfer: doing PIO, len=%d\n", sc->sc_datalen);
-
- /* acknowledge phase change */
- SetReg ( sc->sci_tcmd, phase );
-/* *sc->sci_tcmd = phase; */
- if (phase == PHASE_DATA_OUT) {
- len = ncr5380_pio_out(sc, phase, sc->sc_datalen, sc->sc_dataptr);
- } else {
- len = ncr5380_pio_in (sc, phase, sc->sc_datalen, sc->sc_dataptr);
- }
- sc->sc_dataptr += len;
- sc->sc_datalen -= len;
-
- NCR_TRACE("data_xfer: did PIO, resid=%d\n", sc->sc_datalen);
- return (ACT_CONTINUE);
-
-abort:
- sc->sc_state |= NCR_ABORTING;
- ncr_sched_msgout(sc, SEND_ABORT);
- return (ACT_CONTINUE);
-}
-
-
-static int
-ncr5380_status(sc)
- struct ncr5380_softc *sc;
-{
- int len;
- u_char status;
- struct sci_req *sr = sc->sc_current;
- struct scsi_xfer *xs = sr->sr_xs;
-
- /* acknowledge phase change */
- SetReg ( sc->sci_tcmd, PHASE_STATUS );
-/* *sc->sci_tcmd = PHASE_STATUS; */
-
- len = ncr5380_pio_in(sc, PHASE_STATUS, 1, &status);
- if (len) {
- sr->sr_status = status;
- } else {
- printf("ncr5380_status: none?\n");
- }
-
- return ACT_CONTINUE;
-}
-
-
-/*
- * This is the big state machine that follows SCSI phase changes.
- * This is somewhat like a co-routine. It will do a SCSI command,
- * and exit if the command is complete, or if it must wait, i.e.
- * for DMA to complete or for reselect to resume the job.
- *
- * The bus must be selected, and we need to know which command is
- * being undertaken.
- */
-static void
-ncr5380_machine(sc)
- struct ncr5380_softc *sc;
-{
- struct sci_req *sr;
- struct scsi_xfer *xs;
- int act_flags, phase, timo;
-
-#ifdef DIAGNOSTIC
- if ((getsr() & PSL_IPL) < PSL_IPL2)
- panic("ncr5380_machine: bad spl");
- if (sc->sc_state == NCR_IDLE)
- panic("ncr5380_machine: state=idle");
- if (sc->sc_current == NULL)
- panic("ncr5380_machine: no current cmd");
-#endif
-
- sr = sc->sc_current;
- xs = sr->sr_xs;
- act_flags = ACT_CONTINUE;
-
- /*
- * This will be called by ncr5380_intr() when DMA is
- * complete. Must stop DMA before touching the 5380 or
- * there will be "register conflict" errors.
- */
- if (sc->sc_state & NCR_DOINGDMA) {
- /* Pick-up where where we left off... */
- goto dma_done;
- }
-
-next_phase:
-
- if (!SCI_BUSY(sc)) {
- /* Unexpected disconnect */
- printf("ncr5380_machine: unexpected disconnect.\n");
- xs->error = XS_DRIVER_STUFFUP;
- act_flags |= (ACT_DISCONNECT | ACT_CMD_DONE);
- goto do_actions;
- }
-
- /*
- * Wait for REQ before reading the phase.
- * Need to wait longer than usual here, because
- * some devices are just plain slow...
- */
- timo = ncr5380_wait_phase_timo;
- for (;;) {
- if (*sc->sci_bus_csr & SCI_BUS_REQ)
- break;
- if (--timo <= 0) {
- if (sc->sc_state & NCR_ABORTING) {
- printf("%s: no REQ while aborting, reset\n",
- sc->sc_dev.dv_xname);
- act_flags |= ACT_RESET_BUS;
- goto do_actions;
- }
- printf("%s: no REQ for next phase, abort\n",
- sc->sc_dev.dv_xname);
- sc->sc_state |= NCR_ABORTING;
- ncr_sched_msgout(sc, SEND_ABORT);
- goto next_phase;
- }
- delay(100);
- }
-
- phase = SCI_BUS_PHASE(*sc->sci_bus_csr);
- NCR_TRACE("machine: phase=%s\n",
- (long) phase_names[phase & 7]);
-
- /*
- * We assume that the device knows what it's doing,
- * so any phase is good.
- */
-
-#if 0
- /*
- * XXX: Do not ACK the phase yet! do it later...
- * XXX: ... each phase routine does that itself.
- * In particular, DMA needs it done LATER.
- */
- SetReg ( sc->sci_tcmd, phase );
-/* *sc->sci_tcmd = phase; */ /* acknowledge phase change */
-#endif
-
- switch (phase) {
-
- case PHASE_DATA_OUT:
- case PHASE_DATA_IN:
- act_flags = ncr5380_data_xfer(sc, phase);
- break;
-
- case PHASE_COMMAND:
- act_flags = ncr5380_command(sc);
- break;
-
- case PHASE_STATUS:
- act_flags = ncr5380_status(sc);
- break;
-
- case PHASE_MSG_OUT:
- act_flags = ncr5380_msg_out(sc);
- break;
-
- case PHASE_MSG_IN:
- act_flags = ncr5380_msg_in(sc);
- break;
-
- default:
- printf("ncr5380_machine: Unexpected phase 0x%x\n", phase);
- sc->sc_state |= NCR_ABORTING;
- ncr_sched_msgout(sc, SEND_ABORT);
- goto next_phase;
-
- } /* switch */
- sc->sc_prevphase = phase;
-
-do_actions:
- __asm("_ncr5380_actions:");
-
- if (act_flags & ACT_WAIT_DMA) {
- act_flags &= ~ACT_WAIT_DMA;
- /* Wait for DMA to complete (polling, or interrupt). */
- if ((sr->sr_flags & SR_IMMED) == 0) {
- NCR_TRACE("machine: wait for DMA intr.\n", 0);
- return; /* will resume at dma_done */
- }
- /* Busy-wait for it to finish. */
- NCR_TRACE("machine: dma_poll, dh=0x%x\n",
- (long) sr->sr_dma_hand);
- (*sc->sc_dma_poll)(sc);
- dma_done:
- /* Return here after interrupt. */
- if (sr->sr_flags & SR_OVERDUE)
- sc->sc_state |= NCR_ABORTING;
- NCR_TRACE("machine: dma_stop, dh=0x%x\n",
- (long) sr->sr_dma_hand);
- (*sc->sc_dma_stop)(sc);
- SCI_CLR_INTR(sc); /* XXX */
- /*
- * While DMA is running we can not touch the SBC,
- * so various places just set NCR_ABORTING and
- * expect us the "kick it" when DMA is done.
- */
- if (sc->sc_state & NCR_ABORTING) {
- ncr_sched_msgout(sc, SEND_ABORT);
- }
- }
-
- /*
- * Check for parity error.
- * XXX - better place to check?
- */
- if (*(sc->sci_csr) & SCI_CSR_PERR) {
- printf("%s: parity error csr = %02x!\n",
- sc->sc_dev.dv_xname, *(sc->sci_csr) );
- /* XXX: sc->sc_state |= NCR_ABORTING; */
- ncr_sched_msgout(sc, SEND_PARITY_ERROR);
- }
-
- if (act_flags == ACT_CONTINUE)
- goto next_phase;
- /* All other actions "break" from the loop. */
-
- NCR_TRACE("machine: act_flags=0x%x\n", act_flags);
-
- if (act_flags & ACT_RESET_BUS) {
- act_flags |= ACT_CMD_DONE;
- /*
- * Reset the SCSI bus, usually due to a timeout.
- * The error code XS_TIMEOUT allows retries.
- */
- sc->sc_state |= NCR_ABORTING;
- printf("%s: reset SCSI bus for TID=%d LUN=%d\n",
- sc->sc_dev.dv_xname,
- sr->sr_target, sr->sr_lun);
- ncr5380_reset_scsibus(sc);
- }
-
- if (act_flags & ACT_CMD_DONE) {
- act_flags |= ACT_DISCONNECT;
- /* Need to call scsi_done() */
- /* XXX: from the aic6360 driver, but why? */
- if (sc->sc_datalen < 0) {
- printf("%s: %d extra bytes from %d:%d\n",
- sc->sc_dev.dv_xname, -sc->sc_datalen,
- sr->sr_target, sr->sr_lun);
- sc->sc_datalen = 0;
- }
- xs->resid = sc->sc_datalen;
- /* Note: this will clear sc_current */
- NCR_TRACE("machine: call done, cur=0x%x\n", (long)sr);
- ncr5380_done(sc);
- }
-
- if (act_flags & ACT_DISCONNECT) {
- /*
- * The device has dropped BSY (or will soon).
- * Return and let ncr5380_sched() do its thing.
- */
- SetReg ( sc->sci_icmd, 0 );
- SetReg ( sc->sci_mode, 0 );
- SetReg ( sc->sci_tcmd, PHASE_INVALID );
- SetReg ( sc->sci_sel_enb, 0 );
-
-/* *sc->sci_icmd = 0;
- *sc->sci_mode = 0;
- *sc->sci_tcmd = PHASE_INVALID;
- *sc->sci_sel_enb = 0; */
-
- SCI_CLR_INTR(sc);
- SetReg ( sc->sci_sel_enb, 0x80 );
- *sc->sci_sel_enb = 0x80;
-
- if ((act_flags & ACT_CMD_DONE) == 0) {
- __asm("_ncr5380_disconnected:");
- NCR_TRACE("machine: discon, cur=0x%x\n", (long)sr);
- }
-
- /*
- * We may be here due to a disconnect message,
- * in which case we did NOT call ncr5380_done,
- * and we need to clear sc_current.
- */
- sc->sc_state = NCR_IDLE;
- sc->sc_current = NULL;
-
- /* Paranoia: clear everything. */
- sc->sc_dataptr = NULL;
- sc->sc_datalen = 0;
- sc->sc_prevphase = PHASE_INVALID;
- sc->sc_msgpriq = 0;
- sc->sc_msgoutq = 0;
- sc->sc_msgout = 0;
-
- /* Our caller will re-enable interrupts. */
- }
-}
-
-
-#ifdef DEBUG
-
-static void
-ncr5380_show_scsi_cmd(xs)
- struct scsi_xfer *xs;
-{
- u_char *b = (u_char *) xs->cmd;
- int i = 0;
-
- if ( ! ( xs->flags & SCSI_RESET ) ) {
- printf("si(%d:%d:%d)-",
- xs->sc_link->scsibus,
- xs->sc_link->target,
- xs->sc_link->lun);
- while (i < xs->cmdlen) {
- if (i) printf(",");
- printf("%x",b[i++]);
- }
- printf("-\n");
- } else {
- printf("si(%d:%d:%d)-RESET-\n",
- xs->sc_link->scsibus,
- xs->sc_link->target,
- xs->sc_link->lun);
- }
-}
-
-
-static void
-ncr5380_show_sense(xs)
- struct scsi_xfer *xs;
-{
- u_char *b = (u_char *)&xs->sense;
- int i;
-
- printf("sense:");
- for (i = 0; i < sizeof(xs->sense); i++)
- printf(" %02x", b[i]);
- printf("\n");
-}
-
-int ncr5380_traceidx = 0;
-
-#define TRACE_MAX 1024
-struct trace_ent {
- char *msg;
- long val;
-} ncr5380_tracebuf[TRACE_MAX];
-
-void
-ncr5380_trace(msg, val)
- char *msg;
- long val;
-{
- register struct trace_ent *tr;
- register int s;
-
- s = splhigh();
-
- tr = &ncr5380_tracebuf[ncr5380_traceidx];
-
- ncr5380_traceidx++;
- if (ncr5380_traceidx >= TRACE_MAX)
- ncr5380_traceidx = 0;
-
- tr->msg = msg;
- tr->val = val;
-
- splx(s);
-}
-
-#ifdef DDB
-void
-ncr5380_clear_trace()
-{
- ncr5380_traceidx = 0;
- bzero((char*) ncr5380_tracebuf, sizeof(ncr5380_tracebuf));
-}
-
-void
-ncr5380_show_trace()
-{
- struct trace_ent *tr;
- int idx;
-
- idx = ncr5380_traceidx;
- do {
- tr = &ncr5380_tracebuf[idx];
- idx++;
- if (idx >= TRACE_MAX)
- idx = 0;
- if (tr->msg)
- db_printf(tr->msg, tr->val);
- } while (idx != ncr5380_traceidx);
-}
-
-void
-ncr5380_show_req(sr)
- struct sci_req *sr;
-{
- struct scsi_xfer *xs = sr->sr_xs;
-
- db_printf("TID=%d ", sr->sr_target);
- db_printf("LUN=%d ", sr->sr_lun);
- db_printf("dh=0x%x ", sr->sr_dma_hand);
- db_printf("dptr=0x%x ", sr->sr_dataptr);
- db_printf("dlen=0x%x ", sr->sr_datalen);
- db_printf("flags=%d ", sr->sr_flags);
- db_printf("stat=%d ", sr->sr_status);
-
- if (xs == NULL) {
- db_printf("(xs=NULL)\n");
- return;
- }
- db_printf("\n");
-#ifdef SCSIDEBUG
- show_scsi_xs(xs);
-#else
- db_printf("xs=0x%x\n", xs);
-#endif
-}
-
-void
-ncr5380_show_state()
-{
- struct ncr5380_softc *sc;
- struct sci_req *sr;
- int i, j, k;
-
- sc = ncr5380_debug_sc;
-
- if (sc == NULL) {
- db_printf("ncr5380_debug_sc == NULL\n");
- return;
- }
-
- db_printf("sc_ncmds=%d\n", sc->sc_ncmds);
- k = -1; /* which is current? */
- for (i = 0; i < SCI_OPENINGS; i++) {
- sr = &sc->sc_ring[i];
- if (sr->sr_xs) {
- if (sr == sc->sc_current)
- k = i;
- db_printf("req %d: (sr=0x%x)", i, (long)sr);
- ncr5380_show_req(sr);
- }
- }
- db_printf("sc_rr=%d, current=%d\n", sc->sc_rr, k);
-
- db_printf("Active request matrix:\n");
- for(i = 0; i < 8; i++) { /* targets */
- for (j = 0; j < 8; j++) { /* LUN */
- sr = sc->sc_matrix[i][j];
- if (sr) {
- db_printf("TID=%d LUN=%d sr=0x%x\n", i, j, (long)sr);
- }
- }
- }
-
- db_printf("sc_state=0x%x\n", sc->sc_state);
- db_printf("sc_current=0x%x\n", sc->sc_current);
- db_printf("sc_dataptr=0x%x\n", sc->sc_dataptr);
- db_printf("sc_datalen=0x%x\n", sc->sc_datalen);
-
- db_printf("sc_prevphase=%d\n", sc->sc_prevphase);
- db_printf("sc_msgpriq=0x%x\n", sc->sc_msgpriq);
-}
-
-#endif /* DDB */
-#endif /* DEBUG */
diff --git a/sys/arch/arm32/podulebus/ncr5380var.h b/sys/arch/arm32/podulebus/ncr5380var.h
deleted file mode 100644
index 0ad0637e1a0..00000000000
--- a/sys/arch/arm32/podulebus/ncr5380var.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/* $NetBSD: ncr5380var.h,v 1.1 1996/01/31 23:26:12 mark Exp $ */
-
-/*
- * Copyright (c) 1995 David Jones, Gordon W. Ross
- * Copyright (c) 1994 Jarle Greipsland
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the authors may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- * 4. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by
- * David Jones and Gordon Ross
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This file defines the interface between the machine-dependent
- * module and the machine-indepenedent ncr5380sbc.c module.
- */
-
-#define SCI_CLR_INTR(sc) (*(sc)->sci_iack)
-#define SCI_BUSY(sc) (*sc->sci_bus_csr & SCI_BUS_BSY)
-
-/* These are NOT artibtrary, but map to bits in sci_tcmd */
-#define PHASE_DATA_OUT 0x0
-#define PHASE_DATA_IN 0x1
-#define PHASE_COMMAND 0x2
-#define PHASE_STATUS 0x3
-#define PHASE_UNSPEC1 0x4
-#define PHASE_UNSPEC2 0x5
-#define PHASE_MSG_OUT 0x6
-#define PHASE_MSG_IN 0x7
-
-/*
- * This illegal phase is used to prevent the 5380 from having
- * a phase-match condition when we don't want one, such as
- * when setting up the DMA engine or whatever...
- */
-#define PHASE_INVALID PHASE_UNSPEC1
-
-
-/* Per-request state. This is required in order to support reselection. */
-struct sci_req {
- struct scsi_xfer *sr_xs; /* Pointer to xfer struct, NULL=unused */
- int sr_target, sr_lun; /* For fast access */
- void *sr_dma_hand; /* Current DMA hnadle */
- u_char *sr_dataptr; /* Saved data pointer */
- int sr_datalen;
- int sr_flags; /* Internal error code */
-#define SR_IMMED 1 /* Immediate command */
-#define SR_SENSE 2 /* We are getting sense */
-#define SR_OVERDUE 4 /* Timeout while not current */
-#define SR_ERROR 8 /* Error occurred */
- int sr_status; /* Status code from last cmd */
-};
-#define SCI_OPENINGS 16 /* How many commands we can enqueue. */
-
-
-struct ncr5380_softc {
- struct device sc_dev;
- struct scsi_link sc_link;
-
- /* Pointers to 5380 registers. See ncr5380reg.h */
- volatile u_char *sci_r0;
- volatile u_char *sci_r1;
- volatile u_char *sci_r2;
- volatile u_char *sci_r3;
- volatile u_char *sci_r4;
- volatile u_char *sci_r5;
- volatile u_char *sci_r6;
- volatile u_char *sci_r7;
-
- /* Functions set from MD code */
- int (*sc_pio_out) __P((struct ncr5380_softc *,
- int, int, u_char *));
- int (*sc_pio_in) __P((struct ncr5380_softc *,
- int, int, u_char *));
- void (*sc_dma_alloc) __P((struct ncr5380_softc *));
- void (*sc_dma_free) __P((struct ncr5380_softc *));
-
- void (*sc_dma_setup) __P((struct ncr5380_softc *));
- void (*sc_dma_start) __P((struct ncr5380_softc *));
- void (*sc_dma_poll) __P((struct ncr5380_softc *));
- void (*sc_dma_eop) __P((struct ncr5380_softc *));
- void (*sc_dma_stop) __P((struct ncr5380_softc *));
-
- void (*sc_intr_on) __P((struct ncr5380_softc *));
- void (*sc_intr_off) __P((struct ncr5380_softc *));
-
- int sc_flags; /* Misc. flags and capabilities */
-#define NCR5380_PERMIT_RESELECT 1 /* Allow disconnect/reselect */
-#define NCR5380_FORCE_POLLING 2 /* Do not use interrupts. */
-
- int sc_min_dma_len; /* Smaller than this is done with PIO */
-
- /* Begin MI shared data */
-
- int sc_state;
-#define NCR_IDLE 0 /* Ready for new work. */
-#define NCR_WORKING 0x01 /* Some command is in progress. */
-#define NCR_ABORTING 0x02 /* Bailing out */
-#define NCR_DOINGDMA 0x04 /* The FIFO data path is active! */
-#define NCR_DROP_MSGIN 0x10 /* Discard all msgs (parity err detected) */
-
- /* The request that has the bus now. */
- struct sci_req *sc_current;
-
- /* Active data pointer for current SCSI command. */
- u_char *sc_dataptr;
- int sc_datalen;
-
- /* Begin MI private data */
-
- /* The number of operations in progress on the bus */
- volatile int sc_ncmds;
-
- /* Ring buffer of pending/active requests */
- struct sci_req sc_ring[SCI_OPENINGS];
- int sc_rr; /* Round-robin scan pointer */
-
- /* Active requests, by target/LUN */
- struct sci_req *sc_matrix[8][8];
-
- /* Message stuff */
- int sc_prevphase;
-
- u_int sc_msgpriq; /* Messages we want to send */
- u_int sc_msgoutq; /* Messages sent during last MESSAGE OUT */
- u_int sc_msgout; /* Message last transmitted */
-#define SEND_DEV_RESET 0x01
-#define SEND_PARITY_ERROR 0x02
-#define SEND_ABORT 0x04
-#define SEND_REJECT 0x08
-#define SEND_INIT_DET_ERR 0x10
-#define SEND_IDENTIFY 0x20
-#define SEND_SDTR 0x40
-#define SEND_WDTR 0x80
-#define NCR_MAX_MSG_LEN 8
- u_char sc_omess[NCR_MAX_MSG_LEN];
- u_char *sc_omp; /* Outgoing message pointer */
- u_char sc_imess[NCR_MAX_MSG_LEN];
- u_char *sc_imp; /* Incoming message pointer */
-
-};
-
-void ncr5380_init __P((struct ncr5380_softc *));
-void ncr5380_reset_scsibus __P((struct ncr5380_softc *));
-int ncr5380_intr __P((struct ncr5380_softc *));
-int ncr5380_scsi_cmd __P((struct scsi_xfer *));
-int ncr5380_pio_in __P((struct ncr5380_softc *, int, int, u_char *));
-int ncr5380_pio_out __P((struct ncr5380_softc *, int, int, u_char *));
-
-#ifdef DEBUG
-struct ncr5380_softc *ncr5380_debug_sc;
-void ncr5380_trace __P((char *msg, long val));
-#define NCR_TRACE(msg, val) ncr5380_trace(msg, val)
-#else
-#define NCR_TRACE(msg, val) /* nada */
-#endif
diff --git a/sys/arch/arm32/podulebus/oak.c b/sys/arch/arm32/podulebus/oak.c
deleted file mode 100644
index 2564aa994a3..00000000000
--- a/sys/arch/arm32/podulebus/oak.c
+++ /dev/null
@@ -1,382 +0,0 @@
-/* $NetBSD: oak.c,v 1.3 1996/03/17 01:24:51 thorpej Exp $ */
-
-/*
- * Copyright (c) 1995 Melvin Tang-Richardson 1996.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by RiscBSD.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * oak.c
- *
- * Oak SCSI Driver.
- */
-
-#undef USE_OWN_PIO_ROUTINES
-
-/* Some system includes *****************************************************/
-
-#include <sys/types.h>
-#include <sys/cdefs.h>
-#include <sys/time.h>
-#include <sys/systm.h>
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/syslog.h>
-#include <sys/device.h>
-#include <sys/buf.h>
-/*#include <machine/bootconfig.h>*/
-
-/* SCSI bus includes */
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-
-/* Hardware related include chip/card/bus ***********************************/
-
-#include <machine/io.h>
-#include <machine/irqhandler.h>
-#include <machine/katelib.h>
-#include <arm32/podulebus/podulebus.h>
-#include <arm32/podulebus/ncr5380reg.h>
-#include <arm32/podulebus/ncr5380var.h>
-
-/****************************************************************************/
-/* Some useful definitions **************************************************/
-/****************************************************************************/
-
-#define MY_MANUFACTURER (0x21)
-#define MY_PODULE (0x58)
-#define MAX_DMA_LEN (0xe000)
-
-/****************************************************************************/
-/* Prototype internal data structures ***************************************/
-/****************************************************************************/
-
-struct oak_softc {
- struct ncr5380_softc ncr_sc;
- int sc_podule;
- int sc_base;
-};
-
-/****************************************************************************/
-/* Function and data prototypes *********************************************/
-/****************************************************************************/
-
-int oakprobe __P(( struct device *, void *, void * ));
-void oakattach __P(( struct device *, struct device *, void * ));
-int oakprint __P(( void *, const char * ));
-void oakminphys __P(( struct buf * ));
-
-#ifdef USE_OWN_PIO_ROUTINES
-int oak_pio_in __P(( struct ncr5380_softc *, int, int, unsigned char * ));
-int oak_pio_out __P(( struct ncr5380_softc *, int, int, unsigned char * ));
-#endif
-
-struct scsi_adapter oak_adapter = {
- ncr5380_scsi_cmd,
- oakminphys,
- NULL,
- NULL,
-};
-
-struct scsi_device oak_device = {
- NULL,
- NULL,
- NULL,
- NULL,
-};
-
-int
-oakprobe(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
-{
- struct oak_softc *sc = (void *) match;
- struct podule_attach_args *pa = (void *) aux;
- int podule;
-
- podule = findpodule(MY_MANUFACTURER, MY_PODULE, pa->pa_podule_number);
-
- if (podule == -1)
- return 0;
-
- sc->sc_podule = podule;
- sc->sc_base = podules[podule].mod_base;
-
- return 1;
-}
-
-void
-oakattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct oak_softc *sc = (void *) self;
- struct ncr5380_softc *ncr_sc = (struct ncr5380_softc *)sc;
- struct podule_attach_args *pa = (void *)aux;
-
- printf(" 16-bit");
-
- ncr_sc->sc_link.adapter_softc = sc;
- ncr_sc->sc_link.adapter_target = 7;
- ncr_sc->sc_link.adapter = &oak_adapter;
- ncr_sc->sc_link.device = &oak_device;
- ncr_sc->sc_link.openings = 4;
-
- ncr_sc->sci_r0 = (volatile u_char *)sc->sc_base + 0x00;
- ncr_sc->sci_r1 = (volatile u_char *)sc->sc_base + 0x04;
- ncr_sc->sci_r2 = (volatile u_char *)sc->sc_base + 0x08;
- ncr_sc->sci_r3 = (volatile u_char *)sc->sc_base + 0x0c;
- ncr_sc->sci_r4 = (volatile u_char *)sc->sc_base + 0x10;
- ncr_sc->sci_r5 = (volatile u_char *)sc->sc_base + 0x14;
- ncr_sc->sci_r6 = (volatile u_char *)sc->sc_base + 0x18;
- ncr_sc->sci_r7 = (volatile u_char *)sc->sc_base + 0x1c;
-
-#ifdef USE_OWN_PIO_ROUTINES
- printf ( ", my pio" );
- ncr_sc->sc_pio_out = oak_pio_out;
- ncr_sc->sc_pio_in = oak_pio_in;
-#else
- printf ( ", normal pio" );
- ncr_sc->sc_pio_out = ncr5380_pio_out;
- ncr_sc->sc_pio_in = ncr5380_pio_in;
-#endif
-
- ncr_sc->sc_dma_alloc = NULL;
- ncr_sc->sc_dma_free = NULL;
- ncr_sc->sc_dma_poll = NULL;
- ncr_sc->sc_dma_setup = NULL;
- ncr_sc->sc_dma_start = NULL;
- ncr_sc->sc_dma_eop = NULL;
- ncr_sc->sc_dma_stop = NULL;
-
- printf(", polling");
- ncr_sc->sc_intr_on = NULL;
- ncr_sc->sc_intr_off = NULL;
-
- ncr_sc->sc_flags = NCR5380_FORCE_POLLING;
-
- ncr5380_init(ncr_sc);
- ncr5380_reset_scsibus(ncr_sc);
-
- printf(" UNDER DEVELOPMENT\n");
-
- config_found(self, &(ncr_sc->sc_link), oakprint);
-}
-
-int
-oakprint(aux, name)
- void *aux;
- const char *name;
-{
- if (name != NULL)
- printf("%s: scsibus ", name);
- return UNCONF;
-}
-
-void
-oakminphys(bp)
- struct buf *bp;
-{
- if (bp->b_bcount > MAX_DMA_LEN) {
- printf("oak: DEBUG reducing dma length\n");
- bp->b_bcount = MAX_DMA_LEN;
- }
- return (minphys(bp));
-}
-
-struct cfattach oak_ca = {
- sizeof(struct oak_softc), oakprobe, oakattach
-};
-
-struct cfdriver oak_cd = {
- NULL, "oak", DV_DISK, NULL, 0,
-};
-
-#ifdef USE_OWN_PIO_ROUTINES
-
-/****************************************************************************/
-/* Copyright (c) 1996 Melvin Tang-Richardson */
-/* Copyright (c) 1995 David Jones, Gordon W. Rose */
-/* Copyright (c) 1994 Jarle Greipsland */
-/****************************************************************************/
-
-static ncr5380_wait_req_timo = 1000 * 50; /* X2 = 100 mS */
-static ncr5380_wait_nrq_timo = 1000 * 25; /* X2 = 50 mS */
-
-/* Return zero on success. */
-static __inline__ int ncr5380_wait_req(sc)
- struct ncr5380_softc *sc;
-{
- register int timo = ncr5380_wait_req_timo;
- for (;;) {
- if (*sc->sci_bus_csr & SCI_BUS_REQ) {
- timo = 0; /* return 0 */
- break;
- }
- if (--timo < 0)
- break; /* return -1 */
- delay(2);
- }
- return (timo);
-}
-
-/* Return zero on success. */
-static __inline__ int ncr5380_wait_not_req(sc)
- struct ncr5380_softc *sc;
-{
- register int timo = ncr5380_wait_nrq_timo;
- for (;;) {
- if ((*sc->sci_bus_csr & SCI_BUS_REQ) == 0) {
- timo = 0; /* return 0 */
- break;
- }
- if (--timo < 0)
- break; /* return -1 */
- delay(2);
- }
- return (timo);
-}
-
-int
-oak_pio_out(sc, phase, count, data)
- struct ncr5380_softc *sc;
- int phase, count;
- unsigned char *data;
-{
- register u_char icmd;
- register int resid;
- register int error;
-
- printf("oak: pio_out %d %d\n", phase, count);
-
- icmd = *(sc->sci_icmd) & SCI_ICMD_RMASK;
-
- icmd |= SCI_ICMD_DATA;
- *sc->sci_icmd = icmd;
-
- resid = count;
- while (resid > 0) {
- if (!SCI_BUSY(sc)) {
- NCR_TRACE("pio_out: lost BSY, resid=%d\n", resid);
- break;
- }
- if (ncr5380_wait_req(sc)) {
- NCR_TRACE("pio_out: no REQ, resid=%d\n", resid);
- break;
- }
- if (SCI_BUS_PHASE(*sc->sci_bus_csr) != phase)
- break;
-
- /* Put the data on the bus. */
- *sc->sci_odata = *data++;
-
- /* Tell the target it's there. */
- icmd |= SCI_ICMD_ACK;
- *sc->sci_icmd = icmd;
-
- /* Wait for target to get it. */
- error = ncr5380_wait_not_req(sc);
-
- /* OK, it's got it (or we gave up waiting). */
- icmd &= ~SCI_ICMD_ACK;
- *sc->sci_icmd = icmd;
-
- if (error) {
- NCR_TRACE("pio_out: stuck REQ, resid=%d\n", resid);
- break;
- }
-
- --resid;
- }
-
- /* Stop driving the data bus. */
- icmd &= ~SCI_ICMD_DATA;
- *sc->sci_icmd = icmd;
-
- return (count - resid);
-}
-
-int
-oak_pio_in(sc, phase, count, data)
- struct ncr5380_softc *sc;
- int phase, count;
- unsigned char *data;
-{
- register u_char icmd;
- register int resid;
- register int error;
-
- printf("oak: pio_in %d %d\n", phase, count);
-
- icmd = *(sc->sci_icmd) & SCI_ICMD_RMASK;
-
- resid = count;
- while (resid > 0) {
- if (!SCI_BUSY(sc)) {
- NCR_TRACE("pio_in: lost BSY, resid=%d\n", resid);
- break;
- }
- if (ncr5380_wait_req(sc)) {
- NCR_TRACE("pio_in: no REQ, resid=%d\n", resid);
- break;
- }
- /* A phase change is not valid until AFTER REQ rises! */
- if (SCI_BUS_PHASE(*sc->sci_bus_csr) != phase)
- break;
-
- /* Read the data bus. */
- *data++ = *sc->sci_data;
-
- /* Tell target we got it. */
- icmd |= SCI_ICMD_ACK;
- *sc->sci_icmd = icmd;
-
- /* Wait for target to drop REQ... */
- error = ncr5380_wait_not_req(sc);
-
- /* OK, we can drop ACK. */
- icmd &= ~SCI_ICMD_ACK;
- *sc->sci_icmd = icmd;
-
- if (error) {
- NCR_TRACE("pio_in: stuck REQ, resid=%d\n", resid);
- break;
- }
-
- --resid;
- }
-
- return (count - resid);
-}
-
-#endif /* USE_OWN_PIO_ROUTINES */
-
diff --git a/sys/arch/arm32/podulebus/podulebus.c b/sys/arch/arm32/podulebus/podulebus.c
deleted file mode 100644
index 24e91b9bc9c..00000000000
--- a/sys/arch/arm32/podulebus/podulebus.c
+++ /dev/null
@@ -1,627 +0,0 @@
-/* $NetBSD: podulebus.c,v 1.5 1996/03/27 22:07:26 mark Exp $ */
-
-/*
- * Copyright (c) 1994,1995 Mark Brinicombe.
- * Copyright (c) 1994 Brini.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * podulebus.c
- *
- * Podule probe and configuration routines
- *
- * Created : 07/11/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/conf.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-#include <machine/io.h>
-#include <machine/katelib.h>
-#include <machine/irqhandler.h>
-#include <arm32/podulebus/podulebus.h>
-
-/*
- * Now construct the table of know podules.
- * A podule description array is setup for each manufacturer id
- */
-
-struct podule_description podules_0000[] = {
- { 0x02, "SCSI interface" },
- { 0x03, "ether 1 interface" },
- { 0x61, "ether 2 interface" },
- { 0x00, NULL },
-};
-
-struct podule_description podules_0004[] = {
- { 0x14, "laser direct (Canon LBP-4)" },
- { 0x00, NULL },
-};
-
-struct podule_description podules_0009[] = {
- { 0x52, "hawk V9 mark2" },
- { 0xcb, "scanlight Video256" },
- { 0xcc, "eagle M2" },
- { 0xce, "lark A16" },
- { 0x200, "MIDI max" },
- { 0x00, NULL },
-};
-
-struct podule_description podules_0011[] = {
- { 0xa4, "ether 3 interface" },
- { 0x00, NULL },
-};
-
-struct podule_description podules_001a[] = {
- { 0x95, "16 bit SCSI interface" },
- { 0x00, NULL },
-};
-
-struct podule_description podules_0021[] = {
- { 0x58, "16 bit SCSI interface" },
- { 0x00, NULL },
-};
-
-struct podule_description podules_002b[] = {
- { 0x67, "SCSI interface" },
- { 0x00, NULL },
-};
-
-struct podule_description podules_003a[] = {
- { 0x3a, "SCSI II interface" },
- { 0xdd, "CDFS & SLCD expansion card" },
- { 0x00, NULL },
-};
-
-struct podule_description podules_0041[] = {
- { 0x41, "16 bit SCSI interface" },
- { 0x00, NULL },
-};
-
-struct podule_description podules_0042[] = {
- { 0xea, "PC card" },
- { 0x00, NULL },
-};
-
-struct podule_description podules_0046[] = {
- { 0xec, "etherlan 600 network slot interface" },
- { 0x00, NULL },
-};
-
-struct podule_description podules_0050[] = {
- { 0x00, "BriniPort intelligent I/O interface" },
- { 0xdf, "BriniLink transputer link adapter" },
- { 0x00, NULL },
-};
-
-struct podule_description podules_0053[] = {
- { 0xe4, "ether B network slot interface" },
- { 0x00, NULL },
-};
-
-struct podule_description podules_005b[] = {
- { 0x107, "SCSI 1 / SCSI 2 host adapter" },
- { 0x00, NULL },
-};
-
-/* A podule list if setup for all the manufacturers */
-
-struct podule_list known_podules[] = {
- { 0x00, "Acorn", podules_0000 },
- { 0x04, "CConcepts", podules_0004 }, /* Two codes ??? */
- { 0x09, "CConcepts", podules_0009 },
- { 0x11, "Atomwide", podules_0011 },
- { 0x1a, "Lingenuity", podules_001a },
- { 0x21, "Oak", podules_0021 },
- { 0x2b, "Morley", podules_002b },
- { 0x3a, "Cumana", podules_003a },
- { 0x41, "ARXE", podules_0041 },
- { 0x42, "Aleph1", podules_0042 },
- { 0x46, "I-Cubed", podules_0046 },
- { 0x50, "Brini", podules_0050 },
- { 0x53, "ANT", podules_0053 },
- { 0x5b, "Power-tec", podules_005b },
-};
-
-/* Array of podule structures, one per possible podule */
-
-podule_t podules[MAX_PODULES + MAX_NETSLOTS];
-irqhandler_t poduleirq;
-extern u_int actual_mask;
-extern irqhandler_t *irqhandlers[NIRQS];
-
-/* Declare prototypes */
-
-void map_section __P((vm_offset_t, vm_offset_t, vm_offset_t));
-int poduleirqhandler __P((void));
-u_int poduleread __P((u_int /*address*/, int /*offset*/, int /*slottype*/));
-
-
-/*
- * int podulebusmatch(struct device *parent, void *match, void *aux)
- *
- * Probe for the podule bus. Currently all this does is return 1 to
- * indicate that the podule bus was found.
- */
-
-int
-podulebusmatch(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
-{
- return (1);
-}
-
-
-int
-podulebusprint(aux, podulebus)
- void *aux;
- const char *podulebus;
-{
- struct podule_attach_args *pa = aux;
-
- if (pa->pa_podule != NULL) {
- if (pa->pa_podule->slottype == SLOT_POD)
- printf(" [ podule %d ]:", pa->pa_podule_number);
- else if (pa->pa_podule->slottype == SLOT_NET)
- printf(" [ netslot %d ]:", pa->pa_podule_number - MAX_PODULES);
- else
- panic("Invalid slot type");
- }
-
-/* XXXX print flags */
- return (QUIET);
-}
-
-
-void
-podulebusscan(parent, match)
- struct device *parent;
- void *match;
-{
- struct device *dev = match;
- struct cfdata *cf = dev->dv_cfdata;
- struct podule_attach_args pa;
-
- if (cf->cf_fstate == FSTATE_STAR)
- panic("nope cannot handle this");
-
- pa.pa_podule = NULL;
- pa.pa_podule_number = -1;
-
- if (cf->cf_loc[0] != -1) {
- pa.pa_podule_number = cf->cf_loc[0];
- }
-
- if ((*cf->cf_attach->ca_match)(parent, dev, &pa) > 0)
- config_attach(parent, dev, &pa, podulebusprint);
- else
- free(dev, M_DEVBUF);
-}
-
-
-void
-dump_podule(podule)
- podule_t *podule;
-{
- printf("podule%d: ", podule->podulenum);
- printf("flags0=%02x ", podule->flags0);
- printf("flags1=%02x ", podule->flags1);
- printf("reserved=%02x ", podule->reserved);
- printf("product=%02x ", podule->product);
- printf("manufacturer=%02x ", podule->manufacturer);
- printf("country=%02x ", podule->country);
- printf("irq_addr=%08x ", podule->irq_addr);
- printf("irq_mask=%02x ", podule->irq_mask);
- printf("fiq_addr=%08x ", podule->fiq_addr);
- printf("fiq_mask=%02x ", podule->fiq_mask);
- printf("fast_base=%08x ", podule->fast_base);
- printf("medium_base=%08x ", podule->medium_base);
- printf("slow_base=%08x ", podule->slow_base);
- printf("sync_base=%08x ", podule->sync_base);
- printf("mod_base=%08x ", podule->mod_base);
- printf("easi_base=%08x ", podule->easi_base);
- printf("attached=%d ", podule->attached);
- printf("slottype=%d ", podule->slottype);
- printf("podulenum=%d ", podule->podulenum);
- printf("\n");
-}
-
-
-void
-podulechunkdirectory(podule)
- podule_t *podule;
-{
- u_int address;
- u_int id;
- u_int size;
- u_int addr;
- int loop;
-
- address = 0x40;
-
- do {
- id = poduleread(podule->slow_base, address, podule->slottype);
- size = poduleread(podule->slow_base, address + 4, podule->slottype);
- size |= (poduleread(podule->slow_base, address + 8, podule->slottype) << 8);
- size |= (poduleread(podule->slow_base, address + 12, podule->slottype) << 16);
- if (id == 0xf5) {
- addr = poduleread(podule->slow_base, address + 16, podule->slottype);
- addr |= (poduleread(podule->slow_base, address + 20, podule->slottype) << 8);
- addr |= (poduleread(podule->slow_base, address + 24, podule->slottype) << 16);
- addr |= (poduleread(podule->slow_base, address + 28, podule->slottype) << 24);
- if (addr < 0x800) {
- for (loop = 0; loop < size; ++loop)
- printf("%c", poduleread(podule->slow_base, (addr + loop)*4, podule->slottype));
- printf("\n");
- }
- }
- address += 32;
- } while (id != 0 && address < 0x800);
-}
-
-
-void
-poduleexamine(podule, dev, slottype)
- podule_t *podule;
- struct device *dev;
- int slottype;
-{
- struct podule_list *pod_list;
- struct podule_description *pod_desc;
-
-/* Test to see if the podule is present */
-
- if ((podule->flags0 & 0x02) == 0x00) {
- podule->slottype = slottype;
- if (slottype == SLOT_NET)
- printf("netslot%d at %s : ", podule->podulenum - MAX_PODULES,
- dev->dv_xname);
- else
- printf("podule%d at %s : ", podule->podulenum,
- dev->dv_xname);
-
-/* Is it Acorn conformant ? */
-
- if (podule->flags0 & 0x80)
- printf("Non-Acorn conformant expansion card\n");
- else {
- int id;
-
-/* Is it a simple podule ? */
-
- id = (podule->flags0 >> 3) & 0x0f;
- if (id != 0)
- printf("Simple expansion card <%x>\n", id);
- else {
-/* Do we know this manufacturer ? */
- pod_list = known_podules;
- while (pod_list->description) {
- if (pod_list->manufacturer_id == podule->manufacturer)
- break;
- ++pod_list;
- }
- if (!pod_list->description)
- printf("man=%04x : ", podule->manufacturer);
- else
- printf("%10s : ", pod_list->description);
-
-/* Do we know this product ? */
-
- pod_desc = pod_list->products;
- while (pod_desc->description) {
- if (pod_desc->product_id == podule->product)
- break;
- ++pod_desc;
- }
- if (!pod_desc->description)
- printf("prod=%04x\n", podule->product);
- else
- printf("%s\n", pod_desc->description);
-
- if (pod_desc->description == NULL
- && podule->flags1 & PODULE_FLAGS_CD)
- podulechunkdirectory(podule);
- }
- }
- }
-}
-
-
-u_int
-poduleread(address, offset, slottype)
- u_int address;
- int offset;
- int slottype;
-{
- static u_int netslotoffset;
-
- if (slottype == SLOT_NET) {
- offset = offset >> 2;
- if (offset < netslotoffset) {
- WriteWord(address, 0);
- netslotoffset = 0;
- }
- while (netslotoffset < offset) {
- slottype = ReadWord(address);
- ++netslotoffset;
- }
- ++netslotoffset;
- return(ReadByte(address));
- }
- return(ReadByte(address + offset));
-}
-
-
-void
-podulescan(dev)
- struct device *dev;
-{
- int loop;
- podule_t *podule;
- u_char *address;
- u_int offset = 0;
-
-/* Loop round all the podules */
-
- for (loop = 0; loop < MAX_PODULES; ++loop, offset += SIMPLE_PODULE_SIZE) {
- if (loop == 4) offset += PODULE_GAP;
- address = ((u_char *)SLOW_PODULE_BASE) + offset;
-
- podule = &podules[loop];
-
-/* Get information from the podule header */
-
- podule->flags0 = address[0];
- podule->flags1 = address[4];
- podule->reserved = address[8];
- podule->product = address[12] + (address[16] << 8);
- podule->manufacturer = address[20] + (address[24] << 8);
- podule->country = address[28];
- if (podule->flags1 & PODULE_FLAGS_IS) {
- podule->irq_addr = address[52] + (address[56] << 8) + (address[60] << 16);
- podule->irq_mask = address[48];
- podule->fiq_addr = address[36] + (address[40] << 8) + (address[44] << 16);
- podule->fiq_mask = address[32];
- } else {
- podule->irq_addr = 0;
- podule->irq_mask = 0;
- podule->fiq_addr = 0;
- podule->fiq_mask = 0;
- }
- podule->fast_base = FAST_PODULE_BASE + offset;
- podule->medium_base = MEDIUM_PODULE_BASE + offset;
- podule->slow_base = SLOW_PODULE_BASE + offset;
- podule->sync_base = SYNC_PODULE_BASE + offset;
- podule->mod_base = MOD_PODULE_BASE + offset;
- podule->easi_base = EASI_BASE + loop * EASI_SIZE;
- podule->attached = 0;
- podule->slottype = SLOT_NONE;
- podule->podulenum = loop;
-
- poduleexamine(podule, dev, SLOT_POD);
- }
-}
-
-
-void
-netslotscan(dev)
- struct device *dev;
-{
- podule_t *podule;
- volatile u_char *address;
-
-/* Only one netslot atm */
-
-/* Reset the address counter */
-
- WriteByte(NETSLOT_BASE, 0x00);
-
- address = (u_char *)NETSLOT_BASE;
-
- podule = &podules[MAX_PODULES];
-
-/* Get information from the podule header */
-
- podule->flags0 = *address;
- podule->flags1 = *address;
- podule->reserved = *address;
- podule->product = *address + (*address << 8);
- podule->manufacturer = *address + (*address << 8);
- podule->country = *address;
- if (podule->flags1 & PODULE_FLAGS_IS) {
- podule->irq_mask = *address;
- podule->irq_addr = *address + (*address << 8) + (*address << 16);
- podule->fiq_mask = *address;
- podule->fiq_addr = *address + (*address << 8) + (*address << 16);
- } else {
- podule->irq_addr = 0;
- podule->irq_mask = 0;
- podule->fiq_addr = 0;
- podule->fiq_mask = 0;
- }
- podule->fast_base = NETSLOT_BASE;
- podule->medium_base = NETSLOT_BASE;
- podule->slow_base = NETSLOT_BASE;
- podule->sync_base = NETSLOT_BASE;
- podule->mod_base = NETSLOT_BASE;
- podule->easi_base = 0;
- podule->attached = 0;
- podule->slottype = SLOT_NONE;
- podule->podulenum = MAX_PODULES;
-
- poduleexamine(podule, dev, SLOT_NET);
-}
-
-
-/*
- * void podulebusattach(struct device *parent, struct device *dev, void *aux)
- *
- * Attach podulebus.
- * This probes all the podules and sets up the podules array with
- * information found in the podule headers.
- * After identifing all the podules, all the children of the podulebus
- * are probed and attached.
- */
-
-void
-podulebusattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- int loop;
-
- printf("\n");
-
-/* Ok we need to map in the podulebus */
-
-/* Map the FAST and SYNC simple podules */
-
- map_section(PAGE_DIRS_BASE, SYNC_PODULE_BASE & 0xfff00000,
- SYNC_PODULE_HW_BASE & 0xfff00000);
-
-/* Now map the EASI space */
-
- for (loop = 0; loop < MAX_PODULES; ++loop) {
- int loop1;
-
- for (loop1 = loop * EASI_SIZE; loop1 < ((loop + 1) * EASI_SIZE); loop1 += (1 << 20))
- map_section(PAGE_DIRS_BASE, EASI_BASE + loop1, EASI_HW_BASE + loop1);
- }
-
-/*
- * The MEDIUM and SLOW simple podules and the module space will have been
- * mapped when the IOMD and COMBO we mapped in for the RPC
- */
-
-/* Install an podule IRQ handler */
-
- poduleirq.ih_func = poduleirqhandler;
- poduleirq.ih_arg = NULL;
- poduleirq.ih_level = IPL_NONE;
- poduleirq.ih_name = "podulebus";
-
- if (irq_claim(IRQ_PODULE, &poduleirq))
- panic("Cannot claim IRQ for podulebus%d", IRQ_PODULE, parent->dv_unit);
-
-/* Find out what hardware is bolted on */
-
- podulescan(self);
- netslotscan(self);
-
-/* Look for drivers */
-
- config_scan(podulebusscan, self);
-}
-
-
-/*
- * int podule_irqhandler(void *arg)
- *
- * text irq handler to service expansion card IRQ's
- *
- * There is currently a problem here.
- * The spl_mask may mask out certain expansion card IRQ's e.g. SCSI
- * but allow others e.g. Ethernet.
- */
-
-int
-poduleirqhandler()
-{
- int loop;
- irqhandler_t *handler;
-
- printf("eek ! Unknown podule IRQ received - Blocking all podule interrupts\n");
- disable_irq(IRQ_PODULE);
- return(1);
-
-/* Loop round the expansion card handlers */
-
- for (loop = IRQ_EXPCARD0; loop <= IRQ_EXPCARD7; ++loop) {
-
-/* Is the IRQ currently allowable */
-
- if (actual_mask & (1 << loop)) {
- handler = irqhandlers[loop];
-
- if (handler && handler->ih_irqmask) {
- if ((*handler->ih_irqmask) & handler->ih_irqbit)
- handler->ih_func(handler->ih_arg);
- }
- }
- }
- return(1);
-}
-
-struct cfattach podulebus_ca = {
- sizeof(struct device), podulebusmatch, podulebusattach
-};
-
-struct cfdriver podulebus_cd = {
- NULL, "podulebus", DV_DULL, 1
-};
-
-
-/* Useful functions that drivers may share */
-
-/*
- * Search the podule list for the specified manufacturer and product.
- * Return the podule number if the podule is not already attach and
- * the podule was in the required slot.
- * A required slot of -1 means any slot.
- */
-
-int
-findpodule(manufacturer, product, required_slot)
- int manufacturer;
- int product;
- int required_slot;
-{
- int loop;
-
- for (loop = 0; loop < MAX_PODULES+MAX_NETSLOTS; ++loop) {
- if (podules[loop].slottype != SLOT_NONE
- && !podules[loop].attached
- && podules[loop].manufacturer == manufacturer
- && podules[loop].product == product
- && (required_slot == -1 || required_slot == loop))
- return(loop);
- }
-
- return(-1);
-}
-
-/* End of podulebus.c */
diff --git a/sys/arch/arm32/podulebus/podulebus.h b/sys/arch/arm32/podulebus/podulebus.h
deleted file mode 100644
index 0b0c6384ad9..00000000000
--- a/sys/arch/arm32/podulebus/podulebus.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* $NetBSD: podulebus.h,v 1.2 1996/03/18 21:23:18 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Mark Brinicombe.
- * Copyright (c) 1995 Brini.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * podulebus.h
- *
- * Podule bus header file
- *
- * Created : 26/04/95
- */
-
-#include <sys/param.h>
-
-/* Define the structures used to describe the "known" podules */
-
-struct podule_description {
- int product_id;
- char *description;
-};
-
-struct podule_list {
- int manufacturer_id;
- char *description;
- struct podule_description *products;
-};
-
-/* Define the structure used to describe a podule */
-
-typedef struct {
-/* The podule header, read from the on board ROM */
-
- u_char flags0;
- u_char flags1;
- u_char reserved;
- u_short product;
- u_short manufacturer;
- u_char country;
- u_int irq_addr;
- u_int irq_mask;
- u_int fiq_addr;
- u_int fiq_mask;
-
-/* The base addresses for this podule */
-
- u_int fast_base;
- u_int medium_base;
- u_int slow_base;
- u_int sync_base;
- u_int mod_base;
- u_int easi_base;
-
-/* Flags */
-
- int podulenum;
- int slottype;
- int attached;
-} podule_t;
-
-#define PODULE_FLAGS_CD 0x01
-#define PODULE_FLAGS_IS 0x02
-
-#define SLOT_NONE 0x00
-#define SLOT_POD 0x01
-#define SLOT_NET 0x02
-
-struct podule_attach_args {
- podule_t *pa_podule;
- int pa_podule_number;
- int pa_slottype;
-};
-
-#ifdef _KERNEL
-
-/* Array of podule structures, one per possible podule */
-
-extern podule_t podules[MAX_PODULES + MAX_NETSLOTS];
-
-int findpodule __P((int, int, int));
-
-#endif
-
-/* End of podulebus.h */
diff --git a/sys/arch/arm32/podulebus/ptsc.c b/sys/arch/arm32/podulebus/ptsc.c
deleted file mode 100644
index ab9b8fbe048..00000000000
--- a/sys/arch/arm32/podulebus/ptsc.c
+++ /dev/null
@@ -1,485 +0,0 @@
-/* $NetBSD: ptsc.c,v 1.2 1996/03/17 01:24:54 thorpej Exp $ */
-
-/*
- * Copyright (c) 1995 Scott Stevens
- * Copyright (c) 1995 Daniel Widenfalk
- * Copyright (c) 1994 Christian E. Hopps
- * Copyright (c) 1982, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ptsc.c
- */
-/*
- * Power-tec SCSI-2 driver
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-#include <machine/pmap.h>
-#include <machine/io.h>
-#include <machine/irqhandler.h>
-#include <arm32/podulebus/podulebus.h>
-#include <arm32/podulebus/sfasreg.h>
-#include <arm32/podulebus/sfasvar.h>
-#include <arm32/podulebus/ptscreg.h>
-#include <arm32/podulebus/ptscvar.h>
-
-int ptscprint __P((void *auxp, const char *));
-void ptscattach __P((struct device *, struct device *, void *));
-int ptscmatch __P((struct device *, void *, void *));
-int ptsc_scsicmd __P((struct scsi_xfer *));
-
-struct scsi_adapter ptsc_scsiswitch = {
- ptsc_scsicmd,
- sfas_minphys,
- 0, /* no lun support */
- 0, /* no lun support */
-};
-
-struct scsi_device ptsc_scsidev = {
- NULL, /* use default error handler */
- NULL, /* do not have a start functio */
- NULL, /* have no async handler */
- NULL, /* Use default done routine */
-};
-
-struct cfattach ptsc_ca = {
- sizeof(struct ptsc_softc), ptscmatch, ptscattach
-};
-
-struct cfdriver ptsc_cd = {
- NULL, "ptsc", DV_DULL, NULL, 0
-};
-
-int ptsc_intr __P((struct sfas_softc *dev));
-int ptsc_setup_dma __P((struct sfas_softc *sc, void *ptr, int len,
- int mode));
-int ptsc_build_dma_chain __P((struct sfas_softc *sc,
- struct sfas_dma_chain *chain, void *p, int l));
-int ptsc_need_bump __P((struct sfas_softc *sc, void *ptr, int len));
-void ptsc_led __P((struct sfas_softc *sc, int mode));
-
-/*
- * if we are a Power-tec SCSI-2 card
- */
-int
-ptscmatch(pdp, match, auxp)
- struct device *pdp;
- void *match, *auxp;
-{
- struct podule_attach_args *pa = (struct podule_attach_args *)auxp;
- int podule;
-
- podule = findpodule(0x5b, 0x107, pa->pa_podule_number);
-
- if (podule == -1)
- return(0);
-
- pa->pa_podule_number = podule;
- pa->pa_podule = &podules[podule];
-
- return(1);
-}
-
-void
-ptscattach(pdp, dp, auxp)
- struct device *pdp;
- struct device *dp;
- void *auxp;
-{
- struct ptsc_softc *sc = (struct ptsc_softc *)dp;
- struct podule_attach_args *pa;
- ptsc_regmap_p rp = &sc->sc_regmap;
- vu_char *fas;
-
- pa = (struct podule_attach_args *)auxp;
- sc->sc_specific.sc_podule_number = pa->pa_podule_number;
- if (sc->sc_specific.sc_podule_number == -1)
- panic("Podule has disappeared !");
-
- sc->sc_specific.sc_podule = &podules[sc->sc_specific.sc_podule_number];
- sc->sc_specific.sc_iobase =
- (vu_char *)sc->sc_specific.sc_podule->fast_base;
-
- rp->chipreset = &sc->sc_specific.sc_iobase[PTSC_CONTROL_CHIPRESET];
- rp->inten = &sc->sc_specific.sc_iobase[PTSC_CONTROL_INTEN];
- rp->status = &sc->sc_specific.sc_iobase[PTSC_STATUS];
- rp->term = &sc->sc_specific.sc_iobase[PTSC_CONTROL_TERM];
- rp->led = &sc->sc_specific.sc_iobase[PTSC_CONTROL_LED];
- fas = &sc->sc_specific.sc_iobase[PTSC_FASOFFSET_BASE];
-
- rp->FAS216.sfas_tc_low = &fas[PTSC_FASOFFSET_TCL];
- rp->FAS216.sfas_tc_mid = &fas[PTSC_FASOFFSET_TCM];
- rp->FAS216.sfas_fifo = &fas[PTSC_FASOFFSET_FIFO];
- rp->FAS216.sfas_command = &fas[PTSC_FASOFFSET_COMMAND];
- rp->FAS216.sfas_dest_id = &fas[PTSC_FASOFFSET_DESTID];
- rp->FAS216.sfas_timeout = &fas[PTSC_FASOFFSET_TIMEOUT];
- rp->FAS216.sfas_syncper = &fas[PTSC_FASOFFSET_PERIOD];
- rp->FAS216.sfas_syncoff = &fas[PTSC_FASOFFSET_OFFSET];
- rp->FAS216.sfas_config1 = &fas[PTSC_FASOFFSET_CONFIG1];
- rp->FAS216.sfas_clkconv = &fas[PTSC_FASOFFSET_CLOCKCONV];
- rp->FAS216.sfas_test = &fas[PTSC_FASOFFSET_TEST];
- rp->FAS216.sfas_config2 = &fas[PTSC_FASOFFSET_CONFIG2];
- rp->FAS216.sfas_config3 = &fas[PTSC_FASOFFSET_CONFIG3];
- rp->FAS216.sfas_tc_high = &fas[PTSC_FASOFFSET_TCH];
- rp->FAS216.sfas_fifo_bot = &fas[PTSC_FASOFFSET_FIFOBOTTOM];
-
- sc->sc_softc.sc_fas = (sfas_regmap_p)rp;
- sc->sc_softc.sc_spec = &sc->sc_specific;
-
- sc->sc_softc.sc_led = ptsc_led;
-
- sc->sc_softc.sc_setup_dma = ptsc_setup_dma;
- sc->sc_softc.sc_build_dma_chain = ptsc_build_dma_chain;
- sc->sc_softc.sc_need_bump = ptsc_need_bump;
-
- sc->sc_softc.sc_clock_freq = 8; /* Power-Tec runs at 8MHz */
- sc->sc_softc.sc_timeout = 250; /* Set default timeout to 250ms */
- sc->sc_softc.sc_config_flags = SFAS_NO_DMA /*| SFAS_NF_DEBUG*/;
- sc->sc_softc.sc_host_id = 7; /* Should check the jumpers */
-
- sc->sc_softc.sc_bump_sz = NBPG;
- sc->sc_softc.sc_bump_pa = 0x0;
-
- sfasinitialize((struct sfas_softc *)sc);
-
- sc->sc_softc.sc_link.adapter_softc = sc;
- sc->sc_softc.sc_link.adapter_target = sc->sc_softc.sc_host_id;
- sc->sc_softc.sc_link.adapter = &ptsc_scsiswitch;
- sc->sc_softc.sc_link.device = &ptsc_scsidev;
- sc->sc_softc.sc_link.openings = 1;
-
- sc->sc_softc.sc_ih.ih_func = ptsc_intr;
- sc->sc_softc.sc_ih.ih_arg = &sc->sc_softc;
- sc->sc_softc.sc_ih.ih_level = IPL_BIO;
-
-/* initialise the card */
- *rp->term = 0;
- *rp->inten = (PTSC_POLL?0:1);
- *rp->led = 0;
-
-#if PTSC_POLL == 0
- if (irq_claim(IRQ_PODULE /*IRQ_EXPCARD0 + sc->sc_specific.sc_podule_number */,
- &sc->sc_softc.sc_ih))
- panic("ptsc: Cannot install IRQ handler");
-#endif
-
- printf("\n");
-
-/* attach all scsi units on us */
- config_found(dp, &sc->sc_softc.sc_link, ptscprint);
-}
-
-/* print diag if pnp is NULL else just extra */
-int
-ptscprint(auxp, pnp)
- void *auxp;
- const char *pnp;
-{
- if (pnp == NULL)
- return(UNCONF);
-
- return(QUIET);
-}
-
-int
-ptsc_intr(dev)
- struct sfas_softc *dev;
-{
- ptsc_regmap_p rp;
- int quickints;
-
- rp = (ptsc_regmap_p)dev->sc_fas;
-
- if (*rp->FAS216.sfas_status & SFAS_STAT_INTERRUPT_PENDING) {
- quickints = 16;
- do {
- dev->sc_status = *rp->FAS216.sfas_status;
- dev->sc_interrupt = *rp->FAS216.sfas_interrupt;
-
- if (dev->sc_interrupt & SFAS_INT_RESELECTED) {
- dev->sc_resel[0] = *rp->FAS216.sfas_fifo;
- dev->sc_resel[1] = *rp->FAS216.sfas_fifo;
- }
-
- sfasintr(dev);
-
- } while((*rp->FAS216.sfas_status & SFAS_STAT_INTERRUPT_PENDING)
- && --quickints);
- }
-
- return(1);
-}
-
-/* Load transfer address into dma register */
-void
-ptsc_set_dma_adr(sc, ptr)
- struct sfas_softc *sc;
- void *ptr;
-{
- ptsc_regmap_p rp;
- unsigned int *p;
- unsigned int d;
-
-#if 0
- printf("ptsc_set_dma_adr(sc = 0x%08x, ptr = 0x%08x)\n", (u_int)sc, (u_int)ptr);
-#endif
- return;
-#if 0
- rp = (ptsc_regmap_p)sc->sc_fas;
-
- d = (unsigned int)ptr;
- p = (unsigned int *)((d & 0xFFFFFF) + (int)rp->dmabase);
-
- *rp->clear=0;
- *p = d;
-#endif
-}
-
-/* Set DMA transfer counter */
-void
-ptsc_set_dma_tc(sc, len)
- struct sfas_softc *sc;
- unsigned int len;
-{
- printf("ptsc_set_dma_tc(sc, len = 0x%08x)", len);
-
- *sc->sc_fas->sfas_tc_low = len; len >>= 8;
- *sc->sc_fas->sfas_tc_mid = len; len >>= 8;
- *sc->sc_fas->sfas_tc_high = len;
-}
-
-/* Set DMA mode */
-void
-ptsc_set_dma_mode(sc, mode)
- struct sfas_softc *sc;
- int mode;
-{
- struct csc_specific *spec;
-
-#if 0
- spec = sc->sc_spec;
-
- spec->portbits = (spec->portbits & ~FLSC_PB_DMA_BITS) | mode;
- *((flsc_regmap_p)sc->sc_fas)->hardbits = spec->portbits;
-#endif
-}
-
-/* Initialize DMA for transfer */
-int
-ptsc_setup_dma(sc, ptr, len, mode)
- struct sfas_softc *sc;
- void *ptr;
- int len;
- int mode;
-{
- int retval;
-
- retval = 0;
-
-#if 0
- printf("ptsc_setup_dma(sc, ptr = 0x%08x, len = 0x%08x, mode = 0x%08x)\n", (u_int)ptr, len, mode);
-#endif
- return(0);
-
-#if 0
- switch(mode) {
- case SFAS_DMA_READ:
- case SFAS_DMA_WRITE:
- flsc_set_dma_adr(sc, ptr);
- if (mode == SFAS_DMA_READ)
- flsc_set_dma_mode(sc,FLSC_PB_ENABLE_DMA | FLSC_PB_DMA_READ);
- else
- flsc_set_dma_mode(sc,FLSC_PB_ENABLE_DMA | FLSC_PB_DMA_WRITE);
-
- flsc_set_dma_tc(sc, len);
- break;
-
- case SFAS_DMA_CLEAR:
- default:
- flsc_set_dma_mode(sc, FLSC_PB_DISABLE_DMA);
- flsc_set_dma_adr(sc, 0);
-
- retval = (*sc->sc_fas->sfas_tc_high << 16) |
- (*sc->sc_fas->sfas_tc_mid << 8) |
- *sc->sc_fas->sfas_tc_low;
-
- flsc_set_dma_tc(sc, 0);
- break;
- }
-
- return(retval);
-#endif
-}
-
-/* Check if address and len is ok for DMA transfer */
-int
-ptsc_need_bump(sc, ptr, len)
- struct sfas_softc *sc;
- void *ptr;
- int len;
-{
- int p;
-
- p = (int)ptr & 0x03;
-
- if (p) {
- p = 4-p;
-
- if (len < 256)
- p = len;
- }
-
- return(p);
-}
-
-/* Interrupt driven routines */
-int
-ptsc_build_dma_chain(sc, chain, p, l)
- struct sfas_softc *sc;
- struct sfas_dma_chain *chain;
- void *p;
- int l;
-{
- vm_offset_t pa, lastpa;
- char *ptr;
- int len, prelen, postlen, max_t, n;
-
-#if 0
- printf("ptsc_build_dma_chain()\n");
-#endif
- return(0);
-
-#if 0
- if (l == 0)
- return(0);
-
-#define set_link(n, p, l, f)\
-do { chain[n].ptr = (p); chain[n].len = (l); chain[n++].flg = (f); } while(0)
-
- n = 0;
-
- if (l < 512)
- set_link(n, (vm_offset_t)p, l, SFAS_CHAIN_BUMP);
- else if ((p >= (void *)0xFF000000)
-#if M68040
- && ((mmutype == MMU_68040) && (p >= (void *)0xFFFC0000))
-#endif
- ) {
- while(l != 0) {
- len = ((l > sc->sc_bump_sz) ? sc->sc_bump_sz : l);
-
- set_link(n, (vm_offset_t)p, len, SFAS_CHAIN_BUMP);
-
- p += len;
- l -= len;
- }
- } else {
- ptr = p;
- len = l;
-
- pa = kvtop(ptr);
- prelen = ((int)ptr & 0x03);
-
- if (prelen) {
- prelen = 4-prelen;
- set_link(n, (vm_offset_t)ptr, prelen, SFAS_CHAIN_BUMP);
- ptr += prelen;
- len -= prelen;
- }
-
- lastpa = 0;
- while(len > 3) {
- pa = kvtop(ptr);
- max_t = NBPG - (pa & PGOFSET);
- if (max_t > len)
- max_t = len;
-
- max_t &= ~3;
-
- if (lastpa == pa)
- sc->sc_chain[n-1].len += max_t;
- else
- set_link(n, pa, max_t, SFAS_CHAIN_DMA);
-
- lastpa = pa+max_t;
-
- ptr += max_t;
- len -= max_t;
- }
-
- if (len)
- set_link(n, (vm_offset_t)ptr, len, SFAS_CHAIN_BUMP);
- }
-
- return(n);
-#endif
-}
-
-/* Turn on/off led */
-void
-ptsc_led(sc, mode)
- struct sfas_softc *sc;
- int mode;
-{
- ptsc_regmap_p rp;
-
- rp = (ptsc_regmap_p)sc->sc_fas;
-
- if (mode) {
- sc->sc_led_status++;
- } else {
- if (sc->sc_led_status)
- sc->sc_led_status--;
- }
- *rp->led = (sc->sc_led_status?1:0);
-}
-
-int
-ptsc_scsicmd(xs)
- struct scsi_xfer *xs;
-{
- /* ensure command is polling for the moment */
-#if PTSC_POLL > 0
- xs->flags |= SCSI_POLL;
-#endif
-#if 0
- printf("Opcode %d\n", (int)(xs->cmd->opcode));
-#endif
- return(sfas_scsicmd(xs));
-}
diff --git a/sys/arch/arm32/podulebus/ptscreg.h b/sys/arch/arm32/podulebus/ptscreg.h
deleted file mode 100644
index 81f01b710e3..00000000000
--- a/sys/arch/arm32/podulebus/ptscreg.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* $NetBSD: ptscreg.h,v 1.1 1996/01/31 23:26:35 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Scott Stevens
- * Copyright (c) 1995 Daniel Widenfalk
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Daniel Widenfalk
- * for the NetBSD Project.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * Power-tec SCSI-2 with FAS216 SCSI interface hardware description.
- */
-
-#ifndef _PTSCREG_H_
-#define _PTSCREG_H_
-
-#include <arm32/podulebus/sfasvar.h>
-
-typedef volatile unsigned short vu_short;
-
-typedef struct ptsc_regmap {
- sfas_regmap_t FAS216;
- vu_char *chipreset;
- vu_char *inten;
- vu_char *status;
- vu_char *term;
- vu_char *led;
-} ptsc_regmap_t;
-typedef ptsc_regmap_t *ptsc_regmap_p;
-
-/* NDA Information */
-#define PTSC_CONTROL_CHIPRESET 0x1018
-#define PTSC_CONTROL_INTEN 0x101c
-#define PTSC_STATUS 0x2000
-#define PTSC_CONTROL_TERM 0x2018
-#define PTSC_CONTROL_LED 0x201c
-#define PTSC_FASOFFSET_BASE 0x3000
-#define PTSC_FASOFFSET_TCL 0x0000
-#define PTSC_FASOFFSET_TCM 0x0040
-#define PTSC_FASOFFSET_FIFO 0x0080
-#define PTSC_FASOFFSET_COMMAND 0x00c0
-#define PTSC_FASOFFSET_DESTID 0x0100
-#define PTSC_FASOFFSET_TIMEOUT 0x0140
-#define PTSC_FASOFFSET_PERIOD 0x0180
-#define PTSC_FASOFFSET_OFFSET 0x01c0
-#define PTSC_FASOFFSET_CONFIG1 0x0200
-#define PTSC_FASOFFSET_CLOCKCONV 0x0240
-#define PTSC_FASOFFSET_TEST 0x0280
-#define PTSC_FASOFFSET_CONFIG2 0x02c0
-#define PTSC_FASOFFSET_CONFIG3 0x0300
-#define PTSC_FASOFFSET_TCH 0x0380
-#define PTSC_FASOFFSET_FIFOBOTTOM 0x03c0
-/* NDA Info end */
-#endif
diff --git a/sys/arch/arm32/podulebus/ptscvar.h b/sys/arch/arm32/podulebus/ptscvar.h
deleted file mode 100644
index 6608eaf2635..00000000000
--- a/sys/arch/arm32/podulebus/ptscvar.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* $NetBSD: ptscvar.h,v 1.1 1996/01/31 23:26:38 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Scott Stevens
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Daniel Widenfalk
- * for the NetBSD Project.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _PTSCVAR_H_
-#define _PTSCVAR_H_
-
-#include <arm32/podulebus/sfasvar.h>
-#include <arm32/podulebus/ptscreg.h>
-
-#define PTSC_POLL 1
-
-struct ptsc_specific {
- vu_char *sc_iobase;
- int sc_podule_number;
- podule_t *sc_podule;
-};
-
-struct ptsc_softc {
- struct sfas_softc sc_softc;
- ptsc_regmap_t sc_regmap;
- struct ptsc_specific sc_specific;
-};
-
-#endif /* _PTSCVAR_H_ */
diff --git a/sys/arch/arm32/podulebus/sbic.c b/sys/arch/arm32/podulebus/sbic.c
deleted file mode 100644
index 01141849910..00000000000
--- a/sys/arch/arm32/podulebus/sbic.c
+++ /dev/null
@@ -1,2947 +0,0 @@
-/* $NetBSD: sbic.c,v 1.2 1996/04/19 20:09:50 mark Exp $ */
-
-/*
- * Copyright (c) 1994 Christian E. Hopps
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: sbic.c,v 1.21 1996/01/07 22:01:54
- */
-#define DEBUG
-/*#define SBIC_DEBUG*/
-/*
- * AMIGA AMD 33C93 scsi adaptor driver
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/kernel.h> /* For hz */
-#include <sys/disklabel.h>
-#include <sys/dkstat.h>
-#include <sys/buf.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-/*#include <machine/pmap.h>
-#include <machine/cpu.h>*/
-#include <machine/io.h>
-#include <machine/irqhandler.h>
-#include <arm32/podulebus/podulebus.h>
-#include <arm32/podulebus/sbicreg.h>
-#include <arm32/podulebus/sbicvar.h>
-#include <arm32/podulebus/ascreg.h>
-
-/* These are for bounce buffers */
-
-/*#include <vm/pmap.h>*/
-
-/* Since I can't find this in any other header files */
-#define SCSI_PHASE(reg) (reg&0x07)
-
-/*
- * SCSI delays
- * In u-seconds, primarily for state changes on the SPC.
- */
-#define SBIC_CMD_WAIT 50000 /* wait per step of 'immediate' cmds */
-#define SBIC_DATA_WAIT 50000 /* wait per data in/out step */
-#define SBIC_INIT_WAIT 50000 /* wait per step (both) during init */
-
-#define b_cylin b_resid
-#define SBIC_WAIT(regs, until, timeo) sbicwait(regs, until, timeo, __LINE__)
-
-extern u_int kvtop();
-
-int sbicicmd __P((struct sbic_softc *, int, int, void *, int, void *, int));
-int sbicgo __P((struct sbic_softc *, struct scsi_xfer *));
-int sbicdmaok __P((struct sbic_softc *, struct scsi_xfer *));
-int sbicwait __P((sbic_regmap_p, char, int , int));
-int sbiccheckdmap __P((void *, u_long, u_long));
-int sbicselectbus __P((struct sbic_softc *, sbic_regmap_p, u_char, u_char, u_char));
-int sbicxfstart __P((sbic_regmap_p, int, u_char, int));
-int sbicxfout __P((sbic_regmap_p regs, int, void *, int));
-int sbicfromscsiperiod __P((struct sbic_softc *, sbic_regmap_p, int));
-int sbictoscsiperiod __P((struct sbic_softc *, sbic_regmap_p, int));
-int sbicintr __P((struct sbic_softc *));
-int sbicpoll __P((struct sbic_softc *));
-int sbicnextstate __P((struct sbic_softc *, u_char, u_char));
-int sbicmsgin __P((struct sbic_softc *));
-int sbicxfin __P((sbic_regmap_p regs, int, void *));
-int sbicabort __P((struct sbic_softc *, sbic_regmap_p, char *));
-void sbicxfdone __P((struct sbic_softc *, sbic_regmap_p, int));
-void sbicerror __P((struct sbic_softc *, sbic_regmap_p, u_char));
-void sbicstart __P((struct sbic_softc *));
-void sbicreset __P((struct sbic_softc *));
-void sbic_scsidone __P((struct sbic_acb *, int));
-void sbic_sched __P((struct sbic_softc *));
-void sbic_save_ptrs __P((struct sbic_softc *, sbic_regmap_p,int,int));
-void sbic_load_ptrs __P((struct sbic_softc *, sbic_regmap_p,int,int));
-
-/*
- * Synch xfer parameters, and timing conversions
- */
-int sbic_min_period = SBIC_SYN_MIN_PERIOD; /* in cycles = f(ICLK,FSn) */
-int sbic_max_offset = SBIC_SYN_MAX_OFFSET; /* pure number */
-
-int sbic_cmd_wait = SBIC_CMD_WAIT;
-int sbic_data_wait = SBIC_DATA_WAIT;
-int sbic_init_wait = SBIC_INIT_WAIT;
-
-/*
- * was broken before.. now if you want this you get it for all drives
- * on sbic controllers.
- */
-u_char sbic_inhibit_sync[8];
-int sbic_enable_reselect = 1;
-int sbic_clock_override = 0;
-int sbic_no_dma = 1; /* was 0 */
-int sbic_parallel_operations = 1;
-
-#ifdef DEBUG
-sbic_regmap_p debug_sbic_regs;
-int sbicdma_ops = 0; /* total DMA operations */
-int sbicdma_bounces = 0; /* number operations using bounce buffer */
-int sbicdma_hits = 0; /* number of DMA chains that were contiguous */
-int sbicdma_misses = 0; /* number of DMA chains that were not contiguous */
-int sbicdma_saves = 0;
-#define QPRINTF(a) if (sbic_debug > 1) printf a
-int sbic_debug = 0;
-int sync_debug = 0;
-int sbic_dma_debug = 0;
-int reselect_debug = 0;
-int report_sense = 0;
-int data_pointer_debug = 0;
-u_char debug_asr, debug_csr, routine;
-void sbictimeout __P((struct sbic_softc *dev));
-void sbic_dump __P((struct sbic_softc *dev));
-
-#define CSR_TRACE_SIZE 32
-#if CSR_TRACE_SIZE
-#define CSR_TRACE(w,c,a,x) do { \
- int s = splbio(); \
- csr_trace[csr_traceptr].whr = (w); csr_trace[csr_traceptr].csr = (c); \
- csr_trace[csr_traceptr].asr = (a); csr_trace[csr_traceptr].xtn = (x); \
-/* dma_cachectl(&csr_trace[csr_traceptr], sizeof(csr_trace[0]));*/ \
- csr_traceptr = (csr_traceptr + 1) & (CSR_TRACE_SIZE - 1); \
-/* dma_cachectl(&csr_traceptr, sizeof(csr_traceptr));*/ \
- splx(s); \
-} while (0)
-int csr_traceptr;
-int csr_tracesize = CSR_TRACE_SIZE;
-struct {
- u_char whr;
- u_char csr;
- u_char asr;
- u_char xtn;
-} csr_trace[CSR_TRACE_SIZE];
-#else
-#define CSR_TRACE
-#endif
-
-#define SBIC_TRACE_SIZE 0
-#if SBIC_TRACE_SIZE
-#define SBIC_TRACE(dev) do { \
- int s = splbio(); \
- sbic_trace[sbic_traceptr].sp = &s; \
- sbic_trace[sbic_traceptr].line = __LINE__; \
- sbic_trace[sbic_traceptr].sr = s; \
- sbic_trace[sbic_traceptr].csr = csr_traceptr; \
-/* dma_cachectl(&sbic_trace[sbic_traceptr], sizeof(sbic_trace[0]));*/ \
- sbic_traceptr = (sbic_traceptr + 1) & (SBIC_TRACE_SIZE - 1); \
-/* dma_cachectl(&sbic_traceptr, sizeof(sbic_traceptr));*/ \
- if (dev) dma_cachectl(dev, sizeof(*dev)); \
- splx(s); \
-} while (0)
-int sbic_traceptr;
-int sbic_tracesize = SBIC_TRACE_SIZE;
-struct {
- void *sp;
- u_short line;
- u_short sr;
- int csr;
-} sbic_trace[SBIC_TRACE_SIZE];
-#else
-#define SBIC_TRACE
-#endif
-
-#else
-#define QPRINTF
-#define CSR_TRACE
-#define SBIC_TRACE
-#endif
-
-/*
- * default minphys routine for sbic based controllers
- */
-void
-sbic_minphys(bp)
- struct buf *bp;
-{
-
- /*
- * No max transfer at this level.
- */
- minphys(bp);
-}
-
-/*
- * Save DMA pointers. Take into account partial transfer. Shut down DMA.
- */
-void
-sbic_save_ptrs(dev, regs, target, lun)
- struct sbic_softc *dev;
- sbic_regmap_p regs;
- int target, lun;
-{
- int count, asr, csr, s;
- unsigned long ptr;
- char *vptr;
- struct sbic_acb* acb;
-
- extern vm_offset_t vm_first_phys;
-
- SBIC_TRACE(dev);
- if( !dev->sc_cur ) return;
- if( !(dev->sc_flags & SBICF_INDMA) ) return; /* DMA not active */
-
- s = splbio();
-
- acb = dev->sc_nexus;
- count = -1;
- do {
- GET_SBIC_asr(regs, asr);
- if( asr & SBIC_ASR_DBR ) {
- printf("sbic_save_ptrs: asr %02x canceled!\n", asr);
- splx(s);
- SBIC_TRACE(dev);
- return;
- }
- } while( asr & (SBIC_ASR_BSY|SBIC_ASR_CIP) );
-
- /* Save important state */
- /* must be done before dmastop */
- acb->sc_dmacmd = dev->sc_dmacmd;
- SBIC_TC_GET(regs, count);
-
- /* Shut down DMA ====CAREFUL==== */
- dev->sc_dmastop(dev);
- dev->sc_flags &= ~SBICF_INDMA;
- SBIC_TC_PUT(regs, 0);
-
-#ifdef DEBUG
- if(!count && sbic_debug) printf("%dcount0",target);
- if(data_pointer_debug == -1)
- printf("SBIC saving target %d data pointers from (%x,%x)%xASR:%02x",
- target, dev->sc_cur->dc_addr, dev->sc_cur->dc_count,
- acb->sc_dmacmd, asr);
-#endif
-
- /* Fixup partial xfers */
- acb->sc_kv.dc_addr += (dev->sc_tcnt - count);
- acb->sc_kv.dc_count -= (dev->sc_tcnt - count);
- acb->sc_pa.dc_addr += (dev->sc_tcnt - count);
- acb->sc_pa.dc_count -= ((dev->sc_tcnt - count)>>1);
-
- acb->sc_tcnt = dev->sc_tcnt = count;
-#ifdef DEBUG
- if(data_pointer_debug)
- printf(" at (%x,%x):%x\n",
- dev->sc_cur->dc_addr, dev->sc_cur->dc_count,count);
- sbicdma_saves++;
-#endif
- splx(s);
- SBIC_TRACE(dev);
-}
-
-
-/*
- * DOES NOT RESTART DMA!!!
- */
-void sbic_load_ptrs(dev, regs, target, lun)
- struct sbic_softc *dev;
- sbic_regmap_p regs;
- int target, lun;
-{
- int i, s, asr, count;
- char* vaddr, * paddr;
- struct sbic_acb *acb;
-
- SBIC_TRACE(dev);
- acb = dev->sc_nexus;
- if( !acb->sc_kv.dc_count ) {
- /* No data to xfer */
- SBIC_TRACE(dev);
- return;
- }
-
- s = splbio();
-
- dev->sc_last = dev->sc_cur = &acb->sc_pa;
- dev->sc_tcnt = acb->sc_tcnt;
- dev->sc_dmacmd = acb->sc_dmacmd;
-
-#ifdef DEBUG
- sbicdma_ops++;
-#endif
- if( !dev->sc_tcnt ) {
- /* sc_tcnt == 0 implies end of segment */
-
- /* do kvm to pa mappings */
-#if 0 /* mark */
- paddr = acb->sc_pa.dc_addr =
- (char *) kvtop(acb->sc_kv.dc_addr);
-#endif
- vaddr = acb->sc_kv.dc_addr;
- count = acb->sc_kv.dc_count;
-#if 0 /* mark */
- for(count = (NBPG - ((int)vaddr & PGOFSET));
- count < acb->sc_kv.dc_count
- && (char*)kvtop(vaddr + count + 4) == paddr + count + 4;
- count += NBPG);
-#endif
- /* If it's all contiguous... */
- if(count > acb->sc_kv.dc_count ) {
- count = acb->sc_kv.dc_count;
-#ifdef DEBUG
- sbicdma_hits++;
-#endif
- } else {
-#ifdef DEBUG
- sbicdma_misses++;
-#endif
- }
- acb->sc_tcnt = count;
- acb->sc_pa.dc_count = count >> 1;
-
-#ifdef DEBUG
- if(data_pointer_debug)
- printf("DMA recalc:kv(%x,%x)pa(%x,%x)\n",
- acb->sc_kv.dc_addr,
- acb->sc_kv.dc_count,
- acb->sc_pa.dc_addr,
- acb->sc_tcnt);
-#endif
- }
- splx(s);
-#ifdef DEBUG
- if(data_pointer_debug)
- printf("SBIC restoring target %d data pointers at (%x,%x)%x\n",
- target, dev->sc_cur->dc_addr, dev->sc_cur->dc_count,
- dev->sc_dmacmd);
-#endif
- SBIC_TRACE(dev);
-}
-
-/*
- * used by specific sbic controller
- *
- * it appears that the higher level code does nothing with LUN's
- * so I will too. I could plug it in, however so could they
- * in scsi_scsi_cmd().
- */
-int
-sbic_scsicmd(xs)
- struct scsi_xfer *xs;
-{
- struct sbic_acb *acb;
- struct sbic_softc *dev;
- struct scsi_link *slp;
- int flags, s, stat;
-
- slp = xs->sc_link;
- dev = slp->adapter_softc;
- SBIC_TRACE(dev);
- flags = xs->flags;
-
- if (flags & SCSI_DATA_UIO)
- panic("sbic: scsi data uio requested");
-
- if (dev->sc_nexus && flags & SCSI_POLL)
- panic("sbic_scsicmd: busy");
-
- if (slp->target == slp->adapter_target)
- return ESCAPE_NOT_SUPPORTED;
-
- s = splbio();
- acb = dev->free_list.tqh_first;
- if (acb)
- TAILQ_REMOVE(&dev->free_list, acb, chain);
- splx(s);
-
- if (acb == NULL) {
-#ifdef DEBUG
- printf("sbic_scsicmd: unable to queue request for target %d\n",
- slp->target);
-#ifdef DDB
- Debugger();
-#endif
-#endif
- xs->error = XS_DRIVER_STUFFUP;
- SBIC_TRACE(dev);
- return(TRY_AGAIN_LATER);
- }
-
- acb->flags = ACB_ACTIVE;
- if (flags & SCSI_DATA_IN)
- acb->flags |= ACB_DATAIN;
- acb->xs = xs;
- bcopy(xs->cmd, &acb->cmd, xs->cmdlen);
- acb->clen = xs->cmdlen;
- acb->sc_kv.dc_addr = xs->data;
- acb->sc_kv.dc_count = xs->datalen;
-#if 0
- acb->pa_addr = xs->data ? (char *)kvtop(xs->data) : 0; /* XXXX check */
-#endif
- if (flags & SCSI_POLL) {
- s = splbio();
- /*
- * This has major side effects -- it locks up the machine
- */
-
- dev->sc_flags |= SBICF_ICMD;
- do {
- while(dev->sc_nexus)
- sbicpoll(dev);
- dev->sc_nexus = acb;
- dev->sc_stat[0] = -1;
- dev->sc_xs = xs;
- dev->target = slp->target;
- dev->lun = slp->lun;
- stat = sbicicmd(dev, slp->target, slp->lun,
- &acb->cmd, acb->clen,
- acb->sc_kv.dc_addr, acb->sc_kv.dc_count);
- } while (dev->sc_nexus != acb);
- sbic_scsidone(acb, stat);
-
- splx(s);
- SBIC_TRACE(dev);
- return(COMPLETE);
- }
-
- s = splbio();
- TAILQ_INSERT_TAIL(&dev->ready_list, acb, chain);
-
- if (dev->sc_nexus) {
- splx(s);
- SBIC_TRACE(dev);
- return(SUCCESSFULLY_QUEUED);
- }
-
- /*
- * nothing is active, try to start it now.
- */
- sbic_sched(dev);
- splx(s);
-
- SBIC_TRACE(dev);
-/* TODO: add sbic_poll to do SCSI_POLL operations */
-#if 0
- if (flags & SCSI_POLL)
- return(COMPLETE);
-#endif
- return(SUCCESSFULLY_QUEUED);
-}
-
-/*
- * attempt to start the next available command
- */
-void
-sbic_sched(dev)
- struct sbic_softc *dev;
-{
- struct scsi_xfer *xs;
- struct scsi_link *slp;
- struct sbic_acb *acb;
- int flags, /*phase,*/ stat, i;
-
- SBIC_TRACE(dev);
- if (dev->sc_nexus)
- return; /* a command is current active */
-
- SBIC_TRACE(dev);
- for (acb = dev->ready_list.tqh_first; acb; acb = acb->chain.tqe_next) {
- slp = acb->xs->sc_link;
- i = slp->target;
- if (!(dev->sc_tinfo[i].lubusy & (1 << slp->lun))) {
- struct sbic_tinfo *ti = &dev->sc_tinfo[i];
-
- TAILQ_REMOVE(&dev->ready_list, acb, chain);
- dev->sc_nexus = acb;
- slp = acb->xs->sc_link;
- ti = &dev->sc_tinfo[slp->target];
- ti->lubusy |= (1 << slp->lun);
- acb->sc_pa.dc_addr = acb->pa_addr; /* XXXX check */
- break;
- }
- }
-
- SBIC_TRACE(dev);
- if (acb == NULL)
- return; /* did not find an available command */
-
- dev->sc_xs = xs = acb->xs;
- slp = xs->sc_link;
- flags = xs->flags;
-
- if (flags & SCSI_RESET)
- sbicreset(dev);
-
-#ifdef DEBUG
- if( data_pointer_debug > 1 )
- printf("sbic_sched(%d,%d)\n",slp->target,slp->lun);
-#endif
- dev->sc_stat[0] = -1;
- dev->target = slp->target;
- dev->lun = slp->lun;
- if ( flags & SCSI_POLL || ( !sbic_parallel_operations
- && (/*phase == STATUS_PHASE ||*/
- sbicdmaok(dev, xs) == 0) ) )
- stat = sbicicmd(dev, slp->target, slp->lun, &acb->cmd,
- acb->clen, acb->sc_kv.dc_addr, acb->sc_kv.dc_count);
- else if (sbicgo(dev, xs) == 0) {
- SBIC_TRACE(dev);
- return;
- } else
- stat = dev->sc_stat[0];
-
- sbic_scsidone(acb, stat);
- SBIC_TRACE(dev);
-}
-
-void
-sbic_scsidone(acb, stat)
- struct sbic_acb *acb;
- int stat;
-{
- struct scsi_xfer *xs;
- struct scsi_link *slp;
- struct sbic_softc *dev;
- int s, dosched = 0;
-
- xs = acb->xs;
- slp = xs->sc_link;
- dev = slp->adapter_softc;
- SBIC_TRACE(dev);
-#ifdef DIAGNOSTIC
- if (acb == NULL || xs == NULL) {
- printf("sbic_scsidone -- (%d,%d) no scsi_xfer\n",
- dev->target, dev->lun);
-#ifdef DDB
- Debugger();
-#endif
- return;
- }
-#endif
- /*
- * XXX Support old-style instrumentation for now.
- * IS THIS REALLY THE RIGHT PLACE FOR THIS? --thorpej
- */
- if (slp->device_softc &&
- ((struct device *)(slp->device_softc))->dv_unit < dk_ndrive)
- ++dk_xfer[((struct device *)(slp->device_softc))->dv_unit];
- /*
- * is this right?
- */
- xs->status = stat;
-
-#ifdef DEBUG
- if( data_pointer_debug > 1 )
- printf("scsidone: (%d,%d)->(%d,%d)%02x\n",
- slp->target, slp->lun,
- dev->target, dev->lun, stat);
- if( xs->sc_link->target == dev->sc_link.adapter_target )
- panic("target == hostid");
-#endif
-
- if (xs->error == XS_NOERROR && !(acb->flags & ACB_CHKSENSE)) {
- if (stat == SCSI_CHECK) {
- /* Schedule a REQUEST SENSE */
- struct scsi_sense *ss = (void *)&acb->cmd;
-#ifdef DEBUG
- if (report_sense)
- printf("sbic_scsidone: autosense %02x targ %d lun %d",
- acb->cmd.opcode, slp->target, slp->lun);
-#endif
- bzero(ss, sizeof(*ss));
- ss->opcode = REQUEST_SENSE;
- ss->byte2 = slp->lun << 5;
- ss->length = sizeof(struct scsi_sense_data);
- acb->clen = sizeof(*ss);
- acb->sc_kv.dc_addr = (char *)&xs->sense;
- acb->sc_kv.dc_count = sizeof(struct scsi_sense_data);
-#if 0
- acb->pa_addr = (char *)kvtop(&xs->sense); /* XXX check */
-#endif
- acb->flags = ACB_ACTIVE | ACB_CHKSENSE | ACB_DATAIN;
- TAILQ_INSERT_HEAD(&dev->ready_list, acb, chain);
- dev->sc_tinfo[slp->target].lubusy &=
- ~(1 << slp->lun);
- dev->sc_tinfo[slp->target].senses++;
- if (dev->sc_nexus == acb) {
- dev->sc_nexus = NULL;
- dev->sc_xs = NULL;
- sbic_sched(dev);
- }
- SBIC_TRACE(dev);
- return;
- }
- }
- if (xs->error == XS_NOERROR && (acb->flags & ACB_CHKSENSE)) {
- xs->error = XS_SENSE;
-#ifdef DEBUG
- if (report_sense)
- printf(" => %02x %02x\n", xs->sense.flags,
- xs->sense.extra_bytes[3]);
-#endif
- } else {
- xs->resid = 0; /* XXXX */
- }
-#if whataboutthisone
- case SCSI_BUSY:
- xs->error = XS_BUSY;
- break;
-#endif
- xs->flags |= ITSDONE;
-
- /*
- * Remove the ACB from whatever queue it's on. We have to do a bit of
- * a hack to figure out which queue it's on. Note that it is *not*
- * necessary to cdr down the ready queue, but we must cdr down the
- * nexus queue and see if it's there, so we can mark the unit as no
- * longer busy. This code is sickening, but it works.
- */
- if (acb == dev->sc_nexus) {
- dev->sc_nexus = NULL;
- dev->sc_xs = NULL;
- dev->sc_tinfo[slp->target].lubusy &= ~(1<<slp->lun);
- if (dev->ready_list.tqh_first)
- dosched = 1; /* start next command */
- } else if (dev->ready_list.tqh_last == &acb->chain.tqe_next) {
- TAILQ_REMOVE(&dev->ready_list, acb, chain);
- } else {
- register struct sbic_acb *acb2;
- for (acb2 = dev->nexus_list.tqh_first; acb2;
- acb2 = acb2->chain.tqe_next) {
- if (acb2 == acb) {
- TAILQ_REMOVE(&dev->nexus_list, acb, chain);
- dev->sc_tinfo[slp->target].lubusy
- &= ~(1<<slp->lun);
- break;
- }
- }
- if (acb2)
- ;
- else if (acb->chain.tqe_next) {
- TAILQ_REMOVE(&dev->ready_list, acb, chain);
- } else {
- printf("%s: can't find matching acb\n",
- dev->sc_dev.dv_xname);
-#ifdef DDB
- Debugger();
-#endif
- }
- }
- /* Put it on the free list. */
- acb->flags = ACB_FREE;
- TAILQ_INSERT_HEAD(&dev->free_list, acb, chain);
-
- dev->sc_tinfo[slp->target].cmds++;
-
- scsi_done(xs);
-
- if (dosched)
- sbic_sched(dev);
- SBIC_TRACE(dev);
-}
-
-int
-sbicdmaok(dev, xs)
- struct sbic_softc *dev;
- struct scsi_xfer *xs;
-{
- if (sbic_no_dma || xs->datalen & 0x1 || (u_int)xs->data & 0x3)
- return(0);
- /*
- * controller supports dma to any addresses?
- */
- else if ((dev->sc_flags & SBICF_BADDMA) == 0)
- return(1);
- /*
- * this address is ok for dma?
- */
- else if (sbiccheckdmap(xs->data, xs->datalen, dev->sc_dmamask) == 0)
- return(1);
- /*
- * we have a bounce buffer?
- */
- else if (dev->sc_tinfo[xs->sc_link->target].bounce)
- return(1);
- /*
- * try to get one
- */
- else if (dev->sc_tinfo[xs->sc_link->target].bounce
- = (char *)alloc_z2mem(MAXPHYS)) {
- if (isztwomem(dev->sc_tinfo[xs->sc_link->target].bounce))
- printf("alloc ZII target %d bounce pa 0x%x\n",
- xs->sc_link->target,
- kvtop(dev->sc_tinfo[xs->sc_link->target].bounce));
- else if (dev->sc_tinfo[xs->sc_link->target].bounce)
- printf("alloc CHIP target %d bounce pa 0x%x\n",
- xs->sc_link->target,
- PREP_DMA_MEM(dev->sc_tinfo[xs->sc_link->target].bounce));
- return(1);
- }
-
- return(0);
-}
-
-
-int
-sbicwait(regs, until, timeo, line)
- sbic_regmap_p regs;
- char until;
- int timeo;
- int line;
-{
- u_char val;
- int csr;
-
- SBIC_TRACE((struct sbic_softc *)0);
- if (timeo == 0)
- timeo = 1000000; /* some large value.. */
-
- GET_SBIC_asr(regs,val);
- while ((val & until) == 0) {
- if (timeo-- == 0) {
- GET_SBIC_csr(regs, csr);
- printf("sbicwait TIMEO @%d with asr=x%x csr=x%x\n",
- line, val, csr);
-#if defined(DDB) && defined(DEBUG)
- Debugger();
-#endif
- return(val); /* Maybe I should abort */
- break;
- }
- DELAY(1);
- GET_SBIC_asr(regs,val);
- }
- SBIC_TRACE((struct sbic_softc *)0);
- return(val);
-}
-
-int
-sbicabort(dev, regs, where)
- struct sbic_softc *dev;
- sbic_regmap_p regs;
- char *where;
-{
- u_char csr, asr;
-
- GET_SBIC_asr(regs, asr);
- GET_SBIC_csr(regs, csr);
-
- printf ("%s: abort %s: csr = 0x%02x, asr = 0x%02x\n",
- dev->sc_dev.dv_xname, where, csr, asr);
-
-
-#if 0
- /* Clean up running command */
- if (dev->sc_nexus != NULL) {
- dev->sc_nexus->xs->error = XS_DRIVER_STUFFUP;
- sbic_scsidone(dev->sc_nexus, dev->sc_stat[0]);
- }
- while (acb = dev->nexus_list.tqh_first) {
- acb->xs->error = XS_DRIVER_STUFFUP;
- sbic_scsidone(acb, -1 /*acb->stat[0]*/);
- }
-#endif
-
- /* Clean up chip itself */
- if (dev->sc_flags & SBICF_SELECTED) {
- while( asr & SBIC_ASR_DBR ) {
- /* sbic is jammed w/data. need to clear it */
- /* But we don't know what direction it needs to go */
- GET_SBIC_data(regs, asr);
- printf("%s: abort %s: clearing data buffer 0x%02x\n",
- dev->sc_dev.dv_xname, where, asr);
- GET_SBIC_asr(regs, asr);
- if( asr & SBIC_ASR_DBR ) /* Not the read direction, then */
- SET_SBIC_data(regs, asr);
- GET_SBIC_asr(regs, asr);
- }
- WAIT_CIP(regs);
-printf("%s: sbicabort - sending ABORT command\n", dev->sc_dev.dv_xname);
- SET_SBIC_cmd(regs, SBIC_CMD_ABORT);
- WAIT_CIP(regs);
-
- GET_SBIC_asr(regs, asr);
- if (asr & (SBIC_ASR_BSY|SBIC_ASR_LCI)) {
- /* ok, get more drastic.. */
-
-printf("%s: sbicabort - asr %x, trying to reset\n", dev->sc_dev.dv_xname, asr);
- sbicreset(dev);
- dev->sc_flags &= ~SBICF_SELECTED;
- return -1;
- }
-printf("%s: sbicabort - sending DISC command\n", dev->sc_dev.dv_xname);
- SET_SBIC_cmd(regs, SBIC_CMD_DISC);
-
- do {
- asr = SBIC_WAIT (regs, SBIC_ASR_INT, 0);
- GET_SBIC_csr (regs, csr);
- CSR_TRACE('a',csr,asr,0);
- } while ((csr != SBIC_CSR_DISC) && (csr != SBIC_CSR_DISC_1)
- && (csr != SBIC_CSR_CMD_INVALID));
-
- /* lets just hope it worked.. */
- dev->sc_flags &= ~SBICF_SELECTED;
- }
- return -1;
-}
-
-
-/*
- * Initialize driver-private structures
- */
-
-void
-sbicinit(dev)
- struct sbic_softc *dev;
-{
- sbic_regmap_p regs;
- u_int my_id, i, s;
- u_char csr;
- struct sbic_acb *acb;
- u_int inhibit_sync;
-
- extern u_long scsi_nosync;
- extern int shift_nosync;
-
-#ifdef SBIC_DEBUG
- printf("sbicinit:\n");
-#endif
-
- regs = dev->sc_sbicp;
-
- if ((dev->sc_flags & SBICF_ALIVE) == 0) {
- TAILQ_INIT(&dev->ready_list);
- TAILQ_INIT(&dev->nexus_list);
- TAILQ_INIT(&dev->free_list);
- dev->sc_nexus = NULL;
- dev->sc_xs = NULL;
- acb = dev->sc_acb;
- bzero(acb, sizeof(dev->sc_acb));
-#ifdef SBIC_DEBUG
- printf("sbicinit: %d\n", __LINE__);
-#endif
-
- for (i = 0; i < sizeof(dev->sc_acb) / sizeof(*acb); i++) {
- TAILQ_INSERT_TAIL(&dev->free_list, acb, chain);
- acb++;
- }
- bzero(dev->sc_tinfo, sizeof(dev->sc_tinfo));
-#ifdef DEBUG
- /* make sure timeout is really not needed */
- timeout((void *)sbictimeout, dev, 30 * hz);
-#endif
-
- } else panic("sbic: reinitializing driver!");
-
-#ifdef SBIC_DEBUG
- printf("sbicinit: %d\n", __LINE__);
-#endif
-
- dev->sc_flags |= SBICF_ALIVE;
- dev->sc_flags &= ~SBICF_SELECTED;
-
- /* initialize inhibit array */
- if (scsi_nosync) {
-#ifdef SBIC_DEBUG
- printf("sbicinit: %d\n", __LINE__);
-#endif
- inhibit_sync = (scsi_nosync >> shift_nosync) & 0xff;
- shift_nosync += 8;
-#ifdef DEBUG
- if (inhibit_sync)
- printf("%s: Inhibiting synchronous transfer %02x\n",
- dev->sc_dev.dv_xname, inhibit_sync);
-#endif
- for (i = 0; i < 8; ++i)
- if (inhibit_sync & (1 << i))
- sbic_inhibit_sync[i] = 1;
- }
-
-#ifdef SBIC_DEBUG
- printf("sbicinit: %d\n", __LINE__);
-#endif
-
- sbicreset(dev);
-}
-
-void
-sbicreset(dev)
- struct sbic_softc *dev;
-{
- sbic_regmap_p regs;
- u_int my_id, i, s;
- u_char csr;
- struct sbic_acb *acb;
-
-#ifdef SBIC_DEBUG
- printf("sbicreset: %d\n", __LINE__);
-#endif
-
- regs = dev->sc_sbicp;
-
-#ifdef SBIC_DEBUG
- printf("sbicreset: regs = %08x\n", regs);
-#endif
-#if 0
- if (dev->sc_flags & SBICF_ALIVE) {
- SET_SBIC_cmd(regs, SBIC_CMD_ABORT);
- WAIT_CIP(regs);
- }
-#else
- SET_SBIC_cmd(regs, SBIC_CMD_ABORT);
-#ifdef SBIC_DEBUG
- printf("sbicreset: %d\n", __LINE__);
-#endif
- WAIT_CIP(regs);
-#ifdef SBIC_DEBUG
- printf("sbicreset: %d\n", __LINE__);
-#endif
-#endif
- s = splbio();
- my_id = dev->sc_link.adapter_target & SBIC_ID_MASK;
-
- /* Enable advanced mode */
- my_id |= SBIC_ID_EAF /*| SBIC_ID_EHP*/ ;
- SET_SBIC_myid(regs, my_id);
-#ifdef SBIC_DEBUG
- printf("sbicreset: %d\n", __LINE__);
-#endif
-
- /*
- * Disable interrupts (in dmainit) then reset the chip
- */
- SET_SBIC_cmd(regs, SBIC_CMD_RESET);
- DELAY(25);
- SBIC_WAIT(regs, SBIC_ASR_INT, 0);
- GET_SBIC_csr(regs, csr); /* clears interrupt also */
-
- if (dev->sc_clkfreq < 110)
- my_id |= SBIC_ID_FS_8_10;
- else if (dev->sc_clkfreq < 160)
- my_id |= SBIC_ID_FS_12_15;
- else if (dev->sc_clkfreq < 210)
- my_id |= SBIC_ID_FS_16_20;
-
- SET_SBIC_myid(regs, my_id);
-#ifdef SBIC_DEBUG
- printf("sbicreset: %d\n", __LINE__);
-#endif
-
- /*
- * Set up various chip parameters
- */
- SET_SBIC_control(regs, SBIC_CTL_EDI | SBIC_CTL_IDI /* | SBIC_CTL_HSP */
- | SBIC_MACHINE_DMA_MODE);
- /*
- * don't allow (re)selection (SBIC_RID_ES)
- * until we can handle target mode!!
- */
- SET_SBIC_rselid(regs, SBIC_RID_ER);
- SET_SBIC_syn(regs, 0); /* asynch for now */
-
- /*
- * anything else was zeroed by reset
- */
- splx(s);
-
-#if 0
- if ((dev->sc_flags & SBICF_ALIVE) == 0) {
- TAILQ_INIT(&dev->ready_list);
- TAILQ_INIT(&dev->nexus_list);
- TAILQ_INIT(&dev->free_list);
- dev->sc_nexus = NULL;
- dev->sc_xs = NULL;
- acb = dev->sc_acb;
- bzero(acb, sizeof(dev->sc_acb));
- for (i = 0; i < sizeof(dev->sc_acb) / sizeof(*acb); i++) {
- TAILQ_INSERT_TAIL(&dev->free_list, acb, chain);
- acb++;
- }
- bzero(dev->sc_tinfo, sizeof(dev->sc_tinfo));
- } else {
- if (dev->sc_nexus != NULL) {
- dev->sc_nexus->xs->error = XS_DRIVER_STUFFUP;
- sbic_scsidone(dev->sc_nexus, dev->sc_stat[0]);
- }
- while (acb = dev->nexus_list.tqh_first) {
- acb->xs->error = XS_DRIVER_STUFFUP;
- sbic_scsidone(acb, -1 /*acb->stat[0]*/);
- }
- }
-
- dev->sc_flags |= SBICF_ALIVE;
-#endif
- dev->sc_flags &= ~SBICF_SELECTED;
-}
-
-void
-sbicerror(dev, regs, csr)
- struct sbic_softc *dev;
- sbic_regmap_p regs;
- u_char csr;
-{
- struct scsi_xfer *xs;
-
- xs = dev->sc_xs;
-
-#ifdef DIAGNOSTIC
- if (xs == NULL)
- panic("sbicerror");
-#endif
- if (xs->flags & SCSI_SILENT)
- return;
-
- printf("%s: ", dev->sc_dev.dv_xname);
- printf("csr == 0x%02x\n", csr); /* XXX */
-}
-
-/*
- * select the bus, return when selected or error.
- */
-int
-sbicselectbus(dev, regs, target, lun, our_addr)
- struct sbic_softc *dev;
- sbic_regmap_p regs;
- u_char target, lun, our_addr;
-{
- u_char asr, csr, id;
-
- SBIC_TRACE(dev);
- QPRINTF(("sbicselectbus %d\n", target));
-
- /*
- * if we're already selected, return (XXXX panic maybe?)
- */
- if (dev->sc_flags & SBICF_SELECTED) {
- SBIC_TRACE(dev);
- return(1);
- }
-
- /*
- * issue select
- */
- SBIC_TC_PUT(regs, 0);
- SET_SBIC_selid(regs, target);
- SET_SBIC_timeo(regs, SBIC_TIMEOUT(250,dev->sc_clkfreq));
-
- /*
- * set sync or async
- */
- if (dev->sc_sync[target].state == SYNC_DONE)
- SET_SBIC_syn(regs, SBIC_SYN (dev->sc_sync[target].offset,
- dev->sc_sync[target].period));
- else
- SET_SBIC_syn(regs, SBIC_SYN (0, sbic_min_period));
-
- GET_SBIC_asr(regs, asr);
- if( asr & (SBIC_ASR_INT|SBIC_ASR_BSY) ) {
- /* This means we got ourselves reselected upon */
-/* printf("sbicselectbus: INT/BSY asr %02x\n", asr);*/
-#ifdef DDB
-/* Debugger();*/
-#endif
- SBIC_TRACE(dev);
- return 1;
- }
-
- SET_SBIC_cmd(regs, SBIC_CMD_SEL_ATN);
-
- /*
- * wait for select (merged from separate function may need
- * cleanup)
- */
- WAIT_CIP(regs);
- do {
- asr = SBIC_WAIT(regs, SBIC_ASR_INT | SBIC_ASR_LCI, 0);
- if (asr & SBIC_ASR_LCI) {
-#ifdef DEBUG
- if (reselect_debug)
- printf("sbicselectbus: late LCI asr %02x\n", asr);
-#endif
- SBIC_TRACE(dev);
- return 1;
- }
- GET_SBIC_csr (regs, csr);
- CSR_TRACE('s',csr,asr,target);
- QPRINTF(("%02x ", csr));
- if( csr == SBIC_CSR_RSLT_NI || csr == SBIC_CSR_RSLT_IFY) {
-#ifdef DEBUG
- if(reselect_debug)
- printf("sbicselectbus: reselected asr %02x\n", asr);
-#endif
- /* We need to handle this now so we don't lock up later */
- sbicnextstate(dev, csr, asr);
- SBIC_TRACE(dev);
- return 1;
- }
- if( csr == SBIC_CSR_SLT || csr == SBIC_CSR_SLT_ATN) {
- panic("sbicselectbus: target issued select!");
- return 1;
- }
- } while (csr != (SBIC_CSR_MIS_2|MESG_OUT_PHASE)
- && csr != (SBIC_CSR_MIS_2|CMD_PHASE) && csr != SBIC_CSR_SEL_TIMEO);
-
- /* Enable (or not) reselection */
- if(!sbic_enable_reselect && dev->nexus_list.tqh_first == NULL)
- SET_SBIC_rselid (regs, 0);
- else
- SET_SBIC_rselid (regs, SBIC_RID_ER);
-
- if (csr == (SBIC_CSR_MIS_2|CMD_PHASE)) {
- dev->sc_flags |= SBICF_SELECTED; /* device ignored ATN */
- GET_SBIC_selid(regs, id);
- dev->target = id;
- GET_SBIC_tlun(regs,dev->lun);
- if( dev->lun & SBIC_TLUN_VALID )
- dev->lun &= SBIC_TLUN_MASK;
- else
- dev->lun = lun;
- } else if (csr == (SBIC_CSR_MIS_2|MESG_OUT_PHASE)) {
- /*
- * Send identify message
- * (SCSI-2 requires an identify msg (?))
- */
- GET_SBIC_selid(regs, id);
- dev->target = id;
- GET_SBIC_tlun(regs,dev->lun);
- if( dev->lun & SBIC_TLUN_VALID )
- dev->lun &= SBIC_TLUN_MASK;
- else
- dev->lun = lun;
- /*
- * handle drives that don't want to be asked
- * whether to go sync at all.
- */
- if (sbic_inhibit_sync[id]
- && dev->sc_sync[id].state == SYNC_START) {
-#ifdef DEBUG
- if (sync_debug)
- printf("Forcing target %d asynchronous.\n", id);
-#endif
- dev->sc_sync[id].offset = 0;
- dev->sc_sync[id].period = sbic_min_period;
- dev->sc_sync[id].state = SYNC_DONE;
- }
-
-
- if (dev->sc_sync[id].state != SYNC_START){
- if( dev->sc_xs->flags & SCSI_POLL
- || (dev->sc_flags & SBICF_ICMD)
- || !sbic_enable_reselect )
- SEND_BYTE (regs, MSG_IDENTIFY | lun);
- else
- SEND_BYTE (regs, MSG_IDENTIFY_DR | lun);
- } else {
- /*
- * try to initiate a sync transfer.
- * So compose the sync message we're going
- * to send to the target
- */
-
-#ifdef DEBUG
- if (sync_debug)
- printf("Sending sync request to target %d ... ",
- id);
-#endif
- /*
- * setup scsi message sync message request
- */
- dev->sc_msg[0] = MSG_IDENTIFY | lun;
- dev->sc_msg[1] = MSG_EXT_MESSAGE;
- dev->sc_msg[2] = 3;
- dev->sc_msg[3] = MSG_SYNC_REQ;
- dev->sc_msg[4] = sbictoscsiperiod(dev, regs,
- sbic_min_period);
- dev->sc_msg[5] = sbic_max_offset;
-
- if (sbicxfstart(regs, 6, MESG_OUT_PHASE, sbic_cmd_wait))
- sbicxfout(regs, 6, dev->sc_msg, MESG_OUT_PHASE);
-
- dev->sc_sync[id].state = SYNC_SENT;
-#ifdef DEBUG
- if (sync_debug)
- printf ("sent\n");
-#endif
- }
-
- asr = SBIC_WAIT (regs, SBIC_ASR_INT, 0);
- GET_SBIC_csr (regs, csr);
- CSR_TRACE('y',csr,asr,target);
- QPRINTF(("[%02x]", csr));
-#ifdef DEBUG
- if (sync_debug && dev->sc_sync[id].state == SYNC_SENT)
- printf("csr-result of last msgout: 0x%x\n", csr);
-#endif
-
- if (csr != SBIC_CSR_SEL_TIMEO)
- dev->sc_flags |= SBICF_SELECTED;
- }
- if (csr == SBIC_CSR_SEL_TIMEO)
- dev->sc_xs->error = XS_SELTIMEOUT;
-
- QPRINTF(("\n"));
-
- SBIC_TRACE(dev);
- return(csr == SBIC_CSR_SEL_TIMEO);
-}
-
-int
-sbicxfstart(regs, len, phase, wait)
- sbic_regmap_p regs;
- int len, wait;
- u_char phase;
-{
- u_char id;
-
- switch (phase) {
- case DATA_IN_PHASE:
- case MESG_IN_PHASE:
- GET_SBIC_selid (regs, id);
- id |= SBIC_SID_FROM_SCSI;
- SET_SBIC_selid (regs, id);
- SBIC_TC_PUT (regs, (unsigned)len);
- break;
- case DATA_OUT_PHASE:
- case MESG_OUT_PHASE:
- case CMD_PHASE:
- GET_SBIC_selid (regs, id);
- id &= ~SBIC_SID_FROM_SCSI;
- SET_SBIC_selid (regs, id);
- SBIC_TC_PUT (regs, (unsigned)len);
- break;
- default:
- SBIC_TC_PUT (regs, 0);
- }
- QPRINTF(("sbicxfstart %d, %d, %d\n", len, phase, wait));
-
- return(1);
-}
-
-int
-sbicxfout(regs, len, bp, phase)
- sbic_regmap_p regs;
- int len;
- void *bp;
- int phase;
-{
- u_char orig_csr, csr, asr, *buf;
- int wait;
-
- buf = bp;
- wait = sbic_data_wait;
-
- QPRINTF(("sbicxfout {%d} %02x %02x %02x %02x %02x "
- "%02x %02x %02x %02x %02x\n", len, buf[0], buf[1], buf[2],
- buf[3], buf[4], buf[5], buf[6], buf[7], buf[8], buf[9]));
-
- GET_SBIC_csr (regs, orig_csr);
- CSR_TRACE('>',orig_csr,0,0);
-
- /*
- * sigh.. WD-PROTO strikes again.. sending the command in one go
- * causes the chip to lock up if talking to certain (misbehaving?)
- * targets. Anyway, this procedure should work for all targets, but
- * it's slightly slower due to the overhead
- */
- WAIT_CIP (regs);
- SET_SBIC_cmd (regs, SBIC_CMD_XFER_INFO);
- for (;len > 0; len--) {
- GET_SBIC_asr (regs, asr);
- while ((asr & SBIC_ASR_DBR) == 0) {
- if ((asr & SBIC_ASR_INT) || --wait < 0) {
-#ifdef DEBUG
- if (sbic_debug)
- printf("sbicxfout fail: l%d i%x w%d\n",
- len, asr, wait);
-#endif
- return (len);
- }
-/* DELAY(1);*/
- GET_SBIC_asr (regs, asr);
- }
-
- SET_SBIC_data (regs, *buf);
- buf++;
- }
- SBIC_TC_GET(regs, len);
- QPRINTF(("sbicxfout done %d bytes\n", len));
- /*
- * this leaves with one csr to be read
- */
- return(0);
-}
-
-/* returns # bytes left to read */
-int
-sbicxfin(regs, len, bp)
- sbic_regmap_p regs;
- int len;
- void *bp;
-{
- int wait, read;
- u_char *obp, *buf;
- u_char orig_csr, csr, asr;
-
- wait = sbic_data_wait;
- obp = bp;
- buf = bp;
-
- GET_SBIC_csr (regs, orig_csr);
- CSR_TRACE('<',orig_csr,0,0);
-
- QPRINTF(("sbicxfin %d, csr=%02x\n", len, orig_csr));
-
- WAIT_CIP (regs);
- SET_SBIC_cmd (regs, SBIC_CMD_XFER_INFO);
- for (;len > 0; len--) {
- GET_SBIC_asr (regs, asr);
- if((asr & SBIC_ASR_PE)) {
-#ifdef DEBUG
- printf("sbicxfin parity error: l%d i%x w%d\n",
- len, asr, wait);
-/* return ((unsigned long)buf - (unsigned long)bp); */
-#ifdef DDB
- Debugger();
-#endif
-#endif
- }
- while ((asr & SBIC_ASR_DBR) == 0) {
- if ((asr & SBIC_ASR_INT) || --wait < 0) {
-#ifdef DEBUG
- if (sbic_debug) {
- QPRINTF(("sbicxfin fail:{%d} %02x %02x %02x %02x %02x %02x "
- "%02x %02x %02x %02x\n", len, obp[0], obp[1], obp[2],
- obp[3], obp[4], obp[5], obp[6], obp[7], obp[8], obp[9]));
- printf("sbicxfin fail: l%d i%x w%d\n",
- len, asr, wait);
-}
-#endif
- return len;
- }
-
- if( ! asr & SBIC_ASR_BSY ) {
- GET_SBIC_csr(regs, csr);
- CSR_TRACE('<',csr,asr,len);
- QPRINTF(("[CSR%02xASR%02x]", csr, asr));
- }
-
-/* DELAY(1);*/
- GET_SBIC_asr (regs, asr);
- }
-
- GET_SBIC_data (regs, *buf);
-/* QPRINTF(("asr=%02x, csr=%02x, data=%02x\n", asr, csr, *buf));*/
- buf++;
- }
-
- QPRINTF(("sbicxfin {%d} %02x %02x %02x %02x %02x %02x "
- "%02x %02x %02x %02x\n", len, obp[0], obp[1], obp[2],
- obp[3], obp[4], obp[5], obp[6], obp[7], obp[8], obp[9]));
-
- /* this leaves with one csr to be read */
- return len;
-}
-
-/*
- * SCSI 'immediate' command: issue a command to some SCSI device
- * and get back an 'immediate' response (i.e., do programmed xfer
- * to get the response data). 'cbuf' is a buffer containing a scsi
- * command of length clen bytes. 'buf' is a buffer of length 'len'
- * bytes for data. The transfer direction is determined by the device
- * (i.e., by the scsi bus data xfer phase). If 'len' is zero, the
- * command must supply no data.
- */
-int
-sbicicmd(dev, target, lun, cbuf, clen, buf, len)
- struct sbic_softc *dev;
- void *cbuf, *buf;
- int clen, len;
-{
- sbic_regmap_p regs;
- u_char phase, csr, asr;
- int wait, newtarget, cmd_sent, parity_err;
- struct sbic_acb *acb;
-
- int discon;
- int i;
-
-#define CSR_LOG_BUF_SIZE 0
-#if CSR_LOG_BUF_SIZE
- int bufptr;
- int csrbuf[CSR_LOG_BUF_SIZE];
- bufptr=0;
-#endif
-
- SBIC_TRACE(dev);
- regs = dev->sc_sbicp;
- acb = dev->sc_nexus;
-
- /* Make sure pointers are OK */
- dev->sc_last = dev->sc_cur = &acb->sc_pa;
- dev->sc_tcnt = acb->sc_tcnt = 0;
- acb->sc_pa.dc_count = 0; /* No DMA */
- acb->sc_kv.dc_addr = buf;
- acb->sc_kv.dc_count = len;
-
-#ifdef DEBUG
- routine = 3;
- debug_sbic_regs = regs; /* store this to allow debug calls */
- if( data_pointer_debug > 1 )
- printf("sbicicmd(%d,%d):%d\n", target, lun,
- acb->sc_kv.dc_count);
-#endif
-
- /*
- * set the sbic into non-DMA mode
- */
- SET_SBIC_control(regs, SBIC_CTL_EDI | SBIC_CTL_IDI /*| SBIC_CTL_HSP*/);
-
- dev->sc_stat[0] = 0xff;
- dev->sc_msg[0] = 0xff;
- i = 1; /* pre-load */
-
- /* We're stealing the SCSI bus */
- dev->sc_flags |= SBICF_ICMD;
-
- do {
- /*
- * select the SCSI bus (it's an error if bus isn't free)
- */
- if (!( dev->sc_flags & SBICF_SELECTED )
- && sbicselectbus(dev, regs, target, lun, dev->sc_scsiaddr)) {
- /*printf("sbicicmd trying to select busy bus!\n");*/
- dev->sc_flags &= ~SBICF_ICMD;
- return(-1);
- }
-
- /*
- * Wait for a phase change (or error) then let the device sequence
- * us through the various SCSI phases.
- */
-
- wait = sbic_cmd_wait;
-
- asr = GET_SBIC_asr (regs, asr);
- GET_SBIC_csr (regs, csr);
- CSR_TRACE('I',csr,asr,target);
- QPRINTF((">ASR:%02xCSR:%02x<", asr, csr));
-
-#if CSR_LOG_BUF_SIZE
- csrbuf[bufptr++] = csr;
-#endif
-
-
- switch (csr) {
- case SBIC_CSR_S_XFERRED:
- case SBIC_CSR_DISC:
- case SBIC_CSR_DISC_1:
- dev->sc_flags &= ~SBICF_SELECTED;
- GET_SBIC_cmd_phase (regs, phase);
- if (phase == 0x60) {
- GET_SBIC_tlun (regs, dev->sc_stat[0]);
- i = 0; /* done */
-/* break; /* Bypass all the state gobldygook */
- } else {
-#ifdef DEBUG
- if(reselect_debug>1)
- printf("sbicicmd: handling disconnect\n");
-#endif
- i = SBIC_STATE_DISCONNECT;
- }
- break;
-
- case SBIC_CSR_XFERRED|CMD_PHASE:
- case SBIC_CSR_MIS|CMD_PHASE:
- case SBIC_CSR_MIS_1|CMD_PHASE:
- case SBIC_CSR_MIS_2|CMD_PHASE:
- if (sbicxfstart(regs, clen, CMD_PHASE, sbic_cmd_wait))
- if (sbicxfout(regs, clen,
- cbuf, CMD_PHASE))
- i = sbicabort(dev, regs,"icmd sending cmd");
-#if 0
- GET_SBIC_csr(regs, csr); /* Lets us reload tcount */
- WAIT_CIP(regs);
- GET_SBIC_asr(regs, asr);
- CSR_TRACE('I',csr,asr,target);
- if( asr & (SBIC_ASR_BSY|SBIC_ASR_LCI|SBIC_ASR_CIP) )
- printf("next: cmd sent asr %02x, csr %02x\n",
- asr, csr);
-#endif
- break;
-
-#if 0
- case SBIC_CSR_XFERRED|DATA_OUT_PHASE:
- case SBIC_CSR_XFERRED|DATA_IN_PHASE:
- case SBIC_CSR_MIS|DATA_OUT_PHASE:
- case SBIC_CSR_MIS|DATA_IN_PHASE:
- case SBIC_CSR_MIS_1|DATA_OUT_PHASE:
- case SBIC_CSR_MIS_1|DATA_IN_PHASE:
- case SBIC_CSR_MIS_2|DATA_OUT_PHASE:
- case SBIC_CSR_MIS_2|DATA_IN_PHASE:
- if (acb->sc_kv.dc_count <= 0)
- i = sbicabort(dev, regs, "icmd out of data");
- else {
- wait = sbic_data_wait;
- if (sbicxfstart(regs,
- acb->sc_kv.dc_count,
- SBIC_PHASE(csr), wait))
- if (csr & 0x01)
- /* data in? */
- i=sbicxfin(regs,
- acb->sc_kv.dc_count,
- acb->sc_kv.dc_addr);
- else
- i=sbicxfout(regs,
- acb->sc_kv.dc_count,
- acb->sc_kv.dc_addr,
- SBIC_PHASE(csr));
- acb->sc_kv.dc_addr +=
- (acb->sc_kv.dc_count - i);
- acb->sc_kv.dc_count = i;
- i = 1;
- }
- break;
-
-#endif
- case SBIC_CSR_XFERRED|STATUS_PHASE:
- case SBIC_CSR_MIS|STATUS_PHASE:
- case SBIC_CSR_MIS_1|STATUS_PHASE:
- case SBIC_CSR_MIS_2|STATUS_PHASE:
- /*
- * the sbic does the status/cmd-complete reading ok,
- * so do this with its hi-level commands.
- */
-#ifdef DEBUG
- if(sbic_debug)
- printf("SBICICMD status phase\n");
-#endif
- SBIC_TC_PUT(regs, 0);
- SET_SBIC_cmd_phase(regs, 0x46);
- SET_SBIC_cmd(regs, SBIC_CMD_SEL_ATN_XFER);
- break;
-
-#if THIS_IS_A_RESERVED_STATE
- case BUS_FREE_PHASE: /* This is not legal */
- if( dev->sc_stat[0] != 0xff )
- goto out;
- break;
-#endif
-
- default:
- i = sbicnextstate(dev, csr, asr);
- }
-
- /*
- * make sure the last command was taken,
- * ie. we're not hunting after an ignored command..
- */
- GET_SBIC_asr(regs, asr);
-
- /* tapes may take a loooong time.. */
- while (asr & SBIC_ASR_BSY){
- if(asr & SBIC_ASR_DBR) {
- printf("sbicicmd: Waiting while sbic is jammed, CSR:%02x,ASR:%02x\n",
- csr,asr);
-#ifdef DDB
- Debugger();
-#endif
- /* SBIC is jammed */
- /* DUNNO which direction */
- /* Try old direction */
- GET_SBIC_data(regs,i);
- GET_SBIC_asr(regs, asr);
- if( asr & SBIC_ASR_DBR) /* Wants us to write */
- SET_SBIC_data(regs,i);
- }
- GET_SBIC_asr(regs, asr);
- }
-
- /*
- * wait for last command to complete
- */
- if (asr & SBIC_ASR_LCI) {
- printf("sbicicmd: last command ignored\n");
- }
- else if( i == 1 ) /* Bsy */
- SBIC_WAIT (regs, SBIC_ASR_INT, wait);
-
- /*
- * do it again
- */
- } while ( i > 0 && dev->sc_stat[0] == 0xff);
-
- /* Sometimes we need to do an extra read of the CSR */
- GET_SBIC_csr(regs, csr);
- CSR_TRACE('I',csr,asr,0xff);
-
-#if CSR_LOG_BUF_SIZE
- if(reselect_debug>1)
- for(i=0; i<bufptr; i++)
- printf("CSR:%02x", csrbuf[i]);
-#endif
-
-#ifdef DEBUG
- if(data_pointer_debug > 1)
- printf("sbicicmd done(%d,%d):%d =%d=\n",
- dev->target, lun,
- acb->sc_kv.dc_count,
- dev->sc_stat[0]);
-#endif
-
- QPRINTF(("=STS:%02x=", dev->sc_stat[0]));
- dev->sc_flags &= ~SBICF_ICMD;
-
- SBIC_TRACE(dev);
- return(dev->sc_stat[0]);
-}
-
-/*
- * Finish SCSI xfer command: After the completion interrupt from
- * a read/write operation, sequence through the final phases in
- * programmed i/o. This routine is a lot like sbicicmd except we
- * skip (and don't allow) the select, cmd out and data in/out phases.
- */
-void
-sbicxfdone(dev, regs, target)
- struct sbic_softc *dev;
- sbic_regmap_p regs;
- int target;
-{
- u_char phase, asr, csr;
- int s;
-
- SBIC_TRACE(dev);
- QPRINTF(("{"));
- s = splbio();
-
- /*
- * have the sbic complete on its own
- */
- SBIC_TC_PUT(regs, 0);
- SET_SBIC_cmd_phase(regs, 0x46);
- SET_SBIC_cmd(regs, SBIC_CMD_SEL_ATN_XFER);
-
- do {
- asr = SBIC_WAIT (regs, SBIC_ASR_INT, 0);
- GET_SBIC_csr (regs, csr);
- CSR_TRACE('f',csr,asr,target);
- QPRINTF(("%02x:", csr));
- } while ((csr != SBIC_CSR_DISC) && (csr != SBIC_CSR_DISC_1)
- && (csr != SBIC_CSR_S_XFERRED));
-
- dev->sc_flags &= ~SBICF_SELECTED;
-
- GET_SBIC_cmd_phase (regs, phase);
- QPRINTF(("}%02x", phase));
- if (phase == 0x60)
- GET_SBIC_tlun(regs, dev->sc_stat[0]);
- else
- sbicerror(dev, regs, csr);
-
- QPRINTF(("=STS:%02x=\n", dev->sc_stat[0]));
- splx(s);
- SBIC_TRACE(dev);
-}
-
- /*
- * No DMA chains
- */
-
-int
-sbicgo(dev, xs)
- struct sbic_softc *dev;
- struct scsi_xfer *xs;
-{
- int i, dmaflags, count, wait, usedma;
- u_char csr, asr, cmd, *addr;
- sbic_regmap_p regs;
- struct sbic_acb *acb;
-
- SBIC_TRACE(dev);
- dev->target = xs->sc_link->target;
- dev->lun = xs->sc_link->lun;
- acb = dev->sc_nexus;
- regs = dev->sc_sbicp;
-
- usedma = sbicdmaok(dev, xs);
-#ifdef DEBUG
- routine = 1;
- debug_sbic_regs = regs; /* store this to allow debug calls */
- if( data_pointer_debug > 1 )
- printf("sbicgo(%d,%d)\n", dev->target, dev->lun);
-#endif
-
- /*
- * set the sbic into DMA mode
- */
- if( usedma )
- SET_SBIC_control(regs, SBIC_CTL_EDI | SBIC_CTL_IDI |
- SBIC_MACHINE_DMA_MODE);
- else
- SET_SBIC_control(regs, SBIC_CTL_EDI | SBIC_CTL_IDI);
-
-
- /*
- * select the SCSI bus (it's an error if bus isn't free)
- */
- if (sbicselectbus(dev, regs, dev->target, dev->lun,
- dev->sc_scsiaddr)) {
-/* printf("sbicgo: Trying to select busy bus!\n"); */
- SBIC_TRACE(dev);
- return(0); /* Not done: needs to be rescheduled */
- }
- dev->sc_stat[0] = 0xff;
-
- /*
- * Calculate DMA chains now
- */
-
- dmaflags = 0;
- if (acb->flags & ACB_DATAIN)
- dmaflags |= DMAGO_READ;
-
-
- /*
- * Deal w/bounce buffers.
- */
-
- addr = acb->sc_kv.dc_addr;
- count = acb->sc_kv.dc_count;
-#if 0 /* mark */
- if (count && (char *)kvtop(addr) != acb->sc_pa.dc_addr) { /* XXXX check */
- printf("sbic: DMA buffer mapping changed %x->%x\n",
- acb->sc_pa.dc_addr, kvtop(addr));
-#ifdef DDB
- Debugger();
-#endif
- }
-#endif
-
-#ifdef DEBUG
- ++sbicdma_ops; /* count total DMA operations */
-#endif
- if (count && usedma && dev->sc_flags & SBICF_BADDMA &&
- sbiccheckdmap(addr, count, dev->sc_dmamask)) {
- /*
- * need to bounce the dma.
- */
- if (dmaflags & DMAGO_READ) {
- acb->flags |= ACB_BBUF;
- acb->sc_dmausrbuf = addr;
- acb->sc_dmausrlen = count;
- acb->sc_usrbufpa = (u_char *)kvtop(addr);
- if(!dev->sc_tinfo[dev->target].bounce) {
- printf("sbicgo: HELP! no bounce allocated for %d\n",
- dev->target);
- printf("xfer: (%x->%x,%x)\n", acb->sc_dmausrbuf,
- acb->sc_usrbufpa, acb->sc_dmausrlen);
- dev->sc_tinfo[xs->sc_link->target].bounce
- = (char *)alloc_z2mem(MAXPHYS);
- if (isztwomem(dev->sc_tinfo[xs->sc_link->target].bounce))
- printf("alloc ZII target %d bounce pa 0x%x\n",
- xs->sc_link->target,
- kvtop(dev->sc_tinfo[xs->sc_link->target].bounce));
- else if (dev->sc_tinfo[xs->sc_link->target].bounce)
- printf("alloc CHIP target %d bounce pa 0x%x\n",
- xs->sc_link->target,
- PREP_DMA_MEM(dev->sc_tinfo[xs->sc_link->target].bounce));
-
- printf("Allocating %d bounce at %x\n",
- dev->target,
- kvtop(dev->sc_tinfo[dev->target].bounce));
- }
- } else { /* write: copy to dma buffer */
-#ifdef DEBUG
- if(data_pointer_debug)
- printf("sbicgo: copying %x bytes to target %d bounce %x\n",
- count, dev->target,
- kvtop(dev->sc_tinfo[dev->target].bounce));
-#endif
- bcopy (addr, dev->sc_tinfo[dev->target].bounce, count);
- }
- addr = dev->sc_tinfo[dev->target].bounce;/* and use dma buffer */
- acb->sc_kv.dc_addr = addr;
-#ifdef DEBUG
- ++sbicdma_bounces; /* count number of bounced */
-#endif
- }
-
- /*
- * Allocate the DMA chain
- */
-
- /* Set start KVM addresses */
-#if 0
- acb->sc_kv.dc_addr = addr;
- acb->sc_kv.dc_count = count;
-#endif
-
- /* Mark end of segment */
- acb->sc_tcnt = dev->sc_tcnt = 0;
- acb->sc_pa.dc_count = 0;
-
- sbic_load_ptrs(dev, regs, dev->target, dev->lun);
- SBIC_TRACE(dev);
- /* Enable interrupts but don't do any DMA */
- dev->sc_enintr(dev);
- if (usedma) {
- dev->sc_tcnt = dev->sc_dmago(dev, acb->sc_pa.dc_addr,
- acb->sc_pa.dc_count,
- dmaflags);
-#ifdef DEBUG
- dev->sc_dmatimo = dev->sc_tcnt ? 1 : 0;
-#endif
- } else
- dev->sc_dmacmd = 0; /* Don't use DMA */
- dev->sc_flags |= SBICF_INDMA;
-/* SBIC_TC_PUT(regs, dev->sc_tcnt); /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
- SBIC_TRACE(dev);
- sbic_save_ptrs(dev, regs, dev->target, dev->lun);
-
- /*
- * push the data cache ( I think this won't work (EH))
- */
-#if defined(M68040)
- if (mmutype == MMU_68040 && usedma && count) {
- dma_cachectl(addr, count);
- if (((u_int)addr & 0xF) || (((u_int)addr + count) & 0xF))
- dev->sc_flags |= SBICF_DCFLUSH;
- }
-#endif
-
- /*
- * enintr() also enables interrupts for the sbic
- */
-#ifdef DEBUG
- if( data_pointer_debug > 1 )
- printf("sbicgo dmago:%d(%x:%x)\n",
- dev->target,dev->sc_cur->dc_addr,dev->sc_tcnt);
- debug_asr = asr;
- debug_csr = csr;
-#endif
-
- /*
- * Lets cycle a while then let the interrupt handler take over
- */
-
- asr = GET_SBIC_asr(regs, asr);
- do {
- GET_SBIC_csr(regs, csr);
- CSR_TRACE('g',csr,asr,dev->target);
-#ifdef DEBUG
- debug_csr = csr;
- routine = 1;
-#endif
- QPRINTF(("go[0x%x]", csr));
-
- i = sbicnextstate(dev, csr, asr);
-
- WAIT_CIP(regs);
- GET_SBIC_asr(regs, asr);
-#ifdef DEBUG
- debug_asr = asr;
-#endif
- if(asr & SBIC_ASR_LCI) printf("sbicgo: LCI asr:%02x csr:%02x\n",
- asr,csr);
- } while( i == SBIC_STATE_RUNNING
- && asr & (SBIC_ASR_INT|SBIC_ASR_LCI) );
-
- CSR_TRACE('g',csr,asr,i<<4);
- SBIC_TRACE(dev);
-if (i == SBIC_STATE_DONE && dev->sc_stat[0] == 0xff) printf("sbicgo: done & stat = 0xff\n");
- if (i == SBIC_STATE_DONE && dev->sc_stat[0] != 0xff) {
-/* if( i == SBIC_STATE_DONE && dev->sc_stat[0] ) { */
- /* Did we really finish that fast? */
- return 1;
- }
- return 0;
-}
-
-
-int
-sbicintr(dev)
- struct sbic_softc *dev;
-{
- sbic_regmap_p regs;
- struct dma_chain *df, *dl;
- u_char asr, csr, *tmpaddr;
- struct sbic_acb *acb;
- int i, newtarget, newlun;
- unsigned tcnt;
-
- regs = dev->sc_sbicp;
-
- /*
- * pending interrupt?
- */
- GET_SBIC_asr (regs, asr);
- if ((asr & SBIC_ASR_INT) == 0)
- return(0);
-
- SBIC_TRACE(dev);
- do {
- GET_SBIC_csr(regs, csr);
- CSR_TRACE('i',csr,asr,dev->target);
-#ifdef DEBUG
- debug_csr = csr;
- routine = 2;
-#endif
- QPRINTF(("intr[0x%x]", csr));
-
- i = sbicnextstate(dev, csr, asr);
-
- WAIT_CIP(regs);
- GET_SBIC_asr(regs, asr);
-#ifdef DEBUG
- debug_asr = asr;
-#endif
-#if 0
- if(asr & SBIC_ASR_LCI) printf("sbicintr: LCI asr:%02x csr:%02x\n",
- asr,csr);
-#endif
- } while(i == SBIC_STATE_RUNNING &&
- asr & (SBIC_ASR_INT|SBIC_ASR_LCI));
- CSR_TRACE('i',csr,asr,i<<4);
- SBIC_TRACE(dev);
- return(1);
-}
-
-/*
- * Run commands and wait for disconnect
- */
-int
-sbicpoll(dev)
- struct sbic_softc *dev;
-{
- sbic_regmap_p regs;
- u_char asr, csr;
- struct sbic_pending* pendp;
- int i;
- unsigned tcnt;
-
- SBIC_TRACE(dev);
- regs = dev->sc_sbicp;
-
- do {
- GET_SBIC_asr (regs, asr);
-#ifdef DEBUG
- debug_asr = asr;
-#endif
- GET_SBIC_csr(regs, csr);
- CSR_TRACE('p',csr,asr,dev->target);
-#ifdef DEBUG
- debug_csr = csr;
- routine = 2;
-#endif
- QPRINTF(("poll[0x%x]", csr));
-
- i = sbicnextstate(dev, csr, asr);
-
- WAIT_CIP(regs);
- GET_SBIC_asr(regs, asr);
- /* tapes may take a loooong time.. */
- while (asr & SBIC_ASR_BSY){
- if(asr & SBIC_ASR_DBR) {
- printf("sbipoll: Waiting while sbic is jammed, CSR:%02x,ASR:%02x\n",
- csr,asr);
-#ifdef DDB
- Debugger();
-#endif
- /* SBIC is jammed */
- /* DUNNO which direction */
- /* Try old direction */
- GET_SBIC_data(regs,i);
- GET_SBIC_asr(regs, asr);
- if( asr & SBIC_ASR_DBR) /* Wants us to write */
- SET_SBIC_data(regs,i);
- }
- GET_SBIC_asr(regs, asr);
- }
-
- if(asr & SBIC_ASR_LCI) printf("sbicpoll: LCI asr:%02x csr:%02x\n",
- asr,csr);
- else if( i == 1 ) /* BSY */
- SBIC_WAIT(regs, SBIC_ASR_INT, sbic_cmd_wait);
- } while(i == SBIC_STATE_RUNNING);
- CSR_TRACE('p',csr,asr,i<<4);
- SBIC_TRACE(dev);
- return(1);
-}
-
-/*
- * Handle a single msgin
- */
-
-int
-sbicmsgin(dev)
- struct sbic_softc *dev;
-{
- sbic_regmap_p regs;
- int recvlen;
- u_char asr, csr, *tmpaddr;
-
- regs = dev->sc_sbicp;
-
- dev->sc_msg[0] = 0xff;
- dev->sc_msg[1] = 0xff;
-
- GET_SBIC_asr(regs, asr);
-#ifdef DEBUG
- if(reselect_debug>1)
- printf("sbicmsgin asr=%02x\n", asr);
-#endif
-
- sbic_save_ptrs(dev, regs, dev->target, dev->lun);
-
- GET_SBIC_selid (regs, csr);
- SET_SBIC_selid (regs, csr | SBIC_SID_FROM_SCSI);
-
- SBIC_TC_PUT(regs, 0);
- tmpaddr = dev->sc_msg;
- recvlen = 1;
- do {
- while( recvlen-- ) {
- asr = GET_SBIC_asr(regs, asr);
- GET_SBIC_csr(regs, csr);
- QPRINTF(("sbicmsgin ready to go (csr,asr)=(%02x,%02x)\n",
- csr, asr));
-
- RECV_BYTE(regs, *tmpaddr);
- CSR_TRACE('m',csr,asr,*tmpaddr);
-#if 1
- /*
- * get the command completion interrupt, or we
- * can't send a new command (LCI)
- */
- SBIC_WAIT(regs, SBIC_ASR_INT, 0);
- GET_SBIC_csr(regs, csr);
- CSR_TRACE('X',csr,asr,dev->target);
-#else
- WAIT_CIP(regs);
- do {
- GET_SBIC_asr(regs, asr);
- csr = 0xff;
- GET_SBIC_csr(regs, csr);
- CSR_TRACE('X',csr,asr,dev->target);
- if( csr == 0xff )
- printf("sbicmsgin waiting: csr %02x asr %02x\n", csr, asr);
- } while( csr == 0xff );
-#endif
-#ifdef DEBUG
- if(reselect_debug>1)
- printf("sbicmsgin: got %02x csr %02x asr %02x\n",
- *tmpaddr, csr, asr);
-#endif
-#if do_parity_check
- if( asr & SBIC_ASR_PE ) {
- printf ("Parity error");
- /* This code simply does not work. */
- WAIT_CIP(regs);
- SET_SBIC_cmd(regs, SBIC_CMD_SET_ATN);
- WAIT_CIP(regs);
- GET_SBIC_asr(regs, asr);
- WAIT_CIP(regs);
- SET_SBIC_cmd(regs, SBIC_CMD_CLR_ACK);
- WAIT_CIP(regs);
- if( !(asr & SBIC_ASR_LCI) )
- /* Target wants to send garbled msg*/
- continue;
- printf("--fixing\n");
- /* loop until a msgout phase occurs on target */
- while(csr & 0x07 != MESG_OUT_PHASE) {
- while( asr & SBIC_ASR_BSY &&
- !(asr & SBIC_ASR_DBR|SBIC_ASR_INT) )
- GET_SBIC_asr(regs, asr);
- if( asr & SBIC_ASR_DBR )
- panic("msgin: jammed again!");
- GET_SBIC_csr(regs, csr);
- CSR_TRACE('e',csr,asr,dev->target);
- if( csr & 0x07 != MESG_OUT_PHASE ) {
- sbicnextstate(dev, csr, asr);
- sbic_save_ptrs(dev, regs,
- dev->target,
- dev->lun);
- }
- }
- /* Should be msg out by now */
- SEND_BYTE(regs, MSG_PARITY_ERROR);
- }
- else
-#endif
- tmpaddr++;
-
- if(recvlen) {
- /* Clear ACK */
- WAIT_CIP(regs);
- GET_SBIC_asr(regs, asr);
- GET_SBIC_csr(regs, csr);
- CSR_TRACE('X',csr,asr,dev->target);
- QPRINTF(("sbicmsgin pre byte CLR_ACK (csr,asr)=(%02x,%02x)\n",
- csr, asr));
- SET_SBIC_cmd(regs, SBIC_CMD_CLR_ACK);
- SBIC_WAIT(regs, SBIC_ASR_INT, 0);
- }
-
- };
-
- if(dev->sc_msg[0] == 0xff) {
- printf("sbicmsgin: sbic swallowed our message\n");
- break;
- }
-#ifdef DEBUG
- if (sync_debug)
- printf("msgin done csr 0x%x asr 0x%x msg 0x%x\n",
- csr, asr, dev->sc_msg[0]);
-#endif
- /*
- * test whether this is a reply to our sync
- * request
- */
- if (MSG_ISIDENTIFY(dev->sc_msg[0])) {
- QPRINTF(("IFFY"));
-#if 0
- /* There is an implied load-ptrs here */
- sbic_load_ptrs(dev, regs, dev->target, dev->lun);
-#endif
- /* Got IFFY msg -- ack it */
- } else if (dev->sc_msg[0] == MSG_REJECT
- && dev->sc_sync[dev->target].state == SYNC_SENT) {
- QPRINTF(("REJECT of SYN"));
-#ifdef DEBUG
- if (sync_debug)
- printf("target %d rejected sync, going async\n",
- dev->target);
-#endif
- dev->sc_sync[dev->target].period = sbic_min_period;
- dev->sc_sync[dev->target].offset = 0;
- dev->sc_sync[dev->target].state = SYNC_DONE;
- SET_SBIC_syn(regs,
- SBIC_SYN(dev->sc_sync[dev->target].offset,
- dev->sc_sync[dev->target].period));
- } else if ((dev->sc_msg[0] == MSG_REJECT)) {
- QPRINTF(("REJECT"));
- /*
- * we'll never REJECt a REJECT message..
- */
- } else if ((dev->sc_msg[0] == MSG_SAVE_DATA_PTR)) {
- QPRINTF(("MSG_SAVE_DATA_PTR"));
- /*
- * don't reject this either.
- */
- } else if ((dev->sc_msg[0] == MSG_DISCONNECT)) {
- QPRINTF(("DISCONNECT"));
-#ifdef DEBUG
- if( reselect_debug>1 && dev->sc_msg[0] == MSG_DISCONNECT )
- printf("sbicmsgin: got disconnect msg %s\n",
- (dev->sc_flags & SBICF_ICMD)?"rejecting":"");
-#endif
- if( dev->sc_flags & SBICF_ICMD ) {
- /* We're in immediate mode. Prevent disconnects. */
- /* prepare to reject the message, NACK */
- SET_SBIC_cmd(regs, SBIC_CMD_SET_ATN);
- WAIT_CIP(regs);
- }
- } else if (dev->sc_msg[0] == MSG_CMD_COMPLETE ) {
- QPRINTF(("CMD_COMPLETE"));
- /* !! KLUDGE ALERT !! quite a few drives don't seem to
- * really like the current way of sending the
- * sync-handshake together with the ident-message, and
- * they react by sending command-complete and
- * disconnecting right after returning the valid sync
- * handshake. So, all I can do is reselect the drive,
- * and hope it won't disconnect again. I don't think
- * this is valid behavior, but I can't help fixing a
- * problem that apparently exists.
- *
- * Note: we should not get here on `normal' command
- * completion, as that condition is handled by the
- * high-level sel&xfer resume command used to walk
- * thru status/cc-phase.
- */
-
-#ifdef DEBUG
- if (sync_debug)
- printf ("GOT MSG %d! target %d acting weird.."
- " waiting for disconnect...\n",
- dev->sc_msg[0], dev->target);
-#endif
- /* Check to see if sbic is handling this */
- GET_SBIC_asr(regs, asr);
- if(asr & SBIC_ASR_BSY)
- return SBIC_STATE_RUNNING;
-
- /* Let's try this: Assume it works and set status to 00 */
- dev->sc_stat[0] = 0;
- } else if (dev->sc_msg[0] == MSG_EXT_MESSAGE
- && tmpaddr == &dev->sc_msg[1]) {
- QPRINTF(("ExtMSG\n"));
- /* Read in whole extended message */
- SET_SBIC_cmd(regs, SBIC_CMD_CLR_ACK);
- SBIC_WAIT(regs, SBIC_ASR_INT, 0);
- GET_SBIC_asr(regs, asr);
- GET_SBIC_csr(regs, csr);
- QPRINTF(("CLR ACK asr %02x, csr %02x\n", asr, csr));
- RECV_BYTE(regs, *tmpaddr);
- CSR_TRACE('x',csr,asr,*tmpaddr);
- /* Wait for command completion IRQ */
- SBIC_WAIT(regs, SBIC_ASR_INT, 0);
- recvlen = *tmpaddr++;
- QPRINTF(("Recving ext msg, asr %02x csr %02x len %02x\n",
- asr, csr, recvlen));
- } else if (dev->sc_msg[0] == MSG_EXT_MESSAGE && dev->sc_msg[1] == 3
- && dev->sc_msg[2] == MSG_SYNC_REQ) {
- QPRINTF(("SYN"));
- dev->sc_sync[dev->target].period =
- sbicfromscsiperiod(dev,
- regs, dev->sc_msg[3]);
- dev->sc_sync[dev->target].offset = dev->sc_msg[4];
- dev->sc_sync[dev->target].state = SYNC_DONE;
- SET_SBIC_syn(regs,
- SBIC_SYN(dev->sc_sync[dev->target].offset,
- dev->sc_sync[dev->target].period));
- printf("%s: target %d now synchronous,"
- " period=%dns, offset=%d.\n",
- dev->sc_dev.dv_xname, dev->target,
- dev->sc_msg[3] * 4, dev->sc_msg[4]);
- } else {
-#ifdef DEBUG
- if (sbic_debug || sync_debug)
- printf ("sbicmsgin: Rejecting message 0x%02x\n",
- dev->sc_msg[0]);
-#endif
- /* prepare to reject the message, NACK */
- SET_SBIC_cmd(regs, SBIC_CMD_SET_ATN);
- WAIT_CIP(regs);
- }
- /* Clear ACK */
- WAIT_CIP(regs);
- GET_SBIC_asr(regs, asr);
- GET_SBIC_csr(regs, csr);
- CSR_TRACE('X',csr,asr,dev->target);
- QPRINTF(("sbicmsgin pre CLR_ACK (csr,asr)=(%02x,%02x)%d\n",
- csr, asr, recvlen));
- SET_SBIC_cmd(regs, SBIC_CMD_CLR_ACK);
- SBIC_WAIT(regs, SBIC_ASR_INT, 0);
- }
-#if 0
- while((csr == SBIC_CSR_MSGIN_W_ACK)
- || (SBIC_PHASE(csr) == MESG_IN_PHASE));
-#else
- while (recvlen>0);
-#endif
-
- QPRINTF(("sbicmsgin finished: csr %02x, asr %02x\n",csr, asr));
-
- /* Should still have one CSR to read */
- return SBIC_STATE_RUNNING;
-}
-
-
-/*
- * sbicnextstate()
- * return:
- * 0 == done
- * 1 == working
- * 2 == disconnected
- * -1 == error
- */
-int
-sbicnextstate(dev, csr, asr)
- struct sbic_softc *dev;
- u_char csr, asr;
-{
- sbic_regmap_p regs;
- struct dma_chain *df, *dl;
- struct sbic_acb *acb;
- int i, newtarget, newlun, wait;
- unsigned tcnt;
-
- SBIC_TRACE(dev);
- regs = dev->sc_sbicp;
- acb = dev->sc_nexus;
-
- QPRINTF(("next[%02x,%02x]",asr,csr));
-
- switch (csr) {
- case SBIC_CSR_XFERRED|CMD_PHASE:
- case SBIC_CSR_MIS|CMD_PHASE:
- case SBIC_CSR_MIS_1|CMD_PHASE:
- case SBIC_CSR_MIS_2|CMD_PHASE:
- sbic_save_ptrs(dev, regs, dev->target, dev->lun);
- if (sbicxfstart(regs, acb->clen, CMD_PHASE, sbic_cmd_wait))
- if (sbicxfout(regs, acb->clen,
- &acb->cmd, CMD_PHASE))
- goto abort;
- break;
-
- case SBIC_CSR_XFERRED|STATUS_PHASE:
- case SBIC_CSR_MIS|STATUS_PHASE:
- case SBIC_CSR_MIS_1|STATUS_PHASE:
- case SBIC_CSR_MIS_2|STATUS_PHASE:
- /*
- * this should be the normal i/o completion case.
- * get the status & cmd complete msg then let the
- * device driver look at what happened.
- */
- sbicxfdone(dev,regs,dev->target);
- /*
- * check for overlapping cache line, flush if so
- */
-#ifdef M68040
- if (dev->sc_flags & SBICF_DCFLUSH) {
-#if 0
- printf("sbic: 68040 DMA cache flush needs fixing? %x:%x\n",
- dev->sc_xs->data, dev->sc_xs->datalen);
-#endif
- }
-#endif
-#ifdef DEBUG
- if( data_pointer_debug > 1 )
- printf("next dmastop: %d(%x:%x)\n",
- dev->target,dev->sc_cur->dc_addr,dev->sc_tcnt);
- dev->sc_dmatimo = 0;
-#endif
- dev->sc_dmastop(dev); /* was dmafree */
- if (acb->flags & ACB_BBUF) {
- if ((u_char *)kvtop(acb->sc_dmausrbuf) != acb->sc_usrbufpa)
- printf("%s: WARNING - buffer mapping changed %x->%x\n",
- dev->sc_dev.dv_xname, acb->sc_usrbufpa,
- kvtop(acb->sc_dmausrbuf));
-#ifdef DEBUG
- if(data_pointer_debug)
- printf("sbicgo:copying %x bytes from target %d bounce %x\n",
- acb->sc_dmausrlen,
- dev->target,
- kvtop(dev->sc_tinfo[dev->target].bounce));
-#endif
- bcopy(dev->sc_tinfo[dev->target].bounce,
- acb->sc_dmausrbuf,
- acb->sc_dmausrlen);
- }
- dev->sc_flags &= ~(SBICF_INDMA | SBICF_DCFLUSH);
- sbic_scsidone(acb, dev->sc_stat[0]);
- SBIC_TRACE(dev);
- return SBIC_STATE_DONE;
-
- case SBIC_CSR_XFERRED|DATA_OUT_PHASE:
- case SBIC_CSR_XFERRED|DATA_IN_PHASE:
- case SBIC_CSR_MIS|DATA_OUT_PHASE:
- case SBIC_CSR_MIS|DATA_IN_PHASE:
- case SBIC_CSR_MIS_1|DATA_OUT_PHASE:
- case SBIC_CSR_MIS_1|DATA_IN_PHASE:
- case SBIC_CSR_MIS_2|DATA_OUT_PHASE:
- case SBIC_CSR_MIS_2|DATA_IN_PHASE:
- if( dev->sc_xs->flags & SCSI_POLL || dev->sc_flags & SBICF_ICMD
- || acb->sc_dmacmd == 0 ) {
- /* Do PIO */
- SET_SBIC_control(regs, SBIC_CTL_EDI | SBIC_CTL_IDI);
- if (acb->sc_kv.dc_count <= 0) {
- printf("sbicnextstate:xfer count %d asr%x csr%x\n",
- acb->sc_kv.dc_count, asr, csr);
- goto abort;
- }
- wait = sbic_data_wait;
- if( sbicxfstart(regs,
- acb->sc_kv.dc_count,
- SBIC_PHASE(csr), wait))
- if( SBIC_PHASE(csr) == DATA_IN_PHASE )
- /* data in? */
- i=sbicxfin(regs,
- acb->sc_kv.dc_count,
- acb->sc_kv.dc_addr);
- else
- i=sbicxfout(regs,
- acb->sc_kv.dc_count,
- acb->sc_kv.dc_addr,
- SBIC_PHASE(csr));
- acb->sc_kv.dc_addr +=
- (acb->sc_kv.dc_count - i);
- acb->sc_kv.dc_count = i;
- } else {
- if (acb->sc_kv.dc_count <= 0) {
- printf("sbicnextstate:xfer count %d asr%x csr%x\n",
- acb->sc_kv.dc_count, asr, csr);
- goto abort;
- }
- /*
- * do scatter-gather dma
- * hacking the controller chip, ouch..
- */
- SET_SBIC_control(regs, SBIC_CTL_EDI | SBIC_CTL_IDI |
- SBIC_MACHINE_DMA_MODE);
- /*
- * set next dma addr and dec count
- */
-#if 0
- SBIC_TC_GET(regs, tcnt);
- dev->sc_cur->dc_count -= ((dev->sc_tcnt - tcnt) >> 1);
- dev->sc_cur->dc_addr += (dev->sc_tcnt - tcnt);
- dev->sc_tcnt = acb->sc_tcnt = tcnt;
-#else
- sbic_save_ptrs(dev, regs, dev->target, dev->lun);
- sbic_load_ptrs(dev, regs, dev->target, dev->lun);
-#endif
-#ifdef DEBUG
- if( data_pointer_debug > 1 )
- printf("next dmanext: %d(%x:%x)\n",
- dev->target,dev->sc_cur->dc_addr,
- dev->sc_tcnt);
- dev->sc_dmatimo = 1;
-#endif
- dev->sc_tcnt = dev->sc_dmanext(dev);
- SBIC_TC_PUT(regs, (unsigned)dev->sc_tcnt);
- SET_SBIC_cmd(regs, SBIC_CMD_XFER_INFO);
- dev->sc_flags |= SBICF_INDMA;
- }
- break;
-
- case SBIC_CSR_XFERRED|MESG_IN_PHASE:
- case SBIC_CSR_MIS|MESG_IN_PHASE:
- case SBIC_CSR_MIS_1|MESG_IN_PHASE:
- case SBIC_CSR_MIS_2|MESG_IN_PHASE:
- SBIC_TRACE(dev);
- return sbicmsgin(dev);
-
- case SBIC_CSR_MSGIN_W_ACK:
- SET_SBIC_cmd(regs, SBIC_CMD_CLR_ACK); /* Dunno what I'm ACKing */
- printf("Acking unknown msgin CSR:%02x",csr);
- break;
-
- case SBIC_CSR_XFERRED|MESG_OUT_PHASE:
- case SBIC_CSR_MIS|MESG_OUT_PHASE:
- case SBIC_CSR_MIS_1|MESG_OUT_PHASE:
- case SBIC_CSR_MIS_2|MESG_OUT_PHASE:
-#ifdef DEBUG
- if (sync_debug)
- printf ("sending REJECT msg to last msg.\n");
-#endif
-
- sbic_save_ptrs(dev, regs, dev->target, dev->lun);
- /*
- * should only get here on reject,
- * since it's always US that
- * initiate a sync transfer
- */
- SEND_BYTE(regs, MSG_REJECT);
- WAIT_CIP(regs);
- if( asr & (SBIC_ASR_BSY|SBIC_ASR_LCI|SBIC_ASR_CIP) )
- printf("next: REJECT sent asr %02x\n", asr);
- SBIC_TRACE(dev);
- return SBIC_STATE_RUNNING;
-
- case SBIC_CSR_DISC:
- case SBIC_CSR_DISC_1:
- dev->sc_flags &= ~(SBICF_INDMA|SBICF_SELECTED);
-
- /* Try to schedule another target */
-#ifdef DEBUG
- if(reselect_debug>1)
- printf("sbicnext target %d disconnected\n", dev->target);
-#endif
- TAILQ_INSERT_HEAD(&dev->nexus_list, acb, chain);
- ++dev->sc_tinfo[dev->target].dconns;
- dev->sc_nexus = NULL;
- dev->sc_xs = NULL;
-
- if( acb->xs->flags & SCSI_POLL
- || (dev->sc_flags & SBICF_ICMD)
- || !sbic_parallel_operations ) {
- SBIC_TRACE(dev);
- return SBIC_STATE_DISCONNECT;
- }
- sbic_sched(dev);
- SBIC_TRACE(dev);
- return SBIC_STATE_DISCONNECT;
-
- case SBIC_CSR_RSLT_NI:
- case SBIC_CSR_RSLT_IFY:
- GET_SBIC_rselid(regs, newtarget);
- /* check SBIC_RID_SIV? */
- newtarget &= SBIC_RID_MASK;
- if (csr == SBIC_CSR_RSLT_IFY) {
- /* Read IFY msg to avoid lockup */
- GET_SBIC_data(regs, newlun);
- WAIT_CIP(regs);
- newlun &= SBIC_TLUN_MASK;
- CSR_TRACE('r',csr,asr,newtarget);
- } else {
- /* Need to get IFY message */
- for (newlun = 256; newlun; --newlun) {
- GET_SBIC_asr(regs, asr);
- if (asr & SBIC_ASR_INT)
- break;
- delay(1);
- }
- newlun = 0; /* XXXX */
- if ((asr & SBIC_ASR_INT) == 0) {
-#ifdef DEBUG
- if (reselect_debug)
- printf("RSLT_NI - no IFFY message? asr %x\n", asr);
-#endif
- } else {
- GET_SBIC_csr(regs,csr);
- CSR_TRACE('n',csr,asr,newtarget);
- if (csr == SBIC_CSR_MIS|MESG_IN_PHASE ||
- csr == SBIC_CSR_MIS_1|MESG_IN_PHASE ||
- csr == SBIC_CSR_MIS_2|MESG_IN_PHASE) {
- sbicmsgin(dev);
- newlun = dev->sc_msg[0] & 7;
- } else {
- printf("RSLT_NI - not MESG_IN_PHASE %x\n",
- csr);
- }
- }
- }
-#ifdef DEBUG
- if(reselect_debug>1 || (reselect_debug && csr==SBIC_CSR_RSLT_NI))
- printf("sbicnext: reselect %s from targ %d lun %d\n",
- csr == SBIC_CSR_RSLT_NI ? "NI" : "IFY",
- newtarget, newlun);
-#endif
- if (dev->sc_nexus) {
-#ifdef DEBUG
- if (reselect_debug > 1)
- printf("%s: reselect %s with active command\n",
- dev->sc_dev.dv_xname,
- csr == SBIC_CSR_RSLT_NI ? "NI" : "IFY");
-#ifdef DDB
-/* Debugger();*/
-#endif
-#endif
- TAILQ_INSERT_HEAD(&dev->ready_list, dev->sc_nexus, chain);
- dev->sc_tinfo[dev->target].lubusy &= ~(1 << dev->lun);
- dev->sc_nexus = NULL;
- dev->sc_xs = NULL;
- }
- /* Reload sync values for this target */
- if (dev->sc_sync[newtarget].state == SYNC_DONE)
- SET_SBIC_syn(regs, SBIC_SYN (dev->sc_sync[newtarget].offset,
- dev->sc_sync[newtarget].period));
- else
- SET_SBIC_syn(regs, SBIC_SYN (0, sbic_min_period));
- for (acb = dev->nexus_list.tqh_first; acb;
- acb = acb->chain.tqe_next) {
- if (acb->xs->sc_link->target != newtarget ||
- acb->xs->sc_link->lun != newlun)
- continue;
- TAILQ_REMOVE(&dev->nexus_list, acb, chain);
- dev->sc_nexus = acb;
- dev->sc_xs = acb->xs;
- dev->sc_flags |= SBICF_SELECTED;
- dev->target = newtarget;
- dev->lun = newlun;
- break;
- }
- if (acb == NULL) {
- printf("%s: reselect %s targ %d not in nexus_list %x\n",
- dev->sc_dev.dv_xname,
- csr == SBIC_CSR_RSLT_NI ? "NI" : "IFY", newtarget,
- &dev->nexus_list.tqh_first);
- panic("bad reselect in sbic");
- }
- if (csr == SBIC_CSR_RSLT_IFY)
- SET_SBIC_cmd(regs, SBIC_CMD_CLR_ACK);
- break;
-
- default:
- abort:
- /*
- * Something unexpected happened -- deal with it.
- */
- printf("sbicnextstate: aborting csr %02x asr %02x\n", csr, asr);
-#ifdef DDB
- Debugger();
-#endif
-#ifdef DEBUG
- if( data_pointer_debug > 1 )
- printf("next dmastop: %d(%x:%x)\n",
- dev->target,dev->sc_cur->dc_addr,dev->sc_tcnt);
- dev->sc_dmatimo = 0;
-#endif
- dev->sc_dmastop(dev);
- SET_SBIC_control(regs, SBIC_CTL_EDI | SBIC_CTL_IDI);
- sbicerror(dev, regs, csr);
- sbicabort(dev, regs, "next");
- if (dev->sc_flags & SBICF_INDMA) {
- /*
- * check for overlapping cache line, flush if so
- */
-#ifdef M68040
- if (dev->sc_flags & SBICF_DCFLUSH) {
-#if 0
- printf("sibc: 68040 DMA cache flush needs fixing? %x:%x\n",
- dev->sc_xs->data, dev->sc_xs->datalen);
-#endif
- }
-#endif
- dev->sc_flags &=
- ~(SBICF_INDMA | SBICF_DCFLUSH);
-#ifdef DEBUG
- if( data_pointer_debug > 1 )
- printf("next dmastop: %d(%x:%x)\n",
- dev->target,dev->sc_cur->dc_addr,dev->sc_tcnt);
- dev->sc_dmatimo = 0;
-#endif
- dev->sc_dmastop(dev);
- sbic_scsidone(acb, -1);
- }
- SBIC_TRACE(dev);
- return SBIC_STATE_ERROR;
- }
-
- SBIC_TRACE(dev);
- return(SBIC_STATE_RUNNING);
-}
-
-
-/*
- * Check if DMA can not be used with specified buffer
- */
-
-int
-sbiccheckdmap(bp, len, mask)
- void *bp;
- u_long len, mask;
-{
- u_char *buffer;
- u_long phy_buf;
- u_long phy_len;
-
- buffer = bp;
-
- if (len == 0)
- return(0);
-
- while (len) {
- phy_buf = kvtop(buffer);
- if (len < (phy_len = NBPG - ((int) buffer & PGOFSET)))
- phy_len = len;
- if (phy_buf & mask)
- return(1);
- buffer += phy_len;
- len -= phy_len;
- }
- return(0);
-}
-
-int
-sbictoscsiperiod(dev, regs, a)
- struct sbic_softc *dev;
- sbic_regmap_p regs;
- int a;
-{
- unsigned int fs;
-
- /*
- * cycle = DIV / (2*CLK)
- * DIV = FS+2
- * best we can do is 200ns at 20Mhz, 2 cycles
- */
-
- GET_SBIC_myid(regs,fs);
- fs = (fs >>6) + 2; /* DIV */
- fs = (fs * 10000) / (dev->sc_clkfreq<<1); /* Cycle, in ns */
- if (a < 2) a = 8; /* map to Cycles */
- return ((fs*a)>>2); /* in 4 ns units */
-}
-
-int
-sbicfromscsiperiod(dev, regs, p)
- struct sbic_softc *dev;
- sbic_regmap_p regs;
- int p;
-{
- register unsigned int fs, ret;
-
- /* Just the inverse of the above */
-
- GET_SBIC_myid(regs,fs);
- fs = (fs >>6) + 2; /* DIV */
- fs = (fs * 10000) / (dev->sc_clkfreq<<1); /* Cycle, in ns */
-
- ret = p << 2; /* in ns units */
- ret = ret / fs; /* in Cycles */
- if (ret < sbic_min_period)
- return(sbic_min_period);
-
- /* verify rounding */
- if (sbictoscsiperiod(dev, regs, ret) < p)
- ret++;
- return (ret >= 8) ? 0 : ret;
-}
-
-#ifdef DEBUG
-
-void sbicdumpstate()
-{
- u_char csr, asr;
-
- GET_SBIC_asr(debug_sbic_regs,asr);
- GET_SBIC_csr(debug_sbic_regs,csr);
- printf("%s: asr:csr(%02x:%02x)->(%02x:%02x)\n",
- (routine==1)?"sbicgo":
- (routine==2)?"sbicintr":
- (routine==3)?"sbicicmd":
- (routine==4)?"sbicnext":"unknown",
- debug_asr, debug_csr, asr, csr);
-
-}
-
-void sbictimeout(dev)
- struct sbic_softc *dev;
-{
- int s, asr;
-
- s = splbio();
- if (dev->sc_dmatimo) {
- if (dev->sc_dmatimo > 1) {
- printf("%s: dma timeout #%d\n",
- dev->sc_dev.dv_xname, dev->sc_dmatimo - 1);
- GET_SBIC_asr(dev->sc_sbicp, asr);
- if( asr & SBIC_ASR_INT ) {
- /* We need to service a missed IRQ */
- printf("Servicing a missed int:(%02x,%02x)->(%02x,??)\n",
- debug_asr, debug_csr, asr);
- sbicintr(dev);
- }
- sbicdumpstate();
- }
- dev->sc_dmatimo++;
- }
- splx(s);
- timeout((void *)sbictimeout, dev, 30 * hz);
-}
-
-void
-sbic_dump_acb(acb)
- struct sbic_acb *acb;
-{
- u_char *b = (u_char *) &acb->cmd;
- int i;
-
- printf("acb@%x ", acb);
- if (acb->xs == NULL) {
- printf("<unused>\n");
- return;
- }
- printf("(%d:%d) flags %2x clen %2d cmd ", acb->xs->sc_link->target,
- acb->xs->sc_link->lun, acb->flags, acb->clen);
- for (i = acb->clen; i; --i)
- printf(" %02x", *b++);
- printf("\n");
- printf(" xs: %08x data %8x:%04x ", acb->xs, acb->xs->data,
- acb->xs->datalen);
- printf("va %8x:%04x ", acb->sc_kv.dc_addr, acb->sc_kv.dc_count);
- printf("pa %8x:%04x tcnt %x\n", acb->sc_pa.dc_addr, acb->sc_pa.dc_count,
- acb->sc_tcnt);
-}
-
-void
-sbic_dump(dev)
- struct sbic_softc *dev;
-{
- sbic_regmap_p regs;
- u_char csr, asr;
- struct sbic_acb *acb;
- int s;
- int i;
-
- s = splbio();
- regs = dev->sc_sbicp;
-#if CSR_TRACE_SIZE
- printf("csr trace: ");
- i = csr_traceptr;
- do {
- printf("%c%02x%02x%02x ", csr_trace[i].whr,
- csr_trace[i].csr, csr_trace[i].asr, csr_trace[i].xtn);
- switch(csr_trace[i].whr) {
- case 'g':
- printf("go "); break;
- case 's':
- printf("select "); break;
- case 'y':
- printf("select+ "); break;
- case 'i':
- printf("intr "); break;
- case 'f':
- printf("finish "); break;
- case '>':
- printf("out "); break;
- case '<':
- printf("in "); break;
- case 'm':
- printf("msgin "); break;
- case 'x':
- printf("msginx "); break;
- case 'X':
- printf("msginX "); break;
- case 'r':
- printf("reselect "); break;
- case 'I':
- printf("icmd "); break;
- case 'a':
- printf("abort "); break;
- default:
- printf("? ");
- }
- switch(csr_trace[i].csr) {
- case 0x11:
- printf("INITIATOR"); break;
- case 0x16:
- printf("S_XFERRED"); break;
- case 0x20:
- printf("MSGIN_ACK"); break;
- case 0x41:
- printf("DISC"); break;
- case 0x42:
- printf("SEL_TIMEO"); break;
- case 0x80:
- printf("RSLT_NI"); break;
- case 0x81:
- printf("RSLT_IFY"); break;
- case 0x85:
- printf("DISC_1"); break;
- case 0x18: case 0x19: case 0x1a:
- case 0x1b: case 0x1e: case 0x1f:
- case 0x28: case 0x29: case 0x2a:
- case 0x2b: case 0x2e: case 0x2f:
- case 0x48: case 0x49: case 0x4a:
- case 0x4b: case 0x4e: case 0x4f:
- case 0x88: case 0x89: case 0x8a:
- case 0x8b: case 0x8e: case 0x8f:
- switch(csr_trace[i].csr & 0xf0) {
- case 0x10:
- printf("DONE_"); break;
- case 0x20:
- printf("STOP_"); break;
- case 0x40:
- printf("ERR_"); break;
- case 0x80:
- printf("REQ_"); break;
- }
- switch(csr_trace[i].csr & 7) {
- case 0:
- printf("DATA_OUT"); break;
- case 1:
- printf("DATA_IN"); break;
- case 2:
- printf("CMD"); break;
- case 3:
- printf("STATUS"); break;
- case 6:
- printf("MSG_OUT"); break;
- case 7:
- printf("MSG_IN"); break;
- default:
- printf("invld phs");
- }
- break;
- default: printf("****"); break;
- }
- if (csr_trace[i].asr & SBIC_ASR_INT)
- printf(" ASR_INT");
- if (csr_trace[i].asr & SBIC_ASR_LCI)
- printf(" ASR_LCI");
- if (csr_trace[i].asr & SBIC_ASR_BSY)
- printf(" ASR_BSY");
- if (csr_trace[i].asr & SBIC_ASR_CIP)
- printf(" ASR_CIP");
- printf("\n");
- i = (i + 1) & (CSR_TRACE_SIZE - 1);
- } while (i != csr_traceptr);
-#endif
- GET_SBIC_asr(regs, asr);
- if ((asr & SBIC_ASR_INT) == 0)
- GET_SBIC_csr(regs, csr);
- else
- csr = 0;
- printf("%s@%x regs %x asr %x csr %x\n", dev->sc_dev.dv_xname,
- dev, regs, asr, csr);
- if (acb = dev->free_list.tqh_first) {
- printf("Free list:\n");
- while (acb) {
- sbic_dump_acb(acb);
- acb = acb->chain.tqe_next;
- }
- }
- if (acb = dev->ready_list.tqh_first) {
- printf("Ready list:\n");
- while (acb) {
- sbic_dump_acb(acb);
- acb = acb->chain.tqe_next;
- }
- }
- if (acb = dev->nexus_list.tqh_first) {
- printf("Nexus list:\n");
- while (acb) {
- sbic_dump_acb(acb);
- acb = acb->chain.tqe_next;
- }
- }
- if (dev->sc_nexus) {
- printf("nexus:\n");
- sbic_dump_acb(dev->sc_nexus);
- }
- printf("sc_xs %x targ %d lun %d flags %x tcnt %x dmacmd %x mask %x\n",
- dev->sc_xs, dev->target, dev->lun, dev->sc_flags, dev->sc_tcnt,
- dev->sc_dmacmd, dev->sc_dmamask);
- for (i = 0; i < 8; ++i) {
- if (dev->sc_tinfo[i].cmds > 2) {
- printf("tgt %d: cmds %d disc %d senses %d lubusy %x\n",
- i, dev->sc_tinfo[i].cmds,
- dev->sc_tinfo[i].dconns,
- dev->sc_tinfo[i].senses,
- dev->sc_tinfo[i].lubusy);
- }
- }
- splx(s);
-}
-
-#endif
diff --git a/sys/arch/arm32/podulebus/sbicreg.h b/sys/arch/arm32/podulebus/sbicreg.h
deleted file mode 100644
index 0b43c60c419..00000000000
--- a/sys/arch/arm32/podulebus/sbicreg.h
+++ /dev/null
@@ -1,426 +0,0 @@
-/* $NetBSD: sbicreg.h,v 1.1 1996/03/06 23:44:09 mark Exp $ */
-
-/*
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)scsireg.h 7.3 (Berkeley) 2/5/91
- */
-
-/*
- * AMD AM33C93A SCSI interface hardware description.
- *
- * Using parts of the Mach scsi driver for the 33C93
- */
-
-#define SBIC_myid 0
-#define SBIC_cdbsize 0
-#define SBIC_control 1
-#define SBIC_timeo 2
-#define SBIC_cdb1 3
-#define SBIC_tsecs 3
-#define SBIC_cdb2 4
-#define SBIC_theads 4
-#define SBIC_cdb3 5
-#define SBIC_tcyl_hi 5
-#define SBIC_cdb4 6
-#define SBIC_tcyl_lo 6
-#define SBIC_cdb5 7
-#define SBIC_addr_hi 7
-#define SBIC_cdb6 8
-#define SBIC_addr_2 8
-#define SBIC_cdb7 9
-#define SBIC_addr_3 9
-#define SBIC_cdb8 10
-#define SBIC_addr_lo 10
-#define SBIC_cdb9 11
-#define SBIC_secno 11
-#define SBIC_cdb10 12
-#define SBIC_headno 12
-#define SBIC_cdb11 13
-#define SBIC_cylno_hi 13
-#define SBIC_cdb12 14
-#define SBIC_cylno_lo 14
-#define SBIC_tlun 15
-#define SBIC_cmd_phase 16
-#define SBIC_syn 17
-#define SBIC_count_hi 18
-#define SBIC_count_med 19
-#define SBIC_count_lo 20
-#define SBIC_selid 21
-#define SBIC_rselid 22
-#define SBIC_csr 23
-#define SBIC_cmd 24
-#define SBIC_data 25
-/* sbic_asr is addressed directly */
-
-/*
- * Register defines
- */
-
-/*
- * Auxiliary Status Register
- */
-
-#define SBIC_ASR_INT 0x80 /* Interrupt pending */
-#define SBIC_ASR_LCI 0x40 /* Last command ignored */
-#define SBIC_ASR_BSY 0x20 /* Busy, only cmd/data/asr readable */
-#define SBIC_ASR_CIP 0x10 /* Busy, cmd unavail also */
-#define SBIC_ASR_xxx 0x0c
-#define SBIC_ASR_PE 0x02 /* Parity error (even) */
-#define SBIC_ASR_DBR 0x01 /* Data Buffer Ready */
-
-/*
- * My ID register, and/or CDB Size
- */
-
-#define SBIC_ID_FS_8_10 0x00 /* Input clock is 8-10 Mhz */
- /* 11 Mhz is invalid */
-#define SBIC_ID_FS_12_15 0x40 /* Input clock is 12-15 Mhz */
-#define SBIC_ID_FS_16_20 0x80 /* Input clock is 16-20 Mhz */
-#define SBIC_ID_EHP 0x10 /* Enable host parity */
-#define SBIC_ID_EAF 0x08 /* Enable Advanced Features */
-#define SBIC_ID_MASK 0x07
-#define SBIC_ID_CBDSIZE_MASK 0x0f /* if unk SCSI cmd group */
-
-/*
- * Control register
- */
-
-#define SBIC_CTL_DMA 0x80 /* Single byte dma */
-#define SBIC_CTL_DBA_DMA 0x40 /* direct buffer acces (bus master)*/
-#define SBIC_CTL_BURST_DMA 0x20 /* continuous mode (8237) */
-#define SBIC_CTL_NO_DMA 0x00 /* Programmed I/O */
-#define SBIC_CTL_HHP 0x10 /* Halt on host parity error */
-#define SBIC_CTL_EDI 0x08 /* Ending disconnect interrupt */
-#define SBIC_CTL_IDI 0x04 /* Intermediate disconnect interrupt*/
-#define SBIC_CTL_HA 0x02 /* Halt on ATN */
-#define SBIC_CTL_HSP 0x01 /* Halt on SCSI parity error */
-
-/*
- * Timeout period register
- * [val in msecs, input clk in 0.1 Mhz]
- */
-
-#define SBIC_TIMEOUT(val,clk) ((((val) * (clk)) / 800) + 1)
-
-/*
- * CDBn registers, note that
- * cdb11 is used for status byte in target mode (send-status-and-cc)
- * cdb12 sez if linked command complete, and w/flag if so
- */
-
-/*
- * Target LUN register
- * [holds target status when select-and-xfer]
- */
-
-#define SBIC_TLUN_VALID 0x80 /* did we receive an Identify msg */
-#define SBIC_TLUN_DOK 0x40 /* Disconnect OK */
-#define SBIC_TLUN_xxx 0x38
-#define SBIC_TLUN_MASK 0x07
-
-/*
- * Command Phase register
- */
-
-#define SBIC_CPH_MASK 0x7f /* values/restarts are cmd specific */
-#define SBIC_CPH(p) ((p) & SBIC_CPH_MASK)
-
-/*
- * FIFO register
- */
-
-#define SBIC_FIFO_DEEP 12
-
-/*
- * maximum possible size in TC registers. Since this is 24 bit, it's easy
- */
-#define SBIC_TC_MAX ((1 << 24) - 1)
-
-/*
- * Synchronous xfer register
- */
-
-#define SBIC_SYN_OFF_MASK 0x0f
-#define SBIC_SYN_MAX_OFFSET SBIC_FIFO_DEEP
-#define SBIC_SYN_PER_MASK 0x70
-#define SBIC_SYN_MIN_PERIOD 2 /* upto 8, encoded as 0 */
-
-#define SBIC_SYN(o,p) \
- (((o) & SBIC_SYN_OFF_MASK) | (((p) << 4) & SBIC_SYN_PER_MASK))
-
-/*
- * Transfer count register
- * optimal access macros depend on addressing
- */
-
-/*
- * Destination ID (selid) register
- */
-
-#define SBIC_SID_SCC 0x80 /* Select command chaining (tgt) */
-#define SBIC_SID_DPD 0x40 /* Data phase direction (inittor) */
-#define SBIC_SID_FROM_SCSI 0x40
-#define SBIC_SID_TO_SCSI 0x00
-#define SBIC_SID_xxx 0x38
-#define SBIC_SID_IDMASK 0x07
-
-/*
- * Source ID (rselid) register
- */
-
-#define SBIC_RID_ER 0x80 /* Enable reselection */
-#define SBIC_RID_ES 0x40 /* Enable selection */
-#define SBIC_RID_DSP 0x20 /* Disable select parity */
-#define SBIC_RID_SIV 0x08 /* Source ID valid */
-#define SBIC_RID_MASK 0x07
-
-/*
- * Status register
- */
-
-#define SBIC_CSR_CAUSE 0xf0
-#define SBIC_CSR_RESET 0x00 /* chip was reset */
-#define SBIC_CSR_CMD_DONE 0x10 /* cmd completed */
-#define SBIC_CSR_CMD_STOPPED 0x20 /* interrupted or abrted*/
-#define SBIC_CSR_CMD_ERR 0x40 /* end with error */
-#define SBIC_CSR_BUS_SERVICE 0x80 /* REQ pending on the bus */
-
-
-#define SBIC_CSR_QUALIFIER 0x0f
-/* Reset State Interrupts */
-#define SBIC_CSR_RESET 0x00 /* reset w/advanced features*/
-#define SBIC_CSR_RESET_AM 0x01 /* reset w/advanced features*/
-/* Successful Completion Interrupts */
-#define SBIC_CSR_TARGET 0x10 /* reselect complete */
-#define SBIC_CSR_INITIATOR 0x11 /* select complete */
-#define SBIC_CSR_WO_ATN 0x13 /* tgt mode completion */
-#define SBIC_CSR_W_ATN 0x14 /* ditto */
-#define SBIC_CSR_XLATED 0x15 /* translate address cmd */
-#define SBIC_CSR_S_XFERRED 0x16 /* initiator mode completion*/
-#define SBIC_CSR_XFERRED 0x18 /* phase in low bits */
-/* Paused or Aborted Interrupts */
-#define SBIC_CSR_MSGIN_W_ACK 0x20 /* (I) msgin, ACK asserted*/
-#define SBIC_CSR_SDP 0x21 /* (I) SDP msg received */
-#define SBIC_CSR_SEL_ABRT 0x22 /* sel/resel aborted */
-#define SBIC_CSR_XFR_PAUSED 0x23 /* (T) no ATN */
-#define SBIC_CSR_XFR_PAUSED_ATN 0x24 /* (T) ATN is asserted */
-#define SBIC_CSR_RSLT_AM 0x27 /* (I) lost selection (AM) */
-#define SBIC_CSR_MIS 0x28 /* (I) xfer aborted, ph mis */
-/* Terminated Interrupts */
-#define SBIC_CSR_CMD_INVALID 0x40
-#define SBIC_CSR_DISC 0x41 /* (I) tgt disconnected */
-#define SBIC_CSR_SEL_TIMEO 0x42
-#define SBIC_CSR_PE 0x43 /* parity error */
-#define SBIC_CSR_PE_ATN 0x44 /* ditto, ATN is asserted */
-#define SBIC_CSR_XLATE_TOOBIG 0x45
-#define SBIC_CSR_RSLT_NOAM 0x46 /* (I) lost sel, no AM mode */
-#define SBIC_CSR_BAD_STATUS 0x47 /* status byte was nok */
-#define SBIC_CSR_MIS_1 0x48 /* ph mis, see low bits */
-/* Service Required Interrupts */
-#define SBIC_CSR_RSLT_NI 0x80 /* reselected, no ify msg */
-#define SBIC_CSR_RSLT_IFY 0x81 /* ditto, AM mode, got ify */
-#define SBIC_CSR_SLT 0x82 /* selected, no ATN */
-#define SBIC_CSR_SLT_ATN 0x83 /* selected with ATN */
-#define SBIC_CSR_ATN 0x84 /* (T) ATN asserted */
-#define SBIC_CSR_DISC_1 0x85 /* (I) bus is free */
-#define SBIC_CSR_UNK_GROUP 0x87 /* strange CDB1 */
-#define SBIC_CSR_MIS_2 0x88 /* (I) ph mis, see low bits */
-
-#define SBIC_PHASE(csr) SCSI_PHASE(csr)
-
-/*
- * Command register (command codes)
- */
-
-#define SBIC_CMD_SBT 0x80 /* Single byte xfer qualifier */
-#define SBIC_CMD_MASK 0x7f
-
- /* Miscellaneous */
-#define SBIC_CMD_RESET 0x00 /* (DTI) lev I */
-#define SBIC_CMD_ABORT 0x01 /* (DTI) lev I */
-#define SBIC_CMD_DISC 0x04 /* ( TI) lev I */
-#define SBIC_CMD_SSCC 0x0d /* ( TI) lev I */
-#define SBIC_CMD_SET_IDI 0x0f /* (DTI) lev I */
-#define SBIC_CMD_XLATE 0x18 /* (DT ) lev II */
-
- /* Initiator state */
-#define SBIC_CMD_SET_ATN 0x02 /* ( I) lev I */
-#define SBIC_CMD_CLR_ACK 0x03 /* ( I) lev I */
-#define SBIC_CMD_XFER_PAD 0x19 /* ( I) lev II */
-#define SBIC_CMD_XFER_INFO 0x20 /* ( I) lev II */
-
- /* Target state */
-#define SBIC_CMD_SND_DISC 0x0e /* ( T ) lev II */
-#define SBIC_CMD_RCV_CMD 0x10 /* ( T ) lev II */
-#define SBIC_CMD_RCV_DATA 0x11 /* ( T ) lev II */
-#define SBIC_CMD_RCV_MSG_OUT 0x12 /* ( T ) lev II */
-#define SBIC_CMD_RCV 0x13 /* ( T ) lev II */
-#define SBIC_CMD_SND_STATUS 0x14 /* ( T ) lev II */
-#define SBIC_CMD_SND_DATA 0x15 /* ( T ) lev II */
-#define SBIC_CMD_SND_MSG_IN 0x16 /* ( T ) lev II */
-#define SBIC_CMD_SND 0x17 /* ( T ) lev II */
-
- /* Disconnected state */
-#define SBIC_CMD_RESELECT 0x05 /* (D ) lev II */
-#define SBIC_CMD_SEL_ATN 0x06 /* (D ) lev II */
-#define SBIC_CMD_SEL 0x07 /* (D ) lev II */
-#define SBIC_CMD_SEL_ATN_XFER 0x08 /* (D I) lev II */
-#define SBIC_CMD_SEL_XFER 0x09 /* (D I) lev II */
-#define SBIC_CMD_RESELECT_RECV 0x0a /* (DT ) lev II */
-#define SBIC_CMD_RESELECT_SEND 0x0b /* (DT ) lev II */
-#define SBIC_CMD_WAIT_SEL_RECV 0x0c /* (DT ) lev II */
-
-/* approximate, but we won't do SBT on selects */
-#define sbic_isa_select(cmd) (((cmd) > 0x5) && ((cmd) < 0xa))
-
-#define PAD(n) char n;
-#define SBIC_MACHINE_DMA_MODE SBIC_CTL_DMA
-
-typedef struct {
- volatile unsigned char sbic_asr; /* r : Aux Status Register */
-#define sbic_address sbic_asr /* w : desired register no */
- PAD(pad1);
- PAD(pad2);
- PAD(pad3);
- volatile unsigned char sbic_value; /* rw: register value */
-} sbic_padded_ind_regmap_t;
-typedef volatile sbic_padded_ind_regmap_t *sbic_regmap_p;
-
-#define sbic_read_reg(regs,regno,val) do { \
- (regs)->sbic_address = (regno); \
- (val) = (regs)->sbic_value; \
- } while (0)
-
-#define sbic_write_reg(regs,regno,val) do { \
- (regs)->sbic_address = (regno); \
- (regs)->sbic_value = (val); \
- } while (0)
-
-#define SET_SBIC_myid(regs,val) sbic_write_reg(regs,SBIC_myid,val)
-#define GET_SBIC_myid(regs,val) sbic_read_reg(regs,SBIC_myid,val)
-#define SET_SBIC_cdbsize(regs,val) sbic_write_reg(regs,SBIC_cdbsize,val)
-#define GET_SBIC_cdbsize(regs,val) sbic_read_reg(regs,SBIC_cdbsize,val)
-#define SET_SBIC_control(regs,val) sbic_write_reg(regs,SBIC_control,val)
-#define GET_SBIC_control(regs,val) sbic_read_reg(regs,SBIC_control,val)
-#define SET_SBIC_timeo(regs,val) sbic_write_reg(regs,SBIC_timeo,val)
-#define GET_SBIC_timeo(regs,val) sbic_read_reg(regs,SBIC_timeo,val)
-#define SET_SBIC_cdb1(regs,val) sbic_write_reg(regs,SBIC_cdb1,val)
-#define GET_SBIC_cdb1(regs,val) sbic_read_reg(regs,SBIC_cdb1,val)
-#define SET_SBIC_cdb2(regs,val) sbic_write_reg(regs,SBIC_cdb2,val)
-#define GET_SBIC_cdb2(regs,val) sbic_read_reg(regs,SBIC_cdb2,val)
-#define SET_SBIC_cdb3(regs,val) sbic_write_reg(regs,SBIC_cdb3,val)
-#define GET_SBIC_cdb3(regs,val) sbic_read_reg(regs,SBIC_cdb3,val)
-#define SET_SBIC_cdb4(regs,val) sbic_write_reg(regs,SBIC_cdb4,val)
-#define GET_SBIC_cdb4(regs,val) sbic_read_reg(regs,SBIC_cdb4,val)
-#define SET_SBIC_cdb5(regs,val) sbic_write_reg(regs,SBIC_cdb5,val)
-#define GET_SBIC_cdb5(regs,val) sbic_read_reg(regs,SBIC_cdb5,val)
-#define SET_SBIC_cdb6(regs,val) sbic_write_reg(regs,SBIC_cdb6,val)
-#define GET_SBIC_cdb6(regs,val) sbic_read_reg(regs,SBIC_cdb6,val)
-#define SET_SBIC_cdb7(regs,val) sbic_write_reg(regs,SBIC_cdb7,val)
-#define GET_SBIC_cdb7(regs,val) sbic_read_reg(regs,SBIC_cdb7,val)
-#define SET_SBIC_cdb8(regs,val) sbic_write_reg(regs,SBIC_cdb8,val)
-#define GET_SBIC_cdb8(regs,val) sbic_read_reg(regs,SBIC_cdb8,val)
-#define SET_SBIC_cdb9(regs,val) sbic_write_reg(regs,SBIC_cdb9,val)
-#define GET_SBIC_cdb9(regs,val) sbic_read_reg(regs,SBIC_cdb9,val)
-#define SET_SBIC_cdb10(regs,val) sbic_write_reg(regs,SBIC_cdb10,val)
-#define GET_SBIC_cdb10(regs,val) sbic_read_reg(regs,SBIC_cdb10,val)
-#define SET_SBIC_cdb11(regs,val) sbic_write_reg(regs,SBIC_cdb11,val)
-#define GET_SBIC_cdb11(regs,val) sbic_read_reg(regs,SBIC_cdb11,val)
-#define SET_SBIC_cdb12(regs,val) sbic_write_reg(regs,SBIC_cdb12,val)
-#define GET_SBIC_cdb12(regs,val) sbic_read_reg(regs,SBIC_cdb12,val)
-#define SET_SBIC_tlun(regs,val) sbic_write_reg(regs,SBIC_tlun,val)
-#define GET_SBIC_tlun(regs,val) sbic_read_reg(regs,SBIC_tlun,val)
-#define SET_SBIC_cmd_phase(regs,val) sbic_write_reg(regs,SBIC_cmd_phase,val)
-#define GET_SBIC_cmd_phase(regs,val) sbic_read_reg(regs,SBIC_cmd_phase,val)
-#define SET_SBIC_syn(regs,val) sbic_write_reg(regs,SBIC_syn,val)
-#define GET_SBIC_syn(regs,val) sbic_read_reg(regs,SBIC_syn,val)
-#define SET_SBIC_count_hi(regs,val) sbic_write_reg(regs,SBIC_count_hi,val)
-#define GET_SBIC_count_hi(regs,val) sbic_read_reg(regs,SBIC_count_hi,val)
-#define SET_SBIC_count_med(regs,val) sbic_write_reg(regs,SBIC_count_med,val)
-#define GET_SBIC_count_med(regs,val) sbic_read_reg(regs,SBIC_count_med,val)
-#define SET_SBIC_count_lo(regs,val) sbic_write_reg(regs,SBIC_count_lo,val)
-#define GET_SBIC_count_lo(regs,val) sbic_read_reg(regs,SBIC_count_lo,val)
-#define SET_SBIC_selid(regs,val) sbic_write_reg(regs,SBIC_selid,val)
-#define GET_SBIC_selid(regs,val) sbic_read_reg(regs,SBIC_selid,val)
-#define SET_SBIC_rselid(regs,val) sbic_write_reg(regs,SBIC_rselid,val)
-#define GET_SBIC_rselid(regs,val) sbic_read_reg(regs,SBIC_rselid,val)
-#define SET_SBIC_csr(regs,val) sbic_write_reg(regs,SBIC_csr,val)
-#define GET_SBIC_csr(regs,val) sbic_read_reg(regs,SBIC_csr,val)
-#define SET_SBIC_cmd(regs,val) sbic_write_reg(regs,SBIC_cmd,val)
-#define GET_SBIC_cmd(regs,val) sbic_read_reg(regs,SBIC_cmd,val)
-#define SET_SBIC_data(regs,val) sbic_write_reg(regs,SBIC_data,val)
-#define GET_SBIC_data(regs,val) sbic_read_reg(regs,SBIC_data,val)
-
-#define SBIC_TC_PUT(regs,val) do { \
- sbic_write_reg(regs,SBIC_count_hi,((val)>>16)); \
- (regs)->sbic_value = (val)>>8; \
- (regs)->sbic_value = (val); \
-} while (0)
-#define SBIC_TC_GET(regs,val) do { \
- sbic_read_reg(regs,SBIC_count_hi,(val)); \
- (val) = ((val)<<8) | (regs)->sbic_value; \
- (val) = ((val)<<8) | (regs)->sbic_value; \
-} while (0)
-
-#define SBIC_LOAD_COMMAND(regs,cmd,cmdsize) do { \
- int n=(cmdsize)-1; \
- char *ptr = (char*)(cmd); \
- sbic_write_reg(regs,SBIC_cdb1,*ptr++); \
- while (n-- > 0) (regs)->sbic_value = *ptr++; \
-} while (0)
-
-#define GET_SBIC_asr(regs,val) (val) = (regs)->sbic_asr
-
-#define WAIT_CIP(regs) do { \
- while ((regs)->sbic_asr & SBIC_ASR_CIP) \
- ; \
-} while (0)
-
-/* transmit a byte in programmed I/O mode */
-#define SEND_BYTE(regs, ch) do { \
- WAIT_CIP(regs); \
- SET_SBIC_cmd(regs, SBIC_CMD_SBT | SBIC_CMD_XFER_INFO); \
- SBIC_WAIT(regs, SBIC_ASR_DBR, 0); \
- SET_SBIC_data(regs, ch); \
- } while (0)
-
-/* receive a byte in programmed I/O mode */
-#define RECV_BYTE(regs, ch) do { \
- WAIT_CIP(regs); \
- SET_SBIC_cmd(regs, SBIC_CMD_SBT | SBIC_CMD_XFER_INFO); \
- SBIC_WAIT(regs, SBIC_ASR_DBR, 0); \
- GET_SBIC_data(regs, ch); \
- } while (0)
diff --git a/sys/arch/arm32/podulebus/sbicvar.h b/sys/arch/arm32/podulebus/sbicvar.h
deleted file mode 100644
index 4c0c29f87e9..00000000000
--- a/sys/arch/arm32/podulebus/sbicvar.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/* $NetBSD: sbicvar.h,v 1.1 1996/03/06 23:44:10 mark Exp $ */
-
-/*
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)scsivar.h 7.1 (Berkeley) 5/8/90
- */
-
-#ifndef _SBICVAR_H_
-#define _SBICVAR_H_
-#include <sys/malloc.h>
-
-/*
- * The largest single request will be MAXPHYS bytes which will require
- * at most MAXPHYS/NBPG+1 chain elements to describe, i.e. if none of
- * the buffer pages are physically contiguous (MAXPHYS/NBPG) and the
- * buffer is not page aligned (+1).
- */
-#define DMAMAXIO (MAXPHYS/NBPG+1)
-
-struct dma_chain {
- int dc_count;
- char *dc_addr;
-};
-
-/*
- * ACB. Holds additional information for each SCSI command Comments: We
- * need a separate scsi command block because we may need to overwrite it
- * with a request sense command. Basicly, we refrain from fiddling with
- * the scsi_xfer struct (except do the expected updating of return values).
- * We'll generally update: xs->{flags,resid,error,sense,status} and
- * occasionally xs->retries.
- */
-struct sbic_acb {
- TAILQ_ENTRY(sbic_acb) chain;
- struct scsi_xfer *xs; /* SCSI xfer ctrl block from above */
- int flags; /* Status */
-#define ACB_FREE 0x00
-#define ACB_ACTIVE 0x01
-#define ACB_DONE 0x04
-#define ACB_CHKSENSE 0x08
-#define ACB_BBUF 0x10 /* DMA input needs to be copied from bounce */
-#define ACB_DATAIN 0x20 /* DMA direction flag */
- struct scsi_generic cmd; /* SCSI command block */
- int clen;
- struct dma_chain sc_kv; /* Virtual address of whole DMA */
- struct dma_chain sc_pa; /* Physical address of DMA segment */
- u_long sc_tcnt; /* number of bytes for this DMA */
- u_char *sc_dmausrbuf; /* user buffer kva - for bounce copy */
- u_long sc_dmausrlen; /* length of bounce copy */
- u_short sc_dmacmd; /* Internal data for this DMA */
- char *pa_addr; /* XXXX initial phys addr */
- u_char *sc_usrbufpa; /* user buffer phys addr */
-};
-
-/*
- * Some info about each (possible) target on the SCSI bus. This should
- * probably have been a "per target+lunit" structure, but we'll leave it at
- * this for now. Is there a way to reliably hook it up to sc->fordriver??
- */
-struct sbic_tinfo {
- int cmds; /* #commands processed */
- int dconns; /* #disconnects */
- int touts; /* #timeouts */
- int perrs; /* #parity errors */
- int senses; /* #request sense commands sent */
- u_char* bounce; /* Bounce buffer for this device */
- ushort lubusy; /* What local units/subr. are busy? */
- u_char flags;
- u_char period; /* Period suggestion */
- u_char offset; /* Offset suggestion */
-} tinfo_t;
-
-struct sbic_softc {
- struct device sc_dev;
-/* struct isr sc_isr;*/
- struct target_sync {
- u_char state;
- u_char period;
- u_char offset;
- } sc_sync[8];
- u_char target; /* Currently active target */
- u_char lun;
- struct scsi_link sc_link; /* proto for sub devices */
- sbic_regmap_p sc_sbicp; /* the SBIC */
- volatile void *sc_cregs; /* driver specific regs */
-
- /* Lists of command blocks */
- TAILQ_HEAD(acb_list, sbic_acb) free_list,
- ready_list,
- nexus_list;
-
- struct sbic_acb *sc_nexus; /* current command */
- struct sbic_acb sc_acb[8]; /* the real command blocks */
- struct sbic_tinfo sc_tinfo[8];
-
- struct scsi_xfer *sc_xs; /* transfer from high level code */
- u_char sc_flags;
- u_char sc_scsiaddr;
- u_char sc_stat[2];
- u_char sc_msg[7];
- u_long sc_clkfreq;
- u_long sc_tcnt; /* number of bytes transferred */
- u_short sc_dmacmd; /* used by dma drivers */
- u_short sc_dmatimo; /* dma timeout */
- u_long sc_dmamask; /* dma valid mem mask */
- struct dma_chain *sc_cur;
- struct dma_chain *sc_last;
- int (*sc_dmago) __P((struct sbic_softc *, char *, int, int));
- int (*sc_dmanext) __P((struct sbic_softc *));
- void (*sc_enintr) __P((struct sbic_softc *));
- void (*sc_dmastop) __P((struct sbic_softc *));
- u_short gtsc_bankmask; /* GVP specific bank selected */
-};
-
-/* sc_flags */
-#define SBICF_ALIVE 0x01 /* controller initialized */
-#define SBICF_DCFLUSH 0x02 /* need flush for overlap after dma finishes */
-#define SBICF_SELECTED 0x04 /* bus is in selected state. */
-#define SBICF_ICMD 0x08 /* Immediate command in execution */
-#define SBICF_BADDMA 0x10 /* controller can only DMA to ztwobus space */
-#define SBICF_INTR 0x40 /* SBICF interrupt expected */
-#define SBICF_INDMA 0x80 /* not used yet, DMA I/O in progress */
-
-/* sync states */
-#define SYNC_START 0 /* no sync handshake started */
-#define SYNC_SENT 1 /* we sent sync request, no answer yet */
-#define SYNC_DONE 2 /* target accepted our (or inferior) settings,
- or it rejected the request and we stay async */
-#ifdef DEBUG
-#define DDB_FOLLOW 0x04
-#define DDB_IO 0x08
-#endif
-extern u_char sbic_inhibit_sync[8];
-extern int sbic_no_dma;
-extern int sbic_clock_override;
-
-#define PHASE 0x07 /* mask for psns/pctl phase */
-#define DATA_OUT_PHASE 0x00
-#define DATA_IN_PHASE 0x01
-#define CMD_PHASE 0x02
-#define STATUS_PHASE 0x03
-#define BUS_FREE_PHASE 0x04
-#define ARB_SEL_PHASE 0x05 /* Fuji chip combines arbitration with sel. */
-#define MESG_OUT_PHASE 0x06
-#define MESG_IN_PHASE 0x07
-
-#define MSG_CMD_COMPLETE 0x00
-#define MSG_EXT_MESSAGE 0x01
-#define MSG_SAVE_DATA_PTR 0x02
-#define MSG_RESTORE_PTR 0x03
-#define MSG_DISCONNECT 0x04
-#define MSG_INIT_DETECT_ERROR 0x05
-#define MSG_ABORT 0x06
-#define MSG_REJECT 0x07
-#define MSG_NOOP 0x08
-#define MSG_PARITY_ERROR 0x09
-#define MSG_BUS_DEVICE_RESET 0x0C
-#define MSG_IDENTIFY 0x80
-#define MSG_IDENTIFY_DR 0xc0 /* (disconnect/reconnect allowed) */
-#define MSG_SYNC_REQ 0x01
-
-#define MSG_ISIDENTIFY(x) (x&MSG_IDENTIFY)
-#define IFY_TRN 0x20
-#define IFY_LUNTRN(x) (x&0x07)
-#define IFY_LUN(x) (!(x&0x20))
-
-/* Check if high bit set */
-
-#define STS_CHECKCOND 0x02 /* Check Condition (ie., read sense) */
-#define STS_CONDMET 0x04 /* Condition Met (ie., search worked) */
-#define STS_BUSY 0x08
-#define STS_INTERMED 0x10 /* Intermediate status sent */
-#define STS_EXT 0x80 /* Extended status valid */
-
-
-/* States returned by our state machine */
-
-#define SBIC_STATE_ERROR -1
-#define SBIC_STATE_DONE 0
-#define SBIC_STATE_RUNNING 1
-#define SBIC_STATE_DISCONNECT 2
-
-/*
- * XXXX
- */
-struct scsi_fmt_cdb {
- int len; /* cdb length (in bytes) */
- u_char cdb[28]; /* cdb to use on next read/write */
-};
-
-struct buf;
-struct scsi_xfer;
-
-void sbic_minphys __P((struct buf *bp));
-int sbic_scsicmd __P((struct scsi_xfer *));
-
-#endif /* _SBICVAR_H_ */
diff --git a/sys/arch/arm32/podulebus/sfas.c b/sys/arch/arm32/podulebus/sfas.c
deleted file mode 100644
index 7dac28fcab8..00000000000
--- a/sys/arch/arm32/podulebus/sfas.c
+++ /dev/null
@@ -1,1621 +0,0 @@
-/* $NetBSD: sfas.c,v 1.4 1996/03/18 21:23:20 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Scott Stevens
- * Copyright (c) 1995 Daniel Widenfalk
- * Copyright (c) 1994 Christian E. Hopps
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)scsi.c 7.5 (Berkeley) 5/4/91
- */
-
-/*
- * Emulex FAS216 scsi adaptor driver
- */
-
-/*
- * Modified for NetBSD/arm32 by Scott Stevens
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/buf.h>
-#include <sys/proc.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-#include <machine/pmap.h>
-#include <machine/cpu.h>
-#include <machine/io.h>
-#include <machine/irqhandler.h>
-#include <machine/katelib.h>
-#include <arm32/podulebus/podulebus.h>
-#include <arm32/podulebus/sfasreg.h>
-#include <arm32/podulebus/sfasvar.h>
-
-/* Externs */
-extern pt_entry_t *pmap_pte __P((pmap_t, vm_offset_t));
-
-void sfasinitialize __P((struct sfas_softc *));
-void sfas_minphys __P((struct buf *bp));
-int sfas_scsicmd __P((struct scsi_xfer *xs));
-void sfas_donextcmd __P((struct sfas_softc *dev, struct sfas_pending *pendp));
-void sfas_scsidone __P((struct sfas_softc *dev, struct scsi_xfer *xs,
- int stat));
-void sfasintr __P((struct sfas_softc *dev));
-void sfasiwait __P((struct sfas_softc *dev));
-void sfasreset __P((struct sfas_softc *dev, int how));
-int sfasselect __P((struct sfas_softc *dev, struct sfas_pending *pendp,
- unsigned char *cbuf, int clen,
- unsigned char *buf, int len, int mode));
-void sfasicmd __P((struct sfas_softc *dev, struct sfas_pending *pendp));
-void sfasgo __P((struct sfas_softc *dev, struct sfas_pending *pendp));
-
-/*
- * Initialize these to make 'em patchable. Defaults to enable sync and discon.
- */
-u_char sfas_inhibit_sync[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
-u_char sfas_inhibit_disc[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
-
-#define DEBUG
-#ifdef DEBUG
-#define QPRINTF(a) if (sfas_debug > 1) printf a
-int sfas_debug = 2;
-#else
-#define QPRINTF
-#endif
-
-/*
- * default minphys routine for sfas based controllers
- */
-void
-sfas_minphys(bp)
- struct buf *bp;
-{
-
- /*
- * No max transfer at this level.
- */
- minphys(bp);
-}
-
-/*
- * Initialize the nexus structs.
- */
-void
-sfas_init_nexus(dev, nexus)
- struct sfas_softc *dev;
- struct nexus *nexus;
-{
- bzero(nexus, sizeof(struct nexus));
-
- nexus->state = SFAS_NS_IDLE;
- nexus->period = 200;
- nexus->offset = 0;
- nexus->syncper = 5;
- nexus->syncoff = 0;
- nexus->config3 = dev->sc_config3 & ~SFAS_CFG3_FASTSCSI;
-}
-
-void
-sfasinitialize(dev)
- struct sfas_softc *dev;
-{
- u_int *pte;
- int i;
-
- dev->sc_led_status = 0;
-
- TAILQ_INIT(&dev->sc_xs_pending);
- TAILQ_INIT(&dev->sc_xs_free);
-
-/*
- * Initialize the sfas_pending structs and link them into the free list. We
- * have to set vm_link_data.pages to 0 or the vm FIX won't work.
- */
- for(i=0; i<MAXPENDING; i++) {
- TAILQ_INSERT_TAIL(&dev->sc_xs_free, &dev->sc_xs_store[i],
- link);
- }
-
-/*
- * Calculate the correct clock conversion factor 2 <= factor <= 8, i.e. set
- * the factor to clock_freq / 5 (int).
- */
- if (dev->sc_clock_freq <= 10)
- dev->sc_clock_conv_fact = 2;
- if (dev->sc_clock_freq <= 40)
- dev->sc_clock_conv_fact = 2+((dev->sc_clock_freq-10)/5);
- else
- panic("sfasinitialize: Clock frequence too high");
-
-/* Setup and save the basic configuration registers */
- dev->sc_config1 = (dev->sc_host_id & SFAS_CFG1_BUS_ID_MASK);
- dev->sc_config2 = SFAS_CFG2_FEATURES_ENABLE;
- dev->sc_config3 = (dev->sc_clock_freq > 25 ? SFAS_CFG3_FASTCLK : 0);
-
-/* Precalculate timeout value and clock period. */
-/* Ekkk ... floating point in the kernel !!!! */
-/* dev->sc_timeout_val = 1+dev->sc_timeout*dev->sc_clock_freq/
- (7.682*dev->sc_clock_conv_fact);*/
- dev->sc_timeout_val = 1+dev->sc_timeout*dev->sc_clock_freq/
- ((7682*dev->sc_clock_conv_fact)/1000);
- dev->sc_clock_period = 1000/dev->sc_clock_freq;
-
- sfasreset(dev, 1 | 2); /* Reset Chip and Bus */
-
- dev->sc_units_disconnected = 0;
- dev->sc_msg_in_len = 0;
- dev->sc_msg_out_len = 0;
-
- dev->sc_flags = 0;
-
- for(i=0; i<8; i++)
- sfas_init_nexus(dev, &dev->sc_nexus[i]);
-
-/*
- * Setup bump buffer.
- */
- dev->sc_bump_va = (u_char *)kmem_alloc(kernel_map, dev->sc_bump_sz);
- dev->sc_bump_pa = pmap_extract(kernel_pmap, (vm_offset_t)dev->sc_bump_va);
-
-/*
- * Setup pages to noncachable, that way we don't have to flush the cache
- * every time we need "bumped" transfer.
- */
- pte = pmap_pte(kernel_pmap, (vm_offset_t)dev->sc_bump_va);
- *pte &= ~PT_C;
- tlbflush();
-
- printf(" dmabuf V0x%08x P0x%08x", (u_int)dev->sc_bump_va, (u_int)dev->sc_bump_pa);
-}
-
-
-/*
- * used by specific sfas controller
- */
-int
-sfas_scsicmd(struct scsi_xfer *xs)
-{
- struct sfas_softc *dev;
- struct scsi_link *slp;
- struct sfas_pending *pendp;
- int flags, s, target;
-
- slp = xs->sc_link;
- dev = slp->adapter_softc;
- flags = xs->flags;
- target = slp->target;
-
- if (flags & SCSI_DATA_UIO)
- panic("sfas: scsi data uio requested");
-
- if ((flags & SCSI_POLL) && (dev->sc_flags & SFAS_ACTIVE))
- panic("sfas_scsicmd: busy");
-
-/* Get hold of a sfas_pending block. */
- s = splbio();
- pendp = dev->sc_xs_free.tqh_first;
- if (pendp == NULL) {
- splx(s);
- return(TRY_AGAIN_LATER);
- }
- TAILQ_REMOVE(&dev->sc_xs_free, pendp, link);
- pendp->xs = xs;
- splx(s);
-
-
-/* If the chip if busy OR the unit is busy, we have to wait for out turn. */
- if ((dev->sc_flags & SFAS_ACTIVE) ||
- (dev->sc_nexus[target].flags & SFAS_NF_UNIT_BUSY)) {
- s = splbio();
- TAILQ_INSERT_TAIL(&dev->sc_xs_pending, pendp, link);
- splx(s);
- } else
- sfas_donextcmd(dev, pendp);
-
- return((flags & SCSI_POLL) ? COMPLETE : SUCCESSFULLY_QUEUED);
-}
-
-/*
- * Actually select the unit, whereby the whole scsi-process is started.
- */
-void
-sfas_donextcmd(dev, pendp)
- struct sfas_softc *dev;
- struct sfas_pending *pendp;
-{
- int s;
-
-/*
- * Special case for scsi unit reset. I think this is waterproof. We first
- * select the unit during splbio. We then cycle through the generated
- * interrupts until the interrupt routine signals that the unit has
- * acknowledged the reset. After that we have to wait a reset to select
- * delay before anything else can happend.
- */
- if (pendp->xs->flags & SCSI_RESET) {
- struct nexus *nexus;
-
- s = splbio();
- while(!sfasselect(dev, pendp, 0, 0, 0, 0, SFAS_SELECT_K)) {
- splx(s);
- delay(10);
- s = splbio();
- }
-
- nexus = dev->sc_cur_nexus;
- while(nexus->flags & SFAS_NF_UNIT_BUSY) {
- sfasiwait(dev);
- sfasintr(dev);
- }
-
- nexus->flags |= SFAS_NF_UNIT_BUSY;
- splx(s);
-
- sfasreset(dev, 0);
-
- s = splbio();
- nexus->flags &= ~SFAS_NF_UNIT_BUSY;
- splx(s);
- }
-
-/*
- * If we are polling, go to splbio and perform the command, else we poke
- * the scsi-bus via sfasgo to get the interrupt machine going.
- */
- if (pendp->xs->flags & SCSI_POLL) {
- s = splbio();
- sfasicmd(dev, pendp);
- TAILQ_INSERT_TAIL(&dev->sc_xs_free, pendp, link);
- splx(s);
- } else {
- sfasgo(dev, pendp);
- }
-}
-
-void
-sfas_scsidone(dev, xs, stat)
- struct sfas_softc *dev;
- struct scsi_xfer *xs;
- int stat;
-{
- struct sfas_pending *pendp;
- int s;
-
- xs->status = stat;
-
- if (stat == 0)
- xs->resid = 0;
- else {
- switch(stat) {
- case SCSI_CHECK:
- /* If we get here we have valid sense data. Faults during
- * sense is handeled elsewhere and will generate a
- * XS_DRIVER_STUFFUP. */
- xs->error = XS_SENSE;
- break;
- case SCSI_BUSY:
- xs->error = XS_BUSY;
- break;
- case -1:
- xs->error = XS_DRIVER_STUFFUP;
- QPRINTF(("sfas_scsicmd() bad %x\n", stat));
- break;
- default:
- xs->error = XS_TIMEOUT;
- break;
- }
- }
-
- xs->flags |= ITSDONE;
-
-/* Steal the next command from the queue so that one unit can't hog the bus. */
- s = splbio();
- pendp = dev->sc_xs_pending.tqh_first;
- while(pendp) {
- if (!(dev->sc_nexus[pendp->xs->sc_link->target].flags &
- SFAS_NF_UNIT_BUSY))
- break;
- pendp = pendp->link.tqe_next;
- }
-
- if (pendp != NULL) {
- TAILQ_REMOVE(&dev->sc_xs_pending, pendp, link);
- }
-
- splx(s);
- scsi_done(xs);
-
- if (pendp)
- sfas_donextcmd(dev, pendp);
-}
-
-/*
- * There are two kinds of reset:
- * 1) CHIP-bus reset. This also implies a SCSI-bus reset.
- * 2) SCSI-bus reset.
- * After the appropriate resets have been performed we wait a reset to select
- * delay time.
- */
-void
-sfasreset(dev, how)
- struct sfas_softc *dev;
- int how;
-{
- sfas_regmap_p rp;
- int i, s;
-
- rp = dev->sc_fas;
-
- if (how & 1) {
- for(i=0; i<8; i++)
- sfas_init_nexus(dev, &dev->sc_nexus[i]);
-
- *rp->sfas_command = SFAS_CMD_RESET_CHIP;
- delay(1);
- *rp->sfas_command = SFAS_CMD_NOP;
-
- *rp->sfas_config1 = dev->sc_config1;
- *rp->sfas_config2 = dev->sc_config2;
- *rp->sfas_config3 = dev->sc_config3;
- *rp->sfas_timeout = dev->sc_timeout_val;
- *rp->sfas_clkconv = dev->sc_clock_conv_fact &
- SFAS_CLOCK_CONVERSION_MASK;
- }
-
- if (how & 2) {
- for(i=0; i<8; i++)
- sfas_init_nexus(dev, &dev->sc_nexus[i]);
-
- s = splbio();
-
- *rp->sfas_command = SFAS_CMD_RESET_SCSI_BUS;
- delay(100);
-
-/* Skip interrupt generated by RESET_SCSI_BUS */
- while(*rp->sfas_status & SFAS_STAT_INTERRUPT_PENDING) {
- dev->sc_status = *rp->sfas_status;
- dev->sc_interrupt = *rp->sfas_interrupt;
-
- delay(100);
- }
-
- dev->sc_status = *rp->sfas_status;
- dev->sc_interrupt = *rp->sfas_interrupt;
-
- splx(s);
- }
-
- if (dev->sc_config_flags & SFAS_SLOW_START)
- delay(4*250000); /* RESET to SELECT DELAY*4 for slow devices */
- else
- delay(250000); /* RESET to SELECT DELAY */
-}
-
-/*
- * Save active data pointers to the nexus block currently active.
- */
-void
-sfas_save_pointers(dev)
- struct sfas_softc *dev;
-{
- struct nexus *nx;
-
- nx = dev->sc_cur_nexus;
- if (nx) {
- nx->cur_link = dev->sc_cur_link;
- nx->max_link = dev->sc_max_link;
- nx->buf = dev->sc_buf;
- nx->len = dev->sc_len;
- nx->dma_len = dev->sc_dma_len;
- nx->dma_buf = dev->sc_dma_buf;
- nx->dma_blk_flg = dev->sc_dma_blk_flg;
- nx->dma_blk_len = dev->sc_dma_blk_len;
- nx->dma_blk_ptr = dev->sc_dma_blk_ptr;
- }
-}
-
-/*
- * Restore data pointers from the currently active nexus block.
- */
-void
-sfas_restore_pointers(dev)
- struct sfas_softc *dev;
-{
- struct nexus *nx;
-
- nx = dev->sc_cur_nexus;
- if (nx) {
- dev->sc_cur_link = nx->cur_link;
- dev->sc_max_link = nx->max_link;
- dev->sc_buf = nx->buf;
- dev->sc_len = nx->len;
- dev->sc_dma_len = nx->dma_len;
- dev->sc_dma_buf = nx->dma_buf;
- dev->sc_dma_blk_flg = nx->dma_blk_flg;
- dev->sc_dma_blk_len = nx->dma_blk_len;
- dev->sc_dma_blk_ptr = nx->dma_blk_ptr;
- dev->sc_chain = nx->dma;
- dev->sc_unit = (nx->lun_unit & 0x0F);
- dev->sc_lun = (nx->lun_unit & 0xF0) >> 4;
- }
-}
-
-/*
- * sfasiwait is used during interrupt and polled IO to wait for an event from
- * the FAS chip. This function MUST NOT BE CALLED without interrupt disabled.
- */
-void
-sfasiwait(dev)
- struct sfas_softc *dev;
-{
- sfas_regmap_p rp;
-
-/*
- * If SFAS_DONT_WAIT is set, we have already grabbed the interrupt info
- * elsewhere. So we don't have to wait for it.
- */
- if (dev->sc_flags & SFAS_DONT_WAIT) {
- dev->sc_flags &= ~SFAS_DONT_WAIT;
- return;
- }
-
- rp = dev->sc_fas;
-
-/* Wait for FAS chip to signal an interrupt. */
- while(!(*rp->sfas_status & SFAS_STAT_INTERRUPT_PENDING))
- delay(1);
-
-/* Grab interrupt info from chip. */
- dev->sc_status = *rp->sfas_status;
- dev->sc_interrupt = *rp->sfas_interrupt;
- if (dev->sc_interrupt & SFAS_INT_RESELECTED) {
- dev->sc_resel[0] = *rp->sfas_fifo;
- dev->sc_resel[1] = *rp->sfas_fifo;
- }
-}
-
-/*
- * Transfer info to/from device. sfas_ixfer uses polled IO+sfasiwait so the
- * rules that apply to sfasiwait also applies here.
- */
-void
-sfas_ixfer(dev, polling)
- struct sfas_softc *dev;
- int polling;
-{
- sfas_regmap_p rp;
- u_char *buf;
- int len, mode, phase;
-
- rp = dev->sc_fas;
- buf = dev->sc_buf;
- len = dev->sc_len;
-
-/*
- * Decode the scsi phase to determine whether we are reading or writing.
- * mode == 1 => READ, mode == 0 => WRITE
- */
- phase = dev->sc_status & SFAS_STAT_PHASE_MASK;
- mode = (phase == SFAS_PHASE_DATA_IN);
-
- while(len && ((dev->sc_status & SFAS_STAT_PHASE_MASK) == phase))
- if (mode) {
- *rp->sfas_command = SFAS_CMD_TRANSFER_INFO;
-
- sfasiwait(dev);
-
- *buf++ = *rp->sfas_fifo;
- len--;
- } else {
- len--;
- *rp->sfas_fifo = *buf++;
- *rp->sfas_command = SFAS_CMD_TRANSFER_INFO;
-
- sfasiwait(dev);
- }
-
-/* Update buffer pointers to reflect the sent/recieved data. */
- dev->sc_buf = buf;
- dev->sc_len = len;
-
-/*
- * Since the last sfasiwait will be a phase-change, we can't wait for it
- * again later, so we have to signal that.
- * Since this may be called from an interrupt initiated routine then we
- * must call sfasintr again to avoid losing an interrupt. Phew!
- */
- if(polling)
- dev->sc_flags |= SFAS_DONT_WAIT;
- else
- sfasintr(dev);
-}
-
-/*
- * Build a Synchronous Data Transfer Request message
- */
-void
-sfas_build_sdtrm(dev, period, offset)
- struct sfas_softc *dev;
- int period;
- int offset;
-{
- dev->sc_msg_out[0] = 0x01;
- dev->sc_msg_out[1] = 0x03;
- dev->sc_msg_out[2] = 0x01;
- dev->sc_msg_out[3] = period/4;
- dev->sc_msg_out[4] = offset;
- dev->sc_msg_out_len= 5;
-}
-
-/*
- * Arbitate the scsi bus and select the unit
- */
-int
-sfas_select_unit(dev, target)
- struct sfas_softc *dev;
- short target;
-{
- sfas_regmap_p rp;
- struct nexus *nexus;
- int s, retcode, i;
- u_char cmd;
-
- s = splbio(); /* Do this at splbio so that we won't be disturbed. */
-
- retcode = 0;
-
- nexus = &dev->sc_nexus[target];
-
-/*
- * Check if the chip is busy. If not the we mark it as so and hope that nobody
- * reselects us until we have grabbed the bus.
- */
- if (!(dev->sc_flags & SFAS_ACTIVE) && !dev->sc_sel_nexus) {
- dev->sc_flags |= SFAS_ACTIVE;
-
- rp = dev->sc_fas;
-
- *rp->sfas_syncper = nexus->syncper;
- *rp->sfas_syncoff = nexus->syncoff;
- *rp->sfas_config3 = nexus->config3;
-
- *rp->sfas_config1 = dev->sc_config1;
- *rp->sfas_timeout = dev->sc_timeout_val;
- *rp->sfas_dest_id = target;
-
-/* If nobody has stolen the bus, we can send a select command to the chip. */
- if (!(*rp->sfas_status & SFAS_STAT_INTERRUPT_PENDING)) {
- *rp->sfas_fifo = nexus->ID;
- if ((nexus->flags & (SFAS_NF_DO_SDTR | SFAS_NF_RESET))
- || (dev->sc_msg_out_len != 0))
- cmd = SFAS_CMD_SEL_ATN_STOP;
- else {
- for(i=0; i<nexus->clen; i++)
- *rp->sfas_fifo = nexus->cbuf[i];
-
- cmd = SFAS_CMD_SEL_ATN;
- }
-
- dev->sc_sel_nexus = nexus;
-
- *rp->sfas_command = cmd;
- retcode = 1;
- }
- }
-
- splx(s);
- return(retcode);
-}
-
-/*
- * Grab the nexus if available else return 0.
- */
-struct nexus *
-sfas_arbitate_target(dev, target)
- struct sfas_softc *dev;
- int target;
-{
- struct nexus *nexus;
- int s;
-
-/*
- * This is realy simple. Raise interrupt level to splbio. Grab the nexus and
- * leave.
- */
- nexus = &dev->sc_nexus[target];
-
- s = splbio();
-
- if (nexus->flags & SFAS_NF_UNIT_BUSY)
- nexus = 0;
- else
- nexus->flags |= SFAS_NF_UNIT_BUSY;
-
- splx(s);
- return(nexus);
-}
-
-/*
- * Setup a nexus for use. Initializes command, buffer pointers and dma chain.
- */
-void
-sfas_setup_nexus(dev, nexus, pendp, cbuf, clen, buf, len, mode)
- struct sfas_softc *dev;
- struct nexus *nexus;
- struct sfas_pending *pendp;
- unsigned char *cbuf;
- int clen;
- unsigned char *buf;
- int len;
- int mode;
-{
- char sync, target, lun;
-
- target = pendp->xs->sc_link->target;
- lun = pendp->xs->sc_link->lun;
-
-/*
- * Adopt mode to reflect the config flags.
- * If we can't use DMA we can't use synch transfer. Also check the
- * sfas_inhibit_xxx[target] flags.
- */
- if ((dev->sc_config_flags & (SFAS_NO_SYNCH | SFAS_NO_DMA)) ||
- sfas_inhibit_sync[(int)target])
- mode &= ~SFAS_SELECT_S;
-
- if ((dev->sc_config_flags & SFAS_NO_RESELECT) ||
- sfas_inhibit_disc[(int)target])
- mode &= ~SFAS_SELECT_R;
-
- nexus->xs = pendp->xs;
-
-/* Setup the nexus struct. */
- nexus->ID = ((mode & SFAS_SELECT_R) ? 0xC0 : 0x80) | lun;
- nexus->clen = clen;
- bcopy(cbuf, nexus->cbuf, nexus->clen);
- nexus->cbuf[1] |= lun << 5; /* Fix the lun bits */
- nexus->cur_link = 0;
- nexus->dma_len = 0;
- nexus->dma_buf = 0;
- nexus->dma_blk_len = 0;
- nexus->dma_blk_ptr = 0;
- nexus->len = len;
- nexus->buf = buf;
- nexus->lun_unit = (lun << 4) | target;
- nexus->state = SFAS_NS_SELECTED;
-
-/* We must keep these flags. All else must be zero. */
- nexus->flags &= SFAS_NF_UNIT_BUSY | SFAS_NF_REQUEST_SENSE
- | SFAS_NF_SYNC_TESTED | SFAS_NF_SELECT_ME;
-
-/*
- * If we are requesting sense, reflect that in the flags so that we can handle
- * error in sense data correctly
- */
- if (nexus->flags & SFAS_NF_REQUEST_SENSE) {
- nexus->flags &= ~SFAS_NF_REQUEST_SENSE;
- nexus->flags |= SFAS_NF_SENSING;
- }
-
- if (mode & SFAS_SELECT_I)
- nexus->flags |= SFAS_NF_IMMEDIATE;
- if (mode & SFAS_SELECT_K)
- nexus->flags |= SFAS_NF_RESET;
-
- sync = ((mode & SFAS_SELECT_S) ? 1 : 0);
-
-/* We can't use sync during polled IO. */
- if (sync && (mode & SFAS_SELECT_I))
- sync = 0;
-
- if (!sync &&
- ((nexus->flags & SFAS_NF_SYNC_TESTED) && (nexus->offset != 0))) {
- /*
- * If the scsi unit is set to synch transfer and we don't want
- * that, we have to renegotiate.
- */
-
- nexus->flags |= SFAS_NF_DO_SDTR;
- nexus->period = 200;
- nexus->offset = 0;
- } else if (sync && !(nexus->flags & SFAS_NF_SYNC_TESTED)) {
- /*
- * If the scsi unit is not set to synch transfer and we want
- * that, we have to negotiate. This should realy base the
- * period on the clock frequence rather than just check if
- * >25Mhz
- */
-
- nexus->flags |= SFAS_NF_DO_SDTR;
- nexus->period = ((dev->sc_clock_freq>25) ? 100 : 200);
- nexus->offset = 8;
-
- /* If the user has a long cable, we want to limit the period */
- if ((nexus->period == 100) &&
- (dev->sc_config_flags & SFAS_SLOW_CABLE))
- nexus->period = 200;
- }
-
-/*
- * Fake a dma-block for polled IO. This way we can use the same code to handle
- * reselection. Much nicer this way.
- */
- if ((mode & SFAS_SELECT_I) || (dev->sc_config_flags & SFAS_NO_DMA)) {
- nexus->dma[0].ptr = (vm_offset_t)buf;
- nexus->dma[0].len = len;
- nexus->dma[0].flg = SFAS_CHAIN_PRG;
- nexus->max_link = 1;
- } else {
- nexus->max_link = dev->sc_build_dma_chain(dev, nexus->dma,
- buf, len);
- }
-
-/* Flush the caches. (If needed) */
-/* Do I need to ? */
-/*
- if ((mmutype == MMU_68040) && len && !(mode & SFAS_SELECT_I))
- dma_cachectl(buf, len);
-*/
-}
-
-int
-sfasselect(dev, pendp, cbuf, clen, buf, len, mode)
- struct sfas_softc *dev;
- struct sfas_pending *pendp;
- unsigned char *cbuf;
- int clen;
- unsigned char *buf;
- int len;
- int mode;
-{
- struct nexus *nexus;
-
-/* Get the nexus struct. */
- nexus = sfas_arbitate_target(dev, pendp->xs->sc_link->target);
- if (nexus == NULL)
- return(0);
-
-/* Setup the nexus struct. */
- sfas_setup_nexus(dev, nexus, pendp, cbuf, clen, buf, len, mode);
-
-/* Post it to the interrupt machine. */
- sfas_select_unit(dev, pendp->xs->sc_link->target);
-
- return(1);
-}
-
-void
-sfas_request_sense(dev, nexus)
- struct sfas_softc *dev;
- struct nexus *nexus;
-{
- struct scsi_xfer *xs;
- struct sfas_pending pend;
- struct scsi_sense rqs;
- int mode;
-
- xs = nexus->xs;
-
-/* Fake a sfas_pending structure. */
- pend.xs = xs;
-
- rqs.opcode = REQUEST_SENSE;
- rqs.byte2 = xs->sc_link->lun << 5;
-#ifdef not_yet
- rqs.length=xs->req_sense_length?xs->req_sense_length:sizeof(xs->sense);
-#else
- rqs.length=sizeof(xs->sense);
-#endif
-
- rqs.unused[0] = rqs.unused[1] = rqs.control = 0;
-
-/*
- * If we are requesting sense during polled IO, we have to sense with polled
- * IO too.
- */
- mode = SFAS_SELECT_RS;
- if (nexus->flags & SFAS_NF_IMMEDIATE)
- mode = SFAS_SELECT_I;
-
-/* Setup the nexus struct for sensing. */
- sfas_setup_nexus(dev, nexus, &pend, (char *)&rqs, sizeof(rqs),
- (char *)&xs->sense, rqs.length, mode);
-
-/* Post it to the interrupt machine. */
- sfas_select_unit(dev, xs->sc_link->target);
-}
-
-void
-sfasgo(dev, pendp)
- struct sfas_softc *dev;
- struct sfas_pending *pendp;
-{
- int s;
- char *buf;
-
- buf = pendp->xs->data;
-
- if (sfasselect(dev, pendp, (char *)pendp->xs->cmd, pendp->xs->cmdlen,
- buf, pendp->xs->datalen, SFAS_SELECT_RS)) {
- /*
- * We got the command going so the sfas_pending struct is now
- * free to reuse.
- */
-
- s = splbio();
- TAILQ_INSERT_TAIL(&dev->sc_xs_free, pendp, link);
- splx(s);
- } else {
- /*
- * We couldn't make the command fly so we have to wait. The
- * struct MUST be inserted at the head to keep the order of
- * the commands.
- */
-
- s = splbio();
- TAILQ_INSERT_HEAD(&dev->sc_xs_pending, pendp, link);
- splx(s);
- }
-
- return;
-}
-
-/*
- * Part one of the interrupt machine. Error checks and reselection test.
- * We don't know if we have an active nexus here!
- */
-int
-sfas_pretests(dev, rp)
- struct sfas_softc *dev;
- sfas_regmap_p rp;
-{
- struct nexus *nexus;
- int i, s;
-
- if (dev->sc_interrupt & SFAS_INT_SCSI_RESET_DETECTED) {
- /*
- * Cleanup and notify user. Lets hope that this is all we
- * have to do
- */
-
- for(i=0; i<8; i++) {
- if (dev->sc_nexus[i].xs)
- sfas_scsidone(dev, dev->sc_nexus[i].xs, -2);
-
- sfas_init_nexus(dev, &dev->sc_nexus[i]);
- }
- printf("sfasintr: SCSI-RESET detected!");
- return(-1);
- }
-
- if (dev->sc_interrupt & SFAS_INT_ILLEGAL_COMMAND) {
- /* Something went terrible wrong! Dump some data and panic! */
-
- printf("FIFO:");
- while(*rp->sfas_fifo_flags & SFAS_FIFO_COUNT_MASK)
- printf(" %x", *rp->sfas_fifo);
- printf("\n");
-
- printf("CMD: %x\n", *rp->sfas_command);
- panic("sfasintr: ILLEGAL COMMAND!");
- }
-
- if (dev->sc_interrupt & SFAS_INT_RESELECTED) {
- /* We were reselected. Set the chip as busy */
-
- s = splbio();
- dev->sc_flags |= SFAS_ACTIVE;
- if (dev->sc_sel_nexus) {
- dev->sc_sel_nexus->flags |= SFAS_NF_SELECT_ME;
- dev->sc_sel_nexus = 0;
- }
- splx(s);
-
- if (dev->sc_units_disconnected) {
- /* Find out who reselected us. */
-
- dev->sc_resel[0] &= ~(1<<dev->sc_host_id);
-
- for(i=0; i<8; i++)
- if (dev->sc_resel[0] & (1<<i))
- break;
-
- if (i == 8)
- panic("Illegal reselection!");
-
- if (dev->sc_nexus[i].state == SFAS_NS_DISCONNECTED) {
- /*
- * This unit had disconnected, so we reconnect
- * it.
- */
-
- dev->sc_cur_nexus = &dev->sc_nexus[i];
- nexus = dev->sc_cur_nexus;
-
- *rp->sfas_syncper = nexus->syncper;
- *rp->sfas_syncoff = nexus->syncoff;
- *rp->sfas_config3 = nexus->config3;
-
- *rp->sfas_dest_id = i & 7;
-
- dev->sc_units_disconnected--;
- dev->sc_msg_in_len= 0;
-
- /* Restore active pointers. */
- sfas_restore_pointers(dev);
-
- nexus->state = SFAS_NS_RESELECTED;
-
- *rp->sfas_command = SFAS_CMD_MESSAGE_ACCEPTED;
-
- return(1);
- }
- }
-
- /* Somehow we got an illegal reselection. Dump and panic. */
- printf("sfasintr: resel[0] %x resel[1] %x disconnected %d\n",
- dev->sc_resel[0], dev->sc_resel[1],
- dev->sc_units_disconnected);
- panic("sfasintr: Unexpected reselection!");
- }
-
- return(0);
-}
-
-/*
- * Part two of the interrupt machine. Handle disconnection and post command
- * processing. We know that we have an active nexus here.
- */
-int
-sfas_midaction(dev, rp, nexus)
- struct sfas_softc *dev;
- sfas_regmap_p rp;
- struct nexus *nexus;
-{
- int i, left, len, s;
- u_char status, msg;
-
- if (dev->sc_interrupt & SFAS_INT_DISCONNECT) {
- s = splbio();
- dev->sc_cur_nexus = 0;
-
- /* Mark chip as busy and clean up the chip FIFO. */
- dev->sc_flags &= ~SFAS_ACTIVE;
- *rp->sfas_command = SFAS_CMD_FLUSH_FIFO;
-
- /* Let the nexus state reflect what we have to do. */
- switch(nexus->state) {
- case SFAS_NS_SELECTED:
- dev->sc_sel_nexus = 0;
- nexus->flags &= ~SFAS_NF_SELECT_ME;
-
- /*
- * We were trying to select the unit. Probably no unit
- * at this ID.
- */
- nexus->xs->resid = dev->sc_len;
-
- nexus->status = -2;
- nexus->flags &= ~SFAS_NF_UNIT_BUSY;
- nexus->state = SFAS_NS_FINISHED;
- break;
-
- case SFAS_NS_SENSE:
- /*
- * Oops! We have to request sense data from this unit.
- * Do so.
- */
- dev->sc_led(dev, 0);
- nexus->flags |= SFAS_NF_REQUEST_SENSE;
- sfas_request_sense(dev, nexus);
- break;
-
- case SFAS_NS_DONE:
- /* All done. */
- nexus->xs->resid = dev->sc_len;
-
- nexus->flags &= ~SFAS_NF_UNIT_BUSY;
- nexus->state = SFAS_NS_FINISHED;
- dev->sc_led(dev, 0);
- break;
-
- case SFAS_NS_DISCONNECTING:
- /*
- * We have recieved a DISCONNECT message, so we are
- * doing a normal disconnection.
- */
- nexus->state = SFAS_NS_DISCONNECTED;
-
- dev->sc_units_disconnected++;
- break;
-
- case SFAS_NS_RESET:
- /*
- * We were reseting this SCSI-unit. Clean up the
- * nexus struct.
- */
- dev->sc_led(dev, 0);
- sfas_init_nexus(dev, nexus);
- break;
-
- default:
- /*
- * Unexpected disconnection! Cleanup and exit. This
- * shouldn't cause any problems.
- */
- printf("sfasintr: Unexpected disconnection\n");
- printf("sfasintr: u %x s %d p %d f %x c %x\n",
- nexus->lun_unit, nexus->state,
- dev->sc_status & SFAS_STAT_PHASE_MASK,
- nexus->flags, nexus->cbuf[0]);
-
- nexus->xs->resid = dev->sc_len;
-
- nexus->flags &= ~SFAS_NF_UNIT_BUSY;
- nexus->state = SFAS_NS_FINISHED;
- nexus->status = -3;
-
- dev->sc_led(dev, 0);
- break;
- }
-
- /*
- * If we have disconnected units, we MUST enable reselection
- * within 250ms.
- */
- if (dev->sc_units_disconnected &&
- !(dev->sc_flags & SFAS_ACTIVE))
- *rp->sfas_command = SFAS_CMD_ENABLE_RESEL;
-
- splx(s);
-
- /* Select the first pre-initialized nexus we find. */
- for(i=0; i<8; i++)
- if (dev->sc_nexus[i].flags & SFAS_NF_SELECT_ME)
- if (sfas_select_unit(dev, i) == 2)
- break;
-
- /* Does any unit need sense data? */
- for(i=0; i<8; i++)
- if (dev->sc_nexus[i].flags & SFAS_NF_REQUEST_SENSE) {
- sfas_request_sense(dev, &dev->sc_nexus[i]);
- break;
- }
-
- /* We are done with this nexus! */
- if (nexus->state == SFAS_NS_FINISHED)
- sfas_scsidone(dev, nexus->xs, nexus->status);
-
- return(1);
- }
-
- switch(nexus->state) {
- case SFAS_NS_SELECTED:
- dev->sc_cur_nexus = nexus;
- dev->sc_sel_nexus = 0;
-
- nexus->flags &= ~SFAS_NF_SELECT_ME;
-
- /*
- * We have selected a unit. Setup chip, restore pointers and
- * light the led.
- */
- *rp->sfas_syncper = nexus->syncper;
- *rp->sfas_syncoff = nexus->syncoff;
- *rp->sfas_config3 = nexus->config3;
-
- sfas_restore_pointers(dev);
-
- if (!(nexus->flags & SFAS_NF_SENSING))
- nexus->status = 0xFF;
- dev->sc_msg_in[0] = 0xFF;
- dev->sc_msg_in_len= 0;
-
- dev->sc_led(dev, 1);
-
- break;
-
- case SFAS_NS_DATA_IN:
- case SFAS_NS_DATA_OUT:
- /* We have transferred data. */
- if (dev->sc_dma_len)
- if (dev->sc_cur_link < dev->sc_max_link) {
- /*
- * Clean up dma and at the same time get how
- * many bytes that were NOT transferred.
- */
- left = dev->sc_setup_dma(dev, 0, 0, SFAS_DMA_CLEAR);
- len = dev->sc_dma_len;
-
- if (nexus->state == SFAS_NS_DATA_IN) {
- /*
- * If we were bumping we may have had an odd length
- * which means that there may be bytes left in the
- * fifo. We also need to move the data from the
- * bump buffer to the actual memory.
- */
- if (dev->sc_dma_buf == dev->sc_bump_pa)
- {
- while((*rp->sfas_fifo_flags&SFAS_FIFO_COUNT_MASK)
- && left)
- dev->sc_bump_va[len-(left--)] = *rp->sfas_fifo;
-
- bcopy(dev->sc_bump_va, dev->sc_buf, len-left);
- }
- } else {
- /* Count any unsent bytes and flush them. */
- left+= *rp->sfas_fifo_flags & SFAS_FIFO_COUNT_MASK;
- *rp->sfas_command = SFAS_CMD_FLUSH_FIFO;
- }
-
- /*
- * Update pointers/length to reflect the transferred
- * data.
- */
- dev->sc_len -= len-left;
- dev->sc_buf += len-left;
-
- dev->sc_dma_buf += len-left;
- dev->sc_dma_len = left;
-
- dev->sc_dma_blk_ptr += len-left;
- dev->sc_dma_blk_len -= len-left;
-
- /*
- * If it was the end of a dma block, we select the
- * next to begin with.
- */
- if (!dev->sc_dma_blk_len)
- dev->sc_cur_link++;
- }
- break;
-
- case SFAS_NS_STATUS:
- /*
- * If we were not sensing, grab the status byte. If we were
- * sensing and we got a bad status, let the user know.
- */
-
- status = *rp->sfas_fifo;
- msg = *rp->sfas_fifo;
-
- if (!(nexus->flags & SFAS_NF_SENSING))
- nexus->status = status;
- else if (status != 0)
- nexus->status = -1;
-
- /*
- * Preload the command complete message. Handeled in
- * sfas_postaction.
- */
- dev->sc_msg_in[0] = msg;
- dev->sc_msg_in_len = 1;
- nexus->flags |= SFAS_NF_HAS_MSG;
- break;
-
- default:
- break;
- }
-
- return(0);
-}
-
-/*
- * Part three of the interrupt machine. Handle phase changes (and repeated
- * phase passes). We know that we have an active nexus here.
- */
-int
-sfas_postaction(dev, rp, nexus)
- struct sfas_softc *dev;
- sfas_regmap_p rp;
- struct nexus *nexus;
-{
- int i, len;
- u_char cmd;
- short offset, period;
-
- cmd = 0;
-
- switch(dev->sc_status & SFAS_STAT_PHASE_MASK) {
- case SFAS_PHASE_DATA_OUT:
- case SFAS_PHASE_DATA_IN:
- if ((dev->sc_status & SFAS_STAT_PHASE_MASK) ==
- SFAS_PHASE_DATA_OUT)
- nexus->state = SFAS_NS_DATA_OUT;
- else
- nexus->state = SFAS_NS_DATA_IN;
-
- /* Make DMA ready to accept new data. Load active pointers
- * from the DMA block. */
- dev->sc_setup_dma(dev, 0, 0, SFAS_DMA_CLEAR);
- if (dev->sc_cur_link < dev->sc_max_link) {
- if (!dev->sc_dma_blk_len) {
- dev->sc_dma_blk_ptr = dev->sc_chain[dev->sc_cur_link].ptr;
- dev->sc_dma_blk_len = dev->sc_chain[dev->sc_cur_link].len;
- dev->sc_dma_blk_flg = dev->sc_chain[dev->sc_cur_link].flg;
- }
-
- /* We should use polled IO here. */
- if (dev->sc_dma_blk_flg == SFAS_CHAIN_PRG) {
- sfas_ixfer(dev, nexus->xs->flags & SCSI_POLL);
- dev->sc_cur_link++;
- dev->sc_dma_len = 0;
- break;
- }
- else if (dev->sc_dma_blk_flg == SFAS_CHAIN_BUMP)
- len = dev->sc_dma_blk_len;
- else
- len = dev->sc_need_bump(dev, dev->sc_dma_blk_ptr,
- dev->sc_dma_blk_len);
-
- /*
- * If len != 0 we must bump the data, else we just DMA it
- * straight into memory.
- */
- if (len) {
- dev->sc_dma_buf = dev->sc_bump_pa;
- dev->sc_dma_len = len;
-
- if (nexus->state == SFAS_NS_DATA_OUT)
- bcopy(dev->sc_buf, dev->sc_bump_va, dev->sc_dma_len);
- } else {
- dev->sc_dma_buf = dev->sc_dma_blk_ptr;
- dev->sc_dma_len = dev->sc_dma_blk_len;
- }
-
- /* Load DMA with adress and length of transfer. */
- dev->sc_setup_dma(dev, dev->sc_dma_buf, dev->sc_dma_len,
- ((nexus->state == SFAS_NS_DATA_OUT) ?
- SFAS_DMA_WRITE : SFAS_DMA_READ));
-
- printf("Using DMA !!!!\n");
- cmd = SFAS_CMD_TRANSFER_INFO | SFAS_CMD_DMA;
- } else {
- /*
- * Hmmm, the unit wants more info than we have or has
- * more than we want. Let the chip handle that.
- */
-
- *rp->sfas_tc_low = 0; /* was 256 but this does not make sense */
- *rp->sfas_tc_mid = 1;
- *rp->sfas_tc_high = 0;
- cmd = SFAS_CMD_TRANSFER_PAD;
- }
- break;
-
- case SFAS_PHASE_COMMAND:
- /* The scsi unit wants the command, send it. */
- nexus->state = SFAS_NS_SVC;
-
- *rp->sfas_command = SFAS_CMD_FLUSH_FIFO;
- for(i=0; i<5; i++);
-
- for(i=0; i<nexus->clen; i++)
- *rp->sfas_fifo = nexus->cbuf[i];
- cmd = SFAS_CMD_TRANSFER_INFO;
- break;
-
- case SFAS_PHASE_STATUS:
- /*
- * We've got status phase. Request status and command
- * complete message.
- */
- nexus->state = SFAS_NS_STATUS;
- cmd = SFAS_CMD_COMMAND_COMPLETE;
- break;
-
- case SFAS_PHASE_MESSAGE_OUT:
- /*
- * Either the scsi unit wants us to send a message or we have
- * asked for it by seting the ATN bit.
- */
- nexus->state = SFAS_NS_MSG_OUT;
-
- *rp->sfas_command = SFAS_CMD_FLUSH_FIFO;
-
- if (nexus->flags & SFAS_NF_DO_SDTR) {
- /* Send a Synchronous Data Transfer Request. */
-
- sfas_build_sdtrm(dev, nexus->period, nexus->offset);
- nexus->flags |= SFAS_NF_SDTR_SENT;
- nexus->flags &= ~SFAS_NF_DO_SDTR;
- } else if (nexus->flags & SFAS_NF_RESET) {
- /* Send a reset scsi unit message. */
-
- dev->sc_msg_out[0] = 0x0C;
- dev->sc_msg_out_len = 1;
- nexus->state = SFAS_NS_RESET;
- nexus->flags &= ~SFAS_NF_RESET;
- } else if (dev->sc_msg_out_len == 0) {
- /* Don't know what to send so we send a NOP message. */
-
- dev->sc_msg_out[0] = 0x08;
- dev->sc_msg_out_len = 1;
- }
-
- cmd = SFAS_CMD_TRANSFER_INFO;
-
- for(i=0; i<dev->sc_msg_out_len; i++)
- *rp->sfas_fifo = dev->sc_msg_out[i];
- dev->sc_msg_out_len = 0;
-
- break;
-
- case SFAS_PHASE_MESSAGE_IN:
- /* Receive a message from the scsi unit. */
- nexus->state = SFAS_NS_MSG_IN;
-
- while(!(nexus->flags & SFAS_NF_HAS_MSG)) {
- *rp->sfas_command = SFAS_CMD_TRANSFER_INFO;
- sfasiwait(dev);
-
- dev->sc_msg_in[dev->sc_msg_in_len++] = *rp->sfas_fifo;
-
- /* Check if we got all the bytes in the message. */
- if (dev->sc_msg_in[0] >= 0x80) ;
- else if (dev->sc_msg_in[0] >= 0x30) ;
- else if (((dev->sc_msg_in[0] >= 0x20) &&
- (dev->sc_msg_in_len == 2)) ||
- ((dev->sc_msg_in[0] != 0x01) &&
- (dev->sc_msg_in_len == 1))) {
- nexus->flags |= SFAS_NF_HAS_MSG;
- break;
- } else {
- if (dev->sc_msg_in_len >= 2)
- if ((dev->sc_msg_in[1]+2) == dev->sc_msg_in_len) {
- nexus->flags |= SFAS_NF_HAS_MSG;
- break;
- }
- }
-
- *rp->sfas_command = SFAS_CMD_MESSAGE_ACCEPTED;
- sfasiwait(dev);
-
- if ((dev->sc_status & SFAS_STAT_PHASE_MASK) !=
- SFAS_PHASE_MESSAGE_IN)
- break;
- }
-
- cmd = SFAS_CMD_MESSAGE_ACCEPTED;
- if (nexus->flags & SFAS_NF_HAS_MSG) {
- /* We have a message. Decode it. */
-
- switch(dev->sc_msg_in[0]) {
- case 0x00: /* COMMAND COMPLETE */
- if ((nexus->status == SCSI_CHECK) &&
- !(nexus->flags & SFAS_NF_SENSING))
- nexus->state = SFAS_NS_SENSE;
- else
- nexus->state = SFAS_NS_DONE;
- break;
- case 0x04: /* DISCONNECT */
- nexus->state = SFAS_NS_DISCONNECTING;
- break;
- case 0x02: /* SAVE DATA POINTER */
- sfas_save_pointers(dev);
- break;
- case 0x03: /* RESTORE DATA POINTERS */
- sfas_restore_pointers(dev);
- break;
- case 0x07: /* MESSAGE REJECT */
- /*
- * If we had sent a SDTR and we got a message
- * reject, the scsi docs say that we must go
- * to async transfer.
- */
- if (nexus->flags & SFAS_NF_SDTR_SENT) {
- nexus->flags &= ~SFAS_NF_SDTR_SENT;
-
- nexus->config3 &= ~SFAS_CFG3_FASTSCSI;
- nexus->syncper = 5;
- nexus->syncoff = 0;
-
- *rp->sfas_syncper = nexus->syncper;
- *rp->sfas_syncoff = nexus->syncoff;
- *rp->sfas_config3 = nexus->config3;
- } else
- /*
- * Something was rejected but we don't know
- * what! PANIC!
- */
- panic("sfasintr: Unknown message rejected!");
- break;
- case 0x08: /* MO OPERATION */
- break;
- case 0x01: /* EXTENDED MESSAGE */
- switch(dev->sc_msg_in[2]) {
- case 0x01:/* SYNC. DATA TRANSFER REQUEST */
- /* Decode the SDTR message. */
- period = 4*dev->sc_msg_in[3];
- offset = dev->sc_msg_in[4];
-
- /*
- * Make sure that the specs are within
- * chip limits. Note that if we
- * initiated the negotiation the specs
- * WILL be withing chip limits. If it
- * was the scsi unit that initiated
- * the negotiation, the specs may be
- * to high.
- */
- if (offset > 16)
- offset = 16;
- if ((period < 200) &&
- (dev->sc_clock_freq <= 25))
- period = 200;
-
- if (offset == 0)
- period = 5*dev->sc_clock_period;
-
- nexus->syncper = period/
- dev->sc_clock_period;
- nexus->syncoff = offset;
-
- if (period < 200)
- nexus->config3 |= SFAS_CFG3_FASTSCSI;
- else
- nexus->config3 &=~SFAS_CFG3_FASTSCSI;
-
- nexus->flags |= SFAS_NF_SYNC_TESTED;
-
- *rp->sfas_syncper = nexus->syncper;
- *rp->sfas_syncoff = nexus->syncoff;
- *rp->sfas_config3 = nexus->config3;
-
- /*
- * Hmmm, it seems that the scsi unit
- * initiated sync negotiation, so lets
- * reply acording to scsi-2 standard.
- */
- if (!(nexus->flags& SFAS_NF_SDTR_SENT))
- {
- if ((dev->sc_config_flags &
- SFAS_NO_SYNCH) ||
- (dev->sc_config_flags &
- SFAS_NO_DMA) ||
- sfas_inhibit_sync[
- nexus->lun_unit & 7]) {
- period = 200;
- offset = 0;
- }
-
- nexus->offset = offset;
- nexus->period = period;
- nexus->flags |= SFAS_NF_DO_SDTR;
- *rp->sfas_command = SFAS_CMD_SET_ATN;
- }
-
- nexus->flags &= ~SFAS_NF_SDTR_SENT;
- break;
-
- case 0x00: /* MODIFY DATA POINTERS */
- case 0x02: /* EXTENDED IDENTIFY (SCSI-1) */
- case 0x03: /* WIDE DATA TRANSFER REQUEST */
- default:
- /* Reject any unhandeled messages. */
-
- dev->sc_msg_out[0] = 0x07;
- dev->sc_msg_out_len = 1;
- *rp->sfas_command = SFAS_CMD_SET_ATN;
- cmd = SFAS_CMD_MESSAGE_ACCEPTED;
- break;
- }
- break;
-
- default:
- /* Reject any unhandeled messages. */
-
- dev->sc_msg_out[0] = 0x07;
- dev->sc_msg_out_len = 1;
- *rp->sfas_command = SFAS_CMD_SET_ATN;
- cmd = SFAS_CMD_MESSAGE_ACCEPTED;
- break;
- }
- nexus->flags &= ~SFAS_NF_HAS_MSG;
- dev->sc_msg_in_len = 0;
- }
- break;
- default:
- printf("SFASINTR: UNKNOWN PHASE! phase: %d\n",
- dev->sc_status & SFAS_STAT_PHASE_MASK);
- dev->sc_led(dev, 0);
- sfas_scsidone(dev, nexus->xs, -4);
-
- return(-1);
- }
-
- if (cmd)
- *rp->sfas_command = cmd;
-
- return(0);
-}
-
-/*
- * Stub for interrupt machine.
- */
-void
-sfasintr(dev)
- struct sfas_softc *dev;
-{
- sfas_regmap_p rp;
- struct nexus *nexus;
-
- rp = dev->sc_fas;
-
- if (!sfas_pretests(dev, rp)) {
-
- nexus = dev->sc_cur_nexus;
- if (nexus == NULL)
- nexus = dev->sc_sel_nexus;
-
- if (nexus)
- if (!sfas_midaction(dev, rp, nexus))
- sfas_postaction(dev, rp, nexus);
- }
-}
-
-/*
- * sfasicmd is used to perform IO when we can't use interrupts. sfasicmd
- * emulates the normal environment by waiting for the chip and calling
- * sfasintr.
- */
-void
-sfasicmd(dev, pendp)
- struct sfas_softc *dev;
- struct sfas_pending *pendp;
-{
- sfas_regmap_p rp;
- struct nexus *nexus;
-
- nexus = &dev->sc_nexus[pendp->xs->sc_link->target];
- rp = dev->sc_fas;
-
- if (!sfasselect(dev, pendp, (char *)pendp->xs->cmd, pendp->xs->cmdlen,
- (char *)pendp->xs->data, pendp->xs->datalen,
- SFAS_SELECT_I))
- panic("sfasicmd: Couldn't select unit");
-
- while(nexus->state != SFAS_NS_FINISHED) {
- sfasiwait(dev);
- sfasintr(dev);
- }
-
- nexus->flags &= ~SFAS_NF_SYNC_TESTED;
-}
diff --git a/sys/arch/arm32/podulebus/sfasreg.h b/sys/arch/arm32/podulebus/sfasreg.h
deleted file mode 100644
index 9c4020ae7f6..00000000000
--- a/sys/arch/arm32/podulebus/sfasreg.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/* $NetBSD: sfasreg.h,v 1.1 1996/01/31 23:26:45 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Daniel Widenfalk
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Daniel Widenfalk
- * for the NetBSD Project.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _SFASREG_H_
-#define _SFASREG_H_
-
-/*
- * Emulex FAS216 SCSI interface hardware description.
- */
-
-typedef volatile unsigned char vu_char;
-
-typedef struct {
- vu_char *sfas_tc_low; /* rw: Transfer count low */
- vu_char *sfas_tc_mid; /* rw: Transfer count mid */
- vu_char *sfas_fifo; /* rw: Data FIFO */
- vu_char *sfas_command; /* rw: Chip command reg */
- vu_char *sfas_dest_id; /* w: (Re)select bus ID */
-#define sfas_status sfas_dest_id /* r: Status */
- vu_char *sfas_timeout; /* w: (Re)select timeout */
-#define sfas_interrupt sfas_timeout /* r: Interrupt */
- vu_char *sfas_syncper; /* w: Synch. transfer period */
-#define sfas_seqstep sfas_syncper /* r: Sequence step */
- vu_char *sfas_syncoff; /* w: Synch. transfer offset */
-#define sfas_fifo_flags sfas_syncoff /* r: FIFO flags */
- vu_char *sfas_config1; /* rw: Config register #1 */
- vu_char *sfas_clkconv; /* w: Clock conv. factor */
- vu_char *sfas_test; /* w: Test register */
- vu_char *sfas_config2; /* rw: Config register #2 */
- vu_char *sfas_config3; /* rw: Config register #3 */
- vu_char *sfas_tc_high; /* rw: Transfer count high */
- vu_char *sfas_fifo_bot; /* w: FIFO bottom register */
-} sfas_regmap_t;
-typedef sfas_regmap_t *sfas_regmap_p;
-
-/* Commands for the FAS216 */
-#define SFAS_CMD_DMA 0x80
-
-#define SFAS_CMD_SEL_NO_ATN 0x41
-#define SFAS_CMD_SEL_ATN 0x42
-#define SFAS_CMD_SEL_ATN3 0x46
-#define SFAS_CMD_SEL_ATN_STOP 0x43
-
-#define SFAS_CMD_ENABLE_RESEL 0x44
-#define SFAS_CMD_DISABLE_RESEL 0x45
-
-#define SFAS_CMD_TRANSFER_INFO 0x10
-#define SFAS_CMD_TRANSFER_PAD 0x98
-
-#define SFAS_CMD_COMMAND_COMPLETE 0x11
-#define SFAS_CMD_MESSAGE_ACCEPTED 0x12
-
-#define SFAS_CMD_SET_ATN 0x1A
-#define SFAS_CMD_RESET_ATN 0x1B
-
-#define SFAS_CMD_NOP 0x00
-#define SFAS_CMD_FLUSH_FIFO 0x01
-#define SFAS_CMD_RESET_CHIP 0x02
-#define SFAS_CMD_RESET_SCSI_BUS 0x03
-
-#define SFAS_STAT_PHASE_MASK 0x07
-#define SFAS_STAT_PHASE_TRANS_CPLT 0x08
-#define SFAS_STAT_TRANSFER_COUNT_ZERO 0x10
-#define SFAS_STAT_PARITY_ERROR 0x20
-#define SFAS_STAT_GROSS_ERROR 0x40
-#define SFAS_STAT_INTERRUPT_PENDING 0x80
-
-#define SFAS_PHASE_DATA_OUT 0
-#define SFAS_PHASE_DATA_IN 1
-#define SFAS_PHASE_COMMAND 2
-#define SFAS_PHASE_STATUS 3
-#define SFAS_PHASE_MESSAGE_OUT 6
-#define SFAS_PHASE_MESSAGE_IN 7
-
-#define SFAS_DEST_ID_MASK 0x07
-
-#define SFAS_INT_SELECTED 0x01
-#define SFAS_INT_SELECTED_WITH_ATN 0x02
-#define SFAS_INT_RESELECTED 0x04
-#define SFAS_INT_FUNCTION_COMPLETE 0x08
-#define SFAS_INT_BUS_SERVICE 0x10
-#define SFAS_INT_DISCONNECT 0x20
-#define SFAS_INT_ILLEGAL_COMMAND 0x40
-#define SFAS_INT_SCSI_RESET_DETECTED 0x80
-
-#define SFAS_SYNCHRON_PERIOD_MASK 0x1F
-
-#define SFAS_FIFO_COUNT_MASK 0x1F
-#define SFAS_FIFO_SEQUENCE_STEP_MASK 0xE0
-#define SFAS_FIFO_SEQUENCE_SHIFT 5
-
-#define SFAS_SYNCHRON_OFFSET_MASK 0x0F
-#define SFAS_SYNC_ASSERT_MASK 0x30
-#define SFAS_SYNC_ASSERT_SHIFT 4
-#define SFAS_SYNC_DEASSERT_MASK 0x30
-#define SFAS_SYNC_DEASSERT_SHIFT 6
-
-#define SFAS_CFG1_BUS_ID_MASK 0x07
-#define SFAS_CFG1_CHIP_TEST_MODE 0x08
-#define SFAS_CFG1_SCSI_PARITY_ENABLE 0x10
-#define SFAS_CFG1_PARITY_TEST_MODE 0x20
-#define SFAS_CFG1_SCSI_RES_INT_DIS 0x40
-#define SFAS_CFG1_SLOW_CABLE_MODE 0x80
-
-#define SFAS_CLOCK_CONVERSION_MASK 0x07
-
-#define SFAS_TEST_TARGET_TEST_MODE 0x01
-#define SFAS_TEST_INITIATOR_TEST_MODE 0x02
-#define SFAS_TEST_TRISTATE_TEST_MODE 0x04
-
-#define SFAS_CFG2_DMA_PARITY_ENABLE 0x01
-#define SFAS_CFG2_REG_PARITY_ENABLE 0x02
-#define SFAS_CFG2_TARG_BAD_PARITY_ABORT 0x04
-#define SFAS_CFG2_SCSI_2_MODE 0x08
-#define SFAS_CFG2_TRISTATE_DMA_REQ 0x10
-#define SFAS_CFG2_BYTE_CONTROL_MODE 0x20
-#define SFAS_CFG2_FEATURES_ENABLE 0x40
-#define SFAS_CFG2_RESERVE_FIFO_BYTE 0x80
-
-#define SFAS_CFG3_THRESHOLD_8_MODE 0x01
-#define SFAS_CFG3_ALTERNATE_DMA_MODE 0x02
-#define SFAS_CFG3_SAVE_RESIDUAL_BYTE 0x04
-#define SFAS_CFG3_FASTCLK 0x08
-#define SFAS_CFG3_FASTSCSI 0x10
-#define SFAS_CFG3_CDB10 0x20
-#define SFAS_CFG3_QENB 0x40
-#define SFAS_CFG3_IDRESCHK 0x80
-
-#endif
diff --git a/sys/arch/arm32/podulebus/sfasvar.h b/sys/arch/arm32/podulebus/sfasvar.h
deleted file mode 100644
index 04dc68d70f8..00000000000
--- a/sys/arch/arm32/podulebus/sfasvar.h
+++ /dev/null
@@ -1,263 +0,0 @@
-/* $NetBSD: sfasvar.h,v 1.1 1996/01/31 23:26:49 mark Exp $ */
-
-/*
- * Copyright (c) 1995 Daniel Widenfalk
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Daniel Widenfalk
- * for the NetBSD Project.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _SFASVAR_H_
-#define _SFASVAR_H_
-
-#ifndef _SFASREG_H_
-#include <arm32/podulebus/sfasreg.h>
-#endif
-
-/*
- * MAXCHAIN is the anticipated maximum number of chain blocks needed. This
- * assumes that we are NEVER requested to transfer more than MAXPHYS bytes.
- */
-#define MAXCHAIN (MAXPHYS/NBPG+2)
-
-/*
- * Maximum number of requests standing by. Could be anything, but I think 9
- * looks nice :-) NOTE: This does NOT include requests already started!
- */
-#define MAXPENDING 9 /* 7 IDs + 2 extra */
-
-/*
- * DMA chain block. If flg == SFAS_CHAIN_PRG or flg == SFAS_CHAIN_BUMP then
- * ptr is a VIRTUAL adress. If flg == SFAS_CHAIN_DMA then ptr is a PHYSICAL
- * adress.
- */
-struct sfas_dma_chain {
- vm_offset_t ptr;
- u_short len;
- short flg;
-};
-#define SFAS_CHAIN_DMA 0x00
-#define SFAS_CHAIN_BUMP 0x01
-#define SFAS_CHAIN_PRG 0x02
-
-
-/*
- * This struct contains the necessary info for a pending request. Pointer to
- * a scsi_xfer struct.
- */
-struct sfas_pending {
- TAILQ_ENTRY(sfas_pending) link;
- struct scsi_xfer *xs;
-};
-
-/*
- * nexus contains all active data for one SCSI unit. Parts of the info in this
- * struct survives between scsi commands.
- */
-struct nexus {
- struct scsi_xfer *xs; /* Pointer to request */
-
- u_char ID; /* ID message to be sent */
- u_char clen; /* scsi command length + */
- u_char cbuf[14]; /* the actual command bytes */
-
- struct sfas_dma_chain dma[MAXCHAIN]; /* DMA chain blocks */
- short max_link; /* Maximum used of above */
- short cur_link; /* Currently handled block */
-
- u_char *buf; /* Virtual adress of data */
- int len; /* Bytes left to transfer */
-
- vm_offset_t dma_buf; /* Current DMA adress */
- int dma_len; /* Current DMA length */
-
- vm_offset_t dma_blk_ptr; /* Current chain adress */
- int dma_blk_len; /* Current chain length */
- u_char dma_blk_flg; /* Current chain flags */
-
- u_char state; /* Nexus state, see below */
- u_short flags; /* Nexus flags, see below */
-
- short period; /* Sync period to request */
- u_char offset; /* Sync offset to request */
-
- u_char syncper; /* FAS216 variable storage */
- u_char syncoff; /* FAS216 variable storage */
- u_char config3; /* FAS216 variable storage */
-
- u_char lun_unit; /* (Lun<<4) | Unit of nexus */
- u_char status; /* Status byte from unit*/
-
-};
-
-/* SCSI nexus_states */
-#define SFAS_NS_IDLE 0 /* Nexus idle */
-#define SFAS_NS_SELECTED 1 /* Last command was a SELECT command */
-#define SFAS_NS_DATA_IN 2 /* Last command was a TRANSFER_INFO */
- /* command during a data in phase */
-#define SFAS_NS_DATA_OUT 3 /* Last command was a TRANSFER_INFO */
- /* command during a data out phase */
-#define SFAS_NS_STATUS 4 /* We have send a COMMAND_COMPLETE */
- /* command and are awaiting status */
-#define SFAS_NS_MSG_IN 5 /* Last phase was MESSAGE IN */
-#define SFAS_NS_MSG_OUT 6 /* Last phase was MESSAGE OUT */
-#define SFAS_NS_SVC 7 /* We have sent the command */
-#define SFAS_NS_DISCONNECTING 8 /* We have recieved a disconnect msg */
-#define SFAS_NS_DISCONNECTED 9 /* We are disconnected */
-#define SFAS_NS_RESELECTED 10 /* We was reselected */
-#define SFAS_NS_DONE 11 /* Done. Prephsase to FINISHED */
-#define SFAS_NS_FINISHED 12 /* Realy done. Call scsi_done */
-#define SFAS_NS_SENSE 13 /* We are requesting sense */
-#define SFAS_NS_RESET 14 /* We are reseting this unit */
-
-/* SCSI nexus flags */
-#define SFAS_NF_UNIT_BUSY 0x0001 /* Unit is not available */
-
-#define SFAS_NF_SELECT_ME 0x0002 /* Nexus is set up, waiting for bus */
-
-#define SFAS_NF_REQUEST_SENSE 0x0004 /* We should request sense */
-#define SFAS_NF_SENSING 0x0008 /* We are sensing */
-
-#define SFAS_NF_HAS_MSG 0x0010 /* We have recieved a complete msg */
-
-#define SFAS_NF_DO_SDTR 0x0020 /* We should send a SDTR */
-#define SFAS_NF_SDTR_SENT 0x0040 /* We have sent a SDTR */
-#define SFAS_NF_SYNC_TESTED 0x0080 /* We have negotiated sync */
-
-#define SFAS_NF_RESET 0x0100 /* Reset this nexus */
-#define SFAS_NF_IMMEDIATE 0x0200 /* We are operating from sfasicmd */
-
-#define SFAS_NF_DEBUG 0x8000 /* As it says: DEBUG */
-
-struct sfas_softc {
- struct device sc_dev; /* System required struct */
- struct scsi_link sc_link; /* For sub devices */
- irqhandler_t sc_ih; /* Interrupt chain struct */
-
- TAILQ_HEAD(,sfas_pending) sc_xs_pending;
- TAILQ_HEAD(,sfas_pending) sc_xs_free;
- struct sfas_pending sc_xs_store[MAXPENDING];
-
- sfas_regmap_p sc_fas; /* FAS216 Address */
- void *sc_spec; /* Board-specific data */
-
- u_char *sc_bump_va; /* Bumpbuf virtual adr */
- vm_offset_t sc_bump_pa; /* Bumpbuf physical adr */
- int sc_bump_sz; /* Bumpbuf size */
-
-/* Configuration registers, must be set BEFORE sfasinitialize */
- u_char sc_clock_freq;
- u_short sc_timeout;
- u_char sc_host_id;
- u_char sc_config_flags;
-
-/* Generic DMA functions */
- int (*sc_setup_dma)();
- int (*sc_build_dma_chain)();
- int (*sc_need_bump)();
-
-/* Generic Led data */
- int sc_led_status;
- void (*sc_led)();
-
-/* Nexus list */
- struct nexus sc_nexus[8];
- struct nexus *sc_cur_nexus;
- struct nexus *sc_sel_nexus;
-
-/* Current transfer data */
- u_char *sc_buf; /* va */
- int sc_len;
-
- vm_offset_t sc_dma_buf; /* pa */
- int sc_dma_len;
- vm_offset_t sc_dma_blk_ptr;
- int sc_dma_blk_len;
- short sc_dma_blk_flg;
-
- struct sfas_dma_chain *sc_chain; /* Current DMA chain */
- short sc_max_link;
- short sc_cur_link;
-
-/* Interrupt registers */
- u_char sc_status;
- u_char sc_interrupt;
- u_char sc_resel[2];
-
- u_char sc_units_disconnected;
-
-/* Storage for FAS216 config registers (current values) */
- u_char sc_config1;
- u_char sc_config2;
- u_char sc_config3;
- u_char sc_clock_conv_fact;
- u_char sc_timeout_val;
- u_char sc_clock_period;
-
- u_char sc_msg_in[7];
- u_char sc_msg_in_len;
-
- u_char sc_msg_out[7];
- u_char sc_msg_out_len;
-
- u_char sc_unit;
- u_char sc_lun;
- u_char sc_flags;
-};
-
-#define SFAS_DMA_READ 0
-#define SFAS_DMA_WRITE 1
-#define SFAS_DMA_CLEAR 2
-
-/* sc_flags */
-#define SFAS_ACTIVE 0x01
-#define SFAS_DONT_WAIT 0x02
-
-/* SCSI Selection modes */
-#define SFAS_SELECT 0x00 /* Normal selection: No sync, no resel */
-#define SFAS_SELECT_R 0x01 /* Reselection allowed */
-#define SFAS_SELECT_S 0x02 /* Synchronous transfer allowed */
-#define SFAS_SELECT_I 0x04 /* Selection for sfasicmd */
-#define SFAS_SELECT_K 0x08 /* Send a BUS DEVICE RESET message (Kill) */
-
-/* Nice abbreviations of the above */
-#define SFAS_SELECT_RS (SFAS_SELECT_R|SFAS_SELECT_S)
-#define SFAS_SELECT_RI (SFAS_SELECT_R|SFAS_SELECT_I)
-#define SFAS_SELECT_SI (SFAS_SELECT_S|SFAS_SELECT_I)
-#define SFAS_SELECT_RSI (SFAS_SELECT_R|SFAS_SELECT_S|SFAS_SELECT_I)
-
-/* sc_config_flags */
-#define SFAS_NO_SYNCH 0x01 /* Disable synchronous transfer */
-#define SFAS_NO_DMA 0x02 /* Do not use DMA! EVER! */
-#define SFAS_NO_RESELECT 0x04 /* Do not allow relesection */
-#define SFAS_SLOW_CABLE 0x08 /* Cable is "unsafe" for fast scsi-2 */
-#define SFAS_SLOW_START 0x10 /* There are slow starters on the bus */
-
-void sfasinitialize __P((struct sfas_softc *sc));
-void sfas_minphys __P((struct buf *bp));
-int sfas_scsicmd __P((struct scsi_xfer *));
-
-#endif /* _SFASVAR_H_ */
diff --git a/sys/arch/atari/Makefile b/sys/arch/atari/Makefile
deleted file mode 100644
index d8c45becb98..00000000000
--- a/sys/arch/atari/Makefile
+++ /dev/null
@@ -1,45 +0,0 @@
-# $NetBSD: Makefile,v 1.1.1.1 1995/03/26 07:12:03 leo Exp $
-#
-# from: @(#)Makefile 7.3 (Berkeley) 6/9/91
-#
-S=${BSDSRCDIR}/sys
-COMM= $S/vm/*.[ch] $S/ufs/*.[ch] $S/sys/*.h $S/compat/sunos/*.[ch] \
- $S/nfs/*.[ch] $S/netns/*.[ch] $S/netiso/*.[ch] \
- $S/netiso/xebec/*.[ch] $S/netinet/*.[ch] $S/netccitt/*.[ch] \
- $S/net/*.[ch] $S/miscfs/*/*.[ch] $S/kern/*.[ch] $S/dev/*.[ch] \
- $S/scsi/*.[ch] $S/lib/libkern/m68k/*.[ch] $S/lib/libkern/*.[ch]
-
-# Makefile for atari tags file
-
-all:
- @echo "make tags or links only"
-
-TATARI= $S/arch/atari/tags
-SATARI= $S/arch/m68k/m68k/*.c $S/arch/m68k/include/*.h \
- $S/arch/atari/atari/*.[ch] $S/arch/atari/include/*.h \
- $S/arch/atari/dev/*.[ch]
-AATARI= $S/arch/m68k/m68k/*.s $S/arch/atari/atari/*.s
-
-# Directories in which to place atari tags links
-DATARI= atari dev include
-
-TAGS:
- -etags -dt ${COMM} ${SATARI} ${AATARI}
- egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${AATARI} | \
- sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
- >> ${TATARI}/tags
-
-tags:
- -ctags -dtf ${TATARI} ${COMM} ${SATARI}
- egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${AATARI} | \
- sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
- >> ${TATARI}
- sort -o ${TATARI} ${TATARI}
-
-links:
- -for i in ${DATARI}; do \
- rm -f $$i/tags; rm -f $$i/TAGS ; \
- ln -s ../tags $$i/tags; ln -s ../TAGS $$i/TAGS; done
-
-.include <bsd.prog.mk>
-
diff --git a/sys/arch/atari/atari/atari_init.c b/sys/arch/atari/atari/atari_init.c
deleted file mode 100644
index 62b3890656e..00000000000
--- a/sys/arch/atari/atari/atari_init.c
+++ /dev/null
@@ -1,546 +0,0 @@
-/* $NetBSD: atari_init.c,v 1.9 1995/12/16 21:40:28 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman
- * Copyright (c) 1994 Michael L. Hitch
- * Copyright (c) 1993 Markus Wild
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Markus Wild.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <vm/vm.h>
-#include <sys/user.h>
-#include <sys/ioctl.h>
-#include <sys/select.h>
-#include <sys/tty.h>
-#include <sys/proc.h>
-#include <sys/buf.h>
-#include <sys/msgbuf.h>
-#include <sys/mbuf.h>
-#include <sys/protosw.h>
-#include <sys/domain.h>
-#include <sys/dkbad.h>
-#include <sys/reboot.h>
-#include <sys/exec.h>
-#include <vm/pmap.h>
-#include <machine/vmparam.h>
-#include <machine/pte.h>
-#include <machine/cpu.h>
-#include <machine/iomap.h>
-#include <machine/mfp.h>
-#include <machine/scu.h>
-#include <machine/video.h>
-#include <atari/atari/misc.h>
-
-extern u_int lowram;
-extern u_int Sysptmap, Sysptsize, Sysseg, proc0paddr;
-u_int *Sysmap;
-int machineid, mmutype, cpu040, astpending;
-char *vmmap;
-pv_entry_t pv_table;
-
-/*
- * Need-to-know for kernel reload code.
- */
-u_long boot_ttphystart, boot_ttphysize, boot_stphysize;
-
-extern char *esym;
-
-/*
- * This is the virtual address of physical page 0. Used by 'do_boot()'.
- */
-vm_offset_t page_zero;
-
-/*
- * Crude support for allocation in ST-ram. Currently only used to allocate
- * video ram.
- * The physical address is also returned because the video init needs it to
- * setup the controller at the time the vm-system is not yet operational so
- * 'kvtop()' cannot be used.
- */
-#ifndef ST_POOL_SIZE
-#define ST_POOL_SIZE 40 /* XXX: enough? */
-#endif
-
-u_long st_pool_size = ST_POOL_SIZE * NBPG; /* Patchable */
-u_long st_pool_virt, st_pool_phys;
-
-/*
- * this is the C-level entry function, it's called from locore.s.
- * Preconditions:
- * Interrupts are disabled
- * PA == VA, we don't have to relocate addresses before enabling
- * the MMU
- * Exec is no longer available (because we're loaded all over
- * low memory, no ExecBase is available anymore)
- *
- * It's purpose is:
- * Do the things that are done in locore.s in the hp300 version,
- * this includes allocation of kernel maps and enabling the MMU.
- *
- * Some of the code in here is `stolen' from Amiga MACH, and was
- * written by Bryan Ford and Niklas Hallqvist.
- *
- * Very crude 68040 support by Michael L. Hitch.
- */
-
-void
-start_c(id, ttphystart, ttphysize, stphysize, esym_addr)
-int id; /* Machine id */
-u_int ttphystart, ttphysize; /* Start address and size of TT-ram */
-u_int stphysize; /* Size of ST-ram */
-char *esym_addr; /* Address of kernel '_esym' symbol */
-{
- extern char end[];
- extern void etext();
- extern u_long protorp[2];
- u_int pstart; /* Next available physical address*/
- u_int vstart; /* Next available virtual address */
- u_int avail;
- u_int pt, ptsize;
- u_int tc, i;
- u_int *sg, *pg;
- u_int sg_proto, pg_proto;
- u_int end_loaded;
- u_int ptextra;
- u_long kbase;
-
- boot_ttphystart = ttphystart;
- boot_ttphysize = ttphysize;
- boot_stphysize = stphysize;
-
- /*
- * The following is a hack. We do not know how much ST memory we
- * really need until after configuration has finished. At this
- * time I have no idea how to grab ST memory at that time.
- * The round_page() call is ment to correct errors made by
- * binpatching!
- */
- st_pool_size = atari_round_page(st_pool_size);
- st_pool_phys = stphysize - st_pool_size;
- stphysize = st_pool_phys;
-
- machineid = id;
- esym = esym_addr;
-
- /*
- * the kernel ends at end() or esym.
- */
- if(esym == NULL)
- end_loaded = (u_int)end;
- else end_loaded = (u_int)esym;
-
-
- /*
- * If we have enough fast-memory to put the kernel in, do it!
- */
- if(ttphysize >= end_loaded)
- kbase = ttphystart;
- else kbase = 0;
-
- /*
- * update these as soon as possible!
- */
- PAGE_SIZE = NBPG;
- PAGE_MASK = NBPG-1;
- PAGE_SHIFT = PG_SHIFT;
-
- /*
- * We run the kernel from ST memory at the moment.
- * The kernel segment table is put just behind the loaded image.
- * pstart: start of usable ST memory
- * avail : size of ST memory available.
- */
- pstart = (u_int)end_loaded;
- pstart = atari_round_page(pstart);
- avail = stphysize - pstart;
-
- /*
- * allocate the kernel segment table
- */
- Sysseg = pstart;
- pstart += NBPG;
- avail -= NBPG;
-
- /*
- * We only allocate 1 extra pagetable. it currently only contains
- * entries for Sysmap.
- */
- ptextra = 0;
-
- /*
- * allocate initial page table pages
- */
- pt = pstart;
- ptsize = (Sysptsize + howmany(ptextra, NPTEPG)) << PGSHIFT;
- pstart += ptsize;
- avail -= ptsize;
-
- /*
- * allocate kernel page table map
- */
- Sysptmap = pstart;
- pstart += NBPG;
- avail -= NBPG;
-
- /*
- * Set Sysmap; mapped after page table pages. Because I too (LWP)
- * didn't understand the reason for this, I borrowed the following
- * (sligthly modified) comment from mac68k/locore.s:
- * LAK: There seems to be some confusion here about the next line,
- * so I'll explain. The kernel needs some way of dynamically modifying
- * the page tables for its own virtual memory. What it does is that it
- * has a page table map. This page table map is mapped right after the
- * kernel itself (in our implementation; in HP's it was after the I/O
- * space). Therefore, the first three (or so) entries in the segment
- * table point to the first three pages of the page tables (which
- * point to the kernel) and the next entry in the segment table points
- * to the page table map (this is done later). Therefore, the value
- * of the pointer "Sysmap" will be something like 16M*3 = 48M. When
- * the kernel addresses this pointer (e.g., Sysmap[0]), it will get
- * the first longword of the first page map (== pt[0]). Since the
- * page map mirrors the segment table, addressing any index of Sysmap
- * will give you a PTE of the page maps which map the kernel.
- */
- Sysmap = (u_int *)(ptsize << (SEGSHIFT - PGSHIFT));
-
- /*
- * Initialize segment table and page table map.
- */
- sg_proto = (pt + kbase) | SG_RW | SG_V;
- pg_proto = (pt + kbase) | PG_RW | PG_CI | PG_V;
- /*
- * map so many segs
- */
- sg = (u_int *)Sysseg;
- pg = (u_int *)Sysptmap;
- while(sg_proto < (pstart + kbase)) {
- *sg++ = sg_proto;
- *pg++ = pg_proto;
- sg_proto += NBPG;
- pg_proto += NBPG;
- }
- /*
- * invalidate the remainder of the tables
- */
- do {
- *sg++ = SG_NV;
- *pg++ = PG_NV;
- } while(sg < (u_int *)(Sysseg + ATARI_STSIZE));
-
- /*
- * initialize kernel page table page(s).
- * Assume load at VA 0.
- * - Text pages are RO
- */
- pg_proto = (0 + kbase) | PG_RO | PG_V;
- pg = (u_int *) pt;
- for(i = 0; i < (u_int)etext; i += NBPG, pg_proto += NBPG)
- *pg++ = pg_proto;
-
- /*
- * data, bss and dynamic tables are read/write
- */
- pg_proto = (pg_proto & PG_FRAME) | PG_RW | PG_V;
-
- /*
- * go till end of data allocated so far
- * plus proc0 u-area (to be allocated)
- */
- for(; i < pstart + USPACE; i += NBPG, pg_proto += NBPG)
- *pg++ = pg_proto;
-
- /*
- * invalidate remainder of kernel PT
- */
- while(pg < (u_int *)(pt + ptsize))
- *pg++ = PG_NV;
-
- /*
- * Go back and validate internal IO PTEs. They MUST be Cache inhibited!
- */
- pg = (u_int *) pt + (AD_IO / NBPG);
- pg_proto = AD_IO | PG_RW | PG_CI | PG_V;
- while(pg_proto < AD_EIO) {
- *pg++ = pg_proto;
- pg_proto += NBPG;
- }
-
- /*
- * Clear proc0 user-area
- */
- bzero((u_char *)pstart, USPACE);
-
- /*
- * Save KVA of proc0 user-area and allocate it
- */
- proc0paddr = pstart;
- pstart += USPACE;
- avail -= USPACE;
-
- /*
- * At this point, virtual and physical allocation starts to divert.
- */
- vstart = pstart;
-
- /*
- * Map the allocated space in ST-ram now. In the contig-case, there
- * is no need to make a distinction between virtual and physical
- * adresses. But I make it anyway to be prepared.
- * Physcal space is already reserved!
- */
- st_pool_virt = vstart;
- pg = (u_int *) pt + (vstart / NBPG);
- pg_proto = st_pool_phys | PG_RW | PG_CI | PG_V;
- vstart += st_pool_size;
- while(pg_proto < (st_pool_phys + st_pool_size)) {
- *pg++ = pg_proto;
- pg_proto += NBPG;
- }
-
- /*
- * Map physical page zero (First ST-ram page)
- */
- page_zero = vstart;
- pg = (u_int *) pt + (vstart / NBPG);
- *pg = PG_RW | PG_CI | PG_V;
- vstart += NBPG;
-
- lowram = 0 >> PGSHIFT; /* XXX */
-
- /*
- * Fill in segments. The page indexes will be initialized
- * later when all reservations are made.
- */
- phys_segs[0].start = 0;
- phys_segs[0].end = stphysize;
- phys_segs[1].start = ttphystart;
- phys_segs[1].end = ttphystart + ttphysize;
- phys_segs[2].start = 0; /* End of segments! */
-
- if(kbase) {
- /*
- * First page of ST-ram is unusable, reserve the space
- * for the kernel in the TT-ram segment.
- */
- phys_segs[0].start = NBPG;
- phys_segs[1].start += pstart;
- }
- else {
- /*
- * Because the first 8 addresses of ST-memory are mapped to
- * ROM, we remap them. This makes the debugger stack-trace
- * work.
- */
- extern u_long first_8_bytes[];
- u_long *sp, *dp;
-
- /*
- * Copy page zero and set first 8 bytes.
- */
- sp = (u_long *)0;
- dp = (u_long *)pstart;
- while(dp < (u_long *)(pstart+NBPG))
- *dp++ = *sp++;
- dp = (u_long *)pstart;
- *dp++ = first_8_bytes[0];
- *dp = first_8_bytes[1];
-
- /*
- * Enter into the page-table
- */
- pg = (u_int *)pt;
- *pg = pstart | PG_RO | PG_V;
-
-
- /*
- * Reserve space for page 0, and allocate the kernel
- * space from the ST-ram segment.
- */
- pstart += NBPG;
- phys_segs[0].start += pstart;
- }
-
- /*
- * As all segment sizes are now valid, calculate page indexes and
- * available physical memory.
- */
- phys_segs[0].first_page = 0;
- for (i = 1; phys_segs[i].start; i++) {
- phys_segs[i].first_page = phys_segs[i-1].first_page;
- phys_segs[i].first_page +=
- (phys_segs[i-1].end - phys_segs[i-1].start) / NBPG;
- }
- for (i = 0, physmem = 0; phys_segs[i].start; i++)
- physmem += phys_segs[i].end - phys_segs[i].start;
- physmem >>= PGSHIFT;
-
- /*
- * get the pmap module in sync with reality.
- */
- pmap_bootstrap(vstart);
-
- /*
- * Prepare to enable the MMU.
- * Setup and load SRP nolimit, share global, 4 byte PTE's
- */
- protorp[0] = 0x80000202;
- protorp[1] = Sysseg + kbase; /* + segtable address */
-
- /*
- * copy over the kernel (and all now initialized variables)
- * to fastram. DONT use bcopy(), this beast is much larger
- * than 128k !
- */
- if(kbase) {
- register u_long *lp, *le, *fp;
- extern u_long first_8_bytes[];
-
- lp = (u_long *)0;
- le = (u_long *)pstart;
- fp = (u_long *)kbase;
- while(lp < le)
- *fp++ = *lp++;
-
- /*
- * Fill in reset stuff
- */
- fp = (u_long *)kbase;
- *fp++ = first_8_bytes[0];
- *fp = first_8_bytes[1];
- }
-
- asm volatile ("pmove %0@,srp" : : "a" (&protorp[0]));
- /*
- * setup and load TC register.
- * enable_cpr, enable_srp, pagesize=8k,
- * A = 8 bits, B = 11 bits
- */
- tc = 0x82d08b00;
- asm volatile ("pmove %0@,tc" : : "a" (&tc));
-
- /* Is this to fool the optimizer?? */
- i = *(int *)proc0paddr;
- *(volatile int *)proc0paddr = i;
-
- /*
- * Initialize the sound-chip YM2149:
- * All sounds off, both ports output.
- */
- SOUND->sd_selr = YM_MFR;
- SOUND->sd_wdat = 0xff;
-
- /*
- * Initialize both MFP chips (if both present!) to generate
- * auto-vectored interrupts with EOI. The active-edge registers are
- * set up. The interrupt enable registers are set to disable all
- * interrupts.
- * A test on presence on the second MFP determines if this is a
- * TT030 or a Falcon. This is added to 'machineid'.
- */
- MFP->mf_iera = MFP->mf_ierb = 0;
- MFP->mf_imra = MFP->mf_imrb = 0;
- MFP->mf_aer = 0;
- MFP->mf_vr = 0x40;
- if(!badbaddr(&MFP2->mf_gpip)) {
- machineid |= ATARI_TT;
- MFP2->mf_iera = MFP2->mf_ierb = 0;
- MFP2->mf_imra = MFP2->mf_imrb = 0;
- MFP2->mf_aer = 0x80;
- MFP2->mf_vr = 0x50;
-
- /*
- * Initialize the SCU, to enable interrupts on the SCC (ipl5),
- * MFP (ipl6) and softints (ipl1).
- */
- SCU->sys_mask = SCU_MFP | SCU_SCC | SCU_SYS_SOFT;
-#ifdef DDB
- /*
- * This allows people with the correct hardware modification
- * to drop into the debugger from an NMI.
- */
- SCU->sys_mask |= SCU_IRQ7;
-#endif
- }
- else machineid |= ATARI_FALCON;
-
- /*
- * Initialize stmem allocator
- */
- init_stmem();
-}
-
-#ifdef DEBUG
-void
-dump_segtable(stp)
- u_int *stp;
-{
- u_int *s, *es;
- int shift, i;
-
- s = stp;
- {
- es = s + (ATARI_STSIZE >> 2);
- shift = SG_ISHIFT;
- }
-
- /*
- * XXX need changes for 68040
- */
- for (i = 0; s < es; s++, i++)
- if (*s & SG_V)
- printf("$%08lx: $%08lx\t", i << shift, *s & SG_FRAME);
- printf("\n");
-}
-
-void
-dump_pagetable(ptp, i, n)
- u_int *ptp, i, n;
-{
- u_int *p, *ep;
-
- p = ptp + i;
- ep = p + n;
- for (; p < ep; p++, i++)
- if (*p & PG_V)
- printf("$%08lx -> $%08lx\t", i, *p & PG_FRAME);
- printf("\n");
-}
-
-u_int
-vmtophys(ste, vm)
- u_int *ste, vm;
-{
- ste = (u_int *) (*(ste + (vm >> SEGSHIFT)) & SG_FRAME);
- ste += (vm & SG_PMASK) >> PGSHIFT;
- return((*ste & -NBPG) | (vm & (NBPG - 1)));
-}
-
-#endif
diff --git a/sys/arch/atari/atari/autoconf.c b/sys/arch/atari/atari/autoconf.c
deleted file mode 100644
index 152ae5243c8..00000000000
--- a/sys/arch/atari/atari/autoconf.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/* $NetBSD: autoconf.c,v 1.3 1996/01/06 20:10:41 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman
- * Copyright (c) 1994 Christian E. Hopps
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christian E. Hopps.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/reboot.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-#include <machine/disklabel.h>
-#include <machine/cpu.h>
-
-void configure __P((void));
-static void setroot __P((void));
-void swapconf __P((void));
-void mbattach __P((struct device *, struct device *, void *));
-int mbprint __P((void *, const char *));
-int mbmatch __P((struct device *, struct cfdata *, void *));
-
-extern int cold; /* 1 if still booting (locore.s) */
-int atari_realconfig;
-#include <sys/kernel.h>
-
-/*
- * called at boot time, configure all devices on system
- */
-void
-configure()
-{
- extern int atari_realconfig;
-
- atari_realconfig = 1;
-
- if (config_rootfound("mainbus", "mainbus") == 0)
- panic("no mainbus found");
-
-#ifdef GENERIC
- if((boothowto & RB_ASKNAME) == 0)
- setroot();
- setconf();
-#else
- setroot();
-#endif
- swapconf();
- cold = 0;
-}
-
-/*ARGSUSED*/
-int
-simple_devprint(auxp, pnp)
- void *auxp;
- const char *pnp;
-{
- return(QUIET);
-}
-
-/*
- * use config_search to find appropriate device, then call that device
- * directly with NULL device variable storage. A device can then
- * always tell the difference between the real and console init
- * by checking for NULL.
- */
-int
-atari_config_found(pcfp, pdp, auxp, pfn)
- struct cfdata *pcfp;
- struct device *pdp;
- void *auxp;
- cfprint_t pfn;
-{
- struct device temp;
- struct cfdata *cf;
- extern int atari_realconfig;
-
- if (atari_realconfig)
- return(config_found(pdp, auxp, pfn));
-
- if (pdp == NULL)
- pdp = &temp;
-
- pdp->dv_cfdata = pcfp;
- if ((cf = config_search((cfmatch_t)NULL, pdp, auxp)) != NULL) {
- cf->cf_driver->cd_attach(pdp, NULL, auxp);
- pdp->dv_cfdata = NULL;
- return(1);
- }
- pdp->dv_cfdata = NULL;
- return(0);
-}
-
-/*
- * this function needs to get enough configured to do a console
- * basically this means start attaching the grfxx's that support
- * the console. Kinda hacky but it works.
- */
-int
-config_console()
-{
- struct cfdata *cf;
-
- /*
- * we need mainbus' cfdata.
- */
- cf = config_rootsearch(NULL, "mainbus", "mainbus");
- if (cf == NULL)
- panic("no mainbus");
- atari_config_found(cf, NULL, "grfbus", NULL);
-}
-
-void
-swapconf()
-{
- struct swdevt *swp;
- u_int maj;
- int nb;
-
- for (swp = swdevt; swp->sw_dev > 0; swp++) {
- maj = major(swp->sw_dev);
-
- if (maj > nblkdev)
- break;
-
- if (bdevsw[maj].d_psize) {
- nb = bdevsw[maj].d_psize(swp->sw_dev);
- if (nb > 0 &&
- (swp->sw_nblks == 0 || swp->sw_nblks > nb))
- swp->sw_nblks = nb;
- else swp->sw_nblks = 0;
- }
- swp->sw_nblks = ctod(dtoc(swp->sw_nblks));
- }
- dumpconf();
- if( dumplo < 0)
- dumplo = 0;
-
-}
-
-#define DOSWAP /* change swdevt and dumpdev */
-dev_t bootdev = 0;
-
-static char devname[][2] = {
- 0,0,
- 0,0,
- 'f','d', /* 2 = fd */
- 0,0,
- 's','d', /* 4 = sd -- SCSI system */
-};
-
-static void
-setroot()
-{
- int majdev, mindev, unit, part, adaptor;
- dev_t temp, orootdev;
- struct swdevt *swp;
-
- if (boothowto & RB_DFLTROOT
- || (bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC)
- return;
- majdev = (bootdev >> B_TYPESHIFT) & B_TYPEMASK;
- if(majdev > sizeof(devname) / sizeof(devname[0]))
- return;
- adaptor = (bootdev >> B_ADAPTORSHIFT) & B_ADAPTORMASK;
- part = (bootdev >> B_PARTITIONSHIFT) & B_PARTITIONMASK;
- unit = (bootdev >> B_UNITSHIFT) & B_UNITMASK;
- orootdev = rootdev;
- rootdev = MAKEDISKDEV(majdev, unit, part);
- /*
- * If the original rootdev is the same as the one
- * just calculated, don't need to adjust the swap configuration.
- */
- if (rootdev == orootdev)
- return;
- printf("changing root device to %c%c%d%c\n",
- devname[majdev][0], devname[majdev][1],
- unit, part + 'a');
-#ifdef DOSWAP
- mindev = DISKUNIT(rootdev);
- for (swp = swdevt; swp->sw_dev; swp++) {
- if (majdev == major(swp->sw_dev)
- && mindev == DISKUNIT(swp->sw_dev)) {
- temp = swdevt[0].sw_dev;
- swdevt[0].sw_dev = swp->sw_dev;
- swp->sw_dev = temp;
- break;
- }
- }
- if (swp->sw_dev == 0)
- return;
- /*
- * If dumpdev was the same as the old primary swap
- * device, move it to the new primary swap device.
- */
- if (temp == dumpdev)
- dumpdev = swdevt[0].sw_dev;
-#endif
-}
-
-/*
- * mainbus driver
- */
-struct cfdriver mainbuscd = {
- NULL, "mainbus", (cfmatch_t)mbmatch, mbattach,
- DV_DULL, sizeof(struct device), NULL, 0
-};
-
-int
-mbmatch(pdp, cfp, auxp)
- struct device *pdp;
- struct cfdata *cfp;
- void *auxp;
-{
- if (cfp->cf_unit > 0)
- return(0);
- /*
- * We are always here
- */
- return(1);
-}
-
-/*
- * "find" all the things that should be there.
- */
-void
-mbattach(pdp, dp, auxp)
- struct device *pdp, *dp;
- void *auxp;
-{
- printf ("\n");
- config_found(dp, "nvr" , simple_devprint);
- config_found(dp, "clock" , simple_devprint);
- config_found(dp, "grfbus" , simple_devprint);
- config_found(dp, "kbd" , simple_devprint);
- config_found(dp, "fdc" , simple_devprint);
- config_found(dp, "zs" , simple_devprint);
- config_found(dp, "ncrscsi", simple_devprint);
-}
-
-int
-mbprint(auxp, pnp)
- void *auxp;
- const char *pnp;
-{
- if (pnp)
- printf("%s at %s", (char *)auxp, pnp);
- return(UNCONF);
-}
diff --git a/sys/arch/atari/atari/conf.c b/sys/arch/atari/atari/conf.c
deleted file mode 100644
index 74bb39025e3..00000000000
--- a/sys/arch/atari/atari/conf.c
+++ /dev/null
@@ -1,334 +0,0 @@
-/* $OpenBSD: conf.c,v 1.15 2000/09/26 14:03:52 art Exp $ */
-
-/*
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)conf.c 7.9 (Berkeley) 5/28/91
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/conf.h>
-#include <sys/vnode.h>
-#include <dev/cons.h>
-
-#ifdef BANKEDDEVPAGER
-#include <sys/bankeddev.h>
-#endif
-
-int ttselect __P((dev_t, int, struct proc *));
-
-#define bdev_rd_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,strategy), \
- dev_init(c,n,ioctl), (dev_type_dump((*))) enxio, dev_size_init(c,n), 0 }
-
-#include "vnd.h"
-#include "ramd.h"
-bdev_decl(rd);
-#include "fd.h"
-#define fdopen Fdopen /* conflicts with fdopen() in kern_descrip.c */
-bdev_decl(fd);
-#undef fdopen
-bdev_decl(sw);
-#include "sd.h"
-#include "st.h"
-#include "cd.h"
-#include "ccd.h"
-
-struct bdevsw bdevsw[] =
-{
- bdev_disk_init(NVND,vnd), /* 0: vnode disk driver */
- bdev_rd_init(NRAMD,rd), /* 1: ram disk - for install disk */
-#define fdopen Fdopen /* conflicts with fdopen() in kern_descrip.c */
- bdev_disk_init(NFD,fd), /* 2: floppy disk */
-#undef fdopen
- bdev_swap_init(1,sw), /* 3: swap pseudo-device */
- bdev_disk_init(NSD,sd), /* 4: SCSI disk */
- bdev_tape_init(NST,st), /* 5: SCSI tape */
- bdev_disk_init(NCD,cd), /* 6: SCSI CD-ROM */
- bdev_lkm_dummy(), /* 7 */
- bdev_lkm_dummy(), /* 8 */
- bdev_lkm_dummy(), /* 9 */
- bdev_lkm_dummy(), /* 10 */
- bdev_lkm_dummy(), /* 11 */
- bdev_lkm_dummy(), /* 12 */
- bdev_disk_init(NCCD,ccd), /* 13: concatenated disk driver */
-};
-int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
-
-/* open, close, ioctl, select, mmap -- XXX should be a map device */
-#define cdev_grf_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \
- (dev_type_write((*))) nullop, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, (dev_type_tty((*))) nullop, \
- dev_init(c,n,select), dev_init(c,n,mmap) }
-
-/* open, close, ioctl, select, mmap -- XXX should be a map device */
-#define cdev_view_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) nullop, \
- (dev_type_write((*))) nullop, dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, (dev_type_tty((*))) nullop, \
- dev_init(c,n,select), dev_init(c,n,mmap) }
-
-#define mmread mmrw
-#define mmwrite mmrw
-cdev_decl(mm);
-cdev_decl(sw);
-#include "pty.h"
-#include "zs.h"
-cdev_decl(zs);
-#include "ss.h"
-#include "uk.h"
-#include "ch.h"
-#include "grf.h"
-cdev_decl(grf);
-#include "ite.h"
-cdev_decl(ite);
-#include "view.h"
-cdev_decl(view);
-#include "kbd.h"
-cdev_decl(kbd);
-#include "mouse.h"
-cdev_decl(ms);
-#define fdopen Fdopen /* conflicts with fdopen() in kern_descrip.c */
-cdev_decl(fd);
-#undef fdopen
-dev_decl(fd,open);
-#include "bpfilter.h"
-#include "tun.h"
-#ifdef XFS
-#include <xfs/nxfs.h>
-cdev_dec(xfs_dev);
-#endif
-
-#ifdef IPFILTER
-#define NIPF 1
-#else
-#define NIPF 0
-#endif
-
-struct cdevsw cdevsw[] =
-{
- cdev_cn_init(1,cn), /* 0: virtual console */
- cdev_ctty_init(1,ctty), /* 1: controlling terminal */
- cdev_mm_init(1,mm), /* 2: /dev/{null,mem,kmem,...} */
- cdev_swap_init(1,sw), /* 3: /dev/drum (swap pseudo-device) */
- cdev_tty_init(NPTY,pts), /* 4: pseudo-tty slave */
- cdev_ptc_init(NPTY,ptc), /* 5: pseudo-tty master */
- cdev_log_init(1,log), /* 6: /dev/klog */
- cdev_tty_init(NZS,zs), /* 7: 8530 SCC */
- cdev_disk_init(NSD,sd), /* 8: SCSI disk */
- cdev_disk_init(NCD,cd), /* 9: SCSI CD-ROM */
- cdev_tape_init(NST,st), /* 10: SCSI tape */
- cdev_grf_init(NGRF,grf), /* 11: frame buffer */
- cdev_tty_init(NITE,ite), /* 12: console terminal emulator */
- cdev_view_init(NVIEW,view), /* 13: /dev/view00 /dev/view01, ... */
- cdev_mouse_init(NKBD,kbd), /* 14: /dev/kbd */
- cdev_mouse_init(NMOUSE,ms), /* 15: /dev/mouse0 /dev/mouse1 */
-#define fdopen Fdopen /* conflicts with fdopen() in kern_descrip.c */
- cdev_disk_init(NFD,fd), /* 16: floppy disk */
-#undef fdopen
- cdev_disk_init(NVND,vnd), /* 17: vnode disk driver */
- cdev_fd_init(1,fd), /* 18: file descriptor pseudo-device */
- cdev_bpftun_init(NBPFILTER,bpf),/* 19: Berkeley packet filter */
- cdev_lkm_init(NLKM,lkm), /* 20: loadable module driver */
- cdev_lkm_dummy(), /* 21 */
- cdev_lkm_dummy(), /* 22 */
- cdev_lkm_dummy(), /* 23 */
- cdev_lkm_dummy(), /* 24 */
- cdev_lkm_dummy(), /* 25 */
- cdev_lkm_dummy(), /* 26 */
- cdev_disk_init(NCCD,ccd), /* 27: concatenated disk driver */
- cdev_bpftun_init(NTUN,tun), /* 28: network tunnel */
- cdev_gen_ipf(NIPF,ipl), /* 29: IP filter log */
- cdev_random_init(1,random), /* 30: random data source */
- cdev_uk_init(NUK,uk), /* 31: unknown SCSI */
- cdev_ss_init(NSS,ss), /* 32: SCSI scanner */
- cdev_ch_init(NCH,ch), /* 33: SCSI media changer */
- cdev_notdef(), /* 34 */
- cdev_notdef(), /* 35 */
- cdev_notdef(), /* 36 */
- cdev_notdef(), /* 37 */
- cdev_notdef(), /* 38 */
- cdev_notdef(), /* 39 */
- cdev_notdef(), /* 40 */
- cdev_notdef(), /* 41 */
- cdev_notdef(), /* 42 */
- cdev_notdef(), /* 43 */
- cdev_notdef(), /* 44 */
- cdev_notdef(), /* 45 */
- cdev_notdef(), /* 46 */
- cdev_notdef(), /* 47 */
- cdev_notdef(), /* 48 */
- cdev_notdef(), /* 49 */
- cdev_notdef(), /* 50 */
-#ifdef XFS
- cdev_xfs_init(NXFS,xfs_dev), /* 51: xfs communication device */
-#else
- cdev_notdef(), /* 51 */
-#endif
-};
-int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
-
-#ifdef BANKEDDEVPAGER
-extern int grfbanked_get __P((int, int, int));
-extern int grfbanked_set __P((int, int));
-extern int grfbanked_cur __P((int));
-
-struct bankeddevsw bankeddevsw[sizeof (cdevsw) / sizeof (cdevsw[0])] = {
- { 0, 0, 0 }, /* 0 */
- { 0, 0, 0 }, /* 1 */
- { 0, 0, 0 }, /* 2 */
- { 0, 0, 0 }, /* 3 */
- { 0, 0, 0 }, /* 4 */
- { 0, 0, 0 }, /* 5 */
- { 0, 0, 0 }, /* 6 */
- { 0, 0, 0 }, /* 7 */
- { 0, 0, 0 }, /* 8 */
- { 0, 0, 0 }, /* 9 */
- { grfbanked_get, grfbanked_cur, grfbanked_set }, /* 10 */
- /* rest { 0, 0, 0 } */
-};
-#endif
-
-int mem_no = 2; /* major device number of memory special file */
-
-/*
- * Swapdev is a fake device implemented
- * in sw.c used only internally to get to swstrategy.
- * It cannot be provided to the users, because the
- * swstrategy routine munches the b_dev and b_blkno entries
- * before calling the appropriate driver. This would horribly
- * confuse, e.g. the hashing routines. Instead, /dev/drum is
- * provided as a character (raw) device.
- */
-dev_t swapdev = makedev(3, 0);
-
-/*
- * Returns true if dev is /dev/mem or /dev/kmem.
- */
-iskmemdev(dev)
- dev_t dev;
-{
-
- return (major(dev) == mem_no && minor(dev) < 2);
-}
-
-/*
- * Returns true if dev is /dev/zero.
- */
-iszerodev(dev)
- dev_t dev;
-{
-
- return (major(dev) == mem_no && minor(dev) == 12);
-}
-
-dev_t
-getnulldev()
-{
- return makedev(mem_no, 2);
-}
-
-static int chrtoblktab[] = {
- /* XXXX This needs to be dynamic for LKMs. */
- /*VCHR*/ /*VBLK*/
- /* 0 */ NODEV,
- /* 1 */ NODEV,
- /* 2 */ NODEV,
- /* 3 */ NODEV,
- /* 4 */ NODEV,
- /* 5 */ NODEV,
- /* 6 */ NODEV,
- /* 7 */ NODEV,
- /* 8 */ 4,
- /* 9 */ 6,
- /* 10 */ 5,
- /* 11 */ NODEV,
- /* 12 */ NODEV,
- /* 13 */ NODEV,
- /* 14 */ NODEV,
- /* 15 */ NODEV,
- /* 16 */ 2,
- /* 17 */ 0,
- /* 18 */ NODEV,
- /* 19 */ NODEV,
- /* 20 */ NODEV,
- /* 21 */ NODEV,
- /* 22 */ NODEV,
- /* 23 */ NODEV,
- /* 24 */ NODEV,
- /* 25 */ NODEV,
- /* 26 */ NODEV,
- /* 27 */ 13,
-};
-
-/*
- * Convert a character device number to a block device number.
- */
-dev_t
-chrtoblk(dev)
- dev_t dev;
-{
- int blkmaj;
-
- if (major(dev) >= nchrdev ||
- major(dev) > sizeof(chrtoblktbl)/sizeof(chrtoblktbl[0]))
- return (NODEV);
- blkmaj = chrtoblktbl[major(dev)];
- if (blkmaj == NODEV)
- return (NODEV);
- return (makedev(blkmaj, minor(dev)));
-}
-
-/*
- * This entire table could be autoconfig()ed but that would mean that
- * the kernel's idea of the console would be out of sync with that of
- * the standalone boot. I think it best that they both use the same
- * known algorithm unless we see a pressing need otherwise.
- */
-cons_decl(ser);
-#define itecnpollc nullcnpollc
-cons_decl(ite);
-
-struct consdev constab[] = {
-#if NSER > 0
- cons_init(ser),
-#endif
-#if NITE > 0
- cons_init(ite),
-#endif
- { 0 },
-};
diff --git a/sys/arch/atari/atari/db_memrw.c b/sys/arch/atari/atari/db_memrw.c
deleted file mode 100644
index e21a1321570..00000000000
--- a/sys/arch/atari/atari/db_memrw.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/* $NetBSD: db_memrw.c,v 1.2 1996/01/19 13:51:11 leo Exp $ */
-
-/*
- * Copyright (c) 1994 Gordon W. Ross
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Interface to the debugger for virtual memory read/write.
- * To write in the text segment, we have to first make
- * the page writable, do the write, then restore the PTE.
- * For reads, validate address first to avoid MMU trap.
- *
- * Note the special handling for 2/4 byte sizes. This is done to make
- * it work sensibly for device registers.
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-
-#include <vm/vm.h>
-
-#include <machine/db_machdep.h>
-#include <machine/pte.h>
-
-/*
- * Check if access is allowed to 'addr'. Mask should contain
- * PG_V for read access, PV_V|PG_RO for write access.
- */
-static int
-db_check(addr, mask)
- char *addr;
- u_int mask;
-{
- u_int *pte;
-
- pte = kvtopte((vm_offset_t)addr);
-
- if ((*pte & mask) != PG_V) {
- db_printf(" address 0x%x not a valid page\n", addr);
- return 0;
- }
- return 1;
-}
-
-/*
- * Read bytes from kernel address space for debugger.
- * It does not matter if this is slow. -gwr
- */
-void
-db_read_bytes(addr, size, data)
- vm_offset_t addr;
- register int size;
- register char *data;
-{
- u_int8_t *src, *dst, *limit;
-
- src = (u_int8_t *)addr;
- dst = (u_int8_t *)data;
- limit = src + size;
-
- if (size == 2 || size == 4) {
- if(db_check(src, PG_V) && db_check(limit, PG_V)) {
- if (size == 2)
- *(u_int16_t*)data = *(u_int16_t*)addr;
- else *(u_int32_t*)data = *(u_int32_t*)addr;
- return;
- }
- }
-
- while (src < limit) {
- *dst = db_check(src, PG_V) ? *src : 0;
- dst++;
- src++;
- }
-}
-
-/*
- * Write one byte somewhere in kernel text.
- * It does not matter if this is slow. -gwr
- */
-static void
-db_write_text(dst, ch)
- u_int8_t *dst;
- u_int8_t ch;
-{
- u_int *pte, oldpte;
-
- pte = kvtopte((vm_offset_t)dst);
- oldpte = *pte;
- if ((oldpte & PG_V) == 0) {
- db_printf(" address 0x%x not a valid page\n", dst);
- return;
- }
-
-/*printf("db_write_text: %x: %x = %x (%x:%x)\n", dst, *dst, ch, pte, *pte);*/
- *pte &= ~PG_RO;
- TBIS(dst);
-
- *dst = ch;
-
- *pte = oldpte;
- TBIS(dst);
- cachectl (4, dst, 1);
-}
-
-/*
- * Write bytes to kernel address space for debugger.
- */
-void
-db_write_bytes(addr, size, data)
- vm_offset_t addr;
- int size;
- char *data;
-{
- extern char etext[] ;
- u_int8_t *dst, *src, *limit;
-
- dst = (u_int8_t *)addr;
- src = (u_int8_t *)data;
- limit = dst + size;
-
- if ((char*)dst >= etext && (size == 2 || size == 4)) {
- if(db_check(dst, PG_V|PG_RO) && db_check(limit, PG_V|PG_RO)) {
- if (size == 2)
- *(u_int16_t*)addr = *(u_int16_t*)data;
- else *(u_int32_t*)addr = *(u_int32_t*)data;
- return;
- }
- }
- while (dst < limit) {
- if ((char*)dst < etext) /* kernel text starts at 0 */
- db_write_text(dst, *src);
- else if (db_check(dst, PG_V|PG_RO))
- *dst = *src;
- dst++;
- src++;
- }
-}
diff --git a/sys/arch/atari/atari/device.h b/sys/arch/atari/atari/device.h
deleted file mode 100644
index ca8652d1529..00000000000
--- a/sys/arch/atari/atari/device.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $NetBSD: device.h,v 1.1.1.1 1995/03/26 07:12:18 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman
- * Copyright (c) 1994 Christian E. Hopps
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christian E. Hopps.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _ATARI_DEVICE_H_
-#define _ATARI_DEVICE_H_
-
-/*
- * devices that need to configure before console use this
- * *and know it* (i.e. everything is really tight certain params won't be
- * passed in some cases and the devices will deal with it)
- */
-int atari_config_found __P((struct cfdata *, struct device *,
- void *, cfprint_t ));
-int simple_devprint __P((void *, const char *));
-int matchname __P((char *, char *));
-/*
- * false when initing for the console.
- */
-extern int atari_realconfig;
-
-
-#define getsoftc(cdnam, unit) \
- ((unit) >= (cdnam).cd_ndevs ? NULL : (cdnam).cd_devs[unit])
-
-#endif /* _ATARI_DEVICE_H_ */
diff --git a/sys/arch/atari/atari/disksubr.c b/sys/arch/atari/atari/disksubr.c
deleted file mode 100644
index 7afad017ede..00000000000
--- a/sys/arch/atari/atari/disksubr.c
+++ /dev/null
@@ -1,705 +0,0 @@
-/* $NetBSD: disksubr.c,v 1.5 1995/11/30 00:57:35 jtc Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/buf.h>
-#include <sys/disklabel.h>
-#include <machine/tospart.h>
-
-/*
- * This is ugly, but as long as disklabel(8) uses
- * BBSIZE from ufs/ffs/fs.h, there's no alternative.
- */
-#include <ufs/ffs/fs.h>
-#if BBSIZE < 8192
-#error BBSIZE in /sys/ufs/ffs/fs.h must be at least 8192 bytes
-#endif
-
-#if 0
-#define MACHDSBR_DEBUG(x) printf x
-#else
-#define MACHDSBR_DEBUG(x)
-#endif
-
-static int real_label __P((dev_t, void (*)(), u_int32_t, struct disklabel *));
-static void chck_label __P((struct disklabel *, struct cpu_disklabel *));
-static void fake_label __P((struct disklabel *, struct tos_table *));
-static int rd_rootparts __P((dev_t, void (*)(), u_int32_t, u_int32_t,
- struct tos_table *));
-static int rd_extparts __P((dev_t, void (*)(), u_int32_t, u_int32_t,
- u_int32_t, struct tos_table *));
-static int add_tospart __P((struct tos_part *, struct tos_table *));
-
-/*
- * XXX unknown function but needed for /sys/scsi to link
- */
-int
-dk_establish()
-{
- return(-1);
-}
-
-/*
- * Determine the size of the transfer, and make sure it is
- * within the boundaries of the partition. Adjust transfer
- * if needed, and signal errors or early completion.
- */
-int
-bounds_check_with_label(bp, lp, osdep, wlabel)
- struct buf *bp;
- struct disklabel *lp;
- struct cpu_disklabel *osdep;
- int wlabel;
-{
- struct partition *pp;
- u_int32_t maxsz, sz;
-
- pp = &lp->d_partitions[DISKPART(bp->b_dev)];
- if (bp->b_flags & B_RAW) {
- if (bp->b_bcount & (lp->d_secsize - 1)) {
- bp->b_error = EINVAL;
- bp->b_flags |= B_ERROR;
- return (-1);
- }
- maxsz = pp->p_size * (lp->d_secsize / DEV_BSIZE);
- sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT;
- } else {
- maxsz = pp->p_size;
- sz = (bp->b_bcount + lp->d_secsize - 1) / lp->d_secsize;
- }
-
- if (bp->b_blkno < 0 || bp->b_blkno + sz > maxsz) {
- if (bp->b_blkno == maxsz) {
- /*
- * trying to get one block beyond return EOF.
- */
- bp->b_resid = bp->b_bcount;
- return(0);
- }
- sz = maxsz - bp->b_blkno;
- if (sz <= 0 || bp->b_blkno < 0) {
- bp->b_error = EINVAL;
- bp->b_flags |= B_ERROR;
- return(-1);
- }
- /*
- * adjust count down
- */
- if (bp->b_flags & B_RAW)
- bp->b_bcount = sz << DEV_BSHIFT;
- else bp->b_bcount = sz * lp->d_secsize;
- }
-
- /*
- * calc cylinder for disksort to order transfers with
- */
- bp->b_cylinder = (bp->b_blkno + pp->p_offset) / lp->d_secpercyl;
- return(1);
-}
-
-/*
- * Attempt to read a disk label from a device using the
- * indicated strategy routine. The label must be partly
- * set up before this:
- * secpercyl and anything required in the strategy routine
- * (e.g. sector size) must be filled in before calling us.
- * Returns NULL on success and an error string on failure.
- */
-char *
-readdisklabel(dev, strat, lp, clp)
-dev_t dev;
-void (*strat)();
-struct disklabel *lp;
-struct cpu_disklabel *clp;
-{
- struct tos_table tt;
- int i;
-
- bzero(clp, sizeof *clp);
-
- /*
- * Give some guaranteed validity to the disk label.
- */
- if (lp->d_secsize == 0)
- lp->d_secsize = DEV_BSIZE;
- if (lp->d_secperunit == 0)
- lp->d_secperunit = 0x1fffffff;
- if (lp->d_secpercyl == 0)
- return("Zero secpercyl");
- for (i = 0; i < MAXPARTITIONS; ++i) {
- lp->d_partitions[i].p_size = 0;
- lp->d_partitions[i].p_offset = 0;
- lp->d_partitions[i].p_fstype = FS_UNUSED;
- }
- lp->d_partitions[RAW_PART].p_size = lp->d_secperunit;
- lp->d_npartitions = RAW_PART + 1;
- lp->d_bbsize = BBSIZE;
- lp->d_sbsize = SBSIZE;
-
- MACHDSBR_DEBUG(("unit: %lu secsize: %lu secperunit: %lu\n",
- (u_long)DISKUNIT(dev), (u_long)lp->d_secsize,
- (u_long)lp->d_secperunit));
-
- /*
- * Try the simple case (boot block at sector 0) first.
- */
- if(real_label(dev, strat, LABELSECTOR, lp)) {
- MACHDSBR_DEBUG(("Normal volume: boot block at sector 0\n"));
- return(NULL);
- }
- /*
- * The vendor specific (TOS) partition layout requires a 512
- * byte sector size.
- */
- tt.tt_cdl = clp;
- tt.tt_nroots = tt.tt_nparts = 0;
- if (lp->d_secsize != TOS_BSIZE || (i = rd_rootparts(dev, strat,
- lp->d_secpercyl, lp->d_secperunit, &tt)) == 2) {
- MACHDSBR_DEBUG(("Uninitialised volume\n"));
- lp->d_partitions[RAW_PART+1].p_size
- = lp->d_partitions[RAW_PART].p_size;
- lp->d_partitions[RAW_PART+1].p_offset
- = lp->d_partitions[RAW_PART].p_offset;
- lp->d_partitions[RAW_PART+1].p_fstype = FS_BSDFFS;
- lp->d_npartitions = RAW_PART + 2;
- goto done;
- }
- if (!i)
- return("Invalid TOS partition table");
- /*
- * TOS format, search for a partition with id NBD or RAW, which
- * contains a NetBSD boot block with a valid disk label in it.
- */
- MACHDSBR_DEBUG(("AHDI partition table: "));
- clp->cd_bblock = NO_BOOT_BLOCK;
- for (i = 0; i < tt.tt_nparts; ++i) {
- struct tos_part *tp = &tt.tt_parts[i];
- u_int32_t id = *((u_int32_t *)&tp->tp_flg);
- if (id != PID_NBD && id != PID_RAW)
- continue;
- if (!real_label(dev, strat, tp->tp_st, lp)) {
- /*
- * No disk label, but if this is the first NBD partition
- * on this volume, we'll mark it anyway as a possible
- * destination for future writedisklabel() calls, just
- * in case there is no valid disk label on any of the
- * other AHDI partitions.
- */
- if (id == PID_NBD
- && clp->cd_bblock == NO_BOOT_BLOCK)
- clp->cd_bblock = tp->tp_st;
- continue;
- }
- /*
- * Found a valid disk label, mark this TOS partition for
- * writedisklabel(), and check for possibly dangerous
- * overlap between TOS and NetBSD partition layout.
- */
- MACHDSBR_DEBUG(("found real disklabel\n"));
- clp->cd_bblock = tp->tp_st;
- chck_label(lp, clp);
- return(NULL);
- }
- /*
- * No disk label on this volume, use the TOS partition
- * layout to create a fake disk label. If there is no
- * NBD partition on this volume either, subsequent
- * writedisklabel() calls will fail.
- */
- MACHDSBR_DEBUG(("creating fake disklabel\n"));
- fake_label(lp, &tt);
-
- /*
- * Calulate new checksum.
- */
-done:
- lp->d_magic = lp->d_magic2 = DISKMAGIC;
- lp->d_checksum = 0;
- lp->d_checksum = dkcksum(lp);
-
- return(NULL);
-}
-
-/*
- * Check new disk label for sensibility before setting it.
- */
-int
-setdisklabel(olp, nlp, openmask, clp)
-struct disklabel *olp, *nlp;
-u_long openmask;
-struct cpu_disklabel *clp;
-{
- /* special case to allow disklabel to be invalidated */
- if (nlp->d_magic == 0xffffffff) {
- *olp = *nlp;
- return(0);
- }
-
- /* sanity clause */
- if (nlp->d_secpercyl == 0 || nlp->d_secsize == 0
- || (nlp->d_secsize % DEV_BSIZE) != 0 || dkcksum(nlp) != 0
- || nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC)
- return(EINVAL);
-
- if (clp->cd_bblock)
- chck_label(nlp, clp);
-
- while (openmask) {
- struct partition *op, *np;
- int i = ffs(openmask) - 1;
- openmask &= ~(1 << i);
- if (i >= nlp->d_npartitions)
- return(EBUSY);
- op = &olp->d_partitions[i];
- np = &nlp->d_partitions[i];
- if (np->p_offset != op->p_offset || np->p_size < op->p_size)
- return(EBUSY);
- /*
- * Copy internally-set partition information
- * if new label doesn't include it. XXX
- */
- if (np->p_fstype == FS_UNUSED && op->p_fstype != FS_UNUSED) {
- np->p_fstype = op->p_fstype;
- np->p_fsize = op->p_fsize;
- np->p_frag = op->p_frag;
- np->p_cpg = op->p_cpg;
- }
- }
- nlp->d_checksum = 0;
- nlp->d_checksum = dkcksum(nlp);
- *olp = *nlp;
- return(0);
-}
-
-/*
- * Write disk label back to device after modification.
- */
-int
-writedisklabel(dev, strat, lp, clp)
-dev_t dev;
-void (*strat)();
-struct disklabel *lp;
-struct cpu_disklabel *clp;
-{
- struct buf *bp;
- u_int32_t bbo;
- int rv;
-
- bbo = clp->cd_bblock;
- if (bbo == NO_BOOT_BLOCK)
- return(ENXIO);
-
- bp = geteblk(BBSIZE);
- bp->b_dev = MAKEDISKDEV(major(dev), DISKUNIT(dev), RAW_PART);
- bp->b_flags = B_BUSY | B_READ;
- bp->b_bcount = BBSIZE;
- bp->b_blkno = bbo;
- bp->b_cylinder = bbo / lp->d_secpercyl;
- (*strat)(bp);
- rv = biowait(bp);
- if (!rv) {
- struct disklabel *nlp = (struct disklabel *)
- ((char *)bp->b_data + LABELOFFSET);
- *nlp = *lp;
- bp->b_flags = B_BUSY | B_WRITE;
- bp->b_bcount = BBSIZE;
- bp->b_blkno = bbo;
- bp->b_cylinder = bbo / lp->d_secpercyl;
- (*strat)(bp);
- rv = biowait(bp);
- }
- bp->b_flags |= B_INVAL | B_AGE;
- brelse(bp);
- return(rv);
-}
-
-/*
- * Read bootblock at block `offset' and check
- * if it contains a valid disklabel.
- * Returns 0 if an error occured, 1 if successfull.
- */
-static int
-real_label(dev, strat, offset, lp)
-dev_t dev;
-void (*strat)();
-u_int32_t offset;
-struct disklabel *lp;
-{
- struct buf *bp;
- int rv = 0;
-
- bp = geteblk(BBSIZE);
- bp->b_dev = MAKEDISKDEV(major(dev), DISKUNIT(dev), RAW_PART);
- bp->b_flags = B_BUSY | B_READ;
- bp->b_bcount = BBSIZE;
- bp->b_blkno = offset;
- bp->b_cylinder = offset / lp->d_secpercyl;
- (*strat)(bp);
- if (!biowait(bp)) {
- struct disklabel *nlp = (struct disklabel *)
- ((char *)bp->b_data + LABELOFFSET);
- if (nlp->d_magic == DISKMAGIC && nlp->d_magic2 == DISKMAGIC
- && dkcksum(nlp) == 0 && nlp->d_npartitions <= MAXPARTITIONS) {
- *lp = *nlp;
- rv = 1;
- }
- }
- bp->b_flags = B_INVAL | B_AGE | B_READ;
- brelse(bp);
- return(rv);
-}
-
-/*
- * Check for consistency between the NetBSD partition table
- * and the TOS auxilary root sectors. There's no good reason
- * to force such consistency, but issueing a warning may help
- * an inexperienced sysadmin to prevent corruption of TOS
- * partitions.
- */
-static void
-chck_label(lp, clp)
-struct disklabel *lp;
-struct cpu_disklabel *clp;
-{
- u_int32_t *rp;
- int i;
-
- for (i = 0; i < lp->d_npartitions; ++i) {
- struct partition *p = &lp->d_partitions[i];
- if (p->p_size == 0 || i == RAW_PART)
- continue;
- if ( (p->p_offset <= clp->cd_bslst
- && p->p_offset + p->p_size > clp->cd_bslst)
- || (p->p_offset > clp->cd_bslst
- && clp->cd_bslst + clp->cd_bslsize > p->p_offset)) {
- uprintf("Warning: NetBSD partition %c includes"
- " AHDI bad sector list\n", 'a'+i);
- }
- for (rp = &clp->cd_roots[0]; *rp; ++rp) {
- if (*rp >= p->p_offset
- && *rp < p->p_offset + p->p_size) {
- uprintf("Warning: NetBSD partition %c"
- " includes AHDI auxilary root\n", 'a'+i);
- }
- }
- }
-}
-
-/*
- * Map the partition table from TOS to the NetBSD table.
- *
- * This means:
- * Part 0 : Root
- * Part 1 : Swap
- * Part 2 : Whole disk
- * Part 3.. : User partitions
- *
- * When more than one root partition is found, only the first one will
- * be recognized as such. The others are mapped as user partitions.
- */
-static void
-fake_label(lp, tt)
-struct disklabel *lp;
-struct tos_table *tt;
-{
- int i, have_root, user_part;
-
- user_part = RAW_PART;
- have_root = (tt->tt_bblock != NO_BOOT_BLOCK);
-
- for (i = 0; i < tt->tt_nparts; ++i) {
- struct tos_part *tp = &tt->tt_parts[i];
- int fst, pno = -1;
-
- switch (*((u_int32_t *)&tp->tp_flg)) {
- case PID_NBD:
- /*
- * If this partition has been marked as the
- * first NBD partition, it will be the root
- * partition.
- */
- if (tp->tp_st == tt->tt_bblock)
- pno = 0;
- /* FALL THROUGH */
- case PID_NBR:
- /*
- * If there is no NBD partition and this is
- * the first NBR partition, it will be the
- * root partition.
- */
- if (!have_root) {
- have_root = 1;
- pno = 0;
- }
- /* FALL THROUGH */
- case PID_NBU:
- fst = FS_BSDFFS;
- break;
- case PID_NBS:
- case PID_SWP:
- if (lp->d_partitions[1].p_size == 0)
- pno = 1;
- fst = FS_SWAP;
- break;
- case PID_BGM:
- case PID_GEM:
- fst = FS_MSDOS;
- break;
- default:
- fst = FS_OTHER;
- break;
- }
- if (pno < 0) {
- if((pno = user_part + 1) >= MAXPARTITIONS)
- continue;
- user_part = pno;
- }
- lp->d_partitions[pno].p_size = tp->tp_size;
- lp->d_partitions[pno].p_offset = tp->tp_st;
- lp->d_partitions[pno].p_fstype = fst;
- }
- lp->d_npartitions = user_part + 1;
-}
-
-/*
- * Create a list of TOS partitions in tos_table `tt'.
- * Returns 0 if an error occured, 1 if successfull,
- * or 2 if no TOS partition table exists.
- */
-static int
-rd_rootparts(dev, strat, spc, spu, tt)
-dev_t dev;
-void (*strat)();
-u_int32_t spc, spu;
-struct tos_table *tt;
-{
- struct tos_root *root;
- struct buf *bp;
- int i, j, rv = 0;
-
- bp = geteblk(TOS_BSIZE);
- bp->b_dev = MAKEDISKDEV(major(dev), DISKUNIT(dev), RAW_PART);
- bp->b_flags = B_BUSY | B_READ;
- bp->b_bcount = TOS_BSIZE;
- bp->b_blkno = TOS_BBLOCK;
- bp->b_cylinder = TOS_BBLOCK / spc;
- (*strat)(bp);
- if (biowait(bp))
- goto done;
- root = (struct tos_root *)bp->b_data;
-
- MACHDSBR_DEBUG(("hdsize: %lu bsl-start: %lu bsl-size: %lu\n",
- (u_long)root->tr_hdsize, (u_long)root->tr_bslst,
- (u_long)root->tr_bslsize));
-
- if (!root->tr_hdsize || (!root->tr_bslsize && root->tr_bslst)) {
- rv = 2; goto done;
- }
- for (i = 0; i < NTOS_PARTS; ++i) {
- struct tos_part *part = &root->tr_parts[i];
- if (!(part->tp_flg & 1)) /* skip invalid entries */
- continue;
- MACHDSBR_DEBUG((" %c%c%c %9lu %9lu\n",
- part->tp_id[0], part->tp_id[1], part->tp_id[2],
- (u_long)part->tp_st, (u_long)part->tp_size));
- if (part->tp_st == 0 || part->tp_st >= spu
- || part->tp_size == 0 || part->tp_size >= spu
- || part->tp_st + part->tp_size > spu)
- goto done;
- if ( (part->tp_st <= root->tr_bslst
- && part->tp_st + part->tp_size > root->tr_bslst)
- || (part->tp_st > root->tr_bslst
- && root->tr_bslst + root->tr_bslsize > part->tp_st))
- goto done;
- if (add_tospart(part, tt) && !rd_extparts(dev, strat,
- spc, part->tp_st, part->tp_size, tt))
- goto done;
- }
- if (tt->tt_nparts > MAX_TOS_PARTS)
- goto done; /* too many partitions for us */
- /*
- * Allthough the AHDI 3.0 specifications do not prohibit
- * a root sector with only invalid partition entries in
- * it, this situation would be most unlikely.
- */
- if (!tt->tt_nparts) {
- rv = 2; goto done;
- }
- for (i = 0; i < tt->tt_nparts; ++i) {
- struct tos_part *p1 = &tt->tt_parts[i];
- for (j = 0; j < i; ++j) {
- struct tos_part *p2 = &tt->tt_parts[j];
- if ( (p1->tp_st <= p2->tp_st
- && p1->tp_st + p1->tp_size > p2->tp_st)
- || (p1->tp_st > p2->tp_st
- && p2->tp_st + p2->tp_size > p1->tp_st))
- goto done;
- }
- }
- tt->tt_bslsize = root->tr_bslsize;
- tt->tt_bslst = root->tr_bslst;
- rv = 1;
-done:
- bp->b_flags = B_INVAL | B_AGE | B_READ;
- brelse(bp);
- return(rv);
-}
-
-/*
- * Add all subpartitions within an extended
- * partition to tos_table `tt'.
- * Returns 0 if an error occured, 1 if successfull.
- */
-static int
-rd_extparts(dev, strat, spc, extst, extsize, tt)
-dev_t dev;
-void (*strat)();
-u_int32_t spc, extst, extsize;
-struct tos_table *tt;
-{
- struct buf *bp;
- u_int32_t subst = extst, subsize = extsize;
- int rv = 0;
-
- bp = geteblk(TOS_BSIZE);
- bp->b_dev = MAKEDISKDEV(major(dev), DISKUNIT(dev), RAW_PART);
-
- for (;;) {
- struct tos_root *root = (struct tos_root *)bp->b_data;
- struct tos_part *part = root->tr_parts;
-
- MACHDSBR_DEBUG(("auxilary root at sector %lu\n",(u_long)subst));
- bp->b_flags = B_BUSY | B_READ;
- bp->b_bcount = TOS_BSIZE;
- bp->b_blkno = subst;
- bp->b_cylinder = subst / spc;
- (*strat)(bp);
- if (biowait(bp))
- goto done;
- /*
- * The first entry in an auxilary root sector must be
- * marked as valid. The entry must describe a normal
- * partition. The partition must not extend beyond
- * the boundaries of the subpartition that it's
- * part of.
- */
- MACHDSBR_DEBUG((" %c%c%c %9lu %9lu\n",
- part->tp_id[0], part->tp_id[1], part->tp_id[2],
- (u_long)part->tp_st, (u_long)part->tp_size));
- if (!(part->tp_flg & 1)
-#if 0 /* LWP: Temporary hack */
- || part->tp_st == 0 || part->tp_st >= subsize
- || part->tp_size == 0 || part->tp_size >= subsize
- || part->tp_st + part->tp_size > subsize) {
-#else
- || part->tp_st == 0
- || part->tp_size == 0
- || part->tp_size >= extsize) {
-#endif
- MACHDSBR_DEBUG(("first entry exceeds parent\n"));
- goto done;
- }
- part->tp_st += subst;
- if (add_tospart(part++, tt)) {
- MACHDSBR_DEBUG(("first entry is XGM\n"));
- goto done;
- }
- /*
- * If the second entry in an auxilary rootsector is
- * marked as invalid, we've reached the end of the
- * linked list of subpartitions.
- */
- if (!(part->tp_flg & 1)) {
- rv = 1;
- goto done;
- }
- /*
- * If marked valid, the second entry in an auxilary
- * rootsector must describe a subpartition (id XGM).
- * The subpartition must not extend beyond the
- * boundaries of the extended partition that
- * it's part of.
- */
- MACHDSBR_DEBUG((" %c%c%c %9lu %9lu\n",
- part->tp_id[0], part->tp_id[1], part->tp_id[2],
- (u_long)part->tp_st, (u_long)part->tp_size));
-#if 0 /* LWP: Temporary hack */
- if (part->tp_st == 0 || part->tp_st >= extsize
- || part->tp_size == 0 || part->tp_size >= extsize
- || part->tp_st + part->tp_size > extsize) {
-#else
- if (part->tp_st == 0
- || part->tp_st >= extsize
- || part->tp_size == 0) {
-#endif
- MACHDSBR_DEBUG(("second entry exceeds parent\n"));
- goto done;
- }
- part->tp_st += extst;
- if (!add_tospart(part, tt)) {
- MACHDSBR_DEBUG(("second entry is not XGM\n"));
- goto done;
- }
- subst = part->tp_st;
- subsize = part->tp_size;
- }
-done:
- bp->b_flags = B_INVAL | B_AGE | B_READ;
- brelse(bp);
- return(rv);
-}
-
-/*
- * Add a TOS partition or an auxilary root sector
- * to the appropriate list in tos_table `tt'.
- * Returns 1 if `tp' is an XGM partition, otherwise 0.
- */
-static int
-add_tospart (tp, tt)
-struct tos_part *tp;
-struct tos_table *tt;
-{
- u_int32_t i;
-
- tp->tp_flg = 0;
- i = *((u_int32_t *)&tp->tp_flg);
- if (i == PID_XGM) {
- i = tt->tt_nroots++;
- if (i < MAX_TOS_ROOTS)
- tt->tt_roots[i] = tp->tp_st;
- return 1;
- }
- i = tt->tt_nparts++;
- if (i < MAX_TOS_PARTS)
- tt->tt_parts[i] = *tp;
- return 0;
-}
diff --git a/sys/arch/atari/atari/dkbad.c b/sys/arch/atari/atari/dkbad.c
deleted file mode 100644
index ecf2c92ed7d..00000000000
--- a/sys/arch/atari/atari/dkbad.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $NetBSD: dkbad.c,v 1.1.1.1 1995/03/26 07:12:19 leo Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dkbad.c 7.2 (Berkeley) 12/16/90
- */
-
-#ifndef NOBADSECT
-#include <sys/param.h>
-#include <sys/buf.h>
-#include <sys/dkbad.h>
-
-/*
- * Search the bad sector table looking for
- * the specified sector. Return index if found.
- * Return -1 if not found.
- */
-
-isbad(bt, cyl, trk, sec)
- register struct dkbad *bt;
-{
- register int i;
- register long blk, bblk;
-
- blk = ((long)cyl << 16) + (trk << 8) + sec;
- for (i = 0; i < NBT_BAD; i++) {
- bblk = ((long)bt->bt_bad[i].bt_cyl << 16) + bt->bt_bad[i].bt_trksec;
- if (blk == bblk)
- return (i);
- if (blk < bblk || bblk < 0)
- break;
- }
- return (-1);
-}
-#endif
diff --git a/sys/arch/atari/atari/fpu.c b/sys/arch/atari/atari/fpu.c
deleted file mode 100644
index 3b6c995ee63..00000000000
--- a/sys/arch/atari/atari/fpu.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/* $NetBSD: fpu.c,v 1.1 1995/08/28 19:31:06 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Gordon W. Ross
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- * 4. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Gordon Ross
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Floating Point Unit (MC68881/882/040)
- * Probe for the FPU at autoconfig time.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/time.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-
-#include <machine/psl.h>
-#include <machine/cpu.h>
-#include <machine/frame.h>
-
-#include <setjmp.h>
-
-extern int fpu_type;
-extern int *nofault;
-
-static char *fpu_descr[] = {
-#ifdef FPU_EMULATE
- " emulated", /* 0 */
-#else
- " no", /* 0 */
-#endif
- " mc68881", /* 1 */
- " mc68882", /* 2 */
- "/", /* 3 68040 internal */
- "???" };
-
-char *
-fpu_describe(type)
-int type;
-{
- int maxtype = sizeof(fpu_descr)/sizeof(fpu_descr[0]) - 1;
-
- if ((type < 0) || (type > maxtype))
- type = 0;
- return(fpu_descr[type]);
-}
-
-int
-fpu_probe()
-{
- /*
- * A 68881 idle frame is 28 bytes and a 68882's is 60 bytes.
- * We, of course, need to have enough room for either.
- */
- int fpframe[60 / sizeof(int)];
- jmp_buf faultbuf;
- u_char b;
-
- nofault = (int *) &faultbuf;
- if (setjmp(faultbuf)) {
- nofault = (int *) 0;
- return(0);
- }
-
- /*
- * Synchronize FPU or cause a fault.
- * This should leave the 881/882 in the IDLE state,
- * state, so we can determine which we have by
- * examining the size of the FP state frame
- */
- asm("fnop");
-
- nofault = (int *) 0;
-
- /*
- * Presumably, if we're an 040 and did not take exception
- * above, we have an FPU. Don't bother probing.
- */
- if (mmutype == MMU_68040) {
- return 3;
- }
-
- /*
- * Presumably, this will not cause a fault--the fnop should
- * have if this will. We save the state in order to get the
- * size of the frame.
- */
- asm("movl %0, a0; fsave a0@" : : "a" (fpframe) : "a0" );
-
- b = *((u_char *) fpframe + 1);
-
- /*
- * Now, restore a NULL state to reset the FPU.
- */
- fpframe[0] = fpframe[1] = 0;
- m68881_restore(fpframe);
-
- /*
- * The size of a 68881 IDLE frame is 0x18
- * and a 68882 frame is 0x38
- */
- if (b == 0x18) return 1;
- if (b == 0x38) return 2;
-
- /*
- * If it's not one of the above, we have no clue what it is.
- */
- return 4;
-}
diff --git a/sys/arch/atari/atari/genassym.c b/sys/arch/atari/atari/genassym.c
deleted file mode 100644
index 46dbd9941c6..00000000000
--- a/sys/arch/atari/atari/genassym.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/* $NetBSD: genassym.c,v 1.6 1995/12/16 21:40:29 leo Exp $ */
-
-/*
- * Copyright (c) 1982, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)genassym.c 7.8 (Berkeley) 5/7/91
- */
-
-#define _KERNEL
-
-#include <sys/param.h>
-#include <sys/buf.h>
-#include <sys/proc.h>
-#include <sys/mbuf.h>
-#include <sys/msgbuf.h>
-#include <machine/cpu.h>
-#include <machine/trap.h>
-#include <machine/psl.h>
-#include <machine/reg.h>
-#include <machine/vmparam.h>
-#include <sys/syscall.h>
-#include <vm/vm.h>
-#include <sys/user.h>
-#include <machine/pte.h>
-#include <machine/iomap.h>
-#include <machine/scu.h>
-
-main()
-{
- register struct proc *p = (struct proc *)0;
- register struct vmmeter *vm = (struct vmmeter *)0;
- register struct user *up = (struct user *)0;
- register struct rusage *rup = (struct rusage *)0;
- struct frame *frame = NULL;
- struct vmspace *vms = (struct vmspace *)0;
- pmap_t pmap = (pmap_t)0;
- struct pcb *pcb = (struct pcb *)0;
- struct mdproc *mdproc = (struct mdproc *)0;
- register unsigned i;
-
- printf("#define\tP_FORW %d\n", &p->p_forw);
- printf("#define\tP_BACK %d\n", &p->p_back);
- printf("#define\tP_VMSPACE %d\n", &p->p_vmspace);
- printf("#define\tP_ADDR %d\n", &p->p_addr);
- printf("#define\tP_PRIORITY %d\n", &p->p_priority);
- printf("#define\tP_STAT %d\n", &p->p_stat);
- printf("#define\tP_WCHAN %d\n", &p->p_wchan);
- printf("#define\tP_MD %d\n", &p->p_md);
- printf("#define\tP_PID %d\n", &p->p_pid);
- printf("#define\tMD_REGS %d\n", &mdproc->md_regs);
- printf("#define\tSRUN %d\n", SRUN);
-
- printf("#define\tPM_STCHG %d\n", &pmap->pm_stchanged);
-
- printf("#define\tVM_PMAP %d\n", &vms->vm_pmap);
- printf("#define\tV_INTR %d\n", &vm->v_intr);
-
- printf("#define\tUPAGES %d\n", UPAGES);
- printf("#define\tUSPACE %d\n", USPACE);
- printf("#define\tNBPG %d\n", NBPG);
- printf("#define\tPGSHIFT %d\n", PGSHIFT);
- printf("#define\tUSRSTACK %d\n", USRSTACK);
-
- printf("#define\tU_PROF %d\n", &up->u_stats.p_prof);
- printf("#define\tU_PROFSCALE %d\n", &up->u_stats.p_prof.pr_scale);
- printf("#define\tT_BUSERR %d\n", T_BUSERR);
- printf("#define\tT_ADDRERR %d\n", T_ADDRERR);
- printf("#define\tT_ILLINST %d\n", T_ILLINST);
- printf("#define\tT_ZERODIV %d\n", T_ZERODIV);
- printf("#define\tT_CHKINST %d\n", T_CHKINST);
- printf("#define\tT_TRAPVINST %d\n", T_TRAPVINST);
- printf("#define\tT_PRIVINST %d\n", T_PRIVINST);
- printf("#define\tT_TRACE %d\n", T_TRACE);
- printf("#define\tT_MMUFLT %d\n", T_MMUFLT);
- printf("#define\tT_SSIR %d\n", T_SSIR);
- printf("#define\tT_FMTERR %d\n", T_FMTERR);
- printf("#define\tT_COPERR %d\n", T_COPERR);
- printf("#define\tT_FPERR %d\n", T_FPERR);
- printf("#define\tT_ASTFLT %d\n", T_ASTFLT);
- printf("#define\tT_TRAP15 %d\n", T_TRAP15);
- printf("#define\tT_FPEMULI %d\n", T_FPEMULI);
- printf("#define\tT_FPEMULD %d\n", T_FPEMULD);
- printf("#define\tPSL_S %d\n", PSL_S);
- printf("#define\tPSL_IPL7 %d\n", PSL_IPL7);
- printf("#define\tPSL_LOWIPL %d\n", PSL_LOWIPL);
- printf("#define\tPSL_HIGHIPL %d\n", PSL_HIGHIPL);
- printf("#define\tPSL_USER %d\n", PSL_USER);
- printf("#define\tSPL1 %d\n", PSL_S | PSL_IPL1);
- printf("#define\tSPL2 %d\n", PSL_S | PSL_IPL2);
- printf("#define\tSPL3 %d\n", PSL_S | PSL_IPL3);
- printf("#define\tSPL4 %d\n", PSL_S | PSL_IPL4);
- printf("#define\tSPL5 %d\n", PSL_S | PSL_IPL5);
- printf("#define\tSPL6 %d\n", PSL_S | PSL_IPL6);
- printf("#define\tFC_USERD %d\n", FC_USERD);
- printf("#define\tFC_SUPERD %d\n", FC_SUPERD);
- printf("#define\tCACHE_ON %d\n", CACHE_ON);
- printf("#define\tCACHE_OFF %d\n", CACHE_OFF);
- printf("#define\tCACHE_CLR %d\n", CACHE_CLR);
- printf("#define\tIC_CLEAR %d\n", IC_CLEAR);
- printf("#define\tDC_CLEAR %d\n", DC_CLEAR);
- printf("#define\tCACHE40_ON %d\n", CACHE40_ON);
- printf("#define\tCACHE40_OFF %d\n", CACHE40_OFF);
- printf("#define\tPG_V %d\n", PG_V);
- printf("#define\tPG_NV %d\n", PG_NV);
- printf("#define\tPG_RO %d\n", PG_RO);
- printf("#define\tPG_RW %d\n", PG_RW);
- printf("#define\tPG_CI %d\n", PG_CI);
- printf("#define\tPG_PROT %d\n", PG_PROT);
- printf("#define\tPG_FRAME %d\n", PG_FRAME);
- printf("#define\tSG_V %d\n", SG_V);
- printf("#define\tSG_NV %d\n", SG_NV);
- printf("#define\tSG_RW %d\n", SG_RW);
- printf("#define\tSG_FRAME %d\n", SG_FRAME);
- printf("#define\tPCB_FLAGS %d\n", &pcb->pcb_flags);
- printf("#define\tPCB_PS %d\n", &pcb->pcb_ps);
- printf("#define\tPCB_USTP %d\n", &pcb->pcb_ustp);
- printf("#define\tPCB_USP %d\n", &pcb->pcb_usp);
- printf("#define\tPCB_REGS %d\n", pcb->pcb_regs);
- printf("#define\tPCB_CMAP2 %d\n", &pcb->pcb_cmap2);
- printf("#define\tPCB_ONFAULT %d\n", &pcb->pcb_onfault);
- printf("#define\tPCB_FPCTX %d\n", &pcb->pcb_fpregs);
- printf("#define\tSIZEOF_PCB %d\n", sizeof(struct pcb));
-
- printf("#define\tFR_SP %d\n", &frame->f_regs[15]);
- printf("#define\tFR_HW %d\n", &frame->f_sr);
- printf("#define\tFR_ADJ %d\n", &frame->f_stackadj);
-
- printf("#define\tSP %d\n", SP);
- printf("#define\tSYS_exit %d\n", SYS_exit);
- printf("#define\tSYS_execve %d\n", SYS_execve);
- printf("#define\tSYS_sigreturn %d\n", SYS_sigreturn);
- printf("#define\tATARI_68020 %d\n", ATARI_68020);
- printf("#define\tATARI_68030 %d\n", ATARI_68030);
- printf("#define\tATARI_68040 %d\n", ATARI_68040);
- printf("#define\tMMU_68030 %d\n", MMU_68030);
- printf("#define\tMMU_68851 %d\n", MMU_68851);
- printf("#define\tMMU_68040 %d\n", MMU_68040);
-
- printf("#define\tSOFTINT_ADDR %d\n", &SCU->sys_int);
- printf("#define\tSYSMASK_ADDR %d\n", &SCU->sys_mask);
-
- exit(0);
-}
diff --git a/sys/arch/atari/atari/kdassert.h b/sys/arch/atari/atari/kdassert.h
deleted file mode 100644
index da29af09481..00000000000
--- a/sys/arch/atari/atari/kdassert.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* $NetBSD: kdassert.h,v 1.1.1.1 1995/03/26 07:12:18 leo Exp $ */
-
-/*
- * Copyright (c) 1994 Christian E. Hopps
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christian E. Hopps.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if ! defined (_KDASSERT_H)
-#define _KDASSERT_H
-#if defined (DEBUG)
-#if defined (__STDC__)
-#if defined (__GNUC__)
-#define KDASSERT(x) if (!(x)) panic ("kernel assertion:\"%s\" failed\nfile: %s\n" \
- "func: %s\nline: %d", #x , __FILE__, __FUNCTION__, __LINE__)
-#else /* !__GNUC__ */
-#define KDASSERT(x) if (!(x)) panic ("kernel assertion:\"%s\" failed\nfile: %s\n" \
- "line: %d", #x, __FILE__, __LINE__)
-#endif /* !__GNUC__ */
-#else /* !__STDC__ */
-#if defined (__GNUC__)
-#define KDASSERT(x) if (!(x)) panic ("kernel assertion:\"%s\" failed\nfile: %s\n" \
- "func: %s\nline: %d", "x", __FILE__, __FUNCTION__, __LINE__)
-#else /* !__GNUC__ */
-#define KDASSERT(x) if (!(x)) panic ("kernel assertion:\"%s\" failed\nfile: %s\n" \
- "line: %d", "x", __FILE__, __LINE__)
-#endif /* !__GNUC__ */
-#endif /* !__STDC__ */
-#else /* !DEBUG */
-#define KDASSERT(x)
-#endif /* !DEBUG */
-#endif /* _KDASSERT_H
diff --git a/sys/arch/atari/atari/locore.s b/sys/arch/atari/atari/locore.s
deleted file mode 100644
index f847aa5584d..00000000000
--- a/sys/arch/atari/atari/locore.s
+++ /dev/null
@@ -1,1904 +0,0 @@
-/* $NetBSD: locore.s,v 1.14 1995/12/18 20:40:59 leo Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1980, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: locore.s 1.58 91/04/22$
- *
- * @(#)locore.s 7.11 (Berkeley) 5/9/91
- */
-
-/*
- *
- * Original (hp300) Author: unknown, maybe Mike Hibler?
- * Amiga author: Markus Wild
- * Atari Modifications: Leo Weppelman
- */
-
-#include "assym.s"
-#include <atari/atari/vectors.s>
-
- .text
-_C_LABEL(kernel_text):
-
-/*
- * This is where we wind up if the kernel jumps to location 0.
- * (i.e. a bogus PC) This is known to immediately follow the vector
- * table and is hence at 0x400 (see reset vector in vectors.s).
- */
- .globl _panic
- pea Ljmp0panic
- jbsr _panic
- /* NOTREACHED */
-Ljmp0panic:
- .asciz "kernel jump to zero"
- .even
-
-/*
- * Do a dump.
- * Called by auto-restart.
- */
- .globl _dumpsys
- .globl _doadump
-_doadump:
- jbsr _dumpsys
- jbsr _doboot
- /*NOTREACHED*/
-
-/*
- * Trap/interrupt vector routines
- */
-
- .globl _trap, _nofault, _longjmp
-_buserr:
- tstl _nofault | device probe?
- jeq _addrerr | no, handle as usual
- movl _nofault,sp@- | yes,
- jbsr _longjmp | longjmp(nofault)
-_addrerr:
- clrl sp@- | stack adjust count
- moveml #0xFFFF,sp@- | save user registers
- movl usp,a0 | save the user SP
- movl a0,sp@(FR_SP) | in the savearea
- lea sp@(FR_HW),a1 | grab base of HW berr frame
- tstl _cpu040
- jeq Lbe030
- movl a1@(8),sp@- | V = exception address
- clrl sp@- | dummy code
- moveq #0,d0
- movw a1@(6),d0 | get vector offset
- andw #0x0fff,d0
- cmpw #12,d0 | is it address error
- jeq Lisaerr
- movl a1@(20),d1 | get fault address
- moveq #0,d0
- movw a1@(12),d0 | get SSW
- btst #11,d0 | check for mis-aligned
- jeq Lbe1stpg | no skip
- addl #3,d1 | get into next page
- andl #PG_FRAME,d1 | and truncate
-Lbe1stpg:
- movl d1,sp@(4) | pass fault address.
- movl d0,sp@ | pass SSW as code
- btst #10,d0 | test ATC
- jeq Lisberr | it's a bus error
- jra Lismerr
-Lbe030:
- moveq #0,d0
- movw a1@(10),d0 | grab SSW for fault processing
- btst #12,d0 | RB set?
- jeq LbeX0 | no, test RC
- bset #14,d0 | yes, must set FB
- movw d0,a1@(10) | for hardware too
-LbeX0:
- btst #13,d0 | RC set?
- jeq LbeX1 | no, skip
- bset #15,d0 | yes, must set FC
- movw d0,a1@(10) | for hardware too
-LbeX1:
- btst #8,d0 | data fault?
- jeq Lbe0 | no, check for hard cases
- movl a1@(16),d1 | fault address is as given in frame
- jra Lbe10 | thats it
-Lbe0:
- btst #4,a1@(6) | long (type B) stack frame?
- jne Lbe4 | yes, go handle
- movl a1@(2),d1 | no, can use save PC
- btst #14,d0 | FB set?
- jeq Lbe3 | no, try FC
- addql #4,d1 | yes, adjust address
- jra Lbe10 | done
-Lbe3:
- btst #15,d0 | FC set?
- jeq Lbe10 | no, done
- addql #2,d1 | yes, adjust address
- jra Lbe10 | done
-Lbe4:
- movl a1@(36),d1 | long format, use stage B address
- btst #15,d0 | FC set?
- jeq Lbe10 | no, all done
- subql #2,d1 | yes, adjust address
-Lbe10:
- movl d1,sp@- | push fault VA
- movl d0,sp@- | and padded SSW
- movw a1@(6),d0 | get frame format/vector offset
- andw #0x0FFF,d0 | clear out frame format
- cmpw #12,d0 | address error vector?
- jeq Lisaerr | yes, go to it
- movl d1,a0 | fault address
- ptestr #1,a0@,#7 | do a table search
- pmove psr,sp@ | save result
- btst #7,sp@ | bus error bit set?
- jeq Lismerr | no, must be MMU fault
- clrw sp@ | yes, re-clear pad word
- jra Lisberr | and process as normal bus error
-Lismerr:
- movl #T_MMUFLT,sp@- | show that we are an MMU fault
- jra Ltrapnstkadj | and deal with it
-Lisaerr:
- movl #T_ADDRERR,sp@- | mark address error
- jra Ltrapnstkadj | and deal with it
-Lisberr:
- movl #T_BUSERR,sp@- | mark bus error
-Ltrapnstkadj:
- jbsr _trap | handle the error
- lea sp@(12),sp | pop value args
- movl sp@(FR_SP),a0 | restore user SP
- movl a0,usp | from save area
- movw sp@(FR_ADJ),d0 | need to adjust stack?
- jne Lstkadj | yes, go to it
- moveml sp@+,#0x7FFF | no, restore most user regs
- addql #8,sp | toss SSP and stkadj
- jra rei | all done
-Lstkadj:
- lea sp@(FR_HW),a1 | pointer to HW frame
- addql #8,a1 | source pointer
- movl a1,a0 | source
- addw d0,a0 | + hole size = dest pointer
- movl a1@-,a0@- | copy
- movl a1@-,a0@- | 8 bytes
- movl a0,sp@(FR_SP) | new SSP
- moveml sp@+,#0x7FFF | restore user registers
- movl sp@,sp | and our SP
- jra rei | all done
-
-/*
- * FP exceptions.
- */
-_fpfline:
- tstl _cpu040 | an 040 FPU
- jeq fpfline_not40 | no, do 6888? emulation
- cmpw #0x202c,sp@(6) | format type 2?
- jne _illinst | no, not an FP emulation
-#ifdef FPSP
- .globl fpsp_unimp
- jmp fpsp_unimp | yes, go handle it
-#endif
-fpfline_not40:
- clrl sp@- | stack adjust count
- moveml #0xFFFF,sp@- | save registers
- moveq #T_FPEMULI,d0 | denote as FP emulation trap
- jra fault | do it
-
-_fpunsupp:
- tstl _cpu040 | an 040 FPU?
- jeq fpunsupp_not40
-#ifdef FPSP
- .globl fpsp_unsupp
- jmp fpsp_unsupp | yes, go handle it
-#endif
-fpunsupp_not40:
- clrl sp@- | stack adjust count
- moveml #0xFFFF,sp@- | save registers
- moveq #T_FPEMULD,d0 | denote as FP emulation trap
- jra fault | do it
-
-/*
- * Handles all other FP coprocessor exceptions.
- * Note that since some FP exceptions generate mid-instruction frames
- * and may cause signal delivery, we need to test for stack adjustment
- * after the trap call.
- */
- .globl _fpfault
-_fpfault:
- clrl sp@- | stack adjust count
- moveml #0xFFFF,sp@- | save user registers
- movl usp,a0 | and save
- movl a0,sp@(FR_SP) | the user stack pointer
- clrl sp@- | no VA arg
- movl _curpcb,a0 | current pcb
- lea a0@(PCB_FPCTX),a0 | address of FP savearea
- fsave a0@ | save state
- tstb a0@ | null state frame?
- jeq Lfptnull | yes, safe
- clrw d0 | no, need to tweak BIU
- movb a0@(1),d0 | get frame size
- bset #3,a0@(0,d0:w) | set exc_pend bit of BIU
-Lfptnull:
- fmovem fpsr,sp@- | push fpsr as code argument
- frestore a0@ | restore state
- movl #T_FPERR,sp@- | push type arg
- jra Ltrapnstkadj | call trap and deal with stack cleanup
-
-/*
- * Coprocessor and format errors can generate mid-instruction stack
- * frames and cause signal delivery hence we need to check for potential
- * stack adjustment.
- */
-_coperr:
- clrl sp@- | stack adjust count
- moveml #0xFFFF,sp@-
- movl usp,a0 | get and save
- movl a0,sp@(FR_SP) | the user stack pointer
- clrl sp@- | no VA arg
- clrl sp@- | or code arg
- movl #T_COPERR,sp@- | push trap type
- jra Ltrapnstkadj | call trap and deal with stack adjust
-
-_fmterr:
- clrl sp@- | stack adjust count
- moveml #0xFFFF,sp@-
- movl usp,a0 | get and save
- movl a0,sp@(FR_SP) | the user stack pointer
- clrl sp@- | no VA arg
- clrl sp@- | or code arg
- movl #T_FMTERR,sp@- | push trap type
- jra Ltrapnstkadj | call trap and deal with stack adjust
-
-/*
- * Other exceptions only cause four and six word stack frame and require
- * no post-trap stack adjustment.
- */
-_illinst:
- clrl sp@-
- moveml #0xFFFF,sp@-
- moveq #T_ILLINST,d0
- jra fault
-
-_zerodiv:
- clrl sp@-
- moveml #0xFFFF,sp@-
- moveq #T_ZERODIV,d0
- jra fault
-
-_chkinst:
- clrl sp@-
- moveml #0xFFFF,sp@-
- moveq #T_CHKINST,d0
- jra fault
-
-_trapvinst:
- clrl sp@-
- moveml #0xFFFF,sp@-
- moveq #T_TRAPVINST,d0
- jra fault
-
-_privinst:
- clrl sp@-
- moveml #0xFFFF,sp@-
- moveq #T_PRIVINST,d0
- jra fault
-
- .globl fault
-fault:
- movl usp,a0 | get and save
- movl a0,sp@(FR_SP) | the user stack pointer
- clrl sp@- | no VA arg
- clrl sp@- | or code arg
- movl d0,sp@- | push trap type
- jbsr _trap | handle trap
- lea sp@(12),sp | pop value args
- movl sp@(FR_SP),a0 | restore
- movl a0,usp | user SP
- moveml sp@+,#0x7FFF | restore most user regs
- addql #8,sp | pop SP and stack adjust
- jra rei | all done
-
- .globl _straytrap
-
-_lev4intr: | HBL & VBL interrupts can not
-_lev2intr: | be turned off on a Falcon, so
- rte | just ignore them.
-
-_lev3intr:
-_lev5intr:
-_lev6intr:
-_badtrap:
- moveml #0xC0C0,sp@- | save scratch regs
- movw sp@(22),sp@- | push exception vector info
- clrw sp@-
- movl sp@(22),sp@- | and PC
- jbsr _straytrap | report
- addql #8,sp | pop args
- moveml sp@+,#0x0303 | restore regs
- jra rei | all done
-
- .globl _straymfpint
-_badmfpint:
- moveml #0xC0C0,sp@- | save scratch regs
- movw sp@(22),sp@- | push exception vector info
- clrw sp@-
- movl sp@(22),sp@- | and PC
- jbsr _straymfpint | report
- addql #8,sp | pop args
- moveml sp@+,#0x0303 | restore regs
- jra rei | all done
-
- .globl _syscall
-_trap0:
- clrl sp@- | stack adjust count
- moveml #0xFFFF,sp@- | save user registers
- movl usp,a0 | save the user SP
- movl a0,sp@(FR_SP) | in the savearea
- movl d0,sp@- | push syscall number
- jbsr _syscall | handle it
- addql #4,sp | pop syscall arg
- movl sp@(FR_SP),a0 | grab and restore
- movl a0,usp | user SP
- moveml sp@+,#0x7FFF | restore most registers
- addql #8,sp | pop SP and stack adjust
- jra rei | all done
-
-/*
- * Our native 4.3 implementation uses trap 1 as sigreturn() and trap 2
- * as a breakpoint trap.
- */
-_trap1:
- jra sigreturn
-
-_trap2:
- jra _trace
-
-/*
- * Trap 12 is the entry point for the cachectl "syscall"
- * cachectl(command, addr, length)
- * command in d0, addr in a1, length in d1
- */
- .globl _cachectl
-_trap12:
- movl d1,sp@- | push length
- movl a1,sp@- | push addr
- movl d0,sp@- | push command
- jbsr _cachectl | do it
- lea sp@(12),sp | pop args
- jra rei | all done
-
-/*
- * Trap 15 is used for:
- * - KGDB traps
- * - trace traps for SUN binaries (not fully supported yet)
- * We just pass it on and let trap() sort it all out
- */
-_trap15:
- clrl sp@-
- moveml #0xFFFF,sp@-
-#ifdef KGDB
- moveq #T_TRAP15,d0
- movw sp@(FR_HW),d1 | get PSW
- andw #PSL_S,d1 | from user mode?
- jeq fault | yes, just a regular fault
- movl d0,sp@-
- .globl _kgdb_trap_glue
- jbsr _kgdb_trap_glue | returns if no debugger
- addl #4,sp
-#endif
- moveq #T_TRAP15,d0
- jra fault
-
-/*
- * Hit a breakpoint (trap 1 or 2) instruction.
- * Push the code and treat as a normal fault.
- */
-_trace:
- clrl sp@-
- moveml #0xFFFF,sp@-
-#ifdef KGDB
- moveq #T_TRACE,d0
- movw sp@(FR_HW),d1 | get SSW
- andw #PSL_S,d1 | from user mode?
- jeq fault | no, regular fault
- movl d0,sp@-
- jbsr _kgdb_trap_glue | returns if no debugger
- addl #4,sp
-#endif
- moveq #T_TRACE,d0
- jra fault
-
-/*
- * The sigreturn() syscall comes here. It requires special handling
- * because we must open a hole in the stack to fill in the (possibly much
- * larger) original stack frame.
- */
-sigreturn:
- lea sp@(-84),sp | leave enough space for largest frame
- movl sp@(84),sp@ | move up current 8 byte frame
- movl sp@(88),sp@(4)
- movl #84,sp@- | default: adjust by 84 bytes
- moveml #0xFFFF,sp@- | save user registers
- movl usp,a0 | save the user SP
- movl a0,sp@(FR_SP) | in the savearea
- movl #SYS_sigreturn,sp@- | push syscall number
- jbsr _syscall | handle it
- addql #4,sp | pop syscall#
- movl sp@(FR_SP),a0 | grab and restore
- movl a0,usp | user SP
- lea sp@(FR_HW),a1 | pointer to HW frame
- movw sp@(FR_ADJ),d0 | do we need to adjust the stack?
- jeq Lsigr1 | no, just continue
- moveq #92,d1 | total size
- subw d0,d1 | - hole size = frame size
- lea a1@(92),a0 | destination
- addw d1,a1 | source
- lsrw #1,d1 | convert to word count
- subqw #1,d1 | minus 1 for dbf
-Lsigrlp:
- movw a1@-,a0@- | copy a word
- dbf d1,Lsigrlp | continue
- movl a0,a1 | new HW frame base
-Lsigr1:
- movl a1,sp@(FR_SP) | new SP value
- moveml sp@+,#0x7FFF | restore user registers
- movl sp@,sp | and our SP
- jra rei | all done
-
-/*
- * Interrupt handlers.
- *
- * Level 0: Spurious: ignored.
- * Level 1: softint
- * Level 2: HBL
- * Level 3: not used
- * Level 4: not used
- * Level 5: SCC (not used)
- * Level 6: MFP1/MFP2 (not used -> autovectored)
- * Level 7: Non-maskable: shouldn't be possible. ignore.
- */
-
-/* Provide a generic interrupt dispatcher, only handle hardclock (int6)
- * specially, to improve performance
- */
-
- .globl _hardclock
-
-_spurintr:
- addql #1,_intrcnt+0
- addql #1,_cnt+V_INTR
- jra rei
-
- /* MFP timer A handler --- System clock --- */
-mfp_tima:
- moveml d0-d1/a0-a1,sp@- | save scratch registers
- lea sp@(16),a1 | get pointer to PS
- movl a1,sp@- | push pointer to PS, PC
- jbsr _hardclock | call generic clock int routine
- addql #4,sp | pop params
- addql #1,_intrcnt+4 | add another system clock interrupt
- moveml sp@+,d0-d1/a0-a1 | restore scratch regs
- addql #1,_cnt+V_INTR | chalk up another interrupt
- jra rei | all done
-
-#ifdef STATCLOCK
- /* MFP timer C handler --- Stat/Prof clock --- */
-mfp_timc:
- moveml d0-d1/a0-a1,sp@- | save scratch registers
- lea sp@(16),a1 | get pointer to PS
- movl a1,sp@- | push pointer to PS, PC
- jbsr _statintr | call statistics clock handler
- addql #4,sp | pop params
- addql #1,_intrcnt+36 | add another stat clock interrupt
- moveml sp@+,d0-d1/a0-a1 | restore scratch regs
- addql #1,_cnt+V_INTR | chalk up another interrupt
- jra rei | all done
-#endif /* STATCLOCK */
-
- /* MFP ACIA handler --- keyboard/midi --- */
-mfp_kbd:
- addql #1,_intrcnt+8 | add another kbd/mouse interrupt
-
- moveml d0-d1/a0-a1,sp@- | Save scratch registers
- movw sp@(16),sp@- | push previous SR value
- clrw sp@- | padded to longword
- jbsr _kbdintr | handle interrupt
- addql #4,sp | pop SR
- moveml sp@+,d0-d1/a0-a1
- addql #1,_cnt+V_INTR | chalk up another interrupt
- jra rei
-
- /* MFP2 SCSI DMA handler --- NCR5380 --- */
-mfp2_5380dm:
- addql #1,_intrcnt+24 | add another 5380-DMA interrupt
-
- moveml d0-d1/a0-a1,sp@- | Save scratch registers
- movw sp@(16),sp@- | push previous SR value
- clrw sp@- | padded to longword
- jbsr _scsi_dma | handle interrupt
- addql #4,sp | pop SR
- moveml sp@+,d0-d1/a0-a1
- addql #1,_cnt+V_INTR | chalk up another interrupt
- jra rei
-
- /* MFP2 SCSI handler --- NCR5380 --- */
-mfp2_5380:
- addql #1,_intrcnt+20 | add another 5380-SCSI interrupt
-
- moveml d0-d1/a0-a1,sp@- | Save scratch registers
- movw sp@(16),sp@- | push previous SR value
- clrw sp@- | padded to longword
- jbsr _scsi_ctrl | handle interrupt
- addql #4,sp | pop SR
- moveml sp@+,d0-d1/a0-a1
- addql #1,_cnt+V_INTR | chalk up another interrupt
- jra rei
-
- /* MFP DMA handler --- fdc/acsi --- */
-mfp_fd_acsi:
- addql #1,_intrcnt+12 | add another fdc/acsi interrupt
-
- moveml d0-d1/a0-a1,sp@- | Save scratch registers
- movw sp@(16),sp@- | push previous SR value
- clrw sp@- | padded to longword
- jbsr _cdmaint | handle interrupt
- addql #4,sp | pop SR
- moveml sp@+,d0-d1/a0-a1
- addql #1,_cnt+V_INTR | chalk up another interrupt
- jra rei
-
- /* SCC Interrupt --- modem2/serial2 --- */
-sccint:
- addql #1,_intrcnt+32 | add another SCC interrupt
-
- moveml d0-d1/a0-a1,sp@- | Save scratch registers
- movw sp@(16),sp@- | push previous SR value
- clrw sp@- | padded to longword
- jbsr _zshard | handle interrupt
- addql #4,sp | pop SR
- moveml sp@+,d0-d1/a0-a1
- addql #1,_cnt+V_INTR | chalk up another interrupt
- jra rei
-
- /* Level 1 (Software) interrupt handler */
-_lev1intr:
- moveb #0, SOFTINT_ADDR | Turn off software interrupt
- moveml d0-d1/a0-a1,sp@-
- addql #1,_intrcnt+16 | add another software interrupt
- jbsr _softint | handle software interrupts
- moveml sp@+,d0-d1/a0-a1
- addql #1,_cnt+V_INTR | chalk up another interrupt
- jra rei
-
- /*
- * Should never occur, except when special hardware modification
- * is installed. In this case, one expects to be dropped into
- * the debugger.
- */
-_lev7intr:
-#ifdef DDB
- /*
- * Note that the nmi has to be turned off while handling it because
- * the hardware modification has no de-bouncing logic....
- */
- movb SYSMASK_ADDR, sp@- | save current sysmask
- movb #0, SYSMASK_ADDR | disable all interrupts
- trap #15 | drop into the debugger
- movb sp@+, SYSMASK_ADDR | restore sysmask
-#endif
- addql #1,_intrcnt+28 | add another nmi interrupt
- rte | all done
-
-
-/*
- * Emulation of VAX REI instruction.
- *
- * This code deals with checking for and servicing ASTs
- * (profiling, scheduling) and software interrupts (network, softclock).
- * We check for ASTs first, just like the VAX. To avoid excess overhead
- * the T_ASTFLT handling code will also check for software interrupts so we
- * do not have to do it here. After identifing that we need an AST we
- * drop the IPL to allow device interrupts.
- *
- * This code is complicated by the fact that sendsig may have been called
- * necessitating a stack cleanup. A cleanup should only be needed at this
- * point for coprocessor mid-instruction frames (type 9), but we also test
- * for bus error frames (type 10 and 11).
- */
- .comm _ssir,1
- .globl _astpending
- .globl rei
-rei:
-#ifdef DEBUG
- tstl _panicstr | have we paniced?
- jne Ldorte | yes, do not make matters worse
-#endif
- tstl _astpending | AST pending?
- jeq Lchksir | no, go check for SIR
-Lrei1:
- btst #5,sp@ | yes, are we returning to user mode?
- jne Lchksir | no, go check for SIR
- movw #PSL_LOWIPL,sr | lower SPL
- clrl sp@- | stack adjust
- moveml #0xFFFF,sp@- | save all registers
- movl usp,a1 | including
- movl a1,sp@(FR_SP) | the users SP
- clrl sp@- | VA == none
- clrl sp@- | code == none
- movl #T_ASTFLT,sp@- | type == async system trap
- jbsr _trap | go handle it
- lea sp@(12),sp | pop value args
- movl sp@(FR_SP),a0 | restore user SP
- movl a0,usp | from save area
- movw sp@(FR_ADJ),d0 | need to adjust stack?
- jne Laststkadj | yes, go to it
- moveml sp@+,#0x7FFF | no, restore most user regs
- addql #8,sp | toss SP and stack adjust
- rte | and do real RTE
-Laststkadj:
- lea sp@(FR_HW),a1 | pointer to HW frame
- addql #8,a1 | source pointer
- movl a1,a0 | source
- addw d0,a0 | + hole size = dest pointer
- movl a1@-,a0@- | copy
- movl a1@-,a0@- | 8 bytes
- movl a0,sp@(FR_SP) | new SSP
- moveml sp@+,#0x7FFF | restore user registers
- movl sp@,sp | and our SP
- rte | and do real RTE
-Lchksir:
- tstb _ssir | SIR pending?
- jeq Ldorte | no, all done
- movl d0,sp@- | need a scratch register
- movw sp@(4),d0 | get SR
- andw #PSL_IPL7,d0 | mask all but IPL
- jne Lnosir | came from interrupt, no can do
- movl sp@+,d0 | restore scratch register
-Lgotsir:
- movw #SPL1,sr | prevent others from servicing int
- tstb _ssir | too late?
- jeq Ldorte | yes, oh well...
- clrl sp@- | stack adjust
- moveml #0xFFFF,sp@- | save all registers
- movl usp,a1 | including
- movl a1,sp@(FR_SP) | the users SP
- clrl sp@- | VA == none
- clrl sp@- | code == none
- movl #T_SSIR,sp@- | type == software interrupt
- jbsr _trap | go handle it
- lea sp@(12),sp | pop value args
- movl sp@(FR_SP),a0 | restore
- movl a0,usp | user SP
- moveml sp@+,#0x7FFF | and all remaining registers
- addql #8,sp | pop SP and stack adjust
- rte
-Lnosir:
- movl sp@+,d0 | restore scratch register
-Ldorte:
- rte | real return
-
- .data
-_esym: .long 0
- .globl _esym
-
-
-/*
- * Initialization
- *
- * A5 contains physical load point from boot
- * exceptions vector thru our table, that's bad.. just hope nothing exceptional
- * happens till we had time to initialize ourselves..
- */
- .comm _lowram,4
-
- .text
- .globl _edata
- .globl _etext,_end
- .globl start
- .globl _first_8_bytes
-_first_8_bytes: | Save first 8 bytes here
- .long 0
- .long 0
-
- .word 0x0002 | XXX: loadbsd version required
- | 2: needs a4 = esym
- | XXX should be a symbol?
-start:
- movw #PSL_HIGHIPL,sr | No interrupts
-
- /*
- * a0 = start of loaded kernel
- * a1 = value of esym
- * d0 = fastmem size
- * d1 = stmem size
- * d2 = cputype
- * d3 = boothowto
- * d4 = size of loaded kernel
- */
- movl a0, a6 | Save load address in a6
- movl #8, a5 | Addresses 0-8 are mapped to ROM on the
- addql #8, a0 | atari ST. We cannot set these.
- subl #8, d4
-
- /*
- * Copy until end of kernel relocation code.
- */
-Lstart0:
- movl a0@+,a5@+
- subl #4, d4
- cmpl #Lstart3,a5
- jle Lstart0
- /*
- * Enter kernel at destination address and continue copy
- */
- jmp Lstart1
-Lstart1:
- movl a6@+,_first_8_bytes | copy first 8 bytes
- movl a6@,_first_8_bytes+4
-Lstart2:
- movl a0@+,a5@+ | copy the rest of the kernel
- subl #4, d4
- jcc Lstart2
-Lstart3:
-
- lea tmpstk,sp | give ourselves a temporary stack
-
- /*
- * save the passed parameters. `prepass' them on the stack for
- * later catch by _start_c
- */
- movl a1,sp@- | pass address of _esym
- movl d1,sp@- | pass stmem-size
- movl d0,sp@- | pass fastmem-size
- movl d5,sp@- | pass fastmem_start
- movl d2,sp@- | pass machine id
- movl d3,_boothowto | save reboot flags
-
- movl #ATARI_68030,d1 | 68030 type from loader
- andl d2,d1
- jeq Ltestfor020 | Not an 68030, try 68020
- movl #MMU_68030,_mmutype | Use 68030 MMU
- jra Lsetcpu040 | skip to init.
-Ltestfor020:
- movl #ATARI_68020,d1 | 68020 type from loader
- andl d2,d1
- jeq Lsetcpu040
- movl #MMU_68851,_mmutype | Assume 68851 with 68020
-Lsetcpu040:
- movl #CACHE_OFF,d0 | 68020/030 cache
- movl #ATARI_68040,d1
- andl d1,d2
- movl d2,_cpu040 | set 68040 CPU flag
- jeq Lstartnot040 | it's not 68040
- movl #MMU_68040,_mmutype | same as hp300 for compat
- .word 0xf4f8 | cpusha bc - push and inval caches
- movl #CACHE40_OFF,d0 | 68040 cache disable
-Lstartnot040:
- movc d0,cacr | clear and disable on-chip cache(s)
- moveq #0,d0 | This assumes load-address 0!!
- movc d0,vbr
-
- /*
- * Initialize source/destination control registers for movs
- */
- moveq #FC_USERD,d0 | user space
- movc d0,sfc | as source
- movc d0,dfc | and destination of transfers
-
- /*
- * let the C function initialize everything and enable the MMU
- */
- jsr _start_c
-
- /*
- * set kernel stack, user SP, and initial pcb
- */
- movl _proc0paddr,a1 | proc0 kernel stack
- lea a1@(USPACE),sp | set kernel stack to end of area
- movl #USRSTACK-4,a2
- movl a2,usp | init user SP
- movl a2,a1@(PCB_USP) | and save it
- movl a1,_curpcb | proc0 is running
- clrw a1@(PCB_FLAGS) | clear flags
-| LWP: The next part can be savely ommitted I think. The fpu probing
-| code resets the m6888? fpu. How about a 68040 fpu?
-|
-| clrl a1@(PCB_FPCTX) | ensure null FP context
-| pea a1@(PCB_FPCTX)
-| jbsr _m68881_restore | restore it (does not kill a1)
-| addql #4,sp
-
- /* flush TLB and turn on caches */
- jbsr _TBIA | invalidate TLB
- movl #CACHE_ON,d0
- tstl _cpu040
- jeq Lcacheon
- /* is this needed? MLH */
- .word 0xf4f8 | cpusha bc - push & invalidate caches
- movl #CACHE40_ON,d0
-Lcacheon:
- movc d0,cacr | clear cache(s)
-
- /*
- * Final setup for C code
- */
- movw #PSL_LOWIPL,sr | lower SPL
-
-#ifdef notdef
- movl d6,_bootdev | and boot device
-#endif
-
- /*
- * Create a fake exception frame that returns to user mode,
- * make space for the rest of a fake saved register set, and
- * pass a pointer to the register set to "main()".
- * "main()" will call "icode()", which fakes
- * an "execve()" system call, which is why we need to do that
- * ("main()" sets "u.u_ar0" to point to the register set).
- * When "main()" returns, we're running in process 1 and have
- * successfully faked the "execve()". We load up the registers from
- * that set; the "rte" loads the PC and PSR, which jumps to "init".
- */
- .globl _proc0
- movl #0,a6 | make DDB stack_trace() work
- clrw sp@- | vector offset/frame type
- clrl sp@- | PC - filled in by "execve"
- movw #PSL_USER,sp@- | in user mode
- clrl sp@- | stack adjust count
- lea sp@(-64),sp | construct space for D0-D7/A0-A7
- lea _proc0,a0 | proc0 in a0
- movl sp,a0@(P_MD + MD_REGS) | save frame for proc0
- movl usp,a1
- movl a1,sp@(FR_SP) | save user stack pointer in frame
- pea sp@ | addr of space for D0
- jbsr _main | main(r0)
- addql #4,sp | pop args
- tstl _cpu040 | 68040?
- jeq Lnoflush | no, skip
- .word 0xf478 | cpusha dc
- .word 0xf498 | cinva ic
-Lnoflush:
- movl sp@(FR_SP),a0 | grab and load
- movl a0,usp | user SP
- moveml sp@+,#0x7FFF | load most registers (all but SSP)
- addql #8,sp | pop SSP and stack adjust count
- rte
-
-/*
- * proc_trampoline call function in register a2 with a3 as an arg
- * and then rei.
- */
- .globl _proc_trampoline
-_proc_trampoline:
- movl a3,sp@- | push function arg (curproc)
- jbsr a2@ | call function
- addql #4,sp | pop arg
- movl sp@(FR_SP),a0 | usp to a0
- movl a0,usp | setup user stack pointer
- moveml sp@+,#0x7FFF | restore all but sp
- addql #8,sp | pop sp and stack adjust
- jra rei | all done
-
-/*
- * Signal "trampoline" code (18 bytes). Invoked from RTE setup by sendsig().
- *
- * Stack looks like:
- *
- * sp+0 -> signal number
- * sp+4 signal specific code
- * sp+8 pointer to signal context frame (scp)
- * sp+12 address of handler
- * sp+16 saved hardware state
- * .
- * .
- * scp+0-> beginning of signal context frame
- */
- .globl _sigcode, _esigcode
- .data
-_sigcode:
- movl sp@(12),a0 | signal handler addr (4 bytes)
- jsr a0@ | call signal handler (2 bytes)
- addql #4,sp | pop signo (2 bytes)
- trap #1 | special syscall entry (2 bytes)
- movl d0,sp@(4) | save errno (4 bytes)
- moveq #1,d0 | syscall == exit (2 bytes)
- trap #0 | exit(errno) (2 bytes)
- .align 2
-_esigcode:
-
-/*
- * Primitives
- */
-#include <m68k/asm.h>
-
-/*
- * copypage(fromaddr, toaddr)
- *
- * Optimized version of bcopy for a single page-aligned NBPG byte copy.
- * dbra will work better perhaps.
- */
-ENTRY(copypage)
- movl sp@(4),a0 | source address
- movl sp@(8),a1 | destination address
- movl #NBPG/32,d0 | number of 32 byte chunks
- tstl _cpu040
- jeq Lmlloop | no, use movl
-Lm16loop:
- .long 0xf6209000 | move16 a0@+,a1@+
- .long 0xf6209000 | move16 a0@+,a1@+
- subql #1,d0
- jne Lm16loop
- rts
-Lmlloop:
- movl a0@+,a1@+
- movl a0@+,a1@+
- movl a0@+,a1@+
- movl a0@+,a1@+
- movl a0@+,a1@+
- movl a0@+,a1@+
- movl a0@+,a1@+
- movl a0@+,a1@+
- subql #1,d0
- jne Lmlloop
- rts
-/*
- * update profiling information for the user
- * addupc(pc, &u.u_prof, ticks)
- */
-ENTRY(addupc)
- movl a2,sp@- | scratch register
- movl sp@(12),a2 | get &u.u_prof
- movl sp@(8),d0 | get user pc
- subl a2@(8),d0 | pc -= pr->pr_off
- jlt Lauexit | less than 0, skip it
- movl a2@(12),d1 | get pr->pr_scale
- lsrl #1,d0 | pc /= 2
- lsrl #1,d1 | scale /= 2
- mulul d1,d0 | pc /= scale
- moveq #14,d1
- lsrl d1,d0 | pc >>= 14
- bclr #0,d0 | pc &= ~1
- cmpl a2@(4),d0 | too big for buffer?
- jge Lauexit | yes, screw it
- addl a2@,d0 | no, add base
- movl d0,sp@- | push address
- jbsr _fusword | grab old value
- movl sp@+,a0 | grab address back
- cmpl #-1,d0 | access ok
- jeq Lauerror | no, skip out
- addw sp@(18),d0 | add tick to current value
- movl d0,sp@- | push value
- movl a0,sp@- | push address
- jbsr _susword | write back new value
- addql #8,sp | pop params
- tstl d0 | fault?
- jeq Lauexit | no, all done
-Lauerror:
- clrl a2@(12) | clear scale (turn off prof)
-Lauexit:
- movl sp@+,a2 | restore scratch reg
- rts
-
-/*
- * non-local gotos
- */
-ENTRY(setjmp)
- movl sp@(4),a0 | savearea pointer
- moveml #0xFCFC,a0@ | save d2-d7/a2-a7
- movl sp@,a0@(48) | and return address
- moveq #0,d0 | return 0
- rts
-
-ENTRY(qsetjmp)
- movl sp@(4),a0 | savearea pointer
- lea a0@(40),a0 | skip regs we do not save
- movl a6,a0@+ | save FP
- movl sp,a0@+ | save SP
- movl sp@,a0@ | and return address
- moveq #0,d0 | return 0
- rts
-
-ENTRY(longjmp)
- movl sp@(4),a0
- moveml a0@+,#0xFCFC
- movl a0@,sp@
- moveq #1,d0
- rts
-
-/*
- * The following primitives manipulate the run queues.
- * _whichqs tells which of the 32 queues _qs
- * have processes in them. Setrunqueue puts processes into queues, Remrq
- * removes them from queues. The running process is on no queue,
- * other processes are on a queue related to p->p_priority, divided by 4
- * actually to shrink the 0-127 range of priorities into the 32 available
- * queues.
- */
-
- .globl _whichqs,_qs,_cnt,_panic
- .globl _curproc
- .comm _want_resched,4
-
-/*
- * Setrunqueue(p)
- *
- * Call should be made at spl6(), and p->p_stat should be SRUN
- */
-ENTRY(setrunqueue)
- movl sp@(4),a0
- tstl a0@(P_BACK)
- jeq Lset1
- movl #Lset2,sp@-
- jbsr _panic
-Lset1:
- clrl d0
- movb a0@(P_PRIORITY),d0
- lsrb #2,d0
- movl _whichqs,d1
- bset d0,d1
- movl d1,_whichqs
- lslb #3,d0
- addl #_qs,d0
- movl d0,a0@(P_FORW)
- movl d0,a1
- movl a1@(P_BACK),a0@(P_BACK)
- movl a0,a1@(P_BACK)
- movl a0@(P_BACK),a1
- movl a0,a1@(P_FORW)
- rts
-
-Lset2:
- .asciz "setrunqueue"
- .even
-
-/*
- * Remrq(p)
- *
- * Call should be made at spl6().
- */
-ENTRY(remrunqueue)
- movl sp@(4),a0
- clrl d0
- movb a0@(P_PRIORITY),d0
- lsrb #2,d0
- movl _whichqs,d1
- bclr d0,d1
- jne Lrem1
- movl #Lrem3,sp@-
- jbsr _panic
-Lrem1:
- movl d1,_whichqs
- movl a0@(P_FORW),a1
- movl a0@(P_BACK),a1@(P_BACK)
- movl a0@(P_BACK),a1
- movl a0@(P_FORW),a1@(P_FORW)
- movl #_qs,a1
- movl d0,d1
- lslb #3,d1
- addl d1,a1
- cmpl a1@(P_FORW),a1
- jeq Lrem2
- movl _whichqs,d1
- bset d0,d1
- movl d1,_whichqs
-Lrem2:
- clrl a0@(P_BACK)
- rts
-
-Lrem3:
- .asciz "remrunqueue"
-Lsw0:
- .asciz "cpu_switch"
- .even
-
- .globl _curpcb
- .globl _masterpaddr | XXX compatibility (debuggers)
- .data
-_masterpaddr: | XXX compatibility (debuggers)
-_curpcb:
- .long 0
-pcbflag:
- .byte 0 | copy of pcb_flags low byte
- .align 2
- .comm nullpcb,SIZEOF_PCB
- .text
-
-/*
- * At exit of a process, do a switch for the last time.
- * Switch to a safe stack and PCB, and deallocate the process's user area.
- */
-ENTRY(switch_exit)
- movl sp@(4),a0
- movl #nullpcb,_curpcb | save state into garbage pcb
- lea tmpstk,sp | goto a tmp stack
-
- /* Free old process's user area. */
- movl #USPACE,sp@- | size of u-area
- movl a0@(P_ADDR),sp@- | address of process's u-area
- movl _kernel_map,sp@- | map it was allocated in
- jbsr _kmem_free | deallocate it
- lea sp@(12),sp | pop args
-
- jra _cpu_switch
-
-/*
- * When no processes are on the runq, Swtch branches to idle
- * to wait for something to come ready.
- */
- .globl Idle
-Lidle:
- stop #PSL_LOWIPL
-Idle:
-idle:
- movw #PSL_HIGHIPL,sr
- tstl _whichqs
- jeq Lidle
- movw #PSL_LOWIPL,sr
- jra Lsw1
-
-Lbadsw:
- movl #Lsw0,sp@-
- jbsr _panic
- /*NOTREACHED*/
-
-/*
- * Cpu_switch()
- *
- * NOTE: On the mc68851 (318/319/330) we attempt to avoid flushing the
- * entire ATC. The effort involved in selective flushing may not be
- * worth it, maybe we should just flush the whole thing?
- *
- * NOTE 2: With the new VM layout we now no longer know if an inactive
- * user's PTEs have been changed (formerly denoted by the SPTECHG p_flag
- * bit). For now, we just always flush the full ATC.
- */
-ENTRY(cpu_switch)
- movl _curpcb,a0 | current pcb
- movw sr,a0@(PCB_PS) | save sr before changing ipl
-#ifdef notyet
- movl _curproc,sp@- | remember last proc running
-#endif
- clrl _curproc
-Lsw1:
- /*
- * Find the highest-priority queue that isn't empty,
- * then take the first proc from that queue.
- */
- clrl d0
- lea _whichqs,a0
- movl a0@,d1
-Lswchk:
- btst d0,d1
- jne Lswfnd
- addqb #1,d0
- cmpb #32,d0
- jne Lswchk
- jra idle
-Lswfnd:
- movw #PSL_HIGHIPL,sr | lock out interrupts
- movl a0@,d1 | and check again...
- bclr d0,d1
- jeq Lsw1 | proc moved, rescan
- movl d1,a0@ | update whichqs
- moveq #1,d1 | double check for higher priority
- lsll d0,d1 | process (which may have snuck in
- subql #1,d1 | while we were finding this one)
- andl a0@,d1
- jeq Lswok | no one got in, continue
- movl a0@,d1
- bset d0,d1 | otherwise put this one back
- movl d1,a0@
- jra Lsw1 | and rescan
-Lswok:
- movl d0,d1
- lslb #3,d1 | convert queue number to index
- addl #_qs,d1 | locate queue (q)
- movl d1,a1
- cmpl a1@(P_FORW),a1 | anyone on queue?
- jeq Lbadsw | no, panic
- movl a1@(P_FORW),a0 | p = q->p_forw
- movl a0@(P_FORW),a1@(P_FORW) | q->p_forw = p->p_forw
- movl a0@(P_FORW),a1 | q = p->p_forw
- movl a0@(P_BACK),a1@(P_BACK) | q->p_back = p->p_back
- cmpl a0@(P_FORW),d1 | anyone left on queue?
- jeq Lsw2 | no, skip
- movl _whichqs,d1
- bset d0,d1 | yes, reset bit
- movl d1,_whichqs
-Lsw2:
- movl a0,_curproc
- clrl _want_resched
-#ifdef notyet
- movl sp@+,a1
- cmpl a0,a1 | switching to same proc?
- jeq Lswdone | yes, skip save and restore
-#endif
-
- /*
- * Save state of previous process in its pcb.
- */
- movl _curpcb,a1
- moveml #0xFCFC,a1@(PCB_REGS) | save non-scratch registers
- movl usp,a2 | grab USP (a2 has been saved)
- movl a2,a1@(PCB_USP) | and save it
- movl _CMAP2,a1@(PCB_CMAP2) | save temporary map PTE
- tstl _fputype | do we have an FPU?
- jeq Lswnofpsave | no? don't attempt to save
- lea a1@(PCB_FPCTX),a2 | pointer to FP save area
- fsave a2@ | save FP state
- tstb a2@ | null state frame?
- jeq Lswnofpsave | yes, all done
- fmovem fp0-fp7,a2@(216) | save FP general registers
- fmovem fpcr/fpsr/fpi,a2@(312) | save FP control registers
-Lswnofpsave:
-
-#ifdef DIAGNOSTIC
- tstl a0@(P_WCHAN)
- jne Lbadsw
- cmpb #SRUN,a0@(P_STAT)
- jne Lbadsw
-#endif
- clrl a0@(P_BACK) | clear back link
- movl a0@(P_ADDR),a1 | get p_addr
- movl a1,_curpcb
- movb a1@(PCB_FLAGS+1),pcbflag | copy of pcb_flags low byte
-
- /* see if pmap_activate needs to be called; should remove this */
- movl a0@(P_VMSPACE),a0 | vmspace = p->p_vmspace
-#ifdef DIAGNOSTIC
- tstl a0 | map == VM_MAP_NULL?
- jeq Lbadsw | panic
-#endif
- lea a0@(VM_PMAP),a0 | pmap = &vmspace.vm_pmap
- tstl a0@(PM_STCHG) | pmap->st_changed?
- jeq Lswnochg | no, skip
- pea a1@ | push pcb (at p_addr)
- pea a0@ | push pmap
- jbsr _pmap_activate | pmap_activate(pmap, pcb)
- addql #8,sp
- movl _curpcb,a1 | restore p_addr
-Lswnochg:
- lea tmpstk,sp | now goto a tmp stack for NMI
- tstl _cpu040
- jne Lres2
- movl #CACHE_CLR,d0
- movc d0,cacr | invalidate cache(s)
- pflusha | flush entire TLB
- jra Lres3
-Lres2:
- .word 0xf518 | pflusha (68040)
- movl #CACHE40_ON,d0
- movc d0,cacr | invalidate cache(s)
-Lres3:
- movl a1@(PCB_USTP),d0 | get USTP
- moveq #PGSHIFT,d1
- lsll d1,d0 | convert to addr
- tstl _cpu040
- jne Lres4
- lea _protorp,a0 | CRP prototype
- movl d0,a0@(4) | stash USTP
- pmove a0@,crp | load new user root pointer
- jra Lres5
-Lres4:
- .word 0x4e7b,0x0806 | movc d0,URP
-Lres5:
- movl a1@(PCB_CMAP2),_CMAP2 | reload tmp map
- moveml a1@(PCB_REGS),#0xFCFC | and registers
- movl a1@(PCB_USP),a0
- movl a0,usp | and USP
- tstl _fputype | do we have an FPU?
- jeq Lnofprest | no, don't attempt to restore
- lea a1@(PCB_FPCTX),a0 | pointer to FP save area
- tstb a0@ | null state frame?
- jeq Lresfprest | yes, easy
- fmovem a0@(312),fpcr/fpsr/fpi | restore FP control registers
- fmovem a0@(216),fp0-fp7 | restore FP general registers
-Lresfprest:
- frestore a0@ | restore state
-
-Lnofprest:
- movw a1@(PCB_PS),sr | no, restore PS
- moveq #1,d0 | return 1 (for alternate returns)
- rts
-
-/*
- * savectx(pcb)
- * Update pcb, saving current processor state
- */
-ENTRY(savectx)
- movl sp@(4),a1
- movw sr,a1@(PCB_PS)
- movl usp,a0 | grab USP
- movl a0,a1@(PCB_USP) | and save it
- moveml #0xFCFC,a1@(PCB_REGS) | save non-scratch registers
- movl _CMAP2,a1@(PCB_CMAP2) | save temporary map PTE
- tstl _fputype | do we have an FPU?
- jeq Lsavedone | no, don't attempt to save
- lea a1@(PCB_FPCTX),a0 | pointer to FP save area
- fsave a0@ | save FP state
- tstb a0@ | null state frame?
- jeq Lsavedone | yes, all done
- fmovem fp0-fp7,a0@(216) | save FP general registers
- fmovem fpcr/fpsr/fpi,a0@(312) | save FP control registers
-Lsavedone:
- moveq #0,d0 | return 0
- rts
-
-/*
- * Copy 1 relocation unit (NBPG bytes)
- * from user virtual address to physical address
- */
-ENTRY(copyseg)
- movl _curpcb,a1 | current pcb
- movl #Lcpydone,a1@(PCB_ONFAULT) | where to return to on a fault
- movl sp@(8),d0 | destination page number
- moveq #PGSHIFT,d1
- lsll d1,d0 | convert to address
- orl #PG_CI+PG_RW+PG_V,d0 | make sure valid and writable
- movl _CMAP2,a0
- movl _CADDR2,sp@- | destination kernel VA
- movl d0,a0@ | load in page table
- jbsr _TBIS | invalidate any old mapping
- addql #4,sp
- movl _CADDR2,a1 | destination addr
- movl sp@(4),a0 | source addr
- movl #NBPG/4-1,d0 | count
-Lcpyloop:
- movsl a0@+,d1 | read longword
- movl d1,a1@+ | write longword
- dbf d0,Lcpyloop | continue until done
-Lcpydone:
- movl _curpcb,a1 | current pcb
- clrl a1@(PCB_ONFAULT) | clear error catch
- rts
-
-/*
- * Copy 1 relocation unit (NBPG bytes)
- * from physical address to physical address
- */
-ENTRY(physcopyseg)
- movl sp@(4),d0 | source page number
- moveq #PGSHIFT,d1
- lsll d1,d0 | convert to address
- orl #PG_CI+PG_RW+PG_V,d0 | make sure valid and writable
- movl _CMAP1,a0
- movl d0,a0@ | load in page table
- movl _CADDR1,sp@- | destination kernel VA
- jbsr _TBIS | invalidate any old mapping
- addql #4,sp
-
- movl sp@(8),d0 | destination page number
- moveq #PGSHIFT,d1
- lsll d1,d0 | convert to address
- orl #PG_CI+PG_RW+PG_V,d0 | make sure valid and writable
- movl _CMAP2,a0
- movl d0,a0@ | load in page table
- movl _CADDR2,sp@- | destination kernel VA
- jbsr _TBIS | invalidate any old mapping
- addql #4,sp
-
- movl _CADDR1,a0 | source addr
- movl _CADDR2,a1 | destination addr
- movl #NBPG/4-1,d0 | count
-Lpcpy:
- movl a0@+,a1@+ | copy longword
- dbf d0,Lpcpy | continue until done
- rts
-
-/*
- * zero out physical memory
- * specified in relocation units (NBPG bytes)
- */
-ENTRY(clearseg)
- movl sp@(4),d0 | destination page number
- moveq #PGSHIFT,d1
- lsll d1,d0 | convert to address
- orl #PG_CI+PG_RW+PG_V,d0 | make sure valid and writable
- movl _CMAP1,a0
- movl _CADDR1,sp@- | destination kernel VA
- movl d0,a0@ | load in page map
- jbsr _TBIS | invalidate any old mapping
- addql #4,sp
- movl _CADDR1,a1 | destination addr
- movl #NBPG/4-1,d0 | count
- /* simple clear loop is fastest on 68020 */
-Lclrloop:
- clrl a1@+ | clear a longword
- dbf d0,Lclrloop | continue til done
- rts
-
-/*
- * Invalidate entire TLB.
- */
-ENTRY(TBIA)
-__TBIA:
- tstl _cpu040
- jne Ltbia040
- pflusha | flush entire TLB
- tstl _mmutype
- jpl Lmc68851a | 68851 implies no d-cache
- movl #DC_CLEAR,d0
- movc d0,cacr | invalidate on-chip d-cache
-Lmc68851a:
- rts
-Ltbia040:
- .word 0xf518 | pflusha
- rts
-
-/*
- * Invalidate any TLB entry for given VA (TB Invalidate Single)
- */
-ENTRY(TBIS)
-#ifdef DEBUG
- tstl fulltflush | being conservative?
- jne __TBIA | yes, flush entire TLB
-#endif
- movl sp@(4),a0 | get addr to flush
- tstl _cpu040
- jne Ltbis040
- tstl _mmutype
- jpl Lmc68851b | is 68851?
- pflush #0,#0,a0@ | flush address from both sides
- movl #DC_CLEAR,d0
- movc d0,cacr | invalidate on-chip data cache
- rts
-Lmc68851b:
- pflushs #0,#0,a0@ | flush address from both sides
- rts
-Ltbis040:
- moveq #FC_SUPERD,d0 | select supervisor
- movc d0,dfc
- .word 0xf508 | pflush a0@
- moveq #FC_USERD,d0 | select user
- movc d0,dfc
- .word 0xf508 | pflush a0@
- rts
-
-/*
- * Invalidate supervisor side of TLB
- */
-ENTRY(TBIAS)
-#ifdef DEBUG
- tstl fulltflush | being conservative?
- jne __TBIA | yes, flush everything
-#endif
- tstl _cpu040
- jne Ltbias040
- tstl _mmutype
- jpl Lmc68851c | 68851?
- pflush #4,#4 | flush supervisor TLB entries
- movl #DC_CLEAR,d0
- movc d0,cacr | invalidate on-chip d-cache
- rts
-Lmc68851c:
- pflushs #4,#4 | flush supervisor TLB entries
- rts
-Ltbias040:
-/* 68040 can't specify supervisor/user on pflusha, so we flush all */
- .word 0xf518 | pflusha
- rts
-
-/*
- * Invalidate user side of TLB
- */
-ENTRY(TBIAU)
-#ifdef DEBUG
- tstl fulltflush | being conservative?
- jne __TBIA | yes, flush everything
-#endif
- tstl _cpu040
- jne Ltbiau040
- tstl _mmutype
- jpl Lmc68851d | 68851?
- pflush #0,#4 | flush user TLB entries
- movl #DC_CLEAR,d0
- movc d0,cacr | invalidate on-chip d-cache
- rts
-Lmc68851d:
- pflushs #0,#4 | flush user TLB entries
- rts
-Ltbiau040:
- /* 68040 can't specify supervisor/user on pflusha, so we flush all */
- .word 0xf518 | pflusha
- rts
-
-/*
- * Invalidate instruction cache
- */
-ENTRY(ICIA)
-ENTRY(ICPA)
-#if defined(M68030) || defined(M68020)
-#if defined(M68040)
- tstl _cpu040
- jne Licia040
-#endif
- movl #IC_CLEAR,d0
- movc d0,cacr | invalidate i-cache
- rts
-Licia040:
-#endif
-#if defined(M68040)
- .word 0xf498 | cinva ic
- rts
-#endif
-
-/*
- * Invalidate data cache.
- * NOTE: we do not flush 68030 on-chip cache as there are no aliasing
- * problems with DC_WA. The only cases we have to worry about are context
- * switch and TLB changes, both of which are handled "in-line" in resume
- * and TBI*.
- */
-ENTRY(DCIA)
-__DCIA:
- tstl _cpu040
- jeq Ldciax
- .word 0xf478 | cpusha dc
-Ldciax:
- rts
-
-ENTRY(DCIS)
-__DCIS:
- tstl _cpu040
- jeq Ldcisx
- .word 0xf478 | cpusha dc
- nop
-Ldcisx:
- rts
-
-ENTRY(DCIU)
-__DCIU:
- tstl _cpu040
- jeq Ldciux
- .word 0xf478 | cpusha dc
-Ldciux:
- rts
-
-/* Invalid single cache line */
-ENTRY(DCIAS)
-__DCIAS:
- tstl _cpu040
- jeq Ldciasx
- movl sp@(4),a0
- .word 0xf468 | cpushl dc,a0@
-Ldciasx:
- rts
-#ifdef M68040
-ENTRY(ICPL) /* invalidate instruction physical cache line */
- movl sp@(4),a0 | address
- .word 0xf488 | cinvl ic,a0@
- rts
-ENTRY(ICPP) /* invalidate instruction physical cache page */
- movl sp@(4),a0 | address
- .word 0xf490 | cinvp ic,a0@
- rts
-ENTRY(DCPL) /* invalidate data physical cache line */
- movl sp@(4),a0 | address
- .word 0xf448 | cinvl dc,a0@
- rts
-ENTRY(DCPP) /* invalidate data physical cache page */
- movl sp@(4),a0 | address
- .word 0xf450 | cinvp dc,a0@
- rts
-ENTRY(DCPA) /* invalidate data physical all */
- .word 0xf458 | cinva dc
- rts
-ENTRY(DCFL) /* data cache flush line */
- movl sp@(4),a0 | address
- .word 0xf468 | cpushl dc,a0@
- rts
-ENTRY(DCFP) /* data cache flush page */
- movl sp@(4),a0 | address
- .word 0xf470 | cpushp dc,a0@
- rts
-#endif /* M68040 */
-
-ENTRY(PCIA)
-#if defined(M68030) || defined(M68030)
-#if defined(M68040)
- tstl _cpu040
- jne Lpcia040
-#endif
- movl #DC_CLEAR,d0
- movc d0,cacr | invalidate on-chip d-cache
- rts
-#endif
-#if defined(M68040)
-ENTRY(DCFA)
-Lpcia040:
- .word 0xf478 | cpusha dc
- rts
-#endif
-
-ENTRY(ecacheon)
- rts
-
-ENTRY(ecacheoff)
- rts
-
-/*
- * Get callers current SP value.
- * Note that simply taking the address of a local variable in a C function
- * doesn't work because callee saved registers may be outside the stack frame
- * defined by A6 (e.g. GCC generated code).
- */
- .globl _getsp
-_getsp:
- movl sp,d0 | get current SP
- addql #4,d0 | compensate for return address
- rts
-
- .globl _getsfc, _getdfc
-_getsfc:
- movc sfc,d0
- rts
-_getdfc:
- movc dfc,d0
- rts
-
-/*
- * Check out a virtual address to see if it's okay to write to.
- *
- * probeva(va, fc)
- *
- */
-ENTRY(probeva)
- movl sp@(8),d0
- movec d0,dfc
- movl sp@(4),a0
- .word 0xf548 | ptestw (a0)
- moveq #FC_USERD,d0 | restore DFC to user space
- movc d0,dfc
- .word 0x4e7a,0x0805 | movec MMUSR,d0
- rts
-
-/*
- * Load a new user segment table pointer.
- */
-ENTRY(loadustp)
- movl sp@(4),d0 | new USTP
- moveq #PGSHIFT,d1
- lsll d1,d0 | convert to addr
- tstl _cpu040
- jne Lldustp040
- lea _protorp,a0 | CRP prototype
- movl d0,a0@(4) | stash USTP
- pmove a0@,crp | load root pointer
- movl #DC_CLEAR,d0
- movc d0,cacr | invalidate on-chip d-cache
- rts | since pmove flushes TLB
-Lldustp040:
- .word 0x4e7b,0x0806 | movec d0,URP
- rts
-
-/*
- * Flush any hardware context associated with given USTP.
- * Only does something for HP330 where we must flush RPT
- * and ATC entries in PMMU.
- */
-ENTRY(flushustp)
- tstl _cpu040
- jne Lnot68851
- tstl _mmutype | 68851 PMMU?
- jle Lnot68851 | no, nothing to do
- movl sp@(4),d0 | get USTP to flush
- moveq #PGSHIFT,d1
- lsll d1,d0 | convert to address
- movl d0,_protorp+4 | stash USTP
- pflushr _protorp | flush RPT/TLB entries
-Lnot68851:
- rts
-
-ENTRY(ploadw)
- movl sp@(4),a0 | address to load
- tstl _cpu040
- jne Lploadw040
- ploadw #1,a0@ | pre-load translation
-Lploadw040: | should 68040 do a ptest?
- rts
-
-/*
- * Set processor priority level calls. Most are implemented with
- * inline asm expansions. However, spl0 requires special handling
- * as we need to check for our emulated software interrupts.
- */
-
-ENTRY(spl0)
- moveq #0,d0
- movw sr,d0 | get old SR for return
- movw #PSL_LOWIPL,sr | restore new SR
- tstb _ssir | software interrupt pending?
- jeq Lspldone | no, all done
- subql #4,sp | make room for RTE frame
- movl sp@(4),sp@(2) | position return address
- clrw sp@(6) | set frame type 0
- movw #PSL_LOWIPL,sp@ | and new SR
- jra Lgotsir | go handle it
-Lspldone:
- rts
-
-ENTRY(_insque)
- movw sr,d0
- movw #PSL_HIGHIPL,sr | atomic
- movl sp@(8),a0 | where to insert (after)
- movl sp@(4),a1 | element to insert (e)
- movl a0@,a1@ | e->next = after->next
- movl a0,a1@(4) | e->prev = after
- movl a1,a0@ | after->next = e
- movl a1@,a0
- movl a1,a0@(4) | e->next->prev = e
- movw d0,sr
- rts
-
-ENTRY(_remque)
- movw sr,d0
- movw #PSL_HIGHIPL,sr | atomic
- movl sp@(4),a0 | element to remove (e)
- movl a0@,a1
- movl a0@(4),a0
- movl a0,a1@(4) | e->next->prev = e->prev
- movl a1,a0@ | e->prev->next = e->next
- movw d0,sr
- rts
-
-/*
- * Save and restore 68881 state.
- * Pretty awful looking since our assembler does not
- * recognize FP mnemonics.
- */
-ENTRY(m68881_save)
- movl sp@(4),a0 | save area pointer
- fsave a0@ | save state
- tstb a0@ | null state frame?
- jeq Lm68881sdone | yes, all done
- fmovem fp0-fp7,a0@(216) | save FP general registers
- fmovem fpcr/fpsr/fpi,a0@(312) | save FP control registers
-Lm68881sdone:
- rts
-
-ENTRY(m68881_restore)
- movl sp@(4),a0 | save area pointer
- tstb a0@ | null state frame?
- jeq Lm68881rdone | yes, easy
- fmovem a0@(312),fpcr/fpsr/fpi | restore FP control registers
- fmovem a0@(216),fp0-fp7 | restore FP general registers
-Lm68881rdone:
- frestore a0@ | restore state
- rts
-
-/*
- * Handle the nitty-gritty of rebooting the machine.
- *
- */
- .globl _doboot
-_doboot:
- movl #CACHE_OFF,d0
- movl _cpu040,d1 | load 68040 flag
- jeq Ldoboot0
- .word 0xf4f8 | cpusha bc - push and inval caches
- nop
- movl #CACHE40_OFF,d0
-Ldoboot0:
- movc d0,cacr | disable on-chip cache(s)
-
- movw #0x2700,sr | cut off any interrupts
-
- /*
- * Clear first 2k of ST-memory. We start clearing at address 0x8
- * because the lower 8 bytes are mapped to ROM.
- * This makes sure that the machine will 'cold-boot'.
- */
- movl _page_zero,a0
- addl #0x8,a0
- movl #512,d0
-Ldb1:
- clrl a0@+
- dbra d0,Ldb1
-
- lea Ldoreboot,a1 | a1 = start of copy range
- lea Ldorebootend,a2 | a2 = end of copy range
- movl _page_zero,a0 | a0 = virtual base for page zero
- addl a1,a0 | + offset of Ldoreboot
-Ldb2: | Do the copy
- movel a1@+,a0@+
- cmpl a1,a2
- jle Ldb2
-
- /*
- * Ok, turn off MMU..
- */
-Ldoreboot:
- tstl d1 | We saved cpu040 here
- jne Lmmuoff040 | Go turn off 68040 MMU
- lea zero,a0
- pmove a0@,tc | Turn off MMU
- lea nullrp,a0
- pmove a0@,crp | Invalidate Cpu root pointer
- pmove a0@,srp | and the Supervisor root pointer
- jra Ldoboot1 | Ok, continue with actual reboot
-Lmmuoff040:
- movl #0,d0
- .word 0x4e7b,0x0003 | movc d0,TC
- .word 0x4e7b,0x0806 | movc d0,URP
- .word 0x4e7b,0x0807 | movc d0,SRP
-Ldoboot1:
- movl 0x4,a0 | fetch reset-vector
- jmp a0@ | jump through it
- /* NOT REACHED */
-
-/* A do-nothing MMU root pointer (includes the following long as well) */
-
-nullrp: .long 0x7fff0001
-zero: .long 0
-Ldorebootend:
-
- .data
- .space NBPG
-tmpstk:
- .globl _mmutype,_protorp
-_protorp:
- .long 0x80000002,0 | prototype root pointer
- .globl _cold
-_cold:
- .long 1 | cold start flag
- .globl _proc0paddr
-_proc0paddr:
- .long 0 | KVA of proc0 u-area
-#ifdef DEBUG
- .globl fulltflush, fullcflush
-fulltflush:
- .long 0
-fullcflush:
- .long 0
- .globl timebomb
-timebomb:
- .long 0
-#endif
-/* interrupt counters */
- .globl _intrcnt,_eintrcnt,_intrnames,_eintrnames
-_intrnames:
- .asciz "spur"
- .asciz "clock"
- .asciz "kbd/mouse"
- .asciz "fdc/acsi"
- .asciz "soft"
- .asciz "5380-SCSI"
- .asciz "5380-DMA"
- .asciz "nmi"
- .asciz "8530-SCC"
- .asciz "statclock"
-_eintrnames:
- .even
-_intrcnt:
- .long 0,0,0,0,0,0,0,0,0,0
-_eintrcnt:
diff --git a/sys/arch/atari/atari/machdep.c b/sys/arch/atari/atari/machdep.c
deleted file mode 100644
index 16a72e1638d..00000000000
--- a/sys/arch/atari/atari/machdep.c
+++ /dev/null
@@ -1,1429 +0,0 @@
-/* $NetBSD: machdep.c,v 1.18 1996/01/04 22:21:47 jtc Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: machdep.c 1.63 91/04/24$
- *
- * @(#)machdep.c 7.16 (Berkeley) 6/3/91
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/signalvar.h>
-#include <sys/kernel.h>
-#include <sys/map.h>
-#include <sys/proc.h>
-#include <sys/buf.h>
-#include <sys/reboot.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/clist.h>
-#include <sys/timeout.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/msgbuf.h>
-#include <sys/user.h>
-#include <sys/exec.h> /* for PS_STRINGS */
-#include <sys/vnode.h>
-#include <sys/queue.h>
-#include <sys/sysctl.h>
-#include <sys/mount.h>
-#include <sys/syscallargs.h>
-#ifdef SYSVSHM
-#include <sys/shm.h>
-#endif
-#ifdef SYSVMSG
-#include <sys/msg.h>
-#endif
-#ifdef SYSVSEM
-#include <sys/sem.h>
-#endif
-#include <net/netisr.h>
-#define MAXMEM 64*1024*CLSIZE /* XXX - from cmap.h */
-#include <vm/vm_param.h>
-#include <vm/pmap.h>
-#include <vm/vm_map.h>
-#include <vm/vm_object.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-#include <machine/cpu.h>
-#include <machine/reg.h>
-#include <machine/psl.h>
-#include <machine/pte.h>
-#include <machine/iomap.h>
-#include <dev/cons.h>
-
-#include "ether.h"
-#include "ppp.h"
-#include "bridge.h"
-
-static void call_sicallbacks __P((void));
-static void alloc_sicallback __P((void));
-
-extern vm_offset_t avail_end;
-
-/*
- * Declare these as initialized data so we can patch them.
- */
-#ifdef BUFPAGES
-int bufpages = BUFPAGES;
-#else
-int bufpages = 0;
-#endif
-int msgbufmapped; /* set when safe to use msgbuf */
-int physmem = MAXMEM; /* max supported memory, changes to actual */
-/*
- * safepri is a safe priority for sleep to set for a spin-wait
- * during autoconfiguration or after a panic.
- */
-int safepri = PSL_LOWIPL;
-extern int freebufspace;
-extern u_int lowram;
-
-#ifdef COMPAT_SUNOS
-extern struct emul emul_sunos;
-#endif
-
-/*
- * For the fpu emulation and the fpu driver
- */
-int fputype = 0;
-
-/* the following is used externally (sysctl_hw) */
-char machine[] = "atari";
-
- /*
- * Console initialization: called early on from main,
- * before vm init or startup. Do enough configuration
- * to choose and initialize a console.
- */
-void
-consinit()
-{
- /*
- * Initialize the console before we print anything out.
- */
- cninit();
-
-#if defined (DDB)
- ddb_init();
- if(boothowto & RB_KDB)
- Debugger();
-#endif
-}
-
-/*
- * cpu_startup: allocate memory for variable-sized tables,
- * initialize cpu, and do autoconfiguration.
- */
-void
-cpu_startup()
-{
- extern long Usrptsize;
- extern u_long boot_ttphysize, boot_stphysize;
- extern struct map *useriomap;
- register unsigned i;
- register caddr_t v, firstaddr;
- int base, residual;
-
-#ifdef DEBUG
- extern int pmapdebug;
- int opmapdebug = pmapdebug;
-#endif
- vm_offset_t minaddr, maxaddr;
- vm_size_t size;
-
- /*
- * Initialize error message buffer (at end of core).
- */
-#ifdef DEBUG
- pmapdebug = 0;
-#endif
- /* avail_end was pre-decremented in pmap_bootstrap to compensate */
- for(i = 0; i < btoc(sizeof (struct msgbuf)); i++)
- pmap_enter(pmap_kernel(), (vm_offset_t)msgbufp,
- avail_end + i * NBPG, VM_PROT_ALL, TRUE);
- msgbufmapped = 1;
-
- /*
- * Good {morning,afternoon,evening,night}.
- */
- printf(version);
- identifycpu();
-
- i = boot_ttphysize + boot_stphysize;
- printf("real mem = %d (%d pages)\n", i, i/NBPG);
-
- /*
- * Allocate space for system data structures.
- * The first available real memory address is in "firstaddr".
- * The first available kernel virtual address is in "v".
- * As pages of kernel virtual memory are allocated, "v" is incremented.
- * As pages of memory are allocated and cleared,
- * "firstaddr" is incremented.
- * An index into the kernel page table corresponding to the
- * virtual memory address maintained in "v" is kept in "mapaddr".
- */
- /*
- * Make two passes. The first pass calculates how much memory is
- * needed and allocates it. The second pass assigns virtual
- * addresses to the various data structures.
- */
- firstaddr = 0;
-again:
- v = (caddr_t)firstaddr;
-
-#define valloc(name, type, num) \
- (name) = (type *)v; v = (caddr_t)((name)+(num))
-#define valloclim(name, type, num, lim) \
- (name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num)))
-/* valloc(cfree, struct cblock, nclist); */
- valloc(timeouts, struct timeout, ntimeout);
-#ifdef SYSVSHM
- valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
-#endif
-#ifdef SYSVSEM
- valloc(sema, struct semid_ds, seminfo.semmni);
- valloc(sem, struct sem, seminfo.semmns);
- /* This is pretty disgusting! */
- valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
-#endif
-#ifdef SYSVMSG
- valloc(msgpool, char, msginfo.msgmax);
- valloc(msgmaps, struct msgmap, msginfo.msgseg);
- valloc(msghdrs, struct msg, msginfo.msgtql);
- valloc(msqids, struct msqid_ds, msginfo.msgmni);
-#endif
- /*
- * Determine how many buffers to allocate. We allocate
- * the BSD standard of use 10% of memory for the first 2 Meg,
- * 5% of remaining. Insure a minimum of 16 buffers.
- * We allocate 3/4 as many swap buffer headers as file i/o buffers.
- */
- if (bufpages == 0)
- if (physmem < btoc(2 * 1024 * 1024))
- bufpages = physmem / (10 * CLSIZE);
- else
- bufpages = (btoc(2 * 1024 * 1024) + physmem) /
- (20 * CLSIZE);
-
- if (nbuf == 0) {
- nbuf = bufpages;
- if (nbuf < 16)
- nbuf = 16;
- }
-
- if (nswbuf == 0) {
- nswbuf = (nbuf * 3 / 4) &~ 1; /* force even */
- if (nswbuf > 256)
- nswbuf = 256; /* sanity */
- }
- valloc(swbuf, struct buf, nswbuf);
- valloc(buf, struct buf, nbuf);
- /*
- * End of first pass, size has been calculated so allocate memory
- */
- if (firstaddr == 0) {
- size = (vm_size_t)(v - firstaddr);
- firstaddr = (caddr_t) kmem_alloc(kernel_map, round_page(size));
- if (firstaddr == 0)
- panic("startup: no room for tables");
- goto again;
- }
- /*
- * End of second pass, addresses have been assigned
- */
- if ((vm_size_t)(v - firstaddr) != size)
- panic("startup: table size inconsistency");
-
- /*
- * Now allocate buffers proper. They are different than the above
- * in that they usually occupy more virtual memory than physical.
- */
- size = MAXBSIZE * nbuf;
- buffer_map = kmem_suballoc(kernel_map, (vm_offset_t *)&buffers,
- &maxaddr, size, TRUE);
- minaddr = (vm_offset_t)buffers;
- if (vm_map_find(buffer_map, vm_object_allocate(size), (vm_offset_t)0,
- &minaddr, size, FALSE) != KERN_SUCCESS)
- panic("startup: cannot allocate buffers");
- if ((bufpages / nbuf) >= btoc(MAXBSIZE)) {
- /* don't want to alloc more physical mem than needed */
- bufpages = btoc(MAXBSIZE) * nbuf;
- }
- base = bufpages / nbuf;
- residual = bufpages % nbuf;
- for (i = 0; i < nbuf; i++) {
- vm_size_t curbufsize;
- vm_offset_t curbuf;
-
- /*
- * First <residual> buffers get (base+1) physical pages
- * allocated for them. The rest get (base) physical pages.
- *
- * The rest of each buffer occupies virtual space,
- * but has no physical memory allocated for it.
- */
- curbuf = (vm_offset_t)buffers + i * MAXBSIZE;
- curbufsize = CLBYTES * (i < residual ? base+1 : base);
- vm_map_pageable(buffer_map, curbuf, curbuf+curbufsize, FALSE);
- vm_map_simplify(buffer_map, curbuf);
- }
-
- /*
- * Allocate a submap for exec arguments. This map effectively
- * limits the number of processes exec'ing at any time.
- */
- exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr, 16*NCARGS, TRUE);
-
- /*
- * Allocate a submap for physio
- */
- phys_map = kmem_suballoc(kernel_map,&minaddr,&maxaddr,VM_PHYS_SIZE,TRUE);
-
- /*
- * Finally, allocate mbuf pool. Since mclrefcnt is an off-size
- * we use the more space efficient malloc in place of kmem_alloc.
- */
- mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES,
- M_MBUF, M_NOWAIT);
- bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES);
- mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
- VM_MBUF_SIZE, FALSE);
-
- /*
- * Initialize timeouts
- */
- timeout_init();
-
-#ifdef DEBUG
- pmapdebug = opmapdebug;
-#endif
- printf("avail mem = %d (%d pages)\n", ptoa(cnt.v_free_count),
- ptoa(cnt.v_free_count)/NBPG);
- printf("using %d buffers containing %d bytes of memory\n",
- nbuf, bufpages * CLBYTES);
-
- /*
- * Set up CPU-specific registers, cache, etc.
- */
- initcpu();
-
- /*
- * Set up buffers, so they can be used to read disk labels.
- */
- bufinit();
-
- /*
- * Configure the system.
- */
- if (boothowto & RB_CONFIG) {
-#ifdef BOOT_CONFIG
- user_config();
-#else
- printf("kernel does not support -c; continuing..\n");
-#endif
- }
- configure();
-}
-
-/*
- * Set registers on exec.
- */
-void
-setregs(p, pack, stack, retval)
- register struct proc *p;
- struct exec_package *pack;
- u_long stack;
- register_t *retval;
-{
- struct frame *frame = (struct frame *)p->p_md.md_regs;
-
- frame->f_sr = PSL_USERSET;
- frame->f_pc = pack->ep_entry & ~1;
- frame->f_regs[D0] = 0;
- frame->f_regs[D1] = 0;
- frame->f_regs[D2] = 0;
- frame->f_regs[D3] = 0;
- frame->f_regs[D4] = 0;
- frame->f_regs[D5] = 0;
- frame->f_regs[D6] = 0;
- frame->f_regs[D7] = 0;
- frame->f_regs[A0] = 0;
- frame->f_regs[A1] = 0;
- frame->f_regs[A2] = (int)PS_STRINGS;
- frame->f_regs[A3] = 0;
- frame->f_regs[A4] = 0;
- frame->f_regs[A5] = 0;
- frame->f_regs[A6] = 0;
- frame->f_regs[SP] = stack;
-
- /* restore a null state frame */
- p->p_addr->u_pcb.pcb_fpregs.fpf_null = 0;
-
- if (fputype)
- m68881_restore(&p->p_addr->u_pcb.pcb_fpregs);
-
-#ifdef COMPAT_SUNOS
- /*
- * SunOS' ld.so does self-modifying code without knowing
- * about the 040's cache purging needs. So we need to uncache
- * writeable executable pages.
- */
- if (p->p_emul == &emul_sunos)
- p->p_md.md_flags |= MDP_UNCACHE_WX;
- else
- p->p_md.md_flags &= ~MDP_UNCACHE_WX;
-#endif
-}
-
-/*
- * Info for CTL_HW
- */
-char cpu_model[120];
-extern char version[];
-
-identifycpu()
-{
- extern char *fpu_describe();
- extern int fpu_probe();
- char *mach, *mmu, *fpu, *cpu;
-
- if (machineid & ATARI_TT)
- mach = "Atari TT";
- else if (machineid & ATARI_FALCON)
- mach = "Atari Falcon";
- else mach = "Atari UNKNOWN";
-
- cpu = "m68k";
- fputype = fpu_probe();
- fpu = fpu_describe(fputype);
-
- if (machineid & ATARI_68040) {
- cpu = "m68040";
- mmu = "/MMU";
- } else if (machineid & ATARI_68030) {
- cpu = "m68030";
- mmu = "/MMU";
- } else {
- cpu = "m68020";
- mmu = " m68851 MMU";
- }
- sprintf(cpu_model, "%s (%s CPU%s%s FPU)", mach, cpu, mmu, fpu);
- printf("%s\n", cpu_model);
-}
-
-/*
- * machine dependent system variables.
- */
-cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
- int *name;
- u_int namelen;
- void *oldp;
- size_t *oldlenp;
- void *newp;
- size_t newlen;
- struct proc *p;
-{
- dev_t consdev;
-
- /* all sysctl names at this level are terminal */
- if (namelen != 1)
- return(ENOTDIR); /* overloaded */
-
- switch (name[0]) {
- case CPU_CONSDEV:
- if (cn_tab != NULL)
- consdev = cn_tab->cn_dev;
- else
- consdev = NODEV;
- return(sysctl_rdstruct(oldp, oldlenp, newp, &consdev, sizeof(consdev)));
- default:
- return(EOPNOTSUPP);
- }
- /* NOTREACHED */
-}
-
-#define SS_RTEFRAME 1
-#define SS_FPSTATE 2
-#define SS_USERREGS 4
-
-struct sigstate {
- int ss_flags; /* which of the following are valid */
- struct frame ss_frame; /* original exception frame */
- struct fpframe ss_fpstate; /* 68881/68882 state info */
-};
-
-/*
- * WARNING: code in locore.s assumes the layout shown for sf_signum
- * thru sf_handler so... don't screw with them!
- */
-struct sigframe {
- int sf_signum; /* signo for handler */
- int sf_code; /* additional info for handler */
- struct sigcontext *sf_scp; /* context ptr for handler */
- sig_t sf_handler; /* handler addr for u_sigc */
- struct sigstate sf_state; /* state of the hardware */
- struct sigcontext sf_sc; /* actual context */
-};
-
-#ifdef DEBUG
-int sigdebug = 0x0;
-int sigpid = 0;
-#define SDB_FOLLOW 0x01
-#define SDB_KSTACK 0x02
-#define SDB_FPSTATE 0x04
-#endif
-
-/*
- * Send an interrupt to process.
- */
-void
-sendsig(catcher, sig, mask, code)
- sig_t catcher;
- int sig, mask;
- u_long code;
-{
- register struct proc *p = curproc;
- register struct sigframe *fp, *kfp;
- register struct frame *frame;
- register struct sigacts *psp = p->p_sigacts;
- register short ft;
- int oonstack;
- extern short exframesize[];
- extern char sigcode[], esigcode[];
-
-
-/*printf("sendsig %d %d %x %x %x\n", p->p_pid, sig, mask, code, catcher);*/
-
- frame = (struct frame *)p->p_md.md_regs;
- ft = frame->f_format;
- oonstack = psp->ps_sigstk.ss_flags & SS_ONSTACK;
-
- /*
- * Allocate and validate space for the signal handler
- * context. Note that if the stack is in P0 space, the
- * call to grow() is a nop, and the useracc() check
- * will fail if the process has not already allocated
- * the space with a `brk'.
- */
- if ((psp->ps_flags & SAS_ALTSTACK) && oonstack == 0 &&
- (psp->ps_sigonstack & sigmask(sig))) {
- fp = (struct sigframe *)(psp->ps_sigstk.ss_sp +
- psp->ps_sigstk.ss_size - sizeof(struct sigframe));
- psp->ps_sigstk.ss_flags |= SS_ONSTACK;
- } else
- fp = (struct sigframe *)frame->f_regs[SP] - 1;
- if ((unsigned)fp <= USRSTACK - ctob(p->p_vmspace->vm_ssize))
- (void)grow(p, (unsigned)fp);
-#ifdef DEBUG
- if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
- printf("sendsig(%d): sig %d ssp %x usp %x scp %x ft %d\n",
- p->p_pid, sig, &oonstack, fp, &fp->sf_sc, ft);
-#endif
- if (useracc((caddr_t)fp, sizeof(struct sigframe), B_WRITE) == 0) {
-#ifdef DEBUG
- if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
- printf("sendsig(%d): useracc failed on sig %d\n",
- p->p_pid, sig);
-#endif
- /*
- * Process has trashed its stack; give it an illegal
- * instruction to halt it in its tracks.
- */
- SIGACTION(p, SIGILL) = SIG_DFL;
- sig = sigmask(SIGILL);
- p->p_sigignore &= ~sig;
- p->p_sigcatch &= ~sig;
- p->p_sigmask &= ~sig;
- psignal(p, SIGILL);
- return;
- }
- kfp = malloc(sizeof(struct sigframe), M_TEMP, M_WAITOK);
- /*
- * Build the argument list for the signal handler.
- */
- kfp->sf_signum = sig;
- kfp->sf_code = code;
- kfp->sf_scp = &fp->sf_sc;
- kfp->sf_handler = catcher;
- /*
- * Save necessary hardware state. Currently this includes:
- * - general registers
- * - original exception frame (if not a "normal" frame)
- * - FP coprocessor state
- */
- kfp->sf_state.ss_flags = SS_USERREGS;
- bcopy((caddr_t)frame->f_regs,
- (caddr_t)kfp->sf_state.ss_frame.f_regs, sizeof frame->f_regs);
- if (ft >= FMT9) {
-#ifdef DEBUG
- if (ft != FMT9 && ft != FMTA && ft != FMTB)
- panic("sendsig: bogus frame type");
-#endif
- kfp->sf_state.ss_flags |= SS_RTEFRAME;
- kfp->sf_state.ss_frame.f_format = frame->f_format;
- kfp->sf_state.ss_frame.f_vector = frame->f_vector;
- bcopy((caddr_t)&frame->F_u,
- (caddr_t)&kfp->sf_state.ss_frame.F_u, exframesize[ft]);
- /*
- * Leave an indicator that we need to clean up the kernel
- * stack. We do this by setting the "pad word" above the
- * hardware stack frame to the amount the stack must be
- * adjusted by.
- *
- * N.B. we increment rather than just set f_stackadj in
- * case we are called from syscall when processing a
- * sigreturn. In that case, f_stackadj may be non-zero.
- */
- frame->f_stackadj += exframesize[ft];
- frame->f_format = frame->f_vector = 0;
-#ifdef DEBUG
- if (sigdebug & SDB_FOLLOW)
- printf("sendsig(%d): copy out %d of frame %d\n",
- p->p_pid, exframesize[ft], ft);
-#endif
- }
- if(fputype) {
- kfp->sf_state.ss_flags |= SS_FPSTATE;
- m68881_save(&kfp->sf_state.ss_fpstate);
- }
-#ifdef DEBUG
- if ((sigdebug & SDB_FPSTATE) && *(char *)&kfp->sf_state.ss_fpstate)
- printf("sendsig(%d): copy out FP state (%x) to %x\n",
- p->p_pid, *(u_int *)&kfp->sf_state.ss_fpstate,
- &kfp->sf_state.ss_fpstate);
-#endif
- /*
- * Build the signal context to be used by sigreturn.
- */
- kfp->sf_sc.sc_onstack = oonstack;
- kfp->sf_sc.sc_mask = mask;
- kfp->sf_sc.sc_sp = frame->f_regs[SP];
- kfp->sf_sc.sc_fp = frame->f_regs[A6];
- kfp->sf_sc.sc_ap = (int)&fp->sf_state;
- kfp->sf_sc.sc_pc = frame->f_pc;
- kfp->sf_sc.sc_ps = frame->f_sr;
- (void) copyout((caddr_t)kfp, (caddr_t)fp, sizeof(struct sigframe));
- frame->f_regs[SP] = (int)fp;
-#ifdef DEBUG
- if (sigdebug & SDB_FOLLOW)
- printf("sendsig(%d): sig %d scp %x fp %x sc_sp %x sc_ap %x\n",
- p->p_pid, sig, kfp->sf_scp, fp,
- kfp->sf_sc.sc_sp, kfp->sf_sc.sc_ap);
-#endif
- /*
- * Signal trampoline code is at base of user stack.
- */
- frame->f_pc = (int)(((char *)PS_STRINGS) - (esigcode - sigcode));
-#ifdef DEBUG
- if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
- printf("sendsig(%d): sig %d returns\n",
- p->p_pid, sig);
-#endif
- free((caddr_t)kfp, M_TEMP);
-}
-
-
-/*
- * System call to cleanup state after a signal
- * has been taken. Reset signal mask and
- * stack state from context left by sendsig (above).
- * Return to previous pc and psl as specified by
- * context left by sendsig. Check carefully to
- * make sure that the user has not modified the
- * psl to gain improper priviledges or to cause
- * a machine fault.
- */
-/* ARGSUSED */
-int
-sys_sigreturn(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct sys_sigreturn_args /* {
- syscallarg(struct sigcontext *)sigcntxp;
- } */ *uap = v;
- struct sigcontext *scp, context;
- struct frame *frame;
- int rf, flags;
- struct sigstate tstate;
- extern short exframesize[];
-
- scp = SCARG(uap, sigcntxp);
-#ifdef DEBUG
- if (sigdebug & SDB_FOLLOW)
- printf("sigreturn: pid %d, scp %x\n", p->p_pid, scp);
-#endif
- if ((int)scp & 1)
- return(EINVAL);
- /*
- * Test and fetch the context structure.
- * We grab it all at once for speed.
- */
- if (useracc((caddr_t)scp, sizeof(*scp), B_WRITE) == 0 ||
- copyin(scp, &context, sizeof(context)))
- return(EINVAL);
- scp = &context;
- if ((scp->sc_ps & (PSL_MBZ|PSL_IPL|PSL_S)) != 0)
- return(EINVAL);
- /*
- * Restore the user supplied information
- */
- if (scp->sc_onstack & 1)
- p->p_sigacts->ps_sigstk.ss_flags |= SS_ONSTACK;
- else
- p->p_sigacts->ps_sigstk.ss_flags &= ~SS_ONSTACK;
- p->p_sigmask = scp->sc_mask &~ sigcantmask;
- frame = (struct frame *) p->p_md.md_regs;
- frame->f_regs[SP] = scp->sc_sp;
- frame->f_regs[A6] = scp->sc_fp;
- frame->f_pc = scp->sc_pc;
- frame->f_sr = scp->sc_ps;
- /*
- * Grab pointer to hardware state information.
- * If zero, the user is probably doing a longjmp.
- */
- if ((rf = scp->sc_ap) == 0)
- return (EJUSTRETURN);
- /*
- * See if there is anything to do before we go to the
- * expense of copying in close to 1/2K of data
- */
- flags = fuword((caddr_t)rf);
-#ifdef DEBUG
- if (sigdebug & SDB_FOLLOW)
- printf("sigreturn(%d): sc_ap %x flags %x\n",
- p->p_pid, rf, flags);
-#endif
- /*
- * fuword failed (bogus sc_ap value).
- */
- if (flags == -1)
- return (EINVAL);
- if (flags == 0 || copyin((caddr_t)rf, (caddr_t)&tstate, sizeof tstate))
- return (EJUSTRETURN);
-#ifdef DEBUG
- if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
- printf("sigreturn(%d): ssp %x usp %x scp %x ft %d\n",
- p->p_pid, &flags, scp->sc_sp, SCARG(uap,sigcntxp),
- (flags&SS_RTEFRAME) ? tstate.ss_frame.f_format : -1);
-#endif
- /*
- * Restore most of the users registers except for A6 and SP
- * which were handled above.
- */
- if (flags & SS_USERREGS)
- bcopy((caddr_t)tstate.ss_frame.f_regs,
- (caddr_t)frame->f_regs, sizeof(frame->f_regs)-2*NBPW);
- /*
- * Restore long stack frames. Note that we do not copy
- * back the saved SR or PC, they were picked up above from
- * the sigcontext structure.
- */
- if (flags & SS_RTEFRAME) {
- register int sz;
-
- /* grab frame type and validate */
- sz = tstate.ss_frame.f_format;
- if (sz > 15 || (sz = exframesize[sz]) < 0)
- return (EINVAL);
- frame->f_stackadj -= sz;
- frame->f_format = tstate.ss_frame.f_format;
- frame->f_vector = tstate.ss_frame.f_vector;
- bcopy((caddr_t)&tstate.ss_frame.F_u, (caddr_t)&frame->F_u, sz);
-#ifdef DEBUG
- if (sigdebug & SDB_FOLLOW)
- printf("sigreturn(%d): copy in %d of frame type %d\n",
- p->p_pid, sz, tstate.ss_frame.f_format);
-#endif
- }
- /*
- * Finally we restore the original FP context
- */
- if (flags & SS_FPSTATE)
- m68881_restore(&tstate.ss_fpstate);
-#ifdef DEBUG
- if ((sigdebug & SDB_FPSTATE) && *(char *)&tstate.ss_fpstate)
- printf("sigreturn(%d): copied in FP state (%x) at %x\n",
- p->p_pid, *(u_int *)&tstate.ss_fpstate,
- &tstate.ss_fpstate);
- if ((sigdebug & SDB_FOLLOW) ||
- ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid))
- printf("sigreturn(%d): returns\n", p->p_pid);
-#endif
- return (EJUSTRETURN);
-}
-
-static int waittime = -1;
-
-void
-bootsync(void)
-{
- if (waittime < 0) {
- extern struct proc proc0;
- /* defeat against panic in boot */
- if (curproc == NULL)
- curproc = &proc0;
- waittime = 0;
-
- vfs_shutdown();
-
- /*
- * If we've been adjusting the clock, the todr
- * will be out of synch; adjust it now unless
- * the system was sitting in ddb.
- */
- if ((howto & RB_TIMEBAD) == 0) {
- resettodr();
- } else {
- printf("WARNING: not updating battery clock\n");
- }
- }
-}
-
-void
-boot(howto)
- register int howto;
-{
- /* take a snap shot before clobbering any registers */
- if (curproc)
- savectx(curproc->p_addr);
-
- boothowto = howto;
- if((howto & RB_NOSYNC) == 0)
- bootsync();
-
- /*
- * Call shutdown hooks. Do this _before_ anything might be
- * asked to the user in case nobody is there....
- */
- doshutdownhooks();
-
- splhigh(); /* extreme priority */
- if(howto & RB_HALT) {
- printf("halted\n\n");
- asm(" stop #0x2700");
- }
- else {
- if(howto & RB_DUMP)
- dumpsys();
-
- doboot();
- /*NOTREACHED*/
- }
- /*NOTREACHED*/
-}
-
-#define BYTES_PER_DUMP NBPG /* Must be a multiple of NBPG */
-static vm_offset_t dumpspace; /* Virt. space to map dumppages */
-
-vm_offset_t
-reserve_dumppages(p)
-vm_offset_t p;
-{
- dumpspace = p;
- return(p + BYTES_PER_DUMP);
-}
-
-unsigned dumpmag = 0x8fca0101; /* magic number for savecore */
-int dumpsize = 0; /* also for savecore */
-long dumplo = 0;
-
-dumpconf()
-{
- extern u_long boot_ttphysize, boot_stphysize;
- int nblks;
-
- dumpsize = (boot_ttphysize + boot_stphysize) / NBPG;
- if (dumpdev != NODEV && bdevsw[major(dumpdev)].d_psize) {
- nblks = (*bdevsw[major(dumpdev)].d_psize)(dumpdev);
- if (dumpsize > btoc(dbtob(nblks - dumplo)))
- dumpsize = btoc(dbtob(nblks - dumplo));
- else if (dumplo == 0)
- dumplo = nblks - btodb(ctob(dumpsize));
- }
- /*
- * Don't dump on the first CLBYTES (why CLBYTES?)
- * in case the dump device includes a disk label.
- */
- if (dumplo < btodb(CLBYTES))
- dumplo = btodb(CLBYTES);
-}
-
-/*
- * Doadump comes here after turning off memory management and
- * getting on the dump stack, either when called above, or by
- * the auto-restart code.
- */
-dumpsys()
-{
- extern u_long boot_ttphysize, boot_ttphystart, boot_stphysize;
-
- daddr_t blkno; /* Current block to write */
- int (*dump)(); /* Dumping function */
- u_long maddr; /* PA being dumped */
- int segbytes; /* Number of bytes in this seg. */
- int nbytes; /* Bytes left to dump */
- int i, n, error;
-
- msgbufmapped = 0;
- if (dumpdev == NODEV)
- return;
- /*
- * For dumps during autoconfiguration,
- * if dump device has already configured...
- */
- if (dumpsize == 0)
- dumpconf();
- if (dumplo < 0)
- return;
- printf("\ndumping to dev %x, offset %d\n", dumpdev, dumplo);
-
-#if defined(DDB) || defined(PANICWAIT)
- printf("Do you want to dump memory? [y]");
- cnputc(i = cngetc());
- switch (i) {
- case 'n':
- case 'N':
- return(0);
- case '\n':
- break;
- default :
- cnputc('\n');
- }
-#endif /* defined(DDB) || defined(PANICWAIT) */
-
- maddr = 0;
- segbytes = boot_stphysize;
- blkno = dumplo;
- dump = bdevsw[major(dumpdev)].d_dump;
- nbytes = dumpsize * NBPG;
-
- printf("dump ");
-
- for (i = 0; i < nbytes; i += n, segbytes -= n) {
- /*
- * Skip the hole
- */
- if (segbytes == 0) {
- maddr = boot_ttphystart;
- segbytes = boot_ttphysize;
- }
- /*
- * Print Mb's to go
- */
- n = nbytes - i;
- if (n && (n % (1024*1024)) == 0)
- printf("%d ", n / (1024 * 1024));
-
- /*
- * Limit transfer to BYTES_PER_DUMP
- */
- if (n > BYTES_PER_DUMP)
- n = BYTES_PER_DUMP;
-
- /*
- * Map to a VA and write it
- */
- if (maddr != 0) { /* XXX kvtop chokes on this */
- (void)pmap_map(dumpspace, maddr, maddr+n, VM_PROT_READ);
- error = (*dump)(dumpdev, blkno, (caddr_t)dumpspace, n);
- if (error)
- break;
- }
-
- maddr += n;
- blkno += btodb(n);
- }
- switch (error) {
-
- case ENXIO:
- printf("device bad\n");
- break;
-
- case EFAULT:
- printf("device not ready\n");
- break;
-
- case EINVAL:
- printf("area improper\n");
- break;
-
- case EIO:
- printf("i/o error\n");
- break;
-
- default:
- printf("succeeded\n");
- break;
- }
- printf("\n\n");
- delay(5000000); /* 5 seconds */
-}
-
-/*
- * Return the best possible estimate of the time in the timeval
- * to which tvp points. We do this by returning the current time
- * plus the amount of time since the last clock interrupt (clock.c:clkread).
- *
- * Check that this time is no less than any previously-reported time,
- * which could happen around the time of a clock adjustment. Just for fun,
- * we guarantee that the time will be greater than the value obtained by a
- * previous call.
- */
-void microtime(tvp)
- register struct timeval *tvp;
-{
- int s = splhigh();
- static struct timeval lasttime;
-
- *tvp = time;
- tvp->tv_usec += clkread();
- while (tvp->tv_usec >= 1000000) {
- tvp->tv_sec++;
- tvp->tv_usec -= 1000000;
- }
- if (tvp->tv_sec == lasttime.tv_sec &&
- tvp->tv_usec <= lasttime.tv_usec &&
- (tvp->tv_usec = lasttime.tv_usec + 1) >= 1000000) {
- tvp->tv_sec++;
- tvp->tv_usec -= 1000000;
- }
- lasttime = *tvp;
- splx(s);
-}
-
-initcpu()
-{
-}
-
-straytrap(pc, evec)
-int pc;
-u_short evec;
-{
- static int prev_evec;
-
- printf("unexpected trap (vector offset %x) from %x\n",evec & 0xFFF, pc);
-
- if(prev_evec == evec) {
- delay(1000000);
- prev_evec = 0;
- }
-}
-
-straymfpint(pc, evec)
-int pc;
-u_short evec;
-{
- printf("unexpected mfp-interrupt (vector offset %x) from %x\n",
- evec & 0xFFF, pc);
-}
-
-/*
- * Simulated software interrupt handler
- */
-softint()
-{
- if(ssir & SIR_NET) {
- siroff(SIR_NET);
- cnt.v_soft++;
- netintr();
- }
- if(ssir & SIR_CLOCK) {
- siroff(SIR_CLOCK);
- cnt.v_soft++;
- /* XXXX softclock(&frame.f_stackadj); */
- softclock();
- }
- if (ssir & SIR_CBACK) {
- siroff(SIR_CBACK);
- cnt.v_soft++;
- call_sicallbacks();
- }
-}
-
-int *nofault;
-
-badbaddr(addr)
- register caddr_t addr;
-{
- register int i;
- label_t faultbuf;
-
-#ifdef lint
- i = *addr; if (i) return(0);
-#endif
- nofault = (int *) &faultbuf;
- if (setjmp((label_t *)nofault)) {
- nofault = (int *) 0;
- return(1);
- }
- i = *(volatile char *)addr;
- nofault = (int *) 0;
- return(0);
-}
-
-netintr()
-{
-#ifdef INET
-#if NETHER > 0
- if (netisr & (1 << NETISR_ARP)) {
- netisr &= ~(1 << NETISR_ARP);
- arpintr();
- }
-#endif
- if (netisr & (1 << NETISR_IP)) {
- netisr &= ~(1 << NETISR_IP);
- ipintr();
- }
-#endif
-#ifdef INET6
- if (netisr & (1 << NETISR_IPV6)) {
- netisr &= ~(1 << NETISR_IPV6);
- ip6intr();
- }
-#endif
-#ifdef NETATALK
- if (netisr & (1 << NETISR_ATALK)) {
- netisr &= ~(1 << NETISR_ATALK);
- atintr();
- }
-#endif
-#ifdef NS
- if (netisr & (1 << NETISR_NS)) {
- netisr &= ~(1 << NETISR_NS);
- nsintr();
- }
-#endif
-#ifdef ISO
- if (netisr & (1 << NETISR_ISO)) {
- netisr &= ~(1 << NETISR_ISO);
- clnlintr();
- }
-#endif
-#ifdef NPPP
- if (netisr & (1 << NETISR_PPP)) {
- netisr &= ~(1 << NETISR_PPP);
- pppintr();
- }
-#endif
-#if NBRIDGE > 0
- if (netisr & (1 << NETISR_BRIDGE)) {
- netisr &= ~(1 << NETISR_BRIDGE);
- bridgeintr();
- }
-#endif
-}
-
-
-/*
- * this is a handy package to have asynchronously executed
- * function calls executed at very low interrupt priority.
- * Example for use is keyboard repeat, where the repeat
- * handler running at splclock() triggers such a (hardware
- * aided) software interrupt.
- * Note: the installed functions are currently called in a
- * LIFO fashion, might want to change this to FIFO
- * later.
- */
-struct si_callback {
- struct si_callback *next;
- void (*function) __P((void *rock1, void *rock2));
- void *rock1, *rock2;
-};
-static struct si_callback *si_callbacks;
-static struct si_callback *si_free;
-#ifdef DIAGNOSTIC
-static int ncb; /* number of callback blocks allocated */
-static int ncbd; /* number of callback blocks dynamically allocated */
-#endif
-
-static void alloc_sicallback()
-{
- struct si_callback *si;
- int s;
-
- si = (struct si_callback *)malloc(sizeof(*si), M_TEMP, M_NOWAIT);
- if(si == NULL)
- return;
- s = splhigh();
- si->next = si_free;
- si_free = si;
- splx(s);
-#ifdef DIAGNOSTIC
- ++ncb;
-#endif
-}
-
-void add_sicallback (function, rock1, rock2)
-void (*function) __P((void *rock1, void *rock2));
-void *rock1, *rock2;
-{
- struct si_callback *si;
- int s;
-
- /*
- * this function may be called from high-priority interrupt handlers.
- * We may NOT block for memory-allocation in here!.
- */
- s = splhigh();
- if((si = si_free) != NULL)
- si_free = si->next;
- splx(s);
-
- if(si == NULL) {
- si = (struct si_callback *)malloc(sizeof(*si),M_TEMP,M_NOWAIT);
-#ifdef DIAGNOSTIC
- if(si)
- ++ncbd; /* count # dynamically allocated */
-#endif
-
- if(!si)
- return;
- }
-
- si->function = function;
- si->rock1 = rock1;
- si->rock2 = rock2;
-
- s = splhigh();
- si->next = si_callbacks;
- si_callbacks = si;
- splx(s);
-
- /*
- * and cause a software interrupt (spl1). This interrupt might
- * happen immediately, or after returning to a safe enough level.
- */
- setsoftcback();
-}
-
-void rem_sicallback(function)
-void (*function) __P((void *rock1, void *rock2));
-{
- struct si_callback *si, *psi, *nsi;
- int s;
-
- s = splhigh();
- for(psi = 0, si = si_callbacks; si; ) {
- nsi = si->next;
-
- if(si->function != function)
- psi = si;
- else {
- si->next = si_free;
- si_free = si;
- if(psi)
- psi->next = nsi;
- else si_callbacks = nsi;
- }
- si = nsi;
- }
- splx(s);
-}
-
-/* purge the list */
-static void call_sicallbacks()
-{
- struct si_callback *si;
- int s;
- void *rock1, *rock2;
- void (*function) __P((void *, void *));
-
- do {
- s = splhigh ();
- if(si = si_callbacks)
- si_callbacks = si->next;
- splx(s);
-
- if(si) {
- function = si->function;
- rock1 = si->rock1;
- rock2 = si->rock2;
- s = splhigh ();
- si->next = si_free;
- si_free = si;
- splx(s);
- function(rock1, rock2);
- }
- } while(si);
-#ifdef DIAGNOSTIC
- if(ncbd) {
-#ifdef DEBUG
- printf("call_sicallback: %d more dynamic structures %d total\n",
- ncbd, ncb);
-#endif
- ncbd = 0;
- }
-#endif
-}
-
-#if defined(DEBUG) && !defined(PANICBUTTON)
-#define PANICBUTTON
-#endif
-
-#ifdef PANICBUTTON
-int panicbutton = 1; /* non-zero if panic buttons are enabled */
-int crashandburn = 0;
-int candbdelay = 50; /* give em half a second */
-
-candbtimer()
-{
- crashandburn = 0;
-}
-#endif
-
-regdump(fp, sbytes)
- struct frame *fp; /* must not be register */
- int sbytes;
-{
- static int doingdump = 0;
- register int i;
- int s;
- extern char *hexstr();
-
- if (doingdump)
- return;
- s = splhigh();
- doingdump = 1;
- printf("pid = %d, pc = %s, ", curproc->p_pid, hexstr(fp->f_pc, 8));
- printf("ps = %s, ", hexstr(fp->f_sr, 4));
- printf("sfc = %s, ", hexstr(getsfc(), 4));
- printf("dfc = %s\n", hexstr(getdfc(), 4));
- printf("Registers:\n ");
- for (i = 0; i < 8; i++)
- printf(" %d", i);
- printf("\ndreg:");
- for (i = 0; i < 8; i++)
- printf(" %s", hexstr(fp->f_regs[i], 8));
- printf("\nareg:");
- for (i = 0; i < 8; i++)
- printf(" %s", hexstr(fp->f_regs[i+8], 8));
- if (sbytes > 0) {
- if (fp->f_sr & PSL_S) {
- printf("\n\nKernel stack (%s):",
- hexstr((int)(((int *)&fp)-1), 8));
- dumpmem(((int *)&fp)-1, sbytes, 0);
- } else {
- printf("\n\nUser stack (%s):", hexstr(fp->f_regs[SP], 8));
- dumpmem((int *)fp->f_regs[SP], sbytes, 1);
- }
- }
- doingdump = 0;
- splx(s);
-}
-
-#define KSADDR ((int *)((u_int)curproc->p_addr + USPACE - NBPG))
-
-dumpmem(ptr, sz, ustack)
- register int *ptr;
- int sz;
-{
- register int i, val;
- extern char *hexstr();
-
- for (i = 0; i < sz; i++) {
- if ((i & 7) == 0)
- printf("\n%s: ", hexstr((int)ptr, 6));
- else
- printf(" ");
- if (ustack == 1) {
- if ((val = fuword(ptr++)) == -1)
- break;
- } else {
- if (ustack == 0 &&
- (ptr < KSADDR || ptr > KSADDR+(NBPG/4-1)))
- break;
- val = *ptr++;
- }
- printf("%s", hexstr(val, 8));
- }
- printf("\n");
-}
-
-char *
-hexstr(val, len)
- register int val;
-{
- static char nbuf[9];
- register int x, i;
-
- if (len > 8)
- return("");
- nbuf[len] = '\0';
- for (i = len-1; i >= 0; --i) {
- x = val & 0xF;
- if (x > 9)
- nbuf[i] = x - 10 + 'A';
- else
- nbuf[i] = x + '0';
- val >>= 4;
- }
- return(nbuf);
-}
-
-/*
- * should only get here, if no standard executable. This can currently
- * only mean, we're reading an old ZMAGIC file without MID, but since Atari
- * ZMAGIC always worked the `right' way (;-)) just ignore the missing
- * MID and proceed to new zmagic code ;-)
- */
-cpu_exec_aout_makecmds(p, epp)
- struct proc *p;
- struct exec_package *epp;
-{
- int error = ENOEXEC;
- struct exec *execp = epp->ep_hdr;
-
-#ifdef COMPAT_NOMID
- if (!((execp->a_midmag >> 16) & 0x0fff)
- && execp->a_midmag == ZMAGIC)
- return(exec_aout_prep_zmagic(p, epp));
-#endif
-#ifdef COMPAT_SUNOS
- {
- extern sunos_exec_aout_makecmds
- __P((struct proc *, struct exec_package *));
- if ((error = sunos_exec_aout_makecmds(p, epp)) == 0)
- return(0);
- }
-#endif
- return(error);
-}
diff --git a/sys/arch/atari/atari/mem.c b/sys/arch/atari/atari/mem.c
deleted file mode 100644
index 8159d371664..00000000000
--- a/sys/arch/atari/atari/mem.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/* $NetBSD: mem.c,v 1.4 1996/01/06 20:10:43 leo Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)mem.c 8.3 (Berkeley) 1/12/94
- */
-
-/*
- * Memory special file
- */
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/buf.h>
-#include <sys/systm.h>
-#include <sys/uio.h>
-#include <sys/malloc.h>
-
-#include <machine/cpu.h>
-
-#include <vm/vm.h>
-
-#include "nvr.h"
-
-extern u_int lowram;
-caddr_t zeropage;
-
-/*ARGSUSED*/
-int
-mmopen(dev, flag, mode)
- dev_t dev;
- int flag, mode;
-{
-
- return (0);
-}
-
-/*ARGSUSED*/
-int
-mmclose(dev, flag, mode)
- dev_t dev;
- int flag, mode;
-{
-
- return (0);
-}
-
-/*ARGSUSED*/
-int
-mmrw(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- register vm_offset_t o, v;
- register int c;
- register struct iovec *iov;
- int error = 0;
- static int physlock;
-
- if (minor(dev) == 0) {
- /* lock against other uses of shared vmmap */
- while (physlock > 0) {
- physlock++;
- error = tsleep((caddr_t)&physlock, PZERO | PCATCH,
- "mmrw", 0);
- if (error)
- return (error);
- }
- physlock = 1;
- }
- while (uio->uio_resid > 0 && error == 0) {
- iov = uio->uio_iov;
- if (iov->iov_len == 0) {
- uio->uio_iov++;
- uio->uio_iovcnt--;
- if (uio->uio_iovcnt < 0)
- panic("mmrw");
- continue;
- }
- switch (minor(dev)) {
-
-/* minor device 0 is physical memory */
- case 0:
- v = uio->uio_offset;
-#ifndef DEBUG
- /* allow reads only in RAM (except for DEBUG) */
- if (v >= 0xFFFFFFFC || v < lowram) {
- error = EFAULT;
- goto unlock;
- }
-#endif
- pmap_enter(pmap_kernel(), (vm_offset_t)vmmap,
- trunc_page(v), uio->uio_rw == UIO_READ ?
- VM_PROT_READ : VM_PROT_WRITE, TRUE);
- o = uio->uio_offset & PGOFSET;
- c = min(uio->uio_resid, (int)(NBPG - o));
- error = uiomove((caddr_t)vmmap + o, c, uio);
- pmap_remove(pmap_kernel(), (vm_offset_t)vmmap,
- (vm_offset_t)vmmap + NBPG);
- continue;
-
-/* minor device 1 is kernel memory */
- case 1:
- v = uio->uio_offset;
- c = min(iov->iov_len, MAXPHYS);
- if (!kernacc((caddr_t)v, c,
- uio->uio_rw == UIO_READ ? B_READ : B_WRITE))
- return (EFAULT);
- error = uiomove((caddr_t)v, c, uio);
- continue;
-
-/* minor device 2 is EOF/RATHOLE */
- case 2:
- if (uio->uio_rw == UIO_WRITE)
- uio->uio_resid = 0;
- return (0);
-
-/* minor device 11 (/dev/nvram) */
- case 11:
-#if NNVR > 0
- error = nvram_uio(uio);
- return (error);
-#else
- return (ENXIO);
-#endif
-
-/* minor device 12 (/dev/zero) is source of nulls on read, rathole on write */
- case 12:
- if (uio->uio_rw == UIO_WRITE) {
- c = iov->iov_len;
- break;
- }
- if (zeropage == NULL) {
- zeropage = (caddr_t)
- malloc(CLBYTES, M_TEMP, M_WAITOK);
- bzero(zeropage, CLBYTES);
- }
- c = min(iov->iov_len, CLBYTES);
- error = uiomove(zeropage, c, uio);
- continue;
-
- default:
- return (ENXIO);
- }
- if (error)
- break;
- iov->iov_base += c;
- iov->iov_len -= c;
- uio->uio_offset += c;
- uio->uio_resid -= c;
- }
- if (minor(dev) == 0) {
-unlock:
- if (physlock > 1)
- wakeup((caddr_t)&physlock);
- physlock = 0;
- }
- return (error);
-}
-
-int
-mmmmap(dev, off, prot)
- dev_t dev;
- int off, prot;
-{
- return (-1);
-}
-
-int
-mmioctl(dev, cmd, data, flags, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flags;
- struct proc *p;
-{
- return (EOPNOTSUPP);
-}
diff --git a/sys/arch/atari/atari/misc.c b/sys/arch/atari/atari/misc.c
deleted file mode 100644
index 9544c6f8859..00000000000
--- a/sys/arch/atari/atari/misc.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/* $NetBSD: misc.c,v 1.3 1995/05/21 10:48:53 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman (Atari modifications)
- * Copyright (c) 1994 Christian E. Hopps (allocator stuff)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/queue.h>
-
-#include <atari/atari/misc.h>
-
-/*
- * St-mem allocator.
- */
-/*
- * From atari_init.c
- */
-extern u_long st_pool_size, st_pool_virt, st_pool_phys;
-
-#define PHYS_ADDR(virt) ((u_long)(virt) - st_pool_virt + st_pool_phys)
-
-static CIRCLEQ_HEAD(stlist, mem_node) st_list;
-static CIRCLEQ_HEAD(freelist, mem_node) free_list;
-u_long stmem_total; /* total free. */
-
-void
-init_stmem()
-{
- int s = splhigh ();
- struct mem_node *mem;
-
- stmem_total = st_pool_size - sizeof(*mem);
-
- mem = (struct mem_node *)st_pool_virt;
- mem->size = st_pool_size - sizeof(*mem);
-
- CIRCLEQ_INIT(&st_list);
- CIRCLEQ_INIT(&free_list);
-
- CIRCLEQ_INSERT_HEAD(&st_list, mem, link);
- CIRCLEQ_INSERT_HEAD(&free_list, mem, free_link);
- splx(s);
-}
-
-void *
-alloc_stmem(size, phys_addr)
-u_long size;
-void **phys_addr;
-{
- struct mem_node *mn, *new, *bfit;
- void *mem;
- int s;
-
- if (size == 0)
- return NULL;
-
- s = splhigh();
-
- if (size & ~(ST_BLOCKMASK))
- size = (size & ST_BLOCKMASK) + ST_BLOCKSIZE;
-
- /*
- * walk list of available nodes, finding the best-fit.
- */
- bfit = NULL;
- mn = free_list.cqh_first;
- for(; mn != (void *)&free_list; mn = mn->free_link.cqe_next) {
- if(size <= mn->size) {
- if((bfit != NULL) && (bfit->size < mn->size))
- continue;
- bfit = mn;
- }
- }
- if(bfit != NULL)
- mn = bfit;
- if (mn == (void *)&free_list) {
- printf("St-mem pool exhausted, binpatch 'st_pool_size'"
- "to get more\n");
- splx(s);
- return(NULL);
- }
-
- if ((mn->size - size) <= sizeof (*mn)) {
- /*
- * our allocation would not leave room
- * for a new node in between.
- */
- CIRCLEQ_REMOVE(&free_list, mn, free_link);
- mn->free_link.cqe_next = NULL;
- size = mn->size; /* increase size. (or same) */
- stmem_total -= mn->size;
- splx(s);
- *phys_addr = (void*)PHYS_ADDR(&mn[1]);
- return ((void *)&mn[1]);
- }
-
- /*
- * split the node's memory.
- */
- new = mn;
- new->size -= size + sizeof(struct mem_node);
- mn = (struct mem_node *)(MNODES_MEM(new) + new->size);
- mn->size = size;
-
- /*
- * add split node to node list
- * and mark as not on free list
- */
- CIRCLEQ_INSERT_AFTER(&st_list, new, mn, link);
- mn->free_link.cqe_next = NULL;
-
- stmem_total -= size + sizeof(struct mem_node);
- splx(s);
- *phys_addr = (void*)PHYS_ADDR(&mn[1]);
- return ((void *)&mn[1]);
-}
-
-void
-free_stmem(mem)
-void *mem;
-{
- struct mem_node *mn, *next, *prev;
- int s;
-
- if (mem == NULL)
- return;
-
- s = splhigh();
- mn = (struct mem_node *)mem - 1;
- next = mn->link.cqe_next;
- prev = mn->link.cqe_prev;
-
- /*
- * check ahead of us.
- */
- if (next != (void *)&st_list && next->free_link.cqe_next) {
- /*
- * if next is: a valid node and a free node. ==> merge
- */
- CIRCLEQ_INSERT_BEFORE(&free_list, next, mn, free_link);
- CIRCLEQ_REMOVE(&st_list, next, link);
- CIRCLEQ_REMOVE(&st_list, next, free_link);
- stmem_total += mn->size + sizeof(struct mem_node);
- mn->size += next->size + sizeof(struct mem_node);
- }
- if (prev != (void *)&st_list && prev->free_link.cqe_prev) {
- /*
- * if prev is: a valid node and a free node. ==> merge
- */
- if (mn->free_link.cqe_next == NULL)
- stmem_total += mn->size + sizeof(struct mem_node);
- else {
- /* already on free list */
- CIRCLEQ_REMOVE(&free_list, mn, free_link);
- stmem_total += sizeof(struct mem_node);
- }
- CIRCLEQ_REMOVE(&st_list, mn, link);
- prev->size += mn->size + sizeof(struct mem_node);
- } else if (mn->free_link.cqe_next == NULL) {
- /*
- * we still are not on free list and we need to be.
- * <-- | -->
- */
- while (next != (void *)&st_list && prev != (void *)&st_list) {
- if (next->free_link.cqe_next) {
- CIRCLEQ_INSERT_BEFORE(&free_list, next, mn,
- free_link);
- break;
- }
- if (prev->free_link.cqe_next) {
- CIRCLEQ_INSERT_AFTER(&free_list, prev, mn,
- free_link);
- break;
- }
- prev = prev->link.cqe_prev;
- next = next->link.cqe_next;
- }
- if (mn->free_link.cqe_next == NULL) {
- if (next == (void *)&st_list) {
- /*
- * we are not on list so we can add
- * ourselves to the tail. (we walked to it.)
- */
- CIRCLEQ_INSERT_TAIL(&free_list,mn,free_link);
- } else {
- CIRCLEQ_INSERT_HEAD(&free_list,mn,free_link);
- }
- }
- stmem_total += mn->size;/* add our helpings to the pool. */
- }
- splx(s);
-}
diff --git a/sys/arch/atari/atari/misc.h b/sys/arch/atari/atari/misc.h
deleted file mode 100644
index 477f4535e47..00000000000
--- a/sys/arch/atari/atari/misc.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $NetBSD: misc.h,v 1.1.1.1 1995/03/26 07:12:21 leo Exp $ */
-
-/*
- * Copyright (c) 1994 Christian E. Hopps (allocator stuff)
- * Copyright (c) 1995 Leo Weppelman (Atari modifications)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _ATARI_MISC_H
-#define _ATARI_MISC_H
-/*
- * St-mem allocator stuff.
- */
-struct mem_node {
- CIRCLEQ_ENTRY(mem_node) link;
- CIRCLEQ_ENTRY(mem_node) free_link;
- u_long size; /* size of memory following node. */
-};
-
-#define ST_BLOCKSIZE (sizeof(long))
-#define ST_BLOCKMASK (~(ST_BLOCKSIZE - 1))
-#define MNODES_MEM(mn) ((u_char *)(&mn[1]))
-
-void init_stmem __P((void));
-void *alloc_stmem __P((u_long, void **));
-void free_stmem __P((void *));
-
-#endif /* _ATARI_MISC_H */
diff --git a/sys/arch/atari/atari/pmap.c b/sys/arch/atari/atari/pmap.c
deleted file mode 100644
index 250fcbfae23..00000000000
--- a/sys/arch/atari/atari/pmap.c
+++ /dev/null
@@ -1,2241 +0,0 @@
-/* $NetBSD: pmap.c,v 1.8 1995/12/25 14:13:53 leo Exp $ */
-
-/*
- * Copyright (c) 1991 Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pmap.c 7.5 (Berkeley) 5/10/91
- */
-
-/*
- * ATARI physical map management code.
- * For 68020/68030 machines with 68551, or 68030 MMUs
- * Don't even pay lip service to multiprocessor support.
- *
- * will only work for PAGE_SIZE == NBPG
- * right now because of the assumed one-to-one relationship of PT
- * pages to STEs.
- */
-
-/*
- * Manages physical address maps.
- *
- * In addition to hardware address maps, this
- * module is called upon to provide software-use-only
- * maps which may or may not be stored in the same
- * form as hardware maps. These pseudo-maps are
- * used to store intermediate results from copy
- * operations to and from address spaces.
- *
- * Since the information managed by this module is
- * also stored by the logical address mapping module,
- * this module may throw away valid virtual-to-physical
- * mappings at almost any time. However, invalidations
- * of virtual-to-physical mappings must be done as
- * requested.
- *
- * In order to cope with hardware architectures which
- * make virtual-to-physical map invalidates expensive,
- * this module may delay invalidate or reduced protection
- * operations until such time as they are actually
- * necessary. This module is given full information as
- * to which processors are currently using which maps,
- * and to when physical maps must be made correct.
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/malloc.h>
-#include <sys/msgbuf.h>
-#include <vm/vm.h>
-#include <sys/user.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-#include <machine/pte.h>
-#include <machine/cpu.h>
-#include <machine/vmparam.h>
-/*
- * Allocate various and sundry SYSMAPs used in the days of old VM
- * and not yet converted. XXX.
- */
-
-#ifdef DEBUG
-struct kpt_stats {
- int collectscans;
- int collectpages;
- int kpttotal;
- int kptinuse;
- int kptmaxuse;
-};
-struct enter_stats {
- int kernel; /* entering kernel mapping */
- int user; /* entering user mapping */
- int ptpneeded; /* needed to allocate a PT page */
- int pwchange; /* no mapping change, just wiring or protection */
- int wchange; /* no mapping change, just wiring */
- int mchange; /* was mapped but mapping to different page */
- int managed; /* a managed page */
- int firstpv; /* first mapping for this PA */
- int secondpv; /* second mapping for this PA */
- int ci; /* cache inhibited */
- int unmanaged; /* not a managed page */
- int flushes; /* cache flushes */
-};
-struct remove_stats {
- int calls;
- int removes;
- int pvfirst;
- int pvsearch;
- int ptinvalid;
- int uflushes;
- int sflushes;
-};
-
-struct remove_stats remove_stats;
-struct enter_stats enter_stats;
-struct kpt_stats kpt_stats;
-
-#define PDB_FOLLOW 0x0001
-#define PDB_INIT 0x0002
-#define PDB_ENTER 0x0004
-#define PDB_REMOVE 0x0008
-#define PDB_CREATE 0x0010
-#define PDB_PTPAGE 0x0020
-#define PDB_CACHE 0x0040
-#define PDB_BITS 0x0080
-#define PDB_COLLECT 0x0100
-#define PDB_PROTECT 0x0200
-#define PDB_SEGTAB 0x0400
-#define PDB_PARANOIA 0x2000
-#define PDB_WIRING 0x4000
-#define PDB_PVDUMP 0x8000
-int debugmap = 0;
-int pmapdebug = PDB_PARANOIA;
-#endif
-
-/*
- * Get STEs and PTEs for user/kernel address space
- */
-#define pmap_ste(m, v) (&((m)->pm_stab[(vm_offset_t)(v) >> pmap_ishift]))
-#define pmap_pte(m, v) (&((m)->pm_ptab[(vm_offset_t)(v) >> PG_SHIFT]))
-
-#define pmap_pte_pa(pte) (*(u_int *)(pte) & PG_FRAME)
-
-#define pmap_ste_v(ste) (*(u_int *)(ste) & SG_V)
-#define pmap_pte_w(pte) (*(u_int *)(pte) & PG_W)
-#define pmap_pte_ci(pte) (*(u_int *)(pte) & PG_CI)
-#define pmap_pte_m(pte) (*(u_int *)(pte) & PG_M)
-#define pmap_pte_u(pte) (*(u_int *)(pte) & PG_U)
-#define pmap_pte_prot(pte) (*(u_int *)(pte) & PG_PROT)
-#define pmap_pte_v(pte) (*(u_int *)(pte) & PG_V)
-
-#define pmap_pte_set_w(pte, v) \
- do { if (v) *(u_int *)(pte) |= PG_W; else *(u_int *)(pte) &= ~PG_W; \
- } while (0)
-#define pmap_pte_set_prot(pte, v) \
- do { if (v) *(u_int *)(pte) |= PG_PROT; else *(u_int *)(pte) &= ~PG_PROT; \
- } while (0)
-#define pmap_pte_w_chg(pte, nw) ((nw) ^ pmap_pte_w(pte))
-#define pmap_pte_prot_chg(pte, np) ((np) ^ pmap_pte_prot(pte))
-
-#define active_pmap(pm) \
- ((pm) == pmap_kernel() || (pm) == curproc->p_vmspace->vm_map.pmap)
-
-/*
- * Given a map and a machine independent protection code,
- * convert to a vax protection code.
- */
-#define pte_prot(m, p) (protection_codes[p])
-int protection_codes[8];
-
-/*
- * Kernel page table page management.
- */
-struct kpt_page {
- struct kpt_page *kpt_next; /* link on either used or free list */
- vm_offset_t kpt_va; /* always valid kernel VA */
- vm_offset_t kpt_pa; /* PA of this page (for speed) */
-};
-struct kpt_page *kpt_free_list, *kpt_used_list;
-struct kpt_page *kpt_pages;
-
-/*
- * Kernel segment/page table and page table map.
- * The page table map gives us a level of indirection we need to dynamically
- * expand the page table. It is essentially a copy of the segment table
- * with PTEs instead of STEs. All are initialized in locore at boot time.
- * Sysmap will initially contain VM_KERNEL_PT_PAGES pages of PTEs.
- * Segtabzero is an empty segment table which all processes share til they
- * reference something.
- */
-u_int *Sysseg1; /* root segment for 68040 */
-u_int *Sysseg;
-u_int *Sysmap, *Sysptmap;
-u_int *Segtabzero;
-vm_size_t Sysptsize = VM_KERNEL_PT_PAGES + 4 / NPTEPG;
-
-struct pmap kernel_pmap_store;
-vm_map_t pt_map;
-
-vm_offset_t avail_start; /* PA of first available physical page */
-vm_offset_t avail_end; /* PA of last available physical page */
-vm_size_t mem_size; /* memory size in bytes */
-vm_offset_t virtual_avail; /* VA of first avail page (after kernel bss)*/
-vm_offset_t virtual_end; /* VA of last avail page (end of kernel AS) */
-vm_offset_t vm_first_phys; /* PA of first managed page */
-vm_offset_t vm_last_phys; /* PA just past last managed page */
-boolean_t pmap_initialized = FALSE; /* Has pmap_init completed? */
-char *pmap_attributes; /* reference and modify bits */
-static int pmap_ishift; /* segment table index shift */
-
-#ifdef MACHINE_NONCONTIG
-static vm_offset_t avail_next;
-static vm_size_t avail_remaining;
-#endif
-
-boolean_t pmap_testbit __P((vm_offset_t, int));
-void pmap_enter_ptpage __P((pmap_t, vm_offset_t));
-extern vm_offset_t reserve_dumppages __P((vm_offset_t));
-
-#ifdef MACHINE_NONCONTIG
-#define pmap_valid_page(pa) (pmap_initialized && pmap_isvalidphys(pa))
-#else
-#define pmap_valid_page(pa) (pmap_initialized && pa >= vm_first_phys && \
- pa < vm_last_phys)
-#endif
-
-/*
- * All those kernel PT submaps that BSD is so fond of
- */
-caddr_t CADDR1, CADDR2;
-u_int *CMAP1, *CMAP2, *vmpte, *msgbufmap;
-
-/*
- * Bootstrap the system enough to run with virtual memory.
- * Map the kernel's code and data, and allocate the system page table.
- *
- * On the HP this is called after mapping has already been enabled
- * and just syncs the pmap module with what has already been done.
- * [We can't call it easily with mapping off since the kernel is not
- * mapped with PA == VA, hence we would have to relocate every address
- * from the linked base (virtual) address 0 to the actual (physical)
- * address of 0xFFxxxxxx.]
- */
-void
-pmap_bootstrap(kernel_size)
-vm_offset_t kernel_size;
-{
- vm_offset_t va;
- u_int *pte;
- int i;
-
- /*
- * Setup physical address ranges
- */
- for (i = 0; phys_segs[i+1].start; i++)
- ;
- /* XXX: allow for msgbuf */
- phys_segs[i].end -= atari_round_page(sizeof(struct msgbuf));
-
- avail_start = phys_segs[0].start;
- avail_end = phys_segs[i].end;
-
-#ifdef MACHINE_NONCONTIG
- /*
- * Setup var's for pmap_next_page()
- */
- for (i = 0, avail_remaining = 0; phys_segs[i].start; i++)
- avail_remaining += phys_segs[i].end - phys_segs[i].start;
-
- avail_remaining >>= PGSHIFT;
- avail_next = phys_segs[0].start;
-#endif
-
- virtual_avail = VM_MIN_KERNEL_ADDRESS + kernel_size;
- virtual_end = VM_MAX_KERNEL_ADDRESS;
-
- /*
- * Initialize protection array.
- */
- atari_protection_init();
-
- /*
- * Kernel page/segment table allocated in locore,
- * just initialize pointers.
- */
- pmap_kernel()->pm_stab = Sysseg;
- pmap_kernel()->pm_ptab = Sysmap;
-#ifdef M68040
- if (cpu040) {
- pmap_kernel()->pm_rtab = Sysseg1;
- pmap_ishift = SG4_SHIFT2;
- } else
-#endif
- pmap_ishift = SG_ISHIFT;
-
- simple_lock_init(&pmap_kernel()->pm_lock);
- pmap_kernel()->pm_count = 1;
-
- /*
- * Allocate all the submaps we need
- */
-#define SYSMAP(c, p, v, n) \
- v = (c)va; va += ((n)*NBPG); p = pte; pte += (n);
-
- va = virtual_avail;
- pte = pmap_pte(pmap_kernel(), va);
-
- SYSMAP(caddr_t ,CMAP1 ,CADDR1 ,1 )
- SYSMAP(caddr_t ,CMAP2 ,CADDR2 ,1 )
- SYSMAP(caddr_t ,vmpte ,vmmap ,1 )
- SYSMAP(struct msgbuf * ,msgbufmap ,msgbufp ,1 )
-
- virtual_avail = reserve_dumppages(va);
-}
-
-/*
- * Bootstrap memory allocator. This function allows for early dynamic
- * memory allocation until the virtual memory system has been bootstrapped.
- * After that point, either kmem_alloc or malloc should be used. This
- * function works by stealing pages from the (to be) managed page pool,
- * stealing virtual address space, then mapping the pages and zeroing them.
- *
- * It should be used from pmap_bootstrap till vm_page_startup, afterwards
- * it cannot be used, and will generate a panic if tried. Note that this
- * memory will never be freed, and in essence it is wired down.
- */
-void *
-pmap_bootstrap_alloc(size)
- int size;
-{
- extern boolean_t vm_page_startup_initialized;
- vm_offset_t val;
-
- if (vm_page_startup_initialized)
- panic("pmap_bootstrap_alloc: called after startup initialized");
- size = round_page(size);
- val = virtual_avail;
-
- virtual_avail = pmap_map(virtual_avail, avail_start,
- avail_start + size, VM_PROT_READ|VM_PROT_WRITE);
- avail_start += size;
-
- bzero((caddr_t) val, size);
- return((void *) val);
-}
-
-/*
- * Initialize the pmap module.
- * Called by vm_init, to initialize any structures that the pmap
- * system needs to map virtual memory.
- */
-void
-#ifdef MACHINE_NONCONTIG
-pmap_init()
-#else
-pmap_init(phys_start, phys_end)
- vm_offset_t phys_start, phys_end;
-#endif
-{
- vm_offset_t addr, addr2;
- vm_size_t npg, s;
- int rv;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
-#ifdef MACHINE_NONCONTIG
- printf("pmap_init(%x, %x)\n", avail_start, avail_end);
-#else
- printf("pmap_init(%x, %x)\n", phys_start, phys_end);
-#endif
-#endif
- addr = (vm_offset_t) Sysmap;
- vm_object_reference(kernel_object);
- (void) vm_map_find(kernel_map, kernel_object, addr, &addr,
- ATARI_KPTSIZE, FALSE);
- /*
- * If this fails it is probably because the static portion of
- * the kernel page table isn't big enough and we overran the
- * page table map. Need to adjust pmap_size() in atari_init.c.
- */
- if (addr != (vm_offset_t)Sysmap)
- panic("pmap_init: bogons in the VM system!");
-#ifdef DEBUG
- if (pmapdebug & PDB_INIT) {
- printf("pmap_init: Sysseg %x, Sysmap %x, Sysptmap %x\n",
- Sysseg, Sysmap, Sysptmap);
- printf(" pstart %x, pend %x, vstart %x, vend %x\n",
- avail_start, avail_end, virtual_avail, virtual_end);
- }
-#endif
-
- /*
- * Allocate memory for random pmap data structures. Includes the
- * initial segment table, pv_head_table and pmap_attributes.
- */
-#ifdef MACHINE_NONCONTIG
- {
- int i;
- for (npg = 0, i = 0; phys_segs[i].start; ++i)
- npg += atop(phys_segs[i].end - phys_segs[i].start);
- }
-#ifdef DEBUG
- printf ("pmap_init: avail_start %08x phys_segs[0].start %08x npg %d\n",
- avail_start, phys_segs[0].start, npg);
-#endif
-#else
- npg = atop(phys_end - phys_start);
-#endif
-#ifdef M68040
- if (cpu040)
- s = (vm_size_t)ATARI_040STSIZE * 128 +
- sizeof(struct pv_entry) * npg + npg;
- else
-#endif
- s = (vm_size_t)ATARI_STSIZE +
- sizeof(struct pv_entry) * npg + npg;
-
- s = round_page(s);
- addr = (vm_offset_t) kmem_alloc(kernel_map, s);
- Segtabzero = (u_int *) addr;
-#ifdef M68040
- if (cpu040)
- addr += ATARI_040STSIZE * 128;
- else
-#endif
- addr += ATARI_STSIZE;
- pv_table = (pv_entry_t) addr;
- addr += sizeof(struct pv_entry) * npg;
- pmap_attributes = (char *) addr;
-#ifdef DEBUG
- if (pmapdebug & PDB_INIT)
- printf("pmap_init: %x bytes (%x pgs): seg %x tbl %x attr %x\n",
- s, npg, Segtabzero, pv_table, pmap_attributes);
-#endif
-
- /*
- * Allocate physical memory for kernel PT pages and their management.
- * we need enough pages to map the page tables for each process
- * plus some slop.
- */
- npg = howmany(((maxproc + 16) * ATARI_UPTSIZE / NPTEPG), NBPG);
- npg = min(atop(ATARI_MAX_KPTSIZE), npg);
- s = ptoa(npg) + round_page(npg * sizeof(struct kpt_page));
-
- /*
- * Verify that space will be allocated in region for which
- * we already have kernel PT pages.
- */
- addr = 0;
- rv = vm_map_find(kernel_map, NULL, 0, &addr, s, TRUE);
- if (rv != KERN_SUCCESS || addr + s >= (vm_offset_t)Sysmap)
- panic("pmap_init: kernel PT too small");
- vm_map_remove(kernel_map, addr, addr + s);
-
- /*
- * Now allocate the space and link the pages together to
- * form the KPT free list.
- */
- addr = (vm_offset_t) kmem_alloc(kernel_map, s);
- s = ptoa(npg);
- addr2 = addr + s;
- kpt_pages = &((struct kpt_page *)addr2)[npg];
- kpt_free_list = (struct kpt_page *) 0;
- do {
- addr2 -= NBPG;
- (--kpt_pages)->kpt_next = kpt_free_list;
- kpt_free_list = kpt_pages;
- kpt_pages->kpt_va = addr2;
- kpt_pages->kpt_pa = pmap_extract(pmap_kernel(), addr2);
- } while (addr != addr2);
-#ifdef DEBUG
- kpt_stats.kpttotal = atop(s);
- if (pmapdebug & PDB_INIT)
- printf("pmap_init: KPT: %d pages from %x to %x\n",
- atop(s), addr, addr + s);
-#endif
-
- /*
- * Slightly modified version of kmem_suballoc() to get page table
- * map where we want it.
- */
- addr = ATARI_UPTBASE;
- if (ATARI_UPTMAXSIZE / ATARI_UPTSIZE < maxproc) {
- s = ATARI_UPTMAXSIZE;
-
- /*
- * XXX We don't want to hang when we run out of page
- * tables, so we lower maxproc so that fork will fail
- * instead. Note that root could still raise this
- * value through sysctl(2).
- */
- maxproc = ATARI_UPTMAXSIZE / ATARI_UPTSIZE;
- }
- else s = maxproc * ATARI_UPTSIZE;
- addr2 = addr + s;
- rv = vm_map_find(kernel_map, NULL, 0, &addr, s, TRUE);
- if (rv != KERN_SUCCESS)
- panic("pmap_init: cannot allocate space for PT map");
- pmap_reference(vm_map_pmap(kernel_map));
- pt_map = vm_map_create(vm_map_pmap(kernel_map), addr, addr2, TRUE);
- if (pt_map == NULL)
- panic("pmap_init: cannot create pt_map");
- rv = vm_map_submap(kernel_map, addr, addr2, pt_map);
- if (rv != KERN_SUCCESS)
- panic("pmap_init: cannot map range to pt_map");
-#ifdef DEBUG
- if (pmapdebug & PDB_INIT)
- printf("pmap_init: pt_map [%x - %x)\n", addr, addr2);
-#endif
-
- /*
- * Now it is safe to enable pv_table recording.
- */
-#ifdef MACHINE_NONCONTIG
- vm_first_phys = avail_start;
- vm_last_phys = avail_end;
-#else
- vm_first_phys = phys_start;
- vm_last_phys = phys_end;
-#endif
- pmap_initialized = TRUE;
-}
-
-#ifdef MACHINE_NONCONTIG
-unsigned int
-pmap_free_pages()
-{
-
- return avail_remaining;
-}
-
-int
-pmap_next_page(addrp)
- vm_offset_t *addrp;
-{
- static int cur_seg = 0;
-
-#ifdef DEBUG
- if(!cur_seg && (avail_next == phys_segs[cur_seg].start))
- printf ("pmap_next_page: next %08x remain %d\n",
- avail_next, avail_remaining);
-#endif
- if (phys_segs[cur_seg].start == 0)
- return FALSE;
- if (avail_next == phys_segs[cur_seg].end) {
- avail_next = phys_segs[++cur_seg].start;
-#ifdef DEBUG
- printf ("pmap_next_page: next %08x remain %d\n",
- avail_next, avail_remaining);
-#endif
- }
-
- if (avail_next == 0)
- return FALSE;
- *addrp = avail_next;
- avail_next += NBPG;
- avail_remaining--;
- return TRUE;
-}
-
-int
-pmap_page_index(pa)
- vm_offset_t pa;
-{
-
- struct physeg *sep = &phys_segs[0];
-
- while (sep->start) {
- if (pa >= sep->start && pa < sep->end)
- return (atari_btop(pa - sep->start) + sep->first_page);
- ++sep;
- }
- return -1;
-}
-
-void
-pmap_virtual_space(startp, endp)
- vm_offset_t *startp;
- vm_offset_t *endp;
-{
- *startp = virtual_avail;
- *endp = virtual_end;
-}
-#else
-#define pmap_page_index(pa) (pa_index(pa))
-#endif /* MACHINE_NONCONTIG */
-
-/*
- * Used to map a range of physical addresses into kernel
- * virtual address space.
- *
- * For now, VM is already on, we only need to map the
- * specified memory.
- */
-vm_offset_t
-pmap_map(virt, start, end, prot)
- vm_offset_t virt;
- vm_offset_t start;
- vm_offset_t end;
- int prot;
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_map(%x, %x, %x, %x)\n", virt, start, end, prot);
-#endif
- while (start < end) {
- pmap_enter(pmap_kernel(), virt, start, prot, FALSE);
- virt += PAGE_SIZE;
- start += PAGE_SIZE;
- }
- return(virt);
-}
-
-/*
- * Create and return a physical map.
- *
- * If the size specified for the map
- * is zero, the map is an actual physical
- * map, and may be referenced by the
- * hardware.
- *
- * If the size specified is non-zero,
- * the map will be used in software only, and
- * is bounded by that size.
- */
-pmap_t
-pmap_create(size)
- vm_size_t size;
-{
- register pmap_t pmap;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- printf("pmap_create(%x)\n", size);
-#endif
- /*
- * Software use map does not need a pmap
- */
- if (size)
- return(NULL);
-
- /* XXX: is it ok to wait here? */
- pmap = (pmap_t) malloc(sizeof *pmap, M_VMPMAP, M_WAITOK);
-#ifdef notifwewait
- if (pmap == NULL)
- panic("pmap_create: cannot allocate a pmap");
-#endif
- bzero(pmap, sizeof(*pmap));
- pmap_pinit(pmap);
- return (pmap);
-}
-
-/*
- * Initialize a preallocated and zeroed pmap structure,
- * such as one in a vmspace structure.
- */
-void
-pmap_pinit(pmap)
- register struct pmap *pmap;
-{
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- printf("pmap_pinit(%x)\n", pmap);
-#endif
- /*
- * No need to allocate page table space yet but we do need a
- * valid segment table. Initially, we point everyone at the
- * "null" segment table. On the first pmap_enter, a real
- * segment table will be allocated.
- */
-#ifdef M68040
- if (cpu040)
- pmap->pm_rtab = Segtabzero;
-#endif
- pmap->pm_stab = Segtabzero;
- pmap->pm_stchanged = TRUE;
- pmap->pm_count = 1;
- simple_lock_init(&pmap->pm_lock);
-}
-
-/*
- * Retire the given physical map from service.
- * Should only be called if the map contains
- * no valid mappings.
- */
-void
-pmap_destroy(pmap)
- register pmap_t pmap;
-{
- int count;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_destroy(%x)\n", pmap);
-#endif
- if (pmap == NULL)
- return;
-
- simple_lock(&pmap->pm_lock);
- count = --pmap->pm_count;
- simple_unlock(&pmap->pm_lock);
- if (count == 0) {
- pmap_release(pmap);
- free((caddr_t)pmap, M_VMPMAP);
- }
-}
-
-/*
- * Release any resources held by the given physical map.
- * Called when a pmap initialized by pmap_pinit is being released.
- * Should only be called if the map contains no valid mappings.
- */
-void
-pmap_release(pmap)
- register struct pmap *pmap;
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_release(%x)\n", pmap);
-#endif
-#ifdef notdef /* DIAGNOSTIC */
- /* count would be 0 from pmap_destroy... */
- simple_lock(&pmap->pm_lock);
- if (pmap->pm_count != 1)
- panic("pmap_release count");
-#endif
- if (pmap->pm_ptab)
- kmem_free_wakeup(pt_map, (vm_offset_t)pmap->pm_ptab,
- ATARI_UPTSIZE);
- if (pmap->pm_stab != Segtabzero)
-#ifdef M68040
- if (cpu040) {
- kmem_free(kernel_map, (vm_offset_t)pmap->pm_rtab,
- ATARI_040RTSIZE);
- kmem_free(kernel_map, (vm_offset_t)pmap->pm_stab,
- ATARI_040STSIZE*128);
- }
- else
-#endif
- kmem_free(kernel_map, (vm_offset_t)pmap->pm_stab, ATARI_STSIZE);
-}
-
-/*
- * Add a reference to the specified pmap.
- */
-void
-pmap_reference(pmap)
- pmap_t pmap;
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_reference(%x)\n", pmap);
-#endif
- if (pmap != NULL) {
- simple_lock(&pmap->pm_lock);
- pmap->pm_count++;
- simple_unlock(&pmap->pm_lock);
- }
-}
-
-/*
- * Remove the given range of addresses from the specified map.
- *
- * It is assumed that the start and end are properly
- * rounded to the page size.
- */
-void
-pmap_remove(pmap, sva, eva)
- register pmap_t pmap;
- vm_offset_t sva, eva;
-{
- register vm_offset_t pa, va;
- register u_int *pte;
- register pv_entry_t pv, npv;
- pmap_t ptpmap;
- int *ste, i, s, bits;
- boolean_t flushcache = FALSE;
-#ifdef DEBUG
- u_int opte;
-
- if (pmapdebug & (PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT))
- printf("pmap_remove(%x, %x, %x)\n", pmap, sva, eva);
-#endif
-
- if (pmap == NULL)
- return;
-
-#ifdef DEBUG
- remove_stats.calls++;
-#endif
- for (va = sva; va < eva; va += PAGE_SIZE) {
- /*
- * Weed out invalid mappings.
- * Note: we assume that the segment table is always allocated.
- */
- if (!pmap_ste_v(pmap_ste(pmap, va))) {
- /* XXX: avoid address wrap around */
- if (va >= atari_trunc_seg((vm_offset_t)-1))
- break;
- va = atari_round_seg(va + PAGE_SIZE) - PAGE_SIZE;
- continue;
- }
- pte = pmap_pte(pmap, va);
- pa = pmap_pte_pa(pte);
- if (pa == 0)
- continue;
-#ifdef DEBUG
- opte = *pte;
- remove_stats.removes++;
-#endif
- /*
- * Update statistics
- */
- if (pmap_pte_w(pte))
- pmap->pm_stats.wired_count--;
- pmap->pm_stats.resident_count--;
-
- /*
- * Invalidate the PTEs.
- * XXX: should cluster them up and invalidate as many
- * as possible at once.
- */
-#ifdef DEBUG
- if (pmapdebug & PDB_REMOVE)
- printf("remove: invalidating %x\n", pte);
-#endif
- bits = *(int *)pte & (PG_U|PG_M);
- *(int *)pte = PG_NV;
- if (active_pmap(pmap))
- TBIS(va);
-
- /*
- * For user mappings decrement the wiring count on
- * the PT page. We do this after the PTE has been
- * invalidated because vm_map_pageable winds up in
- * pmap_pageable which clears the modify bit for the
- * PT page.
- */
- if (pmap != pmap_kernel()) {
- pte = pmap_pte(pmap, va);
- vm_map_pageable(pt_map, trunc_page(pte),
- round_page(pte+1), TRUE);
-#ifdef DEBUG
- if (pmapdebug & PDB_WIRING)
- pmap_check_wiring("remove", trunc_page(pte));
-#endif
- }
- /*
- * Remove from the PV table (raise IPL since we
- * may be called at interrupt time).
- */
- if (!pmap_valid_page(pa))
- continue;
- pv = pa_to_pvh(pa);
- ste = (int *)0;
- s = splimp();
- /*
- * If it is the first entry on the list, it is actually
- * in the header and we must copy the following entry up
- * to the header. Otherwise we must search the list for
- * the entry. In either case we free the now unused entry.
- */
- if (pmap == pv->pv_pmap && va == pv->pv_va) {
- ste = (int *)pv->pv_ptste;
- ptpmap = pv->pv_ptpmap;
- npv = pv->pv_next;
- if (npv) {
- *pv = *npv;
- free((caddr_t)npv, M_VMPVENT);
- } else
- pv->pv_pmap = NULL;
-#ifdef DEBUG
- remove_stats.pvfirst++;
-#endif
- } else {
- for (npv = pv->pv_next; npv; npv = npv->pv_next) {
-#ifdef DEBUG
- remove_stats.pvsearch++;
-#endif
- if (pmap == npv->pv_pmap && va == npv->pv_va)
- break;
- pv = npv;
- }
-#ifdef DEBUG
- if (npv == NULL) {
-printf ("pmap_remove: PA %08x index %d\n", pa, pa_index(pa));
- panic("pmap_remove: PA not in pv_tab");
- }
-#endif
- ste = (int *)npv->pv_ptste;
- ptpmap = npv->pv_ptpmap;
- pv->pv_next = npv->pv_next;
- free((caddr_t)npv, M_VMPVENT);
- pv = pa_to_pvh(pa);
- }
- /*
- * If this was a PT page we must also remove the
- * mapping from the associated segment table.
- */
- if (ste) {
-#ifdef DEBUG
- remove_stats.ptinvalid++;
- if (pmapdebug & (PDB_REMOVE|PDB_PTPAGE)) {
- printf("remove: ste was %x@%x pte was %x@%x\n",
- *ste, ste,
- *(int *)&opte, pmap_pte(pmap, va));
- }
-#endif
-#ifdef M68040
- if (cpu040) {
- /*
- * On the 68040, the PT page contains 64 page tables,
- * so we need to remove all the associated segment
- * table entries
- * (This may be incorrect: if a single page table is
- * being removed, the whole page should not be
- * removed.)
- */
- for (i = 0; i < 64; ++i)
- *ste++ = SG_NV;
- ste -= 64;
-#ifdef DEBUG
- if (pmapdebug &(PDB_REMOVE|PDB_SEGTAB|0x10000))
- printf("pmap_remove:PT at %x remved\n",
- va);
-#endif
- }
- else
-#endif /* M68040 */
- *ste = SG_NV;
- /*
- * If it was a user PT page, we decrement the
- * reference count on the segment table as well,
- * freeing it if it is now empty.
- */
- if (ptpmap != pmap_kernel()) {
-#ifdef DEBUG
- if (pmapdebug & (PDB_REMOVE|PDB_SEGTAB))
- printf("remove: stab %x, refcnt %d\n",
- ptpmap->pm_stab,
- ptpmap->pm_sref - 1);
- if ((pmapdebug & PDB_PARANOIA) &&
- ptpmap->pm_stab != (u_int *)trunc_page(ste))
- panic("remove: bogus ste");
-#endif
- if (--(ptpmap->pm_sref) == 0) {
-#ifdef DEBUG
- if (pmapdebug&(PDB_REMOVE|PDB_SEGTAB))
- printf("remove: free stab %x\n",
- ptpmap->pm_stab);
-#endif
-#ifdef M68040
- if (cpu040) {
- kmem_free(kernel_map,
- (vm_offset_t)ptpmap->pm_rtab,
- ATARI_040RTSIZE);
- kmem_free(kernel_map,
- (vm_offset_t)ptpmap->pm_stab,
- ATARI_040STSIZE*128);
- ptpmap->pm_rtab = Segtabzero;
- }
- else
-#endif
- kmem_free(kernel_map,
- (vm_offset_t)ptpmap->pm_stab,
- ATARI_STSIZE);
- ptpmap->pm_stab = Segtabzero;
- ptpmap->pm_stchanged = TRUE;
- /*
- * XXX may have changed segment table
- * pointer for current process so
- * update now to reload hardware.
- */
- if (ptpmap == curproc->p_vmspace->vm_map.pmap)
- PMAP_ACTIVATE(ptpmap,
- (struct pcb *)curproc->p_addr, 1);
- }
- }
- if (ptpmap == pmap_kernel())
- TBIAS();
- else
- TBIAU();
- pv->pv_flags &= ~PV_PTPAGE;
- ptpmap->pm_ptpages--;
- }
- /*
- * Update saved attributes for managed page
- */
- pmap_attributes[pa_index(pa)] |= bits;
- splx(s);
- }
- if (flushcache) {
- if (pmap == pmap_kernel()) {
- DCIS();
-#ifdef DEBUG
- remove_stats.sflushes++;
-#endif
- } else {
- DCIU();
-#ifdef DEBUG
- remove_stats.uflushes++;
-#endif
- }
- }
-}
-
-/*
- * pmap_page_protect:
- *
- * Lower the permission for all mappings to a given page.
- */
-void
-pmap_page_protect(pa, prot)
- vm_offset_t pa;
- vm_prot_t prot;
-{
- register pv_entry_t pv;
- int s;
-
-#ifdef DEBUG
- if ((pmapdebug & (PDB_FOLLOW|PDB_PROTECT)) ||
- prot == VM_PROT_NONE && (pmapdebug & PDB_REMOVE))
- printf("pmap_page_protect(%x, %x)\n", pa, prot);
-#endif
- if (!pmap_valid_page(pa))
- return;
-
- switch (prot) {
- case VM_PROT_ALL:
- break;
- /* copy_on_write */
- case VM_PROT_READ:
- case VM_PROT_READ|VM_PROT_EXECUTE:
- pmap_changebit(pa, PG_RO, TRUE);
- break;
- /* remove_all */
- default:
- pv = pa_to_pvh(pa);
- s = splimp();
- while (pv->pv_pmap != NULL) {
-#ifdef DEBUG
- if (!pmap_ste_v(pmap_ste(pv->pv_pmap,pv->pv_va)) ||
- pmap_pte_pa(pmap_pte(pv->pv_pmap,pv->pv_va)) != pa)
-{
- printf ("pmap_page_protect: va %08x, pmap_ste_v %d pmap_pte_pa %08x/%08x\n",
- pv->pv_va, pmap_ste_v(pmap_ste(pv->pv_pmap,pv->pv_va)),
- pmap_pte_pa(pmap_pte(pv->pv_pmap,pv->pv_va)),pa);
- printf (" pvh %08x pv %08x pv_next %08x\n", pa_to_pvh(pa), pv, pv->pv_next);
- panic("pmap_page_protect: bad mapping");
-}
-#endif
- pmap_remove(pv->pv_pmap, pv->pv_va,
- pv->pv_va + PAGE_SIZE);
- }
- splx(s);
- break;
- }
-}
-
-/*
- * Set the physical protection on the
- * specified range of this map as requested.
- */
-void
-pmap_protect(pmap, sva, eva, prot)
- register pmap_t pmap;
- vm_offset_t sva, eva;
- vm_prot_t prot;
-{
- register u_int *pte;
- register vm_offset_t va;
- boolean_t needtflush;
- int isro;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_PROTECT))
- printf("pmap_protect(%x, %x, %x, %x)\n", pmap, sva, eva, prot);
-#endif
- if (pmap == NULL)
- return;
-
- if ((prot & VM_PROT_READ) == VM_PROT_NONE) {
- pmap_remove(pmap, sva, eva);
- return;
- }
- if (prot & VM_PROT_WRITE)
- return;
-
- pte = pmap_pte(pmap, sva);
- isro = pte_prot(pmap, prot) == PG_RO ? 1 : 0;
- needtflush = active_pmap(pmap);
- for (va = sva; va < eva; va += PAGE_SIZE) {
- /*
- * Page table page is not allocated.
- * Skip it, we don't want to force allocation
- * of unnecessary PTE pages just to set the protection.
- */
- if (!pmap_ste_v(pmap_ste(pmap, va))) {
- /* XXX: avoid address wrap around */
- if (va >= atari_trunc_seg((vm_offset_t)-1))
- break;
- va = atari_round_seg(va + PAGE_SIZE) - PAGE_SIZE;
- pte = pmap_pte(pmap, va);
- pte++;
- continue;
- }
- /*
- * skip if page not valid or protection is same
- */
- if (!pmap_pte_v(pte) || !pmap_pte_prot_chg(pte, isro)) {
- pte++;
- continue;
- }
-#ifdef M68040
- /*
- * Clear caches if making RO (see section
- * "7.3 Cache Coherency" in the manual).
- */
- if (isro && cpu040) {
- vm_offset_t pa = pmap_pte_pa(pte);
-
- DCFP(pa);
- ICPP(pa);
- }
-#endif
- pmap_pte_set_prot(pte, isro);
- if (needtflush)
- TBIS(va);
- pte++;
- }
-}
-
-/*
- * Insert the given physical page (p) at
- * the specified virtual address (v) in the
- * target physical map with the protection requested.
- *
- * If specified, the page will be wired down, meaning
- * that the related pte can not be reclaimed.
- *
- * NB: This is the only routine which MAY NOT lazy-evaluate
- * or lose information. That is, this routine must actually
- * insert this page into the given map NOW.
- */
-void
-pmap_enter(pmap, va, pa, prot, wired)
- register pmap_t pmap;
- vm_offset_t va;
- register vm_offset_t pa;
- vm_prot_t prot;
- boolean_t wired;
-{
- register u_int *pte;
- register int npte;
- vm_offset_t opa;
- boolean_t cacheable = TRUE;
- boolean_t checkpv = TRUE;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_ENTER))
- printf("pmap_enter(%x, %x, %x, %x, %x)\n",
- pmap, va, pa, prot, wired);
-#endif
- if (pmap == NULL)
- return;
-
-#ifdef DEBUG
- if (pmap == pmap_kernel())
- enter_stats.kernel++;
- else
- enter_stats.user++;
-#endif
- /*
- * For user mapping, allocate kernel VM resources if necessary.
- */
- if (pmap->pm_ptab == NULL)
- pmap->pm_ptab = (u_int *)
- kmem_alloc_wait(pt_map, ATARI_UPTSIZE);
-
- /*
- * Segment table entry not valid, we need a new PT page
- */
- if (!pmap_ste_v(pmap_ste(pmap, va)))
- pmap_enter_ptpage(pmap, va);
-
- pte = pmap_pte(pmap, va);
- opa = pmap_pte_pa(pte);
-#ifdef DEBUG
- if (pmapdebug & PDB_ENTER)
- printf("enter: pte %x, *pte %x\n", pte, *(int *)pte);
-#endif
-
- /*
- * Mapping has not changed, must be protection or wiring change.
- */
- if (opa == pa) {
-#ifdef DEBUG
- enter_stats.pwchange++;
-#endif
- /*
- * Wiring change, just update stats.
- * We don't worry about wiring PT pages as they remain
- * resident as long as there are valid mappings in them.
- * Hence, if a user page is wired, the PT page will be also.
- */
- if (wired && !pmap_pte_w(pte) || !wired && pmap_pte_w(pte)) {
-#ifdef DEBUG
- if (pmapdebug & PDB_ENTER)
- printf("enter: wiring change -> %x\n", wired);
-#endif
- if (wired)
- pmap->pm_stats.wired_count++;
- else
- pmap->pm_stats.wired_count--;
-#ifdef DEBUG
- enter_stats.wchange++;
-#endif
- }
- /*
- * Retain cache inhibition status
- */
- checkpv = FALSE;
- if (pmap_pte_ci(pte))
- cacheable = FALSE;
- goto validate;
- }
-
- /*
- * Mapping has changed, invalidate old range and fall through to
- * handle validating new mapping.
- */
- if (opa) {
-#ifdef DEBUG
- if (pmapdebug & PDB_ENTER)
- printf("enter: removing old mapping %x\n", va);
-#endif
- pmap_remove(pmap, va, va + PAGE_SIZE);
-#ifdef DEBUG
- enter_stats.mchange++;
-#endif
- }
-
- /*
- * If this is a new user mapping, increment the wiring count
- * on this PT page. PT pages are wired down as long as there
- * is a valid mapping in the page.
- */
- if (pmap != pmap_kernel())
- vm_map_pageable(pt_map, trunc_page(pte),
- round_page(pte+1), FALSE);
-
- /*
- * Enter on the PV list if part of our managed memory
- * Note that we raise IPL while manipulating pv_table
- * since pmap_enter can be called at interrupt time.
- */
- if (pmap_valid_page(pa)) {
- register pv_entry_t pv, npv;
- int s;
-
-#ifdef DEBUG
- enter_stats.managed++;
-#endif
- pv = pa_to_pvh(pa);
- s = splimp();
-#ifdef DEBUG
- if (pmapdebug & PDB_ENTER)
- printf("enter: pv at %x: %x/%x/%x\n",
- pv, pv->pv_va, pv->pv_pmap, pv->pv_next);
-#endif
- /*
- * No entries yet, use header as the first entry
- */
- if (pv->pv_pmap == NULL) {
-#ifdef DEBUG
- enter_stats.firstpv++;
-#endif
- pv->pv_va = va;
- pv->pv_pmap = pmap;
- pv->pv_next = NULL;
- pv->pv_ptste = NULL;
- pv->pv_ptpmap = NULL;
- pv->pv_flags = 0;
- }
- /*
- * There is at least one other VA mapping this page.
- * Place this entry after the header.
- */
- else {
-#ifdef DEBUG
- for (npv = pv; npv; npv = npv->pv_next)
- if (pmap == npv->pv_pmap && va == npv->pv_va)
- panic("pmap_enter: already in pv_tab");
-#endif
- npv = (pv_entry_t)
- malloc(sizeof *npv, M_VMPVENT, M_NOWAIT);
- npv->pv_va = va;
- npv->pv_pmap = pmap;
- npv->pv_next = pv->pv_next;
- npv->pv_ptste = NULL;
- npv->pv_ptpmap = NULL;
- pv->pv_next = npv;
-#ifdef DEBUG
- if (!npv->pv_next)
- enter_stats.secondpv++;
-#endif
- }
- splx(s);
- }
- /*
- * Assumption: if it is not part of our managed memory
- * then it must be device memory which may be volitile.
- */
- else if (pmap_initialized) {
- checkpv = cacheable = FALSE;
-#ifdef DEBUG
- enter_stats.unmanaged++;
-#endif
- }
-
- /*
- * Increment counters
- */
- pmap->pm_stats.resident_count++;
- if (wired)
- pmap->pm_stats.wired_count++;
-
-validate:
- /*
- * Now validate mapping with desired protection/wiring.
- * Assume uniform modified and referenced status for all
- * ATARI pages in a MACH page.
- */
-#ifdef M68040
- if (cpu040 && pmap == pmap_kernel() && va >= ATARI_UPTBASE &&
- va < (ATARI_UPTBASE + ATARI_UPTMAXSIZE))
- cacheable = FALSE; /* don't cache user page tables */
-#endif
- npte = (pa & PG_FRAME) | pte_prot(pmap, prot) | PG_V;
- npte |= (*(int *)pte & (PG_M|PG_U));
- if (wired)
- npte |= PG_W;
- if (!checkpv && !cacheable)
- npte |= PG_CI;
-#ifdef M68040
- else if (cpu040 && (npte & PG_PROT) == PG_RW)
- npte |= PG_CCB; /* cache copyback */
-#endif
- /*
- * Remember if this was a wiring-only change.
- * If so, we need not flush the TLB and caches.
- */
- wired = ((*(int *)pte ^ npte) == PG_W);
-#ifdef M68040
- if (cpu040 && !wired) {
- DCFP(pa);
- ICPP(pa);
- }
-#endif
-#ifdef DEBUG
- if (pmapdebug & PDB_ENTER)
- printf("enter: new pte value %x\n", npte);
-#endif
- *(int *)pte++ = npte;
- if (!wired && active_pmap(pmap))
- TBIS(va);
-#ifdef DEBUG
- if ((pmapdebug & PDB_WIRING) && pmap != pmap_kernel()) {
- va -= PAGE_SIZE;
- pmap_check_wiring("enter", trunc_page(pmap_pte(pmap, va)));
- }
-#endif
-}
-
-/*
- * Routine: pmap_change_wiring
- * Function: Change the wiring attribute for a map/virtual-address
- * pair.
- * In/out conditions:
- * The mapping must already exist in the pmap.
- */
-void
-pmap_change_wiring(pmap, va, wired)
- register pmap_t pmap;
- vm_offset_t va;
- boolean_t wired;
-{
- register u_int *pte;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_change_wiring(%x, %x, %x)\n", pmap, va, wired);
-#endif
- if (pmap == NULL)
- return;
-
- pte = pmap_pte(pmap, va);
-#ifdef DEBUG
- /*
- * Page table page is not allocated.
- * Should this ever happen? Ignore it for now,
- * we don't want to force allocation of unnecessary PTE pages.
- */
- if (!pmap_ste_v(pmap_ste(pmap, va))) {
- if (pmapdebug & PDB_PARANOIA)
- printf("pmap_change_wiring: invalid STE for %x\n", va);
- return;
- }
- /*
- * Page not valid. Should this ever happen?
- * Just continue and change wiring anyway.
- */
- if (!pmap_pte_v(pte)) {
- if (pmapdebug & PDB_PARANOIA)
- printf("pmap_change_wiring: invalid PTE for %x\n", va);
- }
-#endif
- if (wired && !pmap_pte_w(pte) || !wired && pmap_pte_w(pte)) {
- if (wired)
- pmap->pm_stats.wired_count++;
- else
- pmap->pm_stats.wired_count--;
- }
- /*
- * Wiring is not a hardware characteristic so there is no need
- * to invalidate TLB.
- */
- pmap_pte_set_w(pte, wired);
-}
-
-/*
- * Routine: pmap_extract
- * Function:
- * Extract the physical page address associated
- * with the given map/virtual_address pair.
- */
-
-vm_offset_t
-pmap_extract(pmap, va)
- register pmap_t pmap;
- vm_offset_t va;
-{
- register vm_offset_t pa;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_extract(%x, %x) -> ", pmap, va);
-#endif
- pa = 0;
- if (pmap && pmap_ste_v(pmap_ste(pmap, va)))
- pa = *(int *)pmap_pte(pmap, va);
- if (pa)
- pa = (pa & PG_FRAME) | (va & ~PG_FRAME);
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("%x\n", pa);
-#endif
- return(pa);
-}
-
-/*
- * Copy the range specified by src_addr/len
- * from the source map to the range dst_addr/len
- * in the destination map.
- *
- * This routine is only advisory and need not do anything.
- */
-void pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr)
- pmap_t dst_pmap;
- pmap_t src_pmap;
- vm_offset_t dst_addr;
- vm_size_t len;
- vm_offset_t src_addr;
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_copy(%x, %x, %x, %x, %x)\n",
- dst_pmap, src_pmap, dst_addr, len, src_addr);
-#endif
-}
-
-/*
- * Require that all active physical maps contain no
- * incorrect entries NOW. [This update includes
- * forcing updates of any address map caching.]
- *
- * Generally used to insure that a thread about
- * to run will see a semantically correct world.
- */
-void pmap_update()
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_update()\n");
-#endif
- TBIA();
-}
-
-/*
- * Routine: pmap_collect
- * Function:
- * Garbage collects the physical map system for
- * pages which are no longer used.
- * Success need not be guaranteed -- that is, there
- * may well be pages which are not referenced, but
- * others may be collected.
- * Usage:
- * Called by the pageout daemon when pages are scarce.
- */
-void
-pmap_collect(pmap)
- pmap_t pmap;
-{
- register vm_offset_t pa;
- register pv_entry_t pv;
- register int *pte;
- vm_offset_t kpa;
- int s;
-
-#ifdef DEBUG
- int *ste;
- int opmapdebug;
-#endif
- if (pmap != pmap_kernel())
- return;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_collect(%x)\n", pmap);
- kpt_stats.collectscans++;
-#endif
- s = splimp();
- for (pa = vm_first_phys; pa < vm_last_phys; pa += PAGE_SIZE) {
- register struct kpt_page *kpt, **pkpt;
-
- /*
- * Locate physical pages which are being used as kernel
- * page table pages.
- */
- pv = pa_to_pvh(pa);
- if (pv->pv_pmap != pmap_kernel() || !(pv->pv_flags & PV_PTPAGE))
- continue;
- do {
- if (pv->pv_ptste && pv->pv_ptpmap == pmap_kernel())
- break;
- } while (pv = pv->pv_next);
- if (pv == NULL)
- continue;
-#ifdef DEBUG
- if (pv->pv_va < (vm_offset_t)Sysmap ||
- pv->pv_va >= (vm_offset_t)Sysmap + ATARI_KPTSIZE)
- printf("collect: kernel PT VA out of range\n");
- else
- goto ok;
- pmap_pvdump(pa);
- continue;
-ok:
-#endif
- pte = (int *)(pv->pv_va + NBPG);
- while (--pte >= (int *)pv->pv_va && *pte == PG_NV)
- ;
- if (pte >= (int *)pv->pv_va)
- continue;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_PTPAGE|PDB_COLLECT)) {
- printf("collect: freeing KPT page at %x (ste %x@%x)\n",
- pv->pv_va, *(int *)pv->pv_ptste, pv->pv_ptste);
- opmapdebug = pmapdebug;
- pmapdebug |= PDB_PTPAGE;
- }
-
- ste = (int *)pv->pv_ptste;
-#endif
- /*
- * If all entries were invalid we can remove the page.
- * We call pmap_remove to take care of invalidating ST
- * and Sysptmap entries.
- */
- kpa = pmap_extract(pmap, pv->pv_va);
- pmap_remove(pmap, pv->pv_va, pv->pv_va + NBPG);
- /*
- * Use the physical address to locate the original
- * (kmem_alloc assigned) address for the page and put
- * that page back on the free list.
- */
- for (pkpt = &kpt_used_list, kpt = *pkpt;
- kpt != (struct kpt_page *)0;
- pkpt = &kpt->kpt_next, kpt = *pkpt)
- if (kpt->kpt_pa == kpa)
- break;
-#ifdef DEBUG
- if (kpt == (struct kpt_page *)0)
- panic("pmap_collect: lost a KPT page");
- if (pmapdebug & (PDB_PTPAGE|PDB_COLLECT))
- printf("collect: %x (%x) to free list\n",
- kpt->kpt_va, kpa);
-#endif
- *pkpt = kpt->kpt_next;
- kpt->kpt_next = kpt_free_list;
- kpt_free_list = kpt;
-#ifdef DEBUG
- kpt_stats.kptinuse--;
- kpt_stats.collectpages++;
- if (pmapdebug & (PDB_PTPAGE|PDB_COLLECT))
- pmapdebug = opmapdebug;
-
- if (*ste)
- printf("collect: kernel STE at %x still valid (%x)\n",
- ste, *ste);
- ste = (int *)&Sysptmap[(u_int *)ste-pmap_ste(pmap_kernel(), 0)];
- if (*ste)
- printf("collect: kernel PTmap at %x still valid (%x)\n",
- ste, *ste);
-#endif
- }
- splx(s);
-}
-
-void
-pmap_activate(pmap, pcbp)
- register pmap_t pmap;
- struct pcb *pcbp;
-{
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_SEGTAB))
- printf("pmap_activate(%x, %x)\n", pmap, pcbp);
-#endif
- PMAP_ACTIVATE(pmap, pcbp, pmap == curproc->p_vmspace->vm_map.pmap);
-}
-
-/*
- * pmap_zero_page zeros the specified (machine independent)
- * page by mapping the page into virtual memory and using
- * bzero to clear its contents, one machine dependent page
- * at a time.
- */
-void
-pmap_zero_page(phys)
- register vm_offset_t phys;
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_zero_page(%x)\n", phys);
-#endif
- phys >>= PG_SHIFT;
- clearseg(phys);
-}
-
-/*
- * pmap_copy_page copies the specified (machine independent)
- * page by mapping the page into virtual memory and using
- * bcopy to copy the page, one machine dependent page at a
- * time.
- */
-void
-pmap_copy_page(src, dst)
- register vm_offset_t src, dst;
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_copy_page(%x, %x)\n", src, dst);
-#endif
- src >>= PG_SHIFT;
- dst >>= PG_SHIFT;
- physcopyseg(src, dst);
-}
-
-
-/*
- * Routine: pmap_pageable
- * Function:
- * Make the specified pages (by pmap, offset)
- * pageable (or not) as requested.
- *
- * A page which is not pageable may not take
- * a fault; therefore, its page table entry
- * must remain valid for the duration.
- *
- * This routine is merely advisory; pmap_enter
- * will specify that these pages are to be wired
- * down (or not) as appropriate.
- */
-void
-pmap_pageable(pmap, sva, eva, pageable)
- pmap_t pmap;
- vm_offset_t sva, eva;
- boolean_t pageable;
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_pageable(%x, %x, %x, %x)\n",
- pmap, sva, eva, pageable);
-#endif
- /*
- * If we are making a PT page pageable then all valid
- * mappings must be gone from that page. Hence it should
- * be all zeros and there is no need to clean it.
- * Assumptions:
- * - we are called with only one page at a time
- * - PT pages have only one pv_table entry
- */
- if (pmap == pmap_kernel() && pageable && sva + PAGE_SIZE == eva) {
- register pv_entry_t pv;
- register vm_offset_t pa;
-
-#ifdef DEBUG
- if ((pmapdebug & (PDB_FOLLOW|PDB_PTPAGE)) == PDB_PTPAGE)
- printf("pmap_pageable(%x, %x, %x, %x)\n",
- pmap, sva, eva, pageable);
-#endif
- if (!pmap_ste_v(pmap_ste(pmap, sva)))
- return;
- pa = pmap_pte_pa(pmap_pte(pmap, sva));
- if (!pmap_valid_page(pa))
- return;
- pv = pa_to_pvh(pa);
- if (pv->pv_ptste == NULL)
- return;
-#ifdef DEBUG
- if (pv->pv_va != sva || pv->pv_next) {
- printf("pmap_pageable: bad PT page va %x next %x\n",
- pv->pv_va, pv->pv_next);
- return;
- }
-#endif
- /*
- * Mark it unmodified to avoid pageout
- */
- pmap_changebit(pa, PG_M, FALSE);
-#ifdef DEBUG
- if (pmapdebug & PDB_PTPAGE)
- printf("pmap_pageable: PT page %x(%x) unmodified\n",
- sva, *(int *)pmap_pte(pmap, sva));
- if (pmapdebug & PDB_WIRING)
- pmap_check_wiring("pageable", sva);
-#endif
- }
-}
-
-/*
- * Clear the modify bits on the specified physical page.
- */
-
-void
-pmap_clear_modify(pa)
- vm_offset_t pa;
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_clear_modify(%x)\n", pa);
-#endif
- pmap_changebit(pa, PG_M, FALSE);
-}
-
-/*
- * pmap_clear_reference:
- *
- * Clear the reference bit on the specified physical page.
- */
-
-void pmap_clear_reference(pa)
- vm_offset_t pa;
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_clear_reference(%x)\n", pa);
-#endif
- pmap_changebit(pa, PG_U, FALSE);
-}
-
-/*
- * pmap_is_referenced:
- *
- * Return whether or not the specified physical page is referenced
- * by any physical maps.
- */
-
-boolean_t
-pmap_is_referenced(pa)
- vm_offset_t pa;
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW) {
- boolean_t rv = pmap_testbit(pa, PG_U);
- printf("pmap_is_referenced(%x) -> %c\n", pa, "FT"[rv]);
- return(rv);
- }
-#endif
- return(pmap_testbit(pa, PG_U));
-}
-
-/*
- * pmap_is_modified:
- *
- * Return whether or not the specified physical page is modified
- * by any physical maps.
- */
-
-boolean_t
-pmap_is_modified(pa)
- vm_offset_t pa;
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW) {
- boolean_t rv = pmap_testbit(pa, PG_M);
- printf("pmap_is_modified(%x) -> %c\n", pa, "FT"[rv]);
- return(rv);
- }
-#endif
- return(pmap_testbit(pa, PG_M));
-}
-
-vm_offset_t
-pmap_phys_address(ppn)
- int ppn;
-{
- return(atari_ptob(ppn));
-}
-
-/*
- * Miscellaneous support routines follow
- */
-
-/* static */
-atari_protection_init()
-{
- register int *kp, prot;
-
- kp = protection_codes;
- for (prot = 0; prot < 8; prot++) {
- switch (prot) {
- case VM_PROT_NONE | VM_PROT_NONE | VM_PROT_NONE:
- *kp++ = 0;
- break;
- case VM_PROT_READ | VM_PROT_NONE | VM_PROT_NONE:
- case VM_PROT_READ | VM_PROT_NONE | VM_PROT_EXECUTE:
- case VM_PROT_NONE | VM_PROT_NONE | VM_PROT_EXECUTE:
- *kp++ = PG_RO;
- break;
- case VM_PROT_NONE | VM_PROT_WRITE | VM_PROT_NONE:
- case VM_PROT_NONE | VM_PROT_WRITE | VM_PROT_EXECUTE:
- case VM_PROT_READ | VM_PROT_WRITE | VM_PROT_NONE:
- case VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE:
- *kp++ = PG_RW;
- break;
- }
- }
-}
-
-/* static */
-boolean_t
-pmap_testbit(pa, bit)
- register vm_offset_t pa;
- int bit;
-{
- register pv_entry_t pv;
- register int *pte;
- int s;
-
- if (!pmap_valid_page(pa))
- return(FALSE);
-
- pv = pa_to_pvh(pa);
- s = splimp();
- /*
- * Check saved info first
- */
- if (pmap_attributes[pa_index(pa)] & bit) {
- splx(s);
- return(TRUE);
- }
- /*
- * Not found, check current mappings returning
- * immediately if found.
- */
- if (pv->pv_pmap != NULL) {
- for (; pv; pv = pv->pv_next) {
- pte = (int *) pmap_pte(pv->pv_pmap, pv->pv_va);
- if (*pte & bit) {
- splx(s);
- return(TRUE);
- }
- }
- }
- splx(s);
- return(FALSE);
-}
-
-/* static */
-pmap_changebit(pa, bit, setem)
- register vm_offset_t pa;
- int bit;
- boolean_t setem;
-{
- register pv_entry_t pv;
- register int *pte, npte;
- vm_offset_t va;
- boolean_t firstpage;
- int s;
-
- firstpage = TRUE;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_BITS)
- printf("pmap_changebit(%x, %x, %s)\n",
- pa, bit, setem ? "set" : "clear");
-#endif
- if (!pmap_valid_page(pa))
- return;
-
- pv = pa_to_pvh(pa);
- s = splimp();
- /*
- * Clear saved attributes (modify, reference)
- */
- if (!setem)
- pmap_attributes[pa_index(pa)] &= ~bit;
- /*
- * Loop over all current mappings setting/clearing as appropos
- * If setting RO do we need to clear the VAC?
- */
- if (pv->pv_pmap == NULL) {
- splx(s);
- return;
- }
- for (; pv; pv = pv->pv_next) {
- va = pv->pv_va;
-
- /*
- * XXX don't write protect pager mappings
- */
- if (bit == PG_RO) {
- extern vm_offset_t pager_sva, pager_eva;
-
- if (va >= pager_sva && va < pager_eva)
- continue;
- }
-
- pte = (int *) pmap_pte(pv->pv_pmap, va);
- if (setem)
- npte = *pte | bit;
- else
- npte = *pte & ~bit;
- if (*pte != npte) {
- /*
- * If we are changing caching status or
- * protection make sure the caches are
- * flushed (but only once).
- */
-#ifdef M68040
- if (firstpage && cpu040 &&
- (bit == PG_RO && setem || (bit & PG_CMASK))) {
- firstpage = FALSE;
- DCFP(pa);
- ICPP(pa);
- }
-#endif
- *pte = npte;
- if (active_pmap(pv->pv_pmap))
- TBIS(va);
- }
- }
- splx(s);
-}
-
-/* static */
-void
-pmap_enter_ptpage(pmap, va)
- register pmap_t pmap;
- register vm_offset_t va;
-{
- register vm_offset_t ptpa;
- register pv_entry_t pv;
- u_int *ste;
- int s;
- u_int sg_proto, *sg;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_ENTER|PDB_PTPAGE))
- printf("pmap_enter_ptpage: pmap %x, va %x\n", pmap, va);
- enter_stats.ptpneeded++;
-#endif
- /*
- * Allocate a segment table if necessary. Note that it is allocated
- * from kernel_map and not pt_map. This keeps user page tables
- * aligned on segment boundaries in the kernel address space.
- * The segment table is wired down. It will be freed whenever the
- * reference count drops to zero.
- */
- if (pmap->pm_stab == Segtabzero) {
-#ifdef M68040
- if (cpu040) {
- pmap->pm_rtab = (u_int *)
- kmem_alloc(kernel_map, ATARI_040RTSIZE);
- pmap->pm_stab = (u_int *)
- kmem_alloc(kernel_map, ATARI_040STSIZE*128);
- /* intialize root table entries */
- sg = (u_int *) pmap->pm_rtab;
- sg_proto = pmap_extract(pmap_kernel(),
- (vm_offset_t) pmap->pm_stab) | SG_RW | SG_V;
-#ifdef DEBUG
- if (pmapdebug & (PDB_ENTER|PDB_PTPAGE))
- printf ("pmap_enter_ptpage: ROOT TABLE SETUP %x %x\n",
- pmap->pm_rtab, sg_proto);
-#endif
- while (sg < (u_int *) ((u_int) pmap->pm_rtab + ATARI_040RTSIZE)) {
- *sg++ = sg_proto;
- sg_proto += ATARI_040STSIZE;
- }
- }
- else
-#endif
- pmap->pm_stab = (u_int *)
- kmem_alloc(kernel_map, ATARI_STSIZE);
- pmap->pm_stchanged = TRUE;
- /*
- * XXX may have changed segment table pointer for current
- * process so update now to reload hardware.
- */
- if (pmap == curproc->p_vmspace->vm_map.pmap)
- PMAP_ACTIVATE(pmap, (struct pcb *)curproc->p_addr, 1);
-#ifdef DEBUG
- if (pmapdebug & (PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB))
- printf("enter: pmap %x stab %x\n",
- pmap, pmap->pm_stab);
-#endif
- }
-
- /*
- * On the 68040, a page will hold 64 page tables, so the segment
- * table will have to have 64 entries set up. First get the ste
- * for the page mapped by the first PT entry.
- */
-#ifdef M68040
- if (cpu040) {
- ste = pmap_ste(pmap, va & ((SG4_MASK1 | SG4_MASK2) << 6));
- va = trunc_page((vm_offset_t)pmap_pte(pmap,
- va & ((SG4_MASK1|SG4_MASK2) << 6)));
- } else
-#endif
- {
- ste = pmap_ste(pmap, va);
- va = trunc_page((vm_offset_t)pmap_pte(pmap, va));
- }
-
- /*
- * In the kernel we allocate a page from the kernel PT page
- * free list and map it into the kernel page table map (via
- * pmap_enter).
- */
- if (pmap == pmap_kernel()) {
- register struct kpt_page *kpt;
-
- s = splimp();
- if ((kpt = kpt_free_list) == (struct kpt_page *)0) {
- /*
- * No PT pages available.
- * Try once to free up unused ones.
- */
-#ifdef DEBUG
- if (pmapdebug & PDB_COLLECT)
- printf("enter: no KPT pages, collecting...\n");
-#endif
- pmap_collect(pmap_kernel());
- if ((kpt = kpt_free_list) == (struct kpt_page *)0)
- panic("pmap_enter_ptpage: can't get KPT page");
- }
-#ifdef DEBUG
- if (++kpt_stats.kptinuse > kpt_stats.kptmaxuse)
- kpt_stats.kptmaxuse = kpt_stats.kptinuse;
-#endif
- kpt_free_list = kpt->kpt_next;
- kpt->kpt_next = kpt_used_list;
- kpt_used_list = kpt;
- ptpa = kpt->kpt_pa;
- bzero(kpt->kpt_va, NBPG);
- pmap_enter(pmap, va, ptpa, VM_PROT_DEFAULT, TRUE);
-#ifdef DEBUG
- if (pmapdebug & (PDB_ENTER|PDB_PTPAGE))
- printf("enter: add &Sysptmap[%d]: %x (KPT page %x)\n",
- ste - pmap_ste(pmap, 0),
- *(int *)&Sysptmap[ste - pmap_ste(pmap, 0)],
- kpt->kpt_va);
-#endif
- splx(s);
- }
- /*
- * For user processes we just simulate a fault on that location
- * letting the VM system allocate a zero-filled page.
- */
- else {
- /*
- * Count the segment table reference now so that we won't
- * lose the segment table when low on memory.
- */
- pmap->pm_sref++;
-#ifdef DEBUG
- if (pmapdebug & (PDB_ENTER|PDB_PTPAGE))
- printf("enter: about to fault UPT pg at %x\n", va);
-#endif
- if (vm_fault(pt_map, va, VM_PROT_READ|VM_PROT_WRITE, FALSE)
- != KERN_SUCCESS)
- panic("pmap_enter: vm_fault failed");
- ptpa = pmap_extract(pmap_kernel(), va);
-#ifdef DEBUG
- PHYS_TO_VM_PAGE(ptpa)->flags |= PG_PTPAGE;
-#endif
- }
-
- /*
- * Locate the PV entry in the kernel for this PT page and
- * record the STE address. This is so that we can invalidate
- * the STE when we remove the mapping for the page.
- */
- pv = pa_to_pvh(ptpa);
- s = splimp();
- if (pv) {
- pv->pv_flags |= PV_PTPAGE;
- do {
- if (pv->pv_pmap == pmap_kernel() && pv->pv_va == va)
- break;
- } while (pv = pv->pv_next);
- }
-#ifdef DEBUG
- if (pv == NULL)
- panic("pmap_enter_ptpage: PT page not entered");
-#endif
- pv->pv_ptste = ste;
- pv->pv_ptpmap = pmap;
-#ifdef DEBUG
- if (pmapdebug & (PDB_ENTER|PDB_PTPAGE))
- printf("enter: new PT page at PA %x, ste at %x\n", ptpa, ste);
-#endif
-
- /*
- * Map the new PT page into the segment table.
- * Also increment the reference count on the segment table if this
- * was a user page table page. Note that we don't use vm_map_pageable
- * to keep the count like we do for PT pages, this is mostly because
- * it would be difficult to identify ST pages in pmap_pageable to
- * release them. We also avoid the overhead of vm_map_pageable.
- */
-#ifdef M68040
- if (cpu040) {
- /* 68040 has 64 page tables, so we have to map all 64 */
- sg = (u_int *) ste;
- sg_proto = (ptpa & SG_FRAME) | SG_RW | SG_V;
- while (sg < (u_int *) (ste + 64)) {
- *sg++ = sg_proto;
- sg_proto += ATARI_040PTSIZE;
- }
- }
- else
-#endif
- *(int *)ste = (ptpa & SG_FRAME) | SG_RW | SG_V;
- if (pmap != pmap_kernel()) {
-#ifdef DEBUG
- if (pmapdebug & (PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB))
- printf("enter: stab %x refcnt %d\n",
- pmap->pm_stab, pmap->pm_sref);
-#endif
- }
- /*
- * Flush stale TLB info.
- */
- if (pmap == pmap_kernel())
- TBIAS();
- else
- TBIAU();
- pmap->pm_ptpages++;
- splx(s);
-}
-
-int
-pmap_isvalidphys(pa)
-vm_offset_t pa;
-{
- struct physeg *sep = &phys_segs[0];
-
- while (sep->start) {
- if (pa >= sep->start && pa < sep->end)
- return(TRUE);
- ++sep;
- }
- return(FALSE);
-}
-
-#ifdef DEBUG
-pmap_pvdump(pa)
- vm_offset_t pa;
-{
- register pv_entry_t pv;
-
- printf("pa %x", pa);
- for (pv = pa_to_pvh(pa); pv; pv = pv->pv_next)
- printf(" -> pmap %x, va %x, ptste %x, ptpmap %x, flags %x",
- pv->pv_pmap, pv->pv_va, pv->pv_ptste, pv->pv_ptpmap,
- pv->pv_flags);
- printf("\n");
-}
-
-pmap_check_wiring(str, va)
- char *str;
- vm_offset_t va;
-{
- vm_map_entry_t entry;
- register int count, *pte;
-
- va = trunc_page(va);
- if (!pmap_ste_v(pmap_ste(pmap_kernel(), va)) ||
- !pmap_pte_v(pmap_pte(pmap_kernel(), va)))
- return;
-
- if (!vm_map_lookup_entry(pt_map, va, &entry)) {
- printf("wired_check: entry for %x not found\n", va);
- return;
- }
- count = 0;
- for (pte = (int *)va; pte < (int *)(va+PAGE_SIZE); pte++)
- if (*pte)
- count++;
- if (entry->wired_count != count)
- printf("*%s*: %x: w%d/a%d\n",
- str, va, entry->wired_count, count);
-}
-#endif
diff --git a/sys/arch/atari/atari/swapgeneric.c b/sys/arch/atari/atari/swapgeneric.c
deleted file mode 100644
index 76a148dbed6..00000000000
--- a/sys/arch/atari/atari/swapgeneric.c
+++ /dev/null
@@ -1,308 +0,0 @@
-/* $NetBSD: swapgeneric.c,v 1.3 1996/01/07 22:02:02 thorpej Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman
- * Copyright (c) 1982, 1986 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/buf.h>
-#include <sys/reboot.h>
-#include <sys/device.h>
-#include <machine/disklabel.h>
-#include <sys/disklabel.h>
-#include <sys/fcntl.h> /* XXXX and all that uses it */
-#include <sys/proc.h> /* XXXX and all that uses it */
-#include <sys/disk.h>
-
-#include "ramd.h"
-#include "fd.h"
-#include "sd.h"
-#include "cd.h"
-
-/*
- * Only boot on ufs. (XXX?)
- */
-int ffs_mountroot();
-int (*mountroot)() = ffs_mountroot;
-
-/*
- * Generic configuration; all in one
- */
-dev_t rootdev = NODEV;
-dev_t dumpdev = NODEV;
-
-struct swdevt swdevt[] = {
- { NODEV, 1, 0 },
- { NODEV, 0, 0 },
-};
-
-#if NFD > 0
-extern struct cfdriver fdcd;
-#endif
-#if NRAMD > 0
-extern struct cfdriver ramdcd;
-#endif
-#if NSD > 0
-extern struct cfdriver sdcd;
-#endif
-#if NCD > 0
-extern struct cfdriver cdcd;
-#endif
-
-struct genericconf {
- struct cfdriver *gc_driver;
- dev_t gc_root;
-};
-
-/*
- * the system will assign rootdev to the first partition 'a'
- * found with FS_BSDFFS fstype. so these should be ordered
- * in preference of boot.
- */
-static struct genericconf genericconf[] = {
-#if NRAMD > 0
- {&ramdcd,makedev(1, 0)},
-#endif
-#if NFD > 0
- {&fdcd, makedev(2, 0)},
-#endif
-#if NSD > 0
- {&sdcd, makedev(4, 0)},
-#endif
-#if NCD > 0
- {&cdcd, makedev(6, 0)},
-#endif
- { 0 },
-};
-
-static void gets __P((char *));
-static struct genericconf *getgenconf __P((char *));
-static struct genericconf *guess_gc __P((int, int *));
-
-
-static struct genericconf *
-getgenconf(bp)
-char *bp;
-{
- char *cp;
- struct genericconf *gc;
-
- for(;;) {
- printf("format: <dev-name><unit> [ ':'<part> ] [ * ]\n");
- printf("root device> ");
- gets(bp);
- for (gc = genericconf; gc->gc_driver; gc++)
- if (gc->gc_driver->cd_name[0] == bp[0] &&
- gc->gc_driver->cd_name[1] == bp[1])
- break;
- if (gc->gc_driver == NULL) {
- printf("use one of:");
- for (gc = genericconf; gc->gc_driver; gc++)
- printf(" %s%%d", gc->gc_driver->cd_name);
- printf("\n");
- continue;
- }
- cp = bp + 2;
- if (*cp >= '0' && *cp <= '9')
- break;
- printf("bad/missing unit number\n");
- }
- return (gc);
-}
-
-setconf()
-{
- struct genericconf *gc;
- int unit, swaponroot, part;
- char name[128];
- char *cp;
-
- swaponroot = 0;
- part = 0;
- unit = 0;
-
- if (rootdev != NODEV)
- goto justdoswap;
-
- if (boothowto & RB_ASKNAME) {
- gc = getgenconf(name);
- cp = name + 2;
-
- /*
- * Get unit number
- */
- while (*cp >= '0' && *cp <= '9')
- unit = 10 * unit + *cp++ - '0';
-
- /*
- * And maybe partition...
- * This is only usefull when booting from floppy. So it is
- * possible to select the correct density.
- */
- if (*cp == ':') {
- cp++;
- while (*cp >= '0' && *cp <= '9')
- part = 10 * part + *cp++ - '0';
- }
-
- if (*cp == '*')
- swaponroot = 1;
- unit &= 0x7;
- }
- else {
- gc = guess_gc(1, &unit);
-
- if (gc == NULL) {
- printf("no suitable root\n");
- asm("stop #0x2700");
- }
- /*NOTREACHED*/
- }
-
- gc->gc_root = MAKEDISKDEV(major(gc->gc_root), unit, part);
- rootdev = gc->gc_root;
-
-
-justdoswap:
- if (!swaponroot) {
- /* Find a suitable swap device */
- if ((gc = guess_gc(0, &unit)) == NULL) {
- swdevt[0].sw_dev = dumpdev =
- MAKEDISKDEV(major(rootdev),DISKUNIT(rootdev),1);
- }
- else {
- swdevt[0].sw_dev = dumpdev =
- MAKEDISKDEV(major(gc->gc_root),unit,1);
- }
- }
-
- /* swap size and dumplo set during autoconfigure */
- if (swaponroot)
- rootdev = dumpdev;
-}
-
-static void
-gets(cp)
-char *cp;
-{
- register char *lp;
- register int c;
-
- lp = cp;
- for (;;) {
- cnputc(c = cngetc());
- switch (c) {
- case '\n':
- case '\r':
- *lp = 0;
- return;
- case '\b':
- case '\177':
- if (lp > cp) {
- lp--;
- cnputc(' ');
- cnputc('\b');
- }
- continue;
- case '#':
- lp--;
- if (lp < cp)
- lp = cp;
- continue;
- case '@':
- case 'u'&037:
- lp = cp;
- cnputc('\n');
- continue;
- default:
- *lp++ = c;
- }
- }
-}
-
-static struct genericconf *
-guess_gc(search_root, rv_unit)
-int search_root;
-int *rv_unit;
-{
- struct genericconf *gc;
- struct partition *pp;
- struct disk *dkp;
- struct device **devpp;
- struct bdevsw *bdp;
- int unit;
-
- for (gc = genericconf; gc->gc_driver; gc++) {
- for (unit = 0; unit < gc->gc_driver->cd_ndevs; unit++) {
- if (gc->gc_driver->cd_devs[unit] == NULL)
- continue;
-
- /*
- * Find the disk corresponding to the current
- * device.
- */
- devpp = (struct device **)gc->gc_driver->cd_devs;
- if ((dkp = disk_find(devpp[unit]->dv_xname)) == NULL)
- continue;
-
- if ((dkp->dk_driver == NULL) ||
- (dkp->dk_driver->d_strategy == NULL))
- continue;
- for (bdp = bdevsw; bdp < (bdevsw + nblkdev); bdp++)
- if (bdp->d_strategy == dkp->dk_driver->d_strategy)
- break;
- if (bdp->d_open(MAKEDISKDEV(major(gc->gc_root),
- unit, 3), FREAD | FNONBLOCK, 0, curproc))
- continue;
- bdp->d_close(MAKEDISKDEV(major(gc->gc_root), unit, 3),
- FREAD | FNONBLOCK, 0, curproc);
- if (search_root) {
- pp = &dkp->dk_label->d_partitions[0];
- if (pp->p_size == 0 || pp->p_fstype != FS_BSDFFS)
- continue;
- }
- else { /* must be swap */
- pp = &dkp->dk_label->d_partitions[1];
- if (pp->p_size == 0 || pp->p_fstype != FS_SWAP)
- continue;
- }
- goto found;
- }
- }
- return (NULL);
-found:
- *rv_unit = unit;
- return (gc);
-}
diff --git a/sys/arch/atari/atari/sys_machdep.c b/sys/arch/atari/atari/sys_machdep.c
deleted file mode 100644
index ca838cd5494..00000000000
--- a/sys/arch/atari/atari/sys_machdep.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/* $NetBSD: sys_machdep.c,v 1.4 1995/12/03 14:34:24 leo Exp $ */
-
-/*
- * Copyright (c) 1982, 1986 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)sys_machdep.c 7.7 (Berkeley) 5/7/91
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/file.h>
-#include <sys/time.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/uio.h>
-#include <sys/kernel.h>
-#include <sys/mtio.h>
-#include <sys/buf.h>
-
-#include <sys/mount.h>
-#include <sys/syscallargs.h>
-
-#include <vm/vm.h>
-
-#include <machine/cpu.h>
-
-/* XXX should be in an include file somewhere */
-#define CC_PURGE 1
-#define CC_FLUSH 2
-#define CC_IPURGE 4
-#define CC_EXTPURGE 0x80000000
-/* XXX end should be */
-
-/*ARGSUSED1*/
-cachectl(req, addr, len)
- int req;
- caddr_t addr;
- int len;
-{
- int error = 0;
-#ifdef M68040
- if (cpu040) {
- register int inc = 0;
- int pa = 0, doall = 0;
- caddr_t end;
-
- if (addr == 0 ||
- (req & ~CC_EXTPURGE) != CC_PURGE && len > 2*NBPG)
- doall = 1;
- if (!doall) {
- end = addr + len;
- if (len <= 1024) {
- addr = (caddr_t)((int)addr & ~0xF);
- inc = 16;
- } else {
- addr = (caddr_t)((int)addr & ~PGOFSET);
- inc = NBPG;
- }
- }
- do {
- /*
- * Convert to physical address if needed.
- * If translation fails, we perform operation on
- * entire cache (XXX is this a rational thing to do?)
- */
- if (!doall &&
- (pa == 0 || ((int)addr & PGOFSET) == 0)) {
- pa = pmap_extract(&curproc->p_vmspace->vm_pmap,
- (vm_offset_t)addr);
- if (pa == 0)
- doall = 1;
- }
- switch (req) {
- case CC_EXTPURGE|CC_IPURGE:
- case CC_IPURGE:
- if (doall) {
- DCFA();
- ICPA();
- } else if (inc == 16) {
- DCFL(pa);
- ICPL(pa);
- } else if (inc == NBPG) {
- DCFP(pa);
- ICPP(pa);
- }
- break;
-
- case CC_EXTPURGE|CC_PURGE:
- case CC_PURGE:
- if (doall)
- DCFA(); /* note: flush not purge */
- else if (inc == 16)
- DCPL(pa);
- else if (inc == NBPG)
- DCPP(pa);
- break;
-
- case CC_EXTPURGE|CC_FLUSH:
- case CC_FLUSH:
- if (doall)
- DCFA();
- else if (inc == 16)
- DCFL(pa);
- else if (inc == NBPG)
- DCFP(pa);
- break;
-
- default:
- error = EINVAL;
- break;
- }
- if (doall)
- break;
- pa += inc;
- addr += inc;
- } while (addr < end);
- return(error);
- }
-#endif /* M68040 */
-
- switch (req) {
- case CC_EXTPURGE|CC_PURGE:
- case CC_EXTPURGE|CC_FLUSH:
- case CC_PURGE:
- case CC_FLUSH:
- DCIU();
- break;
- case CC_EXTPURGE|CC_IPURGE:
- DCIU();
- /*FALLTHROUGH*/
- case CC_IPURGE:
- ICIA();
- break;
- default:
- error = EINVAL;
- break;
- }
- return(error);
-}
-
-/*
- * DMA cache control
- */
-
-/*ARGSUSED1*/
-dma_cachectl(addr, len)
- caddr_t addr;
- int len;
-{
-#ifdef M68040
- if (cpu040) {
- register int inc = 0;
- int pa = 0;
- caddr_t end;
-
- end = addr + len;
- if (len <= 1024) {
- addr = (caddr_t)((int)addr & ~0xF);
- inc = 16;
- } else {
- addr = (caddr_t)((int)addr & ~PGOFSET);
- inc = NBPG;
- }
- do {
- /*
- * Convert to physical address.
- */
- if (pa == 0 || ((int)addr & PGOFSET) == 0) {
- pa = kvtop ((vm_offset_t)addr);
- }
- if (inc == 16) {
- DCFL(pa);
- ICPL(pa);
- } else {
- DCFP(pa);
- ICPP(pa);
- }
- pa += inc;
- addr += inc;
- } while (addr < end);
- }
-#endif /* M68040 */
- return(0);
-}
-
-int
-sys_sysarch(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct sys_sysarch_args /* {
- syscallarg(int) op;
- syscallarg(char*)parms;
- } */ *uap = v;
-
- return ENOSYS;
-}
-
diff --git a/sys/arch/atari/atari/trap.c b/sys/arch/atari/atari/trap.c
deleted file mode 100644
index 838d47922f9..00000000000
--- a/sys/arch/atari/atari/trap.c
+++ /dev/null
@@ -1,1000 +0,0 @@
-/* $NetBSD: trap.c,v 1.10 1995/11/30 00:57:42 jtc Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: trap.c 1.32 91/04/06$
- *
- * @(#)trap.c 7.15 (Berkeley) 8/2/91
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/acct.h>
-#include <sys/kernel.h>
-#include <sys/signalvar.h>
-#include <sys/resourcevar.h>
-#include <sys/syslog.h>
-#include <sys/syscall.h>
-#ifdef KTRACE
-#include <sys/ktrace.h>
-#endif
-
-#include <vm/vm.h>
-#include <sys/user.h>
-#include <vm/pmap.h>
-
-#include <machine/psl.h>
-#include <machine/trap.h>
-#include <machine/cpu.h>
-#include <machine/reg.h>
-#include <machine/mtpr.h>
-#include <machine/pte.h>
-
-#ifdef COMPAT_SUNOS
-#include <compat/sunos/sunos_syscall.h>
-extern struct emul emul_sunos;
-#endif
-
-/*
- * XXX Hack until I can figure out what to do about this code's removal
- * from m68k/include/frame.h
- */
-
-/* 68040 fault frame */
-#define SSW_CP 0x8000 /* Continuation - Floating-Point Post*/
-#define SSW_CU 0x4000 /* Continuation - Unimpl. FP */
-#define SSW_CT 0x2000 /* Continuation - Trace */
-#define SSW_CM 0x1000 /* Continuation - MOVEM */
-#define SSW_MA 0x0800 /* Misaligned access */
-#define SSW_ATC 0x0400 /* ATC fault */
-#define SSW_LK 0x0200 /* Locked transfer */
-#define SSW_RW040 0x0100 /* Read/Write */
-#define SSW_SZMASK 0x0060 /* Transfer size */
-#define SSW_TTMASK 0x0018 /* Transfer type */
-#define SSW_TMMASK 0x0007 /* Transfer modifier */
-
-#define WBS_TMMASK 0x0007
-#define WBS_TTMASK 0x0018
-#define WBS_SZMASK 0x0060
-#define WBS_VALID 0x0080
-
-#define WBS_SIZE_BYTE 0x0020
-#define WBS_SIZE_WORD 0x0040
-#define WBS_SIZE_LONG 0x0000
-#define WBS_SIZE_LINE 0x0060
-
-#define WBS_TT_NORMAL 0x0000
-#define WBS_TT_MOVE16 0x0008
-#define WBS_TT_ALTFC 0x0010
-#define WBS_TT_ACK 0x0018
-
-#define WBS_TM_PUSH 0x0000
-#define WBS_TM_UDATA 0x0001
-#define WBS_TM_UCODE 0x0002
-#define WBS_TM_MMUTD 0x0003
-#define WBS_TM_MMUTC 0x0004
-#define WBS_TM_SDATA 0x0005
-#define WBS_TM_SCODE 0x0006
-#define WBS_TM_RESV 0x0007
-
-#define MMUSR_PA_MASK 0xfffff000
-#define MMUSR_B 0x00000800
-#define MMUSR_G 0x00000400
-#define MMUSR_U1 0x00000200
-#define MMUSR_U0 0x00000100
-#define MMUSR_S 0x00000080
-#define MMUSR_CM 0x00000060
-#define MMUSR_M 0x00000010
-#define MMUSR_0 0x00000008
-#define MMUSR_W 0x00000004
-#define MMUSR_T 0x00000002
-#define MMUSR_R 0x00000001
-/*
- * XXX End hack
- */
-char *trap_type[] = {
- "Bus error",
- "Address error",
- "Illegal instruction",
- "Zero divide",
- "CHK instruction",
- "TRAPV instruction",
- "Privilege violation",
- "Trace trap",
- "MMU fault",
- "SSIR trap",
- "Format error",
- "68881 exception",
- "Coprocessor violation",
- "Async system trap"
-};
-int trap_types = sizeof trap_type / sizeof trap_type[0];
-
-/*
- * Size of various exception stack frames (minus the standard 8 bytes)
- */
-short exframesize[] = {
- FMT0SIZE, /* type 0 - normal (68020/030/040) */
- FMT1SIZE, /* type 1 - throwaway (68020/030/040) */
- FMT2SIZE, /* type 2 - normal 6-word (68020/030/040) */
- FMT3SIZE, /* type 3 - FP post-instruction (68040) */
- -1, -1, -1, /* type 4-6 - undefined */
- FMT7SIZE, /* type 7 - access error (68040) */
- 58, /* type 8 - bus fault (68010) */
- FMT9SIZE, /* type 9 - coprocessor mid-instruction (68020/030) */
- FMTASIZE, /* type A - short bus fault (68020/030) */
- FMTBSIZE, /* type B - long bus fault (68020/030) */
- -1, -1, -1, -1 /* type C-F - undefined */
-};
-
-#ifdef DEBUG
-int mmudebug = 0;
-#endif
-
-extern struct pcb *curpcb;
-int fubail();
-int subail();
-
-static void
-userret(p, pc, oticks)
- struct proc *p;
- int pc;
- u_quad_t oticks;
-{
- int sig, s;
-
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
-
- p->p_priority = p->p_usrpri;
-
- if (want_resched) {
- /*
- * Since we are curproc, clock will normally just change
- * our priority without moving us from one queue to another
- * (since the running process is not on a queue.)
- * If that happened after we setrunqueue ourselves but before
- * we switch'ed, we might not be on the queue indicated by
- * our priority.
- */
- s = splstatclock();
- setrunqueue(p);
- p->p_stats->p_ru.ru_nivcsw++;
- mi_switch();
- splx(s);
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
- }
- /*
- * If profiling, charge recent system time.
- */
- if (p->p_flag & P_PROFIL) {
- extern int psratio;
-
- addupc_task(p, pc, (int)(p->p_sticks - oticks) * psratio);
- }
- curpriority = p->p_priority;
-}
-
-void
-panictrap(type, code, v, fp)
- int type;
- u_int code, v;
- struct frame *fp;
-{
- static int panicing = 0;
- if (panicing++ == 0) {
- printf("trap type %d, code = %x, v = %x\n", type, code, v);
- regdump(fp, 128);
- }
- type &= ~T_USER;
- DCIS(); /* XXX? push cache */
- if ((u_int)type < trap_types)
- panic(trap_type[type]);
- panic("trap");
- /*NOTREACHED*/
-}
-
-/*
- * return to fault handler
- */
-void
-trapcpfault(p, fp)
- struct proc *p;
- struct frame *fp;
-{
- /*
- * We have arranged to catch this fault in one of the
- * copy to/from user space routines, set PC to return to
- * indicated location and set flag informing buserror code
- * that it may need to clean up stack frame.
- */
- fp->f_stackadj = exframesize[fp->f_format];
- fp->f_format = fp->f_vector = 0;
- fp->f_pc = (int) p->p_addr->u_pcb.pcb_onfault;
-}
-
-void
-trapmmufault(type, code, v, fp, p, sticks)
- int type;
- u_int code, v;
- struct frame *fp;
- struct proc *p;
- u_quad_t sticks;
-{
- extern vm_map_t kernel_map;
- struct vmspace *vm;
- vm_prot_t ftype;
- vm_offset_t va;
- vm_map_t map;
- u_int nss;
- int rv;
-
- vm = p->p_vmspace;
-
- /*
- * It is only a kernel address space fault iff:
- * 1. (type & T_USER) == 0 and
- * 2. pcb_onfault not set or
- * 3. pcb_onfault set but supervisor space data fault
- * The last can occur during an exec() copyin where the
- * argument space is lazy-allocated.
- */
-#ifdef DEBUG
- /*
- * Print out some data about the fault
- */
- if (mmudebug && cpu040) {
- printf ("68040 access error: pc %x, code %x,"
- " ea %x, fa %x\n", fp->f_pc, code, fp->f_fmt7.f_ea, v);
- if (curpcb)
- printf (" curpcb %x ->pcb_ustp %x / %x\n",
- curpcb, curpcb->pcb_ustp,
- curpcb->pcb_ustp << PG_SHIFT);
- }
-#endif
- if (type == T_MMUFLT &&
- (p->p_addr->u_pcb.pcb_onfault == 0 ||
- (cpu040 && (code & SSW_TMMASK) == FC_SUPERD) ||
- (!cpu040 && (code & (SSW_DF|FC_SUPERD)) == (SSW_DF|FC_SUPERD))))
- map = kernel_map;
- else
- map = &vm->vm_map;
- if (
- (cpu040 && (code & SSW_RW040) == 0) ||
- (!cpu040 && (code & (SSW_DF|SSW_RW)) ==
- SSW_DF)) /* what about RMW? */
- ftype = VM_PROT_READ | VM_PROT_WRITE;
- else
- ftype = VM_PROT_READ;
- va = trunc_page((vm_offset_t)v);
-#ifdef DEBUG
- if (map == kernel_map && va == 0) {
- printf("trap: bad kernel access at %x\n", v);
- panictrap(type, code, v, fp);
- }
-#endif
-#ifndef no_386bsd_code
- /*
- * XXX: rude hack to make stack limits "work"
- */
- nss = 0;
- if ((caddr_t)va >= vm->vm_maxsaddr && map != kernel_map) {
- nss = clrnd(btoc(USRSTACK - (unsigned)va));
- if (nss > btoc(p->p_rlimit[RLIMIT_STACK].rlim_cur)) {
- rv = KERN_FAILURE;
- goto nogo;
- }
- }
-#endif
-
-#ifdef DEBUG
- if (mmudebug)
- printf("vm_fault(%x,%x,%d,0)\n", map, va, ftype);
-#endif
-
- rv = vm_fault(map, va, ftype, FALSE);
-
-#ifdef DEBUG
- if (mmudebug)
- printf("vmfault %s %x returned %d\n",
- map == kernel_map ? "kernel" : "user", va, rv);
-#endif
- if (cpu040) {
- if(rv != KERN_SUCCESS) {
- goto nogo;
- }
-
- /*
- * The 68040 doesn't re-run instructions that cause
- * write page faults (unless due to a move16 isntruction).
- * So once the page is repaired, we have to write the
- * value of WB2D out to memory ourselves. Because
- * the writeback could possibly span two pages in
- * memory, so we need to check both "ends" of the
- * address to see if they are in the same page or not.
- * If not, then we need to make sure the second page
- * is valid, and bring it into memory if it's not.
- *
- * This whole process needs to be repeated for WB3 as well.
- * <sigh>
- */
-
- /* Check WB1 */
- if (fp->f_fmt7.f_wb1s & WBS_VALID) {
- printf ("trap: wb1 was valid, not handled yet\n");
- panictrap(type, code, v, fp);
- }
-
- /*
- * Check WB2
- * skip if it's for a move16 instruction
- */
- if(fp->f_fmt7.f_wb2s & WBS_VALID &&
- ((fp->f_fmt7.f_wb2s & WBS_TTMASK)==WBS_TT_MOVE16) == 0) {
- if (_write_back(2, fp->f_fmt7.f_wb2s,
- fp->f_fmt7.f_wb2d, fp->f_fmt7.f_wb2a, map)
- != KERN_SUCCESS)
- goto nogo;
- if ((fp->f_fmt7.f_wb2s & WBS_TMMASK)
- != (code & SSW_TMMASK))
- panictrap(type, code, v, fp);
- }
-
- /* Check WB3 */
- if(fp->f_fmt7.f_wb3s & WBS_VALID) {
- vm_map_t wb3_map;
-
- if ((fp->f_fmt7.f_wb3s & WBS_TMMASK) == WBS_TM_SDATA)
- wb3_map = kernel_map;
- else
- wb3_map = &vm->vm_map;
- if (_write_back(3, fp->f_fmt7.f_wb3s,
- fp->f_fmt7.f_wb3d, fp->f_fmt7.f_wb3a, wb3_map)
- != KERN_SUCCESS)
- goto nogo;
- }
- }
-
-#ifdef no_386bsd_code
- /*
- * If this was a stack access we keep track of the maximum
- * accessed stack size. Also, if vm_fault gets a protection
- * failure it is due to accessing the stack region outside
- * the current limit and we need to reflect that as an access
- * error.
- */
- if ((caddr_t)va >= vm->vm_maxsaddr && map != kernel_map) {
- if (rv == KERN_SUCCESS) {
- nss = clrnd(btoc(USRSTACK-(unsigned)va));
- if (nss > vm->vm_ssize)
- vm->vm_ssize = nss;
- } else if (rv == KERN_PROTECTION_FAILURE)
- rv = KERN_INVALID_ADDRESS;
- }
-
- if (rv == KERN_SUCCESS) {
- if (type == T_MMUFLT)
- return;
- userret(p, fp->f_pc, sticks);
- reutrn;
- }
-#else /* use hacky 386bsd_code */
- if (rv == KERN_SUCCESS) {
- /*
- * XXX: continuation of rude stack hack
- */
- if (nss > vm->vm_ssize)
- vm->vm_ssize = nss;
- if (type == T_MMUFLT)
- return;
- userret(p, fp->f_pc, sticks);
- return;
- }
-nogo:
-#endif
- if (type == T_MMUFLT) {
- if (p->p_addr->u_pcb.pcb_onfault) {
- trapcpfault(p, fp);
- return;
- }
- printf("vm_fault(%x, %x, %x, 0) -> %x\n",
- map, va, ftype, rv);
- printf(" type %x, code [mmu,,ssw]: %x\n",
- type, code);
- panictrap(type, code, v, fp);
- }
- trapsignal(p, SIGSEGV, v);
- if ((type & T_USER) == 0)
- return;
- userret(p, fp->f_pc, sticks);
-}
-/*
- * Trap is called from locore to handle most types of processor traps,
- * including events such as simulated software interrupts/AST's.
- * System calls are broken out for efficiency.
- */
-/*ARGSUSED*/
-trap(type, code, v, frame)
- int type;
- u_int code, v;
- struct frame frame;
-{
- struct proc *p;
- u_int ncode, ucode;
- u_quad_t sticks;
- int i, s;
-#ifdef COMPAT_SUNOS
- extern struct emul emul_sunos;
-#endif
-
- p = curproc;
- ucode = 0;
- cnt.v_trap++;
-
- if (USERMODE(frame.f_sr)) {
- type |= T_USER;
- sticks = p->p_sticks;
- p->p_md.md_regs = frame.f_regs;
- }
-
-#ifdef DDB
- if (type == T_TRACE || type == T_BREAKPOINT) {
- if (kdb_trap(type, &frame))
- return;
- }
-#endif
-
- switch (type) {
- default:
- panictrap(type, code, v, &frame);
- /*
- * Kernel Bus error
- */
- case T_BUSERR:
- if (!p->p_addr->u_pcb.pcb_onfault)
- panictrap(type, code, v, &frame);
- trapcpfault(p, &frame);
- return;
- /*
- * User Bus/Addr error.
- */
- case T_BUSERR|T_USER:
- case T_ADDRERR|T_USER:
- i = SIGBUS;
- break;
- /*
- * User illegal/privleged inst fault
- */
- case T_ILLINST|T_USER:
- case T_PRIVINST|T_USER:
- ucode = frame.f_format; /* XXX was ILL_PRIVIN_FAULT */
- i = SIGILL;
- break;
- /*
- * divde by zero, CHK/TRAPV inst
- */
- case T_ZERODIV|T_USER:
- case T_CHKINST|T_USER:
- case T_TRAPVINST|T_USER:
- ucode = frame.f_format;
- i = SIGFPE;
- break;
- /*
- * User coprocessor violation
- */
- case T_COPERR|T_USER:
- ucode = 0;
- i = SIGFPE; /* XXX What is a proper response here? */
- break;
- /*
- * 6888x exceptions
- */
- case T_FPERR|T_USER:
- /*
- * We pass along the 68881 status register which locore
- * stashed in code for us. Note that there is a
- * possibility that the bit pattern of this register
- * will conflict with one of the FPE_* codes defined
- * in signal.h. Fortunately for us, the only such
- * codes we use are all in the range 1-7 and the low
- * 3 bits of the status register are defined as 0 so
- * there is no clash.
- */
- ucode = code;
- i = SIGFPE;
- break;
- /*
- * FPU faults in supervisor mode.
- */
- case T_FPEMULI:
- case T_FPEMULD: {
- extern int *nofault;
-
- if (nofault) /* If we're probing. */
- longjmp((label_t *) nofault);
- panictrap(type, code, v, &frame);
- }
- /*
- * Unimplemented FPU instructions/datatypes.
- */
- case T_FPEMULI|T_USER:
- case T_FPEMULD|T_USER:
-#ifdef FPU_EMULATE
- i = fpu_emulate(&frame, &p->p_addr->u_pcb.pcb_fpregs);
- /* XXX -- deal with tracing? (frame.f_sr & PSL_T) */
- if (i == 0) {
- userret(p, frame.f_pc, sticks);
- return;
- }
-#else
- uprintf("pid %d killed: no floating point support.\n",
- p->p_pid);
- i = SIGILL;
-#endif
- break;
- /*
- * Kernel coprocessor violation
- */
- case T_COPERR:
- /*FALLTHROUGH*/
- /*
- * Kernel format error
- */
- case T_FMTERR:
- /*
- * The user has most likely trashed the RTE or FP state info
- * in the stack frame of a signal handler.
- */
- type |= T_USER;
-#ifdef DEBUG
- printf("pid %d: kernel %s exception\n", p->p_pid,
- type==T_COPERR ? "coprocessor" : "format");
-#endif
- p->p_sigacts->ps_sigact[SIGILL] = SIG_DFL;
- i = sigmask(SIGILL);
- p->p_sigignore &= ~i;
- p->p_sigcatch &= ~i;
- p->p_sigmask &= ~i;
- i = SIGILL;
- ucode = frame.f_format; /* XXX was ILL_RESAD_FAULT */
- break;
- /*
- * Trace traps.
- *
- * M68k NetBSD uses trap #2,
- * SUN 3.x uses trap #15,
- * KGDB uses trap #15 (for kernel breakpoints; handled elsewhere).
- *
- * Atari traps get mapped by locore.s into T_TRACE.
- * SUN 3.x traps get passed through as T_TRAP15 and are not really
- * supported yet.
- */
- case T_TRACE:
- case T_TRAP15:
- frame.f_sr &= ~PSL_T;
- i = SIGTRAP;
- break;
- case T_TRACE|T_USER:
- case T_TRAP15|T_USER:
-#ifdef COMPAT_SUNOS
- /*
- * SunOS uses Trap #2 for a "CPU cache flush"
- * Just flush the on-chip caches and return.
- * XXX - Too bad m68k BSD uses trap 2...
- */
- if (p->p_emul == &emul_sunos) {
- ICIA();
- DCIU();
- /* get out fast */
- return;
-#endif
- frame.f_sr &= ~PSL_T;
- i = SIGTRAP;
- break;
- /*
- * Kernel AST (should not happen)
- */
- case T_ASTFLT:
- panictrap(type, code, v, &frame);
- /*
- * User AST
- */
- case T_ASTFLT|T_USER:
- astpending = 0;
- /*
- * We check for software interrupts first. This is because
- * they are at a higher level than ASTs, and on a VAX would
- * interrupt the AST. We assume that if we are processing
- * an AST that we must be at IPL0 so we don't bother to
- * check. Note that we ensure that we are at least at SIR
- * IPL while processing the SIR.
- */
- spl1();
- /*FALLTHROUGH*/
- /*
- * Software interrupt
- */
- case T_SSIR:
- case T_SSIR|T_USER:
- if(ssir)
- softint();
- /*
- * If this was not an AST trap, we are all done.
- */
- if (type != (T_ASTFLT|T_USER)) {
- cnt.v_trap--;
- return;
- }
- spl0();
- if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
- ADDUPROF(p);
- }
- userret(p, frame.f_pc, sticks);
- return;
- /*
- * Kernel/User page fault
- */
- case T_MMUFLT:
- if (p->p_addr->u_pcb.pcb_onfault == (caddr_t)fubail ||
- p->p_addr->u_pcb.pcb_onfault == (caddr_t)subail) {
- trapcpfault(p, &frame);
- return;
- }
- /*FALLTHROUGH*/
- case T_MMUFLT|T_USER: /* page fault */
- trapmmufault(type, code, v, &frame, p, sticks);
- return;
- }
-
- trapsignal(p, i, ucode);
- if ((type & T_USER) == 0)
- return;
- userret(p, frame.f_pc, sticks);
-}
-
-/*
- * Process a system call.
- */
-syscall(code, frame)
- register_t code;
- struct frame frame;
-{
- register caddr_t params;
- register struct sysent *callp;
- register struct proc *p;
- int error, opc, nsys;
- size_t argsize;
- register_t args[8], rval[2];
- u_quad_t sticks;
-#ifdef COMPAT_SUNOS
- extern struct emul emul_sunos;
-#endif
-
- cnt.v_syscall++;
- if (!USERMODE(frame.f_sr))
- panic("syscall");
- p = curproc;
- sticks = p->p_sticks;
- p->p_md.md_regs = frame.f_regs;
- opc = frame.f_pc;
-
- nsys = p->p_emul->e_nsysent;
- callp = p->p_emul->e_sysent;
-#ifdef COMPAT_SUNOS
- if (p->p_emul == &emul_sunos) {
-
- /*
- * SunOS passes the syscall-number on the stack, whereas
- * BSD passes it in D0. So, we have to get the real "code"
- * from the stack, and clean up the stack, as SunOS glue
- * code assumes the kernel pops the syscall argument the
- * glue pushed on the stack. Sigh...
- */
- code = fuword((caddr_t)frame.f_regs[SP]);
-
- /*
- * XXX
- * Don't do this for sunos_sigreturn, as there's no stored pc
- * on the stack to skip, the argument follows the syscall
- * number without a gap.
- */
- if (code != SUNOS_SYS_sigreturn) {
- frame.f_regs[SP] += sizeof (int);
- /*
- * remember that we adjusted the SP,
- * might have to undo this if the system call
- * returns ERESTART.
- */
- p->p_md.md_flags |= MDP_STACKADJ;
- } else
- p->p_md.md_flags &= ~MDP_STACKADJ;
- }
-#endif
-
- params = (caddr_t)frame.f_regs[SP] + sizeof(int);
-
- switch (code) {
- case SYS_syscall:
- /*
- * Code is first argument, followed by actual args.
- */
- code = fuword(params);
- params += sizeof(int);
- /*
- * XXX sigreturn requires special stack manipulation
- * that is only done if entered via the sigreturn
- * trap. Cannot allow it here so make sure we fail.
- */
- if (code == SYS_sigreturn)
- code = nsys;
- break;
- case SYS___syscall:
- /*
- * Like syscall, but code is a quad, so as to maintain
- * quad alignment for the rest of the arguments.
- */
- if (callp != sysent)
- break;
- code = fuword(params + _QUAD_LOWWORD * sizeof(int));
- params += sizeof(quad_t);
- break;
- default:
- break;
- }
- if (code < 0 || code >= nsys)
- callp += p->p_emul->e_nosys; /* illegal */
- else
- callp += code;
- argsize = callp->sy_argsize;
- if (argsize)
- error = copyin(params, (caddr_t)args, argsize);
- else
- error = 0;
-#ifdef SYSCALL_DEBUG
- scdebug_call(p, code, args);
-#endif
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSCALL))
- ktrsyscall(p, code, argsize, args);
-#endif
- if (error)
- goto bad;
- rval[0] = 0;
- rval[1] = frame.f_regs[D1];
- error = (*callp->sy_call)(p, args, rval);
- switch (error) {
- case 0:
- /*
- * Reinitialize proc pointer `p' as it may be different
- * if this is a child returning from fork syscall.
- */
- p = curproc;
- frame.f_regs[D0] = rval[0];
- frame.f_regs[D1] = rval[1];
- frame.f_sr &= ~PSL_C; /* carry bit */
- break;
- case ERESTART:
- /*
- * We always enter through a `trap' instruction, which is 2
- * bytes, so adjust the pc by that amount.
- */
- frame.f_pc = opc - 2;
- break;
- case EJUSTRETURN:
- /* nothing to do */
- break;
- default:
- bad:
- frame.f_regs[D0] = error;
- frame.f_sr |= PSL_C; /* carry bit */
- break;
- }
-
-#ifdef SYSCALL_DEBUG
- scdebug_ret(p, code, error, rval);
-#endif
-#ifdef COMPAT_SUNOS
- /* need new p-value for this */
- if (error == ERESTART && (p->p_md.md_flags & MDP_STACKADJ))
- frame.f_regs[SP] -= sizeof (int);
-#endif
- userret(p, frame.f_pc, sticks);
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSRET))
- ktrsysret(p, code, error, rval[0]);
-#endif
-}
-/*
- * Process the tail end of a fork() for the child
- */
-void
-child_return(p, frame)
- struct proc *p;
- struct frame frame;
-{
- frame.f_regs[D0] = 0;
- frame.f_sr &= ~PSL_C; /* carry bit */
-
- userret(p, frame.f_pc, 0);
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSRET))
- ktrsysret(p, SYS_fork, 0, 0);
-#endif
-}
-
-/*
- * Process a pending write back
- */
-_write_back (wb, wb_sts, wb_data, wb_addr, wb_map)
- u_int wb; /* writeback type: 1, 2, or 3 */
- u_int wb_sts; /* writeback status information */
- u_int wb_data; /* data to writeback */
- u_int wb_addr; /* address to writeback to */
- vm_map_t wb_map;
-{
- u_int wb_extra_page = 0;
- u_int wb_rc, mmusr;
- void _wb_fault (); /* fault handler for write back */
-
-#ifdef DEBUG
- if (mmudebug)
- printf("wb%d valid: %x %x %x\n",wb,wb_sts,wb_addr,wb_data);
-#endif
-
- /* See if we're going to span two pages (for word or long transfers) */
-
- if((wb_sts & WBS_SZMASK) == WBS_SIZE_WORD)
- if(trunc_page((vm_offset_t)wb_addr) !=
- trunc_page((vm_offset_t)wb_addr+1))
- wb_extra_page = 1;
-
- if((wb_sts & WBS_SZMASK) == WBS_SIZE_LONG)
- if(trunc_page((vm_offset_t)wb_addr) !=
- trunc_page((vm_offset_t)wb_addr+3))
- wb_extra_page = 3;
-
- /*
- * if it's writeback 3, we need to check the first page
- */
- if (wb == 3) {
- mmusr = probeva(wb_addr, wb_sts & WBS_TMMASK);
-#ifdef DEBUG
- if (mmudebug)
- printf("wb3: probeva(%x,%x) = %x\n",
- wb_addr + wb_extra_page, wb_sts & WBS_TMMASK, mmusr);
-#endif
-
- if((mmusr & (MMUSR_R | MMUSR_W)) != MMUSR_R) {
-#ifdef DEBUG
- if (mmudebug)
- printf("wb3: need to bring in first page\n");
-#endif
- wb_rc = vm_fault(wb_map,
- trunc_page((vm_offset_t)wb_addr),
- VM_PROT_READ | VM_PROT_WRITE, FALSE);
-
- if(wb_rc != KERN_SUCCESS)
- return (wb_rc);
-#ifdef DEBUG
- if (mmudebug)
- printf("wb3: first page brought in.\n");
-#endif
- }
- }
-
- /*
- * now check to see if a second page is required
- */
- if(wb_extra_page) {
-
- mmusr = probeva(wb_addr+wb_extra_page, wb_sts & WBS_TMMASK);
-#ifdef DEBUG
- if (mmudebug)
- printf("wb%d: probeva %x %x = %x\n",
- wb, wb_addr + wb_extra_page,
- wb_sts & WBS_TMMASK,mmusr);
-#endif
-
- if((mmusr & (MMUSR_R | MMUSR_W)) != MMUSR_R) {
-#ifdef DEBUG
- if (mmudebug)
- printf("wb%d: page boundary crossed."
- " Bringing in extra page.\n",wb);
-#endif
-
- wb_rc = vm_fault(wb_map,
- trunc_page((vm_offset_t)wb_addr + wb_extra_page),
- VM_PROT_READ | VM_PROT_WRITE,FALSE);
-
- if(wb_rc != KERN_SUCCESS)
- return (wb_rc);
- }
-#ifdef DEBUG
- if (mmudebug)
- printf("wb%d: extra page brought in okay.\n", wb);
-#endif
- }
-
- /* Actually do the write now */
-
- if ((wb_sts & WBS_TMMASK) == FC_USERD &&
- !curpcb->pcb_onfault) {
- curpcb->pcb_onfault = (caddr_t) _wb_fault;
- }
-
- switch(wb_sts & WBS_SZMASK) {
-
- case WBS_SIZE_BYTE :
- asm volatile ("movec %0,dfc ; movesb %1,%2@" : : "d" (wb_sts & WBS_TMMASK),
- "d" (wb_data),
- "a" (wb_addr));
- break;
-
- case WBS_SIZE_WORD :
- asm volatile ("movec %0,dfc ; movesw %1,%2@" : : "d" (wb_sts & WBS_TMMASK),
- "d" (wb_data),
- "a" (wb_addr));
- break;
-
- case WBS_SIZE_LONG :
- asm volatile ("movec %0,dfc ; movesl %1,%2@" : : "d" (wb_sts & WBS_TMMASK),
- "d" (wb_data),
- "a" (wb_addr));
- break;
-
- }
- if (curpcb->pcb_onfault == (caddr_t) _wb_fault)
- curpcb->pcb_onfault = NULL;
- if ((wb_sts & WBS_TMMASK) != FC_USERD)
- asm volatile ("movec %0,dfc\n" : : "d" (FC_USERD));
- return (KERN_SUCCESS);
-}
-
-/*
- * fault handler for write back
- */
-void _wb_fault()
-{
-#ifdef DEBUG
- printf ("trap: writeback fault\n");
-#endif
- return;
-}
diff --git a/sys/arch/atari/atari/vectors.s b/sys/arch/atari/atari/vectors.s
deleted file mode 100644
index 8543bd510f0..00000000000
--- a/sys/arch/atari/atari/vectors.s
+++ /dev/null
@@ -1,205 +0,0 @@
-/* $NetBSD: vectors.s,v 1.3 1995/11/30 21:52:50 leo Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah
- * Copyright (c) 1990 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)vectors.s 7.2 (Berkeley) 5/7/91
- */
- .text
- .globl _buserr,_addrerr
- .globl _illinst,_zerodiv,_chkinst,_trapvinst,_privinst,_trace
- .globl _badtrap
- .globl _spurintr,_lev1intr,_lev2intr,_lev3intr
- .globl _lev4intr,_lev5intr,_lev6intr,_lev7intr
- .globl _trap0,_trap1,_trap2,_trap15
- .globl _fpfline, _fpunsupp, _fpfault
- .globl _trap12, _badmfpint
-
-Lvectab:
- .long 0x4ef80400 | 0: jmp 0x400:w (unused reset SSP)
- .long 0 | 1: NOT USED (reset PC)
- .long _buserr | 2: bus error
- .long _addrerr | 3: address error
- .long _illinst | 4: illegal instruction
- .long _zerodiv | 5: zero divide
- .long _chkinst | 6: CHK instruction
- .long _trapvinst | 7: TRAPV instruction
- .long _privinst | 8: privilege violation
- .long _trace | 9: trace
- .long _illinst | 10: line 1010 emulator
- .long _fpfline | 11: line 1111 emulator
- .long _badtrap | 12: unassigned, reserved
- .long _coperr | 13: coprocessor protocol violation
- .long _fmterr | 14: format error
- .long _badtrap | 15: uninitialized interrupt vector
- .long _badtrap | 16: unassigned, reserved
- .long _badtrap | 17: unassigned, reserved
- .long _badtrap | 18: unassigned, reserved
- .long _badtrap | 19: unassigned, reserved
- .long _badtrap | 20: unassigned, reserved
- .long _badtrap | 21: unassigned, reserved
- .long _badtrap | 22: unassigned, reserved
- .long _badtrap | 23: unassigned, reserved
- .long _spurintr | 24: spurious interrupt
- .long _lev1intr | 25: level 1 interrupt autovector
- .long _lev2intr | 26: level 2 interrupt autovector
- .long _lev3intr | 27: level 3 interrupt autovector
- .long _lev4intr | 28: level 4 interrupt autovector
- .long _lev5intr | 29: level 5 interrupt autovector
- .long _lev6intr | 30: level 6 interrupt autovector
- .long _lev7intr | 31: level 7 interrupt autovector
- .long _trap0 | 32: syscalls
- .long _trap1 | 33: sigreturn syscall or breakpoint
- .long _trap2 | 34: breakpoint or sigreturn syscall
- .long _illinst | 35: TRAP instruction vector
- .long _illinst | 36: TRAP instruction vector
- .long _illinst | 37: TRAP instruction vector
- .long _illinst | 38: TRAP instruction vector
- .long _illinst | 39: TRAP instruction vector
- .long _illinst | 40: TRAP instruction vector
- .long _illinst | 41: TRAP instruction vector
- .long _illinst | 42: TRAP instruction vector
- .long _illinst | 43: TRAP instruction vector
- .long _trap12 | 44: TRAP instruction vector
- .long _illinst | 45: TRAP instruction vector
- .long _illinst | 46: TRAP instruction vector
- .long _trap15 | 47: TRAP instruction vector
-#ifdef FPSP
- .globl bsun, inex, dz, unfl, operr, ovfl, snan
- .long bsun | 48: FPCP branch/set on unordered cond
- .long inex | 49: FPCP inexact result
- .long dz | 50: FPCP divide by zero
- .long unfl | 51: FPCP underflow
- .long operr | 52: FPCP operand error
- .long ovfl | 53: FPCP overflow
- .long snan | 54: FPCP signalling NAN
-#else
- .globl _fpfault
- .long _fpfault | 48: FPCP branch/set on unordered cond
- .long _fpfault | 49: FPCP inexact result
- .long _fpfault | 50: FPCP divide by zero
- .long _fpfault | 51: FPCP underflow
- .long _fpfault | 52: FPCP operand error
- .long _fpfault | 53: FPCP overflow
- .long _fpfault | 54: FPCP signalling NAN
-#endif
-
-
- .long _fpunsupp | 55: FPCP unimplemented data type
- .long _badtrap | 56: unassigned, reserved
- .long _badtrap | 57: unassigned, reserved
- .long _badtrap | 58: unassigned, reserved
- .long _badtrap | 59: unassigned, reserved
- .long _badtrap | 60: unassigned, reserved
- .long _badtrap | 61: unassigned, reserved
- .long _badtrap | 62: unassigned, reserved
- .long _badtrap | 63: unassigned, reserved
-
- /*
- * MFP 1 auto vectors (ipl 6)
- */
- .long _badmfpint | 64: parallel port - BUSY
- .long _badmfpint | 65: modem port 1 - DCD
- .long _badmfpint | 66: modem port 1 - CTS
- .long _badmfpint | 67: unassigned
- .long _badmfpint | 68: modem port 1 baudgen (Timer D)
-#ifdef STATCLOCK
- .long mfp_timc | 69: Timer C {stat,prof}clock
-#else
- .long _badmfpint | 69: Timer C
-#endif /* STATCLOCK */
- .long mfp_kbd | 70: KBD/MIDI IRQ
- .long mfp_fd_acsi | 71: FDC/ACSI DMA
- .long _badmfpint | 72: Display enable counter
- .long _badmfpint | 73: modem port 1 - XMIT error
- .long _badmfpint | 74: modem port 1 - XMIT buffer empty
- .long _badmfpint | 75: modem port 1 - RCV error
- .long _badmfpint | 76: modem port 1 - RCV buffer full
- .long mfp_tima | 77: Timer A (System clock)
- .long _badmfpint | 78: modem port 1 - RI
- .long _badmfpint | 79: Monochrome detect
-
- /*
- * MFP 2 auto vectors (ipl 6)
- */
- .long _badmfpint | 80: I/O pin 1 J602
- .long _badmfpint | 81: I/O pin 3 J602
- .long _badmfpint | 82: SCC-DMA
- .long _badmfpint | 83: modem port 2 - RI
- .long _badmfpint | 84: serial port 1 baudgen (Timer D)
- .long _badmfpint | 85: TCCLC SCC (Timer C)
- .long _badmfpint | 86: FDC Drive Ready
- .long mfp2_5380dm | 87: SCSI DMA
- .long _badmfpint | 88: Display enable (Timer B)
- .long _badmfpint | 89: serial port 1 - XMIT error
- .long _badmfpint | 90: serial port 1 - XMIT buffer empty
- .long _badmfpint | 91: serial port 1 - RCV error
- .long _badmfpint | 92: serial port 1 - RCV buffer full
- .long _badmfpint | 93: Timer A
- .long _badmfpint | 94: RTC
- .long mfp2_5380 | 95: SCSI 5380
-
- /*
- * Interrupts from the 8530 SCC
- */
- .long sccint | 96: SCC Tx empty channel B
- .long _badtrap | 97: Not used
- .long sccint | 98: SCC Ext./Status Channel B
- .long _badtrap | 99: Not used
- .long sccint | 100: SCC Rx Channel B
- .long _badtrap | 101: Not used
- .long sccint | 102: SCC Special Rx cond. Channel B
- .long _badtrap | 103: Not used
- .long sccint | 104: SCC Tx empty channel A
- .long _badtrap | 105: Not used
- .long sccint | 106: SCC Ext./Status Channel A
- .long _badtrap | 107: Not used
- .long sccint | 108: SCC Rx Channel A
- .long _badtrap | 109: Not used
- .long sccint | 110: SCC Special Rx cond. Channel A
- .long _badtrap | 111: Not used
-
-#define BADTRAP16 .long _badtrap,_badtrap,_badtrap,_badtrap,\
- _badtrap,_badtrap,_badtrap,_badtrap,\
- _badtrap,_badtrap,_badtrap,_badtrap,\
- _badtrap,_badtrap,_badtrap,_badtrap
- BADTRAP16 | 112-255: user interrupt vectors
- BADTRAP16 | 112-255: user interrupt vectors
- BADTRAP16 | 112-255: user interrupt vectors
- BADTRAP16 | 112-255: user interrupt vectors
- BADTRAP16 | 112-255: user interrupt vectors
- BADTRAP16 | 112-255: user interrupt vectors
- BADTRAP16 | 112-255: user interrupt vectors
- BADTRAP16 | 112-255: user interrupt vectors
- BADTRAP16 | 112-255: user interrupt vectors
- BADTRAP16 | 112-255: user interrupt vectors
diff --git a/sys/arch/atari/atari/vm_machdep.c b/sys/arch/atari/atari/vm_machdep.c
deleted file mode 100644
index c970adc652b..00000000000
--- a/sys/arch/atari/atari/vm_machdep.c
+++ /dev/null
@@ -1,401 +0,0 @@
-/* $NetBSD: vm_machdep.c,v 1.4 1995/12/09 04:37:34 mycroft Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: vm_machdep.c 1.21 91/04/06$
- *
- * @(#)vm_machdep.c 7.10 (Berkeley) 5/7/91
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/malloc.h>
-#include <sys/vnode.h>
-#include <sys/buf.h>
-#include <sys/core.h>
-#include <sys/exec_aout.h>
-#include <m68k/reg.h>
-
-#include <machine/cpu.h>
-
-#include <vm/vm.h>
-#include <sys/user.h>
-#include <vm/vm_kern.h>
-#include <machine/pte.h>
-
-/*
- * Finish a fork operation, with process p2 nearly set up.
- * Copy and update the kernel stack and pcb, making the child
- * ready to run, and marking it so that it can return differently
- * than the parent. Returns 1 in the child process, 0 in the parent.
- * We currently double-map the user area so that the stack is at the same
- * address in each process; in the future we will probably relocate
- * the frame pointers on the stack after copying.
- */
-void
-cpu_fork(p1, p2, stack, stacksize)
- register struct proc *p1, *p2;
- void *stack;
- size_t stacksize;
-{
- register struct pcb *pcb = &p2->p_addr->u_pcb;
- register struct trapframe *tf;
- register struct switchframe *sf;
- extern void proc_trampoline(), child_return();
-
- p2->p_md.md_flags = p1->p_md.md_flags;
-
- /* Copy pcb from proc p1 to p2. */
- *pcb = p1->p_addr->u_pcb;
-
- PMAP_ACTIVATE(&p2->p_vmspace->vm_pmap, pcb, 0);
-
- /*
- * Copy the trap frame, and arrange for the child to return directly
- * through return_to_user(). Note the inline cpu_set_kpc().
- */
- tf = (struct trapframe *)((u_int)p2->p_addr + USPACE) - 1;
- p2->p_md.md_regs = (int *)tf;
- *tf = *(struct trapframe *)p1->p_md.md_regs;
-
- /*
- * If specified, give the child a different stack.
- */
- if (stack != NULL)
- tf->tf_regs[15] = (u_int)stack + stacksize;
-
- sf = (struct switchframe *)tf - 1;
- sf->sf_pc = (u_int)proc_trampoline;
- pcb->pcb_regs[6] = (int)child_return; /* A2 */
- pcb->pcb_regs[7] = (int)p2; /* A3 */
- pcb->pcb_regs[11] = (int)sf; /* SSP */
-}
-
-/*
- * cpu_set_kpc:
- *
- * Arrange for in-kernel execution of a process to continue at the
- * named pc, as if the code at that address were called as a function
- * with argument, the current process's process pointer.
- *
- * Note that it's assumed that when the named process returns, rei()
- * should be invoked, to return to user mode.
- */
-void
-cpu_set_kpc(p, pc, arg)
- struct proc *p;
- void (*pc) __P((void *));
- void *arg;
-{
- struct pcb *pcbp;
- struct switchframe *sf;
- extern void proc_trampoline(), child_return();
-
- pcbp = &p->p_addr->u_pcb;
- sf = (struct switchframe *)pcbp->pcb_regs[11];
- sf->sf_pc = (u_int)proc_trampoline;
- pcbp->pcb_regs[6] = (int)pc; /* A2 */
- pcbp->pcb_regs[7] = (int)arg; /* A3 */
-}
-
-/*
- * cpu_exit is called as the last action during exit.
- * We release the address space and machine-dependent resources,
- * Block context switches and then call switch_exit() which will
- * free our stack and user area and switch to another process
- * thus we never return.
- */
-void
-cpu_exit(p)
- struct proc *p;
-{
- vmspace_free(p->p_vmspace);
-
- (void)splhigh();
- cnt.v_swtch++;
- switch_exit(p);
- /* NOTREACHED */
-}
-
-/*
- * Move pages from one kernel virtual address to another.
- * Both addresses are assumed to reside in the Sysmap,
- * and size must be a multiple of CLSIZE.
- */
-pagemove(from, to, size)
- register caddr_t from, to;
- int size;
-{
- register vm_offset_t pa;
-
-#ifdef DEBUG
- if (size & CLOFSET)
- panic("pagemove");
-#endif
- while (size > 0) {
- pa = pmap_extract(pmap_kernel(), (vm_offset_t)from);
-#ifdef DEBUG
- if (pa == 0)
- panic("pagemove 2");
- if (pmap_extract(pmap_kernel(), (vm_offset_t)to) != 0)
- panic("pagemove 3");
-#endif
- pmap_remove(pmap_kernel(),
- (vm_offset_t)from, (vm_offset_t)from + PAGE_SIZE);
- pmap_enter(pmap_kernel(),
- (vm_offset_t)to, pa, VM_PROT_READ|VM_PROT_WRITE, 1);
- from += PAGE_SIZE;
- to += PAGE_SIZE;
- size -= PAGE_SIZE;
- }
-}
-
-/*
- * Map `size' bytes of physical memory starting at `paddr' into
- * kernel VA space at `vaddr'. Read/write and cache-inhibit status
- * are specified by `prot'.
- */
-physaccess(vaddr, paddr, size, prot)
- caddr_t vaddr, paddr;
- register int size, prot;
-{
- u_int *pte;
- register u_int page;
-
- if (cpu040 && (prot & PG_CI) == 0) /* if cache not inhibited */
- prot |= PG_CCB; /* set cacheable, copyback */
- pte = kvtopte(vaddr);
- page = (u_int)paddr & PG_FRAME;
- for (size = btoc(size); size; size--) {
- *pte++ = PG_V | prot | page;
- page += NBPG;
- }
- TBIAS();
-}
-
-physunaccess(vaddr, size)
- caddr_t vaddr;
- register int size;
-{
- u_int *pte;
-
- pte = kvtopte(vaddr);
- for (size = btoc(size); size; size--)
- *pte++ = PG_NV;
- TBIAS();
-}
-
-/*
- * Dump the machine specific segment at the start of a core dump.
- * This means the CPU and FPU registers. The format used here is
- * the same one ptrace uses, so gdb can be machine independent.
- *
- * XXX - Generate Sun format core dumps for Sun executables?
- */
-struct md_core {
- struct reg intreg;
- struct fpreg freg;
-};
-int
-cpu_coredump(p, vp, cred, chdr)
- struct proc *p;
- struct vnode *vp;
- struct ucred *cred;
- struct core *chdr;
-{
- int error;
- struct md_core md_core;
- struct coreseg cseg;
- register struct user *up = p->p_addr;
- register i;
-
- CORE_SETMAGIC(*chdr, COREMAGIC, MID_M68K, 0);
- chdr->c_hdrsize = ALIGN(sizeof(*chdr));
- chdr->c_seghdrsize = ALIGN(sizeof(cseg));
- chdr->c_cpusize = sizeof(md_core);
-
- /* Save integer registers. */
- {
- register struct frame *f;
-
- f = (struct frame*) p->p_md.md_regs;
- for (i = 0; i < 16; i++) {
- md_core.intreg.r_regs[i] = f->f_regs[i];
- }
- md_core.intreg.r_sr = f->f_sr;
- md_core.intreg.r_pc = f->f_pc;
- }
- if (fputype) {
- register struct fpframe *f;
-
- f = &up->u_pcb.pcb_fpregs;
- m68881_save(f);
- for (i = 0; i < (8*3); i++) {
- md_core.freg.r_regs[i] = f->fpf_regs[i];
- }
- md_core.freg.r_fpcr = f->fpf_fpcr;
- md_core.freg.r_fpsr = f->fpf_fpsr;
- md_core.freg.r_fpiar = f->fpf_fpiar;
- } else {
- bzero((caddr_t)&md_core.freg, sizeof(md_core.freg));
- }
-
- CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_M68K, CORE_CPU);
- cseg.c_addr = 0;
- cseg.c_size = chdr->c_cpusize;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
- (off_t)chdr->c_hdrsize, UIO_SYSSPACE,
- IO_NODELOCKED|IO_UNIT, cred, NULL, p);
- if (error)
- return error;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&md_core, sizeof(md_core),
- (off_t)(chdr->c_hdrsize + chdr->c_seghdrsize), UIO_SYSSPACE,
- IO_NODELOCKED|IO_UNIT, cred, NULL, p);
-
- if (!error)
- chdr->c_nseg++;
-
- return error;
-}
-
-/*
- * Set a red zone in the kernel stack after the u. area.
- * We don't support a redzone right now. It really isn't clear
- * that it is a good idea since, if the kernel stack were to roll
- * into a write protected page, the processor would lock up (since
- * it cannot create an exception frame) and we would get no useful
- * post-mortem info. Currently, under the DEBUG option, we just
- * check at every clock interrupt to see if the current k-stack has
- * gone too far (i.e. into the "redzone" page) and if so, panic.
- * Look at _lev6intr in locore.s for more details.
- */
-/*ARGSUSED*/
-setredzone(pte, vaddr)
- u_int *pte;
- caddr_t vaddr;
-{
-}
-
-/*
- * Convert kernel VA to physical address
- */
-kvtop(addr)
- register caddr_t addr;
-{
- vm_offset_t va;
-
- va = pmap_extract(pmap_kernel(), (vm_offset_t)addr);
- if (va == 0)
- panic("kvtop: zero page frame");
- return((int)va);
-}
-
-extern vm_map_t phys_map;
-
-/*
- * Map an IO request into kernel virtual address space. Requests fall into
- * one of five catagories:
- *
- * B_PHYS|B_UAREA: User u-area swap.
- * Address is relative to start of u-area (p_addr).
- * B_PHYS|B_PAGET: User page table swap.
- * Address is a kernel VA in usrpt (Usrptmap).
- * B_PHYS|B_DIRTY: Dirty page push.
- * Address is a VA in proc2's address space.
- * B_PHYS|B_PGIN: Kernel pagein of user pages.
- * Address is VA in user's address space.
- * B_PHYS: User "raw" IO request.
- * Address is VA in user's address space.
- *
- * All requests are (re)mapped into kernel VA space via the useriomap
- * (a name with only slightly more meaning than "kernelmap")
- */
-vmapbuf(bp)
- register struct buf *bp;
-{
- register int npf;
- register caddr_t addr;
- register long flags = bp->b_flags;
- struct proc *p;
- int off;
- vm_offset_t kva;
- register vm_offset_t pa;
-
- if ((flags & B_PHYS) == 0)
- panic("vmapbuf");
- addr = bp->b_saveaddr = bp->b_un.b_addr;
- off = (int)addr & PGOFSET;
- p = bp->b_proc;
- npf = btoc(round_page(bp->b_bcount + off));
- kva = kmem_alloc_wait(phys_map, ctob(npf));
- bp->b_un.b_addr = (caddr_t) (kva + off);
- while (npf--) {
- pa = pmap_extract(vm_map_pmap(&p->p_vmspace->vm_map),
- (vm_offset_t)addr);
- if (pa == 0)
- panic("vmapbuf: null page frame");
- pmap_enter(vm_map_pmap(phys_map), kva, trunc_page(pa),
- VM_PROT_READ|VM_PROT_WRITE, TRUE);
- addr += PAGE_SIZE;
- kva += PAGE_SIZE;
- }
-}
-
-/*
- * Free the io map PTEs associated with this IO operation.
- * We also invalidate the TLB entries and restore the original b_addr.
- */
-vunmapbuf(bp)
- register struct buf *bp;
-{
- register int npf;
- register caddr_t addr = bp->b_un.b_addr;
- vm_offset_t kva;
-
- if ((bp->b_flags & B_PHYS) == 0)
- panic("vunmapbuf");
- npf = btoc(round_page(bp->b_bcount + ((int)addr & PGOFSET)));
- kva = (vm_offset_t)((int)addr & ~PGOFSET);
- kmem_free_wakeup(phys_map, kva, ctob(npf));
- bp->b_un.b_addr = bp->b_saveaddr;
- bp->b_saveaddr = NULL;
-}
diff --git a/sys/arch/atari/compile/.cvsignore b/sys/arch/atari/compile/.cvsignore
deleted file mode 100644
index d8aea7293ac..00000000000
--- a/sys/arch/atari/compile/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-ATARITT
-BOOT
-FALCON
-GENERIC
diff --git a/sys/arch/atari/conf/ATARITT b/sys/arch/atari/conf/ATARITT
deleted file mode 100644
index 7c5199f8680..00000000000
--- a/sys/arch/atari/conf/ATARITT
+++ /dev/null
@@ -1,103 +0,0 @@
-#
-# $NetBSD: ATARITT,v 1.8 1996/01/06 20:10:59 leo Exp $
-#
-# ATARI-TT
-#
-# This configuration file is for a multiple disk/multiple tape ATARI-TT
-#
-
-include "std.atari"
-#
-# Add support for about 16 users. This variable is used to size
-# various kernel structures.
-#
-maxusers 16
-
-#
-# processors this kernel should support
-#
-options "M68030" # support for 030
-
-options TIMEZONE=300 # Set the timezone that the kernel will use
-options DST=1 # Set the timezone that the kernel will use
-options HZ=64 # Set the clock-rate (48/64/96)
-
-#options FPSP
-
-#
-# Networking options
-#
-options INET # Basic networking support
-
-options FFS # Berkeley fast file system
-options MFS # Memory based filesystem
-options PROCFS # Process filesystem
-options KERNFS # Kernel parameter filesystem
-options NULLFS # Loopback filesystem
-options MSDOSFS # MSDOS filesystem
-options CD9660 # ISO 9660 filesystem with Rock Ridge
-
-options FIFO # FIFO operations on vnodes
-
-options SWAPPAGER # Pager for swap device
-options DEVPAGER # Pager
-
-
-#
-# Misc. debuging options
-#
-options PANICWAIT # Require keystroke to dump/reboot
-options DDB # Kernel debugger
-
-#
-# File system related options
-#
-#options NFSCLIENT # Network File System client side code
-
-#
-# Compatability options for various existing systems
-#
-options COMPAT_43 # 4.3 BSD compatible system calls (required)
-options COMPAT_10 # Compatibility to NetBSD1.0
-
-#
-# Support for System V IPC facilities.
-#
-#options SYSVSHM # System V shared memory
-#options SYSVMSG # System V messages
-#options SYSVSEM # System V semaphores
-
-#
-# Support for various kernel options
-#
-options KTRACE # Add kernel tracing system call
-options DIAGNOSTIC # Add additional error checking code
-options "NKMEMCLUSTERS=256" # Size of kernel malloc area
-options GENERIC # Mini-root boot support
-
-#
-# Atari specific kernel options:
-#
-options TT_SCSI # SCSI-support for TT only
-options TT_VIDEO # Graphics support for TT only
-
-#
-# Build one kernel that can boot from any disk.
-#
-config netbsd swap on generic
-
-pseudo-device mouse 1 # mouse
-pseudo-device view 2 # View (graphics mapping)
-pseudo-device sl # Slip
-pseudo-device ppp # ppp
-pseudo-device pty 16 # Pseudo-tty support
-pseudo-device loop # Loopback network
-pseudo-device vnd 3 # 3 pseudo disks (see vnconfig)
-
-#
-#The following sections describe various hardware options.
-#
-zs0 at mainbus0 # Serial support through 8530
-grf1 at grfbus0 # second graphics driver
-ite1 at grf1 # second tty
-nvr0 at mainbus0 # nvram driver
diff --git a/sys/arch/atari/conf/BOOT b/sys/arch/atari/conf/BOOT
deleted file mode 100644
index d23b92d7eee..00000000000
--- a/sys/arch/atari/conf/BOOT
+++ /dev/null
@@ -1,96 +0,0 @@
-#
-# $NetBSD: BOOT,v 1.5 1995/11/30 00:57:46 jtc Exp $
-#
-# BOOT
-#
-# This configuration file is for a BOOT kernel. This kernel is supplied
-# on the boot-floppy and in the 'arch/atari/kernels' directory. It supports
-# both Falcons and TT's and should be small enough to allow installation
-# on 4Mb machines.
-#
-
-include "std.atari"
-#
-# Add support for about 16 users. This variable is used to size
-# various kernel structures.
-#
-maxusers 16
-
-#
-# processors this kernel should support
-#
-options "M68030" # support for 030
-
-options TIMEZONE=300 # Set the timezone that the kernel will use
-options DST=1 # Set the timezone that the kernel will use
-options HZ=64 # Set the clock-rate (48/64/96)
-
-options FPU_EMULATE # Support for MC68881/MC68882 emulator
-#options FPSP
-
-#
-# Networking options
-#
-options INET # Basic networking support
-
-options FFS # Berkeley fast file system
-options MFS # Memory based filesystem
-options PROCFS # Process filesystem
-options KERNFS # Kernel parameter filesystem
-options NULLFS # Loopback filesystem
-options MSDOSFS # MSDOS filesystem
-options CD9660 # ISO 9660 filesystem with Rock Ridge
-
-options FIFO # FIFO operations on vnodes
-
-options SWAPPAGER # Pager for swap device
-options DEVPAGER # Pager
-
-
-#
-# Misc. debuging options
-#
-options PANICWAIT # Require keystroke to dump/reboot
-options DDB # Kernel debugger
-
-#
-# Compatability options for various existing systems
-#
-options COMPAT_43 # 4.3 BSD compatible system calls (required)
-options COMPAT_10 # Compatibility to NetBSD1.0
-
-#
-# Support for various kernel options
-#
-options KTRACE # Add kernel tracing system call
-options DIAGNOSTIC # Add additional error checking code
-options "NKMEMCLUSTERS=256" # Size of kernel malloc area
-options GENERIC # Mini-root boot support
-
-#
-# Atari specific kernel options:
-#
-options "ST_POOL_SIZE=22" # smallest that allows TT-HIGH
-options TT_SCSI # SCSI-support for TT
-options FALCON_SCSI # SCSI-support for Falcon
-options TT_VIDEO # Graphics support for TT
-options FALCON_VIDEO # Graphics support for FALCON
-
-#
-# Build one kernel that can boot from any disk.
-#
-config netbsd swap on generic
-
-pseudo-device view 2 # View (graphics mapping)
-pseudo-device sl # Slip
-pseudo-device ppp # ppp
-pseudo-device pty 16 # Pseudo-tty support
-pseudo-device loop # Loopback network
-pseudo-device vnd 3 # 3 pseudo disks (see vnconfig)
-
-#
-#The following sections describe various hardware options.
-#
-zs0 at mainbus0 # Serial support through 8530
-grf1 at grfbus0 # second graphics driver
-ite1 at grf1 # second tty
diff --git a/sys/arch/atari/conf/FALCON b/sys/arch/atari/conf/FALCON
deleted file mode 100644
index 05754cd4815..00000000000
--- a/sys/arch/atari/conf/FALCON
+++ /dev/null
@@ -1,89 +0,0 @@
-#
-# $NetBSD: FALCON,v 1.5 1996/01/06 20:11:00 leo Exp $
-#
-# ATARI-FALCON
-#
-# This configuration file is for a multiple disk/multiple tape ATARI-Falcon
-#
-
-include "std.atari"
-#
-# Add support for about 16 users. This variable is used to size
-# various kernel structures.
-#
-maxusers 16
-
-#
-# processors this kernel should support
-#
-options "M68030" # support for 030
-
-options TIMEZONE=300 # Set the timezone that the kernel will use
-options DST=1 # Set the timezone that the kernel will use
-options HZ=64 # Set the clock-rate (48/64/96)
-
-#
-# Networking options
-#
-options INET # Basic networking support
-
-options FFS # Berkeley fast file system
-options MFS # Memory based filesystem
-options PROCFS # Process filesystem
-options KERNFS # Kernel parameter filesystem
-options NULLFS # Loopback filesystem
-options MSDOSFS # MSDOS filesystem
-options CD9660 # ISO 9660 filesystem with Rock Ridge
-
-options FIFO # FIFO operations on vnodes
-
-options SWAPPAGER # Pager for swap device
-options DEVPAGER # Pager
-
-
-#
-# Misc. debuging options
-#
-options PANICWAIT # Require keystroke to dump/reboot
-options DDB # Kernel debugger
-
-#
-# Compatability options for various existing systems
-#
-options COMPAT_43 # 4.3 BSD compatible system calls (required)
-options COMPAT_10 # Compatibility to NetBSD1.0
-
-#
-# Support for various kernel options
-#
-options KTRACE # Add kernel tracing system call
-options DIAGNOSTIC # Add additional error checking code
-options "NKMEMCLUSTERS=256" # Size of kernel malloc area
-options GENERIC # Mini-root boot support
-
-#
-# Atari specific kernel options:
-#
-options FALCON_SCSI # SCSI-support for FACLON only
-options FALCON_VIDEO # Graphics support for FALCON
-
-#
-# Build one kernel that can boot from any disk.
-#
-config netbsd swap on generic
-
-pseudo-device mouse 1 # mouse
-pseudo-device view 2 # View (graphics mapping)
-pseudo-device sl # Slip
-pseudo-device ppp # ppp
-pseudo-device pty 16 # Pseudo-tty support
-pseudo-device loop # Loopback network
-pseudo-device vnd 3 # 3 pseudo disks (see vnconfig)
-
-#
-#The following sections describe various hardware options.
-#
-zs0 at mainbus0 # Serial support through 8530
-grf1 at grfbus0 # second graphics driver
-ite1 at grf1 # second tty
-nvr0 at mainbus0 # nvram driver
diff --git a/sys/arch/atari/conf/GENERIC b/sys/arch/atari/conf/GENERIC
deleted file mode 100644
index 763ab14ea75..00000000000
--- a/sys/arch/atari/conf/GENERIC
+++ /dev/null
@@ -1,117 +0,0 @@
-#
-# $NetBSD: GENERIC,v 1.10 1996/01/06 20:11:01 leo Exp $
-#
-# Generic atari
-#
-# This configuration file is for a multiple disk/multiple tape ATARI-TT/Falcon
-# with network (through ppp or slip).
-
-include "std.atari"
-#
-# Add support for about 16 users. This variable is used to size
-# various kernel structures.
-#
-maxusers 16
-
-#
-# processors this kernel should support
-#
-options "M68030" # support for 030
-
-options TIMEZONE=300 # Set the timezone that the kernel will use
-options DST=1 # Set the timezone that the kernel will use
-options HZ=64 # Set the clock-rate (48/64/96)
-
-
-#
-# Networking options
-#
-options INET # Basic networking support
-
-options FFS # Berkeley fast file system
-options MFS # Memory based filesystem
-options PROCFS # Process filesystem
-options KERNFS # Kernel parameter filesystem
-options NULLFS # Loopback filesystem
-options MSDOSFS # MSDOS filesystem
-options CD9660 # ISO 9660 filesystem with Rock Ridge
-
-options FIFO # FIFO operations on vnodes
-
-options SWAPPAGER # Pager for swap device
-options DEVPAGER # Pager
-
-
-#
-# Misc. debuging options
-#
-options PANICWAIT # Require keystroke to dump/reboot
-options DDB # Kernel debugger
-
-#
-# File system related options
-#
-options QUOTA # Disk quotas for local disks
-options NFSSERVER # Network File System server side code
-options NFSCLIENT # Network File System client side code
-
-#
-# Compatability options for various existing systems
-#
-options COMPAT_43 # 4.3 BSD compatible system calls (required)
-options COMPAT_10 # Compatibility to NetBSD1.0
-#options COMPAT_09 # has no meaning on the atari
-#options COMPAT_SUNOS # Support to run Sun-3 executables
-#options TCP_COMPAT_42 # Disable UDP checksums (not needed)
-
-#
-# Support for System V IPC facilities.
-#
-options SYSVSHM # System V shared memory
-options SYSVMSG # System V messages
-options SYSVSEM # System V semaphores
-
-#
-# Support for various kernel options
-#
-options KTRACE # Add kernel tracing system call
-options DIAGNOSTIC # Add additional error checking code
-options "NKMEMCLUSTERS=256" # Size of kernel malloc area
-options GENERIC # Mini-root boot support
-
-#
-# Atari specific options
-#
-#options KFONT_8x8 # Use 8x8 font instead of 8x16
-options FPU_EMULATE # Floating point emulation
-options "ST_POOL_SIZE=22" # smallest that allows TT-HIGH
-options TT_SCSI # SCSI-support for TT
-options FALCON_SCSI # SCSI-support for Falcon
-options TT_VIDEO # Graphics support for TT
-options FALCON_VIDEO # Graphics support for FALCON
-options STATCLOCK # Separate {stat,prof}clock
-
-#
-# Build one kernel that can boot from any disk.
-#
-config netbsd swap on generic
-
-pseudo-device mouse 1 # mouse
-pseudo-device view 2 # View (graphics mapping)
-pseudo-device sl # Slip
-pseudo-device ppp # ppp
-pseudo-device pty 16 # Pseudo-tty support
-pseudo-device loop # Loopback network
-pseudo-device vnd 3 # 3 pseudo disks (see vnconfig)
-pseudo-device bpfilter 2 # berkeley packet filters
-pseudo-device tun 2 # network tunnel
-pseudo-device ccd 4 # concatenating disk driver
-# for IPv6
-pseudo-device gif 4
-#pseudo-device faith 1
-
-#
-#The following sections describe various hardware options.
-#
-zs0 at mainbus0 # Serial support through 8530
-nvr0 at mainbus0 # nvram driver
diff --git a/sys/arch/atari/conf/Makefile.atari b/sys/arch/atari/conf/Makefile.atari
deleted file mode 100644
index a856179b5a0..00000000000
--- a/sys/arch/atari/conf/Makefile.atari
+++ /dev/null
@@ -1,169 +0,0 @@
-# $NetBSD: Makefile.atari,v 1.9 1996/01/14 21:06:49 thorpej Exp $
-#
-# Makefile for NetBSD Atari-TT
-#
-# This makefile is constructed from a machine description:
-# config machineid
-# Most changes should be made in the machine description
-# /sys/conf/``machineid''
-# after which you should do
-# config machineid
-# Machine generic makefile changes should be made in
-# /sys/conf/Makefile.``machinetype''
-# after which config should be rerun for all machines of that type.
-#
-# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
-# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
-#
-# -DTRACE compile in kernel tracing hooks
-# -DQUOTA compile in file system quotas
-
-
-# DEBUG is set to -g by config if debugging is requested (config -g).
-# PROF is set to -pg by config if profiling is requested (config -p).
-AS= as ${DEBUG}
-CC= cc ${DEBUG}
-CPP= cpp
-LD= ld
-TOUCH= touch -f -c
-
-# source tree is located via $S relative to the compilation directory
-S= ../../../..
-ATARI= ../..
-
-INCLUDES= -I. -I$S/arch -I$S -I$S/sys
-COPTS= ${INCLUDES} ${IDENT} -D_KERNEL -Dmc68020 -Datari
-CFLAGS= -O2 -Werror -mc68020 -msoft-float ${COPTS}
-
-### find out what to use for libkern
-.include "$S/lib/libkern/Makefile.inc"
-.ifndef PROF
-LIBKERN= ${KERNLIB}
-.else
-LIBKERN= ${KERNLIB_PROF}
-.endif
-
-### find out what to use for libcompat
-.include "$S/compat/common/Makefile.inc"
-.ifndef PROF
-LIBCOMPAT= ${COMPATLIB}
-.else
-LIBCOMPAT= ${COMPATLIB_PROF}
-.endif
-
-### for the Motorola 68040 Floating Point Software Product
-.include "$S/arch/m68k/fpsp/Makefile.inc"
-
-# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
-# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
-# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
-# is marked as config-dependent.
-
-NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
-NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
-
-DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
-DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
-
-PROFILE_C= ${CC} -S -c ${COPTS} $<; \
- sed -e s/_mcount/mcount/ -e s/subrmcount/subr_mcount/ <$*.s | \
- ${AS} -o $@; \
- rm -f $*.s
-
-NORMAL_S= ${CPP} ${COPTS} $< | ${AS} -o $@
-NORMAL_S_C= ${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@
-
-%OBJS
-
-%CFILES
-
-# load lines for config "xxx" will be emitted as:
-# xxx: ${SYSTEM_DEP} swapxxx.o
-# ${SYSTEM_LD_HEAD}
-# ${SYSTEM_LD} swapxxx.o
-# ${SYSTEM_LD_TAIL}
-SYSTEM_OBJ= locore.o ${FPSP} ${OBJS} param.o ioconf.o \
- ${LIBKERN} ${LIBCOMPAT}
-SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
-SYSTEM_LD_HEAD= rm -f $@
-SYSTEM_LD= -@if [ X${DEBUG} = X-g ]; \
- then strip=-X; \
- else strip=-x; \
- fi; \
- echo ${LD} $$strip -n -T 0 -o $@ -e start '$${SYSTEM_OBJ}' vers.o; \
- ${LD} $$strip -n -T 0 -o $@ -e start ${SYSTEM_OBJ} vers.o
-SYSTEM_LD_TAIL= @size $@; chmod 755 $@; \
- [ X${DEBUG} = X-g ] && { \
- echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
- echo strip -d $@; strip -d $@; } || true
-
-%LOAD
-
-vers.o: newvers
-
-newvers:
- sh $S/conf/newvers.sh ${KERN_IDENT}
- ${CC} $(CFLAGS) -c vers.c
-
-clean::
- rm -f eddep *netbsd netbsd.gdb tags *.o locore.i [a-z]*.s \
- Errs errs linterrs makelinks genassym
-
-lint: /tmp param.c
- @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
- ${CFILES} ${ATARI}/atari/swapgeneric.c ioconf.c param.c| \
- grep -v 'struct/union .* never defined' | \
- grep -v 'possible pointer alignment problem'
-
-locore.o: assym.s ${ATARI}/atari/vectors.s ${ATARI}/atari/locore.s
-locore.o: machine/trap.h machine/psl.h machine/pte.h machine/cpu.h
- ${CPP} -DLOCORE ${COPTS} ${ATARI}/atari/locore.s | ${AS} -o locore.o
-
-# the following is necessary because autoconf.o depends on #if GENERIC
-autoconf.o: Makefile
-
-# the following are necessary because the files depend on the types of
-# hp cpu's included in the system configuration
-machdep.o sys_machdep.o pmap.o pmap_bootstrap.o trap.o dma.o: Makefile
-
-# depend on network or filesystem configuration
-uipc_domain.o uipc_proto.o vfs_conf.o locore.o: Makefile
-if_tun.o if_loop.o if_ethersubr.o: Makefile
-in_proto.o: Makefile
-
-# depend on maxusers
-assym.s: Makefile
-
-assym.s: genassym
- ./genassym >assym.s
-
-genassym:
- ${CC} -static ${INCLUDES} ${IDENT} ${PARAM} -Dmc68020 -Datari \
- -o genassym ${ATARI}/atari/genassym.c
-
-depend: assym.s param.c
- mkdep ${COPTS} ${CFILES} ioconf.c param.c
- mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${ATARI}/atari/genassym.c
-
-links:
- egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
- sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
- echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
- sort -u | comm -23 - dontlink | \
- sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
- sh makelinks && rm -f dontlink
-
-tags:
- @echo "see $S/kern/Makefile for tags"
-
-ioconf.o: ioconf.c
- ${CC} -c ${CFLAGS} ioconf.c
-
-param.c: $S/conf/param.c
- rm -f param.c
- cp $S/conf/param.c .
-
-param.o: param.c Makefile
- ${CC} -c ${CFLAGS} ${PARAM} param.c
-
-%RULES
diff --git a/sys/arch/atari/conf/files.atari b/sys/arch/atari/conf/files.atari
deleted file mode 100644
index 698943cc223..00000000000
--- a/sys/arch/atari/conf/files.atari
+++ /dev/null
@@ -1,124 +0,0 @@
-#
-# $NetBSD: files.atari,v 1.14 1996/01/06 20:11:02 leo Exp $
-#
-
-maxpartitions 16
-
-maxusers 2 8 64
-
-device mainbus at root {}
-
-device cpu at mainbus
-
-define event {}
-file arch/atari/dev/event.c event
-
-device clock at mainbus
-file arch/atari/dev/clock.c
-
-# keyboard
-device kbd at mainbus: event
-file arch/atari/dev/kbd.c kbd needs-count
-
-# serial port via 85C30 (modem2/serial2)
-device zs at mainbus: tty
-file arch/atari/dev/zs.c zs needs-count
-
-#ramdisk
-device ramd at mainbus
-file arch/atari/dev/ramd.c ramd needs-flag
-
-# nvram
-device nvr at mainbus
-file arch/atari/dev/nvram.c nvr needs-flag
-
-device fdc at mainbus { unit = -1 }
-
-device fd at fdc
-file arch/atari/dev/fd.c fd needs-flag
-file arch/atari/dev/dma.c
-major {fd = 2}
-
-# graphic devices
-define grfb {}
-
-device grfbus at mainbus: grfb
-
-device grf at grfb {}
-file arch/atari/dev/grf.c grf needs-count
-file arch/atari/dev/ite_cc.c grf ite
-file arch/atari/dev/grfabs.c grf ite
-file arch/atari/dev/grfabs_tt.c grf ite
-file arch/atari/dev/grfabs_fal.c grf ite
-
-device ite at grf
-file arch/atari/dev/ite.c ite needs-flag
-file arch/atari/dev/kbdmap.c ite
-file arch/atari/dev/font_8x8.c ite
-file arch/atari/dev/font_8x16.c ite
-
-
-pseudo-device view
-file arch/atari/dev/view.c view grf needs-count
-
-pseudo-device mouse
-file arch/atari/dev/ms.c mouse needs-count
-
-define scsi {}
-
-# ncr 5380 controller
-device ncrscsi at mainbus: scsi
-file arch/atari/dev/atari5380.c ncrscsi
-
-device scsibus at scsi {target = -1, lun = -1}
-
-device cd at scsibus: disk
-file scsi/cd.c cd needs-flag
-major {cd = 6}
-device sd at scsibus: disk
-file scsi/sd.c sd needs-flag
-major {sd = 4}
-device st at scsibus: tape
-file scsi/st.c st needs-flag
-major {st = 5}
-device ch at scsibus: disk
-file scsi/ch.c ch needs-flag
-device ss at scsibus: tape
-file scsi/ss.c ss needs-flag
-device uk at scsibus: disk
-file scsi/uk.c uk needs-flag
-device su at scsibus: disk
-file scsi/su.c su needs-flag
-
-
-# list of standard files...
-file dev/cons.c ite
-file dev/cninit.c ite
-file scsi/scsi_base.c scsi
-file scsi/scsi_ioctl.c scsi
-file scsi/scsiconf.c scsi
-file arch/atari/atari/atari_init.c
-file arch/atari/atari/autoconf.c
-file arch/atari/atari/conf.c
-file arch/atari/atari/disksubr.c
-file arch/atari/atari/dkbad.c
-file arch/atari/atari/machdep.c
-file arch/atari/atari/mem.c
-file arch/atari/atari/pmap.c
-file arch/atari/atari/sys_machdep.c
-file arch/atari/atari/trap.c
-file arch/atari/atari/misc.c
-file arch/atari/atari/vm_machdep.c
-file arch/atari/atari/db_memrw.c ddb
-file arch/atari/atari/fpu.c
-file arch/m68k/m68k/copy.s
-
-# Emulation modules
-# 6888x emulator (FPU_EMULATE)
-include "../../m68k/fpe/files.fpe"
-
-# Compatibility modules
-
-# SunOS Binary Compatibility (COMPAT_SUNOS)
-include "../../../compat/sunos/files.sunos"
-file arch/m68k/m68k/sunos_machdep.c compat_sunos
diff --git a/sys/arch/atari/conf/std.atari b/sys/arch/atari/conf/std.atari
deleted file mode 100644
index f2903167689..00000000000
--- a/sys/arch/atari/conf/std.atari
+++ /dev/null
@@ -1,28 +0,0 @@
-# $NetBSD: std.atari,v 1.3 1995/06/09 19:43:23 leo Exp $
-#
-# standard atari information
-#
-machine atari m68k
-
-options MACHINE_NONCONTIG # Non-contiguous memory support
- # (required)
-
-mainbus0 at root
-
-clock0 at mainbus0 # system clock
-ramd0 at mainbus0 # ramdisk for install-fs
-kbd0 at mainbus0 # standard keyboard
-fdc0 at mainbus0 # floppy controller
-fd0 at fdc0 unit 0 # buildin floppy drive
-grfbus0 at mainbus0 # bitmapped display's
-ncrscsi0 at mainbus0 # SCSI driver
-scsibus0 at ncrscsi0 # SCSI bus
-grf0 at grfbus0 # graphics driver
-ite0 at grf0 # console
-
-# any disk/tape drives on configured controllers.
-sd* at scsibus? target ? lun ?
-st0 at scsibus? target ? lun 0
-cd0 at scsibus? target ? lun 0
-ss0 at scsibus? target ? lun 0
-uk* at scsibus? target ? lun ?
diff --git a/sys/arch/atari/dev/atari5380.c b/sys/arch/atari/dev/atari5380.c
deleted file mode 100644
index 8ea22c781d5..00000000000
--- a/sys/arch/atari/dev/atari5380.c
+++ /dev/null
@@ -1,840 +0,0 @@
-/* $NetBSD: atari5380.c,v 1.5 1996/01/14 13:06:37 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-#include <sys/buf.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsi_message.h>
-#include <scsi/scsiconf.h>
-
-/*
- * Include the driver definitions
- */
-#include <atari/dev/ncr5380reg.h>
-
-#include <machine/stdarg.h>
-#include <machine/iomap.h>
-#include <machine/mfp.h>
-
-#if defined(FALCON_SCSI)
-#include <machine/dma.h>
-#endif
-
-/*
- * This is crap, but because the interrupts now run at MFP spl-level (6),
- * splbio() is not enough at some places. The code should be checked to
- * find out where splhigh() is needed and where splbio() should be used.
- * Now that I use this interrupt sceme, the spl values are fake!
- */
-#undef splbio()
-#define splbio() splhigh()
-
-/*
- * Set the various driver options
- */
-#define NREQ 18 /* Size of issue queue */
-#define AUTO_SENSE 1 /* Automatically issue a request-sense */
-
-#define DRNAME ncrscsi /* used in various prints */
-#undef DBG_SEL /* Show the selection process */
-#undef DBG_REQ /* Show enqueued/ready requests */
-#undef DBG_ERR_RET /* Show requests with != 0 return code */
-#undef DBG_NOWRITE /* Do not allow writes to the targets */
-#undef DBG_PIO /* Show the polled-I/O process */
-#undef DBG_INF /* Show information transfer process */
-#define DBG_NOSTATIC /* No static functions, all in DDB trace*/
-#define DBG_PID 2 /* Keep track of driver */
-#define REAL_DMA /* Use DMA if sensible */
-#if defined(FALCON_SCSI)
-#define REAL_DMA_POLL 1 /* 1: Poll for end of DMA-transfer */
-#else
-#define REAL_DMA_POLL 0 /* 1: Poll for end of DMA-transfer */
-#endif
-#undef USE_PDMA /* Use special pdma-transfer function */
-#define MIN_PHYS 65536 /*BARF!!!!*/
-
-/*
- * The atari specific driver options
- */
-#undef NO_TTRAM_DMA /* Do not use DMA to TT-ram. This */
- /* fails on older atari's */
-#define ENABLE_NCR5380(sc) cur_softc = sc;
-
-/*
- * Functions that do nothing on the atari
- */
-#define pdma_ready() 0
-
-#if defined(TT_SCSI)
-/*
- * Define all the things we need of the DMA-controller
- */
-#define SCSI_DMA ((struct scsi_dma *)AD_SCSI_DMA)
-#define SCSI_5380 ((struct scsi_5380 *)AD_NCR5380)
-
-struct scsi_dma {
- volatile u_char s_dma_ptr[8]; /* use only the odd bytes */
- volatile u_char s_dma_cnt[8]; /* use only the odd bytes */
- volatile u_char s_dma_res[4]; /* data residue register */
- volatile u_char s_dma_gap; /* not used */
- volatile u_char s_dma_ctrl; /* control register */
-};
-
-#define set_scsi_dma(addr, val) (void)( \
- { \
- u_char *address = (u_char*)addr+1; \
- u_long nval = (u_long)val; \
- __asm("movepl %0, %1@(0)": :"d" (nval), "a" (address)); \
- })
-
-#define get_scsi_dma(addr, res) ( \
- { \
- u_char *address = (u_char*)addr+1; \
- u_long nval; \
- __asm("movepl %1@(0), %0": "=d" (nval) : "a" (address)); \
- res = (u_long)nval; \
- })
-
-/*
- * Defines for TT-DMA control register
- */
-#define SD_BUSERR 0x80 /* 1 = transfer caused bus error*/
-#define SD_ZERO 0x40 /* 1 = byte counter is zero */
-#define SD_ENABLE 0x02 /* 1 = Enable DMA */
-#define SD_OUT 0x01 /* Direction: memory to SCSI */
-#define SD_IN 0x00 /* Direction: SCSI to memory */
-
-/*
- * Define the 5380 register set
- */
-struct scsi_5380 {
- volatile u_char scsi_5380[16]; /* use only the odd bytes */
-};
-#endif /* TT_SCSI */
-
-/**********************************************
- * Variables present for both TT and Falcon. *
- **********************************************/
-
-/*
- * Softc of currently active controller (a bit of fake; we only have one)
- */
-static struct ncr_softc *cur_softc;
-
-#if defined(TT_SCSI) && !defined(FALCON_SCSI)
-/*
- * We can be more efficient for some functions when only TT_SCSI is selected
- */
-#define GET_5380_REG(rnum) SCSI_5380->scsi_5380[(rnum << 1) | 1]
-#define SET_5380_REG(rnum,val) (SCSI_5380->scsi_5380[(rnum << 1) | 1] = val)
-
-#define scsi_mach_init(sc) scsi_tt_init(sc)
-#define scsi_ienable() scsi_tt_ienable()
-#define scsi_idisable() scsi_tt_idisable()
-#define scsi_clr_ipend() scsi_tt_clr_ipend()
-#define scsi_dma_setup(r,p,m) scsi_tt_dmasetup(r, p, m)
-#define wrong_dma_range(r,d) tt_wrong_dma_range(r, d)
-#define poll_edma(reqp) tt_poll_edma(reqp)
-#define get_dma_result(r, b) tt_get_dma_result(r, b)
-
-#define fair_to_keep_dma() 1
-#define claimed_dma() 1
-#define reconsider_dma()
-
-#endif /* defined(TT_SCSI) && !defined(FALCON_SCSI) */
-
-#if defined(TT_SCSI)
-
-/*
- * Define these too, so we can use them locally...
- */
-#define GET_TT_REG(rnum) SCSI_5380->scsi_5380[(rnum << 1) | 1]
-#define SET_TT_REG(rnum,val) (SCSI_5380->scsi_5380[(rnum << 1) | 1] = val)
-
-#ifdef NO_TTRAM_DMA
-static int tt_wrong_dma_range(reqp, dm)
-SC_REQ *reqp;
-struct dma_chain *dm;
-{
- if (dm->dm_addr & 0xff000000) {
- reqp->dr_flag |= DRIVER_BOUNCING;
- return(1);
- }
- return(0);
-}
-#else
-#define tt_wrong_dma_range(reqp, dm) 0
-#endif
-
-static void scsi_tt_init(sc)
-struct ncr_softc *sc;
-{
- /*
- * Enable SCSI-related interrupts
- */
- MFP2->mf_aer |= 0x80; /* SCSI IRQ goes HIGH!!!!! */
-
- MFP2->mf_ierb |= IB_SCDM; /* SCSI-dma interrupts */
- MFP2->mf_iprb &= ~IB_SCDM;
- MFP2->mf_imrb |= IB_SCDM;
-
- MFP2->mf_iera |= IA_SCSI; /* SCSI-5380 interrupts */
- MFP2->mf_ipra &= ~IA_SCSI;
- MFP2->mf_imra |= IA_SCSI;
-
- /*
- * LWP: DMA transfers to TT-ram causes data to be garbeled
- * without notice on some revisons of the TT-mainboard.
- * When program's generate misterious Segmentations faults,
- * try turning on NO_TTRAM_DMA.
- */
-#ifdef NO_TTRAM_DMA
- printf(": DMA to TT-RAM is disabled!");
-#endif
-}
-
-static u_char get_tt_5380_reg(rnum)
-u_short rnum;
-{
- return(SCSI_5380->scsi_5380[(rnum << 1) | 1]);
-}
-
-static void set_tt_5380_reg(rnum, val)
-u_short rnum, val;
-{
- SCSI_5380->scsi_5380[(rnum << 1) | 1] = val;
-}
-
-extern __inline__ void scsi_tt_ienable()
-{
- int sps = splbio();
- MFP2->mf_ierb |= IB_SCDM;
- MFP2->mf_iera |= IA_SCSI;
- splx(sps);
-}
-
-extern __inline__ scsi_tt_idisable()
-{
- int sps = splbio();
- MFP2->mf_ierb &= ~IB_SCDM;
- MFP2->mf_iera &= ~IA_SCSI;
- splx(sps);
-}
-
-extern __inline__ scsi_tt_clr_ipend()
-{
- int tmp;
-
- SCSI_DMA->s_dma_ctrl = 0;
- tmp = GET_TT_REG(NCR5380_IRCV);
-}
-
-static void scsi_tt_dmasetup(reqp, phase, mode)
-SC_REQ *reqp;
-u_int phase;
-u_char mode;
-{
- if (PH_IN(phase)) {
- SCSI_DMA->s_dma_ctrl = SD_IN;
- set_scsi_dma(&(SCSI_DMA->s_dma_ptr), reqp->dm_cur->dm_addr);
- set_scsi_dma(&(SCSI_DMA->s_dma_cnt), reqp->dm_cur->dm_count);
- SET_TT_REG(NCR5380_ICOM, 0);
- SET_TT_REG(NCR5380_MODE, mode);
- SCSI_DMA->s_dma_ctrl = SD_ENABLE;
- SET_TT_REG(NCR5380_IRCV, 0);
- }
- else {
- SCSI_DMA->s_dma_ctrl = SD_OUT;
- set_scsi_dma(&(SCSI_DMA->s_dma_ptr), reqp->dm_cur->dm_addr);
- set_scsi_dma(&(SCSI_DMA->s_dma_cnt), reqp->dm_cur->dm_count);
- SET_TT_REG(NCR5380_MODE, mode);
- SET_TT_REG(NCR5380_ICOM, SC_ADTB);
- SET_TT_REG(NCR5380_DMSTAT, 0);
- SCSI_DMA->s_dma_ctrl = SD_ENABLE|SD_OUT;
- }
-}
-
-static int
-tt_poll_edma(reqp)
-SC_REQ *reqp;
-{
- u_char dmstat, dmastat;
- int timeout = 9000; /* XXX */
-
- /*
- * We wait here until the DMA has finished. This can be
- * achieved by checking the following conditions:
- * - 5380:
- * - End of DMA flag is set
- * - We lost BSY (error!!)
- * - A phase mismatch has occured (partial transfer)
- * - DMA-controller:
- * - A bus error occurred (Kernel error!!)
- * - All bytes are transferred
- * If one of the terminating conditions was met, we call
- * 'dma_ready' to check errors and perform the bookkeeping.
- */
-
- for (;;) {
- delay(20);
- if (--timeout <= 0) {
- ncr_tprint(reqp, "timeout on polled transfer\n");
- reqp->xs->error = XS_DRIVER_STUFFUP;
- return(0);
- }
- dmstat = GET_TT_REG(NCR5380_DMSTAT);
- dmastat = SCSI_DMA->s_dma_ctrl;
- if (dmstat & (SC_END_DMA|SC_BSY_ERR|SC_IRQ_SET))
- break;
- if (!(dmstat & SC_PHS_MTCH))
- break;
- if (dmastat & (SD_BUSERR|SD_ZERO))
- break;
- }
- return(1);
-}
-
-/*
- * Convert physical DMA address to a virtual address.
- */
-static u_char *
-ptov(reqp, phaddr)
-SC_REQ *reqp;
-u_long *phaddr;
-{
- struct dma_chain *dm;
- u_char *vaddr;
-
- dm = reqp->dm_chain;
- vaddr = reqp->xdata_ptr;
- for(; dm < reqp->dm_cur; dm++)
- vaddr += dm->dm_count;
- vaddr += (u_long)phaddr - dm->dm_addr;
- return(vaddr);
-}
-
-static int
-tt_get_dma_result(reqp, bytes_left)
-SC_REQ *reqp;
-u_long *bytes_left;
-{
- int dmastat, dmstat;
- u_char *byte_p;
- u_long leftover;
-
- dmastat = SCSI_DMA->s_dma_ctrl;
- dmstat = GET_TT_REG(NCR5380_DMSTAT);
- get_scsi_dma(SCSI_DMA->s_dma_cnt, leftover);
- get_scsi_dma(SCSI_DMA->s_dma_ptr, (u_long)byte_p);
-
- if (dmastat & SD_BUSERR) {
- /*
- * The DMA-controller seems to access 8 bytes beyond
- * it's limits on output. Therefore check also the byte
- * count. If it's zero, ignore the bus error.
- */
- if (leftover != 0) {
- ncr_tprint(reqp,
- "SCSI-DMA buserror - accessing 0x%x\n", byte_p);
- reqp->xs->error = XS_DRIVER_STUFFUP;
- }
- }
-
- /*
- * We handle the following special condition below:
- * -- The device disconnects in the middle of a write operation --
- * In this case, the 5380 has already pre-fetched the next byte from
- * the DMA-controller before the phase mismatch occurs. Therefore,
- * leftover is 1 too low.
- * This does not always happen! Therefore, we only do this when
- * leftover is odd. This assumes that DMA transfers are _even_! This
- * is normally the case on disks and types but might not always be.
- * XXX: Check if ACK is consistently high on these occasions LWP
- */
- if ((leftover & 1) && !(dmstat & SC_PHS_MTCH) && PH_OUT(reqp->phase))
- leftover++;
-
- /*
- * Check if there are some 'restbytes' left in the DMA-controller.
- */
- if (((u_long)byte_p & 3) && PH_IN(reqp->phase)) {
- u_char *p, *q;
-
- p = ptov(reqp, (u_long)byte_p & ~3);
- q = (u_char*)&(SCSI_DMA->s_dma_res);
- switch ((u_long)byte_p & 3) {
- case 3: *p++ = *q++;
- case 2: *p++ = *q++;
- case 1: *p++ = *q++;
- }
- }
- *bytes_left = leftover;
- return ((dmastat & (SD_BUSERR|SD_ZERO)) ? 1 : 0);
-}
-
-#endif /* defined(TT_SCSI) */
-
-#if defined(FALCON_SCSI) && !defined(TT_SCSI)
-
-#define GET_5380_REG(rnum) get_falcon_5380_reg(rnum)
-#define SET_5380_REG(rnum,val) set_falcon_5380_reg(rnum, val)
-#define scsi_mach_init(sc) scsi_falcon_init(sc)
-#define scsi_ienable() scsi_falcon_ienable()
-#define scsi_idisable() scsi_falcon_idisable()
-#define scsi_clr_ipend() scsi_falcon_clr_ipend()
-#define scsi_dma_setup(r,p,m) scsi_falcon_dmasetup(r, p, m)
-#define wrong_dma_range(r,d) falcon_wrong_dma_range(r, d)
-#define poll_edma(reqp) falcon_poll_edma(reqp)
-#define get_dma_result(r, b) falcon_get_dma_result(r, b)
-
-#define fair_to_keep_dma() (!st_dmawanted())
-#define claimed_dma() falcon_claimed_dma()
-#define reconsider_dma() falcon_reconsider_dma()
-
-#endif /* defined(FALCON_SCSI) && !defined(TT_SCSI) */
-
-#if defined(FALCON_SCSI)
-
-static void fscsi_int __P((void));
-
-static void scsi_falcon_init(sc)
-struct ncr_softc *sc;
-{
- /*
- * Enable disk related interrupts
- */
- MFP->mf_ierb |= IB_DINT;
- MFP->mf_iprb &= ~IB_DINT;
- MFP->mf_imrb |= IB_DINT;
-}
-
-static u_char get_falcon_5380_reg(rnum)
-u_short rnum;
-{
- DMA->dma_mode = DMA_SCSI + rnum;
- return(DMA->dma_data);
-}
-
-static void set_falcon_5380_reg(rnum, val)
-u_short rnum, val;
-{
- DMA->dma_mode = DMA_SCSI + rnum;
- DMA->dma_data = val;
-}
-
-extern __inline__ void scsi_falcon_ienable()
-{
- MFP->mf_ierb |= IB_DINT;
-}
-
-extern __inline__ scsi_falcon_idisable()
-{
- MFP->mf_ierb &= ~IB_DINT;
-}
-
-extern __inline__ scsi_falcon_clr_ipend()
-{
- int tmp;
-
- tmp = get_falcon_5380_reg(NCR5380_IRCV);
-}
-
-static int falcon_wrong_dma_range(reqp, dm)
-SC_REQ *reqp;
-struct dma_chain *dm;
-{
- /*
- * Do not allow chains yet! See also comment with
- * falcon_poll_edma() !!!
- */
- if (((dm - reqp->dm_chain) > 0) || (dm->dm_addr & 0xff000000)) {
- reqp->dr_flag |= DRIVER_BOUNCING;
- return(1);
- }
- /*
- * Never allow DMA to happen on a Falcon when the transfer
- * size is no multiple of 512. This is the transfer unit of the
- * ST DMA-controller.
- */
- if(dm->dm_count & 511)
- return(1);
- return(0);
-}
-
-static int falcon_lock = 0;
-
-extern __inline__ falcon_claimed_dma()
-{
- if (!(falcon_lock & DMA_LOCK_GRANT)) {
- if (falcon_lock) {
- /*
- * DMA access is being claimed.
- */
- return(0);
- }
- if (!st_dmagrab(fscsi_int, run_main, &connected,&falcon_lock,1))
- return(0);
- }
- return(1);
-}
-
-extern __inline__ void falcon_reconsider_dma()
-{
- if (falcon_lock && (connected == NULL) && (discon_q == NULL)) {
- /*
- * No need to keep DMA locked by us as we are not currently
- * connected and no disconnected jobs are pending.
- */
- st_dmafree(&connected, &falcon_lock);
- }
-
- if (!falcon_lock && (issue_q != NULL)) {
- /*
- * We must (re)claim DMA access as there are jobs
- * waiting in the issue queue.
- */
- st_dmagrab(fscsi_int, run_main, &connected, &falcon_lock, 0);
- }
-}
-
-static void fal1_dma(dir, nsects, reqp)
-u_int dir, nsects;
-SC_REQ *reqp;
-{
- dir <<= 8;
- st_dmaaddr_set((caddr_t)reqp->dm_cur->dm_addr);
- DMA->dma_mode = 0x90 | dir;
- DMA->dma_mode = 0x90 | (dir ^ DMA_WRBIT);
- DMA->dma_mode = 0x90 | dir;
- delay(40); /* XXX: LWP - is this really needed ? */
- DMA->dma_data = nsects;
- delay(40); /* XXX: LWP - is this really needed ? */
- DMA->dma_mode = 0x10 | dir;
- delay(40); /* XXX: LWP - is this really needed ? */
-}
-
-static void scsi_falcon_dmasetup(reqp, phase, mode)
-SC_REQ *reqp;
-u_int phase;
-u_char mode;
-{
- int nsects = reqp->dm_cur->dm_count / 512; /* XXX */
-
- /*
- * XXX: We should probably clear the fifo before putting the
- * 5380 into DMA-mode.
- */
- if (PH_IN(phase)) {
- set_falcon_5380_reg(NCR5380_ICOM, 0);
- set_falcon_5380_reg(NCR5380_MODE, mode);
- set_falcon_5380_reg(NCR5380_IRCV, 0);
- fal1_dma(0, nsects, reqp);
- }
- else {
- set_falcon_5380_reg(NCR5380_MODE, mode);
- set_falcon_5380_reg(NCR5380_ICOM, SC_ADTB);
- set_falcon_5380_reg(NCR5380_DMSTAT, 0);
- fal1_dma(1, nsects, reqp);
- }
-}
-
-/*
- * Falcon SCSI interrupt. _Always_ called at spl1!
- */
-static void fscsi_int()
-{
- int itype;
- int dma_done;
-
- if (get_falcon_5380_reg(NCR5380_DMSTAT) & SC_IRQ_SET) {
- scsi_falcon_idisable();
- ncr_ctrl_intr(cur_softc);
- }
-}
-
-static int
-falcon_poll_edma(reqp)
-SC_REQ *reqp;
-{
- int timeout = 9000; /* XXX */
-
- /*
- * Because of the Falcon hardware, it is impossible to reach
- * the 5380 while doing DMA-transfers. So we have to rely on
- * the interrupt line to determine if DMA-has finished. the
- * DMA-controller itself will never fire an interrupt. This means
- * that 'broken-up' DMA transfers are not (yet) possible on the
- * Falcon.
- */
- for (;;) {
- delay(20);
- if (--timeout <= 0) {
- ncr_tprint(reqp, "Timeout on polled transfer\n");
- reqp->xs->error = XS_DRIVER_STUFFUP;
- return(0);
- }
- if (!(MFP->mf_gpip & IO_DINT))
- break;
- }
- return(1);
-}
-
-static int
-falcon_get_dma_result(reqp, bytes_left)
-SC_REQ *reqp;
-u_long *bytes_left;
-{
- int rv = 0;
- int st_dmastat;
- u_long bytes_done;
-
- /*
- * Select sector counter register first (See Atari docu.)
- */
- DMA->dma_mode = 0x90;
- if (!(st_dmastat = DMA->dma_stat) & 0x01) {
- /*
- * Misc. DMA-error according to Atari...
- */
- ncr_tprint(reqp, "Unknow ST-SCSI error near 0x%x\n",
- st_dmaaddr_get());
- reqp->xs->error = XS_DRIVER_STUFFUP;
- rv = 1;
- }
- if (st_dmastat & 0x02) {
- /*
- * Bytecount not zero.... As the fifo loads in 16 byte
- * chunks, check if bytes are stuck in fifo.
- * As we don't use DMA on chunks less than 512 bytes
- * on the Falcon, report any residual not a multiple of
- * 512 as an error...
- */
- bytes_done = st_dmaaddr_get() - reqp->dm_cur->dm_addr;
- if (bytes_done & 511) {
- ncr_tprint(reqp, "Some bytes stuck in fifo\n");
- bytes_done &= ~511;
- reqp->xs->error = XS_DRIVER_STUFFUP;
- }
- *bytes_left = reqp->dm_cur->dm_count - bytes_done;
- }
- else {
- *bytes_left = 0;
- rv = 1;
- }
- return(rv);
-}
-
-#endif /* defined(FALCON_SCSI) */
-
-#if defined(TT_SCSI) && defined(FALCON_SCSI)
-/*
- * Define some functions to support _both_ TT and Falcon SCSI
- */
-
-/*
- * Register access will be done through the following 2 function pointers.
- */
-static u_char (*get_5380_reg)();
-static void (*set_5380_reg)();
-
-#define GET_5380_REG (*get_5380_reg)
-#define SET_5380_REG (*set_5380_reg)
-
-static void scsi_mach_init(sc)
-struct ncr_softc *sc;
-{
- if (machineid & ATARI_FALCON) {
- get_5380_reg = get_falcon_5380_reg;
- set_5380_reg = set_falcon_5380_reg;
- scsi_falcon_init(sc);
- }
- else {
- get_5380_reg = get_tt_5380_reg;
- set_5380_reg = set_tt_5380_reg;
- scsi_tt_init(sc);
- }
-}
-
-extern __inline__ void scsi_ienable()
-{
- if (machineid & ATARI_FALCON)
- scsi_falcon_ienable();
- else scsi_tt_ienable();
-}
-
-extern __inline__ void scsi_idisable()
-{
- if (machineid & ATARI_FALCON)
- scsi_falcon_idisable();
- else scsi_tt_idisable();
-}
-
-extern __inline__ scsi_clr_ipend()
-{
- if (machineid & ATARI_FALCON)
- scsi_falcon_clr_ipend();
- else scsi_tt_clr_ipend();
-}
-
-extern __inline__ scsi_dma_setup(reqp, phase, mbase)
-SC_REQ *reqp;
-u_int phase;
-u_char mbase;
-{
- if (machineid & ATARI_FALCON)
- scsi_falcon_dmasetup(reqp, phase, mbase);
- else scsi_tt_dmasetup(reqp, phase, mbase);
-}
-
-extern __inline__ int wrong_dma_range(reqp, dm)
-SC_REQ *reqp;
-struct dma_chain *dm;
-{
- if (machineid & ATARI_FALCON)
- return(falcon_wrong_dma_range(reqp, dm));
- else return(tt_wrong_dma_range(reqp, dm));
-}
-
-extern __inline__ int poll_edma(reqp)
-SC_REQ *reqp;
-{
- if (machineid & ATARI_FALCON)
- return(falcon_poll_edma(reqp));
- else return(tt_poll_edma(reqp));
-}
-
-extern __inline__ int get_dma_result(reqp, bytes_left)
-SC_REQ *reqp;
-u_long *bytes_left;
-{
- if (machineid & ATARI_FALCON)
- return(falcon_get_dma_result(reqp, bytes_left));
- else return(tt_get_dma_result(reqp, bytes_left));
-}
-
-/*
- * Locking stuff. All turns into NOP's on the TT.
- */
-#define fair_to_keep_dma() ((machineid & ATARI_FALCON) ? \
- !st_dmawanted() : 1)
-#define claimed_dma() ((machineid & ATARI_FALCON) ? \
- falcon_claimed_dma() : 1)
-#define reconsider_dma() { \
- if(machineid & ATARI_FALCON) \
- falcon_reconsider_dma();\
- }
-#endif /* defined(TT_SCSI) && defined(FALCON_SCSI) */
-
-/**********************************************
- * Functions present for both TT and Falcon. *
- **********************************************/
-/*
- * Our autoconfig matching function
- */
-static int
-machine_match(pdp, cdp, auxp, cd)
-struct device *pdp;
-struct cfdata *cdp;
-void *auxp;
-struct cfdriver *cd;
-{
- if (strcmp(auxp, cd->cd_name))
- return(0);
- if (cdp->cf_unit != 0) /* Only one unit */
- return(0);
- return(1);
-}
-
-/*
- * Bounce buffer (de)allocation. Those buffers are gotten from the ST-mem
- * pool. Allocation here is both contiguous and in the lower 16Mb of
- * the address space. Thus being DMA-able for all controllers.
- */
-static u_char *
-alloc_bounceb(len)
-u_long len;
-{
- u_long tmp;
-
- return((u_char *)alloc_stmem(len, &tmp));
-}
-
-static void
-free_bounceb(bounceb)
-u_char *bounceb;
-{
- free_stmem(bounceb);
-}
-
-/*
- * 5380 interrupt.
- */
-scsi_ctrl(sr)
-int sr; /* sr at time of interrupt */
-{
- if (GET_5380_REG(NCR5380_DMSTAT) & SC_IRQ_SET) {
- scsi_idisable();
- if (!BASEPRI(sr))
- add_sicallback(ncr_ctrl_intr, cur_softc, 0);
- else {
- spl1();
- ncr_ctrl_intr(cur_softc);
- }
- }
-}
-
-/*
- * DMA controller interrupt
- */
-scsi_dma(sr)
-int sr; /* sr at time of interrupt */
-{
- SC_REQ *reqp;
-
- if ((reqp = connected) && (reqp->dr_flag & DRIVER_IN_DMA)) {
- scsi_idisable();
- if (!BASEPRI(sr))
- add_sicallback(ncr_dma_intr, cur_softc, 0);
- else {
- spl1();
- ncr_dma_intr(cur_softc);
- }
- }
-}
-
-/*
- * Last but not least... Include the general driver code
- */
-#include "atari/dev/ncr5380.c"
diff --git a/sys/arch/atari/dev/clock.c b/sys/arch/atari/dev/clock.c
deleted file mode 100644
index 5baf74c1dd3..00000000000
--- a/sys/arch/atari/dev/clock.c
+++ /dev/null
@@ -1,465 +0,0 @@
-/* $NetBSD: clock.c,v 1.7 1996/01/06 20:11:06 leo Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: clock.c 1.18 91/01/21$
- *
- * @(#)clock.c 7.6 (Berkeley) 5/7/91
- */
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-#include <machine/psl.h>
-#include <machine/cpu.h>
-#include <machine/iomap.h>
-#include <machine/mfp.h>
-#include <atari/dev/clockreg.h>
-
-#if defined(GPROF) && defined(PROFTIMER)
-#include <machine/profile.h>
-#endif
-
-/*
- * The MFP clock runs at 2457600Hz. We use a {system,stat,prof}clock divider
- * of 200. Therefore the timer runs at an effective rate of:
- * 2457600/200 = 12288Hz.
- */
-#define CLOCK_HZ 12288
-
-/*
- * Machine-dependent clock routines.
- *
- * Inittodr initializes the time of day hardware which provides
- * date functions.
- *
- * Resettodr restores the time of day hardware after a time change.
- */
-
-int clockmatch __P((struct device *, struct cfdata *, void *));
-void clockattach __P((struct device *, struct device *, void *));
-
-struct cfdriver clockcd = {
- NULL, "clock", (cfmatch_t)clockmatch, clockattach,
- DV_DULL, sizeof(struct device), NULL, 0
-};
-
-static u_long gettod __P((void));
-static int settod __P((u_long));
-
-static int divisor; /* Systemclock divisor */
-
-/*
- * Statistics and profile clock intervals and variances. Variance must
- * be a power of 2. Since this gives us an even number, not an odd number,
- * we discard one case and compensate. That is, a variance of 64 would
- * give us offsets in [0..63]. Instead, we take offsets in [1..63].
- * This is symetric around the point 32, or statvar/2, and thus averages
- * to that value (assuming uniform random numbers).
- */
-#ifdef STATCLOCK
-static int statvar = 32; /* {stat,prof}clock variance */
-static int statmin; /* statclock divisor - variance/2 */
-static int profmin; /* profclock divisor - variance/2 */
-static int clk2min; /* current, from above choises */
-#endif
-
-int
-clockmatch(pdp, cfp, auxp)
-struct device *pdp;
-struct cfdata *cfp;
-void *auxp;
-{
- if(!strcmp("clock", auxp))
- return(1);
- return(0);
-}
-
-/*
- * Start the real-time clock.
- */
-void clockattach(pdp, dp, auxp)
-struct device *pdp, *dp;
-void *auxp;
-{
- /*
- * Initialize Timer-A in the ST-MFP. We use a divisor of 200.
- * The MFP clock runs at 2457600Hz. Therefore the timer runs
- * at an effective rate of: 2457600/200 = 12288Hz. The
- * following expression works for 48, 64 or 96 hz.
- */
- divisor = CLOCK_HZ/hz;
- MFP->mf_tacr = 0; /* Stop timer */
- MFP->mf_iera &= ~IA_TIMA; /* Disable timer interrupts */
- MFP->mf_tadr = divisor; /* Set divisor */
-
- if (hz != 48 && hz != 64 && hz != 96) { /* XXX */
- printf (": illegal value %d for systemclock, reset to %d\n\t",
- hz, 64);
- hz = 64;
- }
- printf(": system hz %d timer-A divisor 200/%d\n", hz, divisor);
-
-#ifdef STATCLOCK
- if ((stathz == 0) || (stathz > hz) || (CLOCK_HZ % stathz))
- stathz = hz;
- if ((profhz == 0) || (profhz > (hz << 1)) || (CLOCK_HZ % profhz))
- profhz = hz << 1;
-
- MFP->mf_tcdcr &= 0x7; /* Stop timer */
- MFP->mf_ierb &= ~IB_TIMC; /* Disable timer inter. */
- MFP->mf_tcdr = CLOCK_HZ/stathz; /* Set divisor */
-
- statmin = (CLOCK_HZ/stathz) - (statvar >> 1);
- profmin = (CLOCK_HZ/profhz) - (statvar >> 1);
- clk2min = statmin;
-#endif /* STATCLOCK */
-
- /*
- * Initialize Timer-B in the ST-MFP. This timer is used by the 'delay'
- * function below. This time is setup to be continueously counting from
- * 255 back to zero at a frequency of 614400Hz.
- */
- MFP->mf_tbcr = 0; /* Stop timer */
- MFP->mf_iera &= ~IA_TIMB; /* Disable timer interrupts */
- MFP->mf_tbdr = 0;
- MFP->mf_tbcr = T_Q004; /* Start timer */
-
-}
-
-void cpu_initclocks()
-{
- MFP->mf_tacr = T_Q200; /* Start timer */
- MFP->mf_ipra &= ~IA_TIMA; /* Clear pending interrupts */
- MFP->mf_iera |= IA_TIMA; /* Enable timer interrupts */
- MFP->mf_imra |= IA_TIMA; /* ..... */
-
-#ifdef STATCLOCK
- MFP->mf_tcdcr = (MFP->mf_tcdcr & 0x7) | (T_Q200<<4); /* Start */
- MFP->mf_iprb &= ~IB_TIMC; /* Clear pending interrupts */
- MFP->mf_ierb |= IB_TIMC; /* Enable timer interrupts */
- MFP->mf_imrb |= IB_TIMC; /* ..... */
-#endif /* STATCLOCK */
-}
-
-setstatclockrate(newhz)
- int newhz;
-{
-#ifdef STATCLOCK
- if (newhz == stathz)
- clk2min = statmin;
- else clk2min = profmin;
-#endif /* STATCLOCK */
-}
-
-#ifdef STATCLOCK
-void
-statintr(frame)
- register struct clockframe *frame;
-{
- register int var, r;
-
- var = statvar - 1;
- do {
- r = random() & var;
- } while(r == 0);
-
- /*
- * Note that we are always lagging behind as the new divisor
- * value will not be loaded until the next interrupt. This
- * shouldn't disturb the median frequency (I think ;-) ) as
- * only the value used when switching frequencies is used
- * twice. This shouldn't happen very often.
- */
- MFP->mf_tcdr = clk2min + r;
-
- statclock(frame);
-}
-#endif /* STATCLOCK */
-
-/*
- * Returns number of usec since last recorded clock "tick"
- * (i.e. clock interrupt).
- */
-clkread()
-{
- u_int delta;
-
- delta = ((divisor - MFP->mf_tadr) * tick) / divisor;
- /*
- * Account for pending clock interrupts
- */
- if(MFP->mf_iera & IA_TIMA)
- return(delta + tick);
- return(delta);
-}
-
-#define TIMB_FREQ 614400
-#define TIMB_LIMIT 256
-
-/*
- * Wait "n" microseconds.
- * Relies on MFP-Timer B counting down from TIMB_LIMIT at TIMB_FREQ Hz.
- * Note: timer had better have been programmed before this is first used!
- */
-void delay(n)
-int n;
-{
- int tick, otick;
-
- /*
- * Read the counter first, so that the rest of the setup overhead is
- * counted.
- */
- otick = MFP->mf_tbdr;
-
- /*
- * Calculate ((n * TIMER_FREQ) / 1e6) using explicit assembler code so
- * we can take advantage of the intermediate 64-bit quantity to prevent
- * loss of significance.
- */
- n -= 5;
- if(n < 0)
- return;
- {
- u_int temp;
-
- __asm __volatile ("mulul %2,%1:%0" : "=d" (n), "=d" (temp)
- : "d" (TIMB_FREQ));
- __asm __volatile ("divul %1,%2:%0" : "=d" (n)
- : "d"(1000000),"d"(temp),"0"(n));
- }
-
- while(n > 0) {
- tick = MFP->mf_tbdr;
- if(tick > otick)
- n -= TIMB_LIMIT - (tick - otick);
- else n -= otick - tick;
- otick = tick;
- }
-}
-
-#ifdef GPROF
-/*
- * profclock() is expanded in line in lev6intr() unless profiling kernel.
- * Assumes it is called with clock interrupts blocked.
- */
-profclock(pc, ps)
- caddr_t pc;
- int ps;
-{
- /*
- * Came from user mode.
- * If this process is being profiled record the tick.
- */
- if (USERMODE(ps)) {
- if (p->p_stats.p_prof.pr_scale)
- addupc(pc, &curproc->p_stats.p_prof, 1);
- }
- /*
- * Came from kernel (supervisor) mode.
- * If we are profiling the kernel, record the tick.
- */
- else if (profiling < 2) {
- register int s = pc - s_lowpc;
-
- if (s < s_textsize)
- kcount[s / (HISTFRACTION * sizeof (*kcount))]++;
- }
- /*
- * Kernel profiling was on but has been disabled.
- * Mark as no longer profiling kernel and if all profiling done,
- * disable the clock.
- */
- if (profiling && (profon & PRF_KERNEL)) {
- profon &= ~PRF_KERNEL;
- if (profon == PRF_NONE)
- stopprofclock();
- }
-}
-#endif
-
-/***********************************************************************
- * Real Time Clock support *
- ***********************************************************************/
-
-u_int mc146818_read(rtc, regno)
-void *rtc;
-u_int regno;
-{
- ((struct rtc *)rtc)->rtc_regno = regno;
- return(((struct rtc *)rtc)->rtc_data & 0377);
-}
-
-void mc146818_write(rtc, regno, value)
-void *rtc;
-u_int regno, value;
-{
- ((struct rtc *)rtc)->rtc_regno = regno;
- ((struct rtc *)rtc)->rtc_data = value;
-}
-
-/*
- * Initialize the time of day register, based on the time base which is, e.g.
- * from a filesystem.
- */
-inittodr(base)
-time_t base;
-{
- u_long timbuf = base; /* assume no battery clock exists */
-
- timbuf = gettod();
-
- if(timbuf < base) {
- printf("WARNING: bad date in battery clock\n");
- timbuf = base;
- }
-
- /* Battery clock does not store usec's, so forget about it. */
- time.tv_sec = timbuf;
-}
-
-resettodr()
-{
- if(settod(time.tv_sec) == 1)
- return;
- printf("Cannot set battery backed clock\n");
-}
-
-static char dmsize[12] =
-{
- 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
-};
-
-static char ldmsize[12] =
-{
- 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
-};
-
-static u_long
-gettod()
-{
- int i, sps;
- u_long new_time = 0;
- char *msize;
- mc_todregs clkregs;
-
- sps = splhigh();
- MC146818_GETTOD(RTC, &clkregs);
- splx(sps);
-
- if(range_test(clkregs[MC_HOUR], 0, 23))
- return(0);
- if(range_test(clkregs[MC_DOM], 1, 31))
- return(0);
- if (range_test(clkregs[MC_MONTH], 1, 12))
- return(0);
- if(range_test(clkregs[MC_YEAR], 0, 2000 - GEMSTARTOFTIME))
- return(0);
- clkregs[MC_YEAR] += GEMSTARTOFTIME;
-
- for(i = BSDSTARTOFTIME; i < clkregs[MC_YEAR]; i++) {
- if(is_leap(i))
- new_time += 366;
- else new_time += 365;
- }
-
- msize = is_leap(clkregs[MC_YEAR]) ? ldmsize : dmsize;
- for(i = 0; i < (clkregs[MC_MONTH] - 1); i++)
- new_time += msize[i];
- new_time += clkregs[MC_DOM] - 1;
- new_time *= SECS_DAY;
- new_time += (clkregs[MC_HOUR] * 3600) + (clkregs[MC_MIN] * 60);
- return(new_time + clkregs[MC_SEC]);
-}
-
-static int
-settod(newtime)
-u_long newtime;
-{
- register long days, rem, year;
- register char *ml;
- int sps, sec, min, hour, month;
- mc_todregs clkregs;
-
- /* Number of days since Jan. 1 'BSDSTARTOFTIME' */
- days = newtime / SECS_DAY;
- rem = newtime % SECS_DAY;
-
- /*
- * Calculate sec, min, hour
- */
- hour = rem / SECS_HOUR;
- rem %= SECS_HOUR;
- min = rem / 60;
- sec = rem % 60;
-
- /*
- * Figure out the year. Day in year is left in 'days'.
- */
- year = BSDSTARTOFTIME;
- while(days >= (rem = is_leap(year) ? 366 : 365)) {
- ++year;
- days -= rem;
- }
-
- /*
- * Determine the month
- */
- ml = is_leap(year) ? ldmsize : dmsize;
- for(month = 0; days >= ml[month]; ++month)
- days -= ml[month];
-
- /*
- * Now that everything is calculated, program the RTC
- */
- mc146818_write(RTC, MC_REGA, MC_BASE_32_KHz);
- mc146818_write(RTC, MC_REGB, MC_REGB_24HR | MC_REGB_BINARY);
- sps = splhigh();
- MC146818_GETTOD(RTC, &clkregs);
- clkregs[MC_SEC] = sec;
- clkregs[MC_MIN] = min;
- clkregs[MC_HOUR] = hour;
- clkregs[MC_DOM] = days+1;
- clkregs[MC_MONTH] = month+1;
- clkregs[MC_YEAR] = year - GEMSTARTOFTIME;
- MC146818_PUTTOD(RTC, &clkregs);
- splx(sps);
-
- return(1);
-}
diff --git a/sys/arch/atari/dev/clockioctl.h b/sys/arch/atari/dev/clockioctl.h
deleted file mode 100644
index 03f16574b05..00000000000
--- a/sys/arch/atari/dev/clockioctl.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $NetBSD: clockioctl.h,v 1.1.1.1 1995/03/26 07:12:13 leo Exp $ */
-
-/*
- * Copyright (c) 1989 University of Utah.
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: clockioctl.h 1.1 90/07/09$
- *
- * @(#)clockioctl.h 7.2 (Berkeley) 11/2/90
- */
-
-#define CLOCKMAP _IOWR('C', 1, int)
-#define CLOCKUNMAP _IOW('C', 2, int)
-#define CLOCKGETRES _IOR('C', 3, int)
diff --git a/sys/arch/atari/dev/clockreg.h b/sys/arch/atari/dev/clockreg.h
deleted file mode 100644
index 4642336e2a7..00000000000
--- a/sys/arch/atari/dev/clockreg.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $NetBSD: clockreg.h,v 1.4 1996/01/06 20:11:07 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _CLOCKREG_H
-#define _CLOCKREG_H
-/*
- * Atari TT hardware:
- * Motorola MC146818A RealTimeClock
- */
-
-#define RTC ((struct rtc *)AD_RTC)
-
-struct rtc {
- volatile u_char rtc_dat[4];
-};
-
-#define rtc_regno rtc_dat[1] /* register nr. select */
-#define rtc_data rtc_dat[3] /* data register */
-
-/*
- * Pull in general mc146818 definitions
- */
-#include <dev/ic/mc146818reg.h>
-
-/*
- * Some useful constants/macros
- */
-#define is_leap(x) (!(x % 4) && ((x % 100) || !(x % 1000)))
-#define range_test(n, l, h) ((n) < (l) || (n) > (h))
-#define SECS_DAY 86400L
-#define SECS_HOUR 3600L
-#define GEMSTARTOFTIME ((machineid & ATARI_CLKBROKEN) ? 1970 : 1968)
-#define BSDSTARTOFTIME 1970
-#endif /* _CLOCKREG_H */
diff --git a/sys/arch/atari/dev/dma.c b/sys/arch/atari/dev/dma.c
deleted file mode 100644
index e3a6e6ce0f1..00000000000
--- a/sys/arch/atari/dev/dma.c
+++ /dev/null
@@ -1,278 +0,0 @@
-/* $NetBSD: dma.c,v 1.5 1995/11/06 21:13:38 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This file contains special code dealing with the DMA interface
- * on the Atari ST.
- *
- * The DMA circuitry requires some special treatment for the peripheral
- * devices which make use of the ST's DMA feature (the hard disk and the
- * floppy drive).
- * All devices using DMA need mutually exclusive access and can follow some
- * standard pattern which will be provided in this file.
- *
- * The file contains the following entry points:
- *
- * st_dmagrab: ensure exclusive access to the DMA circuitry
- * st_dmafree: free exclusive access to the DMA circuitry
- * st_dmawanted: somebody is queued waiting for DMA-access
- * dmaint: DMA interrupt routine, switches to the current driver
- * st_dmaaddr_set: specify 24 bit RAM address
- * st_dmaaddr_get: get address of last DMA-op
- * st_dmacomm: program DMA, flush FIFO first
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/queue.h>
-#include <machine/cpu.h>
-#include <machine/iomap.h>
-#include <machine/dma.h>
-
-#define NDMA_DEV 10 /* Max 2 floppy's, 8 hard-disks */
-typedef struct dma_entry {
- TAILQ_ENTRY(dma_entry) entries; /* List pointers */
- void (*call_func)(); /* Call when lock granted */
- void (*int_func)(); /* Call on DMA interrupt */
- void *softc; /* Arg. to int_func */
- int *lock_stat; /* status of DMA lock */
-} DMA_ENTRY;
-
-/*
- * Preallocated entries. An allocator seem an overkill here.
- */
-static DMA_ENTRY dmatable[NDMA_DEV]; /* preallocated entries */
-static int sched_soft = 0; /* callback scheduled */
-
-/*
- * Heads of free and active lists:
- */
-static TAILQ_HEAD(freehead, dma_entry) dma_free;
-static TAILQ_HEAD(acthead, dma_entry) dma_active;
-
-static int must_init = 1; /* Must initialize */
-
-static void cdmasoft __P((void));
-static void init_queues __P((void));
-
-static void init_queues()
-{
- int i;
-
- TAILQ_INIT(&dma_free);
- TAILQ_INIT(&dma_active);
-
- for(i = 0; i < NDMA_DEV; i++)
- TAILQ_INSERT_HEAD(&dma_free, &dmatable[i], entries);
-}
-
-int st_dmagrab(int_func, call_func, softc, lock_stat, rcaller)
-void (*int_func)();
-void (*call_func)();
-void *softc;
-int *lock_stat;
-int rcaller;
-{
- int sps;
- DMA_ENTRY *req;
-
- if(must_init) {
- init_queues();
- must_init = 0;
- }
- *lock_stat = DMA_LOCK_REQ;
-
- sps = splhigh();
-
- /*
- * Create a request...
- */
- if(dma_free.tqh_first == NULL)
- panic("st_dmagrab: Too many outstanding requests");
- req = dma_free.tqh_first;
- TAILQ_REMOVE(&dma_free, dma_free.tqh_first, entries);
- req->call_func = call_func;
- req->int_func = int_func;
- req->softc = softc;
- req->lock_stat = lock_stat;
- TAILQ_INSERT_TAIL(&dma_active, req, entries);
-
- if(dma_active.tqh_first != req) {
- splx(sps);
- return(0);
- }
- splx(sps);
-
- /*
- * We're at the head of the queue, ergo: we got the lock.
- */
- *lock_stat = DMA_LOCK_GRANT;
-
- if(rcaller) {
- /*
- * Just return to caller immediately without going
- * through 'call_func' first.
- */
- return(1);
- }
-
- (*call_func)(softc); /* Call followup function */
- return(0);
-}
-
-void
-st_dmafree(softc, lock_stat)
-void *softc;
-int *lock_stat;
-{
- int sps;
- DMA_ENTRY *req;
-
- sps = splhigh();
-
- /*
- * Some validity checks first.
- */
- if((req = dma_active.tqh_first) == NULL)
- panic("st_dmafree: empty active queue");
- if(req->softc != softc)
- printf("Caller of st_dmafree is not lock-owner!\n");
-
- /*
- * Clear lock status, move request from active to free queue.
- */
- *lock_stat = 0;
- TAILQ_REMOVE(&dma_active, req, entries);
- TAILQ_INSERT_HEAD(&dma_free, req, entries);
-
- if((req = dma_active.tqh_first) != NULL) {
- /*
- * Call next request through softint handler. This avoids
- * spl-conflicts.
- */
- *req->lock_stat = DMA_LOCK_GRANT;
- add_sicallback(req->call_func, req->softc, 0);
- }
- splx(sps);
- return;
-}
-
-int
-st_dmawanted()
-{
- return(dma_active.tqh_first->entries.tqe_next != NULL);
-}
-
-cdmaint(sr)
-long sr; /* sr at time of interrupt */
-{
- if(dma_active.tqh_first != NULL) {
- if(!BASEPRI(sr)) {
- if(!sched_soft++)
- add_sicallback(cdmasoft, 0, 0);
- }
- else {
- spl1();
- cdmasoft();
- }
- }
- else printf("DMA interrupt discarded\n");
-}
-
-static void cdmasoft()
-{
- int s;
- void (*int_func)();
- void *softc;
-
- /*
- * Prevent a race condition here. DMA might be freed while
- * the callback was pending!
- */
- s = splhigh();
- sched_soft = 0;
- if(dma_active.tqh_first != NULL) {
- int_func = dma_active.tqh_first->int_func;
- softc = dma_active.tqh_first->softc;
- }
- else int_func = NULL;
- splx(s);
-
- if(int_func != NULL)
- (*int_func)(softc);
-}
-
-/*
- * Setup address for DMA-transfer.
- * Note: The order _is_ important!
- */
-void
-st_dmaaddr_set(address)
-caddr_t address;
-{
- register u_long ad = (u_long)address;
-
- DMA->dma_addr[AD_LOW ] = (ad ) & 0xff;
- DMA->dma_addr[AD_MID ] = (ad >> 8) & 0xff;
- DMA->dma_addr[AD_HIGH] = (ad >>16) & 0xff;
-}
-
-/*
- * Get address from DMA unit.
- */
-u_long
-st_dmaaddr_get()
-{
- register u_long ad = 0;
-
- ad = (DMA->dma_addr[AD_LOW ] & 0xff);
- ad |= (DMA->dma_addr[AD_MID ] & 0xff) << 8;
- ad |= (DMA->dma_addr[AD_HIGH] & 0xff) <<16;
- return(ad);
-}
-
-/*
- * Program the DMA-controller to transfer 'nblk' blocks of 512 bytes.
- * The DMA_WRBIT trick flushes the FIFO before doing DMA.
- */
-void
-st_dmacomm(mode, nblk)
-int mode, nblk;
-{
- DMA->dma_mode = mode;
- DMA->dma_mode = mode ^ DMA_WRBIT;
- DMA->dma_mode = mode;
- DMA->dma_data = nblk;
- delay(2); /* Needed for Falcon */
- DMA->dma_mode = DMA_SCREG | (mode & DMA_WRBIT);
-}
diff --git a/sys/arch/atari/dev/event.c b/sys/arch/atari/dev/event.c
deleted file mode 100644
index c4ae6c8b89f..00000000000
--- a/sys/arch/atari/dev/event.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/* $NetBSD: event.c,v 1.2 1995/06/25 19:05:23 leo Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)event.c 8.1 (Berkeley) 6/11/93
- *
- * from: Header: event.c,v 1.5 92/11/26 01:10:44 torek Exp (LBL)
- */
-
-/*
- * Internal `Firm_event' interface for the keyboard and mouse drivers.
- */
-
-#include <sys/param.h>
-#include <sys/fcntl.h>
-#include <sys/malloc.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-#include <sys/vnode.h>
-
-#include <atari/dev/vuid_event.h>
-#include <atari/dev/event_var.h>
-
-/*
- * Initialize a firm_event queue.
- */
-void
-ev_init(ev)
- register struct evvar *ev;
-{
-
- ev->ev_get = ev->ev_put = 0;
- ev->ev_q = malloc((u_long)EV_QSIZE * sizeof(struct firm_event),
- M_DEVBUF, M_WAITOK);
- bzero((caddr_t)ev->ev_q, EV_QSIZE * sizeof(struct firm_event));
-}
-
-/*
- * Tear down a firm_event queue.
- */
-void
-ev_fini(ev)
- register struct evvar *ev;
-{
-
- free(ev->ev_q, M_DEVBUF);
-}
-
-/*
- * User-level interface: read, select.
- * (User cannot write an event queue.)
- */
-int
-ev_read(ev, uio, flags)
- register struct evvar *ev;
- struct uio *uio;
- int flags;
-{
- int s, n, cnt, error;
-
- /*
- * Make sure we can return at least 1.
- */
- if (uio->uio_resid < sizeof(struct firm_event))
- return (EMSGSIZE); /* ??? */
- s = splev();
- while (ev->ev_get == ev->ev_put) {
- if (flags & IO_NDELAY) {
- splx(s);
- return (EWOULDBLOCK);
- }
- ev->ev_wanted = 1;
- error = tsleep((caddr_t)ev, PEVENT | PCATCH, "firm_event", 0);
- if (error) {
- splx(s);
- return (error);
- }
- }
- /*
- * Move firm_events from tail end of queue (there is at least one
- * there).
- */
- if (ev->ev_put < ev->ev_get)
- cnt = EV_QSIZE - ev->ev_get; /* events in [get..QSIZE) */
- else
- cnt = ev->ev_put - ev->ev_get; /* events in [get..put) */
- splx(s);
- n = howmany(uio->uio_resid, sizeof(struct firm_event));
- if (cnt > n)
- cnt = n;
- error = uiomove((caddr_t)&ev->ev_q[ev->ev_get],
- cnt * sizeof(struct firm_event), uio);
- n -= cnt;
- /*
- * If we do not wrap to 0, used up all our space, or had an error,
- * stop. Otherwise move from front of queue to put index, if there
- * is anything there to move.
- */
- if ((ev->ev_get = (ev->ev_get + cnt) % EV_QSIZE) != 0 ||
- n == 0 || error || (cnt = ev->ev_put) == 0)
- return (error);
- if (cnt > n)
- cnt = n;
- error = uiomove((caddr_t)&ev->ev_q[0],
- cnt * sizeof(struct firm_event), uio);
- ev->ev_get = cnt;
- return (error);
-}
-
-int
-ev_select(ev, rw, p)
- register struct evvar *ev;
- int rw;
- struct proc *p;
-{
- int s = splev();
-
- switch (rw) {
-
- case FREAD:
- /* succeed if there is something to read */
- if (ev->ev_get != ev->ev_put) {
- splx(s);
- return (1);
- }
- selrecord(p, &ev->ev_sel);
- break;
-
- case FWRITE:
- return (1); /* always fails => never blocks */
- }
- splx(s);
- return (0);
-}
diff --git a/sys/arch/atari/dev/event_var.h b/sys/arch/atari/dev/event_var.h
deleted file mode 100644
index 766bc2632fa..00000000000
--- a/sys/arch/atari/dev/event_var.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* $NetBSD: event_var.h,v 1.1.1.1 1995/03/26 07:12:13 leo Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)event_var.h 8.1 (Berkeley) 6/11/93
- *
- * from: Header: event_var.h,v 1.5 92/11/26 01:11:51 torek Exp (LBL)
- */
-
-/*
- * Internal `Firm_event' interface for the keyboard and mouse drivers.
- * The drivers are expected not to place events in the queue above spltty(),
- * i.e., are expected to run off serial ports.
- */
-
-/* EV_QSIZE should be a power of two so that `%' is fast */
-#define EV_QSIZE 256 /* may need tuning; this uses 2k */
-
-struct evvar {
- u_int ev_get; /* get (read) index (modified synchronously) */
- volatile u_int ev_put; /* put (write) index (modified by interrupt) */
- struct selinfo ev_sel; /* process selecting */
- struct proc *ev_io; /* process that opened queue (can get SIGIO) */
- char ev_wanted; /* wake up on input ready */
- char ev_async; /* send SIGIO on input ready */
- struct firm_event *ev_q;/* circular buffer (queue) of events */
-};
-
-#define splev() spltty()
-
-#define EV_WAKEUP(ev) { \
- selwakeup(&(ev)->ev_sel); \
- if ((ev)->ev_wanted) { \
- (ev)->ev_wanted = 0; \
- wakeup((caddr_t)(ev)); \
- } \
- if ((ev)->ev_async) \
- psignal((ev)->ev_io, SIGIO); \
-}
-
-void ev_init __P((struct evvar *));
-void ev_fini __P((struct evvar *));
-int ev_read __P((struct evvar *, struct uio *, int));
-int ev_select __P((struct evvar *, int, struct proc *));
-
-/*
- * PEVENT is set just above PSOCK, which is just above TTIPRI, on the
- * theory that mouse and keyboard `user' input should be quick.
- */
-#define PEVENT 23
diff --git a/sys/arch/atari/dev/fd.c b/sys/arch/atari/dev/fd.c
deleted file mode 100644
index 7e11c9e14d7..00000000000
--- a/sys/arch/atari/dev/fd.c
+++ /dev/null
@@ -1,1261 +0,0 @@
-/* $NetBSD: fd.c,v 1.13 1996/01/07 22:02:05 thorpej Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This file contains a driver for the Floppy Disk Controller (FDC)
- * on the Atari TT. It uses the WD 1772 chip, modified for steprates.
- *
- * The ST floppy disk controller shares the access to the DMA circuitry
- * with other devices. For this reason the floppy disk controller makes
- * use of some special DMA accessing code.
- *
- * Interrupts from the FDC are in fact DMA interrupts which get their
- * first level handling in 'dma.c' . If the floppy driver is currently
- * using DMA the interrupt is signalled to 'fdcint'.
- *
- * TODO:
- * - Test it with 2 drives (I don't have them)
- * - Test it with an HD-drive (Don't have that either)
- * - Finish ioctl's
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/buf.h>
-#include <sys/device.h>
-#include <sys/ioctl.h>
-#include <sys/fcntl.h>
-#include <sys/conf.h>
-#include <sys/disklabel.h>
-#include <sys/disk.h>
-#include <sys/dkbad.h>
-#include <atari/atari/device.h>
-#include <machine/disklabel.h>
-#include <machine/iomap.h>
-#include <machine/mfp.h>
-#include <machine/dma.h>
-#include <machine/video.h>
-#include <atari/dev/fdreg.h>
-
-/*
- * Be verbose for debugging
- */
-/*#define FLP_DEBUG 1 */
-
-#define FDC_MAX_DMA_AD 0x1000000 /* No DMA possible beyond */
-
-/* Parameters for the disk drive. */
-#define SECTOR_SIZE 512 /* physical sector size in bytes */
-#define NR_DRIVES 2 /* maximum number of drives */
-#define NR_TYPES 3 /* number of diskette/drive combinations*/
-#define MAX_ERRORS 10 /* how often to try rd/wt before quitting*/
-#define STEP_DELAY 6000 /* 6ms (6000us) delay after stepping */
-
-
-#define INV_TRK 32000 /* Should fit in unsigned short */
-#define INV_PART NR_TYPES
-
-/*
- * Driver states
- */
-#define FLP_IDLE 0x00 /* floppy is idle */
-#define FLP_MON 0x01 /* idle with motor on */
-#define FLP_STAT 0x02 /* determine floppy status */
-#define FLP_XFER 0x04 /* read/write data from floppy */
-
-/*
- * Timer delay's
- */
-#define FLP_MONDELAY (3 * hz) /* motor-on delay */
-#define FLP_XFERDELAY (2 * hz) /* timeout on transfer */
-
-/*
- * The density codes
- */
-#define FLP_DD 0 /* Double density */
-#define FLP_HD 1 /* High density */
-
-
-#define b_block b_resid /* FIXME: this is not the place */
-
-/*
- * Global data for all physical floppy devices
- */
-static short selected = 0; /* drive/head currently selected*/
-static short motoron = 0; /* motor is spinning */
-static short nopens = 0; /* Number of opens executed */
-
-static short fd_state = FLP_IDLE; /* Current driver state */
-static int lock_stat= 0; /* dma locking status */
-static short fd_cmd = 0; /* command being executed */
-static char *fd_error= NULL; /* error from fd_xfer_ok() */
-
-/*
- * Private per device data
- */
-struct fd_softc {
- struct device sc_dv; /* generic device info */
- struct disk dkdev; /* generic disk info */
- struct buf bufq; /* queue of buf's */
- int unit; /* unit for atari controlling hw*/
- int nheads; /* number of heads in use */
- int nsectors; /* number of sectors/track */
- int density; /* density code */
- int nblocks; /* number of blocks on disk */
- int curtrk; /* track head positioned on */
- short flags; /* misc flags */
- short part; /* Current open partition */
- int sector; /* logical sector for I/O */
- caddr_t io_data; /* KVA for data transfer */
- int io_bytes; /* bytes left for I/O */
- int io_dir; /* B_READ/B_WRITE */
- int errcnt; /* current error count */
- u_char *bounceb; /* Bounce buffer */
-
-};
-
-/*
- * Flags in fd_softc:
- */
-#define FLPF_NOTRESP 0x001 /* Unit not responding */
-#define FLPF_ISOPEN 0x002 /* Unit is open */
-#define FLPF_SPARE 0x004 /* Not used */
-#define FLPF_HAVELAB 0x008 /* We have a valid label */
-#define FLPF_BOUNCE 0x010 /* Now using the bounce buffer */
-#define FLPF_WRTPROT 0x020 /* Unit is write-protected */
-#define FLPF_EMPTY 0x040 /* Unit is empty */
-#define FLPF_INOPEN 0x080 /* Currently being opened */
-#define FLPF_GETSTAT 0x100 /* Getting unit status */
-
-struct fd_types {
- int nheads; /* Heads in use */
- int nsectors; /* sectors per track */
- int nblocks; /* number of blocks */
- int density; /* density code */
-} fdtypes[NR_TYPES] = {
- { 1, 9, 720 , FLP_DD }, /* 360 Kb */
- { 2, 9, 1440 , FLP_DD }, /* 720 Kb */
- { 2, 18, 2880 , FLP_HD }, /* 1.44 Mb */
-};
-
-typedef void (*FPV)();
-
-/*
- * Private drive functions....
- */
-static void fdstart __P((struct fd_softc *));
-static void fddone __P((struct fd_softc *));
-static void fdstatus __P((struct fd_softc *));
-static void fd_xfer __P((struct fd_softc *));
-static void fdcint __P((struct fd_softc *));
-static int fd_xfer_ok __P((struct fd_softc *));
-static void fdmotoroff __P((struct fd_softc *));
-static void fdminphys __P((struct buf *));
-static void fdtestdrv __P((struct fd_softc *));
-static int fdgetdisklabel __P((struct fd_softc *, dev_t));
-static int fdselect __P((int, int, int));
-static void fddeselect __P((void));
-static void fdmoff __P((struct fd_softc *));
-
-extern __inline__ u_char read_fdreg(u_short regno)
-{
- DMA->dma_mode = regno;
- return(DMA->dma_data);
-}
-
-extern __inline__ void write_fdreg(u_short regno, u_short val)
-{
- DMA->dma_mode = regno;
- DMA->dma_data = val;
-}
-
-extern __inline__ u_char read_dmastat(void)
-{
- DMA->dma_mode = FDC_CS | DMA_SCREG;
- return(DMA->dma_stat);
-}
-
-/*
- * Autoconfig stuff....
- */
-static int fdcmatch __P((struct device *, struct cfdata *, void *));
-static int fdcprint __P((void *, const char *));
-static void fdcattach __P((struct device *, struct device *, void *));
-
-struct cfdriver fdccd = {
- NULL, "fdc", (cfmatch_t)fdcmatch, fdcattach, DV_DULL,
- sizeof(struct device), NULL, 0 };
-
-static int
-fdcmatch(pdp, cfp, auxp)
-struct device *pdp;
-struct cfdata *cfp;
-void *auxp;
-{
- if(strcmp("fdc", auxp) || cfp->cf_unit != 0)
- return(0);
- return(1);
-}
-
-static void
-fdcattach(pdp, dp, auxp)
-struct device *pdp, *dp;
-void *auxp;
-{
- extern struct cfdriver fdcd;
-
- struct fd_softc fdsoftc;
- int i, nfound, first_found = 0;
-
- printf("\n");
- fddeselect();
- for(i = 0; i < NR_DRIVES; i++) {
-
- /*
- * Test if unit is present
- */
- fdsoftc.unit = i;
- fdsoftc.flags = 0;
- st_dmagrab(fdcint, fdtestdrv, &fdsoftc, &lock_stat, 0);
- st_dmafree(&fdsoftc, &lock_stat);
-
- if(!(fdsoftc.flags & FLPF_NOTRESP)) {
- if(!nfound)
- first_found = i;
- nfound++;
- config_found(dp, (void*)i, fdcprint);
- }
- }
-
- if(nfound) {
-
- /*
- * Make sure motor will be turned of when a floppy is
- * inserted in the first selected drive.
- */
- fdselect(first_found, 0, FLP_DD);
- fd_state = FLP_MON;
- timeout((FPV)fdmotoroff, (void*)getsoftc(fdcd, first_found),
- FLP_MONDELAY);
-
- /*
- * enable disk related interrupts
- */
- MFP->mf_ierb |= IB_DINT;
- MFP->mf_iprb &= ~IB_DINT;
- MFP->mf_imrb |= IB_DINT;
- }
-}
-
-static int
-fdcprint(auxp, pnp)
-void *auxp;
-const char *pnp;
-{
- return(UNCONF);
-}
-
-static int fdmatch __P((struct device *, struct cfdata *, void *));
-static void fdattach __P((struct device *, struct device *, void *));
- void fdstrategy __P((struct buf *));
-struct dkdriver fddkdriver = { fdstrategy };
-
-struct cfdriver fdcd = {
- NULL, "fd", (cfmatch_t)fdmatch, fdattach, DV_DISK,
- sizeof(struct fd_softc), NULL, 0 };
-
-static int
-fdmatch(pdp, cfp, auxp)
-struct device *pdp;
-struct cfdata *cfp;
-void *auxp;
-{
- int unit = (int)auxp;
- return(1);
-}
-
-static void
-fdattach(pdp, dp, auxp)
-struct device *pdp, *dp;
-void *auxp;
-{
- struct fd_softc *sc;
-
- sc = (struct fd_softc *)dp;
-
- printf("\n");
-
- /*
- * Initialize and attach the disk structure.
- */
- sc->dkdev.dk_name = sc->sc_dv.dv_xname;
- sc->dkdev.dk_driver = &fddkdriver;
- disk_attach(&sc->dkdev);
-}
-
-fdioctl(dev, cmd, addr, flag, p)
-dev_t dev;
-u_long cmd;
-int flag;
-caddr_t addr;
-struct proc *p;
-{
- struct fd_softc *sc;
- void *data;
-
- sc = getsoftc(fdcd, DISKUNIT(dev));
-
- if((sc->flags & FLPF_HAVELAB) == 0)
- return(EBADF);
-
- switch(cmd) {
- case DIOCSBAD:
- return(EINVAL);
- case DIOCGDINFO:
- *(struct disklabel *)addr = *(sc->dkdev.dk_label);
- return(0);
- case DIOCGPART:
- ((struct partinfo *)addr)->disklab =
- sc->dkdev.dk_label;
- ((struct partinfo *)addr)->part =
- &sc->dkdev.dk_label->d_partitions[DISKPART(dev)];
- return(0);
-#ifdef notyet /* XXX LWP */
- case DIOCSRETRIES:
- case DIOCSSTEP:
- case DIOCSDINFO:
- case DIOCWDINFO:
- case DIOCWLABEL:
-#endif /* notyet */
- default:
- return(ENOTTY);
- }
-}
-
-/*
- * Open the device. If this is the first open on both the floppy devices,
- * intialize the controller.
- * Note that partition info on the floppy device is used to distinguise
- * between 780Kb and 360Kb floppy's.
- * partition 0: 360Kb
- * partition 1: 780Kb
- */
-Fdopen(dev, flags, devtype, proc)
-dev_t dev;
-int flags, devtype;
-struct proc *proc;
-{
- struct fd_softc *sc;
- int sps;
-
-#ifdef FLP_DEBUG
- printf("Fdopen dev=0x%x\n", dev);
-#endif
-
- if(DISKPART(dev) >= NR_TYPES)
- return(ENXIO);
-
- if((sc = getsoftc(fdcd, DISKUNIT(dev))) == NULL)
- return(ENXIO);
-
- /*
- * If no floppy currently open, reset the controller and select
- * floppy type.
- */
- if(!nopens) {
-
-#ifdef FLP_DEBUG
- printf("Fdopen device not yet open\n");
-#endif
- nopens++;
- write_fdreg(FDC_CS, IRUPT);
- delay(40);
- }
-
- /*
- * Sleep while other process is opening the device
- */
- sps = splbio();
- while(sc->flags & FLPF_INOPEN)
- tsleep((caddr_t)sc, PRIBIO, "Fdopen", 0);
- splx(sps);
-
- if(!(sc->flags & FLPF_ISOPEN)) {
- /*
- * Initialise some driver values.
- */
- int part = DISKPART(dev);
- void *addr;
-
- sc->bufq.b_actf = NULL;
- sc->unit = DISKUNIT(dev);
- sc->part = part;
- sc->nheads = fdtypes[part].nheads;
- sc->nsectors = fdtypes[part].nsectors;
- sc->nblocks = fdtypes[part].nblocks;
- sc->density = fdtypes[part].density;
- sc->curtrk = INV_TRK;
- sc->sector = 0;
- sc->errcnt = 0;
- sc->bounceb = (u_char*)alloc_stmem(SECTOR_SIZE, &addr);
- if(sc->bounceb == NULL)
- return(ENOMEM); /* XXX */
-
- /*
- * Go get write protect + loaded status
- */
- sc->flags |= FLPF_INOPEN|FLPF_GETSTAT;
- sps = splbio();
- st_dmagrab(fdcint, fdstatus, sc, &lock_stat, 0);
- while(sc->flags & FLPF_GETSTAT)
- tsleep((caddr_t)sc, PRIBIO, "Fdopen", 0);
- splx(sps);
- wakeup((caddr_t)sc);
-
- if((sc->flags & FLPF_WRTPROT) && (flags & FWRITE)) {
- sc->flags = 0;
- return(EPERM);
- }
- if(sc->flags & FLPF_EMPTY) {
- sc->flags = 0;
- return(ENXIO);
- }
- sc->flags &= ~(FLPF_INOPEN|FLPF_GETSTAT);
- sc->flags |= FLPF_ISOPEN;
- }
- else {
- /*
- * Multiply opens are granted when accessing the same type of
- * floppy (eq. the same partition).
- */
- if(sc->part != DISKPART(dev))
- return(ENXIO); /* XXX temporarely out of business */
- }
- fdgetdisklabel(sc, dev);
-#ifdef FLP_DEBUG
- printf("Fdopen open succeeded on type %d\n", sc->part);
-#endif
-}
-
-fdclose(dev, flags, devtype, proc)
-dev_t dev;
-int flags, devtype;
-struct proc *proc;
-{
- struct fd_softc *sc;
-
- sc = getsoftc(fdcd, DISKUNIT(dev));
- free_stmem(sc->bounceb);
- sc->flags = 0;
- nopens--;
-
-#ifdef FLP_DEBUG
- printf("Closed floppy device -- nopens: %d\n", nopens);
-#endif
- return(0);
-}
-
-void
-fdstrategy(bp)
-struct buf *bp;
-{
- struct fd_softc *sc;
- struct disklabel *lp;
- int sps, nblocks;
-
- sc = getsoftc(fdcd, DISKUNIT(bp->b_dev));
-
-#ifdef FLP_DEBUG
- printf("fdstrategy: 0x%x\n", bp);
-#endif
-
- /*
- * check for valid partition and bounds
- */
- lp = sc->dkdev.dk_label;
- if ((sc->flags & FLPF_HAVELAB) == 0) {
- bp->b_error = EIO;
- goto bad;
- }
- if (bounds_check_with_label(bp, lp, sc->dkdev.dk_cpulabel, 0) <= 0)
- goto done;
-
- if (bp->b_bcount == 0)
- goto done;
-
- /*
- * queue the buf and kick the low level code
- */
- sps = splbio();
- disksort(&sc->bufq, bp);
- if (!lock_stat) {
- if (fd_state & FLP_MON)
- untimeout((FPV)fdmotoroff, (void*)sc);
- fd_state = FLP_IDLE;
- st_dmagrab(fdcint, fdstart, sc, &lock_stat, 0);
- }
- splx(sps);
-
- return;
-bad:
- bp->b_flags |= B_ERROR;
-done:
- bp->b_resid = bp->b_bcount;
- biodone(bp);
-}
-
-/*
- * no dumps to floppy disks thank you.
- */
-int
-fddump(dev_t dev)
-{
- return(ENXIO);
-}
-
-/*
- * no dumps to floppy disks thank you.
- */
-int
-fdsize(dev)
-dev_t dev;
-{
- return(-1);
-}
-
-int
-fdread(dev, uio)
-dev_t dev;
-struct uio *uio;
-{
- return(physio(fdstrategy, NULL, dev, B_READ, fdminphys, uio));
-}
-
-int
-fdwrite(dev, uio)
-dev_t dev;
-struct uio *uio;
-{
- return(physio(fdstrategy, NULL, dev, B_WRITE, fdminphys, uio));
-}
-
-/*
- * Called through DMA-dispatcher, get status.
- */
-static void
-fdstatus(sc)
-struct fd_softc *sc;
-{
-#ifdef FLP_DEBUG
- printf("fdstatus\n");
-#endif
- sc->errcnt = 0;
- fd_state = FLP_STAT;
- fd_xfer(sc);
-}
-
-/*
- * Called through the dma-dispatcher. So we know we are the only ones
- * messing with the floppy-controler.
- * Initialize some fields in the fdsoftc for the state-machine and get
- * it going.
- */
-static void
-fdstart(sc)
-struct fd_softc *sc;
-{
- struct buf *bp;
-
- bp = sc->bufq.b_actf;
- sc->sector = bp->b_blkno; /* Start sector for I/O */
- sc->io_data = bp->b_data; /* KVA base for I/O */
- sc->io_bytes = bp->b_bcount; /* Transfer size in bytes */
- sc->io_dir = bp->b_flags & B_READ;/* Direction of transfer */
- sc->errcnt = 0; /* No errors yet */
- fd_state = FLP_XFER; /* Yes, we're going to transfer */
-
- /* Instrumentation. */
- disk_busy(&sc->dkdev);
-
- fd_xfer(sc);
-}
-
-/*
- * The current transaction is finished (for good or bad). Let go of
- * the the dma-resources. Call biodone() to finish the transaction.
- * Find a new transaction to work on.
- */
-static void
-fddone(sc)
-register struct fd_softc *sc;
-{
- struct buf *bp, *dp;
- struct fd_softc *sc1;
- int i, sps;
-
- /*
- * Give others a chance to use the dma.
- */
- st_dmafree(sc, &lock_stat);
-
-
- if(fd_state != FLP_STAT) {
- /*
- * Finish current transaction.
- */
- sps = splbio();
- dp = &sc->bufq;
- bp = dp->b_actf;
- if(bp == NULL)
- panic("fddone");
- dp->b_actf = bp->b_actf;
- splx(sps);
-
-#ifdef FLP_DEBUG
- printf("fddone: unit: %d, buf: %x, resid: %d\n",sc->unit,bp,
- sc->io_bytes);
-#endif
- bp->b_resid = sc->io_bytes;
-
- disk_unbusy(&sc->dkdev, (bp->b_bcount - bp->b_resid));
-
- biodone(bp);
- }
- fd_state = FLP_MON;
-
- if(lock_stat)
- return; /* XXX Is this possible? */
-
- /*
- * Find a new transaction on round-robin basis.
- */
- for(i = sc->unit + 1; ;i++) {
- if(i >= fdcd.cd_ndevs)
- i = 0;
- if((sc1 = fdcd.cd_devs[i]) == NULL)
- continue;
- if(sc1->bufq.b_actf)
- break;
- if(i == sc->unit) {
- timeout((FPV)fdmotoroff, (void*)sc, FLP_MONDELAY);
-#ifdef FLP_DEBUG
- printf("fddone: Nothing to do\n");
-#endif
- return; /* No work */
- }
- }
- fd_state = FLP_IDLE;
-#ifdef FLP_DEBUG
- printf("fddone: Staring job on unit %d\n", sc1->unit);
-#endif
- st_dmagrab(fdcint, fdstart, sc1, &lock_stat, 0);
-}
-
-static int
-fdselect(drive, head, dense)
-int drive, head, dense;
-{
- int i, sps, spinning;
-#ifdef FLP_DEBUG
- printf("fdselect: drive=%d, head=%d, dense=%d\n", drive, head, dense);
-#endif
- i = ((drive == 1) ? PA_FLOP1 : PA_FLOP0) | head;
- spinning = motoron;
- motoron = 1;
-
- switch(dense) {
- case FLP_DD:
- DMA->dma_drvmode = 0;
- break;
- case FLP_HD:
- DMA->dma_drvmode = (FDC_HDSET|FDC_HDSIG);
- break;
- default:
- panic("fdselect: unknown density code");
- }
- if(i != selected) {
- sps = splhigh();
-
- selected = i;
- SOUND->sd_selr = YM_IOA;
- SOUND->sd_wdat = (SOUND->sd_rdat & 0x78) | (i ^ 0x07);
- splx(sps);
- }
- return(spinning);
-}
-
-static void
-fddeselect()
-{
- int sps;
-
- sps = splhigh();
- SOUND->sd_selr = YM_IOA;
- SOUND->sd_wdat = SOUND->sd_rdat | 0x07;
- splx(sps);
-
- motoron = selected = 0;
- DMA->dma_drvmode = 0;
-}
-
-/****************************************************************************
- * The following functions assume to be running as a result of a *
- * disk-interrupt (e.q. spl = splbio). *
- * They form the finit-state machine, the actual driver. *
- * *
- * fdstart()/ --> fd_xfer() -> activate hardware *
- * fdopen() ^ *
- * | *
- * +-- not ready -<------------+ *
- * | *
- * fdmotoroff()/ --> fdcint() -> fd_xfer_ok() ---+ *
- * h/w interrupt | *
- * \|/ *
- * finished ---> fdone() *
- * *
- ****************************************************************************/
-static void
-fd_xfer(sc)
-struct fd_softc *sc;
-{
- register int head = 0;
- register int track, sector, hbit;
- int i;
- u_long phys_addr;
-
- switch(fd_state) {
- case FLP_XFER:
- /*
- * Calculate head/track values
- */
- track = sc->sector / sc->nsectors;
- head = track % sc->nheads;
- track = track / sc->nheads;
-#ifdef FLP_DEBUG
- printf("fd_xfer: sector:%d,head:%d,track:%d\n", sc->sector,head,
- track);
-#endif
- break;
-
- case FLP_STAT:
- /*
- * FLP_STAT only wants to recalibrate
- */
- sc->curtrk = INV_TRK;
- break;
- default:
- panic("fd_xfer: wrong state (0x%x)", fd_state);
- }
-
- /*
- * Select the drive.
- */
- hbit = fdselect(sc->unit, head, sc->density) ? HBIT : 0;
-
- if(sc->curtrk == INV_TRK) {
- /*
- * Recalibrate, since we lost track of head positioning.
- * The floppy disk controller has no way of determining its
- * absolute arm position (track). Instead, it steps the
- * arm a track at a time and keeps track of where it
- * thinks it is (in software). However, after a SEEK, the
- * hardware reads information from the diskette telling
- * where the arm actually is. If the arm is in the wrong place,
- * a recalibration is done, which forces the arm to track 0.
- * This way the controller can get back into sync with reality.
- */
- fd_cmd = RESTORE;
- write_fdreg(FDC_CS, RESTORE|VBIT|hbit);
- timeout((FPV)fdmotoroff, (void*)sc, FLP_XFERDELAY);
-
-#ifdef FLP_DEBUG
- printf("fd_xfer:Recalibrating drive %d\n", sc->unit);
-#endif
- return;
- }
-
- write_fdreg(FDC_TR, sc->curtrk);
-
- /*
- * Issue a SEEK command on the indicated drive unless the arm is
- * already positioned on the correct track.
- */
- if(track != sc->curtrk) {
- sc->curtrk = track; /* be optimistic */
- write_fdreg(FDC_DR, track);
- write_fdreg(FDC_CS, SEEK|RATE6|VBIT|hbit);
- timeout((FPV)fdmotoroff, (void*)sc, FLP_XFERDELAY);
- fd_cmd = SEEK;
-#ifdef FLP_DEBUG
- printf("fd_xfer:Seek to track %d on drive %d\n",track,sc->unit);
-#endif
- return;
- }
-
- /*
- * The drive is now on the proper track. Read or write 1 block.
- */
- sector = sc->sector % sc->nsectors;
- sector++; /* start numbering at 1 */
-
- write_fdreg(FDC_SR, sector);
-
- phys_addr = (u_long)kvtop(sc->io_data);
- if(phys_addr >= FDC_MAX_DMA_AD) {
- /*
- * We _must_ bounce this address
- */
- phys_addr = (u_long)kvtop(sc->bounceb);
- if(sc->io_dir == B_WRITE)
- bcopy(sc->io_data, sc->bounceb, SECTOR_SIZE);
- sc->flags |= FLPF_BOUNCE;
- }
- st_dmaaddr_set((caddr_t)phys_addr); /* DMA address setup */
-
-#ifdef FLP_DEBUG
- printf("fd_xfer:Start io (io_addr:%x)\n", kvtop(sc->io_data));
-#endif
-
- if(sc->io_dir == B_READ) {
- /* Issue the command */
- st_dmacomm(DMA_FDC | DMA_SCREG, 1);
- write_fdreg(FDC_CS, F_READ|hbit);
- fd_cmd = F_READ;
- }
- else {
- /* Issue the command */
- st_dmacomm(DMA_WRBIT | DMA_FDC | DMA_SCREG, 1);
- write_fdreg(DMA_WRBIT | FDC_CS, F_WRITE|hbit|EBIT|PBIT);
- fd_cmd = F_WRITE;
- }
- timeout((FPV)fdmotoroff, (void*)sc, FLP_XFERDELAY);
-}
-
-/* return values of fd_xfer_ok(): */
-#define X_OK 0
-#define X_AGAIN 1
-#define X_ERROR 2
-#define X_FAIL 3
-
-/*
- * Hardware interrupt function.
- */
-static void
-fdcint(sc)
-struct fd_softc *sc;
-{
- struct buf *bp;
-
-#ifdef FLP_DEBUG
- printf("fdcint: unit = %d\n", sc->unit);
-#endif
-
- /*
- * Cancel timeout (we made it, didn't we)
- */
- untimeout((FPV)fdmotoroff, (void*)sc);
-
- switch(fd_xfer_ok(sc)) {
- case X_ERROR :
- if(++(sc->errcnt) < MAX_ERRORS) {
- /*
- * Command failed but still retries left.
- */
- break;
- }
- /* FALL THROUGH */
- case X_FAIL :
- /*
- * Non recoverable error. Fall back to motor-on
- * idle-state.
- */
- if(fd_error != NULL) {
- printf("Floppy error: %s\n", fd_error);
- fd_error = NULL;
- }
-
- if(fd_state == FLP_STAT) {
- sc->flags |= FLPF_EMPTY;
- sc->flags &= ~FLPF_GETSTAT;
- wakeup((caddr_t)sc);
- fddone(sc);
- return;
- }
-
- bp = sc->bufq.b_actf;
-
- bp->b_error = EIO;
- bp->b_flags |= B_ERROR;
- fd_state = FLP_MON;
-
- break;
- case X_AGAIN:
- /*
- * Start next part of state machine.
- */
- break;
- case X_OK:
- /*
- * Command ok and finished. Reset error-counter.
- * If there are no more bytes to transfer fall back
- * to motor-on idle state.
- */
- sc->errcnt = 0;
-
- if(fd_state == FLP_STAT) {
- sc->flags &= ~FLPF_GETSTAT;
- wakeup((caddr_t)sc);
- fddone(sc);
- return;
- }
-
- if((sc->flags & FLPF_BOUNCE) && (sc->io_dir == B_READ))
- bcopy(sc->bounceb, sc->io_data, SECTOR_SIZE);
- sc->flags &= ~FLPF_BOUNCE;
-
- sc->sector++;
- sc->io_data += SECTOR_SIZE;
- sc->io_bytes -= SECTOR_SIZE;
- if(sc->io_bytes <= 0)
- fd_state = FLP_MON;
- }
- if(fd_state == FLP_MON)
- fddone(sc);
- else fd_xfer(sc);
-}
-
-/*
- * Determine status of last command. Should only be called through
- * 'fdcint()'.
- * Returns:
- * X_ERROR : Error on command; might succeed next time.
- * X_FAIL : Error on command; will never succeed.
- * X_AGAIN : Part of a command succeeded, call 'fd_xfer()' to complete.
- * X_OK : Command succeeded and is complete.
- *
- * This function only affects sc->curtrk.
- */
-static int
-fd_xfer_ok(sc)
-register struct fd_softc *sc;
-{
- register int status;
-
-#ifdef FLP_DEBUG
- printf("fd_xfer_ok: cmd: 0x%x, state: 0x%x\n", fd_cmd, fd_state);
-#endif
- switch(fd_cmd) {
- case IRUPT:
- /*
- * Timeout. Force a recalibrate before we try again.
- */
- status = read_fdreg(FDC_CS);
-
- fd_error = "Timeout";
- sc->curtrk = INV_TRK;
- return(X_ERROR);
- case F_READ:
- /*
- * Test for DMA error
- */
- status = read_dmastat();
- if(!(status & DMAOK)) {
- fd_error = "Dma error";
- return(X_ERROR);
- }
- /*
- * Get controller status and check for errors.
- */
- status = read_fdreg(FDC_CS);
- if(status & (RNF | CRCERR | LD_T00)) {
- fd_error = "Read error";
- if(status & RNF)
- sc->curtrk = INV_TRK;
- return(X_ERROR);
- }
- break;
- case F_WRITE:
- /*
- * Test for DMA error
- */
- status = read_dmastat();
- if(!(status & DMAOK)) {
- fd_error = "Dma error";
- return(X_ERROR);
- }
- /*
- * Get controller status and check for errors.
- */
- status = read_fdreg(FDC_CS);
- if(status & WRI_PRO) {
- fd_error = "Write protected";
- return(X_FAIL);
- }
- if(status & (RNF | CRCERR | LD_T00)) {
- fd_error = "Write error";
- sc->curtrk = INV_TRK;
- return(X_ERROR);
- }
- break;
- case SEEK:
- status = read_fdreg(FDC_CS);
- if(status & (RNF | CRCERR)) {
- fd_error = "Seek error";
- sc->curtrk = INV_TRK;
- return(X_ERROR);
- }
- return(X_AGAIN);
- case RESTORE:
- /*
- * Determine if the recalibration succeeded.
- */
- status = read_fdreg(FDC_CS);
- if(status & RNF) {
- fd_error = "Recalibrate error";
- /* reset controller */
- write_fdreg(FDC_CS, IRUPT);
- sc->curtrk = INV_TRK;
- return(X_ERROR);
- }
- sc->curtrk = 0;
- if(fd_state == FLP_STAT) {
- if(status & WRI_PRO)
- sc->flags |= FLPF_WRTPROT;
- break;
- }
- return(X_AGAIN);
- default:
- fd_error = "Driver error: fd_xfer_ok : Unknown state";
- return(X_FAIL);
- }
- return(X_OK);
-}
-
-/*
- * All timeouts will call this function.
- */
-static void
-fdmotoroff(sc)
-struct fd_softc *sc;
-{
- int sps;
-
- /*
- * Get at harware interrupt level
- */
- sps = splbio();
-
-#if FLP_DEBUG
- printf("fdmotoroff, state = 0x%x\n", fd_state);
-#endif
-
- switch(fd_state) {
- case FLP_STAT :
- case FLP_XFER :
- /*
- * Timeout during a transfer; cancel transaction
- * set command to 'IRUPT'.
- * A drive-interrupt is simulated to trigger the state
- * machine.
- */
- /*
- * Cancel current transaction
- */
- fd_cmd = IRUPT;
- write_fdreg(FDC_CS, IRUPT);
- delay(20);
- (void)read_fdreg(FDC_CS);
- write_fdreg(FDC_CS, RESTORE);
- break;
-
- case FLP_MON :
- /*
- * Turn motor off.
- */
- if(selected) {
- int tmp;
-
- st_dmagrab(fdcint, fdmoff, sc, &tmp, 0);
- }
- else fd_state = FLP_IDLE;
- break;
- }
- splx(sps);
-}
-
-/*
- * min byte count to whats left of the track in question
- */
-static void
-fdminphys(bp)
-struct buf *bp;
-{
- struct fd_softc *sc;
- int sec, toff, tsz;
-
- if((sc = getsoftc(fdcd, DISKUNIT(bp->b_dev))) == NULL)
- panic("fdminphys: couldn't get softc");
-
- sec = bp->b_blkno % (sc->nsectors * sc->nheads);
- toff = sec * SECTOR_SIZE;
- tsz = sc->nsectors * sc->nheads * SECTOR_SIZE;
-
-#ifdef FLP_DEBUG
- printf("fdminphys: before %d", bp->b_bcount);
-#endif
-
- bp->b_bcount = min(bp->b_bcount, tsz - toff);
-
-#ifdef FLP_DEBUG
- printf(" after %d\n", bp->b_bcount);
-#endif
-
- minphys(bp);
-}
-
-/*
- * Called from fdmotoroff to turn the motor actually off....
- * This can't be done in fdmotoroff itself, because exclusive access to the
- * DMA controller is needed to read the FDC-status register. The function
- * 'fdmoff()' always runs as the result of a 'dmagrab()'.
- * We need to test the status-register because we want to be sure that the
- * drive motor is really off before deselecting the drive. The FDC only
- * turns off the drive motor after having seen 10 index-pulses. You only
- * get index-pulses when a drive is selected....This means that if the
- * drive is deselected when the motor is still spinning, it will continue
- * to spin _even_ when you insert a floppy later on...
- */
-static void
-fdmoff(fdsoftc)
-struct fd_softc *fdsoftc;
-{
- int tmp;
-
- if ((fd_state == FLP_MON) && selected) {
- tmp = read_fdreg(FDC_CS);
- if (!(tmp & MOTORON)) {
- fddeselect();
- fd_state = FLP_IDLE;
- }
- else timeout((FPV)fdmotoroff, (void*)fdsoftc, 10*FLP_MONDELAY);
- }
- st_dmafree(fdsoftc, &tmp);
-}
-
-/*
- * Used to find out wich drives are actually connected. We do this by issueing
- * is 'RESTORE' command and check if the 'track-0' bit is set. This also works
- * if the drive is present but no floppy is inserted.
- */
-static void
-fdtestdrv(fdsoftc)
-struct fd_softc *fdsoftc;
-{
- int i, status;
-
- /*
- * Select the right unit and head.
- */
- fdselect(fdsoftc->unit, 0, FLP_DD);
-
- write_fdreg(FDC_CS, RESTORE|HBIT);
-
- /*
- * Wait for about 2 seconds.
- */
- delay(2000000);
-
- status = read_fdreg(FDC_CS);
- if(status & (RNF|BUSY)) {
- write_fdreg(FDC_CS, IRUPT); /* reset controller */
- delay(40);
- }
-
- if(!(status & LD_T00))
- fdsoftc->flags |= FLPF_NOTRESP;
-
- fddeselect();
-}
-
-/*
- * Build disk label. For now we only create a label from what we know
- * from 'sc'.
- */
-static int
-fdgetdisklabel(sc, dev)
-struct fd_softc *sc;
-dev_t dev;
-{
- struct disklabel *lp, *dlp;
- int part;
-
- /*
- * If we already got one, get out.
- */
- if(sc->flags & FLPF_HAVELAB)
- return(0);
-
-#ifdef FLP_DEBUG
- printf("fdgetdisklabel()\n");
-#endif
-
- part = DISKPART(dev);
- lp = sc->dkdev.dk_label;
- bzero(lp, sizeof(struct disklabel));
-
- lp->d_secsize = SECTOR_SIZE;
- lp->d_ntracks = sc->nheads;
- lp->d_nsectors = sc->nsectors;
- lp->d_secpercyl = lp->d_ntracks * lp->d_nsectors;
- lp->d_ncylinders = sc->nblocks / lp->d_secpercyl;
- lp->d_secperunit = sc->nblocks;
-
- lp->d_type = DTYPE_FLOPPY;
- lp->d_rpm = 300; /* good guess I suppose. */
- lp->d_interleave = 1; /* FIXME: is this OK? */
- lp->d_bbsize = 0;
- lp->d_sbsize = 0;
- lp->d_npartitions = part + 1;
- lp->d_trkseek = STEP_DELAY;
- lp->d_magic = DISKMAGIC;
- lp->d_magic2 = DISKMAGIC;
- lp->d_checksum = dkcksum(lp);
- lp->d_partitions[part].p_size = lp->d_secperunit;
- lp->d_partitions[part].p_fstype = FS_UNUSED;
- lp->d_partitions[part].p_fsize = 1024;
- lp->d_partitions[part].p_frag = 8;
- sc->flags |= FLPF_HAVELAB;
-
- return(0);
-}
diff --git a/sys/arch/atari/dev/fdreg.h b/sys/arch/atari/dev/fdreg.h
deleted file mode 100644
index 255fea0126d..00000000000
--- a/sys/arch/atari/dev/fdreg.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* $NetBSD: fdreg.h,v 1.2 1995/04/22 22:18:21 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _FDREG_H
-#define _FDREG_H
-/*
- * Atari TT hardware:
- * Western Digital 1772 Floppy Disk Controller.
- */
-
-/*
- * Accessing the FDC registers is indirect through ST-specific
- * DMA circuitry. See also dma.h.
- */
-#define FDC_CS (DMA_FDC ) /* command/status */
-#define FDC_TR (DMA_FDC| DMA_A0) /* track register */
-#define FDC_SR (DMA_FDC|DMA_A1 ) /* sector register */
-#define FDC_DR (DMA_FDC|DMA_A1|DMA_A0) /* data register */
-
-/*
- * commands (relevant bits/fields indicated)
- */
-#define RESTORE 0x00 /* ( HVRR) seek to track 0 */
-#define SEEK 0x10 /* ( HVRR) seek to track */
-#define STEP 0x20 /* (UHVRR) step in same direction */
-#define STEPI 0x40 /* (UHVRR) step in */
-#define STEPO 0x60 /* (UHVRR) step out */
-#define F_READ 0x80 /* (MHE00) read sector */
-#define F_WRITE 0xA0 /* (MHEPA) write sector */
-#define READID 0xC0 /* ( HE00) read sector ID */
-#define READTR 0xE0 /* ( HE00) read track */
-#define WRITETR 0xF0 /* ( HEP0) write track */
-#define IRUPT 0xD0 /* ( IIII) force interrupt */
-
-/*
- * other bits/fields in command register
- */
-#define RATE6 0x00 /* not 2, but 6 msec steprate */
-#define RATE12 0x01 /* not 3, but 12 msec steprate */
-#define RATE2 0x02 /* not 5, but 2 msec steprate */
-#define RATE3 0x03 /* not 6, but 3 msec steprate */
-#define VBIT 0x04 /* verify sector ID */
-#define HBIT 0x08 /* suppress motor on sequence */
-#define UBIT 0x10 /* update track register */
-#define EBIT 0x04 /* wait 30 msec to settle */
-#define MBIT 0x10 /* multi-sector */
-#define PBIT 0x02 /* write precompensate */
-#define A0BIT 0x01 /* suppress (?) data address mark */
-#define IINDEX 0x04 /* interrupt on each index pulse */
-#define IFORCE 0x08 /* force interrupt */
-
-/*
- * status register
- */
-#define BUSY 0x01 /* set if command under execution */
-#define DRQ 0x02 /* Data Register status (pin c1) */
-#define LD_T00 0x04 /* lost data; track 00 */
-#define CRCERR 0x08 /* CRC error */
-#define RNF 0x10 /* Record Not Found */
-#define RT_SU 0x20 /* Record Type; Spin Up completed */
-#define WRI_PRO 0x40 /* Write Protected */
-#define MOTORON 0x80 /* Motor On */
-
-#endif /* _FDREG_H */
diff --git a/sys/arch/atari/dev/font.h b/sys/arch/atari/dev/font.h
deleted file mode 100644
index c96b55a429e..00000000000
--- a/sys/arch/atari/dev/font.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $NetBSD: font.h,v 1.1.1.1 1995/03/26 07:12:13 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _FONT_H
-#define _FONT_H
-/*
- * What we like to know about fonts...
- */
-typedef struct {
- short boldsmear;
- unsigned char width;
- unsigned char height;
- unsigned char baseline;
- unsigned char font_lo;
- unsigned char font_hi;
- unsigned char *font_p;
-} font_info;
-
-#endif /* _FONT_H */
diff --git a/sys/arch/atari/dev/font_8x16.c b/sys/arch/atari/dev/font_8x16.c
deleted file mode 100644
index fa852f2f2a3..00000000000
--- a/sys/arch/atari/dev/font_8x16.c
+++ /dev/null
@@ -1,565 +0,0 @@
-/* $NetBSD: font_8x16.c,v 1.2 1995/09/23 20:25:34 leo Exp $ */
-
-/*
- * Copyright (c) 1992, 1993, 1994 Hellmuth Michaelis and Joerg Wunsch
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by
- * Hellmuth Michaelis and Joerg Wunsch
- * 4. The name authors may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Translated into compiler and human readable for for the Atari-TT port of
- * NetBSD by Leo Weppelman.
- *
- * Reorganized and edited some chars to fit the iso-8859-1 fontset by
- * Thomas Gerner
- */
-#include <atari/dev/font.h>
-
-char fontname_8x16[64] = "vt220iso.816";
-
-extern unsigned char fontdata_8x16[];
-font_info font_info_8x16 = { 1, 8, 16, 14, 0, 255, &fontdata_8x16[0] };
-
-int fontheight_8x16 = 16;
-int fontwidth_8x16 = 8;
-
-unsigned char fontdata_8x16[] = {
-/* 0x00 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x01 */ 0x00, 0x18, 0x18, 0x3c, 0x3c, 0x7e, 0x7e, 0xff,
- 0xff, 0x7e, 0x7e, 0x3c, 0x3c, 0x18, 0x18, 0x00,
-/* 0x02 */ 0x42, 0x99, 0x99, 0x42, 0x42, 0x99, 0x99, 0x42,
- 0x42, 0x99, 0x99, 0x42, 0x42, 0x99, 0x99, 0x42,
-/* 0x03 */ 0x00, 0x00, 0x90, 0x90, 0xf0, 0x90, 0x90, 0x00,
- 0x3e, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00,
-/* 0x04 */ 0x00, 0x00, 0xf0, 0x80, 0xe0, 0x80, 0x80, 0x00,
- 0x1e, 0x10, 0x1c, 0x10, 0x10, 0x00, 0x00, 0x00,
-/* 0x05 */ 0x00, 0x00, 0x60, 0x90, 0x80, 0x90, 0x60, 0x00,
- 0x1c, 0x12, 0x1c, 0x12, 0x12, 0x00, 0x00, 0x00,
-/* 0x06 */ 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0xf0, 0x00,
- 0x1e, 0x10, 0x1c, 0x10, 0x10, 0x00, 0x00, 0x00,
-/* 0x07 */ 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x08 */ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18,
- 0x18, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
-/* 0x09 */ 0x00, 0x00, 0x88, 0x98, 0xa8, 0xc8, 0x88, 0x00,
- 0x10, 0x10, 0x10, 0x10, 0x1e, 0x00, 0x00, 0x00,
-/* 0x0a */ 0x00, 0x00, 0x88, 0x88, 0x50, 0x50, 0x20, 0x00,
- 0x3e, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00,
-/* 0x0b */ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x0c */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8,
- 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-/* 0x0d */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f,
- 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-/* 0x0e */ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x0f */ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff,
- 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-/* 0x10 */ 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x11 */ 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x12 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x13 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
-/* 0x14 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
-/* 0x15 */ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f,
- 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-/* 0x16 */ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8,
- 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-/* 0x17 */ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x18 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
- 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-/* 0x19 */ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
- 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-/* 0x1a */ 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18,
- 0x0c, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00,
-/* 0x1b */ 0x00, 0x00, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18,
- 0x30, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00,
-/* 0x1c */ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x6c, 0x6c, 0x6c,
- 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00,
-/* 0x1d */ 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18,
- 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x1e */ 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60,
- 0x60, 0x60, 0xe6, 0xfc, 0x00, 0x00, 0x00, 0x00,
-/* 0x1f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* ' ' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* '!' */ 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18,
- 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
-/* '"' */ 0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* '#' */ 0x00, 0x00, 0x00, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c,
- 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00,
-/* '$' */ 0x00, 0x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c,
- 0x06, 0x86, 0xc6, 0x7c, 0x18, 0x18, 0x00, 0x00,
-/* '%' */ 0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18,
- 0x30, 0x60, 0xc6, 0x86, 0x00, 0x00, 0x00, 0x00,
-/* '&' */ 0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x76, 0xdc,
- 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
-/* ''' */ 0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* '(' */ 0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30,
- 0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00,
-/* ')' */ 0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c,
- 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
-/* '*' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff,
- 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* '+' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e,
- 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* ',' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00,
-/* '-' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* '.' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
-/* '/' */ 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18,
- 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00,
-/* '0' */ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xce, 0xde, 0xf6,
- 0xe6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* '1' */ 0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18,
- 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
-/* '2' */ 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x0c, 0x18, 0x30,
- 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
-/* '3' */ 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x3c, 0x06,
- 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* '4' */ 0x00, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xfe,
- 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00,
-/* '5' */ 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xfc, 0x06,
- 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* '6' */ 0x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xfc, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* '7' */ 0x00, 0x00, 0xfe, 0xc6, 0x06, 0x06, 0x0c, 0x18,
- 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
-/* '8' */ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* '9' */ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06,
- 0x06, 0x06, 0x0c, 0x78, 0x00, 0x00, 0x00, 0x00,
-/* ':' */ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
- 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* ';' */ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
- 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
-/* '<' */ 0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60,
- 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x00,
-/* '=' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00,
- 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* '>' */ 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06,
- 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00,
-/* '?' */ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18,
- 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
-/* '@' */ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xde, 0xde,
- 0xde, 0xdc, 0xc0, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 'A' */ 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe,
- 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
-/* 'B' */ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66,
- 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00,
-/* 'C' */ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0,
- 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
-/* 'D' */ 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66,
- 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00,
-/* 'E' */ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68,
- 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
-/* 'F' */ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68,
- 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
-/* 'G' */ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xde,
- 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00,
-/* 'H' */ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6,
- 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
-/* 'I' */ 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18,
- 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
-/* 'J' */ 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
- 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00,
-/* 'K' */ 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78,
- 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
-/* 'L' */ 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60,
- 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
-/* 'M' */ 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6,
- 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
-/* 'N' */ 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce,
- 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
-/* 'O' */ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 'P' */ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60,
- 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
-/* 'Q' */ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
- 0xc6, 0xd6, 0xde, 0x7c, 0x0c, 0x0e, 0x00, 0x00,
-/* 'R' */ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c,
- 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
-/* 'S' */ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c,
- 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 'T' */ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18,
- 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
-/* 'U' */ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 'V' */ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
- 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
-/* 'W' */ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6,
- 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x00, 0x00, 0x00,
-/* 'X' */ 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x38,
- 0x7c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
-/* 'Y' */ 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18,
- 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
-/* 'Z' */ 0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30,
- 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
-/* '[' */ 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30,
- 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00,
-/* '\' */ 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x70, 0x38,
- 0x1c, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00,
-/* ']' */ 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
- 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00, 0x00,
-/* '^' */ 0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* '_' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
-/* '`' */ 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 'a' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c,
- 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
-/* 'b' */ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x78, 0x6c, 0x66,
- 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 'c' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0,
- 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 'd' */ 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc,
- 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
-/* 'e' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe,
- 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 'f' */ 0x00, 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60,
- 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
-/* 'g' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc,
- 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00,
-/* 'h' */ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66,
- 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
-/* 'i' */ 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18,
- 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
-/* 'j' */ 0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06,
- 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00,
-/* 'k' */ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6c, 0x78,
- 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
-/* 'l' */ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18,
- 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
-/* 'm' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xfe, 0xd6,
- 0xd6, 0xd6, 0xd6, 0xc6, 0x00, 0x00, 0x00, 0x00,
-/* 'n' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66,
- 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
-/* 'o' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 'p' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66,
- 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00,
-/* 'q' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc,
- 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e, 0x00,
-/* 'r' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66,
- 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
-/* 's' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60,
- 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 't' */ 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30,
- 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00,
-/* 'u' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc,
- 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
-/* 'v' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6,
- 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
-/* 'w' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xd6,
- 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00,
-/* 'x' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38,
- 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00,
-/* 'y' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00,
-/* 'z' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18,
- 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
-/* '{' */ 0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18,
- 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00,
-/* '|' */ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18,
- 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
-/* '}' */ 0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x0e, 0x18,
- 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00,
-/* '~' */ 0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x7f */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6,
- 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x80 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x81 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x82 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x83 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x84 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x85 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x86 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x88 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x89 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x8a */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x8b */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x8c */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x8d */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x8e */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x8f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x90 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x91 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x92 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x93 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x94 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x95 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x97 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x98 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x99 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x9a */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x9b */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x9c */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x9d */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x9e */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x9f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xa0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xa1 */ 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18,
- 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
-/* 0xa2 */ 0x00, 0x18, 0x18, 0x3c, 0x66, 0x60, 0x60, 0x60,
- 0x66, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
-/* 0xa3 */ 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60,
- 0x60, 0x60, 0xe6, 0xfc, 0x00, 0x00, 0x00, 0x00,
-/* 0xa4 */ 0xc3, 0x3c, 0x66, 0x42, 0x66, 0x3c, 0xc3, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xa5 */ 0x00, 0x00, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18,
- 0x7e, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
-/* 0xa6 */ 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00,
- 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00,
-/* 0xa7 */ 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6,
- 0x6c, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00,
-/* 0xa8 */ 0x00, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xa9 */ 0x00, 0x7c, 0xc6, 0x82, 0x9a, 0xa6, 0xa2, 0xa6,
- 0x9a, 0x82, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 0xaa */ 0x00, 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xab */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0xd8,
- 0x6c, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xac */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06,
- 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xad */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xae */ 0x00, 0x7c, 0xc6, 0x82, 0xba, 0xa6, 0xba, 0xaa,
- 0xa6, 0x82, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 0xaf */ 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xb0 */ 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xb1 */ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18,
- 0x18, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
-/* 0xb2 */ 0x00, 0x70, 0xd8, 0x30, 0x60, 0xc8, 0xf8, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xb3 */ 0x00, 0x70, 0xd8, 0x30, 0x30, 0xd8, 0x70, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xb4 */ 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xb5 */ 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66,
- 0x66, 0x7c, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00,
-/* 0xb6 */ 0x00, 0x00, 0x7f, 0xdb, 0xdb, 0xdb, 0x7b, 0x1b,
- 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00,
-/* 0xb7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xb8 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x30, 0x60, 0x00, 0x00,
-/* 0xb9 */ 0x00, 0x30, 0x70, 0xf0, 0x30, 0x30, 0x78, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xba */ 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x7c, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xbb */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x6c, 0x36,
- 0x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xbc */ 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30,
- 0x66, 0xce, 0x9e, 0x3e, 0x06, 0x06, 0x00, 0x00,
-/* 0xbd */ 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30,
- 0x60, 0xdc, 0x86, 0x0c, 0x18, 0x3e, 0x00, 0x00,
-/* 0xbe */ 0x00, 0xc0, 0x60, 0xc2, 0x66, 0xcc, 0x18, 0x30,
- 0x66, 0xce, 0x9e, 0x3e, 0x06, 0x06, 0x00, 0x00,
-/* 0xbf */ 0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60,
- 0xc0, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 0xc0 */ 0x18, 0x0c, 0x06, 0x00, 0x38, 0x6c, 0xc6, 0xc6,
- 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
-/* 0xc1 */ 0x18, 0x30, 0x60, 0x00, 0x38, 0x6c, 0xc6, 0xc6,
- 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
-/* 0xc2 */ 0x10, 0x38, 0x6c, 0x00, 0x38, 0x6c, 0xc6, 0xc6,
- 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
-/* 0xc3 */ 0x76, 0xdc, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6,
- 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
-/* 0xc4 */ 0xc6, 0xc6, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6,
- 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
-/* 0xc5 */ 0x38, 0x6c, 0x38, 0x00, 0x38, 0x6c, 0xc6, 0xc6,
- 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
-/* 0xc6 */ 0x00, 0x00, 0x3e, 0x6c, 0xcc, 0xcc, 0xfe, 0xcc,
- 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00,
-/* 0xc7 */ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0,
- 0xc2, 0x66, 0x3c, 0x0c, 0x06, 0x7c, 0x00, 0x00,
-/* 0xc8 */ 0x18, 0x0c, 0x06, 0x00, 0xfe, 0x66, 0x60, 0x7c,
- 0x60, 0x60, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
-/* 0xc9 */ 0x18, 0x30, 0x60, 0x00, 0xfe, 0x66, 0x60, 0x7c,
- 0x60, 0x60, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
-/* 0xca */ 0x10, 0x38, 0x6c, 0x00, 0xfe, 0x66, 0x60, 0x7c,
- 0x60, 0x60, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
-/* 0xcb */ 0x00, 0xc6, 0x00, 0xfe, 0x66, 0x60, 0x60, 0x7c,
- 0x60, 0x60, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
-/* 0xcc */ 0x18, 0x0c, 0x06, 0x00, 0x3c, 0x18, 0x18, 0x18,
- 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
-/* 0xcd */ 0x18, 0x30, 0x60, 0x00, 0x3c, 0x18, 0x18, 0x18,
- 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
-/* 0xce */ 0x10, 0x38, 0x6c, 0x00, 0x3c, 0x18, 0x18, 0x18,
- 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
-/* 0xcf */ 0x00, 0x66, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18,
- 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
-/* 0xd0 */ 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0xf6, 0x66,
- 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00,
-/* 0xd1 */ 0x76, 0xdc, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde,
- 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
-/* 0xd2 */ 0x18, 0x0c, 0x06, 0x00, 0x7c, 0xc6, 0xc6, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 0xd3 */ 0x18, 0x30, 0x60, 0x00, 0x7c, 0xc6, 0xc6, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 0xd4 */ 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 0xd5 */ 0x76, 0xdc, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 0xd6 */ 0xc6, 0xc6, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 0xd7 */ 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38,
- 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xd8 */ 0x00, 0x06, 0x7e, 0xce, 0xce, 0xce, 0xd6, 0xd6,
- 0xe6, 0xe6, 0xe6, 0xfc, 0xc0, 0x00, 0x00, 0x00,
-/* 0xd9 */ 0x18, 0x0c, 0x06, 0x00, 0xc6, 0xc6, 0xc6, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 0xda */ 0x18, 0x30, 0x60, 0x00, 0xc6, 0xc6, 0xc6, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 0xdb */ 0x10, 0x38, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 0xdc */ 0xc6, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 0xdd */ 0x18, 0x30, 0x60, 0x00, 0x66, 0x66, 0x66, 0x3c,
- 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
-/* 0xde */ 0x00, 0xf0, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x7c,
- 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
-/* 0xdf */ 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xd8, 0xcc,
- 0xc6, 0xc6, 0xc6, 0xcc, 0x00, 0x00, 0x00, 0x00,
-/* 0xe0 */ 0x00, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0c, 0x7c,
- 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
-/* 0xe1 */ 0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0c, 0x7c,
- 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
-/* 0xe2 */ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x78, 0x0c, 0x7c,
- 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
-/* 0xe3 */ 0x00, 0x00, 0x76, 0xdc, 0x00, 0x78, 0x0c, 0x7c,
- 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
-/* 0xe4 */ 0x00, 0x00, 0xcc, 0x00, 0x00, 0x78, 0x0c, 0x7c,
- 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
-/* 0xe5 */ 0x00, 0x38, 0x6c, 0x38, 0x00, 0x78, 0x0c, 0x7c,
- 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
-/* 0xe6 */ 0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xb2, 0x32,
- 0x7e, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00,
-/* 0xe7 */ 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60,
- 0x66, 0x3c, 0x0c, 0x06, 0x3c, 0x00, 0x00, 0x00,
-/* 0xe8 */ 0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xfe,
- 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 0xe9 */ 0x00, 0x0c, 0x18, 0x30, 0x00, 0x7c, 0xc6, 0xfe,
- 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 0xea */ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe,
- 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 0xeb */ 0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xfe,
- 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 0xec */ 0x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18,
- 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
-/* 0xed */ 0x00, 0x0c, 0x18, 0x30, 0x00, 0x38, 0x18, 0x18,
- 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
-/* 0xee */ 0x00, 0x18, 0x3c, 0x66, 0x00, 0x38, 0x18, 0x18,
- 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
-/* 0xef */ 0x00, 0x00, 0x66, 0x00, 0x00, 0x38, 0x18, 0x18,
- 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
-/* 0xf0 */ 0x00, 0x00, 0x3e, 0x30, 0x18, 0x7c, 0xc6, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 0xf1 */ 0x00, 0x00, 0x76, 0xdc, 0x00, 0xdc, 0x66, 0x66,
- 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
-/* 0xf2 */ 0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 0xf3 */ 0x00, 0x18, 0x30, 0x60, 0x00, 0x7c, 0xc6, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 0xf4 */ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 0xf5 */ 0x00, 0x00, 0x76, 0xdc, 0x00, 0x7c, 0xc6, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 0xf6 */ 0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
-/* 0xf7 */ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e,
- 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xf8 */ 0x00, 0x00, 0x00, 0x00, 0x06, 0x7e, 0xce, 0xce,
- 0xd6, 0xe6, 0xe6, 0xfc, 0xc0, 0x00, 0x00, 0x00,
-/* 0xf9 */ 0x00, 0x60, 0x30, 0x18, 0x00, 0xcc, 0xcc, 0xcc,
- 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
-/* 0xfa */ 0x00, 0x18, 0x30, 0x60, 0x00, 0xcc, 0xcc, 0xcc,
- 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
-/* 0xfb */ 0x00, 0x30, 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc,
- 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
-/* 0xfc */ 0x00, 0x00, 0xcc, 0x00, 0x00, 0xcc, 0xcc, 0xcc,
- 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
-/* 0xfd */ 0x00, 0x18, 0x30, 0x60, 0x00, 0xc6, 0xc6, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0x78, 0x00,
-/* 0xfe */ 0x00, 0x00, 0x00, 0xf0, 0x60, 0x7c, 0x66, 0x66,
- 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00,
-/* 0xff */ 0x00, 0xc6, 0xc6, 0x00, 0x00, 0xc6, 0xc6, 0xc6,
- 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0x78, 0x00
-};
diff --git a/sys/arch/atari/dev/font_8x8.c b/sys/arch/atari/dev/font_8x8.c
deleted file mode 100644
index 0817d2b8845..00000000000
--- a/sys/arch/atari/dev/font_8x8.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/* $NetBSD: font_8x8.c,v 1.2 1995/09/23 20:25:36 leo Exp $ */
-
-/*
- * Copyright (c) 1992, 1993, 1994 Hellmuth Michaelis and Joerg Wunsch
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by
- * Hellmuth Michaelis and Joerg Wunsch
- * 4. The name authors may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Translated into compiler and human readable for for the Atari-TT port of
- * NetBSD by Leo Weppelman.
- *
- * Reorganized and edited some chars to fit the iso-8859-1 fontset
- * by Thomas Gerner
- */
-#include <atari/dev/font.h>
-
-char fontname_8x8[64] = "vt220iso.808";
-
-extern unsigned char fontdata_8x8[];
-
-font_info font_info_8x8 = { 1, 8, 8, 6, 0, 255, &fontdata_8x8[0] };
-
-unsigned char fontdata_8x8[] = {
-/* 0x00 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x01 */ 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x3c, 0x18,
-/* 0x02 */ 0x5a, 0x99, 0x42, 0x99, 0x5a, 0x81, 0x5a, 0x99,
-/* 0x03 */ 0x44, 0x44, 0x7c, 0x44, 0x3e, 0x08, 0x08, 0x08,
-/* 0x04 */ 0x7c, 0x40, 0x78, 0x40, 0x3e, 0x20, 0x3c, 0x20,
-/* 0x05 */ 0x3c, 0x40, 0x40, 0x3c, 0x3c, 0x22, 0x3c, 0x26,
-/* 0x06 */ 0x40, 0x40, 0x40, 0x7c, 0x3e, 0x20, 0x3c, 0x20,
-/* 0x07 */ 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
-/* 0x08 */ 0x30, 0x30, 0xfc, 0x30, 0x30, 0x00, 0xfc, 0x00,
-/* 0x09 */ 0x64, 0x54, 0x4c, 0x44, 0x20, 0x20, 0x20, 0x3e,
-/* 0x0a */ 0x44, 0x44, 0x28, 0x10, 0x3e, 0x08, 0x08, 0x08,
-/* 0x0b */ 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00,
-/* 0x0c */ 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18,
-/* 0x0d */ 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18,
-/* 0x0e */ 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00,
-/* 0x0f */ 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18,
-/* 0x10 */ 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x11 */ 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x12 */ 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
-/* 0x13 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
-/* 0x14 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
-/* 0x15 */ 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18,
-/* 0x16 */ 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18,
-/* 0x17 */ 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00,
-/* 0x18 */ 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18,
-/* 0x19 */ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
-/* 0x1a */ 0x30, 0x18, 0x0c, 0x18, 0x30, 0xfe, 0x00, 0xfe,
-/* 0x1b */ 0x18, 0x30, 0x60, 0x30, 0x18, 0xfe, 0x00, 0xfe,
-/* 0x1c */ 0x00, 0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00,
-/* 0x1d */ 0x02, 0x04, 0x7e, 0x08, 0x10, 0x7e, 0x20, 0x40,
-/* 0x1e */ 0x38, 0x6c, 0x64, 0xf0, 0x60, 0xe6, 0xfc, 0x00,
-/* 0x1f */ 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
-/* ' ' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* '!' */ 0x18, 0x3c, 0x3c, 0x18, 0x18, 0x00, 0x18, 0x00,
-/* '"' */ 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* '#' */ 0x6c, 0x6c, 0xfe, 0x6c, 0xfe, 0x6c, 0x6c, 0x00,
-/* '$' */ 0x30, 0x7c, 0xc0, 0x7c, 0x06, 0xfc, 0x30, 0x00,
-/* '%' */ 0x00, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xc6, 0x00,
-/* '&' */ 0x38, 0x6c, 0x38, 0x76, 0xdc, 0xce, 0x7b, 0x00,
-/* ''' */ 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* '(' */ 0x18, 0x30, 0x60, 0x60, 0x60, 0x30, 0x18, 0x00,
-/* ')' */ 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00,
-/* '*' */ 0x00, 0x6c, 0x38, 0xfe, 0x38, 0x6c, 0x00, 0x00,
-/* '+' */ 0x00, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x00, 0x00,
-/* ',' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x60,
-/* '-' */ 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00,
-/* '.' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00,
-/* '/' */ 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00,
-/* '0' */ 0x7c, 0xce, 0xde, 0xf6, 0xe6, 0xc6, 0x7c, 0x00,
-/* '1' */ 0x30, 0x70, 0xb0, 0x30, 0x30, 0x30, 0xfc, 0x00,
-/* '2' */ 0x78, 0xcc, 0x0c, 0x38, 0x60, 0xc0, 0xfc, 0x00,
-/* '3' */ 0x78, 0xcc, 0x0c, 0x38, 0x0c, 0xcc, 0x78, 0x00,
-/* '4' */ 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x1e, 0x00,
-/* '5' */ 0xfc, 0xc0, 0xf8, 0x0c, 0x0c, 0xcc, 0x78, 0x00,
-/* '6' */ 0x78, 0xcc, 0xc0, 0xf8, 0xcc, 0xcc, 0x78, 0x00,
-/* '7' */ 0xfc, 0xcc, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x00,
-/* '8' */ 0x78, 0xcc, 0xcc, 0x78, 0xcc, 0xcc, 0x78, 0x00,
-/* '9' */ 0x78, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00,
-/* ':' */ 0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x00,
-/* ';' */ 0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x60,
-/* '<' */ 0x18, 0x30, 0x60, 0xc0, 0x60, 0x30, 0x18, 0x00,
-/* '=' */ 0x00, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00,
-/* '>' */ 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00,
-/* '?' */ 0x3c, 0x66, 0x06, 0x0c, 0x18, 0x00, 0x18, 0x00,
-/* '@' */ 0x7c, 0xc6, 0xde, 0xde, 0xde, 0xc0, 0x7e, 0x00,
-/* 'A' */ 0x30, 0x78, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0x00,
-/* 'B' */ 0xfc, 0x66, 0x66, 0x7c, 0x66, 0x66, 0xfc, 0x00,
-/* 'C' */ 0x3c, 0x66, 0xc0, 0xc0, 0xc0, 0x66, 0x3c, 0x00,
-/* 'D' */ 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00,
-/* 'E' */ 0xfe, 0x62, 0x68, 0x78, 0x68, 0x62, 0xfe, 0x00,
-/* 'F' */ 0xfe, 0x62, 0x68, 0x78, 0x68, 0x60, 0xf0, 0x00,
-/* 'G' */ 0x3c, 0x66, 0xc0, 0xc0, 0xce, 0x66, 0x3e, 0x00,
-/* 'H' */ 0xcc, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0xcc, 0x00,
-/* 'I' */ 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00,
-/* 'J' */ 0x1e, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0x78, 0x00,
-/* 'K' */ 0xe6, 0x6c, 0x78, 0x70, 0x78, 0x6c, 0xe6, 0x00,
-/* 'L' */ 0xf0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00,
-/* 'M' */ 0xc6, 0xee, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0x00,
-/* 'N' */ 0xc6, 0xe6, 0xf6, 0xde, 0xce, 0xc6, 0xc6, 0x00,
-/* 'O' */ 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x00,
-/* 'P' */ 0xfc, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00,
-/* 'Q' */ 0x78, 0xcc, 0xcc, 0xcc, 0xdc, 0x78, 0x1c, 0x00,
-/* 'R' */ 0xfc, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0xe6, 0x00,
-/* 'S' */ 0x78, 0xcc, 0xc0, 0x78, 0x0c, 0xcc, 0x78, 0x00,
-/* 'T' */ 0xfc, 0xb4, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00,
-/* 'U' */ 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00,
-/* 'V' */ 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00,
-/* 'W' */ 0xc6, 0xc6, 0xc6, 0xd6, 0xfe, 0xfe, 0xc6, 0x00,
-/* 'X' */ 0xc6, 0xc6, 0x6c, 0x38, 0x38, 0x6c, 0xc6, 0x00,
-/* 'Y' */ 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x30, 0x78, 0x00,
-/* 'Z' */ 0xfc, 0xcc, 0x98, 0x30, 0x64, 0xcc, 0xfc, 0x00,
-/* '[' */ 0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x00,
-/* '\' */ 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x02, 0x00,
-/* ']' */ 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00,
-/* '^' */ 0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00,
-/* '_' */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
-/* '`' */ 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 'a' */ 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x76, 0x00,
-/* 'b' */ 0xe0, 0x60, 0x60, 0x7c, 0x66, 0x66, 0xfc, 0x00,
-/* 'c' */ 0x00, 0x00, 0x78, 0xcc, 0xc0, 0xcc, 0x78, 0x00,
-/* 'd' */ 0x1c, 0x0c, 0x0c, 0x7c, 0xcc, 0xcc, 0x7e, 0x00,
-/* 'e' */ 0x00, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00,
-/* 'f' */ 0x38, 0x6c, 0x60, 0xf8, 0x60, 0x60, 0xf0, 0x00,
-/* 'g' */ 0x00, 0x00, 0x76, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8,
-/* 'h' */ 0xe0, 0x60, 0x6c, 0x76, 0x66, 0x66, 0xe6, 0x00,
-/* 'i' */ 0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
-/* 'j' */ 0x0c, 0x00, 0x1c, 0x0c, 0x0c, 0xcc, 0xcc, 0x78,
-/* 'k' */ 0xe0, 0x60, 0x66, 0x6c, 0x78, 0x6c, 0xe6, 0x00,
-/* 'l' */ 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00,
-/* 'm' */ 0x00, 0x00, 0xcc, 0xfe, 0xfe, 0xd6, 0xc6, 0x00,
-/* 'n' */ 0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0x00,
-/* 'o' */ 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0x78, 0x00,
-/* 'p' */ 0x00, 0x00, 0xdc, 0x66, 0x66, 0x7c, 0x60, 0xf0,
-/* 'q' */ 0x00, 0x00, 0x76, 0xcc, 0xcc, 0x7c, 0x0c, 0x1e,
-/* 'r' */ 0x00, 0x00, 0xdc, 0x76, 0x60, 0x60, 0xf0, 0x00,
-/* 's' */ 0x00, 0x00, 0x7c, 0xc0, 0x7c, 0x06, 0xfc, 0x00,
-/* 't' */ 0x10, 0x30, 0x7c, 0x30, 0x30, 0x36, 0x1c, 0x00,
-/* 'u' */ 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00,
-/* 'v' */ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0x7c, 0x38, 0x00,
-/* 'w' */ 0x00, 0x00, 0xc6, 0xd6, 0xfe, 0xfe, 0x6c, 0x00,
-/* 'x' */ 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0x00,
-/* 'y' */ 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8,
-/* 'z' */ 0x00, 0x00, 0xfc, 0x98, 0x30, 0x64, 0xfc, 0x00,
-/* '{' */ 0x1c, 0x30, 0x30, 0xe0, 0x30, 0x30, 0x1c, 0x00,
-/* '|' */ 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00,
-/* '}' */ 0xe0, 0x30, 0x30, 0x1c, 0x30, 0x30, 0xe0, 0x00,
-/* '~' */ 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x7f */ 0x10, 0x38, 0x6c, 0x6c, 0xc6, 0xc6, 0xfe, 0x00,
-/* 0x80 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x81 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x82 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x83 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x84 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x85 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x86 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x88 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x89 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x8a */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x8b */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x8c */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x8d */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x8e */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x8f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x90 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x91 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x92 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x93 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x94 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x95 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x97 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x98 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x99 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x9a */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x9b */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x9c */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x9d */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x9e */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0x9f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xa0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xa1 */ 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00,
-/* 0xa2 */ 0x18, 0x18, 0x7e, 0xc0, 0xc0, 0x7e, 0x18, 0x18,
-/* 0xa3 */ 0x38, 0x6c, 0x64, 0xf0, 0x60, 0xe6, 0xfc, 0x00,
-/* 0xa4 */ 0x00, 0xc3, 0xdb, 0x3c, 0x66, 0x3c, 0xdb, 0xc3,
-/* 0xa5 */ 0xcc, 0xcc, 0x78, 0xfc, 0x30, 0xfc, 0x30, 0x30,
-/* 0xa6 */ 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18,
-/* 0xa7 */ 0x7e, 0xc3, 0xfc, 0x66, 0x66, 0x3f, 0xc3, 0x7e,
-/* 0xa8 */ 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xa9 */ 0x7c, 0x82, 0x9a, 0xa2, 0xa2, 0x9a, 0x82, 0x7c,
-/* 0xaa */ 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, 0x00,
-/* 0xab */ 0x00, 0x33, 0x66, 0xcc, 0x66, 0x33, 0x00, 0x00,
-/* 0xac */ 0x00, 0x00, 0x00, 0xfc, 0x0c, 0x0c, 0x00, 0x00,
-/* 0xad */ 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00,
-/* 0xae */ 0x7c, 0x82, 0xba, 0xaa, 0xb2, 0xaa, 0x82, 0x7c,
-/* 0xaf */ 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xb0 */ 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
-/* 0xb1 */ 0x30, 0x30, 0xfc, 0x30, 0x30, 0x00, 0xfc, 0x00,
-/* 0xb2 */ 0x70, 0x18, 0x30, 0x60, 0x78, 0x00, 0x00, 0x00,
-/* 0xb3 */ 0x70, 0x18, 0x30, 0x18, 0x70, 0x00, 0x00, 0x00,
-/* 0xb4 */ 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* 0xb5 */ 0x00, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0xc0,
-/* 0xb6 */ 0x7f, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x00,
-/* 0xb7 */ 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
-/* 0xb8 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0x78,
-/* 0xb9 */ 0x38, 0x78, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00,
-/* 0xba */ 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x7c, 0x00, 0x00,
-/* 0xbb */ 0x00, 0xcc, 0x66, 0x33, 0x66, 0xcc, 0x00, 0x00,
-/* 0xbc */ 0xc3, 0xc6, 0xcc, 0xdb, 0x37, 0x6f, 0xcf, 0x03,
-/* 0xbd */ 0xc3, 0xc6, 0xcc, 0xde, 0x33, 0x66, 0xcc, 0x0f,
-/* 0xbe */ 0xc3, 0x66, 0xcc, 0x5b, 0xb7, 0x6f, 0xcf, 0x03,
-/* 0xbf */ 0x30, 0x00, 0x30, 0x60, 0xc0, 0xcc, 0x78, 0x00,
-/* 0xc0 */ 0xe0, 0x38, 0x6c, 0xc6, 0xfe, 0xc6, 0xc6, 0x00,
-/* 0xc1 */ 0x0e, 0x38, 0x6c, 0xc6, 0xfe, 0xc6, 0xc6, 0x00,
-/* 0xc2 */ 0x7c, 0x82, 0x38, 0x6c, 0xc6, 0xfe, 0xc6, 0x00,
-/* 0xc3 */ 0xfe, 0x00, 0x38, 0x6c, 0xc6, 0xfe, 0xc6, 0x00,
-/* 0xc4 */ 0xc6, 0x38, 0x6c, 0xc6, 0xfe, 0xc6, 0xc6, 0x00,
-/* 0xc5 */ 0x30, 0x30, 0x00, 0x78, 0xcc, 0xfc, 0xcc, 0x00,
-/* 0xc6 */ 0x3e, 0x6c, 0xcc, 0xfe, 0xcc, 0xcc, 0xce, 0x00,
-/* 0xc7 */ 0x78, 0xcc, 0xc0, 0xcc, 0x78, 0x18, 0x0c, 0x78,
-/* 0xc8 */ 0xe0, 0x00, 0xfc, 0x60, 0x78, 0x60, 0xfc, 0x00,
-/* 0xc9 */ 0x1c, 0x00, 0xfc, 0x60, 0x78, 0x60, 0xfc, 0x00,
-/* 0xca */ 0x78, 0x00, 0xfc, 0x60, 0x78, 0x60, 0xfc, 0x00,
-/* 0xcb */ 0xcc, 0x00, 0xfc, 0x60, 0x78, 0x60, 0xfc, 0x00,
-/* 0xcc */ 0x70, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x3c, 0x00,
-/* 0xcd */ 0x0e, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x3c, 0x00,
-/* 0xce */ 0x7e, 0x81, 0x3c, 0x18, 0x18, 0x18, 0x3c, 0x00,
-/* 0xcf */ 0x66, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x3c, 0x00,
-/* 0xd0 */ 0xfc, 0x66, 0x66, 0xf6, 0x66, 0x66, 0xfc, 0x00,
-/* 0xd1 */ 0xfc, 0x00, 0xcc, 0xec, 0xfc, 0xdc, 0xcc, 0x00,
-/* 0xd2 */ 0x70, 0x00, 0x18, 0x3c, 0x66, 0x3c, 0x18, 0x00,
-/* 0xd3 */ 0x0e, 0x00, 0x18, 0x3c, 0x66, 0x3c, 0x18, 0x00,
-/* 0xd4 */ 0x3c, 0x42, 0x18, 0x3c, 0x66, 0x3c, 0x18, 0x00,
-/* 0xd5 */ 0x7e, 0x00, 0x18, 0x3c, 0x66, 0x3c, 0x18, 0x00,
-/* 0xd6 */ 0xc3, 0x18, 0x3c, 0x66, 0x66, 0x3c, 0x18, 0x00,
-/* 0xd7 */ 0x00, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82,
-/* 0xd8 */ 0x00, 0x02, 0x7c, 0xce, 0xd6, 0xe6, 0x7c, 0x80,
-/* 0xd9 */ 0xe0, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00,
-/* 0xda */ 0x1c, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00,
-/* 0xdb */ 0x78, 0x84, 0x00, 0xcc, 0xcc, 0xcc, 0x78, 0x00,
-/* 0xdc */ 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00,
-/* 0xdd */ 0x1c, 0x00, 0xcc, 0xcc, 0x78, 0x30, 0x78, 0x00,
-/* 0xde */ 0xf0, 0x60, 0x78, 0x6c, 0x78, 0x60, 0xf0, 0x00,
-/* 0xdf */ 0x00, 0x78, 0xcc, 0xf8, 0xcc, 0xf8, 0xc0, 0xc0,
-/* 0xe0 */ 0xe0, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x7e, 0x00,
-/* 0xe1 */ 0x1c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x7e, 0x00,
-/* 0xe2 */ 0x7e, 0xc3, 0x3c, 0x06, 0x3e, 0x66, 0x3f, 0x00,
-/* 0xe3 */ 0xfe, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x7e, 0x00,
-/* 0xe4 */ 0xcc, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x7e, 0x00,
-/* 0xe5 */ 0x30, 0x30, 0x78, 0x0c, 0x7c, 0xcc, 0x7e, 0x00,
-/* 0xe6 */ 0x00, 0x00, 0x7f, 0x0c, 0x7f, 0xcc, 0x7f, 0x00,
-/* 0xe7 */ 0x00, 0x00, 0x78, 0xc0, 0xc0, 0x78, 0x0c, 0x38,
-/* 0xe8 */ 0xe0, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00,
-/* 0xe9 */ 0x1c, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00,
-/* 0xea */ 0x7e, 0xc3, 0x3c, 0x66, 0x7e, 0x60, 0x3c, 0x00,
-/* 0xeb */ 0xcc, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00,
-/* 0xec */ 0xe0, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
-/* 0xed */ 0x38, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
-/* 0xee */ 0x7c, 0xc6, 0x38, 0x18, 0x18, 0x18, 0x3c, 0x00,
-/* 0xef */ 0xcc, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
-/* 0xf0 */ 0x00, 0x7c, 0x30, 0x78, 0xcc, 0xcc, 0x78, 0x00,
-/* 0xf1 */ 0x00, 0xf8, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0x00,
-/* 0xf2 */ 0x00, 0xe0, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00,
-/* 0xf3 */ 0x00, 0x1c, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00,
-/* 0xf4 */ 0x78, 0xcc, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00,
-/* 0xf5 */ 0x00, 0xfc, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00,
-/* 0xf6 */ 0x00, 0xcc, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00,
-/* 0xf7 */ 0x30, 0x30, 0x00, 0xfc, 0x00, 0x30, 0x30, 0x00,
-/* 0xf8 */ 0x02, 0x3a, 0x6c, 0xd6, 0xd6, 0x6c, 0xb8, 0x80,
-/* 0xf9 */ 0x00, 0xe0, 0x00, 0xcc, 0xcc, 0xcc, 0x7e, 0x00,
-/* 0xfa */ 0x00, 0x1c, 0x00, 0xcc, 0xcc, 0xcc, 0x7e, 0x00,
-/* 0xfb */ 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0x7e, 0x00,
-/* 0xfc */ 0x00, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0x7e, 0x00,
-/* 0xfd */ 0x00, 0x1c, 0x00, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8,
-/* 0xfe */ 0x00, 0xc0, 0xc0, 0xf8, 0xcc, 0xf8, 0xc0, 0xc0,
-/* 0xff */ 0x00, 0xcc, 0x00, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8
-};
diff --git a/sys/arch/atari/dev/grf.c b/sys/arch/atari/dev/grf.c
deleted file mode 100644
index 899714c44f9..00000000000
--- a/sys/arch/atari/dev/grf.c
+++ /dev/null
@@ -1,567 +0,0 @@
-/* $NetBSD: grf.c,v 1.6 1995/06/26 19:55:45 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf.c 1.31 91/01/21$
- *
- * @(#)grf.c 7.8 (Berkeley) 5/7/91
- */
-
-/*
- * Graphics display driver for the Atari
- * This is the hardware-independent portion of the driver.
- * Hardware access is through the grf_softc->g_mode routine.
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/ioctl.h>
-#include <sys/device.h>
-#include <sys/file.h>
-#include <sys/malloc.h>
-#include <sys/conf.h>
-#include <sys/systm.h>
-#include <sys/vnode.h>
-#include <sys/mman.h>
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-#include <vm/vm_pager.h>
-#include <machine/cpu.h>
-#include <atari/atari/device.h>
-#include <atari/dev/grfioctl.h>
-#include <atari/dev/grfabs_reg.h>
-#include <atari/dev/grfvar.h>
-#include <atari/dev/itevar.h>
-#include <atari/dev/viewioctl.h>
-#include <atari/dev/viewvar.h>
-
-#include "grf.h"
-#if NGRF > 0
-
-#include "ite.h"
-#if NITE == 0
-#define ite_on(u,f)
-#define ite_off(u,f)
-#define ite_reinit(d)
-#endif
-
-int grfopen __P((dev_t, int, int, struct proc *));
-int grfclose __P((dev_t, int));
-int grfioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
-int grfselect __P((dev_t, int));
-int grfmmap __P((dev_t, int, int));
-
-int grfon __P((dev_t));
-int grfoff __P((dev_t));
-int grfsinfo __P((dev_t, struct grfdyninfo *));
-#ifdef BANKEDDEVPAGER
-int grfbanked_get __P((dev_t, off_t, int));
-int grfbanked_cur __P((dev_t));
-int grfbanked_set __P((dev_t, int));
-#endif
-static void grf_viewsync __P((struct grf_softc *));
-static int grf_mode __P((struct grf_softc *, int, void *, int, int));
-
-int grfbusprint __P((void *auxp, const char *));
-int grfbusmatch __P((struct device *, struct cfdata *, void *));
-void grfbusattach __P((struct device *, struct device *, void *));
-
-void grfattach __P((struct device *, struct device *, void *));
-int grfmatch __P((struct device *, struct cfdata *, void *));
-int grfprint __P((void *, const char *));
-/*
- * pointers to grf drivers device structs
- */
-struct grf_softc *grfsp[NGRF];
-
-
-struct cfdriver grfbuscd = {
- NULL, "grfbus", (cfmatch_t)grfbusmatch, grfbusattach, DV_DULL,
- sizeof(struct device)
-};
-
-struct cfdriver grfcd = {
- NULL, "grf", (cfmatch_t)grfmatch, grfattach, DV_DULL,
- sizeof(struct grf_softc), NULL, 0
-};
-
-/*
- * only used in console init.
- */
-static struct cfdata *cfdata_gbus = NULL;
-static struct cfdata *cfdata_grf = NULL;
-
-int
-grfbusmatch(pdp, cfp, auxp)
-struct device *pdp;
-struct cfdata *cfp;
-void *auxp;
-{
- if(strcmp(auxp, grfbuscd.cd_name))
- return(0);
-
- if((atari_realconfig == 0) || (cfdata_gbus == NULL)) {
- /*
- * Probe layers we depend on
- */
- if(grfabs_probe() == 0)
- return(0);
- viewprobe();
-
- if(atari_realconfig == 0) {
- /*
- * XXX: console init opens view 0
- */
- if(viewopen(0, 0))
- return(0);
- cfdata_gbus = cfp;
- }
- }
- return(1); /* Always there */
-}
-
-void
-grfbusattach(pdp, dp, auxp)
-struct device *pdp, *dp;
-void *auxp;
-{
- static int did_cons = 0;
- int i;
-
- if(dp == NULL) { /* Console init */
- did_cons = 1;
- i = 0;
- atari_config_found(cfdata_gbus, NULL, (void*)&i, grfbusprint);
- }
- else {
- printf("\n");
- for(i = 0; i < NGRF; i++) {
- /*
- * Skip opening view[0] when we this is the console.
- */
- if(!did_cons || (i > 0))
- if(viewopen(i, 0))
- break;
- config_found(dp, (void*)&i, grfbusprint);
- }
- }
-}
-
-int
-grfbusprint(auxp, name)
- void *auxp;
- const char *name;
-{
- if(name == NULL)
- return(UNCONF);
- return(QUIET);
-}
-
-
-int
-grfmatch(pdp, cfp, auxp)
-struct device *pdp;
-struct cfdata *cfp;
-void *auxp;
-{
- int unit = *(int*)auxp;
-
- /*
- * Match only on unit indicated by grfbus attach.
- */
- if(cfp->cf_unit != unit)
- return(0);
-
- cfdata_grf = cfp;
- return(1);
-}
-
-/*
- * attach: initialize the grf-structure and try to attach an ite to us.
- * note : dp is NULL during early console init.
- */
-void
-grfattach(pdp, dp, auxp)
-struct device *pdp, *dp;
-void *auxp;
-{
- static struct grf_softc congrf;
- struct grf_softc *gp;
- int maj;
-
- /*
- * find our major device number
- */
- for(maj = 0; maj < nchrdev; maj++)
- if (cdevsw[maj].d_open == grfopen)
- break;
-
- /*
- * Handle exeption case: early console init
- */
- if(dp == NULL) {
- congrf.g_unit = 0;
- congrf.g_grfdev = makedev(maj, 0);
- congrf.g_flags = GF_ALIVE;
- congrf.g_mode = grf_mode;
- congrf.g_conpri = grfcc_cnprobe();
- congrf.g_viewdev = congrf.g_unit;
- grfcc_iteinit(&congrf);
- grf_viewsync(&congrf);
-
- /* Attach console ite */
- atari_config_found(cfdata_grf, NULL, &congrf, grfprint);
- return;
- }
-
- gp = (struct grf_softc *)dp;
- gp->g_unit = gp->g_device.dv_unit;
- grfsp[gp->g_unit] = gp;
-
- if((cfdata_grf != NULL) && (gp->g_unit == 0)) {
- /*
- * We inited earlier just copy the info, take care
- * not to copy the device struct though.
- */
- bcopy(&congrf.g_display, &gp->g_display,
- (char *)&gp[1] - (char *)&gp->g_display);
- }
- else {
- gp->g_grfdev = makedev(maj, gp->g_unit);
- gp->g_flags = GF_ALIVE;
- gp->g_mode = grf_mode;
- gp->g_conpri = 0;
- gp->g_viewdev = gp->g_unit;
- grfcc_iteinit(gp);
- grf_viewsync(gp);
- }
-
- printf(": width %d height %d", gp->g_display.gd_dwidth,
- gp->g_display.gd_dheight);
- if(gp->g_display.gd_colors == 2)
- printf(" monochrome\n");
- else printf(" colors %d\n", gp->g_display.gd_colors);
-
- /*
- * try and attach an ite
- */
- config_found(dp, gp, grfprint);
-}
-
-int
-grfprint(auxp, pnp)
- void *auxp;
- const char *pnp;
-{
- if(pnp)
- printf("ite at %s", pnp);
- return(UNCONF);
-}
-
-/*ARGSUSED*/
-int
-grfopen(dev, flags, devtype, p)
- dev_t dev;
- int flags, devtype;
- struct proc *p;
-{
- struct grf_softc *gp;
-
- if (GRFUNIT(dev) >= NGRF)
- return(ENXIO);
-
- gp = grfsp[GRFUNIT(dev)];
-
- if ((gp->g_flags & GF_ALIVE) == 0)
- return(ENXIO);
-
- if ((gp->g_flags & (GF_OPEN|GF_EXCLUDE)) == (GF_OPEN|GF_EXCLUDE))
- return(EBUSY);
- grf_viewsync(gp);
-
- return(0);
-}
-
-/*ARGSUSED*/
-int
-grfclose(dev, flags)
- dev_t dev;
- int flags;
-{
- struct grf_softc *gp;
-
- gp = grfsp[GRFUNIT(dev)];
- (void)grfoff(dev);
- gp->g_flags &= GF_ALIVE;
- return(0);
-}
-
-/*ARGSUSED*/
-int
-grfioctl(dev, cmd, data, flag, p)
-dev_t dev;
-u_long cmd;
-int flag;
-caddr_t data;
-struct proc *p;
-{
- struct grf_softc *gp;
- int error;
-
- gp = grfsp[GRFUNIT(dev)];
- error = 0;
-
- switch (cmd) {
- case OGRFIOCGINFO:
- /* argl.. no bank-member.. */
- bcopy((caddr_t)&gp->g_display, data, sizeof(struct grfinfo)-4);
- break;
- case GRFIOCGINFO:
- bcopy((caddr_t)&gp->g_display, data, sizeof(struct grfinfo));
- break;
- case GRFIOCON:
- error = grfon(dev);
- break;
- case GRFIOCOFF:
- error = grfoff(dev);
- break;
- case GRFIOCSINFO:
- error = grfsinfo(dev, (struct grfdyninfo *) data);
- break;
- case GRFGETVMODE:
- return(gp->g_mode(gp, GM_GRFGETVMODE, data));
- case GRFSETVMODE:
- error = gp->g_mode(gp, GM_GRFSETVMODE, data);
- if (error == 0 && gp->g_itedev)
- ite_reinit(gp->g_itedev);
- break;
- case GRFGETNUMVM:
- return(gp->g_mode(gp, GM_GRFGETNUMVM, data));
- /*
- * these are all hardware dependant, and have to be resolved
- * in the respective driver.
- */
- case GRFIOCPUTCMAP:
- case GRFIOCGETCMAP:
- case GRFIOCSSPRITEPOS:
- case GRFIOCGSPRITEPOS:
- case GRFIOCSSPRITEINF:
- case GRFIOCGSPRITEINF:
- case GRFIOCGSPRITEMAX:
- default:
- /*
- * check to see whether it's a command recognized by the
- * view code.
- */
- return(viewioctl(gp->g_viewdev, cmd, data, flag, p));
- error = EINVAL;
- break;
-
- }
- return(error);
-}
-
-/*ARGSUSED*/
-int
-grfselect(dev, rw)
- dev_t dev;
- int rw;
-{
- if (rw == FREAD)
- return(0);
- return(1);
-}
-
-/*
- * map the contents of a graphics display card into process'
- * memory space.
- */
-int
-grfmmap(dev, off, prot)
-dev_t dev;
-int off, prot;
-{
- struct grf_softc *gp;
- struct grfinfo *gi;
-
- gp = grfsp[GRFUNIT(dev)];
- gi = &gp->g_display;
-
- /*
- * frame buffer
- */
- if ((off >= 0) && (off < gi->gd_fbsize))
- return (((u_int)gi->gd_fbaddr + off) >> PGSHIFT);
- return(-1);
-}
-
-int
-grfon(dev)
- dev_t dev;
-{
- struct grf_softc *gp;
-
- gp = grfsp[GRFUNIT(dev)];
-
- if (gp->g_flags & GF_GRFON)
- return(0);
-
- gp->g_flags |= GF_GRFON;
- if (gp->g_itedev != NODEV)
- ite_off(gp->g_itedev, 3);
-
- return(gp->g_mode(gp, (dev & GRFOVDEV) ? GM_GRFOVON : GM_GRFON));
-}
-
-int
-grfoff(dev)
- dev_t dev;
-{
- struct grf_softc *gp;
- int error;
-
- gp = grfsp[GRFUNIT(dev)];
-
- if ((gp->g_flags & GF_GRFON) == 0)
- return(0);
-
- gp->g_flags &= ~GF_GRFON;
- error = gp->g_mode(gp, (dev & GRFOVDEV) ? GM_GRFOVOFF : GM_GRFOFF);
-
- /*
- * Closely tied together no X's
- */
- if (gp->g_itedev != NODEV)
- ite_on(gp->g_itedev, 2);
-
- return(error);
-}
-
-int
-grfsinfo(dev, dyninfo)
- dev_t dev;
- struct grfdyninfo *dyninfo;
-{
- struct grf_softc *gp;
- int error;
-
- gp = grfsp[GRFUNIT(dev)];
- error = gp->g_mode(gp, GM_GRFCONFIG, dyninfo);
-
- /*
- * Closely tied together no X's
- */
- if (gp->g_itedev != NODEV)
- ite_reinit(gp->g_itedev);
- return(error);
-}
-
-/*
- * Get the grf-info in sync with underlying view.
- */
-static void
-grf_viewsync(gp)
-struct grf_softc *gp;
-{
- struct view_size vs;
- bmap_t bm;
- struct grfinfo *gi;
-
- gi = &gp->g_display;
-
- viewioctl(gp->g_viewdev, VIOCGBMAP, &bm, 0, -1);
-
- gp->g_data = (caddr_t) 0xDeadBeaf; /* not particularly clean.. */
-
- gi->gd_fbaddr = bm.hw_address;
- gi->gd_fbsize = bm.depth*bm.bytes_per_row*bm.rows;
-
- if(viewioctl(gp->g_viewdev, VIOCGSIZE, &vs, 0, -1)) {
- /*
- * fill in some default values...
- * XXX: Should _never_ happen
- */
- vs.width = 640;
- vs.height = 400;
- vs.depth = 1;
- }
- gi->gd_colors = 1 << vs.depth;
- gi->gd_planes = vs.depth;
-
- gi->gd_fbwidth = vs.width;
- gi->gd_fbheight = vs.height;
- gi->gd_dyn.gdi_fbx = 0;
- gi->gd_dyn.gdi_fby = 0;
- gi->gd_dyn.gdi_dwidth = vs.width;
- gi->gd_dyn.gdi_dheight = vs.height;
- gi->gd_dyn.gdi_dx = 0;
- gi->gd_dyn.gdi_dy = 0;
-}
-
-/*
- * Change the mode of the display.
- * Right now all we can do is grfon/grfoff.
- * Return a UNIX error number or 0 for success.
- */
-/*ARGSUSED*/
-static int
-grf_mode(gp, cmd, arg, a2, a3)
-struct grf_softc *gp;
-int cmd, a2, a3;
-void *arg;
-{
- switch (cmd) {
- case GM_GRFON:
- /*
- * Get in sync with view, ite might have changed it.
- */
- grf_viewsync(gp);
- viewioctl(gp->g_viewdev, VIOCDISPLAY, NULL, 0, -1);
- return(0);
- case GM_GRFOFF:
- viewioctl(gp->g_viewdev, VIOCREMOVE, NULL, 0, -1);
- return(0);
- case GM_GRFCONFIG:
- default:
- break;
- }
- return(EINVAL);
-}
-#endif /* NGRF > 0 */
diff --git a/sys/arch/atari/dev/grfabs.c b/sys/arch/atari/dev/grfabs.c
deleted file mode 100644
index 65f3eb3933c..00000000000
--- a/sys/arch/atari/dev/grfabs.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/* $NetBSD: grfabs.c,v 1.7 1995/09/23 20:29:16 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * atari abstract graphics driver.
- */
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/queue.h>
-#include <sys/malloc.h>
-
-#include <machine/cpu.h>
-#include <machine/iomap.h>
-#include <machine/video.h>
-#include <machine/mfp.h>
-#include <atari/dev/grfabs_reg.h>
-
-/*
- * Function decls
- */
-static dmode_t *get_best_display_mode __P((dimen_t *, int, dmode_t *));
-
-/*
- * List of available graphic modes
- */
-static MODES modes;
-
-/*
- * Ugh.. Stuff needed to allocate console structures before the VM-system
- * is running. There is no malloc() available at that time.
- * Decision to use these: atari_realconfig == 0
- */
-view_t gra_con_view;
-colormap_t gra_con_cmap;
-long gra_con_colors[MAX_CENTRIES];
-
-/*
- * Default colors.....
- * Currently the TT-low (256 colors) just uses 16 times the 16-color default.
- * If you have a sensible 256 scale, feel free to add.....
- * The first 2 colors in all maps are {black,white}, so ite (text) displays
- * are initially readable. Also, this enables me to supply only 1 map. The
- * 4 color mode uses the first four entries of the 16 color mode thus giving
- * a gray scale display. (Maybe we can add an intensity bit to the ite...)
- */
-u_long gra_def_color16[16] = {
- 0x00000000, /* black */
- 0x00ffffff, /* white */
- 0x000c0c0c, /* light gray */
- 0x00808008, /* gray */
- 0x0000000c, /* blue */
- 0x00000c00, /* green */
- 0x00000c0c, /* cyan */
- 0x00c00000, /* red */
- 0x00c0000c, /* magenta */
- 0x00c00c00, /* brown */
- 0x000000ff, /* light blue */
- 0x0000ff00, /* light green */
- 0x0000ffff, /* light cyan */
- 0x00ff0000, /* light red */
- 0x00ff00ff, /* light magenta */
- 0x00ffff00 /* light brown */
-};
-
-/*
- * XXX: called from ite console init routine.
- * Initialize list of posible video modes.
- */
-int
-grfabs_probe()
-{
- static int inited = 0;
-
- if (inited)
- return (1); /* Has to be done only once */
- inited++;
-
- LIST_INIT(&modes);
-
-#ifdef FALCON_VIDEO
- if (machineid & ATARI_FALCON)
- falcon_probe_video(&modes);
-#endif /* FALCON_VIDEO */
-#ifdef TT_VIDEO
- if (machineid & ATARI_TT)
- tt_probe_video(&modes);
-#endif /* TT_VIDEO */
- return ((modes.lh_first == NULL) ? 0 : 1);
-}
-
-view_t *
-grf_alloc_view(d, dim, depth)
-dmode_t *d;
-dimen_t *dim;
-u_char depth;
-{
- if (!d)
- d = get_best_display_mode(dim, depth, NULL);
- if (d)
- return ((d->grfabs_funcs->alloc_view)(d, dim, depth));
- return(NULL);
-}
-
-dmode_t *
-grf_get_best_mode(dim, depth)
-dimen_t *dim;
-u_char depth;
-{
- return (get_best_display_mode(dim, depth, NULL));
-}
-
-void grf_display_view(v)
-view_t *v;
-{
- (v->mode->grfabs_funcs->display_view)(v);
-}
-
-void grf_remove_view(v)
-view_t *v;
-{
- (v->mode->grfabs_funcs->remove_view)(v);
-}
-
-void grf_free_view(v)
-view_t *v;
-{
- (v->mode->grfabs_funcs->free_view)(v);
-}
-
-int
-grf_get_colormap(v, cm)
-view_t *v;
-colormap_t *cm;
-{
- colormap_t *gcm;
- int i, n;
- u_long *sv_entry;
-
- gcm = v->colormap;
- n = cm->size < gcm->size ? cm->size : gcm->size;
-
- /*
- * Copy struct from view but be carefull to keep 'entry'
- */
- sv_entry = cm->entry;
- *cm = *gcm;
- cm->entry = sv_entry;
-
- /*
- * Copy the colors
- */
- bzero(cm->entry, cm->size * sizeof(long));
- for (i = 0; i < n; i++)
- cm->entry[i] = gcm->entry[i];
- return (0);
-}
-
-int
-grf_use_colormap(v, cm)
-view_t *v;
-colormap_t *cm;
-{
- return (v->mode->grfabs_funcs->use_colormap)(v, cm);
-}
-
-static dmode_t *
-get_best_display_mode(dim, depth, curr_mode)
-int depth;
-dimen_t *dim;
-dmode_t *curr_mode;
-{
- dmode_t *save;
- dmode_t *dm;
- long dt, dx, dy, ct;
-
- save = NULL;
- dm = modes.lh_first;
- while (dm != NULL) {
- dx = abs(dm->size.width - dim->width);
- dy = abs(dm->size.height - dim->height);
- ct = dx + dy;
-
- if (ct < dt || save == NULL) {
- save = dm;
- dt = ct;
- }
- dm = dm->link.le_next;
- }
- /*
- * Did we do better than the current mode?
- */
- if ((save != NULL) && (curr_mode != NULL)) {
- dx = abs(curr_mode->size.width - dim->width);
- dy = abs(curr_mode->size.height - dim->height);
- ct = dx + dy;
- if (ct <= dt)
- return (NULL);
- }
- return (save);
-}
diff --git a/sys/arch/atari/dev/grfabs_fal.c b/sys/arch/atari/dev/grfabs_fal.c
deleted file mode 100644
index ed367a1019f..00000000000
--- a/sys/arch/atari/dev/grfabs_fal.c
+++ /dev/null
@@ -1,549 +0,0 @@
-/* $NetBSD: grfabs_fal.c,v 1.2 1996/01/02 20:59:20 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Thomas Gerner.
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifdef FALCON_VIDEO
-/*
- * atari abstract graphics driver: Falcon-interface
- */
-#include <sys/param.h>
-#include <sys/queue.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-
-#include <machine/iomap.h>
-#include <machine/video.h>
-#include <machine/mfp.h>
-#include <atari/atari/device.h>
-#include <atari/dev/grfabs_reg.h>
-#include <atari/dev/grfabs_fal.h>
-
-/*
- * Function decls
- */
-static void init_view __P((view_t *, bmap_t *, dmode_t *, box_t *));
-static bmap_t *alloc_bitmap __P((u_long, u_long, u_char));
-static colormap_t *alloc_colormap __P((dmode_t *));
-static void free_bitmap __P((bmap_t *));
-static void falcon_display_view __P((view_t *));
-static view_t *falcon_alloc_view __P((dmode_t *, dimen_t *, u_char));
-static void falcon_free_view __P((view_t *));
-static void falcon_remove_view __P((view_t *));
-static int falcon_use_colormap __P((view_t *, colormap_t *));
-static void falcon_detect __P((dmode_t *));
-
-/*
- * Our function switch table
- */
-struct grfabs_sw fal_vid_sw = {
- falcon_display_view,
- falcon_alloc_view,
- falcon_free_view,
- falcon_remove_view,
- falcon_use_colormap
-};
-
-static dmode_t vid_modes[] = {
- { { NULL, NULL }, "falauto",{ 0, 0 }, 0, RES_FALAUTO ,&fal_vid_sw},
- { { NULL, NULL }, "sthigh", { 640, 400 }, 1, RES_FAL_STHIGH ,&fal_vid_sw},
- { { NULL, NULL }, "stmid", { 640, 200 }, 2, RES_FAL_STMID ,&fal_vid_sw},
- { { NULL, NULL }, "stlow", { 320, 200 }, 4, RES_FAL_STLOW ,&fal_vid_sw},
- { { NULL, NULL }, "ttlow", { 320, 480 }, 8, RES_FAL_TTLOW ,&fal_vid_sw},
- { { NULL, NULL }, "vga2", { 640, 480 }, 1, RES_VGA2 ,&fal_vid_sw},
- { { NULL, NULL }, "vga4", { 640, 480 }, 2, RES_VGA4 ,&fal_vid_sw},
- { { NULL, NULL }, "vga16", { 640, 480 }, 4, RES_VGA16 ,&fal_vid_sw},
- { { NULL, NULL }, "vga256", { 640, 480 }, 8, RES_VGA256 ,&fal_vid_sw},
- { { NULL, NULL }, "highcol",{ 320, 200 }, 16, RES_DIRECT ,&fal_vid_sw},
- { { NULL, NULL }, NULL, }
-};
-
-/*
- * The following table contains timing values for the various video modes.
- * I have only a multisync monitor, therefore I can not say if this values
- * are useful at other monitors.
- * Use other video modes at YOUR OWN RISK.
- * THERE IS NO WARRENTY ABOUT THIS VALUES TO WORK WITH A PARTICULAR
- * MONITOR. -- Thomas
- */
-static struct videl videlinit[] = {
- { RES_FALAUTO, /* autodedect */
- 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
- 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 },
-
- { RES_FAL_STHIGH, /* sthigh, 640x400, 2 colors */
- 0x2, 0x0, 0x28, 0x0, 0x400, 0xc6, 0x8d, 0x15, 0x273, 0x50, 0x96, 0x0,
- 0x0, 0x419, 0x3af, 0x8f, 0x8f, 0x3af, 0x415, 0x186, 0x8 },
-
- { RES_FAL_STMID, /* stmid, 640x200, 4 colors */
- 0x2, 0x0, 0x50, 0x1, 0x0, 0x17, 0x12, 0x1, 0x20e, 0xd, 0x11, 0x0,
- 0x0, 0x419, 0x3af, 0x8f, 0x8f, 0x3af, 0x415, 0x186, 0x9 },
-
- { RES_FAL_STLOW, /* stlow, 320x200, 16 colors */
- 0x2, 0x0, 0x50, 0x0, 0x0, 0x17, 0x12, 0x1, 0x20e, 0xd, 0x11, 0x0,
- 0x0, 0x419, 0x3af, 0x8f, 0x8f, 0x3af, 0x415, 0x186, 0x5 },
-
- { RES_FAL_TTLOW, /* ttlow, 320x480, 256 colors */
- 0x2, 0x0, 0xa0, 0x0, 0x10, 0xc6, 0x8d, 0x15, 0x29a, 0x7b, 0x96, 0x0,
- 0x0, 0x419, 0x3ff, 0x3f, 0x3f, 0x3ff, 0x415, 0x186, 0x4 },
-
- { RES_VGA2, /* vga, 640x480, 2 colors */
- 0x2, 0x0, 0x28, 0x0, 0x400, 0xc6, 0x8d, 0x15, 0x273, 0x50, 0x96, 0x0,
- 0x0, 0x419, 0x3ff, 0x3f, 0x3f, 0x3ff, 0x415, 0x186, 0x8 },
-
- { RES_VGA4, /* vga, 640x480, 4 colors */
- 0x2, 0x0, 0x50, 0x1, 0x0, 0x17, 0x12, 0x1, 0x20e, 0xd, 0x11, 0x0,
- 0x0, 0x419, 0x3ff, 0x3f, 0x3f, 0x3ff, 0x415, 0x186, 0x8 },
-
- { RES_VGA16, /* vga, 640x480, 16 colors */
- 0x2, 0x0, 0xa0, 0x1, 0x0, 0xc6, 0x8d, 0x15, 0x2a3, 0x7c, 0x96, 0x0,
- 0x0, 0x419, 0x3ff, 0x3f, 0x3f, 0x3ff, 0x415, 0x186, 0x8 },
-
- { RES_VGA256, /* vga, 640x480, 256 colors */
- 0x2, 0x0, 0x140, 0x1, 0x10, 0xc6, 0x8d, 0x15, 0x2ab, 0x84, 0x96, 0x0,
- 0x0, 0x419, 0x3ff, 0x3f, 0x3f, 0x3ff, 0x415, 0x186, 0x8 },
-
- { RES_DIRECT, /* direct video, 320x200, 65536 colors */
- 0x2, 0x0, 0x140, 0x0, 0x100, 0xc6, 0x8d, 0x15, 0x2ac, 0x91, 0x96, 0x0,
- 0x0, 0x419, 0x3ff, 0x3f, 0x3f, 0x3ff, 0x415, 0x186, 0x4 },
-
- { 0xffff } /* end of list */
-};
-
-/*
- * XXX: called from ite console init routine.
- * Initialize list of posible video modes.
- */
-void
-falcon_probe_video(modelp)
-MODES *modelp;
-{
- dmode_t *dm;
- int i;
-
- /* Currently we support only one mode of the falcon video system.
- * This is the mode that is initialized before NetBSD starts. This
- * is possible since the bios has already done that work.
- */
-
- for (i = 0; (dm = &vid_modes[i])->name != NULL; i++) {
- if (dm->vm_reg == RES_FALAUTO) {
- falcon_detect(dm);
- LIST_INSERT_HEAD(modelp, dm, link);
- } else
- LIST_INSERT_HEAD(modelp, dm, link);
- }
-
- /*
- * This seems to prevent bordered screens.
- */
- for (i=0; i < 16; i++)
- VIDEO->vd_fal_rgb[i] = CM_L2FAL(gra_def_color16[i]);
-}
-
-static struct videl *
-falcon_getreg(vm_reg)
-u_short vm_reg;
-{
- int i;
- struct videl *vregs;
-
- for (i = 0; (vregs = &videlinit[i])->vm_reg != 0xffff; i++)
- if (vregs->vm_reg == vm_reg)
- return vregs;
-
- return &videlinit[0]; /* should never happen */
-}
-
-static void
-falcon_detect(dm)
-dmode_t *dm;
-{
- u_short falshift, stshift;
- struct videl *vregs;
-
- /*
- * First get the the videl register values
- */
-
- vregs = falcon_getreg(dm->vm_reg);
-
- vregs->vd_syncmode = VIDEO->vd_sync;
- vregs->vd_line_wide = VIDEO->vd_line_wide;
- vregs->vd_vert_wrap = VIDEO->vd_vert_wrap;
- vregs->vd_st_res = VIDEO->vd_st_res;
- vregs->vd_fal_res = VIDEO->vd_fal_res;
- vregs->vd_h_hold_tim = VIDEO->vd_h_hold_tim;
- vregs->vd_h_bord_beg = VIDEO->vd_h_bord_beg;
- vregs->vd_h_bord_end = VIDEO->vd_h_bord_end;
- vregs->vd_h_dis_beg = VIDEO->vd_h_dis_beg;
- vregs->vd_h_dis_end = VIDEO->vd_h_dis_end;
- vregs->vd_h_ss = VIDEO->vd_h_ss;
- vregs->vd_h_fs = VIDEO->vd_h_fs;
- vregs->vd_h_hh = VIDEO->vd_h_hh;
- vregs->vd_v_freq_tim = VIDEO->vd_v_freq_tim;
- vregs->vd_v_bord_beg = VIDEO->vd_v_bord_beg;
- vregs->vd_v_bord_end = VIDEO->vd_v_bord_end;
- vregs->vd_v_dis_beg = VIDEO->vd_v_dis_beg;
- vregs->vd_v_dis_end = VIDEO->vd_v_dis_end;
- vregs->vd_v_ss = VIDEO->vd_v_ss;
- vregs->vd_fal_ctrl = VIDEO->vd_fal_ctrl;
- vregs->vd_fal_mode = VIDEO->vd_fal_mode;
-
-
- /*
- * Calculate the depth of the screen
- */
-
- falshift = vregs->vd_fal_res;
- stshift = vregs->vd_st_res;
-
- if (falshift & 0x400) /* 2 color */
- dm->depth = 1;
- else if (falshift & 0x100) /* high color, direct */
- dm->depth = 16;
- else if (falshift & 0x10) /* 256 color */
- dm->depth = 8;
- else if (stshift == 0) /* 16 color */
- dm->depth = 4;
- else if (stshift == 1) /* 4 color */
- dm->depth = 2;
- else dm->depth = 1; /* 2 color */
-
- /*
- * Now calculate the screen hight
- */
-
- dm->size.height = vregs->vd_v_dis_end - vregs->vd_v_dis_beg;
- if (!((vregs->vd_fal_mode & 0x2) >> 1)) /* if not interlaced */
- dm->size.height >>=1;
- if (vregs->vd_fal_mode & 0x1) /* if doublescan */
- dm->size.height >>=1;
-
- /*
- * And the width
- */
-
- dm->size.width = vregs->vd_vert_wrap * 16 / dm->depth;
-
-}
-
-static void
-falcon_display_view(v)
-view_t *v;
-{
- dmode_t *dm = v->mode;
- bmap_t *bm = v->bitmap;
- struct videl *vregs;
-
- vregs = falcon_getreg(dm->vm_reg);
-
- if (dm->current_view) {
- /*
- * Mark current view for this mode as no longer displayed
- */
- dm->current_view->flags &= ~VF_DISPLAY;
- }
- dm->current_view = v;
- v->flags |= VF_DISPLAY;
-
- falcon_use_colormap(v, v->colormap);
-
- /* XXX: should use vbl for this */
- VIDEO->vd_raml = (u_long)bm->hw_address & 0xff;
- VIDEO->vd_ramm = ((u_long)bm->hw_address >> 8) & 0xff;
- VIDEO->vd_ramh = ((u_long)bm->hw_address >> 16) & 0xff;
-
- VIDEO->vd_v_freq_tim = vregs->vd_v_freq_tim;
- VIDEO->vd_v_ss = vregs->vd_v_ss;
- VIDEO->vd_v_bord_beg = vregs->vd_v_bord_beg;
- VIDEO->vd_v_bord_end = vregs->vd_v_bord_end;
- VIDEO->vd_v_dis_beg = vregs->vd_v_dis_beg;
- VIDEO->vd_v_dis_end = vregs->vd_v_dis_end;
- VIDEO->vd_h_hold_tim = vregs->vd_h_hold_tim;
- VIDEO->vd_h_ss = vregs->vd_h_ss;
- VIDEO->vd_h_bord_beg = vregs->vd_h_bord_beg;
- VIDEO->vd_h_bord_end = vregs->vd_h_bord_end;
- VIDEO->vd_h_dis_beg = vregs->vd_h_dis_beg;
- VIDEO->vd_h_dis_end = vregs->vd_h_dis_end;
-#if 0 /* This seems not to be necessary -- Thomas */
- VIDEO->vd_h_fs = vregs->vd_h_fs;
- VIDEO->vd_h_hh = vregs->vd_h_hh;
-#endif
- VIDEO->vd_sync = vregs->vd_syncmode;
- VIDEO->vd_fal_res = 0;
- if (dm->depth == 2)
- VIDEO->vd_st_res = vregs->vd_st_res;
- else {
- VIDEO->vd_st_res = 0;
- VIDEO->vd_fal_res = vregs->vd_fal_res;
- }
- VIDEO->vd_vert_wrap = vregs->vd_vert_wrap;
- VIDEO->vd_line_wide = vregs->vd_line_wide;
- VIDEO->vd_fal_ctrl = vregs->vd_fal_ctrl;
- VIDEO->vd_fal_mode = vregs->vd_fal_mode;
-}
-
-static void
-falcon_remove_view(v)
-view_t *v;
-{
- dmode_t *mode = v->mode;
-
- if (mode->current_view == v) {
-#if 0
- if (v->flags & VF_DISPLAY)
- panic("Cannot shutdown display"); /* XXX */
-#endif
- mode->current_view = NULL;
- }
- v->flags &= ~VF_DISPLAY;
-}
-
-static void
-falcon_free_view(v)
-view_t *v;
-{
- if (v) {
- dmode_t *md = v->mode;
-
- falcon_remove_view(v);
- if (v->colormap != &gra_con_cmap)
- free(v->colormap, M_DEVBUF);
- free_bitmap(v->bitmap);
- if (v != &gra_con_view)
- free(v, M_DEVBUF);
- }
-}
-
-static int
-falcon_use_colormap(v, cm)
-view_t *v;
-colormap_t *cm;
-{
- dmode_t *dm;
- volatile u_short *creg;
- volatile u_long *fcreg;
- u_long *src;
- colormap_t *vcm;
- u_long *vcreg;
- u_short ncreg;
- int i;
-
- dm = v->mode;
- vcm = v->colormap;
-
- /*
- * I guess it seems reasonable to require the maps to be
- * of the same type...
- */
- if (cm->type != vcm->type)
- return (EINVAL);
-
- /*
- * First get the colormap addresses an calculate
- * howmany colors are in it.
- */
- if (dm->depth == 16) /* direct color, no colormap;
- but also not (yet) supported */
- return(0);
- fcreg = &VIDEO->vd_fal_rgb[0];
- creg = &VIDEO->vd_st_rgb[0];
- ncreg = 1 << dm->depth;
-
- /* If first entry specified beyond capabilities -> error */
- if (cm->first >= ncreg)
- return (EINVAL);
-
- /*
- * A little tricky, the actual colormap pointer will be NULL
- * when view is not displaying, valid otherwise.
- */
- if (v->flags & VF_DISPLAY)
- creg = &creg[cm->first];
- else creg = NULL;
-
- vcreg = &vcm->entry[cm->first];
- ncreg -= cm->first;
- if (cm->size > ncreg)
- return (EINVAL);
- ncreg = cm->size;
-
- for (i = 0, src = cm->entry; i < ncreg; i++, vcreg++) {
- *vcreg = *src++;
-
- /*
- * If displaying, also update actual color register.
- */
- if (creg != NULL) {
- *fcreg++ = CM_L2FAL(*vcreg);
- if (i < 16 )
- *creg++ = CM_L2ST(*vcreg);
- }
- }
- return (0);
-}
-
-static view_t *
-falcon_alloc_view(mode, dim, depth)
-dmode_t *mode;
-dimen_t *dim;
-u_char depth;
-{
- view_t *v;
- bmap_t *bm;
-
- if (!atari_realconfig)
- v = &gra_con_view;
- else v = malloc(sizeof(*v), M_DEVBUF, M_NOWAIT);
- if (v == NULL)
- return(NULL);
-
- bm = alloc_bitmap(mode->size.width, mode->size.height, mode->depth);
- if (bm) {
- box_t box;
-
- v->colormap = alloc_colormap(mode);
- if (v->colormap) {
- INIT_BOX(&box,0,0,mode->size.width,mode->size.height);
- init_view(v, bm, mode, &box);
- return(v);
- }
- free_bitmap(bm);
- }
- if (v != &gra_con_view)
- free(v, M_DEVBUF);
- return (NULL);
-}
-
-static void
-init_view(v, bm, mode, dbox)
-view_t *v;
-bmap_t *bm;
-dmode_t *mode;
-box_t *dbox;
-{
- v->bitmap = bm;
- v->mode = mode;
- v->flags = 0;
- bcopy(dbox, &v->display, sizeof(box_t));
-}
-
-/* bitmap functions */
-
-static bmap_t *
-alloc_bitmap(width, height, depth)
-u_long width, height;
-u_char depth;
-{
- int i;
- u_long total_size, bm_size;
- void *hw_address;
- bmap_t *bm;
-
- /*
- * Sigh, it seems for mapping to work we need the bitplane data to
- * 1: be aligned on a page boundry.
- * 2: be n pages large.
- *
- * why? because the user gets a page aligned address, if this is before
- * your allocation, too bad. Also it seems that the mapping routines
- * do not watch to closely to the allowable length. so if you go over
- * n pages by less than another page, the user gets to write all over
- * the entire page. Since you did not allocate up to a page boundry
- * (or more) the user writes into someone elses memory. -ch
- */
- bm_size = atari_round_page((width * height * depth) / NBBY);
- total_size = bm_size + sizeof(bmap_t) + NBPG;
-
- if ((bm = (bmap_t*)alloc_stmem(total_size, &hw_address)) == NULL)
- return(NULL);
-
- bm->plane = (u_char*)bm + sizeof(bmap_t);
- bm->plane = (u_char*)atari_round_page(bm->plane);
- bm->hw_address = (u_char*)hw_address + sizeof(bmap_t);
- bm->hw_address = (u_char*)atari_round_page(bm->hw_address);
- bm->bytes_per_row = (width * depth) / NBBY;
- bm->rows = height;
- bm->depth = depth;
-
- bzero(bm->plane, bm_size);
- return (bm);
-}
-
-static void
-free_bitmap(bm)
-bmap_t *bm;
-{
- if (bm)
- free_stmem(bm);
-}
-
-static colormap_t *
-alloc_colormap(dm)
-dmode_t *dm;
-{
- int nentries, i;
- colormap_t *cm;
- u_char type = CM_COLOR;
-
- if (dm->depth == 16) /* direct color, no colormap;
- not (yet) supported */
- nentries = 0;
- else
- nentries = 1 << dm->depth;
-
- if (!atari_realconfig) {
- cm = &gra_con_cmap;
- cm->entry = gra_con_colors;
- }
- else {
- int size;
-
- size = sizeof(*cm) + (nentries * sizeof(cm->entry[0]));
- cm = malloc(size, M_DEVBUF, M_NOWAIT);
- if (cm == NULL)
- return(NULL);
- cm->entry = (long *)&cm[1];
-
- }
-
- if ((cm->type = type) == CM_COLOR)
- cm->red_mask = cm->green_mask = cm->blue_mask = 0x3f;
-
- cm->first = 0;
- cm->size = nentries;
-
- for (i = 0; i < nentries; i++)
- cm->entry[i] = gra_def_color16[i % 16];
- return (cm);
-}
-#endif /* FALCON_VIDEO */
diff --git a/sys/arch/atari/dev/grfabs_fal.h b/sys/arch/atari/dev/grfabs_fal.h
deleted file mode 100644
index 4a04d219304..00000000000
--- a/sys/arch/atari/dev/grfabs_fal.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $NetBSD: grfabs_fal.h,v 1.1 1996/01/02 20:59:24 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Thomas Gerner.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Thomas Gerner
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _GRFABS_FAL_H
-#define _GRFABS_FAL_H
-/*
- * Struct to hold the values for the different video modes
- */
-
-
-struct videl {
- u_short vm_reg; /* video mode */
- u_char vd_syncmode; /* Syncronisation */
- u_short vd_line_wide; /* Falcon line word distance */
- u_short vd_vert_wrap; /* Falcon line length */
- u_char vd_st_res; /* ST resolution */
- u_short vd_fal_res; /* Falcon resolution */
- u_short vd_h_hold_tim; /* Falcon horizontal hold timer */
- u_short vd_h_bord_beg; /* Falcon horizontal border begin */
- u_short vd_h_bord_end; /* Falcon horizontal border end */
- u_short vd_h_dis_beg; /* Falcon horizontal display begin */
- u_short vd_h_dis_end; /* Falcon horizontal display end */
- u_short vd_h_ss; /* Falcon horizontal SS */
- u_short vd_h_fs; /* Falcon horizontal FS */
- u_short vd_h_hh; /* Falcon horizontal HH */
- u_short vd_v_freq_tim; /* Falcon vertical frequency timer */
- u_short vd_v_bord_beg; /* Falcon vertical border begin */
- u_short vd_v_bord_end; /* Falcon vertical border end */
- u_short vd_v_dis_beg; /* Falcon vertical display begin */
- u_short vd_v_dis_end; /* Falcon vertical display end */
- u_short vd_v_ss; /* Falcon vertical SS */
- u_short vd_fal_ctrl; /* Falcon video control */
- u_short vd_fal_mode; /* Falcon video mode */
-};
-
-#endif /* _GRFABS_FAL_H */
diff --git a/sys/arch/atari/dev/grfabs_reg.h b/sys/arch/atari/dev/grfabs_reg.h
deleted file mode 100644
index 1377d2aee84..00000000000
--- a/sys/arch/atari/dev/grfabs_reg.h
+++ /dev/null
@@ -1,219 +0,0 @@
-/* $NetBSD: grfabs_reg.h,v 1.5 1995/09/04 19:41:41 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman
- * Copyright (c) 1994 Christian E. Hopps
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christian E. Hopps.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _GRFABS_REG_H
-#define _GRFABS_REG_H
-
-struct point {
- long x;
- long y;
-};
-typedef struct point point_t;
-
-struct dimension {
- u_long width;
- u_long height;
-};
-typedef struct dimension dimen_t;
-
-struct box {
- long x;
- long y;
- u_long width;
- u_long height;
-};
-typedef struct box box_t;
-
-struct rectangle {
- long left;
- long top;
- long right;
- long bottom;
-};
-typedef struct rectangle rect_t;
-
-typedef struct bitmap bmap_t;
-typedef struct colormap colormap_t;
-typedef struct display_mode dmode_t;
-
-/*
- * View stuff.
- */
-
-struct view {
- bmap_t *bitmap; /* bitmap. */
- box_t display; /* viewable area. */
- dmode_t *mode; /* the mode for this view */
- colormap_t *colormap; /* the colormap for this view */
- int flags;
-};
-typedef struct view view_t;
-
-/* View-flags: */
-#define VF_DISPLAY 1 /* view is on the air now */
-
-/*
- * Bitmap stuff.
- */
-struct bitmap {
- u_short bytes_per_row; /* number of bytes per display row. */
- u_short rows; /* number of display rows. */
- u_short depth; /* depth of bitmap. */
- u_char *plane; /* plane data for bitmap. */
- u_char *hw_address; /* mappable bitplane pointer. */
-};
-
-/*
- * Colormap stuff.
- */
-struct colormap {
- u_char type; /* what type of entries these are. */
- union {
- u_char grey; /* CM_GREYSCALE */
- struct { /* CM_COLOR */
- u_char red;
- u_char green;
- u_char blue;
- } rgb_mask;
- } valid_mask;
- u_short first; /* color register entry[0] refers to */
- u_short size; /* number of entries */
- u_long *entry; /* the table of actual color values */
-};
-
-/*
- * Mask short-hands
- */
-#define grey_mask valid_mask.grey
-#define red_mask valid_mask.rgb_mask.red
-#define green_mask valid_mask.rgb_mask.green
-#define blue_mask valid_mask.rgb_mask.blue
-
-enum colormap_type {
- CM_MONO, /* only on or off allowed */
- CM_GREYSCALE, /* grey values */
- CM_COLOR /* RGB values */
-};
-
-#define MAX_CENTRIES 256 /* that all there is */
-/*
- * Create a colormap entry
- */
-#define MAKE_COLOR_ENTRY(r,g,b) (((r & 0xff)<<16)|((g & 0xff)<<8)|(b & 0xff))
-#define MAKE_MONO_ENTRY(x) ((x) ? 1 : 0)
-#define MAKE_GREY_ENTRY(l) (l & 0xff)
-
-#define CM_L2TT(v) \
- (((0x000f0000 & (v)) >> 8) | ((0x00000f00 & (v)) >> 4) |\
- (0x0000000f & (v)))
-#define CM_TT2L(v) \
- ((((0x00000f00 & (v)) * 0xff / 0xf) << 8) |\
- (((0x000000f0 & (v)) * 0xff / 0xf) << 4) |\
- (0x0000000f & (v)) * 0xff / 0xf)
-#define CM_L2FAL(v) \
- (((0x003f0000 & (v)) << 10) | ((0x00003f00 & (v)) << 10) |\
- (0x0000003f & (v)) << 2)
-#define CM_FAL2L(v) \
- (((((0xfc000000 & (v)) >> 10) * 0xff / 0x3f) & 0x00ff0000) |\
- ((((0x00fc0000 & (v)) >> 10) * 0xff / 0x3f) & 0x0000ff00) |\
- ((0x000000fc & (v)) >> 2) * 0xff / 0x3f)
-#define CM_L2ST(v) \
- (((0x000e0000 & (v)) >> 9) | ((0x00000e00 & (v)) >> 5) |\
- (0x0000000e & (v)) >> 1)
-#define CM_ST2L(v) \
- (((((0x00000700 & (v)) * 0xff / 0x7) << 8) & 0x00ff0000) |\
- ((((0x00000070 & (v)) * 0xff / 0x7) << 4) & 0x0000ff00) |\
- (0x00000007 & (v)) * 0xff / 0x7)
-
-struct grfabs_sw {
- void (*display_view) __P((view_t*));
- view_t * (*alloc_view) __P((dmode_t *, dimen_t *, u_char));
- void (*free_view) __P((view_t *));
- void (*remove_view) __P((view_t *));
- int (*use_colormap) __P((view_t *, colormap_t *));
-};
-
-/* display mode */
-struct display_mode {
- LIST_ENTRY(display_mode) link;
- u_char *name; /* logical name for mode. */
- dimen_t size; /* screen size */
- u_char depth; /* screen depth */
- u_short vm_reg; /* video mode register */
- struct grfabs_sw *grfabs_funcs; /* hardware switch table */
- view_t *current_view; /* view displaying me */
-};
-
-/*
- * Definition of available graphic mode list.
- */
-typedef LIST_HEAD(modelist, display_mode) MODES;
-
-/*
- * Misc draw related macros.
- */
-#define INIT_BOX(b,xx,yy,ww,hh) \
- do { \
- (b)->x = xx; \
- (b)->y = yy; \
- (b)->width = ww; \
- (b)->height = hh; \
- } while(0)
-
-
-/*
- * Common variables
- */
-extern view_t gra_con_view;
-extern colormap_t gra_con_cmap;
-extern long gra_con_colors[MAX_CENTRIES];
-extern u_long gra_def_color16[16];
-
-/*
- * Prototypes:
- */
-#ifdef FALCON_VIDEO
-void falcon_probe_video __P((MODES *));
-#endif /* FALCON_VIDEO */
-#ifdef TT_VIDEO
-void tt_probe_video __P((MODES *));
-#endif /* TT_VIDEO */
-
-view_t *grf_alloc_view __P((dmode_t *d, dimen_t *dim, u_char depth));
-dmode_t *grf_get_best_mode __P((dimen_t *dim, u_char depth));
-void grf_display_view __P((view_t *v));
-void grf_remove_view __P((view_t *v));
-void grf_free_view __P((view_t *v));
-int grf_get_colormap __P((view_t *, colormap_t *));
-int grf_use_colormap __P((view_t *, colormap_t *));
-
-#endif /* _GRFABS_REG_H */
diff --git a/sys/arch/atari/dev/grfabs_tt.c b/sys/arch/atari/dev/grfabs_tt.c
deleted file mode 100644
index aeece81b853..00000000000
--- a/sys/arch/atari/dev/grfabs_tt.c
+++ /dev/null
@@ -1,402 +0,0 @@
-/* $NetBSD: grfabs_tt.c,v 1.1 1995/08/20 18:17:34 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifdef TT_VIDEO
-/*
- * atari abstract graphics driver: TT-interface
- */
-#include <sys/param.h>
-#include <sys/queue.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-
-#include <machine/iomap.h>
-#include <machine/video.h>
-#include <machine/mfp.h>
-#include <atari/atari/device.h>
-#include <atari/dev/grfabs_reg.h>
-
-/*
- * Function decls
- */
-static void init_view __P((view_t *, bmap_t *, dmode_t *, box_t *));
-static bmap_t *alloc_bitmap __P((u_long, u_long, u_char));
-static colormap_t *alloc_colormap __P((dmode_t *));
-static void free_bitmap __P((bmap_t *));
-static void tt_display_view __P((view_t *));
-static view_t *tt_alloc_view __P((dmode_t *, dimen_t *, u_char));
-static void tt_free_view __P((view_t *));
-static void tt_remove_view __P((view_t *));
-static int tt_use_colormap __P((view_t *, colormap_t *));
-
-/*
- * Our function switch table
- */
-struct grfabs_sw tt_vid_sw = {
- tt_display_view,
- tt_alloc_view,
- tt_free_view,
- tt_remove_view,
- tt_use_colormap
-};
-
-static dmode_t vid_modes[] = {
- { { NULL, NULL }, "sthigh", { 640, 400 }, 1, RES_STHIGH, &tt_vid_sw },
- { { NULL, NULL }, "tthigh", { 1280, 960 }, 1, RES_TTHIGH, &tt_vid_sw },
- { { NULL, NULL }, "stmid", { 640, 200 }, 2, RES_STMID , &tt_vid_sw },
- { { NULL, NULL }, "stlow", { 320, 200 }, 4, RES_STLOW , &tt_vid_sw },
- { { NULL, NULL }, "ttmid", { 640, 480 }, 4, RES_TTMID , &tt_vid_sw },
- { { NULL, NULL }, "ttlow", { 320, 480 }, 8, RES_TTLOW , &tt_vid_sw },
- { { NULL, NULL }, NULL, }
-};
-
-/*
- * XXX: called from ite console init routine.
- * Initialize list of posible video modes.
- */
-void
-tt_probe_video(modelp)
-MODES *modelp;
-{
- dmode_t *dm;
- int i;
- int has_mono;
-
- /*
- * First find out what kind of monitor is attached. Dma-sound
- * should be off because the 'sound-done' and 'monochrome-detect'
- * are xor-ed together. I think that shutting it down here is the
- * wrong place.
- */
- has_mono = (MFP->mf_gpip & IA_MONO) == 0;
-
- for (i = 0; (dm = &vid_modes[i])->name != NULL; i++) {
- if (has_mono && (dm->vm_reg != RES_TTHIGH))
- continue;
- if (!has_mono && (dm->vm_reg == RES_TTHIGH))
- continue;
- LIST_INSERT_HEAD(modelp, dm, link);
- }
-
- for (i=0; i < 16; i++)
- VIDEO->vd_tt_rgb[i] = CM_L2TT(gra_def_color16[i]);
-}
-
-static void
-tt_display_view(v)
-view_t *v;
-{
- dmode_t *dm = v->mode;
- bmap_t *bm = v->bitmap;
-
- if (dm->current_view) {
- /*
- * Mark current view for this mode as no longer displayed
- */
- dm->current_view->flags &= ~VF_DISPLAY;
- }
- dm->current_view = v;
- v->flags |= VF_DISPLAY;
-
- tt_use_colormap(v, v->colormap);
-
- /* XXX: should use vbl for this */
- VIDEO->vd_tt_res = dm->vm_reg;
- VIDEO->vd_raml = (u_long)bm->hw_address & 0xff;
- VIDEO->vd_ramm = ((u_long)bm->hw_address >> 8) & 0xff;
- VIDEO->vd_ramh = ((u_long)bm->hw_address >> 16) & 0xff;
-}
-
-void
-tt_remove_view(v)
-view_t *v;
-{
- dmode_t *mode = v->mode;
-
- if (mode->current_view == v) {
-#if 0
- if (v->flags & VF_DISPLAY)
- panic("Cannot shutdown display"); /* XXX */
-#endif
- mode->current_view = NULL;
- }
- v->flags &= ~VF_DISPLAY;
-}
-
-void
-tt_free_view(v)
-view_t *v;
-{
- if(v) {
- dmode_t *md = v->mode;
-
- tt_remove_view(v);
- if (v->colormap != &gra_con_cmap)
- free(v->colormap, M_DEVBUF);
- free_bitmap(v->bitmap);
- if (v != &gra_con_view)
- free(v, M_DEVBUF);
- }
-}
-
-static int
-tt_use_colormap(v, cm)
-view_t *v;
-colormap_t *cm;
-{
- dmode_t *dm;
- volatile u_short *creg;
- u_long *src;
- colormap_t *vcm;
- u_long *vcreg;
- u_short ncreg;
- int i;
-
- dm = v->mode;
- vcm = v->colormap;
-
- /*
- * I guess it seems reasonable to require the maps to be
- * of the same type...
- */
- if (cm->type != vcm->type)
- return(EINVAL);
-
- /*
- * First figure out where the actual colormap resides and
- * howmany colors are in it.
- */
- switch (dm->vm_reg) {
- case RES_STLOW:
- creg = &VIDEO->vd_tt_rgb[0];
- ncreg = 16;
- break;
- case RES_STMID:
- creg = &VIDEO->vd_tt_rgb[0];
- ncreg = 4;
- break;
- case RES_STHIGH:
- creg = &VIDEO->vd_tt_rgb[254];
- ncreg = 2;
- break;
- case RES_TTLOW:
- creg = &VIDEO->vd_tt_rgb[0];
- ncreg = 256;
- break;
- case RES_TTMID:
- creg = &VIDEO->vd_tt_rgb[0];
- ncreg = 16;
- break;
- case RES_TTHIGH:
- return(0); /* No colors */
- default:
- panic("grf_tt:use_colormap: wrong mode!?");
- }
-
- /* If first entry specified beyond capabilities -> error */
- if (cm->first >= ncreg)
- return(EINVAL);
-
- /*
- * A little tricky, the actual colormap pointer will be NULL
- * when view is not displaying, valid otherwise.
- */
- if (v->flags & VF_DISPLAY)
- creg = &creg[cm->first];
- else creg = NULL;
-
- vcreg = &vcm->entry[cm->first];
- ncreg -= cm->first;
- if (cm->size > ncreg)
- return(EINVAL);
- ncreg = cm->size;
-
- for (i = 0, src = cm->entry; i < ncreg; i++, vcreg++) {
- *vcreg = *src++;
-
- /*
- * If displaying, also update actual color registers.
- */
- if (creg != NULL)
- *creg++ = CM_L2TT(*vcreg);
- }
- return (0);
-}
-
-static view_t *
-tt_alloc_view(mode, dim, depth)
-dmode_t *mode;
-dimen_t *dim;
-u_char depth;
-{
- view_t *v;
- bmap_t *bm;
-
- if (!atari_realconfig)
- v = &gra_con_view;
- else v = malloc(sizeof(*v), M_DEVBUF, M_NOWAIT);
- if(v == NULL)
- return (NULL);
-
- bm = alloc_bitmap(mode->size.width, mode->size.height, mode->depth);
- if (bm) {
- box_t box;
-
- v->colormap = alloc_colormap(mode);
- if (v->colormap) {
- INIT_BOX(&box,0,0,mode->size.width,mode->size.height);
- init_view(v, bm, mode, &box);
- return (v);
- }
- free_bitmap(bm);
- }
- if (v != &gra_con_view)
- free(v, M_DEVBUF);
- return (NULL);
-}
-
-static void
-init_view(v, bm, mode, dbox)
-view_t *v;
-bmap_t *bm;
-dmode_t *mode;
-box_t *dbox;
-{
- v->bitmap = bm;
- v->mode = mode;
- v->flags = 0;
- bcopy(dbox, &v->display, sizeof(box_t));
-}
-
-/* bitmap functions */
-
-static bmap_t *
-alloc_bitmap(width, height, depth)
-u_long width, height;
-u_char depth;
-{
- int i;
- u_long total_size, bm_size;
- void *hw_address;
- bmap_t *bm;
-
- /*
- * Sigh, it seems for mapping to work we need the bitplane data to
- * 1: be aligned on a page boundry.
- * 2: be n pages large.
- *
- * why? because the user gets a page aligned address, if this is before
- * your allocation, too bad. Also it seems that the mapping routines
- * do not watch to closely to the allowable length. so if you go over
- * n pages by less than another page, the user gets to write all over
- * the entire page. Since you did not allocate up to a page boundry
- * (or more) the user writes into someone elses memory. -ch
- */
- bm_size = atari_round_page((width * height * depth) / NBBY);
- total_size = bm_size + sizeof(bmap_t) + NBPG;
-
- if ((bm = (bmap_t*)alloc_stmem(total_size, &hw_address)) == NULL)
- return(NULL);
-
- bm->plane = (u_char*)bm + sizeof(bmap_t);
- bm->plane = (u_char*)atari_round_page(bm->plane);
- bm->hw_address = (u_char*)hw_address + sizeof(bmap_t);
- bm->hw_address = (u_char*)atari_round_page(bm->hw_address);
- bm->bytes_per_row = (width * depth) / NBBY;
- bm->rows = height;
- bm->depth = depth;
-
- bzero(bm->plane, bm_size);
- return (bm);
-}
-
-static void
-free_bitmap(bm)
-bmap_t *bm;
-{
- if (bm)
- free_stmem(bm);
-}
-
-static colormap_t *
-alloc_colormap(dm)
-dmode_t *dm;
-{
- int nentries, i;
- colormap_t *cm;
- u_char type = CM_COLOR;
-
- switch (dm->vm_reg) {
- case RES_STLOW:
- case RES_TTMID:
- nentries = 16;
- break;
- case RES_STMID:
- nentries = 4;
- break;
- case RES_STHIGH:
- nentries = 2;
- break;
- case RES_TTLOW:
- nentries = 256;
- break;
- case RES_TTHIGH:
- type = CM_MONO;
- nentries = 0;
- break;
- default:
- panic("grf_tt:alloc_colormap: wrong mode!?");
- }
- if (!atari_realconfig) {
- cm = &gra_con_cmap;
- cm->entry = gra_con_colors;
- }
- else {
- int size;
-
- size = sizeof(*cm) + (nentries * sizeof(cm->entry[0]));
- cm = malloc(size, M_DEVBUF, M_NOWAIT);
- if (cm == NULL)
- return (NULL);
- cm->entry = (long *)&cm[1];
-
- }
- if ((cm->type = type) == CM_COLOR)
- cm->red_mask = cm->green_mask = cm->blue_mask = 0xf;
- cm->first = 0;
- cm->size = nentries;
-
- for (i = 0; i < nentries; i++)
- cm->entry[i] = gra_def_color16[i % 16];
- return (cm);
-}
-#endif /* TT_VIDEO */
diff --git a/sys/arch/atari/dev/grfioctl.h b/sys/arch/atari/dev/grfioctl.h
deleted file mode 100644
index fb5b32571c3..00000000000
--- a/sys/arch/atari/dev/grfioctl.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* $NetBSD: grfioctl.h,v 1.1.1.1 1995/03/26 07:12:12 leo Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grfioctl.h 1.1 90/07/09$
- *
- * @(#)grfioctl.h 7.2 (Berkeley) 11/4/90
- */
-
-
-/* these are changeable values, encapsulated in their own structure, so
- no the whole thing has to be copied when setting parameters. */
-struct grfdyninfo {
- int gdi_fbx; /* frame buffer x offset */
- int gdi_fby; /* frame buffer y offset */
- int gdi_dwidth; /* displayed part width */
- int gdi_dheight; /* displayed part height */
- int gdi_dx; /* displayed part x offset */
- int gdi_dy; /* displayed part y offset */
-};
-
-struct grfinfo {
- caddr_t gd_fbaddr; /* frame buffer physaddr */
- int gd_fbsize; /* frame buffer size */
- short gd_colors; /* number of colors */
- short gd_planes; /* number of planes */
-
- int gd_fbwidth; /* frame buffer width */
- int gd_fbheight; /* frame buffer height */
-
- struct grfdyninfo gd_dyn; /* everything changable by GRFIOCSINFO */
-/* compatibility... */
-#define gd_fbx gd_dyn.gdi_fbx
-#define gd_fby gd_dyn.gdi_fby
-#define gd_dwidth gd_dyn.gdi_dwidth
-#define gd_dheight gd_dyn.gdi_dheight
-#define gd_dx gd_dyn.gdi_dx
-#define gd_dy gd_dyn.gdi_dy
-
- /* new for banked pager support */
- int gd_bank_size; /* size of a bank (or 0) */
-};
-
-
-/* video mode, should be display-independant, but it might need
- modifications in the future to really become hardware-independant. */
-
-struct grfvideo_mode {
- u_char mode_num; /* index in mode table */
- char mode_descr[80]; /* description of mode */
- u_long pixel_clock; /* in Hz. */
- u_short disp_width; /* width of displayed video (incl overscan) */
- u_short disp_height; /* height "" */
- u_short depth; /* number of bitplanes resp. bits per pixel */
- u_short hblank_start;
- u_short hblank_stop;
- u_short hsync_start; /* video-parameters, take care not to */
- u_short hsync_stop; /* use parameters that violete specs of */
- u_short htotal; /* your monitor ! */
- u_short vblank_start;
- u_short vblank_stop;
- u_short vsync_start;
- u_short vsync_stop;
- u_short vtotal;
-};
-
-
-/*
- * BSD ioctls
- */
-#define OGRFIOCGINFO 0x40344700 /* to keep compat for a while... */
-#define GRFIOCGINFO _IOR('G', 0, struct grfinfo) /* get info on device */
-#define GRFIOCON _IO('G', 1) /* turn graphics on */
-#define GRFIOCOFF _IO('G', 2) /* turn graphics off */
-#define GRFIOCMAP _IOWR('G', 5, int) /* map in regs+framebuffer */
-#define GRFIOCUNMAP _IOW('G', 6, int) /* unmap regs+framebuffer */
-
-/* amiga addons */
- /* set info on device */
-#define GRFIOCSINFO _IOW('G', 40, struct grfdyninfo)
- /* get video_mode. mode_num==0 gets current mode. */
-#define GRFGETVMODE _IOWR('G', 41, struct grfvideo_mode)
- /* set video_mode. */
-#define GRFSETVMODE _IOW('G', 42, int)
- /* get number of configured video modes */
-#define GRFGETNUMVM _IOR('G', 43, int)
-
-
-/*
- * generic framebuffer-related ioctls. These are somewhat
- * similar to SunOS fb-ioctls since I liked them reading
- * thru the X11-server code.
- */
-
-/*
- * colormap related information. Every grf has an associated
- * colormap. Depending on the capabilities of the hardware, more
- * or less of the information provided may be used.
- * Maxium value of "index" can be deduced from grfinfo->gd_colors.
- */
-struct grf_colormap {
- int index; /* start at red[index],green[index],blue[index] */
- int count; /* till < red[index+count],... */
- u_char *red;
- u_char *green;
- u_char *blue;
-};
-
-/* write the selected slots into the active colormap */
-#define GRFIOCPUTCMAP _IOW('G', 50, struct grf_colormap)
-
-/* retrieve the selected slots from the active colormap */
-#define GRFIOCGETCMAP _IOWR('G', 51, struct grf_colormap)
-
-
-/*
- * support a possibly available hardware sprite. calls just fail
- * if a given grf doesn't implement hardware sprites.
- */
-struct grf_position {
- u_short x, y; /* 0,0 is upper left corner */
-};
-#define GRFIOCSSPRITEPOS _IOW('G', 52, struct grf_position)
-#define GRFIOCGSPRITEPOS _IOR('G', 53, struct grf_position)
-
-struct grf_spriteinfo {
- u_short set;
-#define GRFSPRSET_ENABLE (1<<0)
-#define GRFSPRSET_POS (1<<1)
-#define GRFSPRSET_HOT (1<<2)
-#define GRFSPRSET_CMAP (1<<3)
-#define GRFSPRSET_SHAPE (1<<4)
-#define GRFSPRSET_ALL 0x1f
- u_short enable; /* sprite is displayed if == 1 */
- struct grf_position pos; /* sprite location */
- struct grf_position hot; /* sprite hot spot */
- struct grf_colormap cmap; /* colormap for the sprite. */
- struct grf_position size; /* x == width, y == height */
- u_char *image, *mask; /* sprite bitmap and mask */
-};
-
-#define GRFIOCSSPRITEINF _IOW('G', 54, struct grf_spriteinfo)
-#define GRFIOCGSPRITEINF _IOR('G', 55, struct grf_spriteinfo)
-
-/* get maximum sprite size hardware can display */
-#define GRFIOCGSPRITEMAX _IOR('G', 56, struct grf_position)
-
-
-/* support for a BitBlt operation. The op-codes are identical
- to X11 GCs */
-#define GRFBBOPclear 0x0 /* 0 */
-#define GRFBBOPand 0x1 /* src AND dst */
-#define GRFBBOPandReverse 0x2 /* src AND NOT dst */
-#define GRFBBOPcopy 0x3 /* src */
-#define GRFBBOPandInverted 0x4 /* NOT src AND dst */
-#define GRFBBOPnoop 0x5 /* dst */
-#define GRFBBOPxor 0x6 /* src XOR dst */
-#define GRFBBOPor 0x7 /* src OR dst */
-#define GRFBBOPnor 0x8 /* NOT src AND NOT dst */
-#define GRFBBOPequiv 0x9 /* NOT src XOR dst */
-#define GRFBBOPinvert 0xa /* NOT dst */
-#define GRFBBOPorReverse 0xb /* src OR NOT dst */
-#define GRFBBOPcopyInverted 0xc /* NOT src */
-#define GRFBBOPorInverted 0xd /* NOT src OR dst */
-#define GRFBBOPnand 0xe /* NOT src OR NOT dst */
-#define GRFBBOPset 0xf /* 1 */
-
-struct grf_bitblt {
- u_short op; /* see above */
- u_short src_x, src_y; /* upper left corner of source-region */
- u_short dst_x, dst_y; /* upper left corner of dest-region */
- u_short w, h; /* width, height of region */
- u_short mask; /* bitmask to apply */
-};
-
-#define GRFIOCBITBLT _IOR('G', 57, struct grf_bitblt)
-
diff --git a/sys/arch/atari/dev/grfvar.h b/sys/arch/atari/dev/grfvar.h
deleted file mode 100644
index 121fd265bca..00000000000
--- a/sys/arch/atari/dev/grfvar.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* $NetBSD: grfvar.h,v 1.2 1995/05/28 19:45:38 leo Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grfvar.h 1.9 91/01/21$
- *
- * @(#)grfvar.h 7.3 (Berkeley) 5/7/91
- */
-
-struct ite_softc;
-
-/*
- * this struct is owned by the driver (grfcc)
- * and is passed to grf when grf is configed. The ite also
- * uses it...
- */
-struct grf_softc {
- struct device g_device; /* config sets this up. */
- struct grfinfo g_display; /* hardware descr. (for ioctl) */
- int g_flags; /* software flags */
- int g_unit; /* grf unit we want/have */
- dev_t g_itedev; /* ite device number */
- dev_t g_grfdev; /* grf device number */
- dev_t g_viewdev; /* view device number */
- caddr_t g_data; /* device dependent data */
- int (*g_mode)();
- int g_conpri; /* priority of ite as console */
- void (*g_iteinit)();
- void (*g_itedeinit)();
- void (*g_iteclear)();
- void (*g_iteputc)();
- void (*g_itecursor)();
- void (*g_itescroll)();
-};
-
-/* flags */
-#define GF_ALIVE 0x01
-#define GF_OPEN 0x02
-#define GF_EXCLUDE 0x04
-#define GF_WANTED 0x08
-#define GF_GRFON 0x10
-
-/* software ids defined in grfioctl.h */
-
-/* requests to mode routine (g_mode())*/
-#define GM_GRFON 1
-#define GM_GRFOFF 2
-#define GM_GRFOVON 3
-#define GM_GRFOVOFF 4
-#define GM_GRFCONFIG 5
-#define GM_GRFGETVMODE 6
-#define GM_GRFSETVMODE 7
-#define GM_GRFGETNUMVM 8
-#define GM_GRFGETBANK 9
-#define GM_GRFSETBANK 10
-#define GM_GRFGETCURBANK 11
-#define GM_GRFIOCTL 12
-
-/* minor device interpretation */
-#define GRFOVDEV 0x10 /* XXX no driver uses yet, overlay planes */
-#define GRFIMDEV 0x20 /* XXX no driver uses yet, images planes */
-#define GRFUNIT(d) ((d) & 0x7)
diff --git a/sys/arch/atari/dev/ite.c b/sys/arch/atari/dev/ite.c
deleted file mode 100644
index 4c9ffa63a2a..00000000000
--- a/sys/arch/atari/dev/ite.c
+++ /dev/null
@@ -1,2348 +0,0 @@
-/* $NetBSD: ite.c,v 1.7 1995/09/04 19:39:21 leo Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: ite.c 1.1 90/07/09
- * from: @(#)ite.c 7.6 (Berkeley) 5/16/91
- */
-
-/*
- * ite - bitmapped terminal.
- * Supports VT200, a few terminal features will be unavailable until
- * the system actually probes the device (i.e. not after consinit())
- */
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/termios.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <dev/cons.h>
-
-#include <atari/atari/kdassert.h>
-#include <atari/dev/kbdmap.h>
-#include <atari/dev/iteioctl.h>
-#include <atari/dev/itevar.h>
-#include <atari/dev/grfioctl.h>
-#include <atari/dev/grfabs_reg.h>
-#include <atari/dev/grfvar.h>
-#include <atari/dev/viewioctl.h>
-#include <atari/dev/viewvar.h>
-
-#define ITEUNIT(dev) (minor(dev))
-
-#define SUBR_INIT(ip) (ip)->grf->g_iteinit(ip)
-#define SUBR_DEINIT(ip) (ip)->grf->g_itedeinit(ip)
-#define SUBR_PUTC(ip,c,dy,dx,m) (ip)->grf->g_iteputc(ip,c,dy,dx,m)
-#define SUBR_CURSOR(ip,flg) (ip)->grf->g_itecursor(ip,flg)
-#define SUBR_CLEAR(ip,sy,sx,h,w) (ip)->grf->g_iteclear(ip,sy,sx,h,w)
-#define SUBR_SCROLL(ip,sy,sx,cnt,dir) (ip)->grf->g_itescroll(ip,sy,sx,cnt,dir)
-
-u_int ite_confunits; /* configured units */
-
-int start_repeat_timeo = 30; /* first repeat after x s/100 */
-int next_repeat_timeo = 10; /* next repeat after x s/100 */
-
-int ite_default_wrap = 1; /* you want vtxxx-nam, binpatch */
-
-struct ite_softc con_itesoftc;
-u_char cons_tabs[MAX_TABS];
-
-struct ite_softc *kbd_ite;
-int kbd_init;
-
-static char *index __P((const char *, int));
-static int inline atoi __P((const char *));
-static void ite_switch __P((int));
-void iteputchar __P((int c, struct ite_softc *ip));
-void ite_putstr __P((const u_char * s, int len, dev_t dev));
-void iteattach __P((struct device *, struct device *, void *));
-int itematch __P((struct device *, struct cfdata *, void *));
-
-struct cfdriver itecd = {
- NULL, "ite", (cfmatch_t)itematch, iteattach, DV_DULL,
- sizeof(struct ite_softc), NULL, 0 };
-
-int
-itematch(pdp, cdp, auxp)
- struct device *pdp;
- struct cfdata *cdp;
- void *auxp;
-{
- struct grf_softc *gp;
- int maj;
-
- gp = auxp;
-
- /* ite0 should be at grf0 */
- if(cdp->cf_unit != gp->g_unit)
- return(0);
-
- /*
- * all that our mask allows (more than enough no one
- * has > 32 monitors for text consoles on one machine)
- */
- if (cdp->cf_unit >= sizeof(ite_confunits) * NBBY)
- return(0);
- /*
- * XXX
- * normally this would be done in attach, however
- * during early init we do not have a device pointer
- * and thus no unit number.
- */
- for(maj = 0; maj < nchrdev; maj++)
- if (cdevsw[maj].d_open == iteopen)
- break;
- gp->g_itedev = makedev(maj, cdp->cf_unit);
- return(1);
-}
-
-void
-iteattach(pdp, dp, auxp)
-struct device *pdp, *dp;
-void *auxp;
-{
- extern int hz;
- struct grf_softc *gp;
- struct ite_softc *ip;
- int s;
-
- gp = (struct grf_softc *)auxp;
-
- /*
- * mark unit as attached (XXX see itematch)
- */
- ite_confunits |= 1 << ITEUNIT(gp->g_itedev);
-
- if(dp) {
- ip = (struct ite_softc *)dp;
-
- s = spltty();
- if(con_itesoftc.grf != NULL
- && con_itesoftc.grf->g_unit == gp->g_unit) {
- /*
- * console reinit copy params over.
- * and console always gets keyboard
- */
- bcopy(&con_itesoftc.grf, &ip->grf,
- (char *)&ip[1] - (char *)&ip->grf);
- con_itesoftc.grf = NULL;
- kbd_ite = ip;
- }
- ip->grf = gp;
- splx(s);
-
- iteinit(gp->g_itedev);
- printf(": rows %d cols %d", ip->rows, ip->cols);
- printf(" repeat at (%d/100)s next at (%d/100)s",
- start_repeat_timeo, next_repeat_timeo);
-
- if (kbd_ite == NULL)
- kbd_ite = ip;
- if (kbd_ite == ip)
- printf(" has keyboard");
- printf("\n");
- } else {
- if (con_itesoftc.grf != NULL &&
- con_itesoftc.grf->g_conpri > gp->g_conpri)
- return;
- con_itesoftc.grf = gp;
- con_itesoftc.tabs = cons_tabs;
- }
-}
-
-struct ite_softc *
-getitesp(dev)
- dev_t dev;
-{
- extern int atari_realconfig;
-
- if(atari_realconfig && (con_itesoftc.grf == NULL))
- return(itecd.cd_devs[ITEUNIT(dev)]);
-
- if(con_itesoftc.grf == NULL)
- panic("no ite_softc for console");
- return(&con_itesoftc);
-}
-
-/*
- * cons.c entry points into ite device.
- */
-
-/*
- * Return a priority in consdev->cn_pri field highest wins. This function
- * is called before any devices have been probed.
- */
-void
-itecnprobe(cd)
- struct consdev *cd;
-{
- /*
- * bring graphics layer up.
- */
- config_console();
-
- /*
- * return priority of the best ite (already picked from attach)
- * or CN_DEAD.
- */
- if (con_itesoftc.grf == NULL)
- cd->cn_pri = CN_DEAD;
- else {
- cd->cn_pri = con_itesoftc.grf->g_conpri;
- cd->cn_dev = con_itesoftc.grf->g_itedev;
- }
-}
-
-void
-itecninit(cd)
- struct consdev *cd;
-{
- struct ite_softc *ip;
-
- ip = getitesp(cd->cn_dev);
- ip->flags |= ITE_ISCONS;
- iteinit(cd->cn_dev);
- ip->flags |= ITE_ACTIVE | ITE_ISCONS;
-}
-
-/*
- * ite_cnfinish() is called in ite_init() when the device is
- * being probed in the normal fasion, thus we can finish setting
- * up this ite now that the system is more functional.
- */
-void
-ite_cnfinish(ip)
- struct ite_softc *ip;
-{
- static int done;
-
- if (done)
- return;
- done = 1;
-}
-
-int
-itecngetc(dev)
- dev_t dev;
-{
- int c;
-
- /* XXX this should be moved */
- if (!kbd_init) {
- kbd_init = 1;
- kbdenable();
- }
- do {
- c = kbdgetcn();
- c = ite_cnfilter(c, ITEFILT_CONSOLE);
- } while (c == -1);
- return (c);
-}
-
-void
-itecnputc(dev, c)
- dev_t dev;
- int c;
-{
- static int paniced;
- struct ite_softc *ip;
- char ch;
-
- ip = getitesp(dev);
- ch = c;
-
- if (panicstr && !paniced &&
- (ip->flags & (ITE_ACTIVE | ITE_INGRF)) != ITE_ACTIVE) {
- (void)ite_on(dev, 3);
- paniced = 1;
- }
- iteputchar(ch, ip);
-}
-
-/*
- * standard entry points to the device.
- */
-
-/*
- * iteinit() is the standard entry point for initialization of
- * an ite device, it is also called from itecninit().
- *
- */
-void
-iteinit(dev)
- dev_t dev;
-{
- extern int atari_realconfig;
- struct ite_softc *ip;
-
- ip = getitesp(dev);
- if (ip->flags & ITE_INITED)
- return;
- if (atari_realconfig) {
- if (ip->kbdmap && ip->kbdmap != &ascii_kbdmap)
- free(ip->kbdmap, M_DEVBUF);
- ip->kbdmap = malloc(sizeof(struct kbdmap), M_DEVBUF, M_WAITOK);
- bcopy(&ascii_kbdmap, ip->kbdmap, sizeof(struct kbdmap));
- }
- else ip->kbdmap = &ascii_kbdmap;
-
- ip->cursorx = 0;
- ip->cursory = 0;
- SUBR_INIT(ip);
- SUBR_CURSOR(ip, DRAW_CURSOR);
- if (ip->tabs == NULL)
- ip->tabs = malloc(MAX_TABS * sizeof(u_char),M_DEVBUF,M_WAITOK);
- ite_reset(ip);
- ip->flags |= ITE_INITED;
-}
-
-int
-iteopen(dev, mode, devtype, p)
- dev_t dev;
- int mode, devtype;
- struct proc *p;
-{
- struct ite_softc *ip;
- struct tty *tp;
- int error, first, unit;
-
- unit = ITEUNIT(dev);
- first = 0;
-
- if (((1 << unit) & ite_confunits) == 0)
- return (ENXIO);
-
- ip = getitesp(dev);
-
- if (ip->tp == NULL)
- tp = ip->tp = ttymalloc();
- else
- tp = ip->tp;
- if ((tp->t_state & (TS_ISOPEN | TS_XCLUDE)) == (TS_ISOPEN | TS_XCLUDE)
- && p->p_ucred->cr_uid != 0)
- return (EBUSY);
- if ((ip->flags & ITE_ACTIVE) == 0) {
- error = ite_on(dev, 0);
- if (error)
- return (error);
- first = 1;
- }
- tp->t_oproc = itestart;
- tp->t_param = ite_param;
- tp->t_dev = dev;
- if ((tp->t_state & TS_ISOPEN) == 0) {
- ttychars(tp);
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- tp->t_cflag = TTYDEF_CFLAG;
- tp->t_lflag = TTYDEF_LFLAG;
- tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
- tp->t_state = TS_WOPEN | TS_CARR_ON;
- ttsetwater(tp);
- }
- error = (*linesw[tp->t_line].l_open) (dev, tp);
- if (error == 0) {
- tp->t_winsize.ws_row = ip->rows;
- tp->t_winsize.ws_col = ip->cols;
- if (!kbd_init) {
- kbd_init = 1;
- kbdenable();
- }
- } else if (first)
- ite_off(dev, 0);
- return (error);
-}
-
-int
-iteclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- struct tty *tp;
-
- tp = getitesp(dev)->tp;
-
- KDASSERT(tp);
- (*linesw[tp->t_line].l_close) (tp, flag);
- ttyclose(tp);
- ite_off(dev, 0);
- return (0);
-}
-
-int
-iteread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- struct tty *tp;
-
- tp = getitesp(dev)->tp;
-
- KDASSERT(tp);
- return ((*linesw[tp->t_line].l_read) (tp, uio, flag));
-}
-
-int
-itewrite(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- struct tty *tp;
-
- tp = getitesp(dev)->tp;
-
- KDASSERT(tp);
- return ((*linesw[tp->t_line].l_write) (tp, uio, flag));
-}
-
-int
-itestop(tp, flag)
- struct tty *tp;
- int flag;
-{
-
-}
-
-struct tty *
-itetty(dev)
- dev_t dev;
-{
- return(getitesp(dev)->tp);
-}
-
-int
-iteioctl(dev, cmd, addr, flag, p)
- dev_t dev;
- u_long cmd;
- int flag;
- caddr_t addr;
- struct proc *p;
-{
- struct iterepeat *irp;
- struct ite_softc *ip;
- struct tty *tp;
- int error;
-
- ip = getitesp(dev);
- tp = ip->tp;
-
- KDASSERT(tp);
-
- error = (*linesw[tp->t_line].l_ioctl) (tp, cmd, addr, flag, p);
- if(error >= 0)
- return (error);
- error = ttioctl(tp, cmd, addr, flag, p);
- if (error >= 0)
- return (error);
-
- switch (cmd) {
- case ITEIOCSKMAP:
- if (addr == 0)
- return(EFAULT);
- bcopy(addr, ip->kbdmap, sizeof(struct kbdmap));
- return(0);
- case ITEIOCSSKMAP:
- if (addr == 0)
- return(EFAULT);
- bcopy(addr, &ascii_kbdmap, sizeof(struct kbdmap));
- return(0);
- case ITEIOCGKMAP:
- if (addr == NULL)
- return(EFAULT);
- bcopy(ip->kbdmap, addr, sizeof(struct kbdmap));
- return(0);
- case ITEIOCGREPT:
- irp = (struct iterepeat *)addr;
- irp->start = start_repeat_timeo;
- irp->next = next_repeat_timeo;
- return(0);
- case ITEIOCSREPT:
- irp = (struct iterepeat *)addr;
- if (irp->start < ITEMINREPEAT || irp->next < ITEMINREPEAT)
- return(EINVAL);
- start_repeat_timeo = irp->start;
- next_repeat_timeo = irp->next;
- return(0);
- }
- error = ite_grf_ioctl(ip, cmd, addr, flag, p);
- if(error >= 0)
- return(error);
- return (ENOTTY);
-}
-
-void
-itestart(tp)
- struct tty *tp;
-{
- struct clist *rbp;
- struct ite_softc *ip;
- u_char buf[ITEBURST];
- int s, len, n;
-
- ip = getitesp(tp->t_dev);
-
- KDASSERT(tp);
-
- s = spltty(); {
- if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP))
- goto out;
-
- tp->t_state |= TS_BUSY;
- rbp = &tp->t_outq;
-
- len = q_to_b(rbp, buf, ITEBURST);
- } splx(s);
-
- /* Here is a really good place to implement pre/jumpscroll() */
- ite_putstr((char *)buf, len, tp->t_dev);
-
- s = spltty(); {
- tp->t_state &= ~TS_BUSY;
- /* we have characters remaining. */
- if (rbp->c_cc) {
- tp->t_state |= TS_TIMEOUT;
- timeout_add(&tp->t_rstrt_to, 1);
- }
- /* wakeup we are below */
- if (rbp->c_cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t) rbp);
- }
- selwakeup(&tp->t_wsel);
- }
- out: ;
- } splx(s);
-}
-
-int
-ite_on(dev, flag)
- dev_t dev;
- int flag;
-{
- struct ite_softc *ip;
- int unit;
-
- unit = ITEUNIT(dev);
- if (((1 << unit) & ite_confunits) == 0)
- return (ENXIO);
-
- ip = getitesp(dev);
-
- /* force ite active, overriding graphics mode */
- if (flag & 1) {
- ip->flags |= ITE_ACTIVE;
- ip->flags &= ~(ITE_INGRF | ITE_INITED);
- }
- /* leave graphics mode */
- if (flag & 2) {
- ip->flags &= ~ITE_INGRF;
- if ((ip->flags & ITE_ACTIVE) == 0)
- return (0);
- }
- ip->flags |= ITE_ACTIVE;
- if (ip->flags & ITE_INGRF)
- return (0);
- iteinit(dev);
- return (0);
-}
-
-int
-ite_off(dev, flag)
-dev_t dev;
-int flag;
-{
- struct ite_softc *ip;
-
- ip = getitesp(dev);
- if (flag & 2)
- ip->flags |= ITE_INGRF;
- if ((ip->flags & ITE_ACTIVE) == 0)
- return;
- if ((flag & 1) ||
- (ip->flags & (ITE_INGRF | ITE_ISCONS | ITE_INITED)) == ITE_INITED)
- SUBR_DEINIT(ip);
- if ((flag & 2) == 0) /* XXX hmm grfon() I think wants this to go inactive. */
- ip->flags &= ~ITE_ACTIVE;
-}
-
-static void
-ite_switch(unit)
-int unit;
-{
- struct ite_softc *ip;
-
- if(!(ite_confunits & (1 << unit)))
- return; /* Don't try unconfigured units */
- ip = getitesp(unit);
- if(!(ip->flags & ITE_INITED))
- return;
-
- /*
- * If switching to an active ite, also switch the keyboard.
- */
- if(ip->flags & ITE_ACTIVE)
- kbd_ite = ip;
-
- /*
- * Now make it visible
- */
- viewioctl(ip->grf->g_viewdev, VIOCDISPLAY, NULL, 0, -1);
-}
-
-/* XXX called after changes made in underlying grf layer. */
-/* I want to nuke this */
-void
-ite_reinit(dev)
- dev_t dev;
-{
- struct ite_softc *ip;
-
- ip = getitesp(dev);
- ip->flags &= ~ITE_INITED;
- iteinit(dev);
-}
-
-int
-ite_param(tp, t)
- struct tty *tp;
- struct termios *t;
-{
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- tp->t_cflag = t->c_cflag;
- return (0);
-}
-
-void
-ite_reset(ip)
- struct ite_softc *ip;
-{
- int i;
-
- ip->curx = 0;
- ip->cury = 0;
- ip->attribute = ATTR_NOR;
- ip->save_curx = 0;
- ip->save_cury = 0;
- ip->save_attribute = ATTR_NOR;
- ip->ap = ip->argbuf;
- ip->emul_level = 0;
- ip->eightbit_C1 = 0;
- ip->top_margin = 0;
- ip->bottom_margin = ip->rows - 1;
- ip->inside_margins = 0;
- ip->linefeed_newline = 0;
- ip->auto_wrap = ite_default_wrap;
- ip->cursor_appmode = 0;
- ip->keypad_appmode = 0;
- ip->imode = 0;
- ip->key_repeat = 1;
- bzero(ip->tabs, ip->cols);
- for (i = 0; i < ip->cols; i++)
- ip->tabs[i] = ((i & 7) == 0);
-}
-
-/*
- * has to be global becuase of the shared filters.
- */
-static u_char key_mod;
-static u_char last_dead;
-
-/* Used in console at startup only */
-int
-ite_cnfilter(c, caller)
-u_int c;
-enum caller caller;
-{
- struct key key;
- struct kbdmap *kbdmap;
- u_char code, up, mask;
- int s;
-
- up = KBD_RELEASED(c);
- c = KBD_SCANCODE(c);
- code = 0;
- mask = 0;
- kbdmap = (kbd_ite == NULL) ? &ascii_kbdmap : kbd_ite->kbdmap;
-
- s = spltty();
-
- /*
- * Handle special keys
- */
- switch(c) {
- case KBD_LEFT_SHIFT:
- mask = KBD_MOD_LSHIFT;
- break;
- case KBD_RIGHT_SHIFT:
- mask = KBD_MOD_RSHIFT;
- break;
- case KBD_CTRL:
- mask = KBD_MOD_CTRL;
- break;
- case KBD_ALT:
- mask = KBD_MOD_ALT;
- break;
- case KBD_CAPS_LOCK:
- /* CAPSLOCK is a toggle */
- if(!up)
- key_mod ^= KBD_MOD_CAPS;
- splx(s);
- return;
- break;
- }
- if(mask) {
- if(up)
- key_mod &= ~mask;
- else
- key_mod |= mask;
- splx(s);
- return -1;
- }
-
- /*
- * No special action if key released
- */
- if(up) {
- splx(s);
- return -1;
- }
-
- /* translate modifiers */
- if(key_mod & KBD_MOD_SHIFT) {
- if(key_mod & KBD_MOD_ALT)
- key = kbdmap->alt_shift_keys[c];
- else key = kbdmap->shift_keys[c];
- }
- else if(key_mod & KBD_MOD_ALT)
- key = kbdmap->alt_keys[c];
- else {
- key = kbdmap->keys[c];
- /*
- * If CAPS and key is CAPable (no pun intended)
- */
- if((key_mod & KBD_MOD_CAPS) && (key.mode & KBD_MODE_CAPS))
- key = kbdmap->shift_keys[c];
- }
- code = key.code;
-
-#ifdef notyet /* LWP: Didn't have time to look at this yet */
- /*
- * If string return simple console filter
- */
- if(key->mode & (KBD_MODE_STRING | KBD_MODE_KPAD)) {
- splx(s);
- return -1;
- }
- /* handle dead keys */
- if(key->mode & KBD_MODE_DEAD) {
- /* if entered twice, send accent itself */
- if (last_dead == key->mode & KBD_MODE_ACCMASK)
- last_dead = 0;
- else {
- last_dead = key->mode & KBD_MODE_ACCMASK;
- splx(s);
- return -1;
- }
- }
- if(last_dead) {
- /* can't apply dead flag to string-keys */
- if (code >= '@' && code < 0x7f)
- code =
- acctable[KBD_MODE_ACCENT(last_dead)][code - '@'];
- last_dead = 0;
- }
-#endif
- if(key_mod & KBD_MOD_CTRL)
- code &= 0x1f;
-
- /*
- * Do console mapping.
- */
- code = code == '\r' ? '\n' : code;
-
- splx(s);
- return (code);
-}
-
-/* And now the old stuff. */
-
-/* these are used to implement repeating keys.. */
-static u_char last_char;
-static u_char tout_pending;
-
-/*ARGSUSED*/
-static void
-
-repeat_handler(arg)
-void *arg;
-{
- tout_pending = 0;
- if(last_char)
- add_sicallback(ite_filter, last_char, ITEFILT_REPEATER);
-}
-
-void
-ite_filter(c, caller)
-u_int c;
-enum caller caller;
-{
- struct tty *kbd_tty;
- struct kbdmap *kbdmap;
- u_char code, *str, up, mask;
- struct key key;
- int s, i;
-
- if(kbd_ite == NULL)
- return;
-
- kbd_tty = kbd_ite->tp;
- kbdmap = kbd_ite->kbdmap;
-
- up = KBD_RELEASED(c);
- c = KBD_SCANCODE(c);
- code = 0;
- mask = 0;
-
- /* have to make sure we're at spltty in here */
- s = spltty();
-
- /*
- * keyboard interrupts come at priority 2, while softint
- * generated keyboard-repeat interrupts come at level 1. So,
- * to not allow a key-up event to get thru before a repeat for
- * the key-down, we remove any outstanding callout requests..
- */
- rem_sicallback(ite_filter);
-
-
- /*
- * Handle special keys
- */
- switch(c) {
- case KBD_LEFT_SHIFT:
- mask = KBD_MOD_LSHIFT;
- break;
- case KBD_RIGHT_SHIFT:
- mask = KBD_MOD_RSHIFT;
- break;
- case KBD_CTRL:
- mask = KBD_MOD_CTRL;
- break;
- case KBD_ALT:
- mask = KBD_MOD_ALT;
- break;
- case KBD_CAPS_LOCK:
- /* CAPSLOCK is a toggle */
- if(!up)
- key_mod ^= KBD_MOD_CAPS;
- splx(s);
- return;
- break;
- }
- if(mask) {
- if(up)
- key_mod &= ~mask;
- else
- key_mod |= mask;
- splx(s);
- return;
- }
-
- /*
- * Stop repeating on up event
- */
- if (up) {
- if(tout_pending) {
- untimeout(repeat_handler, 0);
- tout_pending = 0;
- last_char = 0;
- }
- splx(s);
- return;
- }
- else if(tout_pending && last_char != c) {
- /*
- * Different character, stop also
- */
- untimeout(repeat_handler, 0);
- tout_pending = 0;
- last_char = 0;
- }
-
- /*
- * Handle ite-switching ALT + Fx
- */
- if((key_mod == KBD_MOD_ALT) && (c >= 0x3b) && (c <= 0x44)) {
- ite_switch(c - 0x3b);
- splx(s);
- return;
- }
- /*
- * Safety button, switch back to ascii keymap.
- */
- if(key_mod == (KBD_MOD_ALT | KBD_MOD_LSHIFT) && c == 0x3b) {
- /* ALT + LSHIFT + F1 */
- bcopy(&ascii_kbdmap, kbdmap, sizeof(struct kbdmap));
- splx(s);
- return;
-#ifdef DDB
- }
- else if(key_mod == (KBD_MOD_ALT | KBD_MOD_LSHIFT) && c == 0x43) {
- /* ALT + LSHIFT + F9 */
- extern int Debugger();
- Debugger();
- splx(s);
- return;
-#endif
- }
-
- /*
- * The rest of the code is senseless when the device is not open.
- */
- if(kbd_tty == NULL) {
- splx(s);
- return;
- }
-
- /*
- * Translate modifiers
- */
- if(key_mod & KBD_MOD_SHIFT) {
- if(key_mod & KBD_MOD_ALT)
- key = kbdmap->alt_shift_keys[c];
- else key = kbdmap->shift_keys[c];
- }
- else if(key_mod & KBD_MOD_ALT)
- key = kbdmap->alt_keys[c];
- else {
- key = kbdmap->keys[c];
- /*
- * If CAPS and key is CAPable (no pun intended)
- */
- if((key_mod & KBD_MOD_CAPS) && (key.mode & KBD_MODE_CAPS))
- key = kbdmap->shift_keys[c];
- }
- code = key.code;
-
- /*
- * Arrange to repeat the keystroke. By doing this at the level
- * of scan-codes, we can have function keys, and keys that
- * send strings, repeat too. This also entitles an additional
- * overhead, since we have to do the conversion each time, but
- * I guess that's ok.
- */
- if(!tout_pending && caller == ITEFILT_TTY && kbd_ite->key_repeat) {
- tout_pending = 1;
- last_char = c;
- timeout(repeat_handler, 0, start_repeat_timeo * hz / 100);
- }
- else if(!tout_pending && caller==ITEFILT_REPEATER
- && kbd_ite->key_repeat) {
- tout_pending = 1;
- last_char = c;
- timeout(repeat_handler, 0, next_repeat_timeo * hz / 100);
- }
- /* handle dead keys */
- if (key.mode & KBD_MODE_DEAD) {
- /* if entered twice, send accent itself */
- if (last_dead == key.mode & KBD_MODE_ACCMASK)
- last_dead = 0;
- else {
- last_dead = key.mode & KBD_MODE_ACCMASK;
- splx(s);
- return;
- }
- }
- if (last_dead) {
- /* can't apply dead flag to string-keys */
- if (!(key.mode & KBD_MODE_STRING) && code >= '@' &&
- code < 0x7f)
- code = acctable[KBD_MODE_ACCENT(last_dead)][code - '@'];
- last_dead = 0;
- }
-
- /*
- * If not string, apply CTRL modifiers
- */
- if(!(key.mode & KBD_MODE_STRING)
- && (!(key.mode & KBD_MODE_KPAD)
- || (kbd_ite && !kbd_ite->keypad_appmode))) {
- if(key_mod & KBD_MOD_CTRL)
- code &= 0x1f;
- }
- else if((key.mode & KBD_MODE_KPAD)
- && (kbd_ite && kbd_ite->keypad_appmode)) {
- static char *in = "0123456789-+.\r()/*";
- static char *out = "pqrstuvwxymlnMPQRS";
- char *cp = index(in, code);
-
- /*
- * keypad-appmode sends SS3 followed by the above
- * translated character
- */
- (*linesw[kbd_tty->t_line].l_rint) (27, kbd_tty);
- (*linesw[kbd_tty->t_line].l_rint) ('O', kbd_tty);
- (*linesw[kbd_tty->t_line].l_rint) (out[cp - in], kbd_tty);
- splx(s);
- return;
- } else {
- /* *NO* I don't like this.... */
- static u_char app_cursor[] =
- {
- 3, 27, 'O', 'A',
- 3, 27, 'O', 'B',
- 3, 27, 'O', 'C',
- 3, 27, 'O', 'D'};
-
- str = kbdmap->strings + code;
- /*
- * if this is a cursor key, AND it has the default
- * keymap setting, AND we're in app-cursor mode, switch
- * to the above table. This is *nasty* !
- */
- if(((c == 0x48) || (c == 0x4b) || (c == 0x4d) || (c == 0x50))
- && kbd_ite->cursor_appmode
- && !bcmp(str, "\x03\x1b[", 3) &&
- index("ABCD", str[3]))
- str = app_cursor + 4 * (str[3] - 'A');
-
- /*
- * using a length-byte instead of 0-termination allows
- * to embed \0 into strings, although this is not used
- * in the default keymap
- */
- for (i = *str++; i; i--)
- (*linesw[kbd_tty->t_line].l_rint) (*str++, kbd_tty);
- splx(s);
- return;
- }
- (*linesw[kbd_tty->t_line].l_rint) (code, kbd_tty);
-
- splx(s);
- return;
-}
-
-/* helper functions, makes the code below more readable */
-static void inline
-ite_sendstr(str)
- char *str;
-{
- struct tty *kbd_tty;
-
- kbd_tty = kbd_ite->tp;
- KDASSERT(kbd_tty);
- while (*str)
- (*linesw[kbd_tty->t_line].l_rint) (*str++, kbd_tty);
-}
-
-static void
-alignment_display(ip)
- struct ite_softc *ip;
-{
- int i, j;
-
- for (j = 0; j < ip->rows; j++)
- for (i = 0; i < ip->cols; i++)
- SUBR_PUTC(ip, 'E', j, i, ATTR_NOR);
- attrclr(ip, 0, 0, ip->rows, ip->cols);
- SUBR_CURSOR(ip, DRAW_CURSOR);
-}
-
-static void inline
-snap_cury(ip)
- struct ite_softc *ip;
-{
- if (ip->inside_margins)
- {
- if (ip->cury < ip->top_margin)
- ip->cury = ip->top_margin;
- if (ip->cury > ip->bottom_margin)
- ip->cury = ip->bottom_margin;
- }
-}
-
-static void inline
-ite_dnchar(ip, n)
- struct ite_softc *ip;
- int n;
-{
- n = min(n, ip->cols - ip->curx);
- if (n < ip->cols - ip->curx)
- {
- SUBR_SCROLL(ip, ip->cury, ip->curx + n, n, SCROLL_LEFT);
- attrmov(ip, ip->cury, ip->curx + n, ip->cury, ip->curx,
- 1, ip->cols - ip->curx - n);
- attrclr(ip, ip->cury, ip->cols - n, 1, n);
- }
- while (n-- > 0)
- SUBR_PUTC(ip, ' ', ip->cury, ip->cols - n - 1, ATTR_NOR);
- SUBR_CURSOR(ip, DRAW_CURSOR);
-}
-
-static void inline
-ite_inchar(ip, n)
- struct ite_softc *ip;
- int n;
-{
- n = min(n, ip->cols - ip->curx);
- if (n < ip->cols - ip->curx)
- {
- SUBR_SCROLL(ip, ip->cury, ip->curx, n, SCROLL_RIGHT);
- attrmov(ip, ip->cury, ip->curx, ip->cury, ip->curx + n,
- 1, ip->cols - ip->curx - n);
- attrclr(ip, ip->cury, ip->curx, 1, n);
- }
- while (n--)
- SUBR_PUTC(ip, ' ', ip->cury, ip->curx + n, ATTR_NOR);
- SUBR_CURSOR(ip, DRAW_CURSOR);
-}
-
-static void inline
-ite_clrtoeol(ip)
- struct ite_softc *ip;
-{
- int y = ip->cury, x = ip->curx;
- if (ip->cols - x > 0)
- {
- SUBR_CLEAR(ip, y, x, 1, ip->cols - x);
- attrclr(ip, y, x, 1, ip->cols - x);
- SUBR_CURSOR(ip, DRAW_CURSOR);
- }
-}
-
-static void inline
-ite_clrtobol(ip)
- struct ite_softc *ip;
-{
- int y = ip->cury, x = min(ip->curx + 1, ip->cols);
- SUBR_CLEAR(ip, y, 0, 1, x);
- attrclr(ip, y, 0, 1, x);
- SUBR_CURSOR(ip, DRAW_CURSOR);
-}
-
-static void inline
-ite_clrline(ip)
- struct ite_softc *ip;
-{
- int y = ip->cury;
- SUBR_CLEAR(ip, y, 0, 1, ip->cols);
- attrclr(ip, y, 0, 1, ip->cols);
- SUBR_CURSOR(ip, DRAW_CURSOR);
-}
-
-
-
-static void inline
-ite_clrtoeos(ip)
- struct ite_softc *ip;
-{
- ite_clrtoeol(ip);
- if (ip->cury < ip->rows - 1)
- {
- SUBR_CLEAR(ip, ip->cury + 1, 0, ip->rows - 1 - ip->cury, ip->cols);
- attrclr(ip, ip->cury, 0, ip->rows - ip->cury, ip->cols);
- SUBR_CURSOR(ip, DRAW_CURSOR);
- }
-}
-
-static void inline
-ite_clrtobos(ip)
- struct ite_softc *ip;
-{
- ite_clrtobol(ip);
- if (ip->cury > 0)
- {
- SUBR_CLEAR(ip, 0, 0, ip->cury, ip->cols);
- attrclr(ip, 0, 0, ip->cury, ip->cols);
- SUBR_CURSOR(ip, DRAW_CURSOR);
- }
-}
-
-static void inline
-ite_clrscreen(ip)
- struct ite_softc *ip;
-{
- SUBR_CLEAR(ip, 0, 0, ip->rows, ip->cols);
- attrclr(ip, 0, 0, ip->rows, ip->cols);
- SUBR_CURSOR(ip, DRAW_CURSOR);
-}
-
-
-
-static void inline
-ite_dnline(ip, n)
- struct ite_softc *ip;
- int n;
-{
- /* interesting.. if the cursor is outside the scrolling
- region, this command is simply ignored.. */
- if (ip->cury < ip->top_margin || ip->cury > ip->bottom_margin)
- return;
-
- n = min(n, ip->bottom_margin + 1 - ip->cury);
- if (n <= ip->bottom_margin - ip->cury)
- {
- SUBR_SCROLL(ip, ip->cury + n, 0, n, SCROLL_UP);
- attrmov(ip, ip->cury + n, 0, ip->cury, 0,
- ip->bottom_margin + 1 - ip->cury - n, ip->cols);
- }
- SUBR_CLEAR(ip, ip->bottom_margin - n + 1, 0, n, ip->cols);
- attrclr(ip, ip->bottom_margin - n + 1, 0, n, ip->cols);
- SUBR_CURSOR(ip, DRAW_CURSOR);
-}
-
-static void inline
-ite_inline(ip, n)
- struct ite_softc *ip;
- int n;
-{
- /* interesting.. if the cursor is outside the scrolling
- region, this command is simply ignored.. */
- if (ip->cury < ip->top_margin || ip->cury > ip->bottom_margin)
- return;
-
- n = min(n, ip->bottom_margin + 1 - ip->cury);
- if (n <= ip->bottom_margin - ip->cury)
- {
- SUBR_SCROLL(ip, ip->cury, 0, n, SCROLL_DOWN);
- attrmov(ip, ip->cury, 0, ip->cury + n, 0,
- ip->bottom_margin + 1 - ip->cury - n, ip->cols);
- }
- SUBR_CLEAR(ip, ip->cury, 0, n, ip->cols);
- attrclr(ip, ip->cury, 0, n, ip->cols);
- SUBR_CURSOR(ip, DRAW_CURSOR);
-}
-
-static void inline
-ite_lf (ip)
- struct ite_softc *ip;
-{
- ++ip->cury;
- if ((ip->cury == ip->bottom_margin+1) || (ip->cury == ip->rows))
- {
- ip->cury--;
- SUBR_SCROLL(ip, ip->top_margin + 1, 0, 1, SCROLL_UP);
- ite_clrline(ip);
- }
- SUBR_CURSOR(ip, MOVE_CURSOR);
- clr_attr(ip, ATTR_INV);
-}
-
-static void inline
-ite_crlf (ip)
- struct ite_softc *ip;
-{
- ip->curx = 0;
- ite_lf (ip);
-}
-
-static void inline
-ite_cr (ip)
- struct ite_softc *ip;
-{
- if (ip->curx)
- {
- ip->curx = 0;
- SUBR_CURSOR(ip, MOVE_CURSOR);
- }
-}
-
-static void inline
-ite_rlf (ip)
- struct ite_softc *ip;
-{
- ip->cury--;
- if ((ip->cury < 0) || (ip->cury == ip->top_margin - 1))
- {
- ip->cury++;
- SUBR_SCROLL(ip, ip->top_margin, 0, 1, SCROLL_DOWN);
- ite_clrline(ip);
- }
- SUBR_CURSOR(ip, MOVE_CURSOR);
- clr_attr(ip, ATTR_INV);
-}
-
-static int inline
-atoi (cp)
- const char *cp;
-{
- int n;
-
- for (n = 0; *cp && *cp >= '0' && *cp <= '9'; cp++)
- n = n * 10 + *cp - '0';
-
- return n;
-}
-
-static char *
-index (cp, ch)
- const char *cp;
- int ch;
-{
- while (*cp && *cp != ch) cp++;
- return *cp ? (char *) cp : 0;
-}
-
-
-
-static int inline
-ite_argnum (ip)
- struct ite_softc *ip;
-{
- char ch;
- int n;
-
- /* convert argument string into number */
- if (ip->ap == ip->argbuf)
- return 1;
- ch = *ip->ap;
- *ip->ap = 0;
- n = atoi (ip->argbuf);
- *ip->ap = ch;
-
- return n;
-}
-
-static int inline
-ite_zargnum (ip)
- struct ite_softc *ip;
-{
- char ch, *cp;
- int n;
-
- /* convert argument string into number */
- if (ip->ap == ip->argbuf)
- return 0;
- ch = *ip->ap;
- *ip->ap = 0;
- n = atoi (ip->argbuf);
- *ip->ap = ch;
-
- return n; /* don't "n ? n : 1" here, <CSI>0m != <CSI>1m ! */
-}
-
-static int inline
-strncmp (a, b, l)
- const char *a, *b;
- int l;
-{
- for (;l--; a++, b++)
- if (*a != *b)
- return *a - *b;
- return 0;
-}
-
-void
-ite_putstr(s, len, dev)
- const u_char *s;
- int len;
- dev_t dev;
-{
- struct ite_softc *ip;
- int i;
-
- ip = getitesp(dev);
-
- /* XXX avoid problems */
- if ((ip->flags & (ITE_ACTIVE|ITE_INGRF)) != ITE_ACTIVE)
- return;
-
- SUBR_CURSOR(ip, START_CURSOROPT);
- for (i = 0; i < len; i++)
- if (s[i])
- iteputchar(s[i], ip);
- SUBR_CURSOR(ip, END_CURSOROPT);
-}
-
-
-void
-iteputchar(c, ip)
- register int c;
- struct ite_softc *ip;
-{
- struct tty *kbd_tty;
- int n, x, y;
- char *cp;
-
- if (kbd_ite == NULL)
- kbd_tty = NULL;
- else
- kbd_tty = kbd_ite->tp;
-
- if (ip->escape)
- {
-doesc:
- switch (ip->escape)
- {
- case ESC:
- switch (c)
- {
- /* first 7bit equivalents for the 8bit control characters */
-
- case 'D':
- c = IND;
- ip->escape = 0;
- break; /* and fall into the next switch below (same for all `break') */
-
- case 'E':
- c = NEL;
- ip->escape = 0;
- break;
-
- case 'H':
- c = HTS;
- ip->escape = 0;
- break;
-
- case 'M':
- c = RI;
- ip->escape = 0;
- break;
-
- case 'N':
- c = SS2;
- ip->escape = 0;
- break;
-
- case 'O':
- c = SS3;
- ip->escape = 0;
- break;
-
- case 'P':
- c = DCS;
- ip->escape = 0;
- break;
-
- case '[':
- c = CSI;
- ip->escape = 0;
- break;
-
- case '\\':
- c = ST;
- ip->escape = 0;
- break;
-
- case ']':
- c = OSC;
- ip->escape = 0;
- break;
-
- case '^':
- c = PM;
- ip->escape = 0;
- break;
-
- case '_':
- c = APC;
- ip->escape = 0;
- break;
-
-
- /* introduces 7/8bit control */
- case ' ':
- /* can be followed by either F or G */
- ip->escape = ' ';
- break;
-
-
- /* a lot of character set selections, not yet used...
- 94-character sets: */
- case '(': /* G0 */
- case ')': /* G1 */
- ip->escape = c;
- return;
-
- case '*': /* G2 */
- case '+': /* G3 */
- case 'B': /* ASCII */
- case 'A': /* ISO latin 1 */
- case '<': /* user preferred suplemental */
- case '0': /* dec special graphics */
-
- /* 96-character sets: */
- case '-': /* G1 */
- case '.': /* G2 */
- case '/': /* G3 */
-
- /* national character sets: */
- case '4': /* dutch */
- case '5':
- case 'C': /* finnish */
- case 'R': /* french */
- case 'Q': /* french canadian */
- case 'K': /* german */
- case 'Y': /* italian */
- case '6': /* norwegian/danish */
- /* note: %5 and %6 are not supported (two chars..) */
-
- ip->escape = 0;
- /* just ignore for now */
- return;
-
-
- /* locking shift modes (as you might guess, not yet supported..) */
- case '`':
- ip->GR = ip->G1;
- ip->escape = 0;
- return;
-
- case 'n':
- ip->GL = ip->G2;
- ip->escape = 0;
- return;
-
- case '}':
- ip->GR = ip->G2;
- ip->escape = 0;
- return;
-
- case 'o':
- ip->GL = ip->G3;
- ip->escape = 0;
- return;
-
- case '|':
- ip->GR = ip->G3;
- ip->escape = 0;
- return;
-
-
- /* font width/height control */
- case '#':
- ip->escape = '#';
- return;
-
-
- /* hard terminal reset .. */
- case 'c':
- ite_reset (ip);
- SUBR_CURSOR(ip, MOVE_CURSOR);
- ip->escape = 0;
- return;
-
-
- case '7':
- ip->save_curx = ip->curx;
- ip->save_cury = ip->cury;
- ip->save_attribute = ip->attribute;
- ip->escape = 0;
- return;
-
- case '8':
- ip->curx = ip->save_curx;
- ip->cury = ip->save_cury;
- ip->attribute = ip->save_attribute;
- SUBR_CURSOR(ip, MOVE_CURSOR);
- ip->escape = 0;
- return;
-
- case '=':
- ip->keypad_appmode = 1;
- ip->escape = 0;
- return;
-
- case '>':
- ip->keypad_appmode = 0;
- ip->escape = 0;
- return;
-
- case 'Z': /* request ID */
- if (ip->emul_level == EMUL_VT100)
- ite_sendstr ("\033[?61;0c"); /* XXX not clean */
- else
- ite_sendstr ("\033[?63;0c"); /* XXX not clean */
- ip->escape = 0;
- return;
-
- /* default catch all for not recognized ESC sequences */
- default:
- ip->escape = 0;
- return;
- }
- break;
-
-
- case '(':
- case ')':
- ip->escape = 0;
- return;
-
-
- case ' ':
- switch (c)
- {
- case 'F':
- ip->eightbit_C1 = 0;
- ip->escape = 0;
- return;
-
- case 'G':
- ip->eightbit_C1 = 1;
- ip->escape = 0;
- return;
-
- default:
- /* not supported */
- ip->escape = 0;
- return;
- }
- break;
-
-
- case '#':
- switch (c)
- {
- case '5':
- /* single height, single width */
- ip->escape = 0;
- return;
-
- case '6':
- /* double width, single height */
- ip->escape = 0;
- return;
-
- case '3':
- /* top half */
- ip->escape = 0;
- return;
-
- case '4':
- /* bottom half */
- ip->escape = 0;
- return;
-
- case '8':
- /* screen alignment pattern... */
- alignment_display (ip);
- ip->escape = 0;
- return;
-
- default:
- ip->escape = 0;
- return;
- }
- break;
-
-
-
- case CSI:
- /* the biggie... */
- switch (c)
- {
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- case ';': case '\"': case '$': case '>':
- if (ip->ap < ip->argbuf + MAX_ARGSIZE)
- *ip->ap++ = c;
- return;
-
- case BS:
- /* you wouldn't believe such perversion is possible?
- it is.. BS is allowed in between cursor sequences
- (at least), according to vttest.. */
- if (--ip->curx < 0)
- ip->curx = 0;
- else
- SUBR_CURSOR(ip, MOVE_CURSOR);
- break;
-
- case 'p':
- *ip->ap = 0;
- if (! strncmp (ip->argbuf, "61\"", 3))
- ip->emul_level = EMUL_VT100;
- else if (! strncmp (ip->argbuf, "63;1\"", 5)
- || ! strncmp (ip->argbuf, "62;1\"", 5))
- ip->emul_level = EMUL_VT300_7;
- else
- ip->emul_level = EMUL_VT300_8;
- ip->escape = 0;
- return;
-
-
- case '?':
- *ip->ap = 0;
- ip->escape = '?';
- ip->ap = ip->argbuf;
- return;
-
-
- case 'c':
- *ip->ap = 0;
- if (ip->argbuf[0] == '>')
- {
- ite_sendstr ("\033[>24;0;0;0c");
- }
- else switch (ite_zargnum(ip))
- {
- case 0:
- /* primary DA request, send primary DA response */
- if (ip->emul_level == EMUL_VT100)
- ite_sendstr ("\033[?1;1c");
- else
- ite_sendstr ("\033[?63;1c");
- break;
- }
- ip->escape = 0;
- return;
-
- case 'n':
- switch (ite_zargnum(ip))
- {
- case 5:
- ite_sendstr ("\033[0n"); /* no malfunction */
- break;
- case 6:
- /* cursor position report */
- sprintf (ip->argbuf, "\033[%d;%dR",
- ip->cury + 1, ip->curx + 1);
- ite_sendstr (ip->argbuf);
- break;
- }
- ip->escape = 0;
- return;
-
-
- case 'x':
- switch (ite_zargnum(ip))
- {
- case 0:
- /* Fake some terminal parameters. */
- ite_sendstr ("\033[2;1;1;112;112;1;0x");
- break;
- case 1:
- ite_sendstr ("\033[3;1;1;112;112;1;0x");
- break;
- }
- ip->escape = 0;
- return;
-
-
- case 'g':
- switch (ite_zargnum(ip))
- {
- case 0:
- if (ip->curx < ip->cols)
- ip->tabs[ip->curx] = 0;
- break;
- case 3:
- for (n = 0; n < ip->cols; n++)
- ip->tabs[n] = 0;
- break;
- }
- ip->escape = 0;
- return;
-
-
- case 'h': case 'l':
- n = ite_zargnum (ip);
- switch (n)
- {
- case 4:
- ip->imode = (c == 'h'); /* insert/replace mode */
- break;
- case 20:
- ip->linefeed_newline = (c == 'h');
- break;
- }
- ip->escape = 0;
- return;
-
-
- case 'M':
- ite_dnline (ip, ite_argnum (ip));
- ip->escape = 0;
- return;
-
-
- case 'L':
- ite_inline (ip, ite_argnum (ip));
- ip->escape = 0;
- return;
-
-
- case 'P':
- ite_dnchar (ip, ite_argnum (ip));
- ip->escape = 0;
- return;
-
-
- case '@':
- ite_inchar (ip, ite_argnum (ip));
- ip->escape = 0;
- return;
-
-
- case 'G':
- /* this one was *not* in my vt320 manual but in
- a vt320 termcap entry.. who is right?
- It's supposed to set the horizontal cursor position. */
- *ip->ap = 0;
- x = atoi (ip->argbuf);
- if (x) x--;
- ip->curx = min(x, ip->cols - 1);
- ip->escape = 0;
- SUBR_CURSOR(ip, MOVE_CURSOR);
- clr_attr (ip, ATTR_INV);
- return;
-
-
- case 'd':
- /* same thing here, this one's for setting the absolute
- vertical cursor position. Not documented... */
- *ip->ap = 0;
- y = atoi (ip->argbuf);
- if (y) y--;
- if (ip->inside_margins)
- y += ip->top_margin;
- ip->cury = min(y, ip->rows - 1);
- ip->escape = 0;
- snap_cury(ip);
- SUBR_CURSOR(ip, MOVE_CURSOR);
- clr_attr (ip, ATTR_INV);
- return;
-
-
- case 'H':
- case 'f':
- *ip->ap = 0;
- y = atoi (ip->argbuf);
- x = 0;
- cp = index (ip->argbuf, ';');
- if (cp)
- x = atoi (cp + 1);
- if (x) x--;
- if (y) y--;
- if (ip->inside_margins)
- y += ip->top_margin;
- ip->cury = min(y, ip->rows - 1);
- ip->curx = min(x, ip->cols - 1);
- ip->escape = 0;
- snap_cury(ip);
- SUBR_CURSOR(ip, MOVE_CURSOR);
- clr_attr (ip, ATTR_INV);
- return;
-
- case 'A':
- n = ite_argnum (ip);
- n = ip->cury - (n ? n : 1);
- if (n < 0) n = 0;
- if (ip->inside_margins)
- n = max(ip->top_margin, n);
- else if (n == ip->top_margin - 1)
- /* allow scrolling outside region, but don't scroll out
- of active region without explicit CUP */
- n = ip->top_margin;
- ip->cury = n;
- ip->escape = 0;
- SUBR_CURSOR(ip, MOVE_CURSOR);
- clr_attr (ip, ATTR_INV);
- return;
-
- case 'B':
- n = ite_argnum (ip);
- n = ip->cury + (n ? n : 1);
- n = min(ip->rows - 1, n);
- if (ip->inside_margins)
- n = min(ip->bottom_margin, n);
- else if (n == ip->bottom_margin + 1)
- /* allow scrolling outside region, but don't scroll out
- of active region without explicit CUP */
- n = ip->bottom_margin;
- ip->cury = n;
- ip->escape = 0;
- SUBR_CURSOR(ip, MOVE_CURSOR);
- clr_attr (ip, ATTR_INV);
- return;
-
- case 'C':
- n = ite_argnum (ip);
- n = n ? n : 1;
- ip->curx = min(ip->curx + n, ip->cols - 1);
- ip->escape = 0;
- SUBR_CURSOR(ip, MOVE_CURSOR);
- clr_attr (ip, ATTR_INV);
- return;
-
- case 'D':
- n = ite_argnum (ip);
- n = n ? n : 1;
- n = ip->curx - n;
- ip->curx = n >= 0 ? n : 0;
- ip->escape = 0;
- SUBR_CURSOR(ip, MOVE_CURSOR);
- clr_attr (ip, ATTR_INV);
- return;
-
-
-
-
- case 'J':
- *ip->ap = 0;
- n = ite_zargnum (ip);
- if (n == 0)
- ite_clrtoeos(ip);
- else if (n == 1)
- ite_clrtobos(ip);
- else if (n == 2)
- ite_clrscreen(ip);
- ip->escape = 0;
- return;
-
-
- case 'K':
- n = ite_zargnum (ip);
- if (n == 0)
- ite_clrtoeol(ip);
- else if (n == 1)
- ite_clrtobol(ip);
- else if (n == 2)
- ite_clrline(ip);
- ip->escape = 0;
- return;
-
-
- case 'X':
- n = ite_argnum(ip) - 1;
- n = min(n, ip->cols - 1 - ip->curx);
- for (; n >= 0; n--)
- {
- attrclr(ip, ip->cury, ip->curx + n, 1, 1);
- SUBR_PUTC(ip, ' ', ip->cury, ip->curx + n, ATTR_NOR);
- }
- ip->escape = 0;
- return;
-
-
- case '}': case '`':
- /* status line control */
- ip->escape = 0;
- return;
-
-
- case 'r':
- *ip->ap = 0;
- x = atoi (ip->argbuf);
- x = x ? x : 1;
- y = ip->rows;
- cp = index (ip->argbuf, ';');
- if (cp)
- {
- y = atoi (cp + 1);
- y = y ? y : ip->rows;
- }
- if (y - x < 2)
- {
- /* if illegal scrolling region, reset to defaults */
- x = 1;
- y = ip->rows;
- }
- x--;
- y--;
- ip->top_margin = min(x, ip->rows - 1);
- ip->bottom_margin = min(y, ip->rows - 1);
- if (ip->inside_margins)
- {
- ip->cury = ip->top_margin;
- ip->curx = 0;
- SUBR_CURSOR(ip, MOVE_CURSOR);
- }
- ip->escape = 0;
- return;
-
-
- case 'm':
- /* big attribute setter/resetter */
- {
- char *cp;
- *ip->ap = 0;
- /* kludge to make CSIm work (== CSI0m) */
- if (ip->ap == ip->argbuf)
- ip->ap++;
- for (cp = ip->argbuf; cp < ip->ap; )
- {
- switch (*cp)
- {
- case 0:
- case '0':
- clr_attr (ip, ATTR_ALL);
- cp++;
- break;
-
- case '1':
- set_attr (ip, ATTR_BOLD);
- cp++;
- break;
-
- case '2':
- switch (cp[1])
- {
- case '2':
- clr_attr (ip, ATTR_BOLD);
- cp += 2;
- break;
-
- case '4':
- clr_attr (ip, ATTR_UL);
- cp += 2;
- break;
-
- case '5':
- clr_attr (ip, ATTR_BLINK);
- cp += 2;
- break;
-
- case '7':
- clr_attr (ip, ATTR_INV);
- cp += 2;
- break;
-
- default:
- cp++;
- break;
- }
- break;
-
- case '4':
- set_attr (ip, ATTR_UL);
- cp++;
- break;
-
- case '5':
- set_attr (ip, ATTR_BLINK);
- cp++;
- break;
-
- case '7':
- set_attr (ip, ATTR_INV);
- cp++;
- break;
-
- default:
- cp++;
- break;
- }
- }
-
- }
- ip->escape = 0;
- return;
-
-
- case 'u':
- /* DECRQTSR */
- ite_sendstr ("\033P\033\\");
- ip->escape = 0;
- return;
-
-
-
- default:
- ip->escape = 0;
- return;
- }
- break;
-
-
-
- case '?': /* CSI ? */
- switch (c)
- {
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- case ';': case '\"': case '$':
- /* Don't fill the last character; it's needed. */
- /* XXX yeah, where ?? */
- if (ip->ap < ip->argbuf + MAX_ARGSIZE - 1)
- *ip->ap++ = c;
- return;
-
-
- case 'n':
- *ip->ap = 0;
- if (ip->ap == &ip->argbuf[2])
- {
- if (! strncmp (ip->argbuf, "15", 2))
- /* printer status: no printer */
- ite_sendstr ("\033[13n");
-
- else if (! strncmp (ip->argbuf, "25", 2))
- /* udk status */
- ite_sendstr ("\033[20n");
-
- else if (! strncmp (ip->argbuf, "26", 2))
- /* keyboard dialect: US */
- ite_sendstr ("\033[27;1n");
- }
- ip->escape = 0;
- return;
-
-
- case 'h': case 'l':
- n = ite_zargnum (ip);
- switch (n)
- {
- case 1:
- ip->cursor_appmode = (c == 'h');
- break;
-
- case 3:
- /* 132/80 columns (132 == 'h') */
- break;
-
- case 4: /* smooth scroll */
- break;
-
- case 5:
- /* light background (=='h') /dark background(=='l') */
- break;
-
- case 6: /* origin mode */
- ip->inside_margins = (c == 'h');
- ip->curx = 0;
- ip->cury = ip->inside_margins ? ip->top_margin : 0;
- SUBR_CURSOR(ip, MOVE_CURSOR);
- break;
-
- case 7: /* auto wraparound */
- ip->auto_wrap = (c == 'h');
- break;
-
- case 8: /* keyboard repeat */
- ip->key_repeat = (c == 'h');
- break;
-
- case 20: /* newline mode */
- ip->linefeed_newline = (c == 'h');
- break;
-
- case 25: /* cursor on/off */
- SUBR_CURSOR(ip, (c == 'h') ? DRAW_CURSOR : ERASE_CURSOR);
- break;
- }
- ip->escape = 0;
- return;
-
- default:
- ip->escape = 0;
- return;
- }
- break;
-
-
- default:
- ip->escape = 0;
- return;
- }
- }
-
- switch (c) {
-
- case VT: /* VT is treated like LF */
- case FF: /* so is FF */
- case LF:
- /* cr->crlf distinction is done here, on output,
- not on input! */
- if (ip->linefeed_newline)
- ite_crlf (ip);
- else
- ite_lf (ip);
- break;
-
- case CR:
- ite_cr (ip);
- break;
-
- case BS:
- if (--ip->curx < 0)
- ip->curx = 0;
- else
- SUBR_CURSOR(ip, MOVE_CURSOR);
- break;
-
- case HT:
- for (n = ip->curx + 1; n < ip->cols; n++) {
- if (ip->tabs[n]) {
- ip->curx = n;
- SUBR_CURSOR(ip, MOVE_CURSOR);
- break;
- }
- }
- break;
-
- case BEL:
- if(kbd_tty && kbd_ite && kbd_ite->tp == kbd_tty)
- kbdbell();
- break;
-
- case SO:
- ip->GL = ip->G1;
- break;
-
- case SI:
- ip->GL = ip->G0;
- break;
-
- case ENQ:
- /* send answer-back message !! */
- break;
-
- case CAN:
- ip->escape = 0; /* cancel any escape sequence in progress */
- break;
-
- case SUB:
- ip->escape = 0; /* dito, but see below */
- /* should also display a reverse question mark!! */
- break;
-
- case ESC:
- ip->escape = ESC;
- break;
-
-
- /* now it gets weird.. 8bit control sequences.. */
- case IND: /* index: move cursor down, scroll */
- ite_lf (ip);
- break;
-
- case NEL: /* next line. next line, first pos. */
- ite_crlf (ip);
- break;
-
- case HTS: /* set horizontal tab */
- if (ip->curx < ip->cols)
- ip->tabs[ip->curx] = 1;
- break;
-
- case RI: /* reverse index */
- ite_rlf (ip);
- break;
-
- case SS2: /* go into G2 for one character */
- /* not yet supported */
- break;
-
- case SS3: /* go into G3 for one character */
- break;
-
- case DCS: /* device control string introducer */
- ip->escape = DCS;
- ip->ap = ip->argbuf;
- break;
-
- case CSI: /* control sequence introducer */
- ip->escape = CSI;
- ip->ap = ip->argbuf;
- break;
-
- case ST: /* string terminator */
- /* ignore, if not used as terminator */
- break;
-
- case OSC: /* introduces OS command. Ignore everything upto ST */
- ip->escape = OSC;
- break;
-
- case PM: /* privacy message, ignore everything upto ST */
- ip->escape = PM;
- break;
-
- case APC: /* application program command, ignore everything upto ST */
- ip->escape = APC;
- break;
-
- default:
- if (c < ' ' || c == DEL)
- break;
- if (ip->imode)
- ite_inchar(ip, 1);
- iteprecheckwrap(ip);
-#ifdef DO_WEIRD_ATTRIBUTES
- if ((ip->attribute & ATTR_INV) || attrtest(ip, ATTR_INV)) {
- attrset(ip, ATTR_INV);
- SUBR_PUTC(ip, c, ip->cury, ip->curx, ATTR_INV);
- }
- else
- SUBR_PUTC(ip, c, ip->cury, ip->curx, ATTR_NOR);
-#else
- SUBR_PUTC(ip, c, ip->cury, ip->curx, ip->attribute);
-#endif
- SUBR_CURSOR(ip, DRAW_CURSOR);
- itecheckwrap(ip);
- break;
- }
-}
-
-iteprecheckwrap(ip)
- struct ite_softc *ip;
-{
- if (ip->auto_wrap && ip->curx == ip->cols) {
- ip->curx = 0;
- clr_attr(ip, ATTR_INV);
- if (++ip->cury >= ip->bottom_margin + 1) {
- ip->cury = ip->bottom_margin;
- SUBR_CURSOR(ip, MOVE_CURSOR);
- SUBR_SCROLL(ip, ip->top_margin + 1, 0, 1, SCROLL_UP);
- ite_clrtoeol(ip);
- } else
- SUBR_CURSOR(ip, MOVE_CURSOR);
- }
-}
-
-itecheckwrap(ip)
- struct ite_softc *ip;
-{
- if (ip->curx < ip->cols) {
- ip->curx++;
- SUBR_CURSOR(ip, MOVE_CURSOR);
- }
-}
diff --git a/sys/arch/atari/dev/ite_cc.c b/sys/arch/atari/dev/ite_cc.c
deleted file mode 100644
index 676c499e061..00000000000
--- a/sys/arch/atari/dev/ite_cc.c
+++ /dev/null
@@ -1,671 +0,0 @@
-/* $NetBSD: ite_cc.c,v 1.4 1995/05/28 19:45:39 leo Exp $ */
-
-/*
- * Copyright (c) 1994 Christian E. Hopps
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christian E. Hopps.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "grf.h"
-#if NGRF > 0
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/proc.h>
-#include <sys/device.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/systm.h>
-#include <sys/queue.h>
-#include <sys/termios.h>
-#include <sys/malloc.h>
-#include <dev/cons.h>
-#include <machine/cpu.h>
-#include <atari/dev/itevar.h>
-#include <atari/dev/iteioctl.h>
-#include <atari/dev/grfioctl.h>
-#include <atari/dev/grfabs_reg.h>
-#include <atari/dev/grfvar.h>
-#include <atari/dev/font.h>
-#include <atari/dev/viewioctl.h>
-#include <atari/dev/viewvar.h>
-
-/*
- * This is what ip->priv points to;
- * it contains local variables for custom-chip ites.
- */
-struct ite_priv {
- u_char **row_ptr; /* array of pointers into the bitmap */
- u_long row_bytes;
- u_long cursor_opt;
- u_short *column_offset; /* array of offsets for columns */
- u_int row_offset; /* the row offset */
- u_short width; /* the bitmap width */
- u_short underline; /* where the underline goes */
- u_short ft_x; /* the font width */
- u_short ft_y; /* the font height */
- u_char *font_cell[256];/* the font pointer */
-};
-typedef struct ite_priv ipriv_t;
-
-/*
- * We need the following space to get an ite-console setup before
- * the VM-system is brought up. We setup for a 1280x960 monitor with
- * an 8x8 font.
- */
-extern int atari_realconfig;
-
-#define CONS_MAXROW 120 /* Max. number of rows on console */
-#define CONS_MAXCOL 160 /* Max. number of columns on console */
-static u_short con_columns[CONS_MAXCOL];
-static u_char *con_rows[CONS_MAXROW];
-static ipriv_t con_ipriv;
-
-extern font_info font_info_8x8;
-extern font_info font_info_8x16;
-
-static void view_init __P((struct ite_softc *));
-static void view_deinit __P((struct ite_softc *));
-static int ite_newsize __P((struct ite_softc *, struct itewinsize *));
-static void cursor32 __P((struct ite_softc *, int));
-static void putc8 __P((struct ite_softc *, int, int, int, int));
-static void clear8 __P((struct ite_softc *, int, int, int, int));
-static void scroll8 __P((struct ite_softc *, int, int, int, int));
-static void scrollbmap __P((bmap_t *, u_short, u_short, u_short, u_short,
- short, short));
-
-/*
- * Patchable
- */
-int ite_default_x = 0; /* def leftedge offset */
-int ite_default_y = 0; /* def topedge offset */
-int ite_default_width = 640; /* def width */
-int ite_default_depth = 1; /* def depth */
-int ite_default_height = 400; /* def height */
-
-/*
- * called from grf_cc to return console priority
- */
-int
-grfcc_cnprobe()
-{
- return(CN_INTERNAL);
-}
-/*
- * called from grf_cc to init ite portion of
- * grf_softc struct
- */
-void
-grfcc_iteinit(gp)
-struct grf_softc *gp;
-{
-
- gp->g_itecursor = cursor32;
- gp->g_iteputc = putc8;
- gp->g_iteclear = clear8;
- gp->g_itescroll = scroll8;
- gp->g_iteinit = view_init;
- gp->g_itedeinit = view_deinit;
-}
-
-static void
-view_deinit(ip)
-struct ite_softc *ip;
-{
- ip->flags &= ~ITE_INITED;
-}
-
-static void
-view_init(ip)
-register struct ite_softc *ip;
-{
- struct itewinsize wsz;
- ipriv_t *cci;
-
- if(cci = ip->priv)
- return;
-
-#if defined(KFONT_8X8)
- ip->font = font_info_8x8;
-#else
- ip->font = font_info_8x16;
-#endif
-
- /* Find the correct set of rendering routines for this font. */
- if(ip->font.width != 8)
- panic("kernel font size not supported");
-
- if(!atari_realconfig)
- ip->priv = cci = &con_ipriv;
- else ip->priv = cci = (ipriv_t*)malloc(sizeof(*cci), M_DEVBUF,M_WAITOK);
- if(cci == NULL)
- panic("No memory for ite-view");
- bzero(cci, sizeof(*cci));
-
- cci->cursor_opt = 0;
- cci->row_ptr = NULL;
- cci->column_offset = NULL;
-
- wsz.x = ite_default_x;
- wsz.y = ite_default_y;
- wsz.width = ite_default_width;
- wsz.height = ite_default_height;
- wsz.depth = ite_default_depth;
-
- ite_newsize (ip, &wsz);
-
- /*
- * Only console will be turned on by default..
- */
- if(ip->flags & ITE_ISCONS)
- ip->grf->g_mode(ip->grf, GM_GRFON, NULL, 0, 0);
-}
-
-static int
-ite_newsize(ip, winsz)
-struct ite_softc *ip;
-struct itewinsize *winsz;
-{
- struct view_size vs;
- ipriv_t *cci = ip->priv;
- u_long fbp, i, j;
- int error = 0;
- view_t *view;
-
- vs.x = winsz->x;
- vs.y = winsz->y;
- vs.width = winsz->width;
- vs.height = winsz->height;
- vs.depth = winsz->depth;
-
- error = viewioctl(ip->grf->g_viewdev, VIOCSSIZE, &vs, 0, -1);
- view = viewview(ip->grf->g_viewdev);
-
- /*
- * Reinitialize our structs
- */
- ip->cols = view->display.width / ip->font.width;
- ip->rows = view->display.height / ip->font.height;
-
- /*
- * save new values so that future opens use them
- * this may not be correct when we implement Virtual Consoles
- */
- ite_default_height = view->display.height;
- ite_default_width = view->display.width;
- ite_default_x = view->display.x;
- ite_default_y = view->display.y;
- ite_default_depth = view->bitmap->depth;
-
- if(cci->row_ptr && (cci->row_ptr != con_rows)) {
- free(cci->row_ptr, M_DEVBUF);
- cci->row_ptr = NULL;
- }
- if(cci->column_offset && (cci->column_offset != con_columns)) {
- free(cci->column_offset, M_DEVBUF);
- cci->column_offset = NULL;
- }
-
- if(!atari_realconfig) {
- cci->row_ptr = con_rows;
- cci->column_offset = con_columns;
- }
- else {
- cci->row_ptr = malloc(sizeof(u_char *) * ip->rows,M_DEVBUF,M_NOWAIT);
- cci->column_offset = malloc(sizeof(u_int)*ip->cols,M_DEVBUF,M_NOWAIT);
- }
-
- if(!cci->row_ptr || !cci->column_offset)
- panic("No memory for ite-view");
-
- cci->width = view->bitmap->bytes_per_row << 3;
- cci->underline = ip->font.baseline + 1;
- cci->row_offset = view->bitmap->bytes_per_row;
- cci->ft_x = ip->font.width;
- cci->ft_y = ip->font.height;
- cci->row_bytes = cci->row_offset * cci->ft_y;
- cci->row_ptr[0] = view->bitmap->plane;
- for(i = 1; i < ip->rows; i++)
- cci->row_ptr[i] = cci->row_ptr[i-1] + cci->row_bytes;
-
- /*
- * Initialize the column offsets to point at the correct location
- * in the first plane. This definitely assumes a font width of 8!
- */
- j = view->bitmap->depth * 2;
- cci->column_offset[0] = 0;
- for(i = 1; i < ip->cols; i++)
- cci->column_offset[i] = ((i >> 1) * j) + (i & 1);
-
- /* initialize the font cell pointers */
- cci->font_cell[ip->font.font_lo] = ip->font.font_p;
- for(i = ip->font.font_lo+1; i <= ip->font.font_hi; i++)
- cci->font_cell[i] = cci->font_cell[i-1] + ip->font.height;
-
- return(error);
-}
-
-int
-ite_grf_ioctl(ip, cmd, addr, flag, p)
-struct ite_softc *ip;
-u_long cmd;
-caddr_t addr;
-int flag;
-struct proc *p;
-{
- struct winsize ws;
- struct itewinsize *is;
- struct itebell *ib;
- int error = 0;
- ipriv_t *cci = ip->priv;
- view_t *view = viewview(ip->grf->g_viewdev);
-
- switch (cmd) {
- case ITEIOCGWINSZ:
- is = (struct itewinsize *)addr;
- is->x = view->display.x;
- is->y = view->display.y;
- is->width = view->display.width;
- is->height = view->display.height;
- is->depth = view->bitmap->depth;
- break;
- case ITEIOCSWINSZ:
- is = (struct itewinsize *)addr;
-
- if(ite_newsize(ip, is))
- error = ENOMEM;
- else {
- view = viewview(ip->grf->g_viewdev);
- ws.ws_row = ip->rows;
- ws.ws_col = ip->cols;
- ws.ws_xpixel = view->display.width;
- ws.ws_ypixel = view->display.height;
- ite_reset(ip);
- /*
- * XXX tell tty about the change
- * XXX this is messy, but works
- */
- iteioctl(ip->grf->g_itedev,TIOCSWINSZ,(caddr_t)&ws,0,p);
- }
- break;
- case ITEIOCDSPWIN:
- ip->grf->g_mode(ip->grf, GM_GRFON, NULL, 0, 0);
- break;
- case ITEIOCREMWIN:
- ip->grf->g_mode(ip->grf, GM_GRFOFF, NULL, 0, 0);
- break;
- case ITEIOCGBELL:
-#if 0 /* LWP */
- /* XXX This won't work now */
- /* XXX Should the bell be device dependent? */
- ib = (struct itebell *)addr;
- ib->volume = bvolume;
- ib->pitch = bpitch;
- ib->msec = bmsec;
-#endif
- break;
- case ITEIOCSBELL:
-#if 0 /* LWP */
- /* XXX See above */
- ib = (struct itebell *)addr;
- /* bounds check */
- if(ib->pitch > MAXBPITCH || ib->pitch < MINBPITCH ||
- ib->volume > MAXBVOLUME || ib->msec > MAXBTIME)
- error = EINVAL;
- else {
- bvolume = ib->volume;
- bpitch = ib->pitch;
- bmsec = ib->msec;
- }
-#endif
- break;
- case VIOCSCMAP:
- case VIOCGCMAP:
- /*
- * XXX watchout for that -1 its not really the kernel talking
- * XXX these two commands don't use the proc pointer though
- */
- error = viewioctl(ip->grf->g_viewdev, cmd, addr, flag, -1);
- break;
- default:
- error = -1;
- break;
- }
- return (error);
-}
-
-static void
-cursor32(struct ite_softc *ip, int flag)
-{
- int cend;
- u_char *pl;
- ipriv_t *cci;
-
- cci = ip->priv;
-
- if(flag == END_CURSOROPT)
- cci->cursor_opt--;
- else if(flag == START_CURSOROPT) {
- if(!cci->cursor_opt)
- cursor32(ip, ERASE_CURSOR);
- cci->cursor_opt++;
- return; /* if we are already opted. */
- }
-
- if(cci->cursor_opt)
- return; /* if we are still nested. */
- /* else we draw the cursor. */
-
- if(flag != DRAW_CURSOR && flag != END_CURSOROPT) {
- /*
- * erase the cursor
- */
- cend = ip->font.height-1;
- pl = cci->column_offset[ip->cursorx]
- + cci->row_ptr[ip->cursory];
- __asm__ __volatile__
- ("1: notb %0@ ; addaw %4,%0\n\t"
- "dbra %1,1b"
- : "=a" (pl), "=d" (cend)
- : "0" (pl), "1" (cend),
- "d" (cci->row_offset)
- );
- }
-
- if(flag != DRAW_CURSOR && flag != MOVE_CURSOR && flag != END_CURSOROPT)
- return;
-
- /*
- * draw the cursor
- */
- ip->cursorx = min(ip->curx, ip->cols-1);
- ip->cursory = ip->cury;
- cend = ip->font.height-1;
- pl = cci->column_offset[ip->cursorx]
- + cci->row_ptr[ip->cursory];
-
- __asm__ __volatile__
- ("1: notb %0@ ; addaw %4,%0\n\t"
- "dbra %1,1b"
- : "=a" (pl), "=d" (cend)
- : "0" (pl), "1" (cend),
- "d" (cci->row_offset)
- );
-}
-
-static void
-putc8(struct ite_softc *ip, int c, int dy, int dx, int mode)
-{
- register ipriv_t *cci = (ipriv_t *)ip->priv;
- register u_char *pl = cci->column_offset[dx] + cci->row_ptr[dy];
- register u_int fh = cci->ft_y;
- register u_int ro = cci->row_offset;
- register u_char eor_mask;
- register u_char bl, tmp, ul;
- register u_char *ft;
-
- if(c < ip->font.font_lo || c > ip->font.font_hi)
- return;
-
- ft = cci->font_cell[c];
-
- if(!mode) {
- while(fh--) {
- *pl = *ft++; pl += ro;
- }
- return;
- }
-
- eor_mask = (mode & ATTR_INV) ? 0xff : 0x00;
- bl = (mode & ATTR_BOLD) ? 1 : 0;
- ul = (mode & ATTR_UL) ? fh - cci->underline : fh;
- for(; fh--; pl += ro) {
- if(fh != ul) {
- tmp = *ft++;
- if(bl)
- tmp |= (tmp >> 1);
- *pl = tmp ^ eor_mask;
- }
- else {
- *pl = 0xff ^ eor_mask;
- ft++;
- }
- }
-}
-
-static void
-clear8(struct ite_softc *ip, int sy, int sx, int h, int w)
-{
- ipriv_t *cci = (ipriv_t *) ip->priv;
- view_t *v = viewview(ip->grf->g_viewdev);
- bmap_t *bm = v->bitmap;
-
- if((sx == 0) && (w == ip->cols)) {
- /* common case: clearing whole lines */
- while (h--) {
- int i;
- u_char *ptr = cci->row_ptr[sy];
- for(i = 0; i < ip->font.height; i++) {
- bzero(ptr, bm->bytes_per_row);
- ptr += bm->bytes_per_row;
- }
- sy++;
- }
- }
- else {
- /*
- * clearing only part of a line
- * XXX could be optimized MUCH better, but is it worth the
- * trouble?
- */
-
- int i;
- u_char *pls, *ple;
-
- pls = cci->row_ptr[sy];
- ple = pls + cci->column_offset[sx + w-1];
- pls = pls + cci->column_offset[sx];
-
- for(i = ((ip->font.height) * h)-1; i >= 0; i--) {
- u_char *p = pls;
- while(p <= ple)
- *p++ = 0;
- pls += bm->bytes_per_row;
- ple += bm->bytes_per_row;
- }
- }
-}
-
-/* Note: sx is only relevant for SCROLL_LEFT or SCROLL_RIGHT. */
-static void
-scroll8(ip, sy, sx, count, dir)
-register struct ite_softc *ip;
-register int sy;
-int dir, sx, count;
-{
- bmap_t *bm = viewview(ip->grf->g_viewdev)->bitmap;
- u_char *pl = ((ipriv_t *)ip->priv)->row_ptr[sy];
-
- if(dir == SCROLL_UP) {
- int dy = sy - count;
- int height = ip->bottom_margin - sy + 1;
- int i;
-
- cursor32(ip, ERASE_CURSOR);
- scrollbmap(bm, 0, dy*ip->font.height, bm->bytes_per_row >> 3,
- (ip->bottom_margin-dy+1)*ip->font.height,
- 0, -(count*ip->font.height));
- }
- else if(dir == SCROLL_DOWN) {
- int dy = sy + count;
- int height = ip->bottom_margin - dy + 1;
- int i;
-
- cursor32(ip, ERASE_CURSOR);
- scrollbmap(bm, 0, sy*ip->font.height, bm->bytes_per_row >> 3,
- (ip->bottom_margin-sy+1)*ip->font.height,
- 0, count*ip->font.height);
- }
- else if(dir == SCROLL_RIGHT) {
- int sofs = (ip->cols - count) * ip->font.width;
- int dofs = (ip->cols) * ip->font.width;
- int i, j;
-
- cursor32(ip, ERASE_CURSOR);
- for(j = ip->font.height-1; j >= 0; j--) {
- int sofs2 = sofs, dofs2 = dofs;
- for (i = (ip->cols - (sx + count))-1; i >= 0; i--) {
- int t;
- sofs2 -= ip->font.width;
- dofs2 -= ip->font.width;
- asm("bfextu %1@{%2:%3},%0" : "=d" (t)
- : "a" (pl), "d" (sofs2), "d" (ip->font.width));
- asm("bfins %3,%0@{%1:%2}" :
- : "a" (pl), "d" (dofs2), "d" (ip->font.width),
- "d" (t));
- }
- pl += bm->bytes_per_row;
- }
- }
- else { /* SCROLL_LEFT */
- int sofs = (sx) * ip->font.width;
- int dofs = (sx - count) * ip->font.width;
- int i, j;
-
- cursor32(ip, ERASE_CURSOR);
- for(j = ip->font.height-1; j >= 0; j--) {
- int sofs2 = sofs, dofs2 = dofs;
- for(i = (ip->cols - sx)-1; i >= 0; i--) {
- int t;
-
- asm("bfextu %1@{%2:%3},%0" : "=d" (t)
- : "a" (pl), "d" (sofs2), "d" (ip->font.width));
- asm("bfins %3,%0@{%1:%2}"
- : : "a" (pl), "d" (dofs2),"d" (ip->font.width),
- "d" (t));
- sofs2 += ip->font.width;
- dofs2 += ip->font.width;
- }
- pl += bm->bytes_per_row;
- }
- }
-}
-
-static void
-scrollbmap (bmap_t *bm, u_short x, u_short y, u_short width, u_short height, short dx, short dy)
-{
- u_short depth = bm->depth;
- u_short lwpr = bm->bytes_per_row >> 2;
-
- if(dx) {
- /* FIX: */ panic ("delta x not supported in scroll bitmap yet.");
- }
-
- if(dy == 0) {
- return;
- }
- if(dy > 0) {
- u_long *pl = (u_long *)bm->plane;
- u_long *src_y = pl + (lwpr*y);
- u_long *dest_y = pl + (lwpr*(y+dy));
- u_long count = lwpr*(height-dy);
- u_long *clr_y = src_y;
- u_long clr_count = dest_y - src_y;
- u_long bc, cbc;
-
- src_y += count - 1;
- dest_y += count - 1;
-
- bc = count >> 4;
- count &= 0xf;
-
- while (bc--) {
- *dest_y-- = *src_y--; *dest_y-- = *src_y--;
- *dest_y-- = *src_y--; *dest_y-- = *src_y--;
- *dest_y-- = *src_y--; *dest_y-- = *src_y--;
- *dest_y-- = *src_y--; *dest_y-- = *src_y--;
- *dest_y-- = *src_y--; *dest_y-- = *src_y--;
- *dest_y-- = *src_y--; *dest_y-- = *src_y--;
- *dest_y-- = *src_y--; *dest_y-- = *src_y--;
- *dest_y-- = *src_y--; *dest_y-- = *src_y--;
- }
- while (count--)
- *dest_y-- = *src_y--;
-
- cbc = clr_count >> 4;
- clr_count &= 0xf;
-
- while (cbc--) {
- *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0;
- *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0;
- *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0;
- *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0;
- }
- while(clr_count--)
- *clr_y++ = 0;
- }
- else {
- u_long *pl = (u_long *)bm->plane;
- u_long *src_y = pl + (lwpr*(y-dy));
- u_long *dest_y = pl + (lwpr*y);
- long count = lwpr*(height + dy);
- u_long *clr_y = dest_y + count;
- u_long clr_count = src_y - dest_y;
- u_long bc, cbc;
-
- bc = count >> 4;
- count &= 0xf;
-
- while(bc--) {
- *dest_y++ = *src_y++; *dest_y++ = *src_y++;
- *dest_y++ = *src_y++; *dest_y++ = *src_y++;
- *dest_y++ = *src_y++; *dest_y++ = *src_y++;
- *dest_y++ = *src_y++; *dest_y++ = *src_y++;
- *dest_y++ = *src_y++; *dest_y++ = *src_y++;
- *dest_y++ = *src_y++; *dest_y++ = *src_y++;
- *dest_y++ = *src_y++; *dest_y++ = *src_y++;
- *dest_y++ = *src_y++; *dest_y++ = *src_y++;
- }
- while(count--)
- *dest_y++ = *src_y++;
-
- cbc = clr_count >> 4;
- clr_count &= 0xf;
-
- while (cbc--) {
- *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0;
- *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0;
- *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0;
- *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0; *clr_y++ = 0;
- }
- while (clr_count--)
- *clr_y++ = 0;
- }
-}
-#else
-#error Must be defined
-#endif /* NGRF */
diff --git a/sys/arch/atari/dev/iteioctl.h b/sys/arch/atari/dev/iteioctl.h
deleted file mode 100644
index b1555bfd772..00000000000
--- a/sys/arch/atari/dev/iteioctl.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* $NetBSD: iteioctl.h,v 1.2 1995/07/24 05:56:12 leo Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: iteioctl.h 1.1 90/07/09$
- *
- * @(#)iteioctl.h 7.2 (Berkeley) 11/4/90
- */
-
-struct itewinsize {
- int x; /* leftedge offset to the right */
- int y; /* topedge offset down */
- u_int width; /* width of ite display */
- u_int height; /* height of ite display */
- u_int depth; /* depth of ite display */
-};
-
-struct itebell {
- u_int volume; /* volume of bell (0-64) */
- u_int pitch; /* pitch of bell (10-2000) */
- u_int msec; /* duration of bell */
-};
-#define MAXBVOLUME (63)
-#define MAXBPITCH (2000)
-#define MINBPITCH (10)
-#define MAXBTIME (5000) /* 5 seconds */
-
-struct iterepeat {
- int start; /* number of 100/s before repeat start */
- int next; /* number of 100/s before next repeat */
-};
-#define ITEMINREPEAT 5 /* mininum number of 100/s for key repeat */
-
-#define ITEIOCSKMAP _IOW('Z',0x70, struct kbdmap)
-#define ITEIOCSSKMAP _IOW('Z',0x68, struct kbdmap)
-#define ITEIOCGKMAP _IOR('Z',0x71, struct kbdmap)
-#define ITEIOCGWINSZ _IOR('Z',0x72, struct itewinsize)
-#define ITEIOCSWINSZ _IOW('Z',0x73, struct itewinsize)
-#define ITEIOCDSPWIN _IO('Z', 0x74)
-#define ITEIOCREMWIN _IO('Z', 0x75)
-#define ITEIOCGBELL _IOR('Z', 0x76, struct itebell)
-#define ITEIOCSBELL _IOW('Z', 0x77, struct itebell)
-#define ITEIOCGREPT _IOR('Z', 0x78, struct iterepeat)
-#define ITEIOCSREPT _IOW('Z', 0x79, struct iterepeat)
-
-
-#define ITESWITCH _IOW('Z',0x69, int) /* XXX */
-
diff --git a/sys/arch/atari/dev/itevar.h b/sys/arch/atari/dev/itevar.h
deleted file mode 100644
index 1607302db84..00000000000
--- a/sys/arch/atari/dev/itevar.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/* $NetBSD: itevar.h,v 1.2 1995/07/25 13:49:26 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman (Atari modifications)
- * Copyright (c) 1994 Christian E. Hopps
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christian E. Hopps.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _ITEVAR_H
-#define _ITEVAR_H
-
-#include <atari/dev/font.h>
-
-enum ite_arraymaxs {
- MAX_ARGSIZE = 256,
- MAX_TABS = 256,
-};
-
-enum ite_attr {
- ATTR_NOR = 0,
- ATTR_INV = 1,
- ATTR_UL = 2,
- ATTR_BOLD = 4,
- ATTR_BLINK = 8,
- ATTR_ALL = 16-1,
-
- ATTR_KEYPAD = 0x80 /* XXX */
-};
-
-struct ite_softc {
- struct device device; /* _Must_ be first */
- char argbuf[MAX_ARGSIZE];
- struct grf_softc *grf; /* XXX */
- char *ap;
- struct tty *tp;
- void *priv;
- font_info font;
- u_char *tabs;
- struct kbdmap *kbdmap;
- int flags;
- short cursorx;
- short cursory;
- short rows;
- short cols;
- u_char *cursor;
- char imode;
- u_char escape;
- u_char cursor_opt;
- u_char key_repeat;
- char GL;
- char GR;
- char G0;
- char G1;
- char G2;
- char G3;
- char linefeed_newline;
- char auto_wrap;
- char cursor_appmode;
- char keypad_appmode;
- short top_margin;
- short bottom_margin;
- short inside_margins;
- short eightbit_C1;
- short emul_level;
- enum ite_attr attribute;
- enum ite_attr save_attribute;
- int curx;
- int save_curx;
- int cury;
- int save_cury;
-};
-
-enum ite_flags {
- ITE_ALIVE = 0x1, /* grf layer is configed */
- ITE_ISCONS = 0x2, /* ite is acting console. */
- ITE_INITED = 0x4, /* ite has been inited. */
- ITE_ISOPEN = 0x8, /* ite has been opened */
- ITE_INGRF = 0x10, /* ite is in graphics mode */
- ITE_ACTIVE = 0x20, /* ite is an active terminal */
-};
-
-enum ite_replrules {
- RR_CLEAR = 0,
- RR_COPY = 0x3,
- RR_XOR = 0x6,
- RR_COYINVERTED = 0xC
-};
-
-enum ite_scrolldir {
- SCROLL_UP = 1,
- SCROLL_DOWN,
- SCROLL_LEFT,
- SCROLL_RIGHT,
-};
-
-enum ite_cursact {
- DRAW_CURSOR = 5,
- ERASE_CURSOR,
- MOVE_CURSOR,
- START_CURSOROPT,
- END_CURSOROPT
-};
-
-enum ite_special_keycodes {
- KBD_LEFT_SHIFT = 0x2a,
- KBD_RIGHT_SHIFT = 0x36,
- KBD_CAPS_LOCK = 0x3a,
- KBD_CTRL = 0x1d,
- KBD_ALT = 0x38
-};
-
-enum ite_modifiers {
- KBD_MOD_LSHIFT = 0x01,
- KBD_MOD_RSHIFT = 0x02,
- KBD_MOD_CTRL = 0x04,
- KBD_MOD_ALT = 0x08,
- KBD_MOD_CAPS = 0x10,
- KBD_MOD_SHIFT = (KBD_MOD_LSHIFT | KBD_MOD_RSHIFT)
-};
-
-enum caller {
- ITEFILT_TTY,
- ITEFILT_CONSOLE,
- ITEFILT_REPEATER
-};
-
-enum emul_level {
- EMUL_VT100 = 1,
- EMUL_VT300_8,
- EMUL_VT300_7
-};
-
-enum ite_max_getsize { ITEBURST = 64 };
-
-enum tab_size { TABSIZE = 8 };
-#define TABEND(u) (ite_tty[u]->t_windsize.ws_col - TABSIZE) /* XXX */
-
-#define set_attr(ip, attr) ((ip)->attribute |= (attr))
-#define clr_attr(ip, attr) ((ip)->attribute &= ~(attr))
-#define attrloc(ip, y, x) 0
-#define attrclr(ip, sy, sx, h, w)
-#define attrmov(ip, sy, sx, dy, dx, h, w)
-#define attrtest(ip, attr) 0
-#define attrset(ip, attr)
-
-struct proc;
-struct consdev;
-struct termios;
-
-/* console related function */
-void ite_cnprobe __P((struct consdev *));
-void ite_cninit __P((struct consdev *));
-int ite_cngetc __P((dev_t));
-void ite_cnputc __P((dev_t, int));
-void ite_cnfinish __P((struct ite_softc *));
-
-/* standard ite device entry points. */
-void iteinit __P((dev_t));
-int iteopen __P((dev_t, int, int, struct proc *));
-int iteclose __P((dev_t, int, int, struct proc *));
-int iteread __P((dev_t, struct uio *, int));
-int itewrite __P((dev_t, struct uio *, int));
-int iteioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
-void itestart __P((struct tty *));
-
-/* ite functions */
-int ite_on __P((dev_t, int));
-int ite_off __P((dev_t, int));
-void ite_reinit __P((dev_t));
-int ite_param __P((struct tty *, struct termios *));
-void ite_reset __P((struct ite_softc *));
-int ite_cnfilter __P((u_int, enum caller));
-void ite_filter __P((u_int ,enum caller));
-
-#endif /* _ITEVAR_H */
diff --git a/sys/arch/atari/dev/kbd.c b/sys/arch/atari/dev/kbd.c
deleted file mode 100644
index 32a80018a25..00000000000
--- a/sys/arch/atari/dev/kbd.c
+++ /dev/null
@@ -1,563 +0,0 @@
-/* $NetBSD: kbd.c,v 1.5 1995/06/26 14:31:27 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman
- * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/proc.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <dev/cons.h>
-#include <machine/cpu.h>
-#include <machine/iomap.h>
-#include <machine/mfp.h>
-#include <machine/acia.h>
-#include <machine/video.h>
-#include <atari/dev/itevar.h>
-#include <atari/dev/kbdreg.h>
-#include <atari/dev/event_var.h>
-#include <atari/dev/vuid_event.h>
-
-#include "mouse.h"
-
-/*
- * The ringbuffer is the interface between the hard and soft interrupt handler.
- * The hard interrupt runs straight from the MFP interrupt.
- */
-#define KBD_RING_SIZE 256 /* Sz of input ring buffer, must be power of 2 */
-#define KBD_RING_MASK 255 /* Modulo mask for above */
-
-static u_char kbd_ring[KBD_RING_SIZE];
-static volatile u_int kbd_rbput = 0; /* 'put' index */
-static u_int kbd_rbget = 0; /* 'get' index */
-static u_char kbd_soft = 0; /* 1: Softint has been scheduled*/
-
-struct kbd_softc {
- int k_event_mode; /* if 1, collect events, */
- /* else pass to ite */
- struct evvar k_events; /* event queue state */
- u_char k_soft_cs; /* control-reg. copy */
- u_char k_package[20]; /* XXX package being build */
- u_char k_pkg_size; /* Size of the package */
- u_char k_pkg_idx;
- u_char *k_sendp; /* Output pointer */
- int k_send_cnt; /* Chars left for output */
-};
-
-static struct kbd_softc kbd_softc;
-
-void kbd_write __P((u_char *, int));
-
-static void kbdsoft __P((void));
-static void kbdattach __P((struct device *, struct device *, void *));
-static int kbdmatch __P((struct device *, struct cfdata *, void *));
-static int kbd_write_poll __P((u_char *, int));
-static void kbd_pkg_start __P((struct kbd_softc *, u_char));
-
-struct cfdriver kbdcd = {
- NULL, "kbd", (cfmatch_t)kbdmatch, kbdattach,
- DV_DULL, sizeof(struct device), NULL, 0 };
-
-
-/*ARGSUSED*/
-static int
-kbdmatch(pdp, cfp, auxp)
-struct device *pdp;
-struct cfdata *cfp;
-void *auxp;
-{
- if (!strcmp((char *)auxp, "kbd"))
- return (1);
- return (0);
-}
-
-/*ARGSUSED*/
-static void
-kbdattach(pdp, dp, auxp)
-struct device *pdp, *dp;
-void *auxp;
-{
- int timeout;
- u_char kbd_rst[] = { 0x80, 0x01 };
- u_char kbd_icmd[] = { 0x12, 0x15 };
-
- /*
- * Disable keyboard interrupts from MFP
- */
- MFP->mf_ierb &= ~IB_AINT;
-
- /*
- * Reset ACIA and intialize to:
- * divide by 16, 8 data, 1 stop, no parity, enable RX interrupts
- */
- KBD->ac_cs = A_RESET;
- delay(100); /* XXX: enough? */
- KBD->ac_cs = kbd_softc.k_soft_cs = KBD_INIT | A_RXINT;
-
- /*
- * Clear error conditions
- */
- while (KBD->ac_cs & (A_IRQ|A_RXRDY))
- timeout = KBD->ac_da;
-
- /*
- * Now send the reset string, and read+ignore it's response
- */
- if (!kbd_write_poll(kbd_rst, 2))
- printf("kbd: error cannot reset keyboard\n");
- for (timeout = 1000; timeout > 0; timeout--) {
- if (KBD->ac_cs & (A_IRQ|A_RXRDY)) {
- timeout = KBD->ac_da;
- timeout = 100;
- }
- delay(100);
- }
- /*
- * Send init command: disable mice & joysticks
- */
- kbd_write_poll(kbd_icmd, sizeof(kbd_icmd));
-
- printf("\n");
-}
-
-/* definitions for atari keyboard encoding. */
-#define KEY_CODE(c) ((u_char)(c) & 0x7f)
-#define KEY_UP(c) ((u_char)(c) & 0x80)
-#define IS_KEY(c) ((u_char)(c) < 0xf6)
-
-void
-kbdenable()
-{
- int s, code;
-
- s = spltty();
-
- /*
- * Clear error conditions...
- */
- while (KBD->ac_cs & (A_IRQ|A_RXRDY))
- code = KBD->ac_da;
- /*
- * Enable interrupts from MFP
- */
- MFP->mf_iprb &= ~IB_AINT;
- MFP->mf_ierb |= IB_AINT;
- MFP->mf_imrb |= IB_AINT;
-
- kbd_softc.k_event_mode = 0;
- kbd_softc.k_events.ev_io = 0;
- kbd_softc.k_pkg_size = 0;
- splx(s);
-}
-
-int kbdopen(dev_t dev, int flags, int mode, struct proc *p)
-{
- int s, error;
-
- if (kbd_softc.k_events.ev_io)
- return EBUSY;
-
- kbd_softc.k_events.ev_io = p;
- ev_init(&kbd_softc.k_events);
- return (0);
-}
-
-int
-kbdclose(dev_t dev, int flags, int mode, struct proc *p)
-{
- /* Turn off event mode, dump the queue */
- kbd_softc.k_event_mode = 0;
- ev_fini(&kbd_softc.k_events);
- kbd_softc.k_events.ev_io = NULL;
- return (0);
-}
-
-int
-kbdread(dev_t dev, struct uio *uio, int flags)
-{
- return ev_read(&kbd_softc.k_events, uio, flags);
-}
-
-int
-kbdioctl(dev_t dev,u_long cmd,register caddr_t data,int flag,struct proc *p)
-{
- register struct kbd_softc *k = &kbd_softc;
-
- switch (cmd) {
- case KIOCTRANS:
- if (*(int *)data == TR_UNTRANS_EVENT)
- return 0;
- break;
-
- case KIOCGTRANS:
- /*
- * Get translation mode
- */
- *(int *)data = TR_UNTRANS_EVENT;
- return 0;
-
- case KIOCSDIRECT:
- k->k_event_mode = *(int *)data;
- return 0;
-
- case FIONBIO: /* we will remove this someday (soon???) */
- return 0;
-
- case FIOASYNC:
- k->k_events.ev_async = *(int *)data != 0;
- return 0;
-
- case TIOCSPGRP:
- if (*(int *)data != k->k_events.ev_io->p_pgid)
- return EPERM;
- return 0;
-
- default:
- return ENOTTY;
- }
-
- /*
- * We identified the ioctl, but we do not handle it.
- */
- return EOPNOTSUPP; /* misuse, but what the heck */
-}
-
-int
-kbdselect (dev_t dev, int rw, struct proc *p)
-{
- return ev_select (&kbd_softc.k_events, rw, p);
-}
-
-/*
- * Keyboard interrupt handler called straight from MFP at spl6.
- */
-int
-kbdintr(sr)
-int sr; /* sr at time of interrupt */
-{
- int code;
- int got_char = 0;
-
- /*
- * There may be multiple keys available. Read them all.
- */
- while (KBD->ac_cs & (A_RXRDY|A_OE|A_PE)) {
- got_char = 1;
- if (KBD->ac_cs & (A_OE|A_PE)) {
- code = KBD->ac_da; /* Silently ignore errors */
- continue;
- }
- kbd_ring[kbd_rbput++ & KBD_RING_MASK] = KBD->ac_da;
- }
-
- /*
- * If characters are waiting for transmit, send them.
- */
- if ((kbd_softc.k_soft_cs & A_TXINT) && (KBD->ac_cs & A_TXRDY)) {
- if (kbd_softc.k_sendp != NULL)
- KBD->ac_da = *kbd_softc.k_sendp++;
- if (--kbd_softc.k_send_cnt <= 0) {
- /*
- * The total package has been transmitted,
- * wakeup anyone waiting for it.
- */
- KBD->ac_cs = (kbd_softc.k_soft_cs &= ~A_TXINT);
- kbd_softc.k_sendp = NULL;
- kbd_softc.k_send_cnt = 0;
- wakeup((caddr_t)&kbd_softc.k_send_cnt);
- }
- }
-
- /*
- * Activate software-level to handle possible input.
- */
- if (got_char) {
- if (!BASEPRI(sr)) {
- if (!kbd_soft++)
- add_sicallback(kbdsoft, 0, 0);
- } else {
- spl1();
- kbdsoft();
- }
- }
-}
-
-/*
- * Keyboard soft interrupt handler
- */
-void
-kbdsoft()
-{
- int s;
- u_char code;
- struct kbd_softc *k = &kbd_softc;
- struct firm_event *fe;
- int put;
- int n, get;
-
- kbd_soft = 0;
- get = kbd_rbget;
-
- for (;;) {
- n = kbd_rbput;
- if (get == n) /* We're done */
- break;
- n -= get;
- if (n > KBD_RING_SIZE) { /* Ring buffer overflow */
- get += n - KBD_RING_SIZE;
- n = KBD_RING_SIZE;
- }
- while (--n >= 0) {
- code = kbd_ring[get++ & KBD_RING_MASK];
-
- /*
- * If collecting a package, stuff it in and
- * continue.
- */
- if (k->k_pkg_size && (k->k_pkg_idx < k->k_pkg_size)) {
- k->k_package[k->k_pkg_idx++] = code;
- if (k->k_pkg_idx == k->k_pkg_size) {
- k->k_pkg_size = 0;
-#if NMOUSE > 0
- /*
- * Package is complete, we can now
- * send it to the mouse driver...
- */
- mouse_soft(k->k_package, k->k_pkg_size);
-#endif /* NMOUSE */
- }
- continue;
- }
- /*
- * If this is a package header, init pkg. handling.
- */
- if (!IS_KEY(code)) {
- kbd_pkg_start(k, code);
- continue;
- }
- /*
- * if not in event mode, deliver straight to ite to
- * process key stroke
- */
- if (!k->k_event_mode) {
- /* Gets to spltty() by itself */
- ite_filter(code, ITEFILT_TTY);
- continue;
- }
-
- /*
- * Keyboard is generating events. Turn this keystroke
- * into an event and put it in the queue. If the queue
- * is full, the keystroke is lost (sorry!).
- */
- s = spltty();
- put = k->k_events.ev_put;
- fe = &k->k_events.ev_q[put];
- put = (put + 1) % EV_QSIZE;
- if (put == k->k_events.ev_get) {
- log(LOG_WARNING,
- "keyboard event queue overflow\n");
- splx(s);
- continue;
- }
- fe->id = KEY_CODE(code);
- fe->value = KEY_UP(code) ? VKEY_UP : VKEY_DOWN;
- fe->time = time;
- k->k_events.ev_put = put;
- EV_WAKEUP(&k->k_events);
- splx(s);
- }
- kbd_rbget = get;
- }
-}
-
-static char sound[] = {
- 0xA8,0x01,0xA9,0x01,0xAA,0x01,0x00,
- 0xF8,0x10,0x10,0x10,0x00,0x20,0x03
-};
-
-int
-kbdbell()
-{
- register int i, sps;
-
- sps = spltty();
- for (i = 0; i < sizeof(sound); i++) {
- SOUND->sd_selr = i;
- SOUND->sd_wdat = sound[i];
- }
- splx(sps);
-}
-
-int
-kbdgetcn()
-{
- u_char code;
- int s = spltty();
- int ints_active;
-
- ints_active = 0;
- if (MFP->mf_imrb & IB_AINT) {
- ints_active = 1;
- MFP->mf_imrb &= ~IB_AINT;
- }
- for (;;) {
- while (!((KBD->ac_cs & (A_IRQ|A_RXRDY)) == (A_IRQ|A_RXRDY)))
- ; /* Wait for key */
- if (KBD->ac_cs & (A_OE|A_PE)) {
- code = KBD->ac_da; /* Silently ignore errors */
- continue;
- }
- break;
- }
-
- code = KBD->ac_da;
- if (ints_active) {
- MFP->mf_iprb &= ~IB_AINT;
- MFP->mf_imrb |= IB_AINT;
- }
-
- splx (s);
- return code;
-}
-
-/*
- * Write a command to the keyboard in 'polled' mode.
- */
-static int
-kbd_write_poll(cmd, len)
-u_char *cmd;
-int len;
-{
- int timeout;
-
- while (len-- > 0) {
- KBD->ac_da = *cmd++;
- for (timeout = 100; !(KBD->ac_cs & A_TXRDY); timeout--)
- delay(10);
- if (!(KBD->ac_cs & A_TXRDY))
- return (0);
- }
- return (1);
-}
-
-/*
- * Write a command to the keyboard. Return when command is send.
- */
-void
-kbd_write(cmd, len)
-u_char *cmd;
-int len;
-{
- struct kbd_softc *k = &kbd_softc;
- int sps;
-
- /*
- * Get to splhigh, 'real' interrupts arrive at spl6!
- */
- sps = splhigh();
-
- /*
- * Make sure any privious write has ended...
- */
- while (k->k_sendp != NULL)
- tsleep((caddr_t)&k->k_sendp, TTOPRI, "kbd_write1", 0);
-
- /*
- * If the KBD-acia is not currently busy, send the first
- * character now.
- */
- KBD->ac_cs = (k->k_soft_cs |= A_TXINT);
- if (KBD->ac_cs & A_TXRDY) {
- KBD->ac_da = *cmd++;
- len--;
- }
-
- /*
- * If we're not yet done, wait until all characters are send.
- */
- if (len > 0) {
- k->k_sendp = cmd;
- k->k_send_cnt = len;
- tsleep((caddr_t)&k->k_send_cnt, TTOPRI, "kbd_write2", 0);
- }
- splx(sps);
-
- /*
- * Wakeup all procs waiting for us.
- */
- wakeup((caddr_t)&k->k_sendp);
-}
-
-/*
- * Setup softc-fields to assemble a keyboard package.
- */
-static void
-kbd_pkg_start(kp, msg_start)
-struct kbd_softc *kp;
-u_char msg_start;
-{
- kp->k_pkg_idx = 1;
- kp->k_package[0] = msg_start;
- switch (msg_start) {
- case 0xf6:
- kp->k_pkg_size = 8;
- break;
- case 0xf7:
- kp->k_pkg_size = 6;
- break;
- case 0xf8:
- case 0xf9:
- case 0xfa:
- case 0xfb:
- kp->k_pkg_size = 3;
- break;
- case 0xfc:
- kp->k_pkg_size = 7;
- break;
- case 0xfe:
- case 0xff:
- kp->k_pkg_size = 2;
- break;
- default:
- printf("kbd: Unknown packet 0x%x\n", msg_start);
- break;
- }
-}
diff --git a/sys/arch/atari/dev/kbdmap.c b/sys/arch/atari/dev/kbdmap.c
deleted file mode 100644
index 26d1f936728..00000000000
--- a/sys/arch/atari/dev/kbdmap.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/* $NetBSD: kbdmap.c,v 1.2 1995/07/24 05:56:14 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <atari/dev/kbdmap.h>
-
-/* define a default keymap. This can be changed by keyboard ioctl's
- (later at least..) */
-
-/* mode shortcuts: */
-#define S KBD_MODE_STRING
-#define C KBD_MODE_CAPS
-#define K KBD_MODE_KPAD
-
-struct kbdmap ascii_kbdmap = {
- /* normal map */
- {
-/* 0x00 */ 0, 0, 0, ESC, 0, '1', 0, '2',
-/* 0x04 */ 0, '3', 0, '4', 0, '5', 0, '6',
-/* 0x08 */ 0, '7', 0, '8', 0, '9', 0, '0',
-/* 0x0c */ 0, '-', 0, '=', 0, '\b', 0, '\t',
-/* 0x10 */ C, 'q', C, 'w', C, 'e', C, 'r',
-/* 0x14 */ C, 't', C, 'y', C, 'u', C, 'i',
-/* 0x18 */ C, 'o', C, 'p', 0, '[', 0, ']',
-/* 0x1c */ 0, '\r', 0, 0, C, 'a', C, 's',
-/* 0x20 */ C, 'd', C, 'f', C, 'g', C, 'h',
-/* 0x24 */ C, 'j', C, 'k', C, 'l', 0, ';',
-#ifdef US_KBD
-/* 0x28 */ 0, '\'', 0, '`', 0, 0, 0, '\\',
-#else
-/* 0x28 */ 0, '\'', 0, '`', 0, 0, 0, '#',
-#endif
-/* 0x2c */ C, 'z', C, 'x', C, 'c', C, 'v',
-/* 0x30 */ C, 'b', C, 'n', C, 'm', 0, ',',
-/* 0x34 */ 0, '.', 0, '/', 0, 0, 0, 0,
-/* 0x38 */ 0, 0, 0, ' ', 0, 0, S, 0x10,
-/* 0x3c */ S, 0x15, S, 0x1A, S, 0x1F, S, 0x24,
-/* 0x40 */ S, 0x29, S, 0x2E, S, 0x33, S, 0x38,
-/* 0x44 */ S, 0x3D, 0, 0, 0, 0, 0, 0,
-/* 0x48 */ S, 0x00, 0, 0, 0, '-', S, 0x0C,
-/* 0x4c */ 0, 0, S, 0x08, 0, '+', 0, 0,
-/* 0x50 */ S, 0x04, 0, 0, 0, 0, 0, DEL,
-/* 0x54 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x58 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x5c */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x60 */
-#ifdef US_KBD
-/* 0x60 */ 0, 0, 0, 0, 0, 0, 0, '(',
-#else
-/* 0x60 */ 0, '\\', 0, 0, 0, 0, 0, '(',
-#endif
-/* 0x64 */ 0, ')', 0, '/', 0, '*', K, '7',
-/* 0x68 */ K, '8', K, '9', K, '4', K, '5',
-/* 0x6c */ K, '6', K, '1', K, '2', K, '3',
-/* 0x70 */ K, '0', K, '.', K, '\r', 0, 0,
-/* 0x74 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x78 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x7c */ 0, 0, 0, 0, 0, 0, 0, 0
-},
- /* shifted map */
- {
-#ifdef US_KBD
-/* 0x00 */ 0, 0, 0, ESC, 0, '!', 0, '@',
-#else
-/* 0x00 */ 0, 0, 0, ESC, 0, '!', 0, '"',
-#endif
-/* 0x04 */ 0, '#', 0, '$', 0, '%', 0, '^',
-/* 0x08 */ 0, '&', 0, '*', 0, '(', 0, ')',
-/* 0x0c */ 0, '_', 0, '+', 0, '\b', 0, '\t',
-/* 0x10 */ C, 'Q', C, 'W', C, 'E', C, 'R',
-/* 0x14 */ C, 'T', C, 'Y', C, 'U', C, 'I',
-/* 0x18 */ C, 'O', C, 'P', 0, '{', 0, '}',
-/* 0x1c */ 0, '\r', 0, 0, C, 'A', C, 'S',
-/* 0x20 */ C, 'D', C, 'F', C, 'G', C, 'H',
-/* 0x24 */ C, 'J', C, 'K', C, 'L', 0, ':',
-#ifdef US_KBD
-/* 0x28 */ 0, '"', 0, '~', 0, 0, 0, '|',
-#else
-/* 0x28 */ 0, '@', 0, '_', 0, 0, 0, '~',
-#endif
-/* 0x2c */ C, 'Z', C, 'X', C, 'C', C, 'V',
-/* 0x30 */ C, 'B', C, 'N', C, 'M', 0, '<',
-/* 0x34 */ 0, '>', 0, '?', 0, 0, 0, 0,
-/* 0x38 */ 0, 0, 0, ' ', 0, 0, S, 0x5d,
-/* 0x3c */ S, 0x63, S, 0x69, S, 0x6F, S, 0x75,
-/* 0x40 */ S, 0x7b, S, 0x81, S, 0x87, S, 0x8d,
-/* 0x44 */ S, 0x93, 0, 0, 0, 0, 0, 0,
-/* 0x48 */ S, 0x47, 0, 0, 0, '-', S, 0x57,
-/* 0x4c */ 0, 0, S, 0x51, 0, '+', 0, 0,
-/* 0x50 */ S, 0x4c, 0, 0, 0, 0, 0, DEL,
-/* 0x54 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x58 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x5c */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x60 */
-#ifdef US_KBD
-/* 0x60 */ 0, 0, 0, 0, 0, 0, 0, '(',
-#else
-/* 0x60 */ 0, '|', 0, 0, 0, 0, 0, '(',
-#endif
-/* 0x64 */ 0, ')', 0, '/', 0, '*', K, '7',
-/* 0x68 */ K, '8', K, '9', K, '4', K, '5',
-/* 0x6c */ K, '6', K, '1', K, '2', K, '3',
-/* 0x70 */ K, '0', K, '.', K, '\r', 0, 0,
-/* 0x74 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x78 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x7c */ 0, 0, 0, 0, 0, 0, 0, 0
- },
-
- /* alt map FIXME: No altmap yet.. */
- {
- 0, 0
- },
-
- /* shift alt map FIXME: No shift altmap yet... */
- {
- 0, 0
- },
-
- {
- /* string table. If there's a better way to get the offsets into the
- above table, please tell me..
-
- NOTE: save yourself and others a lot of grief by *not* using
- CSI == 0x9b, using the two-character sequence gives
- much less trouble, especially in GNU-Emacs.. */
-
- 3, ESC, '[', 'A', /* 0x00: CRSR UP */
- 3, ESC, '[', 'B', /* 0x04: CRSR DOWN */
- 3, ESC, '[', 'C', /* 0x08: CRSR RIGHT */
- 3, ESC, '[', 'D', /* 0x0C: CRSR LEFT */
- 4, ESC, '[', '0', '~', /* 0x10: F1 */
- 4, ESC, '[', '1', '~', /* 0x15: F2 */
- 4, ESC, '[', '2', '~', /* 0x1A: F3 */
- 4, ESC, '[', '3', '~', /* 0x1F: F4 */
- 4, ESC, '[', '4', '~', /* 0x24: F5 */
- 4, ESC, '[', '5', '~', /* 0x29: F6 */
- 4, ESC, '[', '6', '~', /* 0x2E: F7 */
- 4, ESC, '[', '7', '~', /* 0x33: F8 */
- 4, ESC, '[', '8', '~', /* 0x38: F9 */
- 4, ESC, '[', '9', '~', /* 0x3D: F10 */
- 4, ESC, '[', '?', '~', /* 0x42: HELP */
-
- 4, ESC, '[', 'T', '~', /* 0x47: shift CRSR UP */
- 4, ESC, '[', 'S', '~', /* 0x4C: shift CRSR DOWN */
- 5, ESC, '[', ' ', '@', '~', /* 0x51: shift CRSR RIGHT */
- 5, ESC, '[', ' ', 'A', '~', /* 0x57: shift CRSR LEFT */
- 5, ESC, '[', '1', '0', '~', /* 0x5D: shift F1 */
- 5, ESC, '[', '1', '1', '~', /* 0x63: shift F2 */
- 5, ESC, '[', '1', '2', '~', /* 0x69: shift F3 */
- 5, ESC, '[', '1', '3', '~', /* 0x6F: shift F4 */
- 5, ESC, '[', '1', '4', '~', /* 0x75: shift F5 */
- 5, ESC, '[', '1', '5', '~', /* 0x7B: shift F6 */
- 5, ESC, '[', '1', '6', '~', /* 0x81: shift F7 */
- 5, ESC, '[', '1', '7', '~', /* 0x87: shift F8 */
- 5, ESC, '[', '1', '8', '~', /* 0x8D: shift F9 */
- 5, ESC, '[', '1', '9', '~', /* 0x93: shift F10 */
- 3, ESC, '[', 'Z', /* 0x99: shift TAB */
- 2, ESC, '[', /* 0x9d: alt ESC == CSI */
- },
-};
-
-unsigned char acctable[KBD_NUM_ACC][64] = {
- { "@ÀBCDÈFGHÌJKLMNÒPQRSTÙVWXYZ[\\]^_"
- "`àbcdèfghìjklmnòpqrstùvwxyz{|}~\177"}, /* KBD_ACC_GRAVE */
-
- { "@ÁBCDÉFGHÍJKLMNÓPQRSTÚVWXYZ[\\]^_"
- "`ábcdéfghíjklmnópqrstúvwxyz{|}~\177"}, /* KBD_ACC_ACUTE */
-
- { "@ÂBCDÊFGHÎJKLMNÔPQRSTÛVWXYZ[\\]^_"
- "`âbcdêfghîjklmnôpqrstûvwxyz{|}~\177"}, /* KBD_ACC_CIRC */
-
- { "@ÃBCDEFGHIJKLMÑÕPQRSTUVWXYZ[\\]^_"
- "`ãbcdefghijklmñÕpqrstuvwxyz{|}~\177"}, /* KBD_ACC_TILDE */
-
- { "@ÄBCDËFGHÏJKLMNÖPQRSTÜVWXYZ[\\]^_"
- "`äbcdëfghïjklmnöpqrstüvwxyz{|}~\177"}, /* KBD_ACC_DIER */
-};
-
-
diff --git a/sys/arch/atari/dev/kbdmap.h b/sys/arch/atari/dev/kbdmap.h
deleted file mode 100644
index b75795cbfb1..00000000000
--- a/sys/arch/atari/dev/kbdmap.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/* $NetBSD: kbdmap.h,v 1.3 1995/07/24 05:56:17 leo Exp $ */
-
-/*
- * Copyright (c) 1993 Markus Wild
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Markus Wild.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define NUL 0
-#define SOH 1
-#define STX 2
-#define ETX 3
-#define EOT 4
-#define ENQ 5
-#define ACK 6
-#define BEL 7
-#define BS 8
-#define HT 9
-#define LF 10
-#define VT 11
-#define FF 12
-#define CR 13
-#define SO 14
-#define SI 15
-#define DLE 16
-#define DC1 17
-#define DC2 18
-#define DC3 19
-#define DC4 20
-#define NAK 21
-#define SYN 22
-#define ETB 23
-#define CAN 24
-#define EM 25
-#define SUB 26
-#define ESC 27
-#define FS 28
-#define GS 29
-#define RS 30
-#define US 31
-#define DEL 127
-#define IND 132
-#define NEL 133
-#define SSA 134
-#define ESA 135
-#define HTS 136
-#define HTJ 137
-#define VTS 138
-#define PLD 139
-#define PLU 140
-#define RI 141
-#define SS2 142
-#define SS3 143
-#define DCS 144
-#define PU1 145
-#define PU2 146
-#define STS 147
-#define CCH 148
-#define MW 149
-#define SPA 150
-#define EPA 151
-#define CSI 155
-#define ST 156
-#define OSC 157
-#define PM 158
-#define APC 159
-
-
-/*
- * A total of 0x80 scancode are defined for the atari keyboard.
- */
-#define KBD_NUM_KEYS 0x80
-
-/* size of string table */
-#define KBD_STRTAB_SIZE 255
-
-/* for dead keys, index into acctable */
-/* FIXME: What the hell are dead keys?? */
-#define KBD_ACC_GRAVE 0
-#define KBD_ACC_ACUTE 1
-#define KBD_ACC_CIRC 2
-#define KBD_ACC_TILDE 3
-#define KBD_ACC_DIER 4
-#define KBD_NUM_ACC 5
-
-
-struct key {
- unsigned char mode; /* see possible values below */
- unsigned char code;
-};
-
-#define KBD_MODE_STRING (0x01) /* code is index into strings[] */
-#define KBD_MODE_DEAD (0x02) /* acc-index in upper nibble, code = plain acc */
-#define KBD_MODE_CAPS (0x04) /* key is capsable. Only in non-shifted maps */
-#define KBD_MODE_KPAD (0x08) /* key is on keypad */
-#define KBD_MODE_GRAVE (KBD_ACC_GRAVE << 4)
-#define KBD_MODE_ACUTE (KBD_ACC_ACUTE << 4)
-#define KBD_MODE_CIRC (KBD_ACC_CIRC << 4)
-#define KBD_MODE_TILDE (KBD_ACC_TILDE << 4)
-#define KBD_MODE_DIER (KBD_ACC_DIER << 4)
-#define KBD_MODE_ACCENT(m) ((m) >> 4) /* get accent from mode */
-#define KBD_MODE_ACCMASK (0xf0)
-
-#define KBD_SCANCODE(code) (code & 0x7f)
-#define KBD_RELEASED(code) (code & 0x80 ? 1 : 0)
-
-struct kbdmap {
- struct key keys[KBD_NUM_KEYS],
- shift_keys[KBD_NUM_KEYS],
- alt_keys[KBD_NUM_KEYS],
- alt_shift_keys[KBD_NUM_KEYS];
- unsigned char strings[KBD_STRTAB_SIZE];
-};
-
-
-#ifdef _KERNEL
-/* XXX: ITE interface */
-extern struct kbdmap ascii_kbdmap;
-extern unsigned char acctable[KBD_NUM_ACC][64];
-#endif
diff --git a/sys/arch/atari/dev/kbdreg.h b/sys/arch/atari/dev/kbdreg.h
deleted file mode 100644
index 84301c4fda2..00000000000
--- a/sys/arch/atari/dev/kbdreg.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* $NetBSD: kbdreg.h,v 1.1.1.1 1995/03/26 07:12:12 leo Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)kbio.h 8.1 (Berkeley) 6/11/93
- *
- * from: Header: kbio.h,v 1.4 92/11/26 01:16:32 torek Exp (LBL)
- */
-
-#define KIOCTRANS _IOW('k', 0, int) /* set translation mode */
- /* (we only accept TR_UNTRANS_EVENT) */
-#define KIOCGTRANS _IOR('k', 5, int) /* get translation mode */
-#define KIOCSDIRECT _IOW('k', 10, int) /* keys to console? */
-
-#define TR_UNTRANS_EVENT 3
diff --git a/sys/arch/atari/dev/ms.c b/sys/arch/atari/dev/ms.c
deleted file mode 100644
index 5d5c647c0ee..00000000000
--- a/sys/arch/atari/dev/ms.c
+++ /dev/null
@@ -1,397 +0,0 @@
-/* $NetBSD: ms.c,v 1.3 1995/07/27 06:35:46 leo Exp $
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * based on:
- *
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ms.c 8.1 (Berkeley) 6/11/93
- *
- * Header: ms.c,v 1.5 92/11/26 01:28:47 torek Exp (LBL)
- */
-
-/*
- * Mouse driver.
- */
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/ioctl.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-#include <sys/tty.h>
-
-#include <atari/dev/event_var.h>
-#include <atari/dev/vuid_event.h>
-
-#include "mouse.h"
-#if NMOUSE > 0
-
-/* there's really no more physical ports on an atari. */
-#if NMOUSE > 1
-#undef NMOUSE
-#define NMOUSE 1
-#endif
-
-typedef void (*FPV)();
-
-/*
- * Mouse specific packages produced by the keyboard. Currently, we only
- * define the REL_MOUSE package, as this is the only one used.
- */
-typedef struct {
- u_char id;
- char dx;
- char dy;
-} REL_MOUSE;
-
-#define IS_REL_MOUSE(id) (((u_int)(id) & 0xF8) == 0xF8)
-#define TIMEOUT_ID (0xFC)
-
-static struct ms_softc {
- u_char ms_buttons; /* button states */
- struct evvar ms_events; /* event queue state */
- int ms_dx; /* accumulated dx */
- int ms_dy; /* accumulated dy */
- struct firm_event ms_bq[2]; /* Button queue */
- int ms_bq_idx; /* Button queue index */
-} ms_softc[NMOUSE];
-
-static void ms_3b_delay __P((struct ms_softc *));
- void mouse_soft __P((REL_MOUSE *, int));
-
-int
-mouseattach(cnt)
- int cnt;
-{
- printf("1 mouse configured\n");
- return(NMOUSE);
-}
-
-static void
-ms_3b_delay(ms)
-struct ms_softc *ms;
-{
- REL_MOUSE rel_ms;
-
- rel_ms.id = TIMEOUT_ID;
- rel_ms.dx = rel_ms.dy = 0;
- mouse_soft(&rel_ms, sizeof(rel_ms));
-}
-/*
- * Note that we are called from the keyboard software interrupt!
- */
-void
-mouse_soft(rel_ms, size)
-REL_MOUSE *rel_ms;
-int size;
-{
- struct ms_softc *ms = &ms_softc[0];
- struct firm_event *fe, *fe2;
- int get, put;
- int sps;
- u_char mbut, bmask;
- int is_timeout;
- int flush_buttons;
- int id;
-
- if (!IS_REL_MOUSE(rel_ms->id))
- return; /* Probably some other message */
- if (ms->ms_events.ev_io == NULL)
- return;
-
- sps = splev();
- get = ms->ms_events.ev_get;
- put = ms->ms_events.ev_put;
- fe = &ms->ms_events.ev_q[put];
-
- if (rel_ms->id == TIMEOUT_ID) {
- is_timeout = 1;
- id = ms->ms_buttons;
- }
- else {
- is_timeout = 0;
- id = (rel_ms->id & 3) | (ms->ms_buttons & 4);
- }
-
- if (!is_timeout && ms->ms_bq_idx)
- untimeout((FPV)ms_3b_delay, (void *)ms);
-
- /*
- * Button states are encoded in the lower 2 bits of 'id'
- */
- if (!(mbut = (id ^ ms->ms_buttons)) && (put != get)) {
- /*
- * Compact dx/dy messages. Always generate an event when
- * a button is pressed or the event queue is empty.
- */
- ms->ms_dx += rel_ms->dx;
- ms->ms_dy += rel_ms->dy;
- goto out;
- }
- rel_ms->dx += ms->ms_dx;
- rel_ms->dy += ms->ms_dy;
- ms->ms_dx = ms->ms_dy = 0;
-
- /*
- * Output location events _before_ button events ie. make sure
- * the button is pressed at the correct location.
- */
- if (rel_ms->dx) {
- if ((++put) % EV_QSIZE == get) {
- put--;
- goto out;
- }
- fe->id = LOC_X_DELTA;
- fe->value = rel_ms->dx;
- fe->time = time;
- if (put >= EV_QSIZE) {
- put = 0;
- fe = &ms->ms_events.ev_q[0];
- }
- else fe++;
- }
- if (rel_ms->dy) {
- if ((++put) % EV_QSIZE == get) {
- put--;
- goto out;
- }
- fe->id = LOC_Y_DELTA;
- fe->value = rel_ms->dy;
- fe->time = time;
- if (put >= EV_QSIZE) {
- put = 0;
- fe = &ms->ms_events.ev_q[0];
- }
- else fe++;
- }
- if (mbut && !is_timeout) {
- for (bmask = 1; bmask < 0x04; bmask <<= 1) {
- if (!(mbut & bmask))
- continue;
- fe2 = &ms->ms_bq[ms->ms_bq_idx++];
- fe2->id = bmask & 1 ? MS_RIGHT : MS_LEFT;
- fe2->value = id & bmask ? VKEY_DOWN : VKEY_UP;
- fe2->time = time;
- }
- }
- if (ms->ms_bq_idx) {
- /*
- * We have at least one button, handle it.
- */
- flush_buttons = (is_timeout) ? 1 : 0;
- if (ms->ms_bq_idx == 2) {
- if (ms->ms_bq[0].value == ms->ms_bq[1].value) {
- /* Must be 2 button presses! */
- if (ms->ms_bq[0].id != ms->ms_bq[1].id) {
- ms->ms_bq[0].id = MS_MIDDLE;
- ms->ms_bq_idx = 1;
- id = 7;
- }
- }
- flush_buttons = 1;
- }
- else {
- if (ms->ms_bq[0].value == VKEY_UP) {
- /*
- * Release of a button is always flushed
- * immediately. If the middle button is
- * active, the release event is his. Mark
- * all buttons released, this also surpresses
- * a spurious release event of the not-yet-
- * released button.
- */
- if( id & 4) {
- ms->ms_bq[0].id = MS_MIDDLE;
- id = 0;
- }
- flush_buttons = 1;
- }
- else if (!is_timeout) {
- timeout((FPV)ms_3b_delay, (void *)ms, 10);
- goto out;
- }
- }
- if (flush_buttons) {
- int i;
-
- for (i = 0; i < ms->ms_bq_idx; i++) {
- if ((++put) % EV_QSIZE == get) {
- ms->ms_bq_idx = 0;
- put--;
- goto out;
- }
- *fe = ms->ms_bq[i];
- if (put >= EV_QSIZE) {
- put = 0;
- fe = &ms->ms_events.ev_q[0];
- }
- else fe++;
- }
- ms->ms_bq_idx = 0;
- }
- }
-
-out:
- ms->ms_events.ev_put = put;
- ms->ms_buttons = id;
- splx(sps);
- EV_WAKEUP(&ms->ms_events);
-}
-
-int
-msopen(dev, flags, mode, p)
-dev_t dev;
-int flags, mode;
-struct proc *p;
-{
- u_char report_ms[] = { 0x08 };
- struct ms_softc *ms;
- int unit;
-
- unit = minor(dev);
- ms = &ms_softc[unit];
-
- if (unit >= NMOUSE)
- return(EXDEV);
-
- if (ms->ms_events.ev_io)
- return(EBUSY);
-
- ms->ms_events.ev_io = p;
- ms->ms_dx = ms->ms_dy = 0;
- ms->ms_buttons = 0;
- ms->ms_bq[0].id = ms->ms_bq[1].id = 0;
- ms->ms_bq_idx = 0;
- ev_init(&ms->ms_events); /* may cause sleep */
-
- /*
- * Enable mouse reporting.
- */
- kbd_write(report_ms, sizeof(report_ms));
- return(0);
-}
-
-int
-msclose(dev, flags, mode, p)
-dev_t dev;
-int flags, mode;
-struct proc *p;
-{
- u_char disable_ms[] = { 0x12 };
- int unit;
- struct ms_softc *ms;
-
- unit = minor (dev);
- ms = &ms_softc[unit];
-
- /*
- * Turn off mouse interrogation.
- */
- kbd_write(disable_ms, sizeof(disable_ms));
- ev_fini(&ms->ms_events);
- ms->ms_events.ev_io = NULL;
- return(0);
-}
-
-int
-msread(dev, uio, flags)
-dev_t dev;
-struct uio *uio;
-int flags;
-{
- struct ms_softc *ms;
-
- ms = &ms_softc[minor(dev)];
- return(ev_read(&ms->ms_events, uio, flags));
-}
-
-int
-msioctl(dev, cmd, data, flag, p)
-dev_t dev;
-u_long cmd;
-register caddr_t data;
-int flag;
-struct proc *p;
-{
- struct ms_softc *ms;
- int unit;
-
- unit = minor(dev);
- ms = &ms_softc[unit];
-
- switch (cmd) {
- case FIONBIO: /* we will remove this someday (soon???) */
- return(0);
- case FIOASYNC:
- ms->ms_events.ev_async = *(int *)data != 0;
- return(0);
- case TIOCSPGRP:
- if (*(int *)data != ms->ms_events.ev_io->p_pgid)
- return(EPERM);
- return(0);
- case VUIDGFORMAT: /* we only do firm_events */
- *(int *)data = VUID_FIRM_EVENT;
- return(0);
- case VUIDSFORMAT:
- if (*(int *)data != VUID_FIRM_EVENT)
- return(EINVAL);
- return(0);
- }
- return(ENOTTY);
-}
-
-int
-msselect(dev, rw, p)
-dev_t dev;
-int rw;
-struct proc *p;
-{
- struct ms_softc *ms;
-
- ms = &ms_softc[minor(dev)];
- return(ev_select(&ms->ms_events, rw, p));
-}
-#endif /* NMOUSE > 0 */
diff --git a/sys/arch/atari/dev/ncr5380.c b/sys/arch/atari/dev/ncr5380.c
deleted file mode 100644
index eebad00a83b..00000000000
--- a/sys/arch/atari/dev/ncr5380.c
+++ /dev/null
@@ -1,2002 +0,0 @@
-/* $NetBSD: ncr5380.c,v 1.14 1996/01/06 20:17:15 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-#ifdef DBG_NOSTATIC
-# define static
-#endif
-#ifdef DBG_SEL
-# define DBG_SELPRINT(a,b) printf(a,b)
-#else
-# define DBG_SELPRINT(a,b)
-#endif
-#ifdef DBG_PIO
-# define DBG_PIOPRINT(a,b,c) printf(a,b,c)
-#else
-# define DBG_PIOPRINT(a,b,c)
-#endif
-#ifdef DBG_INF
-# define DBG_INFPRINT(a,b,c) a(b,c)
-#else
-# define DBG_INFPRINT(a,b,c)
-#endif
-#ifdef DBG_PID
- /* static char *last_hit = NULL, *olast_hit = NULL; */
- static char *last_hit[DBG_PID];
-# define PID(a) \
- { int i; \
- for (i=0; i< DBG_PID-1; i++) \
- last_hit[i] = last_hit[i+1]; \
- last_hit[DBG_PID-1] = a; } \
- /* olast_hit = last_hit; last_hit = a; */
-#else
-# define PID(a)
-#endif
-
-/*
- * Bit mask of targets you want debugging to be shown
- */
-u_char dbg_target_mask = 0x7f;
-
-/*
- * Set bit for target when parity checking must be disabled.
- * My (LWP) Maxtor 7245S seems to generate parity errors on about 50%
- * of all transfers while the data is correct!?
- */
-u_char ncr5380_no_parchk = 0xff;
-
-#ifdef AUTO_SENSE
-
-/*
- * Bit masks of targets that accept linked commands, and those
- * that we've already checked out
- */
-u_char ncr_will_link = 0x00;
-u_char ncr_test_link = 0x00;
-
-#endif /* AUTO_SENSE */
-
-/*
- * This is the default sense-command we send.
- */
-static u_char sense_cmd[] = {
- REQUEST_SENSE, 0, 0, 0, sizeof(struct scsi_sense_data), 0
-};
-
-/*
- * True if the main co-routine is running
- */
-static volatile int main_running = 0;
-
-/*
- * Mask of targets selected
- */
-static u_char busy;
-
-static void ncr5380_minphys(struct buf *bp);
-static int ncr5380_scsi_cmd(struct scsi_xfer *xs);
-static int ncr5380_show_scsi_cmd(struct scsi_xfer *xs);
-
-struct scsi_adapter ncr5380_switch = {
- ncr5380_scsi_cmd, /* scsi_cmd() */
- ncr5380_minphys, /* scsi_minphys() */
- 0, /* open_target_lu() */
- 0 /* close_target_lu() */
-};
-
-struct scsi_device ncr5380_dev = {
- NULL, /* use default error handler */
- NULL, /* do not have a start functio */
- NULL, /* have no async handler */
- NULL /* Use default done routine */
-};
-
-
-static SC_REQ req_queue[NREQ];
-static SC_REQ *free_head = NULL; /* Free request structures */
-
-
-/*
- * Inline functions:
- */
-
-/*
- * Determine the size of a SCSI command.
- */
-extern __inline__ int command_size(opcode)
-u_char opcode;
-{
- switch ((opcode >> 4) & 0xf) {
- case 0:
- case 1:
- return (6);
- case 2:
- case 3:
- return (10);
- }
- return (12);
-}
-
-
-/*
- * Wait for request-line to become active. When it doesn't return 0.
- * Otherwise return != 0.
- * The timeouts in the 'wait_req_*' functions are arbitrary and rather
- * large. In 99% of the invocations nearly no timeout is needed but in
- * some cases (especially when using my tapedrive, a Tandberg 3600) the
- * device is busy internally and the first SCSI-phase will be delayed.
- */
-extern __inline__ int wait_req_true(void)
-{
- int timeout = 25000;
-
- while (!(GET_5380_REG(NCR5380_IDSTAT) & SC_S_REQ) && --timeout)
- delay(1);
- return (GET_5380_REG(NCR5380_IDSTAT) & SC_S_REQ);
-}
-
-/*
- * Wait for request-line to become inactive. When it doesn't return 0.
- * Otherwise return != 0.
- */
-extern __inline__ int wait_req_false(void)
-{
- int timeout = 25000;
-
- while ((GET_5380_REG(NCR5380_IDSTAT) & SC_S_REQ) && --timeout)
- delay(1);
- return (!(GET_5380_REG(NCR5380_IDSTAT) & SC_S_REQ));
-}
-
-extern __inline__ void ack_message()
-{
- SET_5380_REG(NCR5380_ICOM, 0);
-}
-
-extern __inline__ void nack_message(SC_REQ *reqp, u_char msg)
-{
- SET_5380_REG(NCR5380_ICOM, SC_A_ATN);
- reqp->msgout = msg;
-}
-
-extern __inline__ void finish_req(SC_REQ *reqp)
-{
- int sps;
- struct scsi_xfer *xs = reqp->xs;
-
-#ifdef REAL_DMA
- /*
- * If we bounced, free the bounce buffer
- */
- if (reqp->dr_flag & DRIVER_BOUNCING)
- free_bounceb(reqp->bounceb);
-#endif /* REAL_DMA */
-#ifdef DBG_REQ
- if (dbg_target_mask & (1 << reqp->targ_id))
- show_request(reqp, "DONE");
-#endif
-#ifdef DBG_ERR_RET
- if (reqp->xs->error != 0)
- show_request(reqp, "ERR_RET");
-#endif
- /*
- * Return request to free-q
- */
- sps = splbio();
- reqp->next = free_head;
- free_head = reqp;
- splx(sps);
-
- xs->flags |= ITSDONE;
- if (!(reqp->dr_flag & DRIVER_LINKCHK))
- scsi_done(xs);
-}
-
-/*
- * Auto config stuff....
- */
-int ncr_cprint __P((void *auxp, const char *));
-void ncr_attach __P((struct device *, struct device *, void *));
-int ncr_match __P((struct device *, struct cfdata *, void *));
-
-/*
- * Tricks to make driver-name configurable
- */
-#define CFNAME(n) __CONCAT(n,cd)
-#define CFSTRING(n) __STRING(n)
-
-struct cfdriver CFNAME(DRNAME) = {
- NULL, CFSTRING(DRNAME), (cfmatch_t)ncr_match, ncr_attach,
- DV_DULL, sizeof(struct ncr_softc), NULL, 0 };
-
-int
-ncr_match(pdp, cdp, auxp)
-struct device *pdp;
-struct cfdata *cdp;
-void *auxp;
-{
- return (machine_match(pdp, cdp, auxp, &CFNAME(DRNAME)));
-}
-
-void
-ncr_attach(pdp, dp, auxp)
-struct device *pdp, *dp;
-void *auxp;
-{
- struct ncr_softc *sc;
- int i;
-
- sc = (struct ncr_softc *)dp;
-
- sc->sc_link.adapter_softc = sc;
- sc->sc_link.adapter_target = 7;
- sc->sc_link.adapter = &ncr5380_switch;
- sc->sc_link.device = &ncr5380_dev;
- sc->sc_link.openings = NREQ - 1;
-
- /*
- * bitmasks
- */
- sc->sc_noselatn = 0;
- sc->sc_selected = 0;
-
- /*
- * Initialize machine-type specific things...
- */
- scsi_mach_init(sc);
- printf("\n");
-
- /*
- * Initialize request queue freelist.
- */
- for (i = 0; i < NREQ; i++) {
- req_queue[i].next = free_head;
- free_head = &req_queue[i];
- }
-
- /*
- * Initialize the host adapter
- */
- scsi_idisable();
- ENABLE_NCR5380(sc);
- SET_5380_REG(NCR5380_ICOM, 0);
- SET_5380_REG(NCR5380_MODE, IMODE_BASE);
- SET_5380_REG(NCR5380_TCOM, 0);
- SET_5380_REG(NCR5380_IDSTAT, 0);
- scsi_ienable();
-
- /*
- * attach all scsi units on us
- */
- config_found(dp, &sc->sc_link, ncr_cprint);
-}
-
-/*
- * print diag if name is NULL else just extra
- */
-int
-ncr_cprint(auxp, name)
-void *auxp;
-const char *name;
-{
- if (name == NULL)
- return (UNCONF);
- return (QUIET);
-}
-/*
- * End of auto config stuff....
- */
-
-/*
- * Carry out a request from the high level driver.
- */
-static int
-ncr5380_scsi_cmd(struct scsi_xfer *xs)
-{
- int sps;
- SC_REQ *reqp, *link, *tmp;
- int flags = xs->flags;
-
- /*
- * We do not queue RESET commands
- */
- if (flags & SCSI_RESET) {
- scsi_reset(xs->sc_link->adapter_softc);
- return (COMPLETE);
- }
-
- /*
- * Get a request block
- */
- sps = splbio();
- if ((reqp = free_head) == 0) {
- splx(sps);
- return (TRY_AGAIN_LATER);
- }
- free_head = reqp->next;
- reqp->next = NULL;
- splx(sps);
-
- /*
- * Initialize our private fields
- */
- reqp->dr_flag = (flags & SCSI_POLL) ? DRIVER_NOINT : 0;
- reqp->phase = NR_PHASE;
- reqp->msgout = MSG_NOOP;
- reqp->status = SCSGOOD;
- reqp->link = NULL;
- reqp->xs = xs;
- reqp->targ_id = xs->sc_link->target;
- reqp->targ_lun = xs->sc_link->lun;
- reqp->xdata_ptr = (u_char*)xs->data;
- reqp->xdata_len = xs->datalen;
- memcpy(&reqp->xcmd, xs->cmd, sizeof(struct scsi_generic));
- reqp->xcmd.bytes[0] |= reqp->targ_lun << 5;
-
- /*
- * Sanity check on flags...
- */
- if (flags & ITSDONE) {
- ncr_tprint(reqp, "scsi_cmd: command already done.....\n");
- xs->flags &= ~ITSDONE;
- }
- if (!(flags & INUSE)) {
- ncr_tprint(reqp, "scsi_cmd: command not in use.....\n");
- xs->flags |= ~INUSE;
- }
-
-#ifdef REAL_DMA
- /*
- * Check if DMA can be used on this request
- */
- if (scsi_dmaok(reqp))
- reqp->dr_flag |= DRIVER_DMAOK;
-#endif /* REAL_DMA */
-
- /*
- * Insert the command into the issue queue. Note that 'REQUEST SENSE'
- * commands are inserted at the head of the queue since any command
- * will clear the existing contingent allegience condition and the sense
- * data is only valid while the condition exists.
- * When possible, link the command to a previous command to the same
- * target. This is not very sensible when AUTO_SENSE is not defined!
- * Interrupts are disabled while we are fiddling with the issue-queue.
- */
- sps = splbio();
- link = NULL;
- if ((issue_q == NULL) || (reqp->xcmd.opcode == REQUEST_SENSE)) {
- reqp->next = issue_q;
- issue_q = reqp;
- }
- else {
- tmp = issue_q;
- do {
- if (!link && (tmp->targ_id == reqp->targ_id) && !tmp->link)
- link = tmp;
- } while (tmp->next && (tmp = tmp->next));
- tmp->next = reqp;
-#ifdef AUTO_SENSE
- if (link && (ncr_will_link & (1<<reqp->targ_id))) {
- link->link = reqp;
- link->xcmd.bytes[link->xs->cmdlen-2] |= 1;
- }
-#endif
- }
-#ifdef AUTO_SENSE
- /*
- * If we haven't already, check the target for link support.
- * Do this by prefixing the current command with a dummy
- * Request_Sense command, link the dummy to the current
- * command, and insert the dummy command at the head of the
- * issue queue. Set the DRIVER_LINKCHK flag so that we'll
- * ignore the results of the dummy command, since we only
- * care about whether it was accepted or not.
- */
- if (!link && !(ncr_test_link & (1<<reqp->targ_id)) &&
- (tmp = free_head) && !(reqp->dr_flag & DRIVER_NOINT)) {
- free_head = tmp->next;
- tmp->dr_flag = (reqp->dr_flag & ~DRIVER_DMAOK) | DRIVER_LINKCHK;
- tmp->phase = NR_PHASE;
- tmp->msgout = MSG_NOOP;
- tmp->status = SCSGOOD;
- tmp->xs = reqp->xs;
- tmp->targ_id = reqp->targ_id;
- tmp->targ_lun = reqp->targ_lun;
- bcopy(sense_cmd, &tmp->xcmd, sizeof(sense_cmd));
- tmp->xdata_ptr = (u_char *)&tmp->xs->sense;
- tmp->xdata_len = sizeof(tmp->xs->sense);
- ncr_test_link |= 1<<tmp->targ_id;
- tmp->link = reqp;
- tmp->xcmd.bytes[sizeof(sense_cmd)-2] |= 1;
- tmp->next = issue_q;
- issue_q = tmp;
-#ifdef DBG_REQ
- if (dbg_target_mask & (1 << tmp->targ_id))
- show_request(tmp, "LINKCHK");
-#endif
- }
-#endif
- splx(sps);
-
-#ifdef DBG_REQ
- if (dbg_target_mask & (1 << reqp->targ_id))
- show_request(reqp, (reqp->xcmd.opcode == REQUEST_SENSE) ?
- "HEAD":"TAIL");
-#endif
-
- run_main(xs->sc_link->adapter_softc);
-
- if (xs->flags & (SCSI_POLL|ITSDONE))
- return (COMPLETE); /* We're booting or run_main has completed */
- return (SUCCESSFULLY_QUEUED);
-}
-
-static void
-ncr5380_minphys(struct buf *bp)
-{
- if (bp->b_bcount > MIN_PHYS)
- bp->b_bcount = MIN_PHYS;
- minphys(bp);
-}
-#undef MIN_PHYS
-
-static int
-ncr5380_show_scsi_cmd(struct scsi_xfer *xs)
-{
- u_char *b = (u_char *) xs->cmd;
- int i = 0;
-
- if (!(xs->flags & SCSI_RESET)) {
- printf("(%d:%d:%d,0x%x)-", xs->sc_link->scsibus,
- xs->sc_link->target, xs->sc_link->lun, xs->sc_link->flags);
- while (i < xs->cmdlen) {
- if (i)
- printf(",");
- printf("%x",b[i++]);
- }
- printf("-\n");
- }
- else {
- printf("(%d:%d:%d)-RESET-\n",
- xs->sc_link->scsibus,xs->sc_link->target, xs->sc_link->lun);
- }
-}
-
-/*
- * The body of the driver.
- */
-static void
-scsi_main(sc)
-struct ncr_softc *sc;
-{
- SC_REQ *req, *prev;
- int itype;
- int sps;
-
- /*
- * While running in the driver SCSI-interrupts are disabled.
- */
- scsi_idisable();
- ENABLE_NCR5380(sc);
-
- PID("scsi_main1");
- for (;;) {
- sps = splbio();
- if (!connected) {
- /*
- * Check if it is fair keep any exclusive access to DMA
- * claimed. If not, stop queueing new jobs so the discon_q
- * will be eventually drained and DMA can be given up.
- */
- if (!fair_to_keep_dma())
- goto main_exit;
-
- /*
- * Search through the issue-queue for a command
- * destined for a target that isn't busy.
- */
- prev = NULL;
- for (req=issue_q; req != NULL; prev = req, req = req->next) {
- if (!(busy & (1 << req->targ_id))) {
- /*
- * Found one, remove it from the issue queue
- */
- if (prev == NULL)
- issue_q = req->next;
- else prev->next = req->next;
- req->next = NULL;
- break;
- }
- }
-
- /*
- * When a request has just ended, we get here before an other
- * device detects that the bus is free and that it can
- * reconnect. The problem is that when this happens, we always
- * baffle the device because our (initiator) id is higher. This
- * can cause a sort of starvation on slow devices. So we check
- * for a pending reselection here.
- * Note that 'connected' will be non-null if the reselection
- * succeeds.
- */
- if ((GET_5380_REG(NCR5380_IDSTAT) & (SC_S_SEL|SC_S_IO))
- == (SC_S_SEL|SC_S_IO)){
- if (req != NULL) {
- req->next = issue_q;
- issue_q = req;
- }
- splx(sps);
-
- reselect(sc);
- scsi_clr_ipend();
- goto connected;
- }
-
- /*
- * The host is not connected and there is no request
- * pending, exit.
- */
- if (req == NULL) {
- PID("scsi_main2");
- goto main_exit;
- }
-
- /*
- * Re-enable interrupts before handling the request.
- */
- splx(sps);
-
-#ifdef DBG_REQ
- if (dbg_target_mask & (1 << req->targ_id))
- show_request(req, "TARGET");
-#endif
- /*
- * We found a request. Try to connect to the target. If the
- * initiator fails arbitration, the command is put back in the
- * issue queue.
- */
- if (scsi_select(req, 0)) {
- sps = splbio();
- req->next = issue_q;
- issue_q = req;
- splx(sps);
-#ifdef DBG_REQ
- if (dbg_target_mask & (1 << req->targ_id))
- ncr_tprint(req, "Select failed\n");
-#endif
- }
- }
- else splx(sps);
-connected:
- if (connected) {
- /*
- * If the host is currently connected but a 'real-dma' transfer
- * is in progress, the 'end-of-dma' interrupt restarts main.
- * So quit.
- */
- sps = splbio();
- if (connected && (connected->dr_flag & DRIVER_IN_DMA)) {
- PID("scsi_main3");
- goto main_exit;
- }
- splx(sps);
-
- /*
- * Let the target guide us through the bus-phases
- */
- while (information_transfer() == -1)
- ;
- }
- }
- /* NEVER TO REACH HERE */
- panic("ncr5380-SCSI: not designed to come here");
-
-main_exit:
- /*
- * We enter here with interrupts disabled. We are about to exit main
- * so interrupts should be re-enabled. Because interrupts are edge
- * triggered, we could already have missed the interrupt. Therefore
- * we check the IRQ-line here and re-enter when we really missed a
- * valid interrupt.
- */
- PID("scsi_main4");
- scsi_ienable();
- SET_5380_REG(NCR5380_IDSTAT, SC_HOST_ID);
- if (GET_5380_REG(NCR5380_DMSTAT) & SC_IRQ_SET) {
- if ((itype = check_intr(sc)) != INTR_SPURIOUS) {
- scsi_idisable();
- splx(sps);
-
- if (itype == INTR_RESEL)
- reselect(sc);
-#ifdef REAL_DMA
- else dma_ready();
-#else
- else {
- if (pdma_ready())
- goto connected;
- panic("Got DMA interrupt without DMA");
- }
-#endif
- scsi_clr_ipend();
- goto connected;
- }
- }
- reconsider_dma();
-
- main_running = 0;
- splx(sps);
- PID("scsi_main5");
-}
-
-#ifdef REAL_DMA
-/*
- * The SCSI-DMA interrupt.
- * This interrupt can only be triggered when running in non-polled DMA
- * mode. When DMA is not active, it will be silently ignored, it is usually
- * to late because the EOP interrupt of the controller happens just a tiny
- * bit earlier. It might become usefull when scatter/gather is implemented,
- * because in that case only part of the DATAIN/DATAOUT transfer is taken
- * out of a single buffer.
- */
-static void
-ncr_dma_intr(sc)
-struct ncr_softc *sc;
-{
- SC_REQ *reqp;
- int dma_done;
-
- PID("ncr_dma_intr");
- if ((reqp = connected) && (reqp->dr_flag & DRIVER_IN_DMA)) {
- scsi_idisable();
- if (!(dma_done = dma_ready())) {
- transfer_dma(reqp, reqp->phase, 0);
- return;
- }
- run_main(sc);
- }
-}
-#endif /* REAL_DMA */
-
-/*
- * The SCSI-controller interrupt. This interrupt occurs on reselections and
- * at the end of non-polled DMA-interrupts. It is assumed to be called from
- * the machine-dependent hardware interrupt.
- */
-static void
-ncr_ctrl_intr(sc)
-struct ncr_softc *sc;
-{
- int itype;
- int dma_done;
-
- while (GET_5380_REG(NCR5380_DMSTAT) & SC_IRQ_SET) {
- scsi_idisable();
- if ((itype = check_intr(sc)) != INTR_SPURIOUS) {
- if (itype == INTR_RESEL)
- reselect(sc);
- else {
-#ifdef REAL_DMA
- if (!(dma_done = dma_ready())) {
- transfer_dma(connected, connected->phase, 0);
- return;
- }
-#else
- if (pdma_ready())
- return;
- panic("Got DMA interrupt without DMA");
-#endif
- }
- scsi_clr_ipend();
- }
- run_main(sc);
- return;
- }
- PID("ncr_ctrl_intr1");
-}
-
-/*
- * Initiate a connection path between the host and the target. The function
- * first goes into arbitration for the SCSI-bus. When this succeeds, the target
- * is selected and an 'IDENTIFY' message is send.
- * Returns -1 when the arbitration failed. Otherwise 0 is returned. When
- * the target does not respond (to either selection or 'MESSAGE OUT') the
- * 'done' function is executed.
- * The result code given by the driver can be influenced by setting 'code'
- * to a non-zero value. This is the case when 'select' is called by abort.
- */
-static int
-scsi_select(reqp, code)
-SC_REQ *reqp;
-{
- u_long timeout;
- u_char tmp[1];
- u_char phase;
- u_long cnt;
- int sps;
- u_int8_t atn_flag;
- u_int8_t targ_bit;
- struct ncr_softc *sc;
-
- sc = reqp->xs->sc_link->adapter_softc;
- DBG_SELPRINT ("Starting arbitration\n", 0);
- PID("scsi_select1");
-
- sps = splbio();
-
- /*
- * Prevent a race condition here. If a reslection interrupt occurred
- * between the decision to pick a new request and the call to select,
- * we abort the selection.
- * Interrupts are lowered when the 5380 is setup to arbitrate for the
- * bus.
- */
- if (connected) {
- splx(sps);
- PID("scsi_select2");
- return (-1);
- }
-
- /*
- * Set phase bits to 0, otherwise the 5380 won't drive the bus during
- * selection.
- */
- SET_5380_REG(NCR5380_TCOM, 0);
- SET_5380_REG(NCR5380_ICOM, 0);
-
- /*
- * Arbitrate for the bus.
- */
- SET_5380_REG(NCR5380_DATA, SC_HOST_ID);
- SET_5380_REG(NCR5380_MODE, SC_ARBIT);
-
- splx(sps);
-
- cnt = 10;
- while (!(GET_5380_REG(NCR5380_ICOM) & SC_AIP) && --cnt)
- delay(1);
-
- if (!(GET_5380_REG(NCR5380_ICOM) & SC_AIP)) {
- SET_5380_REG(NCR5380_MODE, IMODE_BASE);
- SET_5380_REG(NCR5380_ICOM, 0);
- DBG_SELPRINT ("Arbitration lost, bus not free\n",0);
- PID("scsi_select3");
- return (-1);
- }
-
- /* The arbitration delay is 2.2 usecs */
- delay(3);
-
- /*
- * Check the result of the arbitration. If we failed, return -1.
- */
- if (GET_5380_REG(NCR5380_ICOM) & SC_LA) {
- SET_5380_REG(NCR5380_MODE, IMODE_BASE);
- SET_5380_REG(NCR5380_ICOM, 0);
- PID("scsi_select4");
- return (-1);
- }
-
- /*
- * The spec requires that we should read the data register to
- * check for higher id's and check the SC_LA again.
- */
- tmp[0] = GET_5380_REG(NCR5380_DATA);
- if (tmp[0] & ~((SC_HOST_ID << 1) - 1)) {
- SET_5380_REG(NCR5380_MODE, IMODE_BASE);
- SET_5380_REG(NCR5380_ICOM, 0);
- DBG_SELPRINT ("Arbitration lost, higher id present\n",0);
- PID("scsi_select5");
- return (-1);
- }
- if (GET_5380_REG(NCR5380_ICOM) & SC_LA) {
- SET_5380_REG(NCR5380_MODE, IMODE_BASE);
- SET_5380_REG(NCR5380_ICOM, 0);
- DBG_SELPRINT ("Arbitration lost,deassert SC_ARBIT\n",0);
- PID("scsi_select6");
- return (-1);
- }
- SET_5380_REG(NCR5380_ICOM, SC_A_SEL | SC_A_BSY);
- if (GET_5380_REG(NCR5380_ICOM) & SC_LA) {
- SET_5380_REG(NCR5380_MODE, IMODE_BASE);
- SET_5380_REG(NCR5380_ICOM, 0);
- DBG_SELPRINT ("Arbitration lost, deassert SC_A_SEL\n", 0);
- PID("scsi_select7");
- return (-1);
- }
- /* Bus settle delay + Bus clear delay = 1.2 usecs */
- delay(2);
- DBG_SELPRINT ("Arbitration complete\n", 0);
-
- /*
- * Now that we won the arbitration, start the selection.
- */
- targ_bit = 1 << reqp->targ_id;
- SET_5380_REG(NCR5380_DATA, SC_HOST_ID | targ_bit);
-
- if (sc->sc_noselatn & targ_bit)
- atn_flag = 0;
- else
- atn_flag = SC_A_ATN;
-
- /*
- * Raise ATN while SEL is true before BSY goes false from arbitration,
- * since this is the only way to guarantee that we'll get a MESSAGE OUT
- * phase immediately after the selection.
- */
- SET_5380_REG(NCR5380_ICOM, SC_A_BSY | SC_A_SEL | atn_flag | SC_ADTB);
- SET_5380_REG(NCR5380_MODE, IMODE_BASE);
-
- /*
- * Turn off reselection interrupts
- */
- SET_5380_REG(NCR5380_IDSTAT, 0);
-
- /*
- * Reset BSY. The delay following it, surpresses a glitch in the
- * 5380 which causes us to see our own BSY signal instead of that of
- * the target.
- */
- SET_5380_REG(NCR5380_ICOM, SC_A_SEL | atn_flag | SC_ADTB);
- delay(1);
-
- /*
- * Wait for the target to react, the specs call for a timeout of
- * 250 ms.
- */
- cnt = 25000;
- while (!(GET_5380_REG(NCR5380_IDSTAT) & SC_S_BSY) && --cnt)
- delay(10);
-
- if (!(GET_5380_REG(NCR5380_IDSTAT) & SC_S_BSY)) {
- /*
- * There is no reaction from the target, start the selection
- * timeout procedure. We release the databus but keep SEL
- * asserted. After that we wait a 'selection abort time' (200
- * usecs) and 2 deskew delays (90 ns) and check BSY again.
- * When BSY is asserted, we assume the selection succeeded,
- * otherwise we release the bus.
- */
- SET_5380_REG(NCR5380_ICOM, SC_A_SEL | atn_flag);
- delay(201);
- if (!(GET_5380_REG(NCR5380_IDSTAT) & SC_S_BSY)) {
- SET_5380_REG(NCR5380_ICOM, 0);
- reqp->xs->error = code ? code : XS_SELTIMEOUT;
- DBG_SELPRINT ("Target %d not responding to sel\n",
- reqp->targ_id);
- if (reqp->dr_flag & DRIVER_LINKCHK)
- ncr_test_link &= ~(1<<reqp->targ_id);
- finish_req(reqp);
- PID("scsi_select8");
- return (0);
- }
- }
- SET_5380_REG(NCR5380_ICOM, atn_flag);
-
- DBG_SELPRINT ("Target %d responding to select.\n", reqp->targ_id);
-
- /*
- * The SCSI-interrupts are disabled while a request is being handled.
- */
- scsi_idisable();
-
- /*
- * If we did not request ATN, then don't try to send IDENTIFY.
- */
- if (atn_flag == 0) {
- reqp->phase = PH_CMD;
- goto identify_failed;
- }
-
- /*
- * Here we prepare to send an 'IDENTIFY' message.
- * Allow disconnect only when interrups are allowed.
- */
- tmp[0] = MSG_IDENTIFY(reqp->targ_lun,
- (reqp->dr_flag & DRIVER_NOINT) ? 0 : 1);
- cnt = 1;
- phase = PH_MSGOUT;
-
- /*
- * Since we followed the SCSI-spec and raised ATN while SEL was true
- * but before BSY was false during the selection, a 'MESSAGE OUT'
- * phase should follow. Unfortunately, this does not happen on
- * all targets (Asante ethernet devices, for example), so we must
- * check the actual mode if the message transfer fails--if the
- * new phase is PH_CMD and has never been successfully selected
- * w/ATN in the past, then we assume that it is an old device
- * that doesn't support select w/ATN.
- */
- if (transfer_pio(&phase, tmp, &cnt, 0) || cnt) {
-
- if ((phase == PH_CMD) && !(sc->sc_selected & targ_bit)) {
- DBG_SELPRINT ("Target %d: not responding to ATN.\n",
- reqp->targ_id);
- sc->sc_noselatn |= targ_bit;
- reqp->phase = PH_CMD;
- goto identify_failed;
- }
-
- DBG_SELPRINT ("Target %d: failed to send identify\n",
- reqp->targ_id);
- /*
- * Try to disconnect from the target. We cannot leave
- * it just hanging here.
- */
- if (!reach_msg_out(sc, sizeof(struct scsi_generic))) {
- u_long len = 1;
- u_char phase = PH_MSGOUT;
- u_char msg = MSG_ABORT;
-
- transfer_pio(&phase, &msg, &len, 0);
- }
- else scsi_reset(sc);
-
- SET_5380_REG(NCR5380_ICOM, 0);
- reqp->xs->error = code ? code : XS_DRIVER_STUFFUP;
- finish_req(reqp);
- PID("scsi_select9");
- return (0);
- }
- reqp->phase = PH_MSGOUT;
-
-identify_failed:
- sc->sc_selected |= targ_bit;
-
-#ifdef notyet /* LWP: Do we need timeouts in the driver? */
- /*
- * Command is connected, start timer ticking.
- */
- ccb_p->xtimeout = ccb_p->timeout + Lbolt;
-#endif
-
- connected = reqp;
- busy |= targ_bit;
- PID("scsi_select10");
- return (0);
-}
-
-/*
- * Return codes:
- * -1: quit main, trigger on interrupt
- * 0: keep on running main.
- */
-static int
-information_transfer()
-{
- SC_REQ *reqp = connected;
- u_char tmp, phase;
- u_long len;
-
- PID("info_transf1");
- /*
- * Clear pending interrupts from 5380-chip.
- */
- scsi_clr_ipend();
-
- /*
- * We only have a valid SCSI-phase when REQ is asserted. Something
- * is deadly wrong when BSY has dropped.
- */
- tmp = GET_5380_REG(NCR5380_IDSTAT);
-
- if (!(tmp & SC_S_BSY)) {
- busy &= ~(1 << reqp->targ_id);
- connected = NULL;
- reqp->xs->error = XS_BUSY;
- finish_req(reqp);
- PID("info_transf2");
- return (0);
- }
-
- if (tmp & SC_S_REQ) {
- phase = (tmp >> 2) & 7;
- if (phase != reqp->phase) {
- reqp->phase = phase;
- DBG_INFPRINT(show_phase, reqp, phase);
- }
- }
- else return (-1);
-
- switch (phase) {
- case PH_DATAOUT:
-#ifdef DBG_NOWRITE
- ncr_tprint(reqp, "NOWRITE set -- write attempt aborted.");
- reqp->msgout = MSG_ABORT;
- SET_5380_REG(NCR5380_ICOM, SC_A_ATN);
- return (-1);
-#endif /* DBG_NOWRITE */
- /*
- * If this is the first write using DMA, fill
- * the bounce buffer.
- */
- if (reqp->xdata_ptr == reqp->xs->data) { /* XXX */
- if (reqp->dr_flag & DRIVER_BOUNCING)
- bcopy(reqp->xdata_ptr, reqp->bounceb, reqp->xdata_len);
- }
-
- case PH_DATAIN:
-#ifdef REAL_DMA
- if (reqp->dr_flag & DRIVER_DMAOK) {
- int poll = REAL_DMA_POLL|(reqp->dr_flag & DRIVER_NOINT);
- transfer_dma(reqp, phase, poll);
- if (!poll)
- return (0);
- }
- else
-#endif
- {
- PID("info_transf3");
- len = reqp->xdata_len;
-#ifdef USE_PDMA
- if (transfer_pdma(&phase, reqp->xdata_ptr, &len) == 0)
- return (0);
-#else
- transfer_pio(&phase, reqp->xdata_ptr, &len, 0);
-#endif
- reqp->xdata_ptr += reqp->xdata_len - len;
- reqp->xdata_len = len;
- }
- return (-1);
- case PH_MSGIN:
- /*
- * We only expect single byte messages here.
- */
- len = 1;
- transfer_pio(&phase, &tmp, &len, 1);
- reqp->message = tmp;
- return (handle_message(reqp, tmp));
- case PH_MSGOUT:
- len = 1;
- transfer_pio(&phase, &reqp->msgout, &len, 0);
- if (reqp->msgout == MSG_ABORT) {
- busy &= ~(1 << reqp->targ_id);
- connected = NULL;
- reqp->xs->error = XS_DRIVER_STUFFUP;
- finish_req(reqp);
- PID("info_transf4");
- return (0);
- }
- reqp->msgout = MSG_NOOP;
- return (-1);
- case PH_CMD :
- len = command_size(reqp->xcmd.opcode);
- transfer_pio(&phase, (u_char *)&reqp->xcmd, &len, 0);
- PID("info_transf5");
- return (-1);
- case PH_STATUS:
- len = 1;
- transfer_pio(&phase, &tmp, &len, 0);
- reqp->status = tmp;
- PID("info_transf6");
- return (-1);
- default :
- ncr_tprint(reqp, "Unknown phase\n");
- }
- PID("info_transf7");
- return (-1);
-}
-
-/*
- * Handle the message 'msg' send to us by the target.
- * Return values:
- * 0 : The current command has completed.
- * -1 : Get on to the next phase.
- */
-static int
-handle_message(reqp, msg)
-SC_REQ *reqp;
-u_int msg;
-{
- int sps;
- SC_REQ *prev, *req;
-
- PID("hmessage1");
- switch (msg) {
- /*
- * Linking lets us reduce the time required to get
- * the next command to the device, skipping the arbitration
- * and selection time. In the current implementation,
- * we merely have to start the next command pointed
- * to by 'next_link'.
- */
- case MSG_LINK_CMD_COMPLETE:
- case MSG_LINK_CMD_COMPLETEF:
- if (reqp->link == NULL) {
- ncr_tprint(reqp, "No link for linked command");
- nack_message(reqp, MSG_ABORT);
- PID("hmessage2");
- return (-1);
- }
- ack_message();
- if (!(reqp->dr_flag & DRIVER_AUTOSEN)) {
- reqp->xs->resid = reqp->xdata_len;
- reqp->xs->error = 0;
- }
-
-#ifdef AUTO_SENSE
- if (check_autosense(reqp, 1) == -1)
- return (-1);
-#endif /* AUTO_SENSE */
-
-#ifdef DBG_REQ
- if (dbg_target_mask & (1 << reqp->targ_id))
- show_request(reqp->link, "LINK");
-#endif
- connected = reqp->link;
-
- /*
- * Unlink the 'linked' request from the issue_q
- */
- sps = splbio();
- prev = NULL;
- req = issue_q;
- for (; req != NULL; prev = req, req = req->next) {
- if (req == connected)
- break;
- }
- if (req == NULL)
- panic("Inconsistent issue_q");
- if (prev == NULL)
- issue_q = req->next;
- else prev->next = req->next;
- req->next = NULL;
- splx(sps);
-
- finish_req(reqp);
- PID("hmessage3");
- return (-1);
- case MSG_ABORT:
- case MSG_CMDCOMPLETE:
- ack_message();
- connected = NULL;
- busy &= ~(1 << reqp->targ_id);
- if (!(reqp->dr_flag & DRIVER_AUTOSEN)) {
- reqp->xs->resid = reqp->xdata_len;
- reqp->xs->error = 0;
- }
-
-#ifdef AUTO_SENSE
- if (check_autosense(reqp, 0) == -1) {
- PID("hmessage4");
- return (0);
- }
-#endif /* AUTO_SENSE */
-
- finish_req(reqp);
- PID("hmessage5");
- return (0);
- case MSG_MESSAGE_REJECT:
- ack_message();
- PID("hmessage6");
- return (-1);
- case MSG_DISCONNECT:
- ack_message();
-#ifdef DBG_REQ
- if (dbg_target_mask & (1 << reqp->targ_id))
- show_request(reqp, "DISCON");
-#endif
- sps = splbio();
- connected = NULL;
- reqp->next = discon_q;
- discon_q = reqp;
- splx(sps);
- PID("hmessage7");
- return (0);
- case MSG_SAVEDATAPOINTER:
- case MSG_RESTOREPOINTERS:
- /*
- * We save pointers implicitely at disconnect.
- * So we can ignore these messages.
- */
- ack_message();
- PID("hmessage8");
- return (-1);
- case MSG_EXTENDED:
- nack_message(reqp, MSG_MESSAGE_REJECT);
- PID("hmessage9");
- return (-1);
- default:
- ncr_tprint(reqp, "Unknown message %x\n", msg);
- return (-1);
- }
- PID("hmessage10");
- return (-1);
-}
-
-/*
- * Handle reselection. If a valid reconnection occurs, connected
- * points at the reconnected command. The command is removed from the
- * disconnected queue.
- */
-static void
-reselect(sc)
-struct ncr_softc *sc;
-{
- u_char phase;
- u_long len;
- u_char msg;
- u_char target_mask;
- int abort = 0;
- SC_REQ *tmp, *prev;
-
- PID("reselect1");
- target_mask = GET_5380_REG(NCR5380_DATA) & ~SC_HOST_ID;
-
- /*
- * At this point, we have detected that our SCSI-id is on the bus,
- * SEL is true and BSY was false for at least one bus settle
- * delay (400 ns.).
- * We must assert BSY ourselves, until the target drops the SEL signal.
- * The SCSI-spec specifies no maximum time for this, so we have to
- * choose something long enough to suit all targets.
- */
- SET_5380_REG(NCR5380_ICOM, SC_A_BSY);
- len = 250000;
- while ((GET_5380_REG(NCR5380_IDSTAT) & SC_S_SEL) && (len > 0)) {
- delay(1);
- len--;
- }
- if (GET_5380_REG(NCR5380_IDSTAT) & SC_S_SEL) {
- /* Damn SEL isn't dropping */
- scsi_reset(sc);
- return;
- }
-
- SET_5380_REG(NCR5380_ICOM, 0);
-
- /*
- * Check if the reselection is still valid. Check twice because
- * of possible line glitches - cheaper than delay(1) and we need
- * only a few nanoseconds.
- */
- if (!(GET_5380_REG(NCR5380_IDSTAT) & SC_S_BSY)) {
- if (!(GET_5380_REG(NCR5380_IDSTAT) & SC_S_BSY)) {
- ncr_aprint(sc, "Stepped into the reselection timeout\n");
- return;
- }
- }
-
- /*
- * Get the expected identify message.
- */
- phase = PH_MSGIN;
- len = 1;
- transfer_pio(&phase, &msg, &len, 0);
- if (len || !MSG_ISIDENTIFY(msg)) {
- ncr_aprint(sc, "Expecting IDENTIFY, got 0x%x\n", msg);
- abort = 1;
- }
- else {
- /*
- * Find the command reconnecting
- */
- for (tmp = discon_q, prev = NULL; tmp; prev = tmp, tmp = tmp->next){
- if (target_mask == (1 << tmp->targ_id)) {
- if (prev)
- prev->next = tmp->next;
- else discon_q = tmp->next;
- tmp->next = NULL;
- break;
- }
- }
- if (tmp == NULL) {
- ncr_aprint(sc, "No disconnected job for targetmask %x\n",
- target_mask);
- abort = 1;
- }
- }
- if (abort) {
- msg = MSG_ABORT;
- len = 1;
- phase = PH_MSGOUT;
-
- SET_5380_REG(NCR5380_ICOM, SC_A_ATN);
- if (transfer_pio(&phase, &msg, &len, 0) || len)
- scsi_reset(sc);
- }
- else {
- connected = tmp;
-#ifdef DBG_REQ
- if (dbg_target_mask & (1 << tmp->targ_id))
- show_request(tmp, "RECON");
-#endif
- }
- PID("reselect2");
-}
-
-/*
- * Transfer data in a given phase using programmed I/O.
- * Returns -1 when a different phase is entered without transferring the
- * maximum number of bytes, 0 if all bytes transferred or exit is in the same
- * phase.
- */
-static int
-transfer_pio(phase, data, len, dont_drop_ack)
-u_char *phase;
-u_char *data;
-u_long *len;
-int dont_drop_ack;
-{
- u_int cnt = *len;
- u_char ph = *phase;
- u_char tmp, new_icom;
-
- DBG_PIOPRINT ("SCSI: transfer_pio start: phase: %d, len: %d\n", ph,cnt);
- PID("tpio1");
- SET_5380_REG(NCR5380_TCOM, ph);
- do {
- if (!wait_req_true()) {
- DBG_PIOPRINT ("SCSI: transfer_pio: missing REQ\n", 0, 0);
- break;
- }
- if (((GET_5380_REG(NCR5380_IDSTAT) >> 2) & 7) != ph) {
- DBG_PIOPRINT ("SCSI: transfer_pio: phase mismatch\n", 0, 0);
- break;
- }
- if (PH_IN(ph)) {
- *data++ = GET_5380_REG(NCR5380_DATA);
- SET_5380_REG(NCR5380_ICOM, SC_A_ACK);
- if ((cnt == 1) && dont_drop_ack)
- new_icom = SC_A_ACK;
- else new_icom = 0;
- }
- else {
- SET_5380_REG(NCR5380_DATA, *data++);
-
- /*
- * The SCSI-standard suggests that in the 'MESSAGE OUT' phase,
- * the initiator should drop ATN on the last byte of the
- * message phase after REQ has been asserted for the handshake
- * but before the initiator raises ACK.
- */
- if (!( (ph == PH_MSGOUT) && (cnt > 1) )) {
- SET_5380_REG(NCR5380_ICOM, SC_ADTB);
- SET_5380_REG(NCR5380_ICOM, SC_ADTB | SC_A_ACK);
- new_icom = 0;
- }
- else {
- SET_5380_REG(NCR5380_ICOM, SC_ADTB | SC_A_ATN);
- SET_5380_REG(NCR5380_ICOM, SC_ADTB|SC_A_ATN|SC_A_ACK);
- new_icom = SC_A_ATN;
- }
- }
- if (!wait_req_false()) {
- DBG_PIOPRINT ("SCSI: transfer_pio - REQ not dropping\n", 0, 0);
- break;
- }
- SET_5380_REG(NCR5380_ICOM, new_icom);
-
- } while (--cnt);
-
- if ((tmp = GET_5380_REG(NCR5380_IDSTAT)) & SC_S_REQ)
- *phase = (tmp >> 2) & 7;
- else *phase = NR_PHASE;
- *len = cnt;
- DBG_PIOPRINT ("SCSI: transfer_pio done: phase: %d, len: %d\n",
- *phase, cnt);
- PID("tpio2");
- if (!cnt || (*phase == ph))
- return (0);
- return (-1);
-}
-
-#ifdef REAL_DMA
-/*
- * Start a DMA-transfer on the device using the current pointers.
- * If 'poll' is true, the function busy-waits until DMA has completed.
- */
-static void
-transfer_dma(reqp, phase, poll)
-SC_REQ *reqp;
-u_int phase;
-int poll;
-{
- int dma_done;
- u_char mbase = 0;
- int sps;
-
-again:
- PID("tdma1");
-
- /*
- * We should be in phase, otherwise we are not allowed to
- * drive the bus.
- */
- SET_5380_REG(NCR5380_TCOM, phase);
-
- /*
- * Defer interrupts until DMA is fully running.
- */
- sps = splbio();
-
- /*
- * Clear pending interrupts and parity errors.
- */
- scsi_clr_ipend();
-
- if (!poll) {
- /*
- * Enable SCSI interrupts and set IN_DMA flag, set 'mbase'
- * to the interrupts we want enabled.
- */
- scsi_ienable();
- reqp->dr_flag |= DRIVER_IN_DMA;
- mbase = SC_E_EOPI | SC_MON_BSY;
- }
- else scsi_idisable();
- mbase |= IMODE_BASE | SC_M_DMA;
- scsi_dma_setup(reqp, phase, mbase);
-
- splx(sps);
-
- if (poll) {
- /*
- * On polled-dma transfers, we wait here until the
- * 'end-of-dma' condition occurs.
- */
- poll_edma(reqp);
- if (!(dma_done = dma_ready()))
- goto again;
- }
- PID("tdma2");
-}
-
-/*
- * Check results of a DMA data-transfer.
- */
-static int
-dma_ready()
-{
- SC_REQ *reqp = connected;
- int dmstat, is_edma;
- long bytes_left, bytes_done;
-
- is_edma = get_dma_result(reqp, &bytes_left);
- dmstat = GET_5380_REG(NCR5380_DMSTAT);
-
- /*
- * Check if the call is sensible and not caused by any spurious
- * interrupt.
- */
- if (!is_edma && !(dmstat & (SC_END_DMA|SC_BSY_ERR))
- && (dmstat & SC_PHS_MTCH) ) {
- ncr_tprint(reqp, "dma_ready: spurious call "
- "(dm:%x,last_hit: %s)\n",
-#ifdef DBG_PID
- dmstat, last_hit[DBG_PID-1]);
-#else
- dmstat, "unknown");
-#endif
- return (0);
- }
-
- /*
- * Clear all (pending) interrupts.
- */
- scsi_clr_ipend();
-
- /*
- * Update various transfer-pointers/lengths
- */
- bytes_done = reqp->dm_cur->dm_count - bytes_left;
-
- if ((reqp->dr_flag & DRIVER_BOUNCING) && (PH_IN(reqp->phase))) {
- /*
- * Copy the bytes read until now from the bounce buffer
- * to the 'real' destination. Flush the data-cache
- * before copying.
- */
- PCIA();
- bcopy(reqp->bouncerp, reqp->xdata_ptr, bytes_done);
- reqp->bouncerp += bytes_done;
- }
-
- reqp->xdata_ptr = &reqp->xdata_ptr[bytes_done]; /* XXX */
- reqp->xdata_len -= bytes_done; /* XXX */
- if ((reqp->dm_cur->dm_count -= bytes_done) == 0)
- reqp->dm_cur++;
- else reqp->dm_cur->dm_addr += bytes_done;
-
- if (PH_IN(reqp->phase) && (dmstat & SC_PAR_ERR)) {
- if (!(ncr5380_no_parchk & (1 << reqp->targ_id)))
- /* XXX: Should be parity error ???? */
- reqp->xs->error = XS_DRIVER_STUFFUP;
- }
-
- /*
- * DMA mode should always be reset even when we will continue with the
- * next chain. It is also essential to clear the MON_BUSY because
- * when LOST_BUSY is unexpectedly set, we will not be able to drive
- * the bus....
- */
- SET_5380_REG(NCR5380_MODE, IMODE_BASE);
-
-
- if ((dmstat & SC_BSY_ERR) || !(dmstat & SC_PHS_MTCH)
- || (reqp->dm_cur > reqp->dm_last) || (reqp->xs->error)) {
-
- /*
- * Tell interrupt functions DMA mode has ended.
- */
- reqp->dr_flag &= ~DRIVER_IN_DMA;
-
- /*
- * Clear mode and icom
- */
- SET_5380_REG(NCR5380_MODE, IMODE_BASE);
- SET_5380_REG(NCR5380_ICOM, 0);
-
- if (dmstat & SC_BSY_ERR) {
- if (!reqp->xs->error)
- reqp->xs->error = XS_BUSY;
- finish_req(reqp);
- PID("dma_ready1");
- return (1);
- }
-
- if (reqp->xs->error != 0) {
-ncr_tprint(reqp, "dma-ready: code = %d\n", reqp->xs->error); /* LWP */
- reqp->msgout = MSG_ABORT;
- SET_5380_REG(NCR5380_ICOM, SC_A_ATN);
- }
- PID("dma_ready2");
- return (1);
- }
- return (0);
-}
-#endif /* REAL_DMA */
-
-static int
-check_autosense(reqp, linked)
-SC_REQ *reqp;
-int linked;
-{
- int sps;
-
- /*
- * If this is the driver's Link Check for this target, ignore
- * the results of the command. All we care about is whether we
- * got here from a LINK_CMD_COMPLETE or CMD_COMPLETE message.
- */
- PID("linkcheck");
- if (reqp->dr_flag & DRIVER_LINKCHK) {
- if (linked)
- ncr_will_link |= 1<<reqp->targ_id;
- else ncr_tprint(reqp, "Does not support linked commands\n");
- return (0);
- }
- /*
- * If we not executing an auto-sense and the status code
- * is request-sense, we automatically issue a request
- * sense command.
- */
- PID("cautos1");
- if (!(reqp->dr_flag & DRIVER_AUTOSEN)) {
- switch (reqp->status & SCSMASK) {
- case SCSCHKC:
- bcopy(sense_cmd, &reqp->xcmd, sizeof(sense_cmd));
- reqp->xdata_ptr = (u_char *)&reqp->xs->sense;
- reqp->xdata_len = sizeof(reqp->xs->sense);
- reqp->dr_flag |= DRIVER_AUTOSEN;
- reqp->dr_flag &= ~DRIVER_DMAOK;
- if (!linked) {
- sps = splbio();
- reqp->next = issue_q;
- issue_q = reqp;
- splx(sps);
- }
- else reqp->xcmd.bytes[sizeof(sense_cmd)-2] |= 1;
-
-#ifdef DBG_REQ
- bzero(reqp->xdata_ptr, reqp->xdata_len);
- if (dbg_target_mask & (1 << reqp->targ_id))
- show_request(reqp, "AUTO-SENSE");
-#endif
- PID("cautos2");
- return (-1);
- case SCSBUSY:
- reqp->xs->error = XS_BUSY;
- return (0);
- }
- }
- else {
- /*
- * An auto-sense has finished
- */
- if ((reqp->status & SCSMASK) != SCSGOOD)
- reqp->xs->error = XS_DRIVER_STUFFUP; /* SC_E_AUTOSEN; */
- else reqp->xs->error = XS_SENSE;
- reqp->status = SCSCHKC;
- }
- PID("cautos3");
- return (0);
-}
-
-static int
-reach_msg_out(sc, len)
-struct ncr_softc *sc;
-u_long len;
-{
- u_char phase;
- u_char data;
-
- ncr_aprint(sc, "Trying to reach Message-out phase\n");
- if ((phase = GET_5380_REG(NCR5380_IDSTAT)) & SC_S_REQ)
- phase = (phase >> 2) & 7;
- else return (-1);
- ncr_aprint(sc, "Trying to reach Message-out phase, now: %d\n", phase);
- if (phase == PH_MSGOUT)
- return (0);
-
- SET_5380_REG(NCR5380_TCOM, phase);
-
- do {
- if (!wait_req_true())
- break;
- if (((GET_5380_REG(NCR5380_IDSTAT) >> 2) & 7) != phase)
- break;
- if (PH_IN(phase)) {
- data = GET_5380_REG(NCR5380_DATA);
- SET_5380_REG(NCR5380_ICOM, SC_A_ACK | SC_A_ATN);
- }
- else {
- SET_5380_REG(NCR5380_DATA, 0);
- SET_5380_REG(NCR5380_ICOM, SC_ADTB|SC_A_ACK|SC_A_ATN);
- }
- if (!wait_req_false())
- break;
- SET_5380_REG(NCR5380_ICOM, SC_A_ATN);
- } while (--len);
-
- if ((phase = GET_5380_REG(NCR5380_IDSTAT)) & SC_S_REQ) {
- phase = (phase >> 2) & 7;
- if (phase == PH_MSGOUT) {
- ncr_aprint(sc, "Message-out phase reached.\n");
- return (0);
- }
- }
- return (-1);
-}
-
-static void
-scsi_reset(sc)
-struct ncr_softc *sc;
-{
- SC_REQ *tmp, *next;
- int sps;
-
- ncr_aprint(sc, "Resetting SCSI-bus\n");
-
- PID("scsi_reset1");
- sps = splbio();
- SET_5380_REG(NCR5380_ICOM, SC_A_RST);
- delay(1);
- SET_5380_REG(NCR5380_ICOM, 0);
-
- /*
- * None of the jobs in the discon_q will ever be reconnected,
- * notify this to the higher level code.
- */
- for (tmp = discon_q; tmp ;) {
- next = tmp->next;
- tmp->next = NULL;
- tmp->xs->error = XS_TIMEOUT;
- busy &= ~(1 << tmp->targ_id);
- finish_req(tmp);
- tmp = next;
- }
- discon_q = NULL;
-
- /*
- * The current job will never finish either.
- * The problem is that we can't finish the job because an instance
- * of main is running on it. Our best guess is that the job is currently
- * doing REAL-DMA. In that case 'dma_ready()' should correctly finish
- * the job because it detects BSY-loss.
- */
- if (tmp = connected) {
- if (tmp->dr_flag & DRIVER_IN_DMA) {
- tmp->xs->error = XS_DRIVER_STUFFUP;
-#ifdef REAL_DMA
- dma_ready();
-#endif
- }
- }
- splx(sps);
- PID("scsi_reset2");
-}
-
-/*
- * Check validity of the IRQ set by the 5380. If the interrupt is valid,
- * the appropriate action is carried out (reselection or DMA ready) and
- * INTR_RESEL or INTR_DMA is returned. Otherwise a console notice is written
- * and INTR_SPURIOUS is returned.
- */
-static int
-check_intr(sc)
-struct ncr_softc *sc;
-{
- SC_REQ *reqp;
-
- if ((GET_5380_REG(NCR5380_IDSTAT) & (SC_S_SEL|SC_S_IO))
- ==(SC_S_SEL|SC_S_IO))
- return (INTR_RESEL);
- else {
- if ((reqp = connected) && (reqp->dr_flag & DRIVER_IN_DMA)){
- reqp->dr_flag &= ~DRIVER_IN_DMA;
- return (INTR_DMA);
- }
- }
- scsi_clr_ipend();
- printf("-->");
- scsi_show();
- ncr_aprint(sc, "Spurious interrupt.\n");
- return (INTR_SPURIOUS);
-}
-
-#ifdef REAL_DMA
-/*
- * Check if DMA can be used for this request. This function also builds
- * the dma-chain.
- */
-static int
-scsi_dmaok(reqp)
-SC_REQ *reqp;
-{
- u_long phy_buf;
- u_long phy_len;
- void *req_addr;
- u_long req_len;
- struct dma_chain *dm;
-
- /*
- * Initialize locals and requests' DMA-chain.
- */
- req_len = reqp->xdata_len;
- req_addr = (void*)reqp->xdata_ptr;
- dm = reqp->dm_cur = reqp->dm_last = reqp->dm_chain;
- dm->dm_count = dm->dm_addr = 0;
- reqp->dr_flag &= ~DRIVER_BOUNCING;
-
- /*
- * Do not accept zero length DMA.
- */
- if (req_len == 0)
- return (0);
-
- /*
- * LWP: I think that this restriction is not strictly nessecary.
- */
- if ((req_len & 0x1) || ((u_int)req_addr & 0x3))
- return (0);
-
- /*
- * Build the DMA-chain.
- */
- dm->dm_addr = phy_buf = kvtop(req_addr);
- while (req_len) {
- if (req_len < (phy_len = NBPG - ((u_long)req_addr & PGOFSET)))
- phy_len = req_len;
-
- req_addr += phy_len;
- req_len -= phy_len;
- dm->dm_count += phy_len;
-
- if (req_len) {
- u_long tmp = kvtop(req_addr);
-
- if ((phy_buf + phy_len) != tmp) {
- if (wrong_dma_range(reqp, dm)) {
- if (reqp->dr_flag & DRIVER_BOUNCING)
- goto bounceit;
- return (0);
- }
-
- if (++dm >= &reqp->dm_chain[MAXDMAIO]) {
- ncr_tprint(reqp,"dmaok: DMA chain too long!\n");
- return (0);
- }
- dm->dm_count = 0;
- dm->dm_addr = tmp;
- }
- phy_buf = tmp;
- }
- }
- if (wrong_dma_range(reqp, dm)) {
- if (reqp->dr_flag & DRIVER_BOUNCING)
- goto bounceit;
- return (0);
- }
- reqp->dm_last = dm;
- return (1);
-
-bounceit:
- if ((reqp->bounceb = alloc_bounceb(reqp->xdata_len)) == NULL) {
- /*
- * If we can't get a bounce buffer, forget DMA
- */
- reqp->dr_flag &= ~DRIVER_BOUNCING;
- return(0);
- }
- /*
- * Initialize a single DMA-range containing the bounced request
- */
- dm = reqp->dm_cur = reqp->dm_last = reqp->dm_chain;
- dm->dm_addr = kvtop(reqp->bounceb);
- dm->dm_count = reqp->xdata_len;
- reqp->bouncerp = reqp->bounceb;
-
- return (1);
-}
-#endif /* REAL_DMA */
-
-static void
-run_main(sc)
-struct ncr_softc *sc;
-{
- int sps = splbio();
-
- if (!main_running) {
- /*
- * If shared resources are required, claim them
- * before entering 'scsi_main'. If we can't get them
- * now, assume 'run_main' will be called when the resource
- * becomes available.
- */
- if (!claimed_dma()) {
- splx(sps);
- return;
- }
- main_running = 1;
- splx(sps);
- scsi_main(sc);
- }
- else splx(sps);
-}
-
-/*
- * Prefix message with full target info.
- */
-static void
-ncr_tprint(SC_REQ *reqp, char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- sc_print_addr(reqp->xs->sc_link);
- printf("%r", fmt, ap);
- va_end(ap);
-}
-
-/*
- * Prefix message with adapter info.
- */
-static void
-ncr_aprint(struct ncr_softc *sc, char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- printf("%s : %r", sc->sc_dev.dv_xname, fmt, ap);
- va_end(ap);
-}
-/****************************************************************************
- * Start Debugging Functions *
- ****************************************************************************/
-static void
-show_data_sense(xs)
-struct scsi_xfer *xs;
-{
- u_char *p1, *p2;
- int i;
- int sz;
-
- p1 = (u_char *) xs->cmd;
- p2 = (u_char *)&xs->sense;
- if(*p2 == 0)
- return; /* No(n)sense */
- printf("cmd[%d,%d]: ", xs->cmdlen, sz = command_size(*p1));
- for (i = 0; i < sz; i++)
- printf("%x ", p1[i]);
- printf("\nsense: ");
- for (i = 0; i < sizeof(xs->sense); i++)
- printf("%x ", p2[i]);
- printf("\n");
-}
-
-static void
-show_request(reqp, qtxt)
-SC_REQ *reqp;
-char *qtxt;
-{
- printf("REQ-%s: %d %x[%d] cmd[0]=%x S=%x M=%x R=%x resid=%d dr_flag=%x %s\n",
- qtxt, reqp->targ_id, reqp->xdata_ptr, reqp->xdata_len,
- reqp->xcmd.opcode, reqp->status, reqp->message,
- reqp->xs->error, reqp->xs->resid, reqp->dr_flag,
- reqp->link ? "L":"");
- if (reqp->status == SCSCHKC)
- show_data_sense(reqp->xs);
-}
-
-static char *sig_names[] = {
- "PAR", "SEL", "I/O", "C/D", "MSG", "REQ", "BSY", "RST",
- "ACK", "ATN", "LBSY", "PMATCH", "IRQ", "EPAR", "DREQ", "EDMA"
-};
-
-static void
-show_signals(dmstat, idstat)
-u_char dmstat, idstat;
-{
- u_short tmp, mask;
- int i, j, need_pipe;
-
- tmp = idstat | ((dmstat & 3) << 8);
- printf("Bus signals (%02x/%02x): ", idstat, dmstat & 3);
- for (mask = 1, j = need_pipe = 0; mask <= tmp; mask <<= 1, j++) {
- if (tmp & mask)
- printf("%s%s", need_pipe++ ? "|" : "", sig_names[j]);
- }
- printf("\nDma status (%02x): ", dmstat);
- for (mask = 4, j = 10, need_pipe = 0; mask <= dmstat; mask <<= 1, j++) {
- if (dmstat & mask)
- printf("%s%s", need_pipe++ ? "|" : "", sig_names[j]);
- }
- printf("\n");
-}
-
-scsi_show()
-{
- SC_REQ *tmp;
- int sps = splhigh();
- u_char idstat, dmstat;
- int i;
-
- for (tmp = issue_q; tmp; tmp = tmp->next)
- show_request(tmp, "ISSUED");
- for (tmp = discon_q; tmp; tmp = tmp->next)
- show_request(tmp, "DISCONNECTED");
- if (connected)
- show_request(connected, "CONNECTED");
- idstat = GET_5380_REG(NCR5380_IDSTAT);
- dmstat = GET_5380_REG(NCR5380_DMSTAT);
- show_signals(dmstat, idstat);
- if (connected)
- printf("phase = %d, ", connected->phase);
- printf("busy:%x, spl:%04x\n", busy, sps);
-#ifdef DBG_PID
- for (i=0; i<DBG_PID; i++)
- printf("\t%d\t%s\n", i, last_hit[i]);
-#endif
-
- splx(sps);
-}
diff --git a/sys/arch/atari/dev/ncr5380reg.h b/sys/arch/atari/dev/ncr5380reg.h
deleted file mode 100644
index e563e16c854..00000000000
--- a/sys/arch/atari/dev/ncr5380reg.h
+++ /dev/null
@@ -1,259 +0,0 @@
-/* $NetBSD: ncr5380reg.h,v 1.6 1995/12/18 20:37:54 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _NCR5380REG_H
-#define _NCR5380REG_H
-/*
- * NCR5380 common interface definitions.
- */
-
-/*
- * Register numbers: (first argument to GET/SET_5380_REG )
- */
-#define NCR5380_DATA 0 /* Data register */
-#define NCR5380_ICOM 1 /* Initiator command register */
-#define NCR5380_MODE 2 /* Mode register */
-#define NCR5380_TCOM 3 /* Target command register */
-#define NCR5380_IDSTAT 4 /* Bus status register */
-#define NCR5380_DMSTAT 5 /* DMA status register */
-#define NCR5380_TRCV 6 /* Target receive register */
-#define NCR5380_IRCV 7 /* Initiator receive register */
-
-/*
- * Definitions for Initiator command register.
- */
-#define SC_A_RST 0x80 /* RW - Assert RST */
-#define SC_TEST 0x40 /* W - Test mode */
-#define SC_AIP 0x40 /* R - Arbitration in progress */
-#define SC_LA 0x20 /* R - Lost arbitration */
-#define SC_A_ACK 0x10 /* RW - Assert ACK */
-#define SC_A_BSY 0x08 /* RW - Assert BSY */
-#define SC_A_SEL 0x04 /* RW - Assert SEL */
-#define SC_A_ATN 0x02 /* RW - Assert ATN */
-#define SC_ADTB 0x01 /* RW - Assert Data To Bus */
-
-/*
- * Definitions for mode register
- */
-#define SC_B_DMA 0x80 /* RW - Block mode DMA (not on TT!) */
-#define SC_T_MODE 0x40 /* RW - Target mode */
-#define SC_E_PAR 0x20 /* RW - Enable parity check */
-#define SC_E_PARI 0x10 /* RW - Enable parity interrupt */
-#define SC_E_EOPI 0x08 /* RW - Enable End Of Process Interrupt */
-#define SC_MON_BSY 0x04 /* RW - Monitor BSY */
-#define SC_M_DMA 0x02 /* RW - Set DMA mode */
-#define SC_ARBIT 0x01 /* RW - Arbitrate */
-
-/*
- * Definitions for tcom register
- */
-#define SC_LBS 0x80 /* RW - Last Byte Send (not on TT!) */
-#define SC_A_REQ 0x08 /* RW - Assert REQ */
-#define SC_A_MSG 0x04 /* RW - Assert MSG */
-#define SC_A_CD 0x02 /* RW - Assert C/D */
-#define SC_A_IO 0x01 /* RW - Assert I/O */
-
-/*
- * Definitions for idstat register
- */
-#define SC_S_RST 0x80 /* R - RST is set */
-#define SC_S_BSY 0x40 /* R - BSY is set */
-#define SC_S_REQ 0x20 /* R - REQ is set */
-#define SC_S_MSG 0x10 /* R - MSG is set */
-#define SC_S_CD 0x08 /* R - C/D is set */
-#define SC_S_IO 0x04 /* R - I/O is set */
-#define SC_S_SEL 0x02 /* R - SEL is set */
-#define SC_S_PAR 0x01 /* R - Parity bit */
-
-/*
- * Definitions for dmastat register
- */
-#define SC_END_DMA 0x80 /* R - End of DMA */
-#define SC_DMA_REQ 0x40 /* R - DMA request */
-#define SC_PAR_ERR 0x20 /* R - Parity error */
-#define SC_IRQ_SET 0x10 /* R - IRQ is active */
-#define SC_PHS_MTCH 0x08 /* R - Phase Match */
-#define SC_BSY_ERR 0x04 /* R - Busy error */
-#define SC_ATN_STAT 0x02 /* R - State of ATN line */
-#define SC_ACK_STAT 0x01 /* R - State of ACK line */
-#define SC_S_SEND 0x00 /* W - Start DMA output */
-
-#define SC_CLINT { /* Clear interrupts */ \
- int i = GET_5380_REG(NCR5380_IRCV); \
- }
-
-
-/*
- * Definition of SCSI-bus phases. The values are determined by signals
- * on the SCSI-bus. DO NOT CHANGE!
- * The values must be used to index the pointers in SCSI-PARMS.
- */
-#define NR_PHASE 8
-#define PH_DATAOUT 0
-#define PH_DATAIN 1
-#define PH_CMD 2
-#define PH_STATUS 3
-#define PH_RES1 4
-#define PH_RES2 5
-#define PH_MSGOUT 6
-#define PH_MSGIN 7
-
-#define PH_OUT(phase) (!(phase & 1)) /* TRUE if output phase */
-#define PH_IN(phase) (phase & 1) /* TRUE if input phase */
-
-/*
- * Id of Host-adapter
- */
-#define SC_HOST_ID 0x80
-
-/*
- * Base setting for 5380 mode register
- */
-#define IMODE_BASE SC_E_PAR
-
-/*
- * SCSI completion status codes, should move to sys/scsi/????
- */
-#define SCSMASK 0x1e /* status code mask */
-#define SCSGOOD 0x00 /* good status */
-#define SCSCHKC 0x02 /* check condition */
-#define SCSBUSY 0x08 /* busy status */
-#define SCSCMET 0x04 /* condition met / good */
-
-/*
- * Return values of check_intr()
- */
-#define INTR_SPURIOUS 0
-#define INTR_RESEL 2
-#define INTR_DMA 3
-
-struct ncr_softc {
- struct device sc_dev;
- struct scsi_link sc_link;
-
- /*
- * Some (pre-SCSI2) devices don't support select with ATN.
- * If the device responds to select with ATN by going into
- * command phase (ignoring ATN), then we flag it in the
- * following bitmask.
- * We also keep track of which devices have been selected
- * before. This allows us to not even try raising ATN if
- * the target doesn't respond to it the first time.
- */
- u_int8_t sc_noselatn;
- u_int8_t sc_selected;
-};
-
-/*
- * Max. number of dma-chains per request
- */
-#define MAXDMAIO (MAXPHYS/NBPG + 1)
-
-/*
- * Some requests are not contiguous in physical memory. We need to break them
- * up into contiguous parts for DMA.
- */
-struct dma_chain {
- u_int dm_count;
- u_long dm_addr;
-};
-
-/*
- * Define our issue, free and disconnect queue's.
- */
-typedef struct req_q {
- struct req_q *next; /* next in free, issue or discon queue */
- struct req_q *link; /* next linked command to execute */
- struct scsi_xfer *xs; /* request from high-level driver */
- u_short dr_flag; /* driver state */
- u_char phase; /* current SCSI phase */
- u_char msgout; /* message to send when requested */
- u_char targ_id; /* target for command */
- u_char targ_lun; /* lun for command */
- u_char status; /* returned status byte */
- u_char message; /* returned message byte */
- u_char *bounceb; /* allocated bounce buffer */
- u_char *bouncerp; /* bounce read-pointer */
- struct dma_chain dm_chain[MAXDMAIO];
- struct dma_chain *dm_cur; /* current dma-request */
- struct dma_chain *dm_last; /* last dma-request */
- long xdata_len; /* length of transfer */
- u_char *xdata_ptr; /* virtual address of transfer */
- struct scsi_generic xcmd; /* command to execute */
-} SC_REQ;
-
-/*
- * Values for dr_flag:
- */
-#define DRIVER_IN_DMA 0x01 /* Non-polled DMA activated */
-#define DRIVER_AUTOSEN 0x02 /* Doing automatic sense */
-#define DRIVER_NOINT 0x04 /* We are booting: no interrupts */
-#define DRIVER_DMAOK 0x08 /* DMA can be used on this request */
-#define DRIVER_BOUNCING 0x10 /* Using the bounce buffer */
-#define DRIVER_LINKCHK 0x20 /* Doing the linked command check */
-
-/* XXX: Should go to ncr5380var.h */
-static SC_REQ *issue_q = NULL; /* Commands waiting to be issued*/
-static SC_REQ *discon_q = NULL; /* Commands disconnected */
-static SC_REQ *connected = NULL; /* Command currently connected */
-
-/*
- * Function decls:
- */
-static int transfer_pio __P((u_char *, u_char *, u_long *, int));
-static int wait_req_true __P((void));
-static int wait_req_false __P((void));
-static int scsi_select __P((SC_REQ *, int));
-static int handle_message __P((SC_REQ *, u_int));
-static void ack_message __P((void));
-static void nack_message __P((SC_REQ *, u_char));
-static int information_transfer __P((void));
-static void reselect __P((struct ncr_softc *));
-static int dma_ready __P((void));
-static void transfer_dma __P((SC_REQ *, u_int, int));
-static int check_autosense __P((SC_REQ *, int));
-static int reach_msg_out __P((struct ncr_softc *, u_long));
-static int check_intr __P((struct ncr_softc *));
-static void scsi_reset __P((struct ncr_softc *));
-static int scsi_dmaok __P((SC_REQ *));
-static void run_main __P((struct ncr_softc *));
-static void scsi_main __P((struct ncr_softc *));
-static void ncr_ctrl_intr __P((struct ncr_softc *));
-static void ncr_dma_intr __P((struct ncr_softc *));
-static void ncr_tprint __P((SC_REQ *, char *, ...));
-static void ncr_aprint __P((struct ncr_softc *, char *, ...));
-
-static void show_request __P((SC_REQ *, char *));
-static void show_phase __P((SC_REQ *, int));
-static void show_signals __P((u_char, u_char));
-
-#endif /* _NCR5380REG_H */
diff --git a/sys/arch/atari/dev/nvram.c b/sys/arch/atari/dev/nvram.c
deleted file mode 100644
index 8e67b01e3e5..00000000000
--- a/sys/arch/atari/dev/nvram.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/* $NetBSD: nvram.c,v 1.1 1996/01/06 20:11:08 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Nvram driver
- */
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/buf.h>
-#include <sys/uio.h>
-
-#include <machine/iomap.h>
-
-#include <atari/dev/clockreg.h>
-#include <atari/dev/nvramvar.h>
-
-#include "nvr.h"
-
-#define MC_NVRAM_CSUM (MC_NVRAM_START + MC_NVRAM_SIZE - 2)
-
-#if NNVR > 0
-static void nvram_set_csum __P((u_char csum));
-static int nvram_csum_valid __P((u_char csum));
-static u_char nvram_csum __P((void));
-
-/*
- * Auto config stuff....
- */
-static void nvr_attach __P((struct device *, struct device *, void *));
-static int nvr_match __P((struct device *, struct cfdata *, void *));
-
-struct cfdriver nvrcd = {
- NULL, "nvr", (cfmatch_t)nvr_match, nvr_attach,
- DV_DULL, sizeof(struct nvr_softc), NULL, 0 };
-
-/*ARGSUSED*/
-static int
-nvr_match(pdp, cfp, auxp)
-struct device *pdp;
-struct cfdata *cfp;
-void *auxp;
-{
- if (!strcmp((char *)auxp, "nvr"))
- return (1);
- return (0);
-}
-
-/*ARGSUSED*/
-static void
-nvr_attach(pdp, dp, auxp)
-struct device *pdp, *dp;
-void *auxp;
-{
- struct nvr_softc *nvr_soft;
- int nreg;
-
- /*
- * Check the validity of the NVram contents
- */
- if (!nvram_csum_valid(nvram_csum())) {
- printf(": Invalid checksum - re-initialized");
- for (nreg = MC_NVRAM_START; nreg < MC_NVRAM_CSUM; nreg++)
- mc146818_write(RTC, nreg, 0);
- nvram_set_csum(nvram_csum());
- }
- nvr_soft = nvrcd.cd_devs[0];
- nvr_soft->nvr_flags = NVR_CONFIGURED;
- printf("\n");
-}
-/*
- * End of auto config stuff....
- */
-#endif /* NNVR > 0 */
-
-/*
- * Kernel internal interface
- */
-int
-nvr_get_byte(byteno)
-int byteno;
-{
-#if NNVR > 0
- struct nvr_softc *nvr_soft;
-
- nvr_soft = nvrcd.cd_devs[0];
- if (!(nvr_soft->nvr_flags & NVR_CONFIGURED))
- return(NVR_INVALID);
- return (mc146818_read(RTC, byteno + MC_NVRAM_START) & 0xff);
-#else
- return(NVR_INVALID);
-#endif /* NNVR > 0 */
-}
-
-#if NNVR > 0
-
-nvram_uio(uio)
-struct uio *uio;
-{
- int i;
- off_t offset;
- int nleft;
- u_char buf[MC_NVRAM_CSUM - MC_NVRAM_START + 1];
- u_char *p;
- struct nvr_softc *nvr_soft;
-
- nvr_soft = nvrcd.cd_devs[0];
- if (!(nvr_soft->nvr_flags & NVR_CONFIGURED))
- return ENXIO;
-
-#ifdef NV_DEBUG
- printf("Request to transfer %d bytes offset: %d, %s nvram\n",
- (long)uio->uio_resid, (long)uio->uio_offset,
- (uio->uio_rw == UIO_READ) ? "from" : "to");
-#endif /* NV_DEBUG */
-
- offset = uio->uio_offset + MC_NVRAM_START;
- nleft = uio->uio_resid;
- if (offset + nleft >= MC_NVRAM_CSUM) {
- if (offset == MC_NVRAM_CSUM)
- return (0);
- nleft = MC_NVRAM_CSUM - offset;
- if (nleft <= 0)
- return (EINVAL);
- }
-#ifdef NV_DEBUG
- printf("Translated: offset = %d, bytes: %d\n", (long)offset, nleft);
-#endif /* NV_DEBUG */
-
- if (uio->uio_rw == UIO_READ) {
- for (i = 0, p = buf; i < nleft; i++, p++)
- *p = mc146818_read(RTC, offset + i);
- }
- if (i = uiomove(buf, nleft, uio))
- return (i);
- if (uio->uio_rw == UIO_WRITE) {
- for (i = 0, p = buf; i < nleft; i++, p++)
- mc146818_write(RTC, offset + i, *p);
- nvram_set_csum(nvram_csum());
- }
- return(0);
-}
-
-static u_char
-nvram_csum()
-{
- u_char csum;
- int nreg;
-
- for (csum = 0, nreg = MC_NVRAM_START; nreg < MC_NVRAM_CSUM; nreg++)
- csum += mc146818_read(RTC, nreg);
- return(csum);
-}
-
-static int
-nvram_csum_valid(csum)
-u_char csum;
-{
- if (((~csum & 0xff) != mc146818_read(RTC, MC_NVRAM_CSUM))
- || (csum != mc146818_read(RTC, MC_NVRAM_CSUM + 1)))
- return 0;
- return 1;
-}
-
-static void
-nvram_set_csum(csum)
-u_char csum;
-{
- mc146818_write(RTC, MC_NVRAM_CSUM, ~csum);
- mc146818_write(RTC, MC_NVRAM_CSUM + 1, csum);
-}
-#endif /* NNVR > 0 */
diff --git a/sys/arch/atari/dev/nvramvar.h b/sys/arch/atari/dev/nvramvar.h
deleted file mode 100644
index 0c905de4076..00000000000
--- a/sys/arch/atari/dev/nvramvar.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* $NetBSD: nvramvar.h,v 1.1 1996/01/06 20:11:09 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Nvram driver - variable definitions
- */
-
-struct nvr_softc {
- struct device nvr_dev;
- u_int16_t nvr_flags;
-};
-
-/*
- * nvr_flags
- */
-#define NVR_CONFIGURED 1 /* Configured and valid */
-
-#ifdef _KERNEL
-/*
- * Kernel internal interface to read config info from nvram
- */
-int nvr_get_byte __P((int));
-
-/*
- * Error return from nvr_get_byte
- */
-#define NVR_INVALID (-1)
-#endif /* _KERNEL */
diff --git a/sys/arch/atari/dev/ramd.c b/sys/arch/atari/dev/ramd.c
deleted file mode 100644
index 206d2fa0aa2..00000000000
--- a/sys/arch/atari/dev/ramd.c
+++ /dev/null
@@ -1,506 +0,0 @@
-/* $NetBSD: ramd.c,v 1.6 1996/01/07 22:02:06 thorpej Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/buf.h>
-#include <sys/proc.h>
-#include <sys/device.h>
-#include <sys/ioctl.h>
-#include <sys/fcntl.h>
-#include <sys/conf.h>
-#include <sys/disklabel.h>
-#include <sys/disk.h>
-#include <sys/dkbad.h>
-
-/*
- * Misc. defines:
- */
-#define RAMD_CHUNK (9 * 512) /* Chunk-size for auto-load */
-#define RAMD_NDEV 2 /* Number of devices configured */
-
-struct ramd_info {
- u_long ramd_size; /* Size of disk in bytes */
- u_long ramd_flag; /* see defs below */
- dev_t ramd_dev; /* device to load from */
- u_long ramd_state; /* runtime state see defs below */
- caddr_t ramd_addr; /* Kernel virtual addr */
-};
-
-/*
- * ramd_flag:
- */
-#define RAMD_LOAD 0x01 /* Auto load when first opened */
-#define RAMD_LCOMP 0x02 /* Input is compressed */
-
-/*
- * ramd_state:
- */
-#define RAMD_ALLOC 0x01 /* Memory is allocated */
-#define RAMD_OPEN 0x02 /* Ramdisk is open */
-#define RAMD_INOPEN 0x04 /* Ramdisk is being opened */
-#define RAMD_WANTED 0x08 /* Someone is waiting on struct */
-#define RAMD_LOADED 0x10 /* Ramdisk is properly loaded */
-
-struct ramd_info rd_info[RAMD_NDEV] = {
- {
- 1105920, /* 1Mb in 2160 sectors */
- RAMD_LOAD, /* auto-load this device */
- MAKEDISKDEV(2, 0, 1), /* XXX: This is crap! (720Kb flop) */
- 0, /* Will be set at runtime */
- NULL /* Will be set at runtime */
- },
- {
- 1474560, /* 1.44Mb in 2880 sectors */
- RAMD_LOAD, /* auto-load this device */
- MAKEDISKDEV(2, 0, 1), /* XXX: This is crap! (720Kb flop) */
- 0, /* Will be set at runtime */
- NULL /* Will be set at runtime */
- }
-};
-
-struct read_info {
- struct buf *bp; /* buffer for strategy function */
- long nbytes; /* total number of bytes to read */
- long offset; /* offset in input medium */
- caddr_t bufp; /* current output buffer */
- caddr_t ebufp; /* absolute maximum for bufp */
- int chunk; /* chunk size on input medium */
- int media_sz; /* size of input medium */
- void (*strat)(); /* strategy function for read */
-};
-
-static struct disk ramd_disks[RAMD_NDEV]; /* XXX Ick. */
-
-/*
- * Autoconfig stuff....
- */
-static int ramdmatch __P((struct device *, struct cfdata *, void *));
-static int ramdprint __P((void *, const char *));
-static void ramdattach __P((struct device *, struct device *, void *));
-
-struct cfdriver ramdcd = {
- NULL, "rd", (cfmatch_t)ramdmatch, ramdattach, DV_DULL,
- sizeof(struct device), NULL, 0 };
-
-void rdstrategy __P((struct buf *));
-
-struct dkdriver ramddkdriver = { rdstrategy };
-
-static int
-ramdmatch(pdp, cfp, auxp)
-struct device *pdp;
-struct cfdata *cfp;
-void *auxp;
-{
- if(strcmp("rd", auxp) || (cfp->cf_unit >= RAMD_NDEV))
- return(0);
- return(1);
-}
-
-static void
-ramdattach(pdp, dp, auxp)
-struct device *pdp, *dp;
-void *auxp;
-{
- int i;
- struct disk *diskp;
-
- /*
- * XXX It's not really clear to me _exactly_ what's going
- * on here, so this might need to be adjusted. --thorpej
- */
-
- for(i = 0; i < RAMD_NDEV; i++) {
- /*
- * Initialize and attach the disk structure.
- */
- diskp = &ramd_disks[i];
- bzero(diskp, sizeof(struct disk));
- if ((diskp->dk_name = malloc(8, M_DEVBUF, M_NOWAIT)) == NULL)
- panic("ramdattach: can't allocate space for name");
- bzero(diskp->dk_name, 8);
- sprintf(diskp->dk_name, "rd%d", i);
- diskp->dk_driver = &ramddkdriver;
- disk_attach(diskp);
-
- config_found(dp, (void*)i, ramdprint);
- }
-}
-
-static int
-ramdprint(auxp, pnp)
-void *auxp;
-const char *pnp;
-{
- return(UNCONF);
-}
-
-static int loaddisk __P((struct ramd_info *, struct proc *));
-static int ramd_norm_read __P((struct read_info *));
-static int cpy_uncompressed __P((caddr_t, int, struct read_info *));
-static int rd_compressed __P((caddr_t, int, struct read_info *));
-
-int
-rdopen(dev, flags, devtype, p)
-dev_t dev;
-int flags, devtype;
-struct proc *p;
-{
- struct ramd_info *ri;
- int s;
- int error = 0;
-
- if(DISKUNIT(dev) >= RAMD_NDEV)
- return(ENXIO);
-
- ri = &rd_info[DISKUNIT(dev)];
- if(ri->ramd_state & RAMD_OPEN)
- return(0);
-
- /*
- * If someone is busy opening, wait for it to complete.
- */
- s = splbio();
- while(ri->ramd_state & RAMD_INOPEN) {
- ri->ramd_state |= RAMD_WANTED;
- tsleep((caddr_t)ri, PRIBIO, "rdopen", 0);
- }
- ri->ramd_state |= RAMD_INOPEN;
- splx(s);
-
- if(!(ri->ramd_state & RAMD_ALLOC)) {
- ri->ramd_addr = malloc(ri->ramd_size, M_DEVBUF, M_WAITOK);
- if(ri->ramd_addr == NULL) {
- error = ENXIO;
- goto done;
- }
- ri->ramd_state |= RAMD_ALLOC;
- }
- if((ri->ramd_flag & RAMD_LOAD) && !(ri->ramd_state & RAMD_LOADED)) {
- error = loaddisk(ri, p);
- if(!error)
- ri->ramd_state |= RAMD_LOADED;
- }
-done:
- ri->ramd_state &= ~RAMD_INOPEN;
- if(ri->ramd_state & RAMD_WANTED) {
- ri->ramd_state &= ~RAMD_WANTED;
- wakeup((caddr_t)ri);
- }
- return(error);
-}
-
-int
-rdclose(dev, flags, devtype, p)
-dev_t dev;
-int flags, devtype;
-struct proc *p;
-{
- return(0);
-}
-
-int
-rdioctl(dev, cmd, addr, flag, p)
-dev_t dev;
-u_long cmd;
-int flag;
-caddr_t addr;
-struct proc *p;
-{
- return(ENOTTY);
-}
-
-/*
- * no dumps to ram disks thank you.
- */
-int
-rdsize(dev)
-dev_t dev;
-{
- return(-1);
-}
-
-void
-rdstrategy(bp)
-struct buf *bp;
-{
- struct ramd_info *ri;
- long maxsz, sz;
- char *datap;
-
- ri = &rd_info[DISKUNIT(bp->b_dev)];
-
- maxsz = ri->ramd_size / DEV_BSIZE;
- sz = (bp->b_bcount + DEV_BSIZE - 1) / DEV_BSIZE;
- if (bp->b_blkno < 0 || bp->b_blkno + sz > maxsz) {
- if((bp->b_blkno == maxsz) && (bp->b_flags & B_READ)) {
- /* Hitting EOF */
- bp->b_resid = bp->b_bcount;
- goto done;
- }
- sz = maxsz - bp->b_blkno;
- if((sz <= 0) || (bp->b_blkno < 0)) {
- bp->b_error = EINVAL;
- bp->b_flags |= B_ERROR;
- goto done;
- }
- bp->b_bcount = sz * DEV_BSIZE;
- }
- datap = (char*)((u_long)ri->ramd_addr + bp->b_blkno * DEV_BSIZE);
- if(bp->b_flags & B_READ)
- bcopy(datap, bp->b_data, bp->b_bcount);
- else bcopy(bp->b_data, datap, bp->b_bcount);
- bp->b_resid = 0;
- biodone(bp);
- return;
-
-done:
- bp->b_resid = bp->b_bcount;
- biodone(bp);
-}
-
-int
-rdread(dev, uio)
-dev_t dev;
-struct uio *uio;
-{
- return (physio(rdstrategy, NULL, dev, B_READ, minphys, uio));
-}
-
-int
-rdwrite(dev, uio)
-dev_t dev;
-struct uio *uio;
-{
- return (physio(rdstrategy, NULL, dev, B_WRITE, minphys, uio));
-}
-
-static int
-loaddisk(ri, proc)
-struct ramd_info *ri;
-struct proc *proc;
-{
- struct buf buf;
- int error;
- struct bdevsw *bdp = &bdevsw[major(ri->ramd_dev)];
- struct disklabel dl;
- struct read_info rs;
-
- /*
- * Initialize out buffer header:
- */
- buf.b_actf = NULL;
- buf.b_rcred = buf.b_wcred = proc->p_ucred;
- buf.b_vnbufs.le_next = NOLIST;
- buf.b_flags = B_BUSY;
- buf.b_dev = ri->ramd_dev;
- buf.b_error = 0;
- buf.b_proc = proc;
-
- /*
- * Setup read_info:
- */
- rs.bp = &buf;
- rs.nbytes = ri->ramd_size;
- rs.offset = 0;
- rs.bufp = ri->ramd_addr;
- rs.ebufp = ri->ramd_addr + ri->ramd_size;
- rs.chunk = RAMD_CHUNK;
- rs.media_sz = ri->ramd_size;
- rs.strat = bdp->d_strategy;
-
- /*
- * Open device and try to get some statistics.
- */
- if(error = bdp->d_open(ri->ramd_dev,FREAD | FNONBLOCK, 0, proc))
- return(error);
- if(bdp->d_ioctl(ri->ramd_dev,DIOCGDINFO,(caddr_t)&dl,FREAD,proc) == 0) {
- /* Read on a cylinder basis */
- rs.chunk = dl.d_secsize * dl.d_secpercyl;
- rs.media_sz = dl.d_secperunit * dl.d_secsize;
- }
-
-#ifdef notyet
- if(ri->ramd_flag & RAMD_LCOMP)
- error = decompress(cpy_uncompressed, rd_compressed, &rs);
- else
-#endif /* notyet */
- error = ramd_norm_read(&rs);
-
- bdp->d_close(ri->ramd_dev,FREAD | FNONBLOCK, 0, proc);
- return(error);
-}
-
-static int
-ramd_norm_read(rsp)
-struct read_info *rsp;
-{
- long bytes_left;
- int done, error;
- struct buf *bp;
- int s;
- int dotc = 0;
-
- bytes_left = rsp->nbytes;
- bp = rsp->bp;
- error = 0;
-
- while(bytes_left > 0) {
- s = splbio();
- bp->b_flags = B_BUSY | B_PHYS | B_READ;
- splx(s);
- bp->b_blkno = btodb(rsp->offset);
- bp->b_bcount = rsp->chunk;
- bp->b_data = rsp->bufp;
-
- /* Initiate read */
- (*rsp->strat)(bp);
-
- /* Wait for results */
- s = splbio();
- while ((bp->b_flags & B_DONE) == 0)
- tsleep((caddr_t) bp, PRIBIO + 1, "ramd_norm_read", 0);
- if (bp->b_flags & B_ERROR)
- error = (bp->b_error ? bp->b_error : EIO);
- splx(s);
-
- /* Dot counter */
- printf(".");
- if(!(++dotc % 40))
- printf("\n");
-
- done = bp->b_bcount - bp->b_resid;
- bytes_left -= done;
- rsp->offset += done;
- rsp->bufp += done;
-
- if(error || !done)
- break;
-
- if((rsp->offset == rsp->media_sz) && (bytes_left != 0)) {
- printf("\nInsert next media and hit any key...");
- cngetc();
- printf("\n");
- rsp->offset = 0;
- }
- }
- printf("\n");
- s = splbio();
- splx(s);
- return(error);
-}
-
-/*
- * Functions supporting uncompression:
- */
-/*
- * Copy from the uncompression buffer to the ramdisk
- */
-static int
-cpy_uncompressed(buf, nbyte, rsp)
-caddr_t buf;
-struct read_info *rsp;
-int nbyte;
-{
- if((rsp->bufp + nbyte) >= rsp->ebufp)
- return(0);
- bcopy(buf, rsp->bufp, nbyte);
- rsp->bufp += nbyte;
- return(0);
-}
-
-/*
- * Read a maximum of 'nbyte' bytes into 'buf'.
- */
-static int
-rd_compressed(buf, nbyte, rsp)
-caddr_t buf;
-struct read_info *rsp;
-int nbyte;
-{
- static int dotc = 0;
- struct buf *bp;
- int nread = 0;
- int s;
- int done, error;
-
-
- error = 0;
- bp = rsp->bp;
- nbyte &= ~(DEV_BSIZE - 1);
-
- while(nbyte > 0) {
- s = splbio();
- bp->b_flags = B_BUSY | B_PHYS | B_READ;
- splx(s);
- bp->b_blkno = btodb(rsp->offset);
- bp->b_bcount = min(rsp->chunk, nbyte);
- bp->b_data = buf;
-
- /* Initiate read */
- (*rsp->strat)(bp);
-
- /* Wait for results */
- s = splbio();
- while ((bp->b_flags & B_DONE) == 0)
- tsleep((caddr_t) bp, PRIBIO + 1, "ramd_norm_read", 0);
- if (bp->b_flags & B_ERROR)
- error = (bp->b_error ? bp->b_error : EIO);
- splx(s);
-
- /* Dot counter */
- printf(".");
- if(!(++dotc % 40))
- printf("\n");
-
- done = bp->b_bcount - bp->b_resid;
- nbyte -= done;
- nread += done;
- rsp->offset += done;
-
- if(error || !done)
- break;
-
- if(rsp->offset == rsp->media_sz) {
- printf("\nInsert next media and hit any key...");
- if(cngetc() != '\n')
- printf("\n");
- rsp->offset = 0;
- }
- }
- s = splbio();
- splx(s);
- return(nread);
-}
diff --git a/sys/arch/atari/dev/view.c b/sys/arch/atari/dev/view.c
deleted file mode 100644
index 09dbaf75244..00000000000
--- a/sys/arch/atari/dev/view.c
+++ /dev/null
@@ -1,420 +0,0 @@
-/* $NetBSD: view.c,v 1.6 1995/08/17 20:32:50 leo Exp $ */
-
-/*
- * Copyright (c) 1994 Christian E. Hopps
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christian E. Hopps.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* The view major device is a placeholder device. It serves
- * simply to map the semantics of a graphics dipslay to
- * the semantics of a character block device. In other
- * words the graphics system as currently built does not like to be
- * refered to by open/close/ioctl. This device serves as
- * a interface to graphics. */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/ioctl.h>
-#include <sys/file.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-#include <sys/queue.h>
-#include <machine/cpu.h>
-#include <atari/dev/grfabs_reg.h>
-#include <atari/dev/viewioctl.h>
-#include <atari/dev/viewvar.h>
-#include "view.h"
-
-static void view_display __P((struct view_softc *));
-static void view_remove __P((struct view_softc *));
-static int view_setsize __P((struct view_softc *, struct view_size *));
-static int view_get_colormap __P((struct view_softc *, colormap_t *));
-static int view_set_colormap __P((struct view_softc *, colormap_t *));
-
-void viewclose __P((dev_t, int));
-int viewioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
-int viewopen __P((dev_t, int));
-int viewmmap __P((dev_t, int, int));
-
-int viewprobe ();
-
-struct view_softc views[NVIEW];
-static int view_inited;
-
-int view_default_x;
-int view_default_y;
-int view_default_width = 640;
-int view_default_height = 400;
-int view_default_depth = 1;
-
-/*
- * functions for probeing.
- */
-viewattach(cnt)
- int cnt;
-{
- viewprobe();
- printf("%d view%s configured\n", NVIEW, NVIEW > 1 ? "s" : "");
-}
-
-/* this function is called early to set up a display. */
-viewprobe()
-{
- int i;
-
- if(view_inited)
- return(1);
-
- view_inited = 1;
-
- for(i=0; i<NVIEW; i++) {
- views[i].view = NULL;
- views[i].flags = 0;
- }
- return(1);
-}
-
-
-/*
- * Internal functions.
- */
-
-static void
-view_display (vu)
- struct view_softc *vu;
-{
- int s, i;
-
- if (vu == NULL)
- return;
-
- s = spltty ();
-
- /*
- * mark views that share this monitor as not displaying
- */
- for (i=0; i<NVIEW; i++) {
- if(views[i].flags & VUF_DISPLAY)
- views[i].flags &= ~VUF_DISPLAY;
- }
-
- vu->flags |= VUF_ADDED;
- if (vu->view) {
- vu->view->display.x = vu->size.x;
- vu->view->display.y = vu->size.y;
-
- grf_display_view(vu->view);
-
- vu->size.x = vu->view->display.x;
- vu->size.y = vu->view->display.y;
- vu->flags |= VUF_DISPLAY;
- }
- splx(s);
-}
-
-/*
- * remove a view from our added list if it is marked as displaying
- * switch to a new display.
- */
-static void
-view_remove(vu)
- struct view_softc *vu;
-{
- int i;
-
- if ((vu->flags & VUF_ADDED) == 0)
- return;
-
- vu->flags &= ~VUF_ADDED;
- if (vu->flags & VUF_DISPLAY) {
- for (i = 0; i < NVIEW; i++) {
- if((views[i].flags & VUF_ADDED) && &views[i] != vu) {
- view_display(&views[i]);
- break;
- }
- }
- }
- vu->flags &= ~VUF_DISPLAY;
- grf_remove_view(vu->view);
-}
-
-static int
-view_setsize(vu, vs)
- struct view_softc *vu;
- struct view_size *vs;
-{
- view_t *new, *old;
- dmode_t *dmode;
- dimen_t ns;
- int co, cs;
-
- co = 0;
- cs = 0;
- if (vs->x != vu->size.x || vs->y != vu->size.y)
- co = 1;
-
- if (vs->width != vu->size.width || vs->height != vu->size.height ||
- vs->depth != vu->size.depth)
- cs = 1;
-
- if (cs == 0 && co == 0)
- return(0);
-
- ns.width = vs->width;
- ns.height = vs->height;
-
- if((dmode = grf_get_best_mode(&ns, vs->depth)) != NULL) {
- /*
- * If we can't do better, leave it
- */
- if(dmode == vu->view->mode)
- return(0);
- }
- new = grf_alloc_view(dmode, &ns, vs->depth);
- if (new == NULL)
- return(ENOMEM);
-
- old = vu->view;
- vu->view = new;
- vu->size.x = new->display.x;
- vu->size.y = new->display.y;
- vu->size.width = new->display.width;
- vu->size.height = new->display.height;
- vu->size.depth = new->bitmap->depth;
-
- /*
- * we need a custom remove here to avoid letting
- * another view display mark as not added or displayed
- */
- if (vu->flags & VUF_DISPLAY) {
- vu->flags &= ~(VUF_ADDED|VUF_DISPLAY);
- view_display(vu);
- }
- grf_free_view(old);
- return(0);
-}
-
-static int
-view_get_colormap (vu, ucm)
-struct view_softc *vu;
-colormap_t *ucm;
-{
- int error;
- long *cme;
- long *uep;
-
- if(ucm->size > MAX_CENTRIES)
- return(EINVAL);
-
- /* add one incase of zero, ick. */
- cme = malloc(sizeof(ucm->entry[0])*(ucm->size+1), M_IOCTLOPS,M_WAITOK);
- if (cme == NULL)
- return(ENOMEM);
-
- error = 0;
- uep = ucm->entry;
- ucm->entry = cme; /* set entry to out alloc. */
- if(vu->view == NULL || grf_get_colormap(vu->view, ucm))
- error = EINVAL;
- else error = copyout(cme, uep, sizeof(ucm->entry[0]) * ucm->size);
- ucm->entry = uep; /* set entry back to users. */
- free(cme, M_IOCTLOPS);
- return(error);
-}
-
-static int
-view_set_colormap(vu, ucm)
-struct view_softc *vu;
-colormap_t *ucm;
-{
- colormap_t *cm;
- int error = 0;
-
- if(ucm->size > MAX_CENTRIES)
- return(EINVAL);
-
- cm = malloc(sizeof(ucm->entry[0])*ucm->size + sizeof(*cm), M_IOCTLOPS,
- M_WAITOK);
- if(cm == NULL)
- return(ENOMEM);
-
- bcopy(ucm, cm, sizeof(colormap_t));
- cm->entry = (long *)&cm[1]; /* table directly after. */
- if (((error =
- copyin(ucm->entry,cm->entry,sizeof(ucm->entry[0])*ucm->size)) == 0)
- && (vu->view == NULL || grf_use_colormap(vu->view, cm)))
- error = EINVAL;
- free(cm, M_IOCTLOPS);
- return(error);
-}
-
-/*
- * functions made available by conf.c
- */
-
-/*ARGSUSED*/
-int viewopen(dev, flags)
-dev_t dev;
-int flags;
-{
- dimen_t size;
- struct view_softc *vu;
-
- vu = &views[minor(dev)];
-
- if(minor(dev) >= NVIEW)
- return(EXDEV);
- if(vu->flags & VUF_OPEN)
- return(EBUSY);
-
- vu->size.x = view_default_x;
- vu->size.y = view_default_y;
- size.width = vu->size.width = view_default_width;
- size.height = vu->size.height = view_default_height;
- vu->size.depth = view_default_depth;
- vu->view = grf_alloc_view(NULL, &size, vu->size.depth);
- if (vu->view == NULL)
- return(ENOMEM);
-
- vu->size.x = vu->view->display.x;
- vu->size.y = vu->view->display.y;
- vu->size.width = vu->view->display.width;
- vu->size.height = vu->view->display.height;
- vu->size.depth = vu->view->bitmap->depth;
- vu->flags |= VUF_OPEN;
- return(0);
-}
-
-/*ARGSUSED*/
-void
-viewclose (dev, flags)
- dev_t dev;
- int flags;
-{
- struct view_softc *vu;
-
- vu = &views[minor(dev)];
-
- if ((vu->flags & VUF_OPEN) == 0)
- return;
- view_remove (vu);
- grf_free_view (vu->view);
- vu->flags = 0;
- vu->view = NULL;
-}
-
-
-/*ARGSUSED*/
-int
-viewioctl (dev, cmd, data, flag, p)
-dev_t dev;
-u_long cmd;
-caddr_t data;
-int flag;
-struct proc *p;
-{
- struct view_softc *vu;
- bmap_t *bm;
- int error;
-
- vu = &views[minor(dev)];
- error = 0;
-
- switch (cmd) {
- case VIOCDISPLAY:
- view_display(vu);
- break;
- case VIOCREMOVE:
- view_remove(vu);
- break;
- case VIOCGSIZE:
- bcopy(&vu->size, data, sizeof (struct view_size));
- break;
- case VIOCSSIZE:
- error = view_setsize(vu, (struct view_size *)data);
- break;
- case VIOCGBMAP:
- bm = (bmap_t *)data;
- bcopy(vu->view->bitmap, bm, sizeof(bmap_t));
- if ((int)p != -1) {
- bm->plane = NULL;
- bm->hw_address = NULL;
- }
- break;
- case VIOCGCMAP:
- error = view_get_colormap(vu, (colormap_t *)data);
- break;
- case VIOCSCMAP:
- error = view_set_colormap(vu, (colormap_t *)data);
- break;
- default:
- error = EINVAL;
- break;
- }
- return(error);
-}
-
-/*ARGSUSED*/
-int
-viewmmap(dev, off, prot)
-dev_t dev;
-int off, prot;
-{
- struct view_softc *vu;
- bmap_t *bm;
- u_char *bmd_start;
- u_long bmd_size;
-
- vu = &views[minor(dev)];
- bm = vu->view->bitmap;
- bmd_start = bm->hw_address;
- bmd_size = bm->bytes_per_row*bm->rows*bm->depth;
-
- if (off >= 0 && off < bmd_size)
- return(((u_int)bmd_start + off) >> PGSHIFT);
-
- return(-1);
-}
-
-/*ARGSUSED*/
-int
-viewselect(dev, rw)
-dev_t dev;
-int rw;
-{
- if(rw == FREAD)
- return(0);
- return(1);
-}
-
-view_t *
-viewview(dev)
-dev_t dev;
-{
- return(views[minor(dev)].view);
-}
diff --git a/sys/arch/atari/dev/viewioctl.h b/sys/arch/atari/dev/viewioctl.h
deleted file mode 100644
index 86b3970459e..00000000000
--- a/sys/arch/atari/dev/viewioctl.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* $NetBSD: viewioctl.h,v 1.1.1.1 1995/03/26 07:12:14 leo Exp $ */
-
-/*
- * Copyright (c) 1994 Christian E. Hopps
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christian E. Hopps.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * The view major device is a placeholder device. It serves
- * simply to map the semantics of a graphics display to
- * the semantics of a character block device. In other
- * words the graphics system as currently built does not like to be
- * refered to by open/close/ioctl. This device serves as
- * a interface to graphics.
- */
-
-struct view_size {
- int x;
- int y;
- u_int width;
- u_int height;
- u_int depth;
-};
-
-#define VIOCREMOVE _IO('V', 0x0) /* if displaying remove. */
-#define VIOCDISPLAY _IO('V', 0x1) /* if not displaying, display */
-#define VIOCSSIZE _IOW('V', 0x2, struct view_size)
-#define VIOCGSIZE _IOR('V', 0x3, struct view_size)
-#define VIOCGBMAP _IOR('V', 0x4, bmap_t)
-#define VIOCSCMAP _IOW('V', 0x5, colormap_t)
-#define VIOCGCMAP _IOWR('V', 0x6, colormap_t)
-
diff --git a/sys/arch/atari/dev/viewvar.h b/sys/arch/atari/dev/viewvar.h
deleted file mode 100644
index 3c4b7c59de4..00000000000
--- a/sys/arch/atari/dev/viewvar.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $NetBSD: viewvar.h,v 1.2 1995/05/28 19:45:43 leo Exp $ */
-
-/*
- * Copyright (c) 1994 Christian E. Hopps
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christian E. Hopps.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* The view major device is a placeholder device. It serves
- * simply to map the semantics of a graphics dipslay to
- * the semantics of a character block device. In other
- * words the graphics system as currently built does not like to be
- * refered to by open/close/ioctl. This device serves as
- * a interface to graphics. */
-
-struct view_softc {
- struct view_size size;
- view_t *view;
- pid_t lock_process;
- int flags;
-};
-
-enum view_unit_flag_bits {
- VUB_OPEN,
- VUB_ADDED,
- VUB_DISPLAY,
- VUB_LAST_BIT
-};
-
-enum view_unit_flags {
- VUF_OPEN = 1<<VUB_OPEN,
- VUF_ADDED = 1<<VUB_ADDED,
- VUF_DISPLAY = 1<<VUB_DISPLAY,
- VUF_MASK = ((1<<VUB_LAST_BIT)-1)
-};
-
-#ifdef _KERNEL
-view_t *viewview __P((dev_t));
-#endif /* _KERNEL */
diff --git a/sys/arch/atari/dev/vuid_event.h b/sys/arch/atari/dev/vuid_event.h
deleted file mode 100644
index 8342f31f19b..00000000000
--- a/sys/arch/atari/dev/vuid_event.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* $NetBSD: vuid_event.h,v 1.1.1.1 1995/03/26 07:12:11 leo Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)vuid_event.h 8.1 (Berkeley) 6/11/93
- *
- * from: Header: vuid_event.h,v 1.4 92/11/26 01:20:27 torek Exp (LBL)
- */
-
-/*
- * The following is a minimal emulation of Sun's `Firm_event' structures
- * and related operations necessary to make X11 happy (i.e., make it
- * compile, and make old X11 binaries run).
- */
-typedef struct firm_event {
- u_short id; /* key or MS_* or LOC_[XY]_DELTA */
- u_short pad; /* unused, at least by X11 */
- int value; /* VKEY_{UP,DOWN} or locator delta */
- struct timeval time;
-} Firm_event;
-
-/*
- * Special `id' fields. These weird numbers simply match the old binaries.
- * Others are in 0..0x7f and are keyboard key numbers (keyboard dependent!).
- */
-#define MS_LEFT 0x7f20 /* left mouse button */
-#define MS_MIDDLE 0x7f21 /* middle mouse button */
-#define MS_RIGHT 0x7f22 /* right mouse button */
-#define LOC_X_DELTA 0x7f80 /* mouse delta-X */
-#define LOC_Y_DELTA 0x7f81 /* mouse delta-Y */
-
-/*
- * Special `value' fields. These apply to keys and mouse buttons. The
- * value of a mouse delta is the delta. Note that positive deltas are
- * left and up (not left and down as you might expect).
- */
-#define VKEY_UP 0 /* key or button went up */
-#define VKEY_DOWN 1 /* key or button went down */
-
-/*
- * The following ioctls are clearly intended to take things in and out
- * of `firm event' mode. Since we always run in this mode (as far as
- * /dev/kbd and /dev/mouse are concerned, anyway), we always claim to
- * be in this mode and reject anything else.
- */
-#define VUIDSFORMAT _IOW('v', 1, int)
-#define VUIDGFORMAT _IOR('v', 2, int)
-#define VUID_FIRM_EVENT 1 /* the only format we support */
diff --git a/sys/arch/atari/dev/zs.c b/sys/arch/atari/dev/zs.c
deleted file mode 100644
index b58ec39f31f..00000000000
--- a/sys/arch/atari/dev/zs.c
+++ /dev/null
@@ -1,1233 +0,0 @@
-/* $NetBSD: zs.c,v 1.14 1996/01/23 09:35:15 leo Exp $ */
-
-/*
- * Copyright (c) 1995 L. Weppelman (Atari modifications)
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)zs.c 8.1 (Berkeley) 7/19/93
- */
-
-/*
- * Zilog Z8530 (ZSCC) driver.
- *
- * Runs two tty ports (modem2 and serial2) on zs0.
- *
- * This driver knows far too much about chip to usage mappings.
- */
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/device.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/ioctl.h>
-#include <sys/malloc.h>
-#include <sys/tty.h>
-#include <sys/time.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-
-#include <machine/cpu.h>
-#include <machine/iomap.h>
-#include <machine/scu.h>
-#include <machine/mfp.h>
-#include <machine/video.h>
-
-#include <dev/ic/z8530reg.h>
-#include <atari/dev/zsvar.h>
-#include "zs.h"
-#if NZS > 1
-#error "This driver supports only 1 85C30!"
-#endif
-
-#if NZS > 0
-
-#define PCLK (8053976) /* PCLK pin input clock rate */
-
-#define splzs spl5
-
-/*
- * Software state per found chip.
- */
-struct zs_softc {
- struct device zi_dev; /* base device */
- volatile struct zsdevice *zi_zs; /* chip registers */
- struct zs_chanstate zi_cs[2]; /* chan A and B software state */
-};
-
-static u_char cb_scheduled = 0; /* Already asked for callback? */
-/*
- * Define the registers for a closed port
- */
-static u_char zs_init_regs[16] = {
-/* 0 */ 0,
-/* 1 */ 0,
-/* 2 */ 0x60,
-/* 3 */ 0,
-/* 4 */ 0,
-/* 5 */ 0,
-/* 6 */ 0,
-/* 7 */ 0,
-/* 8 */ 0,
-/* 9 */ ZSWR9_MASTER_IE | ZSWR9_VECTOR_INCL_STAT,
-/* 10 */ ZSWR10_NRZ,
-/* 11 */ ZSWR11_TXCLK_BAUD | ZSWR11_RXCLK_BAUD,
-/* 12 */ 0,
-/* 13 */ 0,
-/* 14 */ ZSWR14_BAUD_FROM_PCLK | ZSWR14_BAUD_ENA,
-/* 15 */ 0
-};
-
-/*
- * Define the machine dependant clock frequencies
- * If BRgen feeds sender/receiver we always use a
- * divisor 16, therefor the division by 16 can as
- * well be done here.
- */
-static u_long zs_freqs_tt[] = {
- /*
- * Atari TT, RTxCB is generated by TT-MFP timer C,
- * which is set to 307.2KHz during initialisation
- * and never changed afterwards.
- */
- PCLK/16, /* BRgen, PCLK, divisor 16 */
- 229500, /* BRgen, RTxCA, divisor 16 */
- 3672000, /* RTxCA, from PCLK4 */
- 0, /* TRxCA, external */
-
- PCLK/16, /* BRgen, PCLK, divisor 16 */
- 19200, /* BRgen, RTxCB, divisor 16 */
- 307200, /* RTxCB, from TT-MFP TCO */
- 2457600 /* TRxCB, from BCLK */
-};
-static u_long zs_freqs_falcon[] = {
- /*
- * Atari Falcon, XXX no specs available, this might be wrong
- */
- PCLK/16, /* BRgen, PCLK, divisor 16 */
- 229500, /* BRgen, RTxCA, divisor 16 */
- 3672000, /* RTxCA, ??? */
- 0, /* TRxCA, external */
-
- PCLK/16, /* BRgen, PCLK, divisor 16 */
- 229500, /* BRgen, RTxCB, divisor 16 */
- 3672000, /* RTxCB, ??? */
- 2457600 /* TRxCB, ??? */
-};
-static u_long zs_freqs_generic[] = {
- /*
- * other machines, assume only PCLK is available
- */
- PCLK/16, /* BRgen, PCLK, divisor 16 */
- 0, /* BRgen, RTxCA, divisor 16 */
- 0, /* RTxCA, unknown */
- 0, /* TRxCA, unknown */
-
- PCLK/16, /* BRgen, PCLK, divisor 16 */
- 0, /* BRgen, RTxCB, divisor 16 */
- 0, /* RTxCB, unknown */
- 0 /* TRxCB, unknown */
-};
-static u_long *zs_frequencies;
-
-/* Definition of the driver for autoconfig. */
-static int zsmatch __P((struct device *, struct cfdata *, void *));
-static void zsattach __P((struct device *, struct device *, void *));
-struct cfdriver zscd = {
- NULL, "zs", (cfmatch_t)zsmatch, zsattach, DV_TTY,
- sizeof(struct zs_softc), NULL, 0 };
-
-/* Interrupt handlers. */
-int zshard __P((long));
-static int zssoft __P((long));
-static int zsrint __P((struct zs_chanstate *, volatile struct zschan *));
-static int zsxint __P((struct zs_chanstate *, volatile struct zschan *));
-static int zssint __P((struct zs_chanstate *, volatile struct zschan *));
-
-static struct zs_chanstate *zslist;
-
-/* Routines called from other code. */
-static void zsstart __P((struct tty *));
-void zsstop __P((struct tty *, int));
-static int zsparam __P((struct tty *, struct termios *));
-static int zsbaudrate __P((int, int, int *, int *, int *, int *));
-
-/* Routines purely local to this driver. */
-static void zs_reset __P((volatile struct zschan *, int, int));
-static int zs_modem __P((struct zs_chanstate *, int, int));
-static void zs_loadchannelregs __P((volatile struct zschan *, u_char *));
-
-static int zsshortcuts; /* number of "shortcut" software interrupts */
-
-static int
-zsmatch(pdp, cfp, auxp)
-struct device *pdp;
-struct cfdata *cfp;
-void *auxp;
-{
- if(strcmp("zs", auxp) || cfp->cf_unit != 0)
- return(0);
- return(1);
-}
-
-/*
- * Attach a found zs.
- */
-static void
-zsattach(parent, dev, aux)
-struct device *parent;
-struct device *dev;
-void *aux;
-{
- register struct zs_softc *zi;
- register struct zs_chanstate *cs;
- register volatile struct zsdevice *addr;
- register struct tty *tp;
- char tmp;
-
- addr = (struct zsdevice *)AD_SCC;
- zi = (struct zs_softc *)dev;
- zi->zi_zs = addr;
- cs = zi->zi_cs;
-
- /*
- * Get the command register into a known state.
- */
- tmp = addr->zs_chan[ZS_CHAN_A].zc_csr;
- tmp = addr->zs_chan[ZS_CHAN_A].zc_csr;
- tmp = addr->zs_chan[ZS_CHAN_B].zc_csr;
- tmp = addr->zs_chan[ZS_CHAN_B].zc_csr;
-
- /*
- * Do a hardware reset.
- */
- ZS_WRITE(&addr->zs_chan[ZS_CHAN_A], 9, ZSWR9_HARD_RESET);
- delay(50000); /*enough ? */
- ZS_WRITE(&addr->zs_chan[ZS_CHAN_A], 9, 0);
-
- /*
- * Initialize both channels
- */
- zs_loadchannelregs(&addr->zs_chan[ZS_CHAN_A], zs_init_regs);
- zs_loadchannelregs(&addr->zs_chan[ZS_CHAN_B], zs_init_regs);
-
- if(machineid & ATARI_TT) {
- /*
- * ininitialise TT-MFP timer C: 307200Hz
- * timer C and D share one control register:
- * bits 0-2 control timer D
- * bits 4-6 control timer C
- */
- int cr = MFP2->mf_tcdcr & 7;
- MFP2->mf_tcdcr = cr; /* stop timer C */
- MFP2->mf_tcdr = 1; /* counter 1 */
- cr |= T_Q004 << 4; /* divisor 4 */
- MFP2->mf_tcdcr = cr; /* start timer C */
- /*
- * enable scc related interrupts
- */
- SCU->sys_mask |= SCU_SCC;
-
- zs_frequencies = zs_freqs_tt;
- } else if (machineid & ATARI_FALCON) {
- zs_frequencies = zs_freqs_falcon;
- } else {
- zs_frequencies = zs_freqs_generic;
- }
-
- /* link into interrupt list with order (A,B) (B=A+1) */
- cs[0].cs_next = &cs[1];
- cs[1].cs_next = zslist;
- zslist = cs;
-
- cs->cs_unit = 0;
- cs->cs_zc = &addr->zs_chan[ZS_CHAN_A];
- cs++;
- cs->cs_unit = 1;
- cs->cs_zc = &addr->zs_chan[ZS_CHAN_B];
-
- printf(": serial2 on channel a and modem2 on channel b\n");
-}
-
-/*
- * Open a zs serial port.
- */
-int
-zsopen(dev, flags, mode, p)
-dev_t dev;
-int flags;
-int mode;
-struct proc *p;
-{
- register struct tty *tp;
- register struct zs_chanstate *cs;
- struct zs_softc *zi;
- int unit = ZS_UNIT(dev);
- int zs = unit >> 1;
- int error, s;
-
- if(zs >= zscd.cd_ndevs || (zi = zscd.cd_devs[zs]) == NULL)
- return (ENXIO);
- cs = &zi->zi_cs[unit & 1];
-
- /*
- * When port A (ser02) is selected on the TT, make sure
- * the port is enabled.
- */
- if((machineid & ATARI_TT) && !(unit & 1)) {
- SOUND->sd_selr = YM_IOA;
- SOUND->sd_wdat = SOUND->sd_rdat | PA_SER2;
- }
-
- if (cs->cs_rbuf == NULL) {
- cs->cs_rbuf = malloc(ZLRB_RING_SIZE * sizeof(int), M_DEVBUF,
- M_WAITOK);
- }
-
- tp = cs->cs_ttyp;
- if(tp == NULL) {
- cs->cs_ttyp = tp = ttymalloc();
- tp->t_dev = dev;
- tp->t_oproc = zsstart;
- tp->t_param = zsparam;
- }
-
- s = spltty();
- if((tp->t_state & TS_ISOPEN) == 0) {
- ttychars(tp);
- if(tp->t_ispeed == 0) {
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- tp->t_cflag = TTYDEF_CFLAG;
- tp->t_lflag = TTYDEF_LFLAG;
- tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
- }
- (void)zsparam(tp, &tp->t_termios);
- ttsetwater(tp);
- }
- else if(tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) {
- splx(s);
- return (EBUSY);
- }
- error = 0;
- for(;;) {
- /* loop, turning on the device, until carrier present */
- zs_modem(cs, ZSWR5_RTS|ZSWR5_DTR, DMSET);
-
- /* May never get a status intr. if DCD already on. -gwr */
- if(cs->cs_zc->zc_csr & ZSRR0_DCD)
- tp->t_state |= TS_CARR_ON;
- if(cs->cs_softcar)
- tp->t_state |= TS_CARR_ON;
- if(flags & O_NONBLOCK || tp->t_cflag & CLOCAL ||
- tp->t_state & TS_CARR_ON)
- break;
- tp->t_state |= TS_WOPEN;
- if(error = ttysleep(tp, (caddr_t)&tp->t_rawq, TTIPRI | PCATCH,
- ttopen, 0)) {
- if(!(tp->t_state & TS_ISOPEN)) {
- zs_modem(cs, 0, DMSET);
- tp->t_state &= ~TS_WOPEN;
- ttwakeup(tp);
- }
- splx(s);
- return error;
- }
- }
- splx(s);
- if(error == 0)
- error = linesw[tp->t_line].l_open(dev, tp);
- if(error)
- zs_modem(cs, 0, DMSET);
- return(error);
-}
-
-/*
- * Close a zs serial port.
- */
-int
-zsclose(dev, flags, mode, p)
-dev_t dev;
-int flags;
-int mode;
-struct proc *p;
-{
- register struct zs_chanstate *cs;
- register struct tty *tp;
- struct zs_softc *zi;
- int unit = ZS_UNIT(dev);
- int s;
-
- zi = zscd.cd_devs[unit >> 1];
- cs = &zi->zi_cs[unit & 1];
- tp = cs->cs_ttyp;
- linesw[tp->t_line].l_close(tp, flags);
- if(tp->t_cflag & HUPCL || tp->t_state & TS_WOPEN ||
- (tp->t_state & TS_ISOPEN) == 0) {
- zs_modem(cs, 0, DMSET);
- /* hold low for 1 second */
- (void)tsleep((caddr_t)cs, TTIPRI, ttclos, hz);
- }
- if(cs->cs_creg[5] & ZSWR5_BREAK) {
- s = splzs();
- cs->cs_preg[5] &= ~ZSWR5_BREAK;
- cs->cs_creg[5] &= ~ZSWR5_BREAK;
- ZS_WRITE(cs->cs_zc, 5, cs->cs_creg[5]);
- splx(s);
- }
- ttyclose(tp);
-
- /*
- * Drop all lines and cancel interrupts
- */
- s = splzs();
- zs_loadchannelregs(cs->cs_zc, zs_init_regs);
- splx(s);
- return (0);
-}
-
-/*
- * Read/write zs serial port.
- */
-int
-zsread(dev, uio, flags)
-dev_t dev;
-struct uio *uio;
-int flags;
-{
- register struct zs_chanstate *cs;
- register struct zs_softc *zi;
- register struct tty *tp;
- int unit;
-
- unit = ZS_UNIT(dev);
- zi = zscd.cd_devs[unit >> 1];
- cs = &zi->zi_cs[unit & 1];
- tp = cs->cs_ttyp;
-
- return(linesw[tp->t_line].l_read(tp, uio, flags));
-}
-
-int
-zswrite(dev, uio, flags)
-dev_t dev;
-struct uio *uio;
-int flags;
-{
- register struct zs_chanstate *cs;
- register struct zs_softc *zi;
- register struct tty *tp;
- int unit;
-
- unit = ZS_UNIT(dev);
- zi = zscd.cd_devs[unit >> 1];
- cs = &zi->zi_cs[unit & 1];
- tp = cs->cs_ttyp;
-
- return(linesw[tp->t_line].l_write(tp, uio, flags));
-}
-
-struct tty *
-zstty(dev)
-dev_t dev;
-{
- register struct zs_chanstate *cs;
- register struct zs_softc *zi;
- int unit;
-
- unit = ZS_UNIT(dev);
- zi = zscd.cd_devs[unit >> 1];
- cs = &zi->zi_cs[unit & 1];
- return(cs->cs_ttyp);
-}
-
-/*
- * ZS hardware interrupt. Scan all ZS channels. NB: we know here that
- * channels are kept in (A,B) pairs.
- *
- * Do just a little, then get out; set a software interrupt if more
- * work is needed.
- *
- * We deliberately ignore the vectoring Zilog gives us, and match up
- * only the number of `reset interrupt under service' operations, not
- * the order.
- */
-
-int
-zshard(sr)
-long sr;
-{
- register struct zs_chanstate *a;
-#define b (a + 1)
- register volatile struct zschan *zc;
- register int rr3, intflags = 0, v, i;
-
- do {
- intflags &= ~4;
- for(a = zslist; a != NULL; a = b->cs_next) {
- rr3 = ZS_READ(a->cs_zc, 3);
- if(rr3 & (ZSRR3_IP_A_RX|ZSRR3_IP_A_TX|ZSRR3_IP_A_STAT)) {
- intflags |= 4|2;
- zc = a->cs_zc;
- i = a->cs_rbput;
- if(rr3 & ZSRR3_IP_A_RX && (v = zsrint(a, zc)) != 0) {
- a->cs_rbuf[i++ & ZLRB_RING_MASK] = v;
- intflags |= 1;
- }
- if(rr3 & ZSRR3_IP_A_TX && (v = zsxint(a, zc)) != 0) {
- a->cs_rbuf[i++ & ZLRB_RING_MASK] = v;
- intflags |= 1;
- }
- if(rr3 & ZSRR3_IP_A_STAT && (v = zssint(a, zc)) != 0) {
- a->cs_rbuf[i++ & ZLRB_RING_MASK] = v;
- intflags |= 1;
- }
- a->cs_rbput = i;
- }
- if(rr3 & (ZSRR3_IP_B_RX|ZSRR3_IP_B_TX|ZSRR3_IP_B_STAT)) {
- intflags |= 4|2;
- zc = b->cs_zc;
- i = b->cs_rbput;
- if(rr3 & ZSRR3_IP_B_RX && (v = zsrint(b, zc)) != 0) {
- b->cs_rbuf[i++ & ZLRB_RING_MASK] = v;
- intflags |= 1;
- }
- if(rr3 & ZSRR3_IP_B_TX && (v = zsxint(b, zc)) != 0) {
- b->cs_rbuf[i++ & ZLRB_RING_MASK] = v;
- intflags |= 1;
- }
- if(rr3 & ZSRR3_IP_B_STAT && (v = zssint(b, zc)) != 0) {
- b->cs_rbuf[i++ & ZLRB_RING_MASK] = v;
- intflags |= 1;
- }
- b->cs_rbput = i;
- }
- }
- } while(intflags & 4);
-#undef b
-
- if(intflags & 1) {
- if(BASEPRI(sr)) {
- spl1();
- zsshortcuts++;
- return(zssoft(sr));
- }
- else if(!cb_scheduled) {
- cb_scheduled++;
- add_sicallback(zssoft, 0, 0);
- }
- }
- return(intflags & 2);
-}
-
-static int
-zsrint(cs, zc)
-register struct zs_chanstate *cs;
-register volatile struct zschan *zc;
-{
- register int c;
-
- /*
- * First read the status, because read of the received char
- * destroy the status of this char.
- */
- c = ZS_READ(zc, 1);
- c |= (zc->zc_data << 8);
-
- /* clear receive error & interrupt condition */
- zc->zc_csr = ZSWR0_RESET_ERRORS;
- zc->zc_csr = ZSWR0_CLR_INTR;
-
- return(ZRING_MAKE(ZRING_RINT, c));
-}
-
-static int
-zsxint(cs, zc)
-register struct zs_chanstate *cs;
-register volatile struct zschan *zc;
-{
- register int i = cs->cs_tbc;
-
- if(i == 0) {
- zc->zc_csr = ZSWR0_RESET_TXINT;
- zc->zc_csr = ZSWR0_CLR_INTR;
- return(ZRING_MAKE(ZRING_XINT, 0));
- }
- cs->cs_tbc = i - 1;
- zc->zc_data = *cs->cs_tba++;
- zc->zc_csr = ZSWR0_CLR_INTR;
- return (0);
-}
-
-static int
-zssint(cs, zc)
-register struct zs_chanstate *cs;
-register volatile struct zschan *zc;
-{
- register int rr0;
-
- rr0 = zc->zc_csr;
- zc->zc_csr = ZSWR0_RESET_STATUS;
- zc->zc_csr = ZSWR0_CLR_INTR;
- /*
- * The chip's hardware flow control is, as noted in zsreg.h,
- * busted---if the DCD line goes low the chip shuts off the
- * receiver (!). If we want hardware CTS flow control but do
- * not have it, and carrier is now on, turn HFC on; if we have
- * HFC now but carrier has gone low, turn it off.
- */
- if(rr0 & ZSRR0_DCD) {
- if(cs->cs_ttyp->t_cflag & CCTS_OFLOW &&
- (cs->cs_creg[3] & ZSWR3_HFC) == 0) {
- cs->cs_creg[3] |= ZSWR3_HFC;
- ZS_WRITE(zc, 3, cs->cs_creg[3]);
- }
- }
- else {
- if (cs->cs_creg[3] & ZSWR3_HFC) {
- cs->cs_creg[3] &= ~ZSWR3_HFC;
- ZS_WRITE(zc, 3, cs->cs_creg[3]);
- }
- }
- return(ZRING_MAKE(ZRING_SINT, rr0));
-}
-
-/*
- * Print out a ring or fifo overrun error message.
- */
-static void
-zsoverrun(unit, ptime, what)
-int unit;
-long *ptime;
-char *what;
-{
-
- if(*ptime != time.tv_sec) {
- *ptime = time.tv_sec;
- log(LOG_WARNING, "zs%d%c: %s overrun\n", unit >> 1,
- (unit & 1) + 'a', what);
- }
-}
-
-/*
- * ZS software interrupt. Scan all channels for deferred interrupts.
- */
-int
-zssoft(sr)
-long sr;
-{
- register struct zs_chanstate *cs;
- register volatile struct zschan *zc;
- register struct linesw *line;
- register struct tty *tp;
- register int get, n, c, cc, unit, s;
- int retval = 0;
-
- cb_scheduled = 0;
- s = spltty();
- for(cs = zslist; cs != NULL; cs = cs->cs_next) {
- get = cs->cs_rbget;
-again:
- n = cs->cs_rbput; /* atomic */
- if(get == n) /* nothing more on this line */
- continue;
- retval = 1;
- unit = cs->cs_unit; /* set up to handle interrupts */
- zc = cs->cs_zc;
- tp = cs->cs_ttyp;
- line = &linesw[tp->t_line];
- /*
- * Compute the number of interrupts in the receive ring.
- * If the count is overlarge, we lost some events, and
- * must advance to the first valid one. It may get
- * overwritten if more data are arriving, but this is
- * too expensive to check and gains nothing (we already
- * lost out; all we can do at this point is trade one
- * kind of loss for another).
- */
- n -= get;
- if(n > ZLRB_RING_SIZE) {
- zsoverrun(unit, &cs->cs_rotime, "ring");
- get += n - ZLRB_RING_SIZE;
- n = ZLRB_RING_SIZE;
- }
- while(--n >= 0) {
- /* race to keep ahead of incoming interrupts */
- c = cs->cs_rbuf[get++ & ZLRB_RING_MASK];
- switch (ZRING_TYPE(c)) {
-
- case ZRING_RINT:
- c = ZRING_VALUE(c);
- if(c & ZSRR1_DO)
- zsoverrun(unit, &cs->cs_fotime, "fifo");
- cc = c >> 8;
- if(c & ZSRR1_FE)
- cc |= TTY_FE;
- if(c & ZSRR1_PE)
- cc |= TTY_PE;
- line->l_rint(cc, tp);
- break;
-
- case ZRING_XINT:
- /*
- * Transmit done: change registers and resume,
- * or clear BUSY.
- */
- if(cs->cs_heldchange) {
- int sps;
-
- sps = splzs();
- c = zc->zc_csr;
- if((c & ZSRR0_DCD) == 0)
- cs->cs_preg[3] &= ~ZSWR3_HFC;
- bcopy((caddr_t)cs->cs_preg,
- (caddr_t)cs->cs_creg, 16);
- zs_loadchannelregs(zc, cs->cs_creg);
- splx(sps);
- cs->cs_heldchange = 0;
- if(cs->cs_heldtbc
- && (tp->t_state & TS_TTSTOP) == 0) {
- cs->cs_tbc = cs->cs_heldtbc - 1;
- zc->zc_data = *cs->cs_tba++;
- goto again;
- }
- }
- tp->t_state &= ~TS_BUSY;
- if(tp->t_state & TS_FLUSH)
- tp->t_state &= ~TS_FLUSH;
- else ndflush(&tp->t_outq,cs->cs_tba
- - (caddr_t)tp->t_outq.c_cf);
- line->l_start(tp);
- break;
-
- case ZRING_SINT:
- /*
- * Status line change. HFC bit is run in
- * hardware interrupt, to avoid locking
- * at splzs here.
- */
- c = ZRING_VALUE(c);
- if((c ^ cs->cs_rr0) & ZSRR0_DCD) {
- cc = (c & ZSRR0_DCD) != 0;
- if(line->l_modem(tp, cc) == 0)
- zs_modem(cs, ZSWR5_RTS|ZSWR5_DTR,
- cc ? DMBIS : DMBIC);
- }
- cs->cs_rr0 = c;
- break;
-
- default:
- log(LOG_ERR, "zs%d%c: bad ZRING_TYPE (%x)\n",
- unit >> 1, (unit & 1) + 'a', c);
- break;
- }
- }
- cs->cs_rbget = get;
- goto again;
- }
- splx(s);
- return (retval);
-}
-
-int
-zsioctl(dev, cmd, data, flag, p)
-dev_t dev;
-u_long cmd;
-caddr_t data;
-int flag;
-struct proc *p;
-{
- int unit = ZS_UNIT(dev);
- struct zs_softc *zi = zscd.cd_devs[unit >> 1];
- register struct tty *tp = zi->zi_cs[unit & 1].cs_ttyp;
- register int error, s;
- register struct zs_chanstate *cs = &zi->zi_cs[unit & 1];
-
- error = linesw[tp->t_line].l_ioctl(tp, cmd, data, flag, p);
- if(error >= 0)
- return(error);
- error = ttioctl(tp, cmd, data, flag, p);
- if(error >= 0)
- return (error);
-
- switch (cmd) {
- case TIOCSBRK:
- s = splzs();
- cs->cs_preg[5] |= ZSWR5_BREAK;
- cs->cs_creg[5] |= ZSWR5_BREAK;
- ZS_WRITE(cs->cs_zc, 5, cs->cs_creg[5]);
- splx(s);
- break;
- case TIOCCBRK:
- s = splzs();
- cs->cs_preg[5] &= ~ZSWR5_BREAK;
- cs->cs_creg[5] &= ~ZSWR5_BREAK;
- ZS_WRITE(cs->cs_zc, 5, cs->cs_creg[5]);
- splx(s);
- break;
- case TIOCGFLAGS: {
- int bits = 0;
-
- if(cs->cs_softcar)
- bits |= TIOCFLAG_SOFTCAR;
- if(cs->cs_creg[15] & ZSWR15_DCD_IE)
- bits |= TIOCFLAG_CLOCAL;
- if(cs->cs_creg[3] & ZSWR3_HFC)
- bits |= TIOCFLAG_CRTSCTS;
- *(int *)data = bits;
- break;
- }
- case TIOCSFLAGS: {
- int userbits, driverbits = 0;
-
- error = suser(p->p_ucred, &p->p_acflag);
- if(error != 0)
- return (EPERM);
-
- userbits = *(int *)data;
-
- /*
- * can have `local' or `softcar', and `rtscts' or `mdmbuf'
- # defaulting to software flow control.
- */
- if(userbits & TIOCFLAG_SOFTCAR && userbits & TIOCFLAG_CLOCAL)
- return(EINVAL);
- if(userbits & TIOCFLAG_MDMBUF) /* don't support this (yet?) */
- return(ENODEV);
-
- s = splzs();
- if((userbits & TIOCFLAG_SOFTCAR)) {
- cs->cs_softcar = 1; /* turn on softcar */
- cs->cs_preg[15] &= ~ZSWR15_DCD_IE; /* turn off dcd */
- cs->cs_creg[15] &= ~ZSWR15_DCD_IE;
- ZS_WRITE(cs->cs_zc, 15, cs->cs_creg[15]);
- }
- else if(userbits & TIOCFLAG_CLOCAL) {
- cs->cs_softcar = 0; /* turn off softcar */
- cs->cs_preg[15] |= ZSWR15_DCD_IE; /* turn on dcd */
- cs->cs_creg[15] |= ZSWR15_DCD_IE;
- ZS_WRITE(cs->cs_zc, 15, cs->cs_creg[15]);
- tp->t_termios.c_cflag |= CLOCAL;
- }
- if(userbits & TIOCFLAG_CRTSCTS) {
- cs->cs_preg[15] |= ZSWR15_CTS_IE;
- cs->cs_creg[15] |= ZSWR15_CTS_IE;
- ZS_WRITE(cs->cs_zc, 15, cs->cs_creg[15]);
- cs->cs_preg[3] |= ZSWR3_HFC;
- cs->cs_creg[3] |= ZSWR3_HFC;
- ZS_WRITE(cs->cs_zc, 3, cs->cs_creg[3]);
- tp->t_termios.c_cflag |= CRTSCTS;
- }
- else {
- /* no mdmbuf, so we must want software flow control */
- cs->cs_preg[15] &= ~ZSWR15_CTS_IE;
- cs->cs_creg[15] &= ~ZSWR15_CTS_IE;
- ZS_WRITE(cs->cs_zc, 15, cs->cs_creg[15]);
- cs->cs_preg[3] &= ~ZSWR3_HFC;
- cs->cs_creg[3] &= ~ZSWR3_HFC;
- ZS_WRITE(cs->cs_zc, 3, cs->cs_creg[3]);
- tp->t_termios.c_cflag &= ~CRTSCTS;
- }
- splx(s);
- break;
- }
- case TIOCSDTR:
- zs_modem(cs, ZSWR5_DTR, DMBIS);
- break;
- case TIOCCDTR:
- zs_modem(cs, ZSWR5_DTR, DMBIC);
- break;
- case TIOCMGET:
- zs_modem(cs, 0, DMGET);
- break;
- case TIOCMSET:
- case TIOCMBIS:
- case TIOCMBIC:
- default:
- return (ENOTTY);
- }
- return (0);
-}
-
-/*
- * Start or restart transmission.
- */
-static void
-zsstart(tp)
-register struct tty *tp;
-{
- register struct zs_chanstate *cs;
- register int s, nch;
- int unit = ZS_UNIT(tp->t_dev);
- struct zs_softc *zi = zscd.cd_devs[unit >> 1];
-
- cs = &zi->zi_cs[unit & 1];
- s = spltty();
-
- /*
- * If currently active or delaying, no need to do anything.
- */
- if(tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP))
- goto out;
-
- /*
- * If there are sleepers, and output has drained below low
- * water mark, awaken.
- */
- if(tp->t_outq.c_cc <= tp->t_lowat) {
- if(tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
-
- nch = ndqb(&tp->t_outq, 0); /* XXX */
- if(nch) {
- register char *p = tp->t_outq.c_cf;
-
- /* mark busy, enable tx done interrupts, & send first byte */
- tp->t_state |= TS_BUSY;
- (void) splzs();
- cs->cs_preg[1] |= ZSWR1_TIE;
- cs->cs_creg[1] |= ZSWR1_TIE;
- ZS_WRITE(cs->cs_zc, 1, cs->cs_creg[1]);
- cs->cs_zc->zc_data = *p;
- cs->cs_tba = p + 1;
- cs->cs_tbc = nch - 1;
- } else {
- /*
- * Nothing to send, turn off transmit done interrupts.
- * This is useful if something is doing polled output.
- */
- (void) splzs();
- cs->cs_preg[1] &= ~ZSWR1_TIE;
- cs->cs_creg[1] &= ~ZSWR1_TIE;
- ZS_WRITE(cs->cs_zc, 1, cs->cs_creg[1]);
- }
-out:
- splx(s);
-}
-
-/*
- * Stop output, e.g., for ^S or output flush.
- */
-void
-zsstop(tp, flag)
-register struct tty *tp;
- int flag;
-{
- register struct zs_chanstate *cs;
- register int s, unit = ZS_UNIT(tp->t_dev);
- struct zs_softc *zi = zscd.cd_devs[unit >> 1];
-
- cs = &zi->zi_cs[unit & 1];
- s = splzs();
- if(tp->t_state & TS_BUSY) {
- /*
- * Device is transmitting; must stop it.
- */
- cs->cs_tbc = 0;
- if ((tp->t_state & TS_TTSTOP) == 0)
- tp->t_state |= TS_FLUSH;
- }
- splx(s);
-}
-
-/*
- * Set ZS tty parameters from termios.
- *
- * This routine makes use of the fact that only registers
- * 1, 3, 4, 5, 9, 10, 11, 12, 13, 14, and 15 are written.
- */
-static int
-zsparam(tp, t)
-register struct tty *tp;
-register struct termios *t;
-{
- int unit = ZS_UNIT(tp->t_dev);
- struct zs_softc *zi = zscd.cd_devs[unit >> 1];
- register struct zs_chanstate *cs = &zi->zi_cs[unit & 1];
- int cdiv, clkm, brgm, tcon;
- register int tmp, tmp5, cflag, s;
-
- tmp = t->c_ospeed;
- tmp5 = t->c_ispeed;
- if(tmp < 0 || (tmp5 && tmp5 != tmp))
- return(EINVAL);
- if(tmp == 0) {
- /* stty 0 => drop DTR and RTS */
- zs_modem(cs, 0, DMSET);
- return(0);
- }
- tmp = zsbaudrate(unit, tmp, &cdiv, &clkm, &brgm, &tcon);
- if (tmp < 0)
- return(EINVAL);
- tp->t_ispeed = tp->t_ospeed = tmp;
-
- cflag = tp->t_cflag = t->c_cflag;
- if (cflag & CSTOPB)
- cdiv |= ZSWR4_TWOSB;
- else
- cdiv |= ZSWR4_ONESB;
- if (!(cflag & PARODD))
- cdiv |= ZSWR4_EVENP;
- if (cflag & PARENB)
- cdiv |= ZSWR4_PARENB;
-
- switch(cflag & CSIZE) {
- case CS5:
- tmp = ZSWR3_RX_5;
- tmp5 = ZSWR5_TX_5;
- break;
- case CS6:
- tmp = ZSWR3_RX_6;
- tmp5 = ZSWR5_TX_6;
- break;
- case CS7:
- tmp = ZSWR3_RX_7;
- tmp5 = ZSWR5_TX_7;
- break;
- case CS8:
- default:
- tmp = ZSWR3_RX_8;
- tmp5 = ZSWR5_TX_8;
- break;
- }
- tmp |= ZSWR3_RX_ENABLE;
- tmp5 |= ZSWR5_TX_ENABLE | ZSWR5_DTR | ZSWR5_RTS;
-
- /*
- * Block interrupts so that state will not
- * be altered until we are done setting it up.
- */
- s = splzs();
- cs->cs_preg[4] = cdiv;
- cs->cs_preg[11] = clkm;
- cs->cs_preg[12] = tcon;
- cs->cs_preg[13] = tcon >> 8;
- cs->cs_preg[14] = brgm;
- cs->cs_preg[1] = ZSWR1_RIE | ZSWR1_TIE | ZSWR1_SIE;
- cs->cs_preg[9] = ZSWR9_MASTER_IE | ZSWR9_VECTOR_INCL_STAT;
- cs->cs_preg[10] = ZSWR10_NRZ;
- cs->cs_preg[15] = ZSWR15_BREAK_IE | ZSWR15_DCD_IE;
-
- /*
- * Output hardware flow control on the chip is horrendous: if
- * carrier detect drops, the receiver is disabled. Hence we
- * can only do this when the carrier is on.
- */
- if(cflag & CCTS_OFLOW && cs->cs_zc->zc_csr & ZSRR0_DCD)
- tmp |= ZSWR3_HFC;
- cs->cs_preg[3] = tmp;
- cs->cs_preg[5] = tmp5;
-
- /*
- * If nothing is being transmitted, set up new current values,
- * else mark them as pending.
- */
- if(cs->cs_heldchange == 0) {
- if (cs->cs_ttyp->t_state & TS_BUSY) {
- cs->cs_heldtbc = cs->cs_tbc;
- cs->cs_tbc = 0;
- cs->cs_heldchange = 1;
- } else {
- bcopy((caddr_t)cs->cs_preg, (caddr_t)cs->cs_creg, 16);
- zs_loadchannelregs(cs->cs_zc, cs->cs_creg);
- }
- }
- splx(s);
- return (0);
-}
-
-/*
- * search for the best matching baudrate
- */
-static int
-zsbaudrate(unit, wanted, divisor, clockmode, brgenmode, timeconst)
-int unit, wanted, *divisor, *clockmode, *brgenmode, *timeconst;
-{
- int bestdiff, bestbps, source;
-
- unit = (unit & 1) << 2;
- for (source = 0; source < 4; ++source) {
- long freq = zs_frequencies[unit + source];
- int diff, bps, div, clkm, brgm, tcon;
- switch (source) {
- case 0: /* BRgen, PCLK */
- brgm = ZSWR14_BAUD_ENA|ZSWR14_BAUD_FROM_PCLK;
- break;
- case 1: /* BRgen, RTxC */
- brgm = ZSWR14_BAUD_ENA;
- break;
- case 2: /* RTxC */
- clkm = ZSWR11_RXCLK_RTXC|ZSWR11_TXCLK_RTXC;
- break;
- case 3: /* TRxC */
- clkm = ZSWR11_RXCLK_TRXC|ZSWR11_TXCLK_TRXC;
- break;
- }
- switch (source) {
- case 0:
- case 1:
- div = ZSWR4_CLK_X16;
- clkm = ZSWR11_RXCLK_BAUD|ZSWR11_TXCLK_BAUD;
- tcon = BPS_TO_TCONST(freq, wanted);
- if (tcon < 0)
- tcon = 0;
- bps = TCONST_TO_BPS(freq, tcon);
- break;
- case 2:
- case 3:
- { int b1 = freq / 16, d1 = abs(b1 - wanted);
- int b2 = freq / 32, d2 = abs(b2 - wanted);
- int b3 = freq / 64, d3 = abs(b3 - wanted);
-
- if (d1 < d2 && d1 < d3) {
- div = ZSWR4_CLK_X16;
- bps = b1;
- } else if (d2 < d3 && d2 < d1) {
- div = ZSWR4_CLK_X32;
- bps = b2;
- } else {
- div = ZSWR4_CLK_X64;
- bps = b3;
- }
- brgm = tcon = 0;
- break;
- }
- }
- diff = abs(bps - wanted);
- if (!source || diff < bestdiff) {
- *divisor = div;
- *clockmode = clkm;
- *brgenmode = brgm;
- *timeconst = tcon;
- bestbps = bps;
- bestdiff = diff;
- if (diff == 0)
- break;
- }
- }
- /* Allow deviations upto 5% */
- if (20 * bestdiff > wanted)
- return -1;
- return bestbps;
-}
-
-/*
- * Raise or lower modem control (DTR/RTS) signals. If a character is
- * in transmission, the change is deferred.
- */
-static int
-zs_modem(cs, bits, how)
-struct zs_chanstate *cs;
-int bits, how;
-{
- int s, mbits;
-
- bits &= ZSWR5_DTR | ZSWR5_RTS;
-
- s = splzs();
- mbits = cs->cs_preg[5] & (ZSWR5_DTR | ZSWR5_RTS);
-
- switch(how) {
- case DMSET:
- mbits = bits;
- break;
- case DMBIS:
- mbits |= bits;
- break;
- case DMBIC:
- mbits &= ~bits;
- break;
- case DMGET:
- splx(s);
- return(mbits);
- }
-
- cs->cs_preg[5] = (cs->cs_preg[5] & ~(ZSWR5_DTR | ZSWR5_RTS)) | mbits;
- if(cs->cs_heldchange == 0) {
- if(cs->cs_ttyp->t_state & TS_BUSY) {
- cs->cs_heldtbc = cs->cs_tbc;
- cs->cs_tbc = 0;
- cs->cs_heldchange = 1;
- }
- else {
- ZS_WRITE(cs->cs_zc, 5, cs->cs_creg[5]);
- }
- }
- splx(s);
- return(0);
-}
-
-/*
- * Write the given register set to the given zs channel in the proper order.
- * The channel must not be transmitting at the time. The receiver will
- * be disabled for the time it takes to write all the registers.
- */
-static void
-zs_loadchannelregs(zc, reg)
-volatile struct zschan *zc;
-u_char *reg;
-{
- int i;
-
- zc->zc_csr = ZSM_RESET_ERR; /* reset error condition */
- i = zc->zc_data; /* drain fifo */
- i = zc->zc_data;
- i = zc->zc_data;
- ZS_WRITE(zc, 4, reg[4]);
- ZS_WRITE(zc, 10, reg[10]);
- ZS_WRITE(zc, 3, reg[3] & ~ZSWR3_RX_ENABLE);
- ZS_WRITE(zc, 5, reg[5] & ~ZSWR5_TX_ENABLE);
- ZS_WRITE(zc, 1, reg[1]);
- ZS_WRITE(zc, 9, reg[9]);
- ZS_WRITE(zc, 11, reg[11]);
- ZS_WRITE(zc, 12, reg[12]);
- ZS_WRITE(zc, 13, reg[13]);
- ZS_WRITE(zc, 14, reg[14]);
- ZS_WRITE(zc, 15, reg[15]);
- ZS_WRITE(zc, 3, reg[3]);
- ZS_WRITE(zc, 5, reg[5]);
-}
-#endif /* NZS > 1 */
diff --git a/sys/arch/atari/dev/zsvar.h b/sys/arch/atari/dev/zsvar.h
deleted file mode 100644
index 35d5f374cb2..00000000000
--- a/sys/arch/atari/dev/zsvar.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/* $NetBSD: zsvar.h,v 1.5 1996/01/24 19:26:40 gwr Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman (Atari modifications)
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)zsvar.h 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * Register layout is machine-dependent...
- */
-
-struct zschan {
- u_char zc_xxx0;
- volatile u_char zc_csr; /* ctrl,status, and indirect access */
- u_char zc_xxx1;
- volatile u_char zc_data; /* data */
-};
-
-struct zsdevice {
- struct zschan zs_chan[2];
-};
-
-/*
- * Software state, per zs channel.
- *
- * The zs chip has insufficient buffering, so we provide a software
- * buffer using a two-level interrupt scheme. The hardware (high priority)
- * interrupt simply grabs the `cause' of the interrupt and stuffs it into
- * a ring buffer. It then schedules a software interrupt; the latter
- * empties the ring as fast as it can, hoping to avoid overflow.
- *
- * Interrupts can happen because of:
- * - received data;
- * - transmit pseudo-DMA done; and
- * - status change.
- * These are all stored together in the (single) ring. The size of the
- * ring is a power of two, to make % operations fast. Since we need two
- * bits to distinguish the interrupt type, and up to 16 for the received
- * data plus RR1 status, we use 32 bits per ring entry.
- *
- * When the value is a character + RR1 status, the character is in the
- * upper 8 bits of the RR1 status.
- */
-#define ZLRB_RING_SIZE 4096 /* ZS line ring buffer size */
-#define ZLRB_RING_MASK 4095 /* mask for same */
-
-/* 0 is reserved (means "no interrupt") */
-#define ZRING_RINT 1 /* receive data interrupt */
-#define ZRING_XINT 2 /* transmit done interrupt */
-#define ZRING_SINT 3 /* status change interrupt */
-
-#define ZRING_TYPE(x) ((x) & 3)
-#define ZRING_VALUE(x) ((x) >> 8)
-#define ZRING_MAKE(t, v) ((t) | (v) << 8)
-
-struct zs_chanstate {
- struct zs_chanstate *cs_next; /* linked list for zshard() */
- volatile struct zschan *cs_zc; /* points to hardware regs */
- int cs_unit; /* unit number */
- struct tty *cs_ttyp; /* ### */
-
- /*
- * We must keep a copy of the write registers as they are
- * mostly write-only and we sometimes need to set and clear
- * individual bits (e.g., in WR3). Not all of these are
- * needed but 16 bytes is cheap and this makes the addressing
- * simpler. Unfortunately, we can only write to some registers
- * when the chip is not actually transmitting, so whenever
- * we are expecting a `transmit done' interrupt the preg array
- * is allowed to `get ahead' of the current values. In a
- * few places we must change the current value of a register,
- * rather than (or in addition to) the pending value; for these
- * cs_creg[] contains the current value.
- */
- u_char cs_creg[16]; /* current values */
- u_char cs_preg[16]; /* pending values */
- u_char cs_heldchange; /* change pending (creg != preg) */
- u_char cs_rr0; /* last rr0 processed */
-
- /* pure software data, per channel */
- char cs_softcar; /* software carrier */
- char cs_xxx; /* (spare) */
-
- /*
- * The transmit byte count and address are used for pseudo-DMA
- * output in the hardware interrupt code. PDMA can be suspended
- * to get pending changes done; heldtbc is used for this. It can
- * also be stopped for ^S; this sets TS_TTSTOP in tp->t_state.
- */
- int cs_tbc; /* transmit byte count */
- caddr_t cs_tba; /* transmit buffer address */
- int cs_heldtbc; /* held tbc while xmission stopped */
-
- /*
- * Printing an overrun error message often takes long enough to
- * cause another overrun, so we only print one per second.
- */
- long cs_rotime; /* time of last ring overrun */
- long cs_fotime; /* time of last fifo overrun */
-
- /*
- * The ring buffer.
- */
- u_int cs_rbget; /* ring buffer `get' index */
- volatile u_int cs_rbput; /* ring buffer `put' index */
- int *cs_rbuf; /* type, value pairs */
-};
-
-#define ZS_CHAN_A 0
-#define ZS_CHAN_B 1
-
-/*
- * Macros to read and write individual registers (except 0) in a channel.
- */
-#define ZS_READ(c, r) ((c)->zc_csr = (r), (c)->zc_csr)
-#define ZS_WRITE(c, r, v) ((c)->zc_csr = (r), (c)->zc_csr = (v))
-
-/*
- * Split minor into unit & flag nibble.
- */
-#define ZS_UNIT(dev) ((minor(dev) >> 4) & 0xf)
-#define ZS_FLAGS(dev) (minor(dev) & 0xf)
diff --git a/sys/arch/atari/include/acia.h b/sys/arch/atari/include/acia.h
deleted file mode 100644
index 870b900b2df..00000000000
--- a/sys/arch/atari/include/acia.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* $NetBSD: acia.h,v 1.3 1995/06/09 19:47:30 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_ACIA_H
-#define _MACHINE_ACIA_H
-/*
- * Atari ST hardware:
- * Motorola 6850 Asynchronous Communications Interface Adapter
- */
-
-#define KBD (((struct acia *)AD_ACIA))
-#define MDI (((struct acia *)AD_ACIA) + 1)
-
-struct acia {
- volatile u_char acb[4]; /* use only the even bytes */
-};
-
-#define ac_cs acb[0] /* control and status register */
-#define ac_da acb[2] /* data register */
-
-/* bits in control register: */
-/* 0x03 *//* clock divider */
-#define A_Q01 0x00 /* don't divide */
-#define A_Q16 0x01 /* divide by 16 */
-#define A_Q64 0x02 /* divide by 64 */
-#define A_RESET 0x03 /* master reset */
-/* 0x1C *//* word select bits */
-#define A_72E 0x00 /* 7 data, 2 stop, parity even */
-#define A_72O 0x04 /* 7 data, 2 stop, parity odd */
-#define A_71E 0x08 /* 7 data, 1 stop, parity even */
-#define A_71O 0x0C /* 7 data, 1 stop, parity odd */
-#define A_82N 0x10 /* 8 data, 2 stop, no parity */
-#define A_81N 0x14 /* 8 data, 1 stop, no parity */
-#define A_81E 0x18 /* 8 data, 1 stop, parity even */
-#define A_81O 0x1C /* 8 data, 1 stop, parity odd */
-/* 0x60 *//* RTS Low/High, TXINT en/dis, BREAK */
-#define A_TXPOL 0x00 /* RTS Low, TXINT disabled */
-#define A_TXINT 0x20 /* RTS Low, TXINT enabled */
-#define A_TXOFF 0x40 /* RTS High, TXINT disabled */
-#define A_BREAK 0x60 /* RTS Low, TXINT disabled, BREAK */
-#define A_RXINT 0x80 /* enable receiver interrupt */
-
-/* bits in status register: */
-#define A_RXRDY 0x01 /* receiver ready */
-#define A_TXRDY 0x02 /* transmitter ready */
-#define A_CLOST 0x04 /* Carrier Lost */
-#define A_CTS 0x08 /* Clear To Send */
-#define A_FE 0x10 /* Frame Error */
-#define A_OE 0x20 /* Overrun Error */
-#define A_PE 0x40 /* Parity Error */
-#define A_IRQ 0x80 /* State of IRQ signal */
-
-/* values for the TT: */
-#define KBD_INIT (A_81N|A_Q64)
-#define MDI_INIT (A_81N|A_Q16)
-
-#endif /* _MACHINE_ACIA_H */
diff --git a/sys/arch/atari/include/ansi.h b/sys/arch/atari/include/ansi.h
deleted file mode 100644
index 31de7856c33..00000000000
--- a/sys/arch/atari/include/ansi.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $NetBSD: ansi.h,v 1.1.1.1 1995/03/26 07:12:09 leo Exp $ */
-
-#ifndef _MACHINE_ANSI_H_
-#define _MACHINE_ANSI_H_
-
-#include <m68k/ansi.h>
-
-#endif
diff --git a/sys/arch/atari/include/asm.h b/sys/arch/atari/include/asm.h
deleted file mode 100644
index c5f3dd8a213..00000000000
--- a/sys/arch/atari/include/asm.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $NetBSD: asm.h,v 1.1.1.1 1995/03/26 07:12:06 leo Exp $ */
-
-#ifndef _MACHINE_ASM_H_
-#define _MACHINE_ASM_H_
-
-#include <m68k/asm.h>
-
-#endif
diff --git a/sys/arch/atari/include/cdefs.h b/sys/arch/atari/include/cdefs.h
deleted file mode 100644
index fbb4f3a5b98..00000000000
--- a/sys/arch/atari/include/cdefs.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $NetBSD: cdefs.h,v 1.1.1.1 1995/03/26 07:12:08 leo Exp $ */
-
-#ifndef _MACHINE_CDEFS_H_
-#define _MACHINE_CDEFS_H_
-
-#include <m68k/cdefs.h>
-
-#endif
diff --git a/sys/arch/atari/include/cpu.h b/sys/arch/atari/include/cpu.h
deleted file mode 100644
index b887861929f..00000000000
--- a/sys/arch/atari/include/cpu.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/* $OpenBSD: cpu.h,v 1.4 1998/03/01 00:37:29 niklas Exp $ */
-/* $NetBSD: cpu.h,v 1.10 1996/01/19 13:46:56 leo Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: cpu.h 1.16 91/03/25$
- *
- * @(#)cpu.h 7.7 (Berkeley) 6/27/91
- */
-
-#ifndef _MACHINE_CPU_H_
-#define _MACHINE_CPU_H_
-
-/*
- * Exported definitions unique to atari/68k cpu support.
- */
-
-/*
- * definitions of cpu-dependent requirements
- * referenced in generic code
- */
-#define cpu_swapin(p) /* nothing */
-#define cpu_wait(p) /* nothing */
-#define cpu_swapout(p) /* nothing */
-
-/*
- * Arguments to hardclock and gatherstats encapsulate the previous
- * machine state in an opaque clockframe. On the hp300, we use
- * what the hardware pushes on an interrupt (frame format 0).
- */
-struct clockframe {
- u_short sr; /* sr at time of interrupt */
- u_long pc; /* pc at time of interrupt */
- u_short vo; /* vector offset (4-word frame) */
-};
-
-#define CLKF_USERMODE(framep) (((framep)->sr & PSL_S) == 0)
-#define CLKF_BASEPRI(framep) (((framep)->sr & PSL_IPL) == 0)
-#define CLKF_PC(framep) ((framep)->pc)
-#if 0
-/* We would like to do it this way... */
-#define CLKF_INTR(framep) (((framep)->sr & PSL_M) == 0)
-#else
-/* but until we start using PSL_M, we have to do this instead */
-#define CLKF_INTR(framep) (0) /* XXX */
-#endif
-
-
-/*
- * Preempt the current process if in interrupt from user mode,
- * or after the current trap/syscall if in system mode.
- */
-#define need_resched() {want_resched = 1; setsoftast();}
-
-/*
- * Give a profiling tick to the current process from the softclock
- * interrupt. On hp300, request an ast to send us through trap(),
- * marking the proc as needing a profiling tick.
- */
-#define profile_tick(p, framep) ((p)->p_flag |= P_OWEUPC, setsoftast())
-#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, setsoftast())
-
-/*
- * Notify the current process (p) that it has a signal pending,
- * process as soon as possible.
- */
-#define signotify(p) setsoftast()
-
-#define setsoftast() (astpending = 1)
-
-extern int astpending; /* need trap before returning to user mode */
-extern int want_resched; /* resched() was called */
-
-/* include support for software interrupts */
-#include <machine/mtpr.h>
-
-/*
- * The rest of this should probably be moved to ../atari/ataricpu.h,
- * although some of it could probably be put into generic 68k headers.
- */
-#define BASEPRI(sr) ((sr & PSL_IPL) == 0)
-
-/*
- * Values for machineid.
- */
-#define ATARI_68000 1 /* 68000 CPU */
-#define ATARI_68010 (1<<1) /* 68010 CPU */
-#define ATARI_68020 (1L<<2) /* 68020 CPU */
-#define ATARI_68030 (1L<<3) /* 68030 CPU */
-#define ATARI_68040 (1L<<4) /* 68040 CPU */
-#define ATARI_TT (1L<<11)
-#define ATARI_FALCON (1L<<12)
-
-#define ATARI_CLKBROKEN (1L<<16)
-
-#define ATARI_ANYCPU (ATARI_68000|ATARI_68010|ATARI_68020|ATARI_68030 \
- |ATARI_68040)
-
-/*
- * Values for mmutype (assigned for quick testing)
- */
-#define MMU_68030 -1 /* 68030 on-chip subset of 68851 */
-#define MMU_68851 1 /* Motorola 68851 */
-#define MMU_68040 -2 /* 68040 on-chip subsubset */
-
-#ifdef _KERNEL
-extern int machineid, mmutype, cpu040, fputype;
-#endif
-
-/*
- * 68851 and 68030 MMU
- */
-#define PMMU_LVLMASK 0x0007
-#define PMMU_INV 0x0400
-#define PMMU_WP 0x0800
-#define PMMU_ALV 0x1000
-#define PMMU_SO 0x2000
-#define PMMU_LV 0x4000
-#define PMMU_BE 0x8000
-#define PMMU_FAULT (PMMU_WP|PMMU_INV)
-
-/* 680X0 function codes */
-#define FC_USERD 1 /* user data space */
-#define FC_USERP 2 /* user program space */
-#define FC_SUPERD 5 /* supervisor data space */
-#define FC_SUPERP 6 /* supervisor program space */
-#define FC_CPU 7 /* CPU space */
-
-/* fields in the 68020 cache control register */
-#define IC_ENABLE 0x0001 /* enable instruction cache */
-#define IC_FREEZE 0x0002 /* freeze instruction cache */
-#define IC_CE 0x0004 /* clear instruction cache entry */
-#define IC_CLR 0x0008 /* clear entire instruction cache */
-
-/* additional fields in the 68030 cache control register */
-#define IC_BE 0x0010 /* instruction burst enable */
-#define DC_ENABLE 0x0100 /* data cache enable */
-#define DC_FREEZE 0x0200 /* data cache freeze */
-#define DC_CE 0x0400 /* clear data cache entry */
-#define DC_CLR 0x0800 /* clear entire data cache */
-#define DC_BE 0x1000 /* data burst enable */
-#define DC_WA 0x2000 /* write allocate */
-
-/* fields in the 68040 cache control register */
-#define IC40_ENABLE 0x00008000 /* enable instruction cache */
-#define DC40_ENABLE 0x80000000 /* enable data cache */
-
-#define CACHE_ON (DC_WA|DC_BE|DC_CLR|DC_ENABLE|IC_BE|IC_CLR|IC_ENABLE)
-#define CACHE_OFF (DC_CLR|IC_CLR)
-#define CACHE_CLR (CACHE_ON)
-#define IC_CLEAR (DC_WA|DC_BE|DC_ENABLE|IC_BE|IC_CLR|IC_ENABLE)
-#define DC_CLEAR (DC_WA|DC_BE|DC_CLR|DC_ENABLE|IC_BE|IC_ENABLE)
-
-/* 68040 cache control */
-#define CACHE40_ON (IC40_ENABLE|DC40_ENABLE)
-#define CACHE40_OFF 0x00000000
-
-/*
- * CTL_MACHDEP definitions.
- */
-#define CPU_CONSDEV 1 /* dev_t: console terminal device */
-#define CPU_MAXID 2 /* number of valid machdep ids */
-
-#define CTL_MACHDEP_NAMES { \
- { 0, 0 }, \
- { "console_device", CTLTYPE_STRUCT }, \
-}
-
-#ifdef _KERNEL
-
-/*
- * Prototypes from pmap.c:
- */
-void pmap_bootstrap __P((vm_offset_t));
-vm_offset_t pmap_map __P((vm_offset_t, vm_offset_t, vm_offset_t, int));
-
-#endif /* _KERNEL */
-
-#endif /* !_MACHINE_CPU_H_ */
diff --git a/sys/arch/atari/include/cpufunc.h b/sys/arch/atari/include/cpufunc.h
deleted file mode 100644
index 3c7842e30b4..00000000000
--- a/sys/arch/atari/include/cpufunc.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $NetBSD: cpufunc.h,v 1.1.1.1 1995/03/26 07:12:05 leo Exp $ */
-
-/*
- * Functions to provide access to special cpu instructions.
- */
-#ifndef _MACHINE_CPUFUNC_H_
-#define _MACHINE_CPUFUNC_H_
-#endif /* !_MACHINE_CPUFUNC_H_ */
diff --git a/sys/arch/atari/include/db_machdep.h b/sys/arch/atari/include/db_machdep.h
deleted file mode 100644
index 896d316688c..00000000000
--- a/sys/arch/atari/include/db_machdep.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $NetBSD: db_machdep.h,v 1.1.1.1 1995/03/26 07:12:06 leo Exp $ */
-
-#ifndef _MACHINE_DB_MACHDEP_H_
-#define _MACHINE_DB_MACHDEP_H_
-
-#include <m68k/db_machdep.h>
-
-#endif
diff --git a/sys/arch/atari/include/disklabel.h b/sys/arch/atari/include/disklabel.h
deleted file mode 100644
index 5f9677f45a5..00000000000
--- a/sys/arch/atari/include/disklabel.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $NetBSD: disklabel.h,v 1.4 1995/11/30 00:58:03 jtc Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_DISKLABEL_H_
-#define _MACHINE_DISKLABEL_H_
-
-/*
- * On a volume, exclusively used by NetBSD, the boot block starts at
- * sector 0. To allow shared use of a volume between two or more OS's
- * the vendor specific AHDI format is supported. In this case the boot
- * block is located at the start of an AHDI partition. In any case the
- * size of the boot block is 8KB, the disk label is at offset 7KB.
- */
-#define LABELSECTOR 0 /* `natural' start of boot block */
-#define LABELOFFSET (7 * 1024) /* offset of disklabel in bytes,
- relative to start of boot block */
-#define MAXPARTITIONS 16
-#define RAW_PART 2 /* xx?c is raw partition */
-
-#define MAX_TOS_ROOTS 61 /* max. # of auxilary root sectors */
-
-struct cpu_disklabel {
- u_int32_t cd_bblock; /* start of NetBSD boot block */
-#define NO_BOOT_BLOCK ((u_int32_t) -1)
- u_int32_t cd_bslst; /* start of TOS bad sector list */
- u_int32_t cd_bslsize; /* size of TOS bad sector list */
- u_int32_t cd_roots[MAX_TOS_ROOTS]; /* TOS root sectors */
-};
-
-#endif /* _MACHINE_DISKLABEL_H_ */
diff --git a/sys/arch/atari/include/dma.h b/sys/arch/atari/include/dma.h
deleted file mode 100644
index 9e6f6659c78..00000000000
--- a/sys/arch/atari/include/dma.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* $NetBSD: dma.h,v 1.7 1995/07/11 18:27:31 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_DMA_H
-#define _MACHINE_DMA_H
-
-/*
- * Atari TT hardware:
- * FDC/ACSI DMA circuitry
- */
-
-#define DMA ((struct dma *)AD_DMA)
-
-struct dma {
- volatile short dma_gap[2]; /* reserved */
- volatile u_short dma_data; /* controller data path */
- volatile u_short dma_mode; /* mode register */
- volatile u_char dma_addr[6]; /* base address H/M/L */
- volatile u_short dma_drvmode; /* floppy density settings */
-};
-
-#define dma_nsec dma_data /* sector count */
-#define dma_stat dma_mode /* status register */
-
-/*
- * Mode register bits
- */
-/* 0x0001 *//* not used */
-#define DMA_A0 0x0002 /* signal A0 to fdc/hdc */
-#define DMA_A1 0x0004 /* signal A1 to fdc/hdc */
-#define DMA_HDC 0x0008 /* must be on if accessing hdc */
-#define DMA_SCREG 0x0010 /* access sector count register */
-/* 0x0020 *//* reserved */
-#define DMA_NODMA 0x0040 /* no DMA (yet) */
-#define DMA_FDC 0x0080 /* must be on if accessing fdc */
-#define DMA_WRBIT 0x0100 /* write to fdc/hdc via dma_data*/
-#define DMA_SCSI 0x0088 /* select 5380 chip */
-
-/*
- * Status register bits
- */
-#define DMAOK 0x0001 /* something wrong */
-#define SCNOT0 0x0002 /* sector count not 0 */
-#define DATREQ 0x0004 /* FDC data request signal */
-
-/*
- * Indices into dma_addr.
- * Access low byte of 16 bits.
- * Fill low/mid/high in this order.
- */
-#define AD_HIGH 1
-#define AD_MID 3
-#define AD_LOW 5
-
-/*
- * Defines for 'dmadrv_mode'.
- */
-#define FDC_HDSET 1 /* Set FDC for High density */
-#define FDC_HDSIG 2 /* Signal HD present to drive */
-
-/*
- * Lock status bits:
- */
-#define DMA_LOCK_REQ 1 /* DMA lock requested */
-#define DMA_LOCK_GRANT 2 /* DMA lock granted */
-
-#ifdef _KERNEL
-int st_dmagrab __P((void (*)(), void (*)(), void *, int *, int));
-void st_dmafree __P((void *, int *));
-int st_dmawanted __P((void));
-void st_dmaaddr_set __P((caddr_t));
-u_long st_dmaaddr_get __P((void));
-void st_dmacomm __P((int, int));
-#endif /* _KERNEL */
-
-#endif /* _MACHINE_DMA_H */
diff --git a/sys/arch/atari/include/endian.h b/sys/arch/atari/include/endian.h
deleted file mode 100644
index 3ec4f825ee7..00000000000
--- a/sys/arch/atari/include/endian.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* $OpenBSD: endian.h,v 1.3 1997/11/09 23:05:05 niklas Exp $ */
-/* $NetBSD: endian.h,v 1.1.1.1 1995/03/26 07:12:06 leo Exp $ */
-
-#ifndef _ATARI_ENDIAN_H_
-#define _ATARI_ENDIAN_H_
-
-#include <m68k/endian.h>
-
-#endif /* _ATARI_ENDIAN_h_ */
diff --git a/sys/arch/atari/include/exec.h b/sys/arch/atari/include/exec.h
deleted file mode 100644
index ca46f9e6341..00000000000
--- a/sys/arch/atari/include/exec.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $NetBSD: exec.h,v 1.1.1.1 1995/03/26 07:12:06 leo Exp $ */
-
-/*
- * Copyright (c) 1993 Christopher G. Demetriou
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_EXEC_H_
-#define _MACHINE_EXEC_H_
-
-#define __LDPGSZ 8192
-
-/* Relocation format. */
-struct relocation_info_m68k {
- int r_address; /* offset in text or data segment */
- unsigned int r_symbolnum : 24, /* ordinal number of add symbol */
- r_pcrel : 1, /* 1 if value should be pc-relative */
- r_length : 2, /* log base 2 of value's width */
- r_extern : 1, /* 1 if need to add symbol to value */
- r_baserel : 1, /* linkage table relative */
- r_jmptable : 1, /* relocate to jump table */
- r_relative : 1, /* load address relative */
- r_copy : 1; /* run time copy */
-};
-#define relocation_info relocation_info_m68k
-
-#define ARCH_ELFSIZE 32
-
-#define ELF_TARG_CLASS ELFCLASS32
-#define ELF_TARG_DATA ELFDATA2MSB
-#define ELF_TARG_MACH EM_68K
-
-#define _NLIST_DO_AOUT
-#define _NLIST_DO_ELF
-
-#define _KERN_DO_AOUT
-#if defined(COMPAT_LINUX) || defined(COMPAT_SVR4)
-#define _KERN_DO_ELF
-#endif
-
-#endif /* _MACHINE_EXEC_H_ */
diff --git a/sys/arch/atari/include/float.h b/sys/arch/atari/include/float.h
deleted file mode 100644
index f5cf37fb337..00000000000
--- a/sys/arch/atari/include/float.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $NetBSD: float.h,v 1.1.1.1 1995/03/26 07:12:06 leo Exp $ */
-
-#ifndef _MACHINE_FLOAT_H_
-#define _MACHINE_FLOAT_H_
-
-#include <m68k/float.h>
-
-#endif
diff --git a/sys/arch/atari/include/frame.h b/sys/arch/atari/include/frame.h
deleted file mode 100644
index d2079289692..00000000000
--- a/sys/arch/atari/include/frame.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $NetBSD: frame.h,v 1.1.1.1 1995/03/26 07:12:05 leo Exp $ */
-
-#ifndef _MACHINE_FRAME_H_
-#define _MACHINE_FRAME_H_
-
-#include <m68k/frame.h>
-
-#endif
diff --git a/sys/arch/atari/include/ieeefp.h b/sys/arch/atari/include/ieeefp.h
deleted file mode 100644
index 9c943f2069c..00000000000
--- a/sys/arch/atari/include/ieeefp.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $NetBSD: ieeefp.h,v 1.2 1995/04/16 16:47:04 jtc Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/ieeefp.h>
diff --git a/sys/arch/atari/include/iomap.h b/sys/arch/atari/include/iomap.h
deleted file mode 100644
index 8fd43b32f1b..00000000000
--- a/sys/arch/atari/include/iomap.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $NetBSD: iomap.h,v 1.2 1995/03/26 07:24:36 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_IOMAP_H
-#define _MACHINE_IOMAP_H
-/*
- * Atari TT hardware:
- * I/O Address map
- */
-
-#define AD_RAM (0x000000L) /* main memory */
-#define AD_CART (0xFA0000L) /* expansion cartridge */
-#define AD_ROM (0xFC0000L) /* system ROM */
-#define AD_IO (0xFF8000L) /* I/O devices */
-#define AD_EIO (0xFFFFFFL) /* End of I/O devices */
-
-/*
- * I/O address parts
- */
-#define AD_RAMCFG (0xFF8000L) /* ram configuration */
-#define AD_VIDEO (0xFF8200L) /* video controller */
-#define AD_RESERVED (0xFF8400L) /* reserved */
-#define AD_DMA (0xFF8600L) /* DMA device access */
-#define AD_SCSI_DMA (0xFF8700L) /* SCSI DMA registers */
-#define AD_NCR5380 (0xFF8780L) /* SCSI controller */
-#define AD_SOUND (0xFF8800L) /* YM-2149 */
-#define AD_RTC (0xFF8960L) /* TT realtime clock */
-#define AD_SCC (0xFF8C80L) /* SCC 8530 */
-#define AD_SCU (0xFF8E00L) /* System Control Unit */
-
-#define AD_MFP (0xFFFA00L) /* 68901 */
-#define AD_MFP2 (0xFFFA80L) /* 68901-TT */
-#define AD_ACIA (0xFFFC00L) /* 2 * 6850 */
-#endif /* _MACHINE_IOMAP_H */
diff --git a/sys/arch/atari/include/limits.h b/sys/arch/atari/include/limits.h
deleted file mode 100644
index e251094c40a..00000000000
--- a/sys/arch/atari/include/limits.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* $NetBSD: limits.h,v 1.1.1.1 1995/03/26 07:12:05 leo Exp $ */
-
-#ifndef _MACHINE_LIMITS_H_
-#define _MACHINE_LIMITS_H_
-
-#include <m68k/limits.h>
-
-#endif /* _MACHINE_LIMITS_H_ */
-
diff --git a/sys/arch/atari/include/mfp.h b/sys/arch/atari/include/mfp.h
deleted file mode 100644
index c3c50886203..00000000000
--- a/sys/arch/atari/include/mfp.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/* $NetBSD: mfp.h,v 1.2 1995/03/26 07:24:37 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_MFP_H
-#define _MACHINE_MFP_H
-/*
- * Atari TT hardware: MFP1/MFP2
- * Motorola 68901 Multi-Function Peripheral
- */
-
-#define MFP ((struct mfp *)AD_MFP)
-#define MFP2 ((struct mfp *)AD_MFP2)
-
-struct mfp {
- volatile u_char mfb[48]; /* use only the odd bytes */
-};
-
-#define mf_gpip mfb[ 1] /* general purpose I/O interrupt port */
-#define mf_aer mfb[ 3] /* active edge register */
-#define mf_ddr mfb[ 5] /* data direction register */
-#define mf_iera mfb[ 7] /* interrupt enable register A */
-#define mf_ierb mfb[ 9] /* interrupt enable register B */
-#define mf_ipra mfb[11] /* interrupt pending register A */
-#define mf_iprb mfb[13] /* interrupt pending register B */
-#define mf_isra mfb[15] /* interrupt in-service register A */
-#define mf_isrb mfb[17] /* interrupt in-service register B */
-#define mf_imra mfb[19] /* interrupt mask register A */
-#define mf_imrb mfb[21] /* interrupt mask register B */
-#define mf_vr mfb[23] /* vector register */
-#define mf_tacr mfb[25] /* timer control register A */
-#define mf_tbcr mfb[27] /* timer control register B */
-#define mf_tcdcr mfb[29] /* timer control register C+D */
-#define mf_tadr mfb[31] /* timer data register A */
-#define mf_tbdr mfb[33] /* timer data register B */
-#define mf_tcdr mfb[35] /* timer data register C */
-#define mf_tddr mfb[37] /* timer data register D */
-#define mf_scr mfb[39] /* synchronous character register */
-#define mf_ucr mfb[41] /* USART control register */
-#define mf_rsr mfb[43] /* receiver status register */
-#define mf_tsr mfb[45] /* transmitter status register */
-#define mf_udr mfb[47] /* USART data register */
-
-/* names of IO port bits: */
-#define IO_PBSY 0x01 /* Parallel Busy */
-#define IO_SDCD 0x02 /* Serial Data Carrier Detect */
-#define IO_SCTS 0x04 /* Serial Clear To Send */
-/* 0x08 *//* reserved */
-#define IO_AINT 0x10 /* ACIA interrupt (KB or MIDI) */
-#define IO_DINT 0x20 /* DMA interrupt (FDC or HDC) */
-#define IO_SRI 0x40 /* Serial Ring Indicator */
-#define IO_MONO 0x80 /* Monochrome Monitor Detect */
-
-/* names of interrupts in register A: MFP1 */
-#define IA_MONO 0x80 /* IO_MONO */
-#define IA_SRI 0x40 /* IO_SRI */
-#define IA_TIMA 0x20 /* Timer A */
-#define IA_RRDY 0x10 /* Serial Receiver Ready(=Full) */
-#define IA_RERR 0x08 /* Serial Receiver Error */
-#define IA_TRDY 0x04 /* Serial Transmitter Ready(=Empty) */
-#define IA_TERR 0x02 /* Serial Transmitter Error */
-#define IA_TIMB 0x01 /* Timer B */
-
-/* names of interrupts in register A: MFP2 */
-#define IA_SCSI 0x80 /* SCSI-controller */
-#define IA_RTC 0x40 /* Real Time Clock */
-#define IA_TIMA2 0x20 /* Timer A */
-/* 0x10 *//* reserved */
-/* 0x08 *//* reserved */
-/* 0x04 *//* reserved */
-/* 0x02 *//* reserved */
-#define IA_TIMB2 0x01 /* Timer B */
-
-/* names of interrupts in register B: MFP1*/
-#define IB_DINT 0x80 /* IO_DINT: from DMA devices */
-#define IB_AINT 0x40 /* IO_AINT: from kbd or midi */
-#define IB_TIMC 0x20 /* Timer C */
-#define IB_TIMD 0x10 /* Timer D */
-/* 0x08 *//* reserved */
-#define IB_SCTS 0x04 /* IO_SCTS */
-#define IB_SDCD 0x02 /* IO_SDCD */
-#define IB_PBSY 0x01 /* IO_PBSY */
-
-/* names of interrupts in register B: MFP2*/
-#define IB_SCDM 0x80 /* SCSI-dma */
-#define IB_DCHG 0x40 /* Diskette change */
-/* 0x20 *//* reserved */
-/* 0x10 *//* reserved */
-#define IB_RISB 0x80 /* Serial Ring indicator SCC port B */
-#define IB_DMSC 0x40 /* SCC-dma */
-#define IB_J602_3 0x02 /* Pin 3 J602 */
-#define IB_J602_1 0x01 /* Pin 1 J602 */
-
-/* bits in VR: */
-#define V_S 0x08 /* software end-of-interrupt mode */
-#define V_V 0xF0 /* four high bits of vector */
-
-/* bits in TCR: */
-/* 0x07 *//* divider */
-#define T_STOP 0x00 /* don't count */
-#define T_Q004 0x01 /* divide by 4 */
-#define T_Q010 0x02 /* divide by 10 */
-#define T_Q016 0x03 /* divide by 16 */
-#define T_Q050 0x04 /* divide by 50 */
-#define T_Q064 0x05 /* divide by 64 */
-#define T_Q100 0x06 /* divide by 100 */
-#define T_Q200 0x07 /* divide by 200 */
-#define T_EXTI 0x08 /* use extern impulse */
-#define T_LOWO 0x10 /* force output low */
-
-/* bits in UCR: */
-/* 0x01 *//* not used */
-#define U_EVEN 0x02 /* even parity */
-#define U_PAR 0x04 /* use parity */
-/* 0x18 *//* sync/async and stop bits */
-#define U_SYNC 0x00 /* synchrone */
-#define U_ST1 0x08 /* async, 1 stop bit */
-#define U_ST1_5 0x10 /* async, 1.5 stop bit */
-#define U_ST2 0x18 /* async, 2 stop bits */
-/* 0x60 *//* number of data bits */
-#define U_D8 0x00 /* 8 data bits */
-#define U_D7 0x20 /* 7 data bits */
-#define U_D6 0x40 /* 6 data bits */
-#define U_D5 0x60 /* 5 data bits */
-#define U_Q16 0x80 /* divide clock by 16 */
-
-/* bits in RSR: */
-#define RS_ENA 0x01 /* Receiver Enable */
-#define RS_STRIP 0x02 /* Synchronous Strip Enable */
-#define RS_CIP 0x04 /* Character in Progress */
-#define RS_BREAK 0x08 /* Break Detected */
-#define RS_FE 0x10 /* Frame Error */
-#define RS_PE 0x20 /* Parity Error */
-#define RS_OE 0x40 /* Overrun Error */
-#define RS_FULL 0x80 /* Buffer Full */
-
-/* bits in TSR: */
-#define TS_ENA 0x01 /* Transmitter Enable */
-/* 0x06 *//* state of dead transmitter output */
-#define TS_TRI 0x00 /* Quiet Output Tristate */
-#define TS_LOW 0x02 /* Quiet Output Low */
-#define TS_HIGH 0x04 /* Quiet Output High */
-#define TS_BACK 0x06 /* Loop Back Mode */
-#define TS_BREAK 0x08 /* Break Detected */
-#define TS_EOT 0x10 /* End of Transmission */
-#define TS_TURN 0x20 /* Auto Turnaround */
-#define TS_UE 0x40 /* Underrun Error */
-#define TS_EMPTY 0x80 /* Buffer Empty */
-#endif /* _MACHINE_MFP_H */
diff --git a/sys/arch/atari/include/mtpr.h b/sys/arch/atari/include/mtpr.h
deleted file mode 100644
index ebbdea932c5..00000000000
--- a/sys/arch/atari/include/mtpr.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $NetBSD: mtpr.h,v 1.2 1995/04/30 12:00:31 leo Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: mtpr.h 1.1 90/07/09$
- *
- * @(#)mtpr.h 7.2 (Berkeley) 11/3/90
- */
-
-#ifndef _MACHINE_MTPR_H_
-#define _MACHINE_MTPR_H_
-
-#ifdef _KERNEL
-
-/*
- * simulated software interrupt register
- */
-
-extern unsigned char ssir;
-
-#define SIR_NET 0x1 /* call netintr() */
-#define SIR_CLOCK 0x2 /* call softclock() */
-#define SIR_CBACK 0x4 /* walk the sicallback-chain */
-
-#define siroff(x) ssir &= ~(x)
-
-#define setsoftnet() (ssir |= SIR_NET)
-#define setsoftclock() (ssir |= SIR_CLOCK)
-#define setsoftcback() (ssir |= SIR_CBACK)
-
-#endif /* _KERNEL */
-
-#endif /* !_MACHINE_MTPR_H_ */
diff --git a/sys/arch/atari/include/param.h b/sys/arch/atari/include/param.h
deleted file mode 100644
index 06ca10f99ee..00000000000
--- a/sys/arch/atari/include/param.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/* $OpenBSD: param.h,v 1.5 2000/07/06 15:25:02 ho Exp $ */
-/* $NetBSD: param.h,v 1.10 1996/01/07 22:30:41 leo Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: machparam.h 1.11 89/08/14$
- *
- * @(#)param.h 7.8 (Berkeley) 6/28/91
- */
-
-#ifndef _MACHINE_PARAM_H_
-#define _MACHINE_PARAM_H_
-
-/*
- * Machine dependent constants for atari
- */
-#define MACHINE "atari"
-#define _MACHINE atari
-#define MACHINE_ARCH "m68k"
-#define _MACHINE_ARCH m68k
-#define MID_MACHINE MID_M68K
-
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value
- * for all data types (int, long, ...). The result is u_int and
- * must be cast to any desired pointer type.
- */
-#define ALIGNBYTES (sizeof(int) - 1)
-#define ALIGN(p) (((u_int)(p) + (sizeof(int) - 1)) &~ (sizeof(int) - 1))
-
-#define NBPG 8192 /* bytes/page */
-#define PGOFSET (NBPG-1) /* byte offset into page */
-#define PGSHIFT 13 /* LOG2(NBPG) */
-#define NPTEPG (NBPG/(sizeof(u_int)))
-
-#define NBSEG (cpu040 ? 32*NBPG : 2048*NBPG) /* bytes/segment */
-#define SEGOFSET (NBSEG-1) /* byte offset into segment */
-#define SEGSHIFT 24 /* LOG2(NBSEG) [68030 value] */
-
-#define KERNBASE 0x0 /* start of kernel virtual */
-#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT)
-
-#define DEV_BSIZE 512
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define BLKDEV_IOSIZE 2048
-#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
-
-#define CLSIZE 1
-#define CLSIZELOG2 0
-
-/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
-#define SSIZE 1 /* initial stack size/NBPG */
-#define SINCR 1 /* increment of stack/NBPG */
-
-#define UPAGES 2 /* pages of u-area */
-#define USPACE (UPAGES * NBPG)
-
-/*
- * Constants related to network buffer management.
- * MCLBYTES must be no larger than CLBYTES (the software page size), and,
- * on machines that exchange pages of input or output buffers with mbuf
- * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
- * of the hardware page size.
- */
-#define MSIZE 128 /* size of an mbuf */
-#define MCLSHIFT 11
-#define MCLBYTES (1 << MCLSHIFT)
-#define MCLOFSET (MCLBYTES - 1)
-#ifndef NMBCLUSTERS
-#ifdef GATEWAY
-#define NMBCLUSTERS 512 /* map size, max cluster allocation */
-#else
-#define NMBCLUSTERS 256 /* map size, max cluster allocation */
-#endif
-#endif
-
-/*
- * Size of kernel malloc arena in CLBYTES-sized logical pages
- */
-#ifndef NKMEMCLUSTERS
-#define NKMEMCLUSTERS (3072*1024/CLBYTES)
-#endif
-
-/* pages ("clicks") to disk blocks */
-#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
-
-/* pages to bytes */
-#define ctob(x) ((x) << PGSHIFT)
-#define btoc(x) (((x) + PGOFSET) >> PGSHIFT)
-
-/* bytes to disk blocks */
-#define btodb(x) ((x) >> DEV_BSHIFT)
-#define dbtob(x) ((x) << DEV_BSHIFT)
-
-/*
- * Map a ``block device block'' to a file system block.
- * This should be device dependent, and should use the bsize
- * field from the disk label.
- * For now though just use DEV_BSIZE.
- */
-#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
-
-/*
- * Mach derived conversion macros
- */
-#define atari_round_seg(x) ((((unsigned)(x)) + NBSEG - 1) & ~(NBSEG-1))
-#define atari_trunc_seg(x) ((unsigned)(x) & ~(NBSEG-1))
-#define atari_round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1))
-#define atari_trunc_page(x) ((unsigned)(x) & ~(NBPG-1))
-#define atari_btos(x) ((unsigned)(x) >> SEGSHIFT)
-#define atari_stob(x) ((unsigned)(x) << SEGSHIFT)
-#define atari_btop(x) ((unsigned)(x) >> PGSHIFT)
-#define atari_ptob(x) ((unsigned)(x) << PGSHIFT)
-
-/*
- * spl functions; all but spl0 are done in-line
- */
-#include <machine/psl.h>
-
-#define _debug_spl(s) \
-({ \
- register int _spl_r; \
-\
- __asm __volatile ("clrl %0; movew sr,%0; movew %1,sr" : \
- "&=d" (_spl_r) : "di" (s)); \
- if ((_spl_r&PSL_IPL) > (s&PSL_IPL)) \
- printf ("%s:%d:spl(%d) ==> spl(%d)!!\n",__FILE__,__LINE__, \
- ((PSL_IPL&_spl_r)>>8), ((PSL_IPL&s)>>8)); \
- _spl_r; \
-})
-
-#define _spl_no_check(s) \
-({ \
- register int _spl_r; \
-\
- __asm __volatile ("clrl %0; movew sr,%0; movew %1,sr" : \
- "&=d" (_spl_r) : "di" (s)); \
- _spl_r; \
-})
-#if defined (DEBUG)
-#define _spl _debug_spl
-#else
-#define _spl _spl_no_check
-#endif
-
-/* spl0 requires checking for software interrupts */
-#define spl1() _spl(PSL_S|PSL_IPL1)
-#define spl2() _spl(PSL_S|PSL_IPL2)
-#define spl3() _spl(PSL_S|PSL_IPL3)
-#define spl4() _spl(PSL_S|PSL_IPL4)
-#define spl5() _spl(PSL_S|PSL_IPL5)
-#define spl6() _spl(PSL_S|PSL_IPL6)
-#define spl7() _spl(PSL_S|PSL_IPL7)
-
-#define splnone() spl0()
-#define spllowersoftclock() spl1()
-#define splsoftclock() spl1()
-#define splsoftnet() spl1()
-#define splbio() spl3()
-#define splnet() spl3()
-/*
- * lowered to spl4 to allow for serial input into
- * private ringbuffer inspite of spltty
- */
-#define spltty() spl4()
-#define splimp() spl4()
-#define splclock() spl6()
-#define splstatclock() spl6()
-#define splvm() spl6()
-#define splhigh() spl7()
-#define splsched() spl7()
-
-#define splx(s) (s & PSL_IPL ? _spl_no_check(s) : spl0())
-
-#ifdef _KERNEL
-void delay __P((int));
-
-#define DELAY(n) delay(n)
-#endif /* _KERNEL */
-
-#endif /* !_MACHINE_PARAM_H_ */
diff --git a/sys/arch/atari/include/pcb.h b/sys/arch/atari/include/pcb.h
deleted file mode 100644
index 3a638675ec2..00000000000
--- a/sys/arch/atari/include/pcb.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* $NetBSD: pcb.h,v 1.2 1995/05/14 15:27:51 leo Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: pcb.h 1.13 89/04/23$
- *
- * @(#)pcb.h 7.4 (Berkeley) 5/4/91
- */
-
-#ifndef _MACHINE_PCB_H_
-#define _MACHINE_PCB_H_
-
-#include <machine/frame.h>
-
-/*
- * ATARI process control block
- */
-struct pcb
-{
- short pcb_flags; /* misc. process flags (+0) */
- short pcb_ps; /* processor status word (+2) */
- int pcb_ustp; /* user segment table pointer (+4) */
- int pcb_usp; /* user stack pointer (+8) */
- int pcb_regs[12]; /* D2-D7, A2-A7 (+C) */
- int pcb_cmap2; /* temporary copy PTE */
- caddr_t pcb_onfault; /* for copyin/out faults */
- struct fpframe pcb_fpregs; /* 68881/2 context save area */
- int pcb_exec[16]; /* exec structure for core dumps */
-};
-
-/* flags (none currently used) */
-
-/*
- * The pcb is augmented with machine-dependent additional data for
- * core dumps. For the hp300, this includes an HP-UX exec header
- * which is dumped for HP-UX processes.
- */
-struct md_coredump {
- int md_exec[16]; /* exec structure for HP-UX core dumps */
-};
-
-#endif /* !_MACHINE_PCB_H_ */
diff --git a/sys/arch/atari/include/pmap.h b/sys/arch/atari/include/pmap.h
deleted file mode 100644
index a7d9b48c984..00000000000
--- a/sys/arch/atari/include/pmap.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* $NetBSD: pmap.h,v 1.6 1995/06/09 19:43:41 leo Exp $ */
-
-/*
- * Copyright (c) 1987 Carnegie-Mellon University
- * Copyright (c) 1991 Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pmap.h 7.6 (Berkeley) 5/10/91
- */
-
-#ifndef _MACHINE_PMAP_H_
-#define _MACHINE_PMAP_H_
-
-/*
- * Pmap stuff (in anticipation of '40 support)
- */
-struct pmap {
- u_int *pm_ptab; /* KVA of page table */
- u_int *pm_stab; /* KVA of segment table */
- u_int *pm_rtab; /* KVA of 68040 root table */
- int pm_stchanged; /* ST changed */
- short pm_sref; /* segment table ref count */
- short pm_count; /* pmap reference count */
- long pm_ptpages; /* more stats: PT pages */
- simple_lock_data_t pm_lock; /* lock on pmap */
- struct pmap_statistics pm_stats; /* pmap statistics */
-};
-
-typedef struct pmap *pmap_t;
-
-/*
- * Macros for speed
- */
-#define PMAP_ACTIVATE(pmapp, pcbp, iscurproc) \
- if ((pmapp) != NULL && (pmapp)->pm_stchanged) { \
- (pcbp)->pcb_ustp = \
- atari_btop(pmap_extract(pmap_kernel(), \
- cpu040 ? (vm_offset_t)(pmapp)->pm_rtab : \
- (vm_offset_t)(pmapp)->pm_stab)); \
- if (iscurproc) \
- loadustp((pcbp)->pcb_ustp); \
- (pmapp)->pm_stchanged = FALSE; \
- }
-#define PMAP_DEACTIVATE(pmapp, pcbp)
-
-/*
- * Description of the memory segments. Build in atari_init/start_c().
- * This gives a better separation between machine dependent stuff and
- * the pmap-module.
- */
-#define NPHYS_SEGS 8
-struct physeg {
- vm_offset_t start; /* PA of first page in segment */
- vm_offset_t end; /* PA of last page in segment */
- int first_page; /* relative page# of 'start' */
-};
-
-/*
- * For each vm_page_t, there is a list of all currently valid virtual
- * mappings of that page. An entry is a pv_entry_t, the list is pv_table.
- */
-typedef struct pv_entry {
- struct pv_entry *pv_next; /* next pv_entry */
- struct pmap *pv_pmap; /* pmap where mapping lies */
- vm_offset_t pv_va; /* virtual address for mapping */
- u_int *pv_ptste; /* non-zero if VA maps a PT page */
- struct pmap *pv_ptpmap; /* if pv_ptste, pmap for PT page */
- int pv_flags; /* flags */
-} *pv_entry_t;
-
-#define PV_CI 0x01 /* all entries must be cache inhibited */
-#define PV_PTPAGE 0x02 /* entry maps a page table page */
-
-#ifdef _KERNEL
-struct physeg phys_segs[NPHYS_SEGS];
-pv_entry_t pv_table; /* array of entries, one per page */
-u_int *Sysmap;
-char *vmmap; /* map for mem, dumps, etc. */
-struct pmap kernel_pmap_store;
-
-#ifdef MACHINE_NONCONTIG
-#define pa_index(pa) pmap_page_index(pa)
-#else
-#define pa_index(pa) atop(pa - vm_first_phys)
-#endif /* MACHINE_NONCONTIG */
-#define pa_to_pvh(pa) (&pv_table[pa_index(pa)])
-#define pmap_kernel() (&kernel_pmap_store)
-#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
-#endif /* _KERNEL */
-
-#endif /* !_MACHINE_PMAP_H_ */
diff --git a/sys/arch/atari/include/proc.h b/sys/arch/atari/include/proc.h
deleted file mode 100644
index 8104668f7cc..00000000000
--- a/sys/arch/atari/include/proc.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* $NetBSD: proc.h,v 1.1.1.1 1995/03/26 07:12:06 leo Exp $ */
-
-/*
- * Copyright (c) 1991 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_PROC_H_
-#define _MACHINE_PROC_H_
-
-/*
- * Machine-dependent part of the proc structure for atari.
- */
-struct mdproc {
- int *md_regs; /* registers on current frame */
- long md_flags; /* machine-dependent flags */
-};
-
-/* md_flags */
-#define MDP_AST 0x0001 /* async trap pending */
-#define MDP_STACKADJ 0x0002 /* frame SP adjusted, might have to
- undo when system call returns
- ERESTART. */
-#endif /* !_MACHINE_PROC_H_ */
diff --git a/sys/arch/atari/include/profile.h b/sys/arch/atari/include/profile.h
deleted file mode 100644
index 2c0aad6025c..00000000000
--- a/sys/arch/atari/include/profile.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $NetBSD: profile.h,v 1.1.1.1 1995/03/26 07:12:07 leo Exp $ */
-
-#ifndef _MACHINE_PROFILE_H_
-#define _MACHINE_PROFILE_H_
-
-#include <m68k/profile.h>
-
-#endif
diff --git a/sys/arch/atari/include/psl.h b/sys/arch/atari/include/psl.h
deleted file mode 100644
index 101d091b428..00000000000
--- a/sys/arch/atari/include/psl.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $NetBSD: psl.h,v 1.1.1.1 1995/03/26 07:12:06 leo Exp $ */
-
-#ifndef _MACHINE_PSL_H_
-#define _MACHINE_PSL_H_
-
-#include <m68k/psl.h>
-
-#endif
diff --git a/sys/arch/atari/include/pte.h b/sys/arch/atari/include/pte.h
deleted file mode 100644
index b087af40075..00000000000
--- a/sys/arch/atari/include/pte.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/* $NetBSD: pte.h,v 1.2 1995/04/30 14:02:14 leo Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: pte.h 1.11 89/09/03$
- *
- * @(#)pte.h 7.3 (Berkeley) 5/8/91
- */
-
-#ifndef _MACHINE_PTE_H_
-#define _MACHINE_PTE_H_
-
-/*
- * ATARI hardware segment/page table entries
- */
-
-struct pte {
- u_int pte;
-};
-
-typedef u_int pt_entry_t;
-
-struct ste {
- u_int ste;
-};
-
-typedef u_int st_entry_t;
-
-#define PT_ENTRY_NULL ((u_int *) 0)
-#define ST_ENTRY_NULL ((u_int *) 0)
-
-#define SG_V 0x00000002 /* segment is valid */
-#define SG_NV 0x00000000
-#define SG_PROT 0x00000004 /* access protection mask */
-#define SG_RO 0x00000004
-#define SG_RW 0x00000000
-#define SG_U 0x00000008 /* modified bit (68040) */
-#define SG_FRAME 0xffffe000
-#define SG_IMASK 0xff000000
-#define SG_ISHIFT 24
-#define SG_PMASK 0x00ffe000
-#define SG_PSHIFT 13
-
-/* 68040 additions */
-#define SG4_MASK1 0xfe000000 /* pointer table 1 index mask */
-#define SG4_SHIFT1 25
-#define SG4_MASK2 0x01fc0000 /* pointer table 2 index mask */
-#define SG4_SHIFT2 18
-#define SG4_MASK3 0x0003e000 /* page table index mask */
-#define SG4_SHIFT3 13
-#define SG4_ADDR1 0xfffffe00 /* pointer table address mask */
-#define SG4_ADDR2 0xffffff00 /* page table address mask */
-
-#define PG_V 0x00000001
-#define PG_NV 0x00000000
-#define PG_PROT 0x00000004
-#define PG_U 0x00000008
-#define PG_M 0x00000010
-#define PG_W 0x00000100
-#define PG_RO 0x00000004
-#define PG_RW 0x00000000
-#define PG_FRAME 0xffffe000
-#define PG_CI 0x00000040
-#define PG_SHIFT 13
-#define PG_PFNUM(x) (((x) & PG_FRAME) >> PG_SHIFT)
-
-/* 68040 additions */
-#define PG_CMASK 0x00000060 /* cache mode mask */
-#define PG_CWT 0x00000000 /* writethrough caching */
-#define PG_CCB 0x00000020 /* copyback caching */
-#define PG_CIS 0x00000040 /* cache inhibited serialized */
-#define PG_CIN 0x00000060 /* cache inhibited nonserialized */
-#define PG_SO 0x00000080 /* supervisor only */
-
-#define ATARI_040RTSIZE 512 /* root (level 1) table size */
-#define ATARI_040STSIZE 512 /* segment (level 2) table size */
-#define ATARI_040PTSIZE 128 /* page (level 3) table size */
-#define ATARI_STSIZE 1024 /* segment table size */
-/*
- * ATARI_MAX_COREUPT maximum number of incore user page tables
- * ATARI_USER_PTSIZE the number of bytes for user pagetables
- * ATARI_PTBASE the VA start of the map from which upt's are allocated
- * ATARI_PTSIZE the size of the map from which upt's are allocated
- * ATARI_KPTSIZE size of kernel page table
- * ATARI_MAX_KPTSIZE the most number of bytes for kpt pages
- * ATARI_MAX_PTSIZE the number of bytes to map everything
- */
-#define ATARI_MAX_COREUPT 1024
-#define ATARI_UPTSIZE roundup(VM_MAXUSER_ADDRESS / NPTEPG, NBPG)
-#define ATARI_UPTBASE 0x10000000
-#define ATARI_UPTMAXSIZE \
- roundup((ATARI_MAX_COREUPT * ATARI_UPTSIZE), NBPG)
-#define ATARI_MAX_KPTSIZE \
- (ATARI_MAX_COREUPT * ATARI_UPTSIZE / NPTEPG)
-#define ATARI_KPTSIZE \
- roundup((VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / NPTEPG, NBPG)
-#define ATARI_MAX_PTSIZE roundup(0xffffffff / NPTEPG, NBPG)
-
-/*
- * Kernel virtual address to page table entry and to physical address.
- */
-#define kvtopte(va) \
- (&Sysmap[((unsigned)(va) - VM_MIN_KERNEL_ADDRESS) >> PGSHIFT])
-#define ptetokv(pt) \
- ((((u_int *)(pt) - Sysmap) << PGSHIFT) + VM_MIN_KERNEL_ADDRESS)
-#define kvtophys(va) \
- ((kvtopte(va)->pg_pfnum << PGSHIFT) | ((int)(va) & PGOFSET))
-
-
-#endif /* !_MACHINE_PTE_H_ */
diff --git a/sys/arch/atari/include/ptrace.h b/sys/arch/atari/include/ptrace.h
deleted file mode 100644
index 5f414028faa..00000000000
--- a/sys/arch/atari/include/ptrace.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $NetBSD: ptrace.h,v 1.1.1.1 1995/03/26 07:12:06 leo Exp $ */
-
-#ifndef _MACHINE_PTRACE_H_
-#define _MACHINE_PTRACE_H_
-
-#include <m68k/ptrace.h>
-
-#endif
diff --git a/sys/arch/atari/include/reg.h b/sys/arch/atari/include/reg.h
deleted file mode 100644
index 15aa532214f..00000000000
--- a/sys/arch/atari/include/reg.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $NetBSD: reg.h,v 1.1.1.1 1995/03/26 07:12:07 leo Exp $ */
-
-#ifndef _MACHINE_REG_H_
-#define _MACHINE_REG_H_
-
-#include <m68k/reg.h>
-
-#endif
diff --git a/sys/arch/atari/include/scu.h b/sys/arch/atari/include/scu.h
deleted file mode 100644
index a516266c095..00000000000
--- a/sys/arch/atari/include/scu.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* $NetBSD: scu.h,v 1.1.1.1 1995/03/26 07:12:08 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_SCU_H
-#define _MACHINE_SCU_H
-/*
- * Atari TT hardware:
- * SCU registers
- */
-
-#define SCU ((struct scu *)AD_SCU)
-
-
-/*
- * System control unit
- */
-struct scu {
- volatile u_char fil1;
- volatile u_char sys_mask; /* System interrupt mask */
- volatile u_char fil2;
- volatile u_char sys_stat; /* System interrupt status */
- volatile u_char fil3;
- volatile u_char sys_int; /* System interrupter */
- volatile u_char fil4;
- volatile u_char vme_int; /* VME interrupter */
- volatile u_char fil5;
- volatile u_char gen_reg1; /* General purpose reg. 1 */
- volatile u_char fil6;
- volatile u_char gen_reg2; /* General purpose reg. 2 */
- volatile u_char fil7;
- volatile u_char vme_mask; /* VME interrupt mask */
- volatile u_char fil8;
- volatile u_char vme_stat; /* VME interrupt status */
-};
-
-/*
- * Bits for system mask & stat.
- * Read 'sys_stat' first, reading 'sys_mask' clears pending bits in 'sys_stat'.
- */
-#define SCU_SYSFAIL 0x80 /* _Sysfail in VME bus (Auto vectored) */
-#define SCU_MFP 0x40 /* MFP interrupt (Programmable) */
-#define SCU_SCC 0x20 /* SCC interrupt (Programmable) */
-#define SCU_VSYNC 0x10 /* Vertical Sync (Auto vectored) */
- /* 0x08 Not Used */
-#define SCU_HSYNC 0x04 /* Horizontal Sync (Auto vectored) */
-#define SCU_SYS_SOFT 0x02 /* System Software INT (Auto vectored) */
- /* 0x00 Not Used */
-
-/*
- * Bits for VME mask & stat.
- * Read 'vme_stat' first, reading 'vme_mask' clears pending bits in 'vme_stat'.
- * Not that MFP/SCC interrupts are hard-wired to the mentioned VME IRQ's.
- * (or'ed).
- */
-#define SCU_IRQ7 0x80
-#define SCU_IQ6_MFP 0x40 /* Also MFP interrupt */
-#define SCU_IRQ5_SCC 0x20 /* Also SCC interrupt */
-#define SCU_IRQ4 0x10
-#define SCU_IRQ3_SOFT 0x08 /* Also VME Software interrupt */
-#define SCU_IRQ2 0x04
-#define SCU_IRQ1 0x02
- /* 0x00 Not Used */
-
-/*
- * Generate/remove Software system interrupt.
- * Note: Will not be cleared automatically!!
- */
-#define SET_SOFT_INT (SCU->sys_int = 1)
-#define CLR_SOFT_INT (SCU->sys_int = 0)
-
-/*
- * Generate/remove Software VME interrupt.
- * Note: Will not be cleared automatically!!
- */
-#define SET_VME_INT (SCU->vme_int = 1)
-#define CLR_VME_INT (SCU->vme_int = 0)
-#endif /* _MACHINE_SCU_H */
diff --git a/sys/arch/atari/include/setjmp.h b/sys/arch/atari/include/setjmp.h
deleted file mode 100644
index 47f4334abeb..00000000000
--- a/sys/arch/atari/include/setjmp.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $NetBSD: setjmp.h,v 1.1.1.1 1995/03/26 07:12:09 leo Exp $ */
-
-#include <m68k/setjmp.h>
diff --git a/sys/arch/atari/include/signal.h b/sys/arch/atari/include/signal.h
deleted file mode 100644
index 05f47cbd64a..00000000000
--- a/sys/arch/atari/include/signal.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $NetBSD: signal.h,v 1.1.1.1 1995/03/26 07:12:07 leo Exp $ */
-
-#ifndef _MACHINE_SIGNAL_H_
-#define _MACHINE_SIGNAL_H_
-
-#include <m68k/signal.h>
-
-#endif
diff --git a/sys/arch/atari/include/spinlock.h b/sys/arch/atari/include/spinlock.h
deleted file mode 100644
index ef70517a7dc..00000000000
--- a/sys/arch/atari/include/spinlock.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: spinlock.h,v 1.1 1999/01/21 02:59:33 millert Exp $ */
-
-#include <m68k/spinlock.h>
diff --git a/sys/arch/atari/include/stdarg.h b/sys/arch/atari/include/stdarg.h
deleted file mode 100644
index 9b66132359a..00000000000
--- a/sys/arch/atari/include/stdarg.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $NetBSD: stdarg.h,v 1.1.1.1 1995/03/26 07:12:06 leo Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/stdarg.h>
diff --git a/sys/arch/atari/include/tospart.h b/sys/arch/atari/include/tospart.h
deleted file mode 100644
index 0109eed9b72..00000000000
--- a/sys/arch/atari/include/tospart.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* $NetBSD: tospart.h,v 1.3 1995/11/30 00:58:05 jtc Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_TOSPART_H
-#define _MACHINE_TOSPART_H
-
-#include <machine/disklabel.h>
-
-#define TOS_BSIZE 512 /* TOS blocksize */
-#define TOS_BBLOCK 0 /* TOS bootblock */
-
-#define MK_PARTID(x,y,z) ( ((u_int32_t)(x) << 16) \
- | ((u_int32_t)(y) << 8) \
- | ((u_int32_t)(z)) \
- )
-/*
- * Various `well known' AHDI partition identifiers.
- */
-#define PID_XGM MK_PARTID('X','G','M')
-#define PID_BGM MK_PARTID('B','G','M')
-#define PID_GEM MK_PARTID('G','E','M')
-#define PID_RAW MK_PARTID('R','A','W')
-#define PID_SWP MK_PARTID('S','W','P')
-#define PID_NBD MK_PARTID('N','B','D')
-#define PID_NBR MK_PARTID('N','B','R')
-#define PID_NBS MK_PARTID('N','B','S')
-#define PID_NBU MK_PARTID('N','B','U')
-
-/*
- * Format of TOS boot block.
- */
-#define NTOS_PARTS 4 /* Max. # of entries in TOS bootblock */
-
-struct tos_part {
- u_char tp_flg; /* bit 0 is in-use flag */
- u_char tp_id[3]; /* id: GEM, BGM, XGM, UNX, MIX */
- u_int32_t tp_st; /* block where partition starts */
- u_int32_t tp_size; /* partition size in blocks */
-};
-struct tos_root {
- u_char tr_fill[0x1c2]; /* filler, can be boot code */
- u_int32_t tr_hdsize; /* size of entire volume in blocks */
- struct tos_part tr_parts[NTOS_PARTS]; /* partition table */
- u_int32_t tr_bslst; /* start of bad-sector list */
- u_int32_t tr_bslsize; /* # of blocks in bad-sector list */
-};
-
-/*
- * TOS partition table.
- */
-#define MAX_TOS_PARTS (MAX_TOS_ROOTS + 3) /* Max. # of TOS partitions */
-
-struct tos_table {
- struct cpu_disklabel *tt_cdl;
- u_int32_t tt_nroots; /* # of auxilary root sectors */
- u_int32_t tt_nparts; /* # of TOS partitions */
- struct tos_part tt_parts[MAX_TOS_PARTS];
-#define tt_roots tt_cdl->cd_roots
-#define tt_bblock tt_cdl->cd_bblock
-#define tt_bslst tt_cdl->cd_bslst
-#define tt_bslsize tt_cdl->cd_bslsize
-};
-
-#endif /* _MACHINE_TOSPART_H */
diff --git a/sys/arch/atari/include/trap.h b/sys/arch/atari/include/trap.h
deleted file mode 100644
index 192d7a95765..00000000000
--- a/sys/arch/atari/include/trap.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $NetBSD: trap.h,v 1.1.1.1 1995/03/26 07:12:06 leo Exp $ */
-
-#ifndef _MACHINE_TRAP_H_
-#define _MACHINE_TRAP_H_
-
-#include <m68k/trap.h>
-
-#endif
diff --git a/sys/arch/atari/include/types.h b/sys/arch/atari/include/types.h
deleted file mode 100644
index 3c091abc7b7..00000000000
--- a/sys/arch/atari/include/types.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $NetBSD: types.h,v 1.3 1995/07/11 18:25:24 leo Exp $ */
-
-#ifndef _MACHINE_TYPES_H_
-#define _MACHINE_TYPES_H_
-
-#include <m68k/types.h>
-
-#endif
diff --git a/sys/arch/atari/include/varargs.h b/sys/arch/atari/include/varargs.h
deleted file mode 100644
index a1ff0b8af18..00000000000
--- a/sys/arch/atari/include/varargs.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $NetBSD: varargs.h,v 1.1.1.1 1995/03/26 07:12:06 leo Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/varargs.h>
diff --git a/sys/arch/atari/include/video.h b/sys/arch/atari/include/video.h
deleted file mode 100644
index 0266f2b7032..00000000000
--- a/sys/arch/atari/include/video.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/* $NetBSD: video.h,v 1.4 1996/01/02 20:59:43 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_VIDEO_H
-#define _MACHINE_VIDEO_H
-/*
- * Access to circuitry for video
- */
-
-#define VIDEO ((struct video *)AD_VIDEO)
-
-struct video {
- volatile char vdb[14]; /* sparsely filled */
- volatile u_short vd_line_wide; /* Falcon line word distance */
- volatile u_short vd_vert_wrap; /* Falcon line length */
- volatile char vd_fill0[45]; /* filler */
- volatile u_short vd_st_rgb[16]; /* RGB for simultaneous colors (ST)*/
- volatile u_char vd_st_res; /* ST resolution */
- volatile char vd_fill1; /* filler */
- volatile u_short vd_tt_res; /* TT-resultion mode */
- volatile u_char vd_ste_hscroll; /* MEGA STe hor bitwise scroll */
- volatile u_short vd_fal_res; /* Falcon resolution */
- volatile char vd_fill2[23];
- volatile u_short vd_h_hold_cnt; /* Falcon horizontal hold counter */
- volatile u_short vd_h_hold_tim; /* Falcon horizontal hold timer */
- volatile u_short vd_h_bord_beg; /* Falcon horizontal border begin */
- volatile u_short vd_h_bord_end; /* Falcon horizontal border end */
- volatile u_short vd_h_dis_beg; /* Falcon horizontal display begin */
- volatile u_short vd_h_dis_end; /* Falcon horizontal display end */
- volatile u_short vd_h_ss; /* Falcon horizontal SS */
- volatile u_short vd_h_fs; /* Falcon horizontal FS */
- volatile u_short vd_h_hh; /* Falcon horizontal HH */
- volatile char vd_fill3[13];
- volatile u_short vd_v_freq_cnt; /* Falcon vertical frequency count */
- volatile u_short vd_v_freq_tim; /* Falcon vertical frequency timer */
- volatile u_short vd_v_bord_beg; /* Falcon vertical border begin */
- volatile u_short vd_v_bord_end; /* Falcon vertical border end */
- volatile u_short vd_v_dis_beg; /* Falcon vertical display begin */
- volatile u_short vd_v_dis_end; /* Falcon vertical display end */
- volatile u_short vd_v_ss; /* Falcon vertical SS */
- volatile char vd_fill4[17];
- volatile u_short vd_fal_ctrl; /* Falcon video control */
- volatile u_short vd_fal_mode; /* Falcon video mode */
- volatile char vd_fill5[315];
- volatile u_short vd_tt_rgb[256]; /* RGB for simultaneous TT colors */
- volatile char vd_fill6[4608];
- volatile u_long vd_fal_rgb[256];/* RGB for Falcon colors */
-};
-
-#define vd_ramh vdb[ 1] /* base address Video RAM, high byte */
-#define vd_ramm vdb[ 3] /* base address Video RAM, mid byte */
-#define vd_raml vdb[13] /* base address Video RAM, low byte */
-#define vd_ptrh vdb[ 5] /* scan address Video RAM, high byte */
-#define vd_ptrm vdb[ 7] /* scan address Video RAM, mid byte */
-#define vd_ptrl vdb[ 9] /* scan address Video RAM, low byte */
-#define vd_sync vdb[10] /* synchronization mode */
-
-/* bits in vd_sync: */
-#define SYNC_EXT 0x01 /* extern sync */
-#define SYNC_50 0x02 /* 50 Hertz (used for color) */
-
-/* bits in vd_st_rgb[]: */
-#define RGB_B 0x0007
-#define RGB_G 0x0070
-#define RGB_R 0x0700
-
-/* some values for vd_st_rgb[]: */
-#define RGB_BLACK 0x0000
-#define RGB_RED 0x0700
-#define RGB_GREEN 0x0070
-#define RGB_BLUE 0x0007
-#define RGB_WHITE 0x0777
-#define RGB_MAGENTA 0x0707
-#define RGB_CYAN 0x0077
-#define RGB_YELLOW 0x0770
-#define RGB_LGREY 0x0555
-#define RGB_DGREY 0x0222
-
-/* values for vd_st_res: */
-#define RES_LOW 0x00 /* 320x200, 16 colors */
-#define RES_MID 0x01 /* 640x200, 4 colors */
-#define RES_HIGH 0x02 /* 640x400, monochrome */
-
-/* masks for vd_tt_res: */
-#define RES_STLOW 0x0000 /* 320x200, 16 colors */
-#define RES_STMID 0x0100 /* 640x200, 4 colors */
-#define RES_STHIGH 0x0200 /* 640x400, monochrome */
-#define RES_TTMID 0x0400 /* 640x480, 16 colors */
-#define RES_TTHIGH 0x0600 /* 1280x960, monochrome */
-#define RES_TTLOW 0x0700 /* 320x480, 256 colors */
-#define TT_PALLET 0x000f /* Pallette number */
-#define TT_HYMONO 0x8000 /* Hyper mono mode */
-#define TT_SHOLD 0x1000 /* Sample/hold mode */
-
-/* The falcon video modes */
-#define RES_FALAUTO 0 /* Falcon resolution dedected at boot */
-#define RES_VGA2 1 /* 640x480, 2 colors */
-#define RES_VGA4 2 /* 640x480, 4 colors */
-#define RES_VGA16 3 /* 640x480, 16 colors */
-#define RES_VGA256 4 /* 640x480, 256 colors */
-#define RES_DIRECT 5 /* 320x200, 65536 colors */
-#define RES_FAL_STLOW 6 /* 320x200, 16 colors */
-#define RES_FAL_STMID 7 /* 640x200, 4 colors */
-#define RES_FAL_STHIGH 8 /* 640x400, 2 colors */
-#define RES_FAL_TTLOW 9 /* 320x480, 256 colors */
-
-/*
- * Yahama YM-2149 Programmable Sound Generator
- */
-
-#define SOUND ((struct sound *)AD_SOUND)
-
-struct sound {
- char sdb[4]; /* use only the even bytes */
-};
-
-#define sd_selr sdb[0] /* select register */
-#define sd_rdat sdb[0] /* read register data */
-#define sd_wdat sdb[2] /* write register data */
-
-/*
- * Accessing the YM-2149 registers is indirect through ST-specific
- * circuitry by writing the register number into sd_selr.
- */
-#define YM_PA0 0 /* Period Channel A, bits 0-7 */
-#define YM_PA1 1 /* Period Channel A, bits 8-11 */
-#define YM_PB0 2 /* Period Channel B, bits 0-7 */
-#define YM_PB1 3 /* Period Channel B, bits 8-11 */
-#define YM_PC0 4 /* Period Channel C, bits 0-7 */
-#define YM_PC1 5 /* Period Channel C, bits 8-11 */
-#define YM_PNG 6 /* Period Noise Generator, bits 0-4 */
-#define YM_MFR 7 /* Multi Function Register */
-#define YM_VA 8 /* Volume Channel A */
-#define YM_VB 9 /* Volume Channel B */
-#define YM_VC 10 /* Volume Channel C */
-#define YM_PE0 11 /* Period Envelope, bits 0-7 */
-#define YM_PE1 12 /* Period Envelope, bits 8-15 */
-#define YM_WFE 13 /* Wave Form Envelope */
-#define YM_IOA 14 /* I/O port A */
-#define YM_IOB 15 /* I/O port B */
-
-/* bits in MFR: */
-#define SA_OFF 0x01 /* Sound Channel A off */
-#define SB_OFF 0x02 /* Sound Channel B off */
-#define SC_OFF 0x04 /* Sound Channel C off */
-#define NA_OFF 0x08 /* Noise Channel A off */
-#define NB_OFF 0x10 /* Noise Channel B off */
-#define NC_OFF 0x20 /* Noise Channel C off */
-#define PA_OUT 0x40 /* Port A for Output */
-#define PB_OUT 0x80 /* Port B for Output */
-
-/* bits in Vx: */
-#define VOLUME 0x0F /* 16 steps */
-#define ENVELOP 0x10 /* volume steered by envelope */
-
-/* bits in WFE: */
-#define WF_HOLD 0x01 /* hold after one period */
-#define WF_ALTERNAT 0x02 /* up and down (no saw teeth) */
-#define WF_ATTACK 0x04 /* start up */
-#define WF_CONTINUE 0x08 /* multiple periods */
-
-/* names for bits in Port A (ST specific): */
-#define PA_SIDEB 0x01 /* select floppy head - if double sided */
-#define PA_FLOP0 0x02 /* Drive Select Floppy 0 */
-#define PA_FLOP1 0x04 /* Drive Select Floppy 1 */
-#define PA_SRTS 0x08 /* Serial RTS */
-#define PA_SDTR 0x10 /* Serial DTR */
-#define PA_PSTROBE 0x20 /* Parallel Strobe */
-#define PA_USER 0x40 /* Free Pin on Monitor Connector */
-#define PA_SER2 0x80 /* Choose between LAN or Ser2 port */
-
-#endif /* _MACHINE_VIDEO_H */
diff --git a/sys/arch/atari/include/vmparam.h b/sys/arch/atari/include/vmparam.h
deleted file mode 100644
index 07025dfa6c5..00000000000
--- a/sys/arch/atari/include/vmparam.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/* $NetBSD: vmparam.h,v 1.1.1.1 1995/03/26 07:12:07 leo Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: vmparam.h 1.16 91/01/18$
- *
- * @(#)vmparam.h 7.3 (Berkeley) 5/7/91
- */
-
-#ifndef _MACHINE_VMPARAM_H_
-#define _MACHINE_VMPARAM_H_
-
-#include <machine/pte.h>
-
-/*
- * Machine dependent constants for HP300
- */
-/*
- * USRTEXT is the start of the user text/data space, while USRSTACK
- * is the top (end) of the user stack. LOWPAGES and HIGHPAGES are
- * the number of pages from the beginning of the P0 region to the
- * beginning of the text and from the beginning of the P1 region to the
- * beginning of the stack respectively.
- *
- * These are a mixture of i386, sun3 and hp settings..
- */
-
-/* Sun settings. Still hope, that I might get sun3 binaries to work... */
-#define USRTEXT 0x2000
-#define USRSTACK 0x0E000000
-#define LOWPAGES btoc(USRTEXT)
-#define KUSER_AREA (-UPAGES*NBPG)
-/*
- * Virtual memory related constants, all in bytes
- */
-
-#ifndef MAXTSIZ
-#define MAXTSIZ (6*1024*1024) /* max text size */
-#endif
-#ifndef DFLDSIZ
-#define DFLDSIZ (32*1024*1024) /* initial data size limit */
-#endif
-#ifndef MAXDSIZ
-#define MAXDSIZ (32*1024*1024) /* max data size */
-#endif
-#ifndef DFLSSIZ
-#define DFLSSIZ (2*1024*1024) /* initial stack size limit */
-#endif
-#ifndef MAXSSIZ
-#define MAXSSIZ MAXDSIZ /* max stack size */
-#endif
-
-/*
- * Default sizes of swap allocation chunks (see dmap.h).
- * The actual values may be changed in vminit() based on MAXDSIZ.
- * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024.
- * DMMIN should be at least ctod(1) so that vtod() works.
- * vminit() insures this.
- */
-#define DMMIN 32 /* smallest swap allocation */
-#define DMMAX NBPG /* largest potential swap allocation */
-
-/*
- * Sizes of the system and user portions of the system page table.
- */
-/* SYSPTSIZE IS SILLY; IT SHOULD BE COMPUTED AT BOOT TIME */
-#define SYSPTSIZE (2 * NPTEPG) /* 16mb */
-#define USRPTSIZE (1 * NPTEPG) /* 16mb */
-
-/*
- * PTEs for mapping user space into the kernel for phyio operations.
- * One page is enough to handle 16Mb of simultaneous raw IO operations.
- */
-#ifndef USRIOSIZE
-#define USRIOSIZE (1 * NPTEPG) /* 16mb */
-#endif
-
-/*
- * PTEs for system V style shared memory.
- * This is basically slop for kmempt which we actually allocate (malloc) from.
- */
-#ifndef SHMMAXPGS
-#define SHMMAXPGS (1 * NPTEPG) /* 16mb */
-#endif
-
-/*
- * The time for a process to be blocked before being very swappable.
- * This is a number of seconds which the system takes as being a non-trivial
- * amount of real time. You probably shouldn't change this;
- * it is used in subtle ways (fractions and multiples of it are, that is, like
- * half of a ``long time'', almost a long time, etc.)
- * It is related to human patience and other factors which don't really
- * change over time.
- */
-#define MAXSLP 20
-
-/*
- * A swapped in process is given a small amount of core without being bothered
- * by the page replacement algorithm. Basically this says that if you are
- * swapped in you deserve some resources. We protect the last SAFERSS
- * pages against paging and will just swap you out rather than paging you.
- * Note that each process has at least UPAGES+CLSIZE pages which are not
- * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this
- * number just means a swapped in process is given around 25k bytes.
- * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81),
- * so we loan each swapped in process memory worth 100$, or just admit
- * that we don't consider it worthwhile and swap it out to disk which costs
- * $30/mb or about $0.75.
- */
-#define SAFERSS 4 /* nominal ``small'' resident set size
- protected against replacement */
-
-/*
- * user/kernel map constants
- */
-#define VM_MIN_ADDRESS ((vm_offset_t)0)
-#define VM_MAXUSER_ADDRESS ((vm_offset_t)(USRSTACK))
-#define VM_MAX_ADDRESS ((vm_offset_t)(0-(UPAGES*NBPG)))
-#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)0)
-#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)(0-NBPG))
-
-/*
- * virtual sizes (bytes) for various kernel submaps
- */
-#define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES)
-#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES)
-#define VM_PHYS_SIZE (USRIOSIZE*CLBYTES)
-
-/*
- * number of kernel PT pages (initial only, can grow dynamically)
- */
-#define VM_KERNEL_PT_PAGES ((vm_size_t)2) /* XXX: SYSPTSIZE */
-#endif /* !_MACHINE_VMPARAM_H_ */
diff --git a/sys/arch/atari/stand/binpatch/Makefile b/sys/arch/atari/stand/binpatch/Makefile
deleted file mode 100644
index f8416da4a33..00000000000
--- a/sys/arch/atari/stand/binpatch/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# $NetBSD: Makefile,v 1.2 1995/08/29 20:26:39 leo Exp $
-
-PROG=binpatch
-MAN=binpatch.8
-
-BINDIR=/sbin
-LDFLAGS+=-static
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/atari/stand/binpatch/binpatch.8 b/sys/arch/atari/stand/binpatch/binpatch.8
deleted file mode 100644
index ff814135b58..00000000000
--- a/sys/arch/atari/stand/binpatch/binpatch.8
+++ /dev/null
@@ -1,96 +0,0 @@
-.\" $NetBSD: binpatch.8,v 1.1.1.1 1995/03/26 07:12:05 leo Exp $
-.\"
-.\" Copyright (c) 1994 Christian E. Hopps
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by Christian E. Hopps.
-.\" 3. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.\"
-.Dd February 2, 1994
-.Dt BINPATCH 8 atari
-.Os
-.Sh NAME
-.Nm binpatch
-.Nd examine and or modify initialized data in a binary file.
-.Sh SYNOPSIS
-.Nm binpatch
-.Op Fl b | Fl w | Fl l
-.Op Fl o Ar offset
-.Fl s Ar symname
-.Op Fl r Ar value
-.Ar binfile
-.Nm binpatch
-.Op Fl b | Fl w | Fl l
-.Op Fl o Ar offset
-.Fl a Ar addr
-.Op Fl r Ar value
-.Ar binfile
-.Sh DESCRIPTION
-.Nm binpatch
-is used to modify or examine the data associated with a symbol in a binary
-file
-.Ar binfile .
-The flags
-.Fl b ,
-.Fl w
-and
-.Fl l
-specify the size of the data to be modified or examined
-(byte, word, and long, respectively). The
-.Ar binfile
-is scanned in search of the symbol
-.Ar symname
-(specified with the
-.Fl s
-flag)
-If the symbol is found the current data and address are printed. Next if the
-.Fl r
-flag has been given, the current data is replaced with that of
-.Ar value .
-.Pp
-If the second form is used the address
-.Ar addr
-specified with the
-.Fl a
-flag is used as a direct address into the data section of the binary and
-no symbol search is performed.
-.Pp
-The
-.Fl o
-flag specifies an offset in byte, word or long (
-.Fl b
-,
-.Fl w
-,
-or
-.Fl l
-) units from the given locator (
-.Fl s
-or
-.Fl a
-) for
-.Nm binpatch
-to perform it's described actions.
-
diff --git a/sys/arch/atari/stand/binpatch/binpatch.c b/sys/arch/atari/stand/binpatch/binpatch.c
deleted file mode 100644
index 3a0b46efe5c..00000000000
--- a/sys/arch/atari/stand/binpatch/binpatch.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/* $NetBSD: binpatch.c,v 1.1.1.1 1995/03/26 07:12:04 leo Exp $ */
-
-/*
- * Copyright (c) 1994 Christian E. Hopps
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christian E. Hopps.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/types.h>
-#include <a.out.h>
-#include <stdio.h>
-
-extern char *optarg;
-extern int optind;
-
-volatile void error ();
-
-int test = 1;
-int testbss;
-char foo = 23;
-
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- struct exec e;
- int c;
- u_long addr = 0, offset = 0;
- u_long replace = 0, do_replace = 0;
- char *symbol = 0;
- char size = 4; /* default to long */
- char *fname;
- int fd;
- int type, off;
- u_long lval;
- u_short sval;
- u_char cval;
-
-
- while ((c = getopt (argc, argv, "a:bwlr:s:o:")) != -1)
- switch (c)
- {
- case 'a':
- if (addr || symbol)
- error ("only one address/symbol allowed");
- if (! strncmp (optarg, "0x", 2))
- sscanf (optarg, "%x", &addr);
- else
- addr = atoi (optarg);
- if (! addr)
- error ("invalid address");
- break;
-
- case 'b':
- size = 1;
- break;
-
- case 'w':
- size = 2;
- break;
-
- case 'l':
- size = 4;
- break;
-
- case 'r':
- do_replace = 1;
- if (! strncmp (optarg, "0x", 2))
- sscanf (optarg, "%x", &replace);
- else
- replace = atoi (optarg);
- break;
-
- case 's':
- if (addr || symbol)
- error ("only one address/symbol allowed");
- symbol = optarg;
- break;
-
- case 'o':
- if (offset)
- error ("only one offset allowed");
- if (! strncmp (optarg, "0x", 2))
- sscanf (optarg, "%x", &offset);
- else
- offset = atoi (optarg);
- break;
- }
-
- argv += optind;
- argc -= optind;
-
-
- if (argc < 1)
- error ("No file to patch.");
-
- fname = argv[0];
- if ((fd = open (fname, 0)) < 0)
- error ("Can't open file");
-
- if (read (fd, &e, sizeof (e)) != sizeof (e)
- || N_BADMAG (e))
- error ("Not a valid executable.");
-
- /* fake mid, so the N_ macros work on the amiga.. */
- e.a_midmag |= 127 << 16;
-
- if (symbol)
- {
- struct nlist nl[2];
- nl[0].n_un.n_name = symbol;
- nl[1].n_un.n_name = 0;
- if (nlist (fname, nl) != 0)
- error ("Symbol not found.");
- addr = nl[0].n_value;
- type = nl[0].n_type & N_TYPE;
- }
- else
- {
- type = N_UNDF;
- if (addr >= N_TXTADDR(e) && addr < N_DATADDR(e))
- type = N_TEXT;
- else if (addr >= N_DATADDR(e) && addr < N_DATADDR(e) + e.a_data)
- type = N_DATA;
- }
- addr += offset;
-
- /* if replace-mode, have to reopen the file for writing.
- Can't do that from the beginning, or nlist() will not
- work (at least not under AmigaDOS) */
- if (do_replace)
- {
- close (fd);
- if ((fd = open (fname, 2)) == -1)
- error ("Can't reopen file for writing.");
- }
-
- if (type != N_TEXT && type != N_DATA)
- error ("address/symbol is not in text or data section.");
-
- if (type == N_TEXT)
- off = addr - N_TXTADDR(e) + N_TXTOFF(e);
- else
- off = addr - N_DATADDR(e) + N_DATOFF(e);
-
- if (lseek (fd, off, 0) == -1)
- error ("lseek");
-
- /* not beautiful, but works on big and little endian machines */
- switch (size)
- {
- case 1:
- if (read (fd, &cval, 1) != 1)
- error ("cread");
- lval = cval;
- break;
-
- case 2:
- if (read (fd, &sval, 2) != 2)
- error ("sread");
- lval = sval;
- break;
-
- case 4:
- if (read (fd, &lval, 4) != 4)
- error ("lread");
- break;
- }
-
-
- if (symbol)
- printf ("%s(0x%x): %d (0x%x)\n", symbol, addr, lval, lval);
- else
- printf ("0x%x: %d (0x%x)\n", addr, lval, lval);
-
- if (do_replace)
- {
- if (lseek (fd, off, 0) == -1)
- error ("write-lseek");
- switch (size)
- {
- case 1:
- cval = replace;
- if (cval != replace)
- error ("byte-value overflow.");
- if (write (fd, &cval, 1) != 1)
- error ("cwrite");
- break;
-
- case 2:
- sval = replace;
- if (sval != replace)
- error ("word-value overflow.");
- if (write (fd, &sval, 2) != 2)
- error ("swrite");
- break;
-
- case 4:
- if (write (fd, &replace, 4) != 4)
- error ("lwrite");
- break;
- }
- }
-
- close (fd);
-}
-
-
-
-volatile void error (str)
- char *str;
-{
- fprintf (stderr, "%s\n", str);
- exit (1);
-}
diff --git a/sys/arch/atari/stand/loadkmap/ge-kbdmap.c b/sys/arch/atari/stand/loadkmap/ge-kbdmap.c
deleted file mode 100644
index cff128e2d5a..00000000000
--- a/sys/arch/atari/stand/loadkmap/ge-kbdmap.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/* $NetBSD: ge-kbdmap.c,v 1.2 1995/09/23 20:27:15 leo Exp $ */
-
-/*
- * Contributed by Thomas Gerner
- */
-
-#include "../../dev/kbdmap.h"
-
-/* mode shortcuts: */
-#define S KBD_MODE_STRING
-#define C KBD_MODE_CAPS
-#define K KBD_MODE_KPAD
-
-struct kbdmap kbdmap;
-struct kbdmap ascii_kbdmap = {
- /* normal map */
- {
-/* 0x00 */ 0, 0, 0, ESC, 0, '1', 0, '2',
-/* 0x04 */ 0, '3', 0, '4', 0, '5', 0, '6',
-/* 0x08 */ 0, '7', 0, '8', 0, '9', 0, '0',
-/* 0x0c */ C, 0xDF, 0, '\'', 0, '\b', 0, '\t',
-/* 0x10 */ C, 'q', C, 'w', C, 'e', C, 'r',
-/* 0x14 */ C, 't', C, 'z', C, 'u', C, 'i',
-/* 0x18 */ C, 'o', C, 'p', C, 0xFC, 0, '+',
-/* 0x1c */ 0, '\r', 0, 0, C, 'a', C, 's',
-/* 0x20 */ C, 'd', C, 'f', C, 'g', C, 'h',
-/* 0x24 */ C, 'j', C, 'k', C, 'l', C, 0xF6,
-/* 0x28 */ C, 0xE4, 0, '#', 0, 0, 0, '~',
-/* 0x2c */ C, 'y', C, 'x', C, 'c', C, 'v',
-/* 0x30 */ C, 'b', C, 'n', C, 'm', 0, ',',
-/* 0x34 */ 0, '.', 0, '-', 0, 0, 0, 0,
-/* 0x38 */ 0, 0, 0, ' ', 0, 0, S, 0x10,
-/* 0x3c */ S, 0x15, S, 0x1A, S, 0x1F, S, 0x24,
-/* 0x40 */ S, 0x29, S, 0x2E, S, 0x33, S, 0x38,
-/* 0x44 */ S, 0x3D, 0, 0, 0, 0, 0, 0,
-/* 0x48 */ S, 0x00, 0, 0, 0, '-', S, 0x0C,
-/* 0x4c */ 0, 0, S, 0x08, 0, '+', 0, 0,
-/* 0x50 */ S, 0x04, 0, 0, 0, 0, 0, DEL,
-/* 0x54 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x58 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x5c */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x60 */
-/* 0x60 */ 0, '<', 0, 0, 0, 0, 0, '(',
-/* 0x64 */ 0, ')', 0, '/', 0, '*', K, '7',
-/* 0x68 */ K, '8', K, '9', K, '4', K, '5',
-/* 0x6c */ K, '6', K, '1', K, '2', K, '3',
-/* 0x70 */ K, '0', K, '.', K, '\r', 0, 0,
-/* 0x74 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x78 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x7c */ 0, 0, 0, 0, 0, 0, 0, 0
-},
- /* shifted map */
- {
-/* 0x00 */ 0, 0, 0, ESC, 0, '!', 0, '"',
-/* 0x04 */ 0, 0xA7, 0, '$', 0, '%', 0, '&',
-/* 0x08 */ 0, '/', 0, '(', 0, ')', 0, '=',
-/* 0x0c */ 0, '?', 0, '`', 0, '\b', 0, '\t',
-/* 0x10 */ C, 'Q', C, 'W', C, 'E', C, 'R',
-/* 0x14 */ C, 'T', C, 'Z', C, 'U', C, 'I',
-/* 0x18 */ C, 'O', C, 'P', C, 0xDC, 0, '*',
-/* 0x1c */ 0, '\r', 0, 0, C, 'A', C, 'S',
-/* 0x20 */ C, 'D', C, 'F', C, 'G', C, 'H',
-/* 0x24 */ C, 'J', C, 'K', C, 'L', C, 0xD6,
-/* 0x28 */ C, 0xC4, 0, '^', 0, 0, 0, '|',
-/* 0x2c */ C, 'Y', C, 'X', C, 'C', C, 'V',
-/* 0x30 */ C, 'B', C, 'N', C, 'M', 0, ';',
-/* 0x34 */ 0, ':', 0, '_', 0, 0, 0, 0,
-/* 0x38 */ 0, 0, 0, ' ', 0, 0, S, 0x5d,
-/* 0x3c */ S, 0x63, S, 0x69, S, 0x6F, S, 0x75,
-/* 0x40 */ S, 0x7b, S, 0x81, S, 0x87, S, 0x8d,
-/* 0x44 */ S, 0x93, 0, 0, 0, 0, 0, 0,
-/* 0x48 */ S, 0x47, 0, 0, 0, '-', S, 0x57,
-/* 0x4c */ 0, 0, S, 0x51, 0, '+', 0, 0,
-/* 0x50 */ S, 0x4c, 0, 0, 0, 0, 0, DEL,
-/* 0x54 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x58 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x5c */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x60 */
-/* 0x60 */ 0, '>', 0, 0, 0, 0, 0, '(',
-/* 0x64 */ 0, ')', 0, '/', 0, '*', K, '7',
-/* 0x68 */ K, '8', K, '9', K, '4', K, '5',
-/* 0x6c */ K, '6', K, '1', K, '2', K, '3',
-/* 0x70 */ K, '0', K, '.', K, '\r', 0, 0,
-/* 0x74 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x78 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x7c */ 0, 0, 0, 0, 0, 0, 0, 0
- },
-
- /* alt map */
- {
-/* 0x00 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x04 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x08 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x0c */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x10 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x14 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x18 */ 0, 0, 0, 0, 0, '@', 0, 0,
-/* 0x1c */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x20 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x24 */ 0, 0, 0, 0, 0, 0, 0, '[',
-/* 0x28 */ 0, ']', 0, 0, 0, 0, 0, 0,
-/* 0x2c */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x30 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x34 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x38 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x3c */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x40 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x44 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x48 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x4c */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x50 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x54 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x58 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x5c */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x60 */
-/* 0x60 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x64 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x68 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x6c */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x74 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x78 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x7c */ 0, 0, 0, 0, 0, 0, 0, 0
- },
-
- /* shift alt map */
- {
-/* 0x00 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x04 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x08 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x0c */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x10 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x14 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x18 */ 0, 0, 0, 0, 0, '\\', 0, 0,
-/* 0x1c */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x20 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x24 */ 0, 0, 0, 0, 0, 0, 0, '{',
-/* 0x28 */ 0, '}', 0, 0, 0, 0, 0, 0,
-/* 0x2c */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x30 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x34 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x38 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x3c */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x40 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x44 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x48 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x4c */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x50 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x54 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x58 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x5c */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x60 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x64 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x68 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x6c */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x70 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x74 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x78 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x7c */ 0, 0, 0, 0, 0, 0, 0, 0
- },
-
- {
- /* string table. If there's a better way to get the offsets into the
- above table, please tell me..
-
- NOTE: save yourself and others a lot of grief by *not* using
- CSI == 0x9b, using the two-character sequence gives
- much less trouble, especially in GNU-Emacs.. */
-
- 3, ESC, '[', 'A', /* 0x00: CRSR UP */
- 3, ESC, '[', 'B', /* 0x04: CRSR DOWN */
- 3, ESC, '[', 'C', /* 0x08: CRSR RIGHT */
- 3, ESC, '[', 'D', /* 0x0C: CRSR LEFT */
- 4, ESC, '[', '0', '~', /* 0x10: F1 */
- 4, ESC, '[', '1', '~', /* 0x15: F2 */
- 4, ESC, '[', '2', '~', /* 0x1A: F3 */
- 4, ESC, '[', '3', '~', /* 0x1F: F4 */
- 4, ESC, '[', '4', '~', /* 0x24: F5 */
- 4, ESC, '[', '5', '~', /* 0x29: F6 */
- 4, ESC, '[', '6', '~', /* 0x2E: F7 */
- 4, ESC, '[', '7', '~', /* 0x33: F8 */
- 4, ESC, '[', '8', '~', /* 0x38: F9 */
- 4, ESC, '[', '9', '~', /* 0x3D: F10 */
- 4, ESC, '[', '?', '~', /* 0x42: HELP */
-
- 4, ESC, '[', 'T', '~', /* 0x47: shift CRSR UP */
- 4, ESC, '[', 'S', '~', /* 0x4C: shift CRSR DOWN */
- 5, ESC, '[', ' ', '@', '~', /* 0x51: shift CRSR RIGHT */
- 5, ESC, '[', ' ', 'A', '~', /* 0x57: shift CRSR LEFT */
- 5, ESC, '[', '1', '0', '~', /* 0x5D: shift F1 */
- 5, ESC, '[', '1', '1', '~', /* 0x63: shift F2 */
- 5, ESC, '[', '1', '2', '~', /* 0x69: shift F3 */
- 5, ESC, '[', '1', '3', '~', /* 0x6F: shift F4 */
- 5, ESC, '[', '1', '4', '~', /* 0x75: shift F5 */
- 5, ESC, '[', '1', '5', '~', /* 0x7B: shift F6 */
- 5, ESC, '[', '1', '6', '~', /* 0x81: shift F7 */
- 5, ESC, '[', '1', '7', '~', /* 0x87: shift F8 */
- 5, ESC, '[', '1', '8', '~', /* 0x8D: shift F9 */
- 5, ESC, '[', '1', '9', '~', /* 0x93: shift F10 */
- 3, ESC, '[', 'Z', /* 0x99: shift TAB */
- 2, ESC, '[', /* 0x9d: alt ESC == CSI */
- },
-};
-
-main()
-{
- write (1, &ascii_kbdmap, sizeof (kbdmap));
-}
diff --git a/sys/arch/atari/stand/loadkmap/loadkmap.c b/sys/arch/atari/stand/loadkmap/loadkmap.c
deleted file mode 100644
index 0884f691ca2..00000000000
--- a/sys/arch/atari/stand/loadkmap/loadkmap.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $NetBSD: loadkmap.c,v 1.2 1995/07/24 05:47:48 leo Exp $ */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include "../../dev/iteioctl.h"
-#include "../../dev/kbdmap.h"
-#include <stdio.h>
-
-
-void load_kmap __P((const char *, int));
-void dump_kmap();
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- int set_sysmap = 0;
- char *mapfile;
-
- if (argc > 2) {
- if ((argc == 3) && !strcmp(argv[1], "-f")) {
- mapfile = argv[2];
- set_sysmap = 1;
- }
- else {
- fprintf(stderr, "%s [-f] keymap\n", argv[0]);
- exit(1);
- }
- }
- else mapfile = argv[1];
-
- if (argc == 1)
- dump_kmap();
- else load_kmap(mapfile, set_sysmap);
-
- exit (0);
-}
-
-
-void
-load_kmap(file, set_sysmap)
-const char *file;
-int set_sysmap;
-{
- int fd;
- char buf[sizeof (struct kbdmap)];
- int ioc;
-
- ioc = set_sysmap ? ITEIOCSSKMAP : ITEIOCSKMAP;
-
- if ((fd = open (file, 0)) >= 0) {
- if (read (fd, buf, sizeof (buf)) == sizeof (buf)) {
- if (ioctl (0, ioc, buf) == 0)
- return;
- else perror("ITEIOCSKMAP");
- }
- else perror("read kmap");
-
- close(fd);
- }
- else perror("open kmap");
-}
-
-void
-dump_kmap()
-{
- char buf[sizeof (struct kbdmap)];
-
- if (ioctl (0, ITEIOCGKMAP, buf) == 0)
- write (1, buf, sizeof (buf));
- else perror ("ITEIOCGKMAP");
-}
diff --git a/sys/arch/atari/stand/loadkmap/uk-kbdmap.c b/sys/arch/atari/stand/loadkmap/uk-kbdmap.c
deleted file mode 100644
index 25b7d6f0e7a..00000000000
--- a/sys/arch/atari/stand/loadkmap/uk-kbdmap.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/* $NetBSD: uk-kbdmap.c,v 1.1.1.1 1995/07/03 20:49:40 leo Exp $ */
-
-#include "../../dev/kbdmap.h"
-
-/* mode shortcuts: */
-#define S KBD_MODE_STRING
-#define C KBD_MODE_CAPS
-#define K KBD_MODE_KPAD
-
-struct kbdmap kbdmap;
-struct kbdmap ascii_kbdmap = {
- /* normal map */
- {
-/* 0x00 */ 0, 0, 0, ESC, 0, '1', 0, '2',
-/* 0x04 */ 0, '3', 0, '4', 0, '5', 0, '6',
-/* 0x08 */ 0, '7', 0, '8', 0, '9', 0, '0',
-/* 0x0c */ 0, '-', 0, '=', 0, '\b', 0, '\t',
-/* 0x10 */ C, 'q', C, 'w', C, 'e', C, 'r',
-/* 0x14 */ C, 't', C, 'y', C, 'u', C, 'i',
-/* 0x18 */ C, 'o', C, 'p', 0, '[', 0, ']',
-/* 0x1c */ 0, '\r', 0, 0, C, 'a', C, 's',
-/* 0x20 */ C, 'd', C, 'f', C, 'g', C, 'h',
-/* 0x24 */ C, 'j', C, 'k', C, 'l', 0, ';',
-/* 0x28 */ 0, '\'', 0, '`', 0, 0, 0, '#',
-/* 0x2c */ C, 'z', C, 'x', C, 'c', C, 'v',
-/* 0x30 */ C, 'b', C, 'n', C, 'm', 0, ',',
-/* 0x34 */ 0, '.', 0, '/', 0, 0, 0, 0,
-/* 0x38 */ 0, 0, 0, ' ', 0, 0, S, 0x10,
-/* 0x3c */ S, 0x15, S, 0x1A, S, 0x1F, S, 0x24,
-/* 0x40 */ S, 0x29, S, 0x2E, S, 0x33, S, 0x38,
-/* 0x44 */ S, 0x3D, 0, 0, 0, 0, 0, 0,
-/* 0x48 */ S, 0x00, 0, 0, 0, '-', S, 0x0C,
-/* 0x4c */ 0, 0, S, 0x08, 0, '+', 0, 0,
-/* 0x50 */ S, 0x04, 0, 0, 0, 0, 0, DEL,
-/* 0x54 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x58 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x5c */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x60 */
-/* 0x60 */ 0, '\\', 0, 0, 0, 0, 0, '(',
-/* 0x64 */ 0, ')', 0, '/', 0, '*', K, '7',
-/* 0x68 */ K, '8', K, '9', K, '4', K, '5',
-/* 0x6c */ K, '6', K, '1', K, '2', K, '3',
-/* 0x70 */ K, '0', K, '.', K, '\r', 0, 0,
-/* 0x74 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x78 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x7c */ 0, 0, 0, 0, 0, 0, 0, 0
-},
- /* shifted map */
- {
-/* 0x00 */ 0, 0, 0, ESC, 0, '!', 0, '"',
-/* 0x04 */ 0, '#', 0, '$', 0, '%', 0, '^',
-/* 0x08 */ 0, '&', 0, '*', 0, '(', 0, ')',
-/* 0x0c */ 0, '_', 0, '+', 0, '\b', 0, '\t',
-/* 0x10 */ C, 'Q', C, 'W', C, 'E', C, 'R',
-/* 0x14 */ C, 'T', C, 'Y', C, 'U', C, 'I',
-/* 0x18 */ C, 'O', C, 'P', 0, '{', 0, '}',
-/* 0x1c */ 0, '\r', 0, 0, C, 'A', C, 'S',
-/* 0x20 */ C, 'D', C, 'F', C, 'G', C, 'H',
-/* 0x24 */ C, 'J', C, 'K', C, 'L', 0, ':',
-/* 0x28 */ 0, '@', 0, '_', 0, 0, 0, '~',
-/* 0x2c */ C, 'Z', C, 'X', C, 'C', C, 'V',
-/* 0x30 */ C, 'B', C, 'N', C, 'M', 0, '<',
-/* 0x34 */ 0, '>', 0, '?', 0, 0, 0, 0,
-/* 0x38 */ 0, 0, 0, ' ', 0, 0, S, 0x5d,
-/* 0x3c */ S, 0x63, S, 0x69, S, 0x6F, S, 0x75,
-/* 0x40 */ S, 0x7b, S, 0x81, S, 0x87, S, 0x8d,
-/* 0x44 */ S, 0x93, 0, 0, 0, 0, 0, 0,
-/* 0x48 */ S, 0x47, 0, 0, 0, '-', S, 0x57,
-/* 0x4c */ 0, 0, S, 0x51, 0, '+', 0, 0,
-/* 0x50 */ S, 0x4c, 0, 0, 0, 0, 0, DEL,
-/* 0x54 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x58 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x5c */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x60 */
-/* 0x60 */ 0, '|', 0, 0, 0, 0, 0, '(',
-/* 0x64 */ 0, ')', 0, '/', 0, '*', K, '7',
-/* 0x68 */ K, '8', K, '9', K, '4', K, '5',
-/* 0x6c */ K, '6', K, '1', K, '2', K, '3',
-/* 0x70 */ K, '0', K, '.', K, '\r', 0, 0,
-/* 0x74 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x78 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x7c */ 0, 0, 0, 0, 0, 0, 0, 0
- },
-
- /* alt map FIXME: No altmap yet.. */
- {
- 0, 0
- },
-
- /* shift alt map FIXME: No shift altmap yet... */
- {
- 0, 0
- },
-
- {
- /* string table. If there's a better way to get the offsets into the
- above table, please tell me..
-
- NOTE: save yourself and others a lot of grief by *not* using
- CSI == 0x9b, using the two-character sequence gives
- much less trouble, especially in GNU-Emacs.. */
-
- 3, ESC, '[', 'A', /* 0x00: CRSR UP */
- 3, ESC, '[', 'B', /* 0x04: CRSR DOWN */
- 3, ESC, '[', 'C', /* 0x08: CRSR RIGHT */
- 3, ESC, '[', 'D', /* 0x0C: CRSR LEFT */
- 4, ESC, '[', '0', '~', /* 0x10: F1 */
- 4, ESC, '[', '1', '~', /* 0x15: F2 */
- 4, ESC, '[', '2', '~', /* 0x1A: F3 */
- 4, ESC, '[', '3', '~', /* 0x1F: F4 */
- 4, ESC, '[', '4', '~', /* 0x24: F5 */
- 4, ESC, '[', '5', '~', /* 0x29: F6 */
- 4, ESC, '[', '6', '~', /* 0x2E: F7 */
- 4, ESC, '[', '7', '~', /* 0x33: F8 */
- 4, ESC, '[', '8', '~', /* 0x38: F9 */
- 4, ESC, '[', '9', '~', /* 0x3D: F10 */
- 4, ESC, '[', '?', '~', /* 0x42: HELP */
-
- 4, ESC, '[', 'T', '~', /* 0x47: shift CRSR UP */
- 4, ESC, '[', 'S', '~', /* 0x4C: shift CRSR DOWN */
- 5, ESC, '[', ' ', '@', '~', /* 0x51: shift CRSR RIGHT */
- 5, ESC, '[', ' ', 'A', '~', /* 0x57: shift CRSR LEFT */
- 5, ESC, '[', '1', '0', '~', /* 0x5D: shift F1 */
- 5, ESC, '[', '1', '1', '~', /* 0x63: shift F2 */
- 5, ESC, '[', '1', '2', '~', /* 0x69: shift F3 */
- 5, ESC, '[', '1', '3', '~', /* 0x6F: shift F4 */
- 5, ESC, '[', '1', '4', '~', /* 0x75: shift F5 */
- 5, ESC, '[', '1', '5', '~', /* 0x7B: shift F6 */
- 5, ESC, '[', '1', '6', '~', /* 0x81: shift F7 */
- 5, ESC, '[', '1', '7', '~', /* 0x87: shift F8 */
- 5, ESC, '[', '1', '8', '~', /* 0x8D: shift F9 */
- 5, ESC, '[', '1', '9', '~', /* 0x93: shift F10 */
- 3, ESC, '[', 'Z', /* 0x99: shift TAB */
- 2, ESC, '[', /* 0x9d: alt ESC == CSI */
- },
-};
-
-main()
-{
- write (1, &ascii_kbdmap, sizeof (kbdmap));
-}
diff --git a/sys/arch/atari/stand/loadkmap/us-kbdmap.c b/sys/arch/atari/stand/loadkmap/us-kbdmap.c
deleted file mode 100644
index 70ca7d53f3c..00000000000
--- a/sys/arch/atari/stand/loadkmap/us-kbdmap.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/* $NetBSD: us-kbdmap.c,v 1.2 1995/07/24 05:44:43 leo Exp $ */
-
-#include "../../dev/kbdmap.h"
-
-/* mode shortcuts: */
-#define S KBD_MODE_STRING
-#define C KBD_MODE_CAPS
-#define K KBD_MODE_KPAD
-
-
-/*
-| 20.June.95
-| Abdulkareem asx@ccnet.com
-|
-| Changes made for the US keyboard
-| The pipe symbol '|', the double-quote '"', the at sign, '@', the
-| tidle '~', the backslash '\' were incompatible to the built-in
-| keymap and therefore not available on the US keyabords.
-|
-| I've added the loadkmap us-map line in my /etc/rc.local file; don't
-| know where else to put it.
-|
-*/
-
-
-struct kbdmap kbdmap;
-struct kbdmap ascii_kbdmap = {
- /* normal map */
- {
-/* 0x00 */ 0, 0, 0, ESC, 0, '1', 0, '2',
-/* 0x04 */ 0, '3', 0, '4', 0, '5', 0, '6',
-/* 0x08 */ 0, '7', 0, '8', 0, '9', 0, '0',
-/* 0x0c */ 0, '-', 0, '=', 0, '\b', 0, '\t',
-/* 0x10 */ C, 'q', C, 'w', C, 'e', C, 'r',
-/* 0x14 */ C, 't', C, 'y', C, 'u', C, 'i',
-/* 0x18 */ C, 'o', C, 'p', 0, '[', 0, ']',
-/* 0x1c */ 0, '\r', 0, DEL, C, 'a', C, 's',
-/* 0x20 */ C, 'd', C, 'f', C, 'g', C, 'h',
-/* 0x24 */ C, 'j', C, 'k', C, 'l', 0, ';',
-/* 0x28 */ 0, '\'', 0, '`', 0, 0, 0, '\\',
-/* 0x2c */ C, 'z', C, 'x', C, 'c', C, 'v',
-/* 0x30 */ C, 'b', C, 'n', C, 'm', 0, ',',
-/* 0x34 */ 0, '.', 0, '/', 0, 0, 0, 0,
-/* 0x38 */ 0, 0, 0, ' ', 0, 0, S, 0x10,
-/* 0x3c */ S, 0x15, S, 0x1A, S, 0x1F, S, 0x24,
-/* 0x40 */ S, 0x29, S, 0x2E, S, 0x33, S, 0x38,
-/* 0x44 */ S, 0x3D, 0, 0, 0, 0, 0, 0,
-/* 0x48 */ S, 0x00, 0, 0, 0, '-', S, 0x0C,
-/* 0x4c */ 0, 0, S, 0x08, 0, '+', 0, 0,
-/* 0x50 */ S, 0x04, 0, 0, 0, 0, 0, DEL,
-/* 0x54 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x58 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x5c */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x60 */
-/* 0x60 */ 0, 0, 0, 0, 0, 0, 0, '(',
-/* 0x64 */ 0, ')', 0, '/', 0, '*', K, '7',
-/* 0x68 */ K, '8', K, '9', K, '4', K, '5',
-/* 0x6c */ K, '6', K, '1', K, '2', K, '3',
-/* 0x70 */ K, '0', K, '.', K, '\r', 0, 0,
-/* 0x74 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x78 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x7c */ 0, 0, 0, 0, 0, 0, 0, 0
-},
- /* shifted map */
- {
-/* 0x00 */ 0, 0, 0, ESC, 0, '!', 0, '@',
-/* 0x04 */ 0, '#', 0, '$', 0, '%', 0, '^',
-/* 0x08 */ 0, '&', 0, '*', 0, '(', 0, ')',
-/* 0x0c */ 0, '_', 0, '+', 0, '\b', 0, '\t',
-/* 0x10 */ C, 'Q', C, 'W', C, 'E', C, 'R',
-/* 0x14 */ C, 'T', C, 'Y', C, 'U', C, 'I',
-/* 0x18 */ C, 'O', C, 'P', 0, '{', 0, '}',
-/* 0x1c */ 0, '\r', 0, 0, C, 'A', C, 'S',
-/* 0x20 */ C, 'D', C, 'F', C, 'G', C, 'H',
-/* 0x24 */ C, 'J', C, 'K', C, 'L', 0, ':',
-/* 0x28 */ 0, '"', 0, '~', 0, 0, 0, '|',
-/* 0x2c */ C, 'Z', C, 'X', C, 'C', C, 'V',
-/* 0x30 */ C, 'B', C, 'N', C, 'M', 0, '<',
-/* 0x34 */ 0, '>', 0, '?', 0, 0, 0, 0,
-/* 0x38 */ 0, 0, 0, ' ', 0, 0, S, 0x5d,
-/* 0x3c */ S, 0x63, S, 0x69, S, 0x6F, S, 0x75,
-/* 0x40 */ S, 0x7b, S, 0x81, S, 0x87, S, 0x8d,
-/* 0x44 */ S, 0x93, 0, 0, 0, 0, 0, 0,
-/* 0x48 */ S, 0x47, 0, 0, 0, '-', S, 0x57,
-/* 0x4c */ 0, 0, S, 0x51, 0, '+', 0, 0,
-/* 0x50 */ S, 0x4c, 0, 0, 0, 0, 0, DEL,
-/* 0x54 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x58 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x5c */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x60 */
-/* 0x60 */ 0, 0, 0, 0, 0, 0, 0, '(',
-/* 0x64 */ 0, ')', 0, '/', 0, '*', K, '7',
-/* 0x68 */ K, '8', K, '9', K, '4', K, '5',
-/* 0x6c */ K, '6', K, '1', K, '2', K, '3',
-/* 0x70 */ K, '0', K, '.', K, '\r', 0, 0,
-/* 0x74 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x78 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* 0x7c */ 0, 0, 0, 0, 0, 0, 0, 0
- },
-
- /* alt map FIXME: No altmap yet.. */
- {
- 0, 0
- },
-
- /* shift alt map FIXME: No shift altmap yet... */
- {
- 0, 0
- },
-
- {
- /* string table. If there's a better way to get the offsets into the
- above table, please tell me..
-
- NOTE: save yourself and others a lot of grief by *not* using
- CSI == 0x9b, using the two-character sequence gives
- much less trouble, especially in GNU-Emacs.. */
-
- 3, ESC, '[', 'A', /* 0x00: CRSR UP */
- 3, ESC, '[', 'B', /* 0x04: CRSR DOWN */
- 3, ESC, '[', 'C', /* 0x08: CRSR RIGHT */
- 3, ESC, '[', 'D', /* 0x0C: CRSR LEFT */
- 4, ESC, '[', '0', '~', /* 0x10: F1 */
- 4, ESC, '[', '1', '~', /* 0x15: F2 */
- 4, ESC, '[', '2', '~', /* 0x1A: F3 */
- 4, ESC, '[', '3', '~', /* 0x1F: F4 */
- 4, ESC, '[', '4', '~', /* 0x24: F5 */
- 4, ESC, '[', '5', '~', /* 0x29: F6 */
- 4, ESC, '[', '6', '~', /* 0x2E: F7 */
- 4, ESC, '[', '7', '~', /* 0x33: F8 */
- 4, ESC, '[', '8', '~', /* 0x38: F9 */
- 4, ESC, '[', '9', '~', /* 0x3D: F10 */
- 4, ESC, '[', '?', '~', /* 0x42: HELP */
-
- 4, ESC, '[', 'T', '~', /* 0x47: shift CRSR UP */
- 4, ESC, '[', 'S', '~', /* 0x4C: shift CRSR DOWN */
- 5, ESC, '[', ' ', '@', '~', /* 0x51: shift CRSR RIGHT */
- 5, ESC, '[', ' ', 'A', '~', /* 0x57: shift CRSR LEFT */
- 5, ESC, '[', '1', '0', '~', /* 0x5D: shift F1 */
- 5, ESC, '[', '1', '1', '~', /* 0x63: shift F2 */
- 5, ESC, '[', '1', '2', '~', /* 0x69: shift F3 */
- 5, ESC, '[', '1', '3', '~', /* 0x6F: shift F4 */
- 5, ESC, '[', '1', '4', '~', /* 0x75: shift F5 */
- 5, ESC, '[', '1', '5', '~', /* 0x7B: shift F6 */
- 5, ESC, '[', '1', '6', '~', /* 0x81: shift F7 */
- 5, ESC, '[', '1', '7', '~', /* 0x87: shift F8 */
- 5, ESC, '[', '1', '8', '~', /* 0x8D: shift F9 */
- 5, ESC, '[', '1', '9', '~', /* 0x93: shift F10 */
- 3, ESC, '[', 'Z', /* 0x99: shift TAB */
- 2, ESC, '[', /* 0x9d: alt ESC == CSI */
- },
-};
-
-main()
-{
- write (1, &ascii_kbdmap, sizeof (kbdmap));
-}
diff --git a/sys/arch/atari/stand/tostools/Makefile b/sys/arch/atari/stand/tostools/Makefile
deleted file mode 100644
index 6c85596a781..00000000000
--- a/sys/arch/atari/stand/tostools/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# $NetBSD: Makefile,v 1.1 1996/01/07 22:05:31 leo Exp $
-
-SUBDIR= libtos loadbsd aptck chg_pid rawwrite
-
-.PHONY: all clean install
-
-all:
- @for dir in ${SUBDIR}; do \
- make -C $$dir all; \
- done
-
-clean:
- @for dir in ${SUBDIR}; do \
- make -C $$dir clean; \
- done
-
-install:
- @for dir in ${SUBDIR}; do \
- make -C $$dir install; \
- done
diff --git a/sys/arch/atari/stand/tostools/Makefile.inc b/sys/arch/atari/stand/tostools/Makefile.inc
deleted file mode 100644
index e5f633c5de7..00000000000
--- a/sys/arch/atari/stand/tostools/Makefile.inc
+++ /dev/null
@@ -1,64 +0,0 @@
-# $NetBSD: Makefile.inc,v 1.1 1996/01/07 22:05:41 leo Exp $
-
-#
-# Configurable stuff.
-#
-CC = cc
-#CC = gcc
-CPP = cpp
-#CPP = gcpp
-#AS = as
-AS = gas
-AR = ar rcs
-RM = rm -f
-AWK = awk
-
-#
-# Any system specific additional libraries.
-#
-#LIBS := ${LIBS} -liio -lport
-LIBS := ${LIBS} -ltermios
-
-DEBUG =
-#DEBUG = -g
-OPTIM = -O
-#OPTIM = -O2 -fomit-frame-pointer
-BASREL =
-#BASREL = -mpcrel -mbaserel
-STRIP =
-#STRIP = -Wl,-s
-
-# End of configuration section.
-
-
-HEADERS := ${HEADERS} ../libtos/libtos.h
-LDADD := ${LDADD} ../libtos/libtos.a
-INCL := ${INCL} -I. -I../libtos
-DEFS := ${DEFS} -DTOSTOOLS
-
-CFLAGS := ${CFLAGS} -Wall ${DEBUG} ${BASREL} ${OPTIM} ${INCL}
-LDFLAGS := ${LDFLAGS} ${DEBUG} ${BASREL} ${STRIP}
-CPPFLAGS:= ${CPPFLAGS} ${DEFS} ${INCL}
-
-.PHONY: all clean install
-
-#
-# Either ${LIB} or ${PROG} is set.
-#
-all: ${LIB} ${PROG}
-
-clean:
- ${RM} ${LIB} ${PROG} ${OBJS} ${CLEAN} a.out core
-
-install:
-# @if [ "${PROG}" ]; then \
-# ...; \
-# fi
-
-${OBJS}: ${HEADERS}
-
-.c.o:
- ${CC} ${CFLAGS} ${CPPFLAGS} -o $@ -c $<
-
-.s.o:
- ${CPP} ${CPPFLAGS} $< | ${AS} ${ASFLAGS} -o $@
diff --git a/sys/arch/atari/stand/tostools/aptck/Makefile b/sys/arch/atari/stand/tostools/aptck/Makefile
deleted file mode 100644
index 63dac91f7f9..00000000000
--- a/sys/arch/atari/stand/tostools/aptck/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-# $NetBSD: Makefile,v 1.2 1996/01/16 15:14:53 leo Exp $
-
-PROG = aptck.ttp
-
-OBJS = aptck.o biosrw.o diskio.o disklbl.o
-HEADERS = aptck.h ahdilbl.h disklbl.h
-
-LIBS = -lxhdi
-CLEAN = aptck.c
-
-include ../Makefile.inc
-
-aptck.c: aptck.in biosrw.s diskio.c disklbl.c
- ${AWK} -f ./setrev.awk $^ > aptck.c
-
-${PROG}: ${OBJS} ${LDADD}
- ${CC} ${LDFLAGS} -o $@ ${OBJS} ${LDADD} ${LIBS}
diff --git a/sys/arch/atari/stand/tostools/aptck/ahdilbl.h b/sys/arch/atari/stand/tostools/aptck/ahdilbl.h
deleted file mode 100644
index dc9c1345209..00000000000
--- a/sys/arch/atari/stand/tostools/aptck/ahdilbl.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* $NetBSD: ahdilbl.h,v 1.1 1996/01/16 15:15:06 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef AHDILABEL_H
-#define AHDILABEL_H
-
-/***** from src/sys/arch/atari/include/disklabel.h *************************/
-
-/*
- * On a volume, exclusively used by NetBSD, the boot block starts at
- * sector 0. To allow shared use of a volume between two or more OS's
- * the vendor specific AHDI format is supported. In this case the boot
- * block is located at the start of an AHDI partition. In any case the
- * size of the boot block must be at least 8KB.
- */
-#define BBMINSIZE 8192 /* minimum size of boot block */
-#define LABELSECTOR 0 /* `natural' start of boot block */
-#define LABELOFFSET 512 /* offset of disk label in bytes,
- relative to start of boot block */
-#define LABELMAXSIZE 1024 /* maximum size of disk label */
-
-#define MAXPARTITIONS 16 /* max. # of NetBSD partitions */
-#define RAW_PART 2 /* xx?c is raw partition */
-
-#define NO_BOOT_BLOCK ((u_int)-1)
-#define MAXAUXROOTS 29 /* max. # of auxilary root sectors */
-
-struct bootblock {
- u_int8_t bb_xxboot[LABELOFFSET]; /* first-stage boot loader */
- u_int8_t bb_dlabel[LABELMAXSIZE];/* disk pack label */
- u_int8_t bb_bootxx[BBMINSIZE - (LABELOFFSET + LABELMAXSIZE)];
- /* second-stage boot loader*/
-};
-
-#define BBGETLABEL(bb, dl) *(dl) = *((struct disklabel *)(bb)->bb_dlabel)
-#define BBSETLABEL(bb, dl) *((struct disklabel *)(bb)->bb_dlabel) = *(dl)
-
-/***** from src/sys/arch/atari/include/ahdilabel.h *************************/
-
-#define AHDI_BSIZE 512 /* AHDI blocksize */
-#define AHDI_BBLOCK 0 /* AHDI bootblock (root sector) */
-#define AHDI_MAXROOTS (MAXAUXROOTS) /* max. # of AHDI rootsectors */
-#define AHDI_MAXPARTS (AHDI_MAXROOTS+3) /* max. # of AHDI partitions */
-
-/*
- * Various `well known' AHDI partition identifiers.
- */
-#define AHDI_MKPID(x,y,z) ( ((u_int32_t)(x) << 16) \
- | ((u_int32_t)(y) << 8) \
- | ((u_int32_t)(z)) \
- )
-#define AHDI_PID_XGM AHDI_MKPID('X','G','M')
-#define AHDI_PID_GEM AHDI_MKPID('G','E','M')
-#define AHDI_PID_BGM AHDI_MKPID('B','G','M')
-#define AHDI_PID_RAW AHDI_MKPID('R','A','W')
-#define AHDI_PID_SWP AHDI_MKPID('S','W','P')
-#define AHDI_PID_NBD AHDI_MKPID('N','B','D')
-#define AHDI_PID_NBR AHDI_MKPID('N','B','R')
-#define AHDI_PID_NBS AHDI_MKPID('N','B','S')
-#define AHDI_PID_NBU AHDI_MKPID('N','B','U')
-
-/*
- * Format of AHDI boot block.
- */
-#define AHDI_MAXRPD 4 /* max. # of partition descriptors */
- /* in the AHDI bootblock (aka root)*/
-#define AHDI_MAXARPD 2 /* max. # of partition descriptors */
- /* in an AHDI auxilary root sector */
-
-struct ahdi_part {
- u_int8_t ap_flg; /* bit 0 is in-use flag */
- u_int8_t ap_id[3]; /* id: GEM, BGM, XGM, UNX, MIX */
- u_int32_t ap_offs; /* block where partition starts */
- u_int32_t ap_size; /* partition size in blocks */
-#define ap_end ap_size /* in the in-core copy, store end instead of size */
-};
-
-struct ahdi_root {
- u_int8_t ar_fill[0x1c2];/* filler, can be boot code */
- u_int32_t ar_hdsize; /* size of entire volume in blocks */
- struct ahdi_part ar_parts[AHDI_MAXRPD]; /* root partition table */
- u_int32_t ar_bslst; /* start of bad-sector list */
- u_int32_t ar_bslsize; /* # of blocks in bad-sector list */
- u_int16_t ar_cksum;
-};
-
-#endif /* AHDILABEL_H */
diff --git a/sys/arch/atari/stand/tostools/aptck/aptck.h b/sys/arch/atari/stand/tostools/aptck/aptck.h
deleted file mode 100644
index 64f37b49a05..00000000000
--- a/sys/arch/atari/stand/tostools/aptck/aptck.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* $NetBSD: aptck.h,v 1.1.1.1 1996/01/07 21:54:15 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Waldi Ravens.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Waldi Ravens.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef APTCK_H
-#define APTCK_H
-
-#define MINOR(bus, target, lun) (lun)
-#define MAJOR(bus, target, lun) (((bus) << 3) + (target))
-
-#define LUN(major, minor) (minor)
-#define TARGET(major, minor) ((major) & 0x0007)
-#define BUS(major, minor) (((major) >> 3) & 0x1FFF)
-#define BIOSDEV(major, minor) (((minor) == 0) ? ((major) + 2) : 0)
-
-typedef signed char int8_t;
-typedef unsigned char u_int8_t;
-typedef signed short int16_t;
-typedef unsigned short u_int16_t;
-typedef signed long int32_t;
-typedef unsigned long u_int32_t;
-
-typedef enum {
- ACSI = 0,
- SCSI = 1,
- IDE = 2
-} bus_t;
-
-typedef struct {
- char id[4];
- u_int start;
- u_int end;
- u_int rsec;
- u_int rent;
-} part_t;
-
-typedef struct {
- u_int major; /* XHDI major number */
- u_int minor; /* XHDI minor number */
- char * sname; /* short name (s00) */
- char * fname; /* full name (scsi target 0 lun 0)*/
- char * product; /* product name */
- u_long bsize; /* block size in bytes */
- u_long msize; /* medium size in blocks */
- u_int bblock; /* NetBSD boot block */
- u_int lblofs; /* label offset in boot block */
- u_int hdsize; /* medium size from root sector */
- u_int bslst; /* start of bad sector list */
- u_int bslend; /* end of bad sector list */
- u_int nroots; /* # of auxilary root sectors */
- u_int *roots; /* list of auxilary roots */
- u_int nparts; /* number of regular partitions */
- part_t *parts; /* list of partition descriptors */
-} disk_t;
-
-
-/*
- * biosrw.s
- */
-EXTERN int bios_read PROTO((void *, u_int, u_int, u_int));
-EXTERN int bios_write PROTO((void *, u_int, u_int, u_int));
-EXTERN void bios_critic PROTO((void));
-
-/*
- * diskio.c
- */
-EXTERN disk_t * disk_open PROTO((char *));
-EXTERN void disk_close PROTO((disk_t *));
-EXTERN void * disk_read PROTO((disk_t *, u_int, u_int));
-EXTERN int disk_write PROTO((disk_t *, u_int, u_int, void *));
-
-/*
- * disklabel.c
- */
-EXTERN int readdisklabel PROTO((disk_t *));
-
-#endif /* APTCK_H */
diff --git a/sys/arch/atari/stand/tostools/aptck/aptck.in b/sys/arch/atari/stand/tostools/aptck/aptck.in
deleted file mode 100644
index 7026db9dd13..00000000000
--- a/sys/arch/atari/stand/tostools/aptck/aptck.in
+++ /dev/null
@@ -1,124 +0,0 @@
-/* $OpenBSD: aptck.in,v 1.2 2000/03/03 00:54:48 todd Exp $ */
-/* $NetBSD: aptck.in,v 1.1.1.1 1996/01/07 21:54:17 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Waldi Ravens.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Waldi Ravens.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/types.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include "libtos.h"
-#include "aptck.h"
-
-int main PROTO((int, char **));
-
-static void version PROTO((void)) NORETURN;
-static void usage PROTO((void)) NORETURN;
-
-static void
-version()
-{
- eprintf("%s\n", "$Revision: 1.2 $");
- xexit(EXIT_SUCCESS);
-}
-
-static void
-usage()
-{
- eprintf("Usage: aptck [OPTIONS] DISK..\n"
- "where OPTIONS are:\n"
- "\t-V display version information and exit\n"
- "\t-h display this help and exit\n"
- "\t-o FILE send output to FILE instead of stdout\n"
- "\t-w wait for key press before exiting\n\n"
- "DISK is the concatenation of BUS, TARGET and LUN.\n"
- "BUS is one of `i' (IDE), `a' (ACSI) or `s' (SCSI).\n"
- "TARGET and LUN are one decimal digit each. LUN must\n"
- "not be specified for IDE devices and is optional for\n"
- "ACSI/SCSI devices (if omitted, LUN defaults to 0).\n\n"
- "Examples: a0 refers to ACSI target 0 lun 0\n"
- " s21 refers to SCSI target 2 lun 1\n"
- );
- xexit(EXIT_SUCCESS);
-}
-
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- extern int optind;
- extern char *optarg;
-
- disk_t *dd;
- int rv, c;
-
- init_toslib(*argv);
-
- while ((c = getopt(argc, argv, "Vho:w")) != -1) {
- switch (c) {
- case 'o':
- redirect_output(optarg);
- break;
- case 'w':
- set_wait_for_key();
- break;
- case 'V':
- version();
- /* NOT REACHED */
- case 'h':
- default:
- usage();
- /* NOT REACHED */
- }
- }
- argv += optind;
-
- if (!*argv) {
- error(-1, "missing DISK argument");
- usage();
- /* NOT REACHED */
- }
-
- c = isatty(STDOUT_FILENO);
- rv = EXIT_SUCCESS;
- while (*argv) {
- dd = disk_open(*argv++);
- if (dd) {
- if (readdisklabel(dd))
- rv = EXIT_FAILURE;
- disk_close(dd);
- if (c)
- press_any_key();
- }
- else rv = EXIT_FAILURE;
- }
- return(rv);
-}
diff --git a/sys/arch/atari/stand/tostools/aptck/biosrw.s b/sys/arch/atari/stand/tostools/aptck/biosrw.s
deleted file mode 100644
index 288fe835717..00000000000
--- a/sys/arch/atari/stand/tostools/aptck/biosrw.s
+++ /dev/null
@@ -1,82 +0,0 @@
-/* $NetBSD: biosrw.s,v 1.1.1.1 1996/01/07 21:54:15 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Waldi Ravens.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Waldi Ravens.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* int bios_read(buffer, offset, count, dev) */
-
- .globl _bios_read
- .text
- .even
-
-_bios_read:
- movml d1-d2/a1-a2,sp@-
- movl sp@(24),sp@- | offset
- movw sp@(38),sp@- | device
- movw #-1,sp@-
- movw sp@(38),sp@- | count
- movl sp@(30),sp@- | buffer
- movw #8,sp@- | read, physical mode
- movw #4,sp@-
- trap #13 | Rwabs()
- lea sp@(18),sp
- movml sp@+,d1-d2/a1-a2
- rts
-
-/* int bios_write(buffer, offset, count, dev) */
-
- .globl _bios_write
- .text
- .even
-
-_bios_write:
- movml d1-d2/a1-a2,sp@-
- movl sp@(20),sp@- | offset
- movw sp@(34),sp@- | device
- movw #-1,sp@-
- movw sp@(34),sp@- | count
- movl sp@(26),sp@- | buffer
- movw #9,sp@- | write, physical mode
- movw #4,sp@-
- trap #13 | Rwabs()
- lea sp@(18),sp
- movml sp@+,d1-d2/a1-a2
- rts
-
-/* int bios_critic(error) */
-
- .globl _bios_critic
- .text
- .even
-
-_bios_critic:
- movw sp@(4),d0
- extl d0
- rts
diff --git a/sys/arch/atari/stand/tostools/aptck/diskio.c b/sys/arch/atari/stand/tostools/aptck/diskio.c
deleted file mode 100644
index 17038b2b870..00000000000
--- a/sys/arch/atari/stand/tostools/aptck/diskio.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/* $NetBSD: diskio.c,v 1.2 1996/01/16 15:15:16 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Waldi Ravens.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Waldi Ravens.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/types.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <xhdi.h>
-#include "libtos.h"
-#include "aptck.h"
-#include "ahdilbl.h"
-#include <osbind.h>
-
-struct pun_info {
- u_int16_t puns;
- u_int8_t pun[16];
- u_int32_t part_start[16];
- u_int32_t P_cookie;
- u_int32_t *P_cookptr;
- u_int16_t P_version;
- u_int16_t P_max_sector;
- u_int32_t reserved[16];
-};
-
-static char * strbd PROTO((char *, ...));
-static int setmami PROTO((disk_t *, char *));
-static int setnames PROTO((disk_t *));
-static int setsizes PROTO((disk_t *));
-static int ahdi_compatible PROTO((void));
-
-disk_t *
-disk_open(name)
- char *name;
-{
- disk_t *dd;
-
- dd = xmalloc(sizeof *dd);
- memset(dd, 0, sizeof *dd);
-
- if (setmami(dd, name) || setnames(dd) || setsizes(dd)) {
- disk_close(dd);
- return(NULL);
- }
- return(dd);
-}
-
-void
-disk_close(dd)
- disk_t *dd;
-{
- if (dd) {
- free(dd->product);
- free(dd->sname);
- free(dd->fname);
- free(dd->roots);
- free(dd->parts);
- free(dd);
- }
-}
-
-void *
-disk_read(dd, start, count)
- disk_t *dd;
- u_int start,
- count;
-{
- char *buffer;
- int bdev;
- long e;
-
- buffer = xmalloc(count * dd->bsize);
-
- e = XHReadWrite(dd->major, dd->minor, 0, start, count, buffer);
- if (!e)
- return(buffer);
- if (e == -32 || (e == -1 && XHGetVersion() == -1)) {
- if (!ahdi_compatible())
- fatal(-1, "AHDI 3.0 compatible harddisk driver required");
- bdev = BIOSDEV(dd->major, dd->minor);
- if (bdev && !bios_read(buffer, start, count, bdev))
- return(buffer);
- }
-
- free(buffer);
- return(NULL);
-}
-
-int
-disk_write(dd, start, count, buffer)
- disk_t *dd;
- u_int start,
- count;
- void *buffer;
-{
- int bdev;
- long e;
-
- e = XHReadWrite(dd->major, dd->minor, 1, start, count, buffer);
- if (e == -32 || (e == -1 && XHGetVersion() == -1)) {
- if (!ahdi_compatible())
- fatal(-1, "AHDI 3.0 compatible harddisk driver required");
- bdev = BIOSDEV(dd->major, dd->minor);
- if (bdev)
- e = bios_write(buffer, start, count, bdev);
- }
-
- return((int)e);
-}
-
-static int
-ahdi_compatible()
-{
- static int ahdi_compat;
-
- if (!ahdi_compat) {
- long oldsp = Super(0L);
- struct pun_info *punp = *((struct pun_info **)0x0516);
- Super(oldsp);
- if (punp && punp->P_cookie == 0x41484449
- && punp->P_cookptr == &punp->P_cookie
- && punp->P_version >= 0x0300)
- ahdi_compat = 1;
- }
- return(ahdi_compat);
-}
-
-static int
-setmami(dd, name)
- disk_t *dd;
- char *name;
-{
- char *p = name;
- u_int target, lun;
- bus_t bus;
-
- if (*p == 'i') {
- bus = IDE;
- if (*++p < '0' || *p > '1') {
- if (*p)
- error(-1, "%s: invalid IDE target `%c'", name, *p);
- else
- error(-1, "%s: missing IDE target", name);
- return(-1);
- }
- target = *p++ - '0';
- lun = 0;
- } else {
- char *b;
-
- if (*p == 'a') {
- bus = ACSI;
- b = "ACSI";
- } else if (*p == 's') {
- bus = SCSI;
- b = "SCSI";
- } else {
- error(-1, "%s: invalid DISK argument", name);
- return(-1);
- }
- if (*++p < '0' || *p > '7') {
- if (*p)
- error(-1, "%s: invalid %s target `%c'", name, b, *p);
- else
- error(-1, "%s: missing %s target", name, b);
- return(-1);
- }
- target = *p++ - '0';
-
- if (*p < '0' || *p > '7') {
- if (*p) {
- error(-1, "%s: invalid %s lun `%c'", name, b, *p);
- return(-1);
- }
- lun = 0;
- } else
- lun = *p++ - '0';
- }
- if (*p) {
- error(-1, "%s: invalid DISK argument", name);
- return(-1);
- }
- dd->major = MAJOR(bus, target, lun);
- dd->minor = MINOR(bus, target, lun);
- return(0);
-}
-
-static int
-setnames(dd)
- disk_t *dd;
-{
- char sn[16], us[16], ls[16], *bs;
- int b, u, l;
-
- b = BUS(dd->major, dd->minor);
- u = TARGET(dd->major, dd->minor);
- l = LUN(dd->major, dd->minor);
-
- switch (b) {
- case IDE: bs = "IDE";
- break;
- case ACSI: bs = "ACSI";
- break;
- case SCSI: bs = "SCSI";
- break;
- default: error(-1, "invalid bus no. %d", b);
- return(-1);
- }
-
- if (u < 0 || u > 7 || (b == IDE && u > 1)) {
- error(-1, "invalid %s target `%d'", bs, u);
- return(-1);
- }
- sprintf(us, " target %d", u);
-
- if (l < 0 || l > 7 || (b == IDE && l > 0)) {
- error(-1, "invalid %s lun `%d'", bs, l);
- return(-1);
- }
- if (b == IDE) {
- sprintf(sn, "i%d", u);
- ls[0] = '\0';
- } else {
- sprintf(sn, "%c%d%d", tolower(*bs), u, l);
- sprintf(ls, " lun %d", l);
- }
-
- dd->fname = strbd(bs, us, ls, NULL);
- dd->sname = strbd(sn, NULL);
- return(0);
-}
-
-static int
-setsizes(dd)
- disk_t *dd;
-{
- if (XHGetVersion() != -1) {
- char *p, prod[1024];
-
- if (XHInqTarget2(dd->major, dd->minor, &dd->bsize, NULL, prod, sizeof(prod))) {
- if (XHInqTarget(dd->major, dd->minor, &dd->bsize, NULL, prod)) {
- error(-1, "%s: device not configured", dd->sname);
- return(-1);
- }
- }
- p = strrchr(prod, '\0');
- while (isspace(*--p))
- *p = '\0';
- dd->product = strbd(prod, NULL);
- if (!XHGetCapacity(dd->major, dd->minor, &dd->msize, &dd->bsize))
- return(0);
- } else {
- dd->product = strbd("unknown", NULL);
- dd->bsize = AHDI_BSIZE; /* XXX */
- }
-
- /* Trial&error search for last sector on medium */
- {
- u_int u, l, m;
- void *p, (*oldvec)();
-
- /* turn off etv_critic handler */
- oldvec = Setexc(257, bios_critic);
-
- u = (u_int)-2; l = 0;
- while (u != l) {
- m = l + ((u - l + 1) / 2);
- p = disk_read(dd, m, 1);
- free(p);
- if (p == NULL)
- u = m - 1;
- else
- l = m;
- }
-
- /* turn on etv_critic handler */
- (void)Setexc(257, oldvec);
-
- if (l) {
- dd->msize = l + 1;
- return(0);
- }
- error(-1, "%s: device not configured", dd->sname);
- return(-1);
- }
-}
-
-char *
-strbd(string1)
- char *string1;
-{
- char *p, *result;
- size_t length = 1;
- va_list ap;
-
- va_start(ap, string1);
- for (p = string1; p; p = va_arg(ap, char *))
- length += strlen(p);
- va_end(ap);
-
- *(result = xmalloc(length)) = '\0';
-
- va_start(ap, string1);
- for (p = string1; p; p = va_arg(ap, char *))
- strcat(result, p);
- va_end(ap);
-
- return(result);
-}
diff --git a/sys/arch/atari/stand/tostools/aptck/disklbl.c b/sys/arch/atari/stand/tostools/aptck/disklbl.c
deleted file mode 100644
index 869edb52513..00000000000
--- a/sys/arch/atari/stand/tostools/aptck/disklbl.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/* $NetBSD: disklbl.c,v 1.2 1996/01/20 13:54:46 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Waldi Ravens.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Waldi Ravens.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/types.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include "libtos.h"
-#include "aptck.h"
-#include "ahdilbl.h"
-#include "disklbl.h"
-
-static int dkcksum PROTO((struct disklabel *));
-static int bsd_label PROTO((disk_t *, u_int));
-static int ahdi_label PROTO((disk_t *));
-static int ahdi_display PROTO((disk_t *));
-static u_int ahdi_getparts PROTO((disk_t *, u_int, u_int));
-
-int
-readdisklabel(dd)
- disk_t *dd;
-{
- int e;
-
- printf("Device : %s (%s) [%s]\n", dd->sname, dd->fname, dd->product);
- printf("Medium size: %lu sectors\n", (u_long)dd->msize);
- printf("Sector size: %lu bytes\n\n", (u_long)dd->bsize);
-
- e = bsd_label(dd, LABELSECTOR);
- if (e < 0) {
- printf("Device I/O error (hardware problem?)\n\n");
- return(-1);
- }
- if (!e) {
- printf("NetBSD/Atari format, boot block: "
- "sector %u labeloffset %u\n\n",
- dd->bblock, dd->lblofs);
- return(0);
- }
-
- e = ahdi_label(dd);
- if (e < 0) {
- printf("Device I/O error (hardware problem?)\n\n");
- return(-1);
- }
- if (!e) {
- printf("AHDI format, NetBSD boot block: ");
- if (dd->bblock != NO_BOOT_BLOCK)
- printf("sector %u labeloffset %u\n\n",
- dd->bblock, dd->lblofs);
- else printf("none\n\n");
- return(0);
- }
-
- printf("Unknown label format.\n\n");
- return(-1);
-}
-
-static int
-bsd_label(dd, offset)
- disk_t *dd;
- u_int offset;
-{
- u_char *bblk;
- u_int nsec;
- int rv;
-
- nsec = (BBMINSIZE + (dd->bsize - 1)) / dd->bsize;
- bblk = disk_read(dd, offset, nsec);
- if (bblk) {
- u_short *end, *p;
-
- end = (u_short *)&bblk[BBMINSIZE - sizeof(struct disklabel)];
- rv = 1;
- for (p = (u_short *)bblk; p < end; ++p) {
- struct disklabel *dl = (struct disklabel *)p;
- if (dl->d_magic == DISKMAGIC && dl->d_magic2 == DISKMAGIC
- && dl->d_npartitions <= MAXPARTITIONS && !dkcksum(dl)) {
- dd->lblofs = (u_char *)p - bblk;
- dd->bblock = offset;
- rv = 0;
- break;
- }
- }
- free(bblk);
- }
- else rv = -1;
-
- return(rv);
-}
-
-static int
-dkcksum(dl)
- struct disklabel *dl;
-{
- u_short *start, *end, sum = 0;
-
- start = (u_short *)dl;
- end = (u_short *)&dl->d_partitions[dl->d_npartitions];
- while (start < end)
- sum ^= *start++;
- return(sum);
-}
-
-int
-ahdi_label(dd)
- disk_t *dd;
-{
- u_int i;
- int e;
-
- /*
- * The AHDI format requires a specific block size.
- */
- if (dd->bsize != AHDI_BSIZE)
- return(1);
-
- /*
- * Fetch the AHDI partition descriptors.
- */
- i = ahdi_getparts(dd, AHDI_BBLOCK, AHDI_BBLOCK);
- if (i) {
- if (i < dd->msize)
- return(-1); /* disk read error */
- else return(1); /* reading past end of medium */
- }
-
- /*
- * Display and perform sanity checks.
- */
- i = ahdi_display(dd);
- if (i)
- return(i);
-
- /*
- * Search for a NetBSD disk label
- */
- dd->bblock = NO_BOOT_BLOCK;
- for (i = 0; i < dd->nparts; ++i) {
- part_t *pd = &dd->parts[i];
- u_int id = *((u_int32_t *)&pd->id) >> 8;
- if (id == AHDI_PID_NBD || id == AHDI_PID_RAW) {
- u_int offs = pd->start;
- if ((e = bsd_label(dd, offs)) < 0) {
- return(e); /* I/O error */
- }
- if (!e) {
- dd->bblock = offs; /* got it */
- return(0);
- }
- if (id == AHDI_PID_NBD && dd->bblock == NO_BOOT_BLOCK)
- dd->bblock = offs;
- }
- }
- return(0);
-}
-
-static int
-root_cmp(x1, x2)
- const void *x1, *x2;
-{
- const u_int *r1 = x1,
- *r2 = x2;
-
- if (*r1 < *r2)
- return(-1);
- if (*r1 > *r2)
- return(1);
- return(0);
-}
-
-static int
-part_cmp(x1, x2)
- const void *x1, *x2;
-{
- const part_t *p1 = x1,
- *p2 = x2;
-
- if (p1->start < p2->start)
- return(-1);
- if (p1->start > p2->start)
- return(1);
- if (p1->end < p2->end)
- return(-1);
- if (p1->end > p2->end)
- return(1);
- if (p1->rsec < p2->rsec)
- return(-1);
- if (p1->rsec > p2->rsec)
- return(1);
- if (p1->rent < p2->rent)
- return(-1);
- if (p1->rent > p2->rent)
- return(1);
- return(0);
-}
-
-static int
-ahdi_display(dd)
- disk_t *dd;
-{
- int i, j, rv = 0;
-
- printf("Start of bad sector list : %u\n", dd->bslst);
- if (dd->bslst == 0) {
- printf("* Illegal value (zero) *\n"); rv = 1;
- }
- printf("End of bad sector list : %u\n", dd->bslend);
- if (dd->bslend == 0) {
- printf("* Illegal value (zero) *\n"); rv = 1;
- }
- printf("Medium size (in root sec): %u\n", dd->hdsize);
- if (dd->hdsize == 0) {
- printf("* Illegal value (zero) *\n"); rv = 1;
- }
-
- qsort(dd->roots, dd->nroots, sizeof *dd->roots, root_cmp);
- qsort(dd->parts, dd->nparts, sizeof *dd->parts, part_cmp);
- printf("\n root desc id start end MBs\n");
-
- for (i = 0; i < dd->nparts; ++i) {
- part_t *p1 = &dd->parts[i];
- u_int megs = p1->end - p1->start + 1,
- blpm = (1024 * 1024) / dd->bsize;
- megs = (megs + (blpm >> 1)) / blpm;
- printf("%8u %4u %s %8u %8u (%3u)\n",
- p1->rsec, p1->rent, p1->id,
- p1->start, p1->end, megs);
- for (j = 0; j < dd->nroots; ++j) {
- u_int aux = dd->roots[j];
- if (aux >= p1->start && aux <= p1->end) {
- printf("FATAL: auxilary root at %u\n", aux); rv = 1;
- }
- }
- for (j = i; j--;) {
- part_t *p2 = &dd->parts[j];
- if (p1->start >= p2->start && p1->start <= p2->end) {
- printf("FATAL: clash with %u/%u\n", p2->rsec, p2->rent); rv = 1;
- }
- if (p2->start >= p1->start && p2->start <= p1->end) {
- printf("FATAL: clash with %u/%u\n", p2->rsec, p2->rent); rv = 1;
- }
- }
- if (p1->start >= dd->bslst && p1->start <= dd->bslend) {
- printf("FATAL: partition overlaps with bad sector list\n"); rv = 1;
- }
- if (dd->bslst >= p1->start && dd->bslst <= p1->end) {
- printf("FATAL: partition overlaps with bad sector list\n"); rv = 1;
- }
- }
-
- printf("\nTotal number of auxilary roots: %u\n", dd->nroots);
- printf("Total number of partitions : %u\n", dd->nparts);
- if (dd->nparts == 0) {
- printf("* Weird # of partitions (zero) *\n"); rv = 1;
- }
- if (dd->nparts > AHDI_MAXPARTS) {
- printf("* Too many AHDI partitions for the default NetBSD "
- "kernel *\n Increase MAXAUXROOTS in src/sys/arch/"
- "atari/include/disklabel.h\n to at least %u, and "
- "recompile the NetBSD kernel.\n", dd->nroots);
- rv = -1;
- }
- return(rv);
-}
-
-static u_int
-ahdi_getparts(dd, rsec, esec)
- disk_t *dd;
- u_int rsec,
- esec;
-{
- struct ahdi_part *part, *end;
- struct ahdi_root *root;
- u_int rv;
-
- root = disk_read(dd, rsec, 1);
- if (!root) {
- rv = rsec + (rsec == 0);
- goto done;
- }
-
- if (rsec == AHDI_BBLOCK)
- end = &root->ar_parts[AHDI_MAXRPD];
- else end = &root->ar_parts[AHDI_MAXARPD];
- for (part = root->ar_parts; part < end; ++part) {
- u_int id = *((u_int32_t *)&part->ap_flg);
- if (!(id & 0x01000000))
- continue;
- if ((id &= 0x00ffffff) == AHDI_PID_XGM) {
- u_int offs = part->ap_offs + esec;
- u_int i = ++dd->nroots;
- dd->roots = xrealloc(dd->roots, i * sizeof *dd->roots);
- dd->roots[--i] = offs;
- rv = ahdi_getparts(dd, offs, esec == AHDI_BBLOCK ? offs : esec);
- if (rv)
- goto done;
- } else {
- part_t *p;
- u_int i = ++dd->nparts;
- dd->parts = xrealloc(dd->parts, i * sizeof *dd->parts);
- p = &dd->parts[--i];
- *((u_int32_t *)&p->id) = id << 8;
- p->start = part->ap_offs + rsec;
- p->end = p->start + part->ap_size - 1;
- p->rsec = rsec;
- p->rent = part - root->ar_parts;
- }
- }
- dd->hdsize = root->ar_hdsize;
- dd->bslst = root->ar_bslst;
- dd->bslend = root->ar_bslst + root->ar_bslsize - 1;
- rv = 0;
-done:
- free(root);
- return(rv);
-}
diff --git a/sys/arch/atari/stand/tostools/aptck/disklbl.h b/sys/arch/atari/stand/tostools/aptck/disklbl.h
deleted file mode 100644
index cfb5c90855b..00000000000
--- a/sys/arch/atari/stand/tostools/aptck/disklbl.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/* $NetBSD: disklbl.h,v 1.1 1996/01/16 15:15:52 leo Exp $ */
-
-/*
- * Copyright (c) 1987, 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)disklabel.h 8.2 (Berkeley) 7/10/94
- */
-
-#ifndef DISKLABEL_H
-#define DISKLABEL_H
-
-#define DISKMAGIC ((u_int32_t)0x82564557) /* The disk magic number */
-
-struct disklabel {
- u_int32_t d_magic; /* the magic number */
- u_int16_t d_type; /* drive type */
- u_int16_t d_subtype; /* controller/d_type specific */
- char d_typename[16]; /* type name, e.g. "eagle" */
-
- /*
- * d_packname contains the pack identifier and is returned when
- * the disklabel is read off the disk or in-core copy.
- * d_boot0 and d_boot1 are the (optional) names of the
- * primary (block 0) and secondary (block 1-15) bootstraps
- * as found in /usr/mdec. These are returned when using
- * getdiskbyname(3) to retrieve the values from /etc/disktab.
- */
- union {
- char un_d_packname[16]; /* pack identifier */
- struct {
- char *un_d_boot0; /* primary bootstrap name */
- char *un_d_boot1; /* secondary bootstrap name */
- } un_b;
- } d_un;
-#define d_packname d_un.un_d_packname
-#define d_boot0 d_un.un_b.un_d_boot0
-#define d_boot1 d_un.un_b.un_d_boot1
-
- /* disk geometry: */
- u_int32_t d_secsize; /* # of bytes per sector */
- u_int32_t d_nsectors; /* # of data sectors per track */
- u_int32_t d_ntracks; /* # of tracks per cylinder */
- u_int32_t d_ncylinders; /* # of data cylinders per unit */
- u_int32_t d_secpercyl; /* # of data sectors per cylinder */
- u_int32_t d_secperunit; /* # of data sectors per unit */
-
- /*
- * Spares (bad sector replacements) below are not counted in
- * d_nsectors or d_secpercyl. Spare sectors are assumed to
- * be physical sectors which occupy space at the end of each
- * track and/or cylinder.
- */
- u_int16_t d_sparespertrack; /* # of spare sectors per track */
- u_int16_t d_sparespercyl; /* # of spare sectors per cylinder */
- /*
- * Alternate cylinders include maintenance, replacement, configuration
- * description areas, etc.
- */
- u_int32_t d_acylinders; /* # of alt. cylinders per unit */
-
- /* hardware characteristics: */
- /*
- * d_interleave, d_trackskew and d_cylskew describe perturbations
- * in the media format used to compensate for a slow controller.
- * Interleave is physical sector interleave, set up by the
- * formatter or controller when formatting. When interleaving is
- * in use, logically adjacent sectors are not physically
- * contiguous, but instead are separated by some number of
- * sectors. It is specified as the ratio of physical sectors
- * traversed per logical sector. Thus an interleave of 1:1
- * implies contiguous layout, while 2:1 implies that logical
- * sector 0 is separated by one sector from logical sector 1.
- * d_trackskew is the offset of sector 0 on track N relative to
- * sector 0 on track N-1 on the same cylinder. Finally, d_cylskew
- * is the offset of sector 0 on cylinder N relative to sector 0
- * on cylinder N-1.
- */
- u_int16_t d_rpm; /* rotational speed */
- u_int16_t d_interleave; /* hardware sector interleave */
- u_int16_t d_trackskew; /* sector 0 skew, per track */
- u_int16_t d_cylskew; /* sector 0 skew, per cylinder */
- u_int32_t d_headswitch; /* head switch time, usec */
- u_int32_t d_trkseek; /* track-to-track seek, usec */
- u_int32_t d_flags; /* generic flags */
-#define NDDATA 5
- u_int32_t d_drivedata[NDDATA]; /* drive-type specific information */
-#define NSPARE 5
- u_int32_t d_spare[NSPARE]; /* reserved for future use */
- u_int32_t d_magic2; /* the magic number (again) */
- u_int16_t d_checksum; /* xor of data incl. partitions */
-
- /* filesystem and partition information: */
- u_int16_t d_npartitions; /* number of partitions in following */
- u_int32_t d_bbsize; /* size of boot area at sn0, bytes */
- u_int32_t d_sbsize; /* max size of fs superblock, bytes */
- struct partition { /* the partition table */
- u_int32_t p_size; /* number of sectors in partition */
- u_int32_t p_offset; /* starting sector */
- u_int32_t p_fsize; /* filesystem basic fragment size */
- u_int8_t p_fstype; /* filesystem type, see below */
- u_int8_t p_frag; /* filesystem fragments per block */
- union {
- u_int16_t cpg; /* UFS: FS cylinders per group */
- u_int16_t sgs; /* LFS: FS segment shift */
- } __partition_u1;
-#define p_cpg __partition_u1.cpg
-#define p_sgs __partition_u1.sgs
- } d_partitions[MAXPARTITIONS]; /* actually may be more */
-};
-
-#endif /* DISKLABEL_H */
diff --git a/sys/arch/atari/stand/tostools/aptck/setrev.awk b/sys/arch/atari/stand/tostools/aptck/setrev.awk
deleted file mode 100644
index 0e545c24df0..00000000000
--- a/sys/arch/atari/stand/tostools/aptck/setrev.awk
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/awk -f
-#
-# $NetBSD: setrev.awk,v 1.1 1996/01/16 15:15:55 leo Exp $
-#
-function revcmp(r1, r2, n1, n2, a1, a2, n, i) {
- n1 = split(r1, a1, "\.")
- n2 = split(r2, a2, "\.")
- n = (n1 < n2) ? n1 : n2
-
- for (i = 1; i <= n; ++i) {
- if (a1[i] != a2[i])
- return(a1[i] - a2[i])
- }
- if (n1 != n2)
- return(n1 - n2)
- return(0)
-}
-
-BEGIN {
- destfile = ARGV[1]
- rev = "0.0"
-}
-
-{
- if (revcmp($4, rev) > 0)
- rev = $4
- next file
-}
-
-END {
- while ((e = getline <destfile) > 0) {
- if (/"\$Revision.*\$"/)
- sub("\\\$Revision.*\\\$", "Revision " rev)
- print
- }
- if (e)
- exit(1)
- exit(0)
-}
diff --git a/sys/arch/atari/stand/tostools/chg_pid/Makefile b/sys/arch/atari/stand/tostools/chg_pid/Makefile
deleted file mode 100644
index 54dec324b7a..00000000000
--- a/sys/arch/atari/stand/tostools/chg_pid/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# $NetBSD: Makefile,v 1.1 1996/01/07 22:06:01 leo Exp $
-
-PROG = chg_pid.ttp
-
-OBJS = chg_pid.o
-HEADERS =
-
-include ../Makefile.inc
-
-${PROG}: ${OBJS} ${LDADD}
- ${CC} ${LDFLAGS} -o $@ ${OBJS} ${LDADD} ${LIBS}
diff --git a/sys/arch/atari/stand/tostools/chg_pid/chg_pid.c b/sys/arch/atari/stand/tostools/chg_pid/chg_pid.c
deleted file mode 100644
index c9ee76c6207..00000000000
--- a/sys/arch/atari/stand/tostools/chg_pid/chg_pid.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/* $OpenBSD: chg_pid.c,v 1.4 2000/03/03 00:54:48 todd Exp $ */
-/* $NetBSD: chg_pid.c,v 1.3 1996/01/09 09:55:06 leo Exp $ */
-
-/*
- * Copyright (c) 1995 L. Weppelman
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- *
- * This program changes the partition id field (p_id) in the GEM
- * partition info. NetBSD uses these id-fields to determine the kind
- * of partition. Sensible id's to set are:
- * NBU : NetBSD User partition
- * NBR : NetBSD Root partition
- * NBS : NetBSD Swap partition
- * NBD : General NetBSD partition
- * RAW : Partition hidden for GEMDOS
- *
- * When NetBSD auto boots, the first 'NBR' partition found when scanning the
- * SCSI-disks becomes the active root partition. The same goes for 'NBS'.
- * Drives are scanned in 'SCSI-id' order.
- */
-#include <sys/types.h>
-#include <osbind.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdio.h>
-#include "libtos.h"
-
-#ifndef Dmawrite
-#define Dmawrite DMAwrite
-#endif
-#ifndef Dmaread
-#define Dmaread DMAread
-#endif
-
-/*
- * Format of GEM root sector
- */
-typedef struct gem_part {
- u_char p_flg; /* bit 0 is in-use flag */
- char p_id[3]; /* id: GEM, BGM, XGM, UNX, MIX */
- u_long p_st; /* block where partition starts */
- u_long p_size; /* partition size */
-} GEM_PART;
-
-/*
- * Defines for p_flg
- */
-#define P_VALID 0x01 /* info is valid */
-#define P_ACTIVE 0x80 /* partition is active */
-
-#define NGEM_PARTS 4 /* Max. partition infos in root sector */
-
-typedef struct gem_root {
- u_char fill[0x1c2]; /* Filler, can be boot code */
- u_long hd_siz; /* size of entire volume */
- GEM_PART parts[NGEM_PARTS]; /* see above */
- u_long bsl_st; /* start of bad-sector list */
- u_long bsl_cnt; /* nr. blocks in bad-sector list*/
- u_short csum; /* checksum correction */
-} GEM_ROOT;
-
-void help PROTO((void));
-void usage PROTO((void));
-int chg_tosparts PROTO((int, int, char *));
-void change_it PROTO((int, GEM_PART *, char *));
-int read_block PROTO((void *, int, int));
-int write_block PROTO((void *, int, int));
-void set_csum PROTO((char *));
-
-const char version[] = "$Revision: 1.4 $";
-
-char *Progname = NULL; /* What are we called */
-int t_flag = 0; /* Test -- don't actually do it */
-int v_flag = 0; /* show version */
-int h_flag = 0; /* show help */
-
-int
-main(argc, argv)
-int argc;
-char *argv[];
-{
- /*
- * Option parsing
- */
- extern int optind;
- extern char *optarg;
-
- int driveno = 0;
- int partno = 0;
- char *newname = NULL;
- int c;
-
- init_toslib(argv[0]);
- Progname = argv[0];
-
- while ((c = getopt(argc, argv, "htVwo:")) != -1) {
- switch (c) {
- case 'h':
- h_flag = 1;
- break;
- case 'o':
- redirect_output(optarg);
- break;
- case 't':
- t_flag = 1;
- break;
- case 'V':
- v_flag = 1;
- break;
- case 'w':
- set_wait_for_key();
- break;
- default:
- usage();
- }
- }
- argc -= optind;
- argv += optind;
-
- if (h_flag)
- help();
-
- if (v_flag) {
- eprintf("%s\r\n", version);
- if (argc != 3)
- xexit(0);
- }
-
- if (argc != 3)
- usage();
-
- eprintf("Note: >>> Both drive and partition numbers start "
- "at 0! <<<\r\n");
-
- driveno = atoi(argv[0]);
- partno = atoi(argv[1]);
- newname = argv[2];
- eprintf("About to change id of partition %d on drive %d to %s\r\n",
- partno, driveno, newname);
-
- if (!t_flag)
- c = key_wait("Are you sure (y/n)? ");
- else c = 'y';
- switch(c) {
- case 'y':
- case 'Y':
- if(chg_tosparts(partno, driveno, newname)) {
- if (!t_flag)
- eprintf("Done\r\n");
- else eprintf("Not Done\r\n");
- xexit(0);
- }
- else eprintf("Partition number not found\r\n");
- break;
- default :
- eprintf("Aborted\r\n");
- xexit(1);
- break;
- }
- xexit(0);
-}
-
-int chg_tosparts(chg_part, drive, newname)
-int chg_part, drive;
-char *newname;
-{
- GEM_ROOT *g_root;
- GEM_PART g_local[NGEM_PARTS];
- char buf[512];
- int pno = 0;
- int i;
-
- /*
- * Read root sector
- */
- if (read_block(buf, 0, drive) == 0)
- fatal(-1, "Cannot read block 0\r\n");
-
- /*
- * Make local copy of partition info, we may need to re-use
- * the buffer in case of 'XGM' partitions.
- */
- g_root = (GEM_ROOT*)buf;
- bcopy(g_root->parts, g_local, NGEM_PARTS*sizeof(GEM_PART));
-
- for (i = 0; i < NGEM_PARTS; i++) {
- if (!(g_local[i].p_flg & 1))
- continue;
- if (!strncmp(g_local[i].p_id, "XGM", 3)) {
- int j;
- daddr_t new_root = g_local[i].p_st;
-
- /*
- * Loop through extended partition list
- */
- for(;;) {
- if (read_block(buf, new_root, drive) == 0)
- fatal(-1, "Cannot read block %d\r\n", new_root);
- for (j = 0; j < NGEM_PARTS; j++) {
- if (!(g_root->parts[j].p_flg & 1))
- continue;
- if (!strncmp(g_root->parts[j].p_id, "XGM", 3)) {
- new_root = g_local[i].p_st + g_root->parts[j].p_st;
- break;
- }
- else {
- if (pno == chg_part) {
- change_it(pno, &g_root->parts[j], newname);
- if (t_flag)
- return(1);
- if (write_block(buf, new_root, drive) == 0)
- fatal(-1, "Cannot write block %d\r\n",new_root);
- return(1);
- }
- pno++;
- }
- }
- if (j == NGEM_PARTS)
- break;
- }
- }
- else {
- if (pno == chg_part) {
- /*
- * Re-read block 0
- */
- if (read_block(buf, 0, drive) == 0)
- fatal(-1, "Cannot read block 0\r\n");
- change_it(pno, &g_root->parts[i], newname);
- if (t_flag)
- return(1);
- set_csum(buf);
- if (write_block(buf, 0, drive) == 0)
- fatal(-1, "Cannot write block 0\r\n");
- return(1);
- }
- pno++;
- }
- }
- return(0);
-}
-
-void change_it(pno, gp, newname)
-int pno;
-GEM_PART *gp;
-char *newname;
-{
- char s1[4], s2[4];
-
- strncpy(s1, gp->p_id, 3);
- strncpy(s2, newname, 3);
- s1[3] = s2[3] = '\0';
- eprintf("Changing partition %d: %s -> %s ...", pno, s1, s2);
- gp->p_id[0] = s2[0]; gp->p_id[1] = s2[1]; gp->p_id[2] = s2[2];
-}
-
-int read_block(buf, blkno, drive)
-void *buf;
-int blkno;
-int drive;
-{
- if(Dmaread(blkno, 1, buf, drive + 8) != 0)
- return(0);
- return(1);
-}
-
-int write_block(buf, blkno, drive)
-void *buf;
-int blkno;
-int drive;
-{
- if(Dmawrite(blkno, 1, buf, drive + 8) != 0)
- return(0);
- return(1);
-}
-
-void set_csum(buf)
-char *buf;
-{
- unsigned short *p = (unsigned short *)buf;
- unsigned short csum = 0;
- int i;
-
- p[255] = 0;
- for(i = 0; i < 256; i++)
- csum += *p++;
- *--p = (0x1234 - csum) & 0xffff;
-}
-
-void usage()
-{
- eprintf("Usage: %s [-hVwt] [ -o <output file>] <driveno> <partno> "
- "<newid>\r\n", Progname);
- xexit(1);
-}
-
-void
-help()
-{
- eprintf("\r
-Change partition identifiers\r
-\r
-Usage: %s [-hVwt] [ -o <output file>] <driveno> <partno> <newid>\r
-\r
-Description of options:\r
-\r
-\t-h What you're getting right now.\r
-\t-o Write output to both <output file> and stdout.\r
-\t-V Print program version.\r
-\t-w Wait for a keypress before exiting.\r
-\t-t Test mode. It does everyting except the modifications on disk.\r
-\r
-The <driveno> and <partno> arguments specify the drive and the partition\r
-this program acts on. Both are zero based.\r
-The <newid> argument specifies a 3 letter string that will become the new\r
-partition-id.\r
-Finally note that the actions of %s are reversable.\r
-", Progname, Progname);
- xexit(0);
-}
diff --git a/sys/arch/atari/stand/tostools/libtos/Makefile b/sys/arch/atari/stand/tostools/libtos/Makefile
deleted file mode 100644
index f89ac1cd0eb..00000000000
--- a/sys/arch/atari/stand/tostools/libtos/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# $NetBSD: Makefile,v 1.1.1.1 1996/01/07 21:50:50 leo Exp $
-#
-LIB = libtos.a
-
-OBJS = bsdstart.o eprintf.o error.o xalloc.o xexit.o keywait.o
-HEADERS = kparamb.h libtos.h
-
-include ../Makefile.inc
-
-${LIB}: ${OBJS}
- @${RM} ${LIB}
- ${AR} ${LIB} ${OBJS}
diff --git a/sys/arch/atari/stand/tostools/libtos/bsdstart.s b/sys/arch/atari/stand/tostools/libtos/bsdstart.s
deleted file mode 100644
index 4ede2b4177c..00000000000
--- a/sys/arch/atari/stand/tostools/libtos/bsdstart.s
+++ /dev/null
@@ -1,111 +0,0 @@
-/* $NetBSD: bsdstart.s,v 1.2 1996/01/23 20:34:07 leo Exp $ */
-
-/*
- * Copyright (c) 1995 L. Weppelman
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This function sets up the registers according to the kernel parameter block,
- * disables the MMU and jumps to the kernel.
- *
- * bsd_startup(struct kparamb *)
- */
- .text
- .even
- .globl _bsd_startup
-
-_bsd_startup:
- movw #0x2700,sr
-
- | the BSD kernel wants values into the following registers:
- | d0: ttmem-size
- | d1: stmem-size
- | d2: cputype
- | d3: boothowto
- | d4: length of loaded kernel
- | d5: start of fastram
- | a0: start of loaded kernel
- | a1: end of symbols (esym)
- | All other registers zeroed for possible future requirements.
-
- movl sp@(4),a3 | a3 points to parameter block
-#ifdef TOSTOOLS
- lea _bsd_startup,sp | make sure we have a good stack ***
-#endif
- movl a3@,a0 | loaded kernel
- movl a3@(8),d0 | kernel entry point
- addl a0,d0 | added makes our absolute entry point
- movl d0,sp@- | push entry point ***
- movl a3@(12),d1 | stmem-size
- movl a3@(16),d0 | ttmem-size
- movl a3@(20),d2 | bootflags
- movl a3@(24),d3 | boothowto
- movl a3@(4),d4 | length of loaded kernel
- movl a3@(28),d5 | start of fastram
- movl a3@(32),a1 | end of symbols
- subl a5,a5 | target, load to 0
- btst #4,d2 | Is this an 68040?
- beqs 0f
-
- | Turn off 68040 MMU
- .word 0x4e7b,0xd003 | movec a5,tc
- .word 0x4e7b,0xd806 | movec a5,urp
- .word 0x4e7b,0xd807 | movec a5,srp
- .word 0x4e7b,0xd004 | movec a5,itt0
- .word 0x4e7b,0xd005 | movec a5,itt1
- .word 0x4e7b,0xd006 | movec a5,dtt0
- .word 0x4e7b,0xd007 | movec a5,dtt1
- bras 1f
-
-0: lea pc@(zero),a3
- pmove a3@,tc | Turn off MMU
- pmove a3@(-4),crp | crp = nullrp
- pmove a3@(-4),srp | srp = nullrp
- btst #3,d2 | Is this an 68030?
- beqs 1f
-
- | Turn off 68030 TT registers
- .word 0xf013,0x0800 | pmove a3@,tt0
- .word 0xf013,0x0c00 | pmove a3@,tt1
-
-1: movq #0,d6 | would have known contents
- movl d6,d7
- movl d6,a2
- movl d6,a3
- movl d6,a4
- movl d6,a5
- movl d6,a6
- rts | enter kernel at address on stack ***
-
-| A do-nothing MMU root pointer (includes the following long as well)
-| Note that the above code makes assumptions about the order of the following
-| items.
-
-nullrp: .long 0x80000202
-zero: .long 0
diff --git a/sys/arch/atari/stand/tostools/libtos/eprintf.c b/sys/arch/atari/stand/tostools/libtos/eprintf.c
deleted file mode 100644
index 60e07c57daf..00000000000
--- a/sys/arch/atari/stand/tostools/libtos/eprintf.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* $NetBSD: eprintf.c,v 1.1.1.1 1996/01/07 21:50:49 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Waldi Ravens.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Waldi Ravens.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <fcntl.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include "libtos.h"
-
-static int output_redirected = 0;
-
-void
-redirect_output(fn)
- char *fn;
-{
- int fd;
-
- fd = creat(fn, 0666);
- if (fd < 0 || dup2(fd, STDOUT_FILENO) < 0)
- fatal(errno, "%s", fn);
- output_redirected = 1;
-}
-
-/*
- * Print output to stderr. When output is redirected,
- * also write it to stdout.
- */
-int
-eprintf(frm)
- char *frm;
-{
- va_list args;
- int rv;
-
- va_start(args, frm);
- rv = veprintf(frm, args);
- va_end(args);
- return(rv);
-}
-
-int
-veprintf(frm, args)
- char *frm;
- va_list args;
-{
- int rv;
-
- rv = vfprintf(stderr, frm, args);
- if (output_redirected)
- vfprintf(stdout, frm, args);
- return(rv);
-}
diff --git a/sys/arch/atari/stand/tostools/libtos/error.c b/sys/arch/atari/stand/tostools/libtos/error.c
deleted file mode 100644
index fe5ff6f57d7..00000000000
--- a/sys/arch/atari/stand/tostools/libtos/error.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* $NetBSD: error.c,v 1.1.1.1 1996/01/07 21:50:49 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Waldi Ravens.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Waldi Ravens.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <osbind.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "libtos.h"
-
-static void errmsg PROTO((int, char *, va_list));
-
-const char *program_name;
-
-void
-init_toslib(arg0)
- char *arg0;
-{
- char *p;
-
- if (isatty(STDERR_FILENO) && (!*arg0 || !getenv("STDERR")))
- Fforce(STDERR_FILENO, -1);
-
- if (!(p = strrchr(arg0, '/')))
- p = strrchr(arg0, '\\');
- program_name = p ? ++p : arg0;
-}
-
-void
-error(err, frm)
- int err;
- char *frm;
-{
- va_list args;
-
- va_start(args, frm);
- errmsg(err, frm, args);
- va_end(args);
-}
-
-void
-fatal(err, frm)
- int err;
- char *frm;
-{
- va_list args;
-
- va_start(args, frm);
- errmsg(err, frm, args);
- va_end(args);
-
- xexit(EXIT_FAILURE);
-}
-
-static void
-errmsg(err, frm, args)
- int err;
- char *frm;
- va_list args;
-{
- extern const char *program_name;
-
- eprintf("%s: ", program_name);
- veprintf(frm, args);
-
- if (err != -1) {
- char *es = strerror(err);
- if (es)
- eprintf(": %s", es);
- else
- eprintf(": unknown error %d", err);
- }
-
- eprintf("\n");
-}
diff --git a/sys/arch/atari/stand/tostools/libtos/keywait.c b/sys/arch/atari/stand/tostools/libtos/keywait.c
deleted file mode 100644
index b0e73db52ad..00000000000
--- a/sys/arch/atari/stand/tostools/libtos/keywait.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $NetBSD: keywait.c,v 1.1.1.1 1996/01/07 21:50:50 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Waldi Ravens.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Waldi Ravens.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <termios.h>
-#include "libtos.h"
-
-int
-key_wait(text)
- char *text;
-{
- struct termios term_attr;
- tcflag_t lfl_orig;
- int any_key;
- char c;
-
- any_key = (text == NULL);
- if (any_key)
- text = "Press any key...";
-
- fprintf(stderr, text);
- fflush(stderr);
-
- tcgetattr(STDERR_FILENO, &term_attr);
- lfl_orig = term_attr.c_lflag;
- if (any_key)
- term_attr.c_lflag &= ~ECHO;
- term_attr.c_lflag &= ~ICANON;
- tcsetattr(STDERR_FILENO, TCSAFLUSH, &term_attr);
- read(STDERR_FILENO, &c, 1);
- term_attr.c_lflag = lfl_orig;
- tcsetattr(STDERR_FILENO, TCSAFLUSH, &term_attr);
-
- fprintf(stderr, (any_key ? "\r" : "\r\n"));
- fflush(stderr);
- return(c);
-}
diff --git a/sys/arch/atari/stand/tostools/libtos/kparamb.h b/sys/arch/atari/stand/tostools/libtos/kparamb.h
deleted file mode 100644
index 8c7f0d514b3..00000000000
--- a/sys/arch/atari/stand/tostools/libtos/kparamb.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* $NetBSD: kparamb.h,v 1.2 1996/01/19 13:54:12 leo Exp $ */
-
-/*
- * Copyright (c) 1995 L. Weppelman
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Structure passed to bsd_startup().
- */
-struct kparamb {
- u_char *kp; /* 00: Kernel load address */
- long ksize; /* 04: Size of loaded kernel */
- u_long entry; /* 08: Kernel entry point */
- long stmem_size; /* 12: Size of st-ram */
- long ttmem_size; /* 16: Size of tt-ram */
- long bootflags; /* 20: Various boot flags */
- long boothowto; /* 24: How to boot */
- long ttmem_start; /* 28: Start of tt-ram */
- long esym_loc; /* 32: End of symbol table */
-};
-
-#ifndef STANDALONE
-/*
- * Values for 'bootflags'.
- * Note: These should match with the values NetBSD uses!
- */
-#define ATARI_68000 1 /* 68000 CPU */
-#define ATARI_68010 (1<<1) /* 68010 CPU */
-#define ATARI_68020 (1<<2) /* 68020 CPU */
-#define ATARI_68030 (1<<3) /* 68030 CPU */
-#define ATARI_68040 (1<<4) /* 68040 CPU */
-#define ATARI_TT (1L<<11) /* This is a TT030 */
-#define ATARI_FALCON (1L<<12) /* This is a Falcon */
-
-#define ATARI_CLKBROKEN (1<<16) /* GEMDOS has faulty year base */
-
-#define ATARI_ANYCPU (ATARI_68000|ATARI_68010|ATARI_68020|ATARI_68030 \
- |ATARI_68040)
-
-/*
- * Definitions for boothowto
- * Note: These should match with the values NetBSD uses!
- */
-#define RB_AUTOBOOT 0x00
-#define RB_ASKNAME 0x01
-#define RB_SINGLE 0x02
-#define RB_KDB 0x40
-
-#endif /* STANDALONE */
diff --git a/sys/arch/atari/stand/tostools/libtos/libtos.h b/sys/arch/atari/stand/tostools/libtos/libtos.h
deleted file mode 100644
index 7873d816b8d..00000000000
--- a/sys/arch/atari/stand/tostools/libtos/libtos.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $NetBSD: libtos.h,v 1.1.1.1 1996/01/07 21:50:49 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Waldi Ravens.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Waldi Ravens.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBTOS_H
-#define LIBTOS_H
-
-#ifdef __STDC__
-#define PROTO(x) x
-#define EXTERN
-#else
-#define PROTO(x) ()
-#define EXTERN extern
-#endif
-
-#ifdef __GNUC__
-#if (__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 5))
-#define NORETURN __attribute__((noreturn))
-#else
-#define NORETURN
-#endif
-#endif
-
-#include <sys/types.h>
-#include <stdarg.h>
-#include "kparamb.h"
-
-EXTERN void bsd_startup PROTO((struct kparamb *)) NORETURN;
-EXTERN void init_toslib PROTO((char *));
-EXTERN void redirect_output PROTO((char *));
-EXTERN int eprintf PROTO((char *, ...));
-EXTERN int veprintf PROTO((char *, va_list));
-EXTERN void set_wait_for_key PROTO((void));
-EXTERN void press_any_key PROTO((void));
-EXTERN int key_wait PROTO((char *));
-EXTERN void xexit PROTO((int)) NORETURN;
-EXTERN void error PROTO((int, char *, ...));
-EXTERN void fatal PROTO((int, char *, ...)) NORETURN;
-EXTERN void * xmalloc PROTO((size_t));
-EXTERN void * xrealloc PROTO((void *, size_t));
-
-#endif /* LIBTOS_H */
diff --git a/sys/arch/atari/stand/tostools/libtos/xalloc.c b/sys/arch/atari/stand/tostools/libtos/xalloc.c
deleted file mode 100644
index 84b2f55cd4d..00000000000
--- a/sys/arch/atari/stand/tostools/libtos/xalloc.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* $NetBSD: xalloc.c,v 1.1.1.1 1996/01/07 21:50:49 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Waldi Ravens.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Waldi Ravens.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdlib.h>
-#include "libtos.h"
-
-void *
-xmalloc(size)
- size_t size;
-{
- void * p = malloc(size);
-
- if (p || !size)
- return(p);
- fatal(-1, "Virtual memory exhausted");
-}
-
-void *
-xrealloc(ptr, size)
- void *ptr;
- size_t size;
-{
- void * p = realloc(ptr, size);
-
- if (p || !size)
- return(p);
- fatal(-1, "Virtual memory exhausted");
-}
diff --git a/sys/arch/atari/stand/tostools/libtos/xexit.c b/sys/arch/atari/stand/tostools/libtos/xexit.c
deleted file mode 100644
index deb46724952..00000000000
--- a/sys/arch/atari/stand/tostools/libtos/xexit.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $NetBSD: xexit.c,v 1.1.1.1 1996/01/07 21:50:50 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Waldi Ravens.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Waldi Ravens.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include "libtos.h"
-
-static int wait_for_key = 0;
-
-void
-set_wait_for_key()
-{
- if (isatty(STDERR_FILENO))
- wait_for_key = 1;
-}
-
-void
-press_any_key()
-{
- if (wait_for_key)
- (void)key_wait(NULL);
-}
-
-void
-xexit(status)
- int status;
-{
- press_any_key();
- exit(status);
-}
diff --git a/sys/arch/atari/stand/tostools/loadbsd/Makefile b/sys/arch/atari/stand/tostools/loadbsd/Makefile
deleted file mode 100644
index 7453f6f9594..00000000000
--- a/sys/arch/atari/stand/tostools/loadbsd/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# $NetBSD: Makefile,v 1.1 1996/01/07 22:06:13 leo Exp $
-
-PROG = loadbsd.ttp
-
-OBJS = loadbsd.o
-HEADERS = loader.h ../libtos/kparamb.h
-
-include ../Makefile.inc
-
-${PROG}: ${OBJS} ${LDADD}
- ${CC} ${LDFLAGS} -o $@ ${OBJS} ${LDADD} ${LIBS}
diff --git a/sys/arch/atari/stand/tostools/loadbsd/loadbsd.c b/sys/arch/atari/stand/tostools/loadbsd/loadbsd.c
deleted file mode 100644
index 31d1070538f..00000000000
--- a/sys/arch/atari/stand/tostools/loadbsd/loadbsd.c
+++ /dev/null
@@ -1,354 +0,0 @@
-/* $OpenBSD: loadbsd.c,v 1.4 2000/03/03 00:54:49 todd Exp $ */
-/* $NetBSD: loadbsd.c,v 1.11 1996/01/09 09:55:15 leo Exp $ */
-
-/*
- * Copyright (c) 1995 L. Weppelman
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * NetBSD loader for the Atari-TT.
- */
-
-#include <a_out.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <osbind.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "libtos.h"
-#include "loader.h"
-
-char *Progname; /* How are we called */
-int d_flag = 0; /* Output debugging output? */
-int h_flag = 0; /* show help */
-int s_flag = 0; /* St-ram only */
-int t_flag = 0; /* Just test, do not execute */
-int v_flag = 0; /* show version */
-
-const char version[] = "$Revision: 1.4 $";
-
-/*
- * Default name of kernel to boot, large enough to patch
- */
-char kname[80] = "n:/netbsd";
-
-static struct kparamb kparam;
-
-void help PROTO((void));
-void usage PROTO((void));
-void get_sys_info PROTO((void));
-void start_kernel PROTO((void));
-
-int
-main(argc, argv)
-int argc;
-char **argv;
-{
- /*
- * Option parsing
- */
- extern int optind;
- extern char *optarg;
- int ch;
- int fd;
- long textsz, stringsz;
- struct exec ehdr;
-
- init_toslib(argv[0]);
- Progname = argv[0];
-
- kparam.boothowto = RB_SINGLE;
-
- while ((ch = getopt(argc, argv, "abdhstVwDo:S:T:")) != -1) {
- switch (ch) {
- case 'a':
- kparam.boothowto &= ~(RB_SINGLE);
- kparam.boothowto |= RB_AUTOBOOT;
- break;
- case 'b':
- kparam.boothowto |= RB_ASKNAME;
- break;
- case 'd':
- kparam.boothowto |= RB_KDB;
- break;
- case 'D':
- d_flag = 1;
- break;
- case 'h':
- h_flag = 1;
- break;
- case 'o':
- redirect_output(optarg);
- break;
- case 's':
- s_flag = 1;
- break;
- case 'S':
- kparam.stmem_size = atoi(optarg);
- break;
- case 't':
- t_flag = 1;
- break;
- case 'T':
- kparam.ttmem_size = atoi(optarg);
- break;
- case 'V':
- v_flag = 1;
- break;
- case 'w':
- set_wait_for_key();
- break;
- default:
- usage();
- }
- }
- argc -= optind;
- argv += optind;
- if (argc == 1)
- strcpy(kname, argv[0]);
-
- if (h_flag)
- help();
- if (v_flag)
- eprintf("%s\r\n", version);
-
- /*
- * Get system info to pass to NetBSD
- */
- get_sys_info();
-
- /*
- * Find the kernel to boot and read it's exec-header
- */
- if ((fd = open(kname, O_RDONLY)) < 0)
- fatal(-1, "Cannot open kernel '%s'", kname);
- if (read(fd, (char *)&ehdr, sizeof(ehdr)) != sizeof(ehdr))
- fatal(-1, "Cannot read exec-header of '%s'", kname);
- if (N_MAGIC(ehdr) != NMAGIC)
- fatal(-1, "Not an NMAGIC file '%s'", kname);
-
- /*
- * Extract various sizes from the kernel executable
- */
- textsz = (ehdr.a_text + __LDPGSZ - 1) & ~(__LDPGSZ - 1);
- kparam.esym_loc = 0;
- kparam.ksize = textsz + ehdr.a_data + ehdr.a_bss;
- kparam.entry = ehdr.a_entry;
-
- if (ehdr.a_syms) {
- if (lseek(fd,ehdr.a_text+ehdr.a_data+ehdr.a_syms+sizeof(ehdr),0) <= 0)
- fatal(-1, "Cannot seek to string table in '%s'", kname);
- if (read(fd, (char *)&stringsz, sizeof(long)) != sizeof(long))
- fatal(-1, "Cannot read string-table size");
- if (lseek(fd, sizeof(ehdr), 0) <= 0)
- fatal(-1, "Cannot seek back to text start");
- kparam.ksize += ehdr.a_syms + sizeof(long) + stringsz;
- }
-
- if ((kparam.kp = (u_char *)malloc(kparam.ksize)) == NULL)
- fatal(-1, "Cannot malloc kernel image space");
-
- /*
- * Read text & data, clear bss
- */
- if ((read(fd, (char *)kparam.kp, ehdr.a_text) != ehdr.a_text)
- || (read(fd,(char *)(kparam.kp+textsz),ehdr.a_data) != ehdr.a_data))
- fatal(-1, "Unable to read kernel image\n");
- memset(kparam.kp + textsz + ehdr.a_data, 0, ehdr.a_bss);
-
- /*
- * Read symbol and string table
- */
- if (ehdr.a_syms) {
- long *p;
-
- p = (long *)(kparam.kp + textsz + ehdr.a_data + ehdr.a_bss);
- *p++ = ehdr.a_syms;
- if (read(fd, (char *)p, ehdr.a_syms) != ehdr.a_syms)
- fatal(-1, "Cannot read symbol table\n");
- p = (long *)((char *)p + ehdr.a_syms);
- if (read(fd, (char *)p, stringsz) != stringsz)
- fatal(-1, "Cannot read string table\n");
- kparam.esym_loc = (long)((char *)p-(char *)kparam.kp +stringsz);
- }
-
- if (d_flag) {
- eprintf("\r\nKernel info:\r\n");
- eprintf("Kernel loadaddr\t: 0x%08x\r\n", kparam.kp);
- eprintf("Kernel size\t: %10d bytes\r\n", kparam.ksize);
- eprintf("Kernel entry\t: 0x%08x\r\n", kparam.entry);
- eprintf("Kernel esym\t: 0x%08x\r\n", kparam.esym_loc);
- }
-
- if (!t_flag)
- start_kernel();
- /* NOT REACHED */
-
- eprintf("Kernel '%s' was loaded OK\r\n", kname);
- xexit(0);
-}
-
-/*
- * Extract memory and cpu/fpu info from system.
- */
-void
-get_sys_info()
-{
- long stck;
- long *jar;
- OSH *oshdr;
-
- kparam.bootflags = 0;
-
- stck = Super(0);
-
- /*
- * Some GEMDOS versions use a different year-base in the RTC.
- */
- oshdr = *ADDR_OSHEAD;
- oshdr = oshdr->os_beg;
- if ((oshdr->os_version > 0x0300) && (oshdr->os_version < 0x0306))
- kparam.bootflags |= ATARI_CLKBROKEN;
-
- if (kparam.stmem_size <= 0)
- kparam.stmem_size = *ADDR_PHYSTOP;
-
- if (kparam.ttmem_size)
- kparam.ttmem_start = TTRAM_BASE;
- else {
- if (!s_flag && (*ADDR_CHKRAMTOP == RAM_TOP_MAGIC)) {
- kparam.ttmem_size = *ADDR_RAMTOP;
- if (kparam.ttmem_size > TTRAM_BASE) {
- kparam.ttmem_size -= TTRAM_BASE;
- kparam.ttmem_start = TTRAM_BASE;
- }
- else kparam.ttmem_size = 0;
- }
- }
-
- /*
- * Scan cookiejar for cpu types
- */
- jar = *ADDR_P_COOKIE;
- if (jar != NULL) {
- do {
- if (jar[0] == 0x5f435055) { /* _CPU */
- switch (jar[1]) {
- case 0:
- kparam.bootflags |= ATARI_68000;
- break;
- case 10:
- kparam.bootflags |= ATARI_68010;
- break;
- case 20:
- kparam.bootflags |= ATARI_68020;
- break;
- case 30:
- kparam.bootflags |= ATARI_68030;
- break;
- case 40:
- kparam.bootflags |= ATARI_68040;
- break;
- default:
- fatal(-1, "Unknown CPU-type");
- }
- }
- if (jar[0] == 0x42504658) { /* BPFX */
- unsigned long *p;
-
- p = (unsigned long*)jar[1];
-
- kparam.ttmem_start = p[1];
- kparam.ttmem_size = p[2];
- }
- jar = &jar[2];
- } while (jar[-2]);
- }
- if (!(kparam.bootflags & ATARI_ANYCPU))
- fatal(-1, "Cannot determine CPU-type");
-
- (void)Super(stck);
-
- if (d_flag) {
- eprintf("Machine info:\r\n");
- eprintf("ST-RAM size\t: %10d bytes\r\n",kparam.stmem_size);
- eprintf("TT-RAM size\t: %10d bytes\r\n",kparam.ttmem_size);
- eprintf("TT-RAM start\t: 0x%08x\r\n", kparam.ttmem_start);
- eprintf("Cpu-type\t: 0x%08x\r\n", kparam.bootflags);
- }
-}
-
-void
-help()
-{
- eprintf("\r
-NetBSD loader for the Atari-TT\r
-\r
-Usage: %s [-abdhstVD] [-S <stram-size>] [-T <ttram-size>] [kernel]\r
-\r
-Description of options:\r
-\r
-\t-a Boot up to multi-user mode.\r
-\t-b Ask for root device to use.\r
-\t-d Enter kernel debugger.\r
-\t-D printout debug information while loading\r
-\t-h What you're getting right now.\r
-\t-o Write output to both <output file> and stdout.\r
-\t-s Use only ST-compatible RAM\r
-\t-S Set amount of ST-compatible RAM\r
-\t-T Set amount of TT-compatible RAM\r
-\t-t Test the loader. It will do everything except executing the\r
-\t loaded kernel.\r
-\t-V Print loader version.\r
-\t-w Wait for a keypress before exiting.\r
-", Progname);
- xexit(0);
-}
-
-void
-usage()
-{
- eprintf("Usage: %s [-abdhstVD] [-S <stram-size>] "
- "[-T <ttram-size>] [kernel]\r\n", Progname);
- xexit(1);
-}
-
-void
-start_kernel()
-{
- long stck;
-
- stck = Super(0);
- bsd_startup(&kparam);
- /* NOT REACHED */
-
- (void)Super(stck);
-}
diff --git a/sys/arch/atari/stand/tostools/loadbsd/loader.h b/sys/arch/atari/stand/tostools/loadbsd/loader.h
deleted file mode 100644
index d649e0a2a55..00000000000
--- a/sys/arch/atari/stand/tostools/loadbsd/loader.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $NetBSD: loader.h,v 1.6 1996/01/07 22:06:18 leo Exp $ */
-
-/*
- * Copyright (c) 1995 L. Weppelman
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * NetBSD loader for the Atari-TT.
- *
- * Assume compiling under TOS or MINT. The page-size will always
- * be incorrect then (if it is defined anyway).
- */
-#ifdef __LDPGSZ
-#undef __LDPGSZ
-#endif
-
-#define __LDPGSZ (8*1024) /* Page size for NetBSD */
-
-#ifndef N_MAGIC
-#define N_MAGIC(hdr) (hdr.a_magic & 0xffff)
-#endif
-
-#define TTRAM_BASE 0x1000000 /* Fastram always starts here */
-
-/*
- * System var's used in low-memory
- */
-#define ADDR_RAMTOP ((long*)0x5a4) /* End of TT-ram (unofficial) */
-#define ADDR_CHKRAMTOP ((long*)0x5a8) /* above is valid (unofficial)*/
-#define ADDR_PHYSTOP ((long*)0x42e) /* End of ST-ram */
-#define ADDR_P_COOKIE ((long**)0x5a0) /* Pointer to cookie jar */
-#define ADDR_OSHEAD ((OSH**)0x4f2) /* Pointer Os-header */
-
-#define RAM_TOP_MAGIC (0x1357bd13) /* Magic nr. for ADDR_CHKRAMTOP */
-
-/*
- * Sufficient but incomplete definition os Os-header
- */
-typedef struct osh {
- unsigned short os_entry;
- unsigned short os_version;
- void *reseth;
- struct osh *os_beg;
-} OSH;
diff --git a/sys/arch/atari/stand/tostools/rawwrite/Makefile b/sys/arch/atari/stand/tostools/rawwrite/Makefile
deleted file mode 100644
index 411b97b755b..00000000000
--- a/sys/arch/atari/stand/tostools/rawwrite/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# $NetBSD: Makefile,v 1.1 1996/01/07 22:06:22 leo Exp $
-
-PROG = rawwrite.ttp
-
-OBJS = rawwrite.o
-HEADERS =
-
-include ../Makefile.inc
-
-${PROG}: ${OBJS} ${LDADD}
- ${CC} ${LDFLAGS} -o $@ ${OBJS} ${LDADD} ${LIBS}
diff --git a/sys/arch/atari/stand/tostools/rawwrite/rawwrite.c b/sys/arch/atari/stand/tostools/rawwrite/rawwrite.c
deleted file mode 100644
index cf770b0aad8..00000000000
--- a/sys/arch/atari/stand/tostools/rawwrite/rawwrite.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/* $OpenBSD: rawwrite.c,v 1.4 2000/03/03 00:54:49 todd Exp $ */
-/* $NetBSD: rawwrite.c,v 1.3 1996/01/09 09:55:17 leo Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <osbind.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <string.h>
-#include "libtos.h"
-
-#define SECT_SIZE 512 /* Sector size */
-#define NSECT_DD 18 /* Sectors per cylinder 720Kb */
-#define NSECT_HD 36 /* Sectors per cylinder 1.44Mb */
-#define NTRK 80 /* Number of tracks */
-
-static void help PROTO((void));
-static void usage PROTO((void));
-static void brwrite PROTO((char *, int));
-
-char buf[NSECT_HD * SECT_SIZE];
-int h_flag = 0; /* Show help */
-int v_flag = 0; /* Verbose (a dot for each track copied) */
-int V_flag = 0; /* Show version */
-char *progname;
-
-const char version[] = "$Revision: 1.4 $";
-
-int
-main(argc, argv)
-int argc;
-char *argv[];
-{
- extern int optind;
- extern char *optarg;
- int ch;
- char *infile;
- int fd;
- int i;
- int nsect;
-
- progname = argv[0];
- init_toslib(argv[0]);
-
- while ((ch = getopt(argc, argv, "hvVwo:")) != -1) {
- switch (ch) {
- case 'h':
- h_flag = 1;
- break;
- case 'o':
- redirect_output(optarg);
- break;
- case 'v':
- v_flag = 1;
- break;
- case 'V':
- V_flag = 1;
- break;
- case 'w':
- set_wait_for_key();
- break;
- default :
- usage();
- break;
- }
- }
- if (h_flag)
- help();
- if (V_flag)
- eprintf("%s\r\n", version);
-
- if (optind >= argc)
- usage();
-
- infile = argv[optind];
- nsect = NSECT_DD;
-
- if ((fd = open(infile, O_RDONLY)) < 0)
- fatal(-1, "Cannot open '%s'\n", infile);
-
- for (i = 0; i < NTRK; i++) {
- if (read(fd, buf, nsect * SECT_SIZE) != (nsect * SECT_SIZE))
- fatal(-1, "\n\rRead error on '%s'\n", infile);
- if (v_flag) {
- if (i && !(i % 40))
- eprintf("\r\n");
- eprintf(".");
- }
- brwrite(buf, i);
- }
- close(fd);
- if (v_flag)
- eprintf("\r\n");
- xexit(0);
-}
-
-static void
-brwrite(buf, trk)
-char *buf;
-int trk;
-{
- static u_char trbuf[NSECT_DD * SECT_SIZE * 2];
- static u_int sideno = 0;
-
- for (sideno = 0; sideno < 2; sideno++) {
- if (Flopfmt(trbuf, 0, 0, NSECT_DD/2, trk, sideno, 1,
- 0x87654321, 0xe5e5))
- fatal(-1, "Format error");
- if (Flopwr(buf, 0, 0, 1, trk, sideno, NSECT_DD/2))
- fatal(-1, "Write error");
- buf += (NSECT_DD/2) * SECT_SIZE;
- }
-}
-static void
-usage()
-{
- eprintf("Usage: %s [-hvVw] [-o <log-file>] <infile>\r\n", progname);
- xexit(1);
-}
-
-static void
-help()
-{
- eprintf("\r
-write a raw floppy-image to disk\r
-\r
-Usage: %s [-hvVw] [-o <log-file>] <infile>\r
-\r
-Description of options:\r
-\r
-\t-h What you're getting right now.\r
-\t-o Write output to both <output file> and stdout.\r
-\t-v Show a '.' for each track written.\r
-\t-V Print program version.\r
-\t-w Wait for a keypress before exiting.\r
-", progname);
- xexit(0);
-}
diff --git a/sys/arch/kbus/Makefile b/sys/arch/kbus/Makefile
deleted file mode 100644
index 56051070bd5..00000000000
--- a/sys/arch/kbus/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-# $NetBSD: Makefile,v 1.2 1994/10/26 08:23:50 cgd Exp $
-
-# @(#)Makefile 7.3 (Berkeley) 6/9/91
-
-COMM= ../net/*.[ch] ../netimp/*.[ch] ../netinet/*.[ch] ../netns/*.[ch] \
- ../netiso/*.[ch] ../netccitt/*.[ch] \
- ../kern/*.c ../ufs/*.[ch] ../nfs/*.[ch] ../vm/*.[ch] ../sys/*.h
-
-# Makefile for pc532 tags file
-
-SUBDIR= stand
-
-TPC532= ../pc532/tags
-SPC532= ../pc532/pc532/*.[ch] ../pc532/include/*.h \
- ../pc532/dev/*.[ch] ../pc532/scsi/*.[ch]
-APC532= ../pc532/pc532/*.s
-
-# Directories in which to place pc532 tags links
-DPC532= dev include scsi
-
-tags:
- -ctags -dtf ${TPC532} ${COMM} ${SPC532}
- egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${APC532} | \
- sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
- >> ${TPC532}
- sort -o ${TPC532} ${TPC532}
-
-links:
- -for i in ${DPC532}; do \
- cd ../$$i && rm -f tags; ln -s ../tags tags; done
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/kbus/README b/sys/arch/kbus/README
deleted file mode 100644
index db88456c863..00000000000
--- a/sys/arch/kbus/README
+++ /dev/null
@@ -1,49 +0,0 @@
-README file for Series5.
-************************
-
-Written by Tristan Gingold 1997 (gingold@email.enst.fr)
-
-This file contains comments about the work I did in 1997.
-These comments are written from remindings, so they are not accurate.
-
-Series5 was a computer shipped by Solbourne from October 1989 on.
-However, Solbourne hardware activities are now ended.
-
-The Series5 is the second model from Solbourne, after Series4.
-It was powered by a 33 Mhz Cypress Sparc and a Weitek Abacus 3171 fpu.
-
-The model I have (Series5 model 800 with 2 SMD disks) has 2 cpus.
-In fact, Solbourne Computer was the first to offer a multiprocessor Sparc
-machine, which was software compatible with SunOS.
-
-However, it is not hardware compatible.
-
-The SMP servers are based on CPU, memory and I/O cards that connect to a
-common backplane bus, the KBUS. It is a proprietary 64-bit bus.
-The I/O cards also provides a bridge to a VME bus, on which a Xylogics card
-is connected.
-
-Device drivers:
-* zs: (ttya/ttyb) ttya is the console. At this time, there is a software bug
- which sometimes hangs the console (but not the system).
-* le: (ethernet). Seems to be fully ok, used for loading the kernel and
- as the main diskless interface.
-* xd: (Sylogucs 753 SMD disk controller). Seems ok. The driver was based
- on sparc/dev/xd.c, but modified (the genuine bad144 code was too buggy
- for me).
-* si: (WD33C93A SCSI): At least inquire is working, but no more.
-* kbd, bwtwo, ms: there is no drivers, since I have no screen, no mouse and
- no keyboard.
-
-Note that only one processor can work. (Snif !)
-
-At this time, I can boot the system and get the login prompt on the console,
-and via telnet.
-The kernel sometimes crash, so there is still some work to do.
-
-************
-The Series5 kernel was cross-build with a gcc configured for SunOs on a
-i386-linux host. (!!!)
-The binary should be fully compatible with the Sparc one. So, there is no
-binary distribution.
-Kernel files come from sparc, pmax (for pmap.c), mvme68k (sbic*.c), pc532...
diff --git a/sys/arch/kbus/compile/.cvsignore b/sys/arch/kbus/compile/.cvsignore
deleted file mode 100644
index bb3497f0d62..00000000000
--- a/sys/arch/kbus/compile/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-DEFAULT
-INSTALL
-KLONDIKE
-STEELHEAD
diff --git a/sys/arch/kbus/conf/DEFAULT b/sys/arch/kbus/conf/DEFAULT
deleted file mode 100644
index c10699b1bd2..00000000000
--- a/sys/arch/kbus/conf/DEFAULT
+++ /dev/null
@@ -1,111 +0,0 @@
-#
-# DEFAULT: default install kernel
-#
-
-machine kbus
-
-maxusers 8 # estimated number of users
-options TIMEZONE=0, DST=0 # time zone to read RTC in
-options SWAPPAGER # paging
-options DEVPAGER # device node caching
-options OLD_PIPE
-#options KGDB
-
-options DDB # kernel debugger; recommended
-#options DIAGNOSTIC # internal consistency checking
-options KTRACE # system call tracing, a la ktrace(1)
-
-options ACCOUNTING # process accounting
-#options FIFO # fifos; recommended
-#options SYSVSHM # System V shared memory; broken
-#options SHMMAXPGS=1024
-#options LKM # loadable kernel modules
-#options LEDEBUG
-
-# compatibility options
-#options COMPAT_09 # NetBSD 0.9,
-#options COMPAT_10 # NetBSD 1.0,
-#options COMPAT_43 # and 4.3BSD
-#options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD
-options COMPAT_SUNOS # Compatibility with SunOS binaries
-
-# file system options
-#options QUOTA # file system quotas
-options FFS # Berkeley fast file system
-#options LFS # log-structered file system
-#options MFS # memory file system; uses RAM and swap
-#options MSDOSFS # MS-DOS file system
-#options CD9660 # ISO 9660 CD-ROM file system, with RR
-#options NULLFS # loopback file system
-#options UMAPFS # NULLFS + uid and gid remapping
-#options UNION # union file system
-#options PORTAL # /portal
-#options FDESC # /dev/fd
-#options KERNFS # /kern
-#options PROCFS # /proc
-#options NFSSERVER # Network File System server
-options NFSCLIENT # Network File System client
-
-# networking options
-#options GATEWAY # packet forwarding
-options INET # IP + ICMP + TCP + UDP
-#options NS # XNS
-#options ISO,TPIP # OSI
-#options EON # OSI tunneling over IP
-#options CCITT,LLC,HDLC # X.25
-
-# pc532 specific options
-#options COMDEF_SPEED=B19200 # default baud on the scn chips
-#options PLIP # PLIP driver in dev/lpt.c
-
-#config bsd root on nfs swap on nfs
-config bsd swap generic
-
-mainbus0 at root
-
-kbus0 at mainbus?
-vmel0 at mainbus?
-vmeh0 at mainbus?
-vmes0 at mainbus?
-
-zsc1 at kbus0 addr 0x17012000
-zsc0 at kbus0 addr 0x17011000
-
-# clock
-clock0 at zsc0 channel 1 # clock
-
-#
-# Serial ports
-#
-zstty0 at zsc1 channel 0 # ttya
-zstty1 at zsc1 channel 1 # ttyb
-
-# Lance Ethernet (only onboard)
-sle0 at kbus0 addr 0x90001000 level 3
-
-# Xylogics 753 controllers
-xdc0 at vmes0 addr 0xffffee80 level 2 vect 0x44
-# xdc1 at vmes0 addr 0xffffee90 level 2 vect 0x45
-xd* at xdc? drive ?
-
-# WD33C93A SCSI controler.
-si0 at kbus? addr 0x90000800
-
-scsibus* at si?
-
-#sd* at scsibus? target ? lun ?
-st* at scsibus? target ? lun ? # SCSI Tapes
-#cd* at scsibus? target ? lun ?
-#ch* at scsibus? target ? lun ?
-#ss* at scsibus? target ? lun ?
-#uk* at scsibus? target ? lun ?
-
-pseudo-device pty 16 # pseudo-terminals
-pseudo-device loop 1 # loopback network
-#pseudo-device vnd 2 # vnode devices
-#pseudo-device bpfilter 4 # packet filter
-#pseudo-device sl 1 # compressed SLIP
-#pseudo-device ppp 1 # Point-to-Point Protocol
-#pseudo-device tun 1 # network tunneling
-
-
diff --git a/sys/arch/kbus/conf/DISKLESS b/sys/arch/kbus/conf/DISKLESS
deleted file mode 100644
index b8ca4a9f2b5..00000000000
--- a/sys/arch/kbus/conf/DISKLESS
+++ /dev/null
@@ -1,112 +0,0 @@
-#
-# DEFAULT: default install kernel
-#
-
-machine kbus
-
-maxusers 8 # estimated number of users
-options TIMEZONE=0, DST=0 # time zone to read RTC in
-options SWAPPAGER # paging
-options DEVPAGER # device node caching
-options OLD_PIPE
-#options KGDB
-
-options DDB # kernel debugger; recommended
-#options DIAGNOSTIC # internal consistency checking
-#options KTRACE # system call tracing, a la ktrace(1)
-
-#options ACCOUNTING # process accounting
-#options FIFO # fifos; recommended
-#options SYSVSHM # System V shared memory; broken
-#options SHMMAXPGS=1024
-#options LKM # loadable kernel modules
-options LEDEBUG
-
-# compatibility options
-#options COMPAT_09 # NetBSD 0.9,
-#options COMPAT_10 # NetBSD 1.0,
-#options COMPAT_43 # and 4.3BSD
-#options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD
-options COMPAT_SUNOS # Compatibility with SunOS binaries
-
-# file system options
-#options QUOTA # file system quotas
-options FFS # Berkeley fast file system
-#options LFS # log-structered file system
-#options MFS # memory file system; uses RAM and swap
-#options MSDOSFS # MS-DOS file system
-#options CD9660 # ISO 9660 CD-ROM file system, with RR
-#options NULLFS # loopback file system
-#options UMAPFS # NULLFS + uid and gid remapping
-#options UNION # union file system
-#options PORTAL # /portal
-#options FDESC # /dev/fd
-#options KERNFS # /kern
-#options PROCFS # /proc
-#options NFSSERVER # Network File System server
-options NFSCLIENT # Network File System client
-
-# networking options
-#options GATEWAY # packet forwarding
-options INET # IP + ICMP + TCP + UDP
-#options NS # XNS
-#options ISO,TPIP # OSI
-#options EON # OSI tunneling over IP
-#options CCITT,LLC,HDLC # X.25
-
-# pc532 specific options
-#options COMDEF_SPEED=B19200 # default baud on the scn chips
-#options PLIP # PLIP driver in dev/lpt.c
-
-config bsd root on nfs swap on nfs
-#config bsd swap generic
-options GENERIC
-
-mainbus0 at root
-
-kbus0 at mainbus?
-vmel0 at mainbus?
-vmeh0 at mainbus?
-vmes0 at mainbus?
-
-zsc1 at kbus0 addr 0x17012000
-zsc0 at kbus0 addr 0x17011000
-
-# clock
-clock0 at zsc0 channel 1 # clock
-
-#
-# Serial ports
-#
-zstty0 at zsc1 channel 0 # ttya
-zstty1 at zsc1 channel 1 # ttyb
-
-# Lance Ethernet (only onboard)
-sle0 at kbus0 addr 0x90001000 level 3
-
-# Xylogics 753 controllers
-xdc0 at vmes0 addr 0xffffee80 level 2 vect 0x44
-# xdc1 at vmes0 addr 0xffffee90 level 2 vect 0x45
-xd* at xdc? drive ?
-
-# WD33C93A SCSI controler.
-si0 at kbus? addr 0x90000800
-
-scsibus* at si?
-
-#sd* at scsibus? target ? lun ?
-st* at scsibus? target ? lun ? # SCSI Tapes
-#cd* at scsibus? target ? lun ?
-#ch* at scsibus? target ? lun ?
-#ss* at scsibus? target ? lun ?
-#uk* at scsibus? target ? lun ?
-
-pseudo-device pty 16 # pseudo-terminals
-pseudo-device loop 1 # loopback network
-#pseudo-device vnd 2 # vnode devices
-#pseudo-device bpfilter 4 # packet filter
-#pseudo-device sl 1 # compressed SLIP
-#pseudo-device ppp 1 # Point-to-Point Protocol
-#pseudo-device tun 1 # network tunneling
-
-
diff --git a/sys/arch/kbus/conf/Makefile.kbus b/sys/arch/kbus/conf/Makefile.kbus
deleted file mode 100644
index 6f960eeb43c..00000000000
--- a/sys/arch/kbus/conf/Makefile.kbus
+++ /dev/null
@@ -1,165 +0,0 @@
-# $OpenBSD: Makefile.kbus,v 1.4 2000/01/10 03:49:50 millert Exp $
-
-# Copyright 1990 W. Jolitz
-# @(#)Makefile.i386 7.1 5/10/91
-#
-# Makefile for OpenBSD/Kbus
-#
-# Edited by Philip A. Nelson
-#
-# This makefile is constructed from a machine description:
-# config machineid
-# Most changes should be made in the machine description
-# /sys/arch/kbus/conf/``machineid''
-# after which you should do
-# config machineid
-# Generic makefile changes should be made in
-# /sys/arch/kbus/conf/Makefile.kbus
-# after which config should be rerun for all machines.
-#
-# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE INVISIBLE TO MAKEFILE
-# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
-#
-# -DTRACE compile in kernel tracing hooks
-# -DQUOTA compile in file system quotas
-#
-
-TOUCH= touch -f -c
-HOSTCC= gcc
-#HOST=sparc-sun-sunos4-
-HOST=
-AS= $(HOST)as
-LD= $(HOST)ld
-CC= $(HOST)gcc
-CPP= $(HOST)cpp
-AWK= awk
-
-S= ../../../..
-KBUS= ../..
-
-.s.o:
- $(CC) -x assembler-with-cpp -traditional-cpp -c ${COPTS} ${KBUS}/kbus/$*.s ${ASFLAGS} -o $*.o
-
-CPPFLAGS= -I. -I$S -I$S/sys -I${KBUS}
-INCLUDES=$(CPPFLAGS)
-COPTS= ${INCLUDES} ${IDENT} -D_KERNEL
-CDIAGFLAGS= -Wall -Werror -Wno-format -Wstrict-prototypes \
- -Wmissing-prototypes -Wno-main -Wno-uninitialized
-
-CFLAGS= -pipe -O ${COPTS} ${CDIAGFLAGS}
-ASFLAGS=
-
-### find out what to use for libkern
-.include "$S/lib/libkern/Makefile.inc"
-.ifndef PROF
-LIBKERN= ${KERNLIB}
-.else
-LIBKERN= ${KERNLIB_PROF}
-.endif
-
-### find out what to use for libcompat
-.include "$S/compat/common/Makefile.inc"
-.ifndef PROF
-LIBCOMPAT= ${COMPATLIB}
-.else
-LIBCOMPAT= ${COMPATLIB_PROF}
-.endif
-
-NORMAL_S= (${CPP} ${COPTS} ${PROF} $< | ${AS} ${ASFLAGS} -o $*.o)
-NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
-NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
-DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
-DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
-SYSTEM_OBJS=locore.o ${OBJS} param.o ioconf.o conf.o ${LIBKERN} \
- ${LIBCOMPAT}
-SYSTEM_DEP=Makefile ${SYSTEM_OBJS}
-SYSTEM_LD_HEAD= @echo loading $@; rm -f $@
-#SYSTEM_LD= ${LD} -T ${KBUS}/kbus/ldscript -e start -d -o $@ -X ${SYSTEM_OBJS} vers.o
-SYSTEM_LD= ${LD} -N -p -Ttext FF060000 -e start -o $@ ${SYSTEM_OBJS} vers.o
-#SYSTEM_LD_TAIL= $(HOST)size $@ ; $(HOST)nm -n $@ > SYMMS ; chmod 755 $@; cp $@ /tftpboot
-SYSTEM_LD_TAIL= $(HOST)size $@ ; $(HOST)nm -n $@ > SYMMS ; chmod 755 $@
-
-%OBJS
-
-%CFILES
-
-%LOAD
-
-clean::
- rm -f eddep *bsd *bsd.gdb tags *.[io] [a-z]*.s \
- [Ee]rrs linterrs makelinks genassym genassym.o assym.h
-
-#lint: /tmp param.c
-# @lint -hbxn -I. -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
-# ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
-# grep -v 'struct/union .* never defined' | \
-# grep -v 'possible pointer alignment problem'
-
-locore.o: assym.h ${KBUS}/kbus/locore.s
-
-# the following is necessary because autoconf.o depends on #if GENERIC
-autoconf.o: Makefile
-
-# depend on network configuration
-af.o uipc_domain.o uipc_proto.o locore.o: Makefile
-if_tun.o if_loop.o if_ethersubr.o: Makefile
-in_proto.o: Makefile
-
-# depend on maxusers
-assym.s machdep.o: Makefile
-
-# depends on KDB (cons.o also depends on GENERIC)
-trap.o cons.o: Makefile
-
-assym.s: $S/sys/param.h machine/pte.h $S/sys/buf.h \
- $S/sys/vmmeter.h \
- $S/sys/proc.h $S/sys/msgbuf.h machine/vmparam.h
-
-assym.h: genassym
- ./genassym >assym.h
-
-genassym: ${KBUS}/kbus/genassym.c
- ${HOSTCC} ${INCLUDES} -D_KERNEL ${IDENT} ${PARAM} \
- ${KBUS}/kbus/genassym.c -o genassym
-
-depend:: .depend
-.depend: assym.h param.c
- mkdep ${COPTS} ${CFILES} ioconf.c
- mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${KBUS}/kbus/genassym.c
-
-links:
- egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
- sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
- echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
- sort -u | comm -23 - dontlink | \
- sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
- sh makelinks && rm -f dontlink
-
-tags:
- @echo "see $S/kern/Makefile for tags"
-
-ioconf.o: ioconf.c $S/sys/param.h $S/sys/buf.h
- ${CC} -c ${CFLAGS} ioconf.c
-
-conf.o: $S/sys/param.h $S/sys/systm.h $S/sys/buf.h $S/sys/ioctl.h \
- $S/sys/tty.h $S/sys/conf.h ${KBUS}/kbus/conf.c
- ${CC} -c ${CFLAGS} ${KBUS}/kbus/conf.c
-
-param.c: $S/conf/param.c
- -rm -f param.c
- cp $S/conf/param.c .
-
-param.o: param.c Makefile
- ${CC} -c ${CFLAGS} ${PARAM} param.c
-
-vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
- sh $S/conf/newvers.sh
- ${CC} ${CFLAGS} -c vers.c
-
-# for config.new
-newvers:
- sh $S/conf/newvers.sh
- ${CC} ${CFLAGS} -c vers.c
-
-%RULES
-
diff --git a/sys/arch/kbus/conf/files.kbus b/sys/arch/kbus/conf/files.kbus
deleted file mode 100644
index ea61283517e..00000000000
--- a/sys/arch/kbus/conf/files.kbus
+++ /dev/null
@@ -1,144 +0,0 @@
-# $OpenBSD: files.kbus,v 1.2 2000/01/10 03:49:50 millert Exp $
-#
-# new style config file for kbus architecture
-#
-
-# maxpartitions must be first item in files.${ARCH}.newconf
-maxpartitions 16
-
-maxusers 2 16 64
-
-device mainbus {}
-attach mainbus at root
-file arch/kbus/kbus/mainbus.c mainbus
-
-device kbus {addr = -1, [level = -1]}
-attach kbus at mainbus
-file arch/kbus/dev/kbus.c kbus
-
-# VME Space
-device vmel {addr = -1, [level = -1], [vect = -1]}
-attach vmel at mainbus
-device vmeh {addr = -1, [level = -1], [vect = -1]}
-attach vmeh at mainbus
-device vmes {addr = -1, [level = -1], [vect = -1]}
-attach vmes at mainbus
-file arch/kbus/dev/vme.c vmel | vmeh | vmes
-
-major {vnd = 5}
-
-#device rd at membus: disk
-#file arch/kbus/dev/rd.c rd needs-count
-#major {rd = 3}
-
-#device timer at membus
-#device clock at membus
-file arch/kbus/kbus/clock.c # clock timer
-
-device zsc {channel = -1}
-attach zsc at kbus
-file arch/kbus/dev/zs.c zsc needs-flag
-file dev/ic/z8530sc.c zsc
-
-device clock
-attach clock at zsc
-
-device zstty: tty
-attach zstty at zsc
-file dev/ic/z8530tty.c zstty needs-flag
-file arch/skbus/dev/zs_kgdb.c kgdb
-
-# device defined in sys/conf/files
-device sle: ether, ifnet
-attach sle at kbus
-file arch/kbus/dev/if_le.c sle
-file arch/kbus/dev/am7990.c sle
-
-
-include "../../../scsi/files.scsi"
-
-device si: scsi
-attach si at kbus
-file arch/kbus/dev/sbic.c si
-file arch/kbus/dev/sbicdma.c si
-
-
-#define scsi {}
-
-#device ncr at membus: scsi
-#file arch/kbus/dev/ncr.c ncr needs-count
-#device oldncr at membus: scsi
-#file arch/kbus/dev/oldncr.c oldncr needs-count
-#device dp at membus: scsi
-#file arch/kbus/dev/dp.c dp needs-count
-#device aic at membus: scsi
-#file arch/kbus/dev/aic.c aic needs-count
-
-#device scsibus at scsi {target = -1, lun = -1}
-
-#device cd at scsibus: disk
-#file scsi/cd.c cd needs-flag
-#major {cd = 4}
-#device sd at scsibus: disk
-#file scsi/sd.c sd needs-flag
-#major {sd = 0}
-#device st at scsibus: tape
-#file scsi/st.c st needs-flag
-#major {st = 2}
-#device ch at scsibus: disk
-#file scsi/ch.c ch needs-flag
-#device uk at scsibus: disk
-#file scsi/uk.c uk needs-flag
-#device su at scsibus: disk
-#file scsi/su.c su needs-flag
-#device ss at scsibus: tape
-#file scsi/ss.c ss needs-flag
-
-#
-# VME
-#
-device xdc {drive = -1}
-attach xdc at vmes
-device xd: disk
-attach xd at xdc
-file arch/kbus/dev/xd.c xd needs-flag
-
-file dev/cons.c
-#file scsi/scsiconf.c scsi
-#file scsi/scsi_base.c scsi
-#file scsi/scsi_ioctl.c scsi
-file arch/kbus/kbus/autoconf.c
-file arch/kbus/kbus/locore2.c
-file arch/kbus/kbus/db_disasm.c ddb
-file arch/kbus/kbus/db_interface.c ddb
-file arch/kbus/kbus/db_trace.c ddb
-file arch/kbus/kbus/disksubr.c disk
-#file arch/kbus/kbus/icuinit.c
-file arch/kbus/kbus/in_cksum.c inet
-file arch/kbus/kbus/intr.c
-file arch/kbus/kbus/machdep.c
-file arch/kbus/kbus/mem.c
-file arch/kbus/kbus/ns_cksum.c ns
-#file arch/kbus/kbus/ntoh.s
-file arch/kbus/kbus/pmap.c
-file arch/kbus/kbus/process_machdep.c
-#file arch/kbus/kbus/random.s
-file arch/kbus/kbus/sys_machdep.c
-file arch/kbus/kbus/trap.c
-file arch/kbus/kbus/vm_machdep.c
-
-file arch/kbus/fpu/fpu.c
-file arch/kbus/fpu/fpu_add.c
-file arch/kbus/fpu/fpu_compare.c
-file arch/kbus/fpu/fpu_div.c
-file arch/kbus/fpu/fpu_explode.c
-file arch/kbus/fpu/fpu_implode.c
-file arch/kbus/fpu/fpu_mul.c
-file arch/kbus/fpu/fpu_sqrt.c
-file arch/kbus/fpu/fpu_subr.c
-
-# SunOS Binary Compatibility (COMPAT_SUNOS)
-include "../../../compat/sunos/files.sunos"
-file arch/kbus/kbus/sunos_machdep.c compat_sunos
-
-
diff --git a/sys/arch/kbus/dev/am7990.c b/sys/arch/kbus/dev/am7990.c
deleted file mode 100644
index 981090a30a6..00000000000
--- a/sys/arch/kbus/dev/am7990.c
+++ /dev/null
@@ -1,1096 +0,0 @@
-/* $OpenBSD: am7990.c,v 1.3 1999/02/28 05:02:17 jason Exp $ */
-/* $NetBSD: am7990.c,v 1.22 1996/10/13 01:37:19 christos Exp $ */
-
-/*-
- * Copyright (c) 1995 Charles M. Hannum. All rights reserved.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell and Rick Macklem.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)if_le.c 8.2 (Berkeley) 11/16/93
- */
-
-#include "bpfilter.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/syslog.h>
-#include <sys/socket.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-#include <sys/ioctl.h>
-#include <sys/errno.h>
-
-#include <net/if.h>
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-
-#ifdef INET
-#include <netinet/in_systm.h>
-#include <netinet/in_var.h>
-#include <netinet/ip.h>
-#endif
-
-#if NBPFILTER > 0
-#include <net/bpf.h>
-#include <net/bpfdesc.h>
-#endif
-
-#include <machine/ioasic.h>
-#include "am7990reg.h"
-#include "am7990var.h"
-
-#ifdef LEDEBUG
-void am7990_recv_print __P((struct am7990_softc *, int));
-void am7990_xmit_print __P((struct am7990_softc *, int));
-#endif
-
-integrate void am7990_rint __P((struct am7990_softc *));
-integrate void am7990_tint __P((struct am7990_softc *));
-
-integrate int am7990_put __P((struct am7990_softc *, int, struct mbuf *));
-integrate struct mbuf *am7990_get __P((struct am7990_softc *, int, int));
-integrate void am7990_read __P((struct am7990_softc *, int, int));
-
-hide void am7990_shutdown __P((void *));
-
-#define ifp (&sc->sc_arpcom.ac_if)
-
-#if 0 /* XXX what do we do about this?! --thorpej */
-static inline u_int16_t ether_cmp __P((void *, void *));
-
-/*
- * Compare two Ether/802 addresses for equality, inlined and
- * unrolled for speed. I'd love to have an inline assembler
- * version of this... XXX: Who wanted that? mycroft?
- * I wrote one, but the following is just as efficient.
- * This expands to 10 short m68k instructions! -gwr
- * Note: use this like bcmp()
- */
-static inline u_short
-ether_cmp(one, two)
- void *one, *two;
-{
- register u_int16_t *a = (u_short *) one;
- register u_int16_t *b = (u_short *) two;
- register u_int16_t diff;
-
- diff = *a++ - *b++;
- diff |= *a++ - *b++;
- diff |= *a++ - *b++;
-
- return (diff);
-}
-
-#define ETHER_CMP ether_cmp
-#endif /* XXX */
-
-#ifndef ETHER_CMP
-#define ETHER_CMP(a, b) bcmp((a), (b), ETHER_ADDR_LEN)
-#endif
-
-/*
- * am7990 configuration driver. Attachments are provided by
- * machine-dependent driver front-ends.
- */
-struct cfdriver sle_cd = {
- NULL, "le", DV_IFNET
-};
-
-void
-am7990_config(sc)
- struct am7990_softc *sc;
-{
- int mem;
-
- /* Make sure IOASIC is OK. */
- if (!ioasic)
- panic ("am7990_config: IOASIC not mapped");
-
- /* Make sure the chip is stopped. */
- am7990_stop(sc);
-
- /* Initialize ifnet structure. */
- bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ);
- ifp->if_softc = sc;
- ifp->if_start = am7990_start;
- ifp->if_ioctl = am7990_ioctl;
- ifp->if_watchdog = am7990_watchdog;
- ifp->if_flags =
- IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST;
-#ifdef LANCE_REVC_BUG
- ifp->if_flags &= ~IFF_MULTICAST;
-#endif
-
- /* Attach the interface. */
- if_attach(ifp);
- ether_ifattach(ifp);
-
-#if NBPFILTER > 0
- bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
-#endif
-
- sc->sc_nrbuf = 16;
- sc->sc_ntbuf = 4;
-
- printf(": address %s\n", ether_sprintf(sc->sc_arpcom.ac_enaddr));
- printf("%s: %d receive buffers, %d transmit buffers\n",
- sc->sc_dev.dv_xname, sc->sc_nrbuf, sc->sc_ntbuf);
-
- sc->sc_sh = shutdownhook_establish(am7990_shutdown, sc);
- if (sc->sc_sh == NULL)
- panic("am7990_config: can't establish shutdownhook");
-
- mem = 0;
- sc->sc_initaddr = mem;
- mem += sizeof(struct leinit);
- sc->sc_rmdaddr = mem;
- mem += sizeof(struct lermd) * sc->sc_nrbuf;
- sc->sc_tmdaddr = mem;
- mem += sizeof(struct letmd) * sc->sc_ntbuf;
- sc->sc_rbufaddr = mem;
- mem += LEBLEN * sc->sc_nrbuf;
- sc->sc_tbufaddr = 0x8000;
- mem += LEBLEN * sc->sc_ntbuf;
-
- if (mem > sc->sc_memsize)
- panic("am7990_config: mem > memsize");
-}
-
-void
-am7990_reset(sc)
- struct am7990_softc *sc;
-{
- int s;
-
- s = splimp();
- am7990_init(sc);
- splx(s);
-}
-
-/*
- * Set up the initialization block and the descriptor rings.
- */
-void
-am7990_meminit(sc)
- register struct am7990_softc *sc;
-{
- u_long a;
- int bix;
- struct leinit init;
- struct lermd rmd;
- struct letmd tmd;
-
-#if NBPFILTER > 0
- if (ifp->if_flags & IFF_PROMISC)
- init.init_mode = LE_MODE_NORMAL | LE_MODE_PROM;
- else
-#endif
- init.init_mode = LE_MODE_NORMAL;
- init.init_padr[0] =
- (sc->sc_arpcom.ac_enaddr[1] << 8) | sc->sc_arpcom.ac_enaddr[0];
- init.init_padr[1] =
- (sc->sc_arpcom.ac_enaddr[3] << 8) | sc->sc_arpcom.ac_enaddr[2];
- init.init_padr[2] =
- (sc->sc_arpcom.ac_enaddr[5] << 8) | sc->sc_arpcom.ac_enaddr[4];
- am7990_setladrf(&sc->sc_arpcom, init.init_ladrf);
-
- /* Set up ioasic. */
- ioasic->ioasic_ei_rar = sc->sc_addr >> IOASIC_EI_RAR_SHIFT;
- ioasic->ioasic_ei_tar1 = (sc->sc_addr + 0x8000) >> IOASIC_EI_TAR_SHIFT;
- ioasic->ioasic_ei_tar2 = (sc->sc_addr + 0xa000) >> IOASIC_EI_TAR_SHIFT;
-
- sc->sc_last_rd = 0;
- sc->sc_first_td = sc->sc_last_td = sc->sc_no_td = 0;
-
- a = sc->sc_addr + LE_RMDADDR(sc, 0);
- init.init_rdra = (a & 0x1fff) | 0x8000;
- init.init_rlen = (ffs(sc->sc_nrbuf) - 1) << 13;
-
- a = sc->sc_addr + LE_TMDADDR(sc, 0);
- init.init_tdra = (a & 0x1fff) | 0x8000;
- init.init_tlen = (ffs(sc->sc_ntbuf) - 1) << 13;
-
- (*sc->sc_copytodesc)(sc, &init, LE_INITADDR(sc), sizeof(init));
-
-
- /*
- * Set up receive ring descriptors.
- */
- for (bix = 0; bix < sc->sc_nrbuf; bix++) {
- a = sc->sc_addr + LE_RBUFADDR(sc, bix);
- rmd.rmd0 = a & 0x7fff;
- rmd.rmd1_hadr = 0;
- rmd.rmd1_bits = LE_R1_OWN;
- rmd.rmd2 = -LEBLEN | LE_XMD2_ONES;
- rmd.rmd3 = 0;
- (*sc->sc_copytodesc)(sc, &rmd, LE_RMDADDR(sc, bix),
- sizeof(rmd));
- }
-
- /*
- * Set up transmit ring descriptors.
- */
- for (bix = 0; bix < sc->sc_ntbuf; bix++) {
- a = sc->sc_addr + LE_TBUFADDR(sc, bix);
- tmd.tmd0 = (a & 0x3fff) | 0xc000;
- tmd.tmd1_hadr = 0;
- tmd.tmd1_bits = 0;
- tmd.tmd2 = 0 | LE_XMD2_ONES;
- tmd.tmd3 = 0;
- (*sc->sc_copytodesc)(sc, &tmd, LE_TMDADDR(sc, bix),
- sizeof(tmd));
- }
-}
-
-void
-am7990_stop(sc)
- struct am7990_softc *sc;
-{
-
- (*sc->sc_wrcsr)(sc, LE_CSR0, LE_C0_STOP);
-}
-
-/*
- * Initialization of interface; set up initialization block
- * and transmit/receive descriptor rings.
- */
-void
-am7990_init(sc)
- register struct am7990_softc *sc;
-{
- register int timo;
- u_long a;
-
- (*sc->sc_wrcsr)(sc, LE_CSR0, LE_C0_STOP);
- DELAY(100);
-
- /* Set the correct byte swapping mode, etc. */
- (*sc->sc_wrcsr)(sc, LE_CSR3, sc->sc_conf3);
-
- /* Set up LANCE init block. */
- am7990_meminit(sc);
-
- /* Give LANCE the physical address of its init block. */
- a = sc->sc_addr + LE_INITADDR(sc);
- (*sc->sc_wrcsr)(sc, LE_CSR1, (a & 0x7fff) | 0x8000);
- (*sc->sc_wrcsr)(sc, LE_CSR2, 0);
-
- /* Try to initialize the LANCE. */
- DELAY(100);
- (*sc->sc_wrcsr)(sc, LE_CSR0, LE_C0_INIT);
-
- /* Wait for initialization to finish. */
- for (timo = 100000; timo; timo--)
- if ((*sc->sc_rdcsr)(sc, LE_CSR0) & LE_C0_IDON)
- break;
-
- if ((*sc->sc_rdcsr)(sc, LE_CSR0) & LE_C0_IDON) {
- /* Start the LANCE. */
- (*sc->sc_wrcsr)(sc, LE_CSR0, LE_C0_INEA | LE_C0_STRT |
- LE_C0_IDON);
- ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
- ifp->if_timer = 0;
- am7990_start(ifp);
- } else
- panic("%s: card failed to initialize", sc->sc_dev.dv_xname);
- if (sc->sc_hwinit)
- (*sc->sc_hwinit)(sc);
-}
-
-/*
- * Routine to copy from mbuf chain to transmit buffer in
- * network buffer memory.
- */
-integrate int
-am7990_put(sc, boff, m)
- struct am7990_softc *sc;
- int boff;
- register struct mbuf *m;
-{
- register struct mbuf *n;
- register int len, tlen = 0;
-
-#if 0
- printf ("am7990_put: psr=0x%08x, IPR=0x%02x, LIPR=0x%02x\n",
- getpsr(), lda (ASI_IPR, 0) & 0xff,
- lduba (ASI_DGRAM, 0)); /* TG */
-#endif
-
- for (; m; m = n) {
- len = m->m_len;
- if (len == 0) {
- MFREE(m, n);
- continue;
- }
- (*sc->sc_copytobuf)(sc, mtod(m, caddr_t), boff, len);
- boff += len;
- tlen += len;
- MFREE(m, n);
- }
- if (tlen < LEMINSIZE) {
- (*sc->sc_zerobuf)(sc, boff, LEMINSIZE - tlen);
- tlen = LEMINSIZE;
- }
- return (tlen);
-}
-
-/*
- * Pull data off an interface.
- * Len is length of data, with local net header stripped.
- * We copy the data into mbufs. When full cluster sized units are present
- * we copy into clusters.
- */
-integrate struct mbuf *
-am7990_get(sc, boff, totlen)
- struct am7990_softc *sc;
- int boff, totlen;
-{
- register struct mbuf *m;
- struct mbuf *top, **mp;
- int len, pad;
-
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (m == 0)
- return (0);
- m->m_pkthdr.rcvif = ifp;
- m->m_pkthdr.len = totlen;
- pad = ALIGN(sizeof(struct ether_header)) - sizeof(struct ether_header);
- m->m_data += pad;
- len = MHLEN - pad;
- top = 0;
- mp = &top;
-
- while (totlen > 0) {
- if (top) {
- MGET(m, M_DONTWAIT, MT_DATA);
- if (m == 0) {
- m_freem(top);
- return 0;
- }
- len = MLEN;
- }
- if (top && totlen >= MINCLSIZE) {
- MCLGET(m, M_DONTWAIT);
- if (m->m_flags & M_EXT)
- len = MCLBYTES;
- }
- m->m_len = len = min(totlen, len);
- (*sc->sc_copyfrombuf)(sc, mtod(m, caddr_t), boff, len);
- boff += len;
- totlen -= len;
- *mp = m;
- mp = &m->m_next;
- }
-
- return (top);
-}
-
-/*
- * Pass a packet to the higher levels.
- */
-integrate void
-am7990_read(sc, boff, len)
- register struct am7990_softc *sc;
- int boff, len;
-{
- struct mbuf *m;
- struct ether_header *eh;
-
- if (len <= sizeof(struct ether_header) ||
- len > ETHERMTU + sizeof(struct ether_header)) {
-#ifdef LEDEBUG
- printf("%s: invalid packet size %d; dropping\n",
- sc->sc_dev.dv_xname, len);
-#endif
- ifp->if_ierrors++;
- return;
- }
-
- /* Pull packet off interface. */
- m = am7990_get(sc, boff, len);
- if (m == 0) {
- ifp->if_ierrors++;
- return;
- }
-
- ifp->if_ipackets++;
-
- /* We assume that the header fit entirely in one mbuf. */
- eh = mtod(m, struct ether_header *);
-
-#if NBPFILTER > 0
- /*
- * Check if there's a BPF listener on this interface.
- * If so, hand off the raw packet to BPF.
- */
- if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m);
-#endif
-
-#ifdef LANCE_REVC_BUG
- /*
- * The old LANCE (Rev. C) chips have a bug which causes
- * garbage to be inserted in front of the received packet.
- * The work-around is to ignore packets with an invalid
- * destination address (garbage will usually not match).
- * Of course, this precludes multicast support...
- */
- if (ETHER_CMP(eh->ether_dhost, sc->sc_arpcom.ac_enaddr) &&
- ETHER_CMP(eh->ether_dhost, etherbroadcastaddr)) {
- m_freem(m);
- return;
- }
-#endif
-
- /* Pass the packet up, with the ether header sort-of removed. */
- m_adj(m, sizeof(struct ether_header));
-/* printf ("Call ether_input\n"); TG */
- ether_input(ifp, eh, m);
-}
-
-integrate void
-am7990_rint(sc)
- struct am7990_softc *sc;
-{
- register int bix;
- int rp;
- struct lermd rmd;
-
- bix = sc->sc_last_rd;
-
- /* Process all buffers with valid data. */
- for (;;) {
- rp = LE_RMDADDR(sc, bix);
- (*sc->sc_copyfromdesc)(sc, &rmd, rp, sizeof(rmd));
-
- if (rmd.rmd1_bits & LE_R1_OWN)
- break;
-
- if (rmd.rmd1_bits & LE_R1_ERR) {
- if (rmd.rmd1_bits & LE_R1_ENP) {
-#ifdef LEDEBUG
- if ((rmd.rmd1_bits & LE_R1_OFLO) == 0) {
- if (rmd.rmd1_bits & LE_R1_FRAM)
- printf("%s: framing error\n",
- sc->sc_dev.dv_xname);
- if (rmd.rmd1_bits & LE_R1_CRC)
- printf("%s: crc mismatch\n",
- sc->sc_dev.dv_xname);
- }
-#endif
- } else {
- if (rmd.rmd1_bits & LE_R1_OFLO)
- printf("%s: overflow\n",
- sc->sc_dev.dv_xname);
- }
- if (rmd.rmd1_bits & LE_R1_BUFF)
- printf("%s: receive buffer error\n",
- sc->sc_dev.dv_xname);
- ifp->if_ierrors++;
- } else if ((rmd.rmd1_bits & (LE_R1_STP | LE_R1_ENP)) !=
- (LE_R1_STP | LE_R1_ENP)) {
- printf("%s: dropping chained buffer\n",
- sc->sc_dev.dv_xname);
- ifp->if_ierrors++;
- } else {
-#ifdef LEDEBUG
- if (sc->sc_debug)
- am7990_recv_print(sc, sc->sc_last_rd);
-#endif
- am7990_read(sc, LE_RBUFADDR(sc, bix),
- (int)rmd.rmd3 - 4);
- }
-
- rmd.rmd1_bits = LE_R1_OWN;
- rmd.rmd2 = -LEBLEN | LE_XMD2_ONES;
- rmd.rmd3 = 0;
- (*sc->sc_copytodesc)(sc, &rmd, rp, sizeof(rmd));
-
-#ifdef LEDEBUG
- if (sc->sc_debug)
- printf("sc->sc_last_rd = %x, rmd: "
- "ladr %04x, hadr %02x, flags %02x, "
- "bcnt %04x, mcnt %04x\n",
- sc->sc_last_rd,
- rmd.rmd0, rmd.rmd1_hadr, rmd.rmd1_bits,
- rmd.rmd2, rmd.rmd3);
-#endif
-
- if (++bix == sc->sc_nrbuf)
- bix = 0;
- }
-
- sc->sc_last_rd = bix;
-}
-
-integrate void
-am7990_tint(sc)
- register struct am7990_softc *sc;
-{
- register int bix;
- struct letmd tmd;
-
- bix = sc->sc_first_td;
-
- for (;;) {
- if (sc->sc_no_td <= 0)
- break;
-
-#ifdef LEDEBUG
- if (sc->sc_debug)
- printf("trans tmd: "
- "ladr %04x, hadr %02x, flags %02x, "
- "bcnt %04x, mcnt %04x\n",
- tmd.tmd0, tmd.tmd1_hadr, tmd.tmd1_bits,
- tmd.tmd2, tmd.tmd3);
-#endif
-
- (*sc->sc_copyfromdesc)(sc, &tmd, LE_TMDADDR(sc, bix),
- sizeof(tmd));
-
- if (tmd.tmd1_bits & LE_T1_OWN)
- break;
-
- ifp->if_flags &= ~IFF_OACTIVE;
-
- if (tmd.tmd1_bits & LE_T1_ERR) {
- if (tmd.tmd3 & LE_T3_BUFF)
- printf("%s: transmit buffer error\n",
- sc->sc_dev.dv_xname);
- else if (tmd.tmd3 & LE_T3_UFLO)
- printf("%s: underflow\n", sc->sc_dev.dv_xname);
- if (tmd.tmd3 & (LE_T3_BUFF | LE_T3_UFLO)) {
- am7990_reset(sc);
- return;
- }
- if (tmd.tmd3 & LE_T3_LCAR) {
- if (sc->sc_nocarrier)
- (*sc->sc_nocarrier)(sc);
- else
- printf("%s: lost carrier\n",
- sc->sc_dev.dv_xname);
- }
- if (tmd.tmd3 & LE_T3_LCOL)
- ifp->if_collisions++;
- if (tmd.tmd3 & LE_T3_RTRY) {
- printf("%s: excessive collisions, tdr %d\n",
- sc->sc_dev.dv_xname,
- tmd.tmd3 & LE_T3_TDR_MASK);
- ifp->if_collisions += 16;
- }
- ifp->if_oerrors++;
- } else {
- if (tmd.tmd1_bits & LE_T1_ONE)
- ifp->if_collisions++;
- else if (tmd.tmd1_bits & LE_T1_MORE)
- /* Real number is unknown. */
- ifp->if_collisions += 2;
- ifp->if_opackets++;
- }
-
- if (++bix == sc->sc_ntbuf)
- bix = 0;
-
- --sc->sc_no_td;
- }
-
- sc->sc_first_td = bix;
-
- am7990_start(ifp);
-
- if (sc->sc_no_td == 0)
- ifp->if_timer = 0;
-}
-
-/*
- * Controller interrupt.
- */
-int
-am7990_intr(arg)
- register void *arg;
-{
- register struct am7990_softc *sc = arg;
- register u_int16_t isr;
-
- isr = (*sc->sc_rdcsr)(sc, LE_CSR0);
- if ((isr & LE_C0_INTR) == 0)
- return (0);
-
-#ifdef LEDEBUG
- if (sc->sc_debug)
- printf("%s: am7990_intr entering with isr=%04x\n",
- sc->sc_dev.dv_xname, isr);
-#endif
-
- (*sc->sc_wrcsr)(sc, LE_CSR0,
- isr & (LE_C0_INEA | LE_C0_BABL | LE_C0_MISS | LE_C0_MERR |
- LE_C0_RINT | LE_C0_TINT | LE_C0_IDON));
- if (isr & LE_C0_ERR) {
- if (isr & LE_C0_BABL) {
-#ifdef LEDEBUG
- printf("%s: babble\n", sc->sc_dev.dv_xname);
-#endif
- ifp->if_oerrors++;
- }
-#if 0
- if (isr & LE_C0_CERR) {
- printf("%s: collision error\n", sc->sc_dev.dv_xname);
- ifp->if_collisions++;
- }
-#endif
- if (isr & LE_C0_MISS) {
-#ifdef LEDEBUG
- printf("%s: missed packet\n", sc->sc_dev.dv_xname);
-#endif
- ifp->if_ierrors++;
- }
- if (isr & LE_C0_MERR) {
- printf("%s: memory error\n", sc->sc_dev.dv_xname);
- am7990_reset(sc);
- return (1);
- }
- }
-
- if ((isr & LE_C0_RXON) == 0) {
- printf("%s: receiver disabled\n", sc->sc_dev.dv_xname);
- ifp->if_ierrors++;
- am7990_reset(sc);
- return (1);
- }
- if ((isr & LE_C0_TXON) == 0) {
- printf("%s: transmitter disabled\n", sc->sc_dev.dv_xname);
- ifp->if_oerrors++;
- am7990_reset(sc);
- return (1);
- }
-
- if (isr & LE_C0_RINT)
- am7990_rint(sc);
- if (isr & LE_C0_TINT)
- am7990_tint(sc);
-
- return (1);
-}
-
-#undef ifp
-
-void
-am7990_watchdog(ifp)
- struct ifnet *ifp;
-{
- struct am7990_softc *sc = ifp->if_softc;
-
- log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname);
- ++ifp->if_oerrors;
-
- am7990_reset(sc);
-}
-
-/*
- * Setup output on interface.
- * Get another datagram to send off of the interface queue, and map it to the
- * interface before starting the output.
- * Called only at splimp or interrupt level.
- */
-void
-am7990_start(ifp)
- register struct ifnet *ifp;
-{
- register struct am7990_softc *sc = ifp->if_softc;
- register int bix;
- register struct mbuf *m;
- struct letmd tmd;
- int rp;
- int len;
-
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
- return;
-
- bix = sc->sc_last_td;
-
- for (;;) {
- rp = LE_TMDADDR(sc, bix);
- (*sc->sc_copyfromdesc)(sc, &tmd, rp, sizeof(tmd));
-
- if (tmd.tmd1_bits & LE_T1_OWN) {
- ifp->if_flags |= IFF_OACTIVE;
- printf("missing buffer, no_td = %d, last_td = %d\n",
- sc->sc_no_td, sc->sc_last_td);
- }
-
- IF_DEQUEUE(&ifp->if_snd, m);
- if (m == 0)
- break;
-
-#if NBPFILTER > 0
- /*
- * If BPF is listening on this interface, let it see the packet
- * before we commit it to the wire.
- */
- if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m);
-#endif
-
- /*
- * Copy the mbuf chain into the transmit buffer.
- */
- len = am7990_put(sc, LE_TBUFADDR(sc, bix), m);
-
-#ifdef LEDEBUG
- if (len > ETHERMTU + sizeof(struct ether_header))
- printf("packet length %d\n", len);
-#endif
-
- ifp->if_timer = 5;
-
- /*
- * Init transmit registers, and set transmit start flag.
- */
- tmd.tmd1_bits = LE_T1_OWN | LE_T1_STP | LE_T1_ENP;
- tmd.tmd2 = -len | LE_XMD2_ONES;
- tmd.tmd3 = 0;
-
- (*sc->sc_copytodesc)(sc, &tmd, rp, sizeof(tmd));
-
-#ifdef LEDEBUG
- if (sc->sc_debug)
- am7990_xmit_print(sc, sc->sc_last_td);
-#endif
-
- (*sc->sc_wrcsr)(sc, LE_CSR0, LE_C0_INEA | LE_C0_TDMD);
-
- if (++bix == sc->sc_ntbuf)
- bix = 0;
-
- if (++sc->sc_no_td == sc->sc_ntbuf) {
- ifp->if_flags |= IFF_OACTIVE;
- break;
- }
-
- }
-
- sc->sc_last_td = bix;
-}
-
-/*
- * Process an ioctl request.
- */
-int
-am7990_ioctl(ifp, cmd, data)
- register struct ifnet *ifp;
- u_long cmd;
- caddr_t data;
-{
- register struct am7990_softc *sc = ifp->if_softc;
- struct ifaddr *ifa = (struct ifaddr *)data;
- struct ifreq *ifr = (struct ifreq *)data;
- int s, error = 0;
-
- s = splimp();
-
- if ((error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data)) > 0) {
- splx(s);
- return error;
- }
-
- switch (cmd) {
-
- case SIOCSIFADDR:
- ifp->if_flags |= IFF_UP;
-
- switch (ifa->ifa_addr->sa_family) {
-#ifdef INET
- case AF_INET:
- am7990_init(sc);
- arp_ifinit(&sc->sc_arpcom, ifa);
- break;
-#endif
- default:
- am7990_init(sc);
- break;
- }
- break;
-
- case SIOCSIFFLAGS:
- if ((ifp->if_flags & IFF_UP) == 0 &&
- (ifp->if_flags & IFF_RUNNING) != 0) {
- /*
- * If interface is marked down and it is running, then
- * stop it.
- */
- am7990_stop(sc);
- ifp->if_flags &= ~IFF_RUNNING;
- } else if ((ifp->if_flags & IFF_UP) != 0 &&
- (ifp->if_flags & IFF_RUNNING) == 0) {
- /*
- * If interface is marked up and it is stopped, then
- * start it.
- */
- am7990_init(sc);
- } else {
- /*
- * Reset the interface to pick up changes in any other
- * flags that affect hardware registers.
- */
- /*am7990_stop(sc);*/
- am7990_init(sc);
- }
-#if 0 /* def LEDEBUG */
- if (ifp->if_flags & IFF_DEBUG)
- sc->sc_debug = 1;
- else
- sc->sc_debug = 0;
-#endif
- break;
-
- case SIOCADDMULTI:
- case SIOCDELMULTI:
- error = (cmd == SIOCADDMULTI) ?
- ether_addmulti(ifr, &sc->sc_arpcom) :
- ether_delmulti(ifr, &sc->sc_arpcom);
-
- if (error == ENETRESET) {
- /*
- * Multicast list has changed; set the hardware filter
- * accordingly.
- */
- am7990_reset(sc);
- error = 0;
- }
- break;
-
- default:
- error = EINVAL;
- break;
- }
-
- splx(s);
- return (error);
-}
-
-hide void
-am7990_shutdown(arg)
- void *arg;
-{
-
- am7990_stop((struct am7990_softc *)arg);
-}
-
-#ifdef LEDEBUG
-void
-am7990_recv_print(sc, no)
- struct am7990_softc *sc;
- int no;
-{
- struct lermd rmd;
- u_int16_t len;
- struct ether_header eh;
-
- (*sc->sc_copyfromdesc)(sc, &rmd, LE_RMDADDR(sc, no), sizeof(rmd));
- len = rmd.rmd3;
- printf("%s: receive buffer %d, len = %d\n", sc->sc_dev.dv_xname, no,
- len);
- printf("%s: status %04x\n", sc->sc_dev.dv_xname,
- (*sc->sc_rdcsr)(sc, LE_CSR0));
- printf("%s: ladr %04x, hadr %02x, flags %02x, bcnt %04x, mcnt %04x\n",
- sc->sc_dev.dv_xname,
- rmd.rmd0, rmd.rmd1_hadr, rmd.rmd1_bits, rmd.rmd2, rmd.rmd3);
- if (len >= sizeof(eh)) {
- (*sc->sc_copyfrombuf)(sc, &eh, LE_RBUFADDR(sc, no), sizeof(eh));
- printf("%s: dst %s", sc->sc_dev.dv_xname,
- ether_sprintf(eh.ether_dhost));
- printf(" src %s type %04x\n", ether_sprintf(eh.ether_shost),
- ntohs(eh.ether_type));
- }
-}
-
-void
-am7990_xmit_print(sc, no)
- struct am7990_softc *sc;
- int no;
-{
- struct letmd tmd;
- u_int16_t len;
- struct ether_header eh;
-
- (*sc->sc_copyfromdesc)(sc, &tmd, LE_TMDADDR(sc, no), sizeof(tmd));
- len = -tmd.tmd2;
- printf("%s: transmit buffer %d, len = %d\n", sc->sc_dev.dv_xname, no,
- len);
- printf("%s: status %04x\n", sc->sc_dev.dv_xname,
- (*sc->sc_rdcsr)(sc, LE_CSR0));
- printf("%s: ladr %04x, hadr %02x, flags %02x, bcnt %04x, mcnt %04x\n",
- sc->sc_dev.dv_xname,
- tmd.tmd0, tmd.tmd1_hadr, tmd.tmd1_bits, tmd.tmd2, tmd.tmd3);
- if (len >= sizeof(eh)) {
- (*sc->sc_copyfrombuf)(sc, &eh, LE_TBUFADDR(sc, no), sizeof(eh));
- printf("%s: dst %s", sc->sc_dev.dv_xname,
- ether_sprintf(eh.ether_dhost));
- printf(" src %s type %04x\n", ether_sprintf(eh.ether_shost),
- ntohs(eh.ether_type));
- }
-}
-#endif /* LEDEBUG */
-
-/*
- * Set up the logical address filter.
- */
-void
-am7990_setladrf(ac, af)
- struct arpcom *ac;
- u_int16_t *af;
-{
- struct ifnet *ifp = &ac->ac_if;
- struct ether_multi *enm;
- register u_char *cp, c;
- register u_int32_t crc;
- register int i, len;
- struct ether_multistep step;
-
- /*
- * Set up multicast address filter by passing all multicast addresses
- * through a crc generator, and then using the high order 6 bits as an
- * index into the 64 bit logical address filter. The high order bit
- * selects the word, while the rest of the bits select the bit within
- * the word.
- */
-
- if (ifp->if_flags & IFF_PROMISC)
- goto allmulti;
-
- af[0] = af[1] = af[2] = af[3] = 0x0000;
- ETHER_FIRST_MULTI(step, ac, enm);
- while (enm != NULL) {
- if (ETHER_CMP(enm->enm_addrlo, enm->enm_addrhi)) {
- /*
- * We must listen to a range of multicast addresses.
- * For now, just accept all multicasts, rather than
- * trying to set only those filter bits needed to match
- * the range. (At this time, the only use of address
- * ranges is for IP multicast routing, for which the
- * range is big enough to require all bits set.)
- */
- goto allmulti;
- }
-
- cp = enm->enm_addrlo;
- crc = 0xffffffff;
- for (len = sizeof(enm->enm_addrlo); --len >= 0;) {
- c = *cp++;
- for (i = 8; --i >= 0;) {
- if ((crc & 0x01) ^ (c & 0x01)) {
- crc >>= 1;
- crc ^= 0xedb88320;
- } else
- crc >>= 1;
- c >>= 1;
- }
- }
- /* Just want the 6 most significant bits. */
- crc >>= 26;
-
- /* Set the corresponding bit in the filter. */
- af[crc >> 4] |= 1 << (crc & 0xf);
-
- ETHER_NEXT_MULTI(step, enm);
- }
- ifp->if_flags &= ~IFF_ALLMULTI;
- return;
-
-allmulti:
- ifp->if_flags |= IFF_ALLMULTI;
- af[0] = af[1] = af[2] = af[3] = 0xffff;
-}
-
-
-/*
- * Routines for accessing the transmit and receive buffers.
- * The various CPU and adapter configurations supported by this
- * driver require three different access methods for buffers
- * and descriptors:
- * (1) contig (contiguous data; no padding),
- * (2) gap2 (two bytes of data followed by two bytes of padding),
- * (3) gap16 (16 bytes of data followed by 16 bytes of padding).
- */
-
-/*
- * contig: contiguous data with no padding.
- *
- * Buffers may have any alignment.
- */
-
-void
-am7990_copytobuf_contig(sc, from, boff, len)
- struct am7990_softc *sc;
- void *from;
- int boff, len;
-{
- volatile caddr_t buf = sc->sc_mem;
-
-/* printf ("Copytobuf: %p -> %p\n", from, buf + boff); */
- /*
- * Just call bcopy() to do the work.
- */
- bcopy(from, buf + boff, len);
-}
-
-void
-am7990_copyfrombuf_contig(sc, to, boff, len)
- struct am7990_softc *sc;
- void *to;
- int boff, len;
-{
- volatile caddr_t buf = sc->sc_mem;
-
- /*
- * Just call bcopy() to do the work.
- */
- bcopy(buf + boff, to, len);
-}
-
-void
-am7990_zerobuf_contig(sc, boff, len)
- struct am7990_softc *sc;
- int boff, len;
-{
- volatile caddr_t buf = sc->sc_mem;
-
- /*
- * Just let bzero() do the work
- */
- bzero(buf + boff, len);
-}
-
diff --git a/sys/arch/kbus/dev/am7990reg.h b/sys/arch/kbus/dev/am7990reg.h
deleted file mode 100644
index e7b09989026..00000000000
--- a/sys/arch/kbus/dev/am7990reg.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/* $OpenBSD: am7990reg.h,v 1.2 2000/12/21 16:54:54 aaron Exp $ */
-/* $NetBSD: am7990reg.h,v 1.1 1995/04/11 04:17:50 mycroft Exp $ */
-
-/*-
- * Copyright (c) 1995 Charles M. Hannum. All rights reserved.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell and Rick Macklem.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)if_lereg.h 8.1 (Berkeley) 6/10/93
- */
-
-#define LEBLEN 1536 /* ETHERMTU + header + CRC */
-#define LEMINSIZE 60 /* should be 64 if mode DTCR is set */
-
-/*
- * Receive message descriptor
- */
-struct lermd {
- u_int16_t rmd0;
-#if BYTE_ORDER == BIG_ENDIAN
- u_int8_t rmd1_bits;
- u_int8_t rmd1_hadr;
-#else
- u_int8_t rmd1_hadr;
- u_int8_t rmd1_bits;
-#endif
- int16_t rmd2;
- u_int16_t rmd3;
-};
-
-/*
- * Transmit message descriptor
- */
-struct letmd {
- u_int16_t tmd0;
-#if BYTE_ORDER == BIG_ENDIAN
- u_int8_t tmd1_bits;
- u_int8_t tmd1_hadr;
-#else
- u_int8_t tmd1_hadr;
- u_int8_t tmd1_bits;
-#endif
- int16_t tmd2;
- u_int16_t tmd3;
-};
-
-/*
- * Initialization block
- */
-struct leinit {
- u_int16_t init_mode; /* +0x0000 */
- u_int16_t init_padr[3]; /* +0x0002 */
- u_int16_t init_ladrf[4]; /* +0x0008 */
- u_int16_t init_rdra; /* +0x0010 */
- u_int16_t init_rlen; /* +0x0012 */
- u_int16_t init_tdra; /* +0x0014 */
- u_int16_t init_tlen; /* +0x0016 */
- int16_t pad0[4]; /* Pad to 16 shorts */
-};
-
-#define LE_INITADDR(sc) (sc->sc_initaddr)
-#define LE_RMDADDR(sc, bix) (sc->sc_rmdaddr + sizeof(struct lermd) * (bix))
-#define LE_TMDADDR(sc, bix) (sc->sc_tmdaddr + sizeof(struct letmd) * (bix))
-#define LE_RBUFADDR(sc, bix) (sc->sc_rbufaddr + LEBLEN * (bix))
-#define LE_TBUFADDR(sc, bix) (sc->sc_tbufaddr + LEBLEN * (bix))
-
-/* register addresses */
-#define LE_CSR0 0x0000 /* Control and status register */
-#define LE_CSR1 0x0001 /* low address of init block */
-#define LE_CSR2 0x0002 /* high address of init block */
-#define LE_CSR3 0x0003 /* Bus master and control */
-
-/* Control and status register 0 (csr0) */
-#define LE_C0_ERR 0x8000 /* error summary */
-#define LE_C0_BABL 0x4000 /* transmitter timeout error */
-#define LE_C0_CERR 0x2000 /* collision */
-#define LE_C0_MISS 0x1000 /* missed a packet */
-#define LE_C0_MERR 0x0800 /* memory error */
-#define LE_C0_RINT 0x0400 /* receiver interrupt */
-#define LE_C0_TINT 0x0200 /* transmitter interrupt */
-#define LE_C0_IDON 0x0100 /* initialization done */
-#define LE_C0_INTR 0x0080 /* interrupt condition */
-#define LE_C0_INEA 0x0040 /* interrupt enable */
-#define LE_C0_RXON 0x0020 /* receiver on */
-#define LE_C0_TXON 0x0010 /* transmitter on */
-#define LE_C0_TDMD 0x0008 /* transmit demand */
-#define LE_C0_STOP 0x0004 /* disable all external activity */
-#define LE_C0_STRT 0x0002 /* enable external activity */
-#define LE_C0_INIT 0x0001 /* begin initialization */
-
-#define LE_C0_BITS \
- "\20\20ERR\17BABL\16CERR\15MISS\14MERR\13RINT\
-\12TINT\11IDON\10INTR\07INEA\06RXON\05TXON\04TDMD\03STOP\02STRT\01INIT"
-
-/* Control and status register 3 (csr3) */
-#define LE_C3_BSWP 0x0004 /* byte swap */
-#define LE_C3_ACON 0x0002 /* ALE control, eh? */
-#define LE_C3_BCON 0x0001 /* byte control */
-
-/* Initialzation block (mode) */
-#define LE_MODE_PROM 0x8000 /* promiscuous mode */
-/* 0x7f80 reserved, must be zero */
-#define LE_MODE_INTL 0x0040 /* internal loopback */
-#define LE_MODE_DRTY 0x0020 /* disable retry */
-#define LE_MODE_COLL 0x0010 /* force a collision */
-#define LE_MODE_DTCR 0x0008 /* disable transmit CRC */
-#define LE_MODE_LOOP 0x0004 /* loopback mode */
-#define LE_MODE_DTX 0x0002 /* disable transmitter */
-#define LE_MODE_DRX 0x0001 /* disable receiver */
-#define LE_MODE_NORMAL 0 /* none of the above */
-
-/* Receive message descriptor 1 (rmd1_bits) */
-#define LE_R1_OWN 0x80 /* LANCE owns the packet */
-#define LE_R1_ERR 0x40 /* error summary */
-#define LE_R1_FRAM 0x20 /* framing error */
-#define LE_R1_OFLO 0x10 /* overflow error */
-#define LE_R1_CRC 0x08 /* CRC error */
-#define LE_R1_BUFF 0x04 /* buffer error */
-#define LE_R1_STP 0x02 /* start of packet */
-#define LE_R1_ENP 0x01 /* end of packet */
-
-#define LE_R1_BITS \
- "\20\10OWN\7ERR\6FRAM\5OFLO\4CRC\3BUFF\2STP\1ENP"
-
-/* Transmit message descriptor 1 (tmd1_bits) */
-#define LE_T1_OWN 0x80 /* LANCE owns the packet */
-#define LE_T1_ERR 0x40 /* error summary */
-#define LE_T1_MORE 0x10 /* multiple collisions */
-#define LE_T1_ONE 0x08 /* single collision */
-#define LE_T1_DEF 0x04 /* defferred transmit */
-#define LE_T1_STP 0x02 /* start of packet */
-#define LE_T1_ENP 0x01 /* end of packet */
-
-#define LE_T1_BITS \
- "\20\10OWN\7ERR\6RES\5MORE\4ONE\3DEF\2STP\1ENP"
-
-/* Transmit message descriptor 3 (tmd3) */
-#define LE_T3_BUFF 0x8000 /* buffer error */
-#define LE_T3_UFLO 0x4000 /* underflow error */
-#define LE_T3_LCOL 0x1000 /* late collision */
-#define LE_T3_LCAR 0x0800 /* loss of carrier */
-#define LE_T3_RTRY 0x0400 /* retry error */
-#define LE_T3_TDR_MASK 0x03ff /* time domain reflectometry counter */
-
-#define LE_XMD2_ONES 0xf000
-
-#define LE_T3_BITS \
- "\20\20BUFF\17UFLO\16RES\15LCOL\14LCAR\13RTRY"
diff --git a/sys/arch/kbus/dev/am7990var.h b/sys/arch/kbus/dev/am7990var.h
deleted file mode 100644
index 6f4586f2bbf..00000000000
--- a/sys/arch/kbus/dev/am7990var.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/* $OpenBSD: am7990var.h,v 1.1.1.1 1997/10/14 07:25:30 gingold Exp $ */
-/* $NetBSD: am7990var.h,v 1.8 1996/07/05 23:57:01 abrown Exp $ */
-
-/*
- * Copyright (c) 1995 Charles M. Hannum. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles M. Hannum.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifdef DDB
-#define integrate
-#define hide
-#else
-#define integrate static __inline
-#define hide static
-#endif
-
-/*
- * Ethernet software status per device.
- *
- * Each interface is referenced by a network interface structure,
- * arpcom.ac_if, which the routing code uses to locate the interface.
- * This structure contains the output queue for the interface, its address, ...
- *
- * NOTE: this structure MUST be the first element in machine-dependent
- * le_softc structures! This is designed SPECIFICALLY to make it possible
- * to simply cast a "void *" to "struct le_softc *" or to
- * "struct am7990_softc *". Among other things, this saves a lot of hair
- * in the interrupt handlers.
- */
-struct am7990_softc {
- struct device sc_dev; /* base device glue */
- struct arpcom sc_arpcom; /* Ethernet common part */
-
- /*
- * Memory functions:
- *
- * copy to/from descriptor
- * copy to/from buffer
- * zero bytes in buffer
- */
- void (*sc_copytodesc)
- __P((struct am7990_softc *, void *, int, int));
- void (*sc_copyfromdesc)
- __P((struct am7990_softc *, void *, int, int));
- void (*sc_copytobuf)
- __P((struct am7990_softc *, void *, int, int));
- void (*sc_copyfrombuf)
- __P((struct am7990_softc *, void *, int, int));
- void (*sc_zerobuf)
- __P((struct am7990_softc *, int, int));
-
- /*
- * Machine-dependent functions:
- *
- * read/write CSR
- * hardware init hook - may be NULL
- * no carrier hook - may be NULL
- */
- u_int16_t (*sc_rdcsr)
- __P((struct am7990_softc *, u_int16_t));
- void (*sc_wrcsr)
- __P((struct am7990_softc *, u_int16_t, u_int16_t));
- void (*sc_hwinit) __P((struct am7990_softc *));
- void (*sc_nocarrier) __P((struct am7990_softc *));
-
- void *sc_sh; /* shutdownhook cookie */
-
- u_int16_t sc_conf3; /* CSR3 value */
-
- void *sc_mem; /* base address of RAM -- CPU's view */
- u_long sc_addr; /* base address of RAM -- LANCE's view */
-
- u_long sc_memsize; /* size of RAM */
-
- int sc_nrbuf; /* number of receive buffers */
- int sc_ntbuf; /* number of transmit buffers */
- int sc_last_rd;
- int sc_first_td, sc_last_td, sc_no_td;
-
- int sc_initaddr;
- int sc_rmdaddr;
- int sc_tmdaddr;
- int sc_rbufaddr;
- int sc_tbufaddr;
-
-#ifdef LEDEBUG
- int sc_debug;
-#endif
-};
-
-/* Export this to machine-dependent drivers. */
-extern struct cfdriver le_cd;
-
-void am7990_config __P((struct am7990_softc *));
-void am7990_init __P((struct am7990_softc *));
-int am7990_ioctl __P((struct ifnet *, u_long, caddr_t));
-void am7990_meminit __P((struct am7990_softc *));
-void am7990_reset __P((struct am7990_softc *));
-void am7990_setladrf __P((struct arpcom *, u_int16_t *));
-void am7990_start __P((struct ifnet *));
-void am7990_stop __P((struct am7990_softc *));
-void am7990_watchdog __P((struct ifnet *));
-int am7990_intr __P((void *));
-
-/*
- * The following functions are only useful on certain cpu/bus
- * combinations. They should be written in assembly language for
- * maximum efficiency, but machine-independent versions are provided
- * for drivers that have not yet been optimized.
- */
-void am7990_copytobuf_contig __P((struct am7990_softc *, void *, int, int));
-void am7990_copyfrombuf_contig __P((struct am7990_softc *, void *, int, int));
-void am7990_zerobuf_contig __P((struct am7990_softc *, int, int));
-
-#if 0 /* Example only - see am7990.c */
-void am7990_copytobuf_gap2 __P((struct am7990_softc *, void *, int, int));
-void am7990_copyfrombuf_gap2 __P((struct am7990_softc *, void *, int, int));
-void am7990_zerobuf_gap2 __P((struct am7990_softc *, int, int));
-
-void am7990_copytobuf_gap16 __P((struct am7990_softc *, void *, int, int));
-void am7990_copyfrombuf_gap16 __P((struct am7990_softc *, void *, int, int));
-void am7990_zerobuf_gap16 __P((struct am7990_softc *, int, int));
-#endif /* Example only */
diff --git a/sys/arch/kbus/dev/dmavar.h b/sys/arch/kbus/dev/dmavar.h
deleted file mode 100644
index 83ffa77b589..00000000000
--- a/sys/arch/kbus/dev/dmavar.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $OpenBSD: dmavar.h,v 1.1.1.1 1997/10/14 07:25:30 gingold Exp $ */
-
-/*
- * Copyright (c) 1982, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dmavar.h 7.2 (Berkeley) 11/4/90
- */
-
-/* dmago flags */
-#define DMAGO_READ 0x08 /* transfer is a read */
-#define DMAGO_NOINT 0x80 /* don't interrupt on completion */
-
-#ifdef _KERNEL
-typedef void (*dmafree_t) (void *dev);
-typedef int (*dmago_t) (void *dev, char *, int, int);
-typedef int (*dmanext_t) (void *dev);
-typedef void (*dmastop_t) (void *dev);
-#endif
diff --git a/sys/arch/kbus/dev/if_le.c b/sys/arch/kbus/dev/if_le.c
deleted file mode 100644
index 3ec005410fc..00000000000
--- a/sys/arch/kbus/dev/if_le.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/* $OpenBSD: if_le.c,v 1.2 1998/09/16 22:41:18 jason Exp $ */
-/* $NetBSD: if_le.c,v 1.33 1996/11/20 18:56:52 gwr Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Adam Glass and Gordon W. Ross.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "bpfilter.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/syslog.h>
-#include <sys/socket.h>
-#include <sys/device.h>
-
-#include <net/if.h>
-#include <net/if_media.h>
-
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-#include <machine/prom.h>
-#include <machine/ioasic.h>
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-
-#include "am7990reg.h"
-#include "am7990var.h"
-
-static char *le_pages[2 * 0x8000 + 2 * 0x2000];
-
-/*
- * LANCE registers.
- * The real stuff is in dev/ic/am7990reg.h
- */
-struct lereg1 {
- volatile u_int16_t ler1_rdp; /* data port */
- char pad0 [30];
- volatile u_int16_t ler1_rap; /* register select port */
- char pad1 [30];
-};
-
-/*
- * Ethernet software status per interface.
- * The real stuff is in dev/ic/am7990var.h
- */
-struct le_softc {
- struct am7990_softc sc_am7990; /* glue to MI code */
-
- struct lereg1 *sc_r1; /* LANCE registers */
-};
-
-static int le_match __P((struct device *, void *, void *));
-static void le_attach __P((struct device *, struct device *, void *));
-
-struct cfattach sle_ca = {
- sizeof(struct le_softc), le_match, le_attach
-};
-
-hide void lewrcsr __P((struct am7990_softc *, u_int16_t, u_int16_t));
-hide u_int16_t lerdcsr __P((struct am7990_softc *, u_int16_t));
-
-hide void
-lewrcsr(sc, port, val)
- struct am7990_softc *sc;
- u_int16_t port, val;
-{
- register struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1;
-
- ler1->ler1_rap = port;
- ler1->ler1_rdp = val;
-}
-
-hide u_int16_t
-lerdcsr(sc, port)
- struct am7990_softc *sc;
- u_int16_t port;
-{
- register struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1;
- u_int16_t val;
-
- ler1->ler1_rap = port;
- val = ler1->ler1_rdp;
- return (val);
-}
-
-int
-le_match(parent, vcf, aux)
- struct device *parent;
- void *vcf, *aux;
-{
- struct confargs *ca = aux;
-
- if (ca->ca_paddr != LANCE_ADDR)
- return 0;
-
- /* Make sure there is something there... */
- if (bus_peek(ca->ca_bustype, ca->ca_paddr, 1) == -1)
- return (0);
-
- /* Default interrupt priority. */
- if (ca->ca_intpri == -1)
- ca->ca_intpri = 3;
-
- return (1);
-}
-
-static struct intrhand levelhard = {am7990_intr};
-
-void
-le_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct le_softc *lesc = (struct le_softc *)self;
- struct am7990_softc *sc = &lesc->sc_am7990;
-
- if (!ioasic)
- panic ("IOASIC not mapped");
- lesc->sc_r1 = (struct lereg1 *)((char *)ioasic + LANCE_OFFSET);
-
- sc->sc_memsize = 0xa000; /* 40K */
- sc->sc_mem = (void *)(((u_long)le_pages + 0x7fff) & 0xffff8000);
- sc->sc_addr = (u_long)sc->sc_mem & 0xffffff;
- sc->sc_conf3 = LE_C3_BSWP;
-
- idprom_etheraddr(sc->sc_arpcom.ac_enaddr);
-
- sc->sc_copytodesc = am7990_copytobuf_contig;
- sc->sc_copyfromdesc = am7990_copyfrombuf_contig;
- sc->sc_copytobuf = am7990_copytobuf_contig;
- sc->sc_copyfrombuf = am7990_copyfrombuf_contig;
- sc->sc_zerobuf = am7990_zerobuf_contig;
-
- sc->sc_rdcsr = lerdcsr;
- sc->sc_wrcsr = lewrcsr;
- sc->sc_hwinit = NULL;
-#ifdef LEDEBUG
- sc->sc_debug = 0;
-#endif
-
- am7990_config(sc);
-
- /* Install interrupt handler. */
- levelhard.ih_arg = (void *)sc;
- intr_establish (INTR_LANCE, IH_CAN_DELAY, &levelhard);
-/* isr_add_autovect(am7990_intr, (void *)sc, ca->ca_intpri); */
-}
diff --git a/sys/arch/kbus/dev/kbus.c b/sys/arch/kbus/dev/kbus.c
deleted file mode 100644
index ee081fc6be7..00000000000
--- a/sys/arch/kbus/dev/kbus.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/* $OpenBSD: kbus.c,v 1.2 1999/01/11 05:11:27 millert Exp $ */
-/* $NetBSD: kbus.c,v 1.23 1996/11/20 18:56:56 gwr Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Adam Glass and Gordon W. Ross.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/kbus.h>
-#include <machine/ioasic.h>
-
-static int kbus_match __P((struct device *, void *, void *));
-static void kbus_attach __P((struct device *, struct device *, void *));
-static int ioasic_intr __P((void *arg));
-
-#if 0
-static int kbus_print __P((void *, const char *parentname));
-static int kbus_submatch __P((struct device *, void *, void *));
-#endif
-
-struct cfattach kbus_ca = {
- sizeof(struct device), kbus_match, kbus_attach
-};
-
-struct cfdriver kbus_cd = {
- NULL, "kbus", DV_DULL
-};
-
-/* A mapped page for IOASIC. */
-struct ioasic_reg *ioasic;
-
-static struct intrhand ioasic_intrhand = {ioasic_intr};
-
-static int
-kbus_match(parent, vcf, aux)
- struct device *parent;
- void *vcf, *aux;
-{
- struct confargs *ca = aux;
-
- if (ca->ca_bustype != BUS_KBUS)
- return (0);
- return(1);
-}
-
-static void
-kbus_attach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- if (!ioasic)
- {
- ioasic = (struct ioasic_reg *)
- bus_mapin (BUS_KBUS, IOASIC_ADDR, IOASIC_SIZE);
- if (!ioasic)
- panic ("Cannot map IOASIC");
- intr_establish (INTR_IOASIC, 0, &ioasic_intrhand);
- }
-
- printf("\n");
-
- config_search (bus_scan, self, aux);
-}
-
-static int
-ioasic_intr (arg)
- void *arg;
-{
- unsigned int val = ioasic->ioasic_ir;
- printf ("int 131, val = 0x%x\n", val);
- return 0;
-}
-
diff --git a/sys/arch/kbus/dev/rd.c b/sys/arch/kbus/dev/rd.c
deleted file mode 100644
index 195e0e0b8f3..00000000000
--- a/sys/arch/kbus/dev/rd.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/* $OpenBSD: rd.c,v 1.2 2000/03/03 00:54:49 todd Exp $ */
-/*
- * Copyright (c) 1995 Philip A. Nelson.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Philip A. Nelson.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/buf.h>
-#include <sys/device.h>
-#include <sys/conf.h>
-#include <sys/disk.h>
-
-static int rdmatch(struct device *parent, void *cf, void *aux);
-static void rdattach(struct device *parent, struct device *self, void *aux);
-
-struct rdsoftc {
- struct device sc_dev; /* generic device glue */
- struct disk sc_dkdev; /* generic disk glue */
-};
-
-struct cfdriver rdcd = {
- NULL,
- "rd",
- rdmatch,
- rdattach,
- DV_DISK,
- sizeof(struct rdsoftc),
- NULL,
- 0
-};
-
-void rdstrategy __P((struct buf *));
-
-struct dkdriver rddkdriver = { rdstrategy };
-
-#if !defined(RD_SIZE)
-# define RD_SIZE 0x200000
-#endif
-
-u_char ram_disk[RD_SIZE] = "Ramdiskorigin";
-
-static int
-rdmatch(parent, cf, aux)
- struct device *parent;
- void *cf, *aux;
-{
- return(((struct cfdata *)cf)->cf_unit == 0);
-}
-
-static void
-rdattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct rdsoftc *sc = (struct rdsoftc *)self;
-
- printf(" addr 0x%x, size 0x%x\n", ram_disk, RD_SIZE);
-
- /*
- * Initialize and attach the disk structure.
- */
- bzero(&sc->sc_dkdev, sizeof(sc->sc_dkdev));
- sc->sc_dkdev.dk_driver = &rddkdriver;
- sc->sc_dkdev.dk_name = sc->sc_dev.dv_xname;
- disk_attach(&sc->sc_dkdev);
-}
-
-
-/* operational routines */
-
-int
-rdopen(dev, flags, devtype, p)
- dev_t dev;
- int flags, devtype;
- struct proc *p;
-{
- if (minor(dev) == 0)
- return(0);
- else
- return(ENXIO);
-}
-
-int
-rdclose(dev, flags, devtype, p)
- dev_t dev;
- int flags, devtype;
- struct proc *p;
-{
- return(0);
-}
-
-int
-rdioctl(dev, cmd, addr, flag, p)
- dev_t dev;
- u_long cmd;
- int flag;
- caddr_t addr;
- struct proc *p;
-{
- return(ENOTTY);
-}
-
-int
-rdsize(dev)
- dev_t dev;
-{
- if (minor(dev) == 0)
- return(RD_SIZE / DEV_BSIZE);
- else
- return(0);
-}
-
-int
-rddump(dev, blkno, va, size)
- dev_t dev;
- daddr_t blkno;
- caddr_t va;
- size_t size;
-{
- return(ENXIO);
-}
-
-void
-rdstrategy(bp)
- struct buf *bp;
-{
- int loc, size;
- char *adr;
-
- if (minor(bp->b_dev) == 0)
- loc = bp->b_blkno * DEV_BSIZE;
- else {
- bp->b_error = EINVAL;
- bp->b_flags |= B_ERROR;
- return;
- }
- size = bp->b_bcount;
- adr = (char *) bp->b_un.b_addr;
- if (loc + size > sizeof(ram_disk)) {
- bp->b_error = EINVAL;
- bp->b_flags |= B_ERROR;
- return;
- }
- if (bp->b_flags & B_READ)
- bcopy(&ram_disk[loc], adr, size);
- else
- bcopy(adr, &ram_disk[loc], size);
- biodone(bp);
-}
-
-int
-rdread(dev, uio)
- dev_t dev;
- struct uio *uio;
-{
- return(physio(rdstrategy, NULL, dev, B_READ, minphys, uio));
-}
-
-int
-rdwrite(dev, uio)
- dev_t dev;
- struct uio *uio;
-{
- return(physio(rdstrategy, NULL, dev, B_WRITE, minphys, uio));
-}
diff --git a/sys/arch/kbus/dev/sbic.c b/sys/arch/kbus/dev/sbic.c
deleted file mode 100644
index 676c9e40f72..00000000000
--- a/sys/arch/kbus/dev/sbic.c
+++ /dev/null
@@ -1,2914 +0,0 @@
-/* $OpenBSD: sbic.c,v 1.4 2000/11/10 15:33:06 provos Exp $ */
-/* $NetBSD: sbic.c,v 1.28 1996/10/13 03:07:29 christos Exp $ */
-
-/*
- * Copyright (c) 1994 Christian E. Hopps
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)scsi.c 7.5 (Berkeley) 5/4/91
- */
-
-/*
- * AMIGA AMD 33C93 scsi adaptor driver
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/kernel.h> /* For hz */
-#include <sys/disklabel.h>
-#include <sys/dkstat.h>
-#include <sys/buf.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-#include <machine/pmap.h>
-#include <machine/cpu.h>
-#include "dmavar.h"
-#include "sbicreg.h"
-#include "sbicvar.h"
-
-#include <vm/pmap.h>
-
-extern int kvtop __P((caddr_t));
-
-/* Since I can't find this in any other header files */
-#define SCSI_PHASE(reg) (reg&0x07)
-
-/*
- * SCSI delays
- * In u-seconds, primarily for state changes on the SPC.
- */
-#define SBIC_CMD_WAIT 50000 /* wait per step of 'immediate' cmds */
-#define SBIC_DATA_WAIT 50000 /* wait per data in/out step */
-#define SBIC_INIT_WAIT 50000 /* wait per step (both) during init */
-
-#define b_cylin b_resid
-#define SBIC_WAIT(regs, until, timeo) sbicwait(regs, until, timeo, __LINE__)
-
-int sbicicmd __P((struct sbic_softc *, int, int, void *, int, void *, int));
-int sbicgo __P((struct sbic_softc *, struct scsi_xfer *));
-int sbicdmaok __P((struct sbic_softc *, struct scsi_xfer *));
-int sbicwait __P((sbic_regmap_p, char, int , int));
-int sbiccheckdmap __P((void *, u_long, u_long));
-int sbicselectbus __P((struct sbic_softc *, sbic_regmap_p, u_char, u_char, u_char));
-int sbicxfstart __P((sbic_regmap_p, int, u_char, int));
-int sbicxfout __P((sbic_regmap_p regs, int, void *, int));
-int sbicfromscsiperiod __P((struct sbic_softc *, sbic_regmap_p, int));
-int sbictoscsiperiod __P((struct sbic_softc *, sbic_regmap_p, int));
-int sbicpoll __P((struct sbic_softc *));
-int sbicnextstate __P((struct sbic_softc *, u_char, u_char));
-int sbicmsgin __P((struct sbic_softc *));
-int sbicxfin __P((sbic_regmap_p regs, int, void *));
-int sbicabort __P((struct sbic_softc *, sbic_regmap_p, char *));
-void sbicxfdone __P((struct sbic_softc *, sbic_regmap_p, int));
-void sbicerror __P((struct sbic_softc *, sbic_regmap_p, u_char));
-void sbicstart __P((struct sbic_softc *));
-void sbicreset __P((struct sbic_softc *));
-void sbic_scsidone __P((struct sbic_acb *, int));
-void sbic_sched __P((struct sbic_softc *));
-void sbic_save_ptrs __P((struct sbic_softc *, sbic_regmap_p,int,int));
-void sbic_load_ptrs __P((struct sbic_softc *, sbic_regmap_p,int,int));
-#ifdef DEBUG
-void sbicdumpstate __P((void));
-void sbic_dump_acb __P((struct sbic_acb *));
-#endif
-
-/*
- * Synch xfer parameters, and timing conversions
- */
-int sbic_min_period = SBIC_SYN_MIN_PERIOD; /* in cycles = f(ICLK,FSn) */
-int sbic_max_offset = SBIC_SYN_MAX_OFFSET; /* pure number */
-
-int sbic_cmd_wait = SBIC_CMD_WAIT;
-int sbic_data_wait = SBIC_DATA_WAIT;
-int sbic_init_wait = SBIC_INIT_WAIT;
-
-/*
- * was broken before.. now if you want this you get it for all drives
- * on sbic controllers.
- */
-u_char sbic_inhibit_sync[8];
-int sbic_enable_reselect = 1;
-int sbic_clock_override = 0;
-int sbic_no_dma = 0;
-int sbic_parallel_operations = 1;
-
-#ifdef DEBUG
-sbic_regmap_p debug_sbic_regs;
-int sbicdma_ops = 0; /* total DMA operations */
-int sbicdma_bounces = 0; /* number operations using bounce buffer */
-int sbicdma_hits = 0; /* number of DMA chains that were contiguous */
-int sbicdma_misses = 0; /* number of DMA chains that were not contiguous */
-int sbicdma_saves = 0;
-#define QPRINTF(a) if (sbic_debug > 1) printf a
-int sbic_debug = 2;
-int sync_debug = 0;
-int sbic_dma_debug = 0;
-int reselect_debug = 0;
-int report_sense = 0;
-int data_pointer_debug = 2;
-u_char debug_asr, debug_csr, routine;
-void sbictimeout __P((struct sbic_softc *dev));
-
-#define CSR_TRACE_SIZE 32
-#if CSR_TRACE_SIZE
-#define CSR_TRACE(w,c,a,x) do { \
- int s = splbio(); \
- csr_trace[csr_traceptr].whr = (w); csr_trace[csr_traceptr].csr = (c); \
- csr_trace[csr_traceptr].asr = (a); csr_trace[csr_traceptr].xtn = (x); \
- csr_traceptr = (csr_traceptr + 1) & (CSR_TRACE_SIZE - 1); \
- splx(s); \
-} while (0)
-int csr_traceptr;
-int csr_tracesize = CSR_TRACE_SIZE;
-struct {
- u_char whr;
- u_char csr;
- u_char asr;
- u_char xtn;
-} csr_trace[CSR_TRACE_SIZE];
-#else
-#define CSR_TRACE(w,c,a,x)
-#endif
-
-#define SBIC_TRACE_SIZE 16
-#if SBIC_TRACE_SIZE
-#define SBIC_TRACE(dev) do { \
- int s = splbio(); \
- sbic_trace[sbic_traceptr].sp = &s; \
- sbic_trace[sbic_traceptr].line = __LINE__; \
- sbic_trace[sbic_traceptr].sr = s; \
- sbic_trace[sbic_traceptr].csr = csr_traceptr; \
- sbic_traceptr = (sbic_traceptr + 1) & (SBIC_TRACE_SIZE - 1); \
- splx(s); \
-} while (0)
-int sbic_traceptr;
-int sbic_tracesize = SBIC_TRACE_SIZE;
-struct {
- void *sp;
- u_short line;
- u_short sr;
- int csr;
-} sbic_trace[SBIC_TRACE_SIZE];
-#else
-#define SBIC_TRACE(dev)
-#endif
-
-#else /* DEBUG */
-#define QPRINTF(a)
-#define CSR_TRACE(w,c,a,x)
-#define SBIC_TRACE(dev)
-#endif /* DEBUG */
-
-/*
- * default minphys routine for sbic based controllers
- */
-void
-sbic_minphys(bp)
- struct buf *bp;
-{
-
- /*
- * No max transfer at this level.
- */
- minphys(bp);
-}
-
-/*
- * Save DMA pointers. Take into account partial transfer. Shut down DMA.
- */
-void
-sbic_save_ptrs(dev, regs, target, lun)
- struct sbic_softc *dev;
- sbic_regmap_p regs;
- int target, lun;
-{
- int count, asr, s;
- struct sbic_acb* acb;
-
- SBIC_TRACE(dev);
- if( !dev->sc_cur ) return;
- if( !(dev->sc_flags & SBICF_INDMA) ) return; /* DMA not active */
-
- s = splbio();
-
- acb = dev->sc_nexus;
- count = -1;
- do {
- GET_SBIC_asr(regs, asr);
- if( asr & SBIC_ASR_DBR ) {
- printf("sbic_save_ptrs: asr %02x canceled!\n", asr);
- splx(s);
- SBIC_TRACE(dev);
- return;
- }
- } while( asr & (SBIC_ASR_BSY|SBIC_ASR_CIP) );
-
- /* Save important state */
- /* must be done before dmastop */
- acb->sc_dmacmd = dev->sc_dmacmd;
- SBIC_TC_GET(regs, count);
-
- /* Shut down DMA ====CAREFUL==== */
- dev->sc_dmastop(dev);
- dev->sc_flags &= ~SBICF_INDMA;
- SBIC_TC_PUT(regs, 0);
-
-#ifdef DEBUG
- if(!count && sbic_debug) printf("%dcount0",target);
- if(data_pointer_debug == -1)
- printf("SBIC saving target %d data pointers from (%p,%x)%xASR:%02x",
- target, dev->sc_cur->dc_addr, dev->sc_cur->dc_count,
- acb->sc_dmacmd, asr);
-#endif
-
- /* Fixup partial xfers */
- acb->sc_kv.dc_addr += (dev->sc_tcnt - count);
- acb->sc_kv.dc_count -= (dev->sc_tcnt - count);
- acb->sc_pa.dc_addr += (dev->sc_tcnt - count);
- acb->sc_pa.dc_count -= ((dev->sc_tcnt - count)>>1);
-
- acb->sc_tcnt = dev->sc_tcnt = count;
-#ifdef DEBUG
- if(data_pointer_debug)
- printf(" at (%p,%x):%x\n",
- dev->sc_cur->dc_addr, dev->sc_cur->dc_count,count);
- sbicdma_saves++;
-#endif
- splx(s);
- SBIC_TRACE(dev);
-}
-
-
-/*
- * DOES NOT RESTART DMA!!!
- */
-void sbic_load_ptrs(dev, regs, target, lun)
- struct sbic_softc *dev;
- sbic_regmap_p regs;
- int target, lun;
-{
- int s, count;
- char* vaddr, * paddr;
- struct sbic_acb *acb;
-
- SBIC_TRACE(dev);
- acb = dev->sc_nexus;
- if( !acb->sc_kv.dc_count ) {
- /* No data to xfer */
- SBIC_TRACE(dev);
- return;
- }
-
- s = splbio();
-
- dev->sc_last = dev->sc_cur = &acb->sc_pa;
- dev->sc_tcnt = acb->sc_tcnt;
- dev->sc_dmacmd = acb->sc_dmacmd;
-
-#ifdef DEBUG
- sbicdma_ops++;
-#endif
- if( !dev->sc_tcnt ) {
- /* sc_tcnt == 0 implies end of segment */
-
- /* do kvm to pa mappings */
- paddr = acb->sc_pa.dc_addr =
- (char *) kvtop(acb->sc_kv.dc_addr);
-
- vaddr = acb->sc_kv.dc_addr;
- count = acb->sc_kv.dc_count;
- for(count = (NBPG - ((int)vaddr & PGOFSET));
- count < acb->sc_kv.dc_count
- && (char*)kvtop(vaddr + count + 4) == paddr + count + 4;
- count += NBPG);
- /* If it's all contiguous... */
- if(count > acb->sc_kv.dc_count ) {
- count = acb->sc_kv.dc_count;
-#ifdef DEBUG
- sbicdma_hits++;
-#endif
- } else {
-#ifdef DEBUG
- sbicdma_misses++;
-#endif
- }
- acb->sc_tcnt = count;
- acb->sc_pa.dc_count = count >> 1;
-
-#ifdef DEBUG
- if(data_pointer_debug)
- printf("DMA recalc:kv(%p,%x)pa(%p,%lx)\n",
- acb->sc_kv.dc_addr,
- acb->sc_kv.dc_count,
- acb->sc_pa.dc_addr,
- acb->sc_tcnt);
-#endif
- }
- splx(s);
-#ifdef DEBUG
- if(data_pointer_debug)
- printf("SBIC restoring target %d data pointers at (%p,%x)%x\n",
- target, dev->sc_cur->dc_addr, dev->sc_cur->dc_count,
- dev->sc_dmacmd);
-#endif
- SBIC_TRACE(dev);
-}
-
-/*
- * used by specific sbic controller
- *
- * it appears that the higher level code does nothing with LUN's
- * so I will too. I could plug it in, however so could they
- * in scsi_scsi_cmd().
- */
-int
-sbic_scsicmd(xs)
- struct scsi_xfer *xs;
-{
- struct sbic_acb *acb;
- struct sbic_softc *dev;
- struct scsi_link *slp;
- int flags, s, stat;
-
- slp = xs->sc_link;
- dev = slp->adapter_softc;
- SBIC_TRACE(dev);
- flags = xs->flags;
-
- if (flags & SCSI_DATA_UIO)
- panic("sbic: scsi data uio requested");
-
- if (dev->sc_nexus && flags & SCSI_POLL)
- panic("sbic_scsicmd: busy");
-
- if (slp->target == slp->adapter_target)
- return ESCAPE_NOT_SUPPORTED;
-
- s = splbio();
- acb = dev->free_list.tqh_first;
- if (acb)
- TAILQ_REMOVE(&dev->free_list, acb, chain);
- splx(s);
-
- if (acb == NULL) {
-#ifdef DEBUG
- printf("sbic_scsicmd: unable to queue request for target %d\n",
- slp->target);
-#ifdef DDB
- Debugger();
-#endif
-#endif
- xs->error = XS_DRIVER_STUFFUP;
- SBIC_TRACE(dev);
- return(TRY_AGAIN_LATER);
- }
-
- acb->flags = ACB_ACTIVE;
- if (flags & SCSI_DATA_IN)
- acb->flags |= ACB_DATAIN;
- acb->xs = xs;
- bcopy(xs->cmd, &acb->cmd, xs->cmdlen);
- acb->clen = xs->cmdlen;
- acb->sc_kv.dc_addr = xs->data;
- acb->sc_kv.dc_count = xs->datalen;
- acb->pa_addr = xs->data ? (char *)kvtop(xs->data) : 0; /* XXXX check */
-
- if (flags & SCSI_POLL) {
- s = splbio();
- /*
- * This has major side effects -- it locks up the machine
- */
-
- dev->sc_flags |= SBICF_ICMD;
- do {
- while(dev->sc_nexus)
- sbicpoll(dev);
- dev->sc_nexus = acb;
- dev->sc_stat[0] = -1;
- dev->sc_xs = xs;
- dev->target = slp->target;
- dev->lun = slp->lun;
- stat = sbicicmd(dev, slp->target, slp->lun,
- &acb->cmd, acb->clen,
- acb->sc_kv.dc_addr, acb->sc_kv.dc_count);
- } while (dev->sc_nexus != acb);
- sbic_scsidone(acb, stat);
-
- splx(s);
- SBIC_TRACE(dev);
- return(COMPLETE);
- }
-
- s = splbio();
- TAILQ_INSERT_TAIL(&dev->ready_list, acb, chain);
-
- if (dev->sc_nexus) {
- splx(s);
- SBIC_TRACE(dev);
- return(SUCCESSFULLY_QUEUED);
- }
-
- /*
- * nothing is active, try to start it now.
- */
- sbic_sched(dev);
- splx(s);
-
- SBIC_TRACE(dev);
-/* TODO: add sbic_poll to do SCSI_POLL operations */
-#if 0
- if (flags & SCSI_POLL)
- return(COMPLETE);
-#endif
- return(SUCCESSFULLY_QUEUED);
-}
-
-/*
- * attempt to start the next available command
- */
-void
-sbic_sched(dev)
- struct sbic_softc *dev;
-{
- struct scsi_xfer *xs;
- struct scsi_link *slp;
- struct sbic_acb *acb;
- int flags, /*phase,*/ stat, i;
-
- SBIC_TRACE(dev);
- if (dev->sc_nexus)
- return; /* a command is current active */
-
- SBIC_TRACE(dev);
- for (acb = dev->ready_list.tqh_first; acb; acb = acb->chain.tqe_next) {
- slp = acb->xs->sc_link;
- i = slp->target;
- if (!(dev->sc_tinfo[i].lubusy & (1 << slp->lun))) {
- struct sbic_tinfo *ti = &dev->sc_tinfo[i];
-
- TAILQ_REMOVE(&dev->ready_list, acb, chain);
- dev->sc_nexus = acb;
- slp = acb->xs->sc_link;
- ti = &dev->sc_tinfo[slp->target];
- ti->lubusy |= (1 << slp->lun);
- acb->sc_pa.dc_addr = acb->pa_addr; /* XXXX check */
- break;
- }
- }
-
- SBIC_TRACE(dev);
- if (acb == NULL)
- return; /* did not find an available command */
-
- dev->sc_xs = xs = acb->xs;
- slp = xs->sc_link;
- flags = xs->flags;
-
- if (flags & SCSI_RESET)
- sbicreset(dev);
-
-#ifdef DEBUG
- if( data_pointer_debug > 1 )
- printf("sbic_sched(%d,%d)\n",slp->target,slp->lun);
-#endif
- dev->sc_stat[0] = -1;
- dev->target = slp->target;
- dev->lun = slp->lun;
- if ( flags & SCSI_POLL || ( !sbic_parallel_operations
- && (/*phase == STATUS_PHASE ||*/
- sbicdmaok(dev, xs) == 0) ) )
- stat = sbicicmd(dev, slp->target, slp->lun, &acb->cmd,
- acb->clen, acb->sc_kv.dc_addr, acb->sc_kv.dc_count);
- else if (sbicgo(dev, xs) == 0) {
- SBIC_TRACE(dev);
- return;
- } else
- stat = dev->sc_stat[0];
-
- sbic_scsidone(acb, stat);
- SBIC_TRACE(dev);
-}
-
-void
-sbic_scsidone(acb, stat)
- struct sbic_acb *acb;
- int stat;
-{
- struct scsi_xfer *xs;
- struct scsi_link *slp;
- struct sbic_softc *dev;
- int dosched = 0;
-
- xs = acb->xs;
- slp = xs->sc_link;
- dev = slp->adapter_softc;
- SBIC_TRACE(dev);
-#ifdef DIAGNOSTIC
- if (acb == NULL || xs == NULL) {
- printf("sbic_scsidone -- (%d,%d) no scsi_xfer\n",
- dev->target, dev->lun);
-#ifdef DDB
- Debugger();
-#endif
- return;
- }
-#endif
- /*
- * is this right?
- */
- xs->status = stat;
-
-#ifdef DEBUG
- if( data_pointer_debug > 1 )
- printf("scsidone: (%d,%d)->(%d,%d)%02x\n",
- slp->target, slp->lun,
- dev->target, dev->lun, stat);
- if( xs->sc_link->target == dev->sc_link.adapter_target )
- panic("target == hostid");
-#endif
-
- if (xs->error == XS_NOERROR && !(acb->flags & ACB_CHKSENSE)) {
- if (stat == SCSI_CHECK) {
- /* Schedule a REQUEST SENSE */
- struct scsi_sense *ss = (void *)&acb->cmd;
-#ifdef DEBUG
- if (report_sense)
- printf("sbic_scsidone: autosense %02x targ %d lun %d",
- acb->cmd.opcode, slp->target, slp->lun);
-#endif
- bzero(ss, sizeof(*ss));
- ss->opcode = REQUEST_SENSE;
- ss->byte2 = slp->lun << 5;
- ss->length = sizeof(struct scsi_sense_data);
- acb->clen = sizeof(*ss);
- acb->sc_kv.dc_addr = (char *)&xs->sense;
- acb->sc_kv.dc_count = sizeof(struct scsi_sense_data);
- acb->pa_addr = (char *)kvtop((u_char *)&xs->sense); /* XXX check */
- acb->flags = ACB_ACTIVE | ACB_CHKSENSE | ACB_DATAIN;
- TAILQ_INSERT_HEAD(&dev->ready_list, acb, chain);
- dev->sc_tinfo[slp->target].lubusy &=
- ~(1 << slp->lun);
- dev->sc_tinfo[slp->target].senses++;
- if (dev->sc_nexus == acb) {
- dev->sc_nexus = NULL;
- dev->sc_xs = NULL;
- sbic_sched(dev);
- }
- SBIC_TRACE(dev);
- return;
- }
- }
- if (xs->error == XS_NOERROR && (acb->flags & ACB_CHKSENSE)) {
- xs->error = XS_SENSE;
-#ifdef DEBUG
- if (report_sense)
- printf(" => %02x %02x\n", xs->sense.flags,
- xs->sense.extra_bytes[3]);
-#endif
- } else {
- xs->resid = 0; /* XXXX */
- }
-#if whataboutthisone
- case SCSI_BUSY:
- xs->error = XS_BUSY;
- break;
-#endif
- xs->flags |= ITSDONE;
-
- /*
- * Remove the ACB from whatever queue it's on. We have to do a bit of
- * a hack to figure out which queue it's on. Note that it is *not*
- * necessary to cdr down the ready queue, but we must cdr down the
- * nexus queue and see if it's there, so we can mark the unit as no
- * longer busy. This code is sickening, but it works.
- */
- if (acb == dev->sc_nexus) {
- dev->sc_nexus = NULL;
- dev->sc_xs = NULL;
- dev->sc_tinfo[slp->target].lubusy &= ~(1<<slp->lun);
- if (dev->ready_list.tqh_first)
- dosched = 1; /* start next command */
- } else if (dev->ready_list.tqh_last == &acb->chain.tqe_next) {
- TAILQ_REMOVE(&dev->ready_list, acb, chain);
- } else {
- register struct sbic_acb *acb2;
- for (acb2 = dev->nexus_list.tqh_first; acb2;
- acb2 = acb2->chain.tqe_next) {
- if (acb2 == acb) {
- TAILQ_REMOVE(&dev->nexus_list, acb, chain);
- dev->sc_tinfo[slp->target].lubusy
- &= ~(1<<slp->lun);
- break;
- }
- }
- if (acb2)
- ;
- else if (acb->chain.tqe_next) {
- TAILQ_REMOVE(&dev->ready_list, acb, chain);
- } else {
- printf("%s: can't find matching acb\n",
- dev->sc_dev.dv_xname);
-#ifdef DDB
- Debugger();
-#endif
- }
- }
- /* Put it on the free list. */
- acb->flags = ACB_FREE;
- TAILQ_INSERT_HEAD(&dev->free_list, acb, chain);
-
- dev->sc_tinfo[slp->target].cmds++;
-
- scsi_done(xs);
-
- if (dosched)
- sbic_sched(dev);
- SBIC_TRACE(dev);
-}
-
-int
-sbicdmaok(dev, xs)
- struct sbic_softc *dev;
- struct scsi_xfer *xs;
-{
- if (sbic_no_dma || xs->datalen & 0x1 || (u_int)xs->data & 0x3)
- return(0);
- /*
- * controller supports dma to any addresses?
- */
- else if ((dev->sc_flags & SBICF_BADDMA) == 0)
- return(1);
- /*
- * this address is ok for dma?
- */
- else if (sbiccheckdmap(xs->data, xs->datalen, dev->sc_dmamask) == 0)
- return(1);
-#if 0
- /*
- * we have a bounce buffer?
- */
- else if (dev->sc_tinfo[xs->sc_link->target].bounce)
- return(1);
- /*
- * try to get one
- */
- else if ((dev->sc_tinfo[xs->sc_link->target].bounce
- = (char *)alloc_z2mem(MAXPHYS))) {
- if (isztwomem(dev->sc_tinfo[xs->sc_link->target].bounce))
- printf("alloc ZII target %d bounce pa 0x%x\n",
- xs->sc_link->target,
- kvtop(dev->sc_tinfo[xs->sc_link->target].bounce));
- else if (dev->sc_tinfo[xs->sc_link->target].bounce)
- printf("alloc CHIP target %d bounce pa 0x%p\n",
- xs->sc_link->target,
- PREP_DMA_MEM(dev->sc_tinfo[xs->sc_link->target].bounce));
- return(1);
- }
-#endif /* 0 */
- return(0);
-}
-
-
-int
-sbicwait(regs, until, timeo, line)
- sbic_regmap_p regs;
- char until;
- int timeo;
- int line;
-{
- u_char val;
- int csr;
-
- SBIC_TRACE((struct sbic_softc *)0);
- if (timeo == 0)
- timeo = 1000000; /* some large value.. */
-
- GET_SBIC_asr(regs,val);
- while ((val & until) == 0) {
- if (timeo-- == 0) {
- GET_SBIC_csr(regs, csr);
- printf("sbicwait TIMEO @%d with asr=x%x csr=x%x\n",
- line, val, csr);
-#if defined(DDB) && defined(DEBUG)
- Debugger();
-#endif
- return(val); /* Maybe I should abort */
- break;
- }
- DELAY(1);
- GET_SBIC_asr(regs,val);
- }
- SBIC_TRACE((struct sbic_softc *)0);
- return(val);
-}
-
-int
-sbicabort(dev, regs, where)
- struct sbic_softc *dev;
- sbic_regmap_p regs;
- char *where;
-{
- u_char csr, asr;
-
- GET_SBIC_asr(regs, asr);
- GET_SBIC_csr(regs, csr);
-
- printf ("%s: abort %s: csr = 0x%02x, asr = 0x%02x\n",
- dev->sc_dev.dv_xname, where, csr, asr);
-
-
-#if 0
- /* Clean up running command */
- if (dev->sc_nexus != NULL) {
- dev->sc_nexus->xs->error = XS_DRIVER_STUFFUP;
- sbic_scsidone(dev->sc_nexus, dev->sc_stat[0]);
- }
- while (acb = dev->nexus_list.tqh_first) {
- acb->xs->error = XS_DRIVER_STUFFUP;
- sbic_scsidone(acb, -1 /*acb->stat[0]*/);
- }
-#endif
-
- /* Clean up chip itself */
- if (dev->sc_flags & SBICF_SELECTED) {
- while( asr & SBIC_ASR_DBR ) {
- /* sbic is jammed w/data. need to clear it */
- /* But we don't know what direction it needs to go */
- GET_SBIC_data(regs, asr);
- printf("%s: abort %s: clearing data buffer 0x%02x\n",
- dev->sc_dev.dv_xname, where, asr);
- GET_SBIC_asr(regs, asr);
- if( asr & SBIC_ASR_DBR ) /* Not the read direction, then */
- SET_SBIC_data(regs, asr);
- GET_SBIC_asr(regs, asr);
- }
- WAIT_CIP(regs);
-printf("%s: sbicabort - sending ABORT command\n", dev->sc_dev.dv_xname);
- SET_SBIC_cmd(regs, SBIC_CMD_ABORT);
- WAIT_CIP(regs);
-
- GET_SBIC_asr(regs, asr);
- if (asr & (SBIC_ASR_BSY|SBIC_ASR_LCI)) {
- /* ok, get more drastic.. */
-
-printf("%s: sbicabort - asr %x, trying to reset\n", dev->sc_dev.dv_xname, asr);
- sbicreset(dev);
- dev->sc_flags &= ~SBICF_SELECTED;
- return -1;
- }
-printf("%s: sbicabort - sending DISC command\n", dev->sc_dev.dv_xname);
- SET_SBIC_cmd(regs, SBIC_CMD_DISC);
-
- do {
- asr = SBIC_WAIT (regs, SBIC_ASR_INT, 0);
- GET_SBIC_csr (regs, csr);
- CSR_TRACE('a',csr,asr,0);
- } while ((csr != SBIC_CSR_DISC) && (csr != SBIC_CSR_DISC_1)
- && (csr != SBIC_CSR_CMD_INVALID));
-
- /* lets just hope it worked.. */
- dev->sc_flags &= ~SBICF_SELECTED;
- }
- return -1;
-}
-
-
-/*
- * Initialize driver-private structures
- */
-
-void
-sbicinit(dev)
- struct sbic_softc *dev;
-{
- sbic_regmap_p regs;
- u_int i;
- struct sbic_acb *acb;
- u_int inhibit_sync;
-
- extern u_long scsi_nosync;
- extern int shift_nosync;
-
- regs = dev->sc_sbicp;
-
- if ((dev->sc_flags & SBICF_ALIVE) == 0) {
- TAILQ_INIT(&dev->ready_list);
- TAILQ_INIT(&dev->nexus_list);
- TAILQ_INIT(&dev->free_list);
- dev->sc_nexus = NULL;
- dev->sc_xs = NULL;
- acb = dev->sc_acb;
- bzero(acb, sizeof(dev->sc_acb));
- for (i = 0; i < sizeof(dev->sc_acb) / sizeof(*acb); i++) {
- TAILQ_INSERT_TAIL(&dev->free_list, acb, chain);
- acb++;
- }
- bzero(dev->sc_tinfo, sizeof(dev->sc_tinfo));
-#ifdef DEBUG
- /* make sure timeout is really not needed */
- timeout((void *)sbictimeout, dev, 30 * hz);
-#endif
-
- } else panic("sbic: reinitializing driver!");
-
- dev->sc_flags |= SBICF_ALIVE;
- dev->sc_flags &= ~SBICF_SELECTED;
-
- /* initialize inhibit array */
- if (scsi_nosync) {
- inhibit_sync = (scsi_nosync >> shift_nosync) & 0xff;
- shift_nosync += 8;
-#ifdef DEBUG
- if (inhibit_sync)
- printf("%s: Inhibiting synchronous transfer %02x\n",
- dev->sc_dev.dv_xname, inhibit_sync);
-#endif
- for (i = 0; i < 8; ++i)
- if (inhibit_sync & (1 << i))
- sbic_inhibit_sync[i] = 1;
- }
-
- sbicreset(dev);
-}
-
-void
-sbicreset(dev)
- struct sbic_softc *dev;
-{
- sbic_regmap_p regs;
- u_int my_id, s;
- u_char csr;
- int microcode;
- int chips;
-#if 0
- u_int i;
- struct sbic_acb *acb;
-#endif
-
- regs = dev->sc_sbicp;
-#if 0
- if (dev->sc_flags & SBICF_ALIVE) {
- SET_SBIC_cmd(regs, SBIC_CMD_ABORT);
- WAIT_CIP(regs);
- }
-#else
- SET_SBIC_cmd(regs, SBIC_CMD_ABORT);
- WAIT_CIP(regs);
-#endif
- s = splbio();
- my_id = dev->sc_link.adapter_target & SBIC_ID_MASK;
-
- /* Enable advanced mode */
- my_id |= SBIC_ID_EAF /*| SBIC_ID_EHP*/ ;
- SET_SBIC_myid(regs, my_id);
-
- /*
- * Disable interrupts (in dmainit) then reset the chip
- */
- SET_SBIC_cmd(regs, SBIC_CMD_RESET);
- DELAY(25);
- SBIC_WAIT(regs, SBIC_ASR_INT, 0);
- GET_SBIC_csr(regs, csr); /* clears interrupt also */
-
- GET_SBIC_cdb1 (regs, microcode);
- if (csr == 0x00)
- chips = 0;
- else if (csr == 0x01)
- {
- SET_SBIC_queue_tag (regs, 0xa5);
- GET_SBIC_queue_tag (regs, csr);
- if (csr == 0xa5)
- {
- chips = 2;
- SET_SBIC_queue_tag (regs, 0);
- }
- else
- chips = 1;
- }
- else
- chips = -1;
-
- printf ("SBIC reset WD22C93%c - microcode %d\n",
- '@' + chips, microcode);
-
- if (dev->sc_clkfreq < 110)
- my_id |= SBIC_ID_FS_8_10;
- else if (dev->sc_clkfreq < 160)
- my_id |= SBIC_ID_FS_12_15;
- else if (dev->sc_clkfreq < 210)
- my_id |= SBIC_ID_FS_16_20;
-
- SET_SBIC_myid(regs, my_id);
-
- /*
- * Set up various chip parameters
- */
- SET_SBIC_control(regs, SBIC_CTL_EDI | SBIC_CTL_IDI /* | SBIC_CTL_HSP */
- | SBIC_MACHINE_DMA_MODE);
- /*
- * don't allow (re)selection (SBIC_RID_ES)
- * until we can handle target mode!!
- */
- SET_SBIC_rselid(regs, SBIC_RID_ER);
- SET_SBIC_syn(regs, 0); /* asynch for now */
-
- /*
- * anything else was zeroed by reset
- */
- splx(s);
-
-#if 0
- if ((dev->sc_flags & SBICF_ALIVE) == 0) {
- TAILQ_INIT(&dev->ready_list);
- TAILQ_INIT(&dev->nexus_list);
- TAILQ_INIT(&dev->free_list);
- dev->sc_nexus = NULL;
- dev->sc_xs = NULL;
- acb = dev->sc_acb;
- bzero(acb, sizeof(dev->sc_acb));
- for (i = 0; i < sizeof(dev->sc_acb) / sizeof(*acb); i++) {
- TAILQ_INSERT_TAIL(&dev->free_list, acb, chain);
- acb++;
- }
- bzero(dev->sc_tinfo, sizeof(dev->sc_tinfo));
- } else {
- if (dev->sc_nexus != NULL) {
- dev->sc_nexus->xs->error = XS_DRIVER_STUFFUP;
- sbic_scsidone(dev->sc_nexus, dev->sc_stat[0]);
- }
- while (acb = dev->nexus_list.tqh_first) {
- acb->xs->error = XS_DRIVER_STUFFUP;
- sbic_scsidone(acb, -1 /*acb->stat[0]*/);
- }
- }
-
- dev->sc_flags |= SBICF_ALIVE;
-#endif
- dev->sc_flags &= ~SBICF_SELECTED;
-}
-
-void
-sbicerror(dev, regs, csr)
- struct sbic_softc *dev;
- sbic_regmap_p regs;
- u_char csr;
-{
- struct scsi_xfer *xs;
-
- xs = dev->sc_xs;
-
-#ifdef DIAGNOSTIC
- if (xs == NULL)
- panic("sbicerror");
-#endif
- if (xs->flags & SCSI_SILENT)
- return;
-
- printf("%s: ", dev->sc_dev.dv_xname);
- printf("csr == 0x%02x\n", csr); /* XXX */
-}
-
-/*
- * select the bus, return when selected or error.
- */
-int
-sbicselectbus(dev, regs, target, lun, our_addr)
- struct sbic_softc *dev;
- sbic_regmap_p regs;
- u_char target, lun, our_addr;
-{
- u_char asr, csr, id;
-
- SBIC_TRACE(dev);
- QPRINTF(("sbicselectbus %d\n", target));
-
- /*
- * if we're already selected, return (XXXX panic maybe?)
- */
- if (dev->sc_flags & SBICF_SELECTED) {
- SBIC_TRACE(dev);
- return(1);
- }
-
- /*
- * issue select
- */
- SBIC_TC_PUT(regs, 0);
- SET_SBIC_selid(regs, target);
- SET_SBIC_timeo(regs, SBIC_TIMEOUT(250,dev->sc_clkfreq));
-
- /*
- * set sync or async
- */
- if (dev->sc_sync[target].state == SYNC_DONE)
- SET_SBIC_syn(regs, SBIC_SYN (dev->sc_sync[target].offset,
- dev->sc_sync[target].period));
- else
- SET_SBIC_syn(regs, SBIC_SYN (0, sbic_min_period));
-
- GET_SBIC_asr(regs, asr);
- if( asr & (SBIC_ASR_INT|SBIC_ASR_BSY) ) {
- /* This means we got ourselves reselected upon */
-/* printf("sbicselectbus: INT/BSY asr %02x\n", asr);*/
-#ifdef DDB
-/* Debugger();*/
-#endif
- SBIC_TRACE(dev);
- return 1;
- }
-
- SET_SBIC_cmd(regs, SBIC_CMD_SEL_ATN);
-
- /*
- * wait for select (merged from separate function may need
- * cleanup)
- */
- WAIT_CIP(regs);
- do {
- asr = SBIC_WAIT(regs, SBIC_ASR_INT | SBIC_ASR_LCI, 0);
- if (asr & SBIC_ASR_LCI) {
-#ifdef DEBUG
- if (reselect_debug)
- printf("sbicselectbus: late LCI asr %02x\n", asr);
-#endif
- SBIC_TRACE(dev);
- return 1;
- }
- GET_SBIC_csr (regs, csr);
- CSR_TRACE('s',csr,asr,target);
- QPRINTF(("%02x ", csr));
- if( csr == SBIC_CSR_RSLT_NI || csr == SBIC_CSR_RSLT_IFY) {
-#ifdef DEBUG
- if(reselect_debug)
- printf("sbicselectbus: reselected asr %02x\n", asr);
-#endif
- /* We need to handle this now so we don't lock up later */
- sbicnextstate(dev, csr, asr);
- SBIC_TRACE(dev);
- return 1;
- }
- if( csr == SBIC_CSR_SLT || csr == SBIC_CSR_SLT_ATN) {
- panic("sbicselectbus: target issued select!");
- return 1;
- }
- } while (csr != (SBIC_CSR_MIS_2|MESG_OUT_PHASE)
- && csr != (SBIC_CSR_MIS_2|CMD_PHASE) && csr != SBIC_CSR_SEL_TIMEO);
-
- /* Enable (or not) reselection */
- if(!sbic_enable_reselect && dev->nexus_list.tqh_first == NULL)
- SET_SBIC_rselid (regs, 0);
- else
- SET_SBIC_rselid (regs, SBIC_RID_ER);
-
- if (csr == (SBIC_CSR_MIS_2|CMD_PHASE)) {
- dev->sc_flags |= SBICF_SELECTED; /* device ignored ATN */
- GET_SBIC_selid(regs, id);
- dev->target = id;
- GET_SBIC_tlun(regs,dev->lun);
- if( dev->lun & SBIC_TLUN_VALID )
- dev->lun &= SBIC_TLUN_MASK;
- else
- dev->lun = lun;
- } else if (csr == (SBIC_CSR_MIS_2|MESG_OUT_PHASE)) {
- /*
- * Send identify message
- * (SCSI-2 requires an identify msg (?))
- */
- GET_SBIC_selid(regs, id);
- dev->target = id;
- GET_SBIC_tlun(regs,dev->lun);
- if( dev->lun & SBIC_TLUN_VALID )
- dev->lun &= SBIC_TLUN_MASK;
- else
- dev->lun = lun;
- /*
- * handle drives that don't want to be asked
- * whether to go sync at all.
- */
- if (sbic_inhibit_sync[id]
- && dev->sc_sync[id].state == SYNC_START) {
-#ifdef DEBUG
- if (sync_debug)
- printf("Forcing target %d asynchronous.\n", id);
-#endif
- dev->sc_sync[id].offset = 0;
- dev->sc_sync[id].period = sbic_min_period;
- dev->sc_sync[id].state = SYNC_DONE;
- }
-
-
- if (dev->sc_sync[id].state != SYNC_START){
- if( dev->sc_xs->flags & SCSI_POLL
- || (dev->sc_flags & SBICF_ICMD)
- || !sbic_enable_reselect )
- SEND_BYTE (regs, MSG_IDENTIFY | lun);
- else
- SEND_BYTE (regs, MSG_IDENTIFY_DR | lun);
- } else {
- /*
- * try to initiate a sync transfer.
- * So compose the sync message we're going
- * to send to the target
- */
-
-#ifdef DEBUG
- if (sync_debug)
- printf("Sending sync request to target %d ... ",
- id);
-#endif
- /*
- * setup scsi message sync message request
- */
- dev->sc_msg[0] = MSG_IDENTIFY | lun;
- dev->sc_msg[1] = MSG_EXT_MESSAGE;
- dev->sc_msg[2] = 3;
- dev->sc_msg[3] = MSG_SYNC_REQ;
- dev->sc_msg[4] = sbictoscsiperiod(dev, regs,
- sbic_min_period);
- dev->sc_msg[5] = sbic_max_offset;
-
- if (sbicxfstart(regs, 6, MESG_OUT_PHASE, sbic_cmd_wait))
- sbicxfout(regs, 6, dev->sc_msg, MESG_OUT_PHASE);
-
- dev->sc_sync[id].state = SYNC_SENT;
-#ifdef DEBUG
- if (sync_debug)
- printf ("sent\n");
-#endif
- }
-
- asr = SBIC_WAIT (regs, SBIC_ASR_INT, 0);
- GET_SBIC_csr (regs, csr);
- CSR_TRACE('y',csr,asr,target);
- QPRINTF(("[%02x]", csr));
-#ifdef DEBUG
- if (sync_debug && dev->sc_sync[id].state == SYNC_SENT)
- printf("csr-result of last msgout: 0x%x\n", csr);
-#endif
-
- if (csr != SBIC_CSR_SEL_TIMEO)
- dev->sc_flags |= SBICF_SELECTED;
- }
- if (csr == SBIC_CSR_SEL_TIMEO)
- dev->sc_xs->error = XS_SELTIMEOUT;
-
- QPRINTF(("\n"));
-
- SBIC_TRACE(dev);
- return(csr == SBIC_CSR_SEL_TIMEO);
-}
-
-int
-sbicxfstart(regs, len, phase, wait)
- sbic_regmap_p regs;
- int len, wait;
- u_char phase;
-{
- u_char id;
-
- switch (phase) {
- case DATA_IN_PHASE:
- case MESG_IN_PHASE:
- GET_SBIC_selid (regs, id);
- id |= SBIC_SID_FROM_SCSI;
- SET_SBIC_selid (regs, id);
- SBIC_TC_PUT (regs, (unsigned)len);
- break;
- case DATA_OUT_PHASE:
- case MESG_OUT_PHASE:
- case CMD_PHASE:
- GET_SBIC_selid (regs, id);
- id &= ~SBIC_SID_FROM_SCSI;
- SET_SBIC_selid (regs, id);
- SBIC_TC_PUT (regs, (unsigned)len);
- break;
- default:
- SBIC_TC_PUT (regs, 0);
- }
- QPRINTF(("sbicxfstart %d, %d, %d\n", len, phase, wait));
-
- return(1);
-}
-
-int
-sbicxfout(regs, len, bp, phase)
- sbic_regmap_p regs;
- int len;
- void *bp;
- int phase;
-{
- u_char orig_csr, asr, *buf;
- int wait;
-
- buf = bp;
- wait = sbic_data_wait;
-
- QPRINTF(("sbicxfout {%d} %02x %02x %02x %02x %02x "
- "%02x %02x %02x %02x %02x\n", len, buf[0], buf[1], buf[2],
- buf[3], buf[4], buf[5], buf[6], buf[7], buf[8], buf[9]));
-
- GET_SBIC_csr (regs, orig_csr);
- CSR_TRACE('>',orig_csr,0,0);
-
- /*
- * sigh.. WD-PROTO strikes again.. sending the command in one go
- * causes the chip to lock up if talking to certain (misbehaving?)
- * targets. Anyway, this procedure should work for all targets, but
- * it's slightly slower due to the overhead
- */
- WAIT_CIP (regs);
- SET_SBIC_cmd (regs, SBIC_CMD_XFER_INFO);
- for (;len > 0; len--) {
- GET_SBIC_asr (regs, asr);
- while ((asr & SBIC_ASR_DBR) == 0) {
- if ((asr & SBIC_ASR_INT) || --wait < 0) {
-#ifdef DEBUG
- if (sbic_debug)
- printf("sbicxfout fail: l%d i%x w%d\n",
- len, asr, wait);
-#endif
- return (len);
- }
-/* DELAY(1);*/
- GET_SBIC_asr (regs, asr);
- }
-
- SET_SBIC_data (regs, *buf);
- buf++;
- }
- SBIC_TC_GET(regs, len);
- QPRINTF(("sbicxfout done %d bytes\n", len));
- /*
- * this leaves with one csr to be read
- */
- return(0);
-}
-
-/* returns # bytes left to read */
-int
-sbicxfin(regs, len, bp)
- sbic_regmap_p regs;
- int len;
- void *bp;
-{
- int wait;
- u_char *obp, *buf;
- u_char orig_csr, csr, asr;
-
- wait = sbic_data_wait;
- obp = bp;
- buf = bp;
-
- GET_SBIC_csr (regs, orig_csr);
- CSR_TRACE('<',orig_csr,0,0);
-
- QPRINTF(("sbicxfin %d, csr=%02x\n", len, orig_csr));
-
- WAIT_CIP (regs);
- SET_SBIC_cmd (regs, SBIC_CMD_XFER_INFO);
- for (;len > 0; len--) {
- GET_SBIC_asr (regs, asr);
- if((asr & SBIC_ASR_PE)) {
-#ifdef DEBUG
- printf("sbicxfin parity error: l%d i%x w%d\n",
- len, asr, wait);
-/* return ((unsigned long)buf - (unsigned long)bp); */
-#ifdef DDB
- Debugger();
-#endif
-#endif
- }
- while ((asr & SBIC_ASR_DBR) == 0) {
- if ((asr & SBIC_ASR_INT) || --wait < 0) {
-#ifdef DEBUG
- if (sbic_debug) {
- QPRINTF(("sbicxfin fail:{%d} %02x %02x %02x %02x %02x %02x "
- "%02x %02x %02x %02x\n", len, obp[0], obp[1], obp[2],
- obp[3], obp[4], obp[5], obp[6], obp[7], obp[8], obp[9]));
- printf("sbicxfin fail: l%d i%x w%d\n",
- len, asr, wait);
-}
-#endif
- return len;
- }
-
- if( ! asr & SBIC_ASR_BSY ) {
- GET_SBIC_csr(regs, csr);
- CSR_TRACE('<',csr,asr,len);
- QPRINTF(("[CSR%02xASR%02x]", csr, asr));
- }
-
-/* DELAY(1);*/
- GET_SBIC_asr (regs, asr);
- }
-
- GET_SBIC_data (regs, *buf);
-/* QPRINTF(("asr=%02x, csr=%02x, data=%02x\n", asr, csr, *buf));*/
- buf++;
- }
-
- QPRINTF(("sbicxfin {%d} %02x %02x %02x %02x %02x %02x "
- "%02x %02x %02x %02x\n", len, obp[0], obp[1], obp[2],
- obp[3], obp[4], obp[5], obp[6], obp[7], obp[8], obp[9]));
-
- /* this leaves with one csr to be read */
- return len;
-}
-
-/*
- * SCSI 'immediate' command: issue a command to some SCSI device
- * and get back an 'immediate' response (i.e., do programmed xfer
- * to get the response data). 'cbuf' is a buffer containing a scsi
- * command of length clen bytes. 'buf' is a buffer of length 'len'
- * bytes for data. The transfer direction is determined by the device
- * (i.e., by the scsi bus data xfer phase). If 'len' is zero, the
- * command must supply no data.
- */
-int
-sbicicmd(dev, target, lun, cbuf, clen, buf, len)
- struct sbic_softc *dev;
- void *cbuf, *buf;
- int clen, len;
-{
- sbic_regmap_p regs;
- u_char phase, csr, asr;
- int wait, i;
- struct sbic_acb *acb;
-
-#define CSR_LOG_BUF_SIZE 0
-#if CSR_LOG_BUF_SIZE
- int bufptr;
- int csrbuf[CSR_LOG_BUF_SIZE];
- bufptr=0;
-#endif
-
- SBIC_TRACE(dev);
- regs = dev->sc_sbicp;
- acb = dev->sc_nexus;
-
- /* Make sure pointers are OK */
- dev->sc_last = dev->sc_cur = &acb->sc_pa;
- dev->sc_tcnt = acb->sc_tcnt = 0;
- acb->sc_pa.dc_count = 0; /* No DMA */
- acb->sc_kv.dc_addr = buf;
- acb->sc_kv.dc_count = len;
-
-#ifdef DEBUG
- routine = 3;
- debug_sbic_regs = regs; /* store this to allow debug calls */
- if( data_pointer_debug > 1 )
- printf("sbicicmd(%d,%d):%d\n", target, lun,
- acb->sc_kv.dc_count);
-#endif
-
- /*
- * set the sbic into non-DMA mode
- */
- SET_SBIC_control(regs, SBIC_CTL_EDI | SBIC_CTL_IDI /*| SBIC_CTL_HSP*/);
-
- dev->sc_stat[0] = 0xff;
- dev->sc_msg[0] = 0xff;
- i = 1; /* pre-load */
-
- /* We're stealing the SCSI bus */
- dev->sc_flags |= SBICF_ICMD;
-
- do {
- /*
- * select the SCSI bus (it's an error if bus isn't free)
- */
- if (!( dev->sc_flags & SBICF_SELECTED )
- && sbicselectbus(dev, regs, target, lun, dev->sc_scsiaddr)) {
- /*printf("sbicicmd trying to select busy bus!\n");*/
- dev->sc_flags &= ~SBICF_ICMD;
- return(-1);
- }
-
- /*
- * Wait for a phase change (or error) then let the device sequence
- * us through the various SCSI phases.
- */
-
- wait = sbic_cmd_wait;
-
- asr = GET_SBIC_asr (regs, asr);
- GET_SBIC_csr (regs, csr);
- CSR_TRACE('I',csr,asr,target);
- QPRINTF((">ASR:%02xCSR:%02x<", asr, csr));
-
-#if CSR_LOG_BUF_SIZE
- csrbuf[bufptr++] = csr;
-#endif
-
-
- switch (csr) {
- case SBIC_CSR_S_XFERRED:
- case SBIC_CSR_DISC:
- case SBIC_CSR_DISC_1:
- dev->sc_flags &= ~SBICF_SELECTED;
- GET_SBIC_cmd_phase (regs, phase);
- if (phase == 0x60) {
- GET_SBIC_tlun (regs, dev->sc_stat[0]);
- i = 0; /* done */
-/* break; */ /* Bypass all the state gobldygook */
- } else {
-#ifdef DEBUG
- if(reselect_debug>1)
- printf("sbicicmd: handling disconnect\n");
-#endif
- i = SBIC_STATE_DISCONNECT;
- }
- break;
-
- case SBIC_CSR_XFERRED|CMD_PHASE:
- case SBIC_CSR_MIS|CMD_PHASE:
- case SBIC_CSR_MIS_1|CMD_PHASE:
- case SBIC_CSR_MIS_2|CMD_PHASE:
- if (sbicxfstart(regs, clen, CMD_PHASE, sbic_cmd_wait))
- if (sbicxfout(regs, clen,
- cbuf, CMD_PHASE))
- i = sbicabort(dev, regs,"icmd sending cmd");
-#if 0
- GET_SBIC_csr(regs, csr); /* Lets us reload tcount */
- WAIT_CIP(regs);
- GET_SBIC_asr(regs, asr);
- CSR_TRACE('I',csr,asr,target);
- if( asr & (SBIC_ASR_BSY|SBIC_ASR_LCI|SBIC_ASR_CIP) )
- printf("next: cmd sent asr %02x, csr %02x\n",
- asr, csr);
-#endif
- break;
-
-#if 0
- case SBIC_CSR_XFERRED|DATA_OUT_PHASE:
- case SBIC_CSR_XFERRED|DATA_IN_PHASE:
- case SBIC_CSR_MIS|DATA_OUT_PHASE:
- case SBIC_CSR_MIS|DATA_IN_PHASE:
- case SBIC_CSR_MIS_1|DATA_OUT_PHASE:
- case SBIC_CSR_MIS_1|DATA_IN_PHASE:
- case SBIC_CSR_MIS_2|DATA_OUT_PHASE:
- case SBIC_CSR_MIS_2|DATA_IN_PHASE:
- if (acb->sc_kv.dc_count <= 0)
- i = sbicabort(dev, regs, "icmd out of data");
- else {
- wait = sbic_data_wait;
- if (sbicxfstart(regs,
- acb->sc_kv.dc_count,
- SBIC_PHASE(csr), wait))
- if (csr & 0x01)
- /* data in? */
- i=sbicxfin(regs,
- acb->sc_kv.dc_count,
- acb->sc_kv.dc_addr);
- else
- i=sbicxfout(regs,
- acb->sc_kv.dc_count,
- acb->sc_kv.dc_addr,
- SBIC_PHASE(csr));
- acb->sc_kv.dc_addr +=
- (acb->sc_kv.dc_count - i);
- acb->sc_kv.dc_count = i;
- i = 1;
- }
- break;
-
-#endif
- case SBIC_CSR_XFERRED|STATUS_PHASE:
- case SBIC_CSR_MIS|STATUS_PHASE:
- case SBIC_CSR_MIS_1|STATUS_PHASE:
- case SBIC_CSR_MIS_2|STATUS_PHASE:
- /*
- * the sbic does the status/cmd-complete reading ok,
- * so do this with its hi-level commands.
- */
-#ifdef DEBUG
- if(sbic_debug)
- printf("SBICICMD status phase\n");
-#endif
- SBIC_TC_PUT(regs, 0);
- SET_SBIC_cmd_phase(regs, 0x46);
- SET_SBIC_cmd(regs, SBIC_CMD_SEL_ATN_XFER);
- break;
-
-#if THIS_IS_A_RESERVED_STATE
- case BUS_FREE_PHASE: /* This is not legal */
- if( dev->sc_stat[0] != 0xff )
- goto out;
- break;
-#endif
-
- default:
- i = sbicnextstate(dev, csr, asr);
- }
-
- /*
- * make sure the last command was taken,
- * ie. we're not hunting after an ignored command..
- */
- GET_SBIC_asr(regs, asr);
-
- /* tapes may take a loooong time.. */
- while (asr & SBIC_ASR_BSY){
- if(asr & SBIC_ASR_DBR) {
- printf("sbicicmd: Waiting while sbic is jammed, CSR:%02x,ASR:%02x\n",
- csr,asr);
-#ifdef DDB
- Debugger();
-#endif
- /* SBIC is jammed */
- /* DUNNO which direction */
- /* Try old direction */
- GET_SBIC_data(regs,i);
- GET_SBIC_asr(regs, asr);
- if( asr & SBIC_ASR_DBR) /* Wants us to write */
- SET_SBIC_data(regs,i);
- }
- GET_SBIC_asr(regs, asr);
- }
-
- /*
- * wait for last command to complete
- */
- if (asr & SBIC_ASR_LCI) {
- printf("sbicicmd: last command ignored\n");
- }
- else if( i == 1 ) /* Bsy */
- SBIC_WAIT (regs, SBIC_ASR_INT, wait);
-
- /*
- * do it again
- */
- } while ( i > 0 && dev->sc_stat[0] == 0xff);
-
- /* Sometimes we need to do an extra read of the CSR */
- GET_SBIC_csr(regs, csr);
- CSR_TRACE('I',csr,asr,0xff);
-
-#if CSR_LOG_BUF_SIZE
- if(reselect_debug>1)
- for(i=0; i<bufptr; i++)
- printf("CSR:%02x", csrbuf[i]);
-#endif
-
-#ifdef DEBUG
- if(data_pointer_debug > 1)
- printf("sbicicmd done(%d,%d):%d =%d=\n",
- dev->target, lun,
- acb->sc_kv.dc_count,
- dev->sc_stat[0]);
-#endif
-
- QPRINTF(("=STS:%02x=", dev->sc_stat[0]));
- dev->sc_flags &= ~SBICF_ICMD;
-
- SBIC_TRACE(dev);
- return(dev->sc_stat[0]);
-}
-
-/*
- * Finish SCSI xfer command: After the completion interrupt from
- * a read/write operation, sequence through the final phases in
- * programmed i/o. This routine is a lot like sbicicmd except we
- * skip (and don't allow) the select, cmd out and data in/out phases.
- */
-void
-sbicxfdone(dev, regs, target)
- struct sbic_softc *dev;
- sbic_regmap_p regs;
- int target;
-{
- u_char phase, asr, csr;
- int s;
-
- SBIC_TRACE(dev);
- QPRINTF(("{"));
- s = splbio();
-
- /*
- * have the sbic complete on its own
- */
- SBIC_TC_PUT(regs, 0);
- SET_SBIC_cmd_phase(regs, 0x46);
- SET_SBIC_cmd(regs, SBIC_CMD_SEL_ATN_XFER);
-
- do {
- asr = SBIC_WAIT (regs, SBIC_ASR_INT, 0);
- GET_SBIC_csr (regs, csr);
- CSR_TRACE('f',csr,asr,target);
- QPRINTF(("%02x:", csr));
- } while ((csr != SBIC_CSR_DISC) && (csr != SBIC_CSR_DISC_1)
- && (csr != SBIC_CSR_S_XFERRED));
-
- dev->sc_flags &= ~SBICF_SELECTED;
-
- GET_SBIC_cmd_phase (regs, phase);
- QPRINTF(("}%02x", phase));
- if (phase == 0x60)
- GET_SBIC_tlun(regs, dev->sc_stat[0]);
- else
- sbicerror(dev, regs, csr);
-
- QPRINTF(("=STS:%02x=\n", dev->sc_stat[0]));
- splx(s);
- SBIC_TRACE(dev);
-}
-
- /*
- * No DMA chains
- */
-
-int
-sbicgo(dev, xs)
- struct sbic_softc *dev;
- struct scsi_xfer *xs;
-{
- int i, dmaflags, count, usedma;
- u_char csr, asr, *addr;
- sbic_regmap_p regs;
- struct sbic_acb *acb;
-
- SBIC_TRACE(dev);
- dev->target = xs->sc_link->target;
- dev->lun = xs->sc_link->lun;
- acb = dev->sc_nexus;
- regs = dev->sc_sbicp;
-
- usedma = sbicdmaok(dev, xs);
-#ifdef DEBUG
- routine = 1;
- debug_sbic_regs = regs; /* store this to allow debug calls */
- if( data_pointer_debug > 1 )
- printf("sbicgo(%d,%d)\n", dev->target, dev->lun);
-#endif
-
- /*
- * set the sbic into DMA mode
- */
- if( usedma )
- SET_SBIC_control(regs, SBIC_CTL_EDI | SBIC_CTL_IDI |
- SBIC_MACHINE_DMA_MODE);
- else
- SET_SBIC_control(regs, SBIC_CTL_EDI | SBIC_CTL_IDI);
-
-
- /*
- * select the SCSI bus (it's an error if bus isn't free)
- */
- if (sbicselectbus(dev, regs, dev->target, dev->lun,
- dev->sc_scsiaddr)) {
-/* printf("sbicgo: Trying to select busy bus!\n"); */
- SBIC_TRACE(dev);
- return(0); /* Not done: needs to be rescheduled */
- }
- dev->sc_stat[0] = 0xff;
-
- /*
- * Calculate DMA chains now
- */
-
- dmaflags = 0;
- if (acb->flags & ACB_DATAIN)
- dmaflags |= DMAGO_READ;
-
-
- /*
- * Deal w/bounce buffers.
- */
-
- addr = acb->sc_kv.dc_addr;
- count = acb->sc_kv.dc_count;
- if (count && (char *)kvtop(addr) != acb->sc_pa.dc_addr) { /* XXXX check */
- printf("sbic: DMA buffer mapping changed %p->%x\n",
- acb->sc_pa.dc_addr, kvtop(addr));
-#ifdef DDB
- Debugger();
-#endif
- }
-
-#ifdef DEBUG
- ++sbicdma_ops; /* count total DMA operations */
-#endif
-#if 0
- if (count && usedma && dev->sc_flags & SBICF_BADDMA &&
- sbiccheckdmap(addr, count, dev->sc_dmamask)) {
- /*
- * need to bounce the dma.
- */
- if (dmaflags & DMAGO_READ) {
- acb->flags |= ACB_BBUF;
- acb->sc_dmausrbuf = addr;
- acb->sc_dmausrlen = count;
- acb->sc_usrbufpa = (u_char *)kvtop(addr);
- if(!dev->sc_tinfo[dev->target].bounce) {
- printf("sbicgo: HELP! no bounce allocated for %d\n",
- dev->target);
- printf("xfer: (%p->%p,%lx)\n", acb->sc_dmausrbuf,
- acb->sc_usrbufpa, acb->sc_dmausrlen);
- dev->sc_tinfo[xs->sc_link->target].bounce
- = (char *)alloc_z2mem(MAXPHYS);
- if (isztwomem(dev->sc_tinfo[xs->sc_link->target].bounce))
- printf("alloc ZII target %d bounce pa 0x%x\n",
- xs->sc_link->target,
- kvtop(dev->sc_tinfo[xs->sc_link->target].bounce));
- else if (dev->sc_tinfo[xs->sc_link->target].bounce)
- printf("alloc CHIP target %d bounce pa 0x%p\n",
- xs->sc_link->target,
- PREP_DMA_MEM(dev->sc_tinfo[xs->sc_link->target].bounce));
-
- printf("Allocating %d bounce at %x\n",
- dev->target,
- kvtop(dev->sc_tinfo[dev->target].bounce));
- }
- } else { /* write: copy to dma buffer */
-#ifdef DEBUG
- if(data_pointer_debug)
- printf("sbicgo: copying %x bytes to target %d bounce %x\n",
- count, dev->target,
- kvtop(dev->sc_tinfo[dev->target].bounce));
-#endif
- bcopy (addr, dev->sc_tinfo[dev->target].bounce, count);
- }
- addr = dev->sc_tinfo[dev->target].bounce;/* and use dma buffer */
- acb->sc_kv.dc_addr = addr;
-#ifdef DEBUG
- ++sbicdma_bounces; /* count number of bounced */
-#endif
- }
-#endif /* 0 */
-
- /*
- * Allocate the DMA chain
- */
-
- /* Set start KVM addresses */
-#if 0
- acb->sc_kv.dc_addr = addr;
- acb->sc_kv.dc_count = count;
-#endif
-
- /* Mark end of segment */
- acb->sc_tcnt = dev->sc_tcnt = 0;
- acb->sc_pa.dc_count = 0;
-
- sbic_load_ptrs(dev, regs, dev->target, dev->lun);
- SBIC_TRACE(dev);
- /* Enable interrupts but don't do any DMA */
- dev->sc_enintr(dev);
- if (usedma) {
- dev->sc_tcnt = dev->sc_dmago(dev, acb->sc_pa.dc_addr,
- acb->sc_pa.dc_count,
- dmaflags);
-#ifdef DEBUG
- dev->sc_dmatimo = dev->sc_tcnt ? 1 : 0;
-#endif
- } else
- dev->sc_dmacmd = 0; /* Don't use DMA */
- dev->sc_flags |= SBICF_INDMA;
-/* SBIC_TC_PUT(regs, dev->sc_tcnt); */ /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
- SBIC_TRACE(dev);
- sbic_save_ptrs(dev, regs, dev->target, dev->lun);
-
- /*
- * push the data cache ( I think this won't work (EH))
- */
-#if defined(M68040) || defined(M68060)
- if (mmutype == MMU_68040 && usedma && count) {
- dma_cachectl(addr, count);
- if (((u_int)addr & 0xF) || (((u_int)addr + count) & 0xF))
- dev->sc_flags |= SBICF_DCFLUSH;
- }
-#endif
-
- /*
- * enintr() also enables interrupts for the sbic
- */
-#ifdef DEBUG
- if( data_pointer_debug > 1 )
- printf("sbicgo dmago:%d(%p:%lx)\n",
- dev->target,dev->sc_cur->dc_addr,dev->sc_tcnt);
-#if 0
- /*
- * Hmm - this isn't right: asr and csr haven't been set yet.
- */
- debug_asr = asr;
- debug_csr = csr;
-#endif
-#endif
-
- /*
- * Lets cycle a while then let the interrupt handler take over
- */
-
- asr = GET_SBIC_asr(regs, asr);
- do {
- GET_SBIC_csr(regs, csr);
- CSR_TRACE('g',csr,asr,dev->target);
-#ifdef DEBUG
- debug_csr = csr;
- routine = 1;
-#endif
- QPRINTF(("go[0x%x]", csr));
-
- i = sbicnextstate(dev, csr, asr);
-
- WAIT_CIP(regs);
- GET_SBIC_asr(regs, asr);
-#ifdef DEBUG
- debug_asr = asr;
-#endif
- if(asr & SBIC_ASR_LCI) printf("sbicgo: LCI asr:%02x csr:%02x\n",
- asr,csr);
- } while( i == SBIC_STATE_RUNNING
- && asr & (SBIC_ASR_INT|SBIC_ASR_LCI) );
-
- CSR_TRACE('g',csr,asr,i<<4);
- SBIC_TRACE(dev);
-if (i == SBIC_STATE_DONE && dev->sc_stat[0] == 0xff) printf("sbicgo: done & stat = 0xff\n");
- if (i == SBIC_STATE_DONE && dev->sc_stat[0] != 0xff) {
-/* if( i == SBIC_STATE_DONE && dev->sc_stat[0] ) { */
- /* Did we really finish that fast? */
- return 1;
- }
- return 0;
-}
-
-
-int
-sbicintr(dev)
- struct sbic_softc *dev;
-{
- sbic_regmap_p regs;
- u_char asr, csr;
- int i;
-
- regs = dev->sc_sbicp;
-
- /*
- * pending interrupt?
- */
- GET_SBIC_asr (regs, asr);
- if ((asr & SBIC_ASR_INT) == 0)
- return(0);
-
- SBIC_TRACE(dev);
- do {
- GET_SBIC_csr(regs, csr);
- CSR_TRACE('i',csr,asr,dev->target);
-#ifdef DEBUG
- debug_csr = csr;
- routine = 2;
-#endif
- QPRINTF(("intr[0x%x]", csr));
-
- i = sbicnextstate(dev, csr, asr);
-
- WAIT_CIP(regs);
- GET_SBIC_asr(regs, asr);
-#ifdef DEBUG
- debug_asr = asr;
-#endif
-#if 0
- if(asr & SBIC_ASR_LCI) printf("sbicintr: LCI asr:%02x csr:%02x\n",
- asr,csr);
-#endif
- } while(i == SBIC_STATE_RUNNING &&
- asr & (SBIC_ASR_INT|SBIC_ASR_LCI));
- CSR_TRACE('i',csr,asr,i<<4);
- SBIC_TRACE(dev);
- return(1);
-}
-
-/*
- * Run commands and wait for disconnect
- */
-int
-sbicpoll(dev)
- struct sbic_softc *dev;
-{
- sbic_regmap_p regs;
- u_char asr, csr;
- int i;
-
- SBIC_TRACE(dev);
- regs = dev->sc_sbicp;
-
- do {
- GET_SBIC_asr (regs, asr);
-#ifdef DEBUG
- debug_asr = asr;
-#endif
- GET_SBIC_csr(regs, csr);
- CSR_TRACE('p',csr,asr,dev->target);
-#ifdef DEBUG
- debug_csr = csr;
- routine = 2;
-#endif
- QPRINTF(("poll[0x%x]", csr));
-
- i = sbicnextstate(dev, csr, asr);
-
- WAIT_CIP(regs);
- GET_SBIC_asr(regs, asr);
- /* tapes may take a loooong time.. */
- while (asr & SBIC_ASR_BSY){
- if(asr & SBIC_ASR_DBR) {
- printf("sbipoll: Waiting while sbic is jammed, CSR:%02x,ASR:%02x\n",
- csr,asr);
-#ifdef DDB
- Debugger();
-#endif
- /* SBIC is jammed */
- /* DUNNO which direction */
- /* Try old direction */
- GET_SBIC_data(regs,i);
- GET_SBIC_asr(regs, asr);
- if( asr & SBIC_ASR_DBR) /* Wants us to write */
- SET_SBIC_data(regs,i);
- }
- GET_SBIC_asr(regs, asr);
- }
-
- if(asr & SBIC_ASR_LCI) printf("sbicpoll: LCI asr:%02x csr:%02x\n",
- asr,csr);
- else if( i == 1 ) /* BSY */
- SBIC_WAIT(regs, SBIC_ASR_INT, sbic_cmd_wait);
- } while(i == SBIC_STATE_RUNNING);
- CSR_TRACE('p',csr,asr,i<<4);
- SBIC_TRACE(dev);
- return(1);
-}
-
-/*
- * Handle a single msgin
- */
-
-int
-sbicmsgin(dev)
- struct sbic_softc *dev;
-{
- sbic_regmap_p regs;
- int recvlen;
- u_char asr, csr, *tmpaddr;
-
- regs = dev->sc_sbicp;
-
- dev->sc_msg[0] = 0xff;
- dev->sc_msg[1] = 0xff;
-
- GET_SBIC_asr(regs, asr);
-#ifdef DEBUG
- if(reselect_debug>1)
- printf("sbicmsgin asr=%02x\n", asr);
-#endif
-
- sbic_save_ptrs(dev, regs, dev->target, dev->lun);
-
- GET_SBIC_selid (regs, csr);
- SET_SBIC_selid (regs, csr | SBIC_SID_FROM_SCSI);
-
- SBIC_TC_PUT(regs, 0);
- tmpaddr = dev->sc_msg;
- recvlen = 1;
- do {
- while( recvlen-- ) {
- asr = GET_SBIC_asr(regs, asr);
- GET_SBIC_csr(regs, csr);
- QPRINTF(("sbicmsgin ready to go (csr,asr)=(%02x,%02x)\n",
- csr, asr));
-
- RECV_BYTE(regs, *tmpaddr);
- CSR_TRACE('m',csr,asr,*tmpaddr);
-#if 1
- /*
- * get the command completion interrupt, or we
- * can't send a new command (LCI)
- */
- SBIC_WAIT(regs, SBIC_ASR_INT, 0);
- GET_SBIC_csr(regs, csr);
- CSR_TRACE('X',csr,asr,dev->target);
-#else
- WAIT_CIP(regs);
- do {
- GET_SBIC_asr(regs, asr);
- csr = 0xff;
- GET_SBIC_csr(regs, csr);
- CSR_TRACE('X',csr,asr,dev->target);
- if( csr == 0xff )
- printf("sbicmsgin waiting: csr %02x asr %02x\n", csr, asr);
- } while( csr == 0xff );
-#endif
-#ifdef DEBUG
- if(reselect_debug>1)
- printf("sbicmsgin: got %02x csr %02x asr %02x\n",
- *tmpaddr, csr, asr);
-#endif
-#if do_parity_check
- if( asr & SBIC_ASR_PE ) {
- printf ("Parity error");
- /* This code simply does not work. */
- WAIT_CIP(regs);
- SET_SBIC_cmd(regs, SBIC_CMD_SET_ATN);
- WAIT_CIP(regs);
- GET_SBIC_asr(regs, asr);
- WAIT_CIP(regs);
- SET_SBIC_cmd(regs, SBIC_CMD_CLR_ACK);
- WAIT_CIP(regs);
- if( !(asr & SBIC_ASR_LCI) )
- /* Target wants to send garbled msg*/
- continue;
- printf("--fixing\n");
- /* loop until a msgout phase occurs on target */
- while(csr & 0x07 != MESG_OUT_PHASE) {
- while( asr & SBIC_ASR_BSY &&
- !(asr & SBIC_ASR_DBR|SBIC_ASR_INT) )
- GET_SBIC_asr(regs, asr);
- if( asr & SBIC_ASR_DBR )
- panic("msgin: jammed again!");
- GET_SBIC_csr(regs, csr);
- CSR_TRACE('e',csr,asr,dev->target);
- if( csr & 0x07 != MESG_OUT_PHASE ) {
- sbicnextstate(dev, csr, asr);
- sbic_save_ptrs(dev, regs,
- dev->target,
- dev->lun);
- }
- }
- /* Should be msg out by now */
- SEND_BYTE(regs, MSG_PARITY_ERROR);
- }
- else
-#endif
- tmpaddr++;
-
- if(recvlen) {
- /* Clear ACK */
- WAIT_CIP(regs);
- GET_SBIC_asr(regs, asr);
- GET_SBIC_csr(regs, csr);
- CSR_TRACE('X',csr,asr,dev->target);
- QPRINTF(("sbicmsgin pre byte CLR_ACK (csr,asr)=(%02x,%02x)\n",
- csr, asr));
- SET_SBIC_cmd(regs, SBIC_CMD_CLR_ACK);
- SBIC_WAIT(regs, SBIC_ASR_INT, 0);
- }
-
- };
-
- if(dev->sc_msg[0] == 0xff) {
- printf("sbicmsgin: sbic swallowed our message\n");
- break;
- }
-#ifdef DEBUG
- if (sync_debug)
- printf("msgin done csr 0x%x asr 0x%x msg 0x%x\n",
- csr, asr, dev->sc_msg[0]);
-#endif
- /*
- * test whether this is a reply to our sync
- * request
- */
- if (MSG_ISIDENTIFY(dev->sc_msg[0])) {
- QPRINTF(("IFFY"));
-#if 0
- /* There is an implied load-ptrs here */
- sbic_load_ptrs(dev, regs, dev->target, dev->lun);
-#endif
- /* Got IFFY msg -- ack it */
- } else if (dev->sc_msg[0] == MSG_REJECT
- && dev->sc_sync[dev->target].state == SYNC_SENT) {
- QPRINTF(("REJECT of SYN"));
-#ifdef DEBUG
- if (sync_debug)
- printf("target %d rejected sync, going async\n",
- dev->target);
-#endif
- dev->sc_sync[dev->target].period = sbic_min_period;
- dev->sc_sync[dev->target].offset = 0;
- dev->sc_sync[dev->target].state = SYNC_DONE;
- SET_SBIC_syn(regs,
- SBIC_SYN(dev->sc_sync[dev->target].offset,
- dev->sc_sync[dev->target].period));
- } else if ((dev->sc_msg[0] == MSG_REJECT)) {
- QPRINTF(("REJECT"));
- /*
- * we'll never REJECt a REJECT message..
- */
- } else if ((dev->sc_msg[0] == MSG_SAVE_DATA_PTR)) {
- QPRINTF(("MSG_SAVE_DATA_PTR"));
- /*
- * don't reject this either.
- */
- } else if ((dev->sc_msg[0] == MSG_DISCONNECT)) {
- QPRINTF(("DISCONNECT"));
-#ifdef DEBUG
- if( reselect_debug>1 && dev->sc_msg[0] == MSG_DISCONNECT )
- printf("sbicmsgin: got disconnect msg %s\n",
- (dev->sc_flags & SBICF_ICMD)?"rejecting":"");
-#endif
- if( dev->sc_flags & SBICF_ICMD ) {
- /* We're in immediate mode. Prevent disconnects. */
- /* prepare to reject the message, NACK */
- SET_SBIC_cmd(regs, SBIC_CMD_SET_ATN);
- WAIT_CIP(regs);
- }
- } else if (dev->sc_msg[0] == MSG_CMD_COMPLETE ) {
- QPRINTF(("CMD_COMPLETE"));
- /* !! KLUDGE ALERT !! quite a few drives don't seem to
- * really like the current way of sending the
- * sync-handshake together with the ident-message, and
- * they react by sending command-complete and
- * disconnecting right after returning the valid sync
- * handshake. So, all I can do is reselect the drive,
- * and hope it won't disconnect again. I don't think
- * this is valid behavior, but I can't help fixing a
- * problem that apparently exists.
- *
- * Note: we should not get here on `normal' command
- * completion, as that condition is handled by the
- * high-level sel&xfer resume command used to walk
- * thru status/cc-phase.
- */
-
-#ifdef DEBUG
- if (sync_debug)
- printf ("GOT MSG %d! target %d acting weird.."
- " waiting for disconnect...\n",
- dev->sc_msg[0], dev->target);
-#endif
- /* Check to see if sbic is handling this */
- GET_SBIC_asr(regs, asr);
- if(asr & SBIC_ASR_BSY)
- return SBIC_STATE_RUNNING;
-
- /* Let's try this: Assume it works and set status to 00 */
- dev->sc_stat[0] = 0;
- } else if (dev->sc_msg[0] == MSG_EXT_MESSAGE
- && tmpaddr == &dev->sc_msg[1]) {
- QPRINTF(("ExtMSG\n"));
- /* Read in whole extended message */
- SET_SBIC_cmd(regs, SBIC_CMD_CLR_ACK);
- SBIC_WAIT(regs, SBIC_ASR_INT, 0);
- GET_SBIC_asr(regs, asr);
- GET_SBIC_csr(regs, csr);
- QPRINTF(("CLR ACK asr %02x, csr %02x\n", asr, csr));
- RECV_BYTE(regs, *tmpaddr);
- CSR_TRACE('x',csr,asr,*tmpaddr);
- /* Wait for command completion IRQ */
- SBIC_WAIT(regs, SBIC_ASR_INT, 0);
- recvlen = *tmpaddr++;
- QPRINTF(("Recving ext msg, asr %02x csr %02x len %02x\n",
- asr, csr, recvlen));
- } else if (dev->sc_msg[0] == MSG_EXT_MESSAGE && dev->sc_msg[1] == 3
- && dev->sc_msg[2] == MSG_SYNC_REQ) {
- QPRINTF(("SYN"));
- dev->sc_sync[dev->target].period =
- sbicfromscsiperiod(dev,
- regs, dev->sc_msg[3]);
- dev->sc_sync[dev->target].offset = dev->sc_msg[4];
- dev->sc_sync[dev->target].state = SYNC_DONE;
- SET_SBIC_syn(regs,
- SBIC_SYN(dev->sc_sync[dev->target].offset,
- dev->sc_sync[dev->target].period));
- printf("%s: target %d now synchronous,"
- " period=%dns, offset=%d.\n",
- dev->sc_dev.dv_xname, dev->target,
- dev->sc_msg[3] * 4, dev->sc_msg[4]);
- } else {
-#ifdef DEBUG
- if (sbic_debug || sync_debug)
- printf ("sbicmsgin: Rejecting message 0x%02x\n",
- dev->sc_msg[0]);
-#endif
- /* prepare to reject the message, NACK */
- SET_SBIC_cmd(regs, SBIC_CMD_SET_ATN);
- WAIT_CIP(regs);
- }
- /* Clear ACK */
- WAIT_CIP(regs);
- GET_SBIC_asr(regs, asr);
- GET_SBIC_csr(regs, csr);
- CSR_TRACE('X',csr,asr,dev->target);
- QPRINTF(("sbicmsgin pre CLR_ACK (csr,asr)=(%02x,%02x)%d\n",
- csr, asr, recvlen));
- SET_SBIC_cmd(regs, SBIC_CMD_CLR_ACK);
- SBIC_WAIT(regs, SBIC_ASR_INT, 0);
- }
-#if 0
- while((csr == SBIC_CSR_MSGIN_W_ACK)
- || (SBIC_PHASE(csr) == MESG_IN_PHASE));
-#else
- while (recvlen>0);
-#endif
-
- QPRINTF(("sbicmsgin finished: csr %02x, asr %02x\n",csr, asr));
-
- /* Should still have one CSR to read */
- return SBIC_STATE_RUNNING;
-}
-
-
-/*
- * sbicnextstate()
- * return:
- * 0 == done
- * 1 == working
- * 2 == disconnected
- * -1 == error
- */
-int
-sbicnextstate(dev, csr, asr)
- struct sbic_softc *dev;
- u_char csr, asr;
-{
- sbic_regmap_p regs;
- struct sbic_acb *acb;
- int i, newtarget, newlun, wait;
-#if 0
- unsigned tcnt;
-#endif
-
- i = 0;
- SBIC_TRACE(dev);
- regs = dev->sc_sbicp;
- acb = dev->sc_nexus;
-
- QPRINTF(("next[%02x,%02x]",asr,csr));
-
- switch (csr) {
- case SBIC_CSR_XFERRED|CMD_PHASE:
- case SBIC_CSR_MIS|CMD_PHASE:
- case SBIC_CSR_MIS_1|CMD_PHASE:
- case SBIC_CSR_MIS_2|CMD_PHASE:
- sbic_save_ptrs(dev, regs, dev->target, dev->lun);
- if (sbicxfstart(regs, acb->clen, CMD_PHASE, sbic_cmd_wait))
- if (sbicxfout(regs, acb->clen,
- &acb->cmd, CMD_PHASE))
- goto abort;
- break;
-
- case SBIC_CSR_XFERRED|STATUS_PHASE:
- case SBIC_CSR_MIS|STATUS_PHASE:
- case SBIC_CSR_MIS_1|STATUS_PHASE:
- case SBIC_CSR_MIS_2|STATUS_PHASE:
- /*
- * this should be the normal i/o completion case.
- * get the status & cmd complete msg then let the
- * device driver look at what happened.
- */
- sbicxfdone(dev,regs,dev->target);
- /*
- * check for overlapping cache line, flush if so
- */
-#if defined(M68040) || defined(M68060)
- if (dev->sc_flags & SBICF_DCFLUSH) {
-#if 0
- printf("sbic: 68040/68060 DMA cache flush needs "
- "fixing? %x:%x\n",
- dev->sc_xs->data, dev->sc_xs->datalen);
-#endif
- }
-#endif
-#ifdef DEBUG
- if( data_pointer_debug > 1 )
- printf("next dmastop: %d(%p:%lx)\n",
- dev->target,dev->sc_cur->dc_addr,dev->sc_tcnt);
- dev->sc_dmatimo = 0;
-#endif
- dev->sc_dmastop(dev); /* was dmafree */
- if (acb->flags & ACB_BBUF) {
- if ((u_char *)kvtop(acb->sc_dmausrbuf) != acb->sc_usrbufpa)
- printf("%s: WARNING - buffer mapping changed %p->%x\n",
- dev->sc_dev.dv_xname, acb->sc_usrbufpa,
- kvtop(acb->sc_dmausrbuf));
-#ifdef DEBUG
- if(data_pointer_debug)
- printf("sbicgo:copying %lx bytes from target %d bounce %x\n",
- acb->sc_dmausrlen,
- dev->target,
- kvtop(dev->sc_tinfo[dev->target].bounce));
-#endif
- bcopy(dev->sc_tinfo[dev->target].bounce,
- acb->sc_dmausrbuf,
- acb->sc_dmausrlen);
- }
- dev->sc_flags &= ~(SBICF_INDMA | SBICF_DCFLUSH);
- sbic_scsidone(acb, dev->sc_stat[0]);
- SBIC_TRACE(dev);
- return SBIC_STATE_DONE;
-
- case SBIC_CSR_XFERRED|DATA_OUT_PHASE:
- case SBIC_CSR_XFERRED|DATA_IN_PHASE:
- case SBIC_CSR_MIS|DATA_OUT_PHASE:
- case SBIC_CSR_MIS|DATA_IN_PHASE:
- case SBIC_CSR_MIS_1|DATA_OUT_PHASE:
- case SBIC_CSR_MIS_1|DATA_IN_PHASE:
- case SBIC_CSR_MIS_2|DATA_OUT_PHASE:
- case SBIC_CSR_MIS_2|DATA_IN_PHASE:
- if( dev->sc_xs->flags & SCSI_POLL || dev->sc_flags & SBICF_ICMD
- || acb->sc_dmacmd == 0 ) {
- /* Do PIO */
- SET_SBIC_control(regs, SBIC_CTL_EDI | SBIC_CTL_IDI);
- if (acb->sc_kv.dc_count <= 0) {
- printf("sbicnextstate:xfer count %d asr%x csr%x\n",
- acb->sc_kv.dc_count, asr, csr);
- goto abort;
- }
- wait = sbic_data_wait;
- if( sbicxfstart(regs,
- acb->sc_kv.dc_count,
- SBIC_PHASE(csr), wait)) {
- if( SBIC_PHASE(csr) == DATA_IN_PHASE )
- /* data in? */
- i=sbicxfin(regs,
- acb->sc_kv.dc_count,
- acb->sc_kv.dc_addr);
- else
- i=sbicxfout(regs,
- acb->sc_kv.dc_count,
- acb->sc_kv.dc_addr,
- SBIC_PHASE(csr));
- }
- acb->sc_kv.dc_addr +=
- (acb->sc_kv.dc_count - i);
- acb->sc_kv.dc_count = i;
- } else {
- if (acb->sc_kv.dc_count <= 0) {
- printf("sbicnextstate:xfer count %d asr%x csr%x\n",
- acb->sc_kv.dc_count, asr, csr);
- goto abort;
- }
- /*
- * do scatter-gather dma
- * hacking the controller chip, ouch..
- */
- SET_SBIC_control(regs, SBIC_CTL_EDI | SBIC_CTL_IDI |
- SBIC_MACHINE_DMA_MODE);
- /*
- * set next dma addr and dec count
- */
-#if 0
- SBIC_TC_GET(regs, tcnt);
- dev->sc_cur->dc_count -= ((dev->sc_tcnt - tcnt) >> 1);
- dev->sc_cur->dc_addr += (dev->sc_tcnt - tcnt);
- dev->sc_tcnt = acb->sc_tcnt = tcnt;
-#else
- sbic_save_ptrs(dev, regs, dev->target, dev->lun);
- sbic_load_ptrs(dev, regs, dev->target, dev->lun);
-#endif
-#ifdef DEBUG
- if( data_pointer_debug > 1 )
- printf("next dmanext: %d(%p:%lx)\n",
- dev->target,dev->sc_cur->dc_addr,
- dev->sc_tcnt);
- dev->sc_dmatimo = 1;
-#endif
- dev->sc_tcnt = dev->sc_dmanext(dev);
- SBIC_TC_PUT(regs, (unsigned)dev->sc_tcnt);
- SET_SBIC_cmd(regs, SBIC_CMD_XFER_INFO);
- dev->sc_flags |= SBICF_INDMA;
- }
- break;
-
- case SBIC_CSR_XFERRED|MESG_IN_PHASE:
- case SBIC_CSR_MIS|MESG_IN_PHASE:
- case SBIC_CSR_MIS_1|MESG_IN_PHASE:
- case SBIC_CSR_MIS_2|MESG_IN_PHASE:
- SBIC_TRACE(dev);
- return sbicmsgin(dev);
-
- case SBIC_CSR_MSGIN_W_ACK:
- SET_SBIC_cmd(regs, SBIC_CMD_CLR_ACK); /* Dunno what I'm ACKing */
- printf("Acking unknown msgin CSR:%02x",csr);
- break;
-
- case SBIC_CSR_XFERRED|MESG_OUT_PHASE:
- case SBIC_CSR_MIS|MESG_OUT_PHASE:
- case SBIC_CSR_MIS_1|MESG_OUT_PHASE:
- case SBIC_CSR_MIS_2|MESG_OUT_PHASE:
-#ifdef DEBUG
- if (sync_debug)
- printf ("sending REJECT msg to last msg.\n");
-#endif
-
- sbic_save_ptrs(dev, regs, dev->target, dev->lun);
- /*
- * should only get here on reject,
- * since it's always US that
- * initiate a sync transfer
- */
- SEND_BYTE(regs, MSG_REJECT);
- WAIT_CIP(regs);
- if( asr & (SBIC_ASR_BSY|SBIC_ASR_LCI|SBIC_ASR_CIP) )
- printf("next: REJECT sent asr %02x\n", asr);
- SBIC_TRACE(dev);
- return SBIC_STATE_RUNNING;
-
- case SBIC_CSR_DISC:
- case SBIC_CSR_DISC_1:
- dev->sc_flags &= ~(SBICF_INDMA|SBICF_SELECTED);
-
- /* Try to schedule another target */
-#ifdef DEBUG
- if(reselect_debug>1)
- printf("sbicnext target %d disconnected\n", dev->target);
-#endif
- TAILQ_INSERT_HEAD(&dev->nexus_list, acb, chain);
- ++dev->sc_tinfo[dev->target].dconns;
- dev->sc_nexus = NULL;
- dev->sc_xs = NULL;
-
- if( acb->xs->flags & SCSI_POLL
- || (dev->sc_flags & SBICF_ICMD)
- || !sbic_parallel_operations ) {
- SBIC_TRACE(dev);
- return SBIC_STATE_DISCONNECT;
- }
- sbic_sched(dev);
- SBIC_TRACE(dev);
- return SBIC_STATE_DISCONNECT;
-
- case SBIC_CSR_RSLT_NI:
- case SBIC_CSR_RSLT_IFY:
- GET_SBIC_rselid(regs, newtarget);
- /* check SBIC_RID_SIV? */
- newtarget &= SBIC_RID_MASK;
- if (csr == SBIC_CSR_RSLT_IFY) {
- /* Read IFY msg to avoid lockup */
- GET_SBIC_data(regs, newlun);
- WAIT_CIP(regs);
- newlun &= SBIC_TLUN_MASK;
- CSR_TRACE('r',csr,asr,newtarget);
- } else {
- /* Need to get IFY message */
- for (newlun = 256; newlun; --newlun) {
- GET_SBIC_asr(regs, asr);
- if (asr & SBIC_ASR_INT)
- break;
- delay(1);
- }
- newlun = 0; /* XXXX */
- if ((asr & SBIC_ASR_INT) == 0) {
-#ifdef DEBUG
- if (reselect_debug)
- printf("RSLT_NI - no IFFY message? asr %x\n", asr);
-#endif
- } else {
- GET_SBIC_csr(regs,csr);
- CSR_TRACE('n',csr,asr,newtarget);
- if (csr == (SBIC_CSR_MIS | MESG_IN_PHASE) ||
- csr == (SBIC_CSR_MIS_1 | MESG_IN_PHASE) ||
- csr == (SBIC_CSR_MIS_2 | MESG_IN_PHASE)) {
- sbicmsgin(dev);
- newlun = dev->sc_msg[0] & 7;
- } else {
- printf("RSLT_NI - not MESG_IN_PHASE %x\n",
- csr);
- }
- }
- }
-#ifdef DEBUG
- if(reselect_debug>1 || (reselect_debug && csr==SBIC_CSR_RSLT_NI))
- printf("sbicnext: reselect %s from targ %d lun %d\n",
- csr == SBIC_CSR_RSLT_NI ? "NI" : "IFY",
- newtarget, newlun);
-#endif
- if (dev->sc_nexus) {
-#ifdef DEBUG
- if (reselect_debug > 1)
- printf("%s: reselect %s with active command\n",
- dev->sc_dev.dv_xname,
- csr == SBIC_CSR_RSLT_NI ? "NI" : "IFY");
-#ifdef DDB
-/* Debugger();*/
-#endif
-#endif
- TAILQ_INSERT_HEAD(&dev->ready_list, dev->sc_nexus, chain);
- dev->sc_tinfo[dev->target].lubusy &= ~(1 << dev->lun);
- dev->sc_nexus = NULL;
- dev->sc_xs = NULL;
- }
- /* Reload sync values for this target */
- if (dev->sc_sync[newtarget].state == SYNC_DONE)
- SET_SBIC_syn(regs, SBIC_SYN (dev->sc_sync[newtarget].offset,
- dev->sc_sync[newtarget].period));
- else
- SET_SBIC_syn(regs, SBIC_SYN (0, sbic_min_period));
- for (acb = dev->nexus_list.tqh_first; acb;
- acb = acb->chain.tqe_next) {
- if (acb->xs->sc_link->target != newtarget ||
- acb->xs->sc_link->lun != newlun)
- continue;
- TAILQ_REMOVE(&dev->nexus_list, acb, chain);
- dev->sc_nexus = acb;
- dev->sc_xs = acb->xs;
- dev->sc_flags |= SBICF_SELECTED;
- dev->target = newtarget;
- dev->lun = newlun;
- break;
- }
- if (acb == NULL) {
- printf("%s: reselect %s targ %d not in nexus_list %p\n",
- dev->sc_dev.dv_xname,
- csr == SBIC_CSR_RSLT_NI ? "NI" : "IFY", newtarget,
- &dev->nexus_list.tqh_first);
- panic("bad reselect in sbic");
- }
- if (csr == SBIC_CSR_RSLT_IFY)
- SET_SBIC_cmd(regs, SBIC_CMD_CLR_ACK);
- break;
-
- default:
- abort:
- /*
- * Something unexpected happened -- deal with it.
- */
- printf("sbicnextstate: aborting csr %02x asr %02x\n", csr, asr);
-#ifdef DDB
- Debugger();
-#endif
-#ifdef DEBUG
- if( data_pointer_debug > 1 )
- printf("next dmastop: %d(%p:%lx)\n",
- dev->target,dev->sc_cur->dc_addr,dev->sc_tcnt);
- dev->sc_dmatimo = 0;
-#endif
- dev->sc_dmastop(dev);
- SET_SBIC_control(regs, SBIC_CTL_EDI | SBIC_CTL_IDI);
- sbicerror(dev, regs, csr);
- sbicabort(dev, regs, "next");
- if (dev->sc_flags & SBICF_INDMA) {
- /*
- * check for overlapping cache line, flush if so
- */
-#if defined(M68040) || defined(M68060)
-
- if (dev->sc_flags & SBICF_DCFLUSH) {
-#if 0
- printf("sbic: 68040/060 DMA cache flush needs "
- "fixing? %x:%x\n",
- dev->sc_xs->data, dev->sc_xs->datalen);
-#endif
- }
-#endif
- dev->sc_flags &=
- ~(SBICF_INDMA | SBICF_DCFLUSH);
-#ifdef DEBUG
- if( data_pointer_debug > 1 )
- printf("next dmastop: %d(%p:%lx)\n",
- dev->target,dev->sc_cur->dc_addr,dev->sc_tcnt);
- dev->sc_dmatimo = 0;
-#endif
- dev->sc_dmastop(dev);
- sbic_scsidone(acb, -1);
- }
- SBIC_TRACE(dev);
- return SBIC_STATE_ERROR;
- }
-
- SBIC_TRACE(dev);
- return(SBIC_STATE_RUNNING);
-}
-
-
-/*
- * Check if DMA can not be used with specified buffer
- */
-
-int
-sbiccheckdmap(bp, len, mask)
- void *bp;
- u_long len, mask;
-{
- u_char *buffer;
- u_long phy_buf;
- u_long phy_len;
-
- buffer = bp;
-
- if (len == 0)
- return(0);
-
- while (len) {
- phy_buf = kvtop(buffer);
- if (len < (phy_len = NBPG - ((int) buffer & PGOFSET)))
- phy_len = len;
- if (phy_buf & mask)
- return(1);
- buffer += phy_len;
- len -= phy_len;
- }
- return(0);
-}
-
-int
-sbictoscsiperiod(dev, regs, a)
- struct sbic_softc *dev;
- sbic_regmap_p regs;
- int a;
-{
- unsigned int fs;
-
- /*
- * cycle = DIV / (2*CLK)
- * DIV = FS+2
- * best we can do is 200ns at 20Mhz, 2 cycles
- */
-
- GET_SBIC_myid(regs,fs);
- fs = (fs >>6) + 2; /* DIV */
- fs = (fs * 10000) / (dev->sc_clkfreq<<1); /* Cycle, in ns */
- if (a < 2) a = 8; /* map to Cycles */
- return ((fs*a)>>2); /* in 4 ns units */
-}
-
-int
-sbicfromscsiperiod(dev, regs, p)
- struct sbic_softc *dev;
- sbic_regmap_p regs;
- int p;
-{
- register unsigned int fs, ret;
-
- /* Just the inverse of the above */
-
- GET_SBIC_myid(regs,fs);
- fs = (fs >>6) + 2; /* DIV */
- fs = (fs * 10000) / (dev->sc_clkfreq<<1); /* Cycle, in ns */
-
- ret = p << 2; /* in ns units */
- ret = ret / fs; /* in Cycles */
- if (ret < sbic_min_period)
- return(sbic_min_period);
-
- /* verify rounding */
- if (sbictoscsiperiod(dev, regs, ret) < p)
- ret++;
- return (ret >= 8) ? 0 : ret;
-}
-
-#ifdef DEBUG
-
-void
-sbicdumpstate()
-{
- u_char csr, asr;
-
- GET_SBIC_asr(debug_sbic_regs,asr);
- GET_SBIC_csr(debug_sbic_regs,csr);
- printf("%s: asr:csr(%02x:%02x)->(%02x:%02x)\n",
- (routine==1)?"sbicgo":
- (routine==2)?"sbicintr":
- (routine==3)?"sbicicmd":
- (routine==4)?"sbicnext":"unknown",
- debug_asr, debug_csr, asr, csr);
-
-}
-
-void
-sbictimeout(dev)
- struct sbic_softc *dev;
-{
- int s, asr;
-
- s = splbio();
- if (dev->sc_dmatimo) {
- if (dev->sc_dmatimo > 1) {
- printf("%s: dma timeout #%d\n",
- dev->sc_dev.dv_xname, dev->sc_dmatimo - 1);
- GET_SBIC_asr(dev->sc_sbicp, asr);
- if( asr & SBIC_ASR_INT ) {
- /* We need to service a missed IRQ */
- printf("Servicing a missed int:(%02x,%02x)->(%02x,??)\n",
- debug_asr, debug_csr, asr);
- sbicintr(dev);
- }
- sbicdumpstate();
- }
- dev->sc_dmatimo++;
- }
- splx(s);
- timeout((void *)sbictimeout, dev, 30 * hz);
-}
-
-void
-sbic_dump_acb(acb)
- struct sbic_acb *acb;
-{
- u_char *b = (u_char *) &acb->cmd;
- int i;
-
- printf("acb@%p ", acb);
- if (acb->xs == NULL) {
- printf("<unused>\n");
- return;
- }
- printf("(%d:%d) flags %2x clen %2d cmd ", acb->xs->sc_link->target,
- acb->xs->sc_link->lun, acb->flags, acb->clen);
- for (i = acb->clen; i; --i)
- printf(" %02x", *b++);
- printf("\n");
- printf(" xs: %8p data %8p:%04x ", acb->xs, acb->xs->data,
- acb->xs->datalen);
- printf("va %8p:%04x ", acb->sc_kv.dc_addr, acb->sc_kv.dc_count);
- printf("pa %8p:%04x tcnt %lx\n", acb->sc_pa.dc_addr, acb->sc_pa.dc_count,
- acb->sc_tcnt);
-}
-
-void
-sbic_dump(dev)
- struct sbic_softc *dev;
-{
- sbic_regmap_p regs;
- u_char csr, asr;
- struct sbic_acb *acb;
- int s;
- int i;
-
- s = splbio();
- regs = dev->sc_sbicp;
-#if CSR_TRACE_SIZE
- printf("csr trace: ");
- i = csr_traceptr;
- do {
- printf("%c%02x%02x%02x ", csr_trace[i].whr,
- csr_trace[i].csr, csr_trace[i].asr, csr_trace[i].xtn);
- switch(csr_trace[i].whr) {
- case 'g':
- printf("go "); break;
- case 's':
- printf("select "); break;
- case 'y':
- printf("select+ "); break;
- case 'i':
- printf("intr "); break;
- case 'f':
- printf("finish "); break;
- case '>':
- printf("out "); break;
- case '<':
- printf("in "); break;
- case 'm':
- printf("msgin "); break;
- case 'x':
- printf("msginx "); break;
- case 'X':
- printf("msginX "); break;
- case 'r':
- printf("reselect "); break;
- case 'I':
- printf("icmd "); break;
- case 'a':
- printf("abort "); break;
- default:
- printf("? ");
- }
- switch(csr_trace[i].csr) {
- case 0x11:
- printf("INITIATOR"); break;
- case 0x16:
- printf("S_XFERRED"); break;
- case 0x20:
- printf("MSGIN_ACK"); break;
- case 0x41:
- printf("DISC"); break;
- case 0x42:
- printf("SEL_TIMEO"); break;
- case 0x80:
- printf("RSLT_NI"); break;
- case 0x81:
- printf("RSLT_IFY"); break;
- case 0x85:
- printf("DISC_1"); break;
- case 0x18: case 0x19: case 0x1a:
- case 0x1b: case 0x1e: case 0x1f:
- case 0x28: case 0x29: case 0x2a:
- case 0x2b: case 0x2e: case 0x2f:
- case 0x48: case 0x49: case 0x4a:
- case 0x4b: case 0x4e: case 0x4f:
- case 0x88: case 0x89: case 0x8a:
- case 0x8b: case 0x8e: case 0x8f:
- switch(csr_trace[i].csr & 0xf0) {
- case 0x10:
- printf("DONE_"); break;
- case 0x20:
- printf("STOP_"); break;
- case 0x40:
- printf("ERR_"); break;
- case 0x80:
- printf("REQ_"); break;
- }
- switch(csr_trace[i].csr & 7) {
- case 0:
- printf("DATA_OUT"); break;
- case 1:
- printf("DATA_IN"); break;
- case 2:
- printf("CMD"); break;
- case 3:
- printf("STATUS"); break;
- case 6:
- printf("MSG_OUT"); break;
- case 7:
- printf("MSG_IN"); break;
- default:
- printf("invld phs");
- }
- break;
- default: printf("****"); break;
- }
- if (csr_trace[i].asr & SBIC_ASR_INT)
- printf(" ASR_INT");
- if (csr_trace[i].asr & SBIC_ASR_LCI)
- printf(" ASR_LCI");
- if (csr_trace[i].asr & SBIC_ASR_BSY)
- printf(" ASR_BSY");
- if (csr_trace[i].asr & SBIC_ASR_CIP)
- printf(" ASR_CIP");
- printf("\n");
- i = (i + 1) & (CSR_TRACE_SIZE - 1);
- } while (i != csr_traceptr);
-#endif
- GET_SBIC_asr(regs, asr);
- if ((asr & SBIC_ASR_INT) == 0)
- GET_SBIC_csr(regs, csr);
- else
- csr = 0;
- printf("%s@%p regs %p asr %x csr %x\n", dev->sc_dev.dv_xname,
- dev, regs, asr, csr);
- if ((acb = dev->free_list.tqh_first)) {
- printf("Free list:\n");
- while (acb) {
- sbic_dump_acb(acb);
- acb = acb->chain.tqe_next;
- }
- }
- if ((acb = dev->ready_list.tqh_first)) {
- printf("Ready list:\n");
- while (acb) {
- sbic_dump_acb(acb);
- acb = acb->chain.tqe_next;
- }
- }
- if ((acb = dev->nexus_list.tqh_first)) {
- printf("Nexus list:\n");
- while (acb) {
- sbic_dump_acb(acb);
- acb = acb->chain.tqe_next;
- }
- }
- if (dev->sc_nexus) {
- printf("nexus:\n");
- sbic_dump_acb(dev->sc_nexus);
- }
- printf("sc_xs %p targ %d lun %d flags %x tcnt %lx dmacmd %x mask %lx\n",
- dev->sc_xs, dev->target, dev->lun, dev->sc_flags, dev->sc_tcnt,
- dev->sc_dmacmd, dev->sc_dmamask);
- for (i = 0; i < 8; ++i) {
- if (dev->sc_tinfo[i].cmds > 2) {
- printf("tgt %d: cmds %d disc %d senses %d lubusy %x\n",
- i, dev->sc_tinfo[i].cmds,
- dev->sc_tinfo[i].dconns,
- dev->sc_tinfo[i].senses,
- dev->sc_tinfo[i].lubusy);
- }
- }
- splx(s);
-}
-
-#endif
diff --git a/sys/arch/kbus/dev/sbic.c.mvme b/sys/arch/kbus/dev/sbic.c.mvme
deleted file mode 100644
index 857121d8bae..00000000000
--- a/sys/arch/kbus/dev/sbic.c.mvme
+++ /dev/null
@@ -1,2719 +0,0 @@
-/* $OpenBSD: sbic.c.mvme,v 1.1.1.1 1997/10/14 07:25:29 gingold Exp $ */
-/* $NetBSD: sbic.c,v 1.2 1996/04/23 16:32:54 chuck Exp $ */
-/*
- * Changes Copyright (c) 1996 Steve Woodford
- * Original Copyright (c) 1994 Christian E. Hopps
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)scsi.c 7.5 (Berkeley) 5/4/91
- */
-
-/*
- * Steve Woodford (SCW), Apr, 1996
- * MVME147S WD33C93 Scsi Bus Interface Controller driver,
- *
- * Basically a de-loused and tidied up version of the Amiga AMD 33C93 driver.
- *
- * The original driver used features which required at least a WD33C93A
- * chip. The '147 has the original WD33C93 chip (no 'A' suffix).
- *
- * This version of the driver is pretty well generic, so should work with
- * any flavour of WD33C93 chip.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/kernel.h> /* For hz */
-#include <sys/disklabel.h>
-#include <sys/dkstat.h>
-#include <sys/buf.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-#include <vm/pmap.h>
-#include <machine/pmap.h>
-#include <dev/dmavar.h>
-#include <dev/sbicreg.h>
-#include <dev/sbicvar.h>
-#include <machine/autoconf.h>
-
-/*
- * Since I can't find this in any other header files
- */
-#define SCSI_PHASE(reg) (reg&0x07)
-
-/*
- * SCSI delays
- * In u-seconds, primarily for state changes on the SPC.
- */
-#define SBIC_CMD_WAIT 50000 /* wait per step of 'immediate' cmds */
-#define SBIC_DATA_WAIT 50000 /* wait per data in/out step */
-#define SBIC_INIT_WAIT 50000 /* wait per step (both) during init */
-
-/*
- * Convenience macro for waiting for a particular sbic event
- */
-#define SBIC_WAIT(regs, until, timeo) sbicwait(regs, until, timeo, __LINE__)
-
-int sbicicmd __P((struct sbic_softc *, void *, int, void *, int));
-int sbicgo __P((struct sbic_softc *, struct scsi_xfer *));
-int sbicdmaok __P((struct sbic_softc *, struct scsi_xfer *));
-int sbicwait __P((sbic_regmap_p, u_char, int , int));
-int sbiccheckdmap __P((void *, u_long, u_long));
-u_char sbicselectbus __P((struct sbic_softc *));
-int sbicxfout __P((sbic_regmap_p, int, void *));
-int sbicxfin __P((sbic_regmap_p, int, void *));
-int sbicfromscsiperiod __P((struct sbic_softc *, int));
-int sbictoscsiperiod __P((struct sbic_softc *, int));
-int sbicintr __P((struct sbic_softc *));
-int sbicpoll __P((struct sbic_softc *));
-int sbicnextstate __P((struct sbic_softc *, u_char, u_char));
-int sbicmsgin __P((struct sbic_softc *));
-int sbicabort __P((struct sbic_softc *, char *));
-void sbicxfdone __P((struct sbic_softc *));
-void sbicerror __P((struct sbic_softc *,u_char));
-void sbicreset __P((struct sbic_softc *));
-void sbic_scsidone __P((struct sbic_acb *, int));
-void sbic_sched __P((struct sbic_softc *));
-void sbic_save_ptrs __P((struct sbic_softc *));
-void sbic_load_ptrs __P((struct sbic_softc *));
-
-/*
- * Synch xfer parameters, and timing conversions
- */
-int sbic_min_period = SBIC_SYN_MIN_PERIOD; /* in cycles = f(ICLK,FSn) */
-int sbic_max_offset = SBIC_SYN_MAX_OFFSET; /* pure number */
-int sbic_cmd_wait = SBIC_CMD_WAIT;
-int sbic_data_wait = SBIC_DATA_WAIT;
-int sbic_init_wait = SBIC_INIT_WAIT;
-
-/*
- * was broken before.. now if you want this you get it for all drives
- * on sbic controllers.
- */
-u_char sbic_inhibit_sync[8];
-int sbic_enable_reselect = 1; /* Allow Disconnect / Reselect */
-int sbic_no_dma = 0; /* Use PIO transfers instead of DMA */
-int sbic_parallel_operations = 1; /* Allow command queues */
-
-/*
- * Some useful stuff for debugging purposes
- */
-#ifdef DEBUG
-int sbicdma_ops = 0; /* total DMA operations */
-int sbicdma_hits = 0; /* number of DMA chains that were contiguous */
-int sbicdma_misses = 0; /* number of DMA chains that were not contiguous */
-int sbicdma_saves = 0;
-
-#define QPRINTF(a) if (sbic_debug > 1) printf a
-
-int sbic_debug = 2; /* Debug all chip related things */
-int sync_debug = 0; /* Debug all Synchronous Scsi related things */
-int reselect_debug = 0; /* Debug all reselection related things */
-int report_sense = 0; /* Always print Sense information */
-int data_pointer_debug = 2; /* Debug Data Pointer related things */
-
-void sbictimeout __P((struct sbic_softc *dev));
-
-#else
-#define QPRINTF(a) /* */
-#endif
-
-extern int kvtop __P((caddr_t addr));
-
-/*
- * default minphys routine for sbic based controllers
- */
-void
-sbic_minphys(bp)
- struct buf *bp;
-{
- /*
- * No max transfer at this level.
- */
- minphys(bp);
-}
-
-
-/*
- * Save DMA pointers. Take into account partial transfer. Shut down DMA.
- */
-void
-sbic_save_ptrs(dev)
- struct sbic_softc *dev;
-{
- sbic_regmap_p regs;
- struct sbic_acb* acb;
- int count,
- asr,
- s;
-
- /*
- * Only need to save pointers if DMA was active...
- */
- if ( dev->sc_cur == NULL || (dev->sc_flags & SBICF_INDMA) == 0 )
- return;
-
- regs = dev->sc_sbicp;
-
- s = splbio();
-
- /*
- * Wait until WD chip is idle
- */
- do {
- GET_SBIC_asr(regs, asr);
- if( asr & SBIC_ASR_DBR ) {
- printf("sbic_save_ptrs: asr %02x canceled!\n", asr);
- splx(s);
- return;
- }
- } while( asr & (SBIC_ASR_BSY|SBIC_ASR_CIP) );
-
-
- /*
- * Save important state.
- * must be done before dmastop
- */
- acb = dev->sc_nexus;
- acb->sc_dmacmd = dev->sc_dmacmd;
-
- /*
- * Fetch the residual count
- */
- SBIC_TC_GET(regs, count);
-
- /*
- * Shut down DMA
- */
- dev->sc_dmastop(dev);
-
- /*
- * No longer in DMA
- */
- dev->sc_flags &= ~SBICF_INDMA;
-
- /*
- * Ensure the WD chip is back in polled I/O mode, with nothing to
- * transfer.
- */
- SBIC_TC_PUT(regs, 0);
- SET_SBIC_control(regs, SBIC_CTL_EDI | SBIC_CTL_IDI);
-
- /*
- * Update current count...
- */
- acb->sc_tcnt = count;
-
- /*
- * Work out how many bytes were actually transferred
- */
- count = dev->sc_tcnt - count;
- dev->sc_tcnt = acb->sc_tcnt;
-
- /*
- * Fixup partial xfers
- */
- acb->sc_kv.dc_addr += count;
- acb->sc_kv.dc_count -= count;
- acb->sc_pa.dc_addr += count;
- acb->sc_pa.dc_count -= count >> 1;
-
-#ifdef DEBUG
- if ( data_pointer_debug )
- printf("save at (%x,%x):%x\n",
- dev->sc_cur->dc_addr, dev->sc_cur->dc_count,count);
- sbicdma_saves++;
-#endif
-
- splx(s);
-}
-
-
-/*
- * DOES NOT RESTART DMA!!!
- */
-void
-sbic_load_ptrs(dev)
- struct sbic_softc *dev;
-{
- struct sbic_acb *acb = dev->sc_nexus;
- int s;
-
- if ( acb->sc_kv.dc_count == 0 ) {
- /*
- * No data to xfer
- */
- return;
- }
-
- s = splbio();
-
- /*
- * Reset the Scatter-Gather chain
- */
- dev->sc_last = dev->sc_cur = &acb->sc_pa;
-
- /*
- * Restore the Transfer Count and DMA specific data
- */
- dev->sc_tcnt = acb->sc_tcnt;
- dev->sc_dmacmd = acb->sc_dmacmd;
-
-#ifdef DEBUG
- sbicdma_ops++;
-#endif
-
- /*
- * Need to fixup new segment?
- */
- if ( dev->sc_tcnt == 0 ) {
- /*
- * sc_tcnt == 0 implies end of segment
- */
- char *vaddr, *paddr;
- int count;
-
- /*
- * do kvm to pa mappings
- */
- vaddr = acb->sc_kv.dc_addr;
- paddr = acb->sc_pa.dc_addr = (char *) kvtop(vaddr);
-
- for (count = (NBPG - ((int)vaddr & PGOFSET));
- count < acb->sc_kv.dc_count &&
- (char*)kvtop(vaddr + count + 4) == paddr + count + 4;
- count += NBPG)
- ; /* Do nothing */
-
- /*
- * If it's all contiguous...
- */
- if ( count > acb->sc_kv.dc_count ) {
- count = acb->sc_kv.dc_count;
-#ifdef DEBUG
- sbicdma_hits++;
-#endif
- }
-#ifdef DEBUG
- else
- sbicdma_misses++;
-#endif
-
- acb->sc_tcnt = count;
- acb->sc_pa.dc_count = count >> 1;
-
-#ifdef DEBUG
- if ( data_pointer_debug )
- printf("DMA recalc:kv(%x,%x)pa(%x,%x)\n", acb->sc_kv.dc_addr,
- acb->sc_kv.dc_count,
- acb->sc_pa.dc_addr,
- acb->sc_tcnt);
-#endif
-
- }
-
- splx(s);
-}
-
-/*
- * used by specific sbic controller
- *
- * it appears that the higher level code does nothing with LUN's
- * so I will too. I could plug it in, however so could they
- * in scsi_scsi_cmd().
- */
-int
-sbic_scsicmd(xs)
- struct scsi_xfer *xs;
-{
- struct scsi_link *slp = xs->sc_link;
- struct sbic_softc *dev = slp->adapter_softc;
- struct sbic_acb *acb;
- int flags = xs->flags,
- s;
-
- if ( flags & SCSI_DATA_UIO )
- panic("sbic: scsi data uio requested");
-
- if ( dev->sc_nexus && (flags & SCSI_POLL) )
- panic("sbic_scsicmd: busy");
-
- if ( slp->target == slp->adapter_target )
- return ESCAPE_NOT_SUPPORTED;
-
- s = splbio();
-
- if ( (acb = dev->free_list.tqh_first) != NULL )
- TAILQ_REMOVE(&dev->free_list, acb, chain);
-
- splx(s);
-
- if ( acb == NULL ) {
-#ifdef DEBUG
- printf("sbic_scsicmd: unable to queue request for target %d\n",
- slp->target);
-#ifdef DDB
- Debugger();
-#endif
-#endif
- xs->error = XS_DRIVER_STUFFUP;
-
- return(TRY_AGAIN_LATER);
- }
-
- if ( flags & SCSI_DATA_IN )
- acb->flags = ACB_ACTIVE | ACB_DATAIN;
- else
- acb->flags = ACB_ACTIVE;
-
- acb->xs = xs;
- acb->clen = xs->cmdlen;
- acb->sc_kv.dc_addr = xs->data;
- acb->sc_kv.dc_count = xs->datalen;
- acb->pa_addr = xs->data ? (char *)kvtop(xs->data) : 0;
- bcopy(xs->cmd, &acb->cmd, xs->cmdlen);
-
- if ( flags & SCSI_POLL ) {
- /*
- * This has major side effects -- it locks up the machine
- */
- int stat;
-
- s = splbio();
-
- dev->sc_flags |= SBICF_ICMD;
-
- do {
- /*
- * If we already had a nexus, while away the time until idle...
- * This is likely only to happen if a reselection occurs between
- * here and our earlier check for ICMD && sc_nexus (which would
- * have resulted in a panic() had it been true).
- */
- while ( dev->sc_nexus )
- sbicpoll(dev);
-
- /*
- * Fix up the new nexus
- */
- dev->sc_nexus = acb;
- dev->sc_xs = xs;
- dev->target = slp->target;
- dev->lun = slp->lun;
-
- stat = sbicicmd(dev, &acb->cmd, acb->clen,
- acb->sc_kv.dc_addr, acb->sc_kv.dc_count);
-
- } while ( dev->sc_nexus != acb );
-
- sbic_scsidone(acb, stat);
-
- splx(s);
-
- return(COMPLETE);
- }
-
- s = splbio();
- TAILQ_INSERT_TAIL(&dev->ready_list, acb, chain);
-
- /*
- * If nothing is active, try to start it now.
- */
- if ( dev->sc_nexus == NULL )
- sbic_sched(dev);
-
- splx(s);
-
- return(SUCCESSFULLY_QUEUED);
-}
-
-/*
- * attempt to start the next available command
- */
-void
-sbic_sched(dev)
- struct sbic_softc *dev;
-{
- struct scsi_xfer *xs;
- struct scsi_link *slp = NULL; /* Gag the compiler */
- struct sbic_acb *acb;
- int flags,
- stat;
-
- /*
- * XXXSCW
- * I'll keep this test here, even though I can't see any obvious way
- * in which sbic_sched() could be called with sc_nexus non NULL
- */
- if ( dev->sc_nexus )
- return; /* a command is current active */
-
- /*
- * Loop through the ready list looking for work to do...
- */
- for (acb = dev->ready_list.tqh_first; acb; acb = acb->chain.tqe_next) {
- int i, j;
-
- slp = acb->xs->sc_link;
- i = slp->target;
- j = 1 << slp->lun;
-
- /*
- * We've found a potential command, but is the target/lun busy?
- */
- if ( (dev->sc_tinfo[i].lubusy & j) == 0 ) {
- /*
- * Nope, it's not busy, so we can use it.
- */
- dev->sc_tinfo[i].lubusy |= j;
- TAILQ_REMOVE(&dev->ready_list, acb, chain);
- dev->sc_nexus = acb;
- acb->sc_pa.dc_addr = acb->pa_addr; /* XXXX check */
- break;
- }
- }
-
- if ( acb == NULL ) {
- QPRINTF(("sbicsched: no work\n"));
- return; /* did not find an available command */
- }
-
-#ifdef DEBUG
- if ( data_pointer_debug > 1 )
- printf("sbic_sched(%d,%d)\n", slp->target, slp->lun);
-#endif
-
- dev->sc_xs = xs = acb->xs;
- flags = xs->flags;
-
- if ( flags & SCSI_RESET )
- sbicreset(dev);
-
- dev->sc_stat[0] = -1;
- dev->target = slp->target;
- dev->lun = slp->lun;
-
- if ( flags & SCSI_POLL || (!sbic_parallel_operations &&
- (sbicdmaok(dev, xs) == 0)) )
- stat = sbicicmd(dev, &acb->cmd, acb->clen,
- acb->sc_kv.dc_addr, acb->sc_kv.dc_count);
- else
- if ( sbicgo(dev, xs) == 0 )
- return;
- else
- stat = dev->sc_stat[0];
-
- sbic_scsidone(acb, stat);
-}
-
-void
-sbic_scsidone(acb, stat)
- struct sbic_acb *acb;
- int stat;
-{
- struct scsi_xfer *xs = acb->xs;
- struct scsi_link *slp = xs->sc_link;
- struct sbic_softc *dev = slp->adapter_softc;
- int dosched = 0;
-
-#ifdef DIAGNOSTIC
- if ( acb == NULL || xs == NULL ) {
- printf("sbic_scsidone -- (%d,%d) no scsi_xfer\n", dev->target, dev->lun);
-#ifdef DDB
- Debugger();
-#endif
- return;
- }
-#endif
-
- if ( slp->device_softc &&
- ((struct device *)(slp->device_softc))->dv_unit < dk_ndrive)
- ++dk_xfer[((struct device *)(slp->device_softc))->dv_unit];
-
- /*
- * is this right?
- */
- xs->status = stat;
-
-#ifdef DEBUG
- if ( data_pointer_debug > 1 )
- printf("scsidone: (%d,%d)->(%d,%d)%02x\n", slp->target, slp->lun,
- dev->target, dev->lun, stat);
-
- if ( xs->sc_link->target == dev->sc_link.adapter_target )
- panic("target == hostid");
-#endif
-
- if ( xs->error == XS_NOERROR && (acb->flags & ACB_CHKSENSE) == 0 ) {
-
- if ( stat == SCSI_CHECK ) {
- /*
- * Schedule a REQUEST SENSE
- */
- struct scsi_sense *ss = (void *)&acb->cmd;
-
-#ifdef DEBUG
- if ( report_sense )
- printf("sbic_scsidone: autosense %02x targ %d lun %d",
- acb->cmd.opcode, slp->target, slp->lun);
-#endif
-
- bzero(ss, sizeof(*ss));
-
- ss->opcode = REQUEST_SENSE;
- ss->byte2 = slp->lun << 5;
- ss->length = sizeof(struct scsi_sense_data);
-
- acb->clen = sizeof(*ss);
- acb->sc_kv.dc_addr = (char *)&xs->sense;
- acb->sc_kv.dc_count = sizeof(struct scsi_sense_data);
- acb->pa_addr = (char *)kvtop((caddr_t)&xs->sense); /* XXX check */
- acb->flags = ACB_ACTIVE | ACB_CHKSENSE | ACB_DATAIN;
-
- TAILQ_INSERT_HEAD(&dev->ready_list, acb, chain);
-
- dev->sc_tinfo[slp->target].lubusy &= ~(1 << slp->lun);
- dev->sc_tinfo[slp->target].senses++;
-
- if ( dev->sc_nexus == acb ) {
- dev->sc_nexus = NULL;
- dev->sc_xs = NULL;
- sbic_sched(dev);
- }
- return;
- }
- }
-
- if ( xs->error == XS_NOERROR && (acb->flags & ACB_CHKSENSE) != 0 ) {
-
- xs->error = XS_SENSE;
-
-#ifdef DEBUG
- if (report_sense)
- printf(" => %02x %02x\n", xs->sense.flags,
- xs->sense.extra_bytes[3]);
-#endif
-
- } else {
- xs->resid = 0; /* XXXX */
- }
-
- xs->flags |= ITSDONE;
-
- /*
- * Remove the ACB from whatever queue it's on. We have to do a bit of
- * a hack to figure out which queue it's on. Note that it is *not*
- * necessary to cdr down the ready queue, but we must cdr down the
- * nexus queue and see if it's there, so we can mark the unit as no
- * longer busy. This code is sickening, but it works.
- */
- if ( acb == dev->sc_nexus ) {
-
- dev->sc_nexus = NULL;
- dev->sc_xs = NULL;
-
- dev->sc_tinfo[slp->target].lubusy &= ~(1 << slp->lun);
-
- if ( dev->ready_list.tqh_first )
- dosched = 1; /* start next command */
-
- } else
- if ( dev->ready_list.tqh_last == &acb->chain.tqe_next ) {
-
- TAILQ_REMOVE(&dev->ready_list, acb, chain);
-
- } else {
-
- register struct sbic_acb *a;
-
- for (a = dev->nexus_list.tqh_first; a; a = a->chain.tqe_next) {
- if ( a == acb ) {
- TAILQ_REMOVE(&dev->nexus_list, acb, chain);
- dev->sc_tinfo[slp->target].lubusy &= ~(1 << slp->lun);
- break;
- }
- }
-
- if ( a )
- ;
- else if ( acb->chain.tqe_next ) {
- TAILQ_REMOVE(&dev->ready_list, acb, chain);
- } else {
- printf("%s: can't find matching acb\n", dev->sc_dev.dv_xname);
-#ifdef DDB
- Debugger();
-#endif
- }
- }
-
- /*
- * Put it on the free list.
- */
- acb->flags = ACB_FREE;
- TAILQ_INSERT_HEAD(&dev->free_list, acb, chain);
-
- dev->sc_tinfo[slp->target].cmds++;
-
- scsi_done(xs);
-
- if ( dosched )
- sbic_sched(dev);
-}
-
-int
-sbicdmaok(dev, xs)
- struct sbic_softc *dev;
- struct scsi_xfer *xs;
-{
- if ( sbic_no_dma || xs->datalen & 0x03 || (int)xs->data & 0x03)
- return(0);
-
- /*
- * controller supports dma to any addresses?
- */
- if ( (dev->sc_flags & SBICF_BADDMA) == 0 )
- return(1);
-
- /*
- * this address is ok for dma?
- */
- if ( sbiccheckdmap(xs->data, xs->datalen, dev->sc_dmamask) == 0 )
- return(1);
-
- return(0);
-}
-
-int
-sbicwait(regs, until, timeo, line)
- sbic_regmap_p regs;
- u_char until;
- int timeo;
- int line;
-{
- u_char val;
-
- if ( timeo == 0 )
- timeo = 1000000; /* some large value.. */
-
- GET_SBIC_asr(regs, val);
-
- while ( (val & until) == 0 ) {
-
- if ( timeo-- == 0 ) {
- int csr;
- GET_SBIC_csr(regs, csr);
- printf("sbicwait TIMEO @%d with asr=x%x csr=x%x\n", line, val, csr);
-#if defined(DDB) && defined(DEBUG)
- Debugger();
-#endif
- return(val); /* Maybe I should abort */
- break;
- }
-
- DELAY(1);
- GET_SBIC_asr(regs, val);
- }
-
- return(val);
-}
-
-int
-sbicabort(dev, where)
- struct sbic_softc *dev;
- char *where;
-{
- sbic_regmap_p regs = dev->sc_sbicp;
- u_char csr,
- asr;
-
- GET_SBIC_asr(regs, asr);
- GET_SBIC_csr(regs, csr);
-
- /*
- * Clean up chip itself
- */
- if ( dev->sc_flags & SBICF_SELECTED ) {
-
- while ( asr & SBIC_ASR_DBR ) {
- /*
- * sbic is jammed w/data. need to clear it
- * But we don't know what direction it needs to go
- */
- GET_SBIC_data(regs, asr);
- printf("%s: abort %s: clearing data buffer 0x%02x\n",
- dev->sc_dev.dv_xname, where, asr);
- GET_SBIC_asr(regs, asr);
- if ( asr & SBIC_ASR_DBR ) /* Not the read direction, then */
- SET_SBIC_data(regs, asr);
- GET_SBIC_asr(regs, asr);
- }
-
- WAIT_CIP(regs);
-
- printf("%s: sbicabort - sending ABORT command\n", dev->sc_dev.dv_xname);
- SET_SBIC_cmd(regs, SBIC_CMD_ABORT);
- WAIT_CIP(regs);
-
- GET_SBIC_asr(regs, asr);
-
- if ( asr & (SBIC_ASR_BSY|SBIC_ASR_LCI) ) {
- /*
- * ok, get more drastic..
- */
- printf("%s: sbicabort - asr %x, trying to reset\n",
- dev->sc_dev.dv_xname, asr);
- sbicreset(dev);
- dev->sc_flags &= ~SBICF_SELECTED;
- return SBIC_STATE_ERROR;
- }
-
- printf("%s: sbicabort - sending DISC command\n", dev->sc_dev.dv_xname);
- SET_SBIC_cmd(regs, SBIC_CMD_DISC);
-
- do {
- SBIC_WAIT (regs, SBIC_ASR_INT, 0);
- GET_SBIC_asr(regs, asr);
- GET_SBIC_csr (regs, csr);
- QPRINTF(("csr: 0x%02x, asr: 0x%02x\n", csr, asr));
- } while ( (csr != SBIC_CSR_DISC) && (csr != SBIC_CSR_DISC_1) &&
- (csr != SBIC_CSR_CMD_INVALID) );
-
- /*
- * lets just hope it worked..
- */
- dev->sc_flags &= ~SBICF_SELECTED;
- }
-
- return SBIC_STATE_ERROR;
-}
-
-
-/*
- * Initialize driver-private structures
- */
-void
-sbicinit(dev)
- struct sbic_softc *dev;
-{
- u_int i;
-
- extern u_long scsi_nosync;
- extern int shift_nosync;
-
- if ( (dev->sc_flags & SBICF_ALIVE) == 0 ) {
-
- struct sbic_acb *acb;
-
- TAILQ_INIT(&dev->ready_list);
- TAILQ_INIT(&dev->nexus_list);
- TAILQ_INIT(&dev->free_list);
-
- dev->sc_nexus = NULL;
- dev->sc_xs = NULL;
-
- acb = dev->sc_acb;
- bzero(acb, sizeof(dev->sc_acb));
-
- for (i = 0; i < sizeof(dev->sc_acb) / sizeof(*acb); i++) {
- TAILQ_INSERT_TAIL(&dev->free_list, acb, chain);
- acb++;
- }
-
- bzero(dev->sc_tinfo, sizeof(dev->sc_tinfo));
-
-#ifdef DEBUG
- /*
- * make sure timeout is really not needed
- */
- timeout((void *)sbictimeout, dev, 30 * hz);
-#endif
-
- } else
- panic("sbic: reinitializing driver!");
-
- dev->sc_flags |= SBICF_ALIVE;
- dev->sc_flags &= ~SBICF_SELECTED;
-
- /*
- * initialize inhibit array
- */
- if ( scsi_nosync ) {
-
- u_int inhibit_sync = (scsi_nosync >> shift_nosync) & 0xff;
-
- shift_nosync += 8;
-
-#ifdef DEBUG
- if ( inhibit_sync )
- printf("%s: Inhibiting synchronous transfer %02x\n",
- dev->sc_dev.dv_xname, inhibit_sync);
-#endif
- for (i = 0; i < 8; ++i) {
- if ( inhibit_sync & (1 << i) )
- sbic_inhibit_sync[i] = 1;
- }
- }
-
- sbicreset(dev);
-}
-
-void
-sbicreset(dev)
- struct sbic_softc *dev;
-{
- sbic_regmap_p regs = dev->sc_sbicp;
- u_int my_id,
- s;
- u_char csr;
- u_char asr;
-
- GET_SBIC_asr (regs, asr);
- s = splbio();
-
- my_id = dev->sc_link.adapter_target & SBIC_ID_MASK;
-
- if (dev->sc_clkfreq < 110)
- my_id |= SBIC_ID_FS_8_10;
- else if (dev->sc_clkfreq < 160)
- my_id |= SBIC_ID_FS_12_15;
- else if (dev->sc_clkfreq < 210)
- my_id |= SBIC_ID_FS_16_20;
-
- SET_SBIC_myid(regs, my_id);
-
- /*
- * Reset the chip
- */
- SET_SBIC_cmd(regs, SBIC_CMD_RESET);
- DELAY(25);
-
- SBIC_WAIT(regs, SBIC_ASR_INT, 0);
- GET_SBIC_csr(regs, csr); /* clears interrupt also */
- GET_SBIC_asr (regs, asr);
-
- /*
- * Set up various chip parameters
- */
- SET_SBIC_control(regs,
- SBIC_CTL_EDI | SBIC_CTL_IDI | SBIC_MACHINE_DMA_MODE);
-
- /*
- * don't allow Selection (SBIC_RID_ES)
- * until we can handle target mode!!
- */
- SET_SBIC_rselid(regs, SBIC_RID_ER);
-
- /*
- * Asynchronous for now
- */
- SET_SBIC_syn(regs, 0);
-
- /*
- * Anything else was zeroed by reset
- */
- splx(s);
-
- dev->sc_flags &= ~SBICF_SELECTED;
- GET_SBIC_asr (regs, asr);
-}
-
-void
-sbicerror(dev, csr)
- struct sbic_softc *dev;
- u_char csr;
-{
- struct scsi_xfer *xs = dev->sc_xs;
-
-#ifdef DIAGNOSTIC
- if ( xs == NULL )
- panic("sbicerror: dev->sc_xs == NULL");
-#endif
-
- if ( xs->flags & SCSI_SILENT )
- return;
-
- printf("%s: csr == 0x%02x\n", dev->sc_dev.dv_xname, csr);
-}
-
-/*
- * select the bus, return when selected or error.
- *
- * Returns the current CSR following selection and optionally MSG out phase.
- * i.e. the returned CSR *should* indicate CMD phase...
- * If the return value is 0, some error happened.
- */
-u_char
-sbicselectbus(dev)
- struct sbic_softc *dev;
-{
- sbic_regmap_p regs = dev->sc_sbicp;
- u_char target = dev->target,
- lun = dev->lun,
- asr,
- csr,
- id;
-
- /*
- * if we're already selected, return (XXXX panic maybe?)
- */
- if ( dev->sc_flags & SBICF_SELECTED )
- return(0);
-
- QPRINTF(("sbicselectbus %d: ", target));
-
- /*
- * issue select
- */
- SET_SBIC_selid(regs, target);
- SET_SBIC_timeo(regs, SBIC_TIMEOUT(250, dev->sc_clkfreq));
-
- GET_SBIC_asr(regs, asr);
-
- if ( asr & (SBIC_ASR_INT|SBIC_ASR_BSY) ) {
- /*
- * This means we got ourselves reselected upon
- */
- QPRINTF(("WD busy (reselect?)\n"));
- return 0;
- }
-
- SET_SBIC_cmd(regs, SBIC_CMD_SEL_ATN);
-
- /*
- * wait for select (merged from seperate function may need
- * cleanup)
- */
- WAIT_CIP(regs);
-
- do {
-
- asr = SBIC_WAIT(regs, SBIC_ASR_INT | SBIC_ASR_LCI, 0);
-
- if ( asr & SBIC_ASR_LCI ) {
- QPRINTF(("late LCI: asr %02x\n", asr));
- return 0;
- }
-
- /*
- * Clear interrupt
- */
- GET_SBIC_csr (regs, csr);
-
- QPRINTF(("%02x ", csr));
-
- /*
- * Reselected from under our feet?
- */
- if ( csr == SBIC_CSR_RSLT_NI || csr == SBIC_CSR_RSLT_IFY ) {
- QPRINTF(("got reselected, asr %02x\n", asr));
- /*
- * We need to handle this now so we don't lock up later
- */
- sbicnextstate(dev, csr, asr);
-
- return 0;
- }
-
- /*
- * Whoops!
- */
- if ( csr == SBIC_CSR_SLT || csr == SBIC_CSR_SLT_ATN ) {
- panic("sbicselectbus: target issued select!");
- return 0;
- }
-
- } while (csr != (SBIC_CSR_MIS_2 | MESG_OUT_PHASE) &&
- csr != (SBIC_CSR_MIS_2 | CMD_PHASE) &&
- csr != SBIC_CSR_SEL_TIMEO);
-
- /*
- * Anyone at home?
- */
- if ( csr == SBIC_CSR_SEL_TIMEO ) {
- dev->sc_xs->error = XS_SELTIMEOUT;
- QPRINTF(("Selection Timeout\n"));
- return 0;
- }
-
- QPRINTF(("Selection Complete\n"));
-
- /*
- * Assume we're now selected
- */
- GET_SBIC_selid(regs, id);
- dev->target = id;
- dev->lun = lun;
- dev->sc_flags |= SBICF_SELECTED;
-
- /*
- * Enable (or not) reselection
- * XXXSCW This is probably not necessary since we don't use use the
- * Select-and-Xfer-with-ATN command to initiate a selection...
- */
- if ( !sbic_enable_reselect && dev->nexus_list.tqh_first == NULL)
- SET_SBIC_rselid (regs, 0);
- else
- SET_SBIC_rselid (regs, SBIC_RID_ER);
-
- /*
- * We only really need to do anything when the target goes to MSG out
- * If the device ignored ATN, it's probably old and brain-dead,
- * but we'll try to support it anyhow.
- * If it doesn't support message out, it definately doesn't
- * support synchronous transfers, so no point in even asking...
- */
- if ( csr == (SBIC_CSR_MIS_2 | MESG_OUT_PHASE) ) {
- /*
- * Send identify message (SCSI-2 requires an identify msg)
- */
- if ( sbic_inhibit_sync[id] && dev->sc_sync[id].state == SYNC_START ) {
- /*
- * Handle drives that don't want to be asked
- * whether to go sync at all.
- */
- dev->sc_sync[id].offset = 0;
- dev->sc_sync[id].period = sbic_min_period;
- dev->sc_sync[id].state = SYNC_DONE;
- }
-
- /*
- * Do we need to negotiate Synchronous Xfers for this target?
- */
- if ( dev->sc_sync[id].state != SYNC_START ) {
- /*
- * Nope, we've already negotiated.
- * Now see if we should allow the target to disconnect/reselect...
- */
- if ( dev->sc_xs->flags & SCSI_POLL || dev->sc_flags & SBICF_ICMD ||
- !sbic_enable_reselect )
- SEND_BYTE (regs, MSG_IDENTIFY | lun);
- else
- SEND_BYTE (regs, MSG_IDENTIFY_DR | lun);
-
- } else {
- /*
- * try to initiate a sync transfer.
- * So compose the sync message we're going
- * to send to the target
- */
-#ifdef DEBUG
- if ( sync_debug )
- printf("\nSending sync request to target %d ... ", id);
-#endif
- /*
- * setup scsi message sync message request
- */
- dev->sc_msg[0] = MSG_IDENTIFY | lun;
- dev->sc_msg[1] = MSG_EXT_MESSAGE;
- dev->sc_msg[2] = 3;
- dev->sc_msg[3] = MSG_SYNC_REQ;
- dev->sc_msg[4] = sbictoscsiperiod(dev, sbic_min_period);
- dev->sc_msg[5] = sbic_max_offset;
-
- sbicxfout(regs, 6, dev->sc_msg);
-
- dev->sc_sync[id].state = SYNC_SENT;
-#ifdef DEBUG
- if ( sync_debug )
- printf ("sent\n");
-#endif
- }
-
- /*
- * There's one interrupt still to come: the change to CMD phase...
- */
- SBIC_WAIT(regs, SBIC_ASR_INT , 0);
- GET_SBIC_csr(regs, csr);
- }
-
- /*
- * set sync or async
- */
- if ( dev->sc_sync[target].state == SYNC_DONE ) {
-#ifdef DEBUG
- if ( sync_debug )
- printf("select(%d): sync reg = 0x%02x\n", target,
- SBIC_SYN(dev->sc_sync[target].offset,
- dev->sc_sync[target].period));
-#endif
- SET_SBIC_syn(regs, SBIC_SYN(dev->sc_sync[target].offset,
- dev->sc_sync[target].period));
- } else {
-#ifdef DEBUG
- if ( sync_debug )
- printf("select(%d): sync reg = 0x%02x\n", target,
- SBIC_SYN(0,sbic_min_period));
-#endif
- SET_SBIC_syn(regs, SBIC_SYN(0, sbic_min_period));
- }
-
- return csr;
-}
-
-/*
- * Information Transfer *to* a Scsi Target.
- *
- * Note: Don't expect there to be an interrupt immediately after all
- * the data is transferred out. The WD spec sheet says that the Transfer-
- * Info command for non-MSG_IN phases only completes when the target
- * next asserts 'REQ'. That is, when the SCSI bus changes to a new state.
- *
- * This can have a nasty effect on commands which take a relatively long
- * time to complete, for example a START/STOP unit command may remain in
- * CMD phase until the disk has spun up. Only then will the target change
- * to STATUS phase. This is really only a problem for immediate commands
- * since we don't allow disconnection for them (yet).
- */
-int
-sbicxfout(regs, len, bp)
- sbic_regmap_p regs;
- int len;
- void *bp;
-{
- int wait = sbic_data_wait;
- u_char asr,
- *buf = bp;
-
- QPRINTF(("sbicxfout {%d} %02x %02x %02x %02x %02x "
- "%02x %02x %02x %02x %02x\n", len, buf[0], buf[1], buf[2],
- buf[3], buf[4], buf[5], buf[6], buf[7], buf[8], buf[9]));
-
- /*
- * sigh.. WD-PROTO strikes again.. sending the command in one go
- * causes the chip to lock up if talking to certain (misbehaving?)
- * targets. Anyway, this procedure should work for all targets, but
- * it's slightly slower due to the overhead
- */
- WAIT_CIP (regs);
-
- SBIC_TC_PUT (regs, 0);
- SET_SBIC_control(regs, SBIC_CTL_EDI | SBIC_CTL_IDI);
- SBIC_TC_PUT (regs, (unsigned)len);
- SET_SBIC_cmd (regs, SBIC_CMD_XFER_INFO);
-
- /*
- * Loop for each byte transferred
- */
- do {
-
- GET_SBIC_asr (regs, asr);
-
- if ( asr & SBIC_ASR_DBR ) {
- if ( len ) {
- SET_SBIC_data (regs, *buf);
- buf++;
- len--;
- } else {
- SET_SBIC_data (regs, 0);
- }
- wait = sbic_data_wait;
- }
-
- } while ( len && (asr & SBIC_ASR_INT) == 0 && wait-- > 0 );
-
-#ifdef DEBUG
- QPRINTF(("sbicxfout done: %d bytes remaining (wait:%d)\n", len, wait));
-#endif
-
- /*
- * Normally, an interrupt will be pending when this routing returns.
- */
- return(len);
-}
-
-/*
- * Information Transfer *from* a Scsi Target
- * returns # bytes left to read
- */
-int
-sbicxfin(regs, len, bp)
- sbic_regmap_p regs;
- int len;
- void *bp;
-{
- int wait = sbic_data_wait;
- u_char *buf = bp;
- u_char asr;
-#ifdef DEBUG
- u_char *obp = bp;
-#endif
-
- WAIT_CIP (regs);
-
- SET_SBIC_control(regs, SBIC_CTL_EDI | SBIC_CTL_IDI);
- SBIC_TC_PUT (regs, (unsigned)len);
- SET_SBIC_cmd (regs, SBIC_CMD_XFER_INFO);
-
- /*
- * Loop for each byte transferred
- */
- do {
-
- GET_SBIC_asr (regs, asr);
-
- if ( asr & SBIC_ASR_DBR ) {
- if ( len ) {
- GET_SBIC_data (regs, *buf);
- buf++;
- len--;
- } else {
- u_char foo;
- GET_SBIC_data (regs, foo);
- }
- wait = sbic_data_wait;
- }
-
- } while ( (asr & SBIC_ASR_INT) == 0 && wait-- > 0 );
-
- QPRINTF(("sbicxfin {%d} %02x %02x %02x %02x %02x %02x "
- "%02x %02x %02x %02x\n", len, obp[0], obp[1], obp[2],
- obp[3], obp[4], obp[5], obp[6], obp[7], obp[8], obp[9]));
-
- SBIC_TC_PUT (regs, 0);
-
- /*
- * this leaves with one csr to be read
- */
- return len;
-}
-
-/*
- * SCSI 'immediate' command: issue a command to some SCSI device
- * and get back an 'immediate' response (i.e., do programmed xfer
- * to get the response data). 'cbuf' is a buffer containing a scsi
- * command of length clen bytes. 'buf' is a buffer of length 'len'
- * bytes for data. The transfer direction is determined by the device
- * (i.e., by the scsi bus data xfer phase). If 'len' is zero, the
- * command must supply no data.
- *
- * Note that although this routine looks like it can handle disconnect/
- * reselect, the fact is that it can't. There is still some work to be
- * done to clean this lot up.
- */
-int
-sbicicmd(dev, cbuf, clen, buf, len)
- struct sbic_softc *dev;
- void *cbuf,
- *buf;
- int clen,
- len;
-{
- sbic_regmap_p regs = dev->sc_sbicp;
- struct sbic_acb *acb = dev->sc_nexus;
- u_char csr,
- asr;
- int still_busy = SBIC_STATE_RUNNING;
-#ifdef DEBUG
- int counter = 0;
-#endif
-
- /*
- * Make sure pointers are OK
- */
- dev->sc_last = dev->sc_cur = &acb->sc_pa;
- dev->sc_tcnt = acb->sc_tcnt = 0;
-
- acb->sc_dmacmd = 0;
- acb->sc_pa.dc_count = 0; /* No DMA */
- acb->sc_kv.dc_addr = buf;
- acb->sc_kv.dc_count = len;
-
-#ifdef DEBUG
- if ( data_pointer_debug > 1 )
- printf("sbicicmd(%d,%d):%d\n", dev->target, dev->lun, acb->sc_kv.dc_count);
-#endif
-
- /*
- * set the sbic into non-DMA mode
- */
- SET_SBIC_control(regs, SBIC_CTL_EDI | SBIC_CTL_IDI);
-
- dev->sc_stat[0] = 0xff;
- dev->sc_msg[0] = 0xff;
-
- /*
- * We're stealing the SCSI bus
- */
- dev->sc_flags |= SBICF_ICMD;
-
- do {
- GET_SBIC_asr (regs, asr);
-
- /*
- * select the SCSI bus (it's an error if bus isn't free)
- */
- if ( (dev->sc_flags & SBICF_SELECTED) == 0 &&
- still_busy != SBIC_STATE_DISCONNECT ) {
- if ( (csr = sbicselectbus(dev)) == 0 ) {
- dev->sc_flags &= ~SBICF_ICMD;
- return(-1);
- }
- } else
- if ( (asr & (SBIC_ASR_BSY | SBIC_ASR_INT)) == SBIC_ASR_INT )
- GET_SBIC_csr(regs, csr);
- else
- csr = 0;
-
- if ( csr ) {
-
- QPRINTF((">ASR:0x%02x CSR:0x%02x< ", asr, csr));
-
- switch ( csr ) {
-
- case SBIC_CSR_S_XFERRED:
- case SBIC_CSR_DISC:
- case SBIC_CSR_DISC_1:
- {
- u_char phase;
-
- dev->sc_flags &= ~SBICF_SELECTED;
- GET_SBIC_cmd_phase (regs, phase);
-
- if ( phase == 0x60 ) {
- GET_SBIC_tlun (regs, dev->sc_stat[0]);
- still_busy = SBIC_STATE_DONE; /* done */
- } else {
-#ifdef DEBUG
- if ( reselect_debug > 1 )
- printf("sbicicmd: handling disconnect\n");
-#endif
- still_busy = SBIC_STATE_DISCONNECT;
- }
- }
- break;
-
- case SBIC_CSR_XFERRED | CMD_PHASE:
- case SBIC_CSR_MIS | CMD_PHASE:
- case SBIC_CSR_MIS_1 | CMD_PHASE:
- case SBIC_CSR_MIS_2 | CMD_PHASE:
- {
- if ( sbicxfout(regs, clen, cbuf) )
- still_busy = sbicabort(dev, "icmd sending cmd");
- }
- break;
-
- case SBIC_CSR_XFERRED | STATUS_PHASE:
- case SBIC_CSR_MIS | STATUS_PHASE:
- case SBIC_CSR_MIS_1 | STATUS_PHASE:
- case SBIC_CSR_MIS_2 | STATUS_PHASE:
- {
- /*
- * The sbic does the status/cmd-complete reading ok,
- * so do this with its hi-level commands.
- */
-#ifdef DEBUG
- if ( sbic_debug )
- printf("SBICICMD status phase (bsy=%d)\n", still_busy);
-#endif
- SET_SBIC_cmd_phase(regs, 0x46);
- SET_SBIC_cmd(regs, SBIC_CMD_SEL_ATN_XFER);
- }
- break;
-
- default:
- {
- still_busy = sbicnextstate(dev, csr, asr);
- }
- break;
- }
-
- /*
- * make sure the last command was taken,
- * ie. we're not hunting after an ignored command..
- */
- GET_SBIC_asr(regs, asr);
-
- /*
- * tapes may take a loooong time..
- */
- while (asr & SBIC_ASR_BSY ) {
-
- if ( asr & SBIC_ASR_DBR ) {
- int i;
-
- printf("sbicicmd: Waiting while sbic is jammed, CSR:%02x,ASR:%02x\n", csr,asr);
-#ifdef DDB
- Debugger();
-#endif
- /*
- * SBIC is jammed
- * DUNNO which direction
- * Try old direction
- */
- GET_SBIC_data(regs, i);
- GET_SBIC_asr(regs, asr);
-
- if ( asr & SBIC_ASR_DBR ) /* Wants us to write */
- SET_SBIC_data(regs, i);
- }
-
- GET_SBIC_asr(regs, asr);
- }
- }
-
- /*
- * wait for last command to complete
- */
- if ( asr & SBIC_ASR_LCI ) {
- printf("sbicicmd: last command ignored\n");
- }
- else
- if ( still_busy >= SBIC_STATE_RUNNING ) /* Bsy */
- SBIC_WAIT (regs, SBIC_ASR_INT, sbic_cmd_wait);
-
- /*
- * do it again
- */
- } while ( still_busy >= SBIC_STATE_RUNNING && dev->sc_stat[0] == 0xff );
-
- /*
- * Sometimes we need to do an extra read of the CSR
- */
- GET_SBIC_csr(regs, csr);
-
-#ifdef DEBUG
- if ( data_pointer_debug > 1 )
- printf("sbicicmd done(%d,%d):%d =%d=\n", dev->target, dev->lun,
- acb->sc_kv.dc_count,
- dev->sc_stat[0]);
-#endif
-
- dev->sc_flags &= ~SBICF_ICMD;
-
- return(dev->sc_stat[0]);
-}
-
-/*
- * Finish SCSI xfer command: After the completion interrupt from
- * a read/write operation, sequence through the final phases in
- * programmed i/o. This routine is a lot like sbicicmd except we
- * skip (and don't allow) the select, cmd out and data in/out phases.
- */
-void
-sbicxfdone(dev)
- struct sbic_softc *dev;
-{
- sbic_regmap_p regs = dev->sc_sbicp;
- u_char phase,
- csr;
- int s;
-
- QPRINTF(("{"));
- s = splbio();
-
- /*
- * have the sbic complete on its own
- */
- SBIC_TC_PUT(regs, 0);
- SET_SBIC_cmd_phase(regs, 0x46);
- SET_SBIC_cmd(regs, SBIC_CMD_SEL_ATN_XFER);
-
- do {
-
- SBIC_WAIT (regs, SBIC_ASR_INT, 0);
- GET_SBIC_csr (regs, csr);
- QPRINTF(("%02x:", csr));
-
- } while ( (csr != SBIC_CSR_DISC) && (csr != SBIC_CSR_DISC_1) &&
- (csr != SBIC_CSR_S_XFERRED));
-
- dev->sc_flags &= ~SBICF_SELECTED;
-
- GET_SBIC_cmd_phase (regs, phase);
- QPRINTF(("}%02x", phase));
-
- if ( phase == 0x60 )
- GET_SBIC_tlun(regs, dev->sc_stat[0]);
- else
- sbicerror(dev, csr);
-
- QPRINTF(("=STS:%02x=\n", dev->sc_stat[0]));
-
- splx(s);
-}
-
-/*
- * No DMA chains
- */
-int
-sbicgo(dev, xs)
- struct sbic_softc *dev;
- struct scsi_xfer *xs;
-{
- struct sbic_acb *acb = dev->sc_nexus;
- sbic_regmap_p regs = dev->sc_sbicp;
- int i,
- dmaflags,
- count,
- usedma;
- u_char csr,
- asr,
- *addr;
-
- dev->target = xs->sc_link->target;
- dev->lun = xs->sc_link->lun;
-
- usedma = sbicdmaok(dev, xs);
-
-#ifdef DEBUG
- if ( data_pointer_debug > 1 )
- printf("sbicgo(%d,%d): usedma=%d\n", dev->target, dev->lun, usedma);
-#endif
-
- /*
- * select the SCSI bus (it's an error if bus isn't free)
- */
- if ( (csr = sbicselectbus(dev)) == 0 )
- return(0); /* Not done: needs to be rescheduled */
-
- dev->sc_stat[0] = 0xff;
-
- /*
- * Calculate DMA chains now
- */
- if ( acb->flags & ACB_DATAIN )
- dmaflags = DMAGO_READ;
- else
- dmaflags = 0;
-
- addr = acb->sc_kv.dc_addr;
- count = acb->sc_kv.dc_count;
-
- if ( count && ((char *)kvtop(addr) != acb->sc_pa.dc_addr) ) {
- printf("sbic: DMA buffer mapping changed %x->%x\n",
- acb->sc_pa.dc_addr, kvtop(addr));
-#ifdef DDB
- Debugger();
-#endif
- }
-
-#ifdef DEBUG
- ++sbicdma_ops; /* count total DMA operations */
-#endif
-
- /*
- * Allocate the DMA chain
- * Mark end of segment...
- */
- acb->sc_tcnt = dev->sc_tcnt = 0;
- acb->sc_pa.dc_count = 0;
-
- sbic_load_ptrs(dev);
-
- /*
- * Enable interrupts but don't do any DMA
- * enintr() also enables interrupts for the sbic
- */
- dev->sc_enintr(dev);
-
- if ( usedma ) {
- dev->sc_tcnt = dev->sc_dmago(dev, acb->sc_pa.dc_addr,
- acb->sc_pa.dc_count, dmaflags);
-#ifdef DEBUG
- dev->sc_dmatimo = dev->sc_tcnt ? 1 : 0;
-#endif
- } else
- dev->sc_dmacmd = 0; /* Don't use DMA */
-
- acb->sc_dmacmd = dev->sc_dmacmd;
-
-#ifdef DEBUG
- if ( data_pointer_debug > 1 ) {
- printf("sbicgo dmago:%d(%x:%x) dmacmd=0x%02x\n", dev->target,
- dev->sc_cur->dc_addr,
- dev->sc_tcnt,
- dev->sc_dmacmd);
- }
-#endif
-
- /*
- * Lets cycle a while then let the interrupt handler take over.
- */
- GET_SBIC_asr(regs, asr);
-
- do {
-
- QPRINTF(("go "));
-
- /*
- * Handle the new phase
- */
- i = sbicnextstate(dev, csr, asr);
-#if 0
- WAIT_CIP(regs);
-#endif
- if ( i == SBIC_STATE_RUNNING ) {
- GET_SBIC_asr(regs, asr);
-
- if ( asr & SBIC_ASR_LCI )
- printf("sbicgo: LCI asr:%02x csr:%02x\n", asr, csr);
-
- if ( asr & SBIC_ASR_INT )
- GET_SBIC_csr(regs, csr);
- }
-
- } while ( i == SBIC_STATE_RUNNING && asr & (SBIC_ASR_INT|SBIC_ASR_LCI) );
-
- if ( i == SBIC_STATE_DONE ) {
- if ( dev->sc_stat[0] == 0xff )
-#if 0
- printf("sbicgo: done & stat = 0xff\n");
-#else
- ;
-#endif
- else
- return 1; /* Did we really finish that fast? */
- }
-
- return 0;
-}
-
-
-int
-sbicintr(dev)
- struct sbic_softc *dev;
-{
- sbic_regmap_p regs = dev->sc_sbicp;
- u_char asr,
- csr;
- int i;
-
- /*
- * pending interrupt?
- */
- GET_SBIC_asr (regs, asr);
- if ( (asr & SBIC_ASR_INT) == 0 )
- return(0);
-
- GET_SBIC_csr(regs, csr);
-
- do {
-
- QPRINTF(("intr[0x%x]", csr));
-
- i = sbicnextstate(dev, csr, asr);
-#if 0
- WAIT_CIP(regs);
-#endif
- if ( i == SBIC_STATE_RUNNING ) {
- GET_SBIC_asr(regs, asr);
-
- if ( asr & SBIC_ASR_LCI )
- printf("sbicgo: LCI asr:%02x csr:%02x\n", asr, csr);
-
- if ( asr & SBIC_ASR_INT )
- GET_SBIC_csr(regs, csr);
- }
-
- } while ( i == SBIC_STATE_RUNNING && asr & (SBIC_ASR_INT|SBIC_ASR_LCI) );
-
- QPRINTF(("intr done. state=%d, asr=0x%02x\n", i, asr));
-
- return(1);
-}
-
-/*
- * Run commands and wait for disconnect.
- * This is only ever called when a command is in progress, when we
- * want to busy wait for it to finish.
- */
-int
-sbicpoll(dev)
- struct sbic_softc *dev;
-{
- sbic_regmap_p regs = dev->sc_sbicp;
- u_char asr;
- u_char csr;
- int i;
-
- /*
- * Wait for the next interrupt
- */
- SBIC_WAIT(regs, SBIC_ASR_INT, sbic_cmd_wait);
-
- /* Just to avoid GCC warnings. */
- csr = 0;
-
- do {
- GET_SBIC_asr (regs, asr);
-
- if (asr & SBIC_ASR_INT)
- GET_SBIC_csr(regs, csr);
-
- QPRINTF(("poll[0x%x]", csr));
-
- /*
- * Handle it
- */
- i = sbicnextstate(dev, csr, asr);
-
- WAIT_CIP(regs);
- GET_SBIC_asr(regs, asr);
-
- /*
- * tapes may take a loooong time..
- */
- while ( asr & SBIC_ASR_BSY ) {
- u_char z = 0;
-
- if ( asr & SBIC_ASR_DBR ) {
- printf("sbipoll: Waiting while sbic is jammed, CSR:%02x,ASR:%02x\n", csr,asr);
-#ifdef DDB
- Debugger();
-#endif
- /*
- * SBIC is jammed
- * DUNNO which direction
- * Try old direction
- */
- GET_SBIC_data(regs, z);
- GET_SBIC_asr(regs, asr);
-
- if ( asr & SBIC_ASR_DBR ) /* Wants us to write */
- SET_SBIC_data(regs, z);
- }
-
- GET_SBIC_asr(regs, asr);
- }
-
- if ( asr & SBIC_ASR_LCI )
- printf("sbicpoll: LCI asr:%02x csr:%02x\n", asr,csr);
- else
- if ( i == SBIC_STATE_RUNNING ) /* BSY */
- SBIC_WAIT(regs, SBIC_ASR_INT, sbic_cmd_wait);
-
- } while ( i == SBIC_STATE_RUNNING );
-
- return(1);
-}
-
-/*
- * Handle a single msgin
- */
-int
-sbicmsgin(dev)
- struct sbic_softc *dev;
-{
- sbic_regmap_p regs = dev->sc_sbicp;
- int recvlen = 1;
- u_char asr,
- csr,
- *tmpaddr,
- *msgaddr;
-
- tmpaddr = msgaddr = dev->sc_msg;
-
- tmpaddr[0] = 0xff;
- tmpaddr[1] = 0xff;
-
- GET_SBIC_asr(regs, asr);
-
-#ifdef DEBUG
- if ( reselect_debug > 1 )
- printf("sbicmsgin asr=%02x\n", asr);
-#endif
-
- GET_SBIC_selid (regs, csr);
- SET_SBIC_selid (regs, csr | SBIC_SID_FROM_SCSI);
-
- SBIC_TC_PUT(regs, 0);
- SET_SBIC_control(regs, SBIC_CTL_EDI | SBIC_CTL_IDI);
-
- do {
- while( recvlen-- ) {
-
- /*
- * Fetch the next byte of the message
- */
- RECV_BYTE(regs, *tmpaddr);
-
- /*
- * get the command completion interrupt, or we
- * can't send a new command (LCI)
- */
- SBIC_WAIT(regs, SBIC_ASR_INT, 0);
- GET_SBIC_csr(regs, csr);
-
-#ifdef DEBUG
- if ( reselect_debug > 1 )
- printf("sbicmsgin: got %02x csr %02x\n", *tmpaddr, csr);
-#endif
-
- tmpaddr++;
-
- if ( recvlen ) {
- /*
- * Clear ACK, and wait for the interrupt for the next byte
- */
- SET_SBIC_cmd(regs, SBIC_CMD_CLR_ACK);
- SBIC_WAIT(regs, SBIC_ASR_INT, 0);
- GET_SBIC_csr(regs, csr);
- }
- }
-
- if ( msgaddr[0] == 0xff ) {
- printf("sbicmsgin: sbic swallowed our message\n");
- break;
- }
-
-#ifdef DEBUG
- if ( sync_debug ) {
- GET_SBIC_asr(regs, asr);
- printf("msgin done csr 0x%x asr 0x%x msg 0x%x\n", csr, asr, msgaddr[0]);
- }
-#endif
- /*
- * test whether this is a reply to our sync
- * request
- */
- if ( MSG_ISIDENTIFY(msgaddr[0]) ) {
-
- /*
- * Got IFFY msg -- ack it
- */
- QPRINTF(("IFFY"));
-
- } else
- if ( msgaddr[0] == MSG_REJECT &&
- dev->sc_sync[dev->target].state == SYNC_SENT) {
-
- /*
- * Target probably rejected our Sync negotiation.
- */
- QPRINTF(("REJECT of SYN"));
-
-#ifdef DEBUG
- if ( sync_debug )
- printf("target %d rejected sync, going async\n", dev->target);
-#endif
-
- dev->sc_sync[dev->target].period = sbic_min_period;
- dev->sc_sync[dev->target].offset = 0;
- dev->sc_sync[dev->target].state = SYNC_DONE;
- SET_SBIC_syn(regs, SBIC_SYN(dev->sc_sync[dev->target].offset,
- dev->sc_sync[dev->target].period));
-
- } else
- if ( msgaddr[0] == MSG_REJECT ) {
-
- /*
- * we'll never REJECt a REJECT message..
- */
- QPRINTF(("REJECT"));
-
- } else
- if ( msgaddr[0] == MSG_SAVE_DATA_PTR ) {
-
- /*
- * don't reject this either.
- */
- QPRINTF(("MSG_SAVE_DATA_PTR"));
-
- } else
- if ( msgaddr[0] == MSG_RESTORE_PTR ) {
-
- /*
- * don't reject this either.
- */
- QPRINTF(("MSG_RESTORE_PTR"));
-
- } else
- if ( msgaddr[0] == MSG_DISCONNECT ) {
-
- /*
- * Target is disconnecting...
- */
- QPRINTF(("DISCONNECT"));
-
-#ifdef DEBUG
- if ( reselect_debug > 1 && msgaddr[0] == MSG_DISCONNECT )
- printf("sbicmsgin: got disconnect msg %s\n",
- (dev->sc_flags & SBICF_ICMD) ? "rejecting" : "");
-#endif
-
- if ( dev->sc_flags & SBICF_ICMD ) {
- /*
- * We're in immediate mode. Prevent disconnects.
- * prepare to reject the message, NACK
- */
- SET_SBIC_cmd(regs, SBIC_CMD_SET_ATN);
- WAIT_CIP(regs);
- }
-
- } else
- if ( msgaddr[0] == MSG_CMD_COMPLETE ) {
-
- /*
- * !! KLUDGE ALERT !! quite a few drives don't seem to
- * really like the current way of sending the
- * sync-handshake together with the ident-message, and
- * they react by sending command-complete and
- * disconnecting right after returning the valid sync
- * handshake. So, all I can do is reselect the drive,
- * and hope it won't disconnect again. I don't think
- * this is valid behavior, but I can't help fixing a
- * problem that apparently exists.
- *
- * Note: we should not get here on `normal' command
- * completion, as that condition is handled by the
- * high-level sel&xfer resume command used to walk
- * thru status/cc-phase.
- */
- QPRINTF(("CMD_COMPLETE"));
-
-#ifdef DEBUG
- if ( sync_debug )
- printf ("GOT MSG %d! target %d acting weird.."
- " waiting for disconnect...\n", msgaddr[0], dev->target);
-#endif
-
- /*
- * Check to see if sbic is handling this
- */
- GET_SBIC_asr(regs, asr);
-
- /*
- * XXXSCW: I'm not convinced of this, we haven't negated ACK yet...
- */
- if ( asr & SBIC_ASR_BSY )
- return SBIC_STATE_RUNNING;
-
- /*
- * Let's try this: Assume it works and set status to 00
- */
- dev->sc_stat[0] = 0;
-
- } else
- if ( msgaddr[0] == MSG_EXT_MESSAGE && tmpaddr == &(msgaddr[1]) ) {
-
- /*
- * Target is sending us an extended message. We'll assume it's
- * the response to our Sync. negotiation.
- */
- QPRINTF(("ExtMSG\n"));
-
- /*
- * Read in whole extended message. First, negate ACK to accept
- * the MSG_EXT_MESSAGE byte...
- */
- SET_SBIC_cmd(regs, SBIC_CMD_CLR_ACK);
-
- /*
- * Wait for the interrupt for the next byte (length)
- */
- SBIC_WAIT(regs, SBIC_ASR_INT, 0);
- GET_SBIC_csr(regs, csr);
-
-#ifdef DEBUG
- QPRINTF(("CLR ACK csr %02x\n", csr));
-#endif
-
- /*
- * Read the length byte
- */
- RECV_BYTE(regs, *tmpaddr);
-
- /*
- * Wait for command completion IRQ
- */
- SBIC_WAIT(regs, SBIC_ASR_INT, 0);
- GET_SBIC_csr(regs, csr);
-
- /*
- * Reload the loop counter
- */
- recvlen = *tmpaddr++;
-
- QPRINTF(("Recving ext msg, csr %02x len %02x\n", csr, recvlen));
-
- } else
- if ( msgaddr[0] == MSG_EXT_MESSAGE && msgaddr[1] == 3 &&
- msgaddr[2] == MSG_SYNC_REQ ) {
-
- /*
- * We've received the complete Extended Message Sync. Request...
- */
- QPRINTF(("SYN"));
-
- /*
- * Compute the required Transfer Period for the WD chip...
- */
- dev->sc_sync[dev->target].period = sbicfromscsiperiod(dev, msgaddr[3]);
- dev->sc_sync[dev->target].offset = msgaddr[4];
- dev->sc_sync[dev->target].state = SYNC_DONE;
-
- /*
- * Put the WD chip in synchronous mode
- */
- SET_SBIC_syn(regs, SBIC_SYN(dev->sc_sync[dev->target].offset,
- dev->sc_sync[dev->target].period));
-#ifdef DEBUG
- if ( sync_debug )
- printf("msgin(%d): sync reg = 0x%02x\n", dev->target,
- SBIC_SYN(dev->sc_sync[dev->target].offset,
- dev->sc_sync[dev->target].period));
-#endif
-
- printf("%s: target %d now synchronous, period=%dns, offset=%d.\n",
- dev->sc_dev.dv_xname, dev->target,
- msgaddr[3] * 4, msgaddr[4]);
-
- } else {
-
- /*
- * We don't support whatever this message is...
- */
-#ifdef DEBUG
- if ( sbic_debug || sync_debug )
- printf ("sbicmsgin: Rejecting message 0x%02x\n", msgaddr[0]);
-#endif
-
- /*
- * prepare to reject the message, NACK
- */
- SET_SBIC_cmd(regs, SBIC_CMD_SET_ATN);
- WAIT_CIP(regs);
- }
-
- /*
- * Negate ACK to complete the transfer
- */
- SET_SBIC_cmd(regs, SBIC_CMD_CLR_ACK);
-
- /*
- * Wait for the interrupt for the next byte, or phase change.
- * Only read the CSR if we have more data to transfer.
- * XXXSCW: We should really verify that we're still in MSG IN phase
- * before blindly going back around this loop, but that would mean
- * we read the CSR... <sigh>
- */
- SBIC_WAIT(regs, SBIC_ASR_INT, 0);
- if ( recvlen > 0 )
- GET_SBIC_csr(regs, csr);
-
- } while ( recvlen > 0 );
-
- /*
- * Should still have one CSR to read
- */
- return SBIC_STATE_RUNNING;
-}
-
-
-/*
- * sbicnextstate()
- * return:
- * SBIC_STATE_DONE == done
- * SBIC_STATE_RUNNING == working
- * SBIC_STATE_DISCONNECT == disconnected
- * SBIC_STATE_ERROR == error
- */
-int
-sbicnextstate(dev, csr, asr)
- struct sbic_softc *dev;
- u_char csr,
- asr;
-{
- sbic_regmap_p regs = dev->sc_sbicp;
- struct sbic_acb *acb = dev->sc_nexus;
-
- QPRINTF(("next[%02x,%02x]: ",asr,csr));
-
- switch (csr) {
-
- case SBIC_CSR_XFERRED | CMD_PHASE:
- case SBIC_CSR_MIS | CMD_PHASE:
- case SBIC_CSR_MIS_1 | CMD_PHASE:
- case SBIC_CSR_MIS_2 | CMD_PHASE:
- {
- if ( sbicxfout(regs, acb->clen, &acb->cmd) )
- goto abort;
- }
- break;
-
- case SBIC_CSR_XFERRED | STATUS_PHASE:
- case SBIC_CSR_MIS | STATUS_PHASE:
- case SBIC_CSR_MIS_1 | STATUS_PHASE:
- case SBIC_CSR_MIS_2 | STATUS_PHASE:
- {
- SET_SBIC_control(regs, SBIC_CTL_EDI | SBIC_CTL_IDI);
-
- /*
- * this should be the normal i/o completion case.
- * get the status & cmd complete msg then let the
- * device driver look at what happened.
- */
- sbicxfdone(dev);
-
-#ifdef DEBUG
- dev->sc_dmatimo = 0;
- if ( data_pointer_debug > 1 )
- printf("next dmastop: %d(%x:%x)\n", dev->target,
- dev->sc_cur->dc_addr,
- dev->sc_tcnt);
-#endif
- /*
- * Stop the DMA chip
- */
- dev->sc_dmastop(dev);
-
- dev->sc_flags &= ~(SBICF_INDMA | SBICF_DCFLUSH);
-
- /*
- * Indicate to the upper layers that the command is done
- */
- sbic_scsidone(acb, dev->sc_stat[0]);
-
- return SBIC_STATE_DONE;
- }
-
- case SBIC_CSR_XFERRED | DATA_OUT_PHASE:
- case SBIC_CSR_XFERRED | DATA_IN_PHASE:
- case SBIC_CSR_MIS | DATA_OUT_PHASE:
- case SBIC_CSR_MIS | DATA_IN_PHASE:
- case SBIC_CSR_MIS_1 | DATA_OUT_PHASE:
- case SBIC_CSR_MIS_1 | DATA_IN_PHASE:
- case SBIC_CSR_MIS_2 | DATA_OUT_PHASE:
- case SBIC_CSR_MIS_2 | DATA_IN_PHASE:
- {
- /*
- * Verify that we expected to transfer data...
- */
- if ( acb->sc_kv.dc_count <= 0 ) {
- printf("next: DATA phase with xfer count == %d, asr:0x%02x csr:0x%02x\n",
- acb->sc_kv.dc_count, asr, csr);
- goto abort;
- }
-
- /*
- * Should we transfer using PIO or DMA ?
- */
- if ( dev->sc_xs->flags & SCSI_POLL || dev->sc_flags & SBICF_ICMD ||
- acb->sc_dmacmd == 0 ) {
-
- /*
- * Do PIO transfer
- */
- int i;
-
-#ifdef DEBUG
- if ( data_pointer_debug > 1 )
- printf("next PIO: %d(%x:%x)\n", dev->target,
- acb->sc_kv.dc_addr,
- acb->sc_kv.dc_count);
-#endif
-
- if ( SBIC_PHASE(csr) == DATA_IN_PHASE )
- /*
- * data in
- */
- i = sbicxfin(regs, acb->sc_kv.dc_count,
- acb->sc_kv.dc_addr);
- else
- /*
- * data out
- */
- i = sbicxfout(regs, acb->sc_kv.dc_count,
- acb->sc_kv.dc_addr);
-
- acb->sc_kv.dc_addr += (acb->sc_kv.dc_count - i);
- acb->sc_kv.dc_count = i;
-
- /*
- * Update current count...
- */
- acb->sc_tcnt = dev->sc_tcnt = i;
-
- dev->sc_flags &= ~SBICF_INDMA;
-
- } else {
-
- /*
- * Do DMA transfer
- * set next dma addr and dec count
- */
- sbic_save_ptrs(dev);
- sbic_load_ptrs(dev);
-
- SET_SBIC_control(regs, SBIC_CTL_EDI | SBIC_CTL_IDI |
- SBIC_MACHINE_DMA_MODE);
-
-#ifdef DEBUG
- dev->sc_dmatimo = 1;
- if ( data_pointer_debug > 1 )
- printf("next DMA: %d(%x:%x)\n", dev->target,
- dev->sc_cur->dc_addr,
- dev->sc_tcnt);
-#endif
- /*
- * Start the DMA chip going
- */
- dev->sc_tcnt = dev->sc_dmanext(dev);
-
- /*
- * Tell the WD chip how much to transfer this time around
- */
- SBIC_TC_PUT(regs, (unsigned)dev->sc_tcnt);
-
- /*
- * Start the transfer
- */
- SET_SBIC_cmd(regs, SBIC_CMD_XFER_INFO);
-
- /*
- * Indicate that we're in DMA mode
- */
- dev->sc_flags |= SBICF_INDMA;
- }
- }
- break;
-
- case SBIC_CSR_XFERRED | MESG_IN_PHASE:
- case SBIC_CSR_MIS | MESG_IN_PHASE:
- case SBIC_CSR_MIS_1 | MESG_IN_PHASE:
- case SBIC_CSR_MIS_2 | MESG_IN_PHASE:
- {
- sbic_save_ptrs(dev);
-
- /*
- * Handle a single message in...
- */
- return sbicmsgin(dev);
- }
-
- case SBIC_CSR_MSGIN_W_ACK:
- {
- /*
- * We should never see this since it's handled in 'sbicmsgin()'
- * but just for the sake of paranoia...
- */
- SET_SBIC_cmd(regs, SBIC_CMD_CLR_ACK); /* Dunno what I'm ACKing */
- printf("Acking unknown msgin CSR:%02x",csr);
- }
- break;
-
- case SBIC_CSR_XFERRED | MESG_OUT_PHASE:
- case SBIC_CSR_MIS | MESG_OUT_PHASE:
- case SBIC_CSR_MIS_1 | MESG_OUT_PHASE:
- case SBIC_CSR_MIS_2 | MESG_OUT_PHASE:
- {
- /*
- * We only ever handle a message out phase here for sending a
- * REJECT message.
- */
- sbic_save_ptrs(dev);
-
-#ifdef DEBUG
- if (sync_debug)
- printf ("sending REJECT msg to last msg.\n");
-#endif
-
- SEND_BYTE(regs, MSG_REJECT);
- WAIT_CIP(regs);
- }
- break;
-
- case SBIC_CSR_DISC:
- case SBIC_CSR_DISC_1:
- {
- /*
- * Try to schedule another target
- */
- sbic_save_ptrs(dev);
-
- dev->sc_flags &= ~SBICF_SELECTED;
-
-#ifdef DEBUG
- if ( reselect_debug > 1 )
- printf("sbicnext target %d disconnected\n", dev->target);
-#endif
-
- TAILQ_INSERT_HEAD(&dev->nexus_list, acb, chain);
-
- ++dev->sc_tinfo[dev->target].dconns;
-
- dev->sc_nexus = NULL;
- dev->sc_xs = NULL;
-
- if ( acb->xs->flags & SCSI_POLL || dev->sc_flags & SBICF_ICMD ||
- !sbic_parallel_operations )
- return SBIC_STATE_DISCONNECT;
-
- QPRINTF(("sbicnext: calling sbic_sched\n"));
-
- sbic_sched(dev);
-
- QPRINTF(("sbicnext: sbic_sched returned\n"));
-
- return SBIC_STATE_DISCONNECT;
- }
-
- case SBIC_CSR_RSLT_NI:
- case SBIC_CSR_RSLT_IFY:
- {
- /*
- * A reselection.
- * Note that since we don't enable Advanced Features (assuming
- * the WD chip is at least the 'A' revision), we're only ever
- * likely to see the 'SBIC_CSR_RSLT_NI' status. But for the
- * hell of it, we'll handle it anyway, for all the extra code
- * it needs...
- */
- u_char newtarget,
- newlun;
-
- GET_SBIC_rselid(regs, newtarget);
-
- /*
- * check SBIC_RID_SIV?
- */
- newtarget &= SBIC_RID_MASK;
-
- if ( csr == SBIC_CSR_RSLT_IFY ) {
-
- /*
- * Read Identify msg to avoid lockup
- */
- GET_SBIC_data(regs, newlun);
- WAIT_CIP(regs);
- newlun &= SBIC_TLUN_MASK;
-
- } else {
-
- /*
- * Need to read Identify message the hard way, assuming
- * the target even sends us one...
- */
- for (newlun = 255; newlun; --newlun) {
- GET_SBIC_asr(regs, asr);
- if (asr & SBIC_ASR_INT)
- break;
- delay(10);
- }
-
- /*
- * If we didn't get an interrupt, somethink's up
- */
- if ( (asr & SBIC_ASR_INT) == 0 ) {
- printf("%s: Reselect without identify? asr %x\n",
- dev->sc_dev.dv_xname, asr);
- newlun = 0; /* XXXX */
- } else {
- /*
- * We got an interrupt, verify that it's a change to
- * message in phase, and if so read the message.
- */
- GET_SBIC_csr(regs,csr);
-
- if (csr == (SBIC_CSR_MIS | MESG_IN_PHASE) ||
- csr == (SBIC_CSR_MIS_1 | MESG_IN_PHASE) ||
- csr == (SBIC_CSR_MIS_2 | MESG_IN_PHASE) ) {
- /*
- * Yup, gone to message in. Fetch the target LUN
- */
- sbicmsgin(dev);
- newlun = dev->sc_msg[0] & 0x07;
-
- } else {
- /*
- * Whoops! Target didn't go to message in phase!!
- */
- printf("RSLT_NI - not MESG_IN_PHASE %x\n", csr);
- newlun = 0; /* XXXSCW */
- }
- }
- }
-
- /*
- * Ok, we have the identity of the reselecting target.
- */
-#ifdef DEBUG
- if ( reselect_debug > 1 ||
- (reselect_debug && csr == SBIC_CSR_RSLT_NI) ) {
- printf("sbicnext: reselect %s from targ %d lun %d\n",
- csr == SBIC_CSR_RSLT_NI ? "NI" : "IFY", newtarget, newlun);
- }
-#endif
-
- if ( dev->sc_nexus ) {
- /*
- * Whoops! We've been reselected with an command in progress!
- * The best we can do is to put the current command back on the
- * ready list and hope for the best.
- */
-#ifdef DEBUG
- if ( reselect_debug > 1 ) {
- printf("%s: reselect %s with active command\n",
- dev->sc_dev.dv_xname,
- csr == SBIC_CSR_RSLT_NI ? "NI" : "IFY");
- }
-#endif
-
- TAILQ_INSERT_HEAD(&dev->ready_list, dev->sc_nexus, chain);
-
- dev->sc_tinfo[dev->target].lubusy &= ~(1 << dev->lun);
-
- dev->sc_nexus = NULL;
- dev->sc_xs = NULL;
- }
-
- /*
- * Reload sync values for this target
- */
- if ( dev->sc_sync[newtarget].state == SYNC_DONE )
- SET_SBIC_syn(regs, SBIC_SYN (dev->sc_sync[newtarget].offset,
- dev->sc_sync[newtarget].period));
- else
- SET_SBIC_syn(regs, SBIC_SYN (0, sbic_min_period));
-
- /*
- * Loop through the nexus list until we find the saved entry
- * for the reselecting target...
- */
- for (acb = dev->nexus_list.tqh_first; acb;
- acb = acb->chain.tqe_next) {
-
- if ( acb->xs->sc_link->target == newtarget &&
- acb->xs->sc_link->lun == newlun) {
- /*
- * We've found the saved entry. Dequeue it, and
- * make it current again.
- */
- TAILQ_REMOVE(&dev->nexus_list, acb, chain);
-
- dev->sc_nexus = acb;
- dev->sc_xs = acb->xs;
- dev->sc_flags |= SBICF_SELECTED;
- dev->target = newtarget;
- dev->lun = newlun;
- break;
- }
- }
-
- if ( acb == NULL ) {
- printf("%s: reselect %s targ %d not in nexus_list %x\n",
- dev->sc_dev.dv_xname,
- csr == SBIC_CSR_RSLT_NI ? "NI" : "IFY", newtarget,
- &dev->nexus_list.tqh_first);
- panic("bad reselect in sbic");
- }
-
- if ( csr == SBIC_CSR_RSLT_IFY )
- SET_SBIC_cmd(regs, SBIC_CMD_CLR_ACK);
- }
- break;
-
- default:
- abort:
- {
- /*
- * Something unexpected happened -- deal with it.
- */
- printf("next: aborting asr 0x%02x csr 0x%02x\n", asr, csr);
-
-#ifdef DDB
- Debugger();
-#endif
-
-#ifdef DEBUG
- dev->sc_dmatimo = 0;
- if ( data_pointer_debug > 1 )
- printf("next dmastop: %d(%x:%x)\n", dev->target,
- dev->sc_cur->dc_addr,
- dev->sc_tcnt);
-#endif
-
- dev->sc_dmastop(dev);
- SET_SBIC_control(regs, SBIC_CTL_EDI | SBIC_CTL_IDI);
- if ( dev->sc_xs ) sbicerror(dev, csr);
- sbicabort(dev, "next");
-
- if ( dev->sc_flags & SBICF_INDMA ) {
- dev->sc_flags &= ~(SBICF_INDMA | SBICF_DCFLUSH);
-
-#ifdef DEBUG
- dev->sc_dmatimo = 0;
- if ( data_pointer_debug > 1 )
- printf("next dmastop: %d(%x:%x)\n", dev->target,
- dev->sc_cur->dc_addr,
- dev->sc_tcnt);
-#endif
- sbic_scsidone(acb, -1);
- }
-
- return SBIC_STATE_ERROR;
- }
- }
-
- return(SBIC_STATE_RUNNING);
-}
-
-
-/*
- * Check if DMA can not be used with specified buffer
- */
-int
-sbiccheckdmap(bp, len, mask)
- void *bp;
- u_long len,
- mask;
-{
- u_char *buffer;
- u_long phy_buf;
- u_long phy_len;
-
- buffer = bp;
-
- if ( len == 0 )
- return(1);
-
- while ( len ) {
-
- phy_buf = kvtop(buffer);
- phy_len = NBPG - ((int) buffer & PGOFSET);
-
- if ( len < phy_len )
- phy_len = len;
-
- if ( phy_buf & mask )
- return(1);
-
- buffer += phy_len;
- len -= phy_len;
- }
-
- return(0);
-}
-
-int
-sbictoscsiperiod(dev, a)
- struct sbic_softc *dev;
- int a;
-{
- unsigned int fs;
-
- /*
- * cycle = DIV / (2 * CLK)
- * DIV = FS + 2
- * best we can do is 200ns at 20Mhz, 2 cycles
- */
-
- GET_SBIC_myid(dev->sc_sbicp, fs);
-
- fs = (fs >> 6) + 2; /* DIV */
-
- fs = (fs * 10000) / (dev->sc_clkfreq << 1); /* Cycle, in ns */
-
- if ( a < 2 )
- a = 8; /* map to Cycles */
-
- return ( (fs * a) >> 2 ); /* in 4 ns units */
-}
-
-int
-sbicfromscsiperiod(dev, p)
- struct sbic_softc *dev;
- int p;
-{
- unsigned fs,
- ret;
-
- /*
- * Just the inverse of the above
- */
- GET_SBIC_myid(dev->sc_sbicp, fs);
-
- fs = (fs >> 6) + 2; /* DIV */
-
- fs = (fs * 10000) / (dev->sc_clkfreq << 1); /* Cycle, in ns */
-
- ret = p << 2; /* in ns units */
- ret = ret / fs; /* in Cycles */
-
- if ( ret < sbic_min_period )
- return(sbic_min_period);
-
- /*
- * verify rounding
- */
- if ( sbictoscsiperiod(dev, ret) < p )
- ret++;
-
- return( (ret >= 8) ? 0 : ret );
-}
-
-#ifdef DEBUG
-void
-sbictimeout(dev)
- struct sbic_softc *dev;
-{
- int s,
- asr;
-
- s = splbio();
-
- if ( dev->sc_dmatimo ) {
-
- if ( dev->sc_dmatimo > 1 ) {
-
- printf("%s: dma timeout #%d\n", dev->sc_dev.dv_xname,
- dev->sc_dmatimo - 1);
-
- GET_SBIC_asr(dev->sc_sbicp, asr);
-
- if ( asr & SBIC_ASR_INT ) {
- /*
- * We need to service a missed IRQ
- */
- sbicintr(dev);
- } else {
- (void) sbicabort(dev, "timeout");
- splx(s);
- return;
- }
- }
-
- dev->sc_dmatimo++;
- }
-
- splx(s);
-
- timeout((void *)sbictimeout, dev, 30 * hz);
-}
-#endif
diff --git a/sys/arch/kbus/dev/sbicdma.c b/sys/arch/kbus/dev/sbicdma.c
deleted file mode 100644
index b5a1cf8d155..00000000000
--- a/sys/arch/kbus/dev/sbicdma.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/* $OpenBSD: sbicdma.c,v 1.1.1.1 1997/10/14 07:25:30 gingold Exp $ */
-
-/*
- * Copyright (c) 1996 Steve Woodford
- * Copyright (c) 1982, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)wdsc.c
- */
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-#include <dev/dmavar.h>
-#include <dev/sbicreg.h>
-#include <dev/sbicvar.h>
-#include <dev/sbicdma.h>
-#include <machine/ioasic.h>
-#include <machine/autoconf.h>
-#include <vm/vm.h>
-
-void wdscattach __P((struct device *, struct device *, void *));
-int wdscmatch __P((struct device *, struct cfdata *, void *));
-
-void wdsc_enintr __P((struct sbic_softc *));
-int wdsc_dmago __P((struct sbic_softc *, char *, int, int));
-int wdsc_dmanext __P((struct sbic_softc *));
-void wdsc_dmastop __P((struct sbic_softc *));
-int wdsc_dmaintr __P((struct sbic_softc *));
-int wdsc_scsiintr __P((void *));
-
-struct scsi_adapter wdsc_scsiswitch = {
- sbic_scsicmd,
- sbic_minphys,
- 0, /* no lun support */
- 0, /* no lun support */
-};
-
-struct scsi_device wdsc_scsidev = {
- NULL, /* use default error handler */
- NULL, /* do not have a start functio */
- NULL, /* have no async handler */
- NULL, /* Use default done routine */
-};
-
-struct cfattach si_ca = {
- sizeof(struct sbic_softc), (cfmatch_t)wdscmatch, wdscattach
-};
-
-struct cfdriver si_cd = {
- NULL, "si", DV_DULL, NULL, 0
-};
-
-/*
- * Define 'scsi_nosync = 0x00' to enable sync SCSI mode.
- * This is untested as yet, use at your own risk...
- */
-u_long scsi_nosync = 0xff;
-int shift_nosync = 0;
-
-/*
- * Match for SCSI devices on the onboard WD33C93 chip
- */
-int
-wdscmatch(pdp, cdp, auxp)
- struct device *pdp;
- struct cfdata *cdp;
- void *auxp;
-{
- /*
- * Match everything
- */
- return(1);
-}
-
-
-/*
- * Attach the wdsc driver
- */
-void
-wdscattach(pdp, dp, auxp)
- struct device *pdp, *dp;
- void *auxp;
-{
- struct sbic_softc *sc = (struct sbic_softc *)dp;
-/* struct confargs *ca = auxp; */
-
- sc->sc_enintr = wdsc_enintr;
- sc->sc_dmago = wdsc_dmago;
- sc->sc_dmanext = wdsc_dmanext;
- sc->sc_dmastop = wdsc_dmastop;
- sc->sc_dmacmd = 0;
-
- sc->sc_link.adapter_softc = sc;
- sc->sc_link.adapter_target = 7;
- sc->sc_link.adapter = &wdsc_scsiswitch;
- sc->sc_link.device = &wdsc_scsidev;
- sc->sc_link.openings = 2;
-
- printf(": target %d\n", sc->sc_link.adapter_target);
-
-
- sc->sc_sbicp = (sbic_regmap_p)((void *)ioasic + WD33C93A_OFFSET);
-
- /*
- * Eveything is a valid dma address.
- *
- */
- sc->sc_dmamask = 0;
-
- /*
- * The onboard WD33C93 is usually clocked at 20MHz...
- * (We use 10 times this for accuracy in later calculations)
- */
- sc->sc_clkfreq = 200;
-
- /*
- * Initialise the hardware
- */
- sbicinit(sc);
-
- /*
- * Fix up the interrupts
- */
- sc->sc_sbicih.ih_fun = wdsc_scsiintr;
- sc->sc_sbicih.ih_arg = sc;
- intr_establish (INTR_IOASIC /* ca->ca_intpri */, 0, &sc->sc_sbicih);
-
- /*
- * Attach all scsi units on us, watching for boot device
- * (see dk_establish).
- */
- config_found(dp, &sc->sc_link, scsiprint);
-}
-
-/*
- * Enable DMA interrupts
- */
-void
-wdsc_enintr(dev)
- struct sbic_softc *dev;
-{
- dev->sc_flags |= SBICF_INTR;
-}
-
-/*
- * Prime the hardware for a DMA transfer
- */
-int
-wdsc_dmago (sc, pa, count, flags)
- struct sbic_softc *sc;
- char *pa;
- int count, flags;
-{
- printf ("dmago: ir=%d, count=%d, pa=%p\n",
- ioasic->ioasic_ir, count, pa);
- /*
- * Set up the command word based on flags
- */
- if ( (flags & DMAGO_READ) == 0 )
- sc->sc_dmacmd = IOASIC_SI_CTL_WRITE;
- else
- sc->sc_dmacmd = IOASIC_SI_CTL_READ;
-
- sc->sc_flags |= SBICF_INTR;
-
- /*
- * Prime the hardware.
- * Note, it's probably not necessary to do this here, since dmanext
- * is called just prior to the actual transfer.
- */
-
- ioasic->ioasic_si_sar = ((u_long)pa) >> IOASIC_SI_SAR_SHIFT;
- ioasic->ioasic_si_ctl =
- ((((u_long)pa) << IOASIC_SI_CTL_SHIFT) & IOASIC_SI_CTL_AMASK)
- | sc->sc_dmacmd;
-
- return(sc->sc_tcnt);
-}
-
-/*
- * Prime the hardware for the next DMA transfer
- */
-int
-wdsc_dmanext(dev)
- struct sbic_softc *dev;
-{
- printf ("sbic dmanext called");
- return 0;
-}
-
-/*
- * Stop DMA, and disable interrupts
- */
-void
-wdsc_dmastop(dev)
- struct sbic_softc *dev;
-{
-}
-
-/*
- * Come here for SCSI interrupts
- */
-int
-wdsc_scsiintr(arg)
- void *arg;
-{
- struct sbic_softc *dev = (struct sbic_softc *)arg;
- int found;
-
- if (ioasic->ioasic_ir & IOASIC_IR_SI_PO)
- {
- printf ("IOASIC page overflow, sar = %p, ctl = %p, pre = %p\n",
- ioasic->ioasic_si_sar << IOASIC_SI_SAR_SHIFT,
- ioasic->ioasic_si_ctl,
- ioasic->ioasic_si_sar_pre);
- return 1;
- }
-
- /*
- * Go handle it
- */
- found = sbicintr(dev);
-
- return(found);
-}
diff --git a/sys/arch/kbus/dev/sbicdma.h b/sys/arch/kbus/dev/sbicdma.h
deleted file mode 100644
index a1ee560c272..00000000000
--- a/sys/arch/kbus/dev/sbicdma.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $OpenBSD: sbicdma.h,v 1.1.1.1 1997/10/14 07:25:30 gingold Exp $ */
-
-/*
- * Copyright (c) 1994 Christian E. Hopps
- * Copyright (c) 1982, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dmareg.h
- */
-#ifndef _MVME68K_DEV_WDSCREG_H_
-#define _MVME68K_DEV_WDSCREG_H_
-
-#define DMAC_CSR_ENABLE (1 << 0) /* Enable the DMAC */
-#define DMAC_CSR_TABLE (1 << 1) /* Select Table Mode */
-#define DMAC_CSR_WRITE (1 << 2) /* Write data from RAM to SCSI */
-#define DMAC_CSR_TBUSERR (1 << 3) /* Bus error during table walk */
-#define DMAC_CSR_DBUSERR (1 << 4) /* Bus error during data xfer */
-#define DMAC_CSR_TSIZE (1 << 5) /* Table addr. not in 32 bits */
-#define DMAC_CSR_8BITS (1 << 6) /* Non-8 bit handshake */
-#define DMAC_CSR_DONE (1 << 7) /* Transfer complete, or error */
-
-#define DMAC_SR_HOLDING 0x0f /* Data holding state */
-#define DMAC_SR_INCREMENT 0xf0 /* Increment value */
-
-#endif
diff --git a/sys/arch/kbus/dev/sbicreg.h b/sys/arch/kbus/dev/sbicreg.h
deleted file mode 100644
index da3d60c2310..00000000000
--- a/sys/arch/kbus/dev/sbicreg.h
+++ /dev/null
@@ -1,441 +0,0 @@
-/* $OpenBSD: sbicreg.h,v 1.1.1.1 1997/10/14 07:25:30 gingold Exp $ */
-
-/*
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)scsireg.h 7.3 (Berkeley) 2/5/91
- */
-
-/*
- * WD33C93 SCSI interface hardware description.
- *
- * Using parts of the Mach scsi driver for the 33C93
- */
-
-#define SBIC_myid 0
-#define SBIC_cdbsize 0
-#define SBIC_control 1
-#define SBIC_timeo 2
-#define SBIC_cdb1 3
-#define SBIC_tsecs 3
-#define SBIC_cdb2 4
-#define SBIC_theads 4
-#define SBIC_cdb3 5
-#define SBIC_tcyl_hi 5
-#define SBIC_cdb4 6
-#define SBIC_tcyl_lo 6
-#define SBIC_cdb5 7
-#define SBIC_addr_hi 7
-#define SBIC_cdb6 8
-#define SBIC_addr_2 8
-#define SBIC_cdb7 9
-#define SBIC_addr_3 9
-#define SBIC_cdb8 10
-#define SBIC_addr_lo 10
-#define SBIC_cdb9 11
-#define SBIC_secno 11
-#define SBIC_cdb10 12
-#define SBIC_headno 12
-#define SBIC_cdb11 13
-#define SBIC_cylno_hi 13
-#define SBIC_cdb12 14
-#define SBIC_cylno_lo 14
-#define SBIC_tlun 15
-#define SBIC_cmd_phase 16
-#define SBIC_syn 17
-#define SBIC_count_hi 18
-#define SBIC_count_med 19
-#define SBIC_count_lo 20
-#define SBIC_selid 21
-#define SBIC_rselid 22
-#define SBIC_csr 23
-#define SBIC_cmd 24
-#define SBIC_data 25
-#define SBIC_queue_tag 26
-/* sbic_asr is addressed directly */
-
-/*
- * Register defines
- */
-
-/*
- * Auxiliary Status Register
- */
-
-#define SBIC_ASR_INT 0x80 /* Interrupt pending */
-#define SBIC_ASR_LCI 0x40 /* Last command ignored */
-#define SBIC_ASR_BSY 0x20 /* Busy, only cmd/data/asr readable */
-#define SBIC_ASR_CIP 0x10 /* Busy, cmd unavail also */
-#define SBIC_ASR_xxx 0x0c
-#define SBIC_ASR_PE 0x02 /* Parity error (even) */
-#define SBIC_ASR_DBR 0x01 /* Data Buffer Ready */
-
-/*
- * My ID register, and/or CDB Size
- */
-
-#define SBIC_ID_FS_8_10 0x00 /* Input clock is 8-10 Mhz */
- /* 11 Mhz is invalid */
-#define SBIC_ID_FS_12_15 0x40 /* Input clock is 12-15 Mhz */
-#define SBIC_ID_FS_16_20 0x80 /* Input clock is 16-20 Mhz */
-#define SBIC_ID_EHP 0x10 /* Enable host parity */
-#define SBIC_ID_EAF 0x08 /* Enable Advanced Features */
-#define SBIC_ID_MASK 0x07
-#define SBIC_ID_CBDSIZE_MASK 0x0f /* if unk SCSI cmd group */
-
-/*
- * Control register
- */
-
-#define SBIC_CTL_DMA 0x80 /* Single byte dma */
-#define SBIC_CTL_DBA_DMA 0x40 /* direct buffer acces (bus master)*/
-#define SBIC_CTL_BURST_DMA 0x20 /* continuous mode (8237) */
-#define SBIC_CTL_NO_DMA 0x00 /* Programmed I/O */
-#define SBIC_CTL_HHP 0x10 /* Halt on host parity error */
-#define SBIC_CTL_EDI 0x08 /* Ending disconnect interrupt */
-#define SBIC_CTL_IDI 0x04 /* Intermediate disconnect interrupt*/
-#define SBIC_CTL_HA 0x02 /* Halt on ATN */
-#define SBIC_CTL_HSP 0x01 /* Halt on SCSI parity error */
-
-/*
- * Timeout period register
- * [val in msecs, input clk in 0.1 Mhz]
- */
-
-#define SBIC_TIMEOUT(val,clk) ((((val) * (clk)) / 800) + 1)
-
-/*
- * CDBn registers, note that
- * cdb11 is used for status byte in target mode (send-status-and-cc)
- * cdb12 sez if linked command complete, and w/flag if so
- */
-
-/*
- * Target LUN register
- * [holds target status when select-and-xfer]
- */
-
-#define SBIC_TLUN_VALID 0x80 /* did we receive an Identify msg */
-#define SBIC_TLUN_DOK 0x40 /* Disconnect OK */
-#define SBIC_TLUN_xxx 0x38
-#define SBIC_TLUN_MASK 0x07
-
-/*
- * Command Phase register
- */
-
-#define SBIC_CPH_MASK 0x7f /* values/restarts are cmd specific */
-#define SBIC_CPH(p) ((p) & SBIC_CPH_MASK)
-
-/*
- * FIFO register
- */
-
-#define SBIC_FIFO_DEEP 12
-
-/*
- * maximum possible size in TC registers. Since this is 24 bit, it's easy
- */
-#define SBIC_TC_MAX ((1 << 24) - 1)
-
-/*
- * Synchronous xfer register
- */
-
-#define SBIC_SYN_OFF_MASK 0x0f
-#define SBIC_SYN_MAX_OFFSET SBIC_FIFO_DEEP
-#define SBIC_SYN_PER_MASK 0x70
-#define SBIC_SYN_MIN_PERIOD 2 /* upto 8, encoded as 0 */
-
-#define SBIC_SYN(o,p) \
- (((o) & SBIC_SYN_OFF_MASK) | (((p) << 4) & SBIC_SYN_PER_MASK))
-
-/*
- * Transfer count register
- * optimal access macros depend on addressing
- */
-
-/*
- * Destination ID (selid) register
- */
-
-#define SBIC_SID_SCC 0x80 /* Select command chaining (tgt) */
-#define SBIC_SID_DPD 0x40 /* Data phase direction (inittor) */
-#define SBIC_SID_FROM_SCSI 0x40
-#define SBIC_SID_TO_SCSI 0x00
-#define SBIC_SID_xxx 0x38
-#define SBIC_SID_IDMASK 0x07
-
-/*
- * Source ID (rselid) register
- */
-
-#define SBIC_RID_ER 0x80 /* Enable reselection */
-#define SBIC_RID_ES 0x40 /* Enable selection */
-#define SBIC_RID_DSP 0x20 /* Disable select parity */
-#define SBIC_RID_SIV 0x08 /* Source ID valid */
-#define SBIC_RID_MASK 0x07
-
-/*
- * Status register
- */
-
-#define SBIC_CSR_CAUSE 0xf0
-#define SBIC_CSR_RESET 0x00 /* chip was reset */
-#define SBIC_CSR_CMD_DONE 0x10 /* cmd completed */
-#define SBIC_CSR_CMD_STOPPED 0x20 /* interrupted or abrted*/
-#define SBIC_CSR_CMD_ERR 0x40 /* end with error */
-#define SBIC_CSR_BUS_SERVICE 0x80 /* REQ pending on the bus */
-
-
-#define SBIC_CSR_QUALIFIER 0x0f
-/* Reset State Interrupts */
-#define SBIC_CSR_RESET 0x00 /* reset w/advanced features*/
-#define SBIC_CSR_RESET_AM 0x01 /* reset w/advanced features*/
-/* Successful Completion Interrupts */
-#define SBIC_CSR_TARGET 0x10 /* reselect complete */
-#define SBIC_CSR_INITIATOR 0x11 /* select complete */
-#define SBIC_CSR_WO_ATN 0x13 /* tgt mode completion */
-#define SBIC_CSR_W_ATN 0x14 /* ditto */
-#define SBIC_CSR_XLATED 0x15 /* translate address cmd */
-#define SBIC_CSR_S_XFERRED 0x16 /* initiator mode completion*/
-#define SBIC_CSR_XFERRED 0x18 /* phase in low bits */
-/* Paused or Aborted Interrupts */
-#define SBIC_CSR_MSGIN_W_ACK 0x20 /* (I) msgin, ACK asserted*/
-#define SBIC_CSR_SDP 0x21 /* (I) SDP msg received */
-#define SBIC_CSR_SEL_ABRT 0x22 /* sel/resel aborted */
-#define SBIC_CSR_XFR_PAUSED 0x23 /* (T) no ATN */
-#define SBIC_CSR_XFR_PAUSED_ATN 0x24 /* (T) ATN is asserted */
-#define SBIC_CSR_RSLT_AM 0x27 /* (I) lost selection (AM) */
-#define SBIC_CSR_MIS 0x28 /* (I) xfer aborted, ph mis */
-/* Terminated Interrupts */
-#define SBIC_CSR_CMD_INVALID 0x40
-#define SBIC_CSR_DISC 0x41 /* (I) tgt disconnected */
-#define SBIC_CSR_SEL_TIMEO 0x42
-#define SBIC_CSR_PE 0x43 /* parity error */
-#define SBIC_CSR_PE_ATN 0x44 /* ditto, ATN is asserted */
-#define SBIC_CSR_XLATE_TOOBIG 0x45
-#define SBIC_CSR_RSLT_NOAM 0x46 /* (I) lost sel, no AM mode */
-#define SBIC_CSR_BAD_STATUS 0x47 /* status byte was nok */
-#define SBIC_CSR_MIS_1 0x48 /* ph mis, see low bits */
-/* Service Required Interrupts */
-#define SBIC_CSR_RSLT_NI 0x80 /* reselected, no ify msg */
-#define SBIC_CSR_RSLT_IFY 0x81 /* ditto, AM mode, got ify */
-#define SBIC_CSR_SLT 0x82 /* selected, no ATN */
-#define SBIC_CSR_SLT_ATN 0x83 /* selected with ATN */
-#define SBIC_CSR_ATN 0x84 /* (T) ATN asserted */
-#define SBIC_CSR_DISC_1 0x85 /* (I) bus is free */
-#define SBIC_CSR_UNK_GROUP 0x87 /* strange CDB1 */
-#define SBIC_CSR_MIS_2 0x88 /* (I) ph mis, see low bits */
-
-#define SBIC_PHASE(csr) SCSI_PHASE(csr)
-
-/*
- * Command register (command codes)
- */
-
-#define SBIC_CMD_SBT 0x80 /* Single byte xfer qualifier */
-#define SBIC_CMD_MASK 0x7f
-
- /* Miscellaneous */
-#define SBIC_CMD_RESET 0x00 /* (DTI) lev I */
-#define SBIC_CMD_ABORT 0x01 /* (DTI) lev I */
-#define SBIC_CMD_DISC 0x04 /* ( TI) lev I */
-#define SBIC_CMD_SSCC 0x0d /* ( TI) lev I */
-#define SBIC_CMD_SET_IDI 0x0f /* (DTI) lev I */
-#define SBIC_CMD_XLATE 0x18 /* (DT ) lev II */
-
- /* Initiator state */
-#define SBIC_CMD_SET_ATN 0x02 /* ( I) lev I */
-#define SBIC_CMD_CLR_ACK 0x03 /* ( I) lev I */
-#define SBIC_CMD_XFER_PAD 0x19 /* ( I) lev II */
-#define SBIC_CMD_XFER_INFO 0x20 /* ( I) lev II */
-
- /* Target state */
-#define SBIC_CMD_SND_DISC 0x0e /* ( T ) lev II */
-#define SBIC_CMD_RCV_CMD 0x10 /* ( T ) lev II */
-#define SBIC_CMD_RCV_DATA 0x11 /* ( T ) lev II */
-#define SBIC_CMD_RCV_MSG_OUT 0x12 /* ( T ) lev II */
-#define SBIC_CMD_RCV 0x13 /* ( T ) lev II */
-#define SBIC_CMD_SND_STATUS 0x14 /* ( T ) lev II */
-#define SBIC_CMD_SND_DATA 0x15 /* ( T ) lev II */
-#define SBIC_CMD_SND_MSG_IN 0x16 /* ( T ) lev II */
-#define SBIC_CMD_SND 0x17 /* ( T ) lev II */
-
- /* Disconnected state */
-#define SBIC_CMD_RESELECT 0x05 /* (D ) lev II */
-#define SBIC_CMD_SEL_ATN 0x06 /* (D ) lev II */
-#define SBIC_CMD_SEL 0x07 /* (D ) lev II */
-#define SBIC_CMD_SEL_ATN_XFER 0x08 /* (D I) lev II */
-#define SBIC_CMD_SEL_XFER 0x09 /* (D I) lev II */
-#define SBIC_CMD_RESELECT_RECV 0x0a /* (DT ) lev II */
-#define SBIC_CMD_RESELECT_SEND 0x0b /* (DT ) lev II */
-#define SBIC_CMD_WAIT_SEL_RECV 0x0c /* (DT ) lev II */
-
-/* approximate, but we won't do SBT on selects */
-#define sbic_isa_select(cmd) (((cmd) > 0x5) && ((cmd) < 0xa))
-
-#define PAD(n) char n;
-#define SBIC_MACHINE_DMA_MODE SBIC_CTL_DMA
-
-typedef struct {
- volatile unsigned char sbic_asr; /* r : Aux Status Register */
- volatile unsigned char pad[0x0f];
-#define sbic_address sbic_asr /* w : desired register no */
- volatile unsigned char sbic_value; /* rw: register value */
-} sbic_padded_ind_regmap_t;
-typedef volatile sbic_padded_ind_regmap_t *sbic_regmap_p;
-
-#define sbic_read_reg(regs,regno,val) \
- do { \
- (regs)->sbic_address = (regno); \
- (val) = (regs)->sbic_value; \
- } while (0)
-
-#define sbic_write_reg(regs,regno,val) \
- do { \
- (regs)->sbic_address = (regno); \
- (regs)->sbic_value = (val); \
- } while (0)
-
-#define SET_SBIC_myid(regs,val) sbic_write_reg(regs,SBIC_myid,val)
-#define GET_SBIC_myid(regs,val) sbic_read_reg(regs,SBIC_myid,val)
-#define SET_SBIC_cdbsize(regs,val) sbic_write_reg(regs,SBIC_cdbsize,val)
-#define GET_SBIC_cdbsize(regs,val) sbic_read_reg(regs,SBIC_cdbsize,val)
-#define SET_SBIC_control(regs,val) sbic_write_reg(regs,SBIC_control,val)
-#define GET_SBIC_control(regs,val) sbic_read_reg(regs,SBIC_control,val)
-#define SET_SBIC_timeo(regs,val) sbic_write_reg(regs,SBIC_timeo,val)
-#define GET_SBIC_timeo(regs,val) sbic_read_reg(regs,SBIC_timeo,val)
-#define SET_SBIC_cdb1(regs,val) sbic_write_reg(regs,SBIC_cdb1,val)
-#define GET_SBIC_cdb1(regs,val) sbic_read_reg(regs,SBIC_cdb1,val)
-#define SET_SBIC_cdb2(regs,val) sbic_write_reg(regs,SBIC_cdb2,val)
-#define GET_SBIC_cdb2(regs,val) sbic_read_reg(regs,SBIC_cdb2,val)
-#define SET_SBIC_cdb3(regs,val) sbic_write_reg(regs,SBIC_cdb3,val)
-#define GET_SBIC_cdb3(regs,val) sbic_read_reg(regs,SBIC_cdb3,val)
-#define SET_SBIC_cdb4(regs,val) sbic_write_reg(regs,SBIC_cdb4,val)
-#define GET_SBIC_cdb4(regs,val) sbic_read_reg(regs,SBIC_cdb4,val)
-#define SET_SBIC_cdb5(regs,val) sbic_write_reg(regs,SBIC_cdb5,val)
-#define GET_SBIC_cdb5(regs,val) sbic_read_reg(regs,SBIC_cdb5,val)
-#define SET_SBIC_cdb6(regs,val) sbic_write_reg(regs,SBIC_cdb6,val)
-#define GET_SBIC_cdb6(regs,val) sbic_read_reg(regs,SBIC_cdb6,val)
-#define SET_SBIC_cdb7(regs,val) sbic_write_reg(regs,SBIC_cdb7,val)
-#define GET_SBIC_cdb7(regs,val) sbic_read_reg(regs,SBIC_cdb7,val)
-#define SET_SBIC_cdb8(regs,val) sbic_write_reg(regs,SBIC_cdb8,val)
-#define GET_SBIC_cdb8(regs,val) sbic_read_reg(regs,SBIC_cdb8,val)
-#define SET_SBIC_cdb9(regs,val) sbic_write_reg(regs,SBIC_cdb9,val)
-#define GET_SBIC_cdb9(regs,val) sbic_read_reg(regs,SBIC_cdb9,val)
-#define SET_SBIC_cdb10(regs,val) sbic_write_reg(regs,SBIC_cdb10,val)
-#define GET_SBIC_cdb10(regs,val) sbic_read_reg(regs,SBIC_cdb10,val)
-#define SET_SBIC_cdb11(regs,val) sbic_write_reg(regs,SBIC_cdb11,val)
-#define GET_SBIC_cdb11(regs,val) sbic_read_reg(regs,SBIC_cdb11,val)
-#define SET_SBIC_cdb12(regs,val) sbic_write_reg(regs,SBIC_cdb12,val)
-#define GET_SBIC_cdb12(regs,val) sbic_read_reg(regs,SBIC_cdb12,val)
-#define SET_SBIC_tlun(regs,val) sbic_write_reg(regs,SBIC_tlun,val)
-#define GET_SBIC_tlun(regs,val) sbic_read_reg(regs,SBIC_tlun,val)
-#define SET_SBIC_cmd_phase(regs,val) sbic_write_reg(regs,SBIC_cmd_phase,val)
-#define GET_SBIC_cmd_phase(regs,val) sbic_read_reg(regs,SBIC_cmd_phase,val)
-#define SET_SBIC_syn(regs,val) sbic_write_reg(regs,SBIC_syn,val)
-#define GET_SBIC_syn(regs,val) sbic_read_reg(regs,SBIC_syn,val)
-#define SET_SBIC_count_hi(regs,val) sbic_write_reg(regs,SBIC_count_hi,val)
-#define GET_SBIC_count_hi(regs,val) sbic_read_reg(regs,SBIC_count_hi,val)
-#define SET_SBIC_count_med(regs,val) sbic_write_reg(regs,SBIC_count_med,val)
-#define GET_SBIC_count_med(regs,val) sbic_read_reg(regs,SBIC_count_med,val)
-#define SET_SBIC_count_lo(regs,val) sbic_write_reg(regs,SBIC_count_lo,val)
-#define GET_SBIC_count_lo(regs,val) sbic_read_reg(regs,SBIC_count_lo,val)
-#define SET_SBIC_selid(regs,val) sbic_write_reg(regs,SBIC_selid,val)
-#define GET_SBIC_selid(regs,val) sbic_read_reg(regs,SBIC_selid,val)
-#define SET_SBIC_rselid(regs,val) sbic_write_reg(regs,SBIC_rselid,val)
-#define GET_SBIC_rselid(regs,val) sbic_read_reg(regs,SBIC_rselid,val)
-#define SET_SBIC_csr(regs,val) sbic_write_reg(regs,SBIC_csr,val)
-#define GET_SBIC_csr(regs,val) sbic_read_reg(regs,SBIC_csr,val)
-#define SET_SBIC_cmd(regs,val) sbic_write_reg(regs,SBIC_cmd,val)
-#define GET_SBIC_cmd(regs,val) sbic_read_reg(regs,SBIC_cmd,val)
-#define SET_SBIC_data(regs,val) sbic_write_reg(regs,SBIC_data,val)
-#define GET_SBIC_data(regs,val) sbic_read_reg(regs,SBIC_data,val)
-#define SET_SBIC_queue_tag(regs,val) sbic_write_reg(regs,SBIC_queue_tag,val)
-#define GET_SBIC_queue_tag(regs,val) sbic_read_reg(regs,SBIC_queue_tag,val)
-
-#define SBIC_TC_PUT(regs,val) \
- do { \
- sbic_write_reg(regs,SBIC_count_hi,((val)>>16)); \
- (regs)->sbic_value = (val)>>8; \
- (regs)->sbic_value = (val); \
- } while (0)
-
-#define SBIC_TC_GET(regs,val) \
- do { \
- sbic_read_reg(regs,SBIC_count_hi,(val)); \
- (val) = ((val)<<8) | (regs)->sbic_value; \
- (val) = ((val)<<8) | (regs)->sbic_value; \
- } while (0)
-
-#define SBIC_LOAD_COMMAND(regs,cmd,cmdsize) \
- do { \
- int n = (cmdsize) - 1; \
- char *ptr = (char *)(cmd); \
- sbic_write_reg(regs, SBIC_cdb1, *ptr++); \
- while(n-- > 0) (regs)->sbic_value = *ptr++; \
- } while (0)
-
-#define GET_SBIC_asr(regs,val) (val) = (regs)->sbic_asr
-
-#define WAIT_CIP(regs) \
- do { \
- while ((regs)->sbic_asr & SBIC_ASR_CIP) \
- ; \
- } while (0)
-
-/*
- * transmit a byte in programmed I/O mode
- **/
-#define SEND_BYTE(regs, ch) \
- do { \
- WAIT_CIP(regs); \
- SET_SBIC_cmd(regs, SBIC_CMD_SBT | SBIC_CMD_XFER_INFO); \
- SBIC_WAIT(regs, SBIC_ASR_DBR, 0); \
- SET_SBIC_data(regs, ch); \
- } while (0)
-
-/*
- * receive a byte in programmed I/O mode
- */
-#define RECV_BYTE(regs, ch) \
- do { \
- WAIT_CIP(regs); \
- SET_SBIC_cmd(regs, SBIC_CMD_SBT | SBIC_CMD_XFER_INFO); \
- SBIC_WAIT(regs, SBIC_ASR_DBR, 0); \
- GET_SBIC_data(regs, ch); \
- } while (0)
-
diff --git a/sys/arch/kbus/dev/sbicvar.h b/sys/arch/kbus/dev/sbicvar.h
deleted file mode 100644
index 3ca88a9a3d7..00000000000
--- a/sys/arch/kbus/dev/sbicvar.h
+++ /dev/null
@@ -1,235 +0,0 @@
-/* $OpenBSD: sbicvar.h,v 1.2 2001/01/25 03:50:47 todd Exp $ */
-/* $NetBSD: sbicvar.h,v 1.11 1996/04/21 21:12:23 veego Exp $ */
-
-/*
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)scsivar.h 7.1 (Berkeley) 5/8/90
- */
-#ifndef _SBICVAR_H_
-#define _SBICVAR_H_
-#include <sys/malloc.h>
-
-/*
- * The largest single request will be MAXPHYS bytes which will require
- * at most MAXPHYS/NBPG+1 chain elements to describe, i.e. if none of
- * the buffer pages are physically contiguous (MAXPHYS/NBPG) and the
- * buffer is not page aligned (+1).
- */
-#define DMAMAXIO (MAXPHYS/NBPG+1)
-
-struct dma_chain {
- int dc_count;
- char *dc_addr;
-};
-
-/*
- * ACB. Holds additional information for each SCSI command Comments: We
- * need a separate scsi command block because we may need to overwrite it
- * with a request sense command. Basicly, we refrain from fiddling with
- * the scsi_xfer struct (except do the expected updating of return values).
- * We'll generally update: xs->{flags,resid,error,sense,status} and
- * occasionally xs->retries.
- */
-struct sbic_acb {
- TAILQ_ENTRY(sbic_acb) chain;
- struct scsi_xfer *xs; /* SCSI xfer ctrl block from above */
- int flags; /* Status */
-#define ACB_FREE 0x00
-#define ACB_ACTIVE 0x01
-#define ACB_DONE 0x04
-#define ACB_CHKSENSE 0x08
-#define ACB_BBUF 0x10 /* DMA input needs to be copied from bounce */
-#define ACB_DATAIN 0x20 /* DMA direction flag */
- struct scsi_generic cmd; /* SCSI command block */
- int clen;
- struct dma_chain sc_kv; /* Virtual address of whole DMA */
- struct dma_chain sc_pa; /* Physical address of DMA segment */
- u_long sc_tcnt; /* number of bytes for this DMA */
- u_char *sc_dmausrbuf; /* user buffer kva - for bounce copy */
- u_long sc_dmausrlen; /* length of bounce copy */
- u_short sc_dmacmd; /* Internal data for this DMA */
- char *pa_addr; /* XXXX initial phys addr */
- u_char *sc_usrbufpa; /* user buffer phys addr */
-};
-
-/*
- * Some info about each (possible) target on the SCSI bus. This should
- * probably have been a "per target+lunit" structure, but we'll leave it at
- * this for now. Is there a way to reliably hook it up to sc->fordriver??
- */
-struct sbic_tinfo {
- int cmds; /* #commands processed */
- int dconns; /* #disconnects */
- int touts; /* #timeouts */
- int perrs; /* #parity errors */
- int senses; /* #request sense commands sent */
- u_char* bounce; /* Bounce buffer for this device */
- ushort lubusy; /* What local units/subr. are busy? */
- u_char flags;
- u_char period; /* Period suggestion */
- u_char offset; /* Offset suggestion */
-} tinfo_t;
-
-struct sbic_softc {
- struct device sc_dev;
- struct intrhand sc_sbicih;
- struct target_sync {
- u_char state;
- u_char period;
- u_char offset;
- } sc_sync[8];
- u_char target; /* Currently active target */
- u_char lun;
- struct scsi_link sc_link; /* proto for sub devices */
- sbic_regmap_p sc_sbicp; /* the SBIC */
- volatile void *sc_cregs; /* driver specific regs */
-
- /* Lists of command blocks */
- TAILQ_HEAD(acb_list, sbic_acb) free_list,
- ready_list,
- nexus_list;
-
- struct sbic_acb *sc_nexus; /* current command */
- struct sbic_acb sc_acb[8]; /* the real command blocks */
- struct sbic_tinfo sc_tinfo[8];
-
- struct scsi_xfer *sc_xs; /* transfer from high level code */
- u_char sc_flags;
- u_char sc_scsiaddr;
- u_char sc_stat[2];
- u_char sc_msg[7];
- u_long sc_clkfreq;
- u_long sc_tcnt; /* number of bytes transferred */
- u_short sc_dmacmd; /* used by dma drivers */
- u_short sc_dmatimo; /* dma timeout */
- u_long sc_dmamask; /* dma valid mem mask */
- struct dma_chain *sc_cur;
- struct dma_chain *sc_last;
- int (*sc_dmago) __P((struct sbic_softc *, char *, int, int));
- int (*sc_dmanext) __P((struct sbic_softc *));
- void (*sc_enintr) __P((struct sbic_softc *));
- void (*sc_dmastop) __P((struct sbic_softc *));
- u_short gtsc_bankmask; /* GVP specific bank selected */
-};
-
-/* sc_flags */
-#define SBICF_ALIVE 0x01 /* controller initialized */
-#define SBICF_DCFLUSH 0x02 /* need flush for overlap after dma finishes */
-#define SBICF_SELECTED 0x04 /* bus is in selected state. */
-#define SBICF_ICMD 0x08 /* Immediate command in execution */
-#define SBICF_BADDMA 0x10 /* controller can only DMA to ztwobus space */
-#define SBICF_INTR 0x40 /* SBICF interrupt expected */
-#define SBICF_INDMA 0x80 /* not used yet, DMA I/O in progress */
-
-/* sync states */
-#define SYNC_START 0 /* no sync handshake started */
-#define SYNC_SENT 1 /* we sent sync request, no answer yet */
-#define SYNC_DONE 2 /* target accepted our (or inferior) settings,
- or it rejected the request and we stay async */
-#ifdef DEBUG
-#define DDB_FOLLOW 0x04
-#define DDB_IO 0x08
-#endif
-extern u_char sbic_inhibit_sync[8];
-extern int sbic_no_dma;
-extern int sbic_clock_override;
-
-#define PHASE 0x07 /* mask for psns/pctl phase */
-#define DATA_OUT_PHASE 0x00
-#define DATA_IN_PHASE 0x01
-#define CMD_PHASE 0x02
-#define STATUS_PHASE 0x03
-#define BUS_FREE_PHASE 0x04
-#define ARB_SEL_PHASE 0x05 /* Fuji chip combines arbitration with sel. */
-#define MESG_OUT_PHASE 0x06
-#define MESG_IN_PHASE 0x07
-
-#define MSG_CMD_COMPLETE 0x00
-#define MSG_EXT_MESSAGE 0x01
-#define MSG_SAVE_DATA_PTR 0x02
-#define MSG_RESTORE_PTR 0x03
-#define MSG_DISCONNECT 0x04
-#define MSG_INIT_DETECT_ERROR 0x05
-#define MSG_ABORT 0x06
-#define MSG_REJECT 0x07
-#define MSG_NOOP 0x08
-#define MSG_PARITY_ERROR 0x09
-#define MSG_BUS_DEVICE_RESET 0x0C
-#define MSG_IDENTIFY 0x80
-#define MSG_IDENTIFY_DR 0xc0 /* (disconnect/reconnect allowed) */
-#define MSG_SYNC_REQ 0x01
-
-#define MSG_ISIDENTIFY(x) (x&MSG_IDENTIFY)
-#define IFY_TRN 0x20
-#define IFY_LUNTRN(x) (x&0x07)
-#define IFY_LUN(x) (!(x&0x20))
-
-/* Check if high bit set */
-
-#define STS_CHECKCOND 0x02 /* Check Condition (ie., read sense) */
-#define STS_CONDMET 0x04 /* Condition Met (ie., search worked) */
-#define STS_BUSY 0x08
-#define STS_INTERMED 0x10 /* Intermediate status sent */
-#define STS_EXT 0x80 /* Extended status valid */
-
-
-/* States returned by our state machine */
-
-#define SBIC_STATE_ERROR -1
-#define SBIC_STATE_DONE 0
-#define SBIC_STATE_RUNNING 1
-#define SBIC_STATE_DISCONNECT 2
-
-/*
- * XXXX
- */
-struct scsi_fmt_cdb {
- int len; /* cdb length (in bytes) */
- u_char cdb[28]; /* cdb to use on next read/write */
-};
-
-struct buf;
-struct scsi_xfer;
-
-void sbic_minphys __P((struct buf *bp));
-int sbic_scsicmd __P((struct scsi_xfer *));
-void sbicinit __P((struct sbic_softc *));
-int sbicintr __P((struct sbic_softc *));
-#ifdef DEBUG
-void sbic_dump __P((struct sbic_softc *dev));
-#endif
-
-#endif /* _SBICVAR_H_ */
diff --git a/sys/arch/kbus/dev/sbicvar.h.mvme b/sys/arch/kbus/dev/sbicvar.h.mvme
deleted file mode 100644
index 005bbbb538a..00000000000
--- a/sys/arch/kbus/dev/sbicvar.h.mvme
+++ /dev/null
@@ -1,210 +0,0 @@
-/* $OpenBSD: sbicvar.h.mvme,v 1.2 2001/01/25 03:50:47 todd Exp $ */
-
-/*
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)scsivar.h 7.1 (Berkeley) 5/8/90
- */
-#ifndef _SBICVAR_H_
-#define _SBICVAR_H_
-#include <sys/malloc.h>
-
-
-/*
- * DMA chains are used for Scatter-Gather DMA.
- */
-struct dma_chain {
- int dc_count;
- char *dc_addr;
-};
-
-/*
- * ACB. Holds additional information for each SCSI command Comments: We
- * need a separate scsi command block because we may need to overwrite it
- * with a request sense command. Basicly, we refrain from fiddling with
- * the scsi_xfer struct (except do the expected updating of return values).
- * We'll generally update: xs->{flags,resid,error,sense,status} and
- * occasionally xs->retries.
- */
-struct sbic_acb {
- TAILQ_ENTRY(sbic_acb) chain;
- struct scsi_xfer *xs; /* SCSI xfer ctrl block from above */
- int flags; /* Status */
-#define ACB_FREE 0x00
-#define ACB_ACTIVE 0x01
-#define ACB_DONE 0x04
-#define ACB_CHKSENSE 0x08
-#define ACB_BBUF 0x10 /* DMA input needs to be copied from bounce */
-#define ACB_DATAIN 0x20 /* DMA direction flag */
-
- struct scsi_generic cmd; /* SCSI command block */
- int clen;
- struct dma_chain sc_kv; /* Virtual address of whole DMA */
- struct dma_chain sc_pa; /* Physical address of DMA segment */
- u_long sc_tcnt; /* number of bytes for this DMA */
- u_short sc_dmacmd; /* Internal data for this DMA */
- char *pa_addr; /* XXXX initial phys addr */
-};
-
-/*
- * Some info about each (possible) target on the SCSI bus. This should
- * probably have been a "per target+lunit" structure, but we'll leave it at
- * this for now. Is there a way to reliably hook it up to sc->fordriver??
- */
-struct sbic_tinfo {
- int cmds; /* #commands processed */
- int dconns; /* #disconnects */
- int senses; /* #request sense commands sent */
- int lubusy; /* What local units/subr. are busy? */
-} tinfo_t;
-
-struct sbic_softc {
- struct device sc_dev;
- /* struct intrhand sc_dmaih; */
- struct intrhand sc_sbicih;
- struct target_sync {
- u_char state;
- u_char period;
- u_char offset;
- } sc_sync[8];
- u_char target; /* Currently active target */
- u_char lun;
- struct scsi_link sc_link; /* proto for sub devices */
- sbic_regmap_p sc_sbicp; /* the SBIC */
- void *sc_cregs; /* driver specific regs */
- int sc_ipl;
-
- /* Lists of command blocks */
- TAILQ_HEAD(acb_list, sbic_acb) free_list,
- ready_list,
- nexus_list;
-
- struct sbic_acb *sc_nexus; /* current command */
- struct sbic_acb sc_acb[8]; /* the real command blocks */
- struct sbic_tinfo sc_tinfo[8];
-
- struct scsi_xfer *sc_xs; /* transfer from high level code */
- u_char sc_flags;
- u_char sc_stat[2];
- u_char sc_msg[7];
- u_long sc_clkfreq;
- u_long sc_tcnt; /* number of bytes transferred */
- u_short sc_dmacmd; /* used by dma drivers */
- u_long sc_dmamask; /* dma valid mem mask */
-
- struct dma_chain *sc_cur;
- struct dma_chain *sc_last;
- int (*sc_dmago) __P((struct sbic_softc *, char *, int, int));
- int (*sc_dmanext) __P((struct sbic_softc *));
- void (*sc_enintr) __P((struct sbic_softc *));
- void (*sc_dmastop) __P((struct sbic_softc *));
-#ifdef DEBUG
- u_short sc_dmatimo; /* dma timeout */
-#endif
-};
-
-/*
- * sc_flags
- */
-#define SBICF_ALIVE 0x01 /* controller initialized */
-#define SBICF_DCFLUSH 0x02 /* need flush for overlap after dma finishes */
-#define SBICF_SELECTED 0x04 /* bus is in selected state. */
-#define SBICF_ICMD 0x08 /* Immediate command in execution */
-#define SBICF_BADDMA 0x10 /* controller can only DMA to ztwobus space */
-#define SBICF_INTR 0x40 /* SBICF interrupt expected */
-#define SBICF_INDMA 0x80 /* not used yet, DMA I/O in progress */
-
-/*
- * sync states
- */
-#define SYNC_START 0 /* no sync handshake started */
-#define SYNC_SENT 1 /* we sent sync request, no answer yet */
-#define SYNC_DONE 2 /* target accepted our (or inferior) settings,
- or it rejected the request and we stay async */
-
-#define PHASE 0x07 /* mask for psns/pctl phase */
-#define DATA_OUT_PHASE 0x00
-#define DATA_IN_PHASE 0x01
-#define CMD_PHASE 0x02
-#define STATUS_PHASE 0x03
-#define BUS_FREE_PHASE 0x04
-#define ARB_SEL_PHASE 0x05 /* Fuji chip combines arbitration with sel. */
-#define MESG_OUT_PHASE 0x06
-#define MESG_IN_PHASE 0x07
-
-#define MSG_CMD_COMPLETE 0x00
-#define MSG_EXT_MESSAGE 0x01
-#define MSG_SAVE_DATA_PTR 0x02
-#define MSG_RESTORE_PTR 0x03
-#define MSG_DISCONNECT 0x04
-#define MSG_INIT_DETECT_ERROR 0x05
-#define MSG_ABORT 0x06
-#define MSG_REJECT 0x07
-#define MSG_NOOP 0x08
-#define MSG_PARITY_ERROR 0x09
-#define MSG_BUS_DEVICE_RESET 0x0C
-#define MSG_IDENTIFY 0x80
-#define MSG_IDENTIFY_DR 0xc0 /* (disconnect/reconnect allowed) */
-#define MSG_SYNC_REQ 0x01
-
-#define MSG_ISIDENTIFY(x) ((x) & MSG_IDENTIFY)
-
-
-#define STS_CHECKCOND 0x02 /* Check Condition (ie., read sense) */
-#define STS_CONDMET 0x04 /* Condition Met (ie., search worked) */
-#define STS_BUSY 0x08
-#define STS_INTERMED 0x10 /* Intermediate status sent */
-#define STS_EXT 0x80 /* Extended status valid */
-
-
-/*
- * States returned by our state machine
- */
-
-#define SBIC_STATE_ERROR -1
-#define SBIC_STATE_DONE 0
-#define SBIC_STATE_RUNNING 1
-#define SBIC_STATE_DISCONNECT 2
-
-
-struct buf;
-struct scsi_xfer;
-
-void sbic_minphys __P((struct buf *bp));
-int sbic_scsicmd __P((struct scsi_xfer *));
-void sbicinit __P((struct sbic_softc *dev));
-int sbicintr __P((struct sbic_softc *));
-
-#endif /* _SBICVAR_H_ */
diff --git a/sys/arch/kbus/dev/vme.c b/sys/arch/kbus/dev/vme.c
deleted file mode 100644
index 8cb12219af6..00000000000
--- a/sys/arch/kbus/dev/vme.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/* $OpenBSD: vme.c,v 1.2 1999/01/11 05:11:28 millert Exp $ */
-/* $NetBSD: vme.c,v 1.6 1996/11/20 18:57:02 gwr Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Gordon W. Ross.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-#include <sys/map.h>
-#include <sys/proc.h>
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-
-#include <machine/autoconf.h>
-#include <machine/dvma.h>
-#include <machine/kbus.h>
-/* #include <machine/vme.h> */
-
-static int vme_match __P((struct device *, void *, void *));
-
-static void vme_attach __P((struct device *, struct device *, void *));
-
-struct cfattach vmel_ca = {
- sizeof(struct device), vme_match, vme_attach
-};
-
-struct cfdriver vmel_cd = {
- NULL, "vmel", DV_DULL
-};
-
-struct cfattach vmeh_ca = {
- sizeof(struct device), vme_match, vme_attach
-};
-
-struct cfdriver vmeh_cd = {
- NULL, "vmeh", DV_DULL
-};
-
-struct cfattach vmes_ca = {
- sizeof(struct device), vme_match, vme_attach
-};
-
-struct cfdriver vmes_cd = {
- NULL, "vmes", DV_DULL
-};
-
-struct intrhand **vmeints;
-
-static int
-vme_match(parent, vcf, aux)
- struct device *parent;
- void *vcf, *aux;
-{
- struct confargs *ca = aux;
-
- if (ca->ca_bustype != BUS_VME32
- && ca->ca_bustype != BUS_VME24
- && ca->ca_bustype != BUS_VME16)
- return 0;
- return 1;
-}
-
-static char *dvma_map_base;
-static unsigned short *vme_iack;
-
-static void
-vme_attach(parent, self, args)
- struct device *parent;
- struct device *self;
- void *args;
-{
- printf("\n");
-
- /* Map the vme address map. */
- if (!dvma_map_base)
- {
- dvma_map_base = bus_mapin (BUS_KBUS, VME_MAP_BASE, DVMA_SIZE);
- if (!dvma_map_base)
- panic ("Cannot map vme address map");
- }
-
- /* Be sure the vme_iack was set. */
- if (!vme_iack)
- {
- vme_iack = (unsigned short *)
- bus_mapin (BUS_KBUS, VME_IACK_BASE, VME_IACK_SIZE);
- if (!vme_iack)
- panic ("Can't map vme iack page");
- }
-
- if (vmeints == NULL) {
- vmeints = (struct intrhand **)malloc(256 *
- sizeof(struct intrhand *), M_TEMP, M_NOWAIT);
- bzero(vmeints, 256 * sizeof(struct intrhand *));
- }
-
- /* We know ca_bustype == BUS_VMExx */
- (void) config_search(bus_scan, self, args);
-}
-
-/*
- * Wrapper for dvma_mapin() in kernel space,
- * so drivers need not include VM goo to get at kernel_map.
- */
-caddr_t
-kdvma_mapin(va, len, canwait)
- caddr_t va;
- int len, canwait;
-{
- return (caddr_t) dvma_mapin(kernel_map, (vm_offset_t)va, len, canwait);
-}
-
-caddr_t
-dvma_malloc(len, kaddr, flags)
- size_t len;
- void *kaddr;
- int flags;
-{
- vm_offset_t kva;
- vm_offset_t dva;
-
- len = round_page(len);
- kva = (vm_offset_t)malloc(len, M_DEVBUF, flags);
- if (kva == NULL)
- return (NULL);
-
- *(vm_offset_t *)kaddr = kva;
- dva = dvma_mapin(kernel_map, kva, len, (flags & M_NOWAIT) ? 0 : 1);
- if (dva == NULL) {
- free((void *)kva, M_DEVBUF);
- return (NULL);
- }
- return (caddr_t)dva;
-}
-
-void
-dvma_free(dva, len, kaddr)
- caddr_t dva;
- size_t len;
- void *kaddr;
-{
- vm_offset_t kva = *(vm_offset_t *)kaddr;
-
- dvma_mapout((vm_offset_t)dva, kva, round_page(len));
- free((void *)kva, M_DEVBUF);
-}
-
-/*
- * Map a range [va, va+len] of wired virtual addresses in the given map
- * to a kernel address in DVMA space.
- * Return a DVMA address, ie suitable for VME devices.
- */
-vm_offset_t
-dvma_mapin(map, va, len, canwait)
- struct vm_map *map;
- vm_offset_t va;
- int len, canwait;
-{
- vm_offset_t kva, tva;
- register int npf, s;
- register vm_offset_t pa;
- long off, pn;
-
- off = (int)va & PGOFSET;
- va -= off;
- len = round_page(len + off);
- npf = btoc(len);
-
- s = splimp();
- for (;;) {
-
- pn = rmalloc(dvmamap, npf);
-
- if (pn != 0)
- break;
- if (canwait) {
- (void)tsleep(dvmamap, PRIBIO+1, "physio", 0);
- continue;
- }
- splx(s);
- return NULL;
- }
- splx(s);
-
- kva = tva = rctov (pn);
-
- while (npf--) {
- pa = pmap_extract(vm_map_pmap(map), va);
- if (pa == 0)
- panic("dvma_mapin: null page frame");
- pa = trunc_page(pa);
-
- *(u_int *)(dvma_map_base + tva) = pa | VME_MAP_V;
-
- tva += PAGE_SIZE;
- va += PAGE_SIZE;
- }
- return kva + off;
-}
-
-/*
- * Remove double map of `va' in DVMA space at `kva'.
- */
-void
-dvma_mapout(kva, va, len)
- vm_offset_t kva, va;
- int len;
-{
- register int s, off;
- vm_offset_t tva;
-
- off = (int)kva & PGOFSET;
- kva -= off;
- len = round_page(len + off);
-
- for (tva = kva; tva < kva + len; tva += VME_PAGESIZE)
- *(u_int *)(dvma_map_base + tva) = VME_MAP_NV;
-
- s = splimp();
- rmfree(dvmamap, btoc(len), vtorc(kva));
- wakeup(dvmamap);
- splx(s);
-}
-
-static int vmeintr __P((void *arg));
-
-static int
-vmeintr(arg)
- void *arg;
-{
- int level = (int)arg, vec;
- struct intrhand *ih;
- int i = 0;
-
- vec = vme_iack[level] & 0xff;
-#if 0
- printf ("vme intr: level = %d, vec = 0x%x\n", level, vec);
-#endif
-
- for (ih = vmeints[vec]; ih; ih = ih->ih_next)
- if (ih->ih_fun)
- i += (ih->ih_fun)(ih->ih_arg);
- if (!i)
- printf ("Stray vme int, level %d, vec 0x%02x\n", level, vec);
-
- return i;
-}
-
-void
-vmeintr_establish(vec, level, ih)
- int vec, level;
- struct intrhand *ih;
-{
- struct intrhand *ihs;
-
- if (vec == -1)
- panic("vmeintr_establish: uninitialized vec");
-
- if (vmeints[vec] == NULL)
- vmeints[vec] = ih;
- else {
- for (ihs = vmeints[vec]; ihs->ih_next; ihs = ihs->ih_next)
- ;
- ihs->ih_next = ih;
- }
-
- /* Be sure the vme_iack was set. */
- if (!vme_iack)
- panic ("vme_iack was not set");
-
- /* ensure the interrupt subsystem will call us at this level */
- for (ihs = intrhand[level]; ihs; ihs = ihs->ih_next)
- if (ihs->ih_fun == vmeintr)
- return;
-
- ihs = (struct intrhand *)malloc(sizeof(struct intrhand),
- M_TEMP, M_NOWAIT);
- if (ihs == NULL)
- panic("vme_addirq");
- bzero(ihs, sizeof *ihs);
- ihs->ih_fun = vmeintr;
- ihs->ih_arg = (void *)level;
- intr_establish(VME_IPL_TO_INTR (level), IH_CAN_DELAY, ihs);
-}
-
diff --git a/sys/arch/kbus/dev/xd.c b/sys/arch/kbus/dev/xd.c
deleted file mode 100644
index 2235fb64a40..00000000000
--- a/sys/arch/kbus/dev/xd.c
+++ /dev/null
@@ -1,2380 +0,0 @@
-/* $NetBSD: xd.c,v 1.25 1996/04/22 02:42:06 christos Exp $ */
-/*
- *
- * Copyright (c) 1995 Charles D. Cranor
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles D. Cranor.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- *
- * x d . c x y l o g i c s 7 5 3 / 7 0 5 3 v m e / s m d d r i v e r
- *
- * author: Chuck Cranor <chuck@ccrc.wustl.edu>
- * id: $NetBSD: xd.c,v 1.25 1996/04/22 02:42:06 christos Exp $
- * started: 27-Feb-95
- * references: [1] Xylogics Model 753 User's Manual
- * part number: 166-753-001, Revision B, May 21, 1988.
- * "Your Partner For Performance"
- * [2] other NetBSD disk device drivers
- *
- * Special thanks go to Scott E. Campbell of Xylogics, Inc. for taking
- * the time to answer some of my questions about the 753/7053.
- *
- * note: the 753 and the 7053 are programmed the same way, but are
- * different sizes. the 753 is a 6U VME card, while the 7053 is a 9U
- * VME card (found in many VME based suns).
- */
-
-#undef XDC_DEBUG /* full debug */
-#define XDC_DIAG /* extra sanity checks */
-#if defined(DIAGNOSTIC) && !defined(XDC_DIAG)
-#define XDC_DIAG /* link in with master DIAG option */
-#endif
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/file.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/buf.h>
-#include <sys/uio.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-#include <sys/disk.h>
-#include <sys/syslog.h>
-#include <sys/dkbad.h>
-#include <sys/conf.h>
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-
-#include <machine/autoconf.h>
-#include <machine/sun_disklabel.h>
-#include <machine/conf.h>
-#include <machine/dvma.h>
-
-#include "xdreg.h"
-#include "xdvar.h"
-#include "xio.h"
-
-
-/*
- * macros
- */
-
-/*
- * XDC_TWAIT: add iorq "N" to tail of SC's wait queue
- */
-#define XDC_TWAIT(SC, N) { \
- (SC)->waitq[(SC)->waitend] = (N); \
- (SC)->waitend = ((SC)->waitend + 1) % XDC_MAXIOPB; \
- (SC)->nwait++; \
-}
-
-/*
- * XDC_HWAIT: add iorq "N" to head of SC's wait queue
- */
-#define XDC_HWAIT(SC, N) { \
- (SC)->waithead = ((SC)->waithead == 0) ? \
- (XDC_MAXIOPB - 1) : ((SC)->waithead - 1); \
- (SC)->waitq[(SC)->waithead] = (N); \
- (SC)->nwait++; \
-}
-
-/*
- * XDC_GET_WAITER: gets the first request waiting on the waitq
- * and removes it (so it can be submitted)
- */
-#define XDC_GET_WAITER(XDCSC, RQ) { \
- (RQ) = (XDCSC)->waitq[(XDCSC)->waithead]; \
- (XDCSC)->waithead = ((XDCSC)->waithead + 1) % XDC_MAXIOPB; \
- xdcsc->nwait--; \
-}
-
-/*
- * XDC_FREE: add iorq "N" to SC's free list
- */
-#define XDC_FREE(SC, N) { \
- (SC)->freereq[(SC)->nfree++] = (N); \
- (SC)->reqs[N].mode = 0; \
- if ((SC)->nfree == 1) wakeup(&(SC)->nfree); \
-}
-
-
-/*
- * XDC_RQALLOC: allocate an iorq off the free list (assume nfree > 0).
- */
-#define XDC_RQALLOC(XDCSC) (XDCSC)->freereq[--((XDCSC)->nfree)]
-
-/*
- * XDC_GO: start iopb ADDR (DVMA addr in a u_long) on XDC
- */
-#define XDC_GO(XDC, ADDR) { \
- (XDC)->xdc_iopbaddr0 = ((ADDR) & 0xff); \
- (ADDR) = ((ADDR) >> 8); \
- (XDC)->xdc_iopbaddr1 = ((ADDR) & 0xff); \
- (ADDR) = ((ADDR) >> 8); \
- (XDC)->xdc_iopbaddr2 = ((ADDR) & 0xff); \
- (ADDR) = ((ADDR) >> 8); \
- (XDC)->xdc_iopbaddr3 = (ADDR); \
- (XDC)->xdc_iopbamod = XDC_ADDRMOD; \
- (XDC)->xdc_csr = XDC_ADDIOPB; /* go! */ \
-}
-
-/*
- * XDC_WAIT: wait for XDC's csr "BITS" to come on in "TIME".
- * LCV is a counter. If it goes to zero then we timed out.
- */
-#define XDC_WAIT(XDC, LCV, TIME, BITS) { \
- (LCV) = (TIME); \
- while ((LCV) > 0) { \
- if ((XDC)->xdc_csr & (BITS)) break; \
- (LCV) = (LCV) - 1; \
- DELAY(1); \
- } \
-}
-
-/*
- * XDC_DONE: don't need IORQ, get error code and free (done after xdc_cmd)
- */
-#define XDC_DONE(SC,RQ,ER) { \
- if ((RQ) == XD_ERR_FAIL) { \
- (ER) = (RQ); \
- } else { \
- if ((SC)->ndone-- == XDC_SUBWAITLIM) \
- wakeup(&(SC)->ndone); \
- (ER) = (SC)->reqs[RQ].errno; \
- XDC_FREE((SC), (RQ)); \
- } \
-}
-
-/*
- * XDC_ADVANCE: advance iorq's pointers by a number of sectors
- */
-#define XDC_ADVANCE(IORQ, N) { \
- if (N) { \
- (IORQ)->sectcnt -= (N); \
- (IORQ)->blockno += (N); \
- (IORQ)->dbuf += ((N)*XDFM_BPS); \
- } \
-}
-
-/*
- * note - addresses you can sleep on:
- * [1] & of xd_softc's "state" (waiting for a chance to attach a drive)
- * [2] & of xdc_softc's "nfree" (waiting for a free iorq/iopb)
- * [3] & of xdc_softc's "ndone" (waiting for number of done iorq/iopb's
- * to drop below XDC_SUBWAITLIM)
- * [4] & an iorq (waiting for an XD_SUB_WAIT iorq to finish)
- */
-
-
-/*
- * function prototypes
- * "xdc_*" functions are internal, all others are external interfaces
- */
-
-/* internals */
-int xdc_cmd __P((struct xdc_softc *, int, int, int, int, int, char *, int));
-char *xdc_e2str __P((int));
-int xdc_error __P((struct xdc_softc *, struct xd_iorq *,
- struct xd_iopb *, int, int));
-int xdc_ioctlcmd __P((struct xd_softc *, dev_t dev, struct xd_iocmd *));
-void xdc_perror __P((struct xd_iorq *, struct xd_iopb *, int));
-int xdc_piodriver __P((struct xdc_softc *, int, int));
-int xdc_remove_iorq __P((struct xdc_softc *));
-int xdc_reset __P((struct xdc_softc *, int, int, int, struct xd_softc *));
-inline void xdc_rqinit __P((struct xd_iorq *, struct xdc_softc *,
- struct xd_softc *, int, u_long, int,
- caddr_t, struct buf *));
-void xdc_rqtopb __P((struct xd_iorq *, struct xd_iopb *, int, int));
-void xdc_start __P((struct xdc_softc *, int));
-int xdc_startbuf __P((struct xdc_softc *, struct xd_softc *, struct buf *));
-int xdc_submit_iorq __P((struct xdc_softc *, int, int));
-void xdc_tick __P((void *));
-void xdc_xdreset __P((struct xdc_softc *, struct xd_softc *));
-
-/* machine interrupt hook */
-int xdcintr __P((void *));
-
-/* autoconf */
-int xdcmatch __P((struct device *, void *, void *));
-void xdcattach __P((struct device *, struct device *, void *));
-int xdmatch __P((struct device *, void *, void *));
-void xdattach __P((struct device *, struct device *, void *));
-
-static void xddummystrat __P((struct buf *));
-int xdgetdisklabel __P((struct xd_softc *, void *));
-
-/*
- * cfdrivers: device driver interface to autoconfig
- */
-
-struct cfattach xdc_ca = {
- sizeof(struct xdc_softc), xdcmatch, xdcattach
-};
-
-
-struct cfdriver xdc_cd = {
- NULL, "xdc", DV_DULL
-};
-
-struct cfattach xd_ca = {
- sizeof(struct xd_softc), xdmatch, xdattach
-};
-
-struct cfdriver xd_cd = {
- NULL, "xd", DV_DISK
-};
-
-struct xdc_attach_args { /* this is the "aux" args to xdattach */
- int driveno; /* unit number */
- char *buf; /* scratch buffer for reading disk label */
- char *dvmabuf; /* DVMA address of above */
- int fullmode; /* submit mode */
- int booting; /* are we booting or not? */
-};
-
-/*
- * dkdriver
- */
-
-struct dkdriver xddkdriver = {xdstrategy};
-
-/*
- * start: disk label fix code (XXX)
- */
-
-static void *xd_labeldata;
-
-static void
-xddummystrat(bp)
- struct buf *bp;
-{
- if (bp->b_bcount != XDFM_BPS)
- panic("xddummystrat");
- bcopy(xd_labeldata, bp->b_un.b_addr, XDFM_BPS);
- bp->b_flags |= B_DONE;
- bp->b_flags &= ~B_BUSY;
-}
-
-int
-xdgetdisklabel(xd, b)
- struct xd_softc *xd;
- void *b;
-{
- char *err;
- struct sun_disklabel *sdl;
-
- /* We already have the label data in `b'; setup for dummy strategy */
- xd_labeldata = b;
-
- /* Required parameter for readdisklabel() */
- xd->sc_dk.dk_label->d_secsize = XDFM_BPS;
-
- err = readdisklabel(MAKEDISKDEV(0, xd->sc_dev.dv_unit, RAW_PART),
- xddummystrat,
- xd->sc_dk.dk_label, xd->sc_dk.dk_cpulabel, 0);
- if (err) {
- printf("%s: %s\n", xd->sc_dev.dv_xname, err);
- return(XD_ERR_FAIL);
- }
-
- /* Ok, we have the label; fill in `pcyl' if there's SunOS magic */
- sdl = (struct sun_disklabel *)xd->sc_dk.dk_cpulabel->cd_block;
- if (sdl->sl_magic == SUN_DKMAGIC)
- xd->pcyl = sdl->sl_pcylinders;
- else {
- printf("%s: WARNING: no `pcyl' in disk label.\n",
- xd->sc_dev.dv_xname);
- xd->pcyl = xd->sc_dk.dk_label->d_ncylinders +
- xd->sc_dk.dk_label->d_acylinders;
- printf("%s: WARNING: guessing pcyl=%d (ncyl+acyl)\n",
- xd->sc_dev.dv_xname, xd->pcyl);
- }
-
- xd->ncyl = xd->sc_dk.dk_label->d_ncylinders;
- xd->acyl = xd->sc_dk.dk_label->d_acylinders;
- xd->nhead = xd->sc_dk.dk_label->d_ntracks;
- xd->nsect = xd->sc_dk.dk_label->d_nsectors;
- xd->sectpercyl = xd->nhead * xd->nsect;
- xd->sc_dk.dk_label->d_secsize = XDFM_BPS; /* not handled by
- * sun->bsd */
- return(XD_ERR_AOK);
-}
-
-/*
- * end: disk label fix code (XXX)
- */
-
-/*
- * a u t o c o n f i g f u n c t i o n s
- */
-
-/*
- * xdcmatch: determine if xdc is present or not. we do a
- * soft reset to detect the xdc.
- */
-
-int xdcmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct confargs *ca = aux;
- int x;
-
- if (ca->ca_bustype != BUS_VME16)
- return (0);
-
- /* Default interrupt priority always splbio==2 */
- if (ca->ca_intpri == -1)
- ca->ca_intpri = 2;
-
- x = bus_peek(ca->ca_bustype, ca->ca_paddr + 11, 1);
- if (x == -1)
- return (0);
-
- return (1);
-}
-
-/*
- * xdcattach: attach controller
- */
-void
-xdcattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-
-{
- struct xdc_softc *xdc = (void *) self;
- struct confargs *ca = aux;
- struct xdc_attach_args xa;
- int lcv, rqno, err;
- struct xd_iopb_ctrl *ctl;
-
- /* get addressing and intr level stuff from autoconfig and load it
- * into our xdc_softc. */
-
- xdc->xdc = (struct xdc *)
- bus_mapin(ca->ca_bustype, ca->ca_paddr, sizeof(struct xdc));
- xdc->ipl = ca->ca_intpri;
- xdc->vector = ca->ca_intvec;
- printf("\n%s", xdc->sc_dev.dv_xname);
-
- for (lcv = 0; lcv < XDC_MAXDEV; lcv++)
- xdc->sc_drives[lcv] = (struct xd_softc *) 0;
-
- /* allocate and zero buffers
- *
- * note: we simplify the code by allocating the max number of iopbs and
- * iorq's up front. thus, we avoid linked lists and the costs
- * associated with them in exchange for wasting a little memory. */
-
- xdc->dvmaiopb = (struct xd_iopb *)
- dvma_malloc(XDC_MAXIOPB * sizeof(struct xd_iopb), &xdc->iopbase,
- M_NOWAIT);
- bzero(xdc->iopbase, XDC_MAXIOPB * sizeof(struct xd_iopb));
-
- xdc->reqs = (struct xd_iorq *)
- malloc(XDC_MAXIOPB * sizeof(struct xd_iorq), M_DEVBUF, M_NOWAIT);
- if (xdc->reqs == NULL)
- panic("xdc malloc");
- bzero(xdc->reqs, XDC_MAXIOPB * sizeof(struct xd_iorq));
-
- /* init free list, iorq to iopb pointers, and non-zero fields in the
- * iopb which never change. */
-
- for (lcv = 0; lcv < XDC_MAXIOPB; lcv++) {
- xdc->reqs[lcv].iopb = &xdc->iopbase[lcv];
- xdc->freereq[lcv] = lcv;
- xdc->iopbase[lcv].fixd = 1; /* always the same */
- xdc->iopbase[lcv].naddrmod = XDC_ADDRMOD; /* always the same */
- xdc->iopbase[lcv].intr_vec = xdc->vector; /* always the same */
- }
- xdc->nfree = XDC_MAXIOPB;
- xdc->nrun = 0;
- xdc->waithead = xdc->waitend = xdc->nwait = 0;
- xdc->ndone = 0;
-
- /* init queue of waiting bufs */
-
- xdc->sc_wq.b_active = 0;
- xdc->sc_wq.b_actf = 0;
- xdc->sc_wq.b_actb = &xdc->sc_wq.b_actf;
-
- /*
- * section 7 of the manual tells us how to init the controller:
- * - read controller parameters (6/0)
- * - write controller parameters (5/0)
- */
-
- /* read controller parameters and insure we have a 753/7053 */
-
- rqno = xdc_cmd(xdc, XDCMD_RDP, XDFUN_CTL, 0, 0, 0, 0, XD_SUB_POLL);
- if (rqno == XD_ERR_FAIL) {
- printf(": couldn't read controller params\n");
- return; /* shouldn't ever happen */
- }
- ctl = (struct xd_iopb_ctrl *) & xdc->iopbase[rqno];
- if (ctl->ctype != XDCT_753) {
- if (xdc->reqs[rqno].errno)
- printf(": %s: ", xdc_e2str(xdc->reqs[rqno].errno));
- printf(": doesn't identify as a 753/7053\n");
- XDC_DONE(xdc, rqno, err);
- return;
- }
- printf(": Xylogics 753/7053, PROM=%x.%02x.%02x\n",
- ctl->eprom_partno, ctl->eprom_lvl, ctl->eprom_rev);
- XDC_DONE(xdc, rqno, err);
-
- /* now write controller parameters (xdc_cmd sets all params for us) */
-
- rqno = xdc_cmd(xdc, XDCMD_WRP, XDFUN_CTL, 0, 0, 0, 0, XD_SUB_POLL);
- XDC_DONE(xdc, rqno, err);
- if (err) {
- printf("%s: controller config error: %s\n",
- xdc->sc_dev.dv_xname, xdc_e2str(err));
- return;
- }
- /* link in interrupt with higher level software */
-
- xdc->sc_ih.ih_fun = xdcintr;
- xdc->sc_ih.ih_arg = xdc;
- vmeintr_establish(ca->ca_intvec, ca->ca_intpri, &xdc->sc_ih);
- evcnt_attach(&xdc->sc_dev, "intr", &xdc->sc_intrcnt);
-
-
- /* now we must look for disks using autoconfig */
- xa.dvmabuf = (char *)dvma_malloc(XDFM_BPS, &xa.buf, M_NOWAIT);
- xa.fullmode = XD_SUB_POLL;
- xa.booting = 1;
-
- for (xa.driveno = 0; xa.driveno < XDC_MAXDEV; xa.driveno++)
- (void) config_found(self, (void *) &xa, NULL);
-
- dvma_free(xa.dvmabuf, XDFM_BPS, &xa.buf);
-
- /* start the watchdog clock */
- timeout(xdc_tick, xdc, XDC_TICKCNT);
-
-}
-
-/*
- * xdmatch: probe for disk.
- *
- * note: we almost always say disk is present. this allows us to
- * spin up and configure a disk after the system is booted (we can
- * call xdattach!).
- */
-int
-xdmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-
-{
- struct cfdata *cf = match;
- struct xdc_attach_args *xa = aux;
-
- /* looking for autoconf wildcard or exact match */
-
- if (cf->cf_loc[0] != -1 && cf->cf_loc[0] != xa->driveno)
- return 0;
-
- return 1;
-
-}
-
-/*
- * xdattach: attach a disk. this can be called from autoconf and also
- * from xdopen/xdstrategy.
- */
-void
-xdattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-
-{
- struct xd_softc *xd = (void *) self;
- struct xdc_softc *xdc = (void *) parent;
- struct xdc_attach_args *xa = aux;
- int rqno, err, spt = 0, mb, blk, lcv, fmode, s = 0, newstate;
- struct xd_iopb_drive *driopb;
- struct dkbad *dkb;
-
- /*
- * Always re-initialize the disk structure. We want statistics
- * to start with a clean slate.
- */
- bzero(&xd->sc_dk, sizeof(xd->sc_dk));
- xd->sc_dk.dk_driver = &xddkdriver;
- xd->sc_dk.dk_name = xd->sc_dev.dv_xname;
-
- /* if booting, init the xd_softc */
-
- if (xa->booting) {
- xd->state = XD_DRIVE_UNKNOWN; /* to start */
- xd->flags = 0;
- xd->parent = xdc;
- }
- xd->xd_drive = xa->driveno;
- fmode = xa->fullmode;
- xdc->sc_drives[xa->driveno] = xd;
-
- /* if not booting, make sure we are the only process in the attach for
- * this drive. if locked out, sleep on it. */
-
- if (!xa->booting) {
- s = splbio();
- while (xd->state == XD_DRIVE_ATTACHING) {
- if (tsleep(&xd->state, PRIBIO, "xdattach", 0)) {
- splx(s);
- return;
- }
- }
- printf("%s at %s",
- xd->sc_dev.dv_xname, xd->parent->sc_dev.dv_xname);
- }
- /* we now have control */
-
- xd->state = XD_DRIVE_ATTACHING;
- newstate = XD_DRIVE_UNKNOWN;
-
- /* first try and reset the drive */
-
- rqno = xdc_cmd(xdc, XDCMD_RST, 0, xd->xd_drive, 0, 0, 0, fmode);
- XDC_DONE(xdc, rqno, err);
- if (err == XD_ERR_NRDY) {
- printf(" drive %d: off-line\n", xa->driveno);
- goto done;
- }
- if (err) {
- printf(": ERROR 0x%02x (%s)\n", err, xdc_e2str(err));
- goto done;
- }
- printf(" drive %d: ready\n", xa->driveno);
-
- /* now set format parameters */
-
- rqno = xdc_cmd(xdc, XDCMD_WRP, XDFUN_FMT, xd->xd_drive, 0, 0, 0, fmode);
- XDC_DONE(xdc, rqno, err);
- if (err) {
- printf("%s: write format parameters failed: %s\n",
- xd->sc_dev.dv_xname, xdc_e2str(err));
- goto done;
- }
-
- /* get drive parameters */
- rqno = xdc_cmd(xdc, XDCMD_RDP, XDFUN_DRV, xd->xd_drive, 0, 0, 0, fmode);
- if (rqno != XD_ERR_FAIL) {
- driopb = (struct xd_iopb_drive *) & xdc->iopbase[rqno];
- spt = driopb->sectpertrk;
- }
- XDC_DONE(xdc, rqno, err);
- if (err) {
- printf("%s: read drive parameters failed: %s\n",
- xd->sc_dev.dv_xname, xdc_e2str(err));
- goto done;
- }
-
- /*
- * now set drive parameters (to semi-bogus values) so we can read the
- * disk label.
- */
- xd->pcyl = xd->ncyl = 1;
- xd->acyl = 0;
- xd->nhead = 1;
- xd->nsect = 1;
- xd->sectpercyl = 1;
- for (lcv = 0; lcv < 126; lcv++) /* init empty bad144 table */
- xd->dkb.bt_bad[lcv].bt_cyl = xd->dkb.bt_bad[lcv].bt_trksec = 0xffff;
- rqno = xdc_cmd(xdc, XDCMD_WRP, XDFUN_DRV, xd->xd_drive, 0, 0, 0, fmode);
- XDC_DONE(xdc, rqno, err);
- if (err) {
- printf("%s: write drive parameters failed: %s\n",
- xd->sc_dev.dv_xname, xdc_e2str(err));
- goto done;
- }
-
- /* read disk label */
- rqno = xdc_cmd(xdc, XDCMD_RD, 0, xd->xd_drive, 0, 1, xa->dvmabuf, fmode);
- XDC_DONE(xdc, rqno, err);
- if (err) {
- printf("%s: reading disk label failed: %s\n",
- xd->sc_dev.dv_xname, xdc_e2str(err));
- goto done;
- }
- newstate = XD_DRIVE_NOLABEL;
-
- xd->hw_spt = spt;
- /* Attach the disk: must be before getdisklabel to malloc label */
- disk_attach(&xd->sc_dk);
-
- if (xdgetdisklabel(xd, xa->buf) != XD_ERR_AOK)
- goto done;
-
- /* inform the user of what is up */
- printf("%s: <%s>, pcyl %d, hw_spt %d\n", xd->sc_dev.dv_xname,
- xa->buf, xd->pcyl, spt);
- mb = xd->ncyl * (xd->nhead * xd->nsect) / (1048576 / XDFM_BPS);
- printf("%s: %dMB, %d cyl, %d head, %d sec, %d bytes/sec\n",
- xd->sc_dev.dv_xname, mb, xd->ncyl, xd->nhead, xd->nsect,
- XDFM_BPS);
-
- /* now set the real drive parameters! */
-
- rqno = xdc_cmd(xdc, XDCMD_WRP, XDFUN_DRV, xd->xd_drive, 0, 0, 0, fmode);
- XDC_DONE(xdc, rqno, err);
- if (err) {
- printf("%s: write real drive parameters failed: %s\n",
- xd->sc_dev.dv_xname, xdc_e2str(err));
- goto done;
- }
- newstate = XD_DRIVE_ONLINE;
-
- /*
- * read bad144 table. this table resides on the first sector of the
- * last track of the disk (i.e. second cyl of "acyl" area).
- */
-
- blk = (xd->ncyl + xd->acyl - 1) * (xd->nhead * xd->nsect) + /* last cyl */
- (xd->nhead - 1) * xd->nsect; /* last head */
- rqno = xdc_cmd(xdc, XDCMD_RD, 0, xd->xd_drive, blk, 1, xa->dvmabuf, fmode);
- XDC_DONE(xdc, rqno, err);
- if (err) {
- printf("%s: reading bad144 failed: %s\n",
- xd->sc_dev.dv_xname, xdc_e2str(err));
- goto done;
- }
-
- /* check dkbad for sanity */
- dkb = (struct dkbad *) xa->buf;
- for (lcv = 0; lcv < 126; lcv++) {
- if ((dkb->bt_bad[lcv].bt_cyl == 0xffff ||
- dkb->bt_bad[lcv].bt_cyl == 0) &&
- dkb->bt_bad[lcv].bt_trksec == 0xffff)
- continue; /* blank */
- if (dkb->bt_bad[lcv].bt_cyl >= xd->ncyl)
- break;
- if ((dkb->bt_bad[lcv].bt_trksec >> 8) >= xd->nhead)
- break;
- if ((dkb->bt_bad[lcv].bt_trksec & 0xff) >= xd->nsect)
- break;
- }
- if (lcv != 126) {
- printf("%s: warning: invalid bad144 sector!\n",
- xd->sc_dev.dv_xname);
- } else {
- bcopy(xa->buf, &xd->dkb, XDFM_BPS);
- }
-
- /* XXX - Where is this and what does it do? -gwr */
- dk_establish(&xd->sc_dk, &xd->sc_dev); /* XXX */
-
-done:
- xd->state = newstate;
- if (!xa->booting) {
- wakeup(&xd->state);
- splx(s);
- }
-}
-
-/*
- * end of autoconfig functions
- */
-
-/*
- * { b , c } d e v s w f u n c t i o n s
- */
-
-/*
- * xdclose: close device
- */
-int
-xdclose(dev, flag, fmt, p)
- dev_t dev;
- int flag, fmt;
- struct proc *p;
-{
- struct xd_softc *xd = xd_cd.cd_devs[DISKUNIT(dev)];
- int part = DISKPART(dev);
-
- /* clear mask bits */
-
- switch (fmt) {
- case S_IFCHR:
- xd->sc_dk.dk_copenmask &= ~(1 << part);
- break;
- case S_IFBLK:
- xd->sc_dk.dk_bopenmask &= ~(1 << part);
- break;
- }
- xd->sc_dk.dk_openmask = xd->sc_dk.dk_copenmask | xd->sc_dk.dk_bopenmask;
-
- return 0;
-}
-
-/*
- * xddump: crash dump system
- */
-int
-xddump(dev, blkno, va, size)
- dev_t dev;
- daddr_t blkno;
- caddr_t va;
- size_t size;
-{
- int unit, part;
- struct xd_softc *xd;
-
- unit = DISKUNIT(dev);
- if (unit >= xd_cd.cd_ndevs)
- return ENXIO;
- part = DISKPART(dev);
-
- xd = xd_cd.cd_devs[unit];
-
- printf("%s%c: crash dump not supported (yet)\n", xd->sc_dev.dv_xname,
- 'a' + part);
-
- return ENXIO;
-
- /* outline: globals: "dumplo" == sector number of partition to start
- * dump at (convert to physical sector with partition table)
- * "dumpsize" == size of dump in clicks "physmem" == size of physical
- * memory (clicks, ctob() to get bytes) (normal case: dumpsize ==
- * physmem)
- *
- * dump a copy of physical memory to the dump device starting at sector
- * "dumplo" in the swap partition (make sure > 0). map in pages as
- * we go. use polled I/O.
- *
- * XXX how to handle NON_CONTIG? */
-
-}
-
-/*
- * xdioctl: ioctls on XD drives. based on ioctl's of other netbsd disks.
- */
-int
-xdioctl(dev, command, addr, flag, p)
- dev_t dev;
- u_long command;
- caddr_t addr;
- int flag;
- struct proc *p;
-
-{
- struct xd_softc *xd;
- struct xd_iocmd *xio;
- int error, s, unit;
-
- unit = DISKUNIT(dev);
-
- if (unit >= xd_cd.cd_ndevs || (xd = xd_cd.cd_devs[unit]) == NULL)
- return (ENXIO);
-
- /* switch on ioctl type */
-
- switch (command) {
- case DIOCSBAD: /* set bad144 info */
- if ((flag & FWRITE) == 0)
- return EBADF;
- s = splbio();
- bcopy(addr, &xd->dkb, sizeof(xd->dkb));
- splx(s);
- return 0;
-
- case DIOCGDINFO: /* get disk label */
- bcopy(xd->sc_dk.dk_label, addr, sizeof(struct disklabel));
- return 0;
-
- case DIOCGPART: /* get partition info */
- ((struct partinfo *) addr)->disklab = xd->sc_dk.dk_label;
- ((struct partinfo *) addr)->part =
- &xd->sc_dk.dk_label->d_partitions[DISKPART(dev)];
- return 0;
-
- case DIOCSDINFO: /* set disk label */
- if ((flag & FWRITE) == 0)
- return EBADF;
- error = setdisklabel(xd->sc_dk.dk_label,
- (struct disklabel *) addr, /* xd->sc_dk.dk_openmask : */ 0,
- xd->sc_dk.dk_cpulabel);
- if (error == 0) {
- if (xd->state == XD_DRIVE_NOLABEL)
- xd->state = XD_DRIVE_ONLINE;
- }
- return error;
-
- case DIOCWLABEL: /* change write status of disk label */
- if ((flag & FWRITE) == 0)
- return EBADF;
- if (*(int *) addr)
- xd->flags |= XD_WLABEL;
- else
- xd->flags &= ~XD_WLABEL;
- return 0;
-
- case DIOCWDINFO: /* write disk label */
- if ((flag & FWRITE) == 0)
- return EBADF;
- error = setdisklabel(xd->sc_dk.dk_label,
- (struct disklabel *) addr, /* xd->sc_dk.dk_openmask : */ 0,
- xd->sc_dk.dk_cpulabel);
- if (error == 0) {
- if (xd->state == XD_DRIVE_NOLABEL)
- xd->state = XD_DRIVE_ONLINE;
-
- /* Simulate opening partition 0 so write succeeds. */
- xd->sc_dk.dk_openmask |= (1 << 0);
- error = writedisklabel(MAKEDISKDEV(major(dev), DISKUNIT(dev), RAW_PART),
- xdstrategy, xd->sc_dk.dk_label,
- xd->sc_dk.dk_cpulabel);
- xd->sc_dk.dk_openmask =
- xd->sc_dk.dk_copenmask | xd->sc_dk.dk_bopenmask;
- }
- return error;
-
- case DIOSXDCMD:
- xio = (struct xd_iocmd *) addr;
- if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
- return (error);
- return (xdc_ioctlcmd(xd, dev, xio));
-
- default:
- return ENOTTY;
- }
-}
-/*
- * xdopen: open drive
- */
-
-int
-xdopen(dev, flag, fmt, p)
- dev_t dev;
- int flag, fmt;
- struct proc *p;
-{
- int unit, part;
- struct xd_softc *xd;
- struct xdc_attach_args xa;
-
- /* first, could it be a valid target? */
-
- unit = DISKUNIT(dev);
- if (unit >= xd_cd.cd_ndevs || (xd = xd_cd.cd_devs[unit]) == NULL)
- return (ENXIO);
- part = DISKPART(dev);
-
- /* do we need to attach the drive? */
-
- if (xd->state == XD_DRIVE_UNKNOWN) {
- xa.driveno = xd->xd_drive;
- xa.dvmabuf = (char *)dvma_malloc(XDFM_BPS, &xa.buf, M_NOWAIT);
- xa.fullmode = XD_SUB_WAIT;
- xa.booting = 0;
- xdattach((struct device *) xd->parent, (struct device *) xd, &xa);
- dvma_free(xa.dvmabuf, XDFM_BPS, &xa.buf);
- if (xd->state == XD_DRIVE_UNKNOWN) {
- return (EIO);
- }
- }
- /* check for partition */
-
- if (part != RAW_PART &&
- (part >= xd->sc_dk.dk_label->d_npartitions ||
- xd->sc_dk.dk_label->d_partitions[part].p_fstype == FS_UNUSED)) {
- return (ENXIO);
- }
- /* set open masks */
-
- switch (fmt) {
- case S_IFCHR:
- xd->sc_dk.dk_copenmask |= (1 << part);
- break;
- case S_IFBLK:
- xd->sc_dk.dk_bopenmask |= (1 << part);
- break;
- }
- xd->sc_dk.dk_openmask = xd->sc_dk.dk_copenmask | xd->sc_dk.dk_bopenmask;
-
- return 0;
-}
-
-int
-xdread(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
-
- return (physio(xdstrategy, NULL, dev, B_READ, minphys, uio));
-}
-
-int
-xdwrite(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
-
- return (physio(xdstrategy, NULL, dev, B_WRITE, minphys, uio));
-}
-
-
-/*
- * xdsize: return size of a partition for a dump
- */
-
-int
-xdsize(dev)
- dev_t dev;
-
-{
- struct xd_softc *xdsc;
- int part, size;
-
- /* valid unit? try an open */
-
- if (xdopen(dev, 0, S_IFBLK, NULL) != 0)
- return (-1);
-
- /* do it */
-
- xdsc = xd_cd.cd_devs[DISKUNIT(dev)];
- part = DISKPART(dev);
- if (xdsc->sc_dk.dk_label->d_partitions[part].p_fstype != FS_SWAP)
- size = -1; /* only give valid size for swap partitions */
- else
- size = xdsc->sc_dk.dk_label->d_partitions[part].p_size;
- if (xdclose(dev, 0, S_IFBLK, NULL) != 0)
- return -1;
- return size;
-}
-/*
- * xdstrategy: buffering system interface to xd.
- */
-
-void
-xdstrategy(bp)
- struct buf *bp;
-
-{
- struct xd_softc *xd;
- struct xdc_softc *parent;
- struct buf *wq;
- int s, unit;
- struct xdc_attach_args xa;
-
- unit = DISKUNIT(bp->b_dev);
-
- /* check for live device */
-
- if (unit >= xd_cd.cd_ndevs || (xd = xd_cd.cd_devs[unit]) == 0 ||
- bp->b_blkno < 0 ||
- (bp->b_bcount % xd->sc_dk.dk_label->d_secsize) != 0) {
- bp->b_error = EINVAL;
- goto bad;
- }
- /* do we need to attach the drive? */
-
- if (xd->state == XD_DRIVE_UNKNOWN) {
- xa.driveno = xd->xd_drive;
- xa.dvmabuf = (char *)dvma_malloc(XDFM_BPS, &xa.buf, M_NOWAIT);
- xa.fullmode = XD_SUB_WAIT;
- xa.booting = 0;
- xdattach((struct device *)xd->parent, (struct device *)xd, &xa);
- dvma_free(xa.dvmabuf, XDFM_BPS, &xa.buf);
- if (xd->state == XD_DRIVE_UNKNOWN) {
- bp->b_error = EIO;
- goto bad;
- }
- }
- if (xd->state != XD_DRIVE_ONLINE && DISKPART(bp->b_dev) != RAW_PART) {
- /* no I/O to unlabeled disks, unless raw partition */
- bp->b_error = EIO;
- goto bad;
- }
- /* short circuit zero length request */
-
- if (bp->b_bcount == 0)
- goto done;
-
- /* check bounds with label (disksubr.c). Determine the size of the
- * transfer, and make sure it is within the boundaries of the
- * partition. Adjust transfer if needed, and signal errors or early
- * completion. */
-
- if (bounds_check_with_label(bp, xd->sc_dk.dk_label,
- xd->sc_dk.dk_cpulabel, (xd->flags & XD_WLABEL) != 0) <= 0)
- goto done;
-
- /*
- * now we know we have a valid buf structure that we need to do I/O
- * on.
- *
- * note that we don't disksort because the controller has a sorting
- * algorithm built into the hardware.
- */
-
- s = splbio(); /* protect the queues */
-
- /* first, give jobs in front of us a chance */
- parent = xd->parent;
- while (parent->nfree > 0 && parent->sc_wq.b_actf)
- if (xdc_startbuf(parent, NULL, NULL) != XD_ERR_AOK)
- break;
-
- /* if there are no free iorq's, then we just queue and return. the
- * buffs will get picked up later by xdcintr().
- */
-
- if (parent->nfree == 0) {
- wq = &xd->parent->sc_wq;
- bp->b_actf = 0;
- bp->b_actb = wq->b_actb;
- *wq->b_actb = bp;
- wq->b_actb = &bp->b_actf;
- splx(s);
- return;
- }
-
- /* now we have free iopb's and we are at splbio... start 'em up */
- if (xdc_startbuf(parent, xd, bp) != XD_ERR_AOK) {
- return;
- }
-
- /* done! */
- splx(s);
- return;
-
-bad: /* tells upper layers we have an error */
- bp->b_flags |= B_ERROR;
-done: /* tells upper layers we are done with this
- * buf */
- bp->b_resid = bp->b_bcount;
- biodone(bp);
-}
-/*
- * end of {b,c}devsw functions
- */
-
-/*
- * i n t e r r u p t f u n c t i o n
- *
- * xdcintr: hardware interrupt.
- */
-int
-xdcintr(v)
- void *v;
-
-{
- struct xdc_softc *xdcsc = v;
-
- /* kick the event counter */
-
- xdcsc->sc_intrcnt.ev_count++;
-
- /* remove as many done IOPBs as possible */
-
- xdc_remove_iorq(xdcsc);
-
- /* start any iorq's already waiting */
-
- xdc_start(xdcsc, XDC_MAXIOPB);
-
- /* fill up any remaining iorq's with queue'd buffers */
-
- while (xdcsc->nfree > 0 && xdcsc->sc_wq.b_actf)
- if (xdc_startbuf(xdcsc, NULL, NULL) != XD_ERR_AOK)
- break;
-
- return (1);
-}
-/*
- * end of interrupt function
- */
-
-/*
- * i n t e r n a l f u n c t i o n s
- */
-
-/*
- * xdc_rqinit: fill out the fields of an I/O request
- */
-
-inline void
-xdc_rqinit(rq, xdc, xd, md, blk, cnt, db, bp)
- struct xd_iorq *rq;
- struct xdc_softc *xdc;
- struct xd_softc *xd;
- int md;
- u_long blk;
- int cnt;
- caddr_t db;
- struct buf *bp;
-{
- rq->xdc = xdc;
- rq->xd = xd;
- rq->ttl = XDC_MAXTTL + 10;
- rq->mode = md;
- rq->tries = rq->errno = rq->lasterror = 0;
- rq->blockno = blk;
- rq->sectcnt = cnt;
- rq->dbuf = rq->dbufbase = db;
- rq->buf = bp;
-}
-/*
- * xdc_rqtopb: load up an IOPB based on an iorq
- */
-
-void
-xdc_rqtopb(iorq, iopb, cmd, subfun)
- struct xd_iorq *iorq;
- struct xd_iopb *iopb;
- int cmd, subfun;
-
-{
- u_long block, dp;
-
- /* standard stuff */
-
- iopb->errs = iopb->done = 0;
- iopb->comm = cmd;
- iopb->errno = iopb->status = 0;
- iopb->subfun = subfun;
- if (iorq->xd)
- iopb->unit = iorq->xd->xd_drive;
- else
- iopb->unit = 0;
-
- /* check for alternate IOPB format */
-
- if (cmd == XDCMD_WRP) {
- switch (subfun) {
- case XDFUN_CTL:{
- struct xd_iopb_ctrl *ctrl =
- (struct xd_iopb_ctrl *) iopb;
- iopb->lll = 0;
- iopb->intl = (XD_STATE(iorq->mode) == XD_SUB_POLL)
- ? 0
- : iorq->xdc->ipl;
- ctrl->param_a = XDPA_TMOD | XDPA_DACF;
- ctrl->param_b = XDPB_ROR | XDPB_TDT_3_2USEC;
- ctrl->param_c = XDPC_OVS | XDPC_COP | XDPC_ASR |
- XDPC_RBC | XDPC_ECC2;
- ctrl->throttle = XDC_THROTTLE;
- ctrl->delay = XDC_DELAY_SPARC;
- break;
- }
- case XDFUN_DRV:{
- struct xd_iopb_drive *drv =
- (struct xd_iopb_drive *)iopb;
- /* we assume that the disk label has the right
- * info */
- if (XD_STATE(iorq->mode) == XD_SUB_POLL)
- drv->dparam_ipl = (XDC_DPARAM << 3);
- else
- drv->dparam_ipl = (XDC_DPARAM << 3) |
- iorq->xdc->ipl;
- drv->maxsect = iorq->xd->nsect - 1;
- drv->maxsector = drv->maxsect;
- /* note: maxsector != maxsect only if you are
- * doing cyl sparing */
- drv->headoff = 0;
- drv->maxcyl = iorq->xd->pcyl - 1;
- drv->maxhead = iorq->xd->nhead - 1;
- break;
- }
- case XDFUN_FMT:{
- struct xd_iopb_format *form =
- (struct xd_iopb_format *) iopb;
- if (XD_STATE(iorq->mode) == XD_SUB_POLL)
- form->interleave_ipl = (XDC_INTERLEAVE << 3);
- else
- form->interleave_ipl = (XDC_INTERLEAVE << 3) |
- iorq->xdc->ipl;
- form->field1 = XDFM_FIELD1;
- form->field2 = XDFM_FIELD2;
- form->field3 = XDFM_FIELD3;
- form->field4 = XDFM_FIELD4;
- form->bytespersec = XDFM_BPS;
- form->field6 = XDFM_FIELD6;
- form->field7 = XDFM_FIELD7;
- break;
- }
- }
- } else {
-
- /* normal IOPB case (harmless to RDP command) */
-
- iopb->lll = 0;
- iopb->intl = (XD_STATE(iorq->mode) == XD_SUB_POLL)
- ? 0
- : iorq->xdc->ipl;
- iopb->sectcnt = iorq->sectcnt;
- block = iorq->blockno;
- if (iorq->xd == NULL || block == 0) {
- iopb->sectno = iopb->headno = iopb->cylno = 0;
- } else {
- iopb->sectno = block % iorq->xd->nsect;
- block = block / iorq->xd->nsect;
- iopb->headno = block % iorq->xd->nhead;
- block = block / iorq->xd->nhead;
- iopb->cylno = block;
- }
- dp = (u_long) iorq->dbuf;
- dp = iopb->daddr = (iorq->dbuf == NULL) ? 0 : dp;
- iopb->addrmod = ((dp + (XDFM_BPS * iorq->sectcnt)) > 0x1000000)
- ? XDC_ADDRMOD32
- : XDC_ADDRMOD;
- }
-}
-
-/*
- * xdc_cmd: front end for POLL'd and WAIT'd commands. Returns rqno.
- * If you've already got an IORQ, you can call submit directly (currently
- * there is no need to do this). NORM requests are handled separately.
- */
-int
-xdc_cmd(xdcsc, cmd, subfn, unit, block, scnt, dptr, fullmode)
- struct xdc_softc *xdcsc;
- int cmd, subfn, unit, block, scnt;
- char *dptr;
- int fullmode;
-
-{
- int rqno, submode = XD_STATE(fullmode), retry;
- struct xd_iorq *iorq;
- struct xd_iopb *iopb;
-
- /* get iorq/iopb */
- switch (submode) {
- case XD_SUB_POLL:
- while (xdcsc->nfree == 0) {
- if (xdc_piodriver(xdcsc, 0, 1) != XD_ERR_AOK)
- return (XD_ERR_FAIL);
- }
- break;
- case XD_SUB_WAIT:
- retry = 1;
- while (retry) {
- while (xdcsc->nfree == 0) {
- if (tsleep(&xdcsc->nfree, PRIBIO, "xdnfree", 0))
- return (XD_ERR_FAIL);
- }
- while (xdcsc->ndone > XDC_SUBWAITLIM) {
- if (tsleep(&xdcsc->ndone, PRIBIO, "xdsubwait", 0))
- return (XD_ERR_FAIL);
- }
- if (xdcsc->nfree)
- retry = 0; /* got it */
- }
- break;
- default:
- return (XD_ERR_FAIL); /* illegal */
- }
- if (xdcsc->nfree == 0)
- panic("xdcmd nfree");
- rqno = XDC_RQALLOC(xdcsc);
- iorq = &xdcsc->reqs[rqno];
- iopb = iorq->iopb;
-
-
- /* init iorq/iopb */
-
- xdc_rqinit(iorq, xdcsc,
- (unit == XDC_NOUNIT) ? NULL : xdcsc->sc_drives[unit],
- fullmode, block, scnt, dptr, NULL);
-
- /* load IOPB from iorq */
-
- xdc_rqtopb(iorq, iopb, cmd, subfn);
-
- /* submit it for processing */
-
- xdc_submit_iorq(xdcsc, rqno, fullmode); /* error code will be in iorq */
-
- return (rqno);
-}
-/*
- * xdc_startbuf
- * start a buffer running, assumes nfree > 0
- */
-
-int
-xdc_startbuf(xdcsc, xdsc, bp)
- struct xdc_softc *xdcsc;
- struct xd_softc *xdsc;
- struct buf *bp;
-
-{
- int rqno, partno;
- struct xd_iorq *iorq;
- struct xd_iopb *iopb;
- struct buf *wq;
- u_long block;
- caddr_t dbuf;
-
- if (!xdcsc->nfree)
- panic("xdc_startbuf free");
- rqno = XDC_RQALLOC(xdcsc);
- iorq = &xdcsc->reqs[rqno];
- iopb = iorq->iopb;
-
- /* get buf */
-
- if (bp == NULL) {
- bp = xdcsc->sc_wq.b_actf;
- if (!bp)
- panic("xdc_startbuf bp");
- wq = bp->b_actf;
- if (wq)
- wq->b_actb = bp->b_actb;
- else
- xdcsc->sc_wq.b_actb = bp->b_actb;
- *bp->b_actb = wq;
- xdsc = xdcsc->sc_drives[DISKUNIT(bp->b_dev)];
- }
- partno = DISKPART(bp->b_dev);
-#ifdef XDC_DEBUG
- printf("xdc_startbuf: %s%c: %s block %d\n", xdsc->sc_dev.dv_xname,
- 'a' + partno, (bp->b_flags & B_READ) ? "read" : "write", bp->b_blkno);
- printf("xdc_startbuf: b_bcount %d, b_data 0x%x\n",
- bp->b_bcount, bp->b_data);
-#endif
-
- /*
- * load request. we have to calculate the correct block number based
- * on partition info.
- *
- * note that iorq points to the buffer as mapped into DVMA space,
- * where as the bp->b_data points to its non-DVMA mapping.
- */
-
- block = bp->b_blkno + ((partno == RAW_PART) ? 0 :
- xdsc->sc_dk.dk_label->d_partitions[partno].p_offset);
-
- dbuf = kdvma_mapin(bp->b_data, bp->b_bcount, 0);
- if (dbuf == NULL) { /* out of DVMA space */
- printf("%s: warning: out of DVMA space\n",
- xdcsc->sc_dev.dv_xname);
- XDC_FREE(xdcsc, rqno);
- wq = &xdcsc->sc_wq; /* put at end of queue */
- bp->b_actf = 0;
- bp->b_actb = wq->b_actb;
- *wq->b_actb = bp;
- wq->b_actb = &bp->b_actf;
- return (XD_ERR_FAIL); /* XXX: need some sort of
- * call-back scheme here? */
- }
-
-#if 0
- printf("xdc_startbuf: %s%c: %s block %d (%d)\n",
- xdsc->sc_dev.dv_xname,
- 'a' + partno, (bp->b_flags & B_READ) ? "read" : "write",
- bp->b_blkno, block);
-#endif
- /* init iorq and load iopb from it */
-
- xdc_rqinit(iorq, xdcsc, xdsc, XD_SUB_NORM | XD_MODE_VERBO, block,
- bp->b_bcount / XDFM_BPS, dbuf, bp);
-
- xdc_rqtopb(iorq, iopb, (bp->b_flags & B_READ) ? XDCMD_RD : XDCMD_WR, 0);
-
- /* Instrumentation. */
- disk_busy(&xdsc->sc_dk);
-
- /* now submit [note that xdc_submit_iorq can never fail on NORM reqs] */
-
- xdc_submit_iorq(xdcsc, rqno, XD_SUB_NORM);
- return (XD_ERR_AOK);
-}
-
-
-/*
- * xdc_submit_iorq: submit an iorq for processing. returns XD_ERR_AOK
- * if ok. if it fail returns an error code. type is XD_SUB_*.
- *
- * note: caller frees iorq in all cases except NORM
- *
- * return value:
- * NORM: XD_AOK (req pending), XD_FAIL (couldn't submit request)
- * WAIT: XD_AOK (success), <error-code> (failed)
- * POLL: <same as WAIT>
- * NOQ : <same as NORM>
- *
- * there are three sources for i/o requests:
- * [1] xdstrategy: normal block I/O, using "struct buf" system.
- * [2] autoconfig/crash dump: these are polled I/O requests, no interrupts.
- * [3] open/ioctl: these are I/O requests done in the context of a process,
- * and the process should block until they are done.
- *
- * software state is stored in the iorq structure. each iorq has an
- * iopb structure. the hardware understands the iopb structure.
- * every command must go through an iopb. a 7053 can only handle
- * XDC_MAXIOPB (31) active iopbs at one time. iopbs are allocated in
- * DVMA space at boot up time. what happens if we run out of iopb's?
- * for i/o type [1], the buffers are queued at the "buff" layer and
- * picked up later by the interrupt routine. for case [2] the
- * programmed i/o driver is called with a special flag that says
- * return when one iopb is free. for case [3] the process can sleep
- * on the iorq free list until some iopbs are avaliable.
- */
-
-
-int
-xdc_submit_iorq(xdcsc, iorqno, type)
- struct xdc_softc *xdcsc;
- int iorqno;
- int type;
-
-{
- u_long iopbaddr;
- struct xd_iorq *iorq = &xdcsc->reqs[iorqno];
-
-#ifdef XDC_DEBUG
- printf("xdc_submit_iorq(%s, no=%d, type=%d)\n", xdcsc->sc_dev.dv_xname,
- iorqno, type);
-#endif
-
- /* first check and see if controller is busy */
- if (xdcsc->xdc->xdc_csr & XDC_ADDING) {
-#ifdef XDC_DEBUG
- printf("xdc_submit_iorq: XDC not ready (ADDING)\n");
-#endif
- if (type == XD_SUB_NOQ)
- return (XD_ERR_FAIL); /* failed */
- XDC_TWAIT(xdcsc, iorqno); /* put at end of waitq */
- switch (type) {
- case XD_SUB_NORM:
- return XD_ERR_AOK; /* success */
- case XD_SUB_WAIT:
- while (iorq->iopb->done == 0) {
- sleep(iorq, PRIBIO);
- }
- return (iorq->errno);
- case XD_SUB_POLL:
- return (xdc_piodriver(xdcsc, iorqno, 0));
- default:
- panic("xdc_submit_iorq adding");
- }
- }
-#ifdef XDC_DEBUG
- {
- u_char *rio = (u_char *) iorq->iopb;
- int sz = sizeof(struct xd_iopb), lcv;
- printf("%s: aio #%d [",
- xdcsc->sc_dev.dv_xname, iorq - xdcsc->reqs);
- for (lcv = 0; lcv < sz; lcv++)
- printf(" %02x", rio[lcv]);
- printf("]\n");
- }
-#endif /* XDC_DEBUG */
-
- /* controller not busy, start command */
- iopbaddr = (u_long)xdcsc->dvmaiopb +
- ((u_long) iorq->iopb - (u_long)xdcsc->iopbase);
-
- XDC_GO(xdcsc->xdc, iopbaddr); /* go! */
- xdcsc->nrun++;
- /* command now running, wrap it up */
- switch (type) {
- case XD_SUB_NORM:
- case XD_SUB_NOQ:
- return (XD_ERR_AOK); /* success */
- case XD_SUB_WAIT:
- while (iorq->iopb->done == 0) {
- sleep(iorq, PRIBIO);
- }
- return (iorq->errno);
- case XD_SUB_POLL:
- return (xdc_piodriver(xdcsc, iorqno, 0));
- default:
- panic("xdc_submit_iorq wrap up");
- }
- panic("xdc_submit_iorq");
- return 0; /* not reached */
-}
-
-
-/*
- * xdc_piodriver
- *
- * programmed i/o driver. this function takes over the computer
- * and drains off all i/o requests. it returns the status of the iorq
- * the caller is interesting in. if freeone is true, then it returns
- * when there is a free iorq.
- */
-int
-xdc_piodriver(xdcsc, iorqno, freeone)
- struct xdc_softc *xdcsc;
- int iorqno;
- int freeone;
-
-{
- int nreset = 0;
- int retval = 0;
- u_long count;
- struct xdc *xdc = xdcsc->xdc;
-#ifdef XDC_DEBUG
- printf("xdc_piodriver(%s, %d, freeone=%d)\n", xdcsc->sc_dev.dv_xname,
- iorqno, freeone);
-#endif
-
- while (xdcsc->nwait || xdcsc->nrun) {
-#ifdef XDC_DEBUG
- printf("xdc_piodriver: wait=%d, run=%d\n",
- xdcsc->nwait, xdcsc->nrun);
-#endif
- XDC_WAIT(xdc, count, XDC_MAXTIME, (XDC_REMIOPB | XDC_F_ERROR));
-#ifdef XDC_DEBUG
- printf("xdc_piodriver: done wait with count = %d\n", count);
-#endif
- /* we expect some progress soon */
- if (count == 0 && nreset >= 2) {
- xdc_reset(xdcsc, 0, XD_RSET_ALL, XD_ERR_FAIL, 0);
-#ifdef XDC_DEBUG
- printf("xdc_piodriver: timeout\n");
-#endif
- return (XD_ERR_FAIL);
- }
- if (count == 0) {
- if (xdc_reset(xdcsc, 0,
- (nreset++ == 0) ? XD_RSET_NONE : iorqno,
- XD_ERR_FAIL,
- 0) == XD_ERR_FAIL)
- return (XD_ERR_FAIL); /* flushes all but POLL
- * requests, resets */
- continue;
- }
- xdc_remove_iorq(xdcsc); /* could resubmit request */
- if (freeone) {
- if (xdcsc->nrun < XDC_MAXIOPB) {
-#ifdef XDC_DEBUG
- printf("xdc_piodriver: done: one free\n");
-#endif
- return (XD_ERR_AOK);
- }
- continue; /* don't xdc_start */
- }
- xdc_start(xdcsc, XDC_MAXIOPB);
- }
-
- /* get return value */
-
- retval = xdcsc->reqs[iorqno].errno;
-
-#ifdef XDC_DEBUG
- printf("xdc_piodriver: done, retval = 0x%x (%s)\n",
- xdcsc->reqs[iorqno].errno, xdc_e2str(xdcsc->reqs[iorqno].errno));
-#endif
-
- /* now that we've drained everything, start up any bufs that have
- * queued */
-
- while (xdcsc->nfree > 0 && xdcsc->sc_wq.b_actf)
- if (xdc_startbuf(xdcsc, NULL, NULL) != XD_ERR_AOK)
- break;
-
- return (retval);
-}
-
-/*
- * xdc_reset: reset one drive. NOTE: assumes xdc was just reset.
- * we steal iopb[0] for this, but we put it back when we are done.
- */
-void
-xdc_xdreset(xdcsc, xdsc)
- struct xdc_softc *xdcsc;
- struct xd_softc *xdsc;
-
-{
- struct xd_iopb tmpiopb;
- u_long addr;
- int del;
- bcopy(xdcsc->iopbase, &tmpiopb, sizeof(tmpiopb));
- bzero(xdcsc->iopbase, sizeof(tmpiopb));
- xdcsc->iopbase->comm = XDCMD_RST;
- xdcsc->iopbase->unit = xdsc->xd_drive;
- addr = (u_long) xdcsc->dvmaiopb;
- XDC_GO(xdcsc->xdc, addr); /* go! */
- XDC_WAIT(xdcsc->xdc, del, XDC_RESETUSEC, XDC_REMIOPB);
- if (del <= 0 || xdcsc->iopbase->errs) {
- printf("%s: off-line: %s\n", xdcsc->sc_dev.dv_xname,
- xdc_e2str(xdcsc->iopbase->errno));
- xdcsc->xdc->xdc_csr = XDC_RESET;
- XDC_WAIT(xdcsc->xdc, del, XDC_RESETUSEC, XDC_RESET);
- if (del <= 0)
- panic("xdc_reset");
- } else {
- xdcsc->xdc->xdc_csr = XDC_CLRRIO; /* clear RIO */
- }
- bcopy(&tmpiopb, xdcsc->iopbase, sizeof(tmpiopb));
-}
-
-
-/*
- * xdc_reset: reset everything: requests are marked as errors except
- * a polled request (which is resubmitted)
- */
-int
-xdc_reset(xdcsc, quiet, blastmode, error, xdsc)
- struct xdc_softc *xdcsc;
- int quiet, blastmode, error;
- struct xd_softc *xdsc;
-
-{
- int del = 0, lcv, retval = XD_ERR_AOK;
- int oldfree = xdcsc->nfree;
-
- /* soft reset hardware */
-
- if (!quiet)
- printf("%s: soft reset\n", xdcsc->sc_dev.dv_xname);
- xdcsc->xdc->xdc_csr = XDC_RESET;
- XDC_WAIT(xdcsc->xdc, del, XDC_RESETUSEC, XDC_RESET);
- if (del <= 0) {
- blastmode = XD_RSET_ALL; /* dead, flush all requests */
- retval = XD_ERR_FAIL;
- }
- if (xdsc)
- xdc_xdreset(xdcsc, xdsc);
-
- /* fix queues based on "blast-mode" */
-
- for (lcv = 0; lcv < XDC_MAXIOPB; lcv++) {
- register struct xd_iorq *iorq = &xdcsc->reqs[lcv];
-
- if (XD_STATE(iorq->mode) != XD_SUB_POLL &&
- XD_STATE(iorq->mode) != XD_SUB_WAIT &&
- XD_STATE(iorq->mode) != XD_SUB_NORM)
- /* is it active? */
- continue;
-
- xdcsc->nrun--; /* it isn't running any more */
- if (blastmode == XD_RSET_ALL || blastmode != lcv) {
- /* failed */
- iorq->errno = error;
- xdcsc->iopbase[lcv].done = xdcsc->iopbase[lcv].errs = 1;
- switch (XD_STATE(xdcsc->reqs[lcv].mode)) {
- case XD_SUB_NORM:
- iorq->buf->b_error = EIO;
- iorq->buf->b_flags |= B_ERROR;
- iorq->buf->b_resid =
- iorq->sectcnt * XDFM_BPS;
- dvma_mapout(
- (vm_offset_t)iorq->dbufbase,
- (vm_offset_t)iorq->buf->b_un.b_addr,
- iorq->buf->b_bcount);
- disk_unbusy(&xdcsc->reqs[lcv].xd->sc_dk,
- (xdcsc->reqs[lcv].buf->b_bcount -
- xdcsc->reqs[lcv].buf->b_resid));
- biodone(iorq->buf);
- XDC_FREE(xdcsc, lcv); /* add to free list */
- break;
- case XD_SUB_WAIT:
- wakeup(iorq);
- case XD_SUB_POLL:
- xdcsc->ndone++;
- iorq->mode =
- XD_NEWSTATE(iorq->mode, XD_SUB_DONE);
- break;
- }
-
- } else {
-
- /* resubmit, put at front of wait queue */
- XDC_HWAIT(xdcsc, lcv);
- }
- }
-
- /*
- * now, if stuff is waiting, start it.
- * since we just reset it should go
- */
- xdc_start(xdcsc, XDC_MAXIOPB);
-
- /* ok, we did it */
- if (oldfree == 0 && xdcsc->nfree)
- wakeup(&xdcsc->nfree);
-
-#ifdef XDC_DIAG
- del = xdcsc->nwait + xdcsc->nrun + xdcsc->nfree + xdcsc->ndone;
- if (del != XDC_MAXIOPB)
- printf("%s: diag: xdc_reset miscount (%d should be %d)!\n",
- xdcsc->sc_dev.dv_xname, del, XDC_MAXIOPB);
- else
- if (xdcsc->ndone > XDC_MAXIOPB - XDC_SUBWAITLIM)
- printf("%s: diag: lots of done jobs (%d)\n",
- xdcsc->sc_dev.dv_xname, xdcsc->ndone);
-#endif
- printf("RESET DONE\n");
- return (retval);
-}
-/*
- * xdc_start: start all waiting buffers
- */
-
-void
-xdc_start(xdcsc, maxio)
- struct xdc_softc *xdcsc;
- int maxio;
-
-{
- int rqno;
- while (maxio && xdcsc->nwait &&
- (xdcsc->xdc->xdc_csr & XDC_ADDING) == 0) {
- XDC_GET_WAITER(xdcsc, rqno); /* note: rqno is an "out"
- * param */
- if (xdc_submit_iorq(xdcsc, rqno, XD_SUB_NOQ) != XD_ERR_AOK)
- panic("xdc_start"); /* should never happen */
- maxio--;
- }
-}
-/*
- * xdc_remove_iorq: remove "done" IOPB's.
- */
-
-int
-xdc_remove_iorq(xdcsc)
- struct xdc_softc *xdcsc;
-
-{
- int errno, rqno, comm, errs;
- struct xdc *xdc = xdcsc->xdc;
- struct xd_iopb *iopb;
- struct xd_iorq *iorq;
- struct buf *bp;
-
- if (xdc->xdc_csr & XDC_F_ERROR) {
- /*
- * FATAL ERROR: should never happen under normal use. This
- * error is so bad, you can't even tell which IOPB is bad, so
- * we dump them all.
- */
- errno = xdc->xdc_f_err;
- printf("%s: fatal error 0x%02x: %s\n", xdcsc->sc_dev.dv_xname,
- errno, xdc_e2str(errno));
- if (xdc_reset(xdcsc, 0, XD_RSET_ALL, errno, 0) != XD_ERR_AOK) {
- printf("%s: soft reset failed!\n",
- xdcsc->sc_dev.dv_xname);
- panic("xdc_remove_iorq: controller DEAD");
- }
- return (XD_ERR_AOK);
- }
-
- /*
- * get iopb that is done
- *
- * hmm... I used to read the address of the done IOPB off the VME
- * registers and calculate the rqno directly from that. that worked
- * until I started putting a load on the controller. when loaded, i
- * would get interrupts but neither the REMIOPB or F_ERROR bits would
- * be set, even after DELAY'ing a while! later on the timeout
- * routine would detect IOPBs that were marked "running" but their
- * "done" bit was set. rather than dealing directly with this
- * problem, it is just easier to look at all running IOPB's for the
- * done bit.
- */
- if (xdc->xdc_csr & XDC_REMIOPB) {
- xdc->xdc_csr = XDC_CLRRIO;
- }
-
- for (rqno = 0; rqno < XDC_MAXIOPB; rqno++) {
- iorq = &xdcsc->reqs[rqno];
- if (iorq->mode == 0 || XD_STATE(iorq->mode) == XD_SUB_DONE)
- continue; /* free, or done */
- iopb = &xdcsc->iopbase[rqno];
- if (iopb->done == 0)
- continue; /* not done yet */
-
-#ifdef XDC_DEBUG
- {
- u_char *rio = (u_char *) iopb;
- int sz = sizeof(struct xd_iopb), lcv;
- printf("%s: rio #%d [", xdcsc->sc_dev.dv_xname, rqno);
- for (lcv = 0; lcv < sz; lcv++)
- printf(" %02x", rio[lcv]);
- printf("]\n");
- }
-#endif /* XDC_DEBUG */
-
- xdcsc->nrun--;
-
- comm = iopb->comm;
- errs = iopb->errs;
-
- if (errs)
- iorq->errno = iopb->errno;
- else
- iorq->errno = 0;
-
- /* handle non-fatal errors */
-
- if (errs &&
- xdc_error(xdcsc, iorq, iopb, rqno, comm) == XD_ERR_AOK)
- continue; /* AOK: we resubmitted it */
-
-
- /* this iorq is now done (hasn't been restarted or anything) */
-
- if ((iorq->mode & XD_MODE_VERBO) && iorq->lasterror)
- xdc_perror(iorq, iopb, 0);
-
- /* now, if read/write check to make sure we got all the data
- * we needed. (this may not be the case if we got an error in
- * the middle of a multisector request). */
-
- if ((iorq->mode & XD_MODE_B144) != 0 && errs == 0 &&
- (comm == XDCMD_RD || comm == XDCMD_WR)) {
- /* we just successfully processed a bad144 sector
- * note: if we are in bad 144 mode, the pointers have
- * been advanced already (see above) and are pointing
- * at the bad144 sector. to exit bad144 mode, we
- * must advance the pointers 1 sector and issue a new
- * request if there are still sectors left to process
- *
- */
- XDC_ADVANCE(iorq, 1); /* advance 1 sector */
-
- /* exit b144 mode */
- iorq->mode = iorq->mode & (~XD_MODE_B144);
-
- if (iorq->sectcnt) { /* more to go! */
- iorq->lasterror = iorq->errno = iopb->errno = 0;
- iopb->errs = iopb->done = 0;
- iorq->tries = 0;
- iopb->sectcnt = iorq->sectcnt;
- iopb->cylno = iorq->blockno /
- iorq->xd->sectpercyl;
- iopb->headno =
- (iorq->blockno / iorq->xd->nsect) %
- iorq->xd->nhead;
- iopb->sectno = iorq->blockno % iorq->xd->nsect;
- iopb->daddr = (u_long) iorq->dbuf;
- XDC_HWAIT(xdcsc, rqno);
- xdc_start(xdcsc, 1); /* resubmit */
- continue;
- }
- }
- /* final cleanup, totally done with this request */
-
- switch (XD_STATE(iorq->mode)) {
- case XD_SUB_NORM:
- bp = iorq->buf;
- if (errs) {
- bp->b_error = EIO;
- bp->b_flags |= B_ERROR;
- bp->b_resid = iorq->sectcnt * XDFM_BPS;
- } else {
- bp->b_resid = 0; /* done */
- }
- dvma_mapout((vm_offset_t) iorq->dbufbase,
- (vm_offset_t) bp->b_un.b_addr,
- bp->b_bcount);
- disk_unbusy(&iorq->xd->sc_dk,
- (bp->b_bcount - bp->b_resid));
- XDC_FREE(xdcsc, rqno);
- biodone(bp);
- break;
- case XD_SUB_WAIT:
- iorq->mode = XD_NEWSTATE(iorq->mode, XD_SUB_DONE);
- xdcsc->ndone++;
- wakeup(iorq);
- break;
- case XD_SUB_POLL:
- iorq->mode = XD_NEWSTATE(iorq->mode, XD_SUB_DONE);
- xdcsc->ndone++;
- break;
- }
- }
-
- return (XD_ERR_AOK);
-}
-
-/*
- * xdc_perror: print error.
- * - if still_trying is true: we got an error, retried and got a
- * different error. in that case lasterror is the old error,
- * and errno is the new one.
- * - if still_trying is not true, then if we ever had an error it
- * is in lasterror. also, if iorq->errno == 0, then we recovered
- * from that error (otherwise iorq->errno == iorq->lasterror).
- */
-void
-xdc_perror(iorq, iopb, still_trying)
- struct xd_iorq *iorq;
- struct xd_iopb *iopb;
- int still_trying;
-
-{
-
- int error = iorq->lasterror;
-
- printf("%s", (iorq->xd) ? iorq->xd->sc_dev.dv_xname
- : iorq->xdc->sc_dev.dv_xname);
- if (iorq->buf)
- printf("%c: ", 'a' + DISKPART(iorq->buf->b_dev));
- if (iopb->comm == XDCMD_RD || iopb->comm == XDCMD_WR)
- printf("%s %d/%d/%d: ",
- (iopb->comm == XDCMD_RD) ? "read" : "write",
- iopb->cylno, iopb->headno, iopb->sectno);
- printf("%s", xdc_e2str(error));
-
- if (still_trying)
- printf(" [still trying, new error=%s]", xdc_e2str(iorq->errno));
- else
- if (iorq->errno == 0)
- printf(" [recovered in %d tries]", iorq->tries);
-
- printf("\n");
-}
-
-/*
- * xdc_error: non-fatal error encountered... recover.
- * return AOK if resubmitted, return FAIL if this iopb is done
- */
-int
-xdc_error(xdcsc, iorq, iopb, rqno, comm)
- struct xdc_softc *xdcsc;
- struct xd_iorq *iorq;
- struct xd_iopb *iopb;
- int rqno, comm;
-
-{
- int errno = iorq->errno;
- int erract = errno & XD_ERA_MASK;
- int oldmode, advance, i;
-
- if (erract == XD_ERA_RSET) { /* some errors require a reset */
- oldmode = iorq->mode;
- iorq->mode = XD_SUB_DONE | (~XD_SUB_MASK & oldmode);
- xdcsc->ndone++;
- /* make xdc_start ignore us */
- xdc_reset(xdcsc, 1, XD_RSET_NONE, errno, iorq->xd);
- iorq->mode = oldmode;
- xdcsc->ndone--;
- }
- /* check for read/write to a sector in bad144 table if bad: redirect
- * request to bad144 area */
-
- if ((comm == XDCMD_RD || comm == XDCMD_WR) &&
- (iorq->mode & XD_MODE_B144) == 0) {
- advance = iorq->sectcnt - iopb->sectcnt;
- XDC_ADVANCE(iorq, advance);
- if ((i = isbad(&iorq->xd->dkb,
- iorq->blockno / iorq->xd->sectpercyl,
- (iorq->blockno / iorq->xd->nsect) % iorq->xd->nhead,
- iorq->blockno % iorq->xd->nsect)) != -1) {
- iorq->mode |= XD_MODE_B144; /* enter bad144 mode &
- * redirect */
- iopb->errno = iopb->done = iopb->errs = 0;
- iopb->sectcnt = 1;
- /* From original dkbad.h:
- Replacement sectors are allocated starting with
- the first sector before the bad sector information
- and working backward towards the beginning of the
- disk. */
- /* Last cylinder. */
- iopb->cylno = (iorq->xd->ncyl + iorq->xd->acyl) - 1;
- /* Last track. */
- i = iorq->xd->sectpercyl - iorq->xd->nsect - (i + 1);
- iopb->headno = i / iorq->xd->nsect;
- iopb->sectno = i % iorq->xd->nsect;
- XDC_HWAIT(xdcsc, rqno);
- xdc_start(xdcsc, 1); /* resubmit */
- return (XD_ERR_AOK); /* recovered! */
- }
- }
-
- /*
- * it isn't a bad144 sector, must be real error! see if we can retry
- * it?
- */
- if ((iorq->mode & XD_MODE_VERBO) && iorq->lasterror)
- xdc_perror(iorq, iopb, 1); /* inform of error state
- * change */
- iorq->lasterror = errno;
-
- if ((erract == XD_ERA_RSET || erract == XD_ERA_HARD)
- && iorq->tries < XDC_MAXTRIES) { /* retry? */
- iorq->tries++;
- iorq->errno = iopb->errno = iopb->done = iopb->errs = 0;
- XDC_HWAIT(xdcsc, rqno);
- xdc_start(xdcsc, 1); /* restart */
- return (XD_ERR_AOK); /* recovered! */
- }
-
- /* failed to recover from this error */
- return (XD_ERR_FAIL);
-}
-
-/*
- * xdc_tick: make sure xd is still alive and ticking (err, kicking).
- */
-void
-xdc_tick(arg)
- void *arg;
-
-{
- struct xdc_softc *xdcsc = arg;
- int lcv, s, reset = 0;
-#ifdef XDC_DIAG
- int wait, run, free, done, whd = 0;
- u_char fqc[XDC_MAXIOPB], wqc[XDC_MAXIOPB], mark[XDC_MAXIOPB];
- s = splbio();
- wait = xdcsc->nwait;
- run = xdcsc->nrun;
- free = xdcsc->nfree;
- done = xdcsc->ndone;
- bcopy(xdcsc->waitq, wqc, sizeof(wqc));
- bcopy(xdcsc->freereq, fqc, sizeof(fqc));
- splx(s);
- if (wait + run + free + done != XDC_MAXIOPB) {
- printf("%s: diag: IOPB miscount (got w/f/r/d %d/%d/%d/%d, wanted %d)\n",
- xdcsc->sc_dev.dv_xname, wait, free, run, done, XDC_MAXIOPB);
- bzero(mark, sizeof(mark));
- printf("FREE: ");
- for (lcv = free; lcv > 0; lcv--) {
- printf("%d ", fqc[lcv - 1]);
- mark[fqc[lcv - 1]] = 1;
- }
- printf("\nWAIT: ");
- lcv = wait;
- while (lcv > 0) {
- printf("%d ", wqc[whd]);
- mark[wqc[whd]] = 1;
- whd = (whd + 1) % XDC_MAXIOPB;
- lcv--;
- }
- printf("\n");
- for (lcv = 0; lcv < XDC_MAXIOPB; lcv++) {
- if (mark[lcv] == 0)
- printf("MARK: running %d: mode %d done %d errs %d errno 0x%x ttl %d buf %p\n",
- lcv, xdcsc->reqs[lcv].mode,
- xdcsc->iopbase[lcv].done,
- xdcsc->iopbase[lcv].errs,
- xdcsc->iopbase[lcv].errno,
- xdcsc->reqs[lcv].ttl, xdcsc->reqs[lcv].buf);
- }
- } else
- if (done > XDC_MAXIOPB - XDC_SUBWAITLIM)
- printf("%s: diag: lots of done jobs (%d)\n",
- xdcsc->sc_dev.dv_xname, done);
-
-#endif
-#ifdef XDC_DEBUG
- printf("%s: tick: csr 0x%x, w/f/r/d %d/%d/%d/%d\n",
- xdcsc->sc_dev.dv_xname,
- xdcsc->xdc->xdc_csr, xdcsc->nwait, xdcsc->nfree, xdcsc->nrun,
- xdcsc->ndone);
- for (lcv = 0; lcv < XDC_MAXIOPB; lcv++) {
- if (xdcsc->reqs[lcv].mode)
- printf("running %d: mode %d done %d errs %d errno 0x%x\n",
- lcv,
- xdcsc->reqs[lcv].mode, xdcsc->iopbase[lcv].done,
- xdcsc->iopbase[lcv].errs, xdcsc->iopbase[lcv].errno);
- }
-#endif
-
- /* reduce ttl for each request if one goes to zero, reset xdc */
- s = splbio();
- for (lcv = 0; lcv < XDC_MAXIOPB; lcv++) {
- if (xdcsc->reqs[lcv].mode == 0 ||
- XD_STATE(xdcsc->reqs[lcv].mode) == XD_SUB_DONE)
- continue;
- xdcsc->reqs[lcv].ttl--;
- if (xdcsc->reqs[lcv].ttl == 0)
- reset = 1;
- }
- if (reset) {
- printf("%s: watchdog timeout\n", xdcsc->sc_dev.dv_xname);
- xdc_reset(xdcsc, 0, XD_RSET_NONE, XD_ERR_FAIL, NULL);
- }
- splx(s);
-
- /* until next time */
-
- timeout(xdc_tick, xdcsc, XDC_TICKCNT);
-}
-
-/*
- * xdc_ioctlcmd: this function provides a user level interface to the
- * controller via ioctl. this allows "format" programs to be written
- * in user code, and is also useful for some debugging. we return
- * an error code. called at user priority.
- */
-int
-xdc_ioctlcmd(xd, dev, xio)
- struct xd_softc *xd;
- dev_t dev;
- struct xd_iocmd *xio;
-
-{
- int s, err, rqno, dummy;
- caddr_t dvmabuf = NULL, buf = NULL;
- struct xdc_softc *xdcsc;
-
- /* check sanity of requested command */
-
- switch (xio->cmd) {
-
- case XDCMD_NOP: /* no op: everything should be zero */
- if (xio->subfn || xio->dptr || xio->dlen ||
- xio->block || xio->sectcnt)
- return (EINVAL);
- break;
-
- case XDCMD_RD: /* read / write sectors (up to XD_IOCMD_MAXS) */
- case XDCMD_WR:
- if (xio->subfn || xio->sectcnt > XD_IOCMD_MAXS ||
- xio->sectcnt * XDFM_BPS != xio->dlen || xio->dptr == NULL)
- return (EINVAL);
- break;
-
- case XDCMD_SK: /* seek: doesn't seem useful to export this */
- return (EINVAL);
-
- case XDCMD_WRP: /* write parameters */
- return (EINVAL);/* not useful, except maybe drive
- * parameters... but drive parameters should
- * go via disklabel changes */
-
- case XDCMD_RDP: /* read parameters */
- if (xio->subfn != XDFUN_DRV ||
- xio->dlen || xio->block || xio->dptr)
- return (EINVAL); /* allow read drive params to
- * get hw_spt */
- xio->sectcnt = xd->hw_spt; /* we already know the answer */
- return (0);
- break;
-
- case XDCMD_XRD: /* extended read/write */
- case XDCMD_XWR:
-
- switch (xio->subfn) {
-
- case XDFUN_THD:/* track headers */
- if (xio->sectcnt != xd->hw_spt ||
- (xio->block % xd->nsect) != 0 ||
- xio->dlen != XD_IOCMD_HSZ * xd->hw_spt ||
- xio->dptr == NULL)
- return (EINVAL);
- xio->sectcnt = 0;
- break;
-
- case XDFUN_FMT:/* NOTE: also XDFUN_VFY */
- if (xio->cmd == XDCMD_XRD)
- return (EINVAL); /* no XDFUN_VFY */
- if (xio->sectcnt || xio->dlen ||
- (xio->block % xd->nsect) != 0 || xio->dptr)
- return (EINVAL);
- break;
-
- case XDFUN_HDR:/* header, header verify, data, data ECC */
- return (EINVAL); /* not yet */
-
- case XDFUN_DM: /* defect map */
- case XDFUN_DMX:/* defect map (alternate location) */
- if (xio->sectcnt || xio->dlen != XD_IOCMD_DMSZ ||
- (xio->block % xd->nsect) != 0 || xio->dptr == NULL)
- return (EINVAL);
- break;
-
- default:
- return (EINVAL);
- }
- break;
-
- case XDCMD_TST: /* diagnostics */
- return (EINVAL);
-
- default:
- return (EINVAL);/* ??? */
- }
-
- /* create DVMA buffer for request if needed */
-
- if (xio->dlen) {
- dvmabuf = dvma_malloc(xio->dlen, &buf, M_WAITOK);
- if (xio->cmd == XDCMD_WR || xio->cmd == XDCMD_XWR) {
- if ((err = copyin(xio->dptr, buf, xio->dlen)) != 0) {
- dvma_free(dvmabuf, xio->dlen, &buf);
- return (err);
- }
- }
- }
- /* do it! */
-
- err = 0;
- xdcsc = xd->parent;
- s = splbio();
- rqno = xdc_cmd(xdcsc, xio->cmd, xio->subfn, xd->xd_drive, xio->block,
- xio->sectcnt, dvmabuf, XD_SUB_WAIT);
- if (rqno == XD_ERR_FAIL) {
- err = EIO;
- goto done;
- }
- xio->errno = xdcsc->reqs[rqno].errno;
- xio->tries = xdcsc->reqs[rqno].tries;
- XDC_DONE(xdcsc, rqno, dummy);
-
- if (xio->cmd == XDCMD_RD || xio->cmd == XDCMD_XRD)
- err = copyout(buf, xio->dptr, xio->dlen);
-
-done:
- splx(s);
- if (dvmabuf)
- dvma_free(dvmabuf, xio->dlen, &buf);
- return (err);
-}
-
-/*
- * xdc_e2str: convert error code number into an error string
- */
-char *
-xdc_e2str(no)
- int no;
-{
- switch (no) {
- case XD_ERR_FAIL:
- return ("Software fatal error");
- case XD_ERR_AOK:
- return ("Successful completion");
- case XD_ERR_ICYL:
- return ("Illegal cylinder address");
- case XD_ERR_IHD:
- return ("Illegal head address");
- case XD_ERR_ISEC:
- return ("Illgal sector address");
- case XD_ERR_CZER:
- return ("Count zero");
- case XD_ERR_UIMP:
- return ("Unimplemented command");
- case XD_ERR_IF1:
- return ("Illegal field length 1");
- case XD_ERR_IF2:
- return ("Illegal field length 2");
- case XD_ERR_IF3:
- return ("Illegal field length 3");
- case XD_ERR_IF4:
- return ("Illegal field length 4");
- case XD_ERR_IF5:
- return ("Illegal field length 5");
- case XD_ERR_IF6:
- return ("Illegal field length 6");
- case XD_ERR_IF7:
- return ("Illegal field length 7");
- case XD_ERR_ISG:
- return ("Illegal scatter/gather length");
- case XD_ERR_ISPT:
- return ("Not enough sectors per track");
- case XD_ERR_ALGN:
- return ("Next IOPB address alignment error");
- case XD_ERR_SGAL:
- return ("Scatter/gather address alignment error");
- case XD_ERR_SGEC:
- return ("Scatter/gather with auto-ECC");
- case XD_ERR_SECC:
- return ("Soft ECC corrected");
- case XD_ERR_SIGN:
- return ("ECC ignored");
- case XD_ERR_ASEK:
- return ("Auto-seek retry recovered");
- case XD_ERR_RTRY:
- return ("Soft retry recovered");
- case XD_ERR_HECC:
- return ("Hard data ECC");
- case XD_ERR_NHDR:
- return ("Header not found");
- case XD_ERR_NRDY:
- return ("Drive not ready");
- case XD_ERR_TOUT:
- return ("Operation timeout");
- case XD_ERR_VTIM:
- return ("VMEDMA timeout");
- case XD_ERR_DSEQ:
- return ("Disk sequencer error");
- case XD_ERR_HDEC:
- return ("Header ECC error");
- case XD_ERR_RVFY:
- return ("Read verify");
- case XD_ERR_VFER:
- return ("Fatail VMEDMA error");
- case XD_ERR_VBUS:
- return ("VMEbus error");
- case XD_ERR_DFLT:
- return ("Drive faulted");
- case XD_ERR_HECY:
- return ("Header error/cyliner");
- case XD_ERR_HEHD:
- return ("Header error/head");
- case XD_ERR_NOCY:
- return ("Drive not on-cylinder");
- case XD_ERR_SEEK:
- return ("Seek error");
- case XD_ERR_ILSS:
- return ("Illegal sector size");
- case XD_ERR_SEC:
- return ("Soft ECC");
- case XD_ERR_WPER:
- return ("Write-protect error");
- case XD_ERR_IRAM:
- return ("IRAM self test failure");
- case XD_ERR_MT3:
- return ("Maintenance test 3 failure (DSKCEL RAM)");
- case XD_ERR_MT4:
- return ("Maintenance test 4 failure (header shift reg)");
- case XD_ERR_MT5:
- return ("Maintenance test 5 failure (VMEDMA regs)");
- case XD_ERR_MT6:
- return ("Maintenance test 6 failure (REGCEL chip)");
- case XD_ERR_MT7:
- return ("Maintenance test 7 failure (buffer parity)");
- case XD_ERR_MT8:
- return ("Maintenance test 8 failure (disk FIFO)");
- case XD_ERR_IOCK:
- return ("IOPB checksum miscompare");
- case XD_ERR_IODM:
- return ("IOPB DMA fatal");
- case XD_ERR_IOAL:
- return ("IOPB address alignment error");
- case XD_ERR_FIRM:
- return ("Firmware error");
- case XD_ERR_MMOD:
- return ("Illegal maintenance mode test number");
- case XD_ERR_ACFL:
- return ("ACFAIL asserted");
- default:
- return ("Unknown error");
- }
-}
diff --git a/sys/arch/kbus/dev/xdreg.h b/sys/arch/kbus/dev/xdreg.h
deleted file mode 100644
index c723d018d0d..00000000000
--- a/sys/arch/kbus/dev/xdreg.h
+++ /dev/null
@@ -1,424 +0,0 @@
-/* $NetBSD: xdreg.h,v 1.3 1996/03/31 22:38:54 pk Exp $ */
-
-/*
- *
- * Copyright (c) 1995 Charles D. Cranor
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles D. Cranor.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * x d r e g . h
- *
- * this file contains the description of the Xylogics 753/7053's hardware
- * data structures.
- *
- * author: Chuck Cranor <chuck@ccrc.wustl.edu>
- */
-
-#define XDC_MAXDEV 4 /* max devices per controller */
-#define XDC_RESETUSEC 1000000 /* max time for xdc reset (page 21 says 1sec) */
-#define XDC_MAXIOPB 31 /* max number of iopbs that can be active */
-#define XDC_MAXTIME 4*1000000 /* four seconds before we give up and reset */
-#define XDC_MAXTRIES 4 /* max number of times to retry an operation */
-#define XDC_THROTTLE 32 /* dma throttle */
-#define XDC_INTERLEAVE 0 /* interleave (for format param) */
-#define XDC_DPARAM 0 /* dparam (drive param) XDDP_EC32 or 0 */
-
-/*
- * xdc device interface
- * (lives in VME address space)
- */
-
-struct xdc {
- volatile u_char filler0;
- volatile u_char xdc_iopbaddr0; /* iopb byte 0 (LSB) */
- volatile u_char filler1;
- volatile u_char xdc_iopbaddr1; /* iopb byte 1 */
- volatile u_char filler2;
- volatile u_char xdc_iopbaddr2; /* iopb byte 2 */
- volatile u_char filler3;
- volatile u_char xdc_iopbaddr3; /* iopb byte 3 (MSB) */
- volatile u_char filler4;
- volatile u_char xdc_iopbamod; /* iopb address modifier */
- volatile u_char filler5;
- volatile u_char xdc_csr; /* control and status register */
- volatile u_char filler6;
- volatile u_char xdc_f_err; /* fatal error register */
-};
-
-/*
- * xdc_iopbamod: addressing modes
- * When doing DMA, if the maximum address of the buffer is greater than
- * 24 bits then you must use the 32 bit mode. Note that on many systems
- * (e.g. sun-4/300) DVMA space is smaller than 24 bits, so there is no
- * need for the 32 bit mode. However, the 32-bit mode hooks are in
- * the driver in case it ever gets ported to an environment that needs it.
- */
-
-#define XDC_ADDRMOD 0x3d /* standard address modifer, 24 bit max */
-#define XDC_ADDRMOD32 0x0d /* 32 bit version above */
-
-/*
- * xdc_csr
- */
-
-#define XDC_RMAINTMD 0x80 /* reserved maintenance mode (write) */
-#define XDC_BUSY 0x80 /* busy (read) */
-#define XDC_F_ERROR 0x40 /* fatal error (read) */
-#define XDC_MAINTMOD 0x20 /* maintenance mode (read/write) */
-#define XDC_RESET 0x08 /* soft reset (read/write) */
-#define XDC_ADDIOPB 0x04 /* add iopb/add pending (write) */
-#define XDC_ADDING 0x04 /* iopb add is pending (read) */
-#define XDC_CLRRIO 0x02 /* clear RIO (remove iopb) request (write) */
-#define XDC_REMIOPB 0x02 /* remove iopb (read) */
-#define XDC_RBUSYSEM 0x01 /* register busy semaphore (read/write) */
-
-/*
- * Input/Output Parameter Block (iopb)
- *
- * all controller commands are done via iopb's. to start a command you
- * must do this:
- * [1] allocate space in DVMA space for the iopb
- * [2] fill out all the fields of the iopb
- * [3] check to see if controller can accept an iopb (XDC_ADDING bit clear)
- * [4] put the DVMA address of the iopb in the xdc registers (in vme space)
- * [5] set the XDC_ADDIOPB bit in the xdc csr
- * [6] <command started>
- *
- * when the controller is done with a command it may interrupt (if you
- * ask it to) and it will set the XDC_REMIOPB bit in the csr. the address
- * of the finished iopb will be in the xdc registers. after that is
- * read, set the XDC_CLRRIO to clear the iopb out of memory.
- *
- * the format of the iopb is described in section 4 of the manual.
- */
-
-struct xd_iopb {
- /* section 4.1.1: byte 0 */
- volatile u_char errs:1; /* error summary bit, only valid if
- "done" is set. must clear "done"
- and "errs" bits before starting an
- operation */
- volatile u_char done:1; /* "done" bit */
- volatile u_char chen:1; /* chain enable, "next iopb" is valid,
- note xd returns one iopb at a time */
- volatile u_char sgm:1; /* scatter/gather mode */
- volatile u_char comm:4; /* command number (see table 4-2) */
-#define XDCMD_NOP 0x0 /* no-op */
-#define XDCMD_WR 0x1 /* write */
-#define XDCMD_RD 0x2 /* read */
-#define XDCMD_SK 0x3 /* seek */
-#define XDCMD_RST 0x4 /* drive reset */
-#define XDCMD_WRP 0x5 /* write params */
-#define XDCMD_RDP 0x6 /* read params */
-#define XDCMD_XWR 0x7 /* extended write */
-#define XDCMD_XRD 0x8 /* extended read */
-#define XDCMD_TST 0x9 /* diagnostic tests */
- /* 0xa to 0xf are reserved */
- /* section 4.1.2: byte 1 */
- volatile u_char errno; /* status byte 1 (non-zero if error) */
- /* section 4.1.3: byte 2 */
- volatile u_char status; /* status byte 2 (see below) */
-#define XDST_SR 0x40 /* slipped revolution */
-#define XDST_CSE 0x20 /* count sectors executed */
-#define XDST_WRPT 0x10 /* write protected drive */
-#define XDST_DFLT 0x08 /* disk fault */
-#define XDST_SKER 0x04 /* seek error: >max, or timeout */
-#define XDST_ONCL 0x02 /* on-cylinder */
-#define XDST_DRDY 0x01 /* drive is ready! */
- /* section 4.1.4: byte 3 */
- volatile u_char istat; /* internal status: reserved for xylogics */
- /* section 4.1.5: byte 4 */
- volatile u_char subfun; /* sub-function of command (see below) */
-#define XDFUN_R 0x00 /* XDCMD_SK: report current addr */
-#define XDFUN_SR 0x01 /* XDCMD_SK: seek and report addr */
-#define XDFUN_SRI 0x02 /* XDCMD_SK: start seek, report comp imm */
-#define XDFUN_CTL 0x00 /* XDCMD_{WRP,RDP}: controller params */
-#define XDFUN_DRV 0x80 /* XDCMD_{WRP,RDP}: drive params */
-#define XDFUN_FMT 0x81 /* XDCMD_{WRP,RDP}: format params,XWR form.*/
-#define XDFUN_STX 0xa0 /* XDCMD_RDP: read drive status extended */
-#define XDFUN_THD 0x80 /* XDCMD_{XWR,XRD}: track headers */
-#define XDFUN_VFY 0x81 /* XDCMD_XRD: verify data */
-#define XDFUN_HDR 0x82 /* XDCMD_{XWR,XRD}: header, verify,data, ecc*/
-#define XDFUN_DM 0xa0 /* XDCMD_{XWR,XRD}: defect map */
-#define XDFUN_DMX 0xa1 /* XDCMD_{XWR,XRD}: defect map extended */
- /* section 4.1.6: byte 5 */
- volatile u_char fixd:1; /* fixed media (vs removeable) */
- volatile u_char reserved1:4; /* reserved */
- volatile u_char unit:3; /* unit number */
- /* note: 6 to 13 are overloaded (see below) */
- /* section 4.1.7: byte 6 */
- volatile u_char lll:5; /* linked list length */
- volatile u_char intl:3; /* interrupt level */
- /* section 4.1.8: byte 7 */
- volatile u_char intr_vec; /* interrupt vector */
- /* section 4.1.9: bytes 8 and 9 */
- volatile u_short sectcnt; /* sector count (# to xfer) */
- /* section 4.1.10: byte a and b */
- volatile u_short cylno; /* cylinder number */
- /* section 4.1.11: byte c */
- volatile u_char headno; /* head number */
- /* section 4.1.12: byte d */
- volatile u_char sectno; /* sector number */
- /* section 4.1.13: byte e */
- volatile u_char addrmod; /* addr modifier (bits 7,6 must be zero) */
- /* section 4.1.14: byte f */
- volatile u_char naddrmod; /* next (in chain) address iobp ad. modifer */
- /* section 4.1.15: bytes 0x10 to 0x13 */
- volatile u_long daddr; /* DMA data address */
- /* section 4.1.16: bytes 0x14 to 0x17 */
- volatile u_long nextiopb; /* next iopb (in chain) address */
- /* section 4.1.17: bytes 0x18, 0x19 */
- volatile u_short cksum; /* iopb checksum */
- /* section 4.1.18: bytes 0x1a, 0x1b */
- volatile u_short eccpattern; /* ECC pattern word (ecc mode 0) */
- /* section 4.1.19: bytes 0x1c, 0x1d */
- volatile u_short eccoffword; /* ECC offset word (ecc mode 0) */
-};
-
-/*
- * some commands overload bytes 6 to 0x13 of the iopb with different meanings.
- * these commands include:
- * section 4.2: controller parameters
- * section 4.3: drive parameters
- * sectino 4.4: format parameters
- *
- * note that the commands that overload the iopb are not part of the
- * "critical data path" of the driver. so, we handle them by defining
- * alternate iopb structures for these commands... it only costs us an
- * extra pointer.
- */
-
-/*
- * controller parameters iopb: redefines bytes: 8 -> 0xe, 0x10 -> 0x13
- */
-
-struct xd_iopb_ctrl {
- volatile u_char same[8]; /* same as xd_iopb */
- /* section 4.2.1: byte 8 */
- volatile u_char param_a; /* param A (see below) */
-#define XDPA_AUD 0x80 /* auto-update iopb fields when cmd done */
-#define XDPA_TMOD 0x40 /* long-word transfer mode (vs word) */
-#define XDPA_DACF 0x20 /* ignore vme ACFAIL signal */
-#define XDPA_ICS 0x10 /* checksum check (adds 100usec per xfer) */
-#define XDPA_EDT 0x08 /* enable on-board DMA timeout timer */
-#define XDPA_NPRM 0x04 /* enable VME non-priv request mode */
- /* rest must be zero */
- /* section 4.2.2: byte 9 */
- volatile u_char param_b; /* param B (see below) */
-#define XDPB_TDT 0xc0 /* throttle dead time (see 8.11, below) */
-#define XDPB_ROR 0x10 /* release on request */
-#define XDPB_DRA 0x01 /* disable read ahead */
- /* TDT values: */
-#define XDPB_TDT_0USEC 0x00 /* no TDT */
-#define XDPB_TDT_3_2USEC 0x40 /* 3.2 usec */
-#define XDPB_TDT_6_4USEC 0x80 /* 6.4 usec */
-#define XDPB_TDT_12_8USEC 0xc0 /* 12.8 usec */
- /* section 4.2.3: byte a */
- volatile u_char param_c; /* param C (see below) */
-#define XDPC_OVS 0x80 /* over-lapped seek */
-#define XDPC_COP 0x40 /* command optimiziation (elevator alg.) */
-#define XDPC_ASR 0x10 /* auto-seek retry */
-#define XDPC_RBC 0x04 /* retry before correction if ECC error */
-#define XDPC_ECCM 0x03 /* ECC mode (0, 1, and 2) */
-#define XDPC_ECC0 0x00 /* ECC mode 0 */
-#define XDPC_ECC1 0x01 /* ECC mode 1 */
-#define XDPC_ECC2 0x02 /* ECC mode 2 */
- /* section 4.2.4: byte b */
- volatile u_char throttle; /* max dma xfers per master (0==256) */
- /* section 4.2.5: byte c */
- volatile u_char eprom_lvl; /* EPROM release level */
- volatile u_char delay; /* delay (see note below) */
- /* section 4.2.6: byte e */
- volatile u_char ctype; /* controller type */
-#define XDCT_753 0x53 /* xylogic 753/7053 */
- volatile u_char same2; /* byte f: same as xd_iopb */
- /* section 4.2.7: byte 0x10, 0x11 */
- volatile u_short eprom_partno; /* eprom part number */
- /* section 4.2.8: byte 12 */
- volatile u_char eprom_rev; /* eprom revision number */
-};
-
-/*
- * Note on byte 0xd ("delay"): This byte is not documented in the
- * Xylogics manual. However, I contacted Xylogics and found out what
- * it does. The controller sorts read commands into groups of
- * contiguous sectors. After it processes a group of contiguous
- * sectors rather than immediately going on to the next group of
- * contiguous sectors, the controller can delay for a certain amount
- * of time in hopes of getting another cluster of reads in the same
- * area of the disk (thus avoiding a long seek). Byte 0xd controls
- * how long it waits before giving up and going on and doing the next
- * contiguous cluster.
- *
- * it is unclear what unit the delay is in, but it looks like sun
- * uses the value "20" for sun3's, and "0" for sparc, except for the
- * 4/300 (where it is "4"). [see /sys/sundev/xd_conf.c on any 4.1.3
- * machine for how sun configures its controller...]
- */
-
-#define XDC_DELAY_SUN3 20
-#define XDC_DELAY_4_300 4
-#define XDC_DELAY_SPARC 0
-
-/*
- * drive parameters iopb: redefines bytes: 6, 8, 9, a, b, c, d, e
- */
-
-struct xd_iopb_drive {
- volatile u_char same[6]; /* same as xd_iopb */
- /* section 4.3.1: byte 6 */
- volatile u_char dparam_ipl; /* drive params | interrupt level */
-#define XDDP_EC32 0x10 /* 32 bit ECC mode */
- volatile u_char same1; /* byte 7: same */
- /* section 4.3.2: byte 8 */
- volatile u_char maxsect; /* max sector/last head (<= byte d) */
- /* section 4.3.3: byte 9 */
- volatile u_char headoff; /* head offset */
- /* section 4.3.4: bytes 0xa, 0xb */
- volatile u_short maxcyl; /* max cyl (zero based!) */
- /* section 4.3.5: byte 0xc */
- volatile u_char maxhead; /* max head (zero based!) */
- /* section 4.3.6: byte 0xd */
- volatile u_char maxsector; /* max sector of disk (zero based!) */
- /* section 4.3.7: byte 0xe */
- volatile u_char sectpertrk; /* sectors per track, not zero base, no runt*/
-};
-
-/*
- * format parameters iopb: redefines bytes: 6, 8, 9, a, b, c, d, 0x10, 0x11
- */
-
-struct xd_iopb_format {
- volatile u_char same[6]; /* smae as xd_iopb */
- /* section 4.4.1: byte 6 */
- volatile u_char interleave_ipl;/* (interleave << 4) | interupt level */
- /* interleave ratio 1:1 to 16:1 */
- volatile u_char same1; /* byte 7: same */
- /* section 4.4.2: byte 8 */
- volatile u_char field1; /* >= 1, xylogic says should be 1 */
-#define XDFM_FIELD1 0x01 /* xylogic value */
- /* section 4.4.3: byte 9 */
- volatile u_char field2; /* >0, field1+field2 <= 255 */
-#define XDFM_FIELD2 0x0a /* xylogic value */
- /* section 4.4.4: byte a */
- volatile u_char field3; /* >= field1+field2 */
-#define XDFM_FIELD3 0x1b /* xylogic value */
- /* section 4.4.5: byte b */
- volatile u_char field4; /* field4 */
-#define XDFM_FIELD4 0x14 /* xylogic value */
- /* section 4.4.6: bytes 0xc, 0xd */
- volatile u_short bytespersec; /* bytes per sector */
-#define XDFM_BPS 0x200 /* must be 512! */
- volatile u_char same2[2]; /* bytes e, f */
- /* section 4.4.7: byte 0x10 */
- volatile u_char field6; /* field 6 */
-#define XDFM_FIELD6 0x0a /* xylogic value */
- /* section 4.4.8: byte 0x11 */
- volatile u_char field7; /* field 7, >= 1 */
-#define XDFM_FIELD7 0x03 /* xylogic value */
-};
-
-
-/*
- * errors: errors come from either the fatal error register or the
- * iopb
- */
-
-#define XD_ERA_MASK 0xf0 /* error action mask */
-#define XD_ERA_PROG 0x10 /* program error */
-#define XD_ERA_PRG2 0x20 /* program error */
-#define XD_ERA_SOFT 0x30 /* soft error: we recovered */
-#define XD_ERA_HARD 0x40 /* hard error: retry */
-#define XD_ERA_RSET 0x60 /* hard error: reset, then retry */
-#define XD_ERA_WPRO 0x90 /* write protected */
-
-/* software error codes */
-#define XD_ERR_FAIL 0xff /* general total failure */
-/* no error */
-#define XD_ERR_AOK 0x00 /* success */
-/* non-retryable programming error */
-#define XD_ERR_ICYL 0x10 /* illegal cyl */
-#define XD_ERR_IHD 0x11 /* illegal head */
-#define XD_ERR_ISEC 0x12 /* illegal sector */
-#define XD_ERR_CZER 0x13 /* count zero */
-#define XD_ERR_UIMP 0x14 /* unknown command */
-#define XD_ERR_IF1 0x15 /* illegal field 1 */
-#define XD_ERR_IF2 0x16 /* illegal field 2 */
-#define XD_ERR_IF3 0x17 /* illegal field 3 */
-#define XD_ERR_IF4 0x18 /* illegal field 4 */
-#define XD_ERR_IF5 0x19 /* illegal field 5 */
-#define XD_ERR_IF6 0x1a /* illegal field 6 */
-#define XD_ERR_IF7 0x1b /* illegal field 7 */
-#define XD_ERR_ISG 0x1c /* illegal scatter/gather */
-#define XD_ERR_ISPT 0x1d /* not enough sectors per track */
-#define XD_ERR_ALGN 0x1e /* next iopb allignment error */
-#define XD_ERR_SGAL 0x1f /* scatter gather address alignment error */
-#define XD_ERR_SGEC 0x20 /* scatter gather with auto ECC */
-/* successfully recovered soft errors */
-#define XD_ERR_SECC 0x30 /* soft ecc corrected */
-#define XD_ERR_SIGN 0x31 /* ecc ignored */
-#define XD_ERR_ASEK 0x32 /* auto-seek retry recovered */
-#define XD_ERR_RTRY 0x33 /* soft retry recovered */
-/* hard errors: please retry */
-#define XD_ERR_HECC 0x40 /* hard data ECC */
-#define XD_ERR_NHDR 0x41 /* header not found */
-#define XD_ERR_NRDY 0x42 /* drive not ready */
-#define XD_ERR_TOUT 0x43 /* timeout */
-#define XD_ERR_VTIM 0x44 /* VME DMA timeout */
-#define XD_ERR_DSEQ 0x45 /* disk sequencer error */
-#define XD_ERR_HDEC 0x48 /* header ECC error */
-#define XD_ERR_RVFY 0x49 /* ready verify */
-#define XD_ERR_VFER 0x4a /* fatal VME DMA error */
-#define XD_ERR_VBUS 0x4b /* VME bus error */
-/* hard error: reset and retry */
-#define XD_ERR_DFLT 0x60 /* drive fault */
-#define XD_ERR_HECY 0x61 /* header error/cyl */
-#define XD_ERR_HEHD 0x62 /* header error/head */
-#define XD_ERR_NOCY 0x63 /* not on cylinder */
-#define XD_ERR_SEEK 0x64 /* seek error */
-/* fatal hardware error */
-#define XD_ERR_ILSS 0x70 /* illegal sector size */
-/* misc */
-#define XD_ERR_SEC 0x80 /* soft ecc */
-/* requires manual intervention */
-#define XD_ERR_WPER 0x90 /* write protected */
-/* FATAL errors */
-#define XD_ERR_IRAM 0xe1 /* IRAM self test failed */
-#define XD_ERR_MT3 0xe3 /* maint test 3 failed (DSKCEL RAM) */
-#define XD_ERR_MT4 0xe4 /* maint test 4 failed (Header shift reg) */
-#define XD_ERR_MT5 0xe5 /* maint test 5 failed (VMEDMA regs) */
-#define XD_ERR_MT6 0xe6 /* maint test 6 failed (REGCEL chip) */
-#define XD_ERR_MT7 0xe7 /* maint test 7 failed (buff. parity) */
-#define XD_ERR_MT8 0xe8 /* maint test 8 failed (fifo) */
-#define XD_ERR_IOCK 0xf0 /* iopb checksume miscompare */
-#define XD_ERR_IODM 0xf1 /* iopb dma fatal */
-#define XD_ERR_IOAL 0xf2 /* iopb allignment error */
-#define XD_ERR_FIRM 0xf3 /* firmware error n*/
-#define XD_ERR_MMOD 0xf5 /* illegal maint mode test number */
-#define XD_ERR_ACFL 0xf6 /* ACFAIL asserted */
diff --git a/sys/arch/kbus/dev/xdvar.h b/sys/arch/kbus/dev/xdvar.h
deleted file mode 100644
index 294f3a8c84b..00000000000
--- a/sys/arch/kbus/dev/xdvar.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/* $NetBSD: xdvar.h,v 1.5 1996/03/31 22:38:56 pk Exp $ */
-
-/*
- *
- * Copyright (c) 1995 Charles D. Cranor
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles D. Cranor.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * x d v a r . h
- *
- * this file defines the software structure we use to control the
- * 753/7053.
- *
- * author: Chuck Cranor <chuck@ccrc.wustl.edu>
- */
-
-/*
- * i/o request: wrapper for hardware's iopb data structure
- */
-
-struct xd_iorq {
- struct xd_iopb *iopb; /* address of matching iopb */
- struct xdc_softc *xdc; /* who we are working with */
- struct xd_softc *xd; /* which disk */
- int ttl; /* time to live */
- int mode; /* current mode (state+other data) */
- int tries; /* number of times we have tried it */
- int errno; /* error number if we fail */
- int lasterror; /* last error we got */
- int blockno; /* starting block no for this xfer */
- int sectcnt; /* number of sectors in xfer */
- char *dbuf; /* KVA of data buffer (advances) */
- char *dbufbase; /* base of dbuf */
- struct buf *buf; /* for NORM */
-};
-
-/*
- * state
- */
-
-#define XD_SUB_MASK 0xf0 /* mask bits for state */
-#define XD_SUB_FREE 0x00 /* free */
-#define XD_SUB_NORM 0x10 /* normal I/O request */
-#define XD_SUB_WAIT 0x20 /* normal I/O request in the
- context of a process */
-#define XD_SUB_POLL 0x30 /* polled mode */
-#define XD_SUB_DONE 0x40 /* not active, but can't be free'd yet */
-#define XD_SUB_NOQ 0x50 /* don't queue, just submit (internal) */
-
-#define XD_STATE(X) ((X) & XD_SUB_MASK) /* extract state from mode */
-#define XD_NEWSTATE(OLD, NEW) (((OLD) & ~XD_SUB_MASK) |(NEW)) /* new state */
-
-
-/*
- * other mode data
- */
-
-#define XD_MODE_VERBO 0x08 /* print error messages */
-#define XD_MODE_B144 0x04 /* handling a bad144 sector */
-
-
-/*
- * software timers and flags
- */
-
-#define XDC_SUBWAITLIM 4 /* max number of "done" IOPBs there can be
- where we still allow a SUB_WAIT command */
-#define XDC_TICKCNT (5*hz) /* call xdc_tick on this interval (5 sec) */
-#define XDC_MAXTTL 2 /* max number of xd ticks to live */
-#define XDC_NOUNIT (-1) /* for xdcmd: no unit number */
-
-/*
- * a "xd_softc" structure contains per-disk state info.
- */
-
-struct xd_softc {
- struct device sc_dev; /* device struct, reqd by autoconf */
- struct disk sc_dk; /* generic disk info */
- struct xdc_softc *parent; /* parent */
- u_short flags; /* flags */
- u_short state; /* device state */
- int xd_drive; /* unit number */
- /* geometry */
- u_short ncyl, acyl, pcyl; /* number of cyl's */
- u_short sectpercyl; /* nhead*nsect */
- u_char nhead; /* number of heads */
- u_char nsect; /* number of sectors per track */
- u_char hw_spt; /* as above, but includes spare sectors */
- struct dkbad dkb; /* bad144 sectors */
-};
-
-/*
- * flags
- */
-
-#define XD_WLABEL 0x0001 /* write label */
-/*
- * state
- */
-
-#define XD_DRIVE_UNKNOWN 0 /* never talked to it */
-#define XD_DRIVE_ATTACHING 1 /* attach in progress */
-#define XD_DRIVE_NOLABEL 2 /* drive on-line, no label */
-#define XD_DRIVE_ONLINE 3 /* drive is on-line */
-
-/*
- * a "xdc_softc" structure contains per-disk-controller state info,
- * including a list of active controllers.
- */
-
-struct xdc_softc {
- struct device sc_dev; /* device struct, reqd by autoconf */
- struct intrhand sc_ih; /* interrupt info */
- struct evcnt sc_intrcnt; /* event counter (for vmstat -i) */
-
- struct xdc *xdc; /* vaddr of vme registers */
-
- struct xd_softc *sc_drives[XDC_MAXDEV]; /* drives on this controller */
- int ipl; /* interrupt level */
- int vector; /* interrupt vector */
-
- struct xd_iorq *reqs; /* i/o requests */
- struct xd_iopb *iopbase; /* iopb base addr (maps iopb->iorq) */
- struct xd_iopb *dvmaiopb; /* iopb base in DVMA space, not kvm */
- struct buf sc_wq; /* queue'd IOPBs for this controller */
- char freereq[XDC_MAXIOPB]; /* free list (stack) */
- char waitq[XDC_MAXIOPB]; /* wait queue */
- u_char nfree; /* number of iopbs free */
- u_char nrun; /* number running */
- u_char nwait; /* number of waiting iopbs */
- u_char ndone; /* number of done IORQs */
- u_char waithead; /* head of queue */
- u_char waitend; /* end of queue */
-};
-
-/*
- * reset blast modes
- */
-
-#define XD_RSET_NONE (-1) /* restart all requests */
-#define XD_RSET_ALL (-2) /* don't restart anything */
diff --git a/sys/arch/kbus/dev/xio.h b/sys/arch/kbus/dev/xio.h
deleted file mode 100644
index 1ad5662b6be..00000000000
--- a/sys/arch/kbus/dev/xio.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $NetBSD: xio.h,v 1.2 1996/03/31 22:38:58 pk Exp $ */
-
-/*
- *
- * Copyright (c) 1995 Charles D. Cranor
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles D. Cranor.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * x i o . h
- *
- * this file defines the software structure we use to ioctl the
- * 753/7053. this interface isn't set in stone and may (or may not)
- * need adjustment.
- *
- * author: Chuck Cranor <chuck@ccrc.wustl.edu>
- */
-
-/*
- * xylogic ioctl interface
- */
-
-struct xd_iocmd {
- u_char cmd; /* in: command number */
- u_char subfn; /* in: subfunction number */
- u_char errno; /* out: error number */
- u_char tries; /* out: number of tries */
- u_short sectcnt; /* in,out: sector count (hw_spt on read drive param) */
- u_short dlen; /* in: length of data buffer (good sanity check) */
- u_long block; /* in: block number */
- caddr_t dptr; /* in: data buffer to do I/O from */
-};
-
-#ifndef DIOSXDCMD
-#define DIOSXDCMD _IOWR('x', 101, struct xd_iocmd) /* do xd command */
-#endif
-
-#define XD_IOCMD_MAXS 16 /* max number of sectors you can do */
-#define XD_IOCMD_HSZ 4 /* size of one header */
-#define XD_IOCMD_DMSZ 24 /* defect map size */
diff --git a/sys/arch/kbus/dev/zs.c b/sys/arch/kbus/dev/zs.c
deleted file mode 100644
index 81752ff1bcb..00000000000
--- a/sys/arch/kbus/dev/zs.c
+++ /dev/null
@@ -1,745 +0,0 @@
-/* $OpenBSD: zs.c,v 1.2 1999/01/11 05:11:28 millert Exp $ */
-/* $NetBSD: zs.c,v 1.42 1996/11/20 18:57:03 gwr Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Gordon W. Ross.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Zilog Z8530 Dual UART driver (machine-dependent part)
- *
- * Runs two serial lines per chip using slave drivers.
- * Plain tty/async lines use the zs_async slave.
- * Sun keyboard/mouse uses the zs_kbd/zs_ms slaves.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/device.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/time.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-
-#include <dev/cons.h>
-#include <dev/ic/z8530reg.h>
-#include <machine/z8530var.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-/* #include <machine/obio.h> */
-
-/*
- * XXX: Hard code this to make console init easier...
- */
-#define NZS 2 /* XXX */
-
-
-/*
- * The Sun3 provides a 3.6864 MHz clock to the ZS chips.
- */
-#define PCLK (3686400) /* PCLK pin input clock rate */
-
-/*
- * Define interrupt levels.
- */
-#define ZSHARD_PRI 6 /* Wired on the CPU board... */
-#define ZSSOFT_PRI 3 /* Want tty pri (4) but this is OK. */
-
-#define ZS_DELAY() delay(3)
-
-/*
- * The layout of this is hardware-dependent (padding, order).
- */
-struct zschan {
- volatile u_char zc_csr; /* ctrl,status, and indirect access */
- u_char zc_pad2[15];
- volatile u_char zc_data; /* data */
- u_char zc_pad1[15];
-};
-#define ZS_SIZE (sizeof (struct zschan))
-
-struct zsdevice {
- /* Yes, they are backwards. */
- struct zschan zs_chan_b;
- struct zschan zs_chan_a;
-};
-
-
-/* Default OBIO addresses. */
-static int zs_physaddr[NZS] = {0x17011000, 0x17012000};
-
-/* Saved PROM mappings */
-static struct zsdevice *zsaddr[NZS]; /* See zs_init() */
-
-/* Flags from cninit() */
-static int zs_hwflags[NZS][2];
-
-/* Default speed for each channel */
-static int zs_defspeed[NZS][2] = {
- { 1200, /* keyboard */
- 1200 }, /* mouse */
- { 9600, /* ttya */
- 9600 }, /* ttyb */
-};
-
-
-static struct zschan *zs_get_chan_addr __P((int, int));
-int zs_getc __P((volatile void *));
-static void zs_putc __P((volatile void *, int));
-
-int zscngetc __P((dev_t));
-void zscnputc __P((dev_t, int));
-void nullcnprobe __P((struct consdev *));
-void zscninit __P((struct consdev *));
-
-void umprintf __P((const char *, ...));
-
-/* Find PROM mappings (for console support). */
-void zs_init __P((void));
-void zs_init()
-{
- int i;
-
- for (i = 0; i < NZS; i++) {
- zsaddr[i] = (struct zsdevice *)
- bus_mapin (BUS_KBUS, zs_physaddr[i], ZS_SIZE);
- }
-}
-
-
-static struct zschan *
-zs_get_chan_addr(zsc_unit, channel)
- int zsc_unit, channel;
-{
- struct zsdevice *addr;
- struct zschan *zc;
-
- if (zsc_unit >= NZS)
- return NULL;
- addr = zsaddr[zsc_unit];
- if (addr == NULL)
- return NULL;
- if (channel == 0) {
- zc = &addr->zs_chan_a;
- } else {
- zc = &addr->zs_chan_b;
- }
- return (zc);
-}
-
-
-static u_char zs_init_reg[16] = {
- 0, /* 0: CMD (reset, etc.) */
- ZSWR1_RIE | ZSWR1_SIE, /* | ZSWR1_TIE, */
- 0, /* 0x18 + ZSHARD_PRI, * IVECT */
- ZSWR3_RX_8 | ZSWR3_RX_ENABLE,
- ZSWR4_CLK_X16 | ZSWR4_ONESB | ZSWR4_EVENP,
- ZSWR5_TX_8 | ZSWR5_TX_ENABLE,
- 0, /* 6: TXSYNC/SYNCLO */
- 0, /* 7: RXSYNC/SYNCHI */
- 0, /* 8: alias for data port */
- ZSWR9_MASTER_IE,
- 0, /*10: Misc. TX/RX control bits */
- ZSWR11_TXCLK_BAUD | ZSWR11_RXCLK_BAUD,
- 14, /*12: BAUDLO (default=9600) */
- 0, /*13: BAUDHI (default=9600) */
- ZSWR14_BAUD_FROM_PCLK | ZSWR14_BAUD_ENA,
- ZSWR15_BREAK_IE | ZSWR15_DCD_IE
-};
-
-
-/****************************************************************
- * Autoconfig
- ****************************************************************/
-
-/* Definition of the driver for autoconfig. */
-static int zsc_match __P((struct device *, void *, void *));
-static void zsc_attach __P((struct device *, struct device *, void *));
-static int zsc_print __P((void *, const char *name));
-
-struct cfattach zsc_ca = {
- sizeof(struct zsc_softc), zsc_match, zsc_attach
-};
-
-struct cfdriver zsc_cd = {
- NULL, "zsc", DV_DULL
-};
-
-static int zshard(void *);
-int zssoft(void *);
-static struct intrhand levelhard = { zshard };
-/* static struct intrhand levelsoft = { zssoft }; */
-
-/*
- * Is the zs chip present?
- */
-
-static int
-zsc_match(parent, vcf, aux)
- struct device *parent;
- void *vcf, *aux;
-{
- struct cfdata *cf = vcf;
- struct confargs *ca = aux;
- int pa, unit, x;
- void *va;
-
- if (ca->ca_bustype != BUS_KBUS)
- return 0;
-
- unit = cf->cf_unit;
- if (unit < 0 || unit >= NZS)
- return (0);
-
- /*
- * OBIO match functions may be called for every possible
- * physical address, so match only our physical address.
- * This driver only supports its default mappings, so
- * non-default locators must match our defaults.
- */
- if ((pa = ca->ca_paddr) == -1) {
- /* Use our default PA. */
- pa = zs_physaddr[unit];
- } else {
- /* Validate the given PA. */
- if (pa != zs_physaddr[unit])
- return (0);
- }
-
- if (pa != ca->ca_paddr)
- return (0);
-
- /* Make sure zs_init() found mappings. */
- va = zsaddr[unit];
- if (va == NULL)
- return (0);
-
- /* This returns -1 on a fault (bus error). */
- x = peek_byte(va);
- return (x != -1);
-}
-
-/*
- * Attach a found zs.
- *
- * Match slave number to zs unit number, so that misconfiguration will
- * not set up the keyboard as ttya, etc.
- */
-static void
-zsc_attach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct zsc_softc *zsc = (void *) self;
-/* struct cfdata *cf = self->dv_cfdata; */
- struct zsc_attach_args zsc_args;
- volatile struct zschan *zc;
- struct zs_chanstate *cs;
- int zsc_unit, intpri, channel;
- int reset, s;
- static int didintr;
-
- zsc_unit = zsc->zsc_dev.dv_unit;
-
-/* if ((intpri = cf->cf_intpri) == -1) */
- intpri = ZSHARD_PRI;
-
- printf(" level %d (softpri %d)\n", intpri, ZSSOFT_PRI);
-
- /* Use the mapping setup by the Sun PROM. */
- if (zsaddr[zsc_unit] == NULL)
- panic("zs_attach: zs%d not mapped", zsc_unit);
-
- /*
- * Initialize software state for each channel.
- */
- for (channel = 0; channel < 2; channel++) {
- cs = &zsc->zsc_cs[channel];
-
- zc = zs_get_chan_addr(zsc_unit, channel);
- cs->cs_reg_csr = &zc->zc_csr;
- cs->cs_reg_data = &zc->zc_data;
-
- cs->cs_channel = channel;
- cs->cs_private = NULL;
- cs->cs_ops = &zsops_null;
-
- /* Define BAUD rate clock for the MI code. */
- cs->cs_brg_clk = PCLK / 16;
-
- /* XXX: get defspeed from EEPROM instead? */
- cs->cs_defspeed = zs_defspeed[zsc_unit][channel];
-
- bcopy(zs_init_reg, cs->cs_creg, 16);
- bcopy(zs_init_reg, cs->cs_preg, 16);
-
- /*
- * Clear the master interrupt enable.
- * The INTENA is common to both channels,
- * so just do it on the A channel.
- */
- if (channel == 0) {
- zs_write_reg(cs, 9, 0);
- }
-
- /*
- * Look for a child driver for this channel.
- * The child attach will setup the hardware.
- */
- zsc_args.channel = channel;
- zsc_args.hwflags = zs_hwflags[zsc_unit][channel];
- if (config_found(self, (void *)&zsc_args, zsc_print) == NULL) {
- /* No sub-driver. Just reset it. */
- reset = (channel == 0) ?
- ZSWR9_A_RESET : ZSWR9_B_RESET;
- s = splzs();
- zs_write_reg(cs, 9, reset);
- splx(s);
- }
- }
-
- /* Now safe to install interrupt handlers */
- if (!didintr) {
- didintr = 1;
- /* intr_establish (ZSSOFT_PRI, 0, &levelsoft); */
- intr_establish (INTR_ZS, IH_CAN_DELAY, &levelhard);
- }
-
- /*
- * Set the master interrupt enable and interrupt vector.
- * (common to both channels, do it on A)
- */
- cs = &zsc->zsc_cs[0];
- s = splzs();
- /* interrupt vector */
- zs_write_reg(cs, 2, zs_init_reg[2]);
- /* master interrupt control (enable) */
- zs_write_reg(cs, 9, zs_init_reg[9]);
- splx(s);
-}
-
-static int
-zsc_print(aux, name)
- void *aux;
- const char *name;
-{
- struct zsc_attach_args *args = aux;
-
- if (name != NULL)
- printf("%s: ", name);
-
- if (args->channel != -1)
- printf(" channel %d", args->channel);
-
- return UNCONF;
-}
-
-static int
-zshard(arg)
- void *arg;
-{
- struct zsc_softc *zsc;
- int unit, rval;
-
- /* Do ttya/ttyb first, because they go faster. */
- rval = 0;
- unit = zsc_cd.cd_ndevs;
- while (--unit >= 0) {
- zsc = zsc_cd.cd_devs[unit];
- if (zsc != NULL) {
- rval |= zsc_intr_hard(zsc);
- }
- }
- return rval;
-}
-
-int zssoftpending;
-
-void
-zsc_req_softint(zsc)
- struct zsc_softc *zsc;
-{
- if (zssoftpending == 0) {
- /* We are at splzs here, so no need to lock. */
- zssoftpending = ZSSOFT_PRI;
- setsoftzs ();
- }
-}
-
-int
-zssoft(arg)
- void *arg;
-{
- struct zsc_softc *zsc;
- int unit;
-
- /* This is not the only ISR on this IPL. */
- if (zssoftpending == 0)
- return (0);
-
- /*
- * The soft intr. bit will be set by zshard only if
- * the variable zssoftpending is zero. The order of
- * these next two statements prevents our clearing
- * the soft intr bit just after zshard has set it.
- */
-/* isr_soft_clear(ZSSOFT_PRI); */
- zssoftpending = 0;
-
- /* Do ttya/ttyb first, because they go faster. */
- unit = zsc_cd.cd_ndevs;
- while (--unit >= 0) {
- zsc = zsc_cd.cd_devs[unit];
- if (zsc != NULL) {
- (void) zsc_intr_soft(zsc);
- }
- }
- return (1);
-}
-
-
-/*
- * Read or write the chip with suitable delays.
- */
-
-u_char
-zs_read_reg(cs, reg)
- struct zs_chanstate *cs;
- u_char reg;
-{
- u_char val;
-
- *cs->cs_reg_csr = reg;
- ZS_DELAY();
- val = *cs->cs_reg_csr;
- ZS_DELAY();
- return val;
-}
-
-void
-zs_write_reg(cs, reg, val)
- struct zs_chanstate *cs;
- u_char reg, val;
-{
- *cs->cs_reg_csr = reg;
- ZS_DELAY();
- *cs->cs_reg_csr = val;
- ZS_DELAY();
-}
-
-u_char
-zs_read_csr(cs)
- struct zs_chanstate *cs;
-{
- register u_char v;
-
- v = *cs->cs_reg_csr;
- ZS_DELAY();
- return v;
-}
-
-u_char
-zs_read_data(cs)
- struct zs_chanstate *cs;
-{
- register u_char v;
-
- v = *cs->cs_reg_data;
- ZS_DELAY();
- return v;
-}
-
-void zs_write_csr(cs, val)
- struct zs_chanstate *cs;
- u_char val;
-{
- *cs->cs_reg_csr = val;
- ZS_DELAY();
-}
-
-void
-zs_write_data(cs, val)
- struct zs_chanstate *cs;
- u_char val;
-{
- *cs->cs_reg_data = val;
- ZS_DELAY();
-}
-
-
-/****************************************************************
- * Console support functions (Sun3 specific!)
- ****************************************************************/
-
-/*
- * Polled input char.
- */
-int
-zs_getc(arg)
- volatile void *arg;
-{
- register volatile struct zschan *zc = arg;
- register int s, c, rr0;
-
- s = splhigh();
- /* Wait for a character to arrive. */
- do {
- rr0 = zc->zc_csr;
- ZS_DELAY();
- } while ((rr0 & ZSRR0_RX_READY) == 0);
-
- c = zc->zc_data;
- ZS_DELAY();
- splx(s);
-
- /*
- * This is used by the kd driver to read scan codes,
- * so don't translate '\r' ==> '\n' here...
- */
- return (c);
-}
-
-/*
- * Polled output char.
- */
-static void
-zs_putc(arg, c)
- volatile void *arg;
- int c;
-{
- register volatile struct zschan *zc = arg;
- register int s, rr0;
-
- s = splhigh();
- /* Wait for transmitter to become ready. */
- do {
- rr0 = zc->zc_csr;
- ZS_DELAY();
- } while ((rr0 & ZSRR0_TX_READY) == 0);
-
- zc->zc_data = c;
- ZS_DELAY();
-
- do {
- rr0 = zc->zc_csr;
- ZS_DELAY();
- } while ((rr0 & ZSRR0_TX_READY) == 0);
- splx(s);
-}
-
-extern struct consdev consdev_kd; /* keyboard/display */
-extern struct consdev consdev_tty;
-extern struct consdev *cn_tab; /* physical console device info */
-
-void *zs_conschan = (void *) 0x17012020;
-
-/*
- * This function replaces sys/dev/cninit.c
- * Determine which device is the console using
- * the PROM "input source" and "output sink".
- */
-void
-cninit()
-{
-/* struct zschan *zc; */
- struct consdev *cn;
- int zsc_unit, channel;
- char inSource;
-
- inSource = 1;
-
- switch (inSource) {
-
- case 1: /* ttya */
- case 2: /* ttyb */
- zsc_unit = 1;
- channel = inSource - 1;
- cn = &consdev_tty;
- cn->cn_dev = makedev(ZSTTY_MAJOR, channel);
- cn->cn_pri = CN_REMOTE;
- break;
-
- case 3: /* ttyc (rewired keyboard connector) */
- case 4: /* ttyd (rewired mouse connector) */
- zsc_unit = 0;
- channel = inSource - 3;
- cn = &consdev_tty;
- cn->cn_dev = makedev(ZSTTY_MAJOR, (channel+2));
- cn->cn_pri = CN_REMOTE;
- break;
-
- default:
-#if 0
- mon_printf("cninit: invalid PROM console selector\n");
-#endif
- /* assume keyboard/display */
- /* fallthrough */
- case 0: /* keyboard/display */
- zsc_unit = 0;
- channel = 0;
- cn = &consdev_kd;
- /* Set cn_dev, cn_pri in kd.c */
- break;
- }
-
-#if 0
- zc = zs_get_chan_addr(zsc_unit, channel);
- if (zc == NULL) {
-#if 0
- mon_printf("cninit: zs not mapped.\n");
-#endif
- return;
- }
- zs_conschan = zc;
-#endif
- zs_hwflags[zsc_unit][channel] = ZS_HWFLAG_CONSOLE;
- cn_tab = cn;
- (*cn->cn_init)(cn);
-}
-
-
-/* We never call this. */
-void
-nullcnprobe(cn)
- struct consdev *cn;
-{
-}
-
-void
-zscninit(cn)
- struct consdev *cn;
-{
-#if 0
- int unit = minor(cn->cn_dev) & 1;
-
- mon_printf("console is zstty%d (tty%c)\n",
- unit, unit + 'a');
-#endif
-}
-
-/*
- * Polled console input putchar.
- */
-int
-zscngetc(dev)
- dev_t dev;
-{
- register volatile struct zschan *zc = zs_conschan;
- register int c;
-
- c = zs_getc(zc);
- return (c);
-}
-
-/*
- * Polled console output putchar.
- */
-void
-zscnputc(dev, c)
- dev_t dev;
- int c;
-{
- register volatile struct zschan *zc = zs_conschan;
-
- zs_putc(zc, c);
- if (c == '\n')
- zs_putc (zc, '\r');
-}
-
-
-struct consdev consdev_tty = {
- nullcnprobe,
- zscninit,
- zscngetc,
- zscnputc,
- nullcnpollc,
-};
-
-
-/*
- * Handle user request to enter kernel debugger.
- */
-void
-zs_abort()
-{
- register volatile struct zschan *zc = zs_conschan;
- int rr0;
-
- /* Wait for end of break to avoid PROM abort. */
- /* XXX - Limit the wait? */
- do {
- rr0 = zc->zc_csr;
- ZS_DELAY();
- } while (rr0 & ZSRR0_BREAK);
-
- /* XXX - Always available, but may be the PROM monitor. */
- Debugger();
-}
-
-#if 1
-static __inline__ int
-zs_hack_read_reg (int reg)
-{
- register volatile struct zschan *zc = zs_conschan;
- int val;
- zc->zc_csr = reg;
- ZS_DELAY();
- val = zc->zc_csr;
- ZS_DELAY();
- return val;
-}
-#endif
-
-void zs_hack (void);
-void
-zs_hack (void)
-{
- int rr[16];
- static int regs[] = {0, 1, 2, 3, 10, 12, 13, 15, -1};
- int *p;
-
- for (p = regs; *p != -1; p++)
- rr[*p] = zs_hack_read_reg (*p);
-
- printf ("zs_hack:\n");
- for (p =regs; *p != -1; p++)
- printf ("regs[%d] = 0x%02x\n", *p, rr[*p]);
-}
diff --git a/sys/arch/kbus/dev/zs_cons.h b/sys/arch/kbus/dev/zs_cons.h
deleted file mode 100644
index dd5768e6b5c..00000000000
--- a/sys/arch/kbus/dev/zs_cons.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* $OpenBSD: zs_cons.h,v 1.1.1.1 1997/10/14 07:25:30 gingold Exp $ */
-
-extern void *zs_conschan;
-
-extern void nullcnprobe __P((struct consdev *));
-
-extern int zs_getc __P((void *arg));
-extern void zs_putc __P((void *arg, int c));
-
diff --git a/sys/arch/kbus/dev/zs_kgdb.c b/sys/arch/kbus/dev/zs_kgdb.c
deleted file mode 100644
index 6104cd84eb0..00000000000
--- a/sys/arch/kbus/dev/zs_kgdb.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/* $OpenBSD: zs_kgdb.c,v 1.1.1.1 1997/10/14 07:25:30 gingold Exp $ */
-/* $NetBSD: zs_kgdb.c,v 1.9 1996/11/20 18:57:04 gwr Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Gordon W. Ross.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Hooks for kgdb when attached vi the z8530 driver
- * XXX - not tested yet...
- *
- * To use this, build a kernel with: option KGDB, and
- * boot that kernel with "-d". (The kernel will call
- * zs_kgdb_init, kgdb_connect.) When the console prints
- * "kgdb waiting..." you run "gdb -k kernel" and then
- * connect to the remote using: "target remote /dev/ttyX"
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/device.h>
-#include <sys/conf.h>
-#include <sys/ioctl.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-
-#include <dev/ic/z8530reg.h>
-#include <machine/z8530var.h>
-
-#include <machine/remote-sl.h>
-
-/* The Sun3 provides a 4.9152 MHz clock to the ZS chips. */
-#define PCLK (9600 * 512) /* PCLK pin input clock rate */
-#define ZSHARD_PRI 6 /* Wired on the CPU board... */
-
-#define ZS_DELAY() delay(2)
-
-/* The layout of this is hardware-dependent (padding, order). */
-struct zschan {
- volatile u_char zc_csr; /* ctrl,status, and indirect access */
- u_char zc_xxx0;
- volatile u_char zc_data; /* data */
- u_char zc_xxx1;
-};
-
-extern int kgdb_dev;
-extern int kgdb_rate;
-
-struct zschan * zs_get_chan_addr __P((int zsc_unit, int channel));
-
-extern int zs_getc __P((void *arg));
-extern void zs_putc __P((void *arg, int c));
-
-struct zsops zsops_kgdb;
-
-static u_char zs_kgdb_regs[16] = {
- 0, /* 0: CMD (reset, etc.) */
- ZSWR1_RIE, /* NOT: (ZSWR1_TIE | ZSWR1_SIE) */
- 0x18 + ZSHARD_PRI, /* IVECT */
- ZSWR3_RX_8 | ZSWR3_RX_ENABLE,
- ZSWR4_CLK_X16 | ZSWR4_ONESB | ZSWR4_EVENP,
- ZSWR5_TX_8 | ZSWR5_TX_ENABLE,
- 0, /* 6: TXSYNC/SYNCLO */
- 0, /* 7: RXSYNC/SYNCHI */
- 0, /* 8: alias for data port */
- ZSWR9_MASTER_IE,
- 0, /*10: Misc. TX/RX control bits */
- ZSWR11_TXCLK_BAUD | ZSWR11_RXCLK_BAUD,
- 14, /*12: BAUDLO (default=9600) */
- 0, /*13: BAUDHI (default=9600) */
- ZSWR14_BAUD_FROM_PCLK | ZSWR14_BAUD_ENA,
- ZSWR15_BREAK_IE | ZSWR15_DCD_IE,
-};
-
-/*
- * This replaces "zs_reset()" in the sparc driver.
- */
-static void
-zs_setparam(cs, iena, rate)
- struct zs_chanstate *cs;
- int iena;
- int rate;
-{
- int s, tconst;
-
- bcopy(zs_kgdb_regs, cs->cs_preg, 16);
-
- if (iena == 0) {
- cs->cs_preg[1] = 0;
- }
-
- /* Initialize the speed, etc. */
- tconst = BPS_TO_TCONST(cs->cs_brg_clk, rate);
- cs->cs_preg[5] |= ZSWR5_DTR | ZSWR5_RTS;
- cs->cs_preg[12] = tconst;
- cs->cs_preg[13] = tconst >> 8;
-
- s = splhigh();
- zs_loadchannelregs(cs);
- splx(s);
-}
-
-/*
- * Set up for kgdb; called at boot time before configuration.
- * KGDB interrupts will be enabled later when zs0 is configured.
- */
-void
-zs_kgdb_init()
-{
- struct zs_chanstate cs;
- volatile struct zschan *zc;
- int channel, zsc_unit;
-
- if (major(kgdb_dev) != ZSTTY_MAJOR)
- return;
-
- /* Note: (ttya,ttyb) on zsc1, and (ttyc,ttyd) on zsc0 */
- zsc_unit = 2 - (kgdb_dev & 2);
- channel = kgdb_dev & 1;
- printf("zs_kgdb_init: attaching zstty%d at %d baud\n",
- channel, kgdb_rate);
-
- /* Setup temporary chanstate. */
- bzero((caddr_t)&cs, sizeof(cs));
- zc = zs_get_chan_addr(zsc_unit, channel);
- cs.cs_reg_csr = &zc->zc_csr;
- cs.cs_reg_data = &zc->zc_data;
- cs.cs_channel = channel;
- cs.cs_brg_clk = PCLK / 16;
-
- /* Now set parameters. (interrupts disabled) */
- zs_setparam(&cs, 0, kgdb_rate);
-
- /* Store the getc/putc functions and arg. */
- kgdb_attach(zs_getc, zs_putc, (void *)zc);
-}
-
-/*
- * This is a "hook" called by zstty_attach to allow the tty
- * to be "taken over" for exclusive use by kgdb.
- * Return non-zero if this is the kgdb port.
- *
- * Set the speed to kgdb_rate, CS8, etc.
- */
-int
-zs_check_kgdb(cs, dev)
- struct zs_chanstate *cs;
- int dev;
-{
-
- if (dev != kgdb_dev)
- return (0);
-
- /*
- * Yes, this is the kgdb port. Finish the autoconfig
- * message and set up the port for our exclusive use.
- */
- printf(" (kgdb)\n");
-
- cs->cs_private = NULL;
- cs->cs_ops = &zsops_kgdb;
-
- /* Now set parameters. (interrupts enabled) */
- zs_setparam(&cs, 1, kgdb_rate);
-
- return (1);
-}
-
-/*
- * KGDB framing character received: enter kernel debugger. This probably
- * should time out after a few seconds to avoid hanging on spurious input.
- */
-void
-zskgdb()
-{
- int unit = minor(kgdb_dev);
-
- printf("zstty%d: kgdb interrupt\n", unit);
- /* This will trap into the debugger. */
- kgdb_connect(1);
-}
-
-
-/****************************************************************
- * Interface to the lower layer (zscc)
- ****************************************************************/
-
-int kgdb_input_lost;
-
-static void
-zs_kgdb_rxint(cs)
- register struct zs_chanstate *cs;
-{
- register u_char c, rr1;
-
- /* Read the input data ASAP. */
- c = zs_read_data(cs);
-
- /* Save the status register too. */
- rr1 = zs_read_reg(cs, 1);
-
- if (rr1 & (ZSRR1_FE | ZSRR1_DO | ZSRR1_PE)) {
- /* Clear the receive error. */
- zs_write_csr(cs, ZSWR0_RESET_ERRORS);
- }
-
- if (c == FRAME_START) {
- zskgdb();
- } else {
- kgdb_input_lost++;
- }
-}
-
-static void
-zs_kgdb_txint(cs)
- register struct zs_chanstate *cs;
-{
- register int rr0;
-
- rr0 = zs_read_csr(cs);
- zs_write_csr(cs, ZSWR0_RESET_TXINT);
-}
-
-static void
-zs_kgdb_stint(cs)
- register struct zs_chanstate *cs;
-{
- register int rr0;
-
- rr0 = zs_read_csr(cs);
- zs_write_csr(cs, ZSWR0_RESET_STATUS);
-}
-
-static void
-zs_kgdb_softint(cs)
- struct zs_chanstate *cs;
-{
- printf("zs_kgdb_softint?\n");
-}
-
-struct zsops zsops_kgdb = {
- zs_kgdb_rxint, /* receive char available */
- zs_kgdb_stint, /* external/status */
- zs_kgdb_txint, /* xmit buffer empty */
- zs_kgdb_softint, /* process software interrupt */
-};
diff --git a/sys/arch/kbus/fpu/fpu.c b/sys/arch/kbus/fpu/fpu.c
deleted file mode 100644
index e72048bc90a..00000000000
--- a/sys/arch/kbus/fpu/fpu.c
+++ /dev/null
@@ -1,396 +0,0 @@
-/* $NetBSD: fpu.c,v 1.3 1996/03/14 19:41:49 christos Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fpu.c 8.1 (Berkeley) 6/11/93
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/signal.h>
-#include <sys/systm.h>
-#include <sys/syslog.h>
-#include <sys/signalvar.h>
-
-#include <machine/instr.h>
-#include <machine/reg.h>
-
-#include <fpu/fpu_emu.h>
-#include <fpu/fpu_extern.h>
-
-/*
- * fpu_execute returns the following error numbers (0 = no error):
- */
-#define FPE 1 /* take a floating point exception */
-#define NOTFPU 2 /* not an FPU instruction */
-
-/*
- * Translate current exceptions into `first' exception. The
- * bits go the wrong way for ffs() (0x10 is most important, etc).
- * There are only 5, so do it the obvious way.
- */
-#define X1(x) x
-#define X2(x) x,x
-#define X4(x) x,x,x,x
-#define X8(x) X4(x),X4(x)
-#define X16(x) X8(x),X8(x)
-
-static char cx_to_trapx[] = {
- X1(FSR_NX),
- X2(FSR_DZ),
- X4(FSR_UF),
- X8(FSR_OF),
- X16(FSR_NV)
-};
-static u_char fpu_codes[] = {
- X1(FPE_FLTINEX_TRAP),
- X2(FPE_FLTDIV_TRAP),
- X4(FPE_FLTUND_TRAP),
- X8(FPE_FLTOVF_TRAP),
- X16(FPE_FLTOPERR_TRAP)
-};
-
-static int fpu_types[] = {
- FPE_FLTRES,
- FPE_FLTDIV,
- FPE_FLTUND,
- FPE_FLTOVF,
- FPE_FLTINV,
-};
-
-/*
- * The FPU gave us an exception. Clean up the mess. Note that the
- * fp queue can only have FPops in it, never load/store FP registers
- * nor FBfcc instructions. Experiments with `crashme' prove that
- * unknown FPops do enter the queue, however.
- */
-void
-fpu_cleanup(p, fs)
- register struct proc *p;
- register struct fpstate *fs;
-{
- register int i, fsr = fs->fs_fsr, error;
- union instr instr;
- union sigval sv;
- struct fpemu fe;
-
- sv.sival_int = p->p_md.md_tf->tf_pc; /* XXX only approximate */
-
- switch ((fsr >> FSR_FTT_SHIFT) & FSR_FTT_MASK) {
-
- case FSR_TT_NONE:
- panic("fpu_cleanup 1"); /* ??? */
- break;
-
- case FSR_TT_IEEE:
- if ((i = fsr & FSR_CX) == 0)
- panic("fpu ieee trap, but no exception");
- trapsignal(p, SIGFPE, fpu_codes[i - 1], fpu_types[i - i], sv);
- break; /* XXX should return, but queue remains */
-
- case FSR_TT_UNFIN:
- case FSR_TT_UNIMP:
- if (fs->fs_qsize == 0)
- panic("fpu_cleanup 2");
- break;
-
- case FSR_TT_SEQ:
- panic("fpu sequence error");
- /* NOTREACHED */
-
- case FSR_TT_HWERR:
- log(LOG_ERR, "fpu hardware error (%s[%d])\n",
- p->p_comm, p->p_pid);
- uprintf("%s[%d]: fpu hardware error\n", p->p_comm, p->p_pid);
- trapsignal(p, SIGFPE, -1, FPE_FLTINV, sv); /* ??? */
- goto out;
-
- default:
- printf("fsr=%x\n", fsr);
- panic("fpu error");
- }
-
- /* emulate the instructions left in the queue */
- fe.fe_fpstate = fs;
- for (i = 0; i < fs->fs_qsize; i++) {
- instr.i_int = fs->fs_queue[i].fq_instr;
- if (instr.i_any.i_op != IOP_reg ||
- (instr.i_op3.i_op3 != IOP3_FPop1 &&
- instr.i_op3.i_op3 != IOP3_FPop2))
- panic("bogus fpu queue");
- error = fpu_execute(&fe, instr);
- switch (error) {
-
- case 0:
- continue;
-
- case FPE:
- trapsignal(p, SIGFPE,
- fpu_codes[(fs->fs_fsr & FSR_CX) - 1],
- fpu_types[(fs->fs_fsr & FSR_CX) - 1], sv);
- break;
-
- case NOTFPU:
- trapsignal(p, SIGILL, 0, ILL_COPROC, sv);
- break;
-
- default:
- panic("fpu_cleanup 3");
- /* NOTREACHED */
- }
- /* XXX should stop here, but queue remains */
- }
-out:
- fs->fs_qsize = 0;
-}
-
-#ifdef notyet
-/*
- * If we have no FPU at all (are there any machines like this out
- * there!?) we have to emulate each instruction, and we need a pointer
- * to the trapframe so that we can step over them and do FBfcc's.
- * We know the `queue' is empty, though; we just want to emulate
- * the instruction at tf->tf_pc.
- */
-fpu_emulate(p, tf, fs)
- struct proc *p;
- register struct trapframe *tf;
- register struct fpstate *fs;
-{
-
- do {
- fetch instr from pc
- decode
- if (integer instr) {
- /*
- * We do this here, rather than earlier, to avoid
- * losing even more badly than usual.
- */
- if (p->p_addr->u_pcb.pcb_uw) {
- write_user_windows();
- if (rwindow_save(p))
- sigexit(p, SIGILL);
- }
- if (loadstore) {
- do_it;
- pc = npc, npc += 4
- } else if (fbfcc) {
- do_annul_stuff;
- } else
- return;
- } else if (fpu instr) {
- fe.fe_fsr = fs->fs_fsr &= ~FSR_CX;
- error = fpu_execute(&fe, fs, instr);
- switch (error) {
- etc;
- }
- } else
- return;
- if (want to reschedule)
- return;
- } while (error == 0);
-}
-#endif
-
-/*
- * Execute an FPU instruction (one that runs entirely in the FPU; not
- * FBfcc or STF, for instance). On return, fe->fe_fs->fs_fsr will be
- * modified to reflect the setting the hardware would have left.
- *
- * Note that we do not catch all illegal opcodes, so you can, for instance,
- * multiply two integers this way.
- */
-int
-fpu_execute(fe, instr)
- register struct fpemu *fe;
- union instr instr;
-{
- register struct fpn *fp;
- register int opf, rs1, rs2, rd, type, mask, fsr, cx;
- register struct fpstate *fs;
- u_int space[4];
-
- /*
- * `Decode' and execute instruction. Start with no exceptions.
- * The type of any i_opf opcode is in the bottom two bits, so we
- * squish them out here.
- */
- opf = instr.i_opf.i_opf;
- type = opf & 3;
- mask = "\0\0\1\3"[type];
- rs1 = instr.i_opf.i_rs1 & ~mask;
- rs2 = instr.i_opf.i_rs2 & ~mask;
- rd = instr.i_opf.i_rd & ~mask;
-#ifdef notdef
- if ((rs1 | rs2 | rd) & mask)
- return (BADREG);
-#endif
- fs = fe->fe_fpstate;
- fe->fe_fsr = fs->fs_fsr & ~FSR_CX;
- fe->fe_cx = 0;
- switch (opf >>= 2) {
-
- default:
- return (NOTFPU);
-
- case FMOV >> 2: /* these should all be pretty obvious */
- rs1 = fs->fs_regs[rs2];
- goto mov;
-
- case FNEG >> 2:
- rs1 = fs->fs_regs[rs2] ^ (1 << 31);
- goto mov;
-
- case FABS >> 2:
- rs1 = fs->fs_regs[rs2] & ~(1 << 31);
- mov:
- fs->fs_regs[rd] = rs1;
- fs->fs_fsr = fe->fe_fsr;
- return (0); /* success */
-
- case FSQRT >> 2:
- fpu_explode(fe, &fe->fe_f1, type, rs2);
- fp = fpu_sqrt(fe);
- break;
-
- case FADD >> 2:
- fpu_explode(fe, &fe->fe_f1, type, rs1);
- fpu_explode(fe, &fe->fe_f2, type, rs2);
- fp = fpu_add(fe);
- break;
-
- case FSUB >> 2:
- fpu_explode(fe, &fe->fe_f1, type, rs1);
- fpu_explode(fe, &fe->fe_f2, type, rs2);
- fp = fpu_sub(fe);
- break;
-
- case FMUL >> 2:
- fpu_explode(fe, &fe->fe_f1, type, rs1);
- fpu_explode(fe, &fe->fe_f2, type, rs2);
- fp = fpu_mul(fe);
- break;
-
- case FDIV >> 2:
- fpu_explode(fe, &fe->fe_f1, type, rs1);
- fpu_explode(fe, &fe->fe_f2, type, rs2);
- fp = fpu_div(fe);
- break;
-
- case FCMP >> 2:
- fpu_explode(fe, &fe->fe_f1, type, rs1);
- fpu_explode(fe, &fe->fe_f2, type, rs2);
- fpu_compare(fe, 0);
- goto cmpdone;
-
- case FCMPE >> 2:
- fpu_explode(fe, &fe->fe_f1, type, rs1);
- fpu_explode(fe, &fe->fe_f2, type, rs2);
- fpu_compare(fe, 1);
- cmpdone:
- /*
- * The only possible exception here is NV; catch it
- * early and get out, as there is no result register.
- */
- cx = fe->fe_cx;
- fsr = fe->fe_fsr | (cx << FSR_CX_SHIFT);
- if (cx != 0) {
- if (fsr & (FSR_NV << FSR_TEM_SHIFT)) {
- fs->fs_fsr = (fsr & ~FSR_FTT) |
- (FSR_TT_IEEE << FSR_FTT_SHIFT);
- return (FPE);
- }
- fsr |= FSR_NV << FSR_AX_SHIFT;
- }
- fs->fs_fsr = fsr;
- return (0);
-
- case FSMULD >> 2:
- case FDMULX >> 2:
- if (type == FTYPE_EXT)
- return (NOTFPU);
- fpu_explode(fe, &fe->fe_f1, type, rs1);
- fpu_explode(fe, &fe->fe_f2, type, rs2);
- type++; /* single to double, or double to quad */
- fp = fpu_mul(fe);
- break;
-
- case FTOS >> 2:
- case FTOD >> 2:
- case FTOX >> 2:
- case FTOI >> 2:
- fpu_explode(fe, fp = &fe->fe_f1, type, rs2);
- type = opf & 3; /* sneaky; depends on instruction encoding */
- break;
- }
-
- /*
- * ALU operation is complete. Collapse the result and then check
- * for exceptions. If we got any, and they are enabled, do not
- * alter the destination register, just stop with an exception.
- * Otherwise set new current exceptions and accrue.
- */
- fpu_implode(fe, fp, type, space);
- cx = fe->fe_cx;
- fsr = fe->fe_fsr;
- if (cx != 0) {
- mask = (fsr >> FSR_TEM_SHIFT) & FSR_TEM_MASK;
- if (cx & mask) {
- /* not accrued??? */
- fs->fs_fsr = (fsr & ~FSR_FTT) |
- (FSR_TT_IEEE << FSR_FTT_SHIFT) |
- (cx_to_trapx[(cx & mask) - 1] << FSR_CX_SHIFT);
- return (FPE);
- }
- fsr |= (cx << FSR_CX_SHIFT) | (cx << FSR_AX_SHIFT);
- }
- fs->fs_fsr = fsr;
- fs->fs_regs[rd] = space[0];
- if (type >= FTYPE_DBL) {
- fs->fs_regs[rd + 1] = space[1];
- if (type > FTYPE_DBL) {
- fs->fs_regs[rd + 2] = space[2];
- fs->fs_regs[rd + 3] = space[3];
- }
- }
- return (0); /* success */
-}
diff --git a/sys/arch/kbus/fpu/fpu_add.c b/sys/arch/kbus/fpu/fpu_add.c
deleted file mode 100644
index fd743bfa349..00000000000
--- a/sys/arch/kbus/fpu/fpu_add.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/* $NetBSD: fpu_add.c,v 1.3 1996/03/14 19:41:52 christos Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fpu_add.c 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * Perform an FPU add (return x + y).
- *
- * To subtract, negate y and call add.
- */
-
-#include <sys/types.h>
-#ifdef DIAGNOSTIC
-#include <sys/systm.h>
-#endif
-
-#include <machine/reg.h>
-#include <machine/instr.h>
-
-#include <fpu/fpu_arith.h>
-#include <fpu/fpu_emu.h>
-#include <fpu/fpu_extern.h>
-
-struct fpn *
-fpu_add(fe)
- register struct fpemu *fe;
-{
- register struct fpn *x = &fe->fe_f1, *y = &fe->fe_f2, *r;
- register u_int r0, r1, r2, r3;
- register int rd;
-
- /*
- * Put the `heavier' operand on the right (see fpu_emu.h).
- * Then we will have one of the following cases, taken in the
- * following order:
- *
- * - y = NaN. Implied: if only one is a signalling NaN, y is.
- * The result is y.
- * - y = Inf. Implied: x != NaN (is 0, number, or Inf: the NaN
- * case was taken care of earlier).
- * If x = -y, the result is NaN. Otherwise the result
- * is y (an Inf of whichever sign).
- * - y is 0. Implied: x = 0.
- * If x and y differ in sign (one positive, one negative),
- * the result is +0 except when rounding to -Inf. If same:
- * +0 + +0 = +0; -0 + -0 = -0.
- * - x is 0. Implied: y != 0.
- * Result is y.
- * - other. Implied: both x and y are numbers.
- * Do addition a la Hennessey & Patterson.
- */
- ORDER(x, y);
- if (ISNAN(y))
- return (y);
- if (ISINF(y)) {
- if (ISINF(x) && x->fp_sign != y->fp_sign)
- return (fpu_newnan(fe));
- return (y);
- }
- rd = ((fe->fe_fsr >> FSR_RD_SHIFT) & FSR_RD_MASK);
- if (ISZERO(y)) {
- if (rd != FSR_RD_RM) /* only -0 + -0 gives -0 */
- y->fp_sign &= x->fp_sign;
- else /* any -0 operand gives -0 */
- y->fp_sign |= x->fp_sign;
- return (y);
- }
- if (ISZERO(x))
- return (y);
- /*
- * We really have two numbers to add, although their signs may
- * differ. Make the exponents match, by shifting the smaller
- * number right (e.g., 1.011 => 0.1011) and increasing its
- * exponent (2^3 => 2^4). Note that we do not alter the exponents
- * of x and y here.
- */
- r = &fe->fe_f3;
- r->fp_class = FPC_NUM;
- if (x->fp_exp == y->fp_exp) {
- r->fp_exp = x->fp_exp;
- r->fp_sticky = 0;
- } else {
- if (x->fp_exp < y->fp_exp) {
- /*
- * Try to avoid subtract case iii (see below).
- * This also guarantees that x->fp_sticky = 0.
- */
- SWAP(x, y);
- }
- /* now x->fp_exp > y->fp_exp */
- r->fp_exp = x->fp_exp;
- r->fp_sticky = fpu_shr(y, x->fp_exp - y->fp_exp);
- }
- r->fp_sign = x->fp_sign;
- if (x->fp_sign == y->fp_sign) {
- FPU_DECL_CARRY
-
- /*
- * The signs match, so we simply add the numbers. The result
- * may be `supernormal' (as big as 1.111...1 + 1.111...1, or
- * 11.111...0). If so, a single bit shift-right will fix it
- * (but remember to adjust the exponent).
- */
- /* r->fp_mant = x->fp_mant + y->fp_mant */
- FPU_ADDS(r->fp_mant[3], x->fp_mant[3], y->fp_mant[3]);
- FPU_ADDCS(r->fp_mant[2], x->fp_mant[2], y->fp_mant[2]);
- FPU_ADDCS(r->fp_mant[1], x->fp_mant[1], y->fp_mant[1]);
- FPU_ADDC(r0, x->fp_mant[0], y->fp_mant[0]);
- if ((r->fp_mant[0] = r0) >= FP_2) {
- (void) fpu_shr(r, 1);
- r->fp_exp++;
- }
- } else {
- FPU_DECL_CARRY
-
- /*
- * The signs differ, so things are rather more difficult.
- * H&P would have us negate the negative operand and add;
- * this is the same as subtracting the negative operand.
- * This is quite a headache. Instead, we will subtract
- * y from x, regardless of whether y itself is the negative
- * operand. When this is done one of three conditions will
- * hold, depending on the magnitudes of x and y:
- * case i) |x| > |y|. The result is just x - y,
- * with x's sign, but it may need to be normalized.
- * case ii) |x| = |y|. The result is 0 (maybe -0)
- * so must be fixed up.
- * case iii) |x| < |y|. We goofed; the result should
- * be (y - x), with the same sign as y.
- * We could compare |x| and |y| here and avoid case iii,
- * but that would take just as much work as the subtract.
- * We can tell case iii has occurred by an overflow.
- *
- * N.B.: since x->fp_exp >= y->fp_exp, x->fp_sticky = 0.
- */
- /* r->fp_mant = x->fp_mant - y->fp_mant */
- FPU_SET_CARRY(y->fp_sticky);
- FPU_SUBCS(r3, x->fp_mant[3], y->fp_mant[3]);
- FPU_SUBCS(r2, x->fp_mant[2], y->fp_mant[2]);
- FPU_SUBCS(r1, x->fp_mant[1], y->fp_mant[1]);
- FPU_SUBC(r0, x->fp_mant[0], y->fp_mant[0]);
- if (r0 < FP_2) {
- /* cases i and ii */
- if ((r0 | r1 | r2 | r3) == 0) {
- /* case ii */
- r->fp_class = FPC_ZERO;
- r->fp_sign = rd == FSR_RD_RM;
- return (r);
- }
- } else {
- /*
- * Oops, case iii. This can only occur when the
- * exponents were equal, in which case neither
- * x nor y have sticky bits set. Flip the sign
- * (to y's sign) and negate the result to get y - x.
- */
-#ifdef DIAGNOSTIC
- if (x->fp_exp != y->fp_exp || r->fp_sticky)
- panic("fpu_add");
-#endif
- r->fp_sign = y->fp_sign;
- FPU_SUBS(r3, 0, r3);
- FPU_SUBCS(r2, 0, r2);
- FPU_SUBCS(r1, 0, r1);
- FPU_SUBC(r0, 0, r0);
- }
- r->fp_mant[3] = r3;
- r->fp_mant[2] = r2;
- r->fp_mant[1] = r1;
- r->fp_mant[0] = r0;
- if (r0 < FP_1)
- fpu_norm(r);
- }
- return (r);
-}
diff --git a/sys/arch/kbus/fpu/fpu_arith.h b/sys/arch/kbus/fpu/fpu_arith.h
deleted file mode 100644
index 572b16d7233..00000000000
--- a/sys/arch/kbus/fpu/fpu_arith.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* $NetBSD: fpu_arith.h,v 1.2 1994/11/20 20:52:35 deraadt Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fpu_arith.h 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * Extended-precision arithmetic.
- *
- * We hold the notion of a `carry register', which may or may not be a
- * machine carry bit or register. On the SPARC, it is just the machine's
- * carry bit.
- *
- * In the worst case, you can compute the carry from x+y as
- * (unsigned)(x + y) < (unsigned)x
- * and from x+y+c as
- * ((unsigned)(x + y + c) <= (unsigned)x && (y|c) != 0)
- * for example.
- */
-
-/* set up for extended-precision arithemtic */
-#define FPU_DECL_CARRY
-
-/*
- * We have three kinds of add:
- * add with carry: r = x + y + c
- * add (ignoring current carry) and set carry: c'r = x + y + 0
- * add with carry and set carry: c'r = x + y + c
- * The macros use `C' for `use carry' and `S' for `set carry'.
- * Note that the state of the carry is undefined after ADDC and SUBC,
- * so if all you have for these is `add with carry and set carry',
- * that is OK.
- *
- * The same goes for subtract, except that we compute x - y - c.
- *
- * Finally, we have a way to get the carry into a `regular' variable,
- * or set it from a value. SET_CARRY turns 0 into no-carry, nonzero
- * into carry; GET_CARRY sets its argument to 0 or 1.
- */
-#define FPU_ADDC(r, x, y) \
- asm volatile("addx %1,%2,%0" : "=r"(r) : "r"(x), "r"(y))
-#define FPU_ADDS(r, x, y) \
- asm volatile("addcc %1,%2,%0" : "=r"(r) : "r"(x), "r"(y))
-#define FPU_ADDCS(r, x, y) \
- asm volatile("addxcc %1,%2,%0" : "=r"(r) : "r"(x), "r"(y))
-#define FPU_SUBC(r, x, y) \
- asm volatile("subx %1,%2,%0" : "=r"(r) : "r"(x), "r"(y))
-#define FPU_SUBS(r, x, y) \
- asm volatile("subcc %1,%2,%0" : "=r"(r) : "r"(x), "r"(y))
-#define FPU_SUBCS(r, x, y) \
- asm volatile("subxcc %1,%2,%0" : "=r"(r) : "r"(x), "r"(y))
-
-#define FPU_GET_CARRY(r) asm volatile("addx %%g0,%%g0,%0" : "=r"(r))
-#define FPU_SET_CARRY(v) asm volatile("addcc %0,-1,%%g0" : : "r"(v))
-
-#define FPU_SHL1_BY_ADD /* shift left 1 faster by ADDC than (a<<1)|(b>>31) */
diff --git a/sys/arch/kbus/fpu/fpu_compare.c b/sys/arch/kbus/fpu/fpu_compare.c
deleted file mode 100644
index 38ea2bd9c8f..00000000000
--- a/sys/arch/kbus/fpu/fpu_compare.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/* $NetBSD: fpu_compare.c,v 1.2 1994/11/20 20:52:37 deraadt Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fpu_compare.c 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * CMP and CMPE instructions.
- *
- * These rely on the fact that our internal wide format is achieved by
- * adding zero bits to the end of narrower mantissas.
- */
-
-#include <sys/types.h>
-
-#include <machine/reg.h>
-
-#include <fpu/fpu_arith.h>
-#include <fpu/fpu_emu.h>
-
-/*
- * Perform a compare instruction (with or without unordered exception).
- * This updates the fcc field in the fsr.
- *
- * If either operand is NaN, the result is unordered. For cmpe, this
- * causes an NV exception. Everything else is ordered:
- * |Inf| > |numbers| > |0|.
- * We already arranged for fp_class(Inf) > fp_class(numbers) > fp_class(0),
- * so we get this directly. Note, however, that two zeros compare equal
- * regardless of sign, while everything else depends on sign.
- *
- * Incidentally, two Infs of the same sign compare equal (per the 80387
- * manual---it would be nice if the SPARC documentation were more
- * complete).
- */
-void
-fpu_compare(struct fpemu *fe, int cmpe)
-{
- register struct fpn *a, *b;
- register int cc, r3, r2, r1, r0;
- FPU_DECL_CARRY
-
- a = &fe->fe_f1;
- b = &fe->fe_f2;
-
- if (ISNAN(a) || ISNAN(b)) {
- /*
- * In any case, we already got an exception for signalling
- * NaNs; here we may replace that one with an identical
- * exception, but so what?.
- */
- if (cmpe)
- fe->fe_cx = FSR_NV;
- cc = FSR_CC_UO;
- goto done;
- }
-
- /*
- * Must handle both-zero early to avoid sign goofs. Otherwise,
- * at most one is 0, and if the signs differ we are done.
- */
- if (ISZERO(a) && ISZERO(b)) {
- cc = FSR_CC_EQ;
- goto done;
- }
- if (a->fp_sign) { /* a < 0 (or -0) */
- if (!b->fp_sign) { /* b >= 0 (or if a = -0, b > 0) */
- cc = FSR_CC_LT;
- goto done;
- }
- } else { /* a > 0 (or +0) */
- if (b->fp_sign) { /* b <= -0 (or if a = +0, b < 0) */
- cc = FSR_CC_GT;
- goto done;
- }
- }
-
- /*
- * Now the signs are the same (but may both be negative). All
- * we have left are these cases:
- *
- * |a| < |b| [classes or values differ]
- * |a| > |b| [classes or values differ]
- * |a| == |b| [classes and values identical]
- *
- * We define `diff' here to expand these as:
- *
- * |a| < |b|, a,b >= 0: a < b => FSR_CC_LT
- * |a| < |b|, a,b < 0: a > b => FSR_CC_GT
- * |a| > |b|, a,b >= 0: a > b => FSR_CC_GT
- * |a| > |b|, a,b < 0: a < b => FSR_CC_LT
- */
-#define opposite_cc(cc) ((cc) == FSR_CC_LT ? FSR_CC_GT : FSR_CC_LT)
-#define diff(magnitude) (a->fp_sign ? opposite_cc(magnitude) : (magnitude))
- if (a->fp_class < b->fp_class) { /* |a| < |b| */
- cc = diff(FSR_CC_LT);
- goto done;
- }
- if (a->fp_class > b->fp_class) { /* |a| > |b| */
- cc = diff(FSR_CC_GT);
- goto done;
- }
- /* now none can be 0: only Inf and numbers remain */
- if (ISINF(a)) { /* |Inf| = |Inf| */
- cc = FSR_CC_EQ;
- goto done;
- }
- /*
- * Only numbers remain. To compare two numbers in magnitude, we
- * simply subtract their mantissas.
- */
- FPU_SUBS(r3, a->fp_mant[0], b->fp_mant[0]);
- FPU_SUBCS(r2, a->fp_mant[1], b->fp_mant[1]);
- FPU_SUBCS(r1, a->fp_mant[2], b->fp_mant[2]);
- FPU_SUBC(r0, a->fp_mant[3], b->fp_mant[3]);
- if (r0 < 0) /* underflow: |a| < |b| */
- cc = diff(FSR_CC_LT);
- else if ((r0 | r1 | r2 | r3) != 0) /* |a| > |b| */
- cc = diff(FSR_CC_GT);
- else
- cc = FSR_CC_EQ; /* |a| == |b| */
-done:
- fe->fe_fsr = (fe->fe_fsr & ~FSR_FCC) | (cc << FSR_FCC_SHIFT);
-}
diff --git a/sys/arch/kbus/fpu/fpu_div.c b/sys/arch/kbus/fpu/fpu_div.c
deleted file mode 100644
index da863d0c562..00000000000
--- a/sys/arch/kbus/fpu/fpu_div.c
+++ /dev/null
@@ -1,267 +0,0 @@
-/* $NetBSD: fpu_div.c,v 1.2 1994/11/20 20:52:38 deraadt Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fpu_div.c 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * Perform an FPU divide (return x / y).
- */
-
-#include <sys/types.h>
-
-#include <machine/reg.h>
-
-#include <fpu/fpu_arith.h>
-#include <fpu/fpu_emu.h>
-
-/*
- * Division of normal numbers is done as follows:
- *
- * x and y are floating point numbers, i.e., in the form 1.bbbb * 2^e.
- * If X and Y are the mantissas (1.bbbb's), the quotient is then:
- *
- * q = (X / Y) * 2^((x exponent) - (y exponent))
- *
- * Since X and Y are both in [1.0,2.0), the quotient's mantissa (X / Y)
- * will be in [0.5,2.0). Moreover, it will be less than 1.0 if and only
- * if X < Y. In that case, it will have to be shifted left one bit to
- * become a normal number, and the exponent decremented. Thus, the
- * desired exponent is:
- *
- * left_shift = x->fp_mant < y->fp_mant;
- * result_exp = x->fp_exp - y->fp_exp - left_shift;
- *
- * The quotient mantissa X/Y can then be computed one bit at a time
- * using the following algorithm:
- *
- * Q = 0; -- Initial quotient.
- * R = X; -- Initial remainder,
- * if (left_shift) -- but fixed up in advance.
- * R *= 2;
- * for (bit = FP_NMANT; --bit >= 0; R *= 2) {
- * if (R >= Y) {
- * Q |= 1 << bit;
- * R -= Y;
- * }
- * }
- *
- * The subtraction R -= Y always removes the uppermost bit from R (and
- * can sometimes remove additional lower-order 1 bits); this proof is
- * left to the reader.
- *
- * This loop correctly calculates the guard and round bits since they are
- * included in the expanded internal representation. The sticky bit
- * is to be set if and only if any other bits beyond guard and round
- * would be set. From the above it is obvious that this is true if and
- * only if the remainder R is nonzero when the loop terminates.
- *
- * Examining the loop above, we can see that the quotient Q is built
- * one bit at a time ``from the top down''. This means that we can
- * dispense with the multi-word arithmetic and just build it one word
- * at a time, writing each result word when it is done.
- *
- * Furthermore, since X and Y are both in [1.0,2.0), we know that,
- * initially, R >= Y. (Recall that, if X < Y, R is set to X * 2 and
- * is therefore at in [2.0,4.0).) Thus Q is sure to have bit FP_NMANT-1
- * set, and R can be set initially to either X - Y (when X >= Y) or
- * 2X - Y (when X < Y). In addition, comparing R and Y is difficult,
- * so we will simply calculate R - Y and see if that underflows.
- * This leads to the following revised version of the algorithm:
- *
- * R = X;
- * bit = FP_1;
- * D = R - Y;
- * if (D >= 0) {
- * result_exp = x->fp_exp - y->fp_exp;
- * R = D;
- * q = bit;
- * bit >>= 1;
- * } else {
- * result_exp = x->fp_exp - y->fp_exp - 1;
- * q = 0;
- * }
- * R <<= 1;
- * do {
- * D = R - Y;
- * if (D >= 0) {
- * q |= bit;
- * R = D;
- * }
- * R <<= 1;
- * } while ((bit >>= 1) != 0);
- * Q[0] = q;
- * for (i = 1; i < 4; i++) {
- * q = 0, bit = 1 << 31;
- * do {
- * D = R - Y;
- * if (D >= 0) {
- * q |= bit;
- * R = D;
- * }
- * R <<= 1;
- * } while ((bit >>= 1) != 0);
- * Q[i] = q;
- * }
- *
- * This can be refined just a bit further by moving the `R <<= 1'
- * calculations to the front of the do-loops and eliding the first one.
- * The process can be terminated immediately whenever R becomes 0, but
- * this is relatively rare, and we do not bother.
- */
-
-struct fpn *
-fpu_div(fe)
- register struct fpemu *fe;
-{
- register struct fpn *x = &fe->fe_f1, *y = &fe->fe_f2;
- register u_int q, bit;
- register u_int r0, r1, r2, r3, d0, d1, d2, d3, y0, y1, y2, y3;
- FPU_DECL_CARRY
-
- /*
- * Since divide is not commutative, we cannot just use ORDER.
- * Check either operand for NaN first; if there is at least one,
- * order the signalling one (if only one) onto the right, then
- * return it. Otherwise we have the following cases:
- *
- * Inf / Inf = NaN, plus NV exception
- * Inf / num = Inf [i.e., return x]
- * Inf / 0 = Inf [i.e., return x]
- * 0 / Inf = 0 [i.e., return x]
- * 0 / num = 0 [i.e., return x]
- * 0 / 0 = NaN, plus NV exception
- * num / Inf = 0
- * num / num = num (do the divide)
- * num / 0 = Inf, plus DZ exception
- */
- if (ISNAN(x) || ISNAN(y)) {
- ORDER(x, y);
- return (y);
- }
- if (ISINF(x) || ISZERO(x)) {
- if (x->fp_class == y->fp_class)
- return (fpu_newnan(fe));
- return (x);
- }
-
- /* all results at this point use XOR of operand signs */
- x->fp_sign ^= y->fp_sign;
- if (ISINF(y)) {
- x->fp_class = FPC_ZERO;
- return (x);
- }
- if (ISZERO(y)) {
- fe->fe_cx = FSR_DZ;
- x->fp_class = FPC_INF;
- return (x);
- }
-
- /*
- * Macros for the divide. See comments at top for algorithm.
- * Note that we expand R, D, and Y here.
- */
-
-#define SUBTRACT /* D = R - Y */ \
- FPU_SUBS(d3, r3, y3); FPU_SUBCS(d2, r2, y2); \
- FPU_SUBCS(d1, r1, y1); FPU_SUBC(d0, r0, y0)
-
-#define NONNEGATIVE /* D >= 0 */ \
- ((int)d0 >= 0)
-
-#ifdef FPU_SHL1_BY_ADD
-#define SHL1 /* R <<= 1 */ \
- FPU_ADDS(r3, r3, r3); FPU_ADDCS(r2, r2, r2); \
- FPU_ADDCS(r1, r1, r1); FPU_ADDC(r0, r0, r0)
-#else
-#define SHL1 \
- r0 = (r0 << 1) | (r1 >> 31), r1 = (r1 << 1) | (r2 >> 31), \
- r2 = (r2 << 1) | (r3 >> 31), r3 <<= 1
-#endif
-
-#define LOOP /* do ... while (bit >>= 1) */ \
- do { \
- SHL1; \
- SUBTRACT; \
- if (NONNEGATIVE) { \
- q |= bit; \
- r0 = d0, r1 = d1, r2 = d2, r3 = d3; \
- } \
- } while ((bit >>= 1) != 0)
-
-#define WORD(r, i) /* calculate r->fp_mant[i] */ \
- q = 0; \
- bit = 1 << 31; \
- LOOP; \
- (x)->fp_mant[i] = q
-
- /* Setup. Note that we put our result in x. */
- r0 = x->fp_mant[0];
- r1 = x->fp_mant[1];
- r2 = x->fp_mant[2];
- r3 = x->fp_mant[3];
- y0 = y->fp_mant[0];
- y1 = y->fp_mant[1];
- y2 = y->fp_mant[2];
- y3 = y->fp_mant[3];
-
- bit = FP_1;
- SUBTRACT;
- if (NONNEGATIVE) {
- x->fp_exp -= y->fp_exp;
- r0 = d0, r1 = d1, r2 = d2, r3 = d3;
- q = bit;
- bit >>= 1;
- } else {
- x->fp_exp -= y->fp_exp + 1;
- q = 0;
- }
- LOOP;
- x->fp_mant[0] = q;
- WORD(x, 1);
- WORD(x, 2);
- WORD(x, 3);
- x->fp_sticky = r0 | r1 | r2 | r3;
-
- return (x);
-}
diff --git a/sys/arch/kbus/fpu/fpu_emu.h b/sys/arch/kbus/fpu/fpu_emu.h
deleted file mode 100644
index 5b2b317c383..00000000000
--- a/sys/arch/kbus/fpu/fpu_emu.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/* $NetBSD: fpu_emu.h,v 1.2 1994/11/20 20:52:39 deraadt Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fpu_emu.h 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * Floating point emulator (tailored for SPARC, but structurally
- * machine-independent).
- *
- * Floating point numbers are carried around internally in an `expanded'
- * or `unpacked' form consisting of:
- * - sign
- * - unbiased exponent
- * - mantissa (`1.' + 112-bit fraction + guard + round)
- * - sticky bit
- * Any implied `1' bit is inserted, giving a 113-bit mantissa that is
- * always nonzero. Additional low-order `guard' and `round' bits are
- * scrunched in, making the entire mantissa 115 bits long. This is divided
- * into four 32-bit words, with `spare' bits left over in the upper part
- * of the top word (the high bits of fp_mant[0]). An internal `exploded'
- * number is thus kept within the half-open interval [1.0,2.0) (but see
- * the `number classes' below). This holds even for denormalized numbers:
- * when we explode an external denorm, we normalize it, introducing low-order
- * zero bits, so that the rest of the code always sees normalized values.
- *
- * Note that a number of our algorithms use the `spare' bits at the top.
- * The most demanding algorithm---the one for sqrt---depends on two such
- * bits, so that it can represent values up to (but not including) 8.0,
- * and then it needs a carry on top of that, so that we need three `spares'.
- *
- * The sticky-word is 32 bits so that we can use `OR' operators to goosh
- * whole words from the mantissa into it.
- *
- * All operations are done in this internal extended precision. According
- * to Hennesey & Patterson, Appendix A, rounding can be repeated---that is,
- * it is OK to do a+b in extended precision and then round the result to
- * single precision---provided single, double, and extended precisions are
- * `far enough apart' (they always are), but we will try to avoid any such
- * extra work where possible.
- */
-struct fpn {
- int fp_class; /* see below */
- int fp_sign; /* 0 => positive, 1 => negative */
- int fp_exp; /* exponent (unbiased) */
- int fp_sticky; /* nonzero bits lost at right end */
- u_int fp_mant[4]; /* 115-bit mantissa */
-};
-
-#define FP_NMANT 115 /* total bits in mantissa (incl g,r) */
-#define FP_NG 2 /* number of low-order guard bits */
-#define FP_LG ((FP_NMANT - 1) & 31) /* log2(1.0) for fp_mant[0] */
-#define FP_QUIETBIT (1 << (FP_LG - 1)) /* Quiet bit in NaNs (0.5) */
-#define FP_1 (1 << FP_LG) /* 1.0 in fp_mant[0] */
-#define FP_2 (1 << (FP_LG + 1)) /* 2.0 in fp_mant[0] */
-
-/*
- * Number classes. Since zero, Inf, and NaN cannot be represented using
- * the above layout, we distinguish these from other numbers via a class.
- * In addition, to make computation easier and to follow Appendix N of
- * the SPARC Version 8 standard, we give each kind of NaN a separate class.
- */
-#define FPC_SNAN -2 /* signalling NaN (sign irrelevant) */
-#define FPC_QNAN -1 /* quiet NaN (sign irrelevant) */
-#define FPC_ZERO 0 /* zero (sign matters) */
-#define FPC_NUM 1 /* number (sign matters) */
-#define FPC_INF 2 /* infinity (sign matters) */
-
-#define ISNAN(fp) ((fp)->fp_class < 0)
-#define ISZERO(fp) ((fp)->fp_class == 0)
-#define ISINF(fp) ((fp)->fp_class == FPC_INF)
-
-/*
- * ORDER(x,y) `sorts' a pair of `fpn *'s so that the right operand (y) points
- * to the `more significant' operand for our purposes. Appendix N says that
- * the result of a computation involving two numbers are:
- *
- * If both are SNaN: operand 2, converted to Quiet
- * If only one is SNaN: the SNaN operand, converted to Quiet
- * If both are QNaN: operand 2
- * If only one is QNaN: the QNaN operand
- *
- * In addition, in operations with an Inf operand, the result is usually
- * Inf. The class numbers are carefully arranged so that if
- * (unsigned)class(op1) > (unsigned)class(op2)
- * then op1 is the one we want; otherwise op2 is the one we want.
- */
-#define ORDER(x, y) { \
- if ((u_int)(x)->fp_class > (u_int)(y)->fp_class) \
- SWAP(x, y); \
-}
-#define SWAP(x, y) { \
- register struct fpn *swap; \
- swap = (x), (x) = (y), (y) = swap; \
-}
-
-/*
- * Emulator state.
- */
-struct fpemu {
- struct fpstate *fe_fpstate; /* registers, etc */
- int fe_fsr; /* fsr copy (modified during op) */
- int fe_cx; /* exceptions */
- struct fpn fe_f1; /* operand 1 */
- struct fpn fe_f2; /* operand 2, if required */
- struct fpn fe_f3; /* available storage for result */
-};
-
-/*
- * Arithmetic functions.
- * Each of these may modify its inputs (f1,f2) and/or the temporary.
- * Each returns a pointer to the result and/or sets exceptions.
- */
-struct fpn *fpu_add(struct fpemu *);
-#define fpu_sub(fe) ((fe)->fe_f2.fp_sign ^= 1, fpu_add(fe))
-struct fpn *fpu_mul(struct fpemu *);
-struct fpn *fpu_div(struct fpemu *);
-struct fpn *fpu_sqrt(struct fpemu *);
-
-/*
- * Other functions.
- */
-
-/* Perform a compare instruction (with or without unordered exception). */
-void fpu_compare(struct fpemu *, int);
-
-/* Build a new Quiet NaN (sign=0, frac=all 1's). */
-struct fpn *fpu_newnan(struct fpemu *);
-
-/*
- * Shift a number right some number of bits, taking care of round/sticky.
- * Note that the result is probably not a well-formed number (it will lack
- * the normal 1-bit mant[0]&FP_1).
- */
-int fpu_shr(struct fpn *, int);
-
-/* Conversion to and from internal format -- note asymmetry. */
-int fpu_itofpn(struct fpn *, u_int);
-int fpu_stofpn(struct fpn *, u_int);
-int fpu_dtofpn(struct fpn *, u_int, u_int);
-int fpu_xtofpn(struct fpn *, u_int, u_int, u_int, u_int);
-
-u_int fpu_fpntoi(struct fpemu *, struct fpn *);
-u_int fpu_fpntos(struct fpemu *, struct fpn *);
-u_int fpu_fpntod(struct fpemu *, struct fpn *);
-u_int fpu_fpntox(struct fpemu *, struct fpn *);
-
-void fpu_explode(struct fpemu *, struct fpn *, int, int);
-void fpu_implode(struct fpemu *, struct fpn *, int, u_int *);
diff --git a/sys/arch/kbus/fpu/fpu_explode.c b/sys/arch/kbus/fpu/fpu_explode.c
deleted file mode 100644
index 158aa1207da..00000000000
--- a/sys/arch/kbus/fpu/fpu_explode.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/* $NetBSD: fpu_explode.c,v 1.3 1996/03/14 19:41:54 christos Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fpu_explode.c 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * FPU subroutines: `explode' the machine's `packed binary' format numbers
- * into our internal format.
- */
-
-#include <sys/types.h>
-#include <sys/systm.h>
-
-#include <machine/ieee.h>
-#include <machine/instr.h>
-#include <machine/reg.h>
-
-#include <fpu/fpu_arith.h>
-#include <fpu/fpu_emu.h>
-#include <fpu/fpu_extern.h>
-
-/*
- * N.B.: in all of the following, we assume the FP format is
- *
- * ---------------------------
- * | s | exponent | fraction |
- * ---------------------------
- *
- * (which represents -1**s * 1.fraction * 2**exponent), so that the
- * sign bit is way at the top (bit 31), the exponent is next, and
- * then the remaining bits mark the fraction. A zero exponent means
- * zero or denormalized (0.fraction rather than 1.fraction), and the
- * maximum possible exponent, 2bias+1, signals inf (fraction==0) or NaN.
- *
- * Since the sign bit is always the topmost bit---this holds even for
- * integers---we set that outside all the *tof functions. Each function
- * returns the class code for the new number (but note that we use
- * FPC_QNAN for all NaNs; fpu_explode will fix this if appropriate).
- */
-
-/*
- * int -> fpn.
- */
-int
-fpu_itof(fp, i)
- register struct fpn *fp;
- register u_int i;
-{
-
- if (i == 0)
- return (FPC_ZERO);
- /*
- * The value FP_1 represents 2^FP_LG, so set the exponent
- * there and let normalization fix it up. Convert negative
- * numbers to sign-and-magnitude. Note that this relies on
- * fpu_norm()'s handling of `supernormals'; see fpu_subr.c.
- */
- fp->fp_exp = FP_LG;
- fp->fp_mant[0] = (int)i < 0 ? -i : i;
- fp->fp_mant[1] = 0;
- fp->fp_mant[2] = 0;
- fp->fp_mant[3] = 0;
- fpu_norm(fp);
- return (FPC_NUM);
-}
-
-#define mask(nbits) ((1 << (nbits)) - 1)
-
-/*
- * All external floating formats convert to internal in the same manner,
- * as defined here. Note that only normals get an implied 1.0 inserted.
- */
-#define FP_TOF(exp, expbias, allfrac, f0, f1, f2, f3) \
- if (exp == 0) { \
- if (allfrac == 0) \
- return (FPC_ZERO); \
- fp->fp_exp = 1 - expbias; \
- fp->fp_mant[0] = f0; \
- fp->fp_mant[1] = f1; \
- fp->fp_mant[2] = f2; \
- fp->fp_mant[3] = f3; \
- fpu_norm(fp); \
- return (FPC_NUM); \
- } \
- if (exp == (2 * expbias + 1)) { \
- if (allfrac == 0) \
- return (FPC_INF); \
- fp->fp_mant[0] = f0; \
- fp->fp_mant[1] = f1; \
- fp->fp_mant[2] = f2; \
- fp->fp_mant[3] = f3; \
- return (FPC_QNAN); \
- } \
- fp->fp_exp = exp - expbias; \
- fp->fp_mant[0] = FP_1 | f0; \
- fp->fp_mant[1] = f1; \
- fp->fp_mant[2] = f2; \
- fp->fp_mant[3] = f3; \
- return (FPC_NUM)
-
-/*
- * 32-bit single precision -> fpn.
- * We assume a single occupies at most (64-FP_LG) bits in the internal
- * format: i.e., needs at most fp_mant[0] and fp_mant[1].
- */
-int
-fpu_stof(fp, i)
- register struct fpn *fp;
- register u_int i;
-{
- register int exp;
- register u_int frac, f0, f1;
-#define SNG_SHIFT (SNG_FRACBITS - FP_LG)
-
- exp = (i >> (32 - 1 - SNG_EXPBITS)) & mask(SNG_EXPBITS);
- frac = i & mask(SNG_FRACBITS);
- f0 = frac >> SNG_SHIFT;
- f1 = frac << (32 - SNG_SHIFT);
- FP_TOF(exp, SNG_EXP_BIAS, frac, f0, f1, 0, 0);
-}
-
-/*
- * 64-bit double -> fpn.
- * We assume this uses at most (96-FP_LG) bits.
- */
-int
-fpu_dtof(fp, i, j)
- register struct fpn *fp;
- register u_int i, j;
-{
- register int exp;
- register u_int frac, f0, f1, f2;
-#define DBL_SHIFT (DBL_FRACBITS - 32 - FP_LG)
-
- exp = (i >> (32 - 1 - DBL_EXPBITS)) & mask(DBL_EXPBITS);
- frac = i & mask(DBL_FRACBITS - 32);
- f0 = frac >> DBL_SHIFT;
- f1 = (frac << (32 - DBL_SHIFT)) | (j >> DBL_SHIFT);
- f2 = j << (32 - DBL_SHIFT);
- frac |= j;
- FP_TOF(exp, DBL_EXP_BIAS, frac, f0, f1, f2, 0);
-}
-
-/*
- * 128-bit extended -> fpn.
- */
-int
-fpu_xtof(fp, i, j, k, l)
- register struct fpn *fp;
- register u_int i, j, k, l;
-{
- register int exp;
- register u_int frac, f0, f1, f2, f3;
-#define EXT_SHIFT (-(EXT_FRACBITS - 3 * 32 - FP_LG)) /* left shift! */
-
- /*
- * Note that ext and fpn `line up', hence no shifting needed.
- */
- exp = (i >> (32 - 1 - EXT_EXPBITS)) & mask(EXT_EXPBITS);
- frac = i & mask(EXT_FRACBITS - 3 * 32);
- f0 = (frac << EXT_SHIFT) | (j >> (32 - EXT_SHIFT));
- f1 = (j << EXT_SHIFT) | (k >> (32 - EXT_SHIFT));
- f2 = (k << EXT_SHIFT) | (l >> (32 - EXT_SHIFT));
- f3 = l << EXT_SHIFT;
- frac |= j | k | l;
- FP_TOF(exp, EXT_EXP_BIAS, frac, f0, f1, f2, f3);
-}
-
-/*
- * Explode the contents of a register / regpair / regquad.
- * If the input is a signalling NaN, an NV (invalid) exception
- * will be set. (Note that nothing but NV can occur until ALU
- * operations are performed.)
- */
-void
-fpu_explode(fe, fp, type, reg)
- register struct fpemu *fe;
- register struct fpn *fp;
- int type, reg;
-{
- register u_int s, *space;
-
- space = &fe->fe_fpstate->fs_regs[reg];
- s = space[0];
- fp->fp_sign = s >> 31;
- fp->fp_sticky = 0;
- switch (type) {
-
- case FTYPE_INT:
- s = fpu_itof(fp, s);
- break;
-
- case FTYPE_SNG:
- s = fpu_stof(fp, s);
- break;
-
- case FTYPE_DBL:
- s = fpu_dtof(fp, s, space[1]);
- break;
-
- case FTYPE_EXT:
- s = fpu_xtof(fp, s, space[1], space[2], space[3]);
- break;
-
- default:
- panic("fpu_explode");
- }
- if (s == FPC_QNAN && (fp->fp_mant[0] & FP_QUIETBIT) == 0) {
- /*
- * Input is a signalling NaN. All operations that return
- * an input NaN operand put it through a ``NaN conversion'',
- * which basically just means ``turn on the quiet bit''.
- * We do this here so that all NaNs internally look quiet
- * (we can tell signalling ones by their class).
- */
- fp->fp_mant[0] |= FP_QUIETBIT;
- fe->fe_cx = FSR_NV; /* assert invalid operand */
- s = FPC_SNAN;
- }
- fp->fp_class = s;
-}
diff --git a/sys/arch/kbus/fpu/fpu_extern.h b/sys/arch/kbus/fpu/fpu_extern.h
deleted file mode 100644
index 0f2ed79668d..00000000000
--- a/sys/arch/kbus/fpu/fpu_extern.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* $NetBSD: fpu_extern.h,v 1.1 1996/03/14 19:41:56 christos Exp $ */
-
-/*
- * Copyright (c) 1995 Christos Zoulas. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christos Zoulas.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-struct proc;
-struct fpstate;
-struct trapframe;
-union instr;
-struct fpemu;
-struct fpn;
-
-/* fpu.c */
-void fpu_cleanup __P((struct proc *, struct fpstate *));
-int fpu_emulate __P((struct proc *, struct trapframe *, struct fpstate *));
-int fpu_execute __P((struct fpemu *, union instr));
-
-/* fpu_add.c */
-struct fpn *fpu_add __P((struct fpemu *));
-
-/* fpu_compare.c */
-void fpu_compare __P((struct fpemu *, int));
-
-/* fpu_div.c */
-struct fpn *fpu_div __P((struct fpemu *));
-
-/* fpu_explode.c */
-int fpu_itof __P((struct fpn *, u_int));
-int fpu_stof __P((struct fpn *, u_int));
-int fpu_dtof __P((struct fpn *, u_int, u_int ));
-int fpu_xtof __P((struct fpn *, u_int, u_int , u_int , u_int ));
-void fpu_explode __P((struct fpemu *, struct fpn *, int, int ));
-
-/* fpu_implode.c */
-u_int fpu_ftoi __P((struct fpemu *, struct fpn *));
-u_int fpu_ftos __P((struct fpemu *, struct fpn *));
-u_int fpu_ftod __P((struct fpemu *, struct fpn *, u_int *));
-u_int fpu_ftox __P((struct fpemu *, struct fpn *, u_int *));
-void fpu_implode __P((struct fpemu *, struct fpn *, int, u_int *));
-
-/* fpu_mul.c */
-struct fpn *fpu_mul __P((struct fpemu *));
-
-/* fpu_sqrt.c */
-struct fpn *fpu_sqrt __P((struct fpemu *));
-
-/* fpu_subr.c */
-int fpu_shr __P((register struct fpn *, register int));
-void fpu_norm __P((register struct fpn *));
-struct fpn *fpu_newnan __P((register struct fpemu *));
diff --git a/sys/arch/kbus/fpu/fpu_implode.c b/sys/arch/kbus/fpu/fpu_implode.c
deleted file mode 100644
index ce101fccc20..00000000000
--- a/sys/arch/kbus/fpu/fpu_implode.c
+++ /dev/null
@@ -1,480 +0,0 @@
-/* $NetBSD: fpu_implode.c,v 1.3 1996/03/14 19:41:59 christos Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fpu_implode.c 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * FPU subroutines: `implode' internal format numbers into the machine's
- * `packed binary' format.
- */
-
-#include <sys/types.h>
-#include <sys/systm.h>
-
-#include <machine/ieee.h>
-#include <machine/instr.h>
-#include <machine/reg.h>
-
-#include <fpu/fpu_arith.h>
-#include <fpu/fpu_emu.h>
-#include <fpu/fpu_extern.h>
-
-static int round __P((register struct fpemu *, register struct fpn *));
-static int toinf __P((struct fpemu *, int));
-
-/*
- * Round a number (algorithm from Motorola MC68882 manual, modified for
- * our internal format). Set inexact exception if rounding is required.
- * Return true iff we rounded up.
- *
- * After rounding, we discard the guard and round bits by shifting right
- * 2 bits (a la fpu_shr(), but we do not bother with fp->fp_sticky).
- * This saves effort later.
- *
- * Note that we may leave the value 2.0 in fp->fp_mant; it is the caller's
- * responsibility to fix this if necessary.
- */
-static int
-round(register struct fpemu *fe, register struct fpn *fp)
-{
- register u_int m0, m1, m2, m3;
- register int gr, s;
-
- m0 = fp->fp_mant[0];
- m1 = fp->fp_mant[1];
- m2 = fp->fp_mant[2];
- m3 = fp->fp_mant[3];
- gr = m3 & 3;
- s = fp->fp_sticky;
-
- /* mant >>= FP_NG */
- m3 = (m3 >> FP_NG) | (m2 << (32 - FP_NG));
- m2 = (m2 >> FP_NG) | (m1 << (32 - FP_NG));
- m1 = (m1 >> FP_NG) | (m0 << (32 - FP_NG));
- m0 >>= FP_NG;
-
- if ((gr | s) == 0) /* result is exact: no rounding needed */
- goto rounddown;
-
- fe->fe_cx |= FSR_NX; /* inexact */
-
- /* Go to rounddown to round down; break to round up. */
- switch ((fe->fe_fsr >> FSR_RD_SHIFT) & FSR_RD_MASK) {
-
- case FSR_RD_RN:
- default:
- /*
- * Round only if guard is set (gr & 2). If guard is set,
- * but round & sticky both clear, then we want to round
- * but have a tie, so round to even, i.e., add 1 iff odd.
- */
- if ((gr & 2) == 0)
- goto rounddown;
- if ((gr & 1) || fp->fp_sticky || (m3 & 1))
- break;
- goto rounddown;
-
- case FSR_RD_RZ:
- /* Round towards zero, i.e., down. */
- goto rounddown;
-
- case FSR_RD_RM:
- /* Round towards -Inf: up if negative, down if positive. */
- if (fp->fp_sign)
- break;
- goto rounddown;
-
- case FSR_RD_RP:
- /* Round towards +Inf: up if positive, down otherwise. */
- if (!fp->fp_sign)
- break;
- goto rounddown;
- }
-
- /* Bump low bit of mantissa, with carry. */
-#ifdef sparc /* ``cheating'' (left out FPU_DECL_CARRY; know this is faster) */
- FPU_ADDS(m3, m3, 1);
- FPU_ADDCS(m2, m2, 0);
- FPU_ADDCS(m1, m1, 0);
- FPU_ADDC(m0, m0, 0);
-#else
- if (++m3 == 0 && ++m2 == 0 && ++m1 == 0)
- m0++;
-#endif
- fp->fp_mant[0] = m0;
- fp->fp_mant[1] = m1;
- fp->fp_mant[2] = m2;
- fp->fp_mant[3] = m3;
- return (1);
-
-rounddown:
- fp->fp_mant[0] = m0;
- fp->fp_mant[1] = m1;
- fp->fp_mant[2] = m2;
- fp->fp_mant[3] = m3;
- return (0);
-}
-
-/*
- * For overflow: return true if overflow is to go to +/-Inf, according
- * to the sign of the overflowing result. If false, overflow is to go
- * to the largest magnitude value instead.
- */
-static int
-toinf(struct fpemu *fe, int sign)
-{
- int inf;
-
- /* look at rounding direction */
- switch ((fe->fe_fsr >> FSR_RD_SHIFT) & FSR_RD_MASK) {
-
- default:
- case FSR_RD_RN: /* the nearest value is always Inf */
- inf = 1;
- break;
-
- case FSR_RD_RZ: /* toward 0 => never towards Inf */
- inf = 0;
- break;
-
- case FSR_RD_RP: /* toward +Inf iff positive */
- inf = sign == 0;
- break;
-
- case FSR_RD_RM: /* toward -Inf iff negative */
- inf = sign;
- break;
- }
- return (inf);
-}
-
-/*
- * fpn -> int (int value returned as return value).
- *
- * N.B.: this conversion always rounds towards zero (this is a peculiarity
- * of the SPARC instruction set).
- */
-u_int
-fpu_ftoi(fe, fp)
- struct fpemu *fe;
- register struct fpn *fp;
-{
- register u_int i;
- register int sign, exp;
-
- sign = fp->fp_sign;
- switch (fp->fp_class) {
-
- case FPC_ZERO:
- return (0);
-
- case FPC_NUM:
- /*
- * If exp >= 2^32, overflow. Otherwise shift value right
- * into last mantissa word (this will not exceed 0xffffffff),
- * shifting any guard and round bits out into the sticky
- * bit. Then ``round'' towards zero, i.e., just set an
- * inexact exception if sticky is set (see round()).
- * If the result is > 0x80000000, or is positive and equals
- * 0x80000000, overflow; otherwise the last fraction word
- * is the result.
- */
- if ((exp = fp->fp_exp) >= 32)
- break;
- /* NB: the following includes exp < 0 cases */
- if (fpu_shr(fp, FP_NMANT - 1 - exp) != 0)
- fe->fe_cx |= FSR_NX;
- i = fp->fp_mant[3];
- if (i >= ((u_int)0x80000000 + sign))
- break;
- return (sign ? -i : i);
-
- default: /* Inf, qNaN, sNaN */
- break;
- }
- /* overflow: replace any inexact exception with invalid */
- fe->fe_cx = (fe->fe_cx & ~FSR_NX) | FSR_NV;
- return (0x7fffffff + sign);
-}
-
-/*
- * fpn -> single (32 bit single returned as return value).
- * We assume <= 29 bits in a single-precision fraction (1.f part).
- */
-u_int
-fpu_ftos(fe, fp)
- struct fpemu *fe;
- register struct fpn *fp;
-{
- register u_int sign = fp->fp_sign << 31;
- register int exp;
-
-#define SNG_EXP(e) ((e) << SNG_FRACBITS) /* makes e an exponent */
-#define SNG_MASK (SNG_EXP(1) - 1) /* mask for fraction */
-
- /* Take care of non-numbers first. */
- if (ISNAN(fp)) {
- /*
- * Preserve upper bits of NaN, per SPARC V8 appendix N.
- * Note that fp->fp_mant[0] has the quiet bit set,
- * even if it is classified as a signalling NaN.
- */
- (void) fpu_shr(fp, FP_NMANT - 1 - SNG_FRACBITS);
- exp = SNG_EXP_INFNAN;
- goto done;
- }
- if (ISINF(fp))
- return (sign | SNG_EXP(SNG_EXP_INFNAN));
- if (ISZERO(fp))
- return (sign);
-
- /*
- * Normals (including subnormals). Drop all the fraction bits
- * (including the explicit ``implied'' 1 bit) down into the
- * single-precision range. If the number is subnormal, move
- * the ``implied'' 1 into the explicit range as well, and shift
- * right to introduce leading zeroes. Rounding then acts
- * differently for normals and subnormals: the largest subnormal
- * may round to the smallest normal (1.0 x 2^minexp), or may
- * remain subnormal. In the latter case, signal an underflow
- * if the result was inexact or if underflow traps are enabled.
- *
- * Rounding a normal, on the other hand, always produces another
- * normal (although either way the result might be too big for
- * single precision, and cause an overflow). If rounding a
- * normal produces 2.0 in the fraction, we need not adjust that
- * fraction at all, since both 1.0 and 2.0 are zero under the
- * fraction mask.
- *
- * Note that the guard and round bits vanish from the number after
- * rounding.
- */
- if ((exp = fp->fp_exp + SNG_EXP_BIAS) <= 0) { /* subnormal */
- /* -NG for g,r; -SNG_FRACBITS-exp for fraction */
- (void) fpu_shr(fp, FP_NMANT - FP_NG - SNG_FRACBITS - exp);
- if (round(fe, fp) && fp->fp_mant[3] == SNG_EXP(1))
- return (sign | SNG_EXP(1) | 0);
- if ((fe->fe_cx & FSR_NX) ||
- (fe->fe_fsr & (FSR_UF << FSR_TEM_SHIFT)))
- fe->fe_cx |= FSR_UF;
- return (sign | SNG_EXP(0) | fp->fp_mant[3]);
- }
- /* -FP_NG for g,r; -1 for implied 1; -SNG_FRACBITS for fraction */
- (void) fpu_shr(fp, FP_NMANT - FP_NG - 1 - SNG_FRACBITS);
-#ifdef DIAGNOSTIC
- if ((fp->fp_mant[3] & SNG_EXP(1 << FP_NG)) == 0)
- panic("fpu_ftos");
-#endif
- if (round(fe, fp) && fp->fp_mant[3] == SNG_EXP(2))
- exp++;
- if (exp >= SNG_EXP_INFNAN) {
- /* overflow to inf or to max single */
- fe->fe_cx |= FSR_OF | FSR_NX;
- if (toinf(fe, sign))
- return (sign | SNG_EXP(SNG_EXP_INFNAN));
- return (sign | SNG_EXP(SNG_EXP_INFNAN - 1) | SNG_MASK);
- }
-done:
- /* phew, made it */
- return (sign | SNG_EXP(exp) | (fp->fp_mant[3] & SNG_MASK));
-}
-
-/*
- * fpn -> double (32 bit high-order result returned; 32-bit low order result
- * left in res[1]). Assumes <= 61 bits in double precision fraction.
- *
- * This code mimics fpu_ftos; see it for comments.
- */
-u_int
-fpu_ftod(fe, fp, res)
- struct fpemu *fe;
- register struct fpn *fp;
- u_int *res;
-{
- register u_int sign = fp->fp_sign << 31;
- register int exp;
-
-#define DBL_EXP(e) ((e) << (DBL_FRACBITS & 31))
-#define DBL_MASK (DBL_EXP(1) - 1)
-
- if (ISNAN(fp)) {
- (void) fpu_shr(fp, FP_NMANT - 1 - DBL_FRACBITS);
- exp = DBL_EXP_INFNAN;
- goto done;
- }
- if (ISINF(fp)) {
- sign |= DBL_EXP(DBL_EXP_INFNAN);
- goto zero;
- }
- if (ISZERO(fp)) {
-zero: res[1] = 0;
- return (sign);
- }
-
- if ((exp = fp->fp_exp + DBL_EXP_BIAS) <= 0) {
- (void) fpu_shr(fp, FP_NMANT - FP_NG - DBL_FRACBITS - exp);
- if (round(fe, fp) && fp->fp_mant[2] == DBL_EXP(1)) {
- res[1] = 0;
- return (sign | DBL_EXP(1) | 0);
- }
- if ((fe->fe_cx & FSR_NX) ||
- (fe->fe_fsr & (FSR_UF << FSR_TEM_SHIFT)))
- fe->fe_cx |= FSR_UF;
- exp = 0;
- goto done;
- }
- (void) fpu_shr(fp, FP_NMANT - FP_NG - 1 - DBL_FRACBITS);
- if (round(fe, fp) && fp->fp_mant[2] == DBL_EXP(2))
- exp++;
- if (exp >= DBL_EXP_INFNAN) {
- fe->fe_cx |= FSR_OF | FSR_NX;
- if (toinf(fe, sign)) {
- res[1] = 0;
- return (sign | DBL_EXP(DBL_EXP_INFNAN) | 0);
- }
- res[1] = ~0;
- return (sign | DBL_EXP(DBL_EXP_INFNAN) | DBL_MASK);
- }
-done:
- res[1] = fp->fp_mant[3];
- return (sign | DBL_EXP(exp) | (fp->fp_mant[2] & DBL_MASK));
-}
-
-/*
- * fpn -> extended (32 bit high-order result returned; low-order fraction
- * words left in res[1]..res[3]). Like ftod, which is like ftos ... but
- * our internal format *is* extended precision, plus 2 bits for guard/round,
- * so we can avoid a small bit of work.
- */
-u_int
-fpu_ftox(fe, fp, res)
- struct fpemu *fe;
- register struct fpn *fp;
- u_int *res;
-{
- register u_int sign = fp->fp_sign << 31;
- register int exp;
-
-#define EXT_EXP(e) ((e) << (EXT_FRACBITS & 31))
-#define EXT_MASK (EXT_EXP(1) - 1)
-
- if (ISNAN(fp)) {
- (void) fpu_shr(fp, 2); /* since we are not rounding */
- exp = EXT_EXP_INFNAN;
- goto done;
- }
- if (ISINF(fp)) {
- sign |= EXT_EXP(EXT_EXP_INFNAN);
- goto zero;
- }
- if (ISZERO(fp)) {
-zero: res[1] = res[2] = res[3] = 0;
- return (sign);
- }
-
- if ((exp = fp->fp_exp + EXT_EXP_BIAS) <= 0) {
- (void) fpu_shr(fp, FP_NMANT - FP_NG - EXT_FRACBITS - exp);
- if (round(fe, fp) && fp->fp_mant[0] == EXT_EXP(1)) {
- res[1] = res[2] = res[3] = 0;
- return (sign | EXT_EXP(1) | 0);
- }
- if ((fe->fe_cx & FSR_NX) ||
- (fe->fe_fsr & (FSR_UF << FSR_TEM_SHIFT)))
- fe->fe_cx |= FSR_UF;
- exp = 0;
- goto done;
- }
- /* Since internal == extended, no need to shift here. */
- if (round(fe, fp) && fp->fp_mant[0] == EXT_EXP(2))
- exp++;
- if (exp >= EXT_EXP_INFNAN) {
- fe->fe_cx |= FSR_OF | FSR_NX;
- if (toinf(fe, sign)) {
- res[1] = res[2] = res[3] = 0;
- return (sign | EXT_EXP(EXT_EXP_INFNAN) | 0);
- }
- res[1] = res[2] = res[3] = ~0;
- return (sign | EXT_EXP(EXT_EXP_INFNAN) | EXT_MASK);
- }
-done:
- res[1] = fp->fp_mant[1];
- res[2] = fp->fp_mant[2];
- res[3] = fp->fp_mant[3];
- return (sign | EXT_EXP(exp) | (fp->fp_mant[0] & EXT_MASK));
-}
-
-/*
- * Implode an fpn, writing the result into the given space.
- */
-void
-fpu_implode(fe, fp, type, space)
- struct fpemu *fe;
- register struct fpn *fp;
- int type;
- register u_int *space;
-{
-
- switch (type) {
-
- case FTYPE_INT:
- space[0] = fpu_ftoi(fe, fp);
- break;
-
- case FTYPE_SNG:
- space[0] = fpu_ftos(fe, fp);
- break;
-
- case FTYPE_DBL:
- space[0] = fpu_ftod(fe, fp, space);
- break;
-
- case FTYPE_EXT:
- /* funky rounding precision options ?? */
- space[0] = fpu_ftox(fe, fp, space);
- break;
-
- default:
- panic("fpu_implode");
- }
-}
diff --git a/sys/arch/kbus/fpu/fpu_mul.c b/sys/arch/kbus/fpu/fpu_mul.c
deleted file mode 100644
index a607b92bdae..00000000000
--- a/sys/arch/kbus/fpu/fpu_mul.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/* $NetBSD: fpu_mul.c,v 1.2 1994/11/20 20:52:44 deraadt Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fpu_mul.c 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * Perform an FPU multiply (return x * y).
- */
-
-#include <sys/types.h>
-
-#include <machine/reg.h>
-
-#include <fpu/fpu_arith.h>
-#include <fpu/fpu_emu.h>
-
-/*
- * The multiplication algorithm for normal numbers is as follows:
- *
- * The fraction of the product is built in the usual stepwise fashion.
- * Each step consists of shifting the accumulator right one bit
- * (maintaining any guard bits) and, if the next bit in y is set,
- * adding the multiplicand (x) to the accumulator. Then, in any case,
- * we advance one bit leftward in y. Algorithmically:
- *
- * A = 0;
- * for (bit = 0; bit < FP_NMANT; bit++) {
- * sticky |= A & 1, A >>= 1;
- * if (Y & (1 << bit))
- * A += X;
- * }
- *
- * (X and Y here represent the mantissas of x and y respectively.)
- * The resultant accumulator (A) is the product's mantissa. It may
- * be as large as 11.11111... in binary and hence may need to be
- * shifted right, but at most one bit.
- *
- * Since we do not have efficient multiword arithmetic, we code the
- * accumulator as four separate words, just like any other mantissa.
- * We use local `register' variables in the hope that this is faster
- * than memory. We keep x->fp_mant in locals for the same reason.
- *
- * In the algorithm above, the bits in y are inspected one at a time.
- * We will pick them up 32 at a time and then deal with those 32, one
- * at a time. Note, however, that we know several things about y:
- *
- * - the guard and round bits at the bottom are sure to be zero;
- *
- * - often many low bits are zero (y is often from a single or double
- * precision source);
- *
- * - bit FP_NMANT-1 is set, and FP_1*2 fits in a word.
- *
- * We can also test for 32-zero-bits swiftly. In this case, the center
- * part of the loop---setting sticky, shifting A, and not adding---will
- * run 32 times without adding X to A. We can do a 32-bit shift faster
- * by simply moving words. Since zeros are common, we optimize this case.
- * Furthermore, since A is initially zero, we can omit the shift as well
- * until we reach a nonzero word.
- */
-struct fpn *
-fpu_mul(fe)
- register struct fpemu *fe;
-{
- register struct fpn *x = &fe->fe_f1, *y = &fe->fe_f2;
- register u_int a3, a2, a1, a0, x3, x2, x1, x0, bit, m;
- register int sticky;
- FPU_DECL_CARRY
-
- /*
- * Put the `heavier' operand on the right (see fpu_emu.h).
- * Then we will have one of the following cases, taken in the
- * following order:
- *
- * - y = NaN. Implied: if only one is a signalling NaN, y is.
- * The result is y.
- * - y = Inf. Implied: x != NaN (is 0, number, or Inf: the NaN
- * case was taken care of earlier).
- * If x = 0, the result is NaN. Otherwise the result
- * is y, with its sign reversed if x is negative.
- * - x = 0. Implied: y is 0 or number.
- * The result is 0 (with XORed sign as usual).
- * - other. Implied: both x and y are numbers.
- * The result is x * y (XOR sign, multiply bits, add exponents).
- */
- ORDER(x, y);
- if (ISNAN(y)) {
- y->fp_sign ^= x->fp_sign;
- return (y);
- }
- if (ISINF(y)) {
- if (ISZERO(x))
- return (fpu_newnan(fe));
- y->fp_sign ^= x->fp_sign;
- return (y);
- }
- if (ISZERO(x)) {
- x->fp_sign ^= y->fp_sign;
- return (x);
- }
-
- /*
- * Setup. In the code below, the mask `m' will hold the current
- * mantissa byte from y. The variable `bit' denotes the bit
- * within m. We also define some macros to deal with everything.
- */
- x3 = x->fp_mant[3];
- x2 = x->fp_mant[2];
- x1 = x->fp_mant[1];
- x0 = x->fp_mant[0];
- sticky = a3 = a2 = a1 = a0 = 0;
-
-#define ADD /* A += X */ \
- FPU_ADDS(a3, a3, x3); \
- FPU_ADDCS(a2, a2, x2); \
- FPU_ADDCS(a1, a1, x1); \
- FPU_ADDC(a0, a0, x0)
-
-#define SHR1 /* A >>= 1, with sticky */ \
- sticky |= a3 & 1, a3 = (a3 >> 1) | (a2 << 31), \
- a2 = (a2 >> 1) | (a1 << 31), a1 = (a1 >> 1) | (a0 << 31), a0 >>= 1
-
-#define SHR32 /* A >>= 32, with sticky */ \
- sticky |= a3, a3 = a2, a2 = a1, a1 = a0, a0 = 0
-
-#define STEP /* each 1-bit step of the multiplication */ \
- SHR1; if (bit & m) { ADD; }; bit <<= 1
-
- /*
- * We are ready to begin. The multiply loop runs once for each
- * of the four 32-bit words. Some words, however, are special.
- * As noted above, the low order bits of Y are often zero. Even
- * if not, the first loop can certainly skip the guard bits.
- * The last word of y has its highest 1-bit in position FP_NMANT-1,
- * so we stop the loop when we move past that bit.
- */
- if ((m = y->fp_mant[3]) == 0) {
- /* SHR32; */ /* unneeded since A==0 */
- } else {
- bit = 1 << FP_NG;
- do {
- STEP;
- } while (bit != 0);
- }
- if ((m = y->fp_mant[2]) == 0) {
- SHR32;
- } else {
- bit = 1;
- do {
- STEP;
- } while (bit != 0);
- }
- if ((m = y->fp_mant[1]) == 0) {
- SHR32;
- } else {
- bit = 1;
- do {
- STEP;
- } while (bit != 0);
- }
- m = y->fp_mant[0]; /* definitely != 0 */
- bit = 1;
- do {
- STEP;
- } while (bit <= m);
-
- /*
- * Done with mantissa calculation. Get exponent and handle
- * 11.111...1 case, then put result in place. We reuse x since
- * it already has the right class (FP_NUM).
- */
- m = x->fp_exp + y->fp_exp;
- if (a0 >= FP_2) {
- SHR1;
- m++;
- }
- x->fp_sign ^= y->fp_sign;
- x->fp_exp = m;
- x->fp_sticky = sticky;
- x->fp_mant[3] = a3;
- x->fp_mant[2] = a2;
- x->fp_mant[1] = a1;
- x->fp_mant[0] = a0;
- return (x);
-}
diff --git a/sys/arch/kbus/fpu/fpu_sqrt.c b/sys/arch/kbus/fpu/fpu_sqrt.c
deleted file mode 100644
index fe249386b9c..00000000000
--- a/sys/arch/kbus/fpu/fpu_sqrt.c
+++ /dev/null
@@ -1,397 +0,0 @@
-/* $NetBSD: fpu_sqrt.c,v 1.2 1994/11/20 20:52:46 deraadt Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fpu_sqrt.c 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * Perform an FPU square root (return sqrt(x)).
- */
-
-#include <sys/types.h>
-
-#include <machine/reg.h>
-
-#include <fpu/fpu_arith.h>
-#include <fpu/fpu_emu.h>
-
-/*
- * Our task is to calculate the square root of a floating point number x0.
- * This number x normally has the form:
- *
- * exp
- * x = mant * 2 (where 1 <= mant < 2 and exp is an integer)
- *
- * This can be left as it stands, or the mantissa can be doubled and the
- * exponent decremented:
- *
- * exp-1
- * x = (2 * mant) * 2 (where 2 <= 2 * mant < 4)
- *
- * If the exponent `exp' is even, the square root of the number is best
- * handled using the first form, and is by definition equal to:
- *
- * exp/2
- * sqrt(x) = sqrt(mant) * 2
- *
- * If exp is odd, on the other hand, it is convenient to use the second
- * form, giving:
- *
- * (exp-1)/2
- * sqrt(x) = sqrt(2 * mant) * 2
- *
- * In the first case, we have
- *
- * 1 <= mant < 2
- *
- * and therefore
- *
- * sqrt(1) <= sqrt(mant) < sqrt(2)
- *
- * while in the second case we have
- *
- * 2 <= 2*mant < 4
- *
- * and therefore
- *
- * sqrt(2) <= sqrt(2*mant) < sqrt(4)
- *
- * so that in any case, we are sure that
- *
- * sqrt(1) <= sqrt(n * mant) < sqrt(4), n = 1 or 2
- *
- * or
- *
- * 1 <= sqrt(n * mant) < 2, n = 1 or 2.
- *
- * This root is therefore a properly formed mantissa for a floating
- * point number. The exponent of sqrt(x) is either exp/2 or (exp-1)/2
- * as above. This leaves us with the problem of finding the square root
- * of a fixed-point number in the range [1..4).
- *
- * Though it may not be instantly obvious, the following square root
- * algorithm works for any integer x of an even number of bits, provided
- * that no overflows occur:
- *
- * let q = 0
- * for k = NBITS-1 to 0 step -1 do -- for each digit in the answer...
- * x *= 2 -- multiply by radix, for next digit
- * if x >= 2q + 2^k then -- if adding 2^k does not
- * x -= 2q + 2^k -- exceed the correct root,
- * q += 2^k -- add 2^k and adjust x
- * fi
- * done
- * sqrt = q / 2^(NBITS/2) -- (and any remainder is in x)
- *
- * If NBITS is odd (so that k is initially even), we can just add another
- * zero bit at the top of x. Doing so means that q is not going to acquire
- * a 1 bit in the first trip around the loop (since x0 < 2^NBITS). If the
- * final value in x is not needed, or can be off by a factor of 2, this is
- * equivalant to moving the `x *= 2' step to the bottom of the loop:
- *
- * for k = NBITS-1 to 0 step -1 do if ... fi; x *= 2; done
- *
- * and the result q will then be sqrt(x0) * 2^floor(NBITS / 2).
- * (Since the algorithm is destructive on x, we will call x's initial
- * value, for which q is some power of two times its square root, x0.)
- *
- * If we insert a loop invariant y = 2q, we can then rewrite this using
- * C notation as:
- *
- * q = y = 0; x = x0;
- * for (k = NBITS; --k >= 0;) {
- * #if (NBITS is even)
- * x *= 2;
- * #endif
- * t = y + (1 << k);
- * if (x >= t) {
- * x -= t;
- * q += 1 << k;
- * y += 1 << (k + 1);
- * }
- * #if (NBITS is odd)
- * x *= 2;
- * #endif
- * }
- *
- * If x0 is fixed point, rather than an integer, we can simply alter the
- * scale factor between q and sqrt(x0). As it happens, we can easily arrange
- * for the scale factor to be 2**0 or 1, so that sqrt(x0) == q.
- *
- * In our case, however, x0 (and therefore x, y, q, and t) are multiword
- * integers, which adds some complication. But note that q is built one
- * bit at a time, from the top down, and is not used itself in the loop
- * (we use 2q as held in y instead). This means we can build our answer
- * in an integer, one word at a time, which saves a bit of work. Also,
- * since 1 << k is always a `new' bit in q, 1 << k and 1 << (k+1) are
- * `new' bits in y and we can set them with an `or' operation rather than
- * a full-blown multiword add.
- *
- * We are almost done, except for one snag. We must prove that none of our
- * intermediate calculations can overflow. We know that x0 is in [1..4)
- * and therefore the square root in q will be in [1..2), but what about x,
- * y, and t?
- *
- * We know that y = 2q at the beginning of each loop. (The relation only
- * fails temporarily while y and q are being updated.) Since q < 2, y < 4.
- * The sum in t can, in our case, be as much as y+(1<<1) = y+2 < 6, and.
- * Furthermore, we can prove with a bit of work that x never exceeds y by
- * more than 2, so that even after doubling, 0 <= x < 8. (This is left as
- * an exercise to the reader, mostly because I have become tired of working
- * on this comment.)
- *
- * If our floating point mantissas (which are of the form 1.frac) occupy
- * B+1 bits, our largest intermediary needs at most B+3 bits, or two extra.
- * In fact, we want even one more bit (for a carry, to avoid compares), or
- * three extra. There is a comment in fpu_emu.h reminding maintainers of
- * this, so we have some justification in assuming it.
- */
-struct fpn *
-fpu_sqrt(fe)
- struct fpemu *fe;
-{
- register struct fpn *x = &fe->fe_f1;
- register u_int bit, q, tt;
- register u_int x0, x1, x2, x3;
- register u_int y0, y1, y2, y3;
- register u_int d0, d1, d2, d3;
- register int e;
-
- /*
- * Take care of special cases first. In order:
- *
- * sqrt(NaN) = NaN
- * sqrt(+0) = +0
- * sqrt(-0) = -0
- * sqrt(x < 0) = NaN (including sqrt(-Inf))
- * sqrt(+Inf) = +Inf
- *
- * Then all that remains are numbers with mantissas in [1..2).
- */
- if (ISNAN(x) || ISZERO(x))
- return (x);
- if (x->fp_sign)
- return (fpu_newnan(fe));
- if (ISINF(x))
- return (x);
-
- /*
- * Calculate result exponent. As noted above, this may involve
- * doubling the mantissa. We will also need to double x each
- * time around the loop, so we define a macro for this here, and
- * we break out the multiword mantissa.
- */
-#ifdef FPU_SHL1_BY_ADD
-#define DOUBLE_X { \
- FPU_ADDS(x3, x3, x3); FPU_ADDCS(x2, x2, x2); \
- FPU_ADDCS(x1, x1, x1); FPU_ADDC(x0, x0, x0); \
-}
-#else
-#define DOUBLE_X { \
- x0 = (x0 << 1) | (x1 >> 31); x1 = (x1 << 1) | (x2 >> 31); \
- x2 = (x2 << 1) | (x3 >> 31); x3 <<= 1; \
-}
-#endif
-#if (FP_NMANT & 1) != 0
-# define ODD_DOUBLE DOUBLE_X
-# define EVEN_DOUBLE /* nothing */
-#else
-# define ODD_DOUBLE /* nothing */
-# define EVEN_DOUBLE DOUBLE_X
-#endif
- x0 = x->fp_mant[0];
- x1 = x->fp_mant[1];
- x2 = x->fp_mant[2];
- x3 = x->fp_mant[3];
- e = x->fp_exp;
- if (e & 1) /* exponent is odd; use sqrt(2mant) */
- DOUBLE_X;
- /* THE FOLLOWING ASSUMES THAT RIGHT SHIFT DOES SIGN EXTENSION */
- x->fp_exp = e >> 1; /* calculates (e&1 ? (e-1)/2 : e/2 */
-
- /*
- * Now calculate the mantissa root. Since x is now in [1..4),
- * we know that the first trip around the loop will definitely
- * set the top bit in q, so we can do that manually and start
- * the loop at the next bit down instead. We must be sure to
- * double x correctly while doing the `known q=1.0'.
- *
- * We do this one mantissa-word at a time, as noted above, to
- * save work. To avoid `(1 << 31) << 1', we also do the top bit
- * outside of each per-word loop.
- *
- * The calculation `t = y + bit' breaks down into `t0 = y0, ...,
- * t3 = y3, t? |= bit' for the appropriate word. Since the bit
- * is always a `new' one, this means that three of the `t?'s are
- * just the corresponding `y?'; we use `#define's here for this.
- * The variable `tt' holds the actual `t?' variable.
- */
-
- /* calculate q0 */
-#define t0 tt
- bit = FP_1;
- EVEN_DOUBLE;
- /* if (x >= (t0 = y0 | bit)) { */ /* always true */
- q = bit;
- x0 -= bit;
- y0 = bit << 1;
- /* } */
- ODD_DOUBLE;
- while ((bit >>= 1) != 0) { /* for remaining bits in q0 */
- EVEN_DOUBLE;
- t0 = y0 | bit; /* t = y + bit */
- if (x0 >= t0) { /* if x >= t then */
- x0 -= t0; /* x -= t */
- q |= bit; /* q += bit */
- y0 |= bit << 1; /* y += bit << 1 */
- }
- ODD_DOUBLE;
- }
- x->fp_mant[0] = q;
-#undef t0
-
- /* calculate q1. note (y0&1)==0. */
-#define t0 y0
-#define t1 tt
- q = 0;
- y1 = 0;
- bit = 1 << 31;
- EVEN_DOUBLE;
- t1 = bit;
- FPU_SUBS(d1, x1, t1);
- FPU_SUBC(d0, x0, t0); /* d = x - t */
- if ((int)d0 >= 0) { /* if d >= 0 (i.e., x >= t) then */
- x0 = d0, x1 = d1; /* x -= t */
- q = bit; /* q += bit */
- y0 |= 1; /* y += bit << 1 */
- }
- ODD_DOUBLE;
- while ((bit >>= 1) != 0) { /* for remaining bits in q1 */
- EVEN_DOUBLE; /* as before */
- t1 = y1 | bit;
- FPU_SUBS(d1, x1, t1);
- FPU_SUBC(d0, x0, t0);
- if ((int)d0 >= 0) {
- x0 = d0, x1 = d1;
- q |= bit;
- y1 |= bit << 1;
- }
- ODD_DOUBLE;
- }
- x->fp_mant[1] = q;
-#undef t1
-
- /* calculate q2. note (y1&1)==0; y0 (aka t0) is fixed. */
-#define t1 y1
-#define t2 tt
- q = 0;
- y2 = 0;
- bit = 1 << 31;
- EVEN_DOUBLE;
- t2 = bit;
- FPU_SUBS(d2, x2, t2);
- FPU_SUBCS(d1, x1, t1);
- FPU_SUBC(d0, x0, t0);
- if ((int)d0 >= 0) {
- x0 = d0, x1 = d1, x2 = d2;
- q |= bit;
- y1 |= 1; /* now t1, y1 are set in concrete */
- }
- ODD_DOUBLE;
- while ((bit >>= 1) != 0) {
- EVEN_DOUBLE;
- t2 = y2 | bit;
- FPU_SUBS(d2, x2, t2);
- FPU_SUBCS(d1, x1, t1);
- FPU_SUBC(d0, x0, t0);
- if ((int)d0 >= 0) {
- x0 = d0, x1 = d1, x2 = d2;
- q |= bit;
- y2 |= bit << 1;
- }
- ODD_DOUBLE;
- }
- x->fp_mant[2] = q;
-#undef t2
-
- /* calculate q3. y0, t0, y1, t1 all fixed; y2, t2, almost done. */
-#define t2 y2
-#define t3 tt
- q = 0;
- y3 = 0;
- bit = 1 << 31;
- EVEN_DOUBLE;
- t3 = bit;
- FPU_SUBS(d3, x3, t3);
- FPU_SUBCS(d2, x2, t2);
- FPU_SUBCS(d1, x1, t1);
- FPU_SUBC(d0, x0, t0);
- ODD_DOUBLE;
- if ((int)d0 >= 0) {
- x0 = d0, x1 = d1, x2 = d2;
- q |= bit;
- y2 |= 1;
- }
- while ((bit >>= 1) != 0) {
- EVEN_DOUBLE;
- t3 = y3 | bit;
- FPU_SUBS(d3, x3, t3);
- FPU_SUBCS(d2, x2, t2);
- FPU_SUBCS(d1, x1, t1);
- FPU_SUBC(d0, x0, t0);
- if ((int)d0 >= 0) {
- x0 = d0, x1 = d1, x2 = d2;
- q |= bit;
- y3 |= bit << 1;
- }
- ODD_DOUBLE;
- }
- x->fp_mant[3] = q;
-
- /*
- * The result, which includes guard and round bits, is exact iff
- * x is now zero; any nonzero bits in x represent sticky bits.
- */
- x->fp_sticky = x0 | x1 | x2 | x3;
- return (x);
-}
diff --git a/sys/arch/kbus/fpu/fpu_subr.c b/sys/arch/kbus/fpu/fpu_subr.c
deleted file mode 100644
index 069b16d701f..00000000000
--- a/sys/arch/kbus/fpu/fpu_subr.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/* $NetBSD: fpu_subr.c,v 1.3 1996/03/14 19:42:01 christos Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fpu_subr.c 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * FPU subroutines.
- */
-
-#include <sys/types.h>
-#ifdef DIAGNOSTIC
-#include <sys/systm.h>
-#endif
-
-#include <machine/reg.h>
-#include <machine/instr.h>
-
-#include <fpu/fpu_arith.h>
-#include <fpu/fpu_emu.h>
-#include <fpu/fpu_extern.h>
-
-/*
- * Shift the given number right rsh bits. Any bits that `fall off' will get
- * shoved into the sticky field; we return the resulting sticky. Note that
- * shifting NaNs is legal (this will never shift all bits out); a NaN's
- * sticky field is ignored anyway.
- */
-int
-fpu_shr(register struct fpn *fp, register int rsh)
-{
- register u_int m0, m1, m2, m3, s;
- register int lsh;
-
-#ifdef DIAGNOSTIC
- if (rsh <= 0 || (fp->fp_class != FPC_NUM && !ISNAN(fp)))
- panic("fpu_rightshift 1");
-#endif
-
- m0 = fp->fp_mant[0];
- m1 = fp->fp_mant[1];
- m2 = fp->fp_mant[2];
- m3 = fp->fp_mant[3];
-
- /* If shifting all the bits out, take a shortcut. */
- if (rsh >= FP_NMANT) {
-#ifdef DIAGNOSTIC
- if ((m0 | m1 | m2 | m3) == 0)
- panic("fpu_rightshift 2");
-#endif
- fp->fp_mant[0] = 0;
- fp->fp_mant[1] = 0;
- fp->fp_mant[2] = 0;
- fp->fp_mant[3] = 0;
-#ifdef notdef
- if ((m0 | m1 | m2 | m3) == 0)
- fp->fp_class = FPC_ZERO;
- else
-#endif
- fp->fp_sticky = 1;
- return (1);
- }
-
- /* Squish out full words. */
- s = fp->fp_sticky;
- if (rsh >= 32 * 3) {
- s |= m3 | m2 | m1;
- m3 = m0, m2 = 0, m1 = 0, m0 = 0;
- } else if (rsh >= 32 * 2) {
- s |= m3 | m2;
- m3 = m1, m2 = m0, m1 = 0, m0 = 0;
- } else if (rsh >= 32) {
- s |= m3;
- m3 = m2, m2 = m1, m1 = m0, m0 = 0;
- }
-
- /* Handle any remaining partial word. */
- if ((rsh &= 31) != 0) {
- lsh = 32 - rsh;
- s |= m3 << lsh;
- m3 = (m3 >> rsh) | (m2 << lsh);
- m2 = (m2 >> rsh) | (m1 << lsh);
- m1 = (m1 >> rsh) | (m0 << lsh);
- m0 >>= rsh;
- }
- fp->fp_mant[0] = m0;
- fp->fp_mant[1] = m1;
- fp->fp_mant[2] = m2;
- fp->fp_mant[3] = m3;
- fp->fp_sticky = s;
- return (s);
-}
-
-/*
- * Force a number to be normal, i.e., make its fraction have all zero
- * bits before FP_1, then FP_1, then all 1 bits. This is used for denorms
- * and (sometimes) for intermediate results.
- *
- * Internally, this may use a `supernormal' -- a number whose fp_mant
- * is greater than or equal to 2.0 -- so as a side effect you can hand it
- * a supernormal and it will fix it (provided fp->fp_mant[3] == 0).
- */
-void
-fpu_norm(register struct fpn *fp)
-{
- register u_int m0, m1, m2, m3, top, sup, nrm;
- register int lsh, rsh, exp;
-
- exp = fp->fp_exp;
- m0 = fp->fp_mant[0];
- m1 = fp->fp_mant[1];
- m2 = fp->fp_mant[2];
- m3 = fp->fp_mant[3];
-
- /* Handle severe subnormals with 32-bit moves. */
- if (m0 == 0) {
- if (m1)
- m0 = m1, m1 = m2, m2 = m3, m3 = 0, exp -= 32;
- else if (m2)
- m0 = m2, m1 = m3, m2 = 0, m3 = 0, exp -= 2 * 32;
- else if (m3)
- m0 = m3, m1 = 0, m2 = 0, m3 = 0, exp -= 3 * 32;
- else {
- fp->fp_class = FPC_ZERO;
- return;
- }
- }
-
- /* Now fix any supernormal or remaining subnormal. */
- nrm = FP_1;
- sup = nrm << 1;
- if (m0 >= sup) {
- /*
- * We have a supernormal number. We need to shift it right.
- * We may assume m3==0.
- */
- for (rsh = 1, top = m0 >> 1; top >= sup; rsh++) /* XXX slow */
- top >>= 1;
- exp += rsh;
- lsh = 32 - rsh;
- m3 = m2 << lsh;
- m2 = (m2 >> rsh) | (m1 << lsh);
- m1 = (m1 >> rsh) | (m0 << lsh);
- m0 = top;
- } else if (m0 < nrm) {
- /*
- * We have a regular denorm (a subnormal number), and need
- * to shift it left.
- */
- for (lsh = 1, top = m0 << 1; top < nrm; lsh++) /* XXX slow */
- top <<= 1;
- exp -= lsh;
- rsh = 32 - lsh;
- m0 = top | (m1 >> rsh);
- m1 = (m1 << lsh) | (m2 >> rsh);
- m2 = (m2 << lsh) | (m3 >> rsh);
- m3 <<= lsh;
- }
-
- fp->fp_exp = exp;
- fp->fp_mant[0] = m0;
- fp->fp_mant[1] = m1;
- fp->fp_mant[2] = m2;
- fp->fp_mant[3] = m3;
-}
-
-/*
- * Concoct a `fresh' Quiet NaN per Appendix N.
- * As a side effect, we set NV (invalid) for the current exceptions.
- */
-struct fpn *
-fpu_newnan(register struct fpemu *fe)
-{
- register struct fpn *fp;
-
- fe->fe_cx = FSR_NV;
- fp = &fe->fe_f3;
- fp->fp_class = FPC_QNAN;
- fp->fp_sign = 0;
- fp->fp_mant[0] = FP_1 - 1;
- fp->fp_mant[1] = fp->fp_mant[2] = fp->fp_mant[3] = ~0;
- return (fp);
-}
diff --git a/sys/arch/kbus/include/ansi.h b/sys/arch/kbus/include/ansi.h
deleted file mode 100644
index ee7bff74d62..00000000000
--- a/sys/arch/kbus/include/ansi.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* $OpenBSD: ansi.h,v 1.3 2000/02/22 17:29:13 millert Exp $ */
-/* $NetBSD: ansi.h,v 1.6 1996/11/15 22:38:59 jtc Exp $ */
-
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ansi.h 8.2 (Berkeley) 1/4/94
- */
-
-#ifndef _ANSI_H_
-#define _ANSI_H_
-
-/*
- * Types which are fundamental to the implementation and may appear in
- * more than one standard header are defined here. Standard headers
- * then use:
- * #ifdef _BSD_SIZE_T_
- * typedef _BSD_SIZE_T_ size_t;
- * #undef _BSD_SIZE_T_
- * #endif
- */
-#define _BSD_CLOCK_T_ unsigned long /* clock() */
-#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */
-#define _BSD_SIZE_T_ unsigned int /* sizeof() */
-#define _BSD_SSIZE_T_ int /* byte count or error */
-#define _BSD_TIME_T_ int /* time() */
-#define _BSD_VA_LIST_ char * /* va_list */
-#define _BSD_CLOCKID_T_ int
-#define _BSD_TIMER_T_ int
-
-/*
- * Runes (wchar_t) is declared to be an ``int'' instead of the more natural
- * ``unsigned long'' or ``long''. Two things are happening here. It is not
- * unsigned so that EOF (-1) can be naturally assigned to it and used. Also,
- * it looks like 10646 will be a 31 bit standard. This means that if your
- * ints cannot hold 32 bits, you will be in trouble. The reason an int was
- * chosen over a long is that the is*() and to*() routines take ints (says
- * ANSI C), but they use _RUNE_T_ instead of int. By changing it here, you
- * lose a bit of ANSI conformance, but your programs will still work.
- *
- * Note that _WCHAR_T_ and _RUNE_T_ must be of the same type. When wchar_t
- * and rune_t are typedef'd, _WCHAR_T_ will be undef'd, but _RUNE_T remains
- * defined for ctype.h.
- */
-#define _BSD_WCHAR_T_ int /* wchar_t */
-#define _BSD_WINT_T_ int /* wint_t */
-#define _BSD_RUNE_T_ int /* rune_t */
-
-/*
- * We describe off_t here so its declaration can be visible to
- * stdio without pulling in all of <sys/type.h>, thus appeasing ANSI.
- */
-#define _BSD_OFF_T_ long long /* file offset */
-
-#endif /* _ANSI_H_ */
diff --git a/sys/arch/kbus/include/asi.h b/sys/arch/kbus/include/asi.h
deleted file mode 100644
index c6ded1e6c09..00000000000
--- a/sys/arch/kbus/include/asi.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* All the asi of the series5 machine. */
-#ifndef _SERIES5_ASI_H_
-#define _SERIES5_ASI_H_
-
-/* Defined by the uP. */
-#define ASI_UP 0x08 /* User program. */
-#define ASI_SP 0x09 /* Supervisor program. */
-#define ASI_UD 0x0a /* User data. */
-#define ASI_SD 0x0b /* Supervisor data. */
-
-/* Diagnostic. */
-#define ASI_CTEST 0x40 /* Cache test operation base ASI. */
-
-/* MMU spaces. */
-#define ASI_MMCR 0x80 /* Memory management control reg, 32-bit, RW */
-#define ASI_FCR 0x81 /* Fault cause register, 32-bit, RW. */
-#define ASI_FVAR 0x82 /* Fault virtual address reg, 32-bit, RO. */
-#define ASI_PDBA 0x83 /* Page directory base register, 32-bit, RW */
-#define ASI_TIR 0x84 /* Test information register, 32-bit, RO. */
-#define ASI_FTIR 0x85 /* FTLB test info reg, 32-bit, RO. */
-
-/* TLB spaces. */
-#define ASI_GTLB_INV 0x85 /* Invalidate GTLB, WO. */
-#define ASI_FTLB_INV 0x86 /* Invalidate FTLB, WO. */
-#define ASI_FGTLB_INV 0x87 /* Invalidate FTLB and GTLB, WO. */
-
-#define ASI_CTAG 0x90 /* Cache tag operations base ASI, WO. */
-#define ASI_CTAG_INV 0x94 /* Cache tag flash invalidation, WO. */
-
-#define ASI_FGTLB_VALI 0xa8 /* Write FTLB & instruction GTLB entry, WO. */
-#define ASI_FGTLB_VALD 0xaa /* Write FTLB & data GTLB entry, WO. */
-#define ASI_GTLB_RDI 0xb1 /* Read instruction GTLB entry, WO. */
-#define ASI_GTLB_RDD 0xb3 /* Read data GTLB entry, WO. */
-
-#define ASI_BID 0xc0 /* Board id register, 16-bit, RO. */
-#define ASI_LED 0xc1 /* Board led register, 16-bit, RO. */
-
-/* ASI spaces for the SIC registers. */
-#define ASI_DIR 0xc8 /* Device id register, 8-bit, RW. */
-#define ASI_IXR 0xc9 /* Interrupt transmit reg, 32-bit, RW. */
-#define ASI_ITXC 0xca /* Interrupt transmit ctrl reg, 32-Bit, RW. */
-#define ASI_IPR 0xcb /* Interrupt priority register, 32-bit, RW. */
-#define ASI_ACK_IPV 0xcc /* Ack int. pending vector reg, 32-Bit, RW. */
-#define ASI_IRXC 0xcd /* Interrupt receiver ctrl reg, 32-bit, RW. */
-#define ASI_NOACK_IPV 0xce /* Noack int. pending vector, 32-bit, RO. */
-
-#define ASI_CRDAT 0xcf /* CRDAT bus state, 32-bit, RO. */
-
-#define ASI_FPAR 0xd0 /* Fault physical address reg, 32-bit, RO */
-#define ASI_FES 0xd1 /* Fault ECC syndrome register, 16-bit, RO */
-#define ASI_FTOR 0xd3 /* Fault time out register, 32-bit, RO. */
-#define ASI_FTSR 0xd4 /* Fault time out space reg, 16-bit, RO. */
-
-#define ASI_TRIGGER 0xd8 /* See diag.h. */
-
-#define ASI_DGRAM 0xe0 /* Diagnostic RAM, 2kb, RW. */
-
-#define ASI_KDT 0xf4 /* Diagnostic transaction space. */
-#define ASI_CLR_CORRUPT 0xf8 /* Corrupt block RAM bit clear, WO. */
-#define ASI_SET_CORRUPT 0xf9 /* Corrupt block RAM bit set, WO. */
-#endif /* _SERIES5_ASI_H_ */
diff --git a/sys/arch/kbus/include/asm.h b/sys/arch/kbus/include/asm.h
deleted file mode 100644
index 2c3c845fab4..00000000000
--- a/sys/arch/kbus/include/asm.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/* $NetBSD: asm.h,v 1.3 1994/11/20 20:53:55 deraadt Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)asm.h 8.1 (Berkeley) 6/11/93
- */
-
-#ifndef _ASM_H_
-#define _ASM_H_
-
-/*
- * GCC __asm constructs for doing assembly stuff.
- */
-
-/*
- * ``Routines'' to load and store from/to alternate address space.
- * The location can be a variable, the asi value (address space indicator)
- * must be a constant.
- *
- * N.B.: You can put as many special functions here as you like, since
- * they cost no kernel space or time if they are not used.
- *
- * These were static inline functions, but gcc screws up the constraints
- * on the address space identifiers (the "n"umeric value part) because
- * it inlines too late, so we have to use the funny valued-macro syntax.
- */
-
-#ifndef __ASSEMBLER__
-/* load byte from alternate address space */
-#define lduba(asi, loc) ({ \
- register int _lduba_v; \
- __asm __volatile("lduba [%1]%2,%0" : "=r" (_lduba_v) : \
- "r" ((int)(loc)), "n" (asi)); \
- _lduba_v; \
-})
-
-/* load half-word from alternate address space */
-#define lduha(asi, loc) ({ \
- register int _lduha_v; \
- __asm __volatile("lduha [%1]%2,%0" : "=r" (_lduha_v) : \
- "r" ((int)(loc)), "n" (asi)); \
- _lduha_v; \
-})
-
-/* load int from alternate address space */
-#define lda(asi, loc) ({ \
- register int _lda_v; \
- __asm __volatile("lda [%1]%2,%0" : "=r" (_lda_v) : \
- "r" ((int)(loc)), "n" (asi)); \
- _lda_v; \
-})
-
-/* store byte to alternate address space */
-#define stba(asi, loc, value) ({ \
- __asm __volatile("stba %0,[%1]%2" : : \
- "r" ((int)(value)), "r" ((int)(loc)), "n" (asi)); \
-})
-
-/* store half-word to alternate address space */
-#define stha(asi, loc, value) ({ \
- __asm __volatile("stha %0,[%1]%2" : : \
- "r" ((int)(value)), "r" ((int)(loc)), "n" (asi)); \
-})
-
-/* store int to alternate address space */
-#define sta(asi, loc, value) ({ \
- __asm __volatile("sta %0,[%1]%2" : : \
- "r" ((int)(value)), "r" ((int)(loc)), "n" (asi)); \
-})
-#endif /* !__ASSEMBLER__ */
-
-#ifdef __STDC__
-#define _C_LABEL(x) _ ## x
-#else
-#define _C_LABEL(x) _/**/x
-#endif
-
-#define _ASM_LABEL(name) name
-
-#ifdef PIC
-/*
- * PIC_PROLOGUE() is akin to the compiler generated function prologue for
- * PIC code. It leaves the address of the Global Offset Table in DEST,
- * clobbering register TMP in the process. Using the temporary enables us
- * to work without a stack frame (doing so requires saving %o7) .
- */
-#define PIC_PROLOGUE(dest,tmp) \
- mov %o7,tmp; 3: call 4f; nop; 4: \
- sethi %hi(__GLOBAL_OFFSET_TABLE_-(3b-.)),dest; \
- or dest,%lo(__GLOBAL_OFFSET_TABLE_-(3b-.)),dest; \
- add dest,%o7,dest; mov tmp,%o7
-
-/*
- * PICCY_SET() does the equivalent of a `set var, %dest' instruction in
- * a PIC-like way, but without involving the Global Offset Table. This
- * only works for VARs defined in the same file *and* in the text segment.
- */
-#define PICCY_SET(var,dest,tmp) \
- mov %o7,tmp; 3: call 4f; nop; 4: \
- add %o7,(var-3b),dest; mov tmp,%o7
-#else
-#define PIC_PROLOGUE(dest,tmp)
-#define PICCY_OFFSET(var,dest,tmp)
-#endif
-
-#define FTYPE(x) .type x,@function
-#define OTYPE(x) .type x,@object
-
-#define _ENTRY(name) \
- .align 4; .globl name; .proc 1; FTYPE(name); name:
-
-#ifdef PROF
-#define _PROF_PROLOGUE \
- .data; .align 4; 1: .long 0; \
- .text; save %sp,-96,%sp; sethi %hi(1b),%o0; call mcount; \
- or %o0,%lo(1b),%o0; restore
-#else
-#define _PROF_PROLOGUE
-#endif
-
-#define ENTRY(name) _ENTRY(_C_LABEL(name)); _PROF_PROLOGUE
-#define ASENTRY(name) _ENTRY(_ASM_LABEL(name)); _PROF_PROLOGUE
-#define FUNC(name) ASENTRY(name)
-
-
-#define ASMSTR .asciz
-
-#endif /* _ASM_H_ */
diff --git a/sys/arch/kbus/include/autoconf.h b/sys/arch/kbus/include/autoconf.h
deleted file mode 100644
index bb6f897d1aa..00000000000
--- a/sys/arch/kbus/include/autoconf.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* $OpenBSD: autoconf.h,v 1.1.1.1 1997/10/14 07:25:31 gingold Exp $ */
-/* $NetBSD: autoconf.h,v 1.12 1996/11/20 18:57:05 gwr Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Adam Glass and Gordon W. Ross.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Autoconfiguration information.
- */
-
-/* These are the "bus" types: */
-#define BUS_KBUS 0 /* "kbus" */
-#define BUS_VME32 1 /* "vme32" */
-#define BUS_VME24 2 /* "vme24" */
-#define BUS_VME16 3 /* "vme16" */
-
-/*
- * This is the "args" parameter to the bus match/attach functions.
- */
-struct confargs {
- int ca_bustype; /* BUS_OBIO, ... */
- int ca_paddr; /* physical address */
- int ca_intpri; /* interrupt priority level */
- int ca_intvec; /* interrupt vector index */
-};
-
-/* Defined in configure.c */
-void configure __P((void));
-/* Defined in swapgeneric.c */
-void setconf __P((void));
-
-struct device;
-int bus_scan __P((struct device *, void *, void *));
-int bus_print __P((void *, const char *));
-int bus_peek __P((int, int, int));
-char *bus_mapin __P ((int bustype, u_long phys, int size));
-
-/* Bus-error tolerant access to mapped address. */
-int peek_byte __P((caddr_t));
-int peek_word __P((caddr_t));
diff --git a/sys/arch/kbus/include/cdefs.h b/sys/arch/kbus/include/cdefs.h
deleted file mode 100644
index be71057bd49..00000000000
--- a/sys/arch/kbus/include/cdefs.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* $NetBSD: cdefs.h,v 1.2 1995/03/23 20:10:38 jtc Exp $ */
-
-/*
- * Written by J.T. Conklin <jtc@wimsey.com> 01/17/95.
- * Public domain.
- */
-
-#ifndef _MACHINE_CDEFS_H_
-#define _MACHINE_CDEFS_H_
-#if 0
-#ifdef __STDC__
-#define _C_LABEL(x) _STRING(_ ## x)
-#else
-#define _C_LABEL(x) _STRING(_/**/x)
-#endif
-#endif
-
-#ifdef __GNUC__
-#ifdef __STDC__
-#define __indr_reference(sym,alias) \
- __asm__(".stabs \"_" #alias "\",11,0,0,0"); \
- __asm__(".stabs \"_" #sym "\",1,0,0,0")
-#define __warn_references(sym,msg) \
- __asm__(".stabs \"" msg "\",30,0,0,0"); \
- __asm__(".stabs \"_" #sym "\",1,0,0,0")
-#else
-#define __indr_reference(sym,alias) \
- __asm__(".stabs \"_/**/alias\",11,0,0,0"); \
- __asm__(".stabs \"_/**/sym\",1,0,0,0")
-#define __warn_references(sym,msg) \
- __asm__(".stabs msg,30,0,0,0"); \
- __asm__(".stabs \"_/**/sym\",1,0,0,0")
-#endif
-#else
-#define __warn_references(sym,msg) /* nothing */
-#endif
-
-#endif /* !_MACHINE_CDEFS_H_ */
diff --git a/sys/arch/kbus/include/conf.h b/sys/arch/kbus/include/conf.h
deleted file mode 100644
index 435537f9625..00000000000
--- a/sys/arch/kbus/include/conf.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* $NetBSD: conf.h,v 1.1 1996/03/30 21:17:55 christos Exp $ */
-/* $OpenBSD: conf.h,v 1.1.1.1 1997/10/14 07:25:31 gingold Exp $ */
-
-/*
- * Copyright (c) 1996 Christos Zoulas. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christos Zoulas.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define mmread mmrw
-#define mmwrite mmrw
-cdev_decl(mm);
-
-cdev_decl(zs);
-
-cdev_decl(fb);
-
-/* open, close, read, write, ioctl, select */
-#define cdev_gen_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
- dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) nullop, \
- 0, dev_init(c,n,select), (dev_type_mmap((*))) enodev }
-
-cdev_decl(ms);
-
-cdev_decl(kbd);
-
-cdev_decl(bwtwo);
-
-cdev_decl(ipl);
-#ifdef IPFILTER
-#define NIPF 1
-#else
-#define NIPF 0
-#endif
-
-bdev_decl(xd);
-cdev_decl(xd);
-
-bdev_decl(xy);
-cdev_decl(xy);
-
-bdev_decl(sw);
-cdev_decl(sw);
diff --git a/sys/arch/kbus/include/cpu.h b/sys/arch/kbus/include/cpu.h
deleted file mode 100644
index e77dcc59a81..00000000000
--- a/sys/arch/kbus/include/cpu.h
+++ /dev/null
@@ -1,275 +0,0 @@
-/* $OpenBSD: cpu.h,v 1.3 1999/01/10 13:34:19 niklas Exp $ */
-/* $NetBSD: cpu.h,v 1.12 1995/06/28 02:55:56 cgd Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)cpu.h 5.4 (Berkeley) 5/9/91
- */
-
-#ifndef _MACHINE_CPU_H_
-#define _MACHINE_CPU_H_
-
-/*
- * CTL_MACHDEP definitions.
- */
-#define CPU_MAXID 1 /* no valid machdep ids */
-
-#define CTL_MACHDEP_NAMES { \
- { 0, 0 }, \
-}
-
-#if defined(_KERNEL) && !defined(_LOCORE)
-/*
- * Definitions unique to ns532 cpu support.
- *
- * modified from 386 code for the pc532 by Phil Nelson (12/92)
- */
-
-#include "machine/psl.h"
-#include "machine/frame.h"
-
-/*
- * definitions of cpu-dependent requirements
- * referenced in generic code
- */
-#define cpu_swapout(p) /* nothing */
-#define cpu_wait(p) /* nothing */
-
-
-/* XXX needed? PAN
- * function vs. inline configuration;
- * these are defined to get generic functions
- * rather than inline or machine-dependent implementations
- */
-#define NEED_MINMAX /* need {,i,l,ul}{min,max} functions */
-#define NEED_FFS /* need ffs function */
-#define NEED_BCMP /* need bcmp function */
-#define NEED_STRLEN /* need strlen function */
-
-/*
- * Arguments to hardclock, softclock and gatherstats encapsulate the
- * previous machine state in an opaque clockframe. The ipl is here
- * as well for strayintr (see locore.s:interrupt and intr.c:strayintr).
- * Note that CLKF_INTR is valid only if CLKF_USERMODE is false.
- */
-struct clockframe {
- u_int psr; /* psr before interrupt, excluding PSR_ET */
- u_int pc; /* pc at interrupt */
- u_int npc; /* npc at interrupt */
- u_int ipv; /* actual interrupt priority vector */
- u_int fp; /* %fp at interrupt */
- u_int ipr; /* Interrupt priority register befor int. */
-};
-typedef struct clockframe clockframe;
-
-extern int eintstack[];
-
-#define CLKF_USERMODE(framep) (((framep)->psr & PSR_PS) == 0)
-#define CLKF_BASEPRI(framep) (((framep)->psr & PSR_PIL) == 0)
-#define CLKF_PC(framep) ((framep)->pc)
-#define CLKF_INTR(framep) ((framep)->fp < (u_int)eintstack)
-
-/*
- * Preempt the current process if in interrupt from user mode,
- * or after the current trap/syscall if in system mode.
- */
-int want_ast;
-int want_resched; /* resched() was called */
-#define need_resched() (want_resched = 1, want_ast = 1)
-
-/*
- * Give a profiling tick to the current process when the user profiling
- * buffer pages are invalid. On the sparc, request an ast to send us
- * through trap(), marking the proc as needing a profiling tick.
- */
-#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, want_ast = 1)
-
-/*
- * Notify the current process (p) that it has a signal pending,
- * process as soon as possible.
- */
-#define signotify(p) (want_ast = 1)
-
-/*
- * Software interrupt request `register'.
- */
-extern unsigned int ssir;
-
-#define SIR_NET 0x01
-#define SIR_CLOCK 0x02
-#define SIR_ZS 0x04
-#define SIR_LE 0x08
-
-#define setsoftnet() ssir |= SIR_NET
-#define setsoftclock() ssir |= SIR_CLOCK
-#define setsoftzs() ssir |= SIR_ZS
-#define setsoftle() ssir |= SIR_LE
-
-/*
- * Give a profiling tick to the current process when the user profiling
- * buffer pages are invalid. On the sparc, request an ast to send us
- * through trap(), marking the proc as needing a profiling tick.
- */
-#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, want_ast = 1)
-
-/*
- * Notify the current process (p) that it has a signal pending,
- * process as soon as possible.
- */
-#define signotify(p) (want_ast = 1)
-
-/*
- * Only one process may own the FPU state.
- *
- * XXX this must be per-cpu (eventually)
- */
-struct proc *fpproc; /* FPU owner */
-int foundfpu; /* true => we have an FPU */
-
-/*
- * Interrupt handler chains. Interrupt handlers should return 0 for
- * ``not me'' or 1 (``I took care of it''). intr_establish() inserts a
- * handler into the list. The handler is called with its (single)
- * argument, or with a pointer to a clockframe if ih_arg is NULL.
- */
-struct intrhand {
- int (*ih_fun) __P((void *));
- void *ih_arg;
- struct intrhand *ih_next;
- unsigned int ih_flags;
-} *intrhand[256];
-#define IH_CAN_DELAY 1
-
-void intr_establish __P((int level, unsigned int flags, struct intrhand *));
-void vmeintr_establish __P((int vec, int level, struct intrhand *));
-
-/*
- * intr_fasttrap() is a lot like intr_establish, but is used for ``fast''
- * interrupt vectors (vectors that are not shared and are handled in the
- * trap window). Such functions must be written in assembly.
- */
-void intr_fasttrap __P((int level, void (*vec)(void)));
-
-/* disksubr.c */
-struct dkbad;
-int isbad __P((struct dkbad *bt, int, int, int));
-#if 0
-/* machdep.c */
-int ldcontrolb __P((caddr_t));
-void dumpconf __P((void));
-caddr_t reserve_dumppages __P((caddr_t));
-/* clock.c */
-struct timeval;
-void lo_microtime __P((struct timeval *));
-int statintr __P((void *));
-int clockintr __P((void *));/* level 10 (clock) interrupt code */
-int statintr __P((void *)); /* level 14 (statclock) interrupt code */
-#endif
-/* locore.s */
-struct fpstate;
-void savefpstate __P((struct fpstate *));
-void loadfpstate __P((struct fpstate *));
-int probeget __P((caddr_t, int));
-void write_all_windows __P((void));
-void write_user_windows __P((void));
-void proc_trampoline __P((void));
-struct pcb;
-void snapshot __P((struct pcb *));
-struct frame *getfp __P((void));
-int xldcontrolb __P((caddr_t, struct pcb *));
-void copywords __P((const void *, void *, size_t));
-void qcopy __P((const void *, void *, size_t));
-void qzero __P((void *, size_t));
-/* locore2.c */
-void remrq __P((struct proc *));
-/* trap.c */
-void kill_user_windows __P((struct proc *));
-int rwindow_save __P((struct proc *));
-void child_return __P((struct proc *));
-#if 0
-/* amd7930intr.s */
-void amd7930_trap __P((void));
-/* cons.c */
-int cnrom __P((void));
-/* zs.c */
-void zsconsole __P((struct tty *, int, int, int (**)(struct tty *, int)));
-#ifdef KGDB
-void zs_kgdb_init __P((void));
-#endif
-/* fb.c */
-void fb_unblank __P((void));
-/* cache.c */
-void cache_flush __P((caddr_t, u_int));
-/* kgdb_stub.c */
-#ifdef KGDB
-void kgdb_attach __P((int (*)(void *), void (*)(void *, int), void *));
-void kgdb_connect __P((int));
-void kgdb_panic __P((void));
-#endif
-/* pmap.c */
-void pmap_bootstrap __P((vm_offset_t));
-vm_offset_t pmap_map __P((vm_offset_t, vm_offset_t, vm_offset_t, int));
-/* iommu.c */
-void iommu_enter __P((u_int, u_int));
-void iommu_remove __P((u_int, u_int));
-#endif
-
-/*
- *
- * The SPARC has a Trap Base Register (TBR) which holds the upper 20 bits
- * of the trap vector table. The next eight bits are supplied by the
- * hardware when the trap occurs, and the bottom four bits are always
- * zero (so that we can shove up to 16 bytes of executable code---exactly
- * four instructions---into each trap vector).
- *
- * The hardware allocates half the trap vectors to hardware and half to
- * software.
- *
- * Traps have priorities assigned (lower number => higher priority).
- */
-
-struct trapvec {
- int tv_instr[4]; /* the four instructions */
-};
-extern struct trapvec *trapbase; /* the 256 vectors */
-
-extern void wzero __P((void *, u_int));
-extern void wcopy __P((const void *, void *, u_int));
-
-extern label_t *nofault;
-
-#endif /* _KERNEL */
-#endif /* _CPU_H_ */
diff --git a/sys/arch/kbus/include/db_machdep.h b/sys/arch/kbus/include/db_machdep.h
deleted file mode 100644
index b6028854359..00000000000
--- a/sys/arch/kbus/include/db_machdep.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* $NetBSD: db_machdep.h,v 1.7 1996/03/31 22:21:28 pk Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1991,1990 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-
-#ifndef _SPARC_DB_MACHDEP_H_
-#define _SPARC_DB_MACHDEP_H_
-
-/*
- * Machine-dependent defines for new kernel debugger.
- */
-
-
-#include <vm/vm.h>
-#include <machine/frame.h>
-#include <machine/psl.h>
-#include <machine/trap.h>
-#include <machine/reg.h>
-
-/* end of mangling */
-
-typedef vm_offset_t db_addr_t; /* address - unsigned */
-typedef int db_expr_t; /* expression - signed */
-
-typedef struct {
- struct trapframe ddb_tf;
- struct frame ddb_fr;
-} db_regs_t;
-
-db_regs_t ddb_regs; /* register state */
-#define DDB_REGS (&ddb_regs)
-#define DDB_TF (&ddb_regs.ddb_tf)
-#define DDB_FR (&ddb_regs.ddb_fr)
-
-#define PC_REGS(regs) ((db_addr_t)(regs)->ddb_tf.tf_pc)
-
-#define BKPT_INST 0x91d02001 /* breakpoint instruction */
-#define BKPT_SIZE (4) /* size of breakpoint inst */
-#define BKPT_SET(inst) (BKPT_INST)
-
-#define db_clear_single_step(regs) (void) (0)
-#define db_set_single_step(regs) (void) (0)
-
-#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BREAKPOINT)
-#define IS_WATCHPOINT_TRAP(type, code) (0)
-
-#define inst_trap_return(ins) ((ins)&0)
-#define inst_return(ins) ((ins)&0)
-#define inst_call(ins) ((ins)&0)
-#define inst_load(ins) 0
-#define inst_store(ins) 0
-
-#define DB_MACHINE_COMMANDS
-
-void db_machine_init __P((void));
-int kdb_trap __P((int, struct trapframe *));
-
-
-#endif /* _SPARC_DB_MACHDEP_H_ */
diff --git a/sys/arch/kbus/include/disklabel.h b/sys/arch/kbus/include/disklabel.h
deleted file mode 100644
index 203bccc5a06..00000000000
--- a/sys/arch/kbus/include/disklabel.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* $OpenBSD: disklabel.h,v 1.1.1.1 1997/10/14 07:25:31 gingold Exp $ */
-/* $NetBSD: disklabel.h,v 1.4 1995/09/01 17:20:31 pk Exp $ */
-
-/*
- * Copyright (c) 1994 Christopher G. Demetriou
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christopher G. Demetriou.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_DISKLABEL_H_
-#define _MACHINE_DISKLABEL_H_
-
-#define LABELSECTOR 0 /* sector containing label */
-#define LABELOFFSET 64 /* offset of label in sector */
-#define MAXPARTITIONS 16 /* number of partitions */
-#define RAW_PART 2 /* raw partition: xx?c */
-
-struct cpu_disklabel {
- char cd_block[512];
-};
-
-#endif /* _MACHINE_DISKLABEL_H_ */
diff --git a/sys/arch/kbus/include/dvma.h b/sys/arch/kbus/include/dvma.h
deleted file mode 100644
index ed9f017692f..00000000000
--- a/sys/arch/kbus/include/dvma.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $OpenBSD: dvma.h,v 1.1.1.1 1997/10/14 07:25:30 gingold Exp $ */
-/* $NetBSD: dvma.h,v 1.4 1996/11/20 18:57:08 gwr Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Gordon W. Ross.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * dvmamap manages a range of DVMA addresses intended to create double
- * mappings of physical memory. In a way, `dvmamap' is a submap of the
- * VM map `phys_map'. The difference is the use of the `resource map'
- * routines to manage page allocation, allowing DVMA addresses to be
- * allocated and freed from within interrupt routines.
- *
- * Note that `phys_map' can still be used to allocate memory-backed pages
- * in DVMA space.
- */
-
-extern struct map *dvmamap;
-
-/* Allow up to 1 Mb of DVMA space. */
-#define DVMA_SIZE (1 << 20)
-
-/*
- * The dvma resource map is defined in page units, which are numbered 1 to N.
- * Use these macros to convert to/from virtual addresses.
- */
-#define rctov(n) ctob(((n)-1))
-#define vtorc(v) ((btoc(v))+1)
-
-extern caddr_t kdvma_mapin __P((caddr_t, int, int));
-extern caddr_t dvma_malloc __P((size_t, void *, int));
-extern void dvma_free __P((caddr_t, size_t, void *));
-extern void dvma_mapout __P((vm_offset_t kva, vm_offset_t va, int len));
-extern vm_offset_t dvma_mapin __P((struct vm_map *, vm_offset_t, int, int));
-
diff --git a/sys/arch/kbus/include/endian.h b/sys/arch/kbus/include/endian.h
deleted file mode 100644
index b14bce734dd..00000000000
--- a/sys/arch/kbus/include/endian.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* $OpenBSD: endian.h,v 1.4 1999/05/10 16:02:09 espie Exp $ */
-
-/*-
- * Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Niklas Hallqvist.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _KBUS_ENDIAN_H_
-#define _KBUS_ENDIAN_H_
-
-#define BYTE_ORDER BIG_ENDIAN
-#include <sys/endian.h>
-
-#endif /* _KBUS_ENDIAN_H_ */
diff --git a/sys/arch/kbus/include/exec.h b/sys/arch/kbus/include/exec.h
deleted file mode 100644
index 00834db5f52..00000000000
--- a/sys/arch/kbus/include/exec.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $NetBSD: exec.h,v 1.7 1994/11/20 20:53:02 deraadt Exp $ */
-
-/*
- * Copyright (c) 1993 Christopher G. Demetriou
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _SPARC_EXEC_H_
-#define _SPARC_EXEC_H_
-
-#define __LDPGSZ 8192 /* linker page size */
-
-enum reloc_type {
- RELOC_8, RELOC_16, RELOC_32,
- RELOC_DISP8, RELOC_DISP16, RELOC_DISP32,
- RELOC_WDISP30, RELOC_WDISP22,
- RELOC_HI22, RELOC_22,
- RELOC_13, RELOC_LO10,
- RELOC_UNUSED1, RELOC_UNUSED2,
- RELOC_BASE10, RELOC_BASE13, RELOC_BASE22,
- RELOC_PC10, RELOC_PC22,
- RELOC_JMP_TBL,
- RELOC_UNUSED3,
- RELOC_GLOB_DAT, RELOC_JMP_SLOT, RELOC_RELATIVE,
-};
-
-/* Relocation format. */
-struct relocation_info_sparc {
- int r_address; /* offset in text or data segment */
- unsigned int r_symbolnum : 24, /* ordinal number of add symbol */
- r_extern : 1, /* 1 if need to add symbol to value */
- : 2; /* unused bits */
- enum reloc_type r_type : 5; /* relocation type time copy */
- long r_addend; /* relocation addend */
-};
-#define relocation_info relocation_info_sparc
-
-#define ARCH_ELFSIZE 32
-
-#define ELF_TARG_CLASS ELFCLASS32
-#define ELF_TARG_DATA ELFDATA2MSB
-#define ELF_TARG_MACH EM_SPARC
-
-#define _NLIST_DO_AOUT
-#define _NLIST_DO_ELF
-
-#define _KERN_DO_AOUT
-#if defined(COMPAT_LINUX) || defined(COMPAT_SVR4)
-#define _KERN_DO_ELF
-#endif
-
-#endif /* _SPARC_EXEC_H_ */
diff --git a/sys/arch/kbus/include/float.h b/sys/arch/kbus/include/float.h
deleted file mode 100644
index 8022d3aa8b4..00000000000
--- a/sys/arch/kbus/include/float.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* $NetBSD: float.h,v 1.5 1995/06/20 20:45:53 jtc Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)float.h 8.1 (Berkeley) 6/11/93
- */
-
-#ifndef _SPARC_FLOAT_H_
-#define _SPARC_FLOAT_H_
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-extern int __flt_rounds();
-__END_DECLS
-
-#define FLT_RADIX 2 /* b */
-#define FLT_ROUNDS __flt_rounds()
-
-#define FLT_MANT_DIG 24 /* p */
-#define FLT_EPSILON 1.19209290E-07F /* b**(1-p) */
-#define FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */
-#define FLT_MIN_EXP -125 /* emin */
-#define FLT_MIN 1.17549435E-38F /* b**(emin-1) */
-#define FLT_MIN_10_EXP -37 /* ceil(log10(b**(emin-1))) */
-#define FLT_MAX_EXP 128 /* emax */
-#define FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */
-#define FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */
-
-#define DBL_MANT_DIG 53
-#define DBL_EPSILON 2.2204460492503131E-16
-#define DBL_DIG 15
-#define DBL_MIN_EXP -1021
-#define DBL_MIN 2.2250738585072014E-308
-#define DBL_MIN_10_EXP -307
-#define DBL_MAX_EXP 1024
-#define DBL_MAX 1.7976931348623157E+308
-#define DBL_MAX_10_EXP 308
-
-#define LDBL_MANT_DIG DBL_MANT_DIG
-#define LDBL_EPSILON DBL_EPSILON
-#define LDBL_DIG DBL_DIG
-#define LDBL_MIN_EXP DBL_MIN_EXP
-#define LDBL_MIN DBL_MIN
-#define LDBL_MIN_10_EXP DBL_MIN_10_EXP
-#define LDBL_MAX_EXP DBL_MAX_EXP
-#define LDBL_MAX DBL_MAX
-#define LDBL_MAX_10_EXP DBL_MAX_10_EXP
-
-#endif /* _SPARC_FLOAT_H_ */
diff --git a/sys/arch/kbus/include/frame.h b/sys/arch/kbus/include/frame.h
deleted file mode 100644
index 3200b1d9ca9..00000000000
--- a/sys/arch/kbus/include/frame.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* $NetBSD: frame.h,v 1.2 1994/11/20 20:53:07 deraadt Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)frame.h 8.1 (Berkeley) 6/11/93
- */
-
-#ifndef _MACHINE_FRAME_H_
-#define _MACHINE_FRAME_H_
-
-/*
- * Sparc stack frame format.
- *
- * Note that the contents of each stack frame may be held only in
- * machine register windows. In order to get an accurate picture
- * of the frame, you must first force the kernel to write any such
- * windows to the stack.
- */
-struct frame {
- int fr_local[8]; /* space to save locals (%l0..%l7) */
- int fr_arg[6]; /* space to save arguments (%i0..%i5) */
- struct frame *fr_fp; /* space to save frame pointer (%i6) */
- int fr_pc; /* space to save return pc (%i7) */
- /*
- * SunOS reserves another 8 words here; this is pointless
- * but we do it for compatibility.
- */
- int fr_xxx; /* `structure return pointer' (unused) */
- int fr_argd[6]; /* `arg dump area' (lunacy) */
- int fr_argx[1]; /* arg extension (args 7..n; variable size) */
-};
-
-#endif /* _MACHINE_FRAME_H_ */
diff --git a/sys/arch/kbus/include/fsr.h b/sys/arch/kbus/include/fsr.h
deleted file mode 100644
index a1d43581015..00000000000
--- a/sys/arch/kbus/include/fsr.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* $NetBSD: fsr.h,v 1.2 1994/11/20 20:53:08 deraadt Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fsr.h 8.1 (Berkeley) 6/11/93
- */
-
-#ifndef _MACHINE_FSR_H_
-#define _MACHINE_FSR_H_
-
-/*
- * Bits in FSR.
- */
-#define FSR_RD 0xc0000000 /* rounding direction */
-#define FSR_RD_RN 0 /* round to nearest */
-#define FSR_RD_RZ 1 /* round towards 0 */
-#define FSR_RD_RP 2 /* round towards +inf */
-#define FSR_RD_RM 3 /* round towards -inf */
-#define FSR_RD_SHIFT 30
-#define FSR_RD_MASK 0x03
-
-#define FSR_RP 0x30000000 /* extended rounding precision */
-#define FSR_RP_X 0 /* extended stays extended */
-#define FSR_RP_S 1 /* extended => single */
-#define FSR_RP_D 2 /* extended => double */
-#define FSR_RP_80 3 /* extended => 80-bit */
-#define FSR_RP_SHIFT 28
-#define FSR_RP_MASK 0x03
-
-#define FSR_TEM 0x0f800000 /* trap enable mask */
-#define FSR_TEM_SHIFT 23
-#define FSR_TEM_MASK 0x1f
-
-#define FSR_NS 0x00400000 /* ``nonstandard mode'' */
-#define FSR_AU 0x00400000 /* aka abrupt underflow mode */
-#define FSR_MBZ 0x00300000 /* reserved; must be zero */
-
-#define FSR_VER 0x000e0000 /* version bits */
-#define FSR_VER_SHIFT 17
-#define FSR_VER_MASK 0x07
-
-#define FSR_FTT 0x0001c000 /* FP trap type */
-#define FSR_TT_NONE 0 /* no trap */
-#define FSR_TT_IEEE 1 /* IEEE exception */
-#define FSR_TT_UNFIN 2 /* unfinished operation */
-#define FSR_TT_UNIMP 3 /* unimplemented operation */
-#define FSR_TT_SEQ 4 /* sequence error */
-#define FSR_TT_HWERR 5 /* hardware error (unrecoverable) */
-#define FSR_FTT_SHIFT 14
-#define FSR_FTT_MASK 0x03
-
-#define FSR_QNE 0x00002000 /* queue not empty */
-#define FSR_PR 0x00001000 /* partial result */
-
-#define FSR_FCC 0x00000c00 /* FP condition codes */
-#define FSR_CC_EQ 0 /* f1 = f2 */
-#define FSR_CC_LT 1 /* f1 < f2 */
-#define FSR_CC_GT 2 /* f1 > f2 */
-#define FSR_CC_UO 3 /* (f1,f2) unordered */
-#define FSR_FCC_SHIFT 10
-#define FSR_FCC_MASK 0x03
-
-#define FSR_AX 0x000003e0 /* accrued exceptions */
-#define FSR_AX_SHIFT 5
-#define FSR_AX_MASK 0x1f
-#define FSR_CX 0x0000001f /* current exceptions */
-#define FSR_CX_SHIFT 0
-#define FSR_CX_MASK 0x1f
-
-/* The following exceptions apply to TEM, AX, and CX. */
-#define FSR_NV 0x10 /* invalid operand */
-#define FSR_OF 0x08 /* overflow */
-#define FSR_UF 0x04 /* underflow */
-#define FSR_DZ 0x02 /* division by zero */
-#define FSR_NX 0x01 /* inexact result */
-
-#endif /* _MACHINE_FSR_H_ */
diff --git a/sys/arch/kbus/include/ieee.h b/sys/arch/kbus/include/ieee.h
deleted file mode 100644
index 188438c0d95..00000000000
--- a/sys/arch/kbus/include/ieee.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* $NetBSD: ieee.h,v 1.2 1994/11/20 20:53:10 deraadt Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ieee.h 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * ieee.h defines the machine-dependent layout of the machine's IEEE
- * floating point. It does *not* define (yet?) any of the rounding
- * mode bits, exceptions, and so forth.
- */
-
-/*
- * Define the number of bits in each fraction and exponent.
- *
- * k k+1
- * Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented
- *
- * (-exp_bias+1)
- * as fractions that look like 0.fffff x 2 . This means that
- *
- * -126
- * the number 0.10000 x 2 , for instance, is the same as the normalized
- *
- * -127 -128
- * float 1.0 x 2 . Thus, to represent 2 , we need one leading zero
- *
- * -129
- * in the fraction; to represent 2 , we need two, and so on. This
- *
- * (-exp_bias-fracbits+1)
- * implies that the smallest denormalized number is 2
- *
- * for whichever format we are talking about: for single precision, for
- *
- * -126 -149
- * instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and
- *
- * -149 == -127 - 23 + 1.
- */
-#define SNG_EXPBITS 8
-#define SNG_FRACBITS 23
-
-#define DBL_EXPBITS 11
-#define DBL_FRACBITS 52
-
-#ifdef notyet
-#define E80_EXPBITS 15
-#define E80_FRACBITS 64
-#endif
-
-#define EXT_EXPBITS 15
-#define EXT_FRACBITS 112
-
-struct ieee_single {
- u_int sng_sign:1;
- u_int sng_exp:8;
- u_int sng_frac:23;
-};
-
-struct ieee_double {
- u_int dbl_sign:1;
- u_int dbl_exp:11;
- u_int dbl_frach:20;
- u_int dbl_fracl;
-};
-
-struct ieee_ext {
- u_int ext_sign:1;
- u_int ext_exp:15;
- u_int ext_frach:16;
- u_int ext_frachm;
- u_int ext_fraclm;
- u_int ext_fracl;
-};
-
-/*
- * Floats whose exponent is in [1..INFNAN) (of whatever type) are
- * `normal'. Floats whose exponent is INFNAN are either Inf or NaN.
- * Floats whose exponent is zero are either zero (iff all fraction
- * bits are zero) or subnormal values.
- *
- * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its
- * high fraction; if the bit is set, it is a `quiet NaN'.
- */
-#define SNG_EXP_INFNAN 255
-#define DBL_EXP_INFNAN 2047
-#define EXT_EXP_INFNAN 32767
-
-#if 0
-#define SNG_QUIETNAN (1 << 22)
-#define DBL_QUIETNAN (1 << 19)
-#define EXT_QUIETNAN (1 << 15)
-#endif
-
-/*
- * Exponent biases.
- */
-#define SNG_EXP_BIAS 127
-#define DBL_EXP_BIAS 1023
-#define EXT_EXP_BIAS 16383
diff --git a/sys/arch/kbus/include/ieeefp.h b/sys/arch/kbus/include/ieeefp.h
deleted file mode 100644
index a1e67846b83..00000000000
--- a/sys/arch/kbus/include/ieeefp.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Written by J.T. Conklin, Apr 6, 1995
- * Public domain.
- */
-
-#ifndef _SPARC_IEEEFP_H_
-#define _SPARC_IEEEFP_H_
-
-typedef int fp_except;
-#define FP_X_IMP 0x01 /* imprecise (loss of precision) */
-#define FP_X_DZ 0x02 /* divide-by-zero exception */
-#define FP_X_UFL 0x04 /* underflow exception */
-#define FP_X_OFL 0x08 /* overflow exception */
-#define FP_X_INV 0x10 /* invalid operation exception */
-
-typedef enum {
- FP_RN=0, /* round to nearest representable number */
- FP_RZ=1, /* round to zero (truncate) */
- FP_RM=2, /* round toward negative infinity */
- FP_RP=3 /* round toward positive infinity */
-} fp_rnd;
-
-#endif /* _SPARC_IEEEFP_H_ */
diff --git a/sys/arch/kbus/include/instr.h b/sys/arch/kbus/include/instr.h
deleted file mode 100644
index 6aa7c24229d..00000000000
--- a/sys/arch/kbus/include/instr.h
+++ /dev/null
@@ -1,360 +0,0 @@
-/* $NetBSD: instr.h,v 1.2 1994/11/20 20:53:11 deraadt Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)instr.h 8.1 (Berkeley) 6/11/93
- */
-
-/* see also Appendix F of the SPARC version 8 document */
-enum IOP { IOP_OP2, IOP_CALL, IOP_reg, IOP_mem };
-enum IOP2 { IOP2_UNIMP, IOP2_err1, IOP2_Bicc, IOP2_err3,
- IOP2_SETHI, IOP2_err5, IOP2_FBfcc, IOP2_CBccc };
-enum IOP3_reg {
- IOP3_ADD, IOP3_AND, IOP3_OR, IOP3_XOR,
- IOP3_SUB, IOP3_ANDN, IOP3_ORN, IOP3_XNOR,
- IOP3_ADDX, IOP3_rerr09, IOP3_UMUL, IOP3_SMUL,
- IOP3_SUBX, IOP3_rerr0d, IOP3_UDIV, IOP3_SDIV,
- IOP3_ADDcc, IOP3_ANDcc, IOP3_ORcc, IOP3_XORcc,
- IOP3_SUBcc, IOP3_ANDNcc, IOP3_ORNcc, IOP3_XNORcc,
- IOP3_ADDXcc, IOP3_rerr19, IOP3_UMULcc, IOP3_SMULcc,
- IOP3_SUBXcc, IOP3_rerr1d, IOP3_UDIVcc, IOP3_SDIVcc,
- IOP3_TADDcc, IOP3_TSUBcc, IOP3_TADDccTV, IOP3_TSUBccTV,
- IOP3_MULScc, IOP3_SLL, IOP3_SRL, IOP3_SRA,
- IOP3_RDASR_RDY_STBAR, IOP3_RDPSR, IOP3_RDWIM, IOP3_RDTGBR,
- IOP3_rerr2c, IOP3_rerr2d, IOP3_rerr2e, IOP3_rerr2f,
- IOP3_WRASR_WRY, IOP3_WRPSR, IOP3_WRWIM, IOP3_WRTBR,
- IOP3_FPop1, IOP3_FPop2, IOP3_CPop1, IOP3_CPop2,
- IOP3_JMPL, IOP3_RETT, IOP3_Ticc, IOP3_FLUSH,
- IOP3_SAVE, IOP3_RESTORE, IOP3_rerr3e, IOP3_rerr3f
-};
-enum IOP3_mem {
- IOP3_LD, IOP3_LDUB, IOP3_LDUH, IOP3_LDD,
- IOP3_ST, IOP3_STB, IOP3_STH, IOP3_STD,
- IOP3_merr08, IOP3_LDSB, IOP3_LDSH, IOP3_merr0b,
- IOP3_merr0c, IOP3_LDSTUB, IOP3_merr0f, IOP3_SWAP,
- IOP3_LDA, IOP3_LDUBA, IOP3_LDUHA, IOP3_LDDA,
- IOP3_STA, IOP3_STBA, IOP3_STHA, IOP3_STDA,
- IOP3_merr18, IOP3_LDSBA, IOP3_LDSHA, IOP3_merr1b,
- IOP3_merr1c, IOP3_LDSTUBA, IOP3_merr1f, IOP3_SWAPA,
- IOP3_LDF, IOP3_LDFSR, IOP3_merr22, IOP3_LDDF,
- IOP3_STF, IOP3_STFSR, IOP3_STDFQ, IOP3_STDF,
- IOP3_merr28, IOP3_merr29, IOP3_merr2a, IOP3_merr2b,
- IOP3_merr2c, IOP3_merr2d, IOP3_merr2e, IOP3_merr2f,
- IOP3_LFC, IOP3_LDCSR, IOP3_merr32, IOP3_LDDC,
- IOP3_STC, IOP3_STCSR, IOP3_STDCQ, IOP3_STDC,
- IOP3_merr38, IOP3_merr39, IOP3_merr3a, IOP3_merr3b,
- IOP3_merr3c, IOP3_merr3d, IOP3_merr3e, IOP3_merr3f
-};
-
-/*
- * Integer condition codes.
- */
-#define Icc_N 0x0 /* never */
-#define Icc_E 0x1 /* equal (equiv. zero) */
-#define Icc_LE 0x2 /* less or equal */
-#define Icc_L 0x3 /* less */
-#define Icc_LEU 0x4 /* less or equal unsigned */
-#define Icc_CS 0x5 /* carry set (equiv. less unsigned) */
-#define Icc_NEG 0x6 /* negative */
-#define Icc_VS 0x7 /* overflow set */
-#define Icc_A 0x8 /* always */
-#define Icc_NE 0x9 /* not equal (equiv. not zero) */
-#define Icc_G 0xa /* greater */
-#define Icc_GE 0xb /* greater or equal */
-#define Icc_GU 0xc /* greater unsigned */
-#define Icc_CC 0xd /* carry clear (equiv. gtr or eq unsigned) */
-#define Icc_POS 0xe /* positive */
-#define Icc_VC 0xf /* overflow clear */
-
-/*
- * Integer registers.
- */
-#define I_G0 0
-#define I_G1 1
-#define I_G2 2
-#define I_G3 3
-#define I_G4 4
-#define I_G5 5
-#define I_G6 6
-#define I_G7 7
-#define I_O0 8
-#define I_O1 9
-#define I_O2 10
-#define I_O3 11
-#define I_O4 12
-#define I_O5 13
-#define I_O6 14
-#define I_O7 15
-#define I_L0 16
-#define I_L1 17
-#define I_L2 18
-#define I_L3 19
-#define I_L4 20
-#define I_L5 21
-#define I_L6 22
-#define I_L7 23
-#define I_I0 24
-#define I_I1 25
-#define I_I2 26
-#define I_I3 27
-#define I_I4 28
-#define I_I5 29
-#define I_I6 30
-#define I_I7 31
-
-/*
- * An instruction.
- */
-union instr {
- int i_int; /* as a whole */
-
- /*
- * The first level of decoding is to use the top 2 bits.
- * This gives us one of three `formats', which usually give
- * a second level of decoding.
- */
- struct {
- u_int i_op:2; /* first-level decode */
- u_int :30;
- } i_any;
-
- /*
- * Format 1 instructions: CALL (undifferentiated).
- */
- struct {
- u_int :2; /* 01 */
- int i_disp:30; /* displacement */
- } i_call;
-
- /*
- * Format 2 instructions (SETHI, UNIMP, and branches, plus illegal
- * unused codes).
- */
- struct {
- u_int :2; /* 00 */
- u_int :5;
- u_int i_op2:3; /* second-level decode */
- u_int :22;
- } i_op2;
-
- /* UNIMP, SETHI */
- struct {
- u_int :2; /* 00 */
- u_int i_rd:5; /* destination register */
- u_int i_op2:3; /* opcode: UNIMP or SETHI */
- u_int i_imm:22; /* immediate value */
- } i_imm22;
-
- /* branches: Bicc, FBfcc, CBccc */
- struct {
- u_int :2; /* 00 */
- u_int i_annul:1; /* annul bit */
- u_int i_cond:4; /* condition codes */
- u_int i_op2:3; /* opcode: {Bi,FBf,CBc}cc */
- int i_disp:22; /* branch displacement */
- } i_branch;
-
- /*
- * Format 3 instructions (memory reference; arithmetic, logical,
- * shift, and other miscellaneous operations). The second-level
- * decode almost always makes use of an `rd' and `rs1', however
- * (see also IOP3_reg and IOP3_mem).
- *
- * Beyond that, the low 14 bits may be broken up in one of three
- * different ways, if at all:
- * 1 bit of imm=0 + 8 bits of asi + 5 bits of rs2 [reg & mem]
- * 1 bit of imm=1 + 13 bits of signed immediate [reg & mem]
- * 9 bits of copressor `opf' opcode + 5 bits of rs2 [reg only]
- */
- struct {
- u_int :2; /* 10 or 11 */
- u_int i_rd:5; /* destination register */
- u_int i_op3:6; /* second-level decode */
- u_int i_rs1:5; /* source register 1 */
- u_int i_low14:14; /* varies */
- } i_op3;
-
- /*
- * Memory forms. These set i_op=3 and use simm13 or asi layout.
- * Memory references without an ASI should use 0, but the actual
- * ASI field is simply ignored.
- */
- struct {
- u_int :2; /* 11 only */
- u_int i_rd:5; /* destination register */
- u_int i_op3:6; /* second-level decode (see IOP3_mem) */
- u_int i_i:1; /* immediate vs asi */
- u_int i_low13:13; /* depend on i bit */
- } i_loadstore;
-
- /*
- * Memory and register forms.
- * These come in quite a variety and we do not
- * attempt to break them down much.
- */
- struct {
- u_int :2; /* 10 or 11 */
- u_int i_rd:5; /* destination register */
- u_int i_op3:6; /* second-level decode */
- u_int i_rs1:5; /* source register 1 */
- u_int i_i:1; /* immediate bit (1) */
- int i_simm13:13; /* signed immediate */
- } i_simm13;
- struct {
- u_int :2; /* 10 or 11 */
- u_int i_rd:5; /* destination register */
- u_int i_op3:6; /* second-level decode */
- u_int i_rs1:5; /* source register 1 */
- u_int i_asi:8; /* asi */
- u_int i_rs2:5; /* source register 2 */
- } i_asi;
- struct {
- u_int :2; /* 10 only (register, no memory) */
- u_int i_rd:5; /* destination register */
- u_int i_op3:6; /* second-level decode (see IOP3_reg) */
- u_int i_rs1:5; /* source register 1 */
- u_int i_opf:9; /* coprocessor 3rd-level decode */
- u_int i_rs2:5; /* source register 2 */
- } i_opf;
-
-};
-
-/*
- * Internal macros for building instructions. These correspond 1-to-1 to
- * the names above. Note that x << y | z == (x << y) | z.
- */
-#define _I_ANY(op, b) ((op) << 30 | (b))
-
-#define _I_OP2(high, op2, low) \
- _I_ANY(IOP_OP2, (high) << 25 | (op2) << 22 | (low))
-#define _I_IMM22(rd, op2, imm) \
- _I_ANY(IOP_OP2, (rd) << 25 | (op2) << 22 | (imm))
-#define _I_BRANCH(a, c, op2, disp) \
- _I_ANY(IOP_OP2, (a) << 29 | (c) << 25 | (op2) << 22 | (disp))
-#define _I_FBFCC(a, cond, disp) \
- _I_BRANCH(a, cond, IOP2_FBfcc, disp)
-#define _I_CBCCC(a, cond, disp) \
- _I_BRANCH(a, cond, IOP2_CBccc, disp)
-
-#define _I_SIMM(simm) (1 << 13 | ((simm) & 0x1fff))
-
-#define _I_OP3_GEN(form, rd, op3, rs1, low14) \
- _I_ANY(form, (rd) << 25 | (op3) << 19 | (rs1) << 14 | (low14))
-#define _I_OP3_LS_RAR(rd, op3, rs1, asi, rs2) \
- _I_OP3_GEN(IOP_mem, rd, op3, rs1, (asi) << 5 | (rs2))
-#define _I_OP3_LS_RI(rd, op3, rs1, simm13) \
- _I_OP3_GEN(IOP_mem, rd, op3, rs1, _I_SIMM(simm13))
-#define _I_OP3_LS_RR(rd, op3, rs1, rs2) \
- _I_OP3_GEN(IOP_mem, rd, op3, rs1, rs2)
-#define _I_OP3_R_RAR(rd, op3, rs1, asi, rs2) \
- _I_OP3_GEN(IOP_reg, rd, op3, rs1, (asi) << 5 | (rs2))
-#define _I_OP3_R_RI(rd, op3, rs1, simm13) \
- _I_OP3_GEN(IOP_reg, rd, op3, rs1, _I_SIMM(simm13))
-#define _I_OP3_R_RR(rd, op3, rs1, rs2) \
- _I_OP3_GEN(IOP_reg, rd, op3, rs1, rs2)
-
-#define I_CALL(d) _I_ANY(IOP_CALL, d)
-#define I_UNIMP(v) _I_IMM22(0, IOP2_UNIMP, v)
-#define I_BN(a, d) _I_BRANCH(a, Icc_N, IOP2_Bicc, d)
-#define I_BE(a, d) _I_BRANCH(a, Icc_E, IOP2_Bicc, d)
-#define I_BZ(a, d) _I_BRANCH(a, Icc_E, IOP2_Bicc, d)
-#define I_BLE(a, d) _I_BRANCH(a, Icc_LE, IOP2_Bicc, d)
-#define I_BL(a, d) _I_BRANCH(a, Icc_L, IOP2_Bicc, d)
-#define I_BLEU(a, d) _I_BRANCH(a, Icc_LEU, IOP2_Bicc, d)
-#define I_BCS(a, d) _I_BRANCH(a, Icc_CS, IOP2_Bicc, d)
-#define I_BLU(a, d) _I_BRANCH(a, Icc_CS, IOP2_Bicc, d)
-#define I_BNEG(a, d) _I_BRANCH(a, Icc_NEG, IOP2_Bicc, d)
-#define I_BVS(a, d) _I_BRANCH(a, Icc_VS, IOP2_Bicc, d)
-#define I_BA(a, d) _I_BRANCH(a, Icc_A, IOP2_Bicc, d)
-#define I_B(a, d) _I_BRANCH(a, Icc_A, IOP2_Bicc, d)
-#define I_BNE(a, d) _I_BRANCH(a, Icc_NE, IOP2_Bicc, d)
-#define I_BNZ(a, d) _I_BRANCH(a, Icc_NE, IOP2_Bicc, d)
-#define I_BG(a, d) _I_BRANCH(a, Icc_G, IOP2_Bicc, d)
-#define I_BGE(a, d) _I_BRANCH(a, Icc_GE, IOP2_Bicc, d)
-#define I_BGU(a, d) _I_BRANCH(a, Icc_GU, IOP2_Bicc, d)
-#define I_BCC(a, d) _I_BRANCH(a, Icc_CC, IOP2_Bicc, d)
-#define I_BGEU(a, d) _I_BRANCH(a, Icc_CC, IOP2_Bicc, d)
-#define I_BPOS(a, d) _I_BRANCH(a, Icc_POS, IOP2_Bicc, d)
-#define I_BVC(a, d) _I_BRANCH(a, Icc_VC, IOP2_Bicc, d)
-#define I_SETHI(r, v) _I_IMM22(r, 4, v)
-
-#define I_ORri(rd, rs1, imm) _I_OP3_R_RI(rd, IOP3_OR, rs1, imm)
-#define I_ORrr(rd, rs1, rs2) _I_OP3_R_RR(rd, IOP3_OR, rs1, rs2)
-
-#define I_MOVi(rd, imm) _I_OP3_R_RI(rd, IOP3_OR, I_G0, imm)
-#define I_MOVr(rd, rs) _I_OP3_R_RR(rd, IOP3_OR, I_G0, rs)
-
-#define I_RDPSR(rd) _I_OP3_R_RR(rd, IOP3_RDPSR, 0, 0)
-
-#define I_JMPLri(rd, rs1, imm) _I_OP3_R_RI(rd, IOP3_JMPL, rs1, imm)
-#define I_JMPLrr(rd, rs1, rs2) _I_OP3_R_RR(rd, IOP3_JMPL, rs1, rs2)
-
-/*
- * (Since these are sparse, we skip the enumerations for now.)
- * FPop values. All appear in both FPop1 and FPop2 spaces, but arithmetic
- * ops should happen only with FPop1 and comparison only with FPop2.
- * The type sits in the low two bits; those bits are given as zero here.
- */
-#define FMOV 0x00
-#define FNEG 0x04
-#define FABS 0x08
-#define FSQRT 0x28
-#define FADD 0x40
-#define FSUB 0x44
-#define FMUL 0x48
-#define FDIV 0x4c
-#define FCMP 0x50
-#define FCMPE 0x54
-#define FSMULD 0x68
-#define FDMULX 0x6c
-#define FTOS 0xc4
-#define FTOD 0xc8
-#define FTOX 0xcc
-#define FTOI 0xd0
-
-/*
- * FPU data types.
- */
-#define FTYPE_INT 0 /* data = 32-bit signed integer */
-#define FTYPE_SNG 1 /* data = 32-bit float */
-#define FTYPE_DBL 2 /* data = 64-bit double */
-#define FTYPE_EXT 3 /* data = 128-bit extended (quad-prec) */
diff --git a/sys/arch/kbus/include/ioasic.h b/sys/arch/kbus/include/ioasic.h
deleted file mode 100644
index a59785d1905..00000000000
--- a/sys/arch/kbus/include/ioasic.h
+++ /dev/null
@@ -1,39 +0,0 @@
-struct ioasic_reg
-{
- volatile int ioasic_ir; /* 0x00: ioasic interrupt register. */
-#define IOASIC_IR_VMEPANIC 0x01 /* VMEbus panic condition. */
-#define IOASIC_IR_SI_PO 0x02 /* scsi page overflow. */
-#define IOASIC_IR_SI_ECC_TO 0x04 /* scsi ECC/timeout error. */
-
- volatile int ioasic_ei_rar; /* 0x04: ioasic enet recv addr. */
-#define IOASIC_EI_RAR_SHIFT 15
-
- volatile int ioasic_ei_tar1; /* 0x08: ioasic enet xmit addr reg 1. */
- volatile int ioasic_ei_tar2; /* 0x0C: ioasic enet xmit addr reg 2. */
-#define IOASIC_EI_TAR_SHIFT 13
-
- /* As far as I know, the IOASIC is the dma controller. The address
- is split between SAR (the 19 high bits) and CTL (the 13 low bits).
- CTL also contains the sens of transfer. */
- volatile int ioasic_si_sar; /* 0x10: ioasic right shift addr. */
-#define IOASIC_SI_SAR_SHIFT 13
-#define IOASIC_SI_SAR_MASK 0x0007FFFF /* 19 bits. */
- volatile int ioasic_si_ctl; /* 0x14: ioasic scsi control register. */
-#define IOASIC_SI_CTL_READ 0
-#define IOASIC_SI_CTL_WRITE 1
-#define IOASIC_SI_CTL_PRE 2
-#define IOASIC_SI_CTL_SHIFT 2 /* left shift addr. */
-#define IOASIC_SI_CTL_MASK 0x00007FFF
-#define IOASIC_SI_CTL_AMASK 0x00007FFC /* 13 bits. */
- int ioasic_pad[6];
- volatile int ioasic_si_sar_pre; /* 0x30: prefetch ioasic scsi addr reg. */
-};
-
-#define IOASIC_ADDR 0x90000000
-#define IOASIC_SIZE 0x2000
-#define WD33C93A_ADDR 0x90000800
-#define WD33C93A_OFFSET 0x00000800
-#define LANCE_ADDR 0X90001000
-#define LANCE_OFFSET 0x00001000
-
-extern struct ioasic_reg *ioasic;
diff --git a/sys/arch/kbus/include/kbus.h b/sys/arch/kbus/include/kbus.h
deleted file mode 100644
index 78136e1de92..00000000000
--- a/sys/arch/kbus/include/kbus.h
+++ /dev/null
@@ -1,96 +0,0 @@
-#define SPACE_ID 0x01
-#define KBUS_SPACE_SHIFT 28
-#define KBUS_SLOT_SHIFT 24
-
-#define BID_SLOT 0x0f
-#define BID_DIAG 0x10
-#define BID_NMI 0x20
-#define BID_SYSFAIL 0x40
-#define BID_BJMPR0 0x80
-
-#define CPUSTAT 0x4018
-#define CPUSTAT_SLAVE 0x01
-#define CPUSTAT_GOOD 0x02
-#define CPUSTAT_NMI 0x04
-#define CPUSTAT_SYSFAIL 0x08
-
-#define DG_CONFIG 0x200
-#define DG_HDR_SIZE 16
-#define DG_CPU_COUNT DG_CONFIG
-#define DG_MEM_COUNT (DG_CPU_COUNT + DG_HDR_SIZE)
-#define DG_SYS_COUNT (DG_MEM_COUNT + DG_HDR_SIZE)
-#define DG_GPX_COUNT (DG_SYS_COUNT + DG_HDR_SIZE)
-#define DG_COP_COUNT (DG_GPX_COUNT + DG_HDR_SIZE)
-#define DG_TY_COUNT (DG_COP_COUNT + DG_HDR_SIZE)
-#define DG_RES1_COUNT (DG_TY_COUNT + DG_HDR_SIZE)
-#define DG_RES2_COUNT (DG_RES1_COUNT + DG_HDR_SIZE)
-#define DG_RES3_COUNT (DG_RES2_COUNT + DG_HDR_SIZE)
-
-#define DG_SLOT_INFO (DG_RES3_COUNT + DG_HDR_SIZE)
-#define DG_SLOT_SIZE 8
-#define DG_SLOT_SHIFT 3
-
-#define DG_SLOT1 DG_SLOT_INFO
-#define DG_SLOT2 (DG_SLOT1 + DG_SLOT_SIZE)
-#define DG_SLOT3 (DG_SLOT2 + DG_SLOT_SIZE)
-#define DG_SLOT4 (DG_SLOT3 + DG_SLOT_SIZE)
-#define DG_SLOT5 (DG_SLOT4 + DG_SLOT_SIZE)
-#define DG_SLOT6 (DG_SLOT5 + DG_SLOT_SIZE)
-#define DG_SLOT7 (DG_SLOT6 + DG_SLOT_SIZE)
-#define DG_SLOT8 (DG_SLOT7 + DG_SLOT_SIZE)
-#define DG_SLOT9 (DG_SLOT8 + DG_SLOT_SIZE)
-#define DG_SLOTA (DG_SLOT9 + DG_SLOT_SIZE)
-#define DG_SLOTB (DG_SLOTA + DG_SLOT_SIZE)
-#define DG_SLOTC (DG_SLOTB + DG_SLOT_SIZE)
-#define DG_SLOTD (DG_SLOTC + DG_SLOT_SIZE)
-#define DG_SLOTE (DG_SLOTD + DG_SLOT_SIZE)
-#define DG_SLOTF (DG_SLOTE + DG_SLOT_SIZE)
-#define DG_SLOT2 (DG_SLOT1 + DG_SLOT_SIZE)
-
-#define DG_MEM_TOTAL (DG_SLOTF + DG_SLOT_SIZE)
-
-#define DG_BD_PRESENT 0
-#define DG_ID_OFF 1
-
-/* A few things about vme. */
-#define VME_MAP_BASE 0x83000000
-#define VME_PAGESIZE 8192
-#define VME_MAP_SIZE 2048
-#define VME_MAP_SPACE (VME_PAGESIZE * VME_MAP_SIZE) /* = 2**24 */
-#define VME_MAP_PFN 0xffffe000
-#define VME_MAP_V 0x1
-#define VME_MAP_NV 0x0
-#define VME_MAP_A16_MIN 2040
-#define VME_MAP_A16_MAX 2047
-#define VME16_BASE_USR 0x84ff0000
-#define VME16_BASE 0x85ff0000
-#define VME16_SIZE (1 << 16)
-#define VME16_MASK (VME16_SIZE - 1)
-#define VME24_BASE_USR 0x86000000
-#define VME24_BASE 0x87000000
-#define VME24_SIZE (1 << 24)
-#define VME24_MASK (VME24_SIZE - 1)
-#define VME32_BASE_USR 0x80000000
-#define VME32_BASE 0x81000000
-#define VME32_SIZE (1 << 24)
-#define VME32_MASK (VME32_SIZE - 1)
-
-/* To ack a vme interruption (and get the vme vector), read a short at
- VME_IACK_BASE + 2 * vme_ipl. Only the lower byte is significant.
- The ipl is given by the sic interruption (int = 128 + 2 * ipl). */
-#define VME_IACK_BASE 0x82000000
-#define VME_IACK_SIZE 0x10
-
-/* The real-time clock. */
-#define RTC_ADDR 0x17020000
-
-/* System board interrupt controller. */
-#define SBIR_BASE 0x17030000 /* SBIR, 1 byte. */
-#define SBIR_DI 0x40 /* 1=directed intr, 0=undirected. */
-#define SBIR_INFO 0x3f /* For undir intr, information. */
-#define SBIR_DDID 0x3f /* For dir intr, dest dev id. */
-#define SBI_DIS 0x17030000 /* Read to disable system brd intr. */
-#define SBI_DIS_OFF 0x0
-#define SBI_EN 0x17031000 /* Read to enable system brd intr. */
-#define SBI_EN_OFF 0x1000
-#define SBIR_SIZE 0x2000
diff --git a/sys/arch/kbus/include/led.h b/sys/arch/kbus/include/led.h
deleted file mode 100644
index 25c9f1107de..00000000000
--- a/sys/arch/kbus/include/led.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * This file contains constants related to the LED's on the cpu boards.
- * The LED's are two 7-segment displays.
- *
- * The segments of each digit are labeled as follows:
- * a a
- * --- ---
- * f| |b f| |b
- * -g- -g-
- * e| |c e| |c
- * --- . --- .
- * d d
- *
- * Each segment corresponds to a bit in the LED register:
- *
- * left hand digit | right hand digit
- * 15 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |.|g|f|e|d|c|b|a|.|g|f|e|d|c|b|a|
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *
- * To turn a segment ON, the bit must be cleared, and to
- * turn a segment OFF, the bit must be set.
- */
-
-#define LED_SEG_A 0xfe
-#define LED_SEG_B 0xfd
-#define LED_SEG_C 0xfb
-#define LED_SEG_D 0xf7
-#define LED_SEG_E 0xef
-#define LED_SEG_F 0xdf
-#define LED_SEG_G 0xbf
-#define LED_SEG_P 0x7f
-
-/* codes mapped into LED register values: */
-#define LED_0 0xc0 /* "0" */
-#define LED_1 0xf9 /* "1" */
-#define LED_2 0xa4 /* "2" */
-#define LED_3 0xb0 /* "3" */
-#define LED_4 0x99 /* "4" */
-#define LED_5 0x92 /* "5" */
-#define LED_6 0x82 /* "6" */
-#define LED_7 0xf8 /* "7" */
-#define LED_8 0x80 /* "8" */
-#define LED_9 0x98 /* "9" */
-#define LED_A 0x88 /* "A" */
-#define LED_b 0x83 /* "b" */
-#define LED_C 0xc6 /* "C" */
-#define LED_d 0xa1 /* "d" */
-#define LED_E 0x86 /* "E" */
-#define LED_F 0x8e /* "F" */
-#define LED_P 0x8c /* "P" */
-#define LED_L 0xc7 /* "L" */
-#define LED_S 0x92 /* "S" */
-#define LED_U 0xc1 /* "U" */
-#define LED_t (LED_SEG_F & LED_SEG_E & LED_SEG_G) /* "t" */
-#define LED_BLANK 0xff /* " " */
-#define LED_BAR 0xfe /* "-" (upper) */
-#define LED_DASH 0xbf /* "-" (middle) */
-#define LED_RUB 0xf7 /* "_" (lower) */
-#define LED_EQU 0xbe /* "=" (upper) */
-#define LED_EQL 0xb7 /* "=" (lower) */
-#define LED_OU 0x9c /* "o" (upper) */
-#define LED_OL 0xa3 /* "o" (lower) */
-#define LED_DP 0x7f /* "." */
diff --git a/sys/arch/kbus/include/limits.h b/sys/arch/kbus/include/limits.h
deleted file mode 100644
index 75350ab4fca..00000000000
--- a/sys/arch/kbus/include/limits.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* $NetBSD: limits.h,v 1.7 1996/01/05 18:10:57 pk Exp $ */
-
-/*
- * Copyright (c) 1988 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)limits.h 8.3 (Berkeley) 1/4/94
- */
-
-#define CHAR_BIT 8 /* number of bits in a char */
-#define MB_LEN_MAX 1 /* no multibyte characters */
-
-#define SCHAR_MIN (-0x7f-1) /* max value for a signed char */
-#define SCHAR_MAX 0x7f /* min value for a signed char */
-
-#define UCHAR_MAX 0xffU /* max value for an unsigned char */
-#define CHAR_MAX 0x7f /* max value for a char */
-#define CHAR_MIN (-0x7f-1) /* min value for a char */
-
-#define USHRT_MAX 0xffffU /* max value for an unsigned short */
-#define SHRT_MAX 0x7fff /* max value for a short */
-#define SHRT_MIN (-0x7fff-1) /* min value for a short */
-
-#define UINT_MAX 0xffffffffU /* max value for an unsigned int */
-#define INT_MAX 0x7fffffff /* max value for an int */
-#define INT_MIN (-0x7fffffff-1) /* min value for an int */
-
-#define ULONG_MAX 0xffffffffUL /* max value for an unsigned long */
-#define LONG_MAX 0x7fffffffL /* max value for a long */
-#define LONG_MIN (-0x7fffffffL-1) /* min value for a long */
-
-#if !defined(_ANSI_SOURCE)
-#define SSIZE_MAX INT_MAX /* max value for a ssize_t */
-
-#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
-#define SIZE_T_MAX UINT_MAX /* max value for a size_t */
-
-#define UID_MAX UINT_MAX /* max value for a uid_t */
-#define GID_MAX UINT_MAX /* max value for a gid_t */
-
-/* GCC requires that quad constants be written as expressions. */
-#define UQUAD_MAX ((u_quad_t)0-1) /* max value for a uquad_t */
- /* max value for a quad_t */
-#define QUAD_MAX ((quad_t)(UQUAD_MAX >> 1))
-#define QUAD_MIN (-QUAD_MAX-1) /* min value for a quad_t */
-#define ULLONG_MAX (UQUAD_MAX) /* max value for unsigned long long */
-#define LLONG_MAX (QUAD_MAX) /* max value for a signed long long */
-#define LLONG_MIN (QUAD_MIN) /* min value for a signed long long */
-
-#endif /* !_POSIX_SOURCE && !_XOPEN_SOURCE */
-#endif /* !_ANSI_SOURCE */
-
-#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE)
-#define LONG_BIT 32
-#define WORD_BIT 32
-
-#define DBL_DIG 15
-#define DBL_MAX 1.7976931348623157E+308
-#define DBL_MIN 2.2250738585072014E-308
-
-#define FLT_DIG 6
-#define FLT_MAX 3.40282347E+38F
-#define FLT_MIN 1.17549435E-38F
-#endif
diff --git a/sys/arch/kbus/include/param.h b/sys/arch/kbus/include/param.h
deleted file mode 100644
index 62b3e9c208f..00000000000
--- a/sys/arch/kbus/include/param.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/* $OpenBSD: param.h,v 1.1.1.1 1997/10/14 07:25:31 gingold Exp $ */
-/* $NetBSD: param.h,v 1.12 1995/06/26 06:56:05 cgd Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)param.h 5.8 (Berkeley) 6/28/91
- */
-
-/*
- * Machine dependent constants for NS 32532.
- *
- * Derived from the i386 param.h by Phil Nelson.
- *
- */
-
-#ifndef _MACHINE_PARAM_H_
-#define _MACHINE_PARAM_H_
-
-#ifdef _KERNEL
-#include <machine/cpu.h>
-#endif
-
-#define MACHINE "Series5"
-#define _MACHINE Series5
-#define MACHINE_ARCH "sparc"
-#define _MACHINE_ARCH sparc
-#define MID_MACHINE MID_SPARC
-
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value
- * for all data types (int, long, ...). The result is u_int and
- * must be cast to any desired pointer type.
- */
-#define ALIGNBYTES (sizeof(double) - 1)
-#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
-
-#define PGSHIFT 13 /* LOG2(NBPG) */
-#define NBPG (1 << PGSHIFT) /* bytes/page */
-#define PGOFSET (NBPG-1) /* byte offset into page */
-#define NPTEPG (NBPG/(sizeof (struct pte)))
-
-#define SEGSHIFT 24 /* LOG2(NBSEG) */
-#define NBSEG (1 << SEGSHIFT) /* bytes/segments. */
-#define SEGOFSET (NBSEG-1) /* byte offset into segment */
-
-#define KERNBASE 0xff000000 /* start of kernel .text seg. */
-#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT)
-
-#define DEV_BSIZE 512
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define BLKDEV_IOSIZE 4096 /* Was 2048 (pan) */
-#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
-
-#define CLSIZE 1
-#define CLSIZELOG2 0
-
-/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
-#define SSIZE 1 /* initial stack size/NBPG */
-#define SINCR 1 /* increment of stack/NBPG */
-
-#define UPAGES 2 /* pages of u-area */
-#define USPACE (UPAGES * NBPG)
-
-/*
- * Constants related to network buffer management.
- * MCLBYTES must be no larger than CLBYTES (the software page size), and,
- * on machines that exchange pages of input or output buffers with mbuf
- * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
- * of the hardware page size.
- */
-#ifndef MSIZE
-#define MSIZE 128 /* size of an mbuf */
-#endif /* MSIZE */
-
-#ifndef MCLSHIFT
-#define MCLSHIFT 11 /* convert bytes to m_buf clusters */
-#endif /* MCLSHIFT */
-#define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */
-#define MCLOFSET (MCLBYTES - 1) /* offset within a m_buf cluster */
-
-#ifndef NMBCLUSTERS
-#define NMBCLUSTERS 512 /* map size, max cluster allocation */
-#endif
-
-/*
- * Size of kernel malloc arena in CLBYTES-sized logical pages
- */
-#ifndef NKMEMCLUSTERS
-#define NKMEMCLUSTERS (2048*1024/CLBYTES)
-#endif
-
-/*
- * Some macros for units conversion
- */
-
-/* pages ("clicks") to disk blocks */
-#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
-
-/* clicks to bytes */
-#define ctob(x) ((x) << PGSHIFT)
-#define btoc(x) (((x) + PGOFSET) >> PGSHIFT)
-
-/* bytes to disk blocks */
-#define btodb(x) ((x) >> DEV_BSHIFT)
-#define dbtob(x) ((x) << DEV_BSHIFT)
-
-
-/*
- * Map a ``block device block'' to a file system block.
- * This should be device dependent, and will be if we
- * add an entry to cdevsw/bdevsw for that purpose.
- * For now though just use DEV_BSIZE.
- */
-#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
-
-
-/*
- * Mach derived conversion macros
- */
-#define series5_round_pdr(x) ((((unsigned)(x)) + NBPDR - 1) & ~(NBPDR-1))
-#define series5_trunc_pdr(x) ((unsigned)(x) & ~(NBPDR-1))
-#define series5_round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1))
-#define series5_trunc_page(x) ((unsigned)(x) & ~(NBPG-1))
-#define series5_btod(x) ((unsigned)(x) >> PDRSHIFT)
-#define series5_dtob(x) ((unsigned)(x) << PDRSHIFT)
-#define series5_btop(x) ((unsigned)(x) >> PGSHIFT)
-#define series5_ptob(x) ((unsigned)(x) << PGSHIFT)
-
-#ifndef __ASSEMBLER__
-#ifndef _KERNEL
-#define DELAY(n) { volatile int N = (n); while (--N > 0); }
-#else
-extern void delay __P((unsigned int));
-#define DELAY(n) delay (n)
-#endif
-
-#if 0
-/* Macros to read and write from absolute addresses. */
-#define WR_ADR(type,adr,val) (*((volatile type *)(adr))=(val))
-#define RD_ADR(type,adr) (*((volatile type *)(adr)))
-#endif
-#endif
-
-#endif
diff --git a/sys/arch/kbus/include/pcb.h b/sys/arch/kbus/include/pcb.h
deleted file mode 100644
index 3692dd17d96..00000000000
--- a/sys/arch/kbus/include/pcb.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* $NetBSD: pcb.h,v 1.4 1995/03/28 18:19:56 jtc Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pcb.h 8.1 (Berkeley) 6/11/93
- */
-
-#include <machine/reg.h>
-
-#ifdef notyet
-#define PCB_MAXWIN 32 /* architectural limit */
-#else
-#define PCB_MAXWIN 8 /* worried about u area sizes ... */
-#endif
-
-/*
- * SPARC Process Control Block.
- *
- * pcb_uw is positive if there are any user windows that are
- * are currently in the CPU windows rather than on the user
- * stack. Whenever we are running in the kernel with traps
- * enabled, we decrement pcb_uw for each ``push'' of a CPU
- * register window into the stack, and we increment it for
- * each ``pull'' from the stack into the CPU. (If traps are
- * disabled, or if we are in user mode, pcb_uw is junk.)
- *
- * To ease computing pcb_uw on traps from user mode, we keep track
- * of the log base 2 of the single bit that is set in %wim.
- *
- * If an overflow occurs while the associated user stack pages
- * are invalid (paged out), we have to store the registers
- * in a page that is locked in core while the process runs,
- * i.e., right here in the pcb. We also need the stack pointer
- * for the last such window (but only the last, as the others
- * are in each window) and the count of windows saved. We
- * cheat by having a whole window structure for that one %sp.
- * Thus, to save window pcb_rw[i] to memory, we write it at
- * pcb_rw[i + 1].rw_in[6].
- *
- * pcb_nsaved has three `kinds' of values. If 0, it means no
- * registers are in the PCB (though if pcb_uw is positive,
- * there may be the next time you look). If positive, it means
- * there are no user registers in the CPU, but there are some
- * saved in pcb_rw[]. As a special case, traps that needed
- * assistance to pull user registers from the stack also store
- * the registers in pcb_rw[], and set pcb_nsaved to -1. This
- * special state is normally short-term: it can only last until the
- * trap returns, and it can never persist across entry to user code.
- */
-struct pcb {
- int pcb_sp; /* sp (%o6) when switch() was called */
- int pcb_pc; /* pc (%o7) when switch() was called */
- int pcb_psr; /* %psr when switch() was called */
-
- caddr_t pcb_onfault; /* for copyin/out */
-
- int pcb_uw; /* user windows inside CPU */
- int pcb_wim; /* log2(%wim) */
- int pcb_nsaved; /* number of windows saved in pcb */
-
-#ifdef notdef
- int pcb_winof; /* number of window overflow traps */
- int pcb_winuf; /* number of window underflow traps */
-#endif
- int pcb_pad; /* pad to doubleword boundary */
-
- /* the following MUST be aligned on a doubleword boundary */
- struct rwindow pcb_rw[PCB_MAXWIN]; /* saved windows */
-};
-
-/*
- * The pcb is augmented with machine-dependent additional data for
- * core dumps. Note that the trapframe here is a copy of the one
- * from the top of the kernel stack (included here so that the kernel
- * stack itself need not be dumped).
- */
-struct md_coredump {
- struct trapframe md_tf;
- struct fpstate md_fpstate;
-};
-
-#ifdef _KERNEL
-extern struct pcb *cpcb;
-#endif /* _KERNEL */
diff --git a/sys/arch/kbus/include/pmap.h b/sys/arch/kbus/include/pmap.h
deleted file mode 100644
index 7f338b611d8..00000000000
--- a/sys/arch/kbus/include/pmap.h
+++ /dev/null
@@ -1,302 +0,0 @@
-/* $NetBSD: pmap.h,v 1.7 1995/05/11 16:53:07 jtc Exp $ */
-
-/*
- * Copyright (c) 1991 Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and William Jolitz of UUNET Technologies Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pmap.h 7.4 (Berkeley) 5/12/91
- */
-
-/*
- * Derived from hp300 version by Mike Hibler, this version by William
- * Jolitz uses a recursive map [a pde points to the page directory] to
- * map the page tables using the pagetables themselves. This is done to
- * reduce the impact on kernel virtual memory for lots of sparse address
- * space, and to reduce the cost of memory to each process.
- *
- * from hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90
- */
-
-#ifndef _MACHINE_PMAP_H_
-#define _MACHINE_PMAP_H_
-
-/*
- * Series5 page table entry and page table directory
- * Phil Nelson, 12/92
- *
- * modified from the 386 stuff by W.Jolitz, 8/89
- */
-
-#define PD_MASK 0xff000000 /* page directory address bits */
-#define PT_MASK 0x00ffe000 /* page table address bits */
-#define PD_SHIFT 24 /* page directory address shift */
-#define PG_SHIFT 13 /* page table address shift */
-
-#define PTE_SIZE_SHIFT 2
-#define PDE_SIZE_SHIFT 2
-
-#if !defined(_LOCORE) && !defined(__ASSEMBLER__)
-
-struct pte
-{
-unsigned int pg_pfnum:19; /* physical page frame number */
-unsigned int pg_sp2:1; /* Spare bit. */
-unsigned int pg_sp1:1; /* Spare bit. */
-unsigned int pg_w:1; /* Soft: page is wired. */
-unsigned int pg_x:1; /* Soft: page is executable. */
-unsigned int pg_ro:1; /* Soft: page is read-only. */
-unsigned int pg_tlbinv:1; /* Invalidate tlb entry. */
-unsigned int pg_sp0:1; /* Spare bit. */
-unsigned int pg_io:1; /* Hardware io access. */
-unsigned int pg_up:1; /* Hardware user protection. */
-unsigned int pg_hro:1; /* Hardware read-only. */
-unsigned int pg_m:1; /* has been modified */
-unsigned int pg_u:1; /* has been used */
-unsigned int pg_v:1; /* valid bit */
-};
-
-struct pde /* First level PTE */
-{
- unsigned long pd_pfnum:19; /* Physical page frame number of pte's. */
- unsigned long pd_mbz:12; /* Reserved. */
- unsigned long pd_v:1; /* Valid bit. */
-};
-#endif /* !_LOCORE */
-
-#define PD_V 0x00000001
-#define PD_NV 0x00000000
-
-#define PG_V 0x00000001
-#define PG_NV 0x00000000
-#define PG_U 0x00000002
-#define PG_M 0x00000004
-#define PG_HRO 0x00000008
-#define PG_u 0x00000010
-#define PG_IO 0x00000020
-#define PG_SP0 0x00000040
-#define PG_TLBINV 0x00000080
-#define PG_RO 0x00000100
-#define PG_RW 0
-#define PG_X 0x00000200 /* Executable bit. */
-#define PG_WIRED 0x00000400 /* Wired bit (user def) */
-#define PG_SPARE 0x00001800
-#define PG_FRAME 0xffffe000
-
-#define PG_PROT (PG_RO | PG_HRO | PG_u)
-#define PG_NOACC 0
-#define PG_KR (PG_u | PG_RO | PG_HRO)
-#define PG_KW (PG_u | PG_HRO)
-#define PG_URKR (PG_RO | PG_HRO)
-#define PG_URKW (PG_HRO)
-#define PG_UW (PG_HRO)
-
-#define PG_WINDOW 0x87
-/*
- * Page Protection Exception bits
- */
-
-#if !defined(_LOCORE) && !defined(__ASSEMBLER__)
-typedef union pt_entry {
- unsigned int pt_entry; /* for copying, etc. */
- struct pte pt_pte; /* for getting to bits by name */
-} pt_entry_t; /* Mach page table entry */
-
-typedef union pd_entry {
- unsigned int pd_entry;
- struct pde pd_pde;
-} pd_entry_t;
-
-extern pt_entry_t *Sysmap;
-
-#define kvtopte(va) \
- (Sysmap + (((vm_offset_t)(va) - VM_MIN_KERNEL_ADDRESS) >> PGSHIFT))
-#if 0
-#define ptetokv(pte) \
- ((((pt_entry_t *)(pte) - Sysmap) << PGSHIFT) + VM_MIN_KERNEL_ADDRESS)
-#endif
-
-#endif /* !_LOCORE */
-
-/*
- * One page directory, shared between
- * kernel and user modes.
- */
-#define SERIES5_PAGE_SIZE NBPG
-
-#define SERIES5_PDT_SIZE 2048 /* Sizeof a page directory table. */
-#define SERIES5_PGT_SIZE NBPG /* Sizeof a page table. */
-
-#define SERIES5_NBR_PDE 0x100 /* Number of entries in the directory. */
-#define SERIES5_NBR_PTE 0x800 /* Number of entries in a page table. */
-
-/* Addresses for fixed structures in the kernel window. */
-/* u page. Note: UPAGES must be 2. */
-#define SERIES5_RED_ZONE 0xffffa000
-#define SERIES5_UPAGE_ADDR 0xffffc000
-#define UADDR 0xffffc000
-#define SERIES5_UPAGE0 0xffffc000
-#define SERIES5_UPAGE1 0xffffe000
-
-/* For pmap_zero_page and pmap_copy_page. */
-#define SERIES5_CMAP1 0xffff2000
-#define SERIES5_CMAP2 0xffff4000
-
-/* For the TLB. */
-#define SERIES5_TLBMISS_TMP 0xffff6000
-#define SERIES5_PDT_BASE 0xffff8000
-
-#define SERIES5_KERN_WINDOW 0xff000000
-#define SERIES5_KERN_MASK 0x00ffffff
-
-#define MMCR_ME 0x00000001 /* Mmu enable. */
-#define MMCR_ECC 0x00000080 /* Ecc enable. */
-
-#define FCR_TOFIO 0x00000001
-#define FCR_TOFM 0x00000002
-#define FCR_ECCM 0x00000004
-#define FCR_DTRAP 0x00000008
-#define FCR_PAGE_OUT 0x00000010
-#define FCR_WRITE_PROT 0x00000020 /* Write protection fault. */
-#define FCR_USER_PROT 0x00000040
-#define FCR_TLB_MISS 0x00000080
-#define FCR_BITS "\20\1TOF\2WDOG\3ECCM\4DTRAP\5POF\6WPF" \
- "\7UPF\10TMISS"
-
-#if !defined(_LOCORE) && !defined(__ASSEMBLER__)
-/*
- * Address of current and alternate address space page table maps
- * and directories.
- */
-#ifdef _KERNEL
-extern int IdlePTD; /* physical address of "Idle" state directory */
-#endif
-
-/*
- * macros to generate page directory/table indicies
- */
-
-#define pdei(va) (((va)&PD_MASK)>>PD_SHIFT)
-#define ptei(va) (((va)&PT_MASK)>>PG_SHIFT)
-
-/*
- *
- * The user address space is mapped using a two level structure where
- * virtual address bits 31..24 are used to index into a segment table which
- * points to a page worth of PTEs (8192 page can hold 2048 PTEs).
- * Bits 23..13 are then used to index a PTE which describes a page within
- * a segment.
- *
- * The wired entries in the TLB will contain the following:
- * 0-1 (UPAGES) for curproc user struct and kernel stack.
- *
- * Note: The kernel doesn't use the same data structures as user programs.
- * All the PTE entries are stored in a single array in Sysmap which is
- * dynamically allocated at boot time.
- */
-
-#define series5_trunc_seg(x) ((vm_offset_t)(x) & ~SEGOFSET)
-#define series5_round_seg(x) (((vm_offset_t)(x) + SEGOFSET) & ~SEGOFSET)
-#define pmap_segmap(m, v) ((m)->pm_segtab->seg_tab[((v) >> SEGSHIFT)])
-#define pmap_segpde(m, v) ((m)->pm_segtab->seg_pde[((v) >> SEGSHIFT)])
-
-union pt_entry;
-
-struct segtab {
- pd_entry_t seg_pde[SERIES5_NBR_PDE];
- union pt_entry *seg_tab[SERIES5_NBR_PDE];
-};
-
-/*
- * Machine dependent pmap structure.
- */
-typedef struct pmap {
- int pm_count; /* pmap reference count */
- simple_lock_data_t pm_lock; /* lock on pmap */
- struct pmap_statistics pm_stats; /* pmap statistics */
- struct segtab *pm_segtab; /* pointers to pages of PTEs */
- void * *pm_psegtab; /* Physical address og PTEs */
-} *pmap_t;
-
-/*
- * Defines for pmap_attributes[phys_mach_page];
- */
-#define PMAP_ATTR_MOD 0x01 /* page has been modified */
-#define PMAP_ATTR_REF 0x02 /* page has been referenced */
-
-#ifdef _KERNEL
-char *pmap_attributes; /* reference and modify bits */
-struct pmap kernel_pmap_store;
-
-#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count)
-#define pmap_kernel() (&kernel_pmap_store)
-
-/*
- * Macros for speed
- */
-#define LOAD_PTDB(pa) \
- do { \
- sta (ASI_PDBA, 0, ((pa) & ~PG_FRAME) | SERIES5_PDT_BASE); \
- sta (ASI_FGTLB_VALD, SERIES5_PDT_BASE, ((pa) & PG_FRAME) | 0x87); \
- sta (ASI_FGTLB_INV, 0, 0); \
- } while (0)
-
-#if 1
-#define PMAP_ACTIVATE(pmap, pcbp)
-#else
-#define PMAP_ACTIVATE(pmapp, pcbp) \
- if ((pmapp) != NULL /*&& (pmapp)->pm_pdchanged */) { \
- (pcbp)->pcb_ptb = \
- pmap_extract(pmap_kernel(),(vm_offset_t)(pmapp)->pm_pdir); \
- if ((pmapp) == &curproc->p_vmspace->vm_pmap) \
- LOAD_PTB ((pcbp)->pcb_ptb); \
- (pmapp)->pm_pdchanged = FALSE; \
- }
-#endif
-
-#define PMAP_DEACTIVATE(pmapp, pcbp)
-
-#define PV_ENTRY_NULL ((pv_entry_t) 0)
-
-struct pmap kernel_pmap_store;
-void pmap_bootstrap __P((vm_offset_t firstaddr));
-void pmap_disp_va __P((pmap_t pmap, vm_offset_t va));
-vm_offset_t pmap_map __P((vm_offset_t, vm_offset_t, vm_offset_t, int));
-struct user;
-struct proc;
-void switchexit __P((struct proc *));
-
-#endif /* _KERNEL */
-#endif /* !_LOCORE */
-#endif
diff --git a/sys/arch/kbus/include/proc.h b/sys/arch/kbus/include/proc.h
deleted file mode 100644
index 907e76efce9..00000000000
--- a/sys/arch/kbus/include/proc.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* $NetBSD: proc.h,v 1.2 1994/11/20 20:53:23 deraadt Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)proc.h 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * Machine-dependent part of the proc structure for SPARC.
- */
-struct mdproc {
- struct trapframe *md_tf; /* trap/syscall registers */
- struct fpstate *md_fpstate; /* fpu state, if any; always resident*/
- int md_upte[UPAGES]; /* ptes for mapping u page. */
-};
diff --git a/sys/arch/kbus/include/profile.h b/sys/arch/kbus/include/profile.h
deleted file mode 100644
index 0a27b368163..00000000000
--- a/sys/arch/kbus/include/profile.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* $NetBSD: profile.h,v 1.6 1996/04/08 20:55:36 pk Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)profile.h 8.1 (Berkeley) 6/11/93
- */
-
-#ifdef PIC
-/* Inline expansion of PICCY_SET() (see <machine/asm.h>). */
-#define MCOUNT \
- asm(".global mcount");\
- asm("mcount:");\
- asm("add %o7, 8, %o1");\
- asm("1: call 2f; nop; 2:");\
- asm("add %o7,__mcount-1b, %o2");\
- asm("ld [%o2], %o2");\
- asm("jmpl %o2, %g0");\
- asm("add %i7, 8, %o0");
-#else
-#define MCOUNT \
- asm(".global mcount");\
- asm("mcount:");\
- asm("add %i7, 8, %o0");\
- asm("sethi %hi(__mcount), %o2");\
- asm("jmpl %o2 + %lo(__mcount), %g0");\
- asm("add %o7, 8, %o1");
-#endif
-
-#define _MCOUNT_DECL static void _mcount
-_MCOUNT_DECL __P((unsigned long, unsigned long));
-
-#ifdef _KERNEL
-/*
- * Block interrupts during mcount so that those interrupts can also be
- * counted (as soon as we get done with the current counting). On the
- * SPARC, we just splhigh/splx as those do not recursively invoke mcount.
- */
-#define MCOUNT_ENTER s = splhigh()
-#define MCOUNT_EXIT splx(s)
-#endif /* _KERNEL */
diff --git a/sys/arch/kbus/include/prom.h b/sys/arch/kbus/include/prom.h
deleted file mode 100644
index 01a3b2d5e0d..00000000000
--- a/sys/arch/kbus/include/prom.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#define ROM_VECTORS 0xff000000
-
-#define ROM_VERSION (ROM_VECTORS + 0)
-#define ROM_COMM_AREA (ROM_VECTORS + 8)
-#define ROM_COMMAND (ROM_VECTORS + 16)
-#define ROM_SLAVEHALT (ROM_VECTORS + 24)
-#define ROM_MSGBUFP (ROM_VECTORS + 32)
-#define ROM_DGRAM (ROM_VECTORS + 40)
-#define ROM_EEVERSION (ROM_VECTORS + 48)
-#define ROM_REVISION (ROM_VECTORS + 56)
-
-struct prom_command_area
-{
- char *command_ptr;
- int ret_val;
- int first_free;
- int memsize;
- int ramdisk;
- char *iomap_addr;
- int (*slave_start) __P((void));
- int row;
- int col;
- int silent;
-};
-
-/* Prom related fucntions. */
-void idprom_etheraddr __P((u_char *ether));
-void verbose_rom_reset __P((void));
diff --git a/sys/arch/kbus/include/psl.h b/sys/arch/kbus/include/psl.h
deleted file mode 100644
index d7cf31b71ae..00000000000
--- a/sys/arch/kbus/include/psl.h
+++ /dev/null
@@ -1,208 +0,0 @@
-/* $NetBSD: psl.h,v 1.11 1996/03/31 22:20:14 pk Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)psl.h 8.1 (Berkeley) 6/11/93
- */
-
-#ifndef PSR_IMPL
-#if !defined(_LOCORE) && !defined(__ASSEMBLER__)
-#include <machine/asm.h>
-#endif
-#include <machine/asi.h>
-#include <machine/sic.h>
-
-/*
- * SPARC Process Status Register (in psl.h for hysterical raisins).
- *
- * The picture in the Sun manuals looks like this:
- * 1 1
- * 31 28 27 24 23 20 19 14 3 2 11 8 7 6 5 4 0
- * +-------+-------+-------+-----------+-+-+-------+-+-+-+---------+
- * | impl | ver | icc | reserved |E|E| pil |S|P|E| CWP |
- * | | |n z v c| |C|F| | |S|T| |
- * +-------+-------+-------+-----------+-+-+-------+-+-+-+---------+
- */
-
-#define PSR_IMPL 0xf0000000 /* implementation */
-#define PSR_VER 0x0f000000 /* version */
-#define PSR_ICC 0x00f00000 /* integer condition codes */
-#define PSR_N 0x00800000 /* negative */
-#define PSR_Z 0x00400000 /* zero */
-#define PSR_O 0x00200000 /* overflow */
-#define PSR_C 0x00100000 /* carry */
-#define PSR_EC 0x00002000 /* coprocessor enable */
-#define PSR_EF 0x00001000 /* FP enable */
-#define PSR_PIL 0x00000f00 /* interrupt level */
-#define PSR_S 0x00000080 /* supervisor (kernel) mode */
-#define PSR_PS 0x00000040 /* previous supervisor mode (traps) */
-#define PSR_ET 0x00000020 /* trap enable */
-#define PSR_CWP 0x0000001f /* current window pointer */
-
-#define PSR_BITS "\20\16EC\15EF\10S\7PS\6ET"
-
-
-#define SPL_SOFTCLOCK 128
-#define SPL_NET 128
-#define SPL_BIO 136
-#define SPL_TTY 139
-#define SPL_ZS SPL_TTY
-#define SPL_CLOCK 141
-#define SPL_VME 142
-#define SPL_PROF 143
-#define SPL_IMP 145
-#define SPL_HIGH 255
-
-#if defined(_KERNEL) && !defined(_LOCORE)
-
-extern unsigned int ssir;
-
-static __inline int getpsr __P((void));
-static __inline void setpsr __P((int));
-static __inline int setpil0 __P((void));
-
-/*
- * GCC pseudo-functions for manipulating PSR (primarily PIL field).
- */
-static __inline int
-getpsr ()
-{
- int psr;
-
- __asm __volatile("rd %%psr,%0" : "=r" (psr));
- return (psr);
-}
-
-static __inline void
-setpsr (newpsr)
- int newpsr;
-{
- __asm __volatile("wr %0,0,%%psr" : : "r" (newpsr));
- __asm __volatile("nop");
- __asm __volatile("nop");
- __asm __volatile("nop");
-}
-
-static __inline int
-setpil0 ()
-{
- int psr, oldipl;
-
- /*
- * wrpsr xors two values: we choose old psr and old ipl here,
- * which gives us the same value as the old psr but with all
- * the old PIL bits turned off.
- */
- __asm __volatile("rd %%psr,%0" : "=r" (psr));
- oldipl = psr & PSR_PIL;
- __asm __volatile("wr %0,%1,%%psr" : : "r" (psr), "r" (oldipl));
-
- /*
- * Three instructions must execute before we can depend
- * on the bits to be changed.
- */
- __asm __volatile("nop; nop; nop");
- return (oldipl);
-}
-
-static __inline int setpil (int newpil)
-{
- int psr, oldipl;
-
- psr = getpsr ();
- oldipl = (psr & PSR_PIL) >> 8;
- setpsr ((psr & ~PSR_PIL) | ((newpil << 8) & PSR_PIL));
- return oldipl;
-}
-
-static __inline int
-setpil15 (void)
-{
- int psr;
-
- psr = getpsr ();
- setpsr (psr | PSR_PIL);
- return (psr & PSR_PIL) >> 8;
-}
-
-/*
- * PIL 1 through 14 can use this macro.
- * (spl0 and splhigh are special since they put all 0s or all 1s
- * into the ipl field.)
- */
-#define SPL(name, newspl) \
-extern int name __P((void));
-
-SPL(splsoftint, SPL_NET)
-#define spllowersoftclock splsoftint
-#define splsoftclock splsoftint
-#define splsoftnet splsoftint
-
-/* Block devices */
-SPL(splbio, SPL_BIO)
-
-/* network hardware interrupts are at level 6 */
-SPL(splnet, SPL_NET)
-
-/* tty input runs at software level 6 */
-SPL(spltty, SPL_TTY)
-
-/*
- * Memory allocation (must be as high as highest network, tty, or disk device)
- */
-SPL(splimp, SPL_IMP)
-
-SPL(splclock, SPL_CLOCK)
-SPL(splstatclock, SPL_CLOCK)
-
-/* zs hardware interrupts are at level 12 */
-SPL(splzs, SPL_ZS)
-
-SPL(splhigh, SPL_HIGH)
-
-SPL(spl0, 0)
-
-extern int splx (int newspl);
-
-#endif /* KERNEL && !_LOCORE */
-
-#endif /* PSR_IMPL */
diff --git a/sys/arch/kbus/include/ptrace.h b/sys/arch/kbus/include/ptrace.h
deleted file mode 100644
index f01223f36bd..00000000000
--- a/sys/arch/kbus/include/ptrace.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $NetBSD: ptrace.h,v 1.4 1994/11/20 20:53:27 deraadt Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ptrace.h 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * SPARC-dependent ptrace definitions.
- */
-#define PT_GETREGS (PT_FIRSTMACH + 0)
-#define PT_SETREGS (PT_FIRSTMACH + 1)
-#define PT_GETFPREGS (PT_FIRSTMACH + 2)
-#define PT_SETFPREGS (PT_FIRSTMACH + 3)
diff --git a/sys/arch/kbus/include/reg.h b/sys/arch/kbus/include/reg.h
deleted file mode 100644
index 137d9aed411..00000000000
--- a/sys/arch/kbus/include/reg.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* $NetBSD: reg.h,v 1.4 1994/11/20 20:53:28 deraadt Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)reg.h 8.1 (Berkeley) 6/11/93
- */
-
-#ifndef _MACHINE_REG_H_
-#define _MACHINE_REG_H_
-
-/*
- * Registers passed to trap/syscall/etc.
- * This structure is known to occupy exactly 80 bytes (see locore.s).
- * Note, tf_global[0] is not actually written (since g0 is always 0).
- * (The slot tf_global[0] is used to send a copy of %wim to kernel gdb.
- * This is known as `cheating'.)
- */
-struct trapframe {
- int tf_psr; /* psr */
- int tf_pc; /* return pc */
- int tf_npc; /* return npc */
- int tf_y; /* %y register */
- int tf_global[8]; /* global registers in trap's caller */
- int tf_out[8]; /* output registers in trap's caller */
-};
-
-/*
- * Register windows. Each stack pointer (%o6 aka %sp) in each window
- * must ALWAYS point to some place at which it is safe to scribble on
- * 64 bytes. (If not, your process gets mangled.) Furthermore, each
- * stack pointer should be aligned on an 8-byte boundary (the kernel
- * as currently coded allows arbitrary alignment, but with a hefty
- * performance penalty).
- */
-struct rwindow {
- int rw_local[8]; /* %l0..%l7 */
- int rw_in[8]; /* %i0..%i7 */
-};
-
-/*
- * Clone trapframe for now; this seems to be the more useful
- * than the old struct reg above.
- */
-struct reg {
- int r_psr; /* psr */
- int r_pc; /* return pc */
- int r_npc; /* return npc */
- int r_y; /* %y register */
- int r_global[8]; /* global registers in trap's caller */
- int r_out[8]; /* output registers in trap's caller */
-};
-
-#include <machine/fsr.h>
-
-/*
- * FP coprocessor registers.
- *
- * FP_QSIZE is the maximum coprocessor instruction queue depth
- * of any implementation on which the kernel will run. David Hough:
- * ``I'd suggest allowing 16 ... allowing an indeterminate variable
- * size would be even better''. Of course, we cannot do that; we
- * need to malloc these.
- */
-#define FP_QSIZE 16
-
-struct fp_qentry {
- int *fq_addr; /* the instruction's address */
- int fq_instr; /* the instruction itself */
-};
-struct fpstate {
- u_int fs_regs[32]; /* our view is 32 32-bit registers */
- int fs_fsr; /* %fsr */
- int fs_qsize; /* actual queue depth */
- struct fp_qentry fs_queue[FP_QSIZE]; /* queue contents */
-};
-
-/*
- * Clone fpstate into an fpreg structure to satisfy <kern/sys_process.c>
- */
-struct fpreg {
- u_int fr_regs[32]; /* our view is 32 32-bit registers */
- int fr_fsr; /* %fsr */
- int fr_qsize; /* actual queue depth */
- struct fp_qentry fr_queue[FP_QSIZE]; /* queue contents */
-};
-
-#endif /* _MACHINE_REG_H_ */
diff --git a/sys/arch/kbus/include/setjmp.h b/sys/arch/kbus/include/setjmp.h
deleted file mode 100644
index e224ce1e7c0..00000000000
--- a/sys/arch/kbus/include/setjmp.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* $NetBSD: setjmp.h,v 1.1 1994/12/20 10:37:10 cgd Exp $ */
-
-/*
- * machine/setjmp.h: machine dependent setjmp-related information.
- */
-
-#define _JBLEN 10 /* size, in longs, of a jmp_buf */
diff --git a/sys/arch/kbus/include/sic.h b/sys/arch/kbus/include/sic.h
deleted file mode 100644
index 16a60676e2e..00000000000
--- a/sys/arch/kbus/include/sic.h
+++ /dev/null
@@ -1,48 +0,0 @@
-
-/* General constants. */
-#define SIC_NUM_IPL 256 /* Number of interrupt priority levels. */
-
-/* For DIR. */
-#define SIC_DIR_MASK 0x3f /* Current device id. */
-
-/* For IPR. */
-#define SIC_IPR_MASK 0xff /* Current interrupt priority level. */
-#define SIC_IPR_CLR_MASK 0xffff0000 /* Clear bits always read as 1. */
-
-/* For IRC. */
-#define SIC_IRC_E 0x00000001 /* Enable receiver. */
-#define SIC_IRC_P 0x00000002 /* Interrupt pending. */
-
-/* For IPV. */
-#define SIC_IPV_IVL 0xff00 /* Pending interrupt vector level. */
-#define SIC_IPV_BRDCST 0x0080 /* Broadcast interrupt if set. */
-#define SIC_IPV_DIR 0x0040 /* Directed interrupt if set. */
-#define SIC_IPV_INFO 0x003f /* Misc info if undirected int. */
-#define SIC_IPV_DDID 0x003f /* Dest dev id if directed int. */
-
-/* For IXR. */
-#define SIC_IXR_IVL 0xff00 /* Pending interrupt vector level. */
-#define SIC_IXR_DIR 0x0040 /* Directed interrupt if set. */
-#define SIC_IXR_INFO 0x003f /* Misc info if undirected int. */
-#define SIC_IXR_DDID 0x003f /* Dest dev id if directed int. */
-
-/* For ITXC. */
-#define SIC_ITXC_E 0x0001 /* Transmitter enable bit. */
-#define SIC_ITXC_A 0x0002 /* interrupt acked bit. */
-
-/* Interrupt vectors. */
-#define INTR_VME_1 0x82 /* 130: vme level 1. */
-#define INTR_IOASIC 0x83 /* 131: ioasic, wd33c93a. */
-#define INTR_VME_2 0x84 /* 132: vme level 2. */
-#define INTR_FB 0x85 /* 133: frame buffer. */
-#define INTR_VME_3 0x86 /* 134: vme level 3. */
-#define INTR_LANCE 0x87 /* 135: LANCE. */
-#define INTR_VME_4 0x88 /* 136: vme level 4. */
-#define INTR_ZS 0x89 /* 137: zs. */
-#define INTR_VME_5 0x8a /* 138: vme level 5. */
-#define INTR_VME_6 0x8c /* 140: vme level 6. */
-#define INTR_CLOCK 0x8d /* 141: clock. */
-#define INTR_VME_7 0x8e /* 142: vme level 7. */
-
-/* Get a sic intr from a vme level. */
-#define VME_IPL_TO_INTR(l) (128 + 2 * (l))
diff --git a/sys/arch/kbus/include/signal.h b/sys/arch/kbus/include/signal.h
deleted file mode 100644
index e8339c38520..00000000000
--- a/sys/arch/kbus/include/signal.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* $NetBSD: signal.h,v 1.4 1996/02/01 22:32:35 mycroft Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)signal.h 8.1 (Berkeley) 6/11/93
- */
-
-#ifndef _SPARC_SIGNAL_H_
-#define _SPARC_SIGNAL_H_
-
-#ifndef _LOCORE
-typedef int sig_atomic_t;
-#endif
-
-#ifndef _ANSI_SOURCE
-#ifndef _LOCORE
-
-/*
- * Information pushed on stack when a signal is delivered.
- * This is used by the kernel to restore state following
- * execution of the signal handler. It is also made available
- * to the handler to allow it to restore state properly if
- * a non-standard exit is performed.
- *
- * All machines must have an sc_onstack and sc_mask.
- */
-struct sigcontext {
- int sc_onstack; /* sigstack state to restore */
- int sc_mask; /* signal mask to restore */
- /* begin machine dependent portion */
- int sc_sp; /* %sp to restore */
- int sc_pc; /* pc to restore */
- int sc_npc; /* npc to restore */
- int sc_psr; /* psr to restore */
- int sc_g1; /* %g1 to restore */
- int sc_o0; /* %o0 to restore */
-};
-#else /* _LOCORE */
-#define SC_SP_OFFSET 8
-#define SC_PC_OFFSET 12
-#define SC_NPC_OFFSET 16
-#define SC_PSR_OFFSET 20
-#define SC_G1_OFFSET 24
-#define SC_O0_OFFSET 28
-#endif /* _LOCORE */
-
-/*
- * `Code' arguments to signal handlers. The names, and the funny numbering.
- * are defined so as to match up with what SunOS uses; I have no idea why
- * they did the numbers that way, except maybe to match up with the 68881.
- */
-#define FPE_INTOVF_TRAP 0x01 /* integer overflow */
-#define FPE_INTDIV_TRAP 0x14 /* integer divide by zero */
-#define FPE_FLTINEX_TRAP 0xc4 /* inexact */
-#define FPE_FLTDIV_TRAP 0xc8 /* divide by zero */
-#define FPE_FLTUND_TRAP 0xcc /* underflow */
-#define FPE_FLTOPERR_TRAP 0xd0 /* operand error */
-#define FPE_FLTOVF_TRAP 0xd4 /* overflow */
-
-#endif /* !_ANSI_SOURCE */
-#endif /* !_SPARC_SIGNAL_H_ */
diff --git a/sys/arch/kbus/include/stdarg.h b/sys/arch/kbus/include/stdarg.h
deleted file mode 100644
index aa2081597bf..00000000000
--- a/sys/arch/kbus/include/stdarg.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* $NetBSD: stdarg.h,v 1.9 1995/12/29 18:53:01 mycroft Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)stdarg.h 8.2 (Berkeley) 9/27/93
- */
-
-#ifndef _SPARC_STDARG_H_
-#define _SPARC_STDARG_H_
-
-#include <machine/ansi.h>
-
-typedef _BSD_VA_LIST_ va_list;
-
-#define __va_size(type) \
- (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long))
-
-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 6
-#define va_start(ap, last) \
- (__builtin_next_arg(last), (ap) = (va_list)__builtin_saveregs())
-#else
-#define va_start(ap, last) \
- (__builtin_next_arg(), (ap) = (va_list)__builtin_saveregs())
-#endif
-
-/*
- * va_arg picks up the next argument of type `type'. Appending an
- * asterisk to `type' must produce a pointer to `type' (i.e., `type'
- * may not be, e.g., `int (*)()').
- *
- * Gcc-2.x tries to use ldd/std for double and quad_t values, but Sun's
- * brain-damaged calling convention does not quad-align these. Thus, for
- * 8-byte arguments, we have to pick up the actual value four bytes at a
- * time, and use type punning (i.e., a union) to produce the result.
- * (We could also do this with a libc function, actually, by returning
- * 8 byte integers in %o0+%o1 and the same 8 bytes as a double in %f0+%f1.)
- *
- * Note: We don't declare __d with type `type', since in C++ the type might
- * have a constructor.
- */
-#if __GNUC__ == 1
-#define __extension__
-#endif
-
-#define __va_8byte(ap, type) \
- __extension__ ({ \
- union { char __d[sizeof(type)]; int __i[2]; } __va_u; \
- __va_u.__i[0] = ((int *)(void *)(ap))[0]; \
- __va_u.__i[1] = ((int *)(void *)(ap))[1]; \
- (ap) += 8; *(type *)(va_list)__va_u.__d; \
- })
-
-#define __va_arg(ap, type) \
- (*(type *)((ap) += __va_size(type), \
- (ap) - (sizeof(type) < sizeof(long) && \
- sizeof(type) != __va_size(type) ? \
- sizeof(type) : __va_size(type))))
-
-#define __RECORD_TYPE_CLASS 12
-#define va_arg(ap, type) \
- (__builtin_classify_type(*(type *)0) >= __RECORD_TYPE_CLASS ? \
- *__va_arg(ap, type *) : __va_size(type) == 8 ? \
- __va_8byte(ap, type) : __va_arg(ap, type))
-
-#define va_end(ap) ((void)0)
-
-#endif /* !_SPARC_STDARG_H_ */
diff --git a/sys/arch/kbus/include/sun_disklabel.h b/sys/arch/kbus/include/sun_disklabel.h
deleted file mode 100644
index c101829d3aa..00000000000
--- a/sys/arch/kbus/include/sun_disklabel.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/* $OpenBSD: sun_disklabel.h,v 1.1.1.1 1997/10/14 07:25:31 gingold Exp $ */
-/* $NetBSD: sun_disklabel.h,v 1.6 1996/01/07 22:03:09 thorpej Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)sun_disklabel.h 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * SunOS disk label layout (only relevant portions discovered here).
- */
-
-#define SUN_DKMAGIC 55998
-
-/* These are the guys that Sun's dkinfo needs... */
-#define DKIOCGGEOM _IOR('d', 2, struct sun_dkgeom) /* geometry info */
-#define DKIOCINFO _IOR('d', 8, struct sun_dkctlr) /* controller info */
-#define DKIOCGPART _IOR('d', 4, struct sun_dkpart) /* partition info */
-
-/* geometry info */
-struct sun_dkgeom {
- u_short sdkc_ncylinders; /* data cylinders */
- u_short sdkc_acylinders; /* alternate cylinders */
- u_short sdkc_xxx1;
- u_short sdkc_ntracks; /* tracks per cylinder */
- u_short sdkc_xxx2;
- u_short sdkc_nsectors; /* sectors per track */
- u_short sdkc_interleave; /* interleave factor */
- u_short sdkc_xxx3;
- u_short sdkc_xxx4;
- u_short sdkc_sparespercyl; /* spare sectors per cylinder */
- u_short sdkc_rpm; /* rotational speed */
- u_short sdkc_pcylinders; /* physical cylinders */
- u_short sdkc_xxx5[7];
-};
-
-/* controller info */
-struct sun_dkctlr {
- int sdkc_addr; /* controller address */
- short sdkc_unit; /* unit (slave) address */
- short sdkc_type; /* controller type */
- short sdkc_flags; /* flags */
-};
-
-/* partition info */
-struct sun_dkpart {
- long sdkp_cyloffset; /* starting cylinder */
- long sdkp_nsectors; /* number of sectors */
-};
-
-#define SUNXPART 8
-#define SL_XPMAG (0x199d1fe2+SUNXPART)
-
-struct sun_disklabel { /* total size = 512 bytes */
- char sl_text[128];
- u_long sl_xpsum; /* additive cksum, [sl_xpmag,sl_xxx1) */
- u_long sl_xpmag; /* "extended" magic number */
- struct sun_dkpart sl_xpart[SUNXPART]; /* "extended" partitions, i through p */
- char sl_xxx1[292-8-(8*SUNXPART)]; /* [292] including sl_x* */
- u_short sl_rpm; /* rotational speed */
- u_short sl_pcylinders; /* number of physical cyls */
- u_short sl_sparespercyl; /* spare sectors per cylinder */
- char sl_xxx3[4];
- u_short sl_interleave; /* interleave factor */
- u_short sl_ncylinders; /* data cylinders */
- u_short sl_acylinders; /* alternate cylinders */
- u_short sl_ntracks; /* tracks per cylinder */
- u_short sl_nsectors; /* sectors per track */
- char sl_xxx4[4];
- struct sun_dkpart sl_part[8]; /* partition layout */
- u_short sl_magic; /* == SUN_DKMAGIC */
- u_short sl_cksum; /* xor checksum of all shorts */
-};
-
-#define SUN_LABELOFFSET 128
-
-#ifdef _KERNEL
-/* reads sun label in sector at [cp..cp+511] and sets *lp to BSD label */
-int sun_disklabel __P((caddr_t, struct disklabel *)); /* true on success */
-
-/* compatability dk ioctl's */
-int sun_dkioctl __P((struct disk *, u_long, caddr_t, int));
-#endif
diff --git a/sys/arch/kbus/include/trap.h b/sys/arch/kbus/include/trap.h
deleted file mode 100644
index 86c45589f80..00000000000
--- a/sys/arch/kbus/include/trap.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* $NetBSD: trap.h,v 1.9 1996/05/16 15:57:04 abrown Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)trap.h 8.1 (Berkeley) 6/11/93
- */
-/*
- * Sun4m support by Aaron Brown, Harvard University.
- * Changes Copyright (c) 1995 The President and Fellows of Harvard College.
- * All rights reserved.
- */
-
-#ifndef _MACHINE_TRAP_H
-#define _MACHINE_TRAP_H
-
-/* trap vec (pri) description */
-#define T_RESET 0x00 /* (1) not actually vectored; jumps to 0 */
-#define T_TEXTFAULT 0x01 /* (2) address fault during instr fetch */
-#define T_ILLINST 0x02 /* (3) illegal instruction */
-#define T_PRIVINST 0x03 /* (4) privileged instruction */
-#define T_FPDISABLED 0x04 /* (5) fp instr while fp disabled */
-#define T_WINOF 0x05 /* (6) register window overflow */
-#define T_WINUF 0x06 /* (7) register window underflow */
-#define T_ALIGN 0x07 /* (8) address not properly aligned */
-#define T_FPE 0x08 /* (9) floating point exception */
-#define T_DATAFAULT 0x09 /* (10) address fault during data fetch */
-#define T_TAGOF 0x0a /* (11) tag overflow */
-/* 0x0b unused */
-/* 0x0c unused */
-/* 0x0d unused */
-/* 0x0e unused */
-/* 0x0f unused */
-/* 0x10 unused */
-#define T_L1INT 0x11 /* (27) level 1 interrupt */
-#define T_L2INT 0x12 /* (26) level 2 interrupt */
-#define T_L3INT 0x13 /* (25) level 3 interrupt */
-#define T_L4INT 0x14 /* (24) level 4 interrupt */
-#define T_L5INT 0x15 /* (23) level 5 interrupt */
-#define T_L6INT 0x16 /* (22) level 6 interrupt */
-#define T_L7INT 0x17 /* (21) level 7 interrupt */
-#define T_L8INT 0x18 /* (20) level 8 interrupt */
-#define T_L9INT 0x19 /* (19) level 9 interrupt */
-#define T_L10INT 0x1a /* (18) level 10 interrupt */
-#define T_L11INT 0x1b /* (17) level 11 interrupt */
-#define T_L12INT 0x1c /* (16) level 12 interrupt */
-#define T_L13INT 0x1d /* (15) level 13 interrupt */
-#define T_L14INT 0x1e /* (14) level 14 interrupt */
-#define T_L15INT 0x1f /* (13) level 15 interrupt */
-/* 0x20 unused */
-/* through 0x23 unused */
-#define T_CPDISABLED 0x24 /* (5) coprocessor instr while disabled */
-/* 0x25 unused */
-/* through 0x27 unused */
-#define T_CPEXCEPTION 0x28 /* (9) coprocessor exception */
-/* 0x29 unused */
-/* through 0x2a unused */
-#define T_STOREBUFFAULT 0x2b /* SuperSPARC: Store buffer copy-back fault */
-/* 0x2c unused */
-/* through 0x7f unused */
-
-/* beginning of `user' vectors (from trap instructions) - all priority 12 */
-#define T_SUN_SYSCALL 0x80 /* system call */
-#define T_BREAKPOINT 0x81 /* breakpoint `instruction' */
-#define T_DIV0 0x82 /* division routine was handed 0 */
-#define T_FLUSHWIN 0x83 /* flush windows */
-#define T_CLEANWIN 0x84 /* provide clean windows */
-#define T_RANGECHECK 0x85 /* ? */
-#define T_FIXALIGN 0x86 /* fix up unaligned accesses */
-#define T_INTOF 0x87 /* integer overflow ? */
-#define T_SVR4_SYSCALL 0x88 /* SVR4 system call */
-#define T_BSD_SYSCALL 0x89 /* BSD system call */
-#define T_KGDB_EXEC 0x8a /* for kernel gdb */
-
-/* 0x8b..0xff are currently unallocated, except the following */
-#define T_SVR4_GETCC 0xa0
-#define T_SVR4_SETCC 0xa1
-#define T_SVR4_GETPSR 0xa2
-#define T_SVR4_SETPSR 0xa3
-#define T_SVR4_GETHRTIME 0xa4
-#define T_SVR4_GETHRVTIME 0xa5
-#define T_SVR4_GETHRESTIME 0xa7
-
-
-#ifdef _KERNEL /* pseudo traps for locore.s */
-#define T_RWRET -1 /* need first user window for trap return */
-#define T_AST -2 /* no-op, just needed reschedule or profile */
-#endif
-
-/* flags to system call (flags in %g1 along with syscall number) */
-#define SYSCALL_G2RFLAG 0x400 /* on success, return to %g2 rather than npc */
-#define SYSCALL_G7RFLAG 0x800 /* use %g7 as above (deprecated) */
-
-/*
- * `software trap' macros to keep people happy (sparc v8 manual says not
- * to set the upper bits).
- */
-#define ST_BREAKPOINT (T_BREAKPOINT & 0x7f)
-#define ST_DIV0 (T_DIV0 & 0x7f)
-#define ST_FLUSHWIN (T_FLUSHWIN & 0x7f)
-#define ST_SYSCALL (T_SUN_SYSCALL & 0x7f)
-
-#endif /* _MACHINE_TRAP_H_ */
diff --git a/sys/arch/kbus/include/types.h b/sys/arch/kbus/include/types.h
deleted file mode 100644
index 16dc11cffcb..00000000000
--- a/sys/arch/kbus/include/types.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* $NetBSD: types.h,v 1.9 1996/03/14 00:48:30 pk Exp $ */
-/* $OpenBSD: types.h,v 1.4 2000/01/10 03:52:44 millert Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)types.h 8.1 (Berkeley) 6/11/93
- */
-
-#ifndef _MACHTYPES_H_
-#define _MACHTYPES_H_
-
-#include <sys/cdefs.h>
-
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
-typedef struct _physadr {
- short r[1];
-} *physadr;
-
-typedef struct label_t {
- int val[2];
-} label_t;
-#endif
-
-typedef unsigned long vm_offset_t;
-typedef unsigned long vm_size_t;
-
-typedef unsigned long vaddr_t;
-typedef unsigned long paddr_t;
-typedef unsigned long vsize_t;
-typedef unsigned long psize_t;
-
-/*
- * Basic integral types. Omit the typedef if
- * not possible for a machine/compiler combination.
- */
-#define __BIT_TYPES_DEFINED__
-typedef __signed char int8_t;
-typedef unsigned char u_int8_t;
-typedef unsigned char uint8_t;
-typedef short int16_t;
-typedef unsigned short u_int16_t;
-typedef unsigned short uint16_t;
-typedef int int32_t;
-typedef unsigned int u_int32_t;
-typedef unsigned int uint32_t;
-typedef long long int64_t;
-typedef unsigned long long u_int64_t;
-typedef unsigned long long uint64_t;
-
-typedef int32_t register_t;
-
-#endif /* _MACHTYPES_H_ */
diff --git a/sys/arch/kbus/include/varargs.h b/sys/arch/kbus/include/varargs.h
deleted file mode 100644
index 3585b7caa94..00000000000
--- a/sys/arch/kbus/include/varargs.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $NetBSD: varargs.h,v 1.10 1995/12/29 18:53:02 mycroft Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)varargs.h 8.3 (Berkeley) 3/22/94
- */
-
-#ifndef _SPARC_VARARGS_H_
-#define _SPARC_VARARGS_H_
-
-#include <machine/stdarg.h>
-
-#if __GNUC__ == 1
-#define __va_ellipsis
-#else
-#define __va_ellipsis ...
-#endif
-
-#define va_alist __builtin_va_alist
-#define va_dcl long __builtin_va_alist; __va_ellipsis
-
-#undef va_start
-#define va_start(ap) \
- ((ap) = (va_list)__builtin_saveregs())
-
-#endif /* !_SPARC_VARARGS_H_ */
diff --git a/sys/arch/kbus/include/vmparam.h b/sys/arch/kbus/include/vmparam.h
deleted file mode 100644
index e2bc6a3257a..00000000000
--- a/sys/arch/kbus/include/vmparam.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/* $NetBSD: vmparam.h,v 1.6 1995/02/14 18:52:29 phil Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)vmparam.h 5.9 (Berkeley) 5/12/91
- */
-
-#ifndef _MACHINE_VMPARAM_H_
-#define _MACHINE_VMPARAM_H_
-
-/*
- * Machine dependent constants for 532.
- */
-
-/*
- * Virtual address space arrangement. On 532, both user and kernel
- * share the address space, not unlike the vax.
- * USRTEXT is the start of the user text/data space, while USRSTACK
- * is the top (end) of the user stack. Immediately above the user stack
- * resides the user structure, which is UPAGES long and contains the
- * kernel stack.
- *
- * Immediately after the user structure is the page table map, and then
- * kernal address space.
- */
-#define USRTEXT 0x2000 /* For NetBSD... */
-#define USRSTACK 0xF8000000
-#define BTOPUSRSTACK series5_btop(USRSTACK) /* btop(USRSTACK) */
-#if 0
-#define LOWPAGES 0
-#define HIGHPAGES UPAGES
-#endif
-
-/*
- * Virtual memory related constants, all in bytes
- */
-#define MAXTSIZ (16*1024*1024) /* max text size */
-#ifndef DFLDSIZ
-#define DFLDSIZ (24*1024*1024) /* initial data size limit */
-#endif
-#ifndef MAXDSIZ
-#define MAXDSIZ (128*1024*1024) /* max data size */
-#endif
-#ifndef DFLSSIZ
-#define DFLSSIZ (1*1024*1024) /* initial stack size limit */
-#endif
-#ifndef MAXSSIZ
-#define MAXSSIZ (8*1024*1024) /* max stack size */
-#endif
-
-/*
- * Default sizes of swap allocation chunks (see dmap.h).
- * The actual values may be changed in vminit() based on MAXDSIZ.
- * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024.
- */
-#define DMMIN 32 /* smallest swap allocation */
-#define DMMAX 4096 /* largest potential swap allocation */
-#define DMTEXT 1024 /* swap allocation for text */
-
-/*
- * Sizes of the system and user portions of the system page table.
- */
-#define SYSPTSIZE (2*NPTEPG)
-#define USRPTSIZE (2*NPTEPG)
-
-/*
- * Size of User Raw I/O map
- */
-#define USRIOSIZE 64
-
-/*
- * The size of the clock loop.
- */
-#define LOOPPAGES (maxfree - firstfree)
-
-/*
- * The time for a process to be blocked before being very swappable.
- * This is a number of seconds which the system takes as being a non-trivial
- * amount of real time. You probably shouldn't change this;
- * it is used in subtle ways (fractions and multiples of it are, that is, like
- * half of a ``long time'', almost a long time, etc.)
- * It is related to human patience and other factors which don't really
- * change over time.
- */
-#define MAXSLP 20
-
-/*
- * A swapped in process is given a small amount of core without being bothered
- * by the page replacement algorithm. Basically this says that if you are
- * swapped in you deserve some resources. We protect the last SAFERSS
- * pages against paging and will just swap you out rather than paging you.
- * Note that each process has at least UPAGES+CLSIZE pages which are not
- * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this
- * number just means a swapped in process is given around 25k bytes.
- * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81),
- * so we loan each swapped in process memory worth 100$, or just admit
- * that we don't consider it worthwhile and swap it out to disk which costs
- * $30/mb or about $0.75.
- * { wfj 6/16/89: Retail AT memory expansion $800/megabyte, loan of $17
- * on disk costing $7/mb or $0.18 (in memory still 100:1 in cost!) }
- */
-#define SAFERSS 8 /* nominal ``small'' resident set size
- protected against replacement */
-
-/*
- * DISKRPM is used to estimate the number of paging i/o operations
- * which one can expect from a single disk controller.
- */
-#define DISKRPM 60
-
-/*
- * Klustering constants. Klustering is the gathering
- * of pages together for pagein/pageout, while clustering
- * is the treatment of hardware page size as though it were
- * larger than it really is.
- *
- * KLMAX gives maximum cluster size in CLSIZE page (cluster-page)
- * units. Note that KLMAX*CLSIZE must be <= DMMIN in dmap.h.
- */
-
-#define KLMAX (4/CLSIZE)
-#define KLSEQL (2/CLSIZE) /* in klust if vadvise(VA_SEQL) */
-#define KLIN (4/CLSIZE) /* default data/stack in klust */
-#define KLTXT (4/CLSIZE) /* default text in klust */
-#define KLOUT (4/CLSIZE)
-
-/*
- * KLSDIST is the advance or retard of the fifo reclaim for sequential
- * processes data space.
- */
-#define KLSDIST 3 /* klusters advance/retard for seq. fifo */
-
-#if 0
-/*
- * Paging thresholds (see vm_sched.c).
- * Strategy of 1/19/85:
- * lotsfree is 512k bytes, but at most 1/4 of memory
- * desfree is 200k bytes, but at most 1/8 of memory
- * minfree is 64k bytes, but at most 1/2 of desfree
- */
-#define LOTSFREE (512 * 1024)
-#define LOTSFREEFRACT 4
-#define DESFREE (200 * 1024)
-#define DESFREEFRACT 8
-#define MINFREE (64 * 1024)
-#define MINFREEFRACT 2
-#endif
-
-/*
- * There are two clock hands, initially separated by HANDSPREAD bytes
- * (but at most all of user memory). The amount of time to reclaim
- * a page once the pageout process examines it increases with this
- * distance and decreases as the scan rate rises.
- */
-#define HANDSPREAD (2 * 1024 * 1024)
-
-/*
- * The number of times per second to recompute the desired paging rate
- * and poke the pagedaemon.
- */
-#define RATETOSCHEDPAGING 4
-
-/*
- * Believed threshold (in megabytes) for which interleaved
- * swapping area is desirable.
- */
-#define LOTSOFMEM 2
-
-#define mapin(pte, v, pfnum, prot) \
- {(*(int *)(pte) = ((pfnum)<<PGSHIFT) | (prot)) ; }
-
-/*
- * Mach derived constants
- */
-
-/* user/kernel map constants */
-/* User vm is 0:0xf8000000. */
-#define VM_MIN_ADDRESS ((vm_offset_t)0)
-#define VM_MAXUSER_ADDRESS ((vm_offset_t)0xF8000000)
-#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS
-/* Io vm, used for phys_map */
-#define VM_MIN_IO_ADDRESS ((vm_offset_t)0xFA000000)
-#define VM_MAX_IO_ADDRESS ((vm_offset_t)0xFB000000)
-/* DVMA space, must be inside the phys_map. 1 Mb. */
-#define VM_MIN_DVMA_ADDRESS ((vm_offset_t)0xFAF00000)
-#define VM_MAX_DVMA_ADDRESS ((vm_offset_t)0xFB000000)
-/* Kernel vm. */
-#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)0xFC000000)
-#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)0xFFF00000)
-/* Prom. */
-#define VM_MIN_PROM_ADDRESS ((vm_offset_t)0xFE000000)
-#define VM_MAX_PROM_ADDRESS ((vm_offset_t)0xFEFFFFFF)
-
-/* virtual sizes (bytes) for various kernel submaps */
-#define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES)
-#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES)
-#define VM_PHYS_SIZE (USRIOSIZE*CLBYTES)
-
-/* # of kernel PT pages (initial only, can grow dynamically) */
-#define VM_KERNEL_PT_PAGES ((vm_size_t)2) /* XXX: SYSPTSIZE */
-
-/* pcb base */
-#define pcbb(p) ((u_int)(p)->p_addr)
-
-#endif
diff --git a/sys/arch/kbus/include/z8530var.h b/sys/arch/kbus/include/z8530var.h
deleted file mode 100644
index 87729496caf..00000000000
--- a/sys/arch/kbus/include/z8530var.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* $NetBSD: z8530var.h,v 1.5 1996/10/13 03:47:44 christos Exp $ */
-
-/*
- * Copyright (c) 1994 Gordon W. Ross
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)zsvar.h 8.1 (Berkeley) 6/11/93
- */
-
-#include <dev/ic/z8530sc.h>
-
-/*
- * Functions to read and write individual registers in a channel.
- * The ZS chip requires a 1.6 uSec. recovery time between accesses,
- * and the Sun3 hardware does NOT take care of this for you.
- * The delay is now handled inside the chip access functions.
- * These could be inlines, but with the delay, speed is moot.
- */
-
-u_char zs_read_reg __P((struct zs_chanstate *cs, u_char reg));
-u_char zs_read_csr __P((struct zs_chanstate *cs));
-u_char zs_read_data __P((struct zs_chanstate *cs));
-
-void zs_write_reg __P((struct zs_chanstate *cs, u_char reg, u_char val));
-void zs_write_csr __P((struct zs_chanstate *cs, u_char val));
-void zs_write_data __P((struct zs_chanstate *cs, u_char val));
-
-
-/*
- * How to request a "soft" interrupt.
- * This could be a macro if you like.
- */
-void zsc_req_softint __P((struct zsc_softc *zsc));
-
-/* Handle user request to enter kernel debugger. */
-void zs_abort __P((void));
-
-/*
- * Some warts needed by z8530tty.c -
- * The default parity REALLY needs to be the same as the PROM uses,
- * or you can not see messages done with printf during boot-up...
- */
-#define ZSTTY_MAJOR 12 /* XXX */
-#define ZSTTY_DEF_CFLAG (CREAD | CS8 | HUPCL)
diff --git a/sys/arch/kbus/kbus/autoconf.c b/sys/arch/kbus/kbus/autoconf.c
deleted file mode 100644
index 328aa08c327..00000000000
--- a/sys/arch/kbus/kbus/autoconf.c
+++ /dev/null
@@ -1,443 +0,0 @@
-/* $NetBSD: autoconf.c,v 1.16 1995/12/28 19:16:55 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)autoconf.c 7.1 (Berkeley) 5/9/91
- */
-
-/*
- * Setup the system to run on the current machine.
- *
- * Configure() is called at boot time and initializes the vba
- * device tables and the memory controller monitoring. Available
- * devices are determined (from possibilities mentioned in ioconf.c),
- * and the drivers are initialized.
- */
-
-#include <sys/param.h>
-#include <sys/disklabel.h>
-#include <sys/conf.h>
-#include <sys/systm.h>
-#include <sys/reboot.h>
-#include <sys/buf.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_map.h>
-
-#include <machine/cpu.h>
-#include <machine/trap.h>
-#include <machine/pmap.h>
-#include <machine/autoconf.h>
-#include <machine/vmparam.h>
-#include <machine/kbus.h>
-
-void setroot __P((void));
-void swapconf __P((void));
-
-/*
- * The following several variables are related to
- * the configuration process, and are used in initializing
- * the machine.
- */
-
-extern int cold; /* cold start flag initialized in locore.s */
-
-/*
- * Determine i/o configuration for a machine.
- */
-void
-configure()
-{
- /* Start the clocks. */
-/* startrtclock(); */
-
- /* Find out what the hardware configuration looks like! */
- if (config_rootfound("mainbus", NULL) == NULL)
- panic ("No mainbus found!");
-
- (void)spl0();
-
- /*
- * Configure swap area and related system
- * parameter based on device(s) used.
- */
-#if 0 /* XXX */
- setroot();
-#endif
- swapconf();
- cold = 0;
-
- printf ("******* COLD = 0 ********\n"); /* XXX */
-}
-
-/*
- * Configure swap space and related parameters.
- */
-void
-swapconf()
-{
- register struct swdevt *swp;
- register int nblks;
-
- for (swp = swdevt; swp->sw_dev > 0; swp++)
- {
- unsigned d = major(swp->sw_dev);
-
- if (d >= nblkdev) break;
- if (bdevsw[d].d_psize) {
- nblks = (*bdevsw[d].d_psize)(swp->sw_dev);
- if (nblks > 0 &&
- (swp->sw_nblks == 0 || swp->sw_nblks > nblks))
- swp->sw_nblks = nblks;
- else
- swp->sw_nblks = 0;
- }
- swp->sw_nblks = ctod(dtoc(swp->sw_nblks));
-
- }
-}
-
-#if 0
-#define DOSWAP /* change swdevt and dumpdev */
-u_long bootdev = 0; /* should be dev_t, but not until 32 bits */
-
-static char devname[][2] = {
- 's','d', /* 0 = sd */
- 's','w', /* 1 = sw */
- 's','t', /* 2 = st */
- 'r','d', /* 3 = rd */
- 'c','d', /* 4 = cd */
-};
-
-/*
- * Attempt to find the device from which we were booted.
- * If we can do so, and not instructed not to do so,
- * change rootdev to correspond to the load device.
- */
-setroot()
-{
- int majdev, mindev, unit, part, adaptor;
- dev_t temp, orootdev;
- struct swdevt *swp;
-
- if (boothowto & RB_DFLTROOT ||
- (bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC)
- return;
- majdev = (bootdev >> B_TYPESHIFT) & B_TYPEMASK;
- if (majdev > sizeof(devname) / sizeof(devname[0]))
- return;
- adaptor = (bootdev >> B_ADAPTORSHIFT) & B_ADAPTORMASK;
- part = (bootdev >> B_PARTITIONSHIFT) & B_PARTITIONMASK;
- unit = (bootdev >> B_UNITSHIFT) & B_UNITMASK;
- mindev = (unit * MAXPARTITIONS) + part;
- orootdev = rootdev;
- rootdev = makedev(majdev, mindev);
- /*
- * If the original rootdev is the same as the one
- * just calculated, don't need to adjust the swap configuration.
- */
- if (rootdev == orootdev)
- return;
- printf("changing root device to %c%c%d%c\n",
- devname[majdev][0], devname[majdev][1],
- unit, part + 'a');
-
-#ifdef DOSWAP
- for (swp = swdevt; swp->sw_dev != NODEV; swp++) {
- if (majdev == major(swp->sw_dev) &&
- (mindev / MAXPARTITIONS)
- == (minor(swp->sw_dev) / MAXPARTITIONS)) {
- temp = swdevt[0].sw_dev;
- swdevt[0].sw_dev = swp->sw_dev;
- swp->sw_dev = temp;
- break;
- }
- }
- if (swp->sw_dev == NODEV)
- return;
-
- /*
- * If dumpdev was the same as the old primary swap device, move
- * it to the new primary swap device.
- */
- if (temp == dumpdev)
- dumpdev = swdevt[0].sw_dev;
-#endif
-}
-#endif
-
-#if 0
-/*ARGSUSED*/
-int
-simple_devprint(auxp, pnp)
- void *auxp;
- const char *pnp;
-{
- return(QUIET);
-}
-#endif
-
-/* Defined in ioconf.c */
-extern char *locnames[];
-extern short locnamp[];
-
-/*
- * Generic "bus" support functions.
- *
- * bus_scan:
- * This function is passed to config_search() by the attach function
- * for each of the "bus" drivers (obctl, obio, obmem, vmes, vmel).
- * The purpose of this function is to copy the "locators" into our
- * confargs structure, so child drivers may use the confargs both
- * as match parameters and as temporary storage for the defaulted
- * locator values determined in the child_match and preserved for
- * the child_attach function. If the bus attach functions just
- * used config_found, then we would not have an opportunity to
- * setup the confargs for each child match and attach call.
- *
- * bus_print:
- * Just prints out the final (non-default) locators.
- */
-int
-bus_scan(parent, child, aux)
- struct device *parent;
- void *child, *aux;
-{
- struct cfdata *cf = child;
- struct confargs *ca = aux;
- cfmatch_t mf;
- int i;
- short *ind;
-
-#ifdef DIAGNOSTIC
- if (parent->dv_cfdata->cf_driver->cd_indirect)
- panic("bus_scan: indirect?");
- if (cf->cf_fstate == FSTATE_STAR)
- panic("bus_scan: FSTATE_STAR");
-#endif
-
- /* ca->ca_bustype set by parent */
- ca->ca_intvec = -1;
- ca->ca_intpri = -1;
- ca->ca_paddr = -1;
-
- for (i = 0, ind = locnamp + cf->cf_locnames; ind[i] != -1; i++)
- {
- if (strcmp (locnames[ind[i]], "addr") == 0)
- ca->ca_paddr = cf->cf_loc[i];
- else if (strcmp (locnames[ind[i]], "vect") == 0)
- ca->ca_intvec = cf->cf_loc[i];
- else if (strcmp (locnames[ind[i]], "level") == 0)
- ca->ca_intpri = cf->cf_loc[i];
- else
- printf ("Unknown loc `%s'\n", locnames[ind[i]]);
- }
-
- /*
- * Note that this allows the match function to save
- * defaulted locators in the confargs that will be
- * preserved for the related attach call.
- */
- mf = cf->cf_attach->ca_match;
- if ((*mf)(parent, cf, ca) > 0) {
- config_attach(parent, cf, ca, bus_print);
- }
- return (0);
-}
-
-/*
- * Print out the confargs. The parent name is non-NULL
- * when there was no match found by config_found().
- */
-int
-bus_print(args, name)
- void *args;
- const char *name;
-{
- struct confargs *ca = args;
-
- if (name)
- printf("%s:", name);
-
- if (ca->ca_paddr != -1)
- printf(" addr 0x%x", ca->ca_paddr);
- if (ca->ca_intpri != -1)
- printf(" level %d", ca->ca_intpri);
- if (ca->ca_intvec != -1)
- printf(" vector 0x%x", ca->ca_intvec);
-
- return(UNCONF);
-}
-
-
-/*
- * Map an I/O device given physical address and size in bytes, e.g.,
- *
- * mydev = (struct mydev *)mapdev(myioaddr,
- * sizeof(struct mydev), pmtype);
- *
- * See also machine/autoconf.h.
- */
-static vm_offset_t iobase = VM_MIN_IO_ADDRESS + NBPG;
-static vm_offset_t peek_addr = VM_MIN_IO_ADDRESS;
-
-char *
-bus_mapin(bustype, paddr, size)
- register int bustype;
- u_long paddr;
- register int size;
-{
- register vm_offset_t v;
- register vm_offset_t pa;
- register char *ret;
-
- size = round_page(size);
- if (size == 0)
- panic("bus_mapin: zero size");
-
- switch (bustype)
- {
- case BUS_KBUS:
- break;
- case BUS_VME16:
- paddr = VME16_BASE | (paddr & VME16_MASK);
- break;
- case BUS_VME24:
- paddr = VME24_BASE | (paddr & VME24_MASK);
- break;
- case BUS_VME32:
- paddr = VME32_BASE | (paddr & VME32_MASK);
- break;
- default:
- return NULL;
- }
-
- v = iobase;
- iobase += size;
- if (iobase > VM_MAX_IO_ADDRESS) /* unlikely */
- panic("mapiodev");
-
- ret = (void *)(v | (paddr & PGOFSET)); /* note: preserve page offset */
-
- pa = trunc_page(paddr);
-
- do {
- pmap_enter(pmap_kernel(), v, pa | PG_IO,
- VM_PROT_READ | VM_PROT_WRITE, 1,
- VM_PROT_READ | VM_PROT_WRITE);
- v += PAGE_SIZE;
- pa += PAGE_SIZE;
- } while ((size -= PAGE_SIZE) > 0);
- return ret;
-}
-
-/*
- * Read addr with size len (1,2,4) into val.
- * If this generates a bus error, return -1
- *
- * Create a temporary mapping,
- * Try the access using peek_*
- * Clean up temp. mapping
- */
-int bus_peek(bustype, paddr, sz)
- int bustype, paddr, sz;
-{
- int off;
-
- switch (bustype)
- {
- case BUS_KBUS:
- break;
- case BUS_VME16:
- paddr = VME16_BASE | (paddr & VME16_MASK);
- break;
- case BUS_VME24:
- paddr = VME24_BASE | (paddr & VME24_MASK);
- break;
- case BUS_VME32:
- paddr = VME32_BASE | (paddr & VME32_MASK);
- break;
- default:
- return -1;
- }
-
- off = paddr & PGOFSET;
-
- pmap_enter (pmap_kernel(), peek_addr, (paddr & PG_FRAME) | PG_IO,
- VM_PROT_READ | VM_PROT_WRITE, 1,
- VM_PROT_READ | VM_PROT_WRITE);
-
- return probeget ((caddr_t)peek_addr + off, sz);
-}
-
-/* from hp300: badaddr() */
-int
-peek_word(addr)
- register caddr_t addr;
-{
- label_t faultbuf;
- register int x;
-
- nofault = &faultbuf;
- if (setjmp(&faultbuf)) {
- nofault = NULL;
- return(-1);
- }
- x = *(volatile u_short *)addr;
- nofault = NULL;
- return(x);
-}
-
-/* from hp300: badbaddr() */
-int
-peek_byte(addr)
- register caddr_t addr;
-{
- label_t faultbuf;
- register int x;
-
- nofault = &faultbuf;
- if (setjmp(&faultbuf)) {
- nofault = NULL;
- return(-1);
- }
- x = *(volatile u_char *)addr;
- nofault = NULL;
- return(x);
-}
diff --git a/sys/arch/kbus/kbus/clock.c b/sys/arch/kbus/kbus/clock.c
deleted file mode 100644
index b03265a937a..00000000000
--- a/sys/arch/kbus/kbus/clock.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/* $NetBSD: clock.c,v 1.11 1995/05/16 07:30:46 phil Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz and Don Ahn.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)clock.c 7.2 (Berkeley) 5/12/91
- *
- */
-
-/*
- * Primitive clock interrupt routines.
- *
- * Improved by Phil Budne ... 10/17/94.
- * Pulled over code from i386/isa/clock.c (Matthias Pfaller 12/03/94).
- */
-
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/device.h>
-#include <sys/conf.h>
-#include <sys/ioctl.h>
-#include <sys/kernel.h>
-
-#include <dev/ic/z8530reg.h>
-#include <machine/z8530var.h>
-#include <machine/kbus.h>
-#include <machine/autoconf.h>
-#include "clockreg.h"
-
-/*
- * Clock driver
- */
-
-/*
- * Zilog Z8530 Dual UART driver (clock interface)
- *
- * This is the "slave" driver that will be attached to
- * the "zsc" driver for a clock.
- */
-static int clock_started;
-
-/* Clock state. */
-struct clock_softc {
- struct device clock_dev; /* required first: base device */
- struct zs_chanstate *clock_cs;
-};
-
-/****************************************************************
- * Definition of the driver for autoconfig.
- ****************************************************************/
-
-static int clock_match __P((struct device *, void *, void *));
-static void clock_attach __P((struct device *, struct device *, void *));
-
-struct cfattach clock_ca = {
- sizeof(struct clock_softc), clock_match, clock_attach
-};
-
-struct cfdriver clock_cd = {
- NULL, "clock", DV_DULL
-};
-
-/*
- * BCD to decimal and decimal to BCD.
- */
-#define FROM_BCD(x,y) ((x) + 10 * (y))
-
-static int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-
-#define yeartoday(year) (((year) % 4) ? 365 : 366)
-
-/* Virtual address of RTC. */
-static u_char *rtc_byte;
-
-/* Set when the tod was read. */
-static int timeset;
-
-/* Needed by kern_clock.c */
-void
-setstatclockrate(int dummy)
-{
- printf ("setstatclockrate\n");
-}
-
-static u_char
-rtc_read_reg (int reg)
-{
- u_char res;
-
- reg &= 0x0f;
- *rtc_byte = RTC_WRITE_ADDR | reg;
- *rtc_byte = reg;
- *rtc_byte = RTC_READ | 0x0f;
- res = *rtc_byte & 0x0f;
- *rtc_byte = RTC_WRITE_ADDR | 0x0f;
- *rtc_byte = 0x0f;
- return res;
-}
-
-static u_char
-rtc_write_reg (int reg, u_char val)
-{
- u_char res = 0;
-
- reg &= 0x0f;
- val &= 0x0f;
- *rtc_byte = RTC_WRITE_ADDR | RTC_STOP | reg;
- *rtc_byte = reg | RTC_STOP ;
- *rtc_byte = RTC_STOP | RTC_WRITE | val;
- *rtc_byte = RTC_STOP | RTC_WRITE | val;
- *rtc_byte = RTC_WRITE | val;
- *rtc_byte = RTC_WRITE_ADDR | 0x0f;
- *rtc_byte = 0x0f;
- return res;
-}
-
-/*
- * Initialize the time of day register, based on the time base which is, e.g.
- * from a filesystem.
- */
-void
-inittodr (base)
- time_t base;
-{
- /*
- * We ignore the suggested time for now and go for the RTC
- * clock time stored in the CMOS RAM.
- */
- time_t n;
- int sec, min, hr, dom, mon, yr;
- int hrl, hrh;
- int i, days = 0;
- int s;
-
- if (!rtc_byte)
- {
- rtc_byte = bus_mapin (BUS_KBUS, RTC_ADDR, 1);
- if (!rtc_byte)
- panic ("Can't map RTC");
- }
-
- timeset = 1;
-
- sec = FROM_BCD (rtc_read_reg (RTC_SEC_LOW),
- rtc_read_reg (RTC_SEC_HIGH));
- min = FROM_BCD (rtc_read_reg (RTC_MIN_LOW),
- rtc_read_reg (RTC_MIN_HIGH));
- dom = FROM_BCD (rtc_read_reg (RTC_DAY_LOW),
- rtc_read_reg (RTC_DAY_HIGH));
- mon = FROM_BCD (rtc_read_reg (RTC_MON_LOW),
- rtc_read_reg (RTC_MON_HIGH));
- yr = RTC_YEAR_BASE + FROM_BCD (rtc_read_reg (RTC_YEAR_LOW),
- rtc_read_reg (RTC_YEAR_HIGH));
- hrl = rtc_read_reg (RTC_HOUR_LOW);
- hrh = rtc_read_reg (RTC_HOUR_HIGH);
- if (hrh & RTC_HOUR_PM)
- hr = 12 + (hrh & 1) * 10 + hrl;
- else
- hr = (hrh & 0x03) * 10 + hrl;
-
- yr = (yr < 70) ? yr + 100 : yr;
-
- /*
- * Check to see if it was really the rtc
- * by checking for bad date info.
- */
- if (sec > 59 || min > 59 || hr > 23 || dom > 31 || mon > 12) {
- printf("inittodr: No clock found\n");
- time.tv_sec = base;
- return;
- }
-
- n = sec + 60 * min + 3600 * hr;
- n += (dom - 1) * 3600 * 24;
-
- if (yeartoday(yr) == 366)
- month[1] = 29;
- for (i = mon - 2; i >= 0; i--)
- days += month[i];
- month[1] = 28;
- for (i = 70; i < yr; i++)
- days += yeartoday(i);
- n += days * 3600 * 24;
-
- n += tz.tz_minuteswest * 60;
- if (tz.tz_dsttime)
- n -= 3600;
- s = splclock();
- time.tv_sec = n;
- time.tv_usec = 0;
- splx(s);
-}
-
-/*
- * Reset the clock.
- */
-void
-resettodr()
-{
- time_t n;
- int diff, i, j;
- int s;
-
- /*
- * We might have been called by boot() due to a crash early
- * on. Don't reset the clock chip in this case.
- */
- if (!timeset)
- return;
-
- diff = tz.tz_minuteswest * 60;
- if (tz.tz_dsttime)
- diff -= 3600;
-
- s = splclock();
- n = (time.tv_sec - diff) % (3600 * 24); /* hrs+mins+secs */
- rtc_write_reg (RTC_SEC_LOW, (n % 60) % 10);
- rtc_write_reg (RTC_SEC_HIGH, (n % 60) / 10);
- n /= 60;
- rtc_write_reg (RTC_MIN_LOW, (n % 60) % 10);
- rtc_write_reg (RTC_MIN_HIGH, (n % 60) / 10);
- rtc_write_reg (RTC_HOUR_LOW, (n / 60) % 10);
- rtc_write_reg (RTC_HOUR_HIGH, (n / 60) / 10);
-
- n = (time.tv_sec - diff) / (3600 * 24); /* days */
- splx(s);
- rtc_write_reg (RTC_WEEK_DAY, (n + 4) % 7); /* 1/1/70 is Thursday */
-
- for (j = 1970, i = yeartoday(j); n >= i; j++, i = yeartoday(j))
- n -= i;
-
- rtc_write_reg (RTC_YEAR_LOW, (j - 1900 - RTC_YEAR_BASE) % 10);
- rtc_write_reg (RTC_YEAR_HIGH, (j - 1900 - RTC_YEAR_BASE) / 10);
-
- if (i == 366)
- month[1] = 29;
- for (i = 0; n >= month[i]; i++)
- n -= month[i];
- month[1] = 28;
- i++;
- rtc_write_reg (RTC_MON_LOW, i % 10);
- rtc_write_reg (RTC_MON_HIGH, i / 10);
- n++;
- rtc_write_reg (RTC_DAY_LOW, n % 10);
- rtc_write_reg (RTC_DAY_HIGH, n / 10);
-}
-
-static int
-clock_intr (void *arg)
-{
- if (clock_started)
- {
- hardclock ((struct clockframe *) arg);
- /* setsoftle (); */
- }
- return 1;
-}
-
-static struct intrhand clockhand = {clock_intr};
-/*
- * clock_match: how is this zs channel configured?
- */
-int
-clock_match(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct cfdata *cf = match;
- struct zsc_attach_args *args = aux;
-
- /* Exact match required for keyboard. */
- if (cf->cf_loc[0] == args->channel)
- return 2;
-
- return 0;
-}
-
-void
-clock_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-
-{
- struct zsc_softc *zsc = (void *) parent;
- struct clock_softc *clock = (void *) self;
- struct zsc_attach_args *args = aux;
- struct zs_chanstate *cs;
- int channel;
- int reset, s, tconst;
-
- channel = args->channel;
- cs = &zsc->zsc_cs[channel];
- cs->cs_private = clock;
- clock->clock_cs = cs;
-
- printf("\n");
-
- /* Initialize the speed, etc. */
- hz = 300; /* 60; */
- tconst = 0x515c;
- s = splclock();
-
- /* May need reset... */
- reset = (channel == 0) ?
- ZSWR9_A_RESET : ZSWR9_B_RESET;
- zs_write_reg(cs, 9, reset);
-
- /* These are OK as set by zscc: WR3, WR4, WR5 */
- cs->cs_preg[1] = 0; /* no intr. */
- cs->cs_preg[3] = ZSWR3_RX_8 | ZSWR3_RX_ENABLE;
- cs->cs_preg[4] = ZSWR4_CLK_X1 | ZSWR4_ONESB | ZSWR4_PARENB;
- cs->cs_preg[5] = ZSWR5_TX_8 | ZSWR5_TX_ENABLE;
- cs->cs_preg[9] = 0; /* Clear MIE. */
- cs->cs_preg[10] = 0;
- cs->cs_preg[11] = ZSWR11_RXCLK_RTXC | ZSWR11_TXCLK_RTXC
- | ZSWR11_TRXC_OUT_ENA | ZSWR11_TRXC_BAUD;
- cs->cs_preg[12] = tconst;
- cs->cs_preg[13] = tconst >> 8;
- cs->cs_preg[14] = ZSWR14_BAUD_FROM_PCLK | ZSWR14_BAUD_ENA;
- cs->cs_preg[15] = 0;
-
- zs_loadchannelregs(cs);
-
- intr_establish (INTR_CLOCK, 0, &clockhand);
- splx(s);
-
- /* Initialize translator. */
- clock_started = 0;
-}
-
-
-void
-cpu_initclocks (void)
-{
- clock_started = 1;
-}
diff --git a/sys/arch/kbus/kbus/clockreg.h b/sys/arch/kbus/kbus/clockreg.h
deleted file mode 100644
index 675088b10aa..00000000000
--- a/sys/arch/kbus/kbus/clockreg.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $OpenBSD: clockreg.h,v 1.2 2000/03/03 00:54:49 todd Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)clockreg.h 8.1 (Berkeley) 6/11/93
- */
-
-/* RTC 58321. */
-#define RTC_STOP 0x80 /* Stop RTC clock. */
-#define RTC_WRITE 0x40 /* Write access. */
-#define RTC_READ 0x20 /* Read access. */
-#define RTC_WRITE_ADDR 0x10 /* Write address. */
-
-#define RTC_SEC_LOW 0x00 /* RTC seconds (low nibble). */
-#define RTC_SEC_HIGH 0x01 /* RTC seconds (high nibble). */
-#define RTC_MIN_LOW 0x02 /* RTC minutes (low nibble). */
-#define RTC_MIN_HIGH 0x03 /* RTC minutes (high nibble). */
-#define RTC_HOUR_LOW 0x04 /* RTC hours (low nibble). */
-#define RTC_HOUR_HIGH 0x05 /* RTC hours (high nibble). */
-#define RTC_HOUR_24 0x08 /* RTC 24 hours mode bit. */
-#define RTC_HOUR_PM 0x04 /* RTC p.m. bit. */
-#define RTC_WEEK_DAY 0x06 /* RTC day of the week. */
-#define RTC_DAY_LOW 0x07 /* RTC day of the month (low nibble). */
-#define RTC_DAY_HIGH 0x08 /* RTC day of the month (high nibble). */
-#define RTC_MON_LOW 0x09 /* RTC month (low nibble). */
-#define RTC_MON_HIGH 0x0a /* RTC month (high nibble). */
-#define RTC_YEAR_LOW 0x0b /* RTC year (low nibble). */
-#define RTC_YEAR_HIGH 0x0c /* RTC year (high nibble). */
-
-#define RTC_YEAR_BASE 68
-
diff --git a/sys/arch/kbus/kbus/conf.c b/sys/arch/kbus/kbus/conf.c
deleted file mode 100644
index 7404e9c5fea..00000000000
--- a/sys/arch/kbus/kbus/conf.c
+++ /dev/null
@@ -1,442 +0,0 @@
-/* $NetBSD: conf.c,v 1.40 1996/04/11 19:20:03 thorpej Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)conf.c 8.3 (Berkeley) 11/14/93
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/ioctl.h>
-#include <sys/vnode.h>
-#include <sys/tty.h>
-#include <sys/conf.h>
-
-#include <machine/conf.h>
-
-#include "pty.h"
-#include "bpfilter.h"
-#include "vnd.h"
-#include "ccd.h"
-#include "st.h"
-/*
-#include "sd.h"
-#include "cd.h"
-#include "rd.h"
-*/
-#include "tun.h"
-
-#include "zsc.h"
-#include "xd.h"
-#ifdef XFS
-#include <xfs/nxfs.h>
-cdev_decl(xfs_dev);
-#endif
-
-#if 0
-#include "bwtwo.h"
-#include "xy.h"
-#endif
-
-#define NXY 0
-#define NSD 0
-#define NSS 0
-#define NCD 0
-#define NUK 0
-#define NRD 0
-#define NFD 0
-#define NIPF 0
-#define NCH 0
-#define NBWTWO 0
-
-struct bdevsw bdevsw[] =
-{
- bdev_notdef(), /* 0 */
- bdev_notdef(), /* 1 */
- bdev_notdef(), /* 2 */
- bdev_notdef(), /* disk_init(NXY,xy), * 3: SMD disk */
- bdev_swap_init(1,sw), /* 4 */
- bdev_notdef(), /* 5 */
- bdev_notdef(), /* 6 */
- bdev_notdef(), /* disk_init(NSD,sd), * 7: SCSI disk */
- bdev_disk_init(NVND,vnd), /* 8: vnode disk driver */
- bdev_disk_init(NCCD,ccd), /* 9: concatenated disk driver */
- bdev_disk_init(NXD,xd), /* 10: SMD disk */
- bdev_tape_init(NST,st), /* 11: SCSI tape */
- bdev_notdef(), /* 12 */
- bdev_notdef(), /* 13 */
- bdev_notdef(), /* 14 */
- bdev_notdef(), /* 15 */
- bdev_notdef(), /* 16: floppy disk */
- bdev_disk_init(NRD,rd), /* 17: ram disk driver */
- bdev_disk_init(NCD,cd), /* 18: SCSI CD-ROM */
- bdev_lkm_dummy(), /* 19 */
- bdev_lkm_dummy(), /* 20 */
- bdev_lkm_dummy(), /* 21 */
- bdev_lkm_dummy(), /* 22 */
- bdev_lkm_dummy(), /* 23 */
- bdev_lkm_dummy(), /* 24 */
-};
-int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
-
-struct cdevsw cdevsw[] =
-{
- cdev_cn_init(1,cn), /* 0: virtual console */
- cdev_notdef(), /* 1 */
- cdev_ctty_init(1,ctty), /* 2: controlling terminal */
- cdev_mm_init(1,mm), /* 3: /dev/{null,mem,kmem,...} */
- cdev_notdef(), /* 4 */
- cdev_notdef(), /* 5 */
- cdev_notdef(), /* 6 */
- cdev_swap_init(1,sw), /* 7: /dev/drum (swap pseudo-device) */
- cdev_notdef(), /* 8 */
- cdev_disk_init(NXY,xy), /* 9: SMD disk */
- cdev_notdef(), /* 10 */
- cdev_notdef(), /* 11 */
- cdev_tty_init(NZSC,zs), /* 12: zs serial */
- cdev_notdef(), /* gen_init(1,ms), * 13: /dev/mouse */
- cdev_notdef(), /* 14 */
- cdev_notdef(), /* 15: sun /dev/winNNN */
- cdev_log_init(1,log), /* 16: /dev/klog */
- cdev_disk_init(NSD,sd), /* 17: SCSI disk */
- cdev_tape_init(NST,st), /* 18: SCSI tape */
- cdev_ch_init(NCH,ch), /* 19: SCSI autochanger */
- cdev_tty_init(NPTY,pts), /* 20: pseudo-tty slave */
- cdev_ptc_init(NPTY,ptc), /* 21: pseudo-tty master */
- cdev_notdef(), /*fb_init(1,fb), * 22: /dev/fb indirect driver */
- cdev_disk_init(NCCD,ccd), /* 23: concatenated disk driver */
- cdev_fd_init(1,filedesc), /* 24: file descriptor pseudo-device */
- cdev_notdef(), /* 25 */
- cdev_notdef(), /* 26 */
- cdev_fb_init(NBWTWO,bwtwo), /* 27: /dev/bwtwo */
- cdev_notdef(), /* 28 */
- cdev_notdef(), /* gen_init(1,kbd), * 29: /dev/kbd */
- cdev_notdef(), /* 30 */
- cdev_notdef(), /* 31: should be /dev/cgtwo */
- cdev_notdef(), /* 32: should be /dev/gpone */
- cdev_notdef(), /* 33 */
- cdev_notdef(), /* 34 */
- cdev_notdef(), /* 35 */
- cdev_notdef(), /* 36 */
- cdev_notdef(), /* 37 */
- cdev_notdef(), /* 38 */
- cdev_notdef(), /* 39: /dev/cgfour */
- cdev_notdef(), /* 40 */
- cdev_notdef(), /* 41 */
- cdev_disk_init(NXD,xd), /* 42: SMD disk */
- cdev_svr4_net_init(NSVR4_NET,svr4_net), /* 43: svr4 net pseudo-device */
- cdev_notdef(), /* 44 */
- cdev_notdef(), /* 45 */
- cdev_notdef(), /* 46 */
- cdev_notdef(), /* 47 */
- cdev_notdef(), /* 48 */
- cdev_notdef(), /* 49 */
- cdev_notdef(), /* 50 */
-#ifdef XFS
- cdev_xfs_init(NXFS,xfs_dev), /* 51: xfs communication device */
-#else
- cdev_notdef(), /* 51 */
-#endif
- cdev_notdef(), /* 52 */
- cdev_notdef(), /* 53 */
- cdev_notdef(), /* 54: floppy disk */
- cdev_notdef(), /* 55: /dev/cgthree */
- cdev_notdef(), /* 56 */
- cdev_notdef(), /* 57 */
- cdev_disk_init(NCD,cd), /* 58: SCSI CD-ROM */
- cdev_gen_ipf(NIPF,ipl), /* 59: ip filtering log */
- cdev_notdef(), /* 60 */
- cdev_notdef(), /* 61 */
- cdev_notdef(), /* 62 */
- cdev_notdef(), /* 63 */
- cdev_notdef(), /* 64: /dev/cgeight */
- cdev_notdef(), /* 65 */
- cdev_notdef(), /* 66 */
- cdev_notdef(), /* 67: /dev/cgsix */
- cdev_notdef(), /* 68 */
- cdev_notdef(), /* 69: /dev/audio */
- cdev_notdef(), /* 70: /dev/openprom */
- cdev_notdef(), /* 71 */
- cdev_notdef(), /* 72 */
- cdev_notdef(), /* 73 */
- cdev_notdef(), /* 74 */
- cdev_notdef(), /* 75 */
- cdev_notdef(), /* 76 */
- cdev_notdef(), /* 77 */
- cdev_notdef(), /* 78 */
- cdev_notdef(), /* 79 */
- cdev_notdef(), /* 80 */
- cdev_notdef(), /* 81 */
- cdev_notdef(), /* 82 */
- cdev_notdef(), /* 83 */
- cdev_notdef(), /* 84 */
- cdev_notdef(), /* 85 */
- cdev_notdef(), /* 86 */
- cdev_notdef(), /* 87 */
- cdev_notdef(), /* 88 */
- cdev_notdef(), /* 89 */
- cdev_notdef(), /* 90 */
- cdev_notdef(), /* 91 */
- cdev_notdef(), /* 92 */
- cdev_notdef(), /* 93 */
- cdev_notdef(), /* 94 */
- cdev_notdef(), /* 95 */
- cdev_notdef(), /* 96 */
- cdev_notdef(), /* 97 */
- cdev_notdef(), /* 98 */
- cdev_notdef(), /* 99 */
- cdev_notdef(), /* 100 */
- cdev_notdef(), /* 101 */
- cdev_notdef(), /* 102 */
- cdev_notdef(), /* 103 */
- cdev_notdef(), /* 104 */
- cdev_bpftun_init(NBPFILTER,bpf),/* 105: packet filter */
- cdev_disk_init(NRD,rd), /* 106: ram disk driver */
- cdev_notdef(), /* 107 */
- cdev_notdef(), /* 108 */
- cdev_notdef(), /* 109 */
- cdev_disk_init(NVND,vnd), /* 110: vnode disk driver */
- cdev_bpftun_init(NTUN,tun), /* 111: network tunnel */
- cdev_lkm_init(NLKM,lkm), /* 112: loadable module driver */
- cdev_lkm_dummy(), /* 113 */
- cdev_lkm_dummy(), /* 114 */
- cdev_lkm_dummy(), /* 115 */
- cdev_lkm_dummy(), /* 116 */
- cdev_lkm_dummy(), /* 117 */
- cdev_lkm_dummy(), /* 118 */
- cdev_random_init(1,random), /* 119: random generator */
- cdev_uk_init(NUK,uk), /* 120: unknown SCSI */
- cdev_ss_init(NSS,ss), /* 121: SCSI scanner */
-};
-int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
-
-int mem_no = 3; /* major device number of memory special file */
-
-/*
- * Swapdev is a fake device implemented
- * in sw.c used only internally to get to swstrategy.
- * It cannot be provided to the users, because the
- * swstrategy routine munches the b_dev and b_blkno entries
- * before calling the appropriate driver. This would horribly
- * confuse, e.g. the hashing routines. Instead, /dev/drum is
- * provided as a character (raw) device.
- */
-dev_t swapdev = makedev(4, 0);
-
-/*
- * Routine that identifies /dev/mem and /dev/kmem.
- *
- * A minimal stub routine can always return 0.
- */
-int
-iskmemdev(dev)
- dev_t dev;
-{
-
- return (major(dev) == mem_no && minor(dev) < 2);
-}
-
-int
-iszerodev(dev)
- dev_t dev;
-{
- return (major(dev) == mem_no && minor(dev) == 12);
-}
-
-dev_t
-getnulldev()
-{
- return makedev(mem_no, 2);
-}
-
-static int chrtoblktbl[] = {
- /* XXXX This needs to be dynamic for LKMs. */
- /*VCHR*/ /*VBLK*/
- /* 0 */ NODEV,
- /* 1 */ NODEV,
- /* 2 */ NODEV,
- /* 3 */ NODEV,
- /* 4 */ NODEV,
- /* 5 */ NODEV,
- /* 6 */ NODEV,
- /* 7 */ NODEV,
- /* 8 */ NODEV,
- /* 9 */ 3,
- /* 10 */ NODEV,
- /* 11 */ NODEV,
- /* 12 */ NODEV,
- /* 13 */ NODEV,
- /* 14 */ NODEV,
- /* 15 */ NODEV,
- /* 16 */ NODEV,
- /* 17 */ 7,
- /* 18 */ 11,
- /* 19 */ NODEV,
- /* 20 */ NODEV,
- /* 21 */ NODEV,
- /* 22 */ NODEV,
- /* 23 */ 9,
- /* 24 */ NODEV,
- /* 25 */ NODEV,
- /* 26 */ NODEV,
- /* 27 */ NODEV,
- /* 28 */ NODEV,
- /* 29 */ NODEV,
- /* 30 */ NODEV,
- /* 31 */ NODEV,
- /* 32 */ NODEV,
- /* 33 */ NODEV,
- /* 34 */ NODEV,
- /* 35 */ NODEV,
- /* 36 */ NODEV,
- /* 37 */ NODEV,
- /* 38 */ NODEV,
- /* 39 */ NODEV,
- /* 40 */ NODEV,
- /* 41 */ NODEV,
- /* 42 */ 10,
- /* 43 */ NODEV,
- /* 44 */ NODEV,
- /* 45 */ NODEV,
- /* 46 */ NODEV,
- /* 47 */ NODEV,
- /* 48 */ NODEV,
- /* 49 */ NODEV,
- /* 50 */ NODEV,
- /* 51 */ NODEV,
- /* 52 */ NODEV,
- /* 53 */ NODEV,
- /* 54 */ 16,
- /* 55 */ NODEV,
- /* 56 */ NODEV,
- /* 57 */ NODEV,
- /* 58 */ 18,
- /* 59 */ NODEV,
- /* 60 */ NODEV,
- /* 61 */ NODEV,
- /* 62 */ NODEV,
- /* 63 */ NODEV,
- /* 64 */ NODEV,
- /* 65 */ NODEV,
- /* 66 */ NODEV,
- /* 67 */ NODEV,
- /* 68 */ NODEV,
- /* 69 */ NODEV,
- /* 70 */ NODEV,
- /* 71 */ NODEV,
- /* 72 */ NODEV,
- /* 73 */ NODEV,
- /* 74 */ NODEV,
- /* 75 */ NODEV,
- /* 76 */ NODEV,
- /* 77 */ NODEV,
- /* 78 */ NODEV,
- /* 79 */ NODEV,
- /* 80 */ NODEV,
- /* 81 */ NODEV,
- /* 82 */ NODEV,
- /* 83 */ NODEV,
- /* 84 */ NODEV,
- /* 85 */ NODEV,
- /* 86 */ NODEV,
- /* 87 */ NODEV,
- /* 88 */ NODEV,
- /* 89 */ NODEV,
- /* 90 */ NODEV,
- /* 91 */ NODEV,
- /* 92 */ NODEV,
- /* 93 */ NODEV,
- /* 94 */ NODEV,
- /* 95 */ NODEV,
- /* 96 */ NODEV,
- /* 97 */ NODEV,
- /* 98 */ NODEV,
- /* 99 */ NODEV,
- /*100 */ NODEV,
- /*101 */ NODEV,
- /*102 */ NODEV,
- /*103 */ NODEV,
- /*104 */ NODEV,
- /*105 */ NODEV,
- /*106 */ 17,
- /*107 */ NODEV,
- /*108 */ NODEV,
- /*109 */ NODEV,
- /*110 */ 8,
-};
-
-/*
- * Routine to convert from character to block device number.
- */
-int
-chrtoblk(dev)
- dev_t dev;
-{
- int blkmaj;
-
- if (major(dev) >= nchrdev ||
- major(dev) > sizeof(chrtoblktbl)/sizeof(chrtoblktbl[0]))
- return (NODEV);
- blkmaj = chrtoblktbl[major(dev)];
- if (blkmaj == NODEV)
- return (NODEV);
- return (makedev(blkmaj, minor(dev)));
-}
-
-/*
- * Convert a character device number to a block device number.
- */
-dev_t
-blktochr(dev)
- dev_t dev;
-{
- int blkmaj = major(dev);
- int i;
-
- if (blkmaj >= nblkdev)
- return (NODEV);
- for (i = 0; i < sizeof(chrtoblktbl)/sizeof(chrtoblktbl[0]); i++)
- if (blkmaj == chrtoblktbl[i])
- return (makedev(i, minor(dev)));
- return (NODEV);
-}
diff --git a/sys/arch/kbus/kbus/db_disasm.c b/sys/arch/kbus/kbus/db_disasm.c
deleted file mode 100644
index 901597194d3..00000000000
--- a/sys/arch/kbus/kbus/db_disasm.c
+++ /dev/null
@@ -1,1013 +0,0 @@
-/* $NetBSD: db_disasm.c,v 1.9 1996/03/31 23:45:07 pk Exp $ */
-
-/*
- * Copyright (c) 1994 David S. Miller, davem@nadzieja.rutgers.edu
- * Copyright (c) 1995 Paul Kranenburg
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by David Miller.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <machine/db_machdep.h>
-#include <machine/instr.h>
-#include <ddb/db_sym.h>
-#include <ddb/db_interface.h>
-#include <ddb/db_extern.h>
-#include <ddb/db_output.h>
-#include <ddb/db_access.h>
-
-/*
- * All Sparc instructions are 32-bits, with the one exception being
- * the set instruction which is actually a macro which expands into
- * two instructions...
- *
- * There are 5 different fields that can be used to identify which
- * operation is encoded into a particular 32-bit insn. There are 3
- * formats for instuctions, which one being used is determined by
- * bits 30-31 of the insn. Here are the bit fields and their names:
- *
- * 1100 0000 0000 0000 0000 0000 0000 0000 op field, determines format
- * 0000 0001 1100 0000 0000 0000 0000 0000 op2 field, format 2 only
- * 0000 0001 1111 1000 0000 0000 0000 0000 op3 field, format 3 only
- * 0000 0000 0000 0000 0010 0000 0000 0000 f3i bit, format 3 only
- */
-
-#define OP(x) (((x) & 0x3) << 30)
-#define OP2(x) (((x) & 0x7) << 22)
-#define OP3(x) (((x) & 0x3f) << 19)
-#define OPF(x) (((x) & 0x1ff) << 5)
-#define F3I(x) (((x) & 0x1) << 13)
-
-/* various other fields */
-
-#define A(x) (((x) & 0x1) << 29)
-#define P(x) (((x) & 0x1) << 19)
-#define X(x) (((x) & 0x1) << 12)
-#define FCN(x) (((x) & 0x1f) << 25)
-#define RCOND2(x) (((x) & 0x7) << 25)
-#define RCOND34(x) (((x) & 0x7) << 10)
-#define COND(x) (((x) & 0xf) << 25)
-#define SW_TRAP(x) ((x) & 0x7f)
-#define SHCNT32(x) ((x) & 0x1f)
-#define SHCNT64(x) ((x) & 0x3f)
-#define IMM11(x) ((x) & 0x7ff)
-#define IMM22(x) ((x) & 0x3fffff)
-#define DISP19(x) ((x) & 0x7ffff)
-#define DISP22(x) ((x) & 0x3fffff)
-#define DISP30(x) ((x) & 0x3fffffff)
-
-/* Register Operand Fields */
-#define RS1(x) (((x) & 0x1f) << 14)
-#define RS2(x) ((x) & 0x1f)
-#define RD(x) (((x) & 0x1f) << 25)
-
-/* FORMAT macros used in sparc_i table to decode each opcode */
-#define FORMAT1(a) (OP(a))
-#define FORMAT2(a,b) (OP(a) | OP2(b))
-#define FORMAT3(a,b,c) (OP(a) | OP3(b) | F3I(c))
-#define FORMAT3F(a,b,c) (OP(a) | OP3(b) | OPF(c))
-
-/* Helper macros to construct OP3 & OPF */
-#define OP3_X(x,y) ((((x) & 3) << 4) | ((y) & 0xf))
-#define OPF_X(x,y) ((((x) & 0x1f) << 4) | ((y) & 0xf))
-
-/* COND condition codes field... */
-#define COND2(x) (((x) & 0xf) << 14)
-
-struct sparc_insn {
- unsigned long int match;
- char* name;
- char* format;
-};
-
-char* regs[] = {
- "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7",
- "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7",
- "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7",
- "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7"
-};
-
-char* priv_regs[] = {
- "tpc", "tnpc", "tstate", "tt", "tick", "tba", "pstate", "tl",
- "pil", "cwp", "cansave", "canrestore", "cleanwin", "otherwin",
- "wstate", "fq",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", ""
-};
-
-char* state_regs[] = {
- "y", "", "ccr", "asi", "tick", "pc", "fprs", "asr",
- "", "", "", "", "", "", "", "",
- "illegal", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", ""
-};
-
-char* ccodes[] = {
- "fcc0", "fcc1", "fcc2", "fcc3", "icc", "", "xcc", ""
-};
-
-char* prefetch[] = {
- "n_reads", "one_read", "n_writes", "one_write", "page"
-};
-
-
-/* The sparc instruction table has a format field which tells what
- the operand structure for this instruction is. Here are the codes:
-
-Modifiers (nust be first):
- a -- opcode has annul bit
- p -- opcode has branch prediction bit
-
-Codes:
- 1 -- source register operand stored in rs1
- 2 -- source register operand stored in rs2
- d -- destination register operand stored in rd
- 3 -- floating source register in rs1
- 4 -- floating source register in rs2
- e -- floating destination register in rd
- i -- 13-bit immediate value stored in simm13
- j -- 11-bit immediate value stored in simm11
- l -- displacement using d16lo and d16hi
- m -- 22-bit fcc displacement value
- n -- 30-bit displacement used in call insns
- o -- %fcc number specified in cc1 and cc0 fields
- p -- address computed by the contents of rs1+rs2
- q -- address computed by the contents of rs1+simm13
- r -- prefetch
- s -- %asi is implicit in the insn, rs1 value not used
- t -- immediate 8-bit asi value
- u -- 19-bit fcc displacement value
- 5 -- hard register, %fsr lower-half
- 6 -- hard register, %fsr all
- 7 -- [reg_addr rs1+rs2] imm_asi
- 8 -- [reg_addr rs1+simm13] %asi
- 9 -- logical or of the cmask and mmask fields (membar insn)
- 0 -- icc or xcc condition codes register
- r -- prefection function stored in fcn field
- A -- privileged register encoded in rs1
- B -- state register encoded in rs1
- C -- %hi(value) where value is stored in imm22 field
- D -- 32-bit shift count in shcnt32
- E -- 64-bit shift count in shcnt64
- F -- software trap number stored in sw_trap
- G -- privileged register encoded in rd
- H -- state register encoded in rd
-
-V8 only:
- Y -- write y register
- P -- write psr register
- T -- write tbr register
- W -- write wim register
-*/
-
-
-struct sparc_insn sparc_i[] = {
-
- /*
- * Format 1: Call
- */
- {(FORMAT1(1)), "call", "n"},
-
- /*
- * Format 0: Sethi & Branches
- */
- /* Illegal Instruction Trap */
- {(FORMAT2(0, 0)), "illtrap", "m"},
-
- /* Note: if imm22 is zero then this is actually a "nop" grrr... */
- {(FORMAT2(0, 0x4)), "sethi", "Cd"},
-
- /* Branch on Integer Condition Codes "Bicc" */
- {(FORMAT2(0, 2) | COND(8)), "ba", "a,m"},
- {(FORMAT2(0, 2) | COND(0)), "bn", "a,m"},
- {(FORMAT2(0, 2) | COND(9)), "bne", "a,m"},
- {(FORMAT2(0, 2) | COND(1)), "be", "a,m"},
- {(FORMAT2(0, 2) | COND(10)), "bg", "a,m"},
- {(FORMAT2(0, 2) | COND(2)), "ble", "a,m"},
- {(FORMAT2(0, 2) | COND(11)), "bge", "a,m"},
- {(FORMAT2(0, 2) | COND(3)), "bl", "a,m"},
- {(FORMAT2(0, 2) | COND(12)), "bgu", "a,m"},
- {(FORMAT2(0, 2) | COND(4)), "bleu", "a,m"},
- {(FORMAT2(0, 2) | COND(13)), "bcc", "a,m"},
- {(FORMAT2(0, 2) | COND(5)), "bcs", "a,m"},
- {(FORMAT2(0, 2) | COND(14)), "bpos", "a,m"},
- {(FORMAT2(0, 2) | COND(6)), "bneg", "a,m"},
- {(FORMAT2(0, 2) | COND(15)), "bvc", "a,m"},
- {(FORMAT2(0, 2) | COND(7)), "bvs", "a,m"},
-
- /* Branch on Integer Condition Codes with Prediction "BPcc" */
- {(FORMAT2(0, 1) | COND(8)), "ba", "ap,u"},
- {(FORMAT2(0, 1) | COND(0)), "bn", "ap,u"},
- {(FORMAT2(0, 1) | COND(9)), "bne", "ap,u"},
- {(FORMAT2(0, 1) | COND(1)), "be", "ap,u"},
- {(FORMAT2(0, 1) | COND(10)), "bg", "ap,u"},
- {(FORMAT2(0, 1) | COND(2)), "ble", "ap,u"},
- {(FORMAT2(0, 1) | COND(11)), "bge", "ap,u"},
- {(FORMAT2(0, 1) | COND(3)), "bl", "ap,u"},
- {(FORMAT2(0, 1) | COND(12)), "bgu", "ap,u"},
- {(FORMAT2(0, 1) | COND(4)), "bleu", "ap,u"},
- {(FORMAT2(0, 1) | COND(13)), "bcc", "ap,u"},
- {(FORMAT2(0, 1) | COND(5)), "bcs", "ap,u"},
- {(FORMAT2(0, 1) | COND(14)), "bpos", "ap,u"},
- {(FORMAT2(0, 1) | COND(6)), "bneg", "ap,u"},
- {(FORMAT2(0, 1) | COND(15)), "bvc", "ap,u"},
- {(FORMAT2(0, 1) | COND(7)), "bvs", "ap,u"},
-
- /* Branch on Integer Register with Prediction "BPr" */
- {(FORMAT2(0, 3) | RCOND2(1)), "brz", "ap,1l"},
- {(FORMAT2(0, 3) | A(1) | P(1) | RCOND2(2)), "brlex", "ap,1l"},
- {(FORMAT2(0, 3) | RCOND2(3)), "brlz", "ap,1l"},
- {(FORMAT2(0, 3) | RCOND2(5)), "brnz", "ap,1l"},
- {(FORMAT2(0, 3) | RCOND2(6)), "brgz", "ap,1l"},
- {(FORMAT2(0, 3) | RCOND2(7)), "brgez", "ap,1l"},
-
- /* Branch on Floating-Point Condition Codes with Prediction "FBPfcc" */
- {(FORMAT2(0, 5) | COND(8)), "fba", "ap,m"},
- {(FORMAT2(0, 5) | COND(0)), "fbn", "ap,m"},
- {(FORMAT2(0, 5) | COND(7)), "fbu", "ap,m"},
- {(FORMAT2(0, 5) | COND(6)), "fbg", "ap,m"},
- {(FORMAT2(0, 5) | COND(5)), "fbug", "ap,m"},
- {(FORMAT2(0, 5) | COND(4)), "fbl", "ap,m"},
- {(FORMAT2(0, 5) | COND(3)), "fbul", "ap,m"},
- {(FORMAT2(0, 5) | COND(2)), "fblg", "ap,m"},
- {(FORMAT2(0, 5) | COND(1)), "fbne", "ap,m"},
- {(FORMAT2(0, 5) | COND(9)), "fbe", "ap,m"},
- {(FORMAT2(0, 5) | COND(10)), "fbue", "ap,m"},
- {(FORMAT2(0, 5) | COND(11)), "fbge", "ap,m"},
- {(FORMAT2(0, 5) | COND(12)), "fbuge", "ap,m"},
- {(FORMAT2(0, 5) | COND(13)), "fble", "ap,m"},
- {(FORMAT2(0, 5) | COND(14)), "fbule", "ap,m"},
- {(FORMAT2(0, 5) | COND(15)), "fbo", "ap,m"},
-
- /* Branch on Floating-Point Condition Codes "FBfcc" */
- {(FORMAT2(0, 6) | COND(8)), "fba", "a,m"},
- {(FORMAT2(0, 6) | COND(0)), "fbn", "a,m"},
- {(FORMAT2(0, 6) | COND(7)), "fbu", "a,m"},
- {(FORMAT2(0, 6) | COND(6)), "fbg", "a,m"},
- {(FORMAT2(0, 6) | COND(5)), "fbug", "a,m"},
- {(FORMAT2(0, 6) | COND(4)), "fbl", "a,m"},
- {(FORMAT2(0, 6) | COND(3)), "fbul", "a,m"},
- {(FORMAT2(0, 6) | COND(2)), "fblg", "a,m"},
- {(FORMAT2(0, 6) | COND(1)), "fbne", "a,m"},
- {(FORMAT2(0, 6) | COND(9)), "fbe", "a,m"},
- {(FORMAT2(0, 6) | COND(10)), "fbue", "a,m"},
- {(FORMAT2(0, 6) | COND(11)), "fbge", "a,m"},
- {(FORMAT2(0, 6) | COND(12)), "fbuge", "a,m"},
- {(FORMAT2(0, 6) | COND(13)), "fble", "a,m"},
- {(FORMAT2(0, 6) | COND(14)), "fbule", "a,m"},
- {(FORMAT2(0, 6) | COND(15)), "fbo", "a,m"},
-
-
-
- /*
- * Format 3/2: Arithmetic & misc (table 32, appendix E)
- */
- {FORMAT3(2, OP3_X(0,0), 0), "add", "12d"},
- {FORMAT3(2, OP3_X(0,0), 1), "add", "1id"},
- {FORMAT3(2, OP3_X(1,0), 0), "addcc", "12d"},
- {FORMAT3(2, OP3_X(1,0), 1), "addcc", "1id"},
- {FORMAT3(2, OP3_X(2,0), 0), "taddcc", "12d"},
- {FORMAT3(2, OP3_X(2,0), 1), "taddcc", "1id"},
-#ifdef V9
- {(FORMAT3(2, 0x30, 1) | RD(0xf)), "sir", "i"},
- {FORMAT3(2, OP3_X(3,0), 0), "wr", "12H"},
- {FORMAT3(2, OP3_X(3,0), 1), "wr", "1iH"},
-#else
- {FORMAT3(2, OP3_X(3,0), 0), "wr", "12Y"}, /* wr 1, 2, %y */
- {FORMAT3(2, OP3_X(3,0), 1), "wr", "1iY"}, /* wr 1, i, %y */
-#endif
-
- {FORMAT3(2, OP3_X(0,1), 0), "and", "12d"},
- {FORMAT3(2, OP3_X(0,1), 1), "and", "1id"},
- {FORMAT3(2, OP3_X(1,1), 0), "andcc", "12d"},
- {FORMAT3(2, OP3_X(1,1), 1), "andcc", "1id"},
- {FORMAT3(2, OP3_X(2,1), 0), "tsubcc", "12d"},
- {FORMAT3(2, OP3_X(2,1), 1), "tsubcc", "1id"},
-#ifdef V9
- {FORMAT3(2, OP3_X(3,1), 0), "saved", ""},
- {FORMAT3(2, OP3_X(3,1), 0)|FCN(1), "restored", ""},
-#else
- {FORMAT3(2, OP3_X(3,1), 0), "wr", "12P"}, /* wr 1, 2, %psr */
- {FORMAT3(2, OP3_X(3,1), 1), "wr", "1iP"}, /* wr 1, i, %psr */
-#endif
-
- {FORMAT3(2, OP3_X(0,2), 0), "or", "12d"},
- {FORMAT3(2, OP3_X(0,2), 1), "or", "1id"},
- {FORMAT3(2, OP3_X(1,2), 0), "orcc", "12d"},
- {FORMAT3(2, OP3_X(1,2), 1), "orcc", "1id"},
- {FORMAT3(2, OP3_X(2,2), 0), "taddcctv", "12d"},
- {FORMAT3(2, OP3_X(2,2), 1), "taddcctv", "1id"},
-#ifdef V9
- {FORMAT3(2, OP3_X(3,2), 0), "wrpr", "12G"},
- {FORMAT3(2, OP3_X(3,2), 1), "wrpr", "1iG"},
-#else
- {FORMAT3(2, OP3_X(3,2), 0), "wr", "12W"}, /* wr 1, 2, %wim */
- {FORMAT3(2, OP3_X(3,2), 1), "wr", "1iW"}, /* wr 1, i, %wim */
-#endif
-
- {FORMAT3(2, OP3_X(0,3), 0), "xor", "12d"},
- {FORMAT3(2, OP3_X(0,3), 1), "xor", "1id"},
- {FORMAT3(2, OP3_X(1,3), 0), "xorcc", "12d"},
- {FORMAT3(2, OP3_X(1,3), 1), "xorcc", "1id"},
- {FORMAT3(2, OP3_X(2,3), 0), "tsubcctv", "12d"},
- {FORMAT3(2, OP3_X(2,3), 1), "tsubcctv", "1id"},
-#ifdef V9
- {FORMAT3(2, OP3_X(3,3), 0), "UNDEFINED", ""},
-#else
- {FORMAT3(2, OP3_X(3,3), 0), "wr", "12T"}, /* wr 1, 2, %tbr */
- {FORMAT3(2, OP3_X(3,3), 1), "wr", "1iT"}, /* wr 1, i, %tbr */
-#endif
-
- {FORMAT3(2, OP3_X(0,4), 0), "sub", "12d"},
- {FORMAT3(2, OP3_X(0,4), 1), "sub", "1id"},
- {FORMAT3(2, OP3_X(1,4), 0), "subcc", "12d"},
- {FORMAT3(2, OP3_X(1,4), 1), "subcc", "1id"},
- {FORMAT3(2, OP3_X(2,4), 0), "mulscc", "12d"},
- {FORMAT3(2, OP3_X(2,4), 1), "mulscc", "1id"},
- {FORMAT3(2, OP3_X(3,4), 1), "FPop1", ""}, /* see below */
-
- {FORMAT3(2, OP3_X(0,5), 0), "andn", "12d"},
- {FORMAT3(2, OP3_X(0,5), 1), "andn", "1id"},
- {FORMAT3(2, OP3_X(1,5), 0), "andncc", "12d"},
- {FORMAT3(2, OP3_X(1,5), 1), "andncc", "1id"},
- {FORMAT3(2, OP3_X(2,5), 0), "sll", "12d"},
- {FORMAT3(2, OP3_X(2,5), 1), "sll", "1Dd"},
- {FORMAT3(2, OP3_X(2,5)|X(1), 0), "sllx", "12d"},
- {FORMAT3(2, OP3_X(2,5)|X(1), 1), "sllx", "1Ed"},
- {FORMAT3(2, OP3_X(3,5), 1), "FPop2", ""}, /* see below */
-
- {FORMAT3(2, OP3_X(0,6), 0), "orn", "12d"},
- {FORMAT3(2, OP3_X(0,6), 1), "orn", "1id"},
- {FORMAT3(2, OP3_X(1,6), 0), "orncc", "12d"},
- {FORMAT3(2, OP3_X(1,6), 1), "orncc", "1id"},
- {FORMAT3(2, OP3_X(2,6), 0), "srl", "12d"},
- {FORMAT3(2, OP3_X(2,6), 1), "srl", "1Dd"},
- {FORMAT3(2, OP3_X(2,6)|X(1), 0), "srlx", "12d"},
- {FORMAT3(2, OP3_X(2,6)|X(1), 1), "srlx", "1Ed"},
- {FORMAT3(2, OP3_X(3,6), 1), "impdep1", ""},
-
- {FORMAT3(2, OP3_X(0,7), 0), "xorn", "12d"},
- {FORMAT3(2, OP3_X(0,7), 1), "xorn", "1id"},
- {FORMAT3(2, OP3_X(1,7), 0), "xorncc", "12d"},
- {FORMAT3(2, OP3_X(1,7), 1), "xorncc", "1id"},
- {FORMAT3(2, OP3_X(2,7), 0), "sra", "12d"},
- {FORMAT3(2, OP3_X(2,7), 1), "sra", "1Dd"},
- {FORMAT3(2, OP3_X(2,7)|X(1), 0), "srax", "12d"},
- {FORMAT3(2, OP3_X(2,7)|X(1), 1), "srax", "1Ed"},
- {FORMAT3(2, OP3_X(3,7), 1), "impdep2", ""},
-
- {FORMAT3(2, OP3_X(0,8), 0), "addc", "12d"},
- {FORMAT3(2, OP3_X(0,8), 1), "addc", "1id"},
- {FORMAT3(2, OP3_X(1,8), 0), "addccc", "12d"},
- {FORMAT3(2, OP3_X(1,8), 1), "addccc", "1id"},
-#ifdef V9
- {(FORMAT3(2, 0x28, 1) | RS1(15)), "membar", "9"},
- {(FORMAT3(2, 0x28, 0) | RS1(15)), "stbar", ""},
- {FORMAT3(2, OP3_X(2,8), 0), "rd", "Bd"},
-#else
- {FORMAT3(2, OP3_X(2,8), 0), "rd", "Yd"},
-#endif
-
- {FORMAT3(2, OP3_X(3,8), 0), "jmpl", "pd"},
- {FORMAT3(2, OP3_X(3,8), 1), "jmpl", "qd"},
-
- {FORMAT3(2, OP3_X(0,9), 0), "mulx", "12d"},
- {FORMAT3(2, OP3_X(0,9), 1), "mulx", "1id"},
- {FORMAT3(2, OP3_X(1,9), 0), "UNDEFINED", ""},
-#ifdef V9
- {FORMAT3(2, OP3_X(2,9), 0), "UNDEFINED", ""},
-#else
- {FORMAT3(2, OP3_X(2,9), 0), "rd", "Pd"},
-#endif
- {FORMAT3(2, OP3_X(3,9), 0), "return", "p"},
- {FORMAT3(2, OP3_X(3,9), 1), "return", "q"},
-
- {FORMAT3(2, OP3_X(0,10), 0), "umul", "12d"},
- {FORMAT3(2, OP3_X(0,10), 1), "umul", "1id"},
- {FORMAT3(2, OP3_X(1,10), 0), "umulcc", "12d"},
- {FORMAT3(2, OP3_X(1,10), 1), "umulcc", "1id"},
-#ifdef V9
- {FORMAT3(2, OP3_X(2,10), 0), "rdpr", "Ad"},
-#else
- {FORMAT3(2, OP3_X(2,10), 0), "rd", "Wd"},
-#endif
- /*
- * OP3 = (3,10): TCC: Trap on Integer Condition Codes
- */
- {(FORMAT3(2, OP3_X(3,10), 0) | COND(0x8)), "ta", "12F"},
- {(FORMAT3(2, OP3_X(3,10), 1) | COND(0x8)), "ta", "0F"},
- {(FORMAT3(2, OP3_X(3,10), 0) | COND(0x0)), "tn", "12F"},
- {(FORMAT3(2, OP3_X(3,10), 1) | COND(0x0)), "tn", "0F"},
- {(FORMAT3(2, OP3_X(3,10), 0) | COND(0x9)), "tne", "12F"},
- {(FORMAT3(2, OP3_X(3,10), 1) | COND(0x9)), "tne", "0F"},
- {(FORMAT3(2, OP3_X(3,10), 0) | COND(0x1)), "te", "12F"},
- {(FORMAT3(2, OP3_X(3,10), 1) | COND(0x1)), "te", "0F"},
- {(FORMAT3(2, OP3_X(3,10), 0) | COND(0xa)), "tg", "12F"},
- {(FORMAT3(2, OP3_X(3,10), 1) | COND(0xa)), "tg", "0F"},
- {(FORMAT3(2, OP3_X(3,10), 0) | COND(0x2)), "tle", "12F"},
- {(FORMAT3(2, OP3_X(3,10), 1) | COND(0x2)), "tle", "0F"},
- {(FORMAT3(2, OP3_X(3,10), 0) | COND(0xb)), "tge", "12F"},
- {(FORMAT3(2, OP3_X(3,10), 1) | COND(0xb)), "tge", "0F"},
- {(FORMAT3(2, OP3_X(3,10), 0) | COND(0x3)), "tl", "12F"},
- {(FORMAT3(2, OP3_X(3,10), 1) | COND(0x3)), "tl", "0F"},
- {(FORMAT3(2, OP3_X(3,10), 0) | COND(0xc)), "tgu", "12F"},
- {(FORMAT3(2, OP3_X(3,10), 1) | COND(0xc)), "tgu", "0F"},
- {(FORMAT3(2, OP3_X(3,10), 0) | COND(0x4)), "tleu", "12F"},
- {(FORMAT3(2, OP3_X(3,10), 1) | COND(0x4)), "tleu", "0F"},
- {(FORMAT3(2, OP3_X(3,10), 0) | COND(0xd)), "tcc", "12F"},
- {(FORMAT3(2, OP3_X(3,10), 1) | COND(0xd)), "tcc", "0F"},
- {(FORMAT3(2, OP3_X(3,10), 0) | COND(0x5)), "tcs", "12F"},
- {(FORMAT3(2, OP3_X(3,10), 1) | COND(0x5)), "tcs", "0F"},
- {(FORMAT3(2, OP3_X(3,10), 0) | COND(0xe)), "tpos", "12F"},
- {(FORMAT3(2, OP3_X(3,10), 1) | COND(0xe)), "tpos", "0F"},
- {(FORMAT3(2, OP3_X(3,10), 0) | COND(0x6)), "tneg", "12F"},
- {(FORMAT3(2, OP3_X(3,10), 1) | COND(0x6)), "tneg", "0F"},
- {(FORMAT3(2, OP3_X(3,10), 0) | COND(0xf)), "tvc", "12F"},
- {(FORMAT3(2, OP3_X(3,10), 1) | COND(0xf)), "tvc", "0F"},
- {(FORMAT3(2, OP3_X(3,10), 0) | COND(0x7)), "tvs", "12F"},
- {(FORMAT3(2, OP3_X(3,10), 1) | COND(0x7)), "tvs", "0F"},
-
- {FORMAT3(2, OP3_X(0,11), 0), "smul", "12d"},
- {FORMAT3(2, OP3_X(0,11), 1), "smul", "1id"},
- {FORMAT3(2, OP3_X(1,11), 0), "smulcc", "12d"},
- {FORMAT3(2, OP3_X(1,11), 1), "smulcc", "1id"},
-#ifdef V9
- {FORMAT3(2, OP3_X(2,11), 0), "flushw", ""},
-#else
- {FORMAT3(2, OP3_X(2,11), 0), "rd", "Td"},
-#endif
- {FORMAT3(2, OP3_X(3,11), 0), "flush", "p"},
- {FORMAT3(2, OP3_X(3,11), 1), "flush", "q"},
-
- {FORMAT3(2, OP3_X(0,12), 0), "subc", "12d"},
- {FORMAT3(2, OP3_X(0,12), 1), "subc", "1id"},
- {FORMAT3(2, OP3_X(1,12), 0), "subccc", "12d"},
- {FORMAT3(2, OP3_X(1,12), 1), "subccc", "1id"},
- /*
- * OP3 = (2,12): MOVcc, Move Integer Register on Condition
- */
- /* For Integer Condition Codes */
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(8)), "mova", "0jd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(0)), "movn", "0jd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(9)), "movne", "0jd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(1)), "move", "0jd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(10)), "movg", "0jd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(2)), "movle", "0jd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(11)), "movge", "0jd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(3)), "movl", "0jd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(12)), "movgu", "0jd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(4)), "movleu", "0jd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(13)), "movcc", "0jd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(5)), "movcs", "0jd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(14)), "movpos", "0jd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(6)), "movneg", "0jd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(15)), "movvc", "0jd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(7)), "movvs", "0jd"},
-
- /* For Floating-Point Condition Codes */
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(8)), "mova", "ojd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(0)), "movn", "ojd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(7)), "movu", "ojd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(6)), "movg", "ojd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(5)), "movug", "ojd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(4)), "movl", "ojd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(3)), "movul", "ojd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(2)), "movlg", "ojd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(1)), "movne", "ojd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(9)), "move", "ojd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(10)), "movue", "ojd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(11)), "movge", "ojd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(12)), "movuge", "ojd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(13)), "movle", "ojd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(14)), "movule", "ojd"},
- {(FORMAT3(2, OP3_X(2,12), 1) | COND(15)), "movo", "ojd"},
-
- {FORMAT3(2, OP3_X(3,12), 0), "save", "12d"},
- {FORMAT3(2, OP3_X(3,12), 1), "save", "1id"},
-
- {FORMAT3(2, OP3_X(0,13), 0), "udivx", "12d"},
- {FORMAT3(2, OP3_X(0,13), 1), "udivx", "1id"},
- {FORMAT3(2, OP3_X(1,13), 0), "UNDEFINED", ""},
- {FORMAT3(2, OP3_X(2,13), 0), "sdivx", "12d"},
- {FORMAT3(2, OP3_X(2,13), 1), "sdivx", "1id"},
- {FORMAT3(2, OP3_X(3,13), 0), "restore", "12d"},
- {FORMAT3(2, OP3_X(3,13), 1), "restore", "1id"},
-
- {FORMAT3(2, OP3_X(0,14), 0), "udiv", "12d"},
- {FORMAT3(2, OP3_X(0,14), 1), "udiv", "1id"},
- {FORMAT3(2, OP3_X(1,14), 0), "udivcc", "12d"},
- {FORMAT3(2, OP3_X(1,14), 1), "udivcc", "1id"},
- {FORMAT3(2, OP3_X(2,14), 0), "popc", "2d"},
- {FORMAT3(2, OP3_X(2,14), 1), "popc", "id"},
-
- {FORMAT3(2, OP3_X(3,14), 0), "done", ""},
- {FORMAT3(2, OP3_X(3,14)|FCN(1), 1), "retry", ""},
-
- {FORMAT3(2, OP3_X(0,15), 0), "sdiv", "12d"},
- {FORMAT3(2, OP3_X(0,15), 1), "sdiv", "1id"},
- {FORMAT3(2, OP3_X(1,15), 0), "sdivcc", "12d"},
- {FORMAT3(2, OP3_X(1,15), 1), "sdivcc", "1id"},
- /*
- * OP3 = (2,15): MOVr:
- * Move Integer Register on Register Condition
- */
- {(FORMAT3(2, OP3_X(2,15), 1) | RCOND34(1)), "movrz", "1jd"},
- {(FORMAT3(2, OP3_X(2,15), 0) | RCOND34(1)), "movrz", "12d"},
- {(FORMAT3(2, OP3_X(2,15), 1) | RCOND34(2)), "movrlez", "1jd"},
- {(FORMAT3(2, OP3_X(2,15), 0) | RCOND34(2)), "movrlez", "12d"},
- {(FORMAT3(2, OP3_X(2,15), 1) | RCOND34(3)), "movrlz", "1jd"},
- {(FORMAT3(2, OP3_X(2,15), 0) | RCOND34(3)), "movrlz", "12d"},
- {(FORMAT3(2, OP3_X(2,15), 1) | RCOND34(5)), "movrnz", "1jd"},
- {(FORMAT3(2, OP3_X(2,15), 0) | RCOND34(5)), "movrnz", "12d"},
- {(FORMAT3(2, OP3_X(2,15), 1) | RCOND34(6)), "movrgz", "1jd"},
- {(FORMAT3(2, OP3_X(2,15), 0) | RCOND34(6)), "movrgz", "12d"},
- {(FORMAT3(2, OP3_X(2,15), 1) | RCOND34(7)), "movrgez", "1jd"},
- {(FORMAT3(2, OP3_X(2,15), 0) | RCOND34(7)), "movrgez", "12d"},
-
- {FORMAT3(2, OP3_X(3,15), 0), "UNDEFINED", ""},
-
-
- /*
- * Format 3/3: Load and store (appendix E, table 33)
- */
-
- /* Loads */
- {(FORMAT3(3, OP3_X(0,0), 0)), "ld", "pd"}, /* officially: lduw */
- {(FORMAT3(3, OP3_X(0,0), 1)), "ld", "qd"},
- {(FORMAT3(3, OP3_X(1,0), 0)), "lda", "7d"}, /* officially: lduwa */
- {(FORMAT3(3, OP3_X(1,0), 1)), "lda", "8d"},
- {(FORMAT3(3, OP3_X(2,0), 0)), "ldf", "pe"},
- {(FORMAT3(3, OP3_X(2,0), 1)), "ldf", "qe"},
- {(FORMAT3(3, OP3_X(3,0), 0)), "ldfa", "7e"},
- {(FORMAT3(3, OP3_X(3,0), 1)), "ldfa", "8e"},
-
- {(FORMAT3(3, OP3_X(0,1), 0)), "ldub", "pd"},
- {(FORMAT3(3, OP3_X(0,1), 1)), "ldub", "qd"},
- {(FORMAT3(3, OP3_X(1,1), 0)), "lduba", "7d"},
- {(FORMAT3(3, OP3_X(1,1), 1)), "lduba", "8d"},
- {(FORMAT3(3, OP3_X(2,1), 0) | RD(0)), "ld", "p5"},
- {(FORMAT3(3, OP3_X(2,1), 1) | RD(0)), "ld", "q5"},
- {(FORMAT3(3, OP3_X(2,1), 0) | RD(1)), "ldx", "p6"},
- {(FORMAT3(3, OP3_X(2,1), 1) | RD(1)), "ldx", "q6"},
-
- {(FORMAT3(3, OP3_X(0,2), 0)), "lduh", "pd"},
- {(FORMAT3(3, OP3_X(0,2), 1)), "lduh", "qd"},
- {(FORMAT3(3, OP3_X(1,2), 0)), "lduha", "7d"},
- {(FORMAT3(3, OP3_X(1,2), 1)), "lduha", "8d"},
- {(FORMAT3(3, OP3_X(2,2), 0)), "ldq", "pe"},
- {(FORMAT3(3, OP3_X(2,2), 1)), "ldq", "qe"},
- {(FORMAT3(3, OP3_X(3,2), 0)), "ldqa", "7e"},
- {(FORMAT3(3, OP3_X(3,2), 1)), "ldqa", "8e"},
-
- {(FORMAT3(3, OP3_X(0,3), 0)), "ldd", "pd"},
- {(FORMAT3(3, OP3_X(0,3), 1)), "ldd", "qd"},
- {(FORMAT3(3, OP3_X(1,3), 0)), "ldda", "7d"},
- {(FORMAT3(3, OP3_X(1,3), 1)), "ldda", "8d"},
- {(FORMAT3(3, OP3_X(2,3), 0)), "ldd", "pe"},
- {(FORMAT3(3, OP3_X(2,3), 1)), "ldd", "qe"},
- {(FORMAT3(3, OP3_X(3,3), 0)), "ldda", "7e"},
- {(FORMAT3(3, OP3_X(3,3), 1)), "ldda", "8e"},
-
- {(FORMAT3(3, OP3_X(0,4), 0)), "st", "dp"}, /* officially: stw */
- {(FORMAT3(3, OP3_X(0,4), 1)), "st", "dq"},
- {(FORMAT3(3, OP3_X(1,4), 0)), "sta", "d7"}, /* officially: stwa */
- {(FORMAT3(3, OP3_X(1,4), 1)), "sta", "d8"},
- {(FORMAT3(3, OP3_X(2,4), 0)), "st", "ep"},
- {(FORMAT3(3, OP3_X(2,4), 1)), "st", "eq"},
- {(FORMAT3(3, OP3_X(3,4), 0)), "sta", "e7"},
- {(FORMAT3(3, OP3_X(3,4), 1)), "sta", "e8"},
-
- {(FORMAT3(3, OP3_X(0,5), 0)), "stb", "dp"},
- {(FORMAT3(3, OP3_X(0,5), 1)), "stb", "dq"},
- {(FORMAT3(3, OP3_X(1,5), 0)), "stba", "d7"},
- {(FORMAT3(3, OP3_X(1,5), 1)), "stba", "d8"},
- {(FORMAT3(3, OP3_X(2,5), 0)), "st", "5p"},
- {(FORMAT3(3, OP3_X(2,5), 1)), "st", "5q"},
- {(FORMAT3(3, OP3_X(2,5), 0)|RD(1)), "stx", "6p"},
- {(FORMAT3(3, OP3_X(2,5), 1)|RD(1)), "stx", "6q"},
-
- {(FORMAT3(3, OP3_X(0,6), 0)), "sth", "dp"},
- {(FORMAT3(3, OP3_X(0,6), 1)), "sth", "dq"},
- {(FORMAT3(3, OP3_X(1,6), 0)), "stha", "d7"},
- {(FORMAT3(3, OP3_X(1,6), 1)), "stha", "d8"},
- {(FORMAT3(3, OP3_X(2,6), 0)), "stq", "ep"},
- {(FORMAT3(3, OP3_X(2,6), 1)), "stq", "eq"},
- {(FORMAT3(3, OP3_X(3,6), 0)), "stqa", "e7"},
- {(FORMAT3(3, OP3_X(3,6), 1)), "stqa", "e8"},
-
- {(FORMAT3(3, OP3_X(0,7), 0)), "std", "dp"},
- {(FORMAT3(3, OP3_X(0,7), 1)), "std", "dq"},
- {(FORMAT3(3, OP3_X(1,7), 0)), "stda", "d7"},
- {(FORMAT3(3, OP3_X(1,7), 1)), "stda", "d8"},
- {(FORMAT3(3, OP3_X(2,7), 0)), "std", "ep"},
- {(FORMAT3(3, OP3_X(2,7), 1)), "std", "eq"},
- {(FORMAT3(3, OP3_X(3,7), 0)), "stda", "e7"},
- {(FORMAT3(3, OP3_X(3,7), 1)), "stda", "e8"},
-
- {(FORMAT3(3, OP3_X(0,8), 0)), "ldsw", "pd"},
- {(FORMAT3(3, OP3_X(0,8), 1)), "ldsw", "qd"},
- {(FORMAT3(3, OP3_X(1,8), 0)), "ldswa", "7d"},
- {(FORMAT3(3, OP3_X(1,8), 1)), "ldswa", "8d"},
-
- {(FORMAT3(3, OP3_X(0,9), 0)), "ldsb", "pd"},
- {(FORMAT3(3, OP3_X(0,9), 1)), "ldsb", "qd"},
- {(FORMAT3(3, OP3_X(1,9), 0)), "ldsba", "7d"},
- {(FORMAT3(3, OP3_X(1,9), 1)), "ldsba", "8d"},
-
- {(FORMAT3(3, OP3_X(0,10), 0)), "ldsh", "pd"},
- {(FORMAT3(3, OP3_X(0,10), 1)), "ldsh", "qd"},
- {(FORMAT3(3, OP3_X(1,10), 0)), "ldsha", "7d"},
- {(FORMAT3(3, OP3_X(1,10), 1)), "ldsha", "8d"},
-
- {(FORMAT3(3, OP3_X(0,11), 0)), "ldx", "pd"},
- {(FORMAT3(3, OP3_X(0,11), 1)), "ldx", "qd"},
- {(FORMAT3(3, OP3_X(1,11), 0)), "ldxa", "7d"},
- {(FORMAT3(3, OP3_X(1,11), 1)), "ldxa", "8d"},
-
- {(FORMAT3(3, OP3_X(3,12), 1)), "casa", "s2d"},
- {(FORMAT3(3, OP3_X(3,12), 0)), "casa", "t2d"},
-
- {(FORMAT3(3, OP3_X(0,13), 0)), "ldstub", "7d"},
- {(FORMAT3(3, OP3_X(0,13), 1)), "ldstub", "8d"},
- {(FORMAT3(3, OP3_X(1,13), 0)), "ldstuba", "pd"},
- {(FORMAT3(3, OP3_X(1,13), 1)), "ldstuba", "qd"},
- {(FORMAT3(3, OP3_X(2,13), 0)), "prefetch", "pr"},
- {(FORMAT3(3, OP3_X(2,13), 1)), "prefetch", "qr"},
- {(FORMAT3(3, OP3_X(3,13), 0)), "prefetcha", "7r"},
- {(FORMAT3(3, OP3_X(3,13), 1)), "prefetcha", "8r"},
-
- {(FORMAT3(3, OP3_X(0,14), 0)), "stx", "dp"},
- {(FORMAT3(3, OP3_X(0,14), 1)), "stx", "dq"},
- {(FORMAT3(3, OP3_X(1,14), 0)), "stwa", "d7"},
- {(FORMAT3(3, OP3_X(1,14), 1)), "stwa", "d8"},
- {(FORMAT3(3, OP3_X(3,14), 0)), "casxa", "t2d"},
- {(FORMAT3(3, OP3_X(3,14), 1)), "casxa", "s2d"},
-
- /* Swap Register */
- {(FORMAT3(3, OP3_X(0,15), 0)), "swap", "pd"},
- {(FORMAT3(3, OP3_X(0,15), 1)), "swap", "qd"},
- {(FORMAT3(3, OP3_X(1,15), 0)), "swapa", "7d"},
- {(FORMAT3(3, OP3_X(1,15), 1)), "swapa", "8d"},
-
-
- /*
- * OP3 = (3,4): FPop1 (table 34)
- */
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(0,1))), "fmovs", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(0,2))), "fmovd", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(0,3))), "fmovq", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(0,5))), "fnegs", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(0,6))), "fnegd", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(0,7))), "fnegq", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(0,9))), "fabss", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(0,10))), "fabsd", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(0,11))), "fabsq", "4e"},
-
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(2,9))), "fsqrts", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(2,10))), "fsqrtd", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(2,11))), "fsqrtq", "4e"},
-
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(4,1))), "fadds", "34e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(4,2))), "faddd", "34e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(4,3))), "faddq", "34e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(4,5))), "fsubs", "34e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(4,6))), "fsubd", "34e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(4,7))), "fsubq", "34e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(4,9))), "fmuls", "34e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(4,10))), "fmuld", "34e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(4,11))), "fmulq", "34e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(4,13))), "fdivs", "34e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(4,14))), "fdivd", "34e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(4,15))), "fdivq", "34e"},
-
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(6,9))), "fsmuld", "34e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(6,14))), "fdmulq", "34e"},
-
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(8,1))), "fstox", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(8,2))), "fdtox", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(8,3))), "fqtox", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(8,4))), "fxtos", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(8,8))), "fxtod", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(8,12))), "fxtoq", "4e"},
-
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(12,4))), "fitos", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(12,6))), "fdtos", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(12,7))), "fqtos", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(12,8))), "fitod", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(12,9))), "fstod", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(12,11))), "fqtod", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(12,12))), "fitoq", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(12,13))), "fstoq", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(12,14))), "fdtoq", "4e"},
-
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(13,1))), "fstoi", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(13,2))), "fdtoi", "4e"},
- {(FORMAT3F(2, OP3_X(3,4), OPF_X(13,3))), "fqtoi", "4e"},
-
-
-#ifdef xxx
- /*
- * OP3 =(3,5): FPop2 (table 35)
- */
- {(FORMAT3F(2, OP3_X(3,5), 81)), "fcmps", "o34"},
- {(FORMAT3F(2, OP3_X(3,5), 82)), "fcmpd", "o34"},
- {(FORMAT3F(2, OP3_X(3,5), 83)), "fcmpq", "o34"},
- {(FORMAT3F(2, OP3_X(3,5), 85)), "fcmpes", "o34"},
- {(FORMAT3F(2, OP3_X(3,5), 86)), "fcmped", "o34"},
- {(FORMAT3F(2, OP3_X(3,5), 87)), "fcmpeq", "o34"},
-
- /* Move Floating-Point Register on Condition "FMOVcc" */
- /* FIXME should check for single, double, and quad movements */
- /* Integer Condition Codes */
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(8)), "fmova", "04e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(0)), "fmovn", "04e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(9)), "fmovne", "04e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(1)), "fmove", "04e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(10)), "fmovg", "04e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(2)), "fmovle", "04e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(11)), "fmovge", "04e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(3)), "fmovl", "04e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(12)), "fmovgu", "04e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(4)), "fmovleu", "04e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(13)), "fmovcc", "04e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(5)), "fmovcs", "04e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(14)), "fmovpos", "04e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(6)), "fmovneg", "04e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(15)), "fmovvc", "04e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(7)), "fmovvs", "04e"},
-
- /* Floating-Point Condition Codes */
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(8)), "fmova", "o4e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(0)), "fmovn", "o4e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(7)), "fmovu", "o4e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(6)), "fmovg", "o4e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(5)), "fmovug", "o4e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(4)), "fmovk", "o4e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(3)), "fmovul", "o4e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(2)), "fmovlg", "o4e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(1)), "fmovne", "o4e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(9)), "fmove", "o4e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(10)), "fmovue", "o4e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(11)), "fmovge", "o4e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(12)), "fmovuge", "o4e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(13)), "fmovle", "o4e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(14)), "fmovule", "o4e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | COND2(15)), "fmovo", "o4e"},
-
- /* Move F-P Register on Integer Register Condition "FMOVr" */
- /* FIXME: check for short, double, and quad's */
- {(FORMAT3(2, OP3_X(3,5), 0) | RCOND34(1)), "fmovre", "14e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | RCOND34(2)), "fmovrlez", "14e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | RCOND34(3)), "fmovrlz", "14e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | RCOND34(5)), "fmovrne", "14e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | RCOND34(6)), "fmovrgz", "14e"},
- {(FORMAT3(2, OP3_X(3,5), 0) | RCOND34(7)), "fmovrgez", "14e"},
-#endif
-
- /* grrrr.... */
- {0, 0, 0}
-
-};
-
-db_addr_t
-db_disasm(loc, altfmt)
- vm_offset_t loc;
- boolean_t altfmt;
-{
- struct sparc_insn* i_ptr = (struct sparc_insn *)&sparc_i;
-
- unsigned long int insn, you_lose, bitmask;
- int matchp;
- char* f_ptr, *cp;
-
- you_lose = 0;
- matchp = 0;
- insn = db_get_value(loc, 4, 0);
-
- if (insn == 0x01000000) {
- db_printf("nop\n");
- return loc + 4;
- }
-
- while (i_ptr->name) {
- /* calculate YOU_LOSE value */
- bitmask= (i_ptr->match);
- you_lose = (~bitmask);
-
- if (((bitmask>>30) & 0x3) == 0x1) {
- /* Call */
- you_lose = ((~0x1)<<30);
- } else if (((bitmask>>30) & 0x3) == 0x0) {
- if (((bitmask>>22) & 0x7) == 0x4) {
- /* Sethi */
- you_lose &= (FORMAT2(0x3,0x7));
- } else {
- /* Branches */
- you_lose &= (FORMAT2(0x3,0x7)|COND(0xf));
- }
- } else if (((bitmask>>30) & 0x3) == 0x2 &&
- ((bitmask>>19) & 0x3f) == 0x34) /* XXX */ {
- /* FPop1 */
- you_lose &= (FORMAT3(0x3,0x3f,0x1) | OPF(0x1ff));
- } else {
- you_lose &= (FORMAT3(0x3,0x3f,0x1));
- }
-
- if (((bitmask & insn) == bitmask) && ((you_lose & insn) == 0)) {
- matchp = 1;
- break;
- }
- i_ptr++;
- };
-
- if (!matchp) {
- db_printf("undefined\n");
- return loc + 4;
- }
-
- db_printf("%s", i_ptr->name);
-
- f_ptr = i_ptr->format;
-
- for (cp = f_ptr; *cp; cp++) {
- if (*cp == ',') {
- for (;f_ptr < cp; f_ptr++)
- switch (*f_ptr) {
- case 'a':
- if (insn & A(1))
- db_printf(",a");
- break;
- case 'p':
- if (insn & P(1))
- db_printf(",pt");
- else
- db_printf(",pn");
- break;
- }
- f_ptr++;
- break;
- }
- }
- db_printf(" \t");
-
- while (*f_ptr) {
- switch (*f_ptr) {
- case '1':
- db_printf("%%%s", regs[((insn >> 14) & 0x1f)]);
- break;
- case '2':
- db_printf("%%%s", regs[(insn & 0x1f)]);
- break;
- case 'd':
- db_printf("%%%s", regs[((insn >> 25) & 0x1f)]);
- break;
- case '3':
- db_printf("%%f%ld", ((insn >> 14) & 0x1f));
- break;
- case '4':
- db_printf("%%f%ld", (insn & 0x1f));
- break;
- case 'e':
- db_printf("%%f%ld", ((insn >> 25) & 0x1f));
- break;
- case 'i':
- db_printf("0x%lx", (insn & 0x1fff));
- break;
- case 'j':
- db_printf("0x%lx", (insn & 0x7ff));
- break;
- case 'l':
- db_printf("0x%lx", ((insn & 0x1fff) |
- ((insn >> 20) & 0x3)));
- break;
- case 'm':
- db_printsym(
- (db_addr_t)(loc + (4 * (insn & 0x3fffff))),
- DB_STGY_ANY);
- break;
- case 'u':
- db_printsym(
- (db_addr_t)(loc + (4 * (insn & 0x7ffff))),
- DB_STGY_ANY);
- break;
- case 'n':
- db_printsym(
- (db_addr_t)(loc + (4 * (insn & 0x3fffffff))),
- DB_STGY_PROC);
- break;
- case 's':
- db_printf("%%asi");
- break;
- case 't':
- db_printf("0x%-2.2lx", ((insn >> 5) & 0xff));
- break;
- case 'o':
- db_printf("%%fcc%ld", ((insn >> 25) & 0x3));
- break;
- case 'p':
- case '7':
- db_printf("[%%%s + %%%s]",
- regs[((insn >> 14) & 0x1f)],
- regs[(insn & 0x1f)]);
- if (*f_ptr == '7')
- db_printf(" %ld", ((insn >> 5) & 0xff));
- break;
- case 'q':
- case '8':
- db_printf("[%%%s + 0x%lx]",
- regs[((insn >> 14) & 0x1f)],
- (insn & 0x1fff));
- if (*f_ptr == '8')
- db_printf(" %%asi");
- break;
- case '5':
- db_printf("%%fsr");
- break;
- case '6':
- db_printf("%%fsr");
- break;
- case '9':
- db_printf("0x%lxl",
- ((insn & 0xf) | ((insn >> 4) & 0x7)));
- break;
- case '0':
- db_printf("%%%s", ccodes[((insn >> 11) & 0x7)]);
- break;
- case 'r':
- db_printf("#%s", prefetch[((insn >> 25) & 0x1f)]);
- break;
- case 'A':
- db_printf("%%%s", priv_regs[((insn >> 14) & 0x1f)]);
- break;
- case 'B':
- db_printf("%%%s", state_regs[((insn >> 14) & 0x1f)]);
- break;
- case 'C':
- db_printf("%%hi(0x%lx)", ((insn & 0x3fffff) << 10));
- break;
- case 'D':
- db_printf("0x%lx", (insn & 0x1f));
- break;
- case 'E':
- db_printf("0x%lx", (insn & 0x3f));
- break;
- case 'F':
- db_printf("0x%lx", (insn & 0x3f));
- break;
- case 'G':
- db_printf("%%%s", priv_regs[((insn >> 25) & 0x1f)]);
- break;
- case 'H':
- db_printf("%%%s", state_regs[((insn >> 25) & 0x1f)]);
- break;
-#ifndef V9
- case 'P':
- db_printf("%%psr");
- break;
- case 'T':
- db_printf("%%tbr");
- break;
- case 'W':
- db_printf("%%wim");
- break;
- case 'Y':
- db_printf("%%y");
- break;
-#endif
- default:
- db_printf("(UNKNOWN)");
- break;
- }
- if (*(++f_ptr))
- db_printf(", ");
- };
-
- db_printf("\n");
-
- return (loc + 4);
-}
-
diff --git a/sys/arch/kbus/kbus/db_interface.c b/sys/arch/kbus/kbus/db_interface.c
deleted file mode 100644
index 86b46fd6bf4..00000000000
--- a/sys/arch/kbus/kbus/db_interface.c
+++ /dev/null
@@ -1,347 +0,0 @@
-/* $NetBSD: db_interface.c,v 1.12 1996/05/18 12:27:45 mrg Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1991,1990 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- *
- * From: db_interface.c,v 2.4 1991/02/05 17:11:13 mrt (CMU)
- */
-
-/*
- * Interface to new debugger.
- */
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/reboot.h>
-#include <sys/systm.h>
-
-#include <vm/vm.h>
-
-#include <dev/cons.h>
-
-#include <machine/db_machdep.h>
-#include <ddb/db_command.h>
-#include <ddb/db_sym.h>
-#include <ddb/db_variables.h>
-#include <ddb/db_extern.h>
-#include <ddb/db_access.h>
-#include <ddb/db_output.h>
-#include <machine/asm.h>
-#include <machine/asi.h>
-
-extern void verbose_rom_reset __P((void));
-
-static void db_disp_tlb_cmd __P((db_expr_t, int, db_expr_t, char *));
-static void db_disp_prom_cmd __P((db_expr_t, int, db_expr_t, char *));
-static void db_disp_qs __P((db_expr_t, int, db_expr_t, char *));
-
-static int nil;
-
-struct db_variable db_regs[] = {
- { "psr", (long *)&DDB_TF->tf_psr, FCN_NULL, },
- { "pc", (long *)&DDB_TF->tf_pc, FCN_NULL, },
- { "npc", (long *)&DDB_TF->tf_npc, FCN_NULL, },
- { "y", (long *)&DDB_TF->tf_y, FCN_NULL, },
- { "wim", (long *)&DDB_TF->tf_global[0], FCN_NULL, }, /* see reg.h */
- { "g0", (long *)&nil, FCN_NULL, },
- { "g1", (long *)&DDB_TF->tf_global[1], FCN_NULL, },
- { "g2", (long *)&DDB_TF->tf_global[2], FCN_NULL, },
- { "g3", (long *)&DDB_TF->tf_global[3], FCN_NULL, },
- { "g4", (long *)&DDB_TF->tf_global[4], FCN_NULL, },
- { "g5", (long *)&DDB_TF->tf_global[5], FCN_NULL, },
- { "g6", (long *)&DDB_TF->tf_global[6], FCN_NULL, },
- { "g7", (long *)&DDB_TF->tf_global[7], FCN_NULL, },
- { "o0", (long *)&DDB_TF->tf_out[0], FCN_NULL, },
- { "o1", (long *)&DDB_TF->tf_out[1], FCN_NULL, },
- { "o2", (long *)&DDB_TF->tf_out[2], FCN_NULL, },
- { "o3", (long *)&DDB_TF->tf_out[3], FCN_NULL, },
- { "o4", (long *)&DDB_TF->tf_out[4], FCN_NULL, },
- { "o5", (long *)&DDB_TF->tf_out[5], FCN_NULL, },
- { "o6", (long *)&DDB_TF->tf_out[6], FCN_NULL, },
- { "o7", (long *)&DDB_TF->tf_out[7], FCN_NULL, },
- { "l0", (long *)&DDB_FR->fr_local[0], FCN_NULL, },
- { "l1", (long *)&DDB_FR->fr_local[1], FCN_NULL, },
- { "l2", (long *)&DDB_FR->fr_local[2], FCN_NULL, },
- { "l3", (long *)&DDB_FR->fr_local[3], FCN_NULL, },
- { "l4", (long *)&DDB_FR->fr_local[4], FCN_NULL, },
- { "l5", (long *)&DDB_FR->fr_local[5], FCN_NULL, },
- { "l6", (long *)&DDB_FR->fr_local[6], FCN_NULL, },
- { "l7", (long *)&DDB_FR->fr_local[7], FCN_NULL, },
- { "i0", (long *)&DDB_FR->fr_arg[0], FCN_NULL, },
- { "i1", (long *)&DDB_FR->fr_arg[1], FCN_NULL, },
- { "i2", (long *)&DDB_FR->fr_arg[2], FCN_NULL, },
- { "i3", (long *)&DDB_FR->fr_arg[3], FCN_NULL, },
- { "i4", (long *)&DDB_FR->fr_arg[4], FCN_NULL, },
- { "i5", (long *)&DDB_FR->fr_arg[5], FCN_NULL, },
- { "i6", (long *)&DDB_FR->fr_arg[6], FCN_NULL, },
- { "i7", (long *)&DDB_FR->fr_arg[7], FCN_NULL, },
-};
-struct db_variable *db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
-
-extern label_t *db_recover;
-
-int db_active = 0;
-
-extern char *trap_type[];
-
-void kdb_kbd_trap __P((struct trapframe *));
-#if 0
-static void db_write_text __P((unsigned char *, int));
-#endif
-void db_prom_cmd __P((db_expr_t, int, db_expr_t, char *));
-
-/*
- * Received keyboard interrupt sequence.
- */
-void
-kdb_kbd_trap(tf)
- struct trapframe *tf;
-{
- if (db_active == 0 && (boothowto & RB_KDB)) {
- printf("\n\nkernel: keyboard interrupt\n");
- kdb_trap(-1, tf);
- }
-}
-
-/*
- * kdb_trap - field a TRACE or BPT trap
- */
-int
-kdb_trap(type, tf)
- int type;
- register struct trapframe *tf;
-{
-
- switch (type) {
- case T_BREAKPOINT: /* breakpoint */
- case -1: /* keyboard interrupt */
- break;
- default:
- printf("kernel: %s trap", trap_type[type & 0xff]);
- if (db_recover != 0) {
- db_error("Faulted in DDB; continuing...\n");
- /*NOTREACHED*/
- }
- }
-
- /* Should switch to kdb`s own stack here. */
-
- ddb_regs.ddb_tf = *tf;
- ddb_regs.ddb_fr = *(struct frame *)tf->tf_out[6];
-
- db_active++;
- cnpollc(TRUE);
- db_trap(type, 0/*code*/);
- cnpollc(FALSE);
- db_active--;
-
- *(struct frame *)tf->tf_out[6] = ddb_regs.ddb_fr;
- *tf = ddb_regs.ddb_tf;
-
- return (1);
-}
-
-/*
- * Read bytes from kernel address space for debugger.
- */
-void
-db_read_bytes(addr, size, data)
- vm_offset_t addr;
- register size_t size;
- register char *data;
-{
- register char *src;
-
- src = (char *)addr;
- while (size-- > 0)
- *data++ = *src++;
-}
-
-
-#if 0
-/*
- * XXX - stolen from pmap.c
- */
-#if defined(SUN4M)
-#define getpte4m(va) lda((va & 0xFFFFF000) | ASI_SRMMUFP_L3, \
- ASI_SRMMUFP)
-void setpte4m __P((vm_offset_t va, int pte));
-
-#endif
-#define getpte4(va) lda(va, ASI_PTE)
-#define setpte4(va, pte) sta(va, ASI_PTE, pte)
-#if defined(SUN4M) && !(defined(SUN4C) || defined(SUN4))
-#define getpte getpte4m
-#define setpte setpte4m
-#elif defined(SUN4M)
-#define getpte(va) (cputyp==CPU_SUN4M ? getpte4m(va) : getpte4(va))
-#define setpte(va, pte) (cputyp==CPU_SUN4M ? setpte4m(va, pte) \
- : setpte4(va,pte))
-#else
-#define getpte getpte4
-#define setpte setpte4
-#endif
-
-#define splpmap() splimp()
-
-static void
-db_write_text(dst, ch)
- unsigned char *dst;
- int ch;
-{
- int s, pte0, pte;
- vm_offset_t va;
-
- s = splpmap();
- va = (unsigned long)dst & (~PGOFSET);
- pte0 = getpte(va);
-
-#if defined(SUN4M)
-#if defined(SUN4) || defined(SUN4C)
- if (cputyp == CPU_SUN4M) {
-#endif
- if ((pte0 & SRMMU_TETYPE) != SRMMU_TEPTE) {
- db_printf(" address %p not a valid page\n", dst);
- splx(s);
- return;
- }
-
- pte = pte0 | PPROT_WRITE;
- setpte(va, pte);
-
-#if defined(SUN4) || defined(SUN4C)
- } else {
-#endif
-#endif /* 4m */
-#if defined(SUN4) || defined(SUN4C)
- if ((pte0 & PG_V) == 0) {
- db_printf(" address %p not a valid page\n", dst);
- splx(s);
- return;
- }
-
- pte = pte0 | PG_W;
- setpte(va, pte);
-#if defined(SUN4M)
- }
-#endif
-#endif /* 4/4c */
-
- *dst = (unsigned char)ch;
-
- setpte(va, pte0);
- splx(s);
-}
-#endif
-
-/*
- * Write bytes to kernel address space for debugger.
- */
-void
-db_write_bytes(addr, size, data)
- vm_offset_t addr;
- register size_t size;
- register char *data;
-{
-#if 0
- extern char etext[];
-#endif
- register char *dst;
-
- dst = (char *)addr;
- while (size-- > 0) {
-#if 0
- if ((dst >= (char *)VM_MIN_KERNEL_ADDRESS) && (dst < etext))
- db_write_text(dst, *data);
- else
-#endif
- *dst = *data;
- dst++, data++;
- }
-
-}
-
-void
-Debugger()
-{
- asm("ta 0x81");
-}
-
-static void
-db_disp_prom_cmd(addr, have_addr, count, modif)
- db_expr_t addr;
- int have_addr;
- db_expr_t count;
- char *modif;
-{
- verbose_rom_reset ();
-}
-
-static void
-db_disp_tlb_cmd(addr, have_addr, count, modif)
- db_expr_t addr;
- int have_addr;
- db_expr_t count;
- char *modif;
-{
- int i;
- for (i = SERIES5_KERN_WINDOW; i; i += SERIES5_PAGE_SIZE)
- db_printf ("[%p] data: 0x%08x inst: 0x%08x\n", i,
- lda (ASI_GTLB_RDD, i), lda (ASI_GTLB_RDI, i));
-}
-
-static void
-db_disp_qs(addr, have_addr, count, modif)
- db_expr_t addr;
- int have_addr;
- db_expr_t count;
- char *modif;
-{
- int ix;
- struct proc *ptr;
-
- for (ix=0; ix<NQS; ix++)
- if (qs[ix].ph_link != qs[ix].ph_rlink)
- {
- ptr = qs[ix].ph_link;
- do {
- printf ("qs[%d]: 0x%x 0x%x\n", ix, ptr->p_forw, ptr->p_back);
- ptr = ptr->p_forw;
- } while (ptr != (struct proc *)0 && ptr != qs[ix].ph_link);
- }
- panic("nil P_BACK");
-}
-
-static struct db_command sparc_db_command_table[] = {
- { "disp_prom", db_disp_prom_cmd, 0, 0 },
- { "disp_tlb", db_disp_tlb_cmd, 0, 0 },
- { "disp_qs", db_disp_qs, 0, 0 },
- { (char *)0, }
-};
-
-void
-db_machine_init()
-{
- db_machine_commands_install(sparc_db_command_table);
-}
diff --git a/sys/arch/kbus/kbus/db_trace.c b/sys/arch/kbus/kbus/db_trace.c
deleted file mode 100644
index 8da02ce3082..00000000000
--- a/sys/arch/kbus/kbus/db_trace.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/* $NetBSD: db_trace.c,v 1.8 1996/04/04 23:25:35 pk Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1991,1990 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <machine/db_machdep.h>
-
-#include <ddb/db_access.h>
-#include <ddb/db_sym.h>
-#include <ddb/db_interface.h>
-#include <ddb/db_output.h>
-
-#define INKERNEL(va) (((vm_offset_t)(va)) >= USRSTACK)
-
-void
-db_stack_trace_cmd(addr, have_addr, count, modif)
- db_expr_t addr;
- int have_addr;
- db_expr_t count;
- char *modif;
-{
- struct frame *frame;
- boolean_t kernel_only = TRUE;
-
- {
- register char c, *cp = modif;
- while ((c = *cp++) != 0)
- if (c == 'u')
- kernel_only = FALSE;
- }
-
- if (count == -1)
- count = 65535;
-
- if (!have_addr)
- frame = (struct frame *)DDB_TF->tf_out[6];
- else
- frame = (struct frame *)addr;
-
- while (count--) {
- int i;
- db_expr_t offset;
- char *name;
- db_addr_t pc;
-
- pc = frame->fr_pc;
- if (!INKERNEL(pc))
- break;
-
- /*
- * Switch to frame that contains arguments
- */
- frame = frame->fr_fp;
- if (!INKERNEL(frame))
- break;
-
- db_find_sym_and_offset(pc, &name, &offset);
- if (name == NULL)
- name = "?";
-
- db_printf("%s(", name);
-
- /*
- * Print %i0..%i5, hope these still reflect the
- * actual arguments somewhat...
- */
- for (i=0; i < 5; i++)
- db_printf("%x, ", frame->fr_arg[i]);
- db_printf("%x) at ", frame->fr_arg[i]);
- db_printsym(pc, DB_STGY_PROC);
- db_printf("\n");
-
- }
-}
diff --git a/sys/arch/kbus/kbus/disksubr.c b/sys/arch/kbus/kbus/disksubr.c
deleted file mode 100644
index 4587d14c74e..00000000000
--- a/sys/arch/kbus/kbus/disksubr.c
+++ /dev/null
@@ -1,633 +0,0 @@
-/* $OpenBSD: disksubr.c,v 1.6 2000/10/18 21:00:36 mickey Exp $ */
-/* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Gordon W. Ross
- * Copyright (c) 1994 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/ioccom.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-#include <sys/disk.h>
-#include <sys/dkbad.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-
-#include <machine/cpu.h>
-#include <machine/autoconf.h>
-#include <machine/sun_disklabel.h>
-
-/*#include <sparc/dev/sbusvar.h> */
-
-#if MAXPARTITIONS != 16
-#warn beware: Sun disklabel compatibility assumes MAXPARTITIONS == 16
-#endif
-
-static char *disklabel_sun_to_bsd __P((char *, struct disklabel *));
-static int disklabel_bsd_to_sun __P((struct disklabel *, char *));
-
-#define b_cylin b_resid
-
-extern struct device *bootdv;
-
-/*
- * find the boot device (if it was a disk). we must check to see if
- * unit info in saved bootpath structure matches unit info in our softc.
- * note that knowing the device name (e.g. "xd0") is not useful... we
- * must check the drive number (or target/lun, in the case of SCSI).
- * (XXX is it worth ifdef'ing this?)
- */
-
-void
-dk_establish(dk, dev)
- struct disk *dk;
- struct device *dev;
-{
- return;
-}
-
-/*
- * Attempt to read a disk label from a device
- * using the indicated strategy routine.
- * The label must be partly set up before this:
- * secpercyl, secsize and anything required for a block i/o read
- * operation in the driver's strategy/start routines
- * must be filled in before calling us.
- *
- * Return buffer for use in signalling errors if requested.
- *
- * Returns null on success and an error string on failure.
- */
-char *
-readdisklabel(dev, strat, lp, clp, spoofonly)
- dev_t dev;
- void (*strat) __P((struct buf *));
- struct disklabel *lp;
- struct cpu_disklabel *clp;
- int spoofonly;
-{
- struct buf *bp;
- struct disklabel *dlp;
- struct sun_disklabel *slp;
- int error, i;
-
- /* minimal requirements for archtypal disk label */
- if (lp->d_secperunit == 0)
- lp->d_secperunit = 0x1fffffff;
- lp->d_npartitions = RAW_PART+1;
- for (i = 0; i < RAW_PART; i++) {
- lp->d_partitions[i].p_size = 0;
- lp->d_partitions[i].p_offset = 0;
- }
- if (lp->d_partitions[i].p_size == 0)
- lp->d_partitions[i].p_size = 0x1fffffff;
- lp->d_partitions[0].p_offset = 0;
- lp->d_bbsize = 8192;
- lp->d_sbsize = 64*1024; /* XXX ? */
-
-#if defined(CD9660)
- if (iso_disklabelspoof(dev, strat, lp) == 0)
- return (NULL);
-#endif
-
- /* don't read the on-disk label if we are in spoofed-only mode */
- if (spoofonly)
- return (NULL);
-
- /* obtain buffer to probe drive with */
- bp = geteblk((int)lp->d_secsize);
-
- /* next, dig out disk label */
- bp->b_dev = dev;
- bp->b_blkno = LABELSECTOR;
- bp->b_cylin = 0;
- bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
- (*strat)(bp);
-
- /* if successful, locate disk label within block and validate */
- error = biowait(bp);
- if (error == 0) {
- /* Save the whole block in case it has info we need. */
- bcopy(bp->b_un.b_addr, clp->cd_block, sizeof(clp->cd_block));
- }
- bp->b_flags = B_INVAL | B_AGE | B_READ;
- brelse(bp);
- if (error)
- return ("disk label read error");
-
- /* Check for a Sun disk label (for PROM compatibility). */
- slp = (struct sun_disklabel *) clp->cd_block;
- if (slp->sl_magic == SUN_DKMAGIC)
- return (disklabel_sun_to_bsd(clp->cd_block, lp));
-
- /* Check for a native disk label (PROM can not boot it). */
- dlp = (struct disklabel *) (clp->cd_block + LABELOFFSET);
- if (dlp->d_magic == DISKMAGIC) {
- if (dkcksum(dlp))
- return ("disk label corrupted");
- *lp = *dlp; /* struct assignment */
- return (NULL);
- }
-
- bzero(clp->cd_block, sizeof(clp->cd_block));
- return ("no disk label");
-}
-
-/*
- * Check new disk label for sensibility
- * before setting it.
- */
-int
-setdisklabel(olp, nlp, openmask, clp)
- register struct disklabel *olp, *nlp;
- u_long openmask;
- struct cpu_disklabel *clp;
-{
- register int i;
- register struct partition *opp, *npp;
-
- /* sanity clause */
- if (nlp->d_secpercyl == 0 || nlp->d_secsize == 0 ||
- (nlp->d_secsize % DEV_BSIZE) != 0)
- return(EINVAL);
-
- /* special case to allow disklabel to be invalidated */
- if (nlp->d_magic == 0xffffffff) {
- *olp = *nlp;
- return (0);
- }
-
- if (nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC ||
- dkcksum(nlp) != 0)
- return (EINVAL);
-
- while ((i = ffs((long)openmask)) != 0) {
- i--;
- openmask &= ~(1 << i);
- if (nlp->d_npartitions <= i)
- return (EBUSY);
- opp = &olp->d_partitions[i];
- npp = &nlp->d_partitions[i];
- if (npp->p_offset != opp->p_offset || npp->p_size < opp->p_size)
- return (EBUSY);
- }
-
- *olp = *nlp;
- return (0);
-}
-
-/*
- * Write disk label back to device after modification.
- * Current label is already in clp->cd_block[]
- */
-int
-writedisklabel(dev, strat, lp, clp)
- dev_t dev;
- void (*strat) __P((struct buf *));
- register struct disklabel *lp;
- struct cpu_disklabel *clp;
-{
- struct buf *bp;
- int error;
-
- error = disklabel_bsd_to_sun(lp, clp->cd_block);
- if (error)
- return (error);
-
-#if 0 /* XXX - Allow writing native disk labels? */
- {
- struct disklabel *dlp;
- dlp = (struct disklabel *)(clp->cd_block + LABELOFFSET);
- *dlp = *lp; /* struct assignment */
- }
-#endif
-
- /* Get a buffer and copy the new label into it. */
- bp = geteblk((int)lp->d_secsize);
- bcopy(clp->cd_block, bp->b_un.b_addr, sizeof(clp->cd_block));
-
- /* Write out the updated label. */
- bp->b_dev = dev;
- bp->b_blkno = LABELSECTOR;
- bp->b_cylin = 0;
- bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_WRITE;
- (*strat)(bp);
- error = biowait(bp);
- brelse(bp);
-
- return (error);
-}
-
-/*
- * Determine the size of the transfer, and make sure it is
- * within the boundaries of the partition. Adjust transfer
- * if needed, and signal errors or early completion.
- */
-int
-bounds_check_with_label(bp, lp, osdep, wlabel)
- struct buf *bp;
- struct disklabel *lp;
- struct cpu_disklabel *osdep;
- int wlabel;
-{
-#define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE))
- struct partition *p = lp->d_partitions + DISKPART(bp->b_dev);
- int sz = howmany(bp->b_bcount, DEV_BSIZE);
-
- /* avoid division by zero */
- if (lp->d_secpercyl == 0) {
- bp->b_error = EINVAL;
- goto bad;
- }
-
- /* overwriting disk label ? */
- /* XXX should also protect bootstrap in first 8K */
- /* XXX this assumes everything <=LABELSECTOR is label! */
- /* But since LABELSECTOR is 0, that's ok for now. */
- if ((bp->b_blkno + blockpersec(p->p_offset, lp) <= LABELSECTOR) &&
- ((bp->b_flags & B_READ) == 0) && (wlabel == 0)) {
- bp->b_error = EROFS;
- goto bad;
- }
-
- /* beyond partition? */
- if (bp->b_blkno + sz > blockpersec(p->p_size, lp)) {
- sz = blockpersec(p->p_size, lp) - bp->b_blkno;
- if (sz == 0) {
- /* If exactly at end of disk, return an EOF */
- bp->b_resid = bp->b_bcount;
- return (0);
- }
- if (sz < 0) {
- /* If past end of disk, return EINVAL. */
- bp->b_error = EINVAL;
- goto bad;
- }
- /* Or truncate if part of it fits */
- bp->b_bcount = sz << DEV_BSHIFT;
- }
-
- /* calculate cylinder for disksort to order transfers with */
- bp->b_resid = (bp->b_blkno + blockpersec(p->p_offset, lp)) /
- lp->d_secpercyl;
- return (1);
-bad:
- bp->b_flags |= B_ERROR;
- return (-1);
-}
-
-/************************************************************************
- *
- * The rest of this was taken from arch/sparc/scsi/sun_disklabel.c
- * and then substantially rewritten by Gordon W. Ross
- *
- ************************************************************************/
-
-/* What partition types to assume for Sun disklabels: */
-static u_char
-sun_fstypes[16] = {
- FS_BSDFFS, /* a */
- FS_SWAP, /* b */
- FS_OTHER, /* c - whole disk */
- FS_BSDFFS, /* d */
- FS_BSDFFS, /* e */
- FS_BSDFFS, /* f */
- FS_BSDFFS, /* g */
- FS_BSDFFS, /* h */
- FS_BSDFFS, /* i */
- FS_BSDFFS, /* j */
- FS_BSDFFS, /* k */
- FS_BSDFFS, /* l */
- FS_BSDFFS, /* m */
- FS_BSDFFS, /* n */
- FS_BSDFFS, /* o */
- FS_BSDFFS /* p */
-};
-
-/*
- * Given a struct sun_disklabel, assume it has an extended partition
- * table and compute the correct value for sl_xpsum.
- */
-static __inline u_long sun_extended_sum __P((struct sun_disklabel *sl));
-static __inline u_long
-sun_extended_sum(sl)
- struct sun_disklabel *sl;
-{
- u_long lsum;
- u_long *xp;
- u_long *ep;
-
- xp = (u_long *) &sl->sl_xpmag;
- ep = (u_long *) &sl->sl_xxx1[0];
-
- lsum = 0;
- for (; xp < ep; xp++)
- lsum += *xp;
- return(lsum);
-}
-
-/*
- * Given a SunOS disk label, set lp to a BSD disk label.
- * Returns NULL on success, else an error string.
- *
- * The BSD label is cleared out before this is called.
- */
-static char *
-disklabel_sun_to_bsd(cp, lp)
- char *cp;
- struct disklabel *lp;
-{
- struct sun_disklabel *sl;
- struct partition *npp;
- struct sun_dkpart *spp;
- int i, secpercyl;
- u_short cksum, *sp1, *sp2;
-
- sl = (struct sun_disklabel *)cp;
-
- /* Verify the XOR check. */
- sp1 = (u_short *)sl;
- sp2 = (u_short *)(sl + 1);
- cksum = 0;
- while (sp1 < sp2)
- cksum ^= *sp1++;
- if (cksum != 0)
- return("SunOS disk label, bad checksum");
-
- /* Format conversion. */
- lp->d_magic = DISKMAGIC;
- lp->d_magic2 = DISKMAGIC;
- memcpy(lp->d_packname, sl->sl_text, sizeof(lp->d_packname));
-
- lp->d_secsize = 512;
- lp->d_nsectors = sl->sl_nsectors;
- lp->d_ntracks = sl->sl_ntracks;
- lp->d_ncylinders = sl->sl_ncylinders;
-
- secpercyl = sl->sl_nsectors * sl->sl_ntracks;
- lp->d_secpercyl = secpercyl;
- lp->d_secperunit = secpercyl * sl->sl_ncylinders;
-
- lp->d_sparespercyl = sl->sl_sparespercyl;
- lp->d_acylinders = sl->sl_acylinders;
- lp->d_rpm = sl->sl_rpm;
- lp->d_interleave = sl->sl_interleave;
-
- lp->d_npartitions = MAXPARTITIONS;
- /* These are as defined in <ufs/ffs/fs.h> */
- lp->d_bbsize = 8192; /* XXX */
- lp->d_sbsize = 8192; /* XXX */
-
- for (i = 0; i < 8; i++) {
- spp = &sl->sl_part[i];
- npp = &lp->d_partitions[i];
- npp->p_offset = spp->sdkp_cyloffset * secpercyl;
- npp->p_size = spp->sdkp_nsectors;
- if (npp->p_size == 0) {
- npp->p_fstype = FS_UNUSED;
- } else {
- npp->p_fstype = sun_fstypes[i];
- if (npp->p_fstype == FS_BSDFFS) {
- /*
- * The sun label does not store the FFS fields,
- * so just set them with default values here.
- */
- npp->p_fsize = 1024;
- npp->p_frag = 8;
- npp->p_cpg = 16;
- }
- }
- }
-
- /* Clear "extended" partition info, tentatively */
- for (i = 0; i < SUNXPART; i++) {
- npp = &lp->d_partitions[i+8];
- npp->p_offset = 0;
- npp->p_size = 0;
- npp->p_fstype = FS_UNUSED;
- }
-
- /* Check to see if there's an "extended" partition table */
- if (sl->sl_xpmag == SL_XPMAG &&
- sun_extended_sum(sl) == sl->sl_xpsum) { /* ...yes! */
- /*
- * There is. Copy over the "extended" partitions.
- * This code parallels the loop for partitions a-h.
- */
- for (i = 0; i < SUNXPART; i++) {
- spp = &sl->sl_xpart[i];
- npp = &lp->d_partitions[i+8];
- npp->p_offset = spp->sdkp_cyloffset * secpercyl;
- npp->p_size = spp->sdkp_nsectors;
- if (npp->p_size == 0) {
- npp->p_fstype = FS_UNUSED;
- continue;
- }
- npp->p_fstype = sun_fstypes[i+8];
- if (npp->p_fstype == FS_BSDFFS) {
- npp->p_fsize = 1024;
- npp->p_frag = 8;
- npp->p_cpg = 16;
- }
- }
- }
-
- lp->d_checksum = 0;
- lp->d_checksum = dkcksum(lp);
- return (NULL);
-}
-
-/*
- * Given a BSD disk label, update the Sun disklabel
- * pointed to by cp with the new info. Note that the
- * Sun disklabel may have other info we need to keep.
- * Returns zero or error code.
- */
-static int
-disklabel_bsd_to_sun(lp, cp)
- struct disklabel *lp;
- char *cp;
-{
- struct sun_disklabel *sl;
- struct partition *npp;
- struct sun_dkpart *spp;
- int i, secpercyl;
- u_short cksum, *sp1, *sp2;
-
- if (lp->d_secsize != 512)
- return (EINVAL);
-
- sl = (struct sun_disklabel *)cp;
-
- /* Format conversion. */
- memcpy(sl->sl_text, lp->d_packname, sizeof(lp->d_packname));
- sl->sl_rpm = lp->d_rpm;
- sl->sl_pcylinders = lp->d_ncylinders + lp->d_acylinders; /* XXX */
- sl->sl_sparespercyl = lp->d_sparespercyl;
- sl->sl_interleave = lp->d_interleave;
- sl->sl_ncylinders = lp->d_ncylinders;
- sl->sl_acylinders = lp->d_acylinders;
- sl->sl_ntracks = lp->d_ntracks;
- sl->sl_nsectors = lp->d_nsectors;
-
- secpercyl = sl->sl_nsectors * sl->sl_ntracks;
- for (i = 0; i < 8; i++) {
- spp = &sl->sl_part[i];
- npp = &lp->d_partitions[i];
-
- if (npp->p_offset % secpercyl)
- return (EINVAL);
- spp->sdkp_cyloffset = npp->p_offset / secpercyl;
- spp->sdkp_nsectors = npp->p_size;
- }
- sl->sl_magic = SUN_DKMAGIC;
-
- /*
- * The reason we store the extended table stuff only conditionally
- * is so that a label that doesn't need it will have NULs there, like
- * a "traditional" Sun label. Since Suns seem to ignore everything
- * between sl_text and sl_rpm, this probably doesn't matter, but it
- * certainly doesn't hurt anything and it's easy to do.
- */
- for (i = 0; i < SUNXPART; i++) {
- if (lp->d_partitions[i+8].p_offset ||
- lp->d_partitions[i+8].p_size)
- break;
- }
- /* We do need to load the extended table? */
- if (i < SUNXPART) {
- sl->sl_xpmag = SL_XPMAG;
- for (i = 0; i < SUNXPART; i++) {
- spp = &sl->sl_xpart[i];
- npp = &lp->d_partitions[i+8];
- if (npp->p_offset % secpercyl)
- return (EINVAL);
- sl->sl_xpart[i].sdkp_cyloffset =
- npp->p_offset / secpercyl;
- sl->sl_xpart[i].sdkp_nsectors = npp->p_size;
- }
- sl->sl_xpsum = sun_extended_sum(sl);
- } else {
- sl->sl_xpmag = 0;
- for (i = 0; i < SUNXPART; i++) {
- sl->sl_xpart[i].sdkp_cyloffset = 0;
- sl->sl_xpart[i].sdkp_nsectors = 0;
- }
- sl->sl_xpsum = 0;
- }
-
- /* Correct the XOR check. */
- sp1 = (u_short *)sl;
- sp2 = (u_short *)(sl + 1);
- sl->sl_cksum = cksum = 0;
- while (sp1 < sp2)
- cksum ^= *sp1++;
- sl->sl_cksum = cksum;
-
- return (0);
-}
-
-/* move this to compat/sunos */
-int
-sun_dkioctl(dk, cmd, data, partition)
- struct disk *dk;
- u_long cmd;
- caddr_t data;
- int partition;
-{
- register struct partition *p;
-
- switch (cmd) {
- case DKIOCGGEOM:
-#define geom ((struct sun_dkgeom *)data)
- bzero(data, sizeof(*geom));
- geom->sdkc_ncylinders = dk->dk_label->d_ncylinders;
- geom->sdkc_acylinders = dk->dk_label->d_acylinders;
- geom->sdkc_ntracks = dk->dk_label->d_ntracks;
- geom->sdkc_nsectors = dk->dk_label->d_nsectors;
- geom->sdkc_interleave = dk->dk_label->d_interleave;
- geom->sdkc_sparespercyl = dk->dk_label->d_sparespercyl;
- geom->sdkc_rpm = dk->dk_label->d_rpm;
- geom->sdkc_pcylinders =
- dk->dk_label->d_ncylinders + dk->dk_label->d_acylinders;
-#undef geom
- break;
- case DKIOCINFO:
- /* Homey don't do DKIOCINFO */
- bzero(data, sizeof(struct sun_dkctlr));
- break;
- case DKIOCGPART:
- if (dk->dk_label->d_secpercyl == 0)
- return (ERANGE); /* XXX */
- p = &dk->dk_label->d_partitions[partition];
- if (p->p_offset % dk->dk_label->d_secpercyl != 0)
- return (ERANGE); /* XXX */
-#define part ((struct sun_dkpart *)data)
- part->sdkp_cyloffset = p->p_offset / dk->dk_label->d_secpercyl;
- part->sdkp_nsectors = p->p_size;
-#undef part
- break;
- default:
- return (-1);
- }
- return (0);
-}
-
-/*
- * Search the bad sector table looking for the specified sector.
- * Return index if found.
- * Return -1 if not found.
- */
-int
-isbad(bt, cyl, trk, sec)
- register struct dkbad *bt;
- int cyl, trk, sec;
-{
- register int i;
- register long blk, bblk;
-
- blk = ((long)cyl << 16) + (trk << 8) + sec;
- for (i = 0; i < 126; i++) {
- bblk = ((long)bt->bt_bad[i].bt_cyl << 16) +
- bt->bt_bad[i].bt_trksec;
- if (blk == bblk)
- return (i);
- /* badblock is *NOT* an ordered list... (Stupid boys...). */
- if (/* blk < bblk || */ bblk < 0)
- break;
- }
- return (-1);
-}
diff --git a/sys/arch/kbus/kbus/genassym.c b/sys/arch/kbus/kbus/genassym.c
deleted file mode 100644
index f624da44d34..00000000000
--- a/sys/arch/kbus/kbus/genassym.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/* $NetBSD: genassym.c,v 1.17.4.1 1996/06/12 20:31:21 pk Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)genassym.c 8.1 (Berkeley) 6/11/93
- */
-
-#include <sys/param.h>
-#include <sys/buf.h>
-#include <sys/proc.h>
-#include <sys/map.h>
-#include <sys/proc.h>
-#include <sys/mbuf.h>
-#include <sys/msgbuf.h>
-#include <sys/syscall.h>
-#include <sys/user.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-#include <sys/disk.h>
-
-#include <machine/pmap.h>
-#include <machine/cpu.h>
-
-#if 0
-#define psignal _XX_psignal
-#include <stdio.h>
-#endif
-#include <stddef.h>
-
-
-#define off(what, str, mem) def(what, (int)offsetof(str, mem))
-
-void def __P((char *, int));
-void flush __P((void));
-int main __P((void));
-
-void
-def(what, where)
- char *what;
- int where;
-{
-
- if (printf("#define\t%s\t%d\n", what, where) < 0) {
- perror("printf");
- exit(1);
- }
-}
-
-
-int
-main()
-{
-
-#if 0
- /* general constants */
- def("BSD", BSD);
- def("SUN4_PGSHIFT", SUN4_PGSHIFT);
- def("SUN4CM_PGSHIFT", SUN4CM_PGSHIFT);
- def("USRSTACK", USRSTACK);
-#endif
-
- /* proc fields and values */
- off("P_ADDR", struct proc, p_addr);
- off("P_UPTE", struct proc, p_md.md_upte);
- off("P_STAT", struct proc, p_stat);
- off("P_WCHAN", struct proc, p_wchan);
- off("P_VMSPACE", struct proc, p_vmspace);
- def("SRUN", SRUN);
-
- /* VM structure fields */
- off("VM_PSEGTAB", struct vmspace, vm_pmap.pm_psegtab);
-
- /* interrupt/fault metering */
- off("V_SWTCH", struct vmmeter, v_swtch);
- off("V_INTR", struct vmmeter, v_intr);
- off("V_FAULTS", struct vmmeter, v_faults);
-
-#if 0
- /* PTE bits and related information */
- def("PG_W", PG_W);
- def("PG_VSHIFT", PG_VSHIFT);
- def("PG_PROTSHIFT", PG_PROTSHIFT);
- def("PG_PROTUREAD", PG_PROTUREAD);
- def("PG_PROTUWRITE", PG_PROTUWRITE);
-#endif
-
- /* FPU state */
- off("FS_REGS", struct fpstate, fs_regs);
- off("FS_FSR", struct fpstate, fs_fsr);
- off("FS_QSIZE", struct fpstate, fs_qsize);
- off("FS_QUEUE", struct fpstate, fs_queue);
- def("FSR_QNE", FSR_QNE);
-
- /* system calls */
- def("SYS_sigreturn", SYS_sigreturn);
- def("SYS_execve", SYS_execve);
- def("SYS_exit", SYS_exit);
-
- /* errno */
- def("EFAULT", EFAULT);
- def("ENAMETOOLONG", ENAMETOOLONG);
-
- /* PCB fields */
- off("PCB_NSAVED", struct pcb, pcb_nsaved);
- off("PCB_ONFAULT", struct pcb, pcb_onfault);
- off("PCB_PSR", struct pcb, pcb_psr);
- off("PCB_RW", struct pcb, pcb_rw);
- off("PCB_SP", struct pcb, pcb_sp);
- off("PCB_PC", struct pcb, pcb_pc);
- off("PCB_UW", struct pcb, pcb_uw);
- off("PCB_WIM", struct pcb, pcb_wim);
-
-#if 0
- /* interrupt enable register PTE */
- def("IE_REG_PTE_PG", PG_V | PG_W | PG_S | PG_NC | PG_OBIO);
-#endif
-
- return(0);
-}
diff --git a/sys/arch/kbus/kbus/in_cksum.c b/sys/arch/kbus/kbus/in_cksum.c
deleted file mode 100644
index ec3f7266b87..00000000000
--- a/sys/arch/kbus/kbus/in_cksum.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/* $NetBSD: in_cksum.c,v 1.3 1995/04/26 13:30:03 pk Exp $ */
-
-/*
- * Copyright (c) 1995 Zubin Dittia.
- * Copyright (c) 1995 Theo de Raadt.
- * Copyright (c) 1995 Matthew Green.
- * Copyright (c) 1994 Charles Hannum.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, and it's contributors.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)in_cksum.c 8.1 (Berkeley) 6/11/93
- */
-
-#include <sys/param.h>
-#include <sys/mbuf.h>
-
-/*
- * Checksum routine for Internet Protocol family headers.
- *
- * This routine is very heavily used in the network
- * code and should be modified for each CPU to be as fast as possible.
- *
- * SPARC version.
- */
-
-/*
- * The checksum computation code here is significantly faster than its
- * vanilla C counterpart (by significantly, I mean 2-3 times faster if
- * the data is in cache, and 1.5-2 times faster if the data is not in
- * cache).
- * We optimize on three fronts:
- * 1. By using the add-with-carry (addxcc) instruction, we can use
- * 32-bit operations instead of 16-bit operations.
- * 2. By unrolling the main loop to reduce branch overheads.
- * 3. By doing a sequence of load,load,add,add,load,load,add,add,
- * we can avoid the extra stall cycle which is incurred if the
- * instruction immediately following a load tries to use the
- * target register of the load.
- * Another possible optimization is to replace a pair of 32-bit loads
- * with a single 64-bit load (ldd) instruction, but I found that although
- * this improves performance somewhat on Sun4c machines, it actually
- * reduces performance considerably on Sun4m machines (because of their
- * superscaler architecture). So I chose to leave it out.
- *
- * Zubin Dittia (zubin@dworkin.wustl.edu)
- */
-
-#define Asm __asm __volatile
-#define ADD64 Asm(" ld [%2],%3; ld [%2+4],%4; \
- addcc %0,%3,%0; addxcc %0,%4,%0; \
- ld [%2+8],%3; ld [%2+12],%4; \
- addxcc %0,%3,%0; addxcc %0,%4,%0; \
- ld [%2+16],%3; ld [%2+20],%4; \
- addxcc %0,%3,%0; addxcc %0,%4,%0; \
- ld [%2+24],%3; ld [%2+28],%4; \
- addxcc %0,%3,%0; addxcc %0,%4,%0; \
- ld [%2+32],%3; ld [%2+36],%4; \
- addxcc %0,%3,%0; addxcc %0,%4,%0; \
- ld [%2+40],%3; ld [%2+44],%4; \
- addxcc %0,%3,%0; addxcc %0,%4,%0; \
- ld [%2+48],%3; ld [%2+52],%4; \
- addxcc %0,%3,%0; addxcc %0,%4,%0; \
- ld [%2+56],%3; ld [%2+60],%4; \
- addxcc %0,%3,%0; addxcc %0,%4,%0; \
- addxcc %0,0,%0" \
- : "=r" (sum) \
- : "0" (sum), "r" (w), "r" (tmp1), "r" (tmp2))
-#define ADD32 Asm(" ld [%2],%3; ld [%2+4],%4; \
- addcc %0,%3,%0; addxcc %0,%4,%0; \
- ld [%2+8],%3; ld [%2+12],%4; \
- addxcc %0,%3,%0; addxcc %0,%4,%0; \
- ld [%2+16],%3; ld [%2+20],%4; \
- addxcc %0,%3,%0; addxcc %0,%4,%0; \
- ld [%2+24],%3; ld [%2+28],%4; \
- addxcc %0,%3,%0; addxcc %0,%4,%0; \
- addxcc %0,0,%0" \
- : "=r" (sum) \
- : "0" (sum), "r" (w), "r" (tmp1), "r" (tmp2))
-#define ADD16 Asm(" ld [%2],%3; ld [%2+4],%4; \
- addcc %0,%3,%0; addxcc %0,%4,%0; \
- ld [%2+8],%3; ld [%2+12],%4; \
- addxcc %0,%3,%0; addxcc %0,%4,%0; \
- addxcc %0,0,%0" \
- : "=r" (sum) \
- : "0" (sum), "r" (w), "r" (tmp1), "r" (tmp2))
-#define ADD8 Asm(" ld [%2],%3; ld [%2+4],%4; \
- addcc %0,%3,%0; addxcc %0,%4,%0; \
- addxcc %0,0,%0" \
- : "=r" (sum) \
- : "0" (sum), "r" (w), "r" (tmp1), "r" (tmp2))
-#define ADD4 Asm(" ld [%2],%3; addcc %0,%3,%0; \
- addxcc %0,0,%0" \
- : "=r" (sum) \
- : "0" (sum), "r" (w), "r" (tmp1))
-
-#define REDUCE {sum = (sum & 0xffff) + (sum >> 16);}
-#define ADDCARRY {if (sum > 0xffff) sum -= 0xffff;}
-#define ROL {sum = sum << 8;} /* depends on recent REDUCE */
-#define ADDBYTE {ROL; sum += *w; byte_swapped ^= 1;}
-#define ADDSHORT {sum += *(u_short *)w;}
-#define ADVANCE(n) {w += n; mlen -= n;}
-
-int in_cksum __P((struct mbuf *, int));
-int
-in_cksum(m, len)
- register struct mbuf *m;
- register int len;
-{
- register u_char *w;
- register u_int sum = 0;
- register int mlen = 0;
- int byte_swapped = 0;
-
- /*
- * Declare two temporary registers for use by the asm code. We
- * allow the compiler to pick which specific machine registers to
- * use, instead of hard-coding this in the asm code above.
- */
- register u_int tmp1 = 0, tmp2 = 0;
-
- for (; m && len; m = m->m_next) {
- if (m->m_len == 0)
- continue;
- w = mtod(m, u_char *);
- mlen = m->m_len;
- if (len < mlen)
- mlen = len;
- len -= mlen;
-
- /*
- * Ensure that we're aligned on a word boundary here so
- * that we can do 32 bit operations below.
- */
- if ((3 & (long)w) != 0) {
- REDUCE;
- if ((1 & (long)w) != 0 && mlen >= 1) {
- ADDBYTE;
- ADVANCE(1);
- }
- if ((2 & (long)w) != 0 && mlen >= 2) {
- ADDSHORT;
- ADVANCE(2);
- }
- }
-
- /*
- * Do as many 32 bit operattions as possible using the
- * 64/32/16/8/4 macro's above, using as many as possible of
- * these.
- */
- while (mlen >= 64) {
- ADD64;
- ADVANCE(64);
- }
- if (mlen >= 32) {
- ADD32;
- ADVANCE(32);
- }
- if (mlen >= 16) {
- ADD16;
- ADVANCE(16);
- }
- if (mlen >= 8) {
- ADD8;
- ADVANCE(8);
- }
- if (mlen >= 4) {
- ADD4;
- ADVANCE(4)
- }
- if (mlen == 0)
- continue;
-
- REDUCE;
- if (mlen >= 2) {
- ADDSHORT;
- ADVANCE(2);
- }
- if (mlen == 1) {
- ADDBYTE;
- }
- }
- if (byte_swapped) {
- REDUCE;
- ROL;
- }
- REDUCE;
- ADDCARRY;
-
- return (0xffff ^ sum);
-}
diff --git a/sys/arch/kbus/kbus/intr.c b/sys/arch/kbus/kbus/intr.c
deleted file mode 100644
index 0770a8215dc..00000000000
--- a/sys/arch/kbus/kbus/intr.c
+++ /dev/null
@@ -1,486 +0,0 @@
-/* $NetBSD: intr.c,v 1.13 1996/03/31 23:35:20 pk Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)intr.c 8.3 (Berkeley) 11/11/93
- */
-
-#include "ppp.h"
-#include "bridge.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/socket.h>
-
-#include <vm/vm.h>
-
-#include <dev/cons.h>
-
-#include <net/netisr.h>
-#include <net/if.h>
-
-#include <machine/cpu.h>
-#include <machine/asi.h>
-#include <machine/sic.h>
-#include <machine/trap.h>
-#include <machine/asm.h>
-#include <machine/autoconf.h>
-#include <machine/kbus.h>
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-#include <netinet/ip_var.h>
-#endif
-#ifdef NS
-#include <netns/ns_var.h>
-#endif
-#ifdef ISO
-#include <netiso/iso.h>
-#include <netiso/clnp.h>
-#endif
-#include "ppp.h"
-#if NPPP > 0
-#include <net/ppp_defs.h>
-#include <net/if_ppp.h>
-#endif
-
-void strayintr __P((struct clockframe *));
-int soft01intr __P((void *));
-void sic_init __P((void));
-void do_sir __P((void));
-static void netintr __P((void));
-void zssoft __P((void));
-
-unsigned int ssir;
-volatile int hir;
-
-volatile unsigned char intrdelay[256];
-static int delay_low, delay_high;
-int intrcnt[256];
-
-/*
- * Stray interrupt handler. Clear it if possible.
- * If not, and if we get 10 interrupts in 10 seconds, panic.
- */
-void
-strayintr(fp)
- struct clockframe *fp;
-{
- static int straytime, nstray;
- int timesince;
-
- printf("stray interrupt ipv=%x ipr=%x pc=%x npc=%x psr=%b\n",
- fp->ipv, fp->ipr, fp->pc, fp->npc, fp->psr, PSR_BITS);
-
- printf ("DIR: %x, IPR: %x, IRC: %x, IXR: %x, IXC: %x\n",
- lduba (ASI_DIR, 0) & SIC_DIR_MASK,
- lda (ASI_IPR, 0) & SIC_IPR_MASK,
- lduba (ASI_IRXC, 0) & 0x3,
- lda (ASI_IXR, 0) & 0xffff,
- lduba (ASI_ITXC, 0) & 0x3);
- timesince = time.tv_sec - straytime;
- if (timesince <= 10) {
- if (++nstray > 9)
- panic("crazy interrupts");
- } else {
- straytime = time.tv_sec;
- nstray = 1;
- }
-}
-
-static void
-netintr()
-{
- int n, s;
-
- s = splhigh();
- n = netisr;
- netisr = 0;
- splx(s);
-
-#define DONETISR(bit, fn) \
- do { \
- if (n & (1 << (bit))) \
- fn; \
- } while (0)
-
-#ifdef INET
- DONETISR(NETISR_ARP, arpintr());
- DONETISR(NETISR_IP, ipintr());
-#endif
-#ifdef INET6
- DONETISR(NETISR_IPV6, ip6intr());
-#endif
-#ifdef NS
- DONETISR(NETISR_NS, nsintr());
-#endif
-#ifdef ISO
- DONETISR(NETISR_ISO, clnlintr());
-#endif
-#ifdef CCITT
- DONETISR(NETISR_CCITT, ccittintr());
-#endif
-#ifdef NATM
- DONETISR(NETISR_NATM, natmintr());
-#endif
-#if NPPP > 1
- DONETISR(NETISR_PPP, pppintr());
-#endif
-#if NBRIDGE > 1
- DONETISR(NETISR_BRIDGE, bridgeintr());
-#endif
-
-#undef DONETISR
-}
-
-static void
-am7990_lesoft (void)
-{
- if (intrhand[135])
- {
- int s;
- s = splnet ();
- (*intrhand[135]->ih_fun)(intrhand[135]->ih_arg);
- splx (s);
- }
-}
-
-void
-do_sir ()
-{
- unsigned int n;
-
- do {
- (void)splhigh();
- n = ssir;
- ssir = 0;
- splsoftint(); /* don't recurse through spl0() */
-
-#define DO_SIR(bit, fn) \
- do { \
- if (n & (bit)) { \
- cnt.v_soft++; \
- fn; \
- } \
- } while (0)
-
- DO_SIR(SIR_NET, netintr());
- DO_SIR(SIR_CLOCK, softclock());
- DO_SIR(SIR_ZS, zssoft());
- DO_SIR(SIR_LE, am7990_lesoft());
-
-#undef DO_SIR
- } while (ssir != 0);
-}
-
-/* Handle delayed interruption from higher level to LEVEL. */
-static void
-do_hir (void)
-{
- int i;
- int done;
- struct intrhand *ih;
-
- setpil15 ();
- hir = 0;
- setpil0 ();
-
-#if 0
- if (intrdelay[135] || intrdelay[137] != 0)
- printf ("do_hir: net is set\n");
-#endif
-
- for (i = delay_high; i >= delay_low; i--)
- while (intrdelay[i])
- {
- done = 0;
- setpil15();
- intrdelay[i] = 0;
- setpil0();
-
- /* Run at the correct spl. */
- stba (ASI_DGRAM, 0, i);
-
- /* Call the handlers. */
- for (ih = intrhand[i]; ih; ih = ih->ih_next)
- done += (*ih->ih_fun)(ih->ih_arg) ? 1 : 0;
- if (!done)
- printf ("stray delayed interruption %d not acked\n", i);
- }
-}
-
-
-/*
- * Level 15 interrupts are special, and not vectored here.
- * Only `prewired' interrupts appear here; boot-time configured devices
- * are attached via intr_establish() below.
- */
-struct intrhand *intrhand[256];
-
-/*
- * Attach an interrupt handler to the vector chain for the given level.
- * This is not possible if it has been taken away as a fast vector.
- */
-void
-intr_establish(level, flags, ih)
- int level;
- unsigned int flags;
- struct intrhand *ih;
-{
- register struct intrhand **p, *q;
- int s;
-
- s = splhigh();
-
- ih->ih_flags = flags;
-#if 1
- printf ("intr establish level %d%s\n",
- level,
- (flags & IH_CAN_DELAY) ? " - can delay" : "");
-#endif
-
- /*
- * This is O(N^2) for long chains, but chains are never long
- * and we do want to preserve order.
- */
- for (p = &intrhand[level]; (q = *p) != NULL; p = &q->ih_next)
- continue;
- *p = ih;
- if (flags & IH_CAN_DELAY)
- {
- if (delay_low == 0 && delay_high == 0)
- delay_low = delay_high = level;
- else
- {
- if (level < delay_low)
- delay_low = level;
- if (level > delay_high)
- delay_high = level;
- }
- }
- ih->ih_next = NULL;
- splx(s);
-}
-
-#if 0
-void
-sendint (int boardid, int level)
-{
- if (lduba (ASI_ITXC, 0) & SIC_ITXC_E)
- return;
- sta (ASI_IXR, 0, ((level & 0xff) << 8) | SIC_IXR_DIR | (boardid & 0x0f));
- stba (ASI_ITXC, 0, SIC_ITXC_E);
-}
-#endif
-
-/* System board interrupt register. */
-static volatile char *sbir;
-
-void
-sic_init ()
-{
- unsigned char irc_status;
- unsigned char id;
- unsigned char v;
-
- /* Map the system board interrupt register (SBIR). */
- sbir = (volatile char *)bus_mapin (BUS_KBUS, SBIR_BASE, SBIR_SIZE);
- if (!sbir)
- panic ("Can't map SBIR");
-
- setpil15 ();
-
- /* Disable the receiver. */
- irc_status = lduba (ASI_IRXC, 0);
- while (irc_status & SIC_IRC_E)
- {
- stba (ASI_IRXC, 0, irc_status & ~SIC_IRC_E);
- irc_status = lduba (ASI_IRXC, 0);
- }
-
- /* Enable all interruptions. */
- sta (ASI_IPR, 0, 0);
-
- /* Set device id. */
- id = lda (ASI_BID, 0) & 0x0f;
- stba (ASI_DIR, 0, id);
-
- /* Ack int. */
- lda (ASI_ACK_IPV, 0);
-
- /* Enable the receiver. */
- stba (ASI_IRXC, 0, irc_status | SIC_IRC_E);
-
- spl0();
- setpil0();
-
- *sbir = id | SBIR_DI;
-
- /* Enable interruptions from the system board. */
- v = sbir[SBI_EN_OFF];
-
- printf ("Interrupts enabled.\n");
-}
-
-#if 1
-/* Set the new spl and return the old one. */
-#define SPL_BODY(new_spl, can_lower) \
-{ \
- int oldspl; \
- \
- /* Get old spl. */ \
- oldspl = lduba (ASI_DGRAM, 0); \
- \
- /* If CAN_LOWER is false, prevent from lowering. */ \
- if (!can_lower && new_spl < oldspl) \
- return oldspl; \
- \
- /* Do hard int. */ \
- if (new_spl <= SPL_SOFTCLOCK && hir) \
- do_hir (); \
- \
- /* Do ast. */ \
- if (new_spl == 0 && ssir) \
- do_sir (); \
- \
- stba (ASI_DGRAM, 0, new_spl); \
- \
- return oldspl; \
-}
-#else
-/* Set the new spl and return the old one. */
-#define SPL_BODY(new_spl) \
-{ \
- int oldspl, oldpsr, i; \
- \
- /* Get old spl. */ \
- oldspl = lda (ASI_IPR, 0) & 0xff; \
- \
- /* Do ast. */ \
- if (new_spl == 0 && ssir) \
- do_sir (); \
- \
- /* Mask all interrupts. */ \
- oldpsr = getpsr (); \
- setpsr (oldpsr | PSR_PIL); \
- \
- /* Disable IRC. */ \
- stba (ASI_IRXC, 0, 0); \
- \
- /* Wait for being disabled. */ \
- for (i = 0xfff; i; i--) \
- { \
- if (!(lduba (ASI_IRXC, 0) & SIC_IRC_E)) \
- goto done; \
- } \
- panic ("Cannot disable IRXC"); \
- \
- done: \
- sta (ASI_IPR, 0, new_spl); \
- if (!(lduba (ASI_IRXC, 0) & SIC_IRC_P)) \
- { \
- /* Enable IRXC. */ \
- stba (ASI_IRXC, 0, 1); \
- } \
- setpsr (oldpsr); \
- \
- return oldspl; \
-}
-#endif
-
-/*
- * PIL 1 through 14 can use this macro.
- * (spl0 and splhigh are special since they put all 0s or all 1s
- * into the ipl field.)
- */
-#undef SPL
-#define SPL(name, newspl) \
-int name __P((void)); \
-int name() \
-SPL_BODY(newspl, 0)
-
-SPL(splsoftint, SPL_NET)
-
-/* Block devices */
-SPL(splbio, SPL_BIO)
-
-/* network hardware interrupts are at level 6 */
-SPL(splnet, SPL_NET)
-
-/* tty input runs at software level 6 */
-SPL(spltty, SPL_TTY)
-
-/*
- * Memory allocation (must be as high as highest network, tty, or disk device)
- */
-SPL(splimp, SPL_IMP)
-
-SPL(splclock, SPL_CLOCK)
-SPL(splstatclock, SPL_CLOCK)
-
-/* zs hardware interrupts are at level 12 */
-SPL(splzs, SPL_ZS)
-
-SPL(splhigh, SPL_HIGH)
-
-int
-spl0 (void)
-{
- SPL_BODY(0, 1)
-}
-
-int splx (int newspl)
-{
- SPL_BODY(newspl, 1)
-}
-
-#if 0
-void
-disp_spl (void)
-{
- printf ("ipr = %d, hir = %d, intrdelay[135] = %d\n",
- lduba (ASI_DGRAM, 0), hir, intrdelay[135]);
-/* printf ("spl = %d\n", (getpsr() & PSR_PIL) >> 8); */
-}
-#endif
diff --git a/sys/arch/kbus/kbus/ldscript b/sys/arch/kbus/kbus/ldscript
deleted file mode 100644
index 1b4e74e83b8..00000000000
--- a/sys/arch/kbus/kbus/ldscript
+++ /dev/null
@@ -1,30 +0,0 @@
-OUTPUT_FORMAT("a.out-sunos-big", "a.out-sunos-big",
- "a.out-sunos-big")
-OUTPUT_ARCH(sparc)
-SECTIONS
-{
- . = 0xff060000;
- .text :
- {
- CREATE_OBJECT_SYMBOLS
- *(.text)
- _etext = .;
- __etext = .;
- }
- . = ALIGN(0x2000);
- .data :
- {
- *(.data)
- CONSTRUCTORS
- _edata = .;
- __edata = .;
- }
- .bss :
- {
- __bss_start = .;
- *(.bss)
- *(COMMON)
- _end = ALIGN(4) ;
- __end = ALIGN(4) ;
- }
-}
diff --git a/sys/arch/kbus/kbus/locore.s b/sys/arch/kbus/kbus/locore.s
deleted file mode 100644
index 97945eab30c..00000000000
--- a/sys/arch/kbus/kbus/locore.s
+++ /dev/null
@@ -1,4722 +0,0 @@
-/*
- * Copyright (c) 1996 Paul Kranenburg
- * Copyright (c) 1996
- * The President and Fellows of Harvard College. All rights reserved.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- * This product includes software developed by Harvard University.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * This product includes software developed by Harvard University.
- * This product includes software developed by Paul Kranenburg.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)locore.s 8.4 (Berkeley) 12/10/93
- */
-
-/* This is locore.s. */
-#define _LOCORE
-
-#include "assym.h"
-#include <machine/param.h>
-#include <machine/vmparam.h>
-#include <machine/asi.h>
-#ifdef notyet
-#include <kbus/dev/zsreg.h>
-#endif
-#include <machine/psl.h>
-#include <machine/signal.h>
-#include <machine/trap.h>
-#include <machine/pmap.h>
-#include <machine/kbus.h>
-#include <machine/sic.h>
-#include <machine/led.h>
-#ifdef COMPAT_SVR4
-#include <compat/svr4/svr4_syscall.h>
-#endif
-
-/*
- * GNU assembler does not understand `.empty' directive; Sun assembler
- * gripes about labels without it. To allow cross-compilation using
- * the Sun assembler, and because .empty directives are useful documentation,
- * we use this trick.
- */
-#ifdef SUN_AS
-#define EMPTY .empty
-#else
-#define EMPTY /* .empty */
-#endif
-
-/* use as needed to align things on longword boundaries */
-#define _ALIGN .align 4
-
-/*
- * CCFSZ (C Compiler Frame SiZe) is the size of a stack frame required if
- * a function is to call C code. It should be just 64, but Sun defined
- * their frame with space to hold arguments 0 through 5 (plus some junk),
- * and varargs routines (such as printf) demand this, and gcc uses this
- * area at times anyway.
- */
-#define CCFSZ 96
-
-/*
- * A handy macro for maintaining instrumentation counters.
- * Note that this clobbers %o0 and %o1. Normal usage is
- * something like:
- * foointr:
- * TRAP_SETUP(...) ! makes %o registers safe
- * INCR(_cnt+V_FOO) ! count a foo
- */
-#define INCR(what) \
- sethi %hi(what), %o0; \
- ld [%o0 + %lo(what)], %o1; \
- inc %o1; \
- st %o1, [%o0 + %lo(what)]
-
-/*
- * Another handy macro: load one register window, given `base' address.
- * This can be either a simple register (e.g., %sp) or include an initial
- * offset (e.g., %g6 + PCB_RW).
- */
-#define LOADWIN(addr) \
- ldd [addr], %l0; \
- ldd [addr + 8], %l2; \
- ldd [addr + 16], %l4; \
- ldd [addr + 24], %l6; \
- ldd [addr + 32], %i0; \
- ldd [addr + 40], %i2; \
- ldd [addr + 48], %i4; \
- ldd [addr + 56], %i6
-
-/*
- * To return from trap we need the two-instruction sequence
- * `jmp %l1; rett %l2', which is defined here for convenience.
- */
-#define RETT jmp %l1; rett %l2
-
- .data
- .align NBPG
-/*
- * The interrupt stack.
- *
- * This is the very first thing in the data segment, and therefore has
- * the lowest kernel stack address. We count on this in the interrupt
- * trap-frame setup code, since we may need to switch from the kernel
- * stack to the interrupt stack (iff we are not already on the interrupt
- * stack). One sethi+cmp is all we need since this is so carefully
- * arranged.
- */
- .globl _intstack
- .globl _eintstack
-_intstack:
- .skip 128 * 128 ! 16k = 128 128-byte stack frames
-_eintstack:
-
-/*
- * When a process exits and its u. area goes away, we set cpcb to point
- * to this `u.', leaving us with something to use for an interrupt stack,
- * and letting all the register save code have a pcb_uw to examine.
- * This is also carefully arranged (to come just before u0, so that
- * process 0's kernel stack can quietly overrun into it during bootup, if
- * we feel like doing that).
- *
- * Note: since the u. are remapped, this must be page-aligned. This is done
- * by the linker, which align the data segment (see ldscript).
- */
-! .globl _idle_u
-_idle_u:
- .skip USPACE
-
-/*
- * Process 0's u.
- *
- * This must be aligned on an 8 byte boundary.
- */
-! .globl _u0
-_u0: .skip USPACE
-! estack0:
-
-#ifdef KGDB
-/*
- * Another item that must be aligned, easiest to put it here.
- */
-KGDB_STACK_SIZE = 2048
- .globl _kgdb_stack
-_kgdb_stack:
- .skip KGDB_STACK_SIZE ! hope this is enough
-#endif
-
-/*
- * _cpcb points to the current pcb (and hence u. area).
- * Initially this is the special one.
- */
-! .globl _cpcb
-! _cpcb: .word _u0
-
-/*
- * _cpumod is the current cpu model, used to distinguish between variants
- * in the Sun4 and Sun4M families. See /sys/arch/kbus/include/param.h for
- * possible values.
- */
-! .globl _cpumod
-!_cpumod:
-! .word 1
-
- _ALIGN
-
- .text
-
-/*
- * The first thing in the real text segment is the trap vector table,
- * which must be aligned on a 4096 byte boundary. The text segment
- * starts beyond page 0 of KERNBASE so that there is a red zone
- * between user and kernel space. Since the boot ROM loads us at
- * 0x4000, it is far easier to start at KERNBASE+0x4000 than to
- * buck the trend. This is two or four pages in (depending on if
- * pagesize is 8192 or 4096). We place two items in this area:
- * the message buffer (phys addr 0) and the IE_reg (phys addr 0x2000).
- * because the message buffer is in our "red zone" between user and
- * kernel space we remap it in configure() to another location and
- * invalidate the mapping at KERNBASE.
- */
-/* .globl _msgbuf
-_msgbuf = KERNBASE */
-
-/*
- * Each trap has room for four instructions, of which one perforce must
- * be a branch. On entry the hardware has copied pc and npc to %l1 and
- * %l2 respectively. We use two more to read the psr into %l0, and to
- * put the trap type value into %l3 (with a few exceptions below).
- * We could read the trap type field of %tbr later in the code instead,
- * but there is no need, and that would require more instructions
- * (read+mask, vs 1 `mov' here).
- *
- * I used to generate these numbers by address arithmetic, but gas's
- * expression evaluator has about as much sense as your average slug
- * (oddly enough, the code looks about as slimy too). Thus, all the
- * trap numbers are given as arguments to the trap macros. This means
- * there is one line per trap. Sigh.
- *
- * Note that only the local registers may be used, since the trap
- * window is potentially the last window. Its `in' registers are
- * the previous window's outs (as usual), but more important, its
- * `out' registers may be in use as the `topmost' window's `in' registers.
- * The global registers are of course verboten (well, until we save
- * them away).
- *
- * Hardware interrupt vectors can be `linked'---the linkage is to regular
- * C code---or rewired to fast in-window handlers. The latter are good
- * for unbuffered hardware like the Zilog serial chip and the AMD audio
- * chip, where many interrupts can be handled trivially with pseudo-DMA or
- * similar. Only one `fast' interrupt can be used per level, however, and
- * direct and `fast' interrupts are incompatible. Routines in intr.c
- * handle setting these, with optional paranoia.
- */
-
- /* regular vectored traps */
-#define VTRAP(type, label) \
- mov (type), %l3; b label; mov %psr, %l0; nop
-
- /* hardware interrupts (can be linked or made `fast') */
-#define HARDINT(lev) \
- mov (lev), %l3; b _sparc_interrupt; mov %psr, %l0; nop
-
- /* traps that just call trap() */
-#define TRAP(type) VTRAP(type, slowtrap)
-
- /* architecturally undefined traps (cause panic) */
-#define UTRAP(type) VTRAP(type, slowtrap)
-
- /* software undefined traps (may be replaced) */
-#define STRAP(type) VTRAP(type, slowtrap)
-
-/* breakpoint acts differently under kgdb */
-#ifdef KGDB
-#define BPT VTRAP(T_BREAKPOINT, bpt)
-#define BPT_KGDB_EXEC VTRAP(T_KGDB_EXEC, bpt)
-#else
-#define BPT TRAP(T_BREAKPOINT)
-#define BPT_KGDB_EXEC TRAP(T_KGDB_EXEC)
-#endif
-
-/* special high-speed 1-instruction-shaved-off traps (get nothing in %l3) */
-#define SYSCALL b syscall; mov %psr, %l0; nop; nop
-#define WINDOW_OF b window_of; mov %psr, %l0; nop; nop
-#define WINDOW_UF b window_uf; mov %psr, %l0; nop; nop
-#ifdef notyet
-#define ZS_INTERRUPT b zshard; mov %psr, %l0; nop; nop
-#else
-#define ZS_INTERRUPT44C HARDINT44C(12)
-#define ZS_INTERRUPT4M HARDINT4M(12)
-#endif
-
- .globl start, _kernel_text
- _kernel_text = start ! for kvm_mkdb(8)
-start:
-trapbase:
- /* trap 0 is special since we cannot receive it */
- b dostart; nop; nop; nop ! 00 = reset (fake)
- VTRAP(T_TEXTFAULT, text_fault) ! 01 = instr. fetch fault
- TRAP(T_ILLINST) ! 02 = illegal instruction
- TRAP(T_PRIVINST) ! 03 = privileged instruction
- TRAP(T_FPDISABLED) ! 04 = fp instr, but EF bit off in psr
- WINDOW_OF ! 05 = window overflow
- WINDOW_UF ! 06 = window underflow
- TRAP(T_ALIGN) ! 07 = address alignment error
- VTRAP(T_FPE, fp_exception) ! 08 = fp exception
- VTRAP(T_DATAFAULT, data_fault) ! 09 = data fetch fault
- TRAP(T_TAGOF) ! 0a = tag overflow
- UTRAP(0x0b)
- UTRAP(0x0c)
- UTRAP(0x0d)
- UTRAP(0x0e)
- UTRAP(0x0f)
- UTRAP(0x10)
- VTRAP(1, bad_interrupt) ! 11 = level 1 interrupt
- VTRAP(2, bad_interrupt) ! 12 = level 2 interrupt
- VTRAP(3, bad_interrupt) ! 13 = level 3 interrupt
- VTRAP(4, bad_interrupt) ! 14 = level 4 interrupt
- VTRAP(5, bad_interrupt) ! 15 = level 5 interrupt
- VTRAP(6, bad_interrupt) ! 16 = level 6 interrupt
- VTRAP(7, bad_interrupt) ! 17 = level 7 interrupt
- VTRAP(8, bad_interrupt) ! 18 = level 8 interrupt
- VTRAP(9, bad_interrupt) ! 19 = level 9 interrupt
- VTRAP(10, bad_interrupt) ! 20 = level 10 interrupt
- VTRAP(11, bad_interrupt) ! 21 = level 11 interrupt
- VTRAP(12, sic_interrupt) ! 1c = level 12 (sic) interrupt
- VTRAP(13, bad_interrupt) ! 23 = level 13 interrupt
- VTRAP(14, bad_interrupt) ! 24 = level 14 interrupt
- VTRAP(15, nmi) ! 1f = nonmaskable interrupt
- UTRAP(0x20)
- UTRAP(0x21)
- UTRAP(0x22)
- UTRAP(0x23)
- TRAP(T_CPDISABLED) ! 24 = coprocessor instr, EC bit off in psr
- UTRAP(0x25)
- UTRAP(0x26)
- UTRAP(0x27)
- TRAP(T_CPEXCEPTION) ! 28 = coprocessor exception
- UTRAP(0x29)
- UTRAP(0x2a)
- UTRAP(0x2b)
- UTRAP(0x2c)
- UTRAP(0x2d)
- UTRAP(0x2e)
- UTRAP(0x2f)
- UTRAP(0x30)
- UTRAP(0x31)
- UTRAP(0x32)
- UTRAP(0x33)
- UTRAP(0x34)
- UTRAP(0x35)
- UTRAP(0x36)
- UTRAP(0x37)
- UTRAP(0x38)
- UTRAP(0x39)
- UTRAP(0x3a)
- UTRAP(0x3b)
- UTRAP(0x3c)
- UTRAP(0x3d)
- UTRAP(0x3e)
- UTRAP(0x3f)
- UTRAP(0x40)
- UTRAP(0x41)
- UTRAP(0x42)
- UTRAP(0x43)
- UTRAP(0x44)
- UTRAP(0x45)
- UTRAP(0x46)
- UTRAP(0x47)
- UTRAP(0x48)
- UTRAP(0x49)
- UTRAP(0x4a)
- UTRAP(0x4b)
- UTRAP(0x4c)
- UTRAP(0x4d)
- UTRAP(0x4e)
- UTRAP(0x4f)
- UTRAP(0x50)
- UTRAP(0x51)
- UTRAP(0x52)
- UTRAP(0x53)
- UTRAP(0x54)
- UTRAP(0x55)
- UTRAP(0x56)
- UTRAP(0x57)
- UTRAP(0x58)
- UTRAP(0x59)
- UTRAP(0x5a)
- UTRAP(0x5b)
- UTRAP(0x5c)
- UTRAP(0x5d)
- UTRAP(0x5e)
- UTRAP(0x5f)
- UTRAP(0x60)
- UTRAP(0x61)
- UTRAP(0x62)
- UTRAP(0x63)
- UTRAP(0x64)
- UTRAP(0x65)
- UTRAP(0x66)
- UTRAP(0x67)
- UTRAP(0x68)
- UTRAP(0x69)
- UTRAP(0x6a)
- UTRAP(0x6b)
- UTRAP(0x6c)
- UTRAP(0x6d)
- UTRAP(0x6e)
- UTRAP(0x6f)
- UTRAP(0x70)
- UTRAP(0x71)
- UTRAP(0x72)
- UTRAP(0x73)
- UTRAP(0x74)
- UTRAP(0x75)
- UTRAP(0x76)
- UTRAP(0x77)
- UTRAP(0x78)
- UTRAP(0x79)
- UTRAP(0x7a)
- UTRAP(0x7b)
- UTRAP(0x7c)
- UTRAP(0x7d)
- UTRAP(0x7e)
- UTRAP(0x7f)
- SYSCALL ! 80 = sun syscall
- BPT ! 81 = pseudo breakpoint instruction
- TRAP(T_DIV0) ! 82 = divide by zero
- TRAP(T_FLUSHWIN) ! 83 = flush windows
- TRAP(T_CLEANWIN) ! 84 = provide clean windows
- TRAP(T_RANGECHECK) ! 85 = ???
- TRAP(T_FIXALIGN) ! 86 = fix up unaligned accesses
- TRAP(T_INTOF) ! 87 = integer overflow
- SYSCALL ! 88 = svr4 syscall
- SYSCALL ! 89 = bsd syscall
- BPT_KGDB_EXEC ! 8a = enter kernel gdb on kernel startup
- STRAP(0x8b)
- STRAP(0x8c)
- STRAP(0x8d)
- STRAP(0x8e)
- STRAP(0x8f)
- STRAP(0x90)
- STRAP(0x91)
- STRAP(0x92)
- STRAP(0x93)
- STRAP(0x94)
- STRAP(0x95)
- STRAP(0x96)
- STRAP(0x97)
- STRAP(0x98)
- STRAP(0x99)
- STRAP(0x9a)
- STRAP(0x9b)
- STRAP(0x9c)
- STRAP(0x9d)
- STRAP(0x9e)
- STRAP(0x9f)
- STRAP(0xa0)
- STRAP(0xa1)
- STRAP(0xa2)
- STRAP(0xa3)
- STRAP(0xa4)
- STRAP(0xa5)
- STRAP(0xa6)
- STRAP(0xa7)
- STRAP(0xa8)
- STRAP(0xa9)
- STRAP(0xaa)
- STRAP(0xab)
- STRAP(0xac)
- STRAP(0xad)
- STRAP(0xae)
- STRAP(0xaf)
- STRAP(0xb0)
- STRAP(0xb1)
- STRAP(0xb2)
- STRAP(0xb3)
- STRAP(0xb4)
- STRAP(0xb5)
- STRAP(0xb6)
- STRAP(0xb7)
- STRAP(0xb8)
- STRAP(0xb9)
- STRAP(0xba)
- STRAP(0xbb)
- STRAP(0xbc)
- STRAP(0xbd)
- STRAP(0xbe)
- STRAP(0xbf)
- STRAP(0xc0)
- STRAP(0xc1)
- STRAP(0xc2)
- STRAP(0xc3)
- STRAP(0xc4)
- STRAP(0xc5)
- STRAP(0xc6)
- STRAP(0xc7)
- STRAP(0xc8)
- STRAP(0xc9)
- STRAP(0xca)
- STRAP(0xcb)
- STRAP(0xcc)
- STRAP(0xcd)
- STRAP(0xce)
- STRAP(0xcf)
- STRAP(0xd0)
- STRAP(0xd1)
- STRAP(0xd2)
- STRAP(0xd3)
- STRAP(0xd4)
- STRAP(0xd5)
- STRAP(0xd6)
- STRAP(0xd7)
- STRAP(0xd8)
- STRAP(0xd9)
- STRAP(0xda)
- STRAP(0xdb)
- STRAP(0xdc)
- STRAP(0xdd)
- STRAP(0xde)
- STRAP(0xdf)
- STRAP(0xe0)
- STRAP(0xe1)
- STRAP(0xe2)
- STRAP(0xe3)
- STRAP(0xe4)
- STRAP(0xe5)
- STRAP(0xe6)
- STRAP(0xe7)
- STRAP(0xe8)
- STRAP(0xe9)
- STRAP(0xea)
- STRAP(0xeb)
- STRAP(0xec)
- STRAP(0xed)
- STRAP(0xee)
- STRAP(0xef)
- STRAP(0xf0)
- STRAP(0xf1)
- STRAP(0xf2)
- STRAP(0xf3)
- STRAP(0xf4)
- STRAP(0xf5)
- STRAP(0xf6)
- STRAP(0xf7)
- STRAP(0xf8)
- STRAP(0xf9)
- STRAP(0xfa)
- STRAP(0xfb)
- STRAP(0xfc)
- STRAP(0xfd)
- STRAP(0xfe)
- STRAP(0xff)
-
-#if 0 /* def DEBUG */
-/*
- * A hardware red zone is impossible. We simulate one in software by
- * keeping a `red zone' pointer; if %sp becomes less than this, we panic.
- * This is expensive and is only enabled when debugging.
- */
-#define REDSIZE (8*96) /* some room for bouncing */
-#define REDSTACK 2048 /* size of `panic: stack overflow' region */
- .data
-_redzone:
- .word _idle_u + REDSIZE
-_redstack:
- .skip REDSTACK
- .text
-Lpanic_red:
- .asciz "stack overflow"
- _ALIGN
-
- /* set stack pointer redzone to base+minstack; alters base */
-#define SET_SP_REDZONE(base, tmp) \
- add base, REDSIZE, base; \
- sethi %hi(_redzone), tmp; \
- st base, [tmp + %lo(_redzone)]
-
- /* variant with a constant */
-#define SET_SP_REDZONE_CONST(const, tmp1, tmp2) \
- set (const) + REDSIZE, tmp1; \
- sethi %hi(_redzone), tmp2; \
- st tmp1, [tmp2 + %lo(_redzone)]
-
- /* check stack pointer against redzone (uses two temps) */
-#define CHECK_SP_REDZONE(t1, t2) \
- sethi %hi(_redzone), t1; \
- ld [t1 + %lo(_redzone)], t2; \
- cmp %sp, t2; /* if sp >= t2, not in red zone */ \
- bgeu 7f; nop; /* and can continue normally */ \
- /* move to panic stack */ \
- st %g0, [t1 + %lo(_redzone)]; \
- set _redstack + REDSTACK - 96, %sp; \
- /* prevent panic() from lowering ipl */ \
- sethi %hi(_panicstr), t2; \
- set Lpanic_red, t2; \
- st t2, [t1 + %lo(_panicstr)]; \
- rd %psr, t1; /* t1 = splhigh() */ \
- or t1, PSR_PIL, t2; \
- wr t2, 0, %psr; \
- wr t2, PSR_ET, %psr; /* turn on traps */ \
- nop; nop; nop; \
- save %sp, -CCFSZ, %sp; /* preserve current window */ \
- sethi %hi(Lpanic_red), %o0; \
- call _panic; or %o0, %lo(Lpanic_red), %o0; \
-7:
-
-#else
-
-#define SET_SP_REDZONE(base, tmp)
-#define SET_SP_REDZONE_CONST(const, t1, t2)
-#define CHECK_SP_REDZONE(t1, t2)
-#endif
-
-/*
- * The window code must verify user stack addresses before using them.
- * A user stack pointer is invalid if:
- * - it is not on an 8 byte boundary;
- * - its pages (a register window, being 64 bytes, can occupy
- * two pages) are not readable or writable.
- * We define three separate macros here for testing user stack addresses.
- *
- * PTE_OF_ADDR locates a PTE, branching to a `bad address'
- * handler if the stack pointer points into the hole in the
- * address space (i.e., top 3 bits are not either all 1 or all 0);
- * CMP_PTE_USER_READ compares the located PTE against `user read' mode;
- * CMP_PTE_USER_WRITE compares the located PTE against `user write' mode.
- * The compares give `equal' if read or write is OK.
- *
- * Note that the user stack pointer usually points into high addresses
- * (top 3 bits all 1), so that is what we check first.
- *
- * The code below also assumes that PTE_OF_ADDR is safe in a delay
- * slot; it is, at it merely sets its `pte' register to a temporary value.
- */
- /* input: addr, output: pte; bad: bad address label */
- /* Nb: addr can't be modified. */
-#define PTE_OF_ADDR(addr, pte, tmp, bad) \
- lda [%g0](ASI_PDBA), tmp; \
- srl addr, PD_SHIFT, pte; \
- sll pte, PDE_SIZE_SHIFT, pte; \
- ld [tmp + pte], pte; /* pte is in fact a pde. */ \
- btst PD_V, pte; /* Is it valid ? */ \
- bz bad; \
- sethi %hi(SERIES5_TLBMISS_TMP), tmp; \
- or pte, PG_WINDOW, pte; \
- sta pte, [tmp](ASI_FGTLB_VALD); \
- srl addr, PG_SHIFT, pte; /* addr to pte index. */ \
- and pte, PT_MASK >> PG_SHIFT, pte; \
- sll pte, PTE_SIZE_SHIFT, pte; \
- ld [tmp + pte], pte /* pte index to pte. */
-
- /* input: pte; output: condition codes */
-#define CMP_PTE_USER_READ(pte) \
- and pte, PG_V | PG_u | PG_IO, pte; \
- cmp pte, PG_V | PG_u
-
- /* input: pte; output: condition codes */
-#define CMP_PTE_USER_WRITE(pte) \
- and pte, PG_V | PG_u | PG_IO | PG_RO, pte; \
- cmp pte, PG_V | PG_u
-
-/*
- * The calculations in PTE_OF_ADDR and CMP_PTE_USER_* are rather slow:
- * in particular, according to Gordon Irlam of the University of Adelaide
- * in Australia, these consume at least 18 cycles on an SS1 and 37 on an
- * SS2. Hence, we try to avoid them in the common case.
- *
- * A chunk of 64 bytes is on a single page if and only if:
- *
- * ((base + 64 - 1) & ~(NBPG-1)) == (base & ~(NBPG-1))
- *
- * Equivalently (and faster to test), the low order bits (base & 4095) must
- * be small enough so that the sum (base + 63) does not carry out into the
- * upper page-address bits, i.e.,
- *
- * (base & (NBPG-1)) < (NBPG - 63)
- *
- * so we allow testing that here. This macro is also assumed to be safe
- * in a delay slot (modulo overwriting its temporary).
- */
-#define SLT_IF_1PAGE_RW(addr, tmp, tmp1) \
- sethi %hi(~PGOFSET), tmp1; \
- andn addr, tmp1, tmp; \
- set PGOFSET - 62, tmp1; \
- cmp tmp, tmp1
-
-/*
- * Every trap that enables traps must set up stack space.
- * If the trap is from user mode, this involves switching to the kernel
- * stack for the current process, and we must also set cpcb->pcb_uw
- * so that the window overflow handler can tell user windows from kernel
- * windows.
- *
- * The number of user windows is:
- *
- * cpcb->pcb_uw = (cpcb->pcb_wim - 1 - CWP) % nwindows
- *
- * (where pcb_wim = log2(current %wim) and CWP = low 5 bits of %psr).
- * We compute this expression by table lookup in uwtab[CWP - pcb_wim],
- * which has been set up as:
- *
- * for i in [-nwin+1 .. nwin-1]
- * uwtab[i] = (nwin - 1 - i) % nwin;
- *
- * (If you do not believe this works, try it for yourself.)
- *
- * We also keep one or two more tables:
- *
- * for i in 0..nwin-1
- * wmask[i] = 1 << ((i + 1) % nwindows);
- *
- * wmask[CWP] tells whether a `rett' would return into the invalid window.
- */
- .data
- .skip 32 ! alignment byte & negative indicies
-uwtab: .skip 32 ! u_char uwtab[-31..31];
-wmask: .skip 32 ! u_char wmask[0..31];
-
- .text
-/*
- * Things begin to grow uglier....
- *
- * Each trap handler may (always) be running in the trap window.
- * If this is the case, it cannot enable further traps until it writes
- * the register windows into the stack (or, if the stack is no good,
- * the current pcb).
- *
- * ASSUMPTIONS: TRAP_SETUP() is called with:
- * %l0 = %psr
- * %l1 = return pc
- * %l2 = return npc
- * %l3 = (some value that must not be altered)
- * which means we have 4 registers to work with.
- *
- * The `stackspace' argument is the number of stack bytes to allocate
- * for register-saving, and must be at least -64 (and typically more,
- * for global registers and %y).
- *
- * Trapframes should use -CCFSZ-80. (80 = sizeof(struct trapframe);
- * see trap.h. This basically means EVERYONE. Interrupt frames could
- * get away with less, but currently do not.)
- *
- * The basic outline here is:
- *
- * if (trap came from kernel mode) {
- * if (we are in the trap window)
- * save it away;
- * %sp = %fp - stackspace;
- * } else {
- * compute the number of user windows;
- * if (we are in the trap window)
- * save it away;
- * %sp = (top of kernel stack) - stackspace;
- * }
- *
- * Again, the number of user windows is:
- *
- * cpcb->pcb_uw = (cpcb->pcb_wim - 1 - CWP) % nwindows
- *
- * (where pcb_wim = log2(current %wim) and CWP is the low 5 bits of %psr),
- * and this is computed as `uwtab[CWP - pcb_wim]'.
- *
- * NOTE: if you change this code, you will have to look carefully
- * at the window overflow and underflow handlers and make sure they
- * have similar changes made as needed.
- */
-#define CALL_CLEAN_TRAP_WINDOW \
- sethi %hi(clean_trap_window), %l7; \
- jmpl %l7 + %lo(clean_trap_window), %l4; \
- mov %g7, %l7 /* save %g7 in %l7 for clean_trap_window */
-
-#define TRAP_SETUP(stackspace) \
- rd %wim, %l4; \
- mov 1, %l5; \
- sll %l5, %l0, %l5; \
- btst PSR_PS, %l0; \
- bz 1f; \
- btst %l5, %l4; \
- /* came from kernel mode; cond codes indicate trap window */ \
- bz,a 3f; \
- add %fp, stackspace, %sp; /* want to just set %sp */ \
- CALL_CLEAN_TRAP_WINDOW; /* but maybe need to clean first */ \
- b 3f; \
- add %fp, stackspace, %sp; \
-1: \
- /* came from user mode: compute pcb_nw */ \
- sethi UADDR, %l6; \
- ld [%l6 + PCB_WIM], %l5; \
- and %l0, 31, %l4; \
- sub %l4, %l5, %l5; \
- set uwtab, %l4; \
- ldub [%l4 + %l5], %l5; \
- st %l5, [%l6 + PCB_UW]; \
- /* cond codes still indicate whether in trap window */ \
- bz,a 2f; \
- sethi %hi(USPACE+(stackspace)), %l5; \
- /* yes, in trap window; must clean it */ \
- CALL_CLEAN_TRAP_WINDOW; \
- sethi UADDR, %l6; \
- sethi %hi(USPACE+(stackspace)), %l5; \
-2: \
- /* trap window is (now) clean: set %sp */ \
- or %l5, %lo(USPACE+(stackspace)), %l5; \
- add %l6, %l5, %sp; \
- SET_SP_REDZONE(%l6, %l5); \
-3: \
- CHECK_SP_REDZONE(%l6, %l5)
-
-/*
- * Interrupt setup is almost exactly like trap setup, but we need to
- * go to the interrupt stack if (a) we came from user mode or (b) we
- * came from kernel mode on the kernel stack.
- */
-#define INTR_SETUP(stackspace) \
- rd %wim, %l4; \
- mov 1, %l5; \
- sll %l5, %l0, %l5; \
- btst PSR_PS, %l0; \
- bz 1f; \
- btst %l5, %l4; \
- /* came from kernel mode; cond codes still indicate trap window */ \
- bz,a 0f; \
- sethi %hi(_eintstack), %l7; \
- CALL_CLEAN_TRAP_WINDOW; \
- sethi %hi(_eintstack), %l7; \
-0: /* now if %fp >= eintstack, we were on the kernel stack */ \
- cmp %fp, %l7; \
- bge,a 3f; \
- add %l7, stackspace, %sp; /* so switch to intstack */ \
- b 4f; \
- add %fp, stackspace, %sp; /* else stay on intstack */ \
-1: \
- /* came from user mode: compute pcb_nw */ \
- sethi UADDR, %l6; \
- ld [%l6 + PCB_WIM], %l5; \
- and %l0, 31, %l4; \
- sub %l4, %l5, %l5; \
- set uwtab, %l4; \
- ldub [%l4 + %l5], %l5; \
- st %l5, [%l6 + PCB_UW]; \
- /* cond codes still indicate whether in trap window */ \
- bz,a 2f; \
- sethi %hi(_eintstack), %l7; \
- /* yes, in trap window; must save regs */ \
- CALL_CLEAN_TRAP_WINDOW; \
- sethi %hi(_eintstack), %l7; \
-2: \
- add %l7, stackspace, %sp; \
-3: \
- SET_SP_REDZONE_CONST(_intstack, %l6, %l5); \
-4: \
- CHECK_SP_REDZONE(%l6, %l5)
-
-/*
- * Handler for making the trap window shiny clean.
- *
- * On entry:
- * cpcb->pcb_nw = number of user windows
- * %l0 = %psr
- * %l1 must not be clobbered
- * %l2 must not be clobbered
- * %l3 must not be clobbered
- * %l4 = address for `return'
- * %l7 = saved %g7 (we put this in a delay slot above, to save work)
- *
- * On return:
- * %wim has changed, along with cpcb->pcb_wim
- * %g7 has been restored
- *
- * Normally, we push only one window.
- */
-clean_trap_window:
- mov %g5, %l5 ! save %g5
- mov %g6, %l6 ! ... and %g6
-/* mov %g7, %l7 ! ... and %g7 (already done for us) */
- sethi UADDR, %g6 ! get current pcb
-
- /* Figure out whether it is a user window (cpcb->pcb_uw > 0). */
- ld [%g6 + PCB_UW], %g7
- deccc %g7
- bge ctw_user
- save %g0, %g0, %g0 ! in any case, enter window to save
-
- /* The window to be pushed is a kernel window. */
- std %l0, [%sp + (0*8)]
- std %l2, [%sp + (1*8)]
- std %l4, [%sp + (2*8)]
- std %l6, [%sp + (3*8)]
- std %i0, [%sp + (4*8)]
- std %i2, [%sp + (5*8)]
- std %i4, [%sp + (6*8)]
- std %i6, [%sp + (7*8)]
-
- /* Set up new window invalid mask, and update cpcb->pcb_wim. */
- rd %psr, %g7 ! g7 = (junk << 5) + new_cwp
- mov 1, %g5 ! g5 = 1 << new_cwp;
- sll %g5, %g7, %g5
- wr %g5, 0, %wim ! setwim(g5);
-/*1*/ and %g7, 31, %g7 ! cpcb->pcb_wim = g7 & 31;
-/*2*/ sethi UADDR, %g6 ! re-get current pcb
-/*3*/ st %g7, [%g6 + PCB_WIM]
- nop
- restore ! back to trap window
-
- mov %l5, %g5 ! restore g5
- mov %l6, %g6 ! ... and g6
- jmp %l4 + 8 ! return to caller
- mov %l7, %g7 ! ... and g7
- /* NOTREACHED */
-
-ctw_user:
- /*
- * The window to be pushed is a user window.
- * We must verify the stack pointer (alignment & permissions).
- * See comments above definition of PTE_OF_ADDR.
- */
- st %g7, [%g6 + PCB_UW] ! cpcb->pcb_uw--;
-
- /*
- * Save ALL user windows into the pcb.
- * We will notice later that we did this, when we
- * get ready to return from our trap or syscall.
- *
- * Reread cpcb->pcb_uw. We decremented this earlier,
- * so it is off by one.
- */
- sethi UADDR, %g6 ! re-get current pcb
-
- ld [%g6 + PCB_UW], %g7 ! (number of user windows) - 1
- add %g6, PCB_RW, %g5
-
- /* save g7+1 windows, starting with the current one */
-1: ! do {
- std %l0, [%g5 + (0*8)] ! rw->rw_local[0] = l0;
- std %l2, [%g5 + (1*8)] ! ...
- std %l4, [%g5 + (2*8)]
- std %l6, [%g5 + (3*8)]
- std %i0, [%g5 + (4*8)]
- std %i2, [%g5 + (5*8)]
- std %i4, [%g5 + (6*8)]
- std %i6, [%g5 + (7*8)]
- deccc %g7 ! if (n > 0) save(), rw++;
- bge,a 1b ! } while (--n >= 0);
- save %g5, 64, %g5
-
- /* stash sp for bottommost window */
- st %sp, [%g5 + 64 + (7*8)]
-
- /* set up new wim */
- rd %psr, %g7 ! g7 = (junk << 5) + new_cwp;
- mov 1, %g5 ! g5 = 1 << new_cwp;
- sll %g5, %g7, %g5
- wr %g5, 0, %wim ! wim = g5;
- and %g7, 31, %g7
- st %g7, [%g6 + PCB_WIM] ! cpcb->pcb_wim = new_cwp;
-
- /* fix up pcb fields */
- ld [%g6 + PCB_UW], %g7 ! n = cpcb->pcb_uw;
- add %g7, 1, %g5
- st %g5, [%g6 + PCB_NSAVED] ! cpcb->pcb_nsaved = n + 1;
- st %g0, [%g6 + PCB_UW] ! cpcb->pcb_uw = 0;
-
- /* return to trap window */
-1: deccc %g7 ! do {
- bge 1b ! restore();
- restore ! } while (--n >= 0);
-
- mov %l5, %g5 ! restore g5, g6, & g7, and return
- mov %l6, %g6
- jmp %l4 + 8
- mov %l7, %g7
- /* NOTREACHED */
-
-
-/*
- * Each memory access (text or data) fault, from user or kernel mode,
- * comes here. We read the error register and figure out what has
- * happened.
- *
- * This cannot be done from C code since we must not enable traps (and
- * hence may not use the `save' instruction) until we have decided that
- * the error is or is not an asynchronous one that showed up after a
- * synchronous error, but which must be handled before the sync err.
- *
- * Most memory faults are user mode text or data faults, which can cause
- * signal delivery or ptracing, for which we must build a full trapframe.
- * It does not seem worthwhile to work to avoid this in the other cases,
- * so we store all the %g registers on the stack immediately.
- *
- * On entry:
- * %l0 = %psr
- * %l1 = return pc
- * %l2 = return npc
- * %l3 = T_TEXTFAULT or T_DATAFAULT
- *
- * Internal:
- * %l4 = %y, until we call mem_access_fault (then onto trapframe)
- * %l5 = IE_reg_addr, if async mem error
- *
- */
-
-text_fault:
- ! Read the fault cause register.
- ! If the cause is a data tlb miss, solve it.
- ! Otherwise, go to mem_fault.
- lda [%g0] (ASI_FCR), %l7
- btst FCR_TLB_MISS, %l7
- bne,a have_text_tlbmiss
- lda [%g0] (ASI_PDBA), %l3
- b mem_fault
- mov T_TEXTFAULT, %l3
-have_text_tlbmiss:
- ! Read the virtual address.
- lda [%g0] (ASI_FVAR), %l4
- ! Load the pte of the page table.
- srl %l4, PD_SHIFT, %l5
- sll %l5, 2, %l5
- ld [%l3 + %l5], %l6
- ! Is it valid ?
- btst PD_V, %l6
- bz,a mem_fault
- mov T_TEXTFAULT, %l3
- ! Load the pte of the page.
- sethi %hi(SERIES5_TLBMISS_TMP), %l7
- or %l6, PG_WINDOW, %l6
- sta %l6, [%l7] (ASI_FGTLB_VALD)
- ! Load the pte
- srl %l4, PG_SHIFT, %l5
- and %l5, PT_MASK >> PG_SHIFT, %l5
- sll %l5, 2, %l5
- ld [%l7 + %l5], %l6
- ! Set used flag.
- or %l6, PG_U, %l6
- st %l6, [%l7 + %l5]
- ! Do it now
- wr %l0, %g0, %psr
- ! Put it in the TLB.
- andn %l4, 3, %l4
- sta %l6, [%l4] (ASI_FGTLB_VALI)
- ! Return
- jmp %l1
- rett %l2
-
-data_fault:
- ! Read the fault cause register.
- ! If the cause is a data tlb miss, solve it.
- ! If the cause is a page modification, set the bit.
- ! Otherwise, go to mem_fault.
- lda [%g0] (ASI_FCR), %l7
- btst FCR_TLB_MISS, %l7
- bne,a have_data_tlbmiss
- lda [%g0] (ASI_PDBA), %l3
- btst FCR_WRITE_PROT, %l7
- bne,a have_data_wp
- lda [%g0] (ASI_PDBA), %l3
- b mem_fault
- mov T_DATAFAULT, %l3
-have_data_tlbmiss:
- ! Read the virtual address.
- lda [%g0] (ASI_FVAR), %l4
- ! Load the pde.
- srl %l4, PD_SHIFT, %l5
- sll %l5, 2, %l5
- ld [%l3 + %l5], %l6
- ! Is it valid ?
- btst PD_V, %l6
- bz,a mem_fault
- mov T_DATAFAULT | 0x100, %l3
- ! Load the pte of the page.
- sethi SERIES5_TLBMISS_TMP, %l7
- or %l6, PG_WINDOW, %l6
- sta %l6, [%l7] (ASI_FGTLB_VALD)
- ! Load the pte
- srl %l4, PG_SHIFT, %l5
- and %l5, PT_MASK >> PG_SHIFT, %l5
- sll %l5, 2, %l5
- ld [%l7 + %l5], %l6
- ! Set used flag.
- or %l6, PG_U, %l6
- st %l6, [%l7 + %l5]
- ! Do it now
- wr %l0, %g0, %psr
- ! Put it in the TLB.
- andn %l4, 3, %l4
- sta %l6, [%l4] (ASI_FGTLB_VALD)
- ! Return
- jmp %l1
- rett %l2
-have_data_wp:
- ! Read the virtual address.
- lda [%g0] (ASI_FVAR), %l4
- ! Load the pte of the page table.
- srl %l4, PD_SHIFT, %l5
- sll %l5, 2, %l5
- ld [%l3 + %l5], %l6
- ! Is it valid ?
- btst PD_V, %l6
- bz,a mem_fault
- mov T_DATAFAULT | 0x200, %l3
- ! Load the pte of the page.
- sethi %hi(SERIES5_TLBMISS_TMP), %l7
- or %l6, PG_WINDOW, %l6
- sta %l6, [%l7] (ASI_FGTLB_VALD)
- ! Load the pte
- srl %l4, PG_SHIFT, %l5
- and %l5, PT_MASK >> PG_SHIFT, %l5
- sll %l5, 2, %l5
- ld [%l7 + %l5], %l6
- ! Test the RO flag
- btst PG_RO, %l6
- bz,a have_data_modified
- or %l6, PG_M, %l6
- b mem_fault
- mov T_DATAFAULT | 0x300, %l3
-have_data_modified:
- ! Put it in the memory.
- st %l6, [%l7 + %l5]
- ! Do it now.
- wr %l0, %g0, %psr
- ! Modify the TLB.
- andn %l6, PG_HRO, %l6
- andn %l4, 3, %l4
- sta %l6, [%l4] (ASI_FGTLB_VALD)
- ! Return
- jmp %l1
- rett %l2
-
-mem_fault:
- lda [%g0] (ASI_FVAR), %g0 ! Read it now to allow writing to mem.
-
- TRAP_SETUP(-CCFSZ-80)
- INCR(_cnt+V_FAULTS) ! cnt.v_faults++ (clobbers %o0,%o1)
-
- st %g1, [%sp + CCFSZ + 20] ! save g1
- rd %y, %l4 ! save y
-
- std %g2, [%sp + CCFSZ + 24] ! save g2, g3
- lda [%g0] (ASI_FCR), %o1 ! Fault cause reg
- std %g4, [%sp + CCFSZ + 32] ! (sneak g4,g5 in here)
- lda [%g0] (ASI_FVAR), %o2 ! virt addr
- btst FCR_ECCM, %o1 ! memory error?
- std %g6, [%sp + CCFSZ + 40]
- bz,a normal_mem_fault ! no, just a regular fault
- wr %l0, PSR_ET, %psr ! (and reenable traps)
-
- /*
- * We got a ECC memory error. It could be one that
-
- * Now reenable traps and call C code.
- * %o1 through %o4 still hold the error reg contents.
- * If memerr() returns, return from the trap.
- */
- wr %l0, PSR_ET, %psr
- clr %o3
- clr %o4
- call _memerr ! memerr(0, ser, sva, 0, 0)
- clr %o0
-
- ld [%sp + CCFSZ + 20], %g1 ! restore g1 through g7
- wr %l0, 0, %psr ! and disable traps, 3 instr delay
- ldd [%sp + CCFSZ + 24], %g2
- ldd [%sp + CCFSZ + 32], %g4
- ldd [%sp + CCFSZ + 40], %g6
- b return_from_trap
- wr %l4, 0, %y ! restore y
-
-normal_mem_fault:
- /*
- * Trap was some other error; call C code to deal with it.
- * Must finish trap frame (psr,pc,npc,%y,%o0..%o7) in case
- * we decide to deliver a signal or ptrace the process.
- * %g1..%g7 were already set up above.
- */
- std %l0, [%sp + CCFSZ + 0] ! set tf.tf_psr, tf.tf_pc
- mov %l3, %o0 ! (argument: type)
- st %l2, [%sp + CCFSZ + 8] ! set tf.tf_npc
- st %l4, [%sp + CCFSZ + 12] ! set tf.tf_y
- mov %l1, %o3 ! (argument: pc)
- std %i0, [%sp + CCFSZ + 48] ! tf.tf_out[0], etc
- std %i2, [%sp + CCFSZ + 56]
- mov %l0, %o4 ! (argument: psr)
- std %i4, [%sp + CCFSZ + 64]
- std %i6, [%sp + CCFSZ + 72]
-! ld [%sp + CCFSZ + 20], %g1
- call _mem_access_fault ! mem_access_fault(type, fcr, fvar,
- ! pc, psr, &tf);
- add %sp, CCFSZ, %o5 ! (argument: &tf)
-
- ldd [%sp + CCFSZ + 0], %l0 ! load new values
- ldd [%sp + CCFSZ + 8], %l2
- wr %l3, 0, %y
- ld [%sp + CCFSZ + 20], %g1
- ldd [%sp + CCFSZ + 24], %g2
- ldd [%sp + CCFSZ + 32], %g4
- ldd [%sp + CCFSZ + 40], %g6
- ldd [%sp + CCFSZ + 48], %i0
- ldd [%sp + CCFSZ + 56], %i2
- ldd [%sp + CCFSZ + 64], %i4
- ldd [%sp + CCFSZ + 72], %i6
-
- b return_from_trap ! go return
- wr %l0, 0, %psr ! (but first disable traps again)
-
-
-/*
- * fp_exception has to check to see if we are trying to save
- * the FP state, and if so, continue to save the FP state.
- *
- * We do not even bother checking to see if we were in kernel mode,
- * since users have no access to the special_fp_store instruction.
- *
- * This whole idea was stolen from Sprite.
- */
-fp_exception:
- set special_fp_store, %l4 ! see if we came from the special one
- cmp %l1, %l4 ! pc == special_fp_store?
- bne slowtrap ! no, go handle per usual
- EMPTY
- sethi %hi(savefpcont), %l4 ! yes, "return" to the special code
- or %lo(savefpcont), %l4, %l4
- jmp %l4
- rett %l4 + 4
-
-/*
- * slowtrap() builds a trap frame and calls trap().
- * This is called `slowtrap' because it *is*....
- * We have to build a full frame for ptrace(), for instance.
- *
- * Registers:
- * %l0 = %psr
- * %l1 = return pc
- * %l2 = return npc
- * %l3 = trap code
- */
-slowtrap:
- TRAP_SETUP(-CCFSZ-80)
- /*
- * Phew, ready to enable traps and call C code.
- */
-slowtrap1:
- mov %l3, %o0 ! put type in %o0 for later
-Lslowtrap_reenter:
- wr %l0, PSR_ET, %psr ! traps on again
- std %l0, [%sp + CCFSZ] ! tf.tf_psr = psr; tf.tf_pc = ret_pc;
- rd %y, %l3
- std %l2, [%sp + CCFSZ + 8] ! tf.tf_npc = return_npc; tf.tf_y = %y;
- st %g1, [%sp + CCFSZ + 20]
- std %g2, [%sp + CCFSZ + 24]
- std %g4, [%sp + CCFSZ + 32]
- std %g6, [%sp + CCFSZ + 40]
- std %i0, [%sp + CCFSZ + 48]
- mov %l0, %o1 ! (psr)
- std %i2, [%sp + CCFSZ + 56]
- mov %l1, %o2 ! (pc)
- std %i4, [%sp + CCFSZ + 64]
- add %sp, CCFSZ, %o3 ! (&tf)
- call _trap ! trap(type, psr, pc, &tf)
- std %i6, [%sp + CCFSZ + 72]
-
- ldd [%sp + CCFSZ], %l0 ! load new values
- ldd [%sp + CCFSZ + 8], %l2
- wr %l3, 0, %y
- ld [%sp + CCFSZ + 20], %g1
- ldd [%sp + CCFSZ + 24], %g2
- ldd [%sp + CCFSZ + 32], %g4
- ldd [%sp + CCFSZ + 40], %g6
- ldd [%sp + CCFSZ + 48], %i0
- ldd [%sp + CCFSZ + 56], %i2
- ldd [%sp + CCFSZ + 64], %i4
- ldd [%sp + CCFSZ + 72], %i6
- b return_from_trap
- wr %l0, 0, %psr
-
-/*
- * Do a `software' trap by re-entering the trap code, possibly first
- * switching from interrupt stack to kernel stack. This is used for
- * scheduling and signal ASTs (which generally occur from softclock or
- * tty or net interrupts) and register window saves (which might occur
- * from anywhere).
- *
- * The current window is the trap window, and it is by definition clean.
- * We enter with the trap type in %o0. All we have to do is jump to
- * Lslowtrap_reenter above, but maybe after switching stacks....
- */
-softtrap:
- sethi %hi(_eintstack), %l7
- cmp %sp, %l7
- bge Lslowtrap_reenter
- EMPTY
- sethi UADDR, %l6
- set USPACE-CCFSZ-80, %l5
- add %l6, %l5, %l7
- SET_SP_REDZONE(%l6, %l5)
- b Lslowtrap_reenter
- mov %l7, %sp
-
-#ifdef KGDB
-/*
- * bpt is entered on all breakpoint traps.
- * If this is a kernel breakpoint, we do not want to call trap().
- * Among other reasons, this way we can set breakpoints in trap().
- */
-bpt:
- btst PSR_PS, %l0 ! breakpoint from kernel?
- bz slowtrap ! no, go do regular trap
- nop
-
- /*
- * Build a trap frame for kgdb_trap_glue to copy.
- * Enable traps but set ipl high so that we will not
- * see interrupts from within breakpoints.
- */
- TRAP_SETUP(-CCFSZ-80)
- or %l0, PSR_PIL, %l4 ! splhigh()
- wr %l4, 0, %psr ! the manual claims that this
- wr %l4, PSR_ET, %psr ! song and dance is necessary
- std %l0, [%sp + CCFSZ + 0] ! tf.tf_psr, tf.tf_pc
- mov %l3, %o0 ! trap type arg for kgdb_trap_glue
- rd %y, %l3
- std %l2, [%sp + CCFSZ + 8] ! tf.tf_npc, tf.tf_y
- rd %wim, %l3
- st %l3, [%sp + CCFSZ + 16] ! tf.tf_wim (a kgdb-only r/o field)
- st %g1, [%sp + CCFSZ + 20] ! tf.tf_global[1]
- std %g2, [%sp + CCFSZ + 24] ! etc
- std %g4, [%sp + CCFSZ + 32]
- std %g6, [%sp + CCFSZ + 40]
- std %i0, [%sp + CCFSZ + 48] ! tf.tf_in[0..1]
- std %i2, [%sp + CCFSZ + 56] ! etc
- std %i4, [%sp + CCFSZ + 64]
- std %i6, [%sp + CCFSZ + 72]
-
- /*
- * Now call kgdb_trap_glue(); if it returns, call trap().
- */
- mov %o0, %l3 ! gotta save trap type
- call _kgdb_trap_glue ! kgdb_trap_glue(type, &trapframe)
- add %sp, CCFSZ, %o1 ! (&trapframe)
-
- /*
- * Use slowtrap to call trap---but first erase our tracks
- * (put the registers back the way they were).
- */
- mov %l3, %o0 ! slowtrap will need trap type
- ld [%sp + CCFSZ + 12], %l3
- wr %l3, 0, %y
- ld [%sp + CCFSZ + 20], %g1
- ldd [%sp + CCFSZ + 24], %g2
- ldd [%sp + CCFSZ + 32], %g4
- b Lslowtrap_reenter
- ldd [%sp + CCFSZ + 40], %g6
-
-/*
- * Enter kernel breakpoint. Write all the windows (not including the
- * current window) into the stack, so that backtrace works. Copy the
- * supplied trap frame to the kgdb stack and switch stacks.
- *
- * kgdb_trap_glue(type, tf0)
- * int type;
- * struct trapframe *tf0;
- */
- .globl _kgdb_trap_glue
-_kgdb_trap_glue:
- save %sp, -CCFSZ, %sp
-
- call _write_all_windows
- mov %sp, %l4 ! %l4 = current %sp
-
- /* copy trapframe to top of kgdb stack */
- set _kgdb_stack + KGDB_STACK_SIZE - 80, %l0
- ! %l0 = tfcopy -> end_of_kgdb_stack
- mov 80, %l1
-1: ldd [%i1], %l2
- inc 8, %i1
- deccc 8, %l1
- std %l2, [%l0]
- bg 1b
- inc 8, %l0
-
-#ifdef DEBUG
- /* save old red zone and then turn it off */
- sethi %hi(_redzone), %l7
- ld [%l7 + %lo(_redzone)], %l6
- st %g0, [%l7 + %lo(_redzone)]
-#endif
- /* switch to kgdb stack */
- add %l0, -CCFSZ-80, %sp
-
- /* if (kgdb_trap(type, tfcopy)) kgdb_rett(tfcopy); */
- mov %i0, %o0
- call _kgdb_trap
- add %l0, -80, %o1
- tst %o0
- bnz,a kgdb_rett
- add %l0, -80, %g1
-
- /*
- * kgdb_trap() did not handle the trap at all so the stack is
- * still intact. A simple `restore' will put everything back,
- * after we reset the stack pointer.
- */
- mov %l4, %sp
-#ifdef DEBUG
- st %l6, [%l7 + %lo(_redzone)] ! restore red zone
-#endif
- ret
- restore
-
-/*
- * Return from kgdb trap. This is sort of special.
- *
- * We know that kgdb_trap_glue wrote the window above it, so that we will
- * be able to (and are sure to have to) load it up. We also know that we
- * came from kernel land and can assume that the %fp (%i6) we load here
- * is proper. We must also be sure not to lower ipl (it is at splhigh())
- * until we have traps disabled, due to the SPARC taking traps at the
- * new ipl before noticing that PSR_ET has been turned off. We are on
- * the kgdb stack, so this could be disastrous.
- *
- * Note that the trapframe argument in %g1 points into the current stack
- * frame (current window). We abandon this window when we move %g1->tf_psr
- * into %psr, but we will not have loaded the new %sp yet, so again traps
- * must be disabled.
- */
-kgdb_rett:
- rd %psr, %g4 ! turn off traps
- wr %g4, PSR_ET, %psr
- /* use the three-instruction delay to do something useful */
- ld [%g1], %g2 ! pick up new %psr
- ld [%g1 + 12], %g3 ! set %y
- wr %g3, 0, %y
-#ifdef DEBUG
- st %l6, [%l7 + %lo(_redzone)] ! and restore red zone
-#endif
- wr %g0, 0, %wim ! enable window changes
- nop; nop; nop
- /* now safe to set the new psr (changes CWP, leaves traps disabled) */
- wr %g2, 0, %psr ! set rett psr (including cond codes)
- /* 3 instruction delay before we can use the new window */
-/*1*/ ldd [%g1 + 24], %g2 ! set new %g2, %g3
-/*2*/ ldd [%g1 + 32], %g4 ! set new %g4, %g5
-/*3*/ ldd [%g1 + 40], %g6 ! set new %g6, %g7
-
- /* now we can use the new window */
- mov %g1, %l4
- ld [%l4 + 4], %l1 ! get new pc
- ld [%l4 + 8], %l2 ! get new npc
- ld [%l4 + 20], %g1 ! set new %g1
-
- /* set up returnee's out registers, including its %sp */
- ldd [%l4 + 48], %i0
- ldd [%l4 + 56], %i2
- ldd [%l4 + 64], %i4
- ldd [%l4 + 72], %i6
-
- /* load returnee's window, making the window above it be invalid */
- restore
- restore %g0, 1, %l1 ! move to inval window and set %l1 = 1
- rd %psr, %l0
- sll %l1, %l0, %l1
- wr %l1, 0, %wim ! %wim = 1 << (%psr & 31)
-/*1*/ sethi UADDR, %l1
-/*2*/ and %l0, 31, %l0 ! CWP = %psr & 31;
-/*3*/ st %l0, [%l1 + PCB_WIM] ! cpcb->pcb_wim = CWP;
- save %g0, %g0, %g0 ! back to window to reload
- LOADWIN(%sp)
- save %g0, %g0, %g0 ! back to trap window
- /* note, we have not altered condition codes; safe to just rett */
- RETT
-#endif
-
-/*
- * syscall() builds a trap frame and calls syscall().
- * sun_syscall is same but delivers sun system call number
- * XXX should not have to save&reload ALL the registers just for
- * ptrace...
- */
-syscall:
- TRAP_SETUP(-CCFSZ-80)
- wr %l0, PSR_ET, %psr
- std %l0, [%sp + CCFSZ + 0] ! tf_psr, tf_pc
- rd %y, %l3
- std %l2, [%sp + CCFSZ + 8] ! tf_npc, tf_y
- st %g1, [%sp + CCFSZ + 20] ! tf_g[1]
- std %g2, [%sp + CCFSZ + 24] ! tf_g[2], tf_g[3]
- std %g4, [%sp + CCFSZ + 32] ! etc
- std %g6, [%sp + CCFSZ + 40]
- mov %g1, %o0 ! (code)
- std %i0, [%sp + CCFSZ + 48]
- add %sp, CCFSZ, %o1 ! (&tf)
- std %i2, [%sp + CCFSZ + 56]
- mov %l1, %o2 ! (pc)
- std %i4, [%sp + CCFSZ + 64]
- call _syscall ! syscall(code, &tf, pc, suncompat)
- std %i6, [%sp + CCFSZ + 72]
- ! now load em all up again, sigh
- ldd [%sp + CCFSZ + 0], %l0 ! new %psr, new pc
- ldd [%sp + CCFSZ + 8], %l2 ! new npc, new %y
- wr %l3, 0, %y
- /* see `proc_trampoline' for the reason for this label */
-return_from_syscall:
- ld [%sp + CCFSZ + 20], %g1
- ldd [%sp + CCFSZ + 24], %g2
- ldd [%sp + CCFSZ + 32], %g4
- ldd [%sp + CCFSZ + 40], %g6
- ldd [%sp + CCFSZ + 48], %i0
- ldd [%sp + CCFSZ + 56], %i2
- ldd [%sp + CCFSZ + 64], %i4
- ldd [%sp + CCFSZ + 72], %i6
- b return_from_trap
- wr %l0, 0, %psr
-
-/*
- * Interrupts. Software interrupts must be cleared from the software
- * interrupt enable register. Rather than calling ienab_bic for each,
- * we do them in-line before enabling traps.
- *
- * After preliminary setup work, the interrupt is passed to each
- * registered handler in turn. These are expected to return nonzero if
- * they took care of the interrupt. If a handler claims the interrupt,
- * we exit (hardware interrupts are latched in the requestor so we'll
- * just take another interrupt in the unlikely event of simultaneous
- * interrupts from two different devices at the same level). If we go
- * through all the registered handlers and no one claims it, we report a
- * stray interrupt. This is more or less done as:
- *
- * for (ih = intrhand[intlev]; ih; ih = ih->ih_next)
- * if ((*ih->ih_fun)(ih->ih_arg ? ih->ih_arg : &frame))
- * return;
- * strayintr(&frame);
- *
- * Software interrupts are almost the same with three exceptions:
- * (1) we clear the interrupt from the software interrupt enable
- * register before calling any handler (we have to clear it first
- * to avoid an interrupt-losing race),
- * (2) we always call all the registered handlers (there is no way
- * to tell if the single bit in the software interrupt register
- * represents one or many requests)
- * (3) we never announce a stray interrupt (because of (1), another
- * interrupt request can come in while we're in the handler. If
- * the handler deals with everything for both the original & the
- * new request, we'll erroneously report a stray interrupt when
- * we take the software interrupt for the new request.
- *
- * Inputs:
- * %l0 = %psr
- * %l1 = return pc
- * %l2 = return npc
- * %l3 = interrupt level
- * (software interrupt only) %l4 = bits to clear in interrupt register
- *
- * Internal:
- * %l4, %l5: local variables
- * %l6 = %y
- * %l7 = %g1
- * %g2..%g7 go to stack
- *
- * An interrupt frame is built in the space for a full trapframe;
- * this contains the psr, pc, npc, and interrupt level.
- */
-sic_interrupt:
- lda [%g0](ASI_ACK_IPV), %l3 ! Ack the interruption
- srl %l3, 8, %l3
- and %l3, 0xff, %l3 ! l3 now contains vector
-
- mov SIC_IRC_E, %l4
- stba %l4, [%g0](ASI_IRXC) ! Enable ints.
-
- sll %l3, 2, %l5
- set _intrcnt, %l4 ! intrcnt[intlev]++;
- ld [%l4 + %l5], %l6
- inc %l6
- st %l6, [%l4 + %l5]
-
- sethi %hi(_cnt+V_INTR), %l4 ! cnt.v_intr++
- ld [%l4 + %lo(_cnt+V_INTR)], %l5
- inc %l5
- st %l5, [%l4 + %lo(_cnt + V_INTR)]
-
- lduba [%g0](ASI_DGRAM), %l4
- cmp %l3, %l4
- bg,a sic_handle_now
- nop
-
- ! Just have to delay interruption %l3
- wr %l0, 0, %psr
- sethi %hi(_intrdelay), %l4
- or %l4, %lo(_intrdelay), %l4
- mov 1, %l5
- stb %l5, [%l4 + %l3]
- sethi %hi(_hir), %l4
- st %l5, [%l4 + %lo(_hir)]
- RETT
-
-sic_handle_now:
- ! %l3 is not modified.
- INTR_SETUP(-CCFSZ-80)
-sic_handle_now1:
- lduba [%g0](ASI_DGRAM), %l4 ! Read IPR.
- stba %l3, [%g0](ASI_DGRAM) ! Mask int.
- ! Enable traps, because of MMU.
- wr %l0, PSR_ET, %psr
-/*1*/ mov %g1, %l7
-/*2*/ rd %y, %l6
-/*3*/ sll %l3, 2, %l5
- std %g2, [%sp + CCFSZ + 24] ! save registers
- std %g4, [%sp + CCFSZ + 32]
- std %g6, [%sp + CCFSZ + 40]
- std %l0, [%sp + CCFSZ + 0] ! set up clockframe (psr & pc)
- std %l2, [%sp + CCFSZ + 8] ! set up clockframe (npc & ipv)
- st %l4, [%sp + CCFSZ + 20] ! set up clockframe (ipr)
-
-sic_handle_now2:
- set _intrhand, %l4 ! %l4 = intrhand[intlev];
- ld [%l4 + %l5], %l4
- b 3f
- st %fp, [%sp + CCFSZ + 16]
-
-1: ld [%l4], %o1
- ld [%l4 + 4], %o0
- tst %o0
- bz,a 2f
- add %sp, CCFSZ, %o0
-2: jmpl %o1, %o7 ! handled = (*ih->ih_fun)(...)
- ld [%l4 + 8], %l4 ! and ih = ih->ih_next
- tst %o0
- bnz 4f ! if (handled) break
- nop
-3: tst %l4
- bnz 1b ! while (ih)
- nop
- call _strayintr ! strayintr(&intrframe)
- add %sp, CCFSZ, %o0
- /* all done: restore registers and go return */
- /* At first, restore spl. */
-4: call _splx
- ld [%sp + CCFSZ + 20], %o0 ! previous SPL
- ldd [%sp + CCFSZ + 24], %g2
- ldd [%sp + CCFSZ + 32], %g4
- ldd [%sp + CCFSZ + 40], %g6
- wr %l0, 0, %psr ! Disable traps.
- mov %l7, %g1
- wr %l6, 0, %y
- b return_from_trap
- nop
-
-bad_interrupt:
- INTR_SETUP(-CCFSZ-80)
- std %g2, [%sp + CCFSZ + 24] ! save registers
- std %g4, [%sp + CCFSZ + 32]
- std %g6, [%sp + CCFSZ + 40]
- INCR(_cnt+V_INTR) ! cnt.v_intr++; (clobbers %o0,%o1)
- mov %g1, %l7
- rd %y, %l6
- std %l0, [%sp + CCFSZ + 0] ! set up clockframe (psr & pc)
- std %l2, [%sp + CCFSZ + 8] ! set up clockframe (npc & ipv)
-
- andn %l0, (PSR_PIL|PSR_ET), %l4 ! %l4 = psr & ~(PSR_PIL | PSR_ET)
- or %l4, 11 << 8, %l4 ! | (11 << IPLSHIFT)
- wr %l4, 0, %psr ! the manual claims this
-
- call _strayintr ! strayintr(&intrframe)
- add %sp, CCFSZ, %o0
- /* all done: restore registers and go return */
-4:
- ldd [%sp + CCFSZ + 24], %g2
- ldd [%sp + CCFSZ + 32], %g4
- ldd [%sp + CCFSZ + 40], %g6
- wr %l0, 0, %psr
- mov %l7, %g1
- b return_from_trap
- wr %l6, 0, %y
-
-#ifdef notyet
-/*
- * Level 12 (ZS serial) interrupt. Handle it quickly, schedule a
- * software interrupt, and get out. Do the software interrupt directly
- * if we would just take it on the way out.
- *
- * Input:
- * %l0 = %psr
- * %l1 = return pc
- * %l2 = return npc
- * Internal:
- * %l3 = zs device
- * %l4, %l5 = temporary
- * %l6 = rr3 (or temporary data) + 0x100 => need soft int
- * %l7 = zs soft status
- */
-zshard:
-#endif /* notyet */
-
-/*
- * Level 15 interrupt. An async memory error has occurred;
- * take care of it (typically by panicking, but hey...).
- * %l0 = %psr
- * %l1 = return pc
- * %l2 = return npc
- * %l3 = 15 * 4 (why? just because!)
- *
- * Internal:
- * %l4 = %y
- * %l5 = %g1
- * %l6 = %g6
- * %l7 = %g7
- * g2, g3, g4, g5 go to stack
- *
- * This code is almost the same as that in mem_access_fault,
- * except that we already know the problem is not a `normal' fault,
- * and that we must be extra-careful with interrupt enables.
- */
-
-nmi:
- set 400000, %l6
-nmi2:
- lda [%g0](ASI_BID), %l7
- deccc %l6
- be nmi3
- btst BID_NMI, %l7
- bne nmi2
- nop
- b nmi
- nop
-nmi3:
- set (LED_t << 8) | LED_1, %l0
- stha %l0, [%g0](ASI_LED)
-
- b _rom_reset
- nop
-
- INTR_SETUP(-CCFSZ-80)
- INCR(_cnt+V_INTR) ! cnt.v_intr++; (clobbers %o0,%o1)
- /*
- * Level 15 interrupts are nonmaskable, so with traps off,
- * Wait until NMI becomes unactive.
- */
- ! At first, disable the MMU.
- lda [%g0] (ASI_MMCR), %o0
- andn %o0, MMCR_ME, %o0
- sta %o1, [%g0] (ASI_MMCR)
-
- or %l0, PSR_PIL, %l0
- wr %l0, %g0, %psr
- nop
- nop
- nop
-
- wr %l0, PSR_ET, %psr ! okay, turn traps on again
-
- std %g2, [%sp + CCFSZ + 0] ! save g2, g3
- rd %y, %l4 ! save y
-
- std %g4, [%sp + CCFSZ + 8] ! save g4, g5
- mov %g1, %l5 ! save g1, g6, g7
- mov %g6, %l6
- mov %g7, %l7
-
- ! and call C code
- call _memerr ! memerr(0, ser, sva, aer, ava)
- clr %o0
-
- mov %l5, %g1 ! restore g1 through g7
- ldd [%sp + CCFSZ + 0], %g2
- ldd [%sp + CCFSZ + 8], %g4
- wr %l0, 0, %psr ! re-disable traps
- mov %l6, %g6
- mov %l7, %g7
-
- b return_from_trap
- wr %l4, 0, %y ! restore y
-
-
-#ifdef GPROF
- .globl window_of, winof_user
- .globl window_uf, winuf_user, winuf_ok, winuf_invalid
- .globl return_from_trap, rft_kernel, rft_user, rft_invalid
- .globl softtrap, slowtrap
- .globl clean_trap_window, syscall
-#endif
-
-/*
- * Window overflow trap handler.
- * %l0 = %psr
- * %l1 = return pc
- * %l2 = return npc
- */
-window_of:
-#ifdef TRIVIAL_WINDOW_OVERFLOW_HANDLER
- /* a trivial version that assumes %sp is ok */
- /* (for testing only!) */
- save %g0, %g0, %g0
- std %l0, [%sp + (0*8)]
- rd %psr, %l0
- mov 1, %l1
- sll %l1, %l0, %l0
- wr %l0, 0, %wim
- std %l2, [%sp + (1*8)]
- std %l4, [%sp + (2*8)]
- std %l6, [%sp + (3*8)]
- std %i0, [%sp + (4*8)]
- std %i2, [%sp + (5*8)]
- std %i4, [%sp + (6*8)]
- std %i6, [%sp + (7*8)]
- restore
- RETT
-#else
- /*
- * This is similar to TRAP_SETUP, but we do not want to spend
- * a lot of time, so we have separate paths for kernel and user.
- * We also know for sure that the window has overflowed.
- */
- btst PSR_PS, %l0
- bz winof_user
- sethi %hi(clean_trap_window), %l7
-
- /*
- * Overflow from kernel mode. Call clean_trap_window to
- * do the dirty work, then just return, since we know prev
- * window is valid. clean_trap_windows might dump all *user*
- * windows into the pcb, but we do not care: there is at
- * least one kernel window (a trap or interrupt frame!)
- * above us.
- */
- jmpl %l7 + %lo(clean_trap_window), %l4
- mov %g7, %l7 ! for clean_trap_window
-
- wr %l0, 0, %psr ! put back the @%*! cond. codes
- nop ! (let them settle in)
- RETT
-
-winof_user:
- /*
- * Overflow from user mode.
- * If clean_trap_window dumps the registers into the pcb,
- * rft_user will need to call trap(), so we need space for
- * a trap frame. We also have to compute pcb_nw.
- *
- * SHOULD EXPAND IN LINE TO AVOID BUILDING TRAP FRAME ON
- * `EASY' SAVES
- */
- sethi UADDR, %l6
- ld [%l6 + PCB_WIM], %l5
- and %l0, 31, %l3
- sub %l3, %l5, %l5 /* l5 = CWP - pcb_wim */
- set uwtab, %l4
- ldub [%l4 + %l5], %l5 /* l5 = uwtab[l5] */
- st %l5, [%l6 + PCB_UW]
- jmpl %l7 + %lo(clean_trap_window), %l4
- mov %g7, %l7 ! for clean_trap_window
- sethi UADDR, %l6
- set USPACE-CCFSZ-80, %l5
- add %l6, %l5, %sp /* over to kernel stack */
- CHECK_SP_REDZONE(%l6, %l5)
-
- /*
- * Copy return_from_trap far enough to allow us
- * to jump directly to rft_user_or_recover_pcb_windows
- * (since we know that is where we are headed).
- */
-! and %l0, 31, %l3 ! still set (clean_trap_window
- ! leaves this register alone)
- set wmask, %l6
- ldub [%l6 + %l3], %l5 ! %l5 = 1 << ((CWP + 1) % nwindows)
- b rft_user_or_recover_pcb_windows
- rd %wim, %l4 ! (read %wim first)
-#endif /* end `real' version of window overflow trap handler */
-
-/*
- * Window underflow trap handler.
- * %l0 = %psr
- * %l1 = return pc
- * %l2 = return npc
- *
- * A picture:
- *
- * T R I X
- * 0 0 0 1 0 0 0 (%wim)
- * [bit numbers increase towards the right;
- * `restore' moves right & `save' moves left]
- *
- * T is the current (Trap) window, R is the window that attempted
- * a `Restore' instruction, I is the Invalid window, and X is the
- * window we want to make invalid before we return.
- *
- * Since window R is valid, we cannot use rft_user to restore stuff
- * for us. We have to duplicate its logic. YUCK.
- *
- * Incidentally, TRIX are for kids. Silly rabbit!
- */
-window_uf:
-#ifdef TRIVIAL_WINDOW_UNDERFLOW_HANDLER
- wr %g0, 0, %wim ! allow us to enter I
- restore ! to R
- nop
- nop
- restore ! to I
- restore %g0, 1, %l1 ! to X
- rd %psr, %l0
- sll %l1, %l0, %l0
- wr %l0, 0, %wim
- save %g0, %g0, %g0 ! back to I
- LOADWIN(%sp)
- save %g0, %g0, %g0 ! back to R
- save %g0, %g0, %g0 ! back to T
- RETT
-#else
- wr %g0, 0, %wim ! allow us to enter I
- btst PSR_PS, %l0
- restore ! enter window R
- bz winuf_user
- restore ! enter window I
-
- /*
- * Underflow from kernel mode. Just recover the
- * registers and go (except that we have to update
- * the blasted user pcb fields).
- */
- restore %g0, 1, %l1 ! enter window X, then set %l1 to 1
- rd %psr, %l0 ! cwp = %psr & 31;
- and %l0, 31, %l0
- sll %l1, %l0, %l1 ! wim = 1 << cwp;
- wr %l1, 0, %wim ! setwim(wim);
-/*1*/ nop
-/*2*/ sethi UADDR, %l1
-/*3*/ st %l0, [%l1 + PCB_WIM] ! cpcb->pcb_wim = cwp;
- save %g0, %g0, %g0 ! back to window I
-window_uf1:
- /* SANITY check. */
- sethi %hi(SERIES5_KERN_WINDOW), %l1
- and %sp, %l1, %l2
- cmp %l1, %l2
- be 1f
- nop
- save %g0, %g0, %g0
- save %g0, %g0, %g0
- ta 20
- /* End of SANITY check. */
-1: LOADWIN(%sp)
- save %g0, %g0, %g0 ! back to R
- save %g0, %g0, %g0 ! and then to T
- wr %l0, 0, %psr ! fix those cond codes....
- nop ! (let them settle in)
- RETT
-
-winuf_user:
- /*
- * Underflow from user mode.
- *
- * We cannot use rft_user (as noted above) because
- * we must re-execute the `restore' instruction.
- * Since it could be, e.g., `restore %l0,0,%l0',
- * it is not okay to touch R's registers either.
- *
- * We are now in window I.
- */
- btst 7, %sp ! if unaligned, it is invalid
- bne winuf_invalid
- EMPTY
-
- PTE_OF_ADDR(%sp, %l7, %l4, winuf_invalid)
- CMP_PTE_USER_READ (%l7) ! if first page not readable,
- bne winuf_invalid ! it is invalid
- EMPTY
- SLT_IF_1PAGE_RW(%sp, %l7, %l4) ! first page is readable
- bl,a winuf_ok ! if only one page, enter window X
- restore %g0, 1, %l1 ! and goto ok, & set %l1 to 1
- add %sp, 7*8, %l5
- PTE_OF_ADDR(%l5, %l7, %l4, winuf_invalid)
- CMP_PTE_USER_READ(%l7) ! check second page too
- be,a winuf_ok ! enter window X and goto ok
- restore %g0, 1, %l1 ! (and then set %l1 to 1)
-
-winuf_invalid:
- /*
- * We were unable to restore the window because %sp
- * is invalid or paged out. Return to the trap window
- * and call trap(T_WINUF). This will save R to the user
- * stack, then load both R and I into the pcb rw[] area,
- * and return with pcb_nsaved set to -1 for success, 0 for
- * failure. `Failure' indicates that someone goofed with the
- * trap registers (e.g., signals), so that we need to return
- * from the trap as from a syscall (probably to a signal handler)
- * and let it retry the restore instruction later. Note that
- * window R will have been pushed out to user space, and thus
- * be the invalid window, by the time we get back here. (We
- * continue to label it R anyway.) We must also set %wim again,
- * and set pcb_uw to 1, before enabling traps. (Window R is the
- * only window, and it is a user window).
- */
- save %g0, %g0, %g0 ! back to R
- save %g0, 1, %l4 ! back to T, then %l4 = 1
- sethi UADDR, %l6
- st %l4, [%l6 + PCB_UW] ! pcb_uw = 1
- ld [%l6 + PCB_WIM], %l5 ! get log2(%wim)
- sll %l4, %l5, %l4 ! %l4 = old %wim
- wr %l4, 0, %wim ! window I is now invalid again
-/*1*/ set USPACE-CCFSZ-80, %l5
-/*2*/ add %l6, %l5, %sp ! get onto kernel stack
-/*3*/ nop
- CHECK_SP_REDZONE(%l6, %l5)
-
- /*
- * Okay, call trap(T_WINUF, psr, pc, &tf).
- * See `slowtrap' above for operation.
- */
- wr %l0, PSR_ET, %psr
- std %l0, [%sp + CCFSZ + 0] ! tf.tf_psr, tf.tf_pc
- rd %y, %l3
- std %l2, [%sp + CCFSZ + 8] ! tf.tf_npc, tf.tf_y
- mov T_WINUF, %o0
- st %g1, [%sp + CCFSZ + 20] ! tf.tf_global[1]
- mov %l0, %o1
- std %g2, [%sp + CCFSZ + 24] ! etc
- mov %l1, %o2
- std %g4, [%sp + CCFSZ + 32]
- add %sp, CCFSZ, %o3
- std %g6, [%sp + CCFSZ + 40]
- std %i0, [%sp + CCFSZ + 48] ! tf.tf_out[0], etc
- std %i2, [%sp + CCFSZ + 56]
- std %i4, [%sp + CCFSZ + 64]
- call _trap ! trap(T_WINUF, pc, psr, &tf)
- std %i6, [%sp + CCFSZ + 72] ! tf.tf_out[6]
-
- ldd [%sp + CCFSZ + 0], %l0 ! new psr, pc
- ldd [%sp + CCFSZ + 8], %l2 ! new npc, %y
- wr %l3, 0, %y
- ld [%sp + CCFSZ + 20], %g1
- ldd [%sp + CCFSZ + 24], %g2
- ldd [%sp + CCFSZ + 32], %g4
- ldd [%sp + CCFSZ + 40], %g6
- ldd [%sp + CCFSZ + 48], %i0 ! %o0 for window R, etc
- ldd [%sp + CCFSZ + 56], %i2
- ldd [%sp + CCFSZ + 64], %i4
- wr %l0, 0, %psr ! disable traps: test must be atomic
-/*1*/ ldd [%sp + CCFSZ + 72], %i6
-/*2*/ sethi UADDR, %l6
-/*3*/ ld [%l6 + PCB_NSAVED], %l7 ! if nsaved is -1, we have our regs
- tst %l7
- bl,a 1f ! got them
- wr %g0, 0, %wim ! allow us to enter windows R, I
-/*1*/ b,a return_from_trap
-
- /*
- * Got 'em. Load 'em up.
- */
-
-1:
- mov %g6, %l3 ! save %g6; set %g6 = cpcb
- mov %l6, %g6
- st %g0, [%g6 + PCB_NSAVED] ! and clear magic flag
- restore ! from T to R
- restore ! from R to I
- restore %g0, 1, %l1 ! from I to X, then %l1 = 1
- rd %psr, %l0 ! cwp = %psr;
- sll %l1, %l0, %l1
- wr %l1, 0, %wim ! make window X invalid
- and %l0, 31, %l0
- st %l0, [%g6 + PCB_WIM] ! cpcb->pcb_wim = cwp;
- nop ! unnecessary? old wim was 0...
- save %g0, %g0, %g0 ! back to I
- LOADWIN(%g6 + PCB_RW + 64) ! load from rw[1]
- save %g0, %g0, %g0 ! back to R
- LOADWIN(%g6 + PCB_RW) ! load from rw[0]
- save %g0, %g0, %g0 ! back to T
- wr %l0, 0, %psr ! restore condition codes
-/*1*/ mov %l3, %g6 ! fix %g6
-/*2*/ nop
-/*3*/ RETT
-
- /*
- * Restoring from user stack, but everything has checked out
- * as good. We are now in window X, and %l1 = 1. Window R
- * is still valid and holds user values.
- */
-winuf_ok:
- rd %psr, %l0
- sll %l1, %l0, %l1
- wr %l1, 0, %wim ! make this one invalid
-/*1*/ sethi UADDR, %l2
-/*2*/ and %l0, 31, %l0
-/*3*/ st %l0, [%l2 + PCB_WIM] ! cpcb->pcb_wim = cwp;
- save %g0, %g0, %g0 ! back to I
- LOADWIN(%sp)
- save %g0, %g0, %g0 ! back to R
- save %g0, %g0, %g0 ! back to T
- wr %l0, 0, %psr ! restore condition codes
- nop ! it takes three to tangle
- RETT
-#endif /* end `real' version of window underflow trap handler */
-
-/*
- * Various return-from-trap routines (see return_from_trap).
- */
-
-/*
- * Return from trap, to kernel.
- * %l0 = %psr
- * %l1 = return pc
- * %l2 = return npc
- * %l4 = %wim
- * %l5 = bit for previous window
- */
-rft_kernel:
- btst %l5, %l4 ! if (wim & l5)
- bnz 1f ! goto reload;
- wr %l0, 0, %psr ! but first put !@#*% cond codes back
-
- /* previous window is valid; just rett */
- nop ! wait for cond codes to settle in
- RETT
-
- /*
- * Previous window is invalid.
- * Update %wim and then reload l0..i7 from frame.
- *
- * T I X
- * 0 0 1 0 0 (%wim)
- * [see picture in window_uf handler]
- *
- * T is the current (Trap) window, I is the Invalid window,
- * and X is the window we want to make invalid. Window X
- * currently has no useful values.
- */
-1:
- wr %g0, 0, %wim ! allow us to enter window I
- nop; nop; nop ! (it takes a while)
- restore ! enter window I
- restore %g0, 1, %l1 ! enter window X, then %l1 = 1
- rd %psr, %l0 ! CWP = %psr & 31;
- and %l0, 31, %l0
- sll %l1, %l0, %l1 ! wim = 1 << CWP;
- wr %l1, 0, %wim ! setwim(wim);
-/*1*/ sethi UADDR, %l1
-/*2*/ st %l0, [%l1 + PCB_WIM] ! cpcb->pcb_wim = l0 & 31;
-/*3*/ nop
- save %g0, %g0, %g0 ! back to window I
- LOADWIN(%sp)
- save %g0, %g0, %g0 ! back to window T
- /*
- * Note that the condition codes are still set from
- * the code at rft_kernel; we can simply return.
- */
- RETT
-
-/*
- * Return from trap, to user. Checks for scheduling trap (`ast') first;
- * will re-enter trap() if set. Note that we may have to switch from
- * the interrupt stack to the kernel stack in this case.
- * %l0 = %psr
- * %l1 = return pc
- * %l2 = return npc
- * %l4 = %wim
- * %l5 = bit for previous window
- * %l6 = cpcb
- * If returning to a valid window, just set psr and return.
- */
-rft_user:
-! sethi %hi(_want_ast), %l7 ! (done below)
- ld [%l7 + %lo(_want_ast)], %l7
- tst %l7 ! want AST trap?
- bne,a softtrap ! yes, re-enter trap with type T_AST
- mov T_AST, %o0
-
- btst %l5, %l4 ! if (wim & l5)
- bnz 1f ! goto reload;
- wr %l0, 0, %psr ! restore cond codes
- nop ! (three instruction delay)
- RETT
-
- /*
- * Previous window is invalid.
- * Before we try to load it, we must verify its stack pointer.
- * This is much like the underflow handler, but a bit easier
- * since we can use our own local registers.
- */
-1:
- btst 7, %fp ! if unaligned, address is invalid
- bne rft_invalid
- EMPTY
-
-rft_user1:
- PTE_OF_ADDR(%fp, %l7, %l3, rft_invalid)
- CMP_PTE_USER_READ (%l7) ! try first page
- bne rft_invalid ! no good
- EMPTY
-rft_user2:
- SLT_IF_1PAGE_RW(%fp, %l7, %l3)
- bl,a rft_user_ok ! only 1 page: ok
- wr %g0, 0, %wim
- add %fp, 7*8, %l5
-rft_user3:
- PTE_OF_ADDR(%l5, %l7, %l3, rft_invalid)
- CMP_PTE_USER_READ(%l7) ! check 2nd page too
- be,a rft_user_ok
- wr %g0, 0, %wim
- /*
- * The window we wanted to pull could not be pulled. Instead,
- * re-enter trap with type T_RWRET. This will pull the window
- * into cpcb->pcb_rw[0] and set cpcb->pcb_nsaved to -1, which we
- * will detect when we try to return again.
- */
-rft_invalid:
- b softtrap
- mov T_RWRET, %o0
-
- /*
- * The window we want to pull can be pulled directly.
- */
-rft_user_ok:
-! wr %g0, 0, %wim ! allow us to get into it
- wr %l0, 0, %psr ! fix up the cond codes now
- nop; nop; nop
- restore ! enter window I
- restore %g0, 1, %l1 ! enter window X, then %l1 = 1
- rd %psr, %l0 ! l0 = (junk << 5) + CWP;
- sll %l1, %l0, %l1 ! %wim = 1 << CWP;
- wr %l1, 0, %wim
-/*1*/ sethi UADDR, %l1
-/*2*/ and %l0, 31, %l0
-/*3*/ st %l0, [%l1 + PCB_WIM] ! cpcb->pcb_wim = l0 & 31;
- save %g0, %g0, %g0 ! back to window I
- LOADWIN(%sp) ! suck hard
- save %g0, %g0, %g0 ! back to window T
- RETT
-
-/*
- * Return from trap. Entered after a
- * wr %l0, 0, %psr
- * which disables traps so that we can rett; registers are:
- *
- * %l0 = %psr
- * %l1 = return pc
- * %l2 = return npc
- *
- * (%l3..%l7 anything).
- *
- * If we are returning to user code, we must:
- * 1. Check for register windows in the pcb that belong on the stack.
- * If there are any, reenter trap with type T_WINOF.
- * 2. Make sure the register windows will not underflow. This is
- * much easier in kernel mode....
- */
-return_from_trap:
-! wr %l0, 0, %psr ! disable traps so we can rett
-! (someone else did this already)
- and %l0, 31, %l5
- set wmask, %l6
- ldub [%l6 + %l5], %l5 ! %l5 = 1 << ((CWP + 1) % nwindows)
- btst PSR_PS, %l0 ! returning to userland?
- bnz rft_kernel ! no, go return to kernel
- rd %wim, %l4 ! (read %wim in any case)
-
-rft_user_or_recover_pcb_windows:
- /*
- * (entered with %l4=%wim, %l5=wmask[cwp]; %l0..%l2 as usual)
- *
- * check cpcb->pcb_nsaved:
- * if 0, do a `normal' return to user (see rft_user);
- * if > 0, cpcb->pcb_rw[] holds registers to be copied to stack;
- * if -1, cpcb->pcb_rw[0] holds user registers for rett window
- * from an earlier T_RWRET pseudo-trap.
- */
- sethi UADDR, %l6
- ld [%l6 + PCB_NSAVED], %l7
- tst %l7
- bz,a rft_user
- sethi %hi(_want_ast), %l7 ! first instr of rft_user
-
- bg,a softtrap ! if (pcb_nsaved > 0)
- mov T_WINOF, %o0 ! trap(T_WINOF);
-
- /*
- * To get here, we must have tried to return from a previous
- * trap and discovered that it would cause a window underflow.
- * We then must have tried to pull the registers out of the
- * user stack (from the address in %fp==%i6) and discovered
- * that it was either unaligned or not loaded in memory, and
- * therefore we ran a trap(T_RWRET), which loaded one set of
- * registers into cpcb->pcb_pcb_rw[0] (if it had killed the
- * process due to a bad stack, we would not be here).
- *
- * We want to load pcb_rw[0] into the previous window, which
- * we know is currently invalid. In other words, we want
- * %wim to be 1 << ((cwp + 2) % nwindows).
- */
- wr %g0, 0, %wim ! enable restores
- mov %g6, %l3 ! save g6 in l3
- mov %l6, %g6 ! set g6 = &u
- st %g0, [%g6 + PCB_NSAVED] ! clear cpcb->pcb_nsaved
- restore ! enter window I
- restore %g0, 1, %l1 ! enter window X, then %l1 = 1
- rd %psr, %l0
- sll %l1, %l0, %l1 ! %wim = 1 << CWP;
- wr %l1, 0, %wim
- and %l0, 31, %l0
- st %l0, [%g6 + PCB_WIM] ! cpcb->pcb_wim = CWP;
- nop ! unnecessary? old wim was 0...
- save %g0, %g0, %g0 ! back to window I
- LOADWIN(%g6 + PCB_RW)
- save %g0, %g0, %g0 ! back to window T (trap window)
- wr %l0, 0, %psr ! cond codes, cond codes everywhere
- mov %l3, %g6 ! restore g6
- RETT
-
-! exported end marker for kernel gdb
- .globl _endtrapcode
-_endtrapcode:
-
-/*
- * init_tables(nwin) int nwin;
- *
- * Set up the uwtab and wmask tables.
- * We know nwin > 1.
- */
-init_tables:
- /*
- * for (i = -nwin, j = nwin - 2; ++i < 0; j--)
- * uwtab[i] = j;
- * (loop runs at least once)
- */
- set uwtab, %o3
- sub %g0, %o0, %o1 ! i = -nwin + 1
- inc %o1
- add %o0, -2, %o2 ! j = nwin - 2;
-0:
- stb %o2, [%o3 + %o1] ! uwtab[i] = j;
-1:
- inccc %o1 ! ++i < 0?
- bl 0b ! yes, continue loop
- dec %o2 ! in any case, j--
-
- /*
- * (i now equals 0)
- * for (j = nwin - 1; i < nwin; i++, j--)
- * uwtab[i] = j;
- * (loop runs at least twice)
- */
- sub %o0, 1, %o2 ! j = nwin - 1
-0:
- stb %o2, [%o3 + %o1] ! uwtab[i] = j
- inc %o1 ! i++
-1:
- cmp %o1, %o0 ! i < nwin?
- bl 0b ! yes, continue
- dec %o2 ! in any case, j--
-
- /*
- * We observe that, for i in 0..nwin-2, (i+1)%nwin == i+1;
- * for i==nwin-1, (i+1)%nwin == 0.
- * To avoid adding 1, we run i from 1 to nwin and set
- * wmask[i-1].
- *
- * for (i = j = 1; i < nwin; i++) {
- * j <<= 1; (j now == 1 << i)
- * wmask[i - 1] = j;
- * }
- * (loop runs at least once)
- */
- set wmask - 1, %o3
- mov 1, %o1 ! i = 1;
- mov 2, %o2 ! j = 2;
-0:
- stb %o2, [%o3 + %o1] ! (wmask - 1)[i] = j;
- inc %o1 ! i++
- cmp %o1, %o0 ! i < nwin?
- bl,a 0b ! yes, continue
- sll %o2, 1, %o2 ! (and j <<= 1)
-
- /*
- * Now i==nwin, so we want wmask[i-1] = 1.
- */
- mov 1, %o2 ! j = 1;
- retl
- stb %o2, [%o3 + %o1] ! (wmask - 1)[i] = j;
-
-dostart:
- /*
- * Startup.
- *
- * We have been loaded in high, at 0xff060000.
- */
- /* Save argc, argv, envp. */
- ld [%sp + 0x5c], %g5
- ld [%sp + 0x60], %g6
- ld [%sp + 0x64], %g7
-
-#if 0 /* def DDB */
- /*
- * First, check for DDB arguments. The loader passes `_esym' in %o4.
- * A DDB magic number is passed in %o5 to allow for bootloaders
- * that know nothing about DDB symbol loading conventions.
- * Note: we don't touch %o1-%o3; SunOS bootloaders seem to use them
- * for their own mirky business.
- */
- set 0x44444230, %l3
- cmp %o5, %l3 ! chk magic
- bne 1f
- tst %o4 ! do we have the symbols?
- bz 1f
- nop
- sethi %hi(_esym - KERNBASE), %l3 ! store _esym
- st %o4, [%l3 + %lo(_esym - KERNBASE)]
-1:
-#endif
-
- /*
- * Step 1: Set up the mmu.
- */
-
- ! Disable the mmu.
- lda [%g0] (ASI_MMCR), %o1
- andn %o1, MMCR_ME, %o1
- sta %o1, [%g0] (ASI_MMCR)
-
- ! Invalidate FTLB & GTLB.
- sta %g0, [%g0] (ASI_FGTLB_INV) ! 0x87
-
- ! Read the fault virtual address reg.
- lda [%g0] (ASI_FVAR), %g0
-
- ! Read the fault physical address reg.
- lda [%g0] (ASI_FPAR), %g0
-
- ! Read the fault time out reg.
- lda [%g0] (ASI_FTOR), %g0
-
- rd %psr, %g1 ! paranoia: make sure ...
- andn %g1, PSR_ET, %g1 ! we have traps off
- wr %g1, 0, %psr ! so that we can fiddle safely
- nop; nop; nop
-
- wr %g0, 0, %wim ! make sure we can set psr
- nop; nop; nop
- wr %g0, PSR_S|PSR_PS|PSR_PIL, %psr ! set initial psr
- nop; nop; nop
-
- /* Map the initial u. */
- sethi %hi(SERIES5_KERN_WINDOW), %l5
- set _u0 + PG_WINDOW, %l7
- sethi UADDR, %l6
- andn %l7, %l5, %l7
- sta %l7, [%l6](ASI_FGTLB_VALD)
- set _u0 + NBPG + PG_WINDOW, %l7
- sethi UADDR + NBPG, %l6
- andn %l7, %l5, %l7
- sta %l7, [%l6](ASI_FGTLB_VALD)
-
- wr %g0, 2, %wim ! set initial %wim (w1 invalid)
- mov 1, %g1 ! set pcb_wim (log2(%wim) = 1)
- sethi UADDR, %g2
- st %g1, [%g2 + PCB_WIM]
-
- set USRSTACK - CCFSZ, %fp ! as if called from user code via
- set UADDR + USPACE - CCFSZ - 80, %sp ! syscall(boot_me_up) or somesuch
- rd %psr, %l0
- wr %l0, PSR_ET, %psr
- nop; nop; nop
-
- /*
- * Step 2: clear BSS. This may just be paranoia; the boot
- * loader might already do it for us; but what the hell.
- */
- set _edata, %o0 ! bzero(edata, end - edata)
- set _end, %o1
- call _bzero
- sub %o1, %o0, %o1
-
- /*
- * Step 3: compute number of windows and set up tables.
- * We could do some of this later.
- */
- save %sp, -64, %sp
- rd %psr, %g1
- restore
- and %g1, 31, %g1 ! want just the CWP bits
- add %g1, 1, %o0 ! compute nwindows
- sethi %hi(_nwindows), %o1 ! may as well tell everyone
- call init_tables
- st %o0, [%o1 + %lo(_nwindows)]
-
- /*
- * Step 4: change the trap base register, now that our trap handlers
- * will function (they need the tables we just set up).
- * This depends on the fact that bzero does not use %g6.
- */
- set trapbase, %g1
- wr %g1, 0, %tbr
- nop; nop; nop ! paranoia
-
- /*
- * Ready to run C code; finish bootstrap.
- */
- mov %g5, %o0
- mov %g6, %o1
- mov %g7, %o2
- call __low_level_init
- nop
-
- call _init_series5
- nop
-
- /*
- * Call main. This returns to us after loading /sbin/init into
- * user space. (If the exec fails, main() does not return.)
- */
- call _main
- clr %o0 ! our frame arg is ignored
- /*NOTREACHED*/
-
- .globl _rom_reset
-_rom_reset:
- /*
- * like Startup. */
-
- ! Disable the mmu.
- lda [%g0] (ASI_MMCR), %o1
- andn %o1, MMCR_ME, %o1
- sta %o1, [%g0] (ASI_MMCR)
-
- ! Invalidate FTLB & GTLB.
- sta %g0, [%g0] (ASI_FGTLB_INV) ! 0x87
-
- ! Read the fault virtual address reg.
- lda [%g0] (ASI_FVAR), %g0
-
- ! Read the fault physical address reg.
- lda [%g0] (ASI_FPAR), %g0
-
- ! Read the fault time out reg.
- lda [%g0] (ASI_FTOR), %g0
-
- rd %psr, %g3 ! paranoia: make sure ...
- andn %g3, PSR_ET, %g3 ! we have traps off
- wr %g3, 0, %psr ! so that we can fiddle safely
- nop; nop; nop
-
- wr %g0, 0, %wim ! make sure we can set psr
- nop; nop; nop
- wr %g0, PSR_S|PSR_PS|PSR_PIL, %psr ! set initial psr
- nop; nop; nop
-
- wr %g0, 2, %wim ! set initial %wim (w1 invalid)
-
- set USRSTACK - CCFSZ, %fp
- set UADDR + USPACE - CCFSZ - 80, %sp
- rd %psr, %l0
- wr %l0, PSR_ET, %psr
- nop; nop; nop
-
-1: call _rom_warm_c
- nop
- b 1b
- nop
-
-
-
-/*
- * The following code is copied to the top of the user stack when each
- * process is exec'ed, and signals are `trampolined' off it.
- *
- * When this code is run, the stack looks like:
- * [%sp] 64 bytes to which registers can be dumped
- * [%sp + 64] signal number (goes in %o0)
- * [%sp + 64 + 4] siginfo_t pointer (goes in %o1)
- * [%sp + 64 + 8] placeholder
- * [%sp + 64 + 12] argument for %o3, currently unsupported (always 0)
- * [%sp + 64 + 16] first word of saved state (sigcontext)
- * .
- * .
- * .
- * [%sp + NNN] last word of saved state
- * (followed by previous stack contents or top of signal stack).
- * The address of the function to call is in %g1; the old %g1 and %o0
- * have already been saved in the sigcontext. We are running in a clean
- * window, all previous windows now being saved to the stack.
- *
- * Note that [%sp + 64 + 8] == %sp + 64 + 16. The copy at %sp+64+8
- * will eventually be removed, with a hole left in its place, if things
- * work out.
- */
- .globl _sigcode
- .globl _esigcode
-_sigcode:
- /*
- * XXX the `save' and `restore' below are unnecessary: should
- * replace with simple arithmetic on %sp
- *
- * Make room on the stack for 32 %f registers + %fsr. This comes
- * out to 33*4 or 132 bytes, but this must be aligned to a multiple
- * of 8, or 136 bytes.
- */
- save %sp, -CCFSZ - 136, %sp
- mov %g2, %l2 ! save globals in %l registers
- mov %g3, %l3
- mov %g4, %l4
- mov %g5, %l5
- mov %g6, %l6
- mov %g7, %l7
- /*
- * Saving the fpu registers is expensive, so do it iff the fsr
- * stored in the sigcontext shows that the fpu is enabled.
- */
- ld [%fp + 64 + 16 + SC_PSR_OFFSET], %l0
- sethi %hi(PSR_EF), %l1 ! FPU enable bit is too high for andcc
- andcc %l0, %l1, %l0 ! %l0 = fpu enable bit
- be 1f ! if not set, skip the saves
- rd %y, %l1 ! in any case, save %y
-
- ! fpu is enabled, oh well
- st %fsr, [%sp + CCFSZ + 0]
- std %f0, [%sp + CCFSZ + 8]
- std %f2, [%sp + CCFSZ + 16]
- std %f4, [%sp + CCFSZ + 24]
- std %f6, [%sp + CCFSZ + 32]
- std %f8, [%sp + CCFSZ + 40]
- std %f10, [%sp + CCFSZ + 48]
- std %f12, [%sp + CCFSZ + 56]
- std %f14, [%sp + CCFSZ + 64]
- std %f16, [%sp + CCFSZ + 72]
- std %f18, [%sp + CCFSZ + 80]
- std %f20, [%sp + CCFSZ + 88]
- std %f22, [%sp + CCFSZ + 96]
- std %f24, [%sp + CCFSZ + 104]
- std %f26, [%sp + CCFSZ + 112]
- std %f28, [%sp + CCFSZ + 120]
- std %f30, [%sp + CCFSZ + 128]
-
-1:
- ldd [%fp + 64], %o0 ! sig, code
- ld [%fp + 76], %o3 ! arg3
- call %g1 ! (*sa->sa_handler)(sig,code,scp,arg3)
- add %fp, 64 + 16, %o2 ! scp
-
- /*
- * Now that the handler has returned, re-establish all the state
- * we just saved above, then do a sigreturn.
- */
- tst %l0 ! reload fpu registers?
- be 1f ! if not, skip the loads
- wr %l1, %g0, %y ! in any case, restore %y
-
- ld [%sp + CCFSZ + 0], %fsr
- ldd [%sp + CCFSZ + 8], %f0
- ldd [%sp + CCFSZ + 16], %f2
- ldd [%sp + CCFSZ + 24], %f4
- ldd [%sp + CCFSZ + 32], %f6
- ldd [%sp + CCFSZ + 40], %f8
- ldd [%sp + CCFSZ + 48], %f10
- ldd [%sp + CCFSZ + 56], %f12
- ldd [%sp + CCFSZ + 64], %f14
- ldd [%sp + CCFSZ + 72], %f16
- ldd [%sp + CCFSZ + 80], %f18
- ldd [%sp + CCFSZ + 88], %f20
- ldd [%sp + CCFSZ + 96], %f22
- ldd [%sp + CCFSZ + 104], %f24
- ldd [%sp + CCFSZ + 112], %f26
- ldd [%sp + CCFSZ + 120], %f28
- ldd [%sp + CCFSZ + 128], %f30
-
-1:
- mov %l2, %g2
- mov %l3, %g3
- mov %l4, %g4
- mov %l5, %g5
- mov %l6, %g6
- mov %l7, %g7
-
- restore %g0, SYS_sigreturn, %g1 ! get registers back & set syscall #
- add %sp, 64 + 16, %o0 ! compute scp
- t ST_SYSCALL ! sigreturn(scp)
- ! sigreturn does not return unless it fails
- mov SYS_exit, %g1 ! exit(errno)
- t ST_SYSCALL
-_esigcode:
-
-#ifdef COMPAT_SVR4
-/*
- * The following code is copied to the top of the user stack when each
- * process is exec'ed, and signals are `trampolined' off it.
- *
- * When this code is run, the stack looks like:
- * [%sp] 64 bytes to which registers can be dumped
- * [%sp + 64] signal number (goes in %o0)
- * [%sp + 64 + 4] pointer to saved siginfo
- * [%sp + 64 + 8] pointer to saved context
- * [%sp + 64 + 12] address of the user's handler
- * [%sp + 64 + 16] first word of saved state (context)
- * .
- * .
- * .
- * [%sp + NNN] last word of saved state (siginfo)
- * (followed by previous stack contents or top of signal stack).
- * The address of the function to call is in %g1; the old %g1 and %o0
- * have already been saved in the sigcontext. We are running in a clean
- * window, all previous windows now being saved to the stack.
- *
- * Note that [%sp + 64 + 8] == %sp + 64 + 16. The copy at %sp+64+8
- * will eventually be removed, with a hole left in its place, if things
- * work out.
- */
- .globl _svr4_sigcode
- .globl _svr4_esigcode
-_svr4_sigcode:
- /*
- * XXX the `save' and `restore' below are unnecessary: should
- * replace with simple arithmetic on %sp
- *
- * Make room on the stack for 32 %f registers + %fsr. This comes
- * out to 33*4 or 132 bytes, but this must be aligned to a multiple
- * of 8, or 136 bytes.
- */
- save %sp, -CCFSZ - 136, %sp
- mov %g2, %l2 ! save globals in %l registers
- mov %g3, %l3
- mov %g4, %l4
- mov %g5, %l5
- mov %g6, %l6
- mov %g7, %l7
- /*
- * Saving the fpu registers is expensive, so do it iff the fsr
- * stored in the sigcontext shows that the fpu is enabled.
- */
- ld [%fp + 64 + 16 + SC_PSR_OFFSET], %l0
- sethi %hi(PSR_EF), %l1 ! FPU enable bit is too high for andcc
- andcc %l0, %l1, %l0 ! %l0 = fpu enable bit
- be 1f ! if not set, skip the saves
- rd %y, %l1 ! in any case, save %y
-
- ! fpu is enabled, oh well
- st %fsr, [%sp + CCFSZ + 0]
- std %f0, [%sp + CCFSZ + 8]
- std %f2, [%sp + CCFSZ + 16]
- std %f4, [%sp + CCFSZ + 24]
- std %f6, [%sp + CCFSZ + 32]
- std %f8, [%sp + CCFSZ + 40]
- std %f10, [%sp + CCFSZ + 48]
- std %f12, [%sp + CCFSZ + 56]
- std %f14, [%sp + CCFSZ + 64]
- std %f16, [%sp + CCFSZ + 72]
- std %f18, [%sp + CCFSZ + 80]
- std %f20, [%sp + CCFSZ + 88]
- std %f22, [%sp + CCFSZ + 96]
- std %f24, [%sp + CCFSZ + 104]
- std %f26, [%sp + CCFSZ + 112]
- std %f28, [%sp + CCFSZ + 120]
- std %f30, [%sp + CCFSZ + 128]
-
-1:
- ldd [%fp + 64], %o0 ! sig, siginfo
- ld [%fp + 72], %o2 ! uctx
- call %g1 ! (*sa->sa_handler)(sig,siginfo,uctx)
- nop
-
- /*
- * Now that the handler has returned, re-establish all the state
- * we just saved above, then do a sigreturn.
- */
- tst %l0 ! reload fpu registers?
- be 1f ! if not, skip the loads
- wr %l1, %g0, %y ! in any case, restore %y
-
- ld [%sp + CCFSZ + 0], %fsr
- ldd [%sp + CCFSZ + 8], %f0
- ldd [%sp + CCFSZ + 16], %f2
- ldd [%sp + CCFSZ + 24], %f4
- ldd [%sp + CCFSZ + 32], %f6
- ldd [%sp + CCFSZ + 40], %f8
- ldd [%sp + CCFSZ + 48], %f10
- ldd [%sp + CCFSZ + 56], %f12
- ldd [%sp + CCFSZ + 64], %f14
- ldd [%sp + CCFSZ + 72], %f16
- ldd [%sp + CCFSZ + 80], %f18
- ldd [%sp + CCFSZ + 88], %f20
- ldd [%sp + CCFSZ + 96], %f22
- ldd [%sp + CCFSZ + 104], %f24
- ldd [%sp + CCFSZ + 112], %f26
- ldd [%sp + CCFSZ + 120], %f28
- ldd [%sp + CCFSZ + 128], %f30
-
-1:
- mov %l2, %g2
- mov %l3, %g3
- mov %l4, %g4
- mov %l5, %g5
- mov %l6, %g6
- mov %l7, %g7
-
- restore %g0, SVR4_SYS_context, %g1 ! get registers & set syscall #
- mov 1, %o0
- add %sp, 64 + 16, %o1 ! compute ucontextp
- t ST_SYSCALL ! svr4_context(1, ucontextp)
- ! setcontext does not return unless it fails
- mov SYS_exit, %g1 ! exit(errno)
- t ST_SYSCALL
-_svr4_esigcode:
-#endif
-
-/*
- * Primitives
- */
-
-#ifdef GPROF
- .globl mcount
-#define ENTRY(x) \
- .globl _/**/x; _/**/x: ; \
- save %sp, -CCFSZ, %sp; \
- call mcount; \
- nop; \
- restore
-#else
-#define ENTRY(x) .globl _/**/x; _/**/x:
-#endif
-#define ALTENTRY(x) .globl _/**/x; _/**/x:
-
-/*
- * getfp() - get stack frame pointer
- */
-ENTRY(getfp)
- retl
- mov %fp, %o0
-
-/*
- * copyinstr(fromaddr, toaddr, maxlength, &lencopied)
- *
- * Copy a null terminated string from the user address space into
- * the kernel address space.
- */
-ENTRY(copyinstr)
- ! %o0 = fromaddr, %o1 = toaddr, %o2 = maxlen, %o3 = &lencopied
-#ifdef DIAGNOSTIC
- tst %o2 ! kernel should never give maxlen <= 0
- ble 1f
- EMPTY
-#endif
- set KERNBASE, %o4
- cmp %o0, %o4 ! fromaddr < KERNBASE?
- blu,a Lcsdocopy ! yes, go do it
- sethi UADDR, %o4 ! (first instr of copy)
-
- b Lcsdone ! no, return EFAULT
- mov EFAULT, %o0
-
-1:
- sethi %hi(2f), %o0
- call _panic
- or %lo(2f), %o0, %o0
-2: .asciz "copyinstr"
- _ALIGN
-
-/*
- * copyoutstr(fromaddr, toaddr, maxlength, &lencopied)
- *
- * Copy a null terminated string from the kernel
- * address space to the user address space.
- */
-ENTRY(copyoutstr)
- ! %o0 = fromaddr, %o1 = toaddr, %o2 = maxlen, %o3 = &lencopied
-#ifdef DIAGNOSTIC
- tst %o2
- ble 1f
- EMPTY
-#endif
- set KERNBASE, %o4
- cmp %o1, %o4 ! toaddr < KERNBASE?
- blu,a Lcsdocopy ! yes, go do it
- sethi UADDR, %o4 ! (first instr of copy)
-
- b Lcsdone ! no, return EFAULT
- mov EFAULT, %o0
-
-1:
- sethi %hi(2f), %o0
- call _panic
- or %lo(2f), %o0, %o0
-2: .asciz "copyoutstr"
- _ALIGN
-
-Lcsdocopy:
- set Lcsfault, %o5
- st %o5, [%o4 + PCB_ONFAULT]
-
- mov %o1, %o5 ! save = toaddr;
-! XXX should do this in bigger chunks when possible
-0: ! loop:
- ldsb [%o0], %g1 ! c = *fromaddr;
- tst %g1
- stb %g1, [%o1] ! *toaddr++ = c;
- be 1f ! if (c == NULL)
- inc %o1 ! goto ok;
- deccc %o2 ! if (--len > 0) {
- bg 0b ! fromaddr++;
- inc %o0 ! goto loop;
- ! }
- !
- b Lcsdone ! error = ENAMETOOLONG;
- mov ENAMETOOLONG, %o0 ! goto done;
-1: ! ok:
- clr %o0 ! error = 0;
-Lcsdone: ! done:
- sub %o1, %o5, %o1 ! len = to - save;
- tst %o3 ! if (lencopied)
- bnz,a 3f
- st %o1, [%o3] ! *lencopied = len;
-3:
- retl ! cpcb->pcb_onfault = 0;
- st %g0, [%o4 + PCB_ONFAULT]! return (error);
-
-Lcsfault:
- b Lcsdone ! error = EFAULT;
- mov EFAULT, %o0 ! goto ret;
-
-/*
- * copystr(fromaddr, toaddr, maxlength, &lencopied)
- *
- * Copy a null terminated string from one point to another in
- * the kernel address space. (This is a leaf procedure, but
- * it does not seem that way to the C compiler.)
- */
-ENTRY(copystr)
-#ifdef DIAGNOSTIC
- tst %o2 ! if (maxlength <= 0)
- ble 4f ! panic(...);
- EMPTY
-#endif
- mov %o1, %o5 ! to0 = to;
-0: ! loop:
- ldsb [%o0], %o4 ! c = *from;
- tst %o4
- stb %o4, [%o1] ! *to++ = c;
- be 1f ! if (c == 0)
- inc %o1 ! goto ok;
- deccc %o2 ! if (--len > 0) {
- bg,a 0b ! from++;
- inc %o0 ! goto loop;
- b 2f ! }
- mov ENAMETOOLONG, %o0 ! ret = ENAMETOOLONG; goto done;
-1: ! ok:
- clr %o0 ! ret = 0;
-2:
- sub %o1, %o5, %o1 ! len = to - to0;
- tst %o3 ! if (lencopied)
- bnz,a 3f
- st %o1, [%o3] ! *lencopied = len;
-3:
- retl
- nop
-#ifdef DIAGNOSTIC
-4:
- sethi %hi(5f), %o0
- call _panic
- or %lo(5f), %o0, %o0
-5:
- .asciz "copystr"
- _ALIGN
-#endif
-
-/*
- * Copyin(src, dst, len)
- *
- * Copy specified amount of data from user space into the kernel.
- */
-ENTRY(copyin)
- set KERNBASE, %o3
- cmp %o0, %o3 ! src < KERNBASE?
- blu,a Ldocopy ! yes, can try it
- sethi UADDR, %o3
-
- /* source address points into kernel space: return EFAULT */
- retl
- mov EFAULT, %o0
-
-/*
- * Copyout(src, dst, len)
- *
- * Copy specified amount of data from kernel to user space.
- * Just like copyin, except that the `dst' addresses are user space
- * rather than the `src' addresses.
- */
-ENTRY(copyout)
- set KERNBASE, %o3
- cmp %o1, %o3 ! dst < KERBASE?
- blu,a Ldocopy
- sethi UADDR, %o3
-
- /* destination address points into kernel space: return EFAULT */
- retl
- mov EFAULT, %o0
-
- /*
- * ******NOTE****** this depends on bcopy() not using %g7
- */
-Ldocopy:
-dcopy:
- set Lcopyfault, %o4
- mov %o7, %g7 ! save return address
- call _bcopy ! bcopy(src, dst, len)
- st %o4, [%o3 + PCB_ONFAULT]
-
- sethi UADDR, %o3
- st %g0, [%o3 + PCB_ONFAULT]
- jmp %g7 + 8
- clr %o0 ! return 0
-
-! Copyin or copyout fault. Clear cpcb->pcb_onfault and return EFAULT.
-! Note that although we were in bcopy, there is no state to clean up;
-! the only special thing is that we have to return to [g7 + 8] rather than
-! [o7 + 8].
-Lcopyfault:
-copyfault:
- sethi UADDR, %o3
- st %g0, [%o3 + PCB_ONFAULT]
- jmp %g7 + 8
- mov EFAULT, %o0
-
-
-/*
- * Write all user windows presently in the CPU back to the user's stack.
- * We just do `save' instructions until pcb_uw == 0.
- *
- * p = cpcb;
- * nsaves = 0;
- * while (p->pcb_uw > 0)
- * save(), nsaves++;
- * while (--nsaves >= 0)
- * restore();
- */
-ENTRY(write_user_windows)
- sethi UADDR, %g6
- b 2f
- clr %g5
-1:
- save %sp, -64, %sp
-2:
- ld [%g6 + PCB_UW], %g7
- tst %g7
- bg,a 1b
- inc %g5
-3:
- deccc %g5
- bge,a 3b
- restore
- retl
- nop
-
-
- .comm _want_resched,4
-/*
- * Masterpaddr is the p->p_addr of the last process on the processor.
- * XXX masterpaddr is almost the same as cpcb
- * XXX should delete this entirely
- */
- .comm _masterpaddr, 4
-
-/*
- * Switch statistics (for later tweaking):
- * nswitchdiff = p1 => p2 (i.e., chose different process)
- * nswitchexit = number of calls to switchexit()
- * _cnt.v_swtch = total calls to swtch+swtchexit
- */
- .comm _nswitchdiff, 4
- .comm _nswitchexit, 4
-
-/*
- * REGISTER USAGE IN cpu_switch AND switchexit:
- * This is split into two phases, more or less
- * `before we locate a new proc' and `after'.
- * Some values are the same in both phases.
- * Note that the %o0-registers are not preserved across
- * the psr change when entering a new process, since this
- * usually changes the CWP field (hence heavy usage of %g's).
- *
- * %g1 = oldpsr (excluding ipl bits)
- * %g2 = %hi(_whichqs); newpsr
- * %g3 = p
- * %g4 = lastproc
- * %g5 = <free>; newpcb
- * %g6 = %hi(_cpcb)
- * %g7 = %hi(_curproc)
- * %o0 = tmp 1
- * %o1 = tmp 2
- * %o2 = tmp 3
- * %o3 = tmp 4; whichqs; vm
- * %o4 = tmp 4; which; sswap
- * %o5 = tmp 5; q; <free>
- */
-
-/*
- * switchexit is called only from cpu_exit() before the current process
- * has freed its kernel stack; we must free it. (curproc is already NULL.)
- *
- * We lay the process to rest by changing to the `idle' kernel stack,
- * and note that the `last loaded process' is nonexistent.
- */
-ENTRY(switchexit)
- mov %o0, %g2 ! save the
-
- /*
- * Change pcb to idle u. area, i.e., set %sp to top of stack
- * and %psr to PSR_S|PSR_ET, and set cpcb to point to _idle_u.
- * Once we have left the old stack, we can call kmem_free to
- * destroy it. Call it any sooner and the register windows
- * go bye-bye.
- */
- wr %g0, PSR_S, %psr ! change to window 0, traps off
- wr %g0, 2, %wim ! and make window 1 the trap window
-
- sethi %hi(SERIES5_KERN_WINDOW), %g5
- set _idle_u + PG_WINDOW, %g7
- sethi UADDR, %g6
- andn %g7, %g5, %g7
- sta %g7, [%g6](ASI_FGTLB_VALD)
- set _idle_u + NBPG + PG_WINDOW, %g7
- sethi UADDR + NBPG, %g6
- andn %g7, %g5, %g7
- sta %g7, [%g6](ASI_FGTLB_VALD)
-
- set _idle_u, %g5
- mov 1, %g7
- st %g7, [%g5 + PCB_WIM] ! idle_u.pcb_wim = log2(2) = 1
- set _idle_u + USPACE-CCFSZ, %sp ! set new %sp
-#ifdef DEBUG
- set _idle_u, %l6
- SET_SP_REDZONE(%l6, %l5)
-#endif
- wr %g0, PSR_S|PSR_ET, %psr ! and then enable traps
- call _exit2
- mov %g2, %o0
-
- /*
- * Now fall through to `the last switch'. %g6 was set to
- * %hi(_cpcb), but may have been clobbered in kmem_free,
- * so all the registers described below will be set here.
- *
- * REGISTER USAGE AT THIS POINT:
- * %g1 = oldpsr (excluding ipl bits)
- * %g2 = %hi(_whichqs)
- * %g4 = lastproc
- * %g6 = %hi(_cpcb)
- * %g7 = %hi(_curproc)
- * %o0 = tmp 1
- * %o1 = tmp 2
- * %o3 = whichqs
- */
-
- INCR(_nswitchexit) ! nswitchexit++;
- INCR(_cnt+V_SWTCH) ! cnt.v_switch++;
-
- mov PSR_S|PSR_ET, %g1 ! oldpsr = PSR_S | PSR_ET;
- sethi %hi(_whichqs), %g2
- clr %g4 ! lastproc = NULL;
- sethi UADDR, %g6
- sethi %hi(_curproc), %g7
- /* FALLTHROUGH */
-
-/*
- * When no processes are on the runq, switch
- * idles here waiting for something to come ready.
- * The registers are set up as noted above.
- */
-! .globl idle
-idle:
- st %g0, [%g7 + %lo(_curproc)] ! curproc = NULL;
- wr %g1, 0, %psr ! (void) spl0();
- nop
- call _spl0
- nop
-
- mov PSR_S|PSR_ET, %g1 ! oldpsr = PSR_S | PSR_ET;
- sethi %hi(_whichqs), %g2
- clr %g4 ! lastproc = NULL;
- sethi UADDR, %g6
- sethi %hi(_curproc), %g7
-
-1: ! spin reading _whichqs until nonzero
- ld [%g2 + %lo(_whichqs)], %o3
- tst %o3
-#if 1
- bz 1b
- mov SPL_CLOCK, %o0
- b Lsw_scan
- stba %o0, [%g0](ASI_DGRAM) ! (void) splclock();
-#else
-#define PIL_CLOCK 12
- bnz,a Lsw_scan
- wr %g1, PIL_CLOCK << 8, %psr ! (void) splclock();
- b,a 1b
-#endif
-
-Lsw_panic_rq:
- sethi %hi(1f), %o0
- call _panic
- or %lo(1f), %o0, %o0
-Lsw_panic_wchan:
- sethi %hi(2f), %o0
- call _panic
- or %lo(2f), %o0, %o0
-Lsw_panic_srun:
- sethi %hi(3f), %o0
- call _panic
- or %lo(3f), %o0, %o0
-1: .asciz "switch rq"
-2: .asciz "switch wchan"
-3: .asciz "switch SRUN"
- _ALIGN
-
-/*
- * cpu_switch() picks a process to run and runs it, saving the current
- * one away. On the assumption that (since most workstations are
- * single user machines) the chances are quite good that the new
- * process will turn out to be the current process, we defer saving
- * it here until we have found someone to load. If that someone
- * is the current process we avoid both store and load.
- *
- * cpu_switch() is always entered at splstatclock or splhigh.
- *
- * IT MIGHT BE WORTH SAVING BEFORE ENTERING idle TO AVOID HAVING TO
- * SAVE LATER WHEN SOMEONE ELSE IS READY ... MUST MEASURE!
- */
- .globl _runtime
- .globl _time
-ENTRY(cpu_switch)
- /*
- * REGISTER USAGE AT THIS POINT:
- * %g1 = oldpsr (excluding ipl bits)
- * %g2 = %hi(_whichqs)
- * %g3 = p
- * %g4 = lastproc
- * %g5 = tmp 0
- * %g6 = %hi(_cpcb)
- * %g7 = %hi(_curproc)
- * %o0 = tmp 1
- * %o1 = tmp 2
- * %o2 = tmp 3
- * %o3 = tmp 4, then at Lsw_scan, whichqs
- * %o4 = tmp 5, then at Lsw_scan, which
- * %o5 = tmp 6, then at Lsw_scan, q
- */
- sethi %hi(_whichqs), %g2 ! set up addr regs
- sethi UADDR, %g6
- std %o6, [%g6 + PCB_SP] ! cpcb->pcb_<sp,pc> = <sp,pc>;
- rd %psr, %g1 ! oldpsr = %psr;
- sethi %hi(_curproc), %g7
- ld [%g7 + %lo(_curproc)], %g4 ! lastproc = curproc;
- st %g1, [%g6 + PCB_PSR] ! cpcb->pcb_psr = oldpsr;
- andn %g1, PSR_PIL, %g1 ! oldpsr &= ~PSR_PIL;
-
- /*
- * In all the fiddling we did to get this far, the thing we are
- * waiting for might have come ready, so let interrupts in briefly
- * before checking for other processes. Note that we still have
- * curproc set---we have to fix this or we can get in trouble with
- * the run queues below.
- */
- st %g0, [%g7 + %lo(_curproc)] ! curproc = NULL;
- stba %g0, [%g0](ASI_DGRAM)
- wr %g1, 0, %psr ! (void) spl0();
-#if 1
- mov SPL_CLOCK, %o0
- stba %o0, [%g0](ASI_DGRAM) ! (void) splclock();
-#else
- nop; nop; nop ! paranoia
- wr %g1, PIL_CLOCK << 8, %psr ! (void) splclock()
-#endif
-
-
-Lsw_scan:
- /*
- * We're about to run a (possibly) new process. Set runtime
- * to indicate its start time.
- */
- sethi %hi(_time), %o0
- ldd [%o0 + %lo(_time)], %o2
- sethi %hi(_runtime), %o0
- std %o2, [%o0 + %lo(_runtime)]
-
- ld [%g2 + %lo(_whichqs)], %o3
-
- /*
- * Optimized inline expansion of `which = ffs(whichqs) - 1';
- * branches to idle if ffs(whichqs) was 0.
- */
- set ffstab, %o2
- andcc %o3, 0xff, %o1 ! byte 0 zero?
- bz,a 1f ! yes, try byte 1
- srl %o3, 8, %o0
- b 2f ! ffs = ffstab[byte0]; which = ffs - 1;
- ldsb [%o2 + %o1], %o0
-1: andcc %o0, 0xff, %o1 ! byte 1 zero?
- bz,a 1f ! yes, try byte 2
- srl %o0, 8, %o0
- ldsb [%o2 + %o1], %o0 ! which = ffstab[byte1] + 7;
- b 3f
- add %o0, 7, %o4
-1: andcc %o0, 0xff, %o1 ! byte 2 zero?
- bz,a 1f ! yes, try byte 3
- srl %o0, 8, %o0
- ldsb [%o2 + %o1], %o0 ! which = ffstab[byte2] + 15;
- b 3f
- add %o0, 15, %o4
-1: ldsb [%o2 + %o0], %o0 ! ffs = ffstab[byte3] + 24
- addcc %o0, 24, %o0 ! (note that ffstab[0] == -24)
- bz idle ! if answer was 0, go idle
- EMPTY
-2: sub %o0, 1, %o4 ! which = ffs(whichqs) - 1
-3: /* end optimized inline expansion */
-
- /*
- * We found a nonempty run queue. Take its first process.
- */
- set _qs, %o5 ! q = &qs[which];
- sll %o4, 3, %o0
- add %o0, %o5, %o5
- ld [%o5], %g3 ! p = q->ph_link;
- cmp %g3, %o5 ! if (p == q)
- be Lsw_panic_rq ! panic("switch rq");
- EMPTY
- ld [%g3], %o0 ! tmp0 = p->p_forw;
- st %o0, [%o5] ! q->ph_link = tmp0;
- st %o5, [%o0 + 4] ! tmp0->p_back = q;
- cmp %o0, %o5 ! if (tmp0 == q)
- bne 1f
- EMPTY
- mov 1, %o1 ! whichqs &= ~(1 << which);
- sll %o1, %o4, %o1
- andn %o3, %o1, %o3
- st %o3, [%g2 + %lo(_whichqs)]
-1:
- /*
- * PHASE TWO: NEW REGISTER USAGE:
- * %g1 = oldpsr (excluding ipl bits)
- * %g2 = newpsr
- * %g3 = p
- * %g4 = lastproc
- * %g5 = newpcb
- * %g6 = %hi(_cpcb)
- * %g7 = %hi(_curproc)
- * %o0 = tmp 1
- * %o1 = tmp 2
- * %o2 = tmp 3
- * %o3 = vm
- * %o4 = sswap
- * %o5 = <free>
- */
-
- /* firewalls */
- ld [%g3 + P_WCHAN], %o0 ! if (p->p_wchan)
- tst %o0
- bne Lsw_panic_wchan ! panic("switch wchan");
- EMPTY
- ldsb [%g3 + P_STAT], %o0 ! if (p->p_stat != SRUN)
- cmp %o0, SRUN
- bne Lsw_panic_srun ! panic("switch SRUN");
- EMPTY
-
- /*
- * Committed to running process p.
- * It may be the same as the one we were running before.
- */
- sethi %hi(_want_resched), %o0
- st %g0, [%o0 + %lo(_want_resched)] ! want_resched = 0;
- ld [%g3 + P_ADDR], %g5 ! newpcb = p->p_addr;
- st %g0, [%g3 + 4] ! p->p_back = NULL;
- ld [%g5 + PCB_PSR], %g2 ! newpsr = newpcb->pcb_psr;
- st %g3, [%g7 + %lo(_curproc)] ! curproc = p;
-
- cmp %g3,%g0
- te 20
-
- cmp %g3, %g4 ! p == lastproc?
- be,a Lsw_sameproc ! yes, go return 0
- wr %g2, 0, %psr ! (after restoring ipl)
-
- /*
- * Not the old process. Save the old process, if any;
- * then load p.
- */
- tst %g4
- be,a Lsw_load ! if no old process, go load
- EMPTY
-
- INCR(_nswitchdiff) ! clobbers %o0,%o1
- /*
- * save: write back all windows (including the current one).
- * XXX crude; knows nwindows <= 8
- */
-#define SAVE save %sp, -64, %sp
-wb1: SAVE; SAVE; SAVE; SAVE; SAVE; SAVE; SAVE /* 7 of each: */
- restore; restore; restore; restore; restore; restore; restore
-
- /*
- * Load the new process. To load, we must change stacks and
- * alter cpcb and %wim, hence we must disable traps. %psr is
- * currently equal to oldpsr (%g1) ^ (PIL_CLOCK << 8);
- * this means that PSR_ET is on. Likewise, PSR_ET is on
- * in newpsr (%g2), although we do not know newpsr's ipl.
- *
- * We also must load up the `in' and `local' registers.
- */
-
-Lsw_load:
- wr %g1, PSR_ET, %psr ! Disable traps
- /* compute new wim */
- ld [%g5 + PCB_WIM], %o0
- mov 1, %o1
- sll %o1, %o0, %o0
- wr %o0, 0, %wim ! %wim = 1 << newpcb->pcb_wim;
- /* now must not change %psr for 3 more instrs */
-/*1*/ set PSR_EF|PSR_EC, %o0
-/*2*/ andn %g2, %o0, %g2 ! newpsr &= ~(PSR_EF|PSR_EC);
-/*3*/ nop
- /* set new psr, but with traps disabled */
- wr %g2, PSR_ET, %psr ! %psr = newpsr ^ PSR_ET;
- stba %g0,[%g0](ASI_DGRAM)
- /* set new cpcb: cpcb = newpcb */
- /* Set new u. ptes. */
- sethi UADDR, %g6
- ld [%g3 + P_UPTE], %g7
- sta %g7, [%g6](ASI_FGTLB_VALD)
- sethi UADDR + NBPG, %g6
- ld [%g3 + P_UPTE + 4], %g7
- sta %g7, [%g6](ASI_FGTLB_VALD)
- /* XXX update masterpaddr too */
-wb2: sethi %hi(_masterpaddr), %g7
- st %g5, [%g7 + %lo(_masterpaddr)]
- ldd [%g5 + PCB_SP], %o6 ! <sp,pc> = newpcb->pcb_<sp,pc>
- /* finally, enable traps */
-wb3: wr %g2, 0, %psr ! psr = newpsr;
- nop
- nop
- nop
-
- /* load window */
- ldd [%sp + (0*8)], %l0
- ldd [%sp + (1*8)], %l2
- ldd [%sp + (2*8)], %l4
- ldd [%sp + (3*8)], %l6
- ldd [%sp + (4*8)], %i0
- ldd [%sp + (5*8)], %i2
- ldd [%sp + (6*8)], %i4
- ldd [%sp + (7*8)], %i6
-
-#ifdef DEBUG
- mov %g5, %o0
- SET_SP_REDZONE(%o0, %o1)
- CHECK_SP_REDZONE(%o0, %o1)
-#endif
-
- /*
- * Now running p. Make sure it has a context so that it
- * can talk about user space stuff. (Its pcb_uw is currently
- * zero so it is safe to have interrupts going here.)
- */
-! call _Debugger
-! nop
- ld [%g3 + P_VMSPACE], %o3 ! vm = p->p_vmspace;
- ld [%o3 + VM_PSEGTAB], %o0 ! vm->vm_pmap.pm_psegtab
- sethi SERIES5_PDT_BASE, %o1
- sethi PG_FRAME, %o2
- andn %o0, %o2, %o3
- or %o3, %o1, %o3
- sta %o3, [%g0](ASI_PDBA)
- and %o0, %o2, %o0
- or %o0, PG_WINDOW, %o0
- sta %o0, [%o1](ASI_FGTLB_VALD)
- sta %g0, [%g0](ASI_FGTLB_INV) ! Flush TLB
-Lsw_sameproc:
- /*
- * We are resuming the process that was running at the
- * call to switch(). Just set psr ipl and return.
- */
-! wr %g2, 0 %psr ! %psr = newpsr; (done earlier)
- nop
- retl
- nop
-
-
-/*
- * Snapshot the current process so that stack frames are up to date.
- * Only used just before a crash dump.
- */
-ENTRY(snapshot)
- st %o6, [%o0 + PCB_SP] ! save sp
- rd %psr, %o1 ! save psr
- st %o1, [%o0 + PCB_PSR]
-
- /*
- * Just like switch(); same XXX comments apply.
- * 7 of each. Minor tweak: the 7th restore is
- * done after a ret.
- */
- SAVE; SAVE; SAVE; SAVE; SAVE; SAVE; SAVE
- restore; restore; restore; restore; restore; restore; ret; restore
-
-
-/*
- * cpu_set_kpc() and cpu_fork() arrange for proc_trampoline() to run
- * after after a process gets chosen in switch(). The stack frame will
- * contain a function pointer in %l0, and an argument to pass to it in %l2.
- *
- * If the function *(%l0) returns, we arrange for an immediate return
- * to user mode. This happens in two known cases: after execve(2) of init,
- * and when returning a child to user mode after a fork(2).
- */
-ENTRY(proc_trampoline)
- call %l0 ! re-use current frame
- mov %l1, %o0
-
- /*
- * Here we finish up as in syscall, but simplified. We need to
- * fiddle pc and npc a bit, as execve() / setregs() /cpu_set_kpc()
- * have only set npc, in anticipation that trap.c will advance past
- * the trap instruction; but we bypass that, so we must do it manually.
- */
- mov PSR_S, %l0 ! user psr (no need to load it)
- !?wr %g0, 2, %wim ! %wim = 2
- ld [%sp + CCFSZ + 8], %l1 ! pc = tf->tf_npc from execve/fork
- b return_from_syscall
- add %l1, 4, %l2 ! npc = pc+4
-
-/*
- * {fu,su}{,i}{byte,word}
- */
-ALTENTRY(fuiword)
-ENTRY(fuword)
- set KERNBASE, %o2
- cmp %o0, %o2 ! if addr >= KERNBASE...
- bgeu Lfsbadaddr
- EMPTY
- btst 3, %o0 ! or has low bits set...
- bnz Lfsbadaddr ! go return -1
- EMPTY
- sethi UADDR, %o2 ! cpcb->pcb_onfault = Lfserr;
- set Lfserr, %o3
- st %o3, [%o2 + PCB_ONFAULT]
- ld [%o0], %o0 ! fetch the word
- retl ! phew, made it, return the word
- st %g0, [%o2 + PCB_ONFAULT]! but first clear onfault
-
-Lfserr:
- st %g0, [%o2 + PCB_ONFAULT]! error in r/w, clear pcb_onfault
-Lfsbadaddr:
- retl ! and return error indicator
- mov -1, %o0
-
- /*
- * This is just like Lfserr, but it's a global label that allows
- * mem_access_fault() to check to see that we don't want to try to
- * page in the fault. It's used by fuswintr() etc.
- */
- .globl _Lfsbail
-_Lfsbail:
- st %g0, [%o2 + PCB_ONFAULT]! error in r/w, clear pcb_onfault
- retl ! and return error indicator
- mov -1, %o0
-
- /*
- * Like fusword but callable from interrupt context.
- * Fails if data isn't resident.
- */
-ENTRY(fuswintr)
- set KERNBASE, %o2
- cmp %o0, %o2 ! if addr >= KERNBASE
- bgeu Lfsbadaddr ! return error
- EMPTY
- sethi UADDR, %o2 ! cpcb->pcb_onfault = _Lfsbail;
- set _Lfsbail, %o3
- st %o3, [%o2 + PCB_ONFAULT]
- lduh [%o0], %o0 ! fetch the halfword
- retl ! made it
- st %g0, [%o2 + PCB_ONFAULT]! but first clear onfault
-
-ENTRY(fusword)
- set KERNBASE, %o2
- cmp %o0, %o2 ! if addr >= KERNBASE
- bgeu Lfsbadaddr ! return error
- EMPTY
- sethi UADDR, %o2 ! cpcb->pcb_onfault = Lfserr;
- set Lfserr, %o3
- st %o3, [%o2 + PCB_ONFAULT]
- lduh [%o0], %o0 ! fetch the halfword
- retl ! made it
- st %g0, [%o2 + PCB_ONFAULT]! but first clear onfault
-
-ALTENTRY(fuibyte)
-ENTRY(fubyte)
- set KERNBASE, %o2
- cmp %o0, %o2 ! if addr >= KERNBASE
- bgeu Lfsbadaddr ! return error
- EMPTY
- sethi UADDR, %o2 ! cpcb->pcb_onfault = Lfserr;
- set Lfserr, %o3
- st %o3, [%o2 + PCB_ONFAULT]
- ldub [%o0], %o0 ! fetch the byte
- retl ! made it
- st %g0, [%o2 + PCB_ONFAULT]! but first clear onfault
-
-ALTENTRY(suiword)
-ENTRY(suword)
- set KERNBASE, %o2
- cmp %o0, %o2 ! if addr >= KERNBASE ...
- bgeu Lfsbadaddr
- EMPTY
- btst 3, %o0 ! or has low bits set ...
- bnz Lfsbadaddr ! go return error
- EMPTY
- sethi UADDR, %o2 ! cpcb->pcb_onfault = Lfserr;
- set Lfserr, %o3
- st %o3, [%o2 + PCB_ONFAULT]
- st %o1, [%o0] ! store the word
- st %g0, [%o2 + PCB_ONFAULT]! made it, clear onfault
- retl ! and return 0
- clr %o0
-
-ENTRY(suswintr)
- set KERNBASE, %o2
- cmp %o0, %o2 ! if addr >= KERNBASE
- bgeu Lfsbadaddr ! go return error
- EMPTY
- sethi UADDR, %o2 ! cpcb->pcb_onfault = _Lfsbail;
- set _Lfsbail, %o3
- st %o3, [%o2 + PCB_ONFAULT]
- sth %o1, [%o0] ! store the halfword
- st %g0, [%o2 + PCB_ONFAULT]! made it, clear onfault
- retl ! and return 0
- clr %o0
-
-ENTRY(susword)
- set KERNBASE, %o2
- cmp %o0, %o2 ! if addr >= KERNBASE
- bgeu Lfsbadaddr ! go return error
- EMPTY
- sethi UADDR, %o2 ! cpcb->pcb_onfault = Lfserr;
- set Lfserr, %o3
- st %o3, [%o2 + PCB_ONFAULT]
- sth %o1, [%o0] ! store the halfword
- st %g0, [%o2 + PCB_ONFAULT]! made it, clear onfault
- retl ! and return 0
- clr %o0
-
-ALTENTRY(suibyte)
-ENTRY(subyte)
- set KERNBASE, %o2
- cmp %o0, %o2 ! if addr >= KERNBASE
- bgeu Lfsbadaddr ! go return error
- EMPTY
- sethi UADDR, %o2 ! cpcb->pcb_onfault = Lfserr;
- set Lfserr, %o3
- st %o3, [%o2 + PCB_ONFAULT]
- stb %o1, [%o0] ! store the byte
- st %g0, [%o2 + PCB_ONFAULT]! made it, clear onfault
- retl ! and return 0
- clr %o0
-
-/* probeget and probeset are meant to be used during autoconfiguration */
-
-/*
- * probeget(addr, size) caddr_t addr; int size;
- *
- * Read or write a (byte,word,longword) from the given address.
- * Like {fu,su}{byte,halfword,word} but our caller is supposed
- * to know what he is doing... the address can be anywhere.
- *
- * We optimize for space, rather than time, here.
- */
-ENTRY(probeget)
- ! %o0 = addr, %o1 = (1,2,4)
- sethi UADDR, %o2 ! cpcb->pcb_onfault = Lfserr;
- set Lfserr, %o5
- st %o5, [%o2 + PCB_ONFAULT]
- btst 1, %o1
- bnz,a 0f ! if (len & 1)
- ldub [%o0], %o0 ! value = *(char *)addr;
-0: btst 2, %o1
- bnz,a 0f ! if (len & 2)
- lduh [%o0], %o0 ! value = *(short *)addr;
-0: btst 4, %o1
- bnz,a 0f ! if (len & 4)
- ld [%o0], %o0 ! value = *(int *)addr;
-0: retl ! made it, clear onfault and return
- st %g0, [%o2 + PCB_ONFAULT]
-
-/*
- * probeset(addr, size, val) caddr_t addr; int size, val;
- *
- * As above, but we return 0 on success.
- */
-ENTRY(probeset)
- ! %o0 = addr, %o1 = (1,2,4), %o2 = val
- sethi UADDR, %o3 ! cpcb->pcb_onfault = Lfserr;
- set Lfserr, %o5
- st %o5, [%o3 + PCB_ONFAULT]
- btst 1, %o1
- bnz,a 0f ! if (len & 1)
- stb %o2, [%o0] ! *(char *)addr = value;
-0: btst 2, %o1
- bnz,a 0f ! if (len & 2)
- sth %o2, [%o0] ! *(short *)addr = value;
-0: btst 4, %o1
- bnz,a 0f ! if (len & 4)
- st %o2, [%o0] ! *(int *)addr = value;
-0: clr %o0 ! made it, clear onfault and return 0
- retl
- st %g0, [%o3 + PCB_ONFAULT]
-
-/*
- * Insert entry into doubly-linked queue.
- * We could just do this in C, but gcc does not do leaves well (yet).
- */
-ENTRY(_insque)
- ! %o0 = e = what to insert; %o1 = after = entry to insert after
- st %o1, [%o0 + 4] ! e->prev = after;
- ld [%o1], %o2 ! tmp = after->next;
- st %o2, [%o0] ! e->next = tmp;
- st %o0, [%o1] ! after->next = e;
- retl
- st %o0, [%o2 + 4] ! tmp->prev = e;
-
-
-/*
- * Remove entry from doubly-linked queue.
- */
-ENTRY(_remque)
- ! %o0 = e = what to remove
- ld [%o0], %o1 ! n = e->next;
- ld [%o0 + 4], %o2 ! p = e->prev;
- st %o2, [%o1 + 4] ! n->prev = p;
- retl
- st %o1, [%o2] ! p->next = n;
-
-/*
- * copywords(src, dst, nbytes)
- *
- * Copy `nbytes' bytes from src to dst, both of which are word-aligned;
- * nbytes is a multiple of four. It may, however, be zero, in which case
- * nothing is to be copied.
- */
-ENTRY(copywords)
- ! %o0 = src, %o1 = dst, %o2 = nbytes
- b 1f
- deccc 4, %o2
-0:
- st %o3, [%o1 + %o2]
- deccc 4, %o2 ! while ((n -= 4) >= 0)
-1:
- bge,a 0b ! *(int *)(dst+n) = *(int *)(src+n);
- ld [%o0 + %o2], %o3
- retl
- nop
-
-/*
- * qcopy(src, dst, nbytes)
- *
- * (q for `quad' or `quick', as opposed to b for byte/block copy)
- *
- * Just like copywords, but everything is multiples of 8.
- */
-ENTRY(qcopy)
- b 1f
- deccc 8, %o2
-0:
- std %o4, [%o1 + %o2]
- deccc 8, %o2
-1:
- bge,a 0b
- ldd [%o0 + %o2], %o4
- retl
- nop
-
-/*
- * qzero(addr, nbytes)
- *
- * Zeroes `nbytes' bytes of a quad-aligned virtual address,
- * where nbytes is itself a multiple of 8.
- */
-ENTRY(qzero)
- ! %o0 = addr, %o1 = len (in bytes)
- clr %g1
-0:
- deccc 8, %o1 ! while ((n =- 8) >= 0)
- bge,a 0b
- std %g0, [%o0 + %o1] ! *(quad *)(addr + n) = 0;
- retl
- nop
-
-/*
- * kernel bcopy/memcpy
- * Assumes regions do not overlap; has no useful return value.
- *
- * Must not use %g7 (see copyin/copyout above).
- */
-
-#define BCOPY_SMALL 32 /* if < 32, copy by bytes */
-
-ENTRY(memcpy)
- /*
- * Swap args for bcopy. Gcc generates calls to memcpy for
- * structure assignments.
- */
- mov %o0, %o3
- mov %o1, %o0
- mov %o3, %o1
-ENTRY(bcopy)
- cmp %o2, BCOPY_SMALL
-Lbcopy_start:
- bge,a Lbcopy_fancy ! if >= this many, go be fancy.
- btst 7, %o0 ! (part of being fancy)
-
- /*
- * Not much to copy, just do it a byte at a time.
- */
- deccc %o2 ! while (--len >= 0)
- bl 1f
- EMPTY
-0:
- inc %o0
- ldsb [%o0 - 1], %o4 ! (++dst)[-1] = *src++;
- stb %o4, [%o1]
- deccc %o2
- bge 0b
- inc %o1
-1:
- retl
- nop
- /* NOTREACHED */
-
- /*
- * Plenty of data to copy, so try to do it optimally.
- */
-Lbcopy_fancy:
- ! check for common case first: everything lines up.
-! btst 7, %o0 ! done already
- bne 1f
- EMPTY
- btst 7, %o1
- be,a Lbcopy_doubles
- dec 8, %o2 ! if all lined up, len -= 8, goto bcopy_doubes
-
- ! If the low bits match, we can make these line up.
-1:
- xor %o0, %o1, %o3 ! t = src ^ dst;
- btst 1, %o3 ! if (t & 1) {
- be,a 1f
- btst 1, %o0 ! [delay slot: if (src & 1)]
-
- ! low bits do not match, must copy by bytes.
-0:
- ldsb [%o0], %o4 ! do {
- inc %o0 ! (++dst)[-1] = *src++;
- inc %o1
- deccc %o2
- bnz 0b ! } while (--len != 0);
- stb %o4, [%o1 - 1]
- retl
- nop
- /* NOTREACHED */
-
- ! lowest bit matches, so we can copy by words, if nothing else
-1:
- be,a 1f ! if (src & 1) {
- btst 2, %o3 ! [delay slot: if (t & 2)]
-
- ! although low bits match, both are 1: must copy 1 byte to align
- ldsb [%o0], %o4 ! *dst++ = *src++;
- stb %o4, [%o1]
- inc %o0
- inc %o1
- dec %o2 ! len--;
- btst 2, %o3 ! } [if (t & 2)]
-1:
- be,a 1f ! if (t & 2) {
- btst 2, %o0 ! [delay slot: if (src & 2)]
- dec 2, %o2 ! len -= 2;
-0:
- ldsh [%o0], %o4 ! do {
- sth %o4, [%o1] ! *(short *)dst = *(short *)src;
- inc 2, %o0 ! dst += 2, src += 2;
- deccc 2, %o2 ! } while ((len -= 2) >= 0);
- bge 0b
- inc 2, %o1
- b Lbcopy_mopb ! goto mop_up_byte;
- btst 1, %o2 ! } [delay slot: if (len & 1)]
- /* NOTREACHED */
-
- ! low two bits match, so we can copy by longwords
-1:
- be,a 1f ! if (src & 2) {
- btst 4, %o3 ! [delay slot: if (t & 4)]
-
- ! although low 2 bits match, they are 10: must copy one short to align
- ldsh [%o0], %o4 ! (*short *)dst = *(short *)src;
- sth %o4, [%o1]
- inc 2, %o0 ! dst += 2;
- inc 2, %o1 ! src += 2;
- dec 2, %o2 ! len -= 2;
- btst 4, %o3 ! } [if (t & 4)]
-1:
- be,a 1f ! if (t & 4) {
- btst 4, %o0 ! [delay slot: if (src & 4)]
- dec 4, %o2 ! len -= 4;
-0:
- ld [%o0], %o4 ! do {
- st %o4, [%o1] ! *(int *)dst = *(int *)src;
- inc 4, %o0 ! dst += 4, src += 4;
- deccc 4, %o2 ! } while ((len -= 4) >= 0);
- bge 0b
- inc 4, %o1
- b Lbcopy_mopw ! goto mop_up_word_and_byte;
- btst 2, %o2 ! } [delay slot: if (len & 2)]
- /* NOTREACHED */
-
- ! low three bits match, so we can copy by doublewords
-1:
- be 1f ! if (src & 4) {
- dec 8, %o2 ! [delay slot: len -= 8]
- ld [%o0], %o4 ! *(int *)dst = *(int *)src;
- st %o4, [%o1]
- inc 4, %o0 ! dst += 4, src += 4, len -= 4;
- inc 4, %o1
- dec 4, %o2 ! }
-1:
-Lbcopy_doubles:
- ldd [%o0], %o4 ! do {
- std %o4, [%o1] ! *(double *)dst = *(double *)src;
- inc 8, %o0 ! dst += 8, src += 8;
- deccc 8, %o2 ! } while ((len -= 8) >= 0);
- bge Lbcopy_doubles
- inc 8, %o1
-
- ! check for a usual case again (save work)
- btst 7, %o2 ! if ((len & 7) == 0)
- be Lbcopy_done ! goto bcopy_done;
-
- btst 4, %o2 ! if ((len & 4)) == 0)
- be,a Lbcopy_mopw ! goto mop_up_word_and_byte;
- btst 2, %o2 ! [delay slot: if (len & 2)]
- ld [%o0], %o4 ! *(int *)dst = *(int *)src;
- st %o4, [%o1]
- inc 4, %o0 ! dst += 4;
- inc 4, %o1 ! src += 4;
- btst 2, %o2 ! } [if (len & 2)]
-
-1:
- ! mop up trailing word (if present) and byte (if present).
-Lbcopy_mopw:
- be Lbcopy_mopb ! no word, go mop up byte
- btst 1, %o2 ! [delay slot: if (len & 1)]
- ldsh [%o0], %o4 ! *(short *)dst = *(short *)src;
- be Lbcopy_done ! if ((len & 1) == 0) goto done;
- sth %o4, [%o1]
- ldsb [%o0 + 2], %o4 ! dst[2] = src[2];
- retl
- stb %o4, [%o1 + 2]
- /* NOTREACHED */
-
- ! mop up trailing byte (if present).
-Lbcopy_mopb:
- bne,a 1f
- ldsb [%o0], %o4
-
-Lbcopy_done:
- retl
- nop
-
-1:
- retl
- stb %o4,[%o1]
-/*
- * ovbcopy(src, dst, len): like bcopy, but regions may overlap.
- */
-ENTRY(ovbcopy)
- cmp %o0, %o1 ! src < dst?
- bgeu Lbcopy_start ! no, go copy forwards as via bcopy
- cmp %o2, BCOPY_SMALL! (check length for doublecopy first)
-
- /*
- * Since src comes before dst, and the regions might overlap,
- * we have to do the copy starting at the end and working backwards.
- */
- add %o2, %o0, %o0 ! src += len
- add %o2, %o1, %o1 ! dst += len
- bge,a Lback_fancy ! if len >= BCOPY_SMALL, go be fancy
- btst 3, %o0
-
- /*
- * Not much to copy, just do it a byte at a time.
- */
- deccc %o2 ! while (--len >= 0)
- bl 1f
- EMPTY
-0:
- dec %o0 ! *--dst = *--src;
- ldsb [%o0], %o4
- dec %o1
- deccc %o2
- bge 0b
- stb %o4, [%o1]
-1:
- retl
- nop
-
- /*
- * Plenty to copy, try to be optimal.
- * We only bother with word/halfword/byte copies here.
- */
-Lback_fancy:
-! btst 3, %o0 ! done already
- bnz 1f ! if ((src & 3) == 0 &&
- btst 3, %o1 ! (dst & 3) == 0)
- bz,a Lback_words ! goto words;
- dec 4, %o2 ! (done early for word copy)
-
-1:
- /*
- * See if the low bits match.
- */
- xor %o0, %o1, %o3 ! t = src ^ dst;
- btst 1, %o3
- bz,a 3f ! if (t & 1) == 0, can do better
- btst 1, %o0
-
- /*
- * Nope; gotta do byte copy.
- */
-2:
- dec %o0 ! do {
- ldsb [%o0], %o4 ! *--dst = *--src;
- dec %o1
- deccc %o2 ! } while (--len != 0);
- bnz 2b
- stb %o4, [%o1]
- retl
- nop
-
-3:
- /*
- * Can do halfword or word copy, but might have to copy 1 byte first.
- */
-! btst 1, %o0 ! done earlier
- bz,a 4f ! if (src & 1) { /* copy 1 byte */
- btst 2, %o3 ! (done early)
- dec %o0 ! *--dst = *--src;
- ldsb [%o0], %o4
- dec %o1
- stb %o4, [%o1]
- dec %o2 ! len--;
- btst 2, %o3 ! }
-
-4:
- /*
- * See if we can do a word copy ((t&2) == 0).
- */
-! btst 2, %o3 ! done earlier
- bz,a 6f ! if (t & 2) == 0, can do word copy
- btst 2, %o0 ! (src&2, done early)
-
- /*
- * Gotta do halfword copy.
- */
- dec 2, %o2 ! len -= 2;
-5:
- dec 2, %o0 ! do {
- ldsh [%o0], %o4 ! src -= 2;
- dec 2, %o1 ! dst -= 2;
- deccc 2, %o0 ! *(short *)dst = *(short *)src;
- bge 5b ! } while ((len -= 2) >= 0);
- sth %o4, [%o1]
- b Lback_mopb ! goto mop_up_byte;
- btst 1, %o2 ! (len&1, done early)
-
-6:
- /*
- * We can do word copies, but we might have to copy
- * one halfword first.
- */
-! btst 2, %o0 ! done already
- bz 7f ! if (src & 2) {
- dec 4, %o2 ! (len -= 4, done early)
- dec 2, %o0 ! src -= 2, dst -= 2;
- ldsh [%o0], %o4 ! *(short *)dst = *(short *)src;
- dec 2, %o1
- sth %o4, [%o1]
- dec 2, %o2 ! len -= 2;
- ! }
-
-7:
-Lback_words:
- /*
- * Do word copies (backwards), then mop up trailing halfword
- * and byte if any.
- */
-! dec 4, %o2 ! len -= 4, done already
-0: ! do {
- dec 4, %o0 ! src -= 4;
- dec 4, %o1 ! src -= 4;
- ld [%o0], %o4 ! *(int *)dst = *(int *)src;
- deccc 4, %o2 ! } while ((len -= 4) >= 0);
- bge 0b
- st %o4, [%o1]
-
- /*
- * Check for trailing shortword.
- */
- btst 2, %o2 ! if (len & 2) {
- bz,a 1f
- btst 1, %o2 ! (len&1, done early)
- dec 2, %o0 ! src -= 2, dst -= 2;
- ldsh [%o0], %o4 ! *(short *)dst = *(short *)src;
- dec 2, %o1
- sth %o4, [%o1] ! }
- btst 1, %o2
-
- /*
- * Check for trailing byte.
- */
-1:
-Lback_mopb:
-! btst 1, %o2 ! (done already)
- bnz,a 1f ! if (len & 1) {
- ldsb [%o0 - 1], %o4 ! b = src[-1];
- retl
- nop
-1:
- retl ! dst[-1] = b;
- stb %o4, [%o1 - 1] ! }
-
-
-/*
- * savefpstate(f) struct fpstate *f;
- *
- * Store the current FPU state. The first `st %fsr' may cause a trap;
- * our trap handler knows how to recover (by `returning' to savefpcont).
- */
-ENTRY(savefpstate)
- rd %psr, %o1 ! enable FP before we begin
- set PSR_EF, %o2
- or %o1, %o2, %o1
- wr %o1, 0, %psr
- /* do some setup work while we wait for PSR_EF to turn on */
- set FSR_QNE, %o5 ! QNE = 0x2000, too big for immediate
- clr %o3 ! qsize = 0;
- nop ! (still waiting for PSR_EF)
-special_fp_store:
- st %fsr, [%o0 + FS_FSR] ! f->fs_fsr = getfsr();
- /*
- * Even if the preceding instruction did not trap, the queue
- * is not necessarily empty: this state save might be happening
- * because user code tried to store %fsr and took the FPU
- * from `exception pending' mode to `exception' mode.
- * So we still have to check the blasted QNE bit.
- * With any luck it will usually not be set.
- */
- ld [%o0 + FS_FSR], %o4 ! if (f->fs_fsr & QNE)
- btst %o5, %o4
- bnz Lfp_storeq ! goto storeq;
- std %f0, [%o0 + FS_REGS + (4*0)] ! f->fs_f0 = etc;
-Lfp_finish:
- st %o3, [%o0 + FS_QSIZE] ! f->fs_qsize = qsize;
- std %f2, [%o0 + FS_REGS + (4*2)]
- std %f4, [%o0 + FS_REGS + (4*4)]
- std %f6, [%o0 + FS_REGS + (4*6)]
- std %f8, [%o0 + FS_REGS + (4*8)]
- std %f10, [%o0 + FS_REGS + (4*10)]
- std %f12, [%o0 + FS_REGS + (4*12)]
- std %f14, [%o0 + FS_REGS + (4*14)]
- std %f16, [%o0 + FS_REGS + (4*16)]
- std %f18, [%o0 + FS_REGS + (4*18)]
- std %f20, [%o0 + FS_REGS + (4*20)]
- std %f22, [%o0 + FS_REGS + (4*22)]
- std %f24, [%o0 + FS_REGS + (4*24)]
- std %f26, [%o0 + FS_REGS + (4*26)]
- std %f28, [%o0 + FS_REGS + (4*28)]
- retl
- std %f30, [%o0 + FS_REGS + (4*30)]
-
-/*
- * Store the (now known nonempty) FP queue.
- * We have to reread the fsr each time in order to get the new QNE bit.
- */
-Lfp_storeq:
- add %o0, FS_QUEUE, %o1 ! q = &f->fs_queue[0];
-1:
- std %fq, [%o1 + %o3] ! q[qsize++] = fsr_qfront();
- st %fsr, [%o0 + FS_FSR] ! reread fsr
- ld [%o0 + FS_FSR], %o4 ! if fsr & QNE, loop
- btst %o5, %o4
- bnz 1b
- inc 8, %o3
- b Lfp_finish ! set qsize and finish storing fregs
- srl %o3, 3, %o3 ! (but first fix qsize)
-
-/*
- * The fsr store trapped. Do it again; this time it will not trap.
- * We could just have the trap handler return to the `st %fsr', but
- * if for some reason it *does* trap, that would lock us into a tight
- * loop. This way we panic instead. Whoopee.
- */
-savefpcont:
- b special_fp_store + 4 ! continue
- st %fsr, [%o0 + FS_FSR] ! but first finish the %fsr store
-
-/*
- * Load FPU state.
- */
-ENTRY(loadfpstate)
- rd %psr, %o1 ! enable FP before we begin
- set PSR_EF, %o2
- or %o1, %o2, %o1
- wr %o1, 0, %psr
- nop; nop; nop ! paranoia
- ldd [%o0 + FS_REGS + (4*0)], %f0
- ldd [%o0 + FS_REGS + (4*2)], %f2
- ldd [%o0 + FS_REGS + (4*4)], %f4
- ldd [%o0 + FS_REGS + (4*6)], %f6
- ldd [%o0 + FS_REGS + (4*8)], %f8
- ldd [%o0 + FS_REGS + (4*10)], %f10
- ldd [%o0 + FS_REGS + (4*12)], %f12
- ldd [%o0 + FS_REGS + (4*14)], %f14
- ldd [%o0 + FS_REGS + (4*16)], %f16
- ldd [%o0 + FS_REGS + (4*18)], %f18
- ldd [%o0 + FS_REGS + (4*20)], %f20
- ldd [%o0 + FS_REGS + (4*22)], %f22
- ldd [%o0 + FS_REGS + (4*24)], %f24
- ldd [%o0 + FS_REGS + (4*26)], %f26
- ldd [%o0 + FS_REGS + (4*28)], %f28
- ldd [%o0 + FS_REGS + (4*30)], %f30
- retl
- ld [%o0 + FS_FSR], %fsr ! setfsr(f->fs_fsr);
-
-/*
- * ffs(), using table lookup.
- * The process switch code shares the table, so we just put the
- * whole thing here.
- */
-ffstab:
- .byte -24,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 00-0f */
- .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 10-1f */
- .byte 6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 20-2f */
- .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 30-3f */
- .byte 7,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 40-4f */
- .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 50-5f */
- .byte 6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 60-6f */
- .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 70-7f */
- .byte 8,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 80-8f */
- .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 10-9f */
- .byte 6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* a0-af */
- .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* b0-bf */
- .byte 7,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* c0-cf */
- .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* d0-df */
- .byte 6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* e0-ef */
- .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* f0-ff */
-
-/*
- * We use a table lookup on each byte.
- *
- * In each section below, %o1 is the current byte (0, 1, 2, or 3).
- * The last byte is handled specially: for the first three,
- * if that byte is nonzero, we return the table value
- * (plus 0, 8, or 16 for the byte number), but for the last
- * one, we just return the table value plus 24. This means
- * that ffstab[0] must be -24 so that ffs(0) will return 0.
- */
-ENTRY(ffs)
- set ffstab, %o2
- andcc %o0, 0xff, %o1 ! get low byte
- bz,a 1f ! try again if 0
- srl %o0, 8, %o0 ! delay slot, get ready for next byte
-
- retl ! return ffstab[%o1]
- ldsb [%o2 + %o1], %o0
-
-1:
- andcc %o0, 0xff, %o1 ! byte 1 like byte 0...
- bz,a 2f
- srl %o0, 8, %o0 ! (use delay to prepare for byte 2)
-
- ldsb [%o2 + %o1], %o0
- retl ! return ffstab[%o1] + 8
- add %o0, 8, %o0
-
-2:
- andcc %o0, 0xff, %o1
- bz,a 3f
- srl %o0, 8, %o0 ! (prepare for byte 3)
-
- ldsb [%o2 + %o1], %o0
- retl ! return ffstab[%o1] + 16
- add %o0, 16, %o0
-
-3: ! just return ffstab[%o0] + 24
- ldsb [%o2 + %o0], %o0
- retl
- add %o0, 24, %o0
-
-/*
- * Signed multiply, from Appendix E of the Sparc Version 8
- * Architecture Manual.
- *
- * Returns %o0 * %o1 in %o1%o0 (i.e., %o1 holds the upper 32 bits of
- * the 64-bit product).
- *
- * This code optimizes short (less than 13-bit) multiplies.
- */
-.globl .mul, __mul
-.mul:
-__mul:
- mov %o0, %y ! multiplier -> Y
- andncc %o0, 0xfff, %g0 ! test bits 12..31
- be Lmul_shortway ! if zero, can do it the short way
- andcc %g0, %g0, %o4 ! zero the partial product and clear N and V
-
- /*
- * Long multiply. 32 steps, followed by a final shift step.
- */
- mulscc %o4, %o1, %o4 ! 1
- mulscc %o4, %o1, %o4 ! 2
- mulscc %o4, %o1, %o4 ! 3
- mulscc %o4, %o1, %o4 ! 4
- mulscc %o4, %o1, %o4 ! 5
- mulscc %o4, %o1, %o4 ! 6
- mulscc %o4, %o1, %o4 ! 7
- mulscc %o4, %o1, %o4 ! 8
- mulscc %o4, %o1, %o4 ! 9
- mulscc %o4, %o1, %o4 ! 10
- mulscc %o4, %o1, %o4 ! 11
- mulscc %o4, %o1, %o4 ! 12
- mulscc %o4, %o1, %o4 ! 13
- mulscc %o4, %o1, %o4 ! 14
- mulscc %o4, %o1, %o4 ! 15
- mulscc %o4, %o1, %o4 ! 16
- mulscc %o4, %o1, %o4 ! 17
- mulscc %o4, %o1, %o4 ! 18
- mulscc %o4, %o1, %o4 ! 19
- mulscc %o4, %o1, %o4 ! 20
- mulscc %o4, %o1, %o4 ! 21
- mulscc %o4, %o1, %o4 ! 22
- mulscc %o4, %o1, %o4 ! 23
- mulscc %o4, %o1, %o4 ! 24
- mulscc %o4, %o1, %o4 ! 25
- mulscc %o4, %o1, %o4 ! 26
- mulscc %o4, %o1, %o4 ! 27
- mulscc %o4, %o1, %o4 ! 28
- mulscc %o4, %o1, %o4 ! 29
- mulscc %o4, %o1, %o4 ! 30
- mulscc %o4, %o1, %o4 ! 31
- mulscc %o4, %o1, %o4 ! 32
- mulscc %o4, %g0, %o4 ! final shift
-
- ! If %o0 was negative, the result is
- ! (%o0 * %o1) + (%o1 << 32))
- ! We fix that here.
-
- tst %o0
- bge 1f
- rd %y, %o0
-
- ! %o0 was indeed negative; fix upper 32 bits of result by subtracting
- ! %o1 (i.e., return %o4 - %o1 in %o1).
- retl
- sub %o4, %o1, %o1
-
-1:
- retl
- mov %o4, %o1
-
-Lmul_shortway:
- /*
- * Short multiply. 12 steps, followed by a final shift step.
- * The resulting bits are off by 12 and (32-12) = 20 bit positions,
- * but there is no problem with %o0 being negative (unlike above).
- */
- mulscc %o4, %o1, %o4 ! 1
- mulscc %o4, %o1, %o4 ! 2
- mulscc %o4, %o1, %o4 ! 3
- mulscc %o4, %o1, %o4 ! 4
- mulscc %o4, %o1, %o4 ! 5
- mulscc %o4, %o1, %o4 ! 6
- mulscc %o4, %o1, %o4 ! 7
- mulscc %o4, %o1, %o4 ! 8
- mulscc %o4, %o1, %o4 ! 9
- mulscc %o4, %o1, %o4 ! 10
- mulscc %o4, %o1, %o4 ! 11
- mulscc %o4, %o1, %o4 ! 12
- mulscc %o4, %g0, %o4 ! final shift
-
- /*
- * %o4 has 20 of the bits that should be in the low part of the
- * result; %y has the bottom 12 (as %y's top 12). That is:
- *
- * %o4 %y
- * +----------------+----------------+
- * | -12- | -20- | -12- | -20- |
- * +------(---------+------)---------+
- * --hi-- ----low-part----
- *
- * The upper 12 bits of %o4 should be sign-extended to form the
- * high part of the product (i.e., highpart = %o4 >> 20).
- */
-
- rd %y, %o5
- sll %o4, 12, %o0 ! shift middle bits left 12
- srl %o5, 20, %o5 ! shift low bits right 20, zero fill at left
- or %o5, %o0, %o0 ! construct low part of result
- retl
- sra %o4, 20, %o1 ! ... and extract high part of result
-
-/*
- * Unsigned multiply. Returns %o0 * %o1 in %o1%o0 (i.e., %o1 holds the
- * upper 32 bits of the 64-bit product).
- *
- * This code optimizes short (less than 13-bit) multiplies. Short
- * multiplies require 25 instruction cycles, and long ones require
- * 45 instruction cycles.
- *
- * On return, overflow has occurred (%o1 is not zero) if and only if
- * the Z condition code is clear, allowing, e.g., the following:
- *
- * call .umul
- * nop
- * bnz overflow (or tnz)
- */
-.globl .umul, __umul
-.umul:
-__umul:
- or %o0, %o1, %o4
- mov %o0, %y ! multiplier -> Y
- andncc %o4, 0xfff, %g0 ! test bits 12..31 of *both* args
- be Lumul_shortway ! if zero, can do it the short way
- andcc %g0, %g0, %o4 ! zero the partial product and clear N and V
-
- /*
- * Long multiply. 32 steps, followed by a final shift step.
- */
- mulscc %o4, %o1, %o4 ! 1
- mulscc %o4, %o1, %o4 ! 2
- mulscc %o4, %o1, %o4 ! 3
- mulscc %o4, %o1, %o4 ! 4
- mulscc %o4, %o1, %o4 ! 5
- mulscc %o4, %o1, %o4 ! 6
- mulscc %o4, %o1, %o4 ! 7
- mulscc %o4, %o1, %o4 ! 8
- mulscc %o4, %o1, %o4 ! 9
- mulscc %o4, %o1, %o4 ! 10
- mulscc %o4, %o1, %o4 ! 11
- mulscc %o4, %o1, %o4 ! 12
- mulscc %o4, %o1, %o4 ! 13
- mulscc %o4, %o1, %o4 ! 14
- mulscc %o4, %o1, %o4 ! 15
- mulscc %o4, %o1, %o4 ! 16
- mulscc %o4, %o1, %o4 ! 17
- mulscc %o4, %o1, %o4 ! 18
- mulscc %o4, %o1, %o4 ! 19
- mulscc %o4, %o1, %o4 ! 20
- mulscc %o4, %o1, %o4 ! 21
- mulscc %o4, %o1, %o4 ! 22
- mulscc %o4, %o1, %o4 ! 23
- mulscc %o4, %o1, %o4 ! 24
- mulscc %o4, %o1, %o4 ! 25
- mulscc %o4, %o1, %o4 ! 26
- mulscc %o4, %o1, %o4 ! 27
- mulscc %o4, %o1, %o4 ! 28
- mulscc %o4, %o1, %o4 ! 29
- mulscc %o4, %o1, %o4 ! 30
- mulscc %o4, %o1, %o4 ! 31
- mulscc %o4, %o1, %o4 ! 32
- mulscc %o4, %g0, %o4 ! final shift
-
-
- /*
- * Normally, with the shift-and-add approach, if both numbers are
- * positive you get the correct result. WIth 32-bit two's-complement
- * numbers, -x is represented as
- *
- * x 32
- * ( 2 - ------ ) mod 2 * 2
- * 32
- * 2
- *
- * (the `mod 2' subtracts 1 from 1.bbbb). To avoid lots of 2^32s,
- * we can treat this as if the radix point were just to the left
- * of the sign bit (multiply by 2^32), and get
- *
- * -x = (2 - x) mod 2
- *
- * Then, ignoring the `mod 2's for convenience:
- *
- * x * y = xy
- * -x * y = 2y - xy
- * x * -y = 2x - xy
- * -x * -y = 4 - 2x - 2y + xy
- *
- * For signed multiplies, we subtract (x << 32) from the partial
- * product to fix this problem for negative multipliers (see mul.s).
- * Because of the way the shift into the partial product is calculated
- * (N xor V), this term is automatically removed for the multiplicand,
- * so we don't have to adjust.
- *
- * But for unsigned multiplies, the high order bit wasn't a sign bit,
- * and the correction is wrong. So for unsigned multiplies where the
- * high order bit is one, we end up with xy - (y << 32). To fix it
- * we add y << 32.
- */
- tst %o1
- bl,a 1f ! if %o1 < 0 (high order bit = 1),
- add %o4, %o0, %o4 ! %o4 += %o0 (add y to upper half)
-1: rd %y, %o0 ! get lower half of product
- retl
- addcc %o4, %g0, %o1 ! put upper half in place and set Z for %o1==0
-
-Lumul_shortway:
- /*
- * Short multiply. 12 steps, followed by a final shift step.
- * The resulting bits are off by 12 and (32-12) = 20 bit positions,
- * but there is no problem with %o0 being negative (unlike above),
- * and overflow is impossible (the answer is at most 24 bits long).
- */
- mulscc %o4, %o1, %o4 ! 1
- mulscc %o4, %o1, %o4 ! 2
- mulscc %o4, %o1, %o4 ! 3
- mulscc %o4, %o1, %o4 ! 4
- mulscc %o4, %o1, %o4 ! 5
- mulscc %o4, %o1, %o4 ! 6
- mulscc %o4, %o1, %o4 ! 7
- mulscc %o4, %o1, %o4 ! 8
- mulscc %o4, %o1, %o4 ! 9
- mulscc %o4, %o1, %o4 ! 10
- mulscc %o4, %o1, %o4 ! 11
- mulscc %o4, %o1, %o4 ! 12
- mulscc %o4, %g0, %o4 ! final shift
-
- /*
- * %o4 has 20 of the bits that should be in the result; %y has
- * the bottom 12 (as %y's top 12). That is:
- *
- * %o4 %y
- * +----------------+----------------+
- * | -12- | -20- | -12- | -20- |
- * +------(---------+------)---------+
- * -----result-----
- *
- * The 12 bits of %o4 left of the `result' area are all zero;
- * in fact, all top 20 bits of %o4 are zero.
- */
-
- rd %y, %o5
- sll %o4, 12, %o0 ! shift middle bits left 12
- srl %o5, 20, %o5 ! shift low bits right 20
- or %o5, %o0, %o0
- retl
- addcc %g0, %g0, %o1 ! %o1 = zero, and set Z
-
-/*
- * Here is a very good random number generator. This implementation is
- * based on ``Two Fast Implementations of the "Minimal Standard" Random
- * Number Generator", David G. Carta, Communications of the ACM, Jan 1990,
- * Vol 33 No 1.
- */
- .data
- .globl __randseed
-__randseed:
- .word 1
- .text
-ENTRY(random)
- sethi %hi(16807), %o1
- wr %o1, %lo(16807), %y
- sethi %hi(__randseed), %g1
- ld [%g1 + %lo(__randseed)], %o0
- andcc %g0, 0, %o2
- mulscc %o2, %o0, %o2
- mulscc %o2, %o0, %o2
- mulscc %o2, %o0, %o2
- mulscc %o2, %o0, %o2
- mulscc %o2, %o0, %o2
- mulscc %o2, %o0, %o2
- mulscc %o2, %o0, %o2
- mulscc %o2, %o0, %o2
- mulscc %o2, %o0, %o2
- mulscc %o2, %o0, %o2
- mulscc %o2, %o0, %o2
- mulscc %o2, %o0, %o2
- mulscc %o2, %o0, %o2
- mulscc %o2, %o0, %o2
- mulscc %o2, %o0, %o2
- mulscc %o2, %g0, %o2
- rd %y, %o3
- srl %o2, 16, %o1
- set 0xffff, %o4
- and %o4, %o2, %o0
- sll %o0, 15, %o0
- srl %o3, 17, %o3
- or %o3, %o0, %o0
- addcc %o0, %o1, %o0
- bneg 1f
- sethi %hi(0x7fffffff), %o1
- retl
- st %o0, [%g1 + %lo(__randseed)]
-1:
- or %o1, %lo(0x7fffffff), %o1
- add %o0, 1, %o0
- and %o1, %o0, %o0
- retl
- st %o0, [%g1 + %lo(__randseed)]
-
-/*
- * delay function
- *
- * void delay(N) -- delay N microseconds
- *
- * Register usage: %o0 = "N" number of usecs to go (counts down to zero)
- * %o1 = "timerblurb" (stays constant)
- * %o2 = counter for 1 usec (counts down from %o1 to zero)
- *
- */
-
- .data
-_timerblurb:
- .word 20
-
- .text
-ENTRY(delay) ! %o0 = n
- subcc %o0, %g0, %g0
- be 2f
-
- sethi %hi(_timerblurb), %o1
- ld [%o1 + %lo(_timerblurb)], %o1 ! %o1 = timerblurb
-
- addcc %o1, %g0, %o2 ! %o2 = cntr (start @ %o1), clear CCs
- ! first time through only
-
- ! delay 1 usec
-1: bne 1b ! come back here if not done
- subcc %o2, 1, %o2 ! %o2 = %o2 - 1 [delay slot]
-
- subcc %o0, 1, %o0 ! %o0 = %o0 - 1
- bne 1b ! done yet?
- addcc %o1, %g0, %o2 ! reinit %o2 and CCs [delay slot]
- ! harmless if not branching
-2:
- retl ! return
- nop ! [delay slot]
-
-#if defined(KGDB) || defined(DDB) || defined(DIAGNOSTIC)
-/*
- * Write all windows (user or otherwise), except the current one.
- *
- * THIS COULD BE DONE IN USER CODE
- */
-ENTRY(write_all_windows)
- /*
- * g2 = g1 = nwindows - 1;
- * while (--g1 > 0) save();
- * while (--g2 > 0) restore();
- */
- sethi %hi(_nwindows), %g1
- ld [%g1 + %lo(_nwindows)], %g1
- dec %g1
- mov %g1, %g2
-
-1: deccc %g1
- bg,a 1b
- save %sp, -64, %sp
-
-2: deccc %g2
- bg,a 2b
- restore
-
- retl
- nop
-#endif /* KGDB */
-
-ENTRY(setjmp)
- std %sp, [%o0+0] ! stack pointer & return pc
- st %fp, [%o0+8] ! frame pointer
- retl
- clr %o0
-
-Lpanic_ljmp:
- .asciz "longjmp botch"
- _ALIGN
-
-ENTRY(longjmp)
- addcc %o1, %g0, %g6 ! compute v ? v : 1 in a global register
- be,a 0f
- mov 1, %g6
-0:
- mov %o0, %g1 ! save a in another global register
- ld [%g1+8], %g7 /* get caller's frame */
-1:
- cmp %fp, %g7 ! compare against desired frame
- bl,a 1b ! if below,
- restore ! pop frame and loop
- be,a 2f ! if there,
- ldd [%g1+0], %o2 ! fetch return %sp and pc, and get out
-
-Llongjmpbotch:
- ! otherwise, went too far; bomb out
- save %sp, -CCFSZ, %sp /* preserve current window */
- sethi %hi(Lpanic_ljmp), %o0
- call _panic
- or %o0, %lo(Lpanic_ljmp), %o0;
- unimp 0
-
-2:
- cmp %o2, %sp ! %sp must not decrease
- bge,a 3f
- mov %o2, %sp ! it is OK, put it in place
- b,a Llongjmpbotch
-3:
- jmp %o3 + 8 ! success, return %g6
- mov %g6, %o0
-
- .data
-#ifdef DDB
- .globl _esym
-_esym:
- .word 0
-#endif
- .globl _cold
-_cold:
- .word 1 ! cold start flag
-
- .globl _proc0paddr
-_proc0paddr:
- .word _u0 ! KVA of proc0 uarea
-
- .comm _nwindows, 4
- .comm _curproc, 4
- .comm _qs, 32 * 8
- .comm _whichqs, 4
diff --git a/sys/arch/kbus/kbus/locore2.c b/sys/arch/kbus/kbus/locore2.c
deleted file mode 100644
index 7e28fb8f265..00000000000
--- a/sys/arch/kbus/kbus/locore2.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* $NetBSD: locore2.c,v 1.6 1996/03/14 21:09:15 christos Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)locore2.c 8.4 (Berkeley) 12/10/93
- */
-
-/*
- * Primitives which are in locore.s on other machines,
- * but which have no reason to be assembly-coded on SPARC.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/resourcevar.h>
-
-#include <machine/cpu.h>
-
-int whichqs;
-
-/*
- * Put process p on the run queue indicated by its priority.
- * Calls should be made at splstatclock(), and p->p_stat should be SRUN.
- */
-void
-setrunqueue(p)
- register struct proc *p;
-{
- register struct prochd *q;
- register struct proc *oldlast;
- register int which = p->p_priority >> 2;
-
- if (p->p_back != NULL)
- panic("setrunqueue");
- q = &qs[which];
- whichqs |= 1 << which;
- p->p_forw = (struct proc *)q;
- p->p_back = oldlast = q->ph_rlink;
- q->ph_rlink = p;
- oldlast->p_forw = p;
-}
-
-/*
- * Remove process p from its run queue, which should be the one
- * indicated by its priority. Calls should be made at splstatclock().
- */
-void
-remrunqueue(p)
- register struct proc *p;
-{
- register int which = p->p_priority >> 2;
- register struct prochd *q;
-
- if ((whichqs & (1 << which)) == 0)
- panic("remrunqueue");
- p->p_forw->p_back = p->p_back;
- p->p_back->p_forw = p->p_forw;
- p->p_back = NULL;
- q = &qs[which];
- if (q->ph_link == (struct proc *)q)
- whichqs &= ~(1 << which);
-}
diff --git a/sys/arch/kbus/kbus/machdep.c b/sys/arch/kbus/kbus/machdep.c
deleted file mode 100644
index 35ff28209ee..00000000000
--- a/sys/arch/kbus/kbus/machdep.c
+++ /dev/null
@@ -1,1468 +0,0 @@
-/* $NetBSD: machdep.c,v 1.43 1996/01/15 05:30:47 phil Exp $ */
-
-/*-
- * Copyright (c) 1982, 1987, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)machdep.c 7.4 (Berkeley) 6/3/91
- */
-
-/*
- * Modified for the pc532 by Phil Nelson. 2/3/93
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/signalvar.h>
-#include <sys/kernel.h>
-#include <sys/map.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/exec.h>
-#include <sys/buf.h>
-#include <sys/reboot.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/timeout.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/msgbuf.h>
-#include <sys/vnode.h>
-#include <sys/device.h>
-#include <sys/sysctl.h>
-#include <sys/mount.h>
-#include <sys/syscallargs.h>
-
-#include <dev/cons.h>
-
-#include <net/netisr.h>
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-
-#include <machine/psl.h>
-#include <machine/reg.h>
-#include <machine/cpu.h>
-#include <machine/pmap.h>
-#include <machine/asi.h>
-#include <machine/asm.h>
-#include <machine/prom.h>
-#include <machine/dvma.h>
-#include <machine/autoconf.h>
-
-extern vm_offset_t avail_end;
-extern struct user *proc0paddr;
-
-vm_map_t buffer_map;
-
-/* A local function... */
-void rom_reset __P((void));
-void romhalt __P((void));
-void romboot __P((const char *));
-void rom_reset_c __P((void));
-void rom_warm_c __P((void));
-void dumpsys __P((void));
-void memerr __P((int type, int ser, int sva, int aer, int ava));
-void stackdump __P((void));
-void init_series5 __P((void));
-
-void sic_init __P((void));
-void zs_init __P((void));
-void db_machine_init __P((void));
-void ddb_init __P((void));
-void _low_level_init __P((int _argc, char *_argv[], char *_envp[]));
-caddr_t allocsys __P((caddr_t));
-
-/* the following is used externally (sysctl_hw) */
-char machine[] = "kbus";
-char cpu_model[] = "sparc";
-
-/*
- * Declare these as initialized data so we can patch them.
- */
-int nswbuf = 0;
-#ifdef NBUF
-int nbuf = NBUF;
-#else
-int nbuf = 0;
-#endif
-#ifdef BUFPAGES
-int bufpages = BUFPAGES;
-#else
-int bufpages = 0;
-#endif
-int msgbufmapped = 0; /* set when safe to use msgbuf */
-
-static int _mapped; /* TG: FIXME. */
-
-/* Real low level initialization. This is called in unmapped mode and
- sets up the initial page directory and page tables for the kernel.
- This routine is the first to be called by locore.s to get the
- kernel running at the correct place in memory.
- */
-
-extern char end[], _edata[];
-extern vm_offset_t avail_start;
-extern vm_offset_t avail_end;
-extern vm_size_t mem_size;
-
-/*
- * dvmamap is used to manage DVMA memory. Note: this coincides with
- * the memory range in `phys_map' (which is mostly a place-holder).
- */
-struct map *dvmamap;
-static int ndvmamap; /* # of entries in dvmamap */
-
-int physmem = 0;
-
-struct segtab *KPTphys;
-
-int IdlePTD;
-int start_page;
-static int argc;
-static char **argv;
-static char **environ;
-
-int low_mem_map;
-
-/* Support for VERY low debugging ... in case we get NO output.
- (e.g. in case pmap does not work and can't do regular mapped
- output. */
-#define VERYLOWDEBUG 1
-
-#if VERYLOWDEBUG
-#include <kbus/umprintf.c>
-#endif
-
-static void
-set_pde (daddr_t va, daddr_t pa)
-{
- KPTphys->seg_pde[(va & PD_MASK) >> PD_SHIFT].pd_entry
- = (pa & ~SERIES5_KERN_WINDOW) | PD_V;
- KPTphys->seg_tab[(va & PD_MASK) >> PD_SHIFT] = (pt_entry_t *)pa;
-}
-
-static void
-set_pte (unsigned long *pte, daddr_t va, daddr_t addr, unsigned long prot)
-{
- int index = (va & PT_MASK) >> PG_SHIFT;
- pte[index] = (addr & PG_FRAME) | prot;
-}
-
-void
-_low_level_init (int _argc, char *_argv[], char *_envp[])
-{
- unsigned long *pio;
- unsigned long *pk;
- unsigned addr;
- int i;
- unsigned int val;
- extern char *zs_conschan;
-
-#if VERYLOWDEBUG
- umprintf ("starting low level init\n");
-#endif
-
- mem_size = 64 * 1024 * 1024; /* ram_size(end); */
- physmem = btoc(mem_size);
- start_page = (((int)&end + SERIES5_PAGE_SIZE) & ~(SERIES5_PAGE_SIZE-1))
- & 0x00ffffff;
- avail_start = start_page;
- avail_end = mem_size - SERIES5_PAGE_SIZE;
-
- argc = _argc;
- argv = _argv;
- environ = _envp;
-
-#if 0 /* VERYLOWDEBUG */
- umprintf ("mem_size = 0x%x\n"
- "physmem=%x\n"
- "start_page=0x%x\n"
- "avail_end=0x%x\n",
- mem_size, physmem, start_page, avail_end);
- umprintf ("args(%d):", argc);
- for (i = 0; i < argc; i++)
- umprintf (" %s", argv[i]);
- umprintf ("\nenviron:\n");
- for (c = environ; *c; c++)
- umprintf ("%s\n", *c);
-#endif
-
-
- /* Initialize the mmu with a simple memory map. */
-
- /* The page directory that starts the entire mapping. */
- IdlePTD = (int) avail_start;
- KPTphys = (struct segtab *)(avail_start | SERIES5_KERN_WINDOW);
- avail_start += SERIES5_PAGE_SIZE;
-
- /* umprintf ("KPTphys = 0x%x\n", KPTphys); */
-
- /* Initialize the page directory. */
- bzero((char *)(KPTphys), SERIES5_PDT_SIZE);
-
- /* umprintf ("KPTphys bzero done\n"); */
-
- /* The order is important. */
- /* The page table for kernel, ... */
- pk = (unsigned long *) (avail_start | SERIES5_KERN_WINDOW);
- avail_start += SERIES5_PAGE_SIZE;
- bzero ((char *)pk, SERIES5_PGT_SIZE);
-
- /* Now for the memory mapped I/O, the ICU and the eprom. */
- pio = (unsigned long *) (avail_start | SERIES5_KERN_WINDOW);
- avail_start += SERIES5_PAGE_SIZE;
- bzero ((char *)pio, SERIES5_PGT_SIZE);
-
- Sysmap = (pt_entry_t *)pk;
-
- umprintf ("pio = 0x%x; pio bzero done\n", pio);
-
- /* Addresses here start at Fd000000... */
-
- /* zs0 is used for console. */
- set_pte (pio, 0xfdffe000, 0x17012000, PG_V | PG_IO);
-
- /* Add the memory mapped I/O entry in the directory. */
- set_pde (0xfd000000, (daddr_t)pio);
- set_pde (0xfc000000, (daddr_t)pk);
-
-/* umprintf ("KPTphys = 0x%x\n", KPTphys); */
-
- /* Start mapping. */
- _mapped = 1;
-
- LOAD_PTDB (((daddr_t) KPTphys) & ~SERIES5_KERN_WINDOW);
- val = lda (ASI_MMCR, 0);
- val |= MMCR_ME;
- sta (ASI_MMCR, 0, val);
- sta (ASI_FGTLB_INV, 0, 0);
-
- zs_conschan = (void *) 0xfdffe020;
- umprintf ("Mmu setup\n");
- /* umprintf ("proc0paddr = %x\n", proc0paddr); */
-
- proc0.p_addr = proc0paddr;
-
- addr = ((unsigned)proc0paddr) & SERIES5_KERN_MASK;
- for (i = 0; i < UPAGES; i++)
- {
- curproc->p_md.md_upte[i] = addr | PG_WINDOW;
- sta (ASI_FGTLB_VALD, UADDR + (i << PGSHIFT), addr | PG_WINDOW);
- addr += NBPG;
- }
- sta (ASI_FGTLB_VALD, SERIES5_RED_ZONE, -1); /* Hope it works. */
-
- /* So easy to do, but FIXME. */
- msgbufp = (struct msgbuf *)0xff056000;
- msgbufmapped = 1;
- *(unsigned int *)ROM_MSGBUFP = (unsigned int)msgbufp;
-}
-
-/* init_series5 is the first procedure called in mapped mode by locore.s
- */
-void
-init_series5 ()
-{
- /* umprintf ("init series5...\n"); */
-
-/*#include "ddb.h" */
-#if NDDB > 0
- kdb_init();
- if (boothowto & RB_KDB)
- Debugger();
-#endif
-
- /* Initialize the pmap stuff.... */
- pmap_bootstrap (avail_start);
-
-
- printf ("First try\n");
- umprintf ("printf tried\n");
-
- /* now running on new page tables, configured, and u/iom is accessible */
-
-#ifdef DDB
- db_machine_init ();
- ddb_init ();
-#endif
-}
-
-
-/*
- * Machine-dependent startup code
- */
-int boothowto = 0;
-long dumplo;
-int physmem;
-
-extern int bootdev;
-extern int cyloffset;
-
-void
-cpu_startup(void)
-{
- register unsigned i;
- register caddr_t v;
- int base, residual;
- vm_offset_t minaddr, maxaddr;
- vm_size_t size = 0;
- extern struct user *proc0paddr;
-
-/* verbose_rom_reset (); */
-
-#ifdef KDB
- kdb_init(); /* startup kernel debugger */
-#endif
- proc0.p_addr = proc0paddr;
-
- /*
- * Good {morning,afternoon,evening,night}.
- */
- printf(version);
- printf("\nreal mem = 0x%x\n", ctob(physmem));
-
- /*
- * Allocate space for system data structures.
- * The first available kernel virtual address is in "v".
- * As pages of kernel virtual memory are allocated, "v" is incremented.
- * As pages of memory are allocated and cleared,
- * "firstaddr" is incremented.
- * An index into the kernel page table corresponding to the
- * virtual memory address maintained in "v" is kept in "mapaddr".
- */
-
- /*
- * Make two passes. The first pass calculates how much memory is
- * needed and allocates it. The second pass assigns virtual
- * addresses to the various data structures.
- */
- size = (int)allocsys ((caddr_t)0);
- if ((v = (caddr_t)kmem_alloc(kernel_map, round_page(size))) == 0)
- panic("startup: no room for tables");
-
- if (allocsys(v) - v != size)
- panic("startup: table size inconsistency");
-
- /*
- * Now allocate buffers proper. They are different than the above
- * in that they usually occupy more virtual memory than physical.
- */
- size = MAXBSIZE * nbuf;
-
- buffer_map = kmem_suballoc(kernel_map, (vm_offset_t *)&buffers,
- &maxaddr, size, TRUE);
- minaddr = (vm_offset_t)buffers;
- vm_map_print (buffer_map, 1);
- printf ("Buffer size: %d bytes, %d kb, minaddr = %p, buffer_map = %p\n",
- size, size / 1024, minaddr, buffer_map);
- {
- vm_object_t vmo;
- vmo = vm_object_allocate (size);
- printf ("vmo: %p, buffer_map: %p\n", vmo, buffer_map);
- i = vm_map_find(buffer_map, vmo, (vm_offset_t)0,
- &minaddr, size, FALSE);
- }
- if (i != KERN_SUCCESS)
- {
- printf ("min: %p, max: %p\n",
- buffer_map->min_offset, buffer_map->max_offset);
- printf ("vm_map_find: error %d\n", i);
- panic("startup: cannot allocate buffers");
- }
- base = bufpages / nbuf;
- residual = bufpages % nbuf;
- if (base >= MAXBSIZE) {
- /* don't want to alloc more physical mem than needed */
- base = MAXBSIZE;
- residual = 0;
- }
- for (i = 0; i < nbuf; i++) {
- vm_size_t curbufsize;
- vm_offset_t curbuf;
-
- /*
- * First <residual> buffers get (base+1) physical pages
- * allocated for them. The rest get (base) physical pages.
- *
- * The rest of each buffer occupies virtual space,
- * but has no physical memory allocated for it.
- */
- curbuf = (vm_offset_t)buffers + i * MAXBSIZE;
- curbufsize = CLBYTES * (i < residual ? base+1 : base);
- vm_map_pageable(buffer_map, curbuf, curbuf+curbufsize, FALSE);
- vm_map_simplify(buffer_map, curbuf);
- }
-
-
- /*
- * Allocate a submap for exec arguments. This map effectively
- * limits the number of processes exec'ing at any time.
- */
- exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
- 8*NCARGS, TRUE);
-
- /*
- * Allocate a map for physio. Others use a submap of the kernel
- * map, but we want one completely separate, even though it uses
- * the same pmap.
- */
- phys_map = vm_map_create(pmap_kernel(),
- VM_MIN_IO_ADDRESS, VM_MAX_IO_ADDRESS, 1);
- if (phys_map == NULL)
- panic("unable to create phys_map");
- /*
- * Allocate DVMA space and dump into a privately managed
- * resource map for double mappings which is usable from
- * interrupt contexts.
- */
- rminit(dvmamap, btoc(1 << 20), 1, "dvmamap", ndvmamap);
-
- /*
- * Finally, allocate mbuf pool. Since mclrefcnt is an off-size
- * we use the more space efficient malloc in place of kmem_alloc.
- */
- mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES,
- M_MBUF, M_NOWAIT);
- bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES);
- mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
- VM_MBUF_SIZE, FALSE);
- /*
- * Initialize timeouts
- */
- timeout_init();
-
- printf("avail mem = 0x%x\n", ptoa(cnt.v_free_count));
- printf("using %d buffers containing %d bytes of memory\n",
- nbuf, bufpages * CLBYTES);
-
- /*
- * Set up buffers, so they can be used to read disk labels.
- */
- bufinit();
-
- /*
- * Configure the system.
- */
- if (boothowto & RB_CONFIG) {
-#ifdef BOOT_CONFIG
- user_config();
-#else
- printf("kernel does not support -c; continuing..\n");
-#endif
- }
- sic_init ();
-
- /* Drivers that use those OBIO mappings from the PROM */
- zs_init();
-
- configure();
-#if 0
- Debugger ();
-#endif
-}
-
-caddr_t
-allocsys(v)
- caddr_t v;
-{
-#define valloc(name, type, num) \
- (name) = (type *)v; v = (caddr_t)((name)+(num))
-#define valloclim(name, type, num, lim) \
- (name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num)))
- valloc(timeouts, struct timeout, ntimeout);
-#ifdef SYSVSHM
- valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
-#endif
- /*
- * Determine how many buffers to allocate.
- * Use 10% of memory for the first 2 Meg, 5% of the remaining
- * memory. Insure a minimum of 16 buffers.
- * We allocate 1/2 as many swap buffer headers as file i/o buffers.
- */
- if (bufpages == 0) {
- if (physmem < (2 * 1024 * 1024))
- bufpages = physmem / 10 / CLSIZE;
- else
- bufpages = ((2 * 1024 * 1024 + physmem) / 40) / CLSIZE;
- }
-
- bufpages = min(NKMEMCLUSTERS*2/5, bufpages); /* XXX ? - cgd */
-
- if (nbuf == 0) {
- nbuf = bufpages / 2;
- if (nbuf < 16) {
- nbuf = 16;
- /* XXX (cgd) -- broken vfs_bio currently demands this */
- bufpages = 32;
- }
- }
-
- if (nswbuf == 0) {
- nswbuf = (nbuf / 2) &~ 1; /* force even */
- if (nswbuf > 256)
- nswbuf = 256; /* sanity */
- }
- valloc(swbuf, struct buf, nswbuf);
- valloc(buf, struct buf, nbuf);
-
- /*
- * Allocate DVMA slots for 1/4 of the number of i/o buffers
- * and one for each process too (PHYSIO).
- */
- valloc(dvmamap, struct map, ndvmamap = maxproc + ((nbuf / 4) &~ 1));
-
- return v;
-}
-
-#ifdef PGINPROF
-/*
- * Return the difference (in microseconds)
- * between the current time and a previous
- * time as represented by the arguments.
- * If there is a pending clock interrupt
- * which has not been serviced due to high
- * ipl, return error code.
- */
-/*ARGSUSED*/
-vmtime(otime, olbolt, oicr)
- register int otime, olbolt, oicr;
-{
-
- return (((time.tv_sec-otime)*60 + lbolt-olbolt)*16667);
-}
-#endif
-
-void
-microtime(tvp)
- register struct timeval *tvp;
-{
- int s = splhigh();
-
- *tvp = time;
- tvp->tv_usec += tick;
- while (tvp->tv_usec >= 1000000) {
- tvp->tv_sec++;
- tvp->tv_usec -= 1000000;
- }
- splx(s);
-}
-
-
-#if 0
-/*
- * insert an element into a queue
- */
-#undef insque
-_insque(element, head)
- register struct prochd *element, *head;
-{
- element->ph_link = head->ph_link;
- head->ph_link = (struct proc *)element;
- element->ph_rlink = (struct proc *)head;
- ((struct prochd *)(element->ph_link))->ph_rlink=(struct proc *)element;
-}
-
-/*
- * remove an element from a queue
- */
-#undef remque
-_remque(element)
- register struct prochd *element;
-{
- ((struct prochd *)(element->ph_link))->ph_rlink = element->ph_rlink;
- ((struct prochd *)(element->ph_rlink))->ph_link = element->ph_link;
- element->ph_rlink = (struct proc *)0;
-}
-#endif
-
-/* vmunaccess() {printf ("vmunaccess!\n");} */
-
-#if 0
-/*
- * Below written in C to allow access to debugging code
- */
-copyinstr (fromaddr, toaddr, maxlength, lencopied)
- size_t *lencopied, maxlength;
- void *toaddr, *fromaddr;
-{
- int c,tally;
-
- tally = 0;
- while (maxlength--) {
- c = fubyte(fromaddr++);
- if (c == -1) {
- if(lencopied) *lencopied = tally;
- return(EFAULT);
- }
- tally++;
- *(char *)toaddr++ = (char) c;
- if (c == 0){
- if(lencopied) *lencopied = (u_int)tally;
- return(0);
- }
- }
- if(lencopied) *lencopied = (u_int)tally;
- return(ENAMETOOLONG);
-}
-
-copyoutstr (fromaddr, toaddr, maxlength, lencopied)
- size_t *lencopied, maxlength;
- void *fromaddr, *toaddr;
-{
- int c;
- int tally;
-
- tally = 0;
- while (maxlength--) {
- c = subyte(toaddr++, *(char *)fromaddr);
- if (c == -1) return(EFAULT);
- tally++;
- if (*(char *)fromaddr++ == 0){
- if(lencopied) *lencopied = tally;
- return(0);
- }
- }
- if(lencopied) *lencopied = tally;
- return(ENAMETOOLONG);
-}
-
-copystr (fromaddr, toaddr, maxlength, lencopied)
- size_t *lencopied, maxlength;
- void *fromaddr, *toaddr;
-{
- u_int tally;
-
- tally = 0;
- while (maxlength--) {
- *(u_char *)toaddr = *(u_char *)fromaddr++;
- tally++;
- if (*(u_char *)toaddr++ == 0) {
- if(lencopied) *lencopied = tally;
- return(0);
- }
- }
- if(lencopied) *lencopied = tally;
- return(ENAMETOOLONG);
-}
-#endif
-
-/*
- * consinit:
- * initialize the system console.
- * XXX - shouldn't deal with this cons_initted thing, but then,
- * it shouldn't be called from init386 either.
- */
-static int cons_initted;
-
-void
-consinit()
-{
- if (!cons_initted) {
- cninit();
- cons_initted = 1;
- }
-}
-
-/*
- * Set up registers on exec.
- *
- * XXX this entire mess must be fixed
- */
-/* ARGSUSED */
-void
-setregs(p, pack, stack, retval)
- struct proc *p;
- struct exec_package *pack;
- u_long stack;
- register_t *retval;
-{
- register struct trapframe *tf = p->p_md.md_tf;
- register struct fpstate *fs;
- register int psr;
-
- /*
- * The syscall will ``return'' to npc or %g7 or %g2; set them all.
- * Set the rest of the registers to 0 except for %o6 (stack pointer,
- * built in exec()) and psr (retain CWP and PSR_S bits).
- */
- psr = tf->tf_psr & (PSR_S | PSR_CWP);
- if ((fs = p->p_md.md_fpstate) != NULL) {
- /*
- * We hold an FPU state. If we own *the* FPU chip state
- * we must get rid of it, and the only way to do that is
- * to save it. In any case, get rid of our FPU state.
- */
- if (p == fpproc) {
- savefpstate(fs);
- fpproc = NULL;
- }
- free((void *)fs, M_SUBPROC);
- p->p_md.md_fpstate = NULL;
- }
- bzero((caddr_t)tf, sizeof *tf);
- tf->tf_psr = psr;
- tf->tf_npc = pack->ep_entry & ~3;
- tf->tf_global[1] = (int)PS_STRINGS;
- tf->tf_global[2] = tf->tf_global[7] = tf->tf_npc;
- stack -= sizeof(struct rwindow);
- tf->tf_out[6] = stack;
- retval[1] = 0;
-}
-
-#ifdef DEBUG
-int sigdebug = 0;
-int sigpid = 0;
-#define SDB_FOLLOW 0x01
-#define SDB_KSTACK 0x02
-#define SDB_FPSTATE 0x04
-#endif
-
-struct sigframe {
- int sf_signo; /* signal number */
- siginfo_t *sf_sip; /* points to siginfo_t */
-#ifdef COMPAT_SUNOS
- struct sigcontext *sf_scp; /* points to user addr of sigcontext */
-#else
- int sf_xxx; /* placeholder */
-#endif
- caddr_t sf_addr; /* SunOS compat */
- struct sigcontext sf_sc; /* actual sigcontext */
- siginfo_t sf_si;
-};
-
-/*
- * machine dependent system variables.
- */
-int
-cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
- int *name;
- u_int namelen;
- void *oldp;
- size_t *oldlenp;
- void *newp;
- size_t newlen;
- struct proc *p;
-{
-
- /* all sysctl names are this level are terminal */
- if (namelen != 1)
- return (ENOTDIR); /* overloaded */
-
- switch (name[0]) {
- default:
- return (EOPNOTSUPP);
- }
- /* NOTREACHED */
-}
-
-/*
- * Send an interrupt to process.
- */
-void
-sendsig(catcher, sig, mask, code, type, val)
- sig_t catcher;
- int sig, mask;
- u_long code;
- int type;
- union sigval val;
-{
- register struct proc *p = curproc;
- register struct sigacts *psp = p->p_sigacts;
- register struct sigframe *fp;
- register struct trapframe *tf;
- register int caddr, oonstack, oldsp, newsp;
- struct sigframe sf;
- extern char sigcode[], esigcode[];
-#define szsigcode (esigcode - sigcode)
-#ifdef COMPAT_SUNOS
- extern struct emul emul_sunos;
-#endif
-
- tf = p->p_md.md_tf;
- oldsp = tf->tf_out[6];
- oonstack = psp->ps_sigstk.ss_flags & SS_ONSTACK;
- /*
- * Compute new user stack addresses, subtract off
- * one signal frame, and align.
- */
- if ((psp->ps_flags & SAS_ALTSTACK) && !oonstack &&
- (psp->ps_sigonstack & sigmask(sig))) {
- fp = (struct sigframe *)(psp->ps_sigstk.ss_sp +
- psp->ps_sigstk.ss_size);
- psp->ps_sigstk.ss_flags |= SS_ONSTACK;
- } else
- fp = (struct sigframe *)oldsp;
- fp = (struct sigframe *)((int)(fp - 1) & ~7);
-
-#ifdef DEBUG
- if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
- printf("sendsig: %s[%d] sig %d newusp %p scp %p\n",
- p->p_comm, p->p_pid, sig, fp, &fp->sf_sc);
-#endif
- /*
- * Now set up the signal frame. We build it in kernel space
- * and then copy it out. We probably ought to just build it
- * directly in user space....
- */
- sf.sf_signo = sig;
- sf.sf_sip = NULL;
-#ifdef COMPAT_SUNOS
- if (p->p_emul == &emul_sunos) {
- sf.sf_sip = (void *)code; /* SunOS has "int code" */
- sf.sf_scp = &fp->sf_sc;
- sf.sf_addr = val.sival_ptr;
- }
-#endif
-
- /*
- * Build the signal context to be used by sigreturn.
- */
- sf.sf_sc.sc_onstack = oonstack;
- sf.sf_sc.sc_mask = mask;
- sf.sf_sc.sc_sp = oldsp;
- sf.sf_sc.sc_pc = tf->tf_pc;
- sf.sf_sc.sc_npc = tf->tf_npc;
- sf.sf_sc.sc_psr = tf->tf_psr;
- sf.sf_sc.sc_g1 = tf->tf_global[1];
- sf.sf_sc.sc_o0 = tf->tf_out[0];
-
- if (psp->ps_siginfo & sigmask(sig)) {
- sf.sf_sip = &fp->sf_si;
- initsiginfo(&sf.sf_si, sig, code, type, val);
- }
-
- /*
- * Put the stack in a consistent state before we whack away
- * at it. Note that write_user_windows may just dump the
- * registers into the pcb; we need them in the process's memory.
- * We also need to make sure that when we start the signal handler,
- * its %i6 (%fp), which is loaded from the newly allocated stack area,
- * joins seamlessly with the frame it was in when the signal occurred,
- * so that the debugger and _longjmp code can back up through it.
- */
- newsp = (int)fp - sizeof(struct rwindow);
- write_user_windows();
- /* XXX do not copyout siginfo if not needed */
- if (rwindow_save(p) || copyout((caddr_t)&sf, (caddr_t)fp, sizeof sf) ||
- suword(&((struct rwindow *)newsp)->rw_in[6], oldsp)) {
- /*
- * Process has trashed its stack; give it an illegal
- * instruction to halt it in its tracks.
- */
-#ifdef DEBUG
- if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
- printf("sendsig: window save or copyout error\n");
-#endif
- sigexit(p, SIGILL);
- /* NOTREACHED */
- }
-#ifdef DEBUG
- if (sigdebug & SDB_FOLLOW)
- printf("sendsig: %s[%d] sig %d scp %p\n",
- p->p_comm, p->p_pid, sig, &fp->sf_sc);
-#endif
- /*
- * Arrange to continue execution at the code copied out in exec().
- * It needs the function to call in %g1, and a new stack pointer.
- */
-#ifdef COMPAT_SUNOS
- if (psp->ps_usertramp & sigmask(sig)) {
- caddr = (int)catcher; /* user does his own trampolining */
- } else
-#endif
- {
- caddr = (int)PS_STRINGS - szsigcode;
- tf->tf_global[1] = (int)catcher;
- }
- tf->tf_pc = caddr;
- tf->tf_npc = caddr + 4;
- tf->tf_out[6] = newsp;
-#ifdef DEBUG
- if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
- printf("sendsig: about to return to catcher\n");
-#endif
-}
-
-/*
- * System call to cleanup state after a signal
- * has been taken. Reset signal mask and
- * stack state from context left by sendsig (above),
- * and return to the given trap frame (if there is one).
- * Check carefully to make sure that the user has not
- * modified the state to gain improper privileges or to cause
- * a machine fault.
- */
-/* ARGSUSED */
-int
-sys_sigreturn(p, v, retval)
- register struct proc *p;
- void *v;
- register_t *retval;
-{
- struct sys_sigreturn_args /* {
- syscallarg(struct sigcontext *) sigcntxp;
- } */ *uap = v;
- register struct sigcontext *scp;
- register struct trapframe *tf;
-
- /* First ensure consistent stack state (see sendsig). */
- write_user_windows();
- if (rwindow_save(p))
- sigexit(p, SIGILL);
-#ifdef DEBUG
- if (sigdebug & SDB_FOLLOW)
- printf("sigreturn: %s[%d], sigcntxp %p\n",
- p->p_comm, p->p_pid, SCARG(uap, sigcntxp));
-#endif
- scp = SCARG(uap, sigcntxp);
- if ((int)scp & 3 || useracc((caddr_t)scp, sizeof *scp, B_WRITE) == 0)
- return (EINVAL);
- tf = p->p_md.md_tf;
- /*
- * Only the icc bits in the psr are used, so it need not be
- * verified. pc and npc must be multiples of 4. This is all
- * that is required; if it holds, just do it.
- */
- if (((scp->sc_pc | scp->sc_npc) & 3) != 0)
- return (EINVAL);
- /* take only psr ICC field */
- tf->tf_psr = (tf->tf_psr & ~PSR_ICC) | (scp->sc_psr & PSR_ICC);
- tf->tf_pc = scp->sc_pc;
- tf->tf_npc = scp->sc_npc;
- tf->tf_global[1] = scp->sc_g1;
- tf->tf_out[0] = scp->sc_o0;
- tf->tf_out[6] = scp->sc_sp;
- if (scp->sc_onstack & 1)
- p->p_sigacts->ps_sigstk.ss_flags |= SS_ONSTACK;
- else
- p->p_sigacts->ps_sigstk.ss_flags &= ~SS_ONSTACK;
- p->p_sigmask = scp->sc_mask & ~sigcantmask;
- return (EJUSTRETURN);
-}
-
-int waittime = -1;
-
-void
-boot(howto)
- register int howto;
-{
- int i;
- static char str[4]; /* room for "-sd\0" */
- extern int cold;
-
- if (cold) {
- printf("halted\n\n");
- romhalt();
- }
-
-/* fb_unblank(); */
- boothowto = howto;
- if ((howto & RB_NOSYNC) == 0 && waittime < 0) {
-#if 1
- extern struct proc proc0;
-
- /* protect against curproc->p_stats.foo refs in sync() XXX */
- if (curproc == NULL)
- curproc = &proc0;
-#endif
- waittime = 0;
- vfs_shutdown();
-
- /*
- * If we've been adjusting the clock, the todr
- * will be out of synch; adjust it now unless
- * the system was sitting in ddb.
- */
- if ((howto & RB_TIMEBAD) == 0) {
- resettodr();
- } else {
- printf("WARNING: not updating battery clock\n");
- }
- }
- (void) splhigh(); /* ??? */
- if (howto & RB_HALT) {
- doshutdownhooks();
- printf("halted\n\n");
- romhalt();
- }
- if (howto & RB_DUMP)
- dumpsys();
-
- doshutdownhooks();
- printf("rebooting\n\n");
- i = 1;
- if (howto & RB_SINGLE)
- str[i++] = 's';
- if (howto & RB_KDB)
- str[i++] = 'd';
- if (i > 1) {
- str[0] = '-';
- str[i] = 0;
- } else
- str[0] = 0;
- romboot (str);
- /*NOTREACHED*/
- while (1)
- ;
-}
-
-#if 0
-u_long dumpmag = 0x8fca0101; /* magic number for savecore */
-int dumpsize = 0; /* also for savecore */
-long dumplo = 0;
-
-void
-dumpconf()
-{
- register int nblks, nmem;
- register struct memarr *mp;
-
- dumpsize = physmem;
-
- /*
- * savecore views the image in units of pages (i.e., dumpsize is in
- * pages) so we round the two mmu entities into page-sized chunks.
- * The PMEGs (32kB) and the segment table (512 bytes plus padding)
- * are appending to the end of the crash dump.
- */
- /* dumpsize += pmap_dumpsize(); TG:FIXME */
- if (dumpdev != NODEV && bdevsw[major(dumpdev)].d_psize) {
- nblks = (*bdevsw[major(dumpdev)].d_psize)(dumpdev);
- /*
- * Don't dump on the first CLBYTES (why CLBYTES?)
- * in case the dump device includes a disk label.
- */
- if (dumplo < btodb(CLBYTES))
- dumplo = btodb(CLBYTES);
-
- /*
- * If dumpsize is too big for the partition, truncate it.
- * Otherwise, put the dump at the end of the partition
- * by making dumplo as large as possible.
- */
- if (dumpsize > btoc(dbtob(nblks - dumplo)))
- dumpsize = btoc(dbtob(nblks - dumplo));
- else if (dumplo + ctod(dumpsize) > nblks)
- dumplo = nblks - ctod(dumpsize);
- }
-}
-
-#define BYTES_PER_DUMP (32 * 1024) /* must be a multiple of pagesize */
-static vm_offset_t dumpspace;
-
-caddr_t
-reserve_dumppages(p)
- caddr_t p;
-{
-
- dumpspace = (vm_offset_t)p;
- return (p + BYTES_PER_DUMP);
-}
-#endif
-
-/*
- * Write a crash dump.
- */
-void
-dumpsys()
-{
-#if 0
- register int psize;
- register daddr_t blkno;
- register int (*dump) __P((dev_t, daddr_t, caddr_t, size_t));
- int error = 0;
- register struct memarr *mp;
- register int nmem;
- extern struct memarr pmemarr[];
- extern int npmemarr;
-
- /* copy registers to memory */
- snapshot(cpcb);
- stackdump();
-
- if (dumpdev == NODEV)
- return;
-
- /*
- * For dumps during autoconfiguration,
- * if dump device has already configured...
- */
- if (dumpsize == 0)
- dumpconf();
- if (dumplo < 0)
- return;
- printf("\ndumping to dev %x, offset %ld\n", dumpdev, dumplo);
-
- psize = (*bdevsw[major(dumpdev)].d_psize)(dumpdev);
- printf("dump ");
- if (psize == -1) {
- printf("area unavailable\n");
- return;
- }
- blkno = dumplo;
- dump = bdevsw[major(dumpdev)].d_dump;
-
- for (mp = pmemarr, nmem = npmemarr; --nmem >= 0; mp++) {
- register unsigned i = 0, n;
- register maddr = mp->addr;
-
- if (maddr == 0) {
- /* Skip first page at physical address 0 */
- maddr += NBPG;
- i += NBPG;
- blkno += btodb(NBPG);
- }
-
- for (; i < mp->len; i += n) {
- n = mp->len - i;
- if (n > BYTES_PER_DUMP)
- n = BYTES_PER_DUMP;
-
- /* print out how many MBs we have dumped */
- if (i && (i % (1024*1024)) == 0)
- printf("%d ", i / (1024*1024));
-
- (void) pmap_map(dumpspace, maddr, maddr + n,
- VM_PROT_READ);
- error = (*dump)(dumpdev, blkno,
- (caddr_t)dumpspace, (int)n);
- pmap_remove(pmap_kernel(), dumpspace, dumpspace + n);
- if (error)
- break;
- maddr += n;
- blkno += btodb(n);
- }
- }
- if (!error)
- error = pmap_dumpmmu(dump, blkno);
-
- switch (error) {
-
- case ENXIO:
- printf("device bad\n");
- break;
-
- case EFAULT:
- printf("device not ready\n");
- break;
-
- case EINVAL:
- printf("area improper\n");
- break;
-
- case EIO:
- printf("i/o error\n");
- break;
-
- case 0:
- printf("succeeded\n");
- break;
-
- default:
- printf("error %d\n", error);
- break;
- }
-#endif
-}
-
-/*
- * get the fp and dump the stack as best we can. don't leave the
- * current stack page
- */
-void
-stackdump()
-{
- struct frame *fp = (struct frame *) getfp(), *sfp;
-
- sfp = fp;
- printf("Frame pointer is at %p\n", fp);
- printf("Call traceback:\n");
- while (fp && ((u_long)fp >> PGSHIFT) == ((u_long)sfp >> PGSHIFT)) {
- printf(" pc = %x args = (%x, %x, %x, %x, %x, %x, %x) fp = %p\n",
- fp->fr_pc, fp->fr_arg[0], fp->fr_arg[1], fp->fr_arg[2],
- fp->fr_arg[3], fp->fr_arg[4], fp->fr_arg[5], fp->fr_arg[6],
- fp->fr_fp);
- fp = fp->fr_fp;
- }
-}
-
-int
-cpu_exec_aout_makecmds(p, epp)
- struct proc *p;
- struct exec_package *epp;
-{
- int error = ENOEXEC;
-
-#ifdef COMPAT_SUNOS
- extern int sunos_exec_aout_makecmds __P((struct proc *,
- struct exec_package *));
- if ((error = sunos_exec_aout_makecmds(p, epp)) == 0)
- return 0;
-#endif
- return error;
-}
-
-#if 0
-int
-ldcontrolb(addr)
-caddr_t addr;
-{
- struct pcb *xpcb;
- extern struct user *proc0paddr;
- u_long saveonfault;
- int res;
- int s;
-
- printf("warning: ldcontrolb called in sun4m\n");
- return 0;
-
- s = splhigh();
- if (curproc == NULL)
- xpcb = (struct pcb *)proc0paddr;
- else
- xpcb = &curproc->p_addr->u_pcb;
-
- saveonfault = (u_long)xpcb->pcb_onfault;
- res = xldcontrolb(addr, xpcb);
- xpcb->pcb_onfault = (caddr_t)saveonfault;
-
- splx(s);
- return (res);
-}
-#endif
-
-void
-wzero(vb, l)
- void *vb;
- u_int l;
-{
- u_char *b = vb;
- u_char *be = b + l;
- u_short *sp;
-
- if (l == 0)
- return;
-
- /* front, */
- if ((u_long)b & 1)
- *b++ = 0;
-
- /* back, */
- if (b != be && ((u_long)be & 1) != 0) {
- be--;
- *be = 0;
- }
-
- /* and middle. */
- sp = (u_short *)b;
- while (sp != (u_short *)be)
- *sp++ = 0;
-}
-
-void
-wcopy(vb1, vb2, l)
- const void *vb1;
- void *vb2;
- u_int l;
-{
- const u_char *b1e, *b1 = vb1;
- u_char *b2 = vb2;
- u_short *sp;
- int bstore = 0;
-
- if (l == 0)
- return;
-
- /* front, */
- if ((u_long)b1 & 1) {
- *b2++ = *b1++;
- l--;
- }
-
- /* middle, */
- sp = (u_short *)b1;
- b1e = b1 + l;
- if (l & 1)
- b1e--;
- bstore = (u_long)b2 & 1;
-
- while (sp < (u_short *)b1e) {
- if (bstore) {
- b2[1] = *sp & 0xff;
- b2[0] = *sp >> 8;
- } else
- *((short *)b2) = *sp;
- sp++;
- b2 += 2;
- }
-
- /* and back. */
- if (l & 1)
- *b2 = *b1e;
-}
-
-void
-memerr (int type, int ser, int sva, int aer, int ava)
-{
- panic ("memory error");
-}
-
-
-#define CALL_ROM_COMMAND (**(void (**)(void))ROM_COMMAND)()
-#define GET_ROM_COMMAREA (*(struct prom_command_area **)ROM_COMM_AREA)
-
-void
-rom_reset_c (void)
-{
- char *command = "reset intr";
-
- if (!*(int *)ROM_COMMAND)
- {
- *(int *)ROM_COMMAND = 0xfe002a80;
- *(int *)ROM_COMM_AREA = 0xff00e018;
- }
- GET_ROM_COMMAREA->command_ptr = command;
- CALL_ROM_COMMAND;
-}
-
-void
-rom_warm_c (void)
-{
- char *command = "reset warm";
-
- if (!*(int *)ROM_COMMAND)
- {
- *(int *)ROM_COMMAND = 0xfe002a80;
- *(int *)ROM_COMM_AREA = 0xff00e018;
- }
- GET_ROM_COMMAREA->command_ptr = command;
- CALL_ROM_COMMAND;
-}
-
-void
-verbose_rom_reset (void)
-{
- umprintf ("rom_version: %x\n", *(unsigned *)ROM_VERSION);
- umprintf ("rom_commarea: %x\n", *(unsigned *)ROM_COMM_AREA);
- umprintf ("rom_command: %x\n", *(unsigned *)ROM_COMMAND);
- umprintf ("rom_msgbufp: %x\n", *(unsigned *)ROM_MSGBUFP);
- umprintf ("rom_dgram: %x\n", *(unsigned *)ROM_DGRAM);
- umprintf ("rom_eeversion: %x\n", *(unsigned *)ROM_EEVERSION);
- umprintf ("rom_revision: %x\n", *(unsigned *)ROM_REVISION);
-}
-
-void
-romhalt (void)
-{
- rom_reset ();
-}
-
-void
-romboot (str)
- const char *str;
-{
- rom_reset ();
-}
-
-static char *
-getenv (const char *str)
-{
- char **c;
- size_t len = strlen (str);
-
- for (c = environ; *c; c++)
- {
- if ((*c)[len] == '=' && strncmp (*c, str, len) == 0)
- return (*c) + len + 1;
- }
- return NULL;
-}
-
-void
-idprom_etheraddr(ether)
- u_char *ether;
-{
- char *ea = getenv ("ENETADDR");
- u_char c;
- int i;
-
- if (ea == NULL)
- panic ("ERROR: ethernet address not set!");
-
- for (i = 0; i < 6; i++)
- {
- if (*ea >= '0' && *ea <= '9')
- c = *ea - '0';
- else if (*ea >= 'a' && *ea <= 'f')
- c = *ea - 'a' + 10;
- else if (*ea >= 'A' && *ea <= 'F')
- c = *ea - 'A' + 10;
- else
- panic ("Bad character for enet addr (%s)", ea);
- ea++;
- if (i == 5 && *ea == 0)
- break;
- if (i < 5 && *ea == ':')
- {
- *ether++ = c;
- ea++;
- continue;
- }
- c <<= 4;
- if (*ea >= '0' && *ea <= '9')
- c |= *ea - '0';
- else if (*ea >= 'a' && *ea <= 'f')
- c |= *ea - 'a' + 10;
- else if (*ea >= 'A' && *ea <= 'F')
- c |= *ea - 'A' + 10;
- else
- panic ("Bad character for enet addr (%s)", ea);
- ea++;
- if (i != 5 && *ea != ':')
- panic ("Bad character for enet addr (%s)", ea);
- ea++;
- *ether++ = c;
- }
-
-}
-
-#ifndef FFS
-void
-ffs_mountroot (void)
-{
- panic ("ffs_mountroot");
-}
-#endif
diff --git a/sys/arch/kbus/kbus/mainbus.c b/sys/arch/kbus/kbus/mainbus.c
deleted file mode 100644
index b13a9b33be4..00000000000
--- a/sys/arch/kbus/kbus/mainbus.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/* $OpenBSD: mainbus.c,v 1.1.1.1 1997/10/14 07:25:34 gingold Exp $ */
-/* $NetBSD: mainbus.c,v 1.5 1996/12/17 21:11:35 gwr Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Gordon W. Ross.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-
-static int main_match __P((struct device *, void *, void *));
-static void main_attach __P((struct device *, struct device *, void *));
-
-struct cfattach mainbus_ca = {
- sizeof(struct device), main_match, main_attach
-};
-
-struct cfdriver mainbus_cd = {
- NULL, "mainbus", DV_DULL
-};
-
-/*
- * Probe for the mainbus; always succeeds.
- */
-static int
-main_match(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
-
- return 1;
-}
-
-/*
- * Do "direct" configuration for the bus types on mainbus.
- * This controls the order of autoconfig for important things
- * used early. For example, idprom is used by Ether drivers.
- */
-static int bus_order[] = {
- BUS_KBUS,
- BUS_VME32,
- BUS_VME24,
- BUS_VME16
-};
-#define BUS_ORDER_SZ (sizeof(bus_order)/sizeof(bus_order[0]))
-
-static void
-main_attach(parent, self, args)
- struct device *parent;
- struct device *self;
- void *args;
-{
- struct confargs ca;
- int i;
-
- printf("\n");
-
- for (i = 0; i < BUS_ORDER_SZ; i++) {
- ca.ca_bustype = bus_order[i];
- (void) config_found(self, &ca, NULL);
- }
-}
diff --git a/sys/arch/kbus/kbus/mem.c b/sys/arch/kbus/kbus/mem.c
deleted file mode 100644
index 83a5c075ed6..00000000000
--- a/sys/arch/kbus/kbus/mem.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/* $NetBSD: mem.c,v 1.13 1996/03/30 21:12:16 christos Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)mem.c 8.3 (Berkeley) 1/12/94
- */
-
-/*
- * Memory special file
- */
-
-#include <sys/param.h>
-#include <sys/buf.h>
-#include <sys/systm.h>
-#include <sys/uio.h>
-#include <sys/malloc.h>
-#include <sys/proc.h>
-#include <sys/conf.h>
-
-#include <machine/conf.h>
-
-#include <vm/vm.h>
-
-vm_offset_t prom_vstart = VM_MIN_PROM_ADDRESS;
-vm_offset_t prom_vend = VM_MAX_PROM_ADDRESS;
-caddr_t zeropage;
-
-/*ARGSUSED*/
-int
-mmopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
-
- switch (minor(dev)) {
- case 0:
- case 1:
- case 2:
- case 11:
- case 12:
- return (0);
- default:
- return (ENXIO);
- }
-}
-
-/*ARGSUSED*/
-int
-mmclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
-
- return (0);
-}
-
-/*ARGSUSED*/
-int
-mmrw(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- register vm_offset_t o, v;
- register int c;
- register struct iovec *iov;
- int error = 0;
- static int physlock;
- extern caddr_t vmmap;
-
- if (minor(dev) == 0) {
- /* lock against other uses of shared vmmap */
- while (physlock > 0) {
- physlock++;
- error = tsleep((caddr_t)&physlock, PZERO | PCATCH,
- "mmrw", 0);
- if (error)
- return (error);
- }
- physlock = 1;
- }
- while (uio->uio_resid > 0 && error == 0) {
- iov = uio->uio_iov;
- if (iov->iov_len == 0) {
- uio->uio_iov++;
- uio->uio_iovcnt--;
- if (uio->uio_iovcnt < 0)
- panic("mmrw");
- continue;
- }
- switch (minor(dev)) {
-
-/* minor device 0 is physical memory */
- case 0:
- v = uio->uio_offset;
-#if 0 /* FIXME */
- if (!pmap_pa_exists(v)) {
- error = EFAULT;
- goto unlock;
- }
-#endif
- pmap_enter(pmap_kernel(), (vm_offset_t)vmmap,
- trunc_page(v), uio->uio_rw == UIO_READ ?
- VM_PROT_READ : VM_PROT_WRITE, TRUE, 0);
- o = uio->uio_offset & PGOFSET;
- c = min(uio->uio_resid, (int)(NBPG - o));
- error = uiomove((caddr_t)vmmap + o, c, uio);
- pmap_remove(pmap_kernel(), (vm_offset_t)vmmap,
- (vm_offset_t)vmmap + NBPG);
- continue;
-
-/* minor device 1 is kernel memory */
- case 1:
- v = uio->uio_offset;
-/* if (v >= MSGBUF_VA && v < MSGBUF_VA+NBPG) {
- c = min(iov->iov_len, 4096);
- } else */ if (v >= prom_vstart && v < prom_vend &&
- uio->uio_rw == UIO_READ) {
- /* Allow read-only access to the PROM */
- c = min(iov->iov_len, prom_vend - prom_vstart);
- } else {
- c = min(iov->iov_len, MAXPHYS);
- if (!kernacc((caddr_t)v, c,
- uio->uio_rw == UIO_READ ? B_READ : B_WRITE))
- return (EFAULT);
- }
- error = uiomove((caddr_t)v, c, uio);
- continue;
-
-/* minor device 2 is EOF/RATHOLE */
- case 2:
- if (uio->uio_rw == UIO_WRITE)
- uio->uio_resid = 0;
- return (0);
-
-
-
-#if defined(SUN4)
-/* minor device 11 (/dev/eeprom) is the old-style (a'la Sun 3) EEPROM */
- case 11:
- if (cputyp == CPU_SUN4)
- error = eeprom_uio(uio);
- else
- error = ENXIO;
-
- continue;
-#endif /* SUN4 */
-
-/* minor device 12 (/dev/zero) is source of nulls on read, rathole on write */
- case 12:
- if (uio->uio_rw == UIO_WRITE) {
- c = iov->iov_len;
- break;
- }
- if (zeropage == NULL) {
- zeropage = (caddr_t)
- malloc(CLBYTES, M_TEMP, M_WAITOK);
- bzero(zeropage, CLBYTES);
- }
- c = min(iov->iov_len, CLBYTES);
- error = uiomove(zeropage, c, uio);
- continue;
-
- default:
- return (ENXIO);
- }
- if (error)
- break;
- iov->iov_base += c;
- iov->iov_len -= c;
- uio->uio_offset += c;
- uio->uio_resid -= c;
- }
- if (minor(dev) == 0) {
-/* unlock: */
- if (physlock > 1)
- wakeup((caddr_t)&physlock);
- physlock = 0;
- }
- return (error);
-}
-
-int
-mmmmap(dev, off, prot)
- dev_t dev;
- int off, prot;
-{
- return (-1);
-}
-
-int
-mmioctl(dev, cmd, data, flags, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flags;
- struct proc *p;
-{
- return (EOPNOTSUPP);
-}
diff --git a/sys/arch/kbus/kbus/pmap.c b/sys/arch/kbus/kbus/pmap.c
deleted file mode 100644
index 44ca9e4e975..00000000000
--- a/sys/arch/kbus/kbus/pmap.c
+++ /dev/null
@@ -1,1358 +0,0 @@
-/* $NetBSD: pmap.c,v 1.13 1996/10/13 03:39:53 christos Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pmap.c 8.4 (Berkeley) 1/26/94
- */
-/* TG: from pmax/pmap.c */
-/*
- * Manages physical address maps.
- *
- * In addition to hardware address maps, this
- * module is called upon to provide software-use-only
- * maps which may or may not be stored in the same
- * form as hardware maps. These pseudo-maps are
- * used to store intermediate results from copy
- * operations to and from address spaces.
- *
- * Since the information managed by this module is
- * also stored by the logical address mapping module,
- * this module may throw away valid virtual-to-physical
- * mappings at almost any time. However, invalidations
- * of virtual-to-physical mappings must be done as
- * requested.
- *
- * In order to cope with hardware architectures which
- * make virtual-to-physical map invalidates expensive,
- * this module may delay invalidate or reduced protection
- * operations until such time as they are actually
- * necessary. This module is given full information as
- * to which processors are currently using which maps,
- * and to when physical maps must be made correct.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/malloc.h>
-#include <sys/user.h>
-#include <sys/buf.h>
-#ifdef SYSVSHM
-#include <sys/shm.h>
-#endif
-#include <machine/asm.h>
-#include <machine/asi.h>
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-#include <vm/vm_pageout.h>
-
-/*
- * For each vm_page_t, there is a list of all currently valid virtual
- * mappings of that page. An entry is a pv_entry_t, the list is pv_table.
- * XXX really should do this as a part of the higher level code.
- */
-typedef struct pv_entry {
- struct pv_entry *pv_next; /* next pv_entry */
- struct pmap *pv_pmap; /* pmap where mapping lies */
- vm_offset_t pv_va; /* virtual address for mapping */
-} *pv_entry_t;
-
-pv_entry_t pv_table; /* array of entries, one per page */
-void pmap_remove_pv __P((pmap_t pmap, vm_offset_t va, vm_offset_t pa));
-
-#define pa_index(pa) atop(pa - first_phys_addr)
-#define pa_to_pvh(pa) (&pv_table[pa_index(pa)])
-
-#undef DEBUG
-#ifdef DEBUG
-struct {
- int kernel; /* entering kernel mapping */
- int user; /* entering user mapping */
- int ptpneeded; /* needed to allocate a PT page */
- int pwchange; /* no mapping change, just wiring or protection */
- int wchange; /* no mapping change, just wiring */
- int mchange; /* was mapped but mapping to different page */
- int managed; /* a managed page */
- int firstpv; /* first mapping for this PA */
- int secondpv; /* second mapping for this PA */
- int ci; /* cache inhibited */
- int unmanaged; /* not a managed page */
- int flushes; /* cache flushes */
- int cachehit; /* new entry forced valid entry out */
-} enter_stats;
-struct {
- int calls;
- int removes;
- int flushes;
- int pvfirst;
- int pvsearch;
-} remove_stats;
-
-
-#define PDB_FOLLOW 0x0001
-#define PDB_INIT 0x0002
-#define PDB_ENTER 0x0004
-#define PDB_REMOVE 0x0008
-#define PDB_CREATE 0x0010
-#define PDB_PTPAGE 0x0020
-#define PDB_PVENTRY 0x0040
-#define PDB_BITS 0x0080
-#define PDB_COLLECT 0x0100
-#define PDB_PROTECT 0x0200
-#define PDB_PARANOIA 0x2000
-#define PDB_WIRING 0x4000
-#define PDB_PVDUMP 0x8000
-int pmapdebug = 0; /* PDB_INIT | PDB_CREATE; */
-#endif /* DEBUG */
-
-struct pmap kernel_pmap_store;
-
-vm_offset_t avail_start; /* PA of first available physical page */
-vm_offset_t avail_end; /* PA of last available physical page */
-vm_size_t mem_size; /* memory size in bytes */
-vm_offset_t virtual_avail; /* VA of first avail page (after kernel bss)*/
-vm_offset_t virtual_end; /* VA of last avail page (end of kernel AS) */
-int series5pagesperpage; /* PAGE_SIZE / NBPG */
-/* struct segtab *free_segtab; * free list kept locally */
-pt_entry_t *Sysmap; /* kernel pte table */
-u_int Sysmapsize; /* number of pte's in Sysmap */
-caddr_t vmmap;
-
-extern struct segtab *KPTphys;
-#define tlb_update(va, pte) tlb_flush(va)
-
-#define kv_to_pte_entry(va) ((unsigned)lda(ASI_GTLB_RDD, va & ~3))
-static void
-kv_tlb_update (int va, unsigned long entry)
-{
- /* printf ("va: %p, entry: %p\n", va, entry); */
- sta (ASI_FGTLB_VALI, va & ~3, entry | PG_WINDOW);
- sta (ASI_FGTLB_VALD, va & ~3, entry | PG_WINDOW);
-}
-
-static void
-tlb_flush (int va)
-{
- sta (ASI_FGTLB_VALI, va & ~3, PG_TLBINV);
- sta (ASI_FGTLB_VALD, va & ~3, PG_TLBINV);
-}
-
-/*
- * Bootstrap the system enough to run with virtual memory.
- * firstaddr is the first unused kseg0 address (not page aligned).
- */
-void
-pmap_bootstrap(firstaddr)
- vm_offset_t firstaddr;
-{
- register int i;
- vm_offset_t start;
- extern int physmem;
-
- firstaddr += SERIES5_KERN_WINDOW;
- start = firstaddr;
-
-#define valloc(name, type, num) \
- (name) = (type *)firstaddr; firstaddr = (vm_offset_t)((name)+(num))
-
-
- pmap_kernel()->pm_segtab = KPTphys;
- pmap_kernel()->pm_psegtab
- = (void *)((u_int)KPTphys & SERIES5_KERN_MASK);
-
- /*
- * Allocate memory for pv_table.
- * This will allocate more entries than we really need.
- * We could do this in pmap_init when we know the actual
- * phys_start and phys_end but its better to use kseg0 addresses
- * rather than kernel virtual addresses mapped through the TLB.
- */
- i = physmem - series5_btop(firstaddr & SERIES5_KERN_MASK);
- valloc(pv_table, struct pv_entry, i);
-
- /*
- * Clear allocated memory.
- */
- firstaddr = series5_round_page(firstaddr);
- bzero((caddr_t)start, firstaddr - start);
-
- avail_start = firstaddr & SERIES5_KERN_MASK;
- avail_end = series5_ptob(physmem);
- mem_size = avail_end - avail_start;
-
- virtual_avail = VM_MIN_KERNEL_ADDRESS;
- virtual_end = 0xfdff0000; /* VM_MAX_KERNEL_ADDRESS; */
- cnt.v_page_size = SERIES5_PAGE_SIZE;
- series5pagesperpage = 1;
-
- simple_lock_init(&pmap_kernel()->pm_lock);
- pmap_kernel()->pm_count = 1;
-
- /* OK, now no kb can be allocated in the kernel window;
- virtual memory should be used. */
- /* TODO: remove pages not used in the kernel window. */
-}
-
-/*
- * Bootstrap memory allocator. This function allows for early dynamic
- * memory allocation until the virtual memory system has been bootstrapped.
- * After that point, either kmem_alloc or malloc should be used. This
- * function works by stealing pages from the (to be) managed page pool,
- * stealing virtual address space, then mapping the pages and zeroing them.
- *
- * It should be used from pmap_bootstrap till vm_page_startup, afterwards
- * it cannot be used, and will generate a panic if tried. Note that this
- * memory will never be freed, and in essence it is wired down.
- */
-void *
-pmap_bootstrap_alloc(size)
- int size;
-{
- extern boolean_t vm_page_startup_initialized;
- vm_offset_t val;
-
- if (vm_page_startup_initialized)
- panic("pmap_bootstrap_alloc: called after startup initialized");
-
- size = round_page(size);
- val = virtual_avail;
-
- virtual_avail = pmap_map(virtual_avail, avail_start,
- avail_start + size, VM_PROT_READ|VM_PROT_WRITE);
- avail_start += size;
-
- bzero ((caddr_t) val, size);
- return (void *) val;
-}
-
-/*
- * Initialize the pmap module.
- * Called by vm_init, to initialize any structures that the pmap
- * system needs to map virtual memory.
- */
-void
-pmap_init(phys_start, phys_end)
- vm_offset_t phys_start, phys_end;
-{
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_INIT))
- printf("pmap_init(%x, %x)\n", phys_start, phys_end);
-#endif
-}
-
-/*
- * Used to map a range of physical addresses into kernel
- * virtual address space.
- *
- * For now, VM is already on, we only need to map the
- * specified memory.
- */
-vm_offset_t
-pmap_map(virt, start, end, prot)
- vm_offset_t virt;
- vm_offset_t start;
- vm_offset_t end;
- int prot;
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_map(%x, %x, %x, %x)\n", virt, start, end, prot);
-#endif
- while (start < end) {
- pmap_enter(pmap_kernel(), virt, start, prot, FALSE, 0);
- virt += PAGE_SIZE;
- start += PAGE_SIZE;
- }
- return(virt);
-}
-
-/*
- * Create and return a physical map.
- *
- * If the size specified for the map
- * is zero, the map is an actual physical
- * map, and may be referenced by the
- * hardware.
- *
- * If the size specified is non-zero,
- * the map will be used in software only, and
- * is bounded by that size.
- */
-pmap_t
-pmap_create(size)
- vm_size_t size;
-{
- register pmap_t pmap;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- printf("pmap_create(%x)\n", size);
-#endif
- /*
- * Software use map does not need a pmap
- */
- if (size)
- return (NULL);
-
- /* XXX: is it ok to wait here? */
- pmap = (pmap_t) malloc(sizeof *pmap, M_VMPMAP, M_WAITOK);
-#if 1 /* def notifwewait */
- if (pmap == NULL)
- panic("pmap_create: cannot allocate a pmap");
-#endif
- bzero(pmap, sizeof(*pmap));
- pmap_pinit(pmap);
- return (pmap);
-}
-
-/*
- * Initialize a preallocated and zeroed pmap structure,
- * such as one in a vmspace structure.
- */
-void
-pmap_pinit(pmap)
- register struct pmap *pmap;
-{
- register int i;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- printf("pmap_pinit(%x)\n", pmap);
-#endif
- simple_lock_init(&pmap->pm_lock);
- pmap->pm_count = 1;
- pmap->pm_segtab = (struct segtab *)
- kmem_alloc (kernel_map, SERIES5_PDT_SIZE);
- if (!pmap->pm_segtab)
- panic ("No rom for segtab");
- pmap->pm_psegtab = (void *)
- pmap_extract (pmap_kernel (), (vm_offset_t) pmap->pm_segtab);
- bzero (pmap->pm_segtab, SERIES5_PDT_SIZE);
-
- /* Copy kernel map. */
- for (i = 0xf8; i <= 0xfd; i++)
- {
- pmap->pm_segtab->seg_tab[i] = pmap_kernel()->pm_segtab->seg_tab[i];
- pmap->pm_segtab->seg_pde[i] = pmap_kernel()->pm_segtab->seg_pde[i];
- }
-}
-
-/*
- * Retire the given physical map from service.
- * Should only be called if the map contains
- * no valid mappings.
- */
-void
-pmap_destroy(pmap)
- register pmap_t pmap;
-{
- int count;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- printf("pmap_destroy(%x)\n", pmap);
-#endif
- if (pmap == NULL)
- return;
-
- simple_lock(&pmap->pm_lock);
- count = --pmap->pm_count;
- simple_unlock(&pmap->pm_lock);
- if (count == 0) {
- pmap_release(pmap);
- free((caddr_t)pmap, M_VMPMAP);
- }
-}
-
-/*
- * Release any resources held by the given physical map.
- * Called when a pmap initialized by pmap_pinit is being released.
- * Should only be called if the map contains no valid mappings.
- */
-void
-pmap_release(pmap)
- register pmap_t pmap;
-{
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- printf("pmap_release(%x)\n", pmap);
-#endif
-
- if (pmap->pm_segtab)
- {
- register pt_entry_t *pte;
- register int i;
-#ifdef DIAGNOSTIC
- register int j;
-#endif
-
- for (i = pdei (VM_MIN_ADDRESS); i < pdei (VM_MAX_ADDRESS); i++)
- {
- /* get pointer to segment map */
- pte = pmap->pm_segtab->seg_tab[i];
- if (!pte)
- continue;
-
-#ifdef DIAGNOSTIC
- for (j = 0; j < NPTEPG; j++)
- {
- if (pte->pt_entry)
- panic("pmap_release: segmap not empty");
- }
-#endif
- kmem_free (kernel_map, (vm_offset_t)pte, SERIES5_PGT_SIZE);
- pmap->pm_segtab->seg_tab[i] = NULL;
- pmap->pm_segtab->seg_pde[i].pd_entry = PD_NV;
- }
- kmem_free (kernel_map, (vm_offset_t)pmap->pm_segtab, SERIES5_PDT_SIZE);
- pmap->pm_segtab = NULL;
- pmap->pm_psegtab = (void *) -1;
- }
-}
-
-/*
- * Add a reference to the specified pmap.
- */
-void
-pmap_reference(pmap)
- pmap_t pmap;
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_reference(%x)\n", pmap);
-#endif
- if (pmap != NULL) {
- simple_lock(&pmap->pm_lock);
- pmap->pm_count++;
- simple_unlock(&pmap->pm_lock);
- }
-}
-
-/*
- * Remove the given range of addresses from the specified map.
- *
- * It is assumed that the start and end are properly
- * rounded to the page size.
- */
-void
-pmap_remove(pmap, sva, eva)
- register pmap_t pmap;
- vm_offset_t sva, eva;
-{
- register vm_offset_t nssva;
- register pt_entry_t *pte;
- unsigned entry;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT))
- printf("pmap_remove(%x, %x, %x)\n", pmap, sva, eva);
- remove_stats.calls++;
-#endif
- if (pmap == NULL)
- return;
-
- if (!pmap->pm_segtab) {
- register pt_entry_t pte;
-
- /* remove entries from kernel pmap */
-#ifdef DIAGNOSTIC
- if (sva < VM_MIN_KERNEL_ADDRESS || eva > virtual_end)
- panic("pmap_remove: kva not in range");
-#endif
- for (; sva < eva; sva += NBPG) {
- entry = pte.pt_entry;
- entry = kv_to_pte_entry (sva);
- if (!(entry & PG_V))
- continue;
- if (entry & PG_WIRED)
- pmap->pm_stats.wired_count--;
- pmap->pm_stats.resident_count--;
- pmap_remove_pv(pmap, sva, entry & PG_FRAME);
-#ifdef ATTR
- pmap_attributes[atop(entry & PG_FRAME)] = 0;
-#endif
- entry = PG_NV;
- /*
- * Flush the TLB for the given address.
- */
- kv_tlb_update (sva, entry);
-#ifdef DEBUG
- remove_stats.flushes++;
-#endif
- }
- return;
- }
-
-#ifdef DIAGNOSTIC
- if (eva > VM_MAXUSER_ADDRESS)
- panic("pmap_remove: uva not in range");
-#endif
- while (sva < eva) {
- /* Compute pte on each new segment. */
- nssva = series5_trunc_seg(sva) + NBSEG;
- if (nssva == 0 || nssva > eva)
- nssva = eva;
- /*
- * If VA belongs to an unallocated segment,
- * skip to the next segment boundary.
- */
- if (!(pte = pmap_segmap(pmap, sva))) {
- sva = nssva;
- continue;
- }
- /*
- * Invalidate every valid mapping within this segment.
- */
- pte += (sva >> PGSHIFT) & (NPTEPG - 1);
- for (; sva < nssva; sva += NBPG, pte++) {
- entry = pte->pt_entry;
- if (!(entry & PG_V))
- continue;
- if (entry & PG_WIRED)
- pmap->pm_stats.wired_count--;
- pmap->pm_stats.resident_count--;
- pmap_remove_pv(pmap, sva, entry & PG_FRAME);
-#ifdef ATTR
- pmap_attributes[atop(entry & PG_FRAME)] = 0;
-#endif
- pte->pt_entry = PG_NV;
- /*
- * Flush the TLB for the given address.
- */
- tlb_flush (sva);
-#ifdef DEBUG
- remove_stats.flushes++;
-#endif
- }
- }
-}
-
-/*
- * pmap_page_protect:
- *
- * Lower the permission for all mappings to a given page.
- */
-void
-pmap_page_protect(pa, prot)
- vm_offset_t pa;
- vm_prot_t prot;
-{
- register pv_entry_t pv;
- register vm_offset_t va;
- int s;
-
-#ifdef DEBUG
- if ((pmapdebug & (PDB_FOLLOW|PDB_PROTECT)) ||
- prot == VM_PROT_NONE && (pmapdebug & PDB_REMOVE))
- printf("pmap_page_protect(%x, %x)\n", pa, prot);
-#endif
- if (!IS_VM_PHYSADDR(pa))
- return;
-
- switch (prot) {
- case VM_PROT_READ|VM_PROT_WRITE:
- case VM_PROT_ALL:
- break;
-
- /* copy_on_write */
- case VM_PROT_READ:
- case VM_PROT_READ|VM_PROT_EXECUTE:
- pv = pa_to_pvh(pa);
- s = splimp();
- /*
- * Loop over all current mappings setting/clearing as appropos.
- */
- if (pv->pv_pmap != NULL) {
- for (; pv; pv = pv->pv_next) {
- extern vm_offset_t pager_sva, pager_eva;
-
- va = pv->pv_va;
-
- /*
- * XXX don't write protect pager mappings
- */
- if (va >= pager_sva && va < pager_eva)
- continue;
- pmap_protect(pv->pv_pmap, va, va + PAGE_SIZE,
- prot);
- }
- }
- splx(s);
- break;
-
- /* remove_all */
- default:
- pv = pa_to_pvh(pa);
- s = splimp();
- while (pv->pv_pmap != NULL) {
- pmap_remove(pv->pv_pmap, pv->pv_va,
- pv->pv_va + PAGE_SIZE);
- }
- splx(s);
- }
-}
-
-/*
- * Set the physical protection on the
- * specified range of this map as requested.
- */
-void
-pmap_protect(pmap, sva, eva, prot)
- register pmap_t pmap;
- vm_offset_t sva, eva;
- vm_prot_t prot;
-{
- register vm_offset_t nssva;
- register pt_entry_t *pte;
- register unsigned entry;
- u_int p;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_PROTECT))
- printf("pmap_protect(%x, %x, %x, %x)\n", pmap, sva, eva, prot);
-#endif
- if (pmap == NULL)
- return;
-
- if ((prot & VM_PROT_READ) == VM_PROT_NONE) {
- pmap_remove(pmap, sva, eva);
- return;
- }
-
- p = (prot & VM_PROT_WRITE) ? PG_RW : PG_RO;
-
-#ifdef DIAGNOSTIC
- if (eva > VM_MAXUSER_ADDRESS)
- panic("pmap_protect: uva not in range");
-#endif
- while (sva < eva) {
- nssva = series5_trunc_seg(sva) + NBSEG;
- if (nssva == 0 || nssva > eva)
- nssva = eva;
- /*
- * If VA belongs to an unallocated segment,
- * skip to the next segment boundary.
- */
- if (!(pte = pmap_segmap(pmap, sva))) {
- sva = nssva;
- continue;
- }
- /*
- * Change protection on every valid mapping within this segment.
- */
- pte += (sva >> PGSHIFT) & (NPTEPG - 1);
- for (; sva < nssva; sva += NBPG, pte++) {
- entry = pte->pt_entry;
- if (!(entry & PG_V))
- continue;
- entry = (entry & ~(PG_M | PG_RO)) | p;
- if (sva >= VM_MAXUSER_ADDRESS)
- entry |= PG_u;
- pte->pt_entry = entry;
- /*
- * Update the TLB if the given address is in the cache.
- */
- tlb_flush (sva);
- }
- }
-}
-
-#ifdef MIPS3 /* r4000,r4400,r4600 */
-/*
- * Return RO protection of page.
- */
-int
-pmap_is_page_ro(pmap, va, entry)
- pmap_t pmap;
- vm_offset_t va;
- int entry;
-{
- return(entry & PG_RO);
-}
-
-#endif /* MIPS3 */ /* r4000,r4400,r4600 */
-
-
-/*
- * Insert the given physical page (p) at
- * the specified virtual address (v) in the
- * target physical map with the protection requested.
- *
- * If specified, the page will be wired down, meaning
- * that the related pte can not be reclaimed.
- *
- * NB: This is the only routine which MAY NOT lazy-evaluate
- * or lose information. That is, this routine must actually
- * insert this page into the given map NOW.
- */
-void
-pmap_enter(pmap, va, pa, prot, wired, access_type)
- register pmap_t pmap;
- vm_offset_t va;
- register vm_offset_t pa;
- vm_prot_t prot;
- boolean_t wired;
- vm_prot_t access_type;
-{
- register pt_entry_t *pte;
- register u_int npte;
- register int i;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_ENTER))
- {
- printf("pmap_enter(%x, %x, %x, %x, %x)\n",
- pmap, va, pa, prot, wired);
- printf ("PHYSADDR = %d, segtab = %x\n",
- IS_VM_PHYSADDR (pa), pmap->pm_segtab);
- }
-#endif
-#ifdef DIAGNOSTIC
- if (!pmap)
- panic("pmap_enter: pmap");
- if (!pmap->pm_segtab) {
- enter_stats.kernel++;
- if (va < VM_MIN_KERNEL_ADDRESS || va >= virtual_end)
- panic("pmap_enter: kva");
- } else {
- enter_stats.user++;
- if (va >= VM_MAXUSER_ADDRESS)
- panic("pmap_enter: uva");
- }
- if (!(prot & VM_PROT_READ))
- panic("pmap_enter: prot");
-#endif
-
- if (IS_VM_PHYSADDR(pa) && (pa & PG_IO) == 0) {
- register pv_entry_t pv, npv;
- int s;
-
- if (!(prot & VM_PROT_WRITE))
- npte = PG_RO;
- else {
- register vm_page_t mem;
-
- mem = PHYS_TO_VM_PAGE(pa);
- if ((int)va < 0) {
- /*
- * Don't bother to trap on kernel writes,
- * just record page as dirty.
- */
- npte = PG_M;
- mem->flags &= ~PG_CLEAN;
- } else
-#ifdef ATTR
- if ((pmap_attributes[atop(pa)] &
- PMAP_ATTR_MOD) || !(mem->flags & PG_CLEAN))
-#else
- if (!(mem->flags & PG_CLEAN))
-#endif
- npte = PG_M;
- else
- npte = 0;
- }
-
-#ifdef DEBUG
- enter_stats.managed++;
-#endif
- /*
- * Enter the pmap and virtual address into the
- * physical to virtual map table.
- */
- pv = pa_to_pvh(pa);
- s = splimp();
-#ifdef DEBUG
- if (pmapdebug & PDB_ENTER)
- printf("pmap_enter: pv %x: was %x/%x/%x\n",
- pv, pv->pv_va, pv->pv_pmap, pv->pv_next);
-#endif
- if (pv->pv_pmap == NULL) {
- /*
- * No entries yet, use header as the first entry
- */
-#ifdef DEBUG
- if (pmapdebug & PDB_PVENTRY)
- printf("pmap_enter: first pv: pmap %x va %x\n",
- pmap, va);
- enter_stats.firstpv++;
-#endif
- pv->pv_va = va;
- pv->pv_pmap = pmap;
- pv->pv_next = NULL;
- } else {
- /*
- * There is at least one other VA mapping this page.
- * Place this entry after the header.
- *
- * Note: the entry may already be in the table if
- * we are only changing the protection bits.
- */
- for (npv = pv; npv; npv = npv->pv_next)
- if (pmap == npv->pv_pmap && va == npv->pv_va) {
-#ifdef DIAGNOSTIC
- unsigned entry;
-
- if (!pmap->pm_segtab)
- entry = kv_to_pte_entry(va);
- else {
- pte = pmap_segmap(pmap, va);
- if (pte) {
- pte += (va >> PGSHIFT) &
- (NPTEPG - 1);
- entry = pte->pt_entry;
- } else
- entry = 0;
- }
- if (!(entry & PG_V) ||
- (entry & PG_FRAME) != pa)
- printf(
- "pmap_enter: found va %x pa %x in pv_table but != %x\n",
- va, pa, entry);
-#endif
- goto fnd;
- }
-#ifdef DEBUG
- if (pmapdebug & PDB_PVENTRY)
- printf("pmap_enter: new pv: pmap %x va %x\n",
- pmap, va);
-#endif
- /* can this cause us to recurse forever? */
- npv = (pv_entry_t)
- malloc(sizeof *npv, M_VMPVENT, M_NOWAIT);
- npv->pv_va = va;
- npv->pv_pmap = pmap;
- npv->pv_next = pv->pv_next;
- pv->pv_next = npv;
-#ifdef DEBUG
- if (!npv->pv_next)
- enter_stats.secondpv++;
-#endif
- fnd:
- ;
- }
- splx(s);
- } else {
- /*
- * Assumption: if it is not part of our managed memory
- * then it must be device memory which may be volitile.
- */
-#ifdef DEBUG
- enter_stats.unmanaged++;
-#endif
- npte = (prot & VM_PROT_WRITE) ? PG_M : PG_RO;
- }
-
- /*
- * The only time we need to flush the cache is if we
- * execute from a physical address and then change the data.
- * This is the best place to do this.
- * pmap_protect() and pmap_remove() are mostly used to switch
- * between R/W and R/O pages.
- * NOTE: we only support cache flush for read only text.
- */
-#if 0
- if (prot == (VM_PROT_READ | VM_PROT_EXECUTE))
- MachFlushICache(pa, PAGE_SIZE);
-#endif
-
- if (!pmap->pm_segtab) {
- /* enter entries into kernel pmap */
- npte |= pa | PG_V | PG_HRO;
- if (wired) {
- pmap->pm_stats.wired_count += series5pagesperpage;
- npte |= PG_WIRED;
- }
- i = series5pagesperpage;
- do {
- if (!(kv_to_pte_entry (va) & PG_V)) {
- pmap->pm_stats.resident_count++;
- } else {
-#ifdef DIAGNOSTIC
- if (pte->pt_entry & PG_WIRED)
- panic("pmap_enter: kernel wired");
-#endif
- }
- /*
- * Update the same virtual address entry.
- */
- kv_tlb_update (va, npte);
- va += NBPG;
- npte += NBPG;
- } while (--i != 0);
- return;
- }
-
- if (!(pte = pmap_segmap(pmap, va))) {
- u_int p_addr;
- pte = (pt_entry_t *)kmem_alloc (kernel_map, SERIES5_PGT_SIZE);
- if (!pte)
- panic ("No room for pd");
- bzero (pte, SERIES5_PGT_SIZE);
- pmap_segmap(pmap, va) = pte;
- p_addr = (u_int)pmap_extract (pmap_kernel(), (vm_offset_t)pte);
- pmap_segpde(pmap, va).pd_entry = p_addr | PD_V;
- }
- pte += (va >> PGSHIFT) & (NPTEPG - 1);
-
- /*
- * Now validate mapping with desired protection/wiring.
- * Assume uniform modified and referenced status for all
- * PMAX pages in a MACH page.
- */
- npte |= pa | PG_V | PG_HRO;
- if (va >= VM_MAXUSER_ADDRESS)
- npte |= PG_u;
- if (wired) {
- pmap->pm_stats.wired_count += series5pagesperpage;
- npte |= PG_WIRED;
- }
-#ifdef DEBUG
- if (pmapdebug & PDB_ENTER) {
- printf("pmap_enter: new pte %x, pte %x\n", npte, pte);
- }
-#endif
- i = series5pagesperpage;
- do {
- pte->pt_entry = npte;
- tlb_flush (va);
- va += NBPG;
- npte += NBPG;
- pte++;
- } while (--i != 0);
-}
-
-/*
- * Routine: pmap_change_wiring
- * Function: Change the wiring attribute for a map/virtual-address
- * pair.
- * In/out conditions:
- * The mapping must already exist in the pmap.
- */
-void
-pmap_change_wiring(pmap, va, wired)
- register pmap_t pmap;
- vm_offset_t va;
- boolean_t wired;
-{
- register pt_entry_t *pte;
- u_int p;
- register int i;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_WIRING))
- printf("pmap_change_wiring(%x, %x, %x)\n", pmap, va, wired);
-#endif
- if (pmap == NULL)
- return;
-
- p = wired ? PG_WIRED : 0;
-
- /*
- * Don't need to flush the TLB since PG_WIRED is only in software.
- */
- if (!pmap->pm_segtab) {
- panic ("!pmap->pm_segtab");
- /* change entries in kernel pmap */
-#ifdef DIAGNOSTIC
- if (va < VM_MIN_KERNEL_ADDRESS || va >= virtual_end)
- panic("pmap_change_wiring");
-#endif
- /* pte = kvtopte(va); */
- } else {
- if (!(pte = pmap_segmap(pmap, va)))
- return;
- pte += (va >> PGSHIFT) & (NPTEPG - 1);
- }
-
- i = series5pagesperpage;
- if (!(pte->pt_entry & PG_WIRED) && p)
- pmap->pm_stats.wired_count += i;
- else if ((pte->pt_entry & PG_WIRED) && !p)
- pmap->pm_stats.wired_count -= i;
- do {
- if (pte->pt_entry & PG_V)
- pte->pt_entry = (pte->pt_entry & ~PG_WIRED) | p;
- pte++;
- } while (--i != 0);
-}
-
-/*
- * Routine: pmap_extract
- * Function:
- * Extract the physical page address associated
- * with the given map/virtual_address pair.
- */
-vm_offset_t
-pmap_extract(pmap, va)
- register pmap_t pmap;
- vm_offset_t va;
-{
- register vm_offset_t pa;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_extract(%x, %x) -> ", pmap, va);
-#endif
-
- if (!pmap->pm_segtab) {
-#ifdef DIAGNOSTIC
- if (va < VM_MIN_KERNEL_ADDRESS || va >= virtual_end)
- panic("pmap_extract");
-#endif
- pa = kv_to_pte_entry(va) & PG_FRAME;
- } else {
- register pt_entry_t *pte;
-
- if (pmap == pmap_kernel()
- && (va & SERIES5_KERN_WINDOW) == SERIES5_KERN_WINDOW)
- pa = kv_to_pte_entry (va) & PG_FRAME;
- else if (!(pte = pmap_segmap(pmap, va)))
- pa = 0;
- else
- {
- pte += (va >> PGSHIFT) & (NPTEPG - 1);
- pa = pte->pt_entry & PG_FRAME;
- }
- }
- if (pa)
- pa |= va & PGOFSET;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_extract: pa %x\n", pa);
-#endif
- return (pa);
-}
-
-/*
- * Copy the range specified by src_addr/len
- * from the source map to the range dst_addr/len
- * in the destination map.
- *
- * This routine is only advisory and need not do anything.
- */
-void
-pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr)
- pmap_t dst_pmap;
- pmap_t src_pmap;
- vm_offset_t dst_addr;
- vm_size_t len;
- vm_offset_t src_addr;
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_copy(%x, %x, %x, %x, %x)\n",
- dst_pmap, src_pmap, dst_addr, len, src_addr);
-#endif
-}
-
-/*
- * Require that all active physical maps contain no
- * incorrect entries NOW. [This update includes
- * forcing updates of any address map caching.]
- *
- * Generally used to insure that a thread about
- * to run will see a semantically correct world.
- */
-void
-pmap_update()
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_update()\n");
-#endif
-}
-
-/*
- * Routine: pmap_collect
- * Function:
- * Garbage collects the physical map system for
- * pages which are no longer used.
- * Success need not be guaranteed -- that is, there
- * may well be pages which are not referenced, but
- * others may be collected.
- * Usage:
- * Called by the pageout daemon when pages are scarce.
- */
-void
-pmap_collect(pmap)
- pmap_t pmap;
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_collect(%x)\n", pmap);
-#endif
-}
-
-/*
- * pmap_zero_page zeros the specified (machine independent)
- * page.
- */
-void
-pmap_zero_page(phys)
- vm_offset_t phys;
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_zero_page(%x)\n", phys);
-#endif
- phys &= PG_FRAME;
- sta (ASI_FGTLB_VALD, SERIES5_CMAP1, phys | PG_WINDOW);
- bzero ((void *)SERIES5_CMAP1, NBPG);
-}
-
-/*
- * pmap_copy_page copies the specified (machine independent)
- * page.
- */
-void
-pmap_copy_page(src, dst)
- vm_offset_t src, dst;
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_copy_page(%x, %x)\n", src, dst);
-#endif
- sta (ASI_FGTLB_VALD, SERIES5_CMAP1, src | PG_WINDOW);
- sta (ASI_FGTLB_VALD, SERIES5_CMAP2, dst | PG_WINDOW);
- bcopy ((void *)SERIES5_CMAP1, (void *)SERIES5_CMAP2, NBPG);
-}
-
-/*
- * Routine: pmap_pageable
- * Function:
- * Make the specified pages (by pmap, offset)
- * pageable (or not) as requested.
- *
- * A page which is not pageable may not take
- * a fault; therefore, its page table entry
- * must remain valid for the duration.
- *
- * This routine is merely advisory; pmap_enter
- * will specify that these pages are to be wired
- * down (or not) as appropriate.
- */
-void
-pmap_pageable(pmap, sva, eva, pageable)
- pmap_t pmap;
- vm_offset_t sva, eva;
- boolean_t pageable;
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_pageable(%x, %x, %x, %x)\n",
- pmap, sva, eva, pageable);
-#endif
-}
-
-/*
- * Clear the modify bits on the specified physical page.
- */
-void
-pmap_clear_modify(pa)
- vm_offset_t pa;
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_clear_modify(%x)\n", pa);
-#endif
-#ifdef ATTR
- pmap_attributes[atop(pa)] &= ~PMAP_ATTR_MOD;
- pmap_changebit (pa, PG_M, FALSE);
-#endif
-}
-
-/*
- * pmap_clear_reference:
- *
- * Clear the reference bit on the specified physical page.
- */
-void
-pmap_clear_reference(pa)
- vm_offset_t pa;
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_clear_reference(%x)\n", pa);
-#endif
-#ifdef ATTR
- pmap_attributes[atop(pa)] &= ~PMAP_ATTR_REF;
- pmap_changebit (pa, PG_U, FALSE);
-#endif
-}
-
-/*
- * pmap_is_referenced:
- *
- * Return whether or not the specified physical page is referenced
- * by any physical maps.
- */
-boolean_t
-pmap_is_referenced(pa)
- vm_offset_t pa;
-{
-#ifdef ATTR
- return (pmap_attributes[atop(pa)] & PMAP_ATTR_REF);
- return pmap_testbit (pa, PG_U);
-#else
- return (FALSE);
-#endif
-}
-
-/*
- * pmap_is_modified:
- *
- * Return whether or not the specified physical page is modified
- * by any physical maps.
- */
-boolean_t
-pmap_is_modified(pa)
- vm_offset_t pa;
-{
-#ifdef ATTR
- return pmap_testbit (pa, PG_M);
-#else
- return (FALSE);
-#endif
-}
-
-vm_offset_t
-pmap_phys_address(ppn)
- int ppn;
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_phys_address(%x)\n", ppn);
-#endif
- return (series5_ptob(ppn));
-}
-
-/*
- * Miscellaneous support routines
- */
-
-/*
- * Remove a physical to virtual address translation.
- */
-void
-pmap_remove_pv(pmap, va, pa)
- pmap_t pmap;
- vm_offset_t va, pa;
-{
- register pv_entry_t pv, npv;
- int s;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_PVENTRY))
- printf("pmap_remove_pv(%x, %x, %x)\n", pmap, va, pa);
-#endif
- /*
- * Remove page from the PV table (raise IPL since we
- * may be called at interrupt time).
- */
- if (!IS_VM_PHYSADDR(pa))
- return;
- pv = pa_to_pvh(pa);
- s = splimp();
- /*
- * If it is the first entry on the list, it is actually
- * in the header and we must copy the following entry up
- * to the header. Otherwise we must search the list for
- * the entry. In either case we free the now unused entry.
- */
- if (pmap == pv->pv_pmap && va == pv->pv_va) {
- npv = pv->pv_next;
- if (npv) {
- *pv = *npv;
- free((caddr_t)npv, M_VMPVENT);
- } else
- pv->pv_pmap = NULL;
-#ifdef DEBUG
- remove_stats.pvfirst++;
-#endif
- } else {
- for (npv = pv->pv_next; npv; pv = npv, npv = npv->pv_next) {
-#ifdef DEBUG
- remove_stats.pvsearch++;
-#endif
- if (pmap == npv->pv_pmap && va == npv->pv_va)
- goto fnd;
- }
-#ifdef DIAGNOSTIC
- printf("pmap_remove_pv(%x, %x, %x) not found\n", pmap, va, pa);
- panic("pmap_remove_pv");
-#endif
- fnd:
- pv->pv_next = npv->pv_next;
- free((caddr_t)npv, M_VMPVENT);
- }
- splx(s);
-}
-
-void
-pmap_disp_va (pmap_t pmap, vm_offset_t va)
-{
- pt_entry_t *pte;
- unsigned entry;
-
- printf ("va 0x%08x for pmap %p, segtab = %p",
- va, pmap, pmap->pm_segtab);
- printf (" seg_tab = %p\n", pmap->pm_segtab->seg_tab);
- pte = pmap_segmap(pmap, va);
- printf ("pt 0x%08x ", pte);
- if (pte)
- {
- pte += (va >> PGSHIFT) & (NPTEPG - 1);
- entry = pte->pt_entry;
- printf ("has pte 0x%08x, and pde 0x%08x\n",
- entry, pmap_segpde (pmap, va).pd_entry);
- }
- else
- printf ("has no pte\n");
-}
-
diff --git a/sys/arch/kbus/kbus/process_machdep.c b/sys/arch/kbus/kbus/process_machdep.c
deleted file mode 100644
index 3ea7669ede6..00000000000
--- a/sys/arch/kbus/kbus/process_machdep.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* $NetBSD: process_machdep.c,v 1.6 1996/03/14 21:09:26 christos Exp $ */
-
-/*
- * Copyright (c) 1993 The Regents of the University of California.
- * Copyright (c) 1993 Jan-Simon Pendry
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Jan-Simon Pendry.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Id: procfs_i386.c,v 4.1 1993/12/17 10:47:45 jsp Rel
- */
-
-/*
- * This file may seem a bit stylized, but that so that it's easier to port.
- * Functions to be implemented here are:
- *
- * process_read_regs(proc, regs)
- * Get the current user-visible register set from the process
- * and copy it into the regs structure (<machine/reg.h>).
- * The process is stopped at the time read_regs is called.
- *
- * process_write_regs(proc, regs)
- * Update the current register set from the passed in regs
- * structure. Take care to avoid clobbering special CPU
- * registers or privileged bits in the PSL.
- * The process is stopped at the time write_regs is called.
- *
- * process_sstep(proc)
- * Arrange for the process to trap after executing a single instruction.
- *
- * process_set_pc(proc)
- * Set the process's program counter.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/time.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/vnode.h>
-#include <machine/psl.h>
-#include <machine/reg.h>
-#include <machine/frame.h>
-#include <sys/ptrace.h>
-
-int
-process_read_regs(p, regs)
- struct proc *p;
- struct reg *regs;
-{
- /* NOTE: struct reg == struct trapframe */
- bcopy(p->p_md.md_tf, (caddr_t)regs, sizeof(struct reg));
- return (0);
-}
-
-int
-process_write_regs(p, regs)
- struct proc *p;
- struct reg *regs;
-{
- int psr = p->p_md.md_tf->tf_psr & ~PSR_ICC;
- bcopy((caddr_t)regs, p->p_md.md_tf, sizeof(struct reg));
- p->p_md.md_tf->tf_psr = psr | (regs->r_psr & PSR_ICC);
- return (0);
-}
-
-int
-process_sstep(p, sstep)
- struct proc *p;
- int sstep;
-{
- if (sstep)
- return EINVAL;
- return (0);
-}
-
-int
-process_set_pc(p, addr)
- struct proc *p;
- caddr_t addr;
-{
- p->p_md.md_tf->tf_pc = (u_int)addr;
- p->p_md.md_tf->tf_npc = (u_int)addr + 4;
- return (0);
-}
-
-int
-process_read_fpregs(p, regs)
-struct proc *p;
-struct fpreg *regs;
-{
- extern struct fpstate initfpstate;
- struct fpstate *statep = &initfpstate;
-
- /* NOTE: struct fpreg == struct fpstate */
- if (p->p_md.md_fpstate)
- statep = p->p_md.md_fpstate;
- bcopy(statep, regs, sizeof(struct fpreg));
- return 0;
-}
-
-int
-process_write_fpregs(p, regs)
-struct proc *p;
-struct fpreg *regs;
-{
- if (p->p_md.md_fpstate == NULL)
- return EINVAL;
-
- bcopy(regs, p->p_md.md_fpstate, sizeof(struct fpreg));
- return 0;
-}
diff --git a/sys/arch/kbus/kbus/sunos_machdep.c b/sys/arch/kbus/kbus/sunos_machdep.c
deleted file mode 100644
index 1a572199112..00000000000
--- a/sys/arch/kbus/kbus/sunos_machdep.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $NetBSD: sunos_machdep.c,v 1.3 1995/10/07 06:26:08 mycroft Exp $ */
-
-/*
- * Copyright (c) 1995 Matthew Green
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/namei.h>
-#include <sys/user.h>
-#include <sys/filedesc.h>
-#include <sys/ioctl.h>
-#include <sys/mount.h>
-#include <sys/kernel.h>
-#include <sys/signal.h>
-#include <sys/signalvar.h>
-#include <sys/malloc.h>
-
-#include <sys/syscallargs.h>
-#include <compat/sunos/sunos_syscallargs.h>
-
-int
-sunos_sys_sigreturn(p, v, retval)
- register struct proc *p;
- void *v;
- register_t *retval;
-{
- struct sunos_sys_sigreturn_args *uap = v;
-
- return (sys_sigreturn(p, (struct sys_sigreturn_args *)uap, retval));
-}
diff --git a/sys/arch/kbus/kbus/swapgeneric.c b/sys/arch/kbus/kbus/swapgeneric.c
deleted file mode 100644
index d046e30ad48..00000000000
--- a/sys/arch/kbus/kbus/swapgeneric.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/* $NetBSD: swapgeneric.c,v 1.1 1995/08/25 07:49:14 phil Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)swapgeneric.c 5.5 (Berkeley) 5/9/91
- */
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/buf.h>
-#include <sys/systm.h>
-#include <sys/reboot.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-
-#include "xd.h"
-
-static void gets __P((char *cp));
-int cngetc __P((void));
-
-/*
- * Generic configuration; all in one
- */
-dev_t rootdev = NODEV;
-dev_t argdev = NODEV;
-dev_t dumpdev = NODEV;
-int nswap;
-struct swdevt swdevt[] = {
- { NODEV, 1, 0 },
- { NODEV, 0, 0 },
-};
-
-#if NSD > 0
-extern struct cfdriver sd_cd;
-#endif
-#if NXD > 0
-extern struct cfdriver xd_cd;
-#endif
-
-struct genericconf {
- struct cfdriver *gc_driver;
- char *gc_name;
- dev_t gc_major;
-} genericconf[] = {
-#if NSD > 0
- { &sd_cd, "sd", 7 },
-#endif
-#if NXD > 0
- { &xd_cd, "xd", 10 },
-#endif
- { 0 }
-};
-
-#ifdef FFS
-extern int ffs_mountroot __P((void));
-#endif
-#ifdef NFSCLIENT
-extern int nfs_mountroot __P((void));
-#endif
-int (*mountroot) __P((void)) = ffs_mountroot;
-
-void setconf __P((void));
-
-void
-setconf ()
-{
- register struct genericconf *gc;
- int unit;
-
- if (rootdev != NODEV)
- goto doswap;
-
- /* There must be at least one entry in genericconf. */
- if (genericconf[0].gc_driver == 0)
- goto verybad;
-
- if (1 || boothowto & RB_ASKNAME) {
- char name[128];
-retry:
- printf("root device? ");
- gets(name);
-#ifdef NFSCLIENT
- /* A very special root file... */
- if (name[0] == 'n' && name[1] == 'f' && name[2] == 's')
- {
- mountroot = nfs_mountroot;
- return;
- }
-#endif
-
- for (gc = genericconf; gc->gc_driver; gc++)
- if (gc->gc_name[0] == name[0] &&
- gc->gc_name[1] == name[1])
- goto gotit;
- goto bad;
-gotit:
- if (name[2] >= '0' && name[2] <= '7' && name[3] == 0) {
- unit = name[2] - '0';
- goto found;
- }
- printf("bad/missing unit number\n");
-bad:
- printf("use:\n");
- for (gc = genericconf; gc->gc_driver; gc++)
- printf("\t%s%%d\n", gc->gc_name);
- goto retry;
- }
- unit = 0;
- for (gc = genericconf; gc->gc_driver; gc++) {
- if (gc->gc_driver->cd_ndevs > unit &&
- gc->gc_driver->cd_devs[unit]) {
- printf("root on %s0\n", gc->gc_name);
- goto found;
- }
- }
-verybad:
- printf("no suitable root \n");
- for (;;) ;
-
-found:
- rootdev = makedev(gc->gc_major, unit * MAXPARTITIONS);
-doswap:
- swdevt[0].sw_dev = argdev = dumpdev =
- makedev(major(rootdev), minor(rootdev) + 1);
-}
-
-static void
-gets(cp)
- char *cp;
-{
- register char *lp;
- register c;
-
- lp = cp;
- for (;;) {
- printf("%c", c = cngetc()&0177);
- switch (c) {
- case '\n':
- case '\r':
- *lp++ = '\0';
- printf("\r\n");
- return;
- case '\b':
- case '\177':
- if (lp > cp) {
- printf(" \b");
- lp--;
- }
- continue;
- case '#':
- lp--;
- if (lp < cp)
- lp = cp;
- continue;
- case '@':
- case 'u'&037:
- lp = cp;
- printf("%c", '\n');
- continue;
- default:
- *lp++ = c;
- }
- }
-}
-
diff --git a/sys/arch/kbus/kbus/sys_machdep.c b/sys/arch/kbus/kbus/sys_machdep.c
deleted file mode 100644
index c38b655305b..00000000000
--- a/sys/arch/kbus/kbus/sys_machdep.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* $NetBSD: sys_machdep.c,v 1.7 1996/03/14 21:09:33 christos Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)sys_machdep.c 8.1 (Berkeley) 6/11/93
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/file.h>
-#include <sys/time.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/uio.h>
-#include <sys/kernel.h>
-#include <sys/mtio.h>
-#include <sys/buf.h>
-
-#include <sys/mount.h>
-#include <sys/syscallargs.h>
-
-int
-sys_sysarch(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct sys_sysarch_args /* {
- syscallarg(int) op;
- syscallarg(char *) parms;
- } */ *uap = v;
- int error = 0;
-
- switch(SCARG(uap, op)) {
- default:
- error = EINVAL;
- break;
- }
- return(error);
-}
diff --git a/sys/arch/kbus/kbus/trap.c b/sys/arch/kbus/kbus/trap.c
deleted file mode 100644
index d61227108e1..00000000000
--- a/sys/arch/kbus/kbus/trap.c
+++ /dev/null
@@ -1,1005 +0,0 @@
-/* $NetBSD: trap.c,v 1.42.4.2 1996/07/03 00:06:40 jtc Exp $ */
-
-/*
- * Copyright (c) 1996
- * The President and Fellows of Harvard College. All rights reserved.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- * This product includes software developed by Harvard University.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * This product includes software developed by Harvard University.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)trap.c 8.4 (Berkeley) 9/23/93
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/user.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/resource.h>
-#include <sys/signal.h>
-#include <sys/wait.h>
-#include <sys/syscall.h>
-#include <sys/syslog.h>
-#ifdef KTRACE
-#include <sys/ktrace.h>
-#endif
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-
-#include <machine/asm.h>
-#include <machine/cpu.h>
-#include <machine/trap.h>
-#include <machine/pmap.h>
-#include <machine/instr.h>
-#include <fpu/fpu_extern.h>
-
-#ifdef DDB
-#include <machine/db_machdep.h>
-#else
-#include <machine/frame.h>
-#endif
-#ifdef COMPAT_SVR4
-#include <machine/svr4_machdep.h>
-#endif
-
-void zs_hack (void);
-
-#define offsetof(s, f) ((int)&((s *)0)->f)
-
-extern int cold;
-
-label_t *nofault;
-
-#ifdef DEBUG
-int rwindow_debug = 0;
-#endif
-
-/*
- * Initial FPU state is all registers == all 1s, everything else == all 0s.
- * This makes every floating point register a signalling NaN, with sign bit
- * set, no matter how it is interpreted. Appendix N of the Sparc V8 document
- * seems to imply that we should do this, and it does make sense.
- */
-struct fpstate initfpstate = {
- { ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0,
- ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0 }
-};
-
-/*
- * There are more than 100 trap types, but most are unused.
- *
- * Trap type 0 is taken over as an `Asynchronous System Trap'.
- * This is left-over Vax emulation crap that should be fixed.
- */
-#define T "trap"
-const char *trap_type[] = {
- /* non-user vectors */
- "ast", /* 0 */
- "text fault", /* 1 */
- "illegal instruction", /* 2 */
- "privileged instruction",/*3 */
- "fp disabled", /* 4 */
- "window overflow", /* 5 */
- "window underflow", /* 6 */
- "alignment fault", /* 7 */
- "fp exception", /* 8 */
- "data fault", /* 9 */
- "tag overflow", /* 0a */
- T, T, T, T, T, T, /* 0b..10 */
- "level 1 int", /* 11 */
- "level 2 int", /* 12 */
- "level 3 int", /* 13 */
- "level 4 int", /* 14 */
- "level 5 int", /* 15 */
- "level 6 int", /* 16 */
- "level 7 int", /* 17 */
- "level 8 int", /* 18 */
- "level 9 int", /* 19 */
- "level 10 int", /* 1a */
- "level 11 int", /* 1b */
- "level 12 int", /* 1c */
- "level 13 int", /* 1d */
- "level 14 int", /* 1e */
- "level 15 int", /* 1f */
- T, T, T, T, T, T, T, T, /* 20..27 */
- T, T, T, T, T, T, T, T, /* 28..2f */
- T, T, T, T, T, T, /* 30..35 */
- "cp disabled", /* 36 */
- T, /* 37 */
- T, T, T, T, T, T, T, T, /* 38..3f */
- "cp exception", /* 40 */
- T, T, T, T, T, T, T, /* 41..47 */
- T, T, T, T, T, T, T, T, /* 48..4f */
- T, T, T, T, T, T, T, T, /* 50..57 */
- T, T, T, T, T, T, T, T, /* 58..5f */
- T, T, T, T, T, T, T, T, /* 60..67 */
- T, T, T, T, T, T, T, T, /* 68..6f */
- T, T, T, T, T, T, T, T, /* 70..77 */
- T, T, T, T, T, T, T, T, /* 78..7f */
-
- /* user (software trap) vectors */
- "syscall", /* 80 */
- "breakpoint", /* 81 */
- "zero divide", /* 82 */
- "flush windows", /* 83 */
- "clean windows", /* 84 */
- "range check", /* 85 */
- "fix align", /* 86 */
- "integer overflow", /* 87 */
- "svr4 syscall", /* 88 */
- "4.4 syscall", /* 89 */
- "kgdb exec", /* 8a */
- T, T, T, T, T, /* 8b..8f */
- T, T, T, T, T, T, T, T, /* 9a..97 */
- T, T, T, T, T, T, T, T, /* 98..9f */
- "svr4 getcc", /* a0 */
- "svr4 setcc", /* a1 */
- "svr4 getpsr", /* a2 */
- "svr4 setpsr", /* a3 */
- "svr4 gethrtime", /* a4 */
- "svr4 gethrvtime", /* a5 */
- T, /* a6 */
- "svr4 gethrestime", /* a7 */
-};
-#undef T
-
-#define N_TRAP_TYPES (sizeof trap_type / sizeof *trap_type)
-
-static __inline void userret __P((struct proc *, int, u_quad_t));
-void trap __P((unsigned, int, int, struct trapframe *));
-static __inline void share_fpu __P((struct proc *, struct trapframe *));
-void mem_access_fault __P((unsigned, int, u_int, int, int, struct trapframe *));
-void syscall __P((register_t, struct trapframe *, register_t));
-
-/*
- * Define the code needed before returning to user mode, for
- * trap, mem_access_fault, and syscall.
- */
-static __inline void
-userret(p, pc, oticks)
- struct proc *p;
- int pc;
- u_quad_t oticks;
-{
- int sig;
-
- /* take pending signals */
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
- p->p_priority = p->p_usrpri;
- if (want_ast) {
- want_ast = 0;
- if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
- ADDUPROF(p);
- }
- }
- if (want_resched) {
- /*
- * Since we are curproc, clock will normally just change
- * our priority without moving us from one queue to another
- * (since the running process is not on a queue.)
- * If that happened after we put ourselves on the run queue
- * but before we switched, we might not be on the queue
- * indicated by our priority.
- */
- (void) splstatclock();
- setrunqueue(p);
- p->p_stats->p_ru.ru_nivcsw++;
- mi_switch();
- (void) spl0();
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
- }
-
- /*
- * If profiling, charge recent system time to the trapped pc.
- */
- if (p->p_flag & P_PROFIL)
- addupc_task(p, pc, (int)(p->p_sticks - oticks));
-
- curpriority = p->p_priority;
-}
-
-/*
- * If someone stole the FPU while we were away, do not enable it
- * on return. This is not done in userret() above as it must follow
- * the ktrsysret() in syscall(). Actually, it is likely that the
- * ktrsysret should occur before the call to userret.
- */
-static __inline void share_fpu(p, tf)
- struct proc *p;
- struct trapframe *tf;
-{
- if ((tf->tf_psr & PSR_EF) != 0 && fpproc != p)
- tf->tf_psr &= ~PSR_EF;
-}
-
-/*
- * Called from locore.s trap handling, for non-MMU-related traps.
- * (MMU-related traps go through mem_access_fault, below.)
- */
-void
-trap(type, psr, pc, tf)
- register unsigned type;
- register int psr, pc;
- register struct trapframe *tf;
-{
- register struct proc *p;
- register struct pcb *pcb;
- register int n;
- u_quad_t sticks;
- union sigval sv;
-
- sv.sival_int = pc; /* XXX fix for parm five of trapsignal() */
-
- /* This steps the PC over the trap. */
-#define ADVANCE (n = tf->tf_npc, tf->tf_pc = n, tf->tf_npc = n + 4)
-
- cnt.v_trap++;
- /*
- * Generally, kernel traps cause a panic. Any exceptions are
- * handled early here.
- */
- if (psr & PSR_PS) {
-#ifdef DDB
- if (type == T_BREAKPOINT) {
- write_all_windows();
- if (kdb_trap(type, tf)) {
- ADVANCE;
- return;
- }
- }
-#endif
-#ifdef DIAGNOSTIC
- /*
- * Currently, we allow DIAGNOSTIC kernel code to
- * flush the windows to record stack traces.
- */
- if (type == T_FLUSHWIN) {
- write_all_windows();
- ADVANCE;
- return;
- }
-#endif
- /*
- * Storing %fsr in cpu_attach will cause this trap
- * even though the fpu has been enabled, if and only
- * if there is no FPU.
- */
- if (type == T_FPDISABLED && cold) {
- ADVANCE;
- return;
- }
- goto dopanic;
- }
- if ((p = curproc) == NULL)
- p = &proc0;
- sticks = p->p_sticks;
- pcb = &p->p_addr->u_pcb;
- p->p_md.md_tf = tf; /* for ptrace/signals */
-
- switch (type) {
-
- default:
- if (type < 0x80)
- {
- dopanic:
- /* Debugger (); */
- printf("* trap type 0x%x: pc=%x npc=%x psr=%x fvar=%x\n",
- type, pc, tf->tf_npc, psr, lda (ASI_FVAR, 0));
- panic(type < N_TRAP_TYPES ? trap_type[type] : "trap");
- /* NOTREACHED */
- }
-#if defined(COMPAT_SVR4) || defined(SUN4M)
-badtrap:
-#endif
- /* the following message is gratuitous */
- /* ... but leave it in until we find anything */
- printf("%s[%d]: unimplemented software trap 0x%x\n",
- p->p_comm, p->p_pid, type);
- trapsignal(p, SIGILL, type, ILL_ILLOPC, sv);
- break;
-
-#ifdef COMPAT_SVR4
- case T_SVR4_GETCC:
- case T_SVR4_SETCC:
- case T_SVR4_GETPSR:
- case T_SVR4_SETPSR:
- case T_SVR4_GETHRTIME:
- case T_SVR4_GETHRVTIME:
- case T_SVR4_GETHRESTIME:
- if (!svr4_trap(type, p))
- goto badtrap;
- break;
-#endif
-
- case T_AST:
- break; /* the work is all in userret() */
-
- case T_ILLINST:
- trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv);
- break;
-
- case T_PRIVINST:
- trapsignal(p, SIGILL, 0, ILL_PRVOPC, sv);
- break;
-
- case T_FPDISABLED: {
- register struct fpstate *fs = p->p_md.md_fpstate;
-
- if (fs == NULL) {
- fs = malloc(sizeof *fs, M_SUBPROC, M_WAITOK);
- *fs = initfpstate;
- p->p_md.md_fpstate = fs;
- }
- /*
- * We may have more FPEs stored up and/or ops queued.
- * If they exist, handle them and get out. Otherwise,
- * resolve the FPU state, turn it on, and try again.
- */
- if (fs->fs_qsize) {
- fpu_cleanup(p, fs);
- break;
- }
- if (fpproc != p) { /* we do not have it */
- if (fpproc != NULL) /* someone else had it */
- savefpstate(fpproc->p_md.md_fpstate);
- loadfpstate(fs);
- fpproc = p; /* now we do have it */
- }
- tf->tf_psr |= PSR_EF;
- break;
- }
-
- case T_WINOF:
- if (rwindow_save(p))
- sigexit(p, SIGILL);
- break;
-
-#define read_rw(src, dst) \
- copyin((caddr_t)(src), (caddr_t)(dst), sizeof(struct rwindow))
-
- case T_RWRET:
- /*
- * T_RWRET is a window load needed in order to rett.
- * It simply needs the window to which tf->tf_out[6]
- * (%sp) points. There are no user or saved windows now.
- * Copy the one from %sp into pcb->pcb_rw[0] and set
- * nsaved to -1. If we decide to deliver a signal on
- * our way out, we will clear nsaved.
- */
- if (pcb->pcb_uw || pcb->pcb_nsaved)
- panic("trap T_RWRET 1");
-#ifdef DEBUG
- if (rwindow_debug)
- printf("%s[%d]: rwindow: pcb<-stack: %x\n",
- p->p_comm, p->p_pid, tf->tf_out[6]);
-#endif
- if (read_rw(tf->tf_out[6], &pcb->pcb_rw[0]))
- sigexit(p, SIGILL);
- if (pcb->pcb_nsaved)
- panic("trap T_RWRET 2");
- pcb->pcb_nsaved = -1; /* mark success */
- break;
-
- case T_WINUF:
- /*
- * T_WINUF is a real window underflow, from a restore
- * instruction. It needs to have the contents of two
- * windows---the one belonging to the restore instruction
- * itself, which is at its %sp, and the one belonging to
- * the window above, which is at its %fp or %i6---both
- * in the pcb. The restore's window may still be in
- * the cpu; we need to force it out to the stack.
- */
-#ifdef DEBUG
- if (rwindow_debug)
- printf("%s[%d]: rwindow: T_WINUF 0: pcb<-stack: %x\n",
- p->p_comm, p->p_pid, tf->tf_out[6]);
-#endif
- write_user_windows();
- if (rwindow_save(p) || read_rw(tf->tf_out[6], &pcb->pcb_rw[0]))
- sigexit(p, SIGILL);
-#ifdef DEBUG
- if (rwindow_debug)
- printf("%s[%d]: rwindow: T_WINUF 1: pcb<-stack: %x\n",
- p->p_comm, p->p_pid, pcb->pcb_rw[0].rw_in[6]);
-#endif
- if (read_rw(pcb->pcb_rw[0].rw_in[6], &pcb->pcb_rw[1]))
- sigexit(p, SIGILL);
- if (pcb->pcb_nsaved)
- panic("trap T_WINUF");
- pcb->pcb_nsaved = -1; /* mark success */
- break;
-
- case T_ALIGN:
- trapsignal(p, SIGBUS, 0, BUS_ADRALN, sv);
- break;
-
- case T_FPE:
- /*
- * Clean up after a floating point exception.
- * fpu_cleanup can (and usually does) modify the
- * state we save here, so we must `give up' the FPU
- * chip context. (The software and hardware states
- * will not match once fpu_cleanup does its job, so
- * we must not save again later.)
- */
- if (p != fpproc)
- panic("fpe without being the FP user");
- savefpstate(p->p_md.md_fpstate);
- fpproc = NULL;
- /* tf->tf_psr &= ~PSR_EF; */ /* share_fpu will do this */
- fpu_cleanup(p, p->p_md.md_fpstate);
- /* fpu_cleanup posts signals if needed */
-#if 0 /* ??? really never??? */
- ADVANCE;
-#endif
- break;
-
- case T_TAGOF:
- trapsignal(p, SIGEMT, 0, EMT_TAGOVF, sv);
- break;
-
- case T_CPDISABLED:
- uprintf("coprocessor instruction\n"); /* XXX */
- trapsignal(p, SIGILL, 0, FPE_FLTINV, sv);
- break;
-
- case T_BREAKPOINT:
- trapsignal(p, SIGTRAP, 0, TRAP_BRKPT, sv);
- break;
-
- case T_DIV0:
- ADVANCE;
- trapsignal(p, SIGFPE, 0, FPE_INTDIV, sv);
- break;
-
- case T_FLUSHWIN:
- write_user_windows();
-#ifdef probably_slower_since_this_is_usually_false
- if (pcb->pcb_nsaved && rwindow_save(p))
- sigexit(p, SIGILL);
-#endif
- ADVANCE;
- break;
-
- case T_CLEANWIN:
- uprintf("T_CLEANWIN\n"); /* XXX */
- ADVANCE;
- break;
-
- case T_RANGECHECK:
- uprintf("T_RANGECHECK\n"); /* XXX */
- ADVANCE;
- trapsignal(p, SIGILL, 0, ILL_ILLOPN, sv);
- break;
-
- case T_FIXALIGN:
- uprintf("T_FIXALIGN\n"); /* XXX */
- ADVANCE;
- break;
-
- case T_INTOF:
- uprintf("T_INTOF\n"); /* XXX */
- ADVANCE;
- trapsignal(p, SIGFPE, FPE_INTOVF_TRAP, FPE_INTOVF, sv);
- break;
- case 0xff: /* Temporary hack... */
- zs_hack ();
- ADVANCE;
- sigexit (p, SIGUSR1);
- break;
-
- }
- userret(p, pc, sticks);
- share_fpu(p, tf);
-#undef ADVANCE
-}
-
-/*
- * Save windows from PCB into user stack, and return 0. This is used on
- * window overflow pseudo-traps (from locore.s, just before returning to
- * user mode) and when ptrace or sendsig needs a consistent state.
- * As a side effect, rwindow_save() always sets pcb_nsaved to 0,
- * clobbering the `underflow restore' indicator if it was -1.
- *
- * If the windows cannot be saved, pcb_nsaved is restored and we return -1.
- */
-int
-rwindow_save(p)
- register struct proc *p;
-{
- register struct pcb *pcb = &p->p_addr->u_pcb;
- register struct rwindow *rw = &pcb->pcb_rw[0];
- register int i;
-
- i = pcb->pcb_nsaved;
- if (i < 0) {
- pcb->pcb_nsaved = 0;
- return (0);
- }
- if (i == 0)
- return (0);
-#ifdef DEBUG
- if (rwindow_debug)
- printf("%s[%d]: rwindow: pcb->stack:", p->p_comm, p->p_pid);
-#endif
- do {
-#ifdef DEBUG
- if (rwindow_debug)
- printf(" %x", rw[1].rw_in[6]);
-#endif
- if (copyout((caddr_t)rw, (caddr_t)rw[1].rw_in[6],
- sizeof *rw))
- return (-1);
- rw++;
- } while (--i > 0);
-#ifdef DEBUG
- if (rwindow_debug)
- printf("\n");
-#endif
- pcb->pcb_nsaved = 0;
- return (0);
-}
-
-/*
- * Kill user windows (before exec) by writing back to stack or pcb
- * and then erasing any pcb tracks. Otherwise we might try to write
- * the registers into the new process after the exec.
- */
-void
-kill_user_windows(p)
- struct proc *p;
-{
-
- write_user_windows();
- p->p_addr->u_pcb.pcb_nsaved = 0;
-}
-
-/*
- * Called from locore.s trap handling, for synchronous memory faults.
- *
- * This duplicates a lot of logic in trap() and perhaps should be
- * moved there; but the bus-error-register parameters are unique to
- * this routine.
- *
- * Since synchronous errors accumulate during prefetch, we can have
- * more than one `cause'. But we do not care what the cause, here;
- * we just want to page in the page and try again.
- */
-void
-mem_access_fault(type, fcr, fvar, pc, psr, tf)
- register unsigned type;
- register int fcr;
- register u_int fvar;
- register int pc, psr;
- register struct trapframe *tf;
-{
- register struct proc *p;
- register struct vmspace *vm;
- register vm_offset_t va;
- register int rv;
- vm_prot_t ftype;
- int onfault;
- u_quad_t sticks;
- union sigval sv;
- int otype;
-
- /* During autoconfig. */
- if (nofault)
- longjmp (nofault);
-
-#if DEBUG
-static int lastdouble;
-#endif
-
- cnt.v_trap++;
- if ((p = curproc) == NULL) /* safety check */
- p = &proc0;
- sticks = p->p_sticks;
-
- /*
- * Figure out what to pass the VM code. We cannot ignore the sfva
- * register on text faults, since this might be a trap on an
- * alternate-ASI access to code space. However, if we're on a
- * supersparc, we can't help using PC, since we don't get a VA in
- * sfva.
- * Kernel faults are somewhat different: text faults are always
- * illegal, and data faults are extra complex. User faults must
- * set p->p_md.md_tf, in case we decide to deliver a signal. Check
- * for illegal virtual addresses early since those can induce more
- * faults.
- * All translation faults are illegal, and result in a SIGSEGV
- * being delivered to the running process (or a kernel panic, for
- * a kernel fault). We check the translation first to make sure
- * it is not spurious.
- * Also, note that in the case where we have an overwritten
- * text fault (OW==1, AT==2,3), we attempt to service the
- * second (overwriting) fault, then restart the instruction
- * (which is from the first fault) and allow the first trap
- * to reappear. XXX is this right? It will probably change...
- */
-#if 0
- if ((sfsr & SFSR_FT) == SFSR_FT_NONE)
- goto out; /* No fault. Why were we called? */
-#endif
-
- /*
- * This next section is a mess since some chips use sfva, and others
- * don't on text faults. We want to use sfva where possible, since
- * we _could_ be dealing with an ASI 0x8,0x9 data access to text space,
- * which would trap as a text fault, at least on a HyperSPARC. Ugh.
- * XXX: Find out about MicroSPARCs.
- */
-
- if (curproc == NULL)
- {
- switch (type & 0xff)
- {
- case T_TEXTFAULT:
- printf("tfault @ %x (pc %x); fcr %x, psr %x\n",
- fvar, pc, fcr, psr);
- break;
- case T_DATAFAULT:
- printf("dfault @ %x (pc %x); fcr %x, psr %x, tf: %x\n",
- fvar, pc, fcr, psr, type >> 8);
- break;
- default:
- printf("?fault @ %x (pc %x); fcr %x\n", fvar, pc, fcr);
- break;
- }
-
- printf ("curproc = %p, p->p_vmspace = %p\n", p, p->p_vmspace);
- pmap_disp_va (&p->p_vmspace->vm_pmap, fvar); /* TG */
- }
-
- otype = type;
- type &= 0xff;
-
- if (type == T_TEXTFAULT)
- fvar = pc;
-
- va = trunc_page(fvar);
-
-#ifdef DEBUG
- if (lastdouble) {
- printf("stacked tfault @ %x (pc %x); fcr %x", fvar, pc, fcr);
- lastdouble = 0;
- if (curproc == NULL)
- printf("NULL proc\n");
- else
- printf("pid %d(%s); sigmask %x, sigcatch %x\n",
- curproc->p_pid, curproc->p_comm,
- curproc->p_sigmask, curproc->p_sigcatch);
- }
-#endif
-#if 0
- if (type == T_TEXTFAULT && !(fcr & FCR_WRITE_PROT)) {
- if (psr & PSR_PS) /* never allow in kernel */
- goto kfault;
- /*
- * Double text fault. The evil "case 5" from the HS manual...
- * Attempt to handle early fault. Ignores ASI 8,9 issue...may
- * do a useless VM read.
- * XXX: Is this really necessary?
- */
-#ifdef DEBUG
- if (dfdebug) {
- lastdouble = 1;
- printf("mem_access_fault: double text fault @ %x (pc %x); fcr %x",
- fvar, pc, fcr);
- if (curproc == NULL)
- printf("NULL proc\n");
- else
- printf(" pid %d(%s); sigmask %x, sigcatch %x\n",
- curproc->p_pid, curproc->p_comm,
- curproc->p_sigmask, curproc->p_sigcatch);
- }
-#endif
- if (mmumod == SUN4M_MMU_HS) { /* On HS, we have va for both */
- if (vm_fault(kernel_map, trunc_page(pc),
- VM_PROT_READ, 0) != KERN_SUCCESS)
-#ifdef DEBUG
- printf("mem_access_fault: "
- "can't pagein 1st text fault.\n")
-#endif
- ;
- }
- }
-#endif /* 0 */
- /* Now munch on protections... */
-
- ftype = fcr & FCR_WRITE_PROT ? VM_PROT_READ|VM_PROT_WRITE:VM_PROT_READ;
- if (psr & PSR_PS) {
- extern char Lfsbail[];
- if (type == T_TEXTFAULT) {
- (void) splhigh();
- printf("text fault: pc=%x fcr=%b fvar=%x\n", pc,
- fcr, FCR_BITS, fvar);
- panic("kernel fault");
- /* NOTREACHED */
- }
- /*
- * If this was an access that we shouldn't try to page in,
- * resume at the fault handler without any action.
- */
- if (p->p_addr && p->p_addr->u_pcb.pcb_onfault == Lfsbail)
- goto kfault;
-
- /*
- * During autoconfiguration, faults are never OK unless
- * pcb_onfault is set. Once running normally we must allow
- * exec() to cause copy-on-write faults to kernel addresses.
- */
- if (cold)
- goto kfault;
- if (va >= VM_MIN_KERNEL_ADDRESS) {
- if (vm_fault(kernel_map, va, ftype, 0) == KERN_SUCCESS)
- {
-#if 0
- printf ("mem_access_fault: kernel vm_fault ok\n");
- pmap_disp_va (&p->p_vmspace->vm_pmap, va); /* TG */
-#endif
- return;
- }
- goto kfault;
- }
- } else
- p->p_md.md_tf = tf;
-
- vm = p->p_vmspace;
-
- /* alas! must call the horrible vm code */
- rv = vm_fault(&vm->vm_map, (vm_offset_t)va, ftype, FALSE);
-
- /*
- * If this was a stack access we keep track of the maximum
- * accessed stack size. Also, if vm_fault gets a protection
- * failure it is due to accessing the stack region outside
- * the current limit and we need to reflect that as an access
- * error.
- */
- if ((caddr_t)va >= vm->vm_maxsaddr) {
- if (rv == KERN_SUCCESS) {
- unsigned nss = clrnd(btoc(USRSTACK - va));
- if (nss > vm->vm_ssize)
- vm->vm_ssize = nss;
- } else if (rv == KERN_PROTECTION_FAILURE)
- rv = KERN_INVALID_ADDRESS;
- }
- if (rv != KERN_SUCCESS) {
- /*
- * Pagein failed. If doing copyin/out, return to onfault
- * address. Any other page fault in kernel, die; if user
- * fault, deliver SIGSEGV.
- */
-/* fault: */
- if (psr & PSR_PS) {
-kfault:
- onfault = p->p_addr ?
- (int)p->p_addr->u_pcb.pcb_onfault : 0;
- if (!onfault) {
- (void) splhigh();
- printf("data fault: pc=%x addr=%x fcr=%b, type=%x\n",
- pc, fvar, fcr, FCR_BITS, otype);
-/* pmap_disp_va (&p->p_vmspace->vm_pmap, va); */
- panic("kernel fault");
- /* NOTREACHED */
- }
- tf->tf_pc = onfault;
- tf->tf_npc = onfault + 4;
- return;
- }
- sv.sival_int = fvar;
- trapsignal(p, SIGSEGV, ftype, SEGV_MAPERR, sv);
- }
-/* out: */
- if ((psr & PSR_PS) == 0) {
- userret(p, pc, sticks);
- share_fpu(p, tf);
- }
-}
-
-/*
- * System calls. `pc' is just a copy of tf->tf_pc.
- *
- * Note that the things labelled `out' registers in the trapframe were the
- * `in' registers within the syscall trap code (because of the automatic
- * `save' effect of each trap). They are, however, the %o registers of the
- * thing that made the system call, and are named that way here.
- */
-void
-syscall(code, tf, pc)
- register_t code;
- register struct trapframe *tf;
- register_t pc;
-{
- register int i, nsys, *ap, nap;
- register struct sysent *callp;
- register struct proc *p;
- int error, new;
- struct args {
- register_t i[8];
- } args;
- register_t rval[2];
- u_quad_t sticks;
-#ifdef DIAGNOSTIC
- struct pcb *cpcb = (struct pcb *)UADDR;
-#endif
-
- cnt.v_syscall++;
- p = curproc;
-#ifdef DIAGNOSTIC
- if (tf->tf_psr & PSR_PS)
- panic("syscall");
- if (cpcb != &p->p_addr->u_pcb)
- panic("syscall cpcb/ppcb");
- if (tf != (struct trapframe *)((caddr_t)cpcb + USPACE) - 1)
- panic("syscall trapframe");
-#endif
- sticks = p->p_sticks;
- p->p_md.md_tf = tf;
- new = code & (SYSCALL_G7RFLAG | SYSCALL_G2RFLAG);
- code &= ~(SYSCALL_G7RFLAG | SYSCALL_G2RFLAG);
-
- callp = p->p_emul->e_sysent;
- nsys = p->p_emul->e_nsysent;
-
- /*
- * The first six system call arguments are in the six %o registers.
- * Any arguments beyond that are in the `argument extension' area
- * of the user's stack frame (see <machine/frame.h>).
- *
- * Check for ``special'' codes that alter this, namely syscall and
- * __syscall. The latter takes a quad syscall number, so that other
- * arguments are at their natural alignments. Adjust the number
- * of ``easy'' arguments as appropriate; we will copy the hard
- * ones later as needed.
- */
- ap = &tf->tf_out[0];
- nap = 6;
-
- switch (code) {
- case SYS_syscall:
- code = *ap++;
- nap--;
- break;
- case SYS___syscall:
- if (callp != sysent)
- break;
- code = ap[_QUAD_LOWWORD];
- ap += 2;
- nap -= 2;
- break;
- }
-
- if (code < 0 || code >= nsys)
- callp += p->p_emul->e_nosys;
- else {
- callp += code;
- i = callp->sy_argsize / sizeof(register_t);
- if (i > nap) { /* usually false */
- if (i > 8)
- panic("syscall nargs");
- error = copyin((caddr_t)tf->tf_out[6] +
- offsetof(struct frame, fr_argx),
- (caddr_t)&args.i[nap], (i - nap) * sizeof(register_t));
- if (error) {
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSCALL))
- ktrsyscall(p, code,
- callp->sy_argsize, args.i);
-#endif
- goto bad;
- }
- i = nap;
- }
- copywords(ap, args.i, i * sizeof(register_t));
- }
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSCALL))
- ktrsyscall(p, code, callp->sy_argsize, args.i);
-#endif
- rval[0] = 0;
- rval[1] = tf->tf_out[1];
- error = (*callp->sy_call)(p, &args, rval);
- if (error == 0) {
- /* Note: fork() does not return here in the child */
- tf->tf_out[0] = rval[0];
- tf->tf_out[1] = rval[1];
- if (new) {
- /* jmp %g2 (or %g7, deprecated) on success */
- i = tf->tf_global[new & SYSCALL_G2RFLAG ? 2 : 7];
- if (i & 3) {
- error = EINVAL;
- goto bad;
- }
- } else {
- /* old system call convention: clear C on success */
- tf->tf_psr &= ~PSR_C; /* success */
- i = tf->tf_npc;
- }
- tf->tf_pc = i;
- tf->tf_npc = i + 4;
- } else if (error > 0 /*error != ERESTART && error != EJUSTRETURN*/) {
-bad:
- if (p->p_emul->e_errno)
- error = p->p_emul->e_errno[error];
- tf->tf_out[0] = error;
- tf->tf_psr |= PSR_C; /* fail */
- i = tf->tf_npc;
- tf->tf_pc = i;
- tf->tf_npc = i + 4;
- }
- /* else if (error == ERESTART || error == EJUSTRETURN) */
- /* nothing to do */
-
- userret(p, pc, sticks);
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSRET))
- ktrsysret(p, code, error, rval[0]);
-#endif
- share_fpu(p, tf);
-}
-
-/*
- * Process the tail end of a fork() for the child.
- */
-void
-child_return(p)
- struct proc *p;
-{
-
- /*
- * Return values in the frame set by cpu_fork().
- */
- userret(p, p->p_md.md_tf->tf_pc, 0);
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSRET))
- ktrsysret(p,
- (p->p_flag & P_PPWAIT) ? SYS_vfork : SYS_fork, 0, 0);
-#endif
-}
diff --git a/sys/arch/kbus/kbus/umprintf.c b/sys/arch/kbus/kbus/umprintf.c
deleted file mode 100644
index a99ba8f67ff..00000000000
--- a/sys/arch/kbus/kbus/umprintf.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/* $NetBSD: umprintf.c,v 1.3 1994/10/26 08:25:20 cgd Exp $ */
-
-/*-
- * Copyright (c) 1986, 1988, 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * hacked out from ..
- * @(#)subr_prf.c 7.30 (Berkeley) 6/29/91
- */
-
-#include <machine/stdarg.h>
-static char *umksprintn __P((u_long num, int base, int *len));
-void umprintf __P((char *fmt, ...));
-void zscnputc __P((int, char));
-
-void
-umprintf (char *fmt, ...)
-{
- va_list ap;
- char *p;
- int tmp;
- int base;
- unsigned long ul;
- char ch;
-
- va_start (ap,fmt);
-
- while (1)
- {
- while ((ch = *fmt++) != '%')
- {
- if (ch == '\0')
- return;
- zscnputc(0, ch);
- }
- ch = *fmt++;
- switch (ch)
- {
- case 's':
- p = va_arg (ap, char *);
- if (!p)
- p = "(null)";
- while (*p)
- zscnputc (0, *p++);
- break;
- case 'd':
- ul = va_arg(ap, u_long);
- base = 10;
- goto number;
- case 'x':
- ul = va_arg(ap, u_long);
- base = 16;
-#if 0
- for (i = 0; i < 8; i++)
- {
- zscnputc (0, "0123456789abcdef"[ul >> 28]);
- ul <<= 4;
- }
- break;
-#endif
- number: p = umksprintn(ul, base, &tmp);
- while ((ch = *p--))
- zscnputc(0,ch);
- break;
- default:
- zscnputc(0,ch);
- }
- }
-}
-
-/*
- * Put a number (base <= 16) in a buffer in reverse order; return an
- * optional length and a pointer to the NULL terminated (preceded?)
- * buffer.
- */
-static char *
-umksprintn(ul, base, lenp)
- register u_long ul;
- register int base, *lenp;
-{ /* A long in base 8, plus NULL. */
- static char buf[sizeof(long) * NBBY / 3 + 2];
- register char *p;
- int d;
-
- p = buf;
- *p='\0';
- do {
- d = ul % base;
- if (d < 10)
- *++p = '0' + d;
- else
- *++p = 'a' + d - 10;
- } while (ul /= base);
- if (lenp)
- *lenp = p - buf;
- return (p);
-}
diff --git a/sys/arch/kbus/kbus/vm_machdep.c b/sys/arch/kbus/kbus/vm_machdep.c
deleted file mode 100644
index 8b512cebca1..00000000000
--- a/sys/arch/kbus/kbus/vm_machdep.c
+++ /dev/null
@@ -1,490 +0,0 @@
-/* $NetBSD: vm_machdep.c,v 1.11 1995/08/29 22:37:54 phil Exp $ */
-
-/*-
- * Copyright (c) 1982, 1986 The Regents of the University of California.
- * Copyright (c) 1989, 1990 William Jolitz
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department, and William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/malloc.h>
-#include <sys/vnode.h>
-#include <sys/buf.h>
-#include <sys/user.h>
-#include <sys/core.h>
-#include <sys/exec.h>
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-
-#include <machine/cpu.h>
-#include <machine/frame.h>
-#include <machine/trap.h>
-
-#if 0
-/*
- * Finish a fork operation, with process p2 nearly set up.
- * Copy and update the kernel stack and pcb, making the child
- * ready to run, and marking it so that it can return differently
- * than the parent. Returns 1 in the child process, 0 in the parent.
- * We currently double-map the user area so that the stack is at the same
- * address in each process; in the future we will probably relocate
- * the frame pointers on the stack after copying.
- */
-cpu_fork(p1, p2, stack, stacksize)
- register struct proc *p1, *p2;
- void *stack;
- size_t stacksize;
-{
- struct user *up = p2->p_addr;
- int foo, offset, addr, i;
-
- /*
- * Copy pcb from proc p1 to p2.
- * _low_level_init will copy the kernel stack as cheeply as
- * possible.
- */
- p2->p_addr->u_pcb = p1->p_addr->u_pcb;
- p2->p_addr->u_pcb.pcb_onstack =
- (struct on_stack *) p2->p_addr + USPACE
- - sizeof (struct on_stack);
-
- /*
- * Wire top of address space of child to it's kstack.
- * First, fault in a page of pte's to map it.
- */
- addr = trunc_page((u_int)vtopte(USRSTACK));
- vm_map_pageable(&p2->p_vmspace->vm_map, addr, addr+USPACE, FALSE);
- for (i=0; i < UPAGES; i++)
- pmap_enter(&p2->p_vmspace->vm_pmap, USRSTACK+i*NBPG,
- pmap_extract(pmap_kernel(), ((int)p2->p_addr)+i*NBPG),
- VM_PROT_READ, TRUE, 0);
-
- pmap_activate(&p2->p_vmspace->vm_pmap, &up->u_pcb);
-
- /*
- * Low_level_fork returns twice! First with a 0 in the
- * parent space and Second with a 1 in the child.
- */
-
- return (low_level_fork(up));
-}
-#endif
-
-#if 0
-/*
- * Move pages from one kernel virtual address to another.
- * Both addresses are assumed to reside in the Sysmap,
- * and size must be a multiple of CLSIZE.
- */
-pagemove(from, to, size)
- register caddr_t from, to;
- int size;
-{
- register struct pte *fpte, *tpte;
-
- if (size % CLBYTES)
- panic("pagemove");
- fpte = kvtopte(from);
- tpte = kvtopte(to);
- while (size > 0) {
- *tpte++ = *fpte;
- *(int *)fpte++ = 0;
- from += NBPG;
- to += NBPG;
- size -= NBPG;
- }
- tlbflush();
-}
-#endif
-
-/*
- * Convert kernel VA to physical address
- */
-int kvtop __P((caddr_t addr));
-int
-kvtop(addr)
- register caddr_t addr;
-{
- vm_offset_t va;
-
- va = pmap_extract(pmap_kernel(), (vm_offset_t)addr);
- if (va == 0)
- panic("kvtop: zero page frame");
- return (int)va;
-}
-
-/*
- * Move pages from one kernel virtual address to another.
- */
-void
-pagemove(from, to, size)
- register caddr_t from, to;
- size_t size;
-{
- register vm_offset_t pa;
-
- if (size & CLOFSET || (int)from & CLOFSET || (int)to & CLOFSET)
- panic("pagemove 1");
- while (size > 0) {
- pa = pmap_extract(pmap_kernel(), (vm_offset_t)from);
- if (pa == 0)
- panic("pagemove 2");
- pmap_remove(pmap_kernel(),
- (vm_offset_t)from, (vm_offset_t)from + PAGE_SIZE);
- pmap_enter(pmap_kernel(),
- (vm_offset_t)to, pa, VM_PROT_READ | VM_PROT_WRITE, 1,
- VM_PROT_READ | VM_PROT_WRITE);
- from += PAGE_SIZE;
- to += PAGE_SIZE;
- size -= PAGE_SIZE;
- }
-}
-
-/*
- * Map an IO request into kernel virtual address space.
- */
-/*ARGSUSED*/
-void
-vmapbuf(bp, sz)
- register struct buf *bp;
- vm_size_t sz;
-{
- register vm_offset_t addr, kva, pa;
- register vm_size_t size, off;
- register int npf;
- struct proc *p;
- register struct vm_map *map;
-
- if ((bp->b_flags & B_PHYS) == 0)
- panic("vmapbuf");
- p = bp->b_proc;
- map = &p->p_vmspace->vm_map;
- bp->b_saveaddr = bp->b_data;
- addr = (vm_offset_t)bp->b_saveaddr;
- off = addr & PGOFSET;
- size = round_page(bp->b_bcount + off);
- kva = kmem_alloc_wait(kernel_map, size);
- bp->b_data = (caddr_t)(kva + off);
- addr = trunc_page(addr);
- npf = btoc(size);
- while (npf--) {
- pa = pmap_extract(vm_map_pmap(map), (vm_offset_t)addr);
- if (pa == 0)
- panic("vmapbuf: null page frame");
-
- /*
- * pmap_enter distributes this mapping to all
- * contexts... maybe we should avoid this extra work
- */
- pmap_enter(pmap_kernel(), kva, pa,
- VM_PROT_READ | VM_PROT_WRITE, 1, 0);
-
- addr += PAGE_SIZE;
- kva += PAGE_SIZE;
- }
-}
-
-/*
- * Free the io map addresses associated with this IO operation.
- */
-/*ARGSUSED*/
-void
-vunmapbuf(bp, sz)
- register struct buf *bp;
- vm_size_t sz;
-{
- register vm_offset_t kva = (vm_offset_t)bp->b_data;
- register vm_size_t size, off;
-
- if ((bp->b_flags & B_PHYS) == 0)
- panic("vunmapbuf");
-
- kva = (vm_offset_t)bp->b_data;
- off = kva & PGOFSET;
- size = round_page(bp->b_bcount + off);
- kmem_free_wakeup(kernel_map, trunc_page(kva), size);
- bp->b_data = bp->b_saveaddr;
- bp->b_saveaddr = NULL;
-}
-
-/*
- * The offset of the topmost frame in the kernel stack.
- */
-#define TOPFRAMEOFF (USPACE-sizeof(struct trapframe)-sizeof(struct frame))
-
-/*
- * Finish a fork operation, with process p2 nearly set up.
- * Copy and update the pcb, making the child ready to run, and marking
- * it so that it can return differently than the parent.
- *
- * This function relies on the fact that the pcb is
- * the first element in struct user.
- */
-void
-cpu_fork(p1, p2, stack, stacksize)
- register struct proc *p1, *p2;
- void *stack;
- size_t stacksize;
-{
- register struct pcb *opcb = &p1->p_addr->u_pcb;
- register struct pcb *npcb = &p2->p_addr->u_pcb;
- register struct trapframe *tf2;
- register struct rwindow *rp;
- register struct user *up = p2->p_addr;
- register pt_entry_t *pte;
- register int i;
-
- /*
- * Cache the PTEs for the user area in the machine dependent
- * part of the proc struct so cpu_switch() can quickly map in
- * the user struct and kernel stack. Note: if the virtual address
- * translation changes (e.g. swapout) we have to update this.
- */
- pte = kvtopte(up);
- for (i = 0; i < UPAGES; i++) {
- p2->p_md.md_upte[i] = pte->pt_entry & PG_FRAME;
- pte++;
- }
-
- /*
- * Save all user registers to p1's stack or, in the case of
- * user registers and invalid stack pointers, to opcb.
- * We then copy the whole pcb to p2; when switch() selects p2
- * to run, it will run at the `proc_trampoline' stub, rather
- * than returning at the copying code below.
- *
- * If process p1 has an FPU state, we must copy it. If it is
- * the FPU user, we must save the FPU state first.
- */
-
- write_user_windows();
- opcb->pcb_psr = getpsr();
- bcopy((caddr_t)opcb, (caddr_t)npcb, sizeof(struct pcb));
- if (p1->p_md.md_fpstate) {
- if (p1 == fpproc)
- savefpstate(p1->p_md.md_fpstate);
- p2->p_md.md_fpstate = malloc(sizeof(struct fpstate),
- M_SUBPROC, M_WAITOK);
- bcopy(p1->p_md.md_fpstate, p2->p_md.md_fpstate,
- sizeof(struct fpstate));
- } else
- p2->p_md.md_fpstate = NULL;
-
- /*
- * Setup (kernel) stack frame that will by-pass the child
- * out of the kernel. (The trap frame invariably resides at
- * the tippity-top of the u. area.)
- */
- tf2 = p2->p_md.md_tf = (struct trapframe *)
- ((int)npcb + USPACE - sizeof(*tf2));
-
- /* Copy parent's trapframe */
- *tf2 = *(struct trapframe *)((int)opcb + USPACE - sizeof(*tf2));
-
- /*
- * If specified, give the child a different stack.
- */
- if (stack != NULL)
- tf2->tf_out[6] = (u_int)stack + stacksize;
-
- /* Duplicate efforts of syscall(), but slightly differently */
- if (tf2->tf_global[1] & SYSCALL_G2RFLAG) {
- /* jmp %g2 (or %g7, deprecated) on success */
- tf2->tf_npc = tf2->tf_global[2];
- } else {
- /*
- * old system call convention: clear C on success
- * note: proc_trampoline() sets a fresh psr when
- * returning to user mode.
- */
- /*tf2->tf_psr &= ~PSR_C; -* success */
- }
-
- /* Set return values in child mode */
- tf2->tf_out[0] = 0;
- tf2->tf_out[1] = 1;
-
- /* Construct kernel frame to return to in cpu_switch() */
- rp = (struct rwindow *)((u_int)npcb + TOPFRAMEOFF);
- rp->rw_local[0] = (int)child_return; /* Function to call */
- rp->rw_local[1] = (int)p2; /* and its argument */
-
- npcb->pcb_pc = (int)proc_trampoline - 8;
- npcb->pcb_sp = UADDR + TOPFRAMEOFF;
- npcb->pcb_psr &= ~PSR_CWP; /* Run in window #0 */
- npcb->pcb_wim = 1; /* Fence at window #1 */
-
-}
-
-/*
- * Finish a swapin operation.
- * We neded to update the cached PTEs for the user area in the
- * machine dependent part of the proc structure.
- */
-void
-cpu_swapin(p)
- register struct proc *p;
-{
- register struct user *up = p->p_addr;
- register pt_entry_t *pte;
- register int i;
-
- /*
- * Cache the PTEs for the user area in the machine dependent
- * part of the proc struct so cpu_switch() can quickly map in
- * the user struct and kernel stack.
- */
- pte = kvtopte(up);
- for (i = 0; i < UPAGES; i++) {
- p->p_md.md_upte[i] = pte->pt_entry & PG_FRAME;
- pte++;
- }
-}
-
-/*
- * cpu_set_kpc:
- *
- * Arrange for in-kernel execution of a process to continue at the
- * named pc, as if the code at that address were called as a function
- * with the current process's process pointer as an argument.
- *
- * Note that it's assumed that when the named process returns,
- * we immediately return to user mode.
- *
- * (Note that cpu_fork(), above, uses an open-coded version of this.)
- */
-void
-cpu_set_kpc(p, pc, arg)
- struct proc *p;
- void (*pc) __P((void *));
- void *arg;
-{
- struct pcb *pcb;
- struct rwindow *rp;
-
- pcb = &p->p_addr->u_pcb;
-
- rp = (struct rwindow *)((u_int)pcb + TOPFRAMEOFF);
- rp->rw_local[0] = (int)pc; /* Function to call */
- rp->rw_local[1] = (int)arg; /* and its argument */
-
- /*
- * Frob PCB:
- * - arrange to return to proc_trampoline() from cpu_switch()
- * - point it at the stack frame constructed above
- * - make it run in a clear set of register windows
- */
- pcb->pcb_pc = (int)proc_trampoline - 8;
- pcb->pcb_sp = UADDR + TOPFRAMEOFF;
- pcb->pcb_psr &= ~PSR_CWP; /* Run in window #0 */
- pcb->pcb_wim = 1; /* Fence at window #1 */
-}
-
-/*
- * cpu_exit is called as the last action during exit.
- * We release the address space and machine-dependent resources,
- * including the memory for the user structure and kernel stack.
- * Since the latter is also the interrupt stack, we release it
- * from assembly code after switching to a temporary pcb+stack.
- */
-void
-cpu_exit(p)
- struct proc *p;
-{
- register struct fpstate *fs;
-
- if ((fs = p->p_md.md_fpstate) != NULL) {
- if (p == fpproc) {
- savefpstate(fs);
- fpproc = NULL;
- }
- free((void *)fs, M_SUBPROC);
- }
-
- switchexit(p);
- /* NOTREACHED */
-}
-
-/*
- * cpu_coredump is called to write a core dump header.
- * (should this be defined elsewhere? machdep.c?)
- */
-int
-cpu_coredump(p, vp, cred, chdr)
- struct proc *p;
- struct vnode *vp;
- struct ucred *cred;
- struct core *chdr;
-{
- int error;
- struct md_coredump md_core;
- struct coreseg cseg;
-
- CORE_SETMAGIC(*chdr, COREMAGIC, MID_SPARC, 0);
- chdr->c_hdrsize = ALIGN(sizeof(*chdr));
- chdr->c_seghdrsize = ALIGN(sizeof(cseg));
- chdr->c_cpusize = sizeof(md_core);
-
- md_core.md_tf = *p->p_md.md_tf;
- if (p->p_md.md_fpstate) {
- if (p == fpproc)
- savefpstate(p->p_md.md_fpstate);
- md_core.md_fpstate = *p->p_md.md_fpstate;
- } else
- bzero((caddr_t)&md_core.md_fpstate, sizeof(struct fpstate));
-
- CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_SPARC, CORE_CPU);
- cseg.c_addr = 0;
- cseg.c_size = chdr->c_cpusize;
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
- (off_t)chdr->c_hdrsize, UIO_SYSSPACE,
- IO_NODELOCKED|IO_UNIT, cred, NULL, p);
- if (error)
- return error;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&md_core, sizeof(md_core),
- (off_t)(chdr->c_hdrsize + chdr->c_seghdrsize), UIO_SYSSPACE,
- IO_NODELOCKED|IO_UNIT, cred, NULL, p);
- if (!error)
- chdr->c_nseg++;
-
- return error;
-}
diff --git a/sys/arch/kbus/stand/netboot/Makefile b/sys/arch/kbus/stand/netboot/Makefile
deleted file mode 100644
index 6678c54e378..00000000000
--- a/sys/arch/kbus/stand/netboot/Makefile
+++ /dev/null
@@ -1,61 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2000/03/03 00:54:49 todd Exp $
-
-RELOC=0xfff10000
-
-S= ${.CURDIR}/../../../..
-
-SRTOBJ= crt0.o
-DIR_SA=$S/lib/libsa
-DIR_KERN=$S/lib/libkern
-M=$S/lib/libkern/arch/${MACHINE_ARCH}
-
-.if exists ($M/Makefile.inc)
-.PATH: $M
-.include "$M/Makefile.inc"
-.endif
-
-SRC_net= nfs.c rpc.c net.c ether.c arp.c in_cksum.c netif.c \
- bootparam.c rarp.c
-
-#SRC_sa = alloc.c bcopy.c memcpy.c close.c getfile.c open.c \
-# printf.c read.c strerror.c ufs.c globals.c lseek.c \
-# closeall.c dev.c dkcksum.c nullfs.c fstat.c
-
-SRC_sa = alloc.c memcpy.c memcmp.c memset.c strncmp.c close.c getfile.c \
- open.c printf.c read.c strerror.c ufs.c globals.c lseek.c \
- dev.c
-
-SRC_kern= ashrdi3.c bcmp.c bzero.c strcmp.c strlen.c strncpy.c __main.c \
- urem.S udiv.S sdiv.S umul.S rem.S
-
-SRC_here= clock.c devopen.c dvma.c \
- gets.c panic.c \
- promboot.c zs.c exec_sun.c \
- boot.c conf.c version.c dev_net.c if_le.c intr.c # promcons.c
-
-SRCS= ${SRC_net} ${SRC_sa} ${SRC_kern} ${SRC_here}
-
-OBJS= ${SRTOBJ} ${SRCS:S/.c/.o/g:S/.S/.o/g}
-
-DEFS= -DSTANDALONE -DSUN_BOOTPARAMS # -DNFS_DEBUG -DDEBUG
-INCL=-I${.CURDIR} -I${S} -I${S}/lib/libsa -I${M}
-COPTS= #-fno-defer-pop
-CFLAGS= -g ${COPTS} ${DEFS} ${DBG} ${INCL}
-
-
-.PATH: ${DIR_SA} ${DIR_KERN} ${DIR_KERN_ARCH}
-
-all: netboot
-
-.S.o:
- ${CC} -c ${CFLAGS} -o $@ $<
-
-netboot: ${OBJS}
- ${LD} -N -Ttext ${RELOC} -e start -o $@ ${OBJS}
- cp $@ /tftpboot
-
-install:
- ${INSTALL} ${INSTALL_COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
- netboot.bin ${DESTDIR}${MDEC_DIR}/netboot
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/kbus/stand/netboot/boot.c b/sys/arch/kbus/stand/netboot/boot.c
deleted file mode 100644
index a004e0394de..00000000000
--- a/sys/arch/kbus/stand/netboot/boot.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/* $OpenBSD: boot.c,v 1.2 2000/03/03 00:54:49 todd Exp $ */
-
-/*-
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
- * 4. The name of the Author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)boot.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-
-#define _KERNEL
-#include <machine/sic.h>
-#include <machine/asi.h>
-#include <machine/asm.h>
-#include <machine/psl.h>
-
-#include "stand.h"
-#include "promboot.h"
-
-/*
- * Boot device is derived from ROM provided information.
- */
-#define LOADADDR 0x10000
-
-extern char version[];
-char defname[32] = "hello";
-char line[80];
-
-#if 0
-u_int bootdev = MAKEBOOTDEV(0, sdmajor, 0, 0, 0); /* disk boot */
-#endif
-u_int bootdev = MAKEBOOTDEV(1, 0, 0, 0, 0); /* network boot */
-
-char **environ;
-
-char *
-getenv (const char *str)
-{
- char **c;
- size_t len = strlen (str);
-
- for (c = environ; *c; c++)
- {
- if ((*c)[len] == '=' && strncmp (*c, str, len) == 0)
- return (*c) + len + 1;
- }
- return NULL;
-}
-
-void
-disp_hex (unsigned char c)
-{
- putchar ("0123456789abcdef"[c >> 4]);
- putchar ("0123456789abcdef"[c & 0x0f]);
- putchar (' ');
-}
-
-void
-dump (unsigned char *addr, int len)
-{
- int i, j;
-
- for (i = 0; i < len; i+= 16)
- {
- printf ("%x: ", i);
- for (j = 0; j < 16 && (i + j < len); j++)
- disp_hex(addr[i+j]);
- printf ("\n");
- }
-}
-
-void
-sic_init (void)
-{
- unsigned char irc_status;
- unsigned char id;
- unsigned char v;
-
- set_ipl (0x0f);
-
- printf ("1");
- /* Disable the receiver. */
- irc_status = lduba (ASI_IRXC, 0);
- while (irc_status & SIC_IRC_E)
- {
- stba (ASI_IRXC, 0, irc_status & ~SIC_IRC_E);
- irc_status = lduba (ASI_IRXC, 0);
- printf ("2");
- }
-
- /* Enable all interruptions. */
- sta (ASI_IPR, 0, 0);
-
- printf ("3");
-
- /* Set device id. */
- id = lda (ASI_BID, 0) & 0x0f;
- stba (ASI_DIR, 0, id);
-
- printf ("4");
- /* Ack int. */
- lda (ASI_ACK_IPV, 0);
-
- printf ("5");
- /* Enable the receiver. */
- stba (ASI_IRXC, 0, irc_status | SIC_IRC_E);
-
- printf ("6");
- set_ipl (0);
- *(unsigned long *)0x17030000 = id | 0x40;
-
- printf ("7");
- /* Enable interruptions from the system board. */
- v = *(volatile char *)0x17031000;
- putchar ('8');
- printf ("9\n");
-}
-
-void
-sendint (int boardid, int level)
-{
- printf ("sendint level %d: ", level);
- if (lduba (ASI_ITXC, 0) & SIC_ITXC_E)
- {
- printf ("busy\n");
- return;
- }
- else
- printf ("not busy...\n");
- sta (ASI_IXR, 0, ((level & 0xff) << 8) | SIC_IXR_DIR | (boardid & 0x0f));
- stba (ASI_ITXC, 0, SIC_ITXC_E);
-}
-
-void
-set_ipr (int level)
-{
-}
-
-extern int debug;
-extern int in_trap_handler;
-
-void
-main (int argc, char *argv[], char *envp[])
-{
- char *cp, *file;
- int io;
- int ask = 0;
-
- environ = envp;
- printf(">> OpenBSD netboot [%s]\n", version);
- /* printf("model MVME%x\n", cputyp); */
-
- printf ("Intr: ");
- sic_init ();
- printf ("Enabled\n");
-
- disp_zs0_b ();
- udelay (10000);
-#if 0
- printf ("Before sendint...\n");
- sendint (1, 150);
- printf ("Again...\n");
- sendint (1, 150);
-#endif
-#if 0
- printf ("Set IPR to 160 and send 160\n");
- sta (ASI_IPR, 0, 0xa0);
- sendint (1, 161);
- sendint (1, 160);
- printf ("Set IPR to 0\n");
- sta (ASI_IPR, 0, 0);
-#endif
-#if 0
- printf ("Set psl to 15, sendint and reset it\n");
- setpil15();
- sendint (1, 155);
- sendint (1,160);
- sendint (1,160);
- setpil0();
-
- disp_date ();
- udelay (1000000);
- printf ("Exit\n");
- _exit (0);
-#endif
-
- debug = 1;
- io = open ("hello", 0);
- if (io == -1)
- printf ("open:(%d) %s\n", errno, strerror (errno));
-#if 0
- asm ("ta 127");
- _exit (0);
-#endif
-
- prom_get_boot_info();
- file = defname;
-
- cp = prom_bootfile;
- if (cp && *cp)
- file = cp;
-
- for (;;) {
- if (ask) {
- printf("boot: ");
- gets(line);
- if (line[0]) {
- prom_get_boot_info();
- }
- }
- exec_sun(file, (char *)LOADADDR, prom_boothow);
- printf("boot: %s\n", strerror(errno));
- ask = 1;
- }
-}
diff --git a/sys/arch/kbus/stand/netboot/bug.c b/sys/arch/kbus/stand/netboot/bug.c
deleted file mode 100644
index e0ac46017bf..00000000000
--- a/sys/arch/kbus/stand/netboot/bug.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
- * 4. The name of the Author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * bug routines -- assumes that the necessary sections of memory
- * are preserved.
- */
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#define MVMEPROM_CALL(x) \
- asm volatile (__CONCAT("trap #15; .short ", __STRING(x)) )
-
-/* returns 0 if no characters ready to read */
-int
-mvmeprom_instat()
-{
- u_short ret;
-
- MVMEPROM_CALL(MVMEPROM_INSTAT);
- asm volatile ("movew ccr,%0": "=d" (ret));
- return (!(ret & 0x4));
-}
-
-void
-mvmeprom_outstr(start, end)
- char *start, *end;
-{
- asm volatile ("movl %0, sp@-" : "=a" (start));
- asm volatile ("movl %0, sp@-" : "=a" (end));
- MVMEPROM_CALL(MVMEPROM_OUTSTR);
-}
-
-void
-mvmeprom_outln(start, end)
- char *start, *end;
-{
- asm volatile ("movl %0, sp@-" : "=a" (start));
- asm volatile ("movl %0, sp@-" : "=a" (end));
- MVMEPROM_CALL(MVMEPROM_OUTSTRCRLF);
-}
-
-/* returns 0: success, nonzero: error */
-int
-mvmeprom_diskrd(arg)
- struct mvmeprom_dskio *arg;
-{
- int ret;
-
- asm volatile ("movel %0, sp@-"::"d" (arg));
- MVMEPROM_CALL(MVMEPROM_DSKRD);
- asm volatile ("movew ccr,%0": "=d" (ret));
- return (!(ret & 0x4));
-}
-
-/* returns 0: success, nonzero: error */
-int
-mvmeprom_diskwr(arg)
- struct mvmeprom_dskio *arg;
-{
- int ret;
-
- asm volatile ("movel %0, sp@-"::"d" (arg));
- MVMEPROM_CALL(MVMEPROM_DSKWR);
- asm volatile ("movew ccr,%0": "=d" (ret));
- return (!(ret & 0x4));
-}
-
-#ifdef NOTYET
-mvmeprom_diskcfig() {}
-mvmeprom_diskfmt(){}
-mvmeprom_diskctrl(){}
-#endif
-
-/* BUG - timing routine */
-void
-mvmeprom_delay(msec)
- int msec;
-{
- asm volatile ("movel %0,sp@-" : :"d" (msec));
- MVMEPROM_CALL(MVMEPROM_DELAY);
-}
-
-/* BUG - return to bug routine */
-void
-mvmeprom_return()
-{
- MVMEPROM_CALL(MVMEPROM_EXIT);
- /*NOTREACHED*/
-}
-
-/* BUG - query board routines */
-struct mvmeprom_brdid *
-mvmeprom_getbrdid()
-{
- struct mvmeprom_brdid *id;
-
- asm volatile ("clrl sp@-");
- MVMEPROM_CALL(MVMEPROM_GETBRDID);
- asm volatile ("movel sp@+,%0": "=d" (id):);
- return (id);
-}
-
-void
-mvmeprom_rtc_rd(ptime)
- struct mvmeprom_time *ptime;
-{
- asm volatile ("movel %0,sp@-" : :"a" (ptime));
- MVMEPROM_CALL(MVMEPROM_RTC_RD);
-}
diff --git a/sys/arch/kbus/stand/netboot/clock.c b/sys/arch/kbus/stand/netboot/clock.c
deleted file mode 100644
index f0cdb090c27..00000000000
--- a/sys/arch/kbus/stand/netboot/clock.c
+++ /dev/null
@@ -1,121 +0,0 @@
-#include <sys/types.h>
-
-#include "clockreg.h"
-#include "config.h"
-#include "clock.h"
-
-/*
- * BCD to decimal and decimal to BCD.
- */
-#define FROM_BCD(x,y) ((x) + 10 * (y))
-
-#define SECDAY (24 * 60 * 60)
-#define SECYR (SECDAY * 365)
-#define LEAPYEAR(y) (((y) & 3) == 0)
-
-/*
- * This code is defunct after 2068.
- * Will Unix still be here then??
- */
-const short dayyr[12] =
-{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
-
-static u_long
-chiptotime(sec, min, hour, day, mon, year)
- register int sec, min, hour, day, mon, year;
-{
- register int days, yr;
-
- if (year < 70)
- year = 70;
-
- /* simple sanity checks */
- if (year < 70 || mon < 1 || mon > 12 || day < 1 || day > 31)
- return (0);
- days = 0;
- for (yr = 70; yr < year; yr++)
- days += LEAPYEAR(yr) ? 366 : 365;
- days += dayyr[mon - 1] + day - 1;
- if (LEAPYEAR(yr) && mon > 2)
- days++;
- /* now have days since Jan 1, 1970; the rest is easy... */
- return (days * SECDAY + hour * 3600 + min * 60 + sec);
-}
-
-static u_char *rtc_byte = (u_char *) 0x17020000;
-
-static u_char
-rtc_read_reg (int reg)
-{
- u_char res;
-
- reg &= 0x0f;
- *rtc_byte = RTC_WRITE_ADDR | reg;
- *rtc_byte = reg;
- *rtc_byte = RTC_READ | 0x0f;
- res = *rtc_byte & 0x0f;
- *rtc_byte = RTC_WRITE_ADDR | 0x0f;
- *rtc_byte = 0x0f;
- return res;
-}
-
-time_t
-getsecs()
-{
- int sec, min, hour, hourl, hourh, day, mon, year;
-
- sec = FROM_BCD (rtc_read_reg (RTC_SEC_LOW),
- rtc_read_reg (RTC_SEC_HIGH));
- min = FROM_BCD (rtc_read_reg (RTC_MIN_LOW),
- rtc_read_reg (RTC_MIN_HIGH));
- day = FROM_BCD (rtc_read_reg (RTC_DAY_LOW),
- rtc_read_reg (RTC_DAY_HIGH));
- mon = FROM_BCD (rtc_read_reg (RTC_MON_LOW),
- rtc_read_reg (RTC_MON_HIGH));
- year = RTC_YEAR_BASE + FROM_BCD (rtc_read_reg (RTC_YEAR_LOW),
- rtc_read_reg (RTC_YEAR_HIGH));
- hourl = rtc_read_reg (RTC_HOUR_LOW);
- hourh = rtc_read_reg (RTC_HOUR_HIGH);
- if (hourh & RTC_HOUR_PM)
- hour = 12 + (hourh & 1) * 10 + hourl;
- else
- hour = (hourh & 0x03) * 10 + hourl;
- return (chiptotime(sec, min, hour, day, mon, year));
-}
-
-void
-disp_date (void)
-{
- static char *days[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
- int hour, hourl, hourh, day, wday, mon, year;
-
- wday = rtc_read_reg (RTC_WEEK_DAY);
- day = FROM_BCD (rtc_read_reg (RTC_DAY_LOW),
- rtc_read_reg (RTC_DAY_HIGH));
- mon = FROM_BCD (rtc_read_reg (RTC_MON_LOW),
- rtc_read_reg (RTC_MON_HIGH));
- year = RTC_YEAR_BASE + FROM_BCD (rtc_read_reg (RTC_YEAR_LOW),
- rtc_read_reg (RTC_YEAR_HIGH));
- hourl = rtc_read_reg (RTC_HOUR_LOW);
- hourh = rtc_read_reg (RTC_HOUR_HIGH);
-
- if (hourh & RTC_HOUR_PM)
- hour = 12 + (hourh & 1) * 10 + hourl;
- else
- hour = (hourh & 0x03) * 10 + hourl;
-
- printf ("Date: %s %d-%d-%d %d:%d%d:%d%d\n",
- days[wday],
- 1900 + year, mon, day,
- hour,
- rtc_read_reg (RTC_MIN_HIGH),
- rtc_read_reg (RTC_MIN_LOW),
- rtc_read_reg (RTC_SEC_HIGH),
- rtc_read_reg (RTC_SEC_LOW));
-}
-
-int
-getticks()
-{
- return getsecs() * 100;
-}
diff --git a/sys/arch/kbus/stand/netboot/clock.h b/sys/arch/kbus/stand/netboot/clock.h
deleted file mode 100644
index d61bc9b03b8..00000000000
--- a/sys/arch/kbus/stand/netboot/clock.h
+++ /dev/null
@@ -1,6 +0,0 @@
-
-extern int hz;
-
-time_t getsecs();
-int getticks();
-
diff --git a/sys/arch/kbus/stand/netboot/clockreg.h b/sys/arch/kbus/stand/netboot/clockreg.h
deleted file mode 100644
index eb9b5160c81..00000000000
--- a/sys/arch/kbus/stand/netboot/clockreg.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $OpenBSD: clockreg.h,v 1.2 2000/03/03 00:54:50 todd Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)clockreg.h 8.1 (Berkeley) 6/11/93
- */
-
-/* RTC 58321. */
-#define RTC_STOP 0x80 /* Stop RTC clock. */
-#define RTC_WRITE 0x40 /* Write access. */
-#define RTC_READ 0x20 /* Read access. */
-#define RTC_WRITE_ADDR 0x10 /* Write address. */
-
-#define RTC_SEC_LOW 0x00 /* RTC seconds (low nibble). */
-#define RTC_SEC_HIGH 0x01 /* RTC seconds (high nibble). */
-#define RTC_MIN_LOW 0x02 /* RTC minutes (low nibble). */
-#define RTC_MIN_HIGH 0x03 /* RTC minutes (high nibble). */
-#define RTC_HOUR_LOW 0x04 /* RTC hours (low nibble). */
-#define RTC_HOUR_HIGH 0x05 /* RTC hours (high nibble). */
-#define RTC_HOUR_24 0x08 /* RTC 24 hours mode bit. */
-#define RTC_HOUR_PM 0x04 /* RTC p.m. bit. */
-#define RTC_WEEK_DAY 0x06 /* RTC day of the week. */
-#define RTC_DAY_LOW 0x07 /* RTC day of the month (low nibble). */
-#define RTC_DAY_HIGH 0x08 /* RTC day of the month (high nibble). */
-#define RTC_MON_LOW 0x09 /* RTC month (low nibble). */
-#define RTC_MON_HIGH 0x0a /* RTC month (high nibble). */
-#define RTC_YEAR_LOW 0x0b /* RTC year (low nibble). */
-#define RTC_YEAR_HIGH 0x0c /* RTC year (high nibble). */
-
-#define RTC_YEAR_BASE 68
-
diff --git a/sys/arch/kbus/stand/netboot/conf.c b/sys/arch/kbus/stand/netboot/conf.c
deleted file mode 100644
index 2f916cedcf2..00000000000
--- a/sys/arch/kbus/stand/netboot/conf.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* $OpenBSD: conf.c,v 1.2 2000/03/03 00:54:50 todd Exp $ */
-
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-
-#include <stand.h>
-#include <nfs.h>
-#include <dev_net.h>
-
-struct fs_ops file_system[] = {
- { nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
-};
-int nfsys = sizeof(file_system) / sizeof(file_system[0]);
-
-struct devsw devsw[] = {
- { "net", net_strategy, net_open, net_close, net_ioctl },
-};
-int ndevs = sizeof(devsw) / sizeof(devsw[0]);
-
-extern struct netif_driver le_driver;
-
-struct netif_driver *netif_drivers[] = {
- &le_driver
-};
-int n_netif_drivers = sizeof(netif_drivers) / sizeof(netif_drivers[0]);
-
-
-/* XXX */
-int netif_debug;
-int debug;
-int errno;
diff --git a/sys/arch/kbus/stand/netboot/config.h b/sys/arch/kbus/stand/netboot/config.h
deleted file mode 100644
index 40fcdcde198..00000000000
--- a/sys/arch/kbus/stand/netboot/config.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* $OpenBSD: config.h,v 1.2 2000/03/03 00:54:50 todd Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
- * 4. The name of the Author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* configuration information for base-line code */
-
-#if 0
-#define ETHER_ADDR_147 (0xfffe0778)
-#define ETHER_ADDR_16X (0xfffc0000+7980)
-#define ERAM_ADDR (0xfffe0774)
-#endif
-#define LANCE_REG_ADDR (0x90001000)
diff --git a/sys/arch/kbus/stand/netboot/crt0.S b/sys/arch/kbus/stand/netboot/crt0.S
deleted file mode 100644
index 03348ca60c5..00000000000
--- a/sys/arch/kbus/stand/netboot/crt0.S
+++ /dev/null
@@ -1,860 +0,0 @@
-#include <machine/led.h>
-#include <machine/asi.h>
-#include <machine/kbus.h>
-#include <machine/psl.h>
-#include <machine/pmap.h>
-
- .text
-#define __WINSIZE 8
-
-#define DEF_TRAP(func,val) \
- mov val, %l3; \
- b func; \
- mov %wim, %l0; \
- nop
-
- .globl start
- .globl _exception_table
-_exception_table:
-start:
-reset:
- b real_start
- nop
- nop
- nop
-DEF_TRAP (bad_except, 1) ! 1: Instruction access
-DEF_TRAP (bad_except, 2) ! 2: Illegal Instruction
-DEF_TRAP (bad_except, 3) ! 3: Privilegied Instruction
-DEF_TRAP (bad_except, 4) ! 4: Floating-Point disabled
-DEF_TRAP (win_ovf, 5) ! 5: Window overflow
-DEF_TRAP (win_unf, 6) ! 6: Window undeflow
-DEF_TRAP (bad_except, 7) ! 7: Memory address not aligned
-DEF_TRAP (bad_except, 8) ! 8: Floating point exception
-#if 1
-DEF_TRAP (bad_except, 9) ! 9: data access exception
-#else
-DEF_TRAP (chk_data_tlbmiss, 9) ! 9: data access exception
-#endif
-DEF_TRAP (bad_except, 10) ! 10: Tag overflow
-DEF_TRAP (bad_except, 11) ! 11: -
-DEF_TRAP (bad_except, 12) ! 12: -
-DEF_TRAP (bad_except, 13) ! 13: -
-DEF_TRAP (bad_except, 14) ! 14: -
-DEF_TRAP (bad_except, 15) ! 15: -
-DEF_TRAP (bad_except, 16) ! 16: -
-DEF_TRAP (interrupt, 1) ! 17: Interrupt level 1
-DEF_TRAP (interrupt, 2) ! 18: Interrupt level 2
-DEF_TRAP (interrupt, 3) ! 19: Interrupt level 3
-DEF_TRAP (interrupt, 4) ! 20: Interrupt level 4
-DEF_TRAP (interrupt, 5) ! 21: Interrupt level 5
-DEF_TRAP (interrupt, 6) ! 22: Interrupt level 6
-DEF_TRAP (interrupt, 7) ! 23: Interrupt level 7
-DEF_TRAP (interrupt, 8) ! 24: Interrupt level 8
-DEF_TRAP (interrupt, 9) ! 25: Interrupt level 9
-DEF_TRAP (interrupt, 10) ! 26: Interrupt level 10
-DEF_TRAP (interrupt, 11) ! 27: Interrupt level 11
-DEF_TRAP (interrupt, 12) ! 28: Interrupt level 12
-DEF_TRAP (interrupt, 13) ! 29: Interrupt level 13
-DEF_TRAP (interrupt, 14) ! 30: Interrupt level 14
-DEF_TRAP (nmi, 15) ! 31: Interrupt level 15
-DEF_TRAP (bad_except, 32) ! 32: -
-DEF_TRAP (bad_except, 33) ! 33: -
-DEF_TRAP (bad_except, 34) ! 34: -
-DEF_TRAP (bad_except, 35) ! 35: -
-DEF_TRAP (bad_except, 36) ! 36: Coprocessor disabled
-DEF_TRAP (bad_except, 37) ! 37: -
-DEF_TRAP (bad_except, 38) ! 38: -
-DEF_TRAP (bad_except, 39) ! 39: -
-DEF_TRAP (bad_except, 40) ! 40: -
-DEF_TRAP (bad_except, 41) ! 41: -
-DEF_TRAP (bad_except, 42) ! 42: -
-DEF_TRAP (bad_except, 43) ! 43: -
-DEF_TRAP (bad_except, 44) ! 44: -
-DEF_TRAP (bad_except, 45) ! 45: -
-DEF_TRAP (bad_except, 46) ! 46: -
-DEF_TRAP (bad_except, 47) ! 47: -
-DEF_TRAP (bad_except, 48) ! 48: -
-DEF_TRAP (bad_except, 49) ! 49: -
-DEF_TRAP (bad_except, 50) ! 50: -
-DEF_TRAP (bad_except, 51) ! 51: -
-DEF_TRAP (bad_except, 52) ! 52: -
-DEF_TRAP (bad_except, 53) ! 53: -
-DEF_TRAP (bad_except, 54) ! 54: -
-DEF_TRAP (bad_except, 55) ! 55: -
-DEF_TRAP (bad_except, 56) ! 56: -
-DEF_TRAP (bad_except, 57) ! 57: -
-DEF_TRAP (bad_except, 58) ! 58: -
-DEF_TRAP (bad_except, 59) ! 59: -
-DEF_TRAP (bad_except, 60) ! 60: -
-DEF_TRAP (bad_except, 61) ! 61: -
-DEF_TRAP (bad_except, 62) ! 62: -
-DEF_TRAP (bad_except, 63) ! 63: -
-DEF_TRAP (bad_except, 64) ! 64: -
-DEF_TRAP (bad_except, 65) ! 65: -
-DEF_TRAP (bad_except, 66) ! 66: -
-DEF_TRAP (bad_except, 67) ! 67: -
-DEF_TRAP (bad_except, 68) ! 68: -
-DEF_TRAP (bad_except, 69) ! 69: -
-DEF_TRAP (bad_except, 70) ! 70: -
-DEF_TRAP (bad_except, 71) ! 71: -
-DEF_TRAP (bad_except, 72) ! 72: -
-DEF_TRAP (bad_except, 73) ! 73: -
-DEF_TRAP (bad_except, 74) ! 74: -
-DEF_TRAP (bad_except, 75) ! 75: -
-DEF_TRAP (bad_except, 76) ! 76: -
-DEF_TRAP (bad_except, 77) ! 77: -
-DEF_TRAP (bad_except, 78) ! 78: -
-DEF_TRAP (bad_except, 79) ! 79: -
-DEF_TRAP (bad_except, 80) ! 80: -
-DEF_TRAP (bad_except, 81) ! 81: -
-DEF_TRAP (bad_except, 82) ! 82: -
-DEF_TRAP (bad_except, 83) ! 83: -
-DEF_TRAP (bad_except, 84) ! 84: -
-DEF_TRAP (bad_except, 85) ! 85: -
-DEF_TRAP (bad_except, 86) ! 86: -
-DEF_TRAP (bad_except, 87) ! 87: -
-DEF_TRAP (bad_except, 88) ! 88: -
-DEF_TRAP (bad_except, 89) ! 89: -
-DEF_TRAP (bad_except, 90) ! 90: -
-DEF_TRAP (bad_except, 91) ! 91: -
-DEF_TRAP (bad_except, 92) ! 92: -
-DEF_TRAP (bad_except, 93) ! 93: -
-DEF_TRAP (bad_except, 94) ! 94: -
-DEF_TRAP (bad_except, 95) ! 95: -
-DEF_TRAP (bad_except, 96) ! 96: -
-DEF_TRAP (bad_except, 97) ! 97: -
-DEF_TRAP (bad_except, 98) ! 98: -
-DEF_TRAP (bad_except, 99) ! 99: -
-DEF_TRAP (bad_except, 100) ! 100: -
-DEF_TRAP (bad_except, 101) ! 101: -
-DEF_TRAP (bad_except, 102) ! 102: -
-DEF_TRAP (bad_except, 103) ! 103: -
-DEF_TRAP (bad_except, 104) ! 104: -
-DEF_TRAP (bad_except, 105) ! 105: -
-DEF_TRAP (bad_except, 106) ! 106: -
-DEF_TRAP (bad_except, 107) ! 107: -
-DEF_TRAP (bad_except, 108) ! 108: -
-DEF_TRAP (bad_except, 109) ! 109: -
-DEF_TRAP (bad_except, 110) ! 110: -
-DEF_TRAP (bad_except, 111) ! 111: -
-DEF_TRAP (bad_except, 112) ! 112: -
-DEF_TRAP (bad_except, 113) ! 113: -
-DEF_TRAP (bad_except, 114) ! 114: -
-DEF_TRAP (bad_except, 115) ! 115: -
-DEF_TRAP (bad_except, 116) ! 116: -
-DEF_TRAP (bad_except, 117) ! 117: -
-DEF_TRAP (bad_except, 118) ! 118: -
-DEF_TRAP (bad_except, 119) ! 119: -
-DEF_TRAP (bad_except, 120) ! 120: -
-DEF_TRAP (bad_except, 121) ! 121: -
-DEF_TRAP (bad_except, 122) ! 122: -
-DEF_TRAP (bad_except, 123) ! 123: -
-DEF_TRAP (bad_except, 124) ! 124: -
-DEF_TRAP (bad_except, 125) ! 125: -
-DEF_TRAP (bad_except, 126) ! 126: -
-DEF_TRAP (bad_except, 127) ! 127: -
-DEF_TRAP (bad_except, 128) ! 128: Trap instruction
-DEF_TRAP (bad_except, 129) ! 129: Trap instruction
-DEF_TRAP (bad_except, 130) ! 130: Trap instruction
-DEF_TRAP (bad_except, 131) ! 131: Trap instruction
-DEF_TRAP (bad_except, 132) ! 132: Trap instruction
-DEF_TRAP (bad_except, 133) ! 133: Trap instruction
-DEF_TRAP (bad_except, 134) ! 134: Trap instruction
-DEF_TRAP (bad_except, 135) ! 135: Trap instruction
-DEF_TRAP (bad_except, 136) ! 136: Trap instruction
-DEF_TRAP (bad_except, 137) ! 137: Trap instruction
-DEF_TRAP (bad_except, 138) ! 138: Trap instruction
-DEF_TRAP (bad_except, 139) ! 139: Trap instruction
-DEF_TRAP (bad_except, 140) ! 140: Trap instruction
-DEF_TRAP (bad_except, 141) ! 141: Trap instruction
-DEF_TRAP (bad_except, 142) ! 142: Trap instruction
-DEF_TRAP (bad_except, 143) ! 143: Trap instruction
-DEF_TRAP (bad_except, 144) ! 144: Trap instruction
-DEF_TRAP (bad_except, 145) ! 145: Trap instruction
-DEF_TRAP (bad_except, 146) ! 146: Trap instruction
-DEF_TRAP (bad_except, 147) ! 147: Trap instruction
-DEF_TRAP (bad_except, 148) ! 148: Trap instruction
-DEF_TRAP (bad_except, 149) ! 149: Trap instruction
-DEF_TRAP (bad_except, 150) ! 150: Trap instruction
-DEF_TRAP (bad_except, 151) ! 151: Trap instruction
-DEF_TRAP (bad_except, 152) ! 152: Trap instruction
-DEF_TRAP (bad_except, 153) ! 153: Trap instruction
-DEF_TRAP (bad_except, 154) ! 154: Trap instruction
-DEF_TRAP (bad_except, 155) ! 155: Trap instruction
-DEF_TRAP (bad_except, 156) ! 156: Trap instruction
-DEF_TRAP (bad_except, 157) ! 157: Trap instruction
-DEF_TRAP (bad_except, 158) ! 158: Trap instruction
-DEF_TRAP (bad_except, 159) ! 159: Trap instruction
-DEF_TRAP (bad_except, 160) ! 160: Trap instruction
-DEF_TRAP (bad_except, 161) ! 161: Trap instruction
-DEF_TRAP (bad_except, 162) ! 162: Trap instruction
-DEF_TRAP (bad_except, 163) ! 163: Trap instruction
-DEF_TRAP (bad_except, 164) ! 164: Trap instruction
-DEF_TRAP (bad_except, 165) ! 165: Trap instruction
-DEF_TRAP (bad_except, 166) ! 166: Trap instruction
-DEF_TRAP (bad_except, 167) ! 167: Trap instruction
-DEF_TRAP (bad_except, 168) ! 168: Trap instruction
-DEF_TRAP (bad_except, 169) ! 169: Trap instruction
-DEF_TRAP (bad_except, 170) ! 170: Trap instruction
-DEF_TRAP (bad_except, 171) ! 171: Trap instruction
-DEF_TRAP (bad_except, 172) ! 172: Trap instruction
-DEF_TRAP (bad_except, 173) ! 173: Trap instruction
-DEF_TRAP (bad_except, 174) ! 174: Trap instruction
-DEF_TRAP (bad_except, 175) ! 175: Trap instruction
-DEF_TRAP (bad_except, 176) ! 176: Trap instruction
-DEF_TRAP (bad_except, 177) ! 177: Trap instruction
-DEF_TRAP (bad_except, 178) ! 178: Trap instruction
-DEF_TRAP (bad_except, 179) ! 179: Trap instruction
-DEF_TRAP (bad_except, 180) ! 180: Trap instruction
-DEF_TRAP (bad_except, 181) ! 181: Trap instruction
-DEF_TRAP (bad_except, 182) ! 182: Trap instruction
-DEF_TRAP (bad_except, 183) ! 183: Trap instruction
-DEF_TRAP (bad_except, 184) ! 184: Trap instruction
-DEF_TRAP (bad_except, 185) ! 185: Trap instruction
-DEF_TRAP (bad_except, 186) ! 186: Trap instruction
-DEF_TRAP (bad_except, 187) ! 187: Trap instruction
-DEF_TRAP (bad_except, 188) ! 188: Trap instruction
-DEF_TRAP (bad_except, 189) ! 189: Trap instruction
-DEF_TRAP (bad_except, 190) ! 190: Trap instruction
-DEF_TRAP (bad_except, 191) ! 191: Trap instruction
-DEF_TRAP (bad_except, 192) ! 192: Trap instruction
-DEF_TRAP (bad_except, 193) ! 193: Trap instruction
-DEF_TRAP (bad_except, 194) ! 194: Trap instruction
-DEF_TRAP (bad_except, 195) ! 195: Trap instruction
-DEF_TRAP (bad_except, 196) ! 196: Trap instruction
-DEF_TRAP (bad_except, 197) ! 197: Trap instruction
-DEF_TRAP (bad_except, 198) ! 198: Trap instruction
-DEF_TRAP (bad_except, 199) ! 199: Trap instruction
-DEF_TRAP (bad_except, 200) ! 200: Trap instruction
-DEF_TRAP (bad_except, 201) ! 201: Trap instruction
-DEF_TRAP (bad_except, 202) ! 202: Trap instruction
-DEF_TRAP (bad_except, 203) ! 203: Trap instruction
-DEF_TRAP (bad_except, 204) ! 204: Trap instruction
-DEF_TRAP (bad_except, 205) ! 205: Trap instruction
-DEF_TRAP (bad_except, 206) ! 206: Trap instruction
-DEF_TRAP (bad_except, 207) ! 207: Trap instruction
-DEF_TRAP (bad_except, 208) ! 208: Trap instruction
-DEF_TRAP (bad_except, 209) ! 209: Trap instruction
-DEF_TRAP (bad_except, 210) ! 210: Trap instruction
-DEF_TRAP (bad_except, 211) ! 211: Trap instruction
-DEF_TRAP (bad_except, 212) ! 212: Trap instruction
-DEF_TRAP (bad_except, 213) ! 213: Trap instruction
-DEF_TRAP (bad_except, 214) ! 214: Trap instruction
-DEF_TRAP (bad_except, 215) ! 215: Trap instruction
-DEF_TRAP (bad_except, 216) ! 216: Trap instruction
-DEF_TRAP (bad_except, 217) ! 217: Trap instruction
-DEF_TRAP (bad_except, 218) ! 218: Trap instruction
-DEF_TRAP (bad_except, 219) ! 219: Trap instruction
-DEF_TRAP (bad_except, 220) ! 220: Trap instruction
-DEF_TRAP (bad_except, 221) ! 221: Trap instruction
-DEF_TRAP (bad_except, 222) ! 222: Trap instruction
-DEF_TRAP (bad_except, 223) ! 223: Trap instruction
-DEF_TRAP (bad_except, 224) ! 224: Trap instruction
-DEF_TRAP (bad_except, 225) ! 225: Trap instruction
-DEF_TRAP (bad_except, 226) ! 226: Trap instruction
-DEF_TRAP (bad_except, 227) ! 227: Trap instruction
-DEF_TRAP (bad_except, 228) ! 228: Trap instruction
-DEF_TRAP (bad_except, 229) ! 229: Trap instruction
-DEF_TRAP (bad_except, 230) ! 230: Trap instruction
-DEF_TRAP (bad_except, 231) ! 231: Trap instruction
-DEF_TRAP (bad_except, 232) ! 232: Trap instruction
-DEF_TRAP (bad_except, 233) ! 233: Trap instruction
-DEF_TRAP (bad_except, 234) ! 234: Trap instruction
-DEF_TRAP (bad_except, 235) ! 235: Trap instruction
-DEF_TRAP (bad_except, 236) ! 236: Trap instruction
-DEF_TRAP (bad_except, 237) ! 237: Trap instruction
-DEF_TRAP (bad_except, 238) ! 238: Trap instruction
-DEF_TRAP (bad_except, 239) ! 239: Trap instruction
-DEF_TRAP (bad_except, 240) ! 240: Trap instruction
-DEF_TRAP (bad_except, 241) ! 241: Trap instruction
-DEF_TRAP (bad_except, 242) ! 242: Trap instruction
-DEF_TRAP (bad_except, 243) ! 243: Trap instruction
-DEF_TRAP (bad_except, 244) ! 244: Trap instruction
-DEF_TRAP (bad_except, 245) ! 245: Trap instruction
-DEF_TRAP (bad_except, 246) ! 246: Trap instruction
-DEF_TRAP (bad_except, 247) ! 247: Trap instruction
-DEF_TRAP (bad_except, 248) ! 248: Trap instruction
-DEF_TRAP (bad_except, 249) ! 249: Trap instruction
-DEF_TRAP (bad_except, 250) ! 250: Trap instruction
-DEF_TRAP (bad_except, 251) ! 251: Trap instruction
-DEF_TRAP (bad_except, 252) ! 252: Trap instruction
-DEF_TRAP (bad_except, 253) ! 253: Trap instruction
-DEF_TRAP (bad_except, 254) ! 254: Trap instruction
-DEF_TRAP (bad_except, 255) ! 255: Trap instruction
-
- .reserve trapstack, 1000 * 4, "bss", 8
-
- .data
- .align 4
-
- .globl _in_trap_handler
-_in_trap_handler:
-in_trap_handler:
- .word 0
-
- .globl _debug_tbr
-_debug_tbr:
- .word 0
- .globl _debug_ret
-_debug_ret:
- .word 0
-
- .globl _nofault
-_nofault:
- .word 0
-
-led_xlat:
- .byte LED_0
- .byte LED_1
- .byte LED_2
- .byte LED_3
- .byte LED_4
- .byte LED_5
- .byte LED_6
- .byte LED_7
- .byte LED_8
- .byte LED_9
- .byte LED_A
- .byte LED_b
- .byte LED_C
- .byte LED_d
- .byte LED_E
- .byte LED_F
-
- .text
- .align 4
-
-
-#if 0
-excpt_dataaccess:
- ! %l3 contains the trap number.
- ! Disp it on the leds.
-
- ! Load the led table addressin %l4
- sethi %hi(led_xlat), %l4
- or %l4, %lo(led_xlat), %l4
-
- ! Convert %l3 into a led half word.
- and %l3, 0x0f, %l5
- ldub [%l4 + %l5], %l5
- srl %l3, 4, %l3
- and %l3, 0x0f, %l3
- ldub [%l4 + %l3], %l3
- and %l3, LED_DP, %l3
- sll %l3, 8, %l3
- or %l3, %l5, %l3
-
- ! Disp it on the led
- stha %l3, [%g0](0xc1)
-
- lda [%g0](0x81), %l3
- lda [%g0](0x82), %g0
- sethi %hi(_nofault), %l3
- st %g0, [%l3 + %lo(_nofault)]
-
- ! Return to the next instruction
- jmp %l2
- rett %l2 + 4
-#endif
-! This function is called when any SPARC trap (except window overflow or
-! underflow) occurs. It makes sure that the invalid register window is still
-! available before jumping into C code. It will also restore the world if you
-! return from handle_exception.
-
-! %l1 contains %pc
-! %l2 contains %npc
- .globl bad_except
-bad_except:
-interrupt:
- rd %psr, %l0
-#if 1
- ! %l3 contains the trap number.
- ! Disp it on the leds.
-
- ! Load the led table addressin %l4
- sethi %hi(led_xlat), %l4
- or %l4, %lo(led_xlat), %l4
-
- ! Convert %l3 into a led half word.
- and %l3, 0x0f, %l5
- ldub [%l4 + %l5], %l5
- srl %l3, 4, %l3
- and %l3, 0x0f, %l3
- ldub [%l4 + %l3], %l3
- and %l3, LED_DP, %l3
- sll %l3, 8, %l3
- or %l3, %l5, %l3
-
- ! Disp it on the led
- stha %l3, [%g0](ASI_LED)
-#endif
-#if 0
- ! Return
- jmp %l2
- rett %l2 + 4
-
- ! Wait for ever.
-1:
- b 1b
- nop
-#endif
-
- mov %wim, %l3
-
- ! Read FCR and FVAR now, otherwise data access to memory is disabled.
- lda [%g0](ASI_FCR), %l6
- lda [%g0](ASI_FVAR), %l7
-
- srl %l3, %l0, %l4 ! wim >> cwp
- cmp %l4, 1
- bne window_fine ! Branch if not in the invalid window
- nop
-
-! Handle window overflow
- mov %g1, %l4
- sll %l3, 1, %g1 ! Rotate wim left
- srl %l3, __WINSIZE-1, %l3
- or %g1, %l3, %g1
-
- save %g0, %g0, %g0 ! Slip into next window
- mov %g1, %wim ! Install the new wim
-
- std %l0, [%sp + 0 * 4] ! save L & I registers
- std %l2, [%sp + 2 * 4]
- std %l4, [%sp + 4 * 4]
- std %l6, [%sp + 6 * 4]
-
- std %i0, [%sp + 8 * 4]
- std %i2, [%sp + 10 * 4]
- std %i4, [%sp + 12 * 4]
- std %i6, [%sp + 14 * 4]
-
- restore ! Go back to trap window.
- mov %l4, %g1 ! Restore %g1
-
-window_fine:
- sethi %hi(in_trap_handler), %l4
- ld [%lo(in_trap_handler) + %l4], %l5
- tst %l5
- bg recursive_trap
- inc %l5
-
- set trapstack+1000*4, %sp ! Switch to trap stack
-
-recursive_trap:
- st %l5, [%lo(in_trap_handler) + %l4]
- sub %sp,(16+1+6+1+80)*4,%sp ! Make room for input & locals
- ! + hidden arg + arg spill
- ! + doubleword alignment
- ! + registers[72] local var
-
- std %g0, [%sp + (24 + 0) * 4] ! registers[Gx]
- std %g2, [%sp + (24 + 2) * 4]
- std %g4, [%sp + (24 + 4) * 4]
- std %g6, [%sp + (24 + 6) * 4]
-
- std %i0, [%sp + (24 + 8) * 4] ! registers[Ox]
- std %i2, [%sp + (24 + 10) * 4]
- std %i4, [%sp + (24 + 12) * 4]
- std %i6, [%sp + (24 + 14) * 4]
-
- mov %y, %l4
- mov %tbr, %l5
- st %l4, [%sp + (24 + 64) * 4] ! Y
- st %l0, [%sp + (24 + 65) * 4] ! PSR
- st %l3, [%sp + (24 + 66) * 4] ! WIM
- st %l5, [%sp + (24 + 67) * 4] ! TBR
- st %l1, [%sp + (24 + 68) * 4] ! PC
- st %l2, [%sp + (24 + 69) * 4] ! NPC
-
- or %l0, 0xf20, %l4
- mov %l4, %psr ! Turn on traps, disable interrupts
- nop
- nop
- nop
-
- set 0x1000, %l1
- btst %l1, %l0 ! FP enabled?
- be no_fpstore
- nop
-
-! Must save fsr first, to flush the FQ. This may cause a deferred fp trap, so
-! traps must be enabled to allow the trap handler to clean things up.
-
- st %fsr, [%sp + (24 + 70) * 4]
-
- std %f0, [%sp + (24 + 32) * 4]
- std %f2, [%sp + (24 + 34) * 4]
- std %f4, [%sp + (24 + 36) * 4]
- std %f6, [%sp + (24 + 38) * 4]
- std %f8, [%sp + (24 + 40) * 4]
- std %f10, [%sp + (24 + 42) * 4]
- std %f12, [%sp + (24 + 44) * 4]
- std %f14, [%sp + (24 + 46) * 4]
- std %f16, [%sp + (24 + 48) * 4]
- std %f18, [%sp + (24 + 50) * 4]
- std %f20, [%sp + (24 + 52) * 4]
- std %f22, [%sp + (24 + 54) * 4]
- std %f24, [%sp + (24 + 56) * 4]
- std %f26, [%sp + (24 + 58) * 4]
- std %f28, [%sp + (24 + 60) * 4]
- std %f30, [%sp + (24 + 62) * 4]
-no_fpstore:
-
-! call _get_in_break_mode
-! nop
-
- lda [%g0](ASI_MMCR), %l4
- st %l4, [%sp + (24 + 72) * 4]
-! Disable mmu
-! andn %l4, 1, %l4
-! sta %l4, [%g0](ASI_MMCR)
- st %l6, [%sp + (24 + 73) * 4]
- st %l7, [%sp + (24 + 74) * 4]
- lda [%g0](ASI_PDBA), %l4
- st %l4, [%sp + (24 + 75) * 4]
- lda [%g0](ASI_FPAR), %l4
- st %l4, [%sp + (24 + 76) * 4]
- lda [%g0](ASI_FTOR), %l4
- st %l4, [%sp + (24 + 77) * 4]
- lduha [%g0](ASI_FES), %l4
- st %l4, [%sp + (24 + 78) * 4]
- lda [%g0](ASI_FTSR), %l4
- st %l4, [%sp + (24 + 79) * 4]
-
- call _handle_exception
- add %sp, 24 * 4, %o0 ! Pass address of registers
-
-! Reload all of the registers that are not on the stack
-
- ld [%sp + (24 + 1) * 4], %g1 ! registers[Gx]
- ldd [%sp + (24 + 2) * 4], %g2
- ldd [%sp + (24 + 4) * 4], %g4
- ldd [%sp + (24 + 6) * 4], %g6
-
- ldd [%sp + (24 + 8) * 4], %i0 ! registers[Ox]
- ldd [%sp + (24 + 10) * 4], %i2
- ldd [%sp + (24 + 12) * 4], %i4
- ldd [%sp + (24 + 14) * 4], %i6
-
-! set 0xff00, %l2
-! ldd [%sp + (24 + 72) * 4], %l4
-! stda %l4, [%l2]0x1 ! DIA1, debug instr addr 1
- ! DIA2, debug instr addr 2
-! inc 8, %l2
-! ldd [%sp + (24 + 74) * 4], %l4
-! stda %l4, [%l2]0x1 ! DDA1, debug data addr 1
- ! DDA2, debug data addr 2
-! inc 8, %l2
-! ldd [%sp + (24 + 76) * 4], %l4
-! stda %l4, [%l2]0x1 ! DDV1, debug data value 1
- ! DDV2, debug data val 2
-! inc 8, %l2
-! ldd [%sp + (24 + 78) * 4], %l4
-! bset 0x200, %l4
-! stda %l4, [%l2]0x1 ! DCR, debug control reg
- ! DSR, debug control reg
-
-
- ldd [%sp + (24 + 64) * 4], %l0 ! Y & PSR
- ldd [%sp + (24 + 68) * 4], %l2 ! PC & NPC
-
- set 0x1000, %l5
- btst %l5, %l1 ! FP enabled?
- be no_fpreload
- nop
-
- ldd [%sp + (24 + 32) * 4], %f0
- ldd [%sp + (24 + 34) * 4], %f2
- ldd [%sp + (24 + 36) * 4], %f4
- ldd [%sp + (24 + 38) * 4], %f6
- ldd [%sp + (24 + 40) * 4], %f8
- ldd [%sp + (24 + 42) * 4], %f10
- ldd [%sp + (24 + 44) * 4], %f12
- ldd [%sp + (24 + 46) * 4], %f14
- ldd [%sp + (24 + 48) * 4], %f16
- ldd [%sp + (24 + 50) * 4], %f18
- ldd [%sp + (24 + 52) * 4], %f20
- ldd [%sp + (24 + 54) * 4], %f22
- ldd [%sp + (24 + 56) * 4], %f24
- ldd [%sp + (24 + 58) * 4], %f26
- ldd [%sp + (24 + 60) * 4], %f28
- ldd [%sp + (24 + 62) * 4], %f30
-
- ld [%sp + (24 + 70) * 4], %fsr
-no_fpreload:
-
- restore ! Ensure that previous window is valid
- save %g0, %g0, %g0 ! by causing a window_underflow trap
-
-
- mov %l1, %psr ! Make sure that traps are disabled
- ! for rett
- mov %l0, %y
- nop
-
- sethi %hi(in_trap_handler), %l4
- ld [%lo(in_trap_handler) + %l4], %l5
- dec %l5
- st %l5, [%lo(in_trap_handler) + %l4]
-
- jmpl %l2, %g0 ! Restore old PC
- rett %l3 ! Restore old nPC
-
- .text
- .align 4
-
-! Register window overflow handler. Come here when save would move us
-! into the invalid window. This routine runs with traps disabled, and
-! must be careful not to touch the condition codes, as PSR is never
-! restored.
-!
-! We are called with %l0 = wim, %l1 = pc, %l2 = npc
-win_ovf:
- save %g0, %g0, %g0
- std %l0, [%sp + (0*8)]
- rd %psr, %l0
- mov 1, %l1
- sll %l1, %l0, %l0
- wr %l0, 0, %wim
- std %l2, [%sp + (1*8)]
- std %l4, [%sp + (2*8)]
- std %l6, [%sp + (3*8)]
- std %i0, [%sp + (4*8)]
- std %i2, [%sp + (5*8)]
- std %i4, [%sp + (6*8)]
- std %i6, [%sp + (7*8)]
- restore
- jmpl %l1, %g0
- rett %l2
-
-! Register window underflow handler. Come here when restore would move us
-! into the invalid window. This routine runs with traps disabled, and
-! must be careful not to touch the condition codes, as PSR is never
-! restored.
-!
-! We are called with %l0 = wim, %l1 = pc, %l2 = npc
-win_unf:
- sll %l0, 1, %l3 ! Rotate wim left
- srl %l0, __WINSIZE-1, %l0
- or %l0, %l3, %l0
-
- mov %l0, %wim ! Install the new wim
-
- restore ! User window
- restore ! His caller window
-
- ldd [%sp + 0 * 4], %l0 ! restore L & I registers
- ldd [%sp + 2 * 4], %l2
- ldd [%sp + 4 * 4], %l4
- ldd [%sp + 6 * 4], %l6
-
- ldd [%sp + 8 * 4], %i0
- ldd [%sp + 10 * 4], %i2
- ldd [%sp + 12 * 4], %i4
- ldd [%sp + 14 * 4], %i6
-
- save %g0, %g0, %g0 ! Back to trap window
- save %g0, %g0, %g0
-
- jmpl %l1, %g0
- rett %l2
-
- .globl chk_data_tlbmiss
-chk_data_tlbmiss:
- ! Save PSR.
- rd %psr, %l0
-
- ! Read fault cause register.
- lda [ %g0 ] (0x81), %l7
-
- ! If nofault is null, go to bad_except.
- sethi %hi(_nofault), %l6
- ld [%l6 + %lo(_nofault)], %l5
- cmp %l5, %g0
- be 1f
- st %g0, [%l6 + %lo(_nofault)]
-
- ! Test if this is a tlb miss exception.
- btst 128, %l7
- bne,a have_data_tlbmiss
- lda [ %g0 ] (0x83), %l3
-1: rd %wim, %l0
- b interrupt
- mov 9, %l3
-
-have_data_tlbmiss:
- ! This is a tlb miss exception.
- ! %l3 now contains the page directory base register.
- ! Test if bit 2 is set.
- btst 2, %l3
- bne clean_data_tlbmiss
-
- ! Read the fault virtual address.
- lda [ %g0 ] (0x82), %l4
-
- ! Read the corresponding pde.
- srl %l4, 23, %l5
- sll %l5, 3, %l5
- ldd [ %l3 + %l5 ], %l6
-
- ! Store the pte into the cache.
- sta %l7, [ %l6 ] (0xaa)
-
- ! Read the pte corresponding to the virtual address.
- ! And store it into the cache.
- srl %l4, 11, %l5
- and %l5, 0xffc, %l5
- ld [ %l6 + %l5 ], %l7
- andn %l4, 3, %l4
- sta %l7, [ %l4 ] (0xaa)
-
- ! Return.
- wr %l0, %g0, %psr
- jmp %l1
- rett %l2
- nop
-clean_data_tlbmiss:
- andn %l3, 2, %l3
- srl %l4, 23, %l5
- sll %l5, 3, %l5
- ldd [ %l3 + %l5 ], %l6
- sta %l7, [ %l6 ] (0xaa)
- srl %l4, 11, %l5
- and %l5, 0xffc, %l5
- ld [ %l6 + %l5 ], %l7
- andn %l4, 3, %l4
- sta %l7, [ %l4 ] (0xaa)
- mov 1, %l5
- and %l0, 31, %l6
- sll %l5, %l6, %l5
- rd %wim, %l3
- btst %l5, %l3
- be data_must_clean
- wr %l0, %g0, %psr
- jmp %l1
- rett %l2
- nop
-data_must_clean:
- mov %l1, %sp
- mov %l2, %o7
- mov %g0, %l0
- mov %g0, %l1
- mov %g0, %l2
- mov %g0, %l3
- mov %g0, %l4
- mov %g0, %l5
- mov %g0, %l6
- mov %g0, %l7
- jmp %sp
- rett %o7
- nop
-
-nmi:
- set 400000, %l6
-nmi2:
- lda [%g0](ASI_BID), %l7
- deccc %l6
- be nmi3
- btst BID_NMI, %l7
- bne nmi2
- nop
- b nmi
- nop
-nmi3:
- set (LED_t << 8) | LED_1, %l0
- stha %l0, [%g0](ASI_LED)
-
- .globl _rom_reset
-_rom_reset:
- /*
- * like Startup. */
-
- ! Disable the mmu.
- lda [%g0] (ASI_MMCR), %o1
- andn %o1, MMCR_ME, %o1
- sta %o1, [%g0] (ASI_MMCR)
-
- ! Invalidate FTLB & GTLB.
- sta %g0, [%g0] (ASI_FGTLB_INV) ! 0x87
-
- ! Read the fault virtual address reg.
- lda [%g0] (ASI_FVAR), %g0
-
- ! Read the fault physical address reg.
- lda [%g0] (ASI_FPAR), %g0
-
- ! Read the fault time out reg.
- lda [%g0] (ASI_FTOR), %g0
-
- rd %psr, %g3 ! paranoia: make sure ...
- andn %g3, PSR_ET, %g3 ! we have traps off
- wr %g3, 0, %psr ! so that we can fiddle safely
- nop; nop; nop
-
- wr %g0, 0, %wim ! make sure we can set psr
- nop; nop; nop
- wr %g0, PSR_S|PSR_PS|PSR_PIL, %psr ! set initial psr
- nop; nop; nop
-
- wr %g0, 2, %wim ! set initial %wim (w1 invalid)
-
-! set USRSTACK - CCFSZ, %fp ! as if called from user code
-! set estack0 - CCFSZ - 80, %sp ! via syscall(boot_me_up) or somesuch
- rd %psr, %l0
- wr %l0, PSR_ET, %psr
- nop; nop; nop
-
-1: call __exit
- nop
- b 1b
- nop
-
-! Reset entry point
-real_start:
- ! Disp on the led (=0)
- sethi %hi(0xb6c0), %l1
- or %l1, %lo(0xB6c0), %l1
- stha %l1, [%g0](0xc1)
-
- ! Save the return point
- sethi %hi(_debug_ret), %l1
- st %o7, [%l1 + %lo(_debug_ret)]
-
- ! Just change the new TBR.
- mov %tbr, %l0
- sethi %hi(_debug_tbr), %l1
- st %l0, [%l1 + %lo(_debug_tbr)]
- sethi %hi(start), %l1
- wr %l1, %lo(start), %tbr
- nop
- nop
- nop
-
- ! Misc info
-! mov %sp, %o0
- ld [%sp + 0x5c], %o0
- ld [%sp + 0x60], %o1
- ld [%sp + 0x64], %o2
-
- ! Call main
- call _main
- nop
-
- ! Exit
- call __exit
- nop
- ret
-
- .globl _set_ipl
-_set_ipl:
- rd %psr, %o1
- andn %o1, 0xf00, %o1
- and %o0, 0x0f, %o0
- sll %o0, 8, %o0
- wr %o0, %o1, %psr
- nop
- nop
- nop
- retl
- nop
diff --git a/sys/arch/kbus/stand/netboot/dev_disk.c b/sys/arch/kbus/stand/netboot/dev_disk.c
deleted file mode 100644
index d21fa2b942e..00000000000
--- a/sys/arch/kbus/stand/netboot/dev_disk.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/* $OpenBSD: dev_disk.c,v 1.2 2000/03/03 00:54:50 todd Exp $ */
-
-/*
- * Copyright (c) 1993 Paul Kranenburg
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Paul Kranenburg.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This module implements a "raw device" interface suitable for
- * use by the stand-alone I/O library UFS file-system code, and
- * possibly for direct access (i.e. boot from tape).
- *
- * The implementation is deceptively simple because it uses the
- * drivers provided by the Sun PROM monitor. Note that only the
- * PROM driver used to load the boot program is available here.
- */
-
-#include <sys/types.h>
-#include <machine/mon.h>
-#include <machine/saio.h>
-
-#include "stand.h"
-
-#include "dvma.h"
-#include "promdev.h"
-
-int
-disk_open(f, devname)
- struct open_file *f;
- char *devname; /* Device part of file name (or NULL). */
-{
- struct saioreq *sip;
- int error;
-
-#ifdef DEBUG_PROM
- printf("disk_open: %s\n", devname);
-#endif
-
- if ((error = prom_iopen(&sip)) != 0)
- return (error);
-
- f->f_devdata = sip;
- return 0;
-}
-
-int
-disk_close(f)
- struct open_file *f;
-{
- struct saioreq *sip;
-
- sip = f->f_devdata;
- prom_iclose(sip);
- f->f_devdata = NULL;
- return 0;
-}
-
-int
-disk_strategy(devdata, flag, dblk, size, buf, rsize)
- void *devdata;
- int flag;
- daddr_t dblk;
- u_int size;
- char *buf;
- u_int *rsize;
-{
- struct saioreq *si;
- struct boottab *ops;
- char *dmabuf;
- int si_flag, xcnt;
-
- si = devdata;
- ops = si->si_boottab;
-
-#ifdef DEBUG_PROM
- printf("disk_strategy: size=%d dblk=%d\n", size, dblk);
-#else
- twiddle();
-#endif
-
- dmabuf = dvma_mapin(buf, size);
-
- si->si_bn = dblk;
- si->si_ma = dmabuf;
- si->si_cc = size;
-
- si_flag = (flag == F_READ) ? SAIO_F_READ : SAIO_F_WRITE;
- xcnt = (*ops->b_strategy)(si, si_flag);
- dvma_mapout(dmabuf, size);
-
-#ifdef DEBUG_PROM
- printf("disk_strategy: xcnt = %x\n", xcnt);
-#endif
-
- if (xcnt <= 0)
- return (EIO);
-
- *rsize = xcnt;
- return (0);
-}
-
-int
-disk_ioctl()
-{
- return EIO;
-}
-
diff --git a/sys/arch/kbus/stand/netboot/dev_disk.h b/sys/arch/kbus/stand/netboot/dev_disk.h
deleted file mode 100644
index 9f05f74bd82..00000000000
--- a/sys/arch/kbus/stand/netboot/dev_disk.h
+++ /dev/null
@@ -1,6 +0,0 @@
-
-int disk_open __P((struct open_file *, ...));
-int disk_close __P((struct open_file *));
-int disk_strategy __P((void *, int, daddr_t, u_int, char *, u_int *));
-int disk_ioctl();
-
diff --git a/sys/arch/kbus/stand/netboot/dev_net.c b/sys/arch/kbus/stand/netboot/dev_net.c
deleted file mode 100644
index 8e0f80dc4b9..00000000000
--- a/sys/arch/kbus/stand/netboot/dev_net.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/* $OpenBSD: dev_net.c,v 1.3 2000/03/03 00:54:50 todd Exp $ */
-
-/*
- * Copyright (c) 1995 Gordon W. Ross
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- * 4. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Gordon W. Ross
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This module implements a "raw device" interface suitable for
- * use by the stand-alone I/O library NFS code. This interface
- * does not support any "block" access, and exists only for the
- * purpose of initializing the network interface, getting boot
- * parameters, and performing the NFS mount.
- *
- * At open time, this does:
- *
- * find interface - netif_open()
- * RARP for IP address - rarp_getipaddress()
- * RPC/bootparams - callrpc(d, RPC_BOOTPARAMS, ...)
- * RPC/mountd - nfs_mount(sock, ip, path)
- *
- * the root file handle from mountd is saved in a global
- * for use by the NFS open code (NFS/lookup).
- */
-
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-#include <netinet/in_systm.h>
-
-#include "stand.h"
-#include "net.h"
-#include "netif.h"
-#include "config.h"
-#include "bootparam.h"
-
-extern int nfs_root_node[]; /* XXX - get from nfs_mount() */
-
-struct in_addr myip, rootip, gateip, mask;
-char rootpath[FNAME_SIZE];
-
-int netdev_sock = -1;
-static int open_count;
-
-extern char *getenv (const char *);
-
-/*
- * Called by devopen after it sets f->f_dev to our devsw entry.
- * This opens the low-level device and sets f->f_devdata.
- */
-int
-net_open(f, devname)
- struct open_file *f;
- char *devname; /* Device part of file name (or NULL). */
-{
- int error = 0;
-
- /* On first open, do netif open, mount, etc. */
- if (open_count == 0) {
- /* Find network interface. */
- if ((netdev_sock = netif_open(devname)) < 0)
- return (error=ENXIO);
- if ((error = net_mountroot(f, devname)) != 0)
- return (error);
- }
- open_count++;
- f->f_devdata = nfs_root_node;
- return (error);
-}
-
-int
-net_close(f)
- struct open_file *f;
-{
- /* On last close, do netif close, etc. */
- if (open_count > 0)
- if (--open_count == 0)
- netif_close(netdev_sock);
- f->f_devdata = NULL;
-}
-
-int
-net_ioctl()
-{
- return EIO;
-}
-
-int
-net_strategy()
-{
- return EIO;
-}
-
-int
-net_mountroot(f, devname)
- struct open_file *f;
- char *devname; /* Device part of file name (or NULL). */
-{
- int error;
-
-#ifdef DEBUG
- printf("net_mountroot: %s\n", devname);
-#endif
-
- /*
- * Get info for NFS boot: our IP address, our hostname,
- * server IP address, and our root path on the server.
- * There are two ways to do this: The old, Sun way,
- * and the more modern, BOOTP way. (RFC951, RFC1048)
- */
-
-#ifdef SUN_BOOTPARAMS
- /* Get boot info using RARP and Sun bootparams. */
-
- /* Get our IP address. (rarp.c) */
- if (rarp_getipaddress(netdev_sock) == -1)
- return (EIO);
- printf("boot: client IP address: %s\n", intoa(myip.s_addr));
-
- /* Get our hostname, server IP address. */
- if (bp_whoami(netdev_sock))
- return (EIO);
- printf("boot: client name: %s\n", hostname);
-
- /* Get the root pathname. */
- if (bp_getfile(netdev_sock, "root", &rootip, rootpath))
- return (EIO);
-
-#else
-
- /* Get boot info using BOOTP way. (RFC951, RFC1048) */
- bootp(netdev_sock);
-
- printf("Using IP address: %s\n", intoa(myip.s_addr));
-
- printf("myip: %s (%s)", hostname, intoa(myip));
- if (gateip)
- printf(", gateip: %s", intoa(gateip));
- if (mask)
- printf(", mask: %s", intoa(mask));
- printf("\n");
-
-#endif
-
- printf("root addr=%s path=%s\n", intoa(rootip.s_addr), rootpath);
-
- /* Get the NFS file handle (mount). */
- error = nfs_mount(netdev_sock, rootip, rootpath);
-
- return (error);
-}
-
-/*
- * machdep_common_ether: get ethernet address
- */
-void
-machdep_common_ether(ether)
- u_char *ether;
-{
- char *ea = getenv ("ENETADDR");
- u_char c;
- int i;
-
- if (ea == NULL)
- panic ("ERROR: ethernet address not set!");
- else
- printf ("Try to parse %s\n", ea);
-
- for (i = 0; i < 6; i++)
- {
- if (*ea >= '0' && *ea <= '9')
- c = *ea - '0';
- else if (*ea >= 'a' && *ea <= 'f')
- c = *ea - 'a' + 10;
- else if (*ea >= 'A' && *ea <= 'F')
- c = *ea - 'A' + 10;
- else
- panic ("Bad character for enet addr (%s)", ea);
- ea++;
- if (i == 5 && *ea == 0)
- break;
- if (i < 5 && *ea == ':')
- {
- *ether++ = c;
- ea++;
- continue;
- }
- c <<= 4;
- if (*ea >= '0' && *ea <= '9')
- c |= *ea - '0';
- else if (*ea >= 'a' && *ea <= 'f')
- c |= *ea - 'a' + 10;
- else if (*ea >= 'A' && *ea <= 'F')
- c |= *ea - 'A' + 10;
- else
- panic ("Bad character for enet addr (%s)", ea);
- ea++;
- if (i != 5 && *ea != ':')
- panic ("Bad character for enet addr (%s)", ea);
- ea++;
- *ether++ = c;
- }
-
-}
diff --git a/sys/arch/kbus/stand/netboot/dev_net.h b/sys/arch/kbus/stand/netboot/dev_net.h
deleted file mode 100644
index 093ba193bfd..00000000000
--- a/sys/arch/kbus/stand/netboot/dev_net.h
+++ /dev/null
@@ -1,6 +0,0 @@
-
-int net_open __P((struct open_file *, ...));
-int net_close __P((struct open_file *));
-int net_ioctl();
-int net_strategy();
-
diff --git a/sys/arch/kbus/stand/netboot/devopen.c b/sys/arch/kbus/stand/netboot/devopen.c
deleted file mode 100644
index 92c083983cb..00000000000
--- a/sys/arch/kbus/stand/netboot/devopen.c
+++ /dev/null
@@ -1,32 +0,0 @@
-
-#include <sys/param.h>
-#include <stand.h>
-#include "promboot.h"
-
-/*
- * Open the device named by the combined device/file name
- * given as the "fname" arg, something like: "sd()bsd"
- *
- * However, Sun PROMs don't really let you choose which
- * device you will talk to. You can only open the device
- * that was used to load the boot program. Therefore, we
- * do not accept a "device" part in the "fname" string.
- * Pass the PROM device name to open in case it needs it.
- */
-int
-devopen(f, fname, file)
- struct open_file *f;
- const char *fname;
- char **file;
-{
- struct devsw *dp;
- char *cp, *path, *devname;
- int error;
-
- *file = (char*)fname;
- dp = &devsw[0];
- f->f_dev = dp;
- error = (*dp->dv_open)(f, prom_bootdev);
-
- return (error);
-}
diff --git a/sys/arch/kbus/stand/netboot/dvma.c b/sys/arch/kbus/stand/netboot/dvma.c
deleted file mode 100644
index 11526106c2a..00000000000
--- a/sys/arch/kbus/stand/netboot/dvma.c
+++ /dev/null
@@ -1,68 +0,0 @@
-
-/*
- * The easiest way to deal with the need for DVMA mappings is
- * to just map the first four megabytes of RAM into DVMA space.
- * That way, dvma_mapin can just compute the DVMA alias address,
- * and dvma_mapout does nothing.
- */
-
-#include <sys/param.h>
-
-#define DVMA_BASE 0x00000000
-#define DVMA_MASK 0x00ffFFff
-#define DVMA_MAPLEN 0x400000 /* 4 MB */
-
-void
-dvma_init()
-{
-#if 0
- int segva, sme;
-
- for (segva = 0; segva < DVMA_MAPLEN; segva += NBSG) {
- sme = get_segmap(segva);
- set_segmap((DVMA_BASE | segva), sme);
- }
-#endif
-}
-
-/* Convert a local address to a DVMA address. */
-char *
-dvma_mapin(char *addr, int len)
-{
- int va = (int)addr;
-
- va |= DVMA_BASE;
- return ((char *) va);
-}
-
-/* Convert a DVMA address to a local address. */
-char *
-dvma_mapout(char *dmabuf, int len)
-{
- if (dmabuf < (char*)DVMA_BASE)
- panic("dvma_mapout");
- return (dmabuf - DVMA_BASE);
-}
-
-extern char *alloc(int len);
-char *
-dvma_alloc(int len)
-{
- char *mem;
-
- mem = alloc(len);
- if (!mem)
- return(mem);
- return(dvma_mapin(mem, len));
-}
-
-extern void free(void *ptr, int len);
-void
-dvma_free(char *dvma, int len)
-{
- char *mem;
-
- mem = dvma_mapout(dvma, len);
- if (mem)
- free(mem, len);
-}
diff --git a/sys/arch/kbus/stand/netboot/dvma.h b/sys/arch/kbus/stand/netboot/dvma.h
deleted file mode 100644
index 2b8be37cbe0..00000000000
--- a/sys/arch/kbus/stand/netboot/dvma.h
+++ /dev/null
@@ -1,6 +0,0 @@
-
-char * dvma_mapin(char *pkt, int len);
-void dvma_mapout(char *dmabuf, int len);
-
-char * dvma_alloc(int len);
-
diff --git a/sys/arch/kbus/stand/netboot/exec_sun.c b/sys/arch/kbus/stand/netboot/exec_sun.c
deleted file mode 100644
index 6fd253ee258..00000000000
--- a/sys/arch/kbus/stand/netboot/exec_sun.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/* $OpenBSD: exec_sun.c,v 1.2 2000/03/03 00:54:50 todd Exp $ */
-
-/*-
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
- * 4. The name of the Author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)boot.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <a.out.h>
-
-#include "stand.h"
-
-extern int debug;
-
-extern u_int bootdev;
-
-/*ARGSUSED*/
-exec_sun(file, loadaddr, howto)
- char *file;
- char *loadaddr;
- int howto;
-{
- register int io;
- struct exec x;
- int cc, magic;
- void (*entry)();
- register char *cp;
- register int *ip;
- int textlen;
-
-#ifdef DEBUG
- printf("exec_sun: file=%s loadaddr=0x%x\n", file, loadaddr);
-#endif
-
- io = open(file, 0);
- if (io < 0)
- return(-1);
-
- /*
- * Read in the exec header, and validate it.
- */
- if (read(io, (char *)&x, sizeof(x)) != sizeof(x))
- goto shread;
- if (N_BADMAG(x)) {
- errno = EFTYPE;
- goto closeout;
- }
-
- cp = x.a_entry; /* loadaddr; */
- textlen = x.a_text;
- magic = N_GETMAGIC(x);
- if (magic == ZMAGIC) {
- cp += sizeof(x);
- textlen -= sizeof(x);
- }
- entry = (void (*)())cp;
-
- printf ("Entry at %x\n", cp);
- /*
- * Leave a copy of the exec header before the text.
- * The sun3 kernel uses this to verify that the
- * symbols were loaded by this boot program.
- */
- bcopy(&x, cp - sizeof(x), sizeof(x));
-
- /*
- * Read in the text segment.
- */
- printf("%x", x.a_text);
- if (read(io, cp, textlen) != textlen)
- goto shread;
- cp += textlen;
-
- /*
- * NMAGIC may have a gap between text and data.
- */
- if (magic == NMAGIC) {
- register int mask = N_PAGSIZ(x) - 1;
- while ((int)cp & mask)
- *cp++ = 0;
- }
-
- /*
- * Read in the data segment.
- */
- printf("+%x", x.a_data);
- if (read(io, cp, x.a_data) != x.a_data)
- goto shread;
- cp += x.a_data;
-
- /*
- * Zero out the BSS section.
- * (Kernel does not do it itself)
- */
- printf("+%x", x.a_bss);
- cc = x.a_bss;
- while ((int)cp & 3) {
- *cp++ = 0;
- --cc;
- }
- ip = (int *)cp;
- cp += cc;
- while ((char *)ip < cp)
- *ip++ = 0;
-
- /*
- * Read in the symbol table and strings.
- * (Always set the symtab size word.)
- */
- *ip++ = x.a_syms;
- cp = (char *)ip;
-
- if (x.a_syms > 0) {
-
- /* Symbol table and string table length word. */
- cc = x.a_syms;
- printf("+[%x", cc);
- cc += sizeof(int); /* strtab length too */
- if (read(io, cp, cc) != cc)
- goto shread;
- cp += x.a_syms;
- ip = (int *)cp; /* points to strtab length */
- cp += sizeof(int);
-
- /* String table. Length word includes itself. */
- cc = *ip;
- printf("+%x]", cc);
- cc -= sizeof(int);
- if (cc <= 0)
- goto shread;
- if (read(io, cp, cc) != cc)
- goto shread;
- cp += cc;
- }
- printf("=%x\n", cp - loadaddr);
- close(io);
-
- if (debug) {
- printf("Debug mode - enter c to continue\n");
- }
-
- printf("Starting program at 0x%x\n", (int)entry);
- (*entry)(howto, bootdev, cp, 0, 0);
- panic("exec returned");
-
-shread:
- printf("exec: short read\n");
- errno = EIO;
-closeout:
- close(io);
- return(-1);
-}
diff --git a/sys/arch/kbus/stand/netboot/gets.c b/sys/arch/kbus/stand/netboot/gets.c
deleted file mode 100644
index 1670f5586eb..00000000000
--- a/sys/arch/kbus/stand/netboot/gets.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/* $OpenBSD: gets.c,v 1.2 2000/03/03 00:54:50 todd Exp $ */
-
-/*-
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
- * 4. The name of the Author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)gets.c 8.1 (Berkeley) 6/11/93
- */
-
-#include "stand.h"
-
-/*
- * This implementation assumes that getchar() does echo, because
- * on some machines, it is hard to keep echo from being done.
- * Those that need it can do echo in their getchar() function.
- *
- * Yes, the code below will echo CR, DEL, and other control chars,
- * but sending CR or DEL here is harmless. All the other editing
- * characters will be followed by a newline, so it doesn't matter.
- * (Most terminals will not show them anyway.)
- */
-
-void
-gets(buf)
- char *buf;
-{
- register int c;
- register char *lp;
-
-top:
- lp = buf;
-
- for (;;) {
- c = getchar() & 0177;
-
- putchar(c);
-
- switch (c) {
-
- default:
- *lp++ = c;
- continue;
-
- case '\177':
- putchar('\b');
- /* fall through */
- case '\b':
- putchar(' ');
- putchar('\b');
- /* fall through */
- case '#':
- if (lp > buf)
- lp--;
- continue;
-
- /*
- * This is not very useful in a boot program.
- * (It costs you 52 bytes on m68k, gcc -O3).
- */
- case 'r'&037: {
- register char *p;
- putchar('\n');
- for (p = buf; p < lp; ++p)
- putchar(*p);
- continue;
- }
-
- case '@':
- case 'u'&037:
- case 'w'&037:
- putchar('\n');
- goto top;
-
- case '\r':
- putchar('\n');
- /* fall through */
- case '\n':
- *lp = '\0';
- return;
-
- } /* switch */
- }
- /*NOTREACHED*/
-}
diff --git a/sys/arch/kbus/stand/netboot/if_le.c b/sys/arch/kbus/stand/netboot/if_le.c
deleted file mode 100644
index f0d9bda665a..00000000000
--- a/sys/arch/kbus/stand/netboot/if_le.c
+++ /dev/null
@@ -1,500 +0,0 @@
-/* $OpenBSD: if_le.c,v 1.3 2000/03/03 00:54:50 todd Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Theo de Raadt for Willowglen Singapore.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1993 Adam Glass
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Adam Glass.
- * 4. The name of the Author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/types.h>
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-
-#include "stand.h"
-#include "netif.h"
-#include "config.h"
-
-#include "if_lereg.h"
-
-int le_debug = 0;
-
-void le_end __P((struct netif *));
-void le_error __P((struct netif *, char *, volatile struct lereg1 *));
-int le_get __P((struct iodesc *, void *, size_t, time_t));
-void le_init __P((struct iodesc *, void *));
-int le_match __P((struct netif *, void *));
-int le_poll __P((struct iodesc *, void *, int));
-int le_probe __P((struct netif *, void *));
-int le_put __P((struct iodesc *, void *, size_t));
-void le_reset __P((struct netif *, u_char *));
-
-struct netif_stats le_stats;
-
-struct netif_dif le0_dif = {
- 0, /* unit */
- 1, /* nsel */
- &le_stats,
- 0,
- 0,
-};
-
-struct netif_driver le_driver = {
- "le", /* netif_bname */
- le_match, /* match */
- le_probe, /* probe */
- le_init, /* init */
- le_get, /* get */
- le_put, /* put */
- le_end, /* end */
- &le0_dif, /* netif_ifs */
- 1, /* netif_nifs */
-};
-
-struct le_configuration {
- unsigned int phys_addr;
- int used;
-} le_config[] = {
- { LANCE_REG_ADDR, 0 }
-};
-
-int nle_config = sizeof(le_config) / (sizeof(le_config[0]));
-
-struct {
- struct lereg1 *sc_r1; /* LANCE registers */
- struct lereg2 *sc_r2; /* RAM */
- void *recv_mem;
- void *xmit_mem;
- int next_rmd;
- int next_tmd;
-} le_softc;
-
-int
-le_match(nif, machdep_hint)
- struct netif *nif;
- void *machdep_hint;
-{
- char *name;
- int i, val = 0;
-
- name = machdep_hint;
- if (name && !bcmp(le_driver.netif_bname, name, 2))
- val += 10;
- for (i = 0; i < nle_config; i++) {
- if (le_config[i].used)
- continue;
- if (le_debug)
- printf("le%d: le_match --> %d\n", i, val + 1);
- le_config[i].used++;
- return val + 1;
- }
- if (le_debug)
- printf("le%d: le_match --> 0\n", i);
- return 0;
-}
-
-int
-le_probe(nif, machdep_hint)
- struct netif *nif;
- void *machdep_hint;
-{
- /* the set unit is the current unit */
- if (le_debug)
- printf("le%d: le_probe called\n", nif->nif_unit);
-
- return 0;
-}
-
-void
-le_error(nif, str, ler1)
- struct netif *nif;
- char *str;
- volatile struct lereg1 *ler1;
-{
-
- printf ("le_error (%s) C0: %b\n", str, ler1->ler1_rdp, LE_C0_BITS);
- /* ler1->ler1_rap = LE_CSRO done in caller */
- if (ler1->ler1_rdp & LE_C0_BABL)
- panic("le%d: been babbling, found by '%s'",
- nif->nif_unit, str);
- if (ler1->ler1_rdp & LE_C0_CERR) {
- le_stats.collision_error++;
- ler1->ler1_rdp = LE_C0_CERR;
- }
- if (ler1->ler1_rdp & LE_C0_MISS) {
- le_stats.missed++;
- ler1->ler1_rdp = LE_C0_MISS;
- }
- if (ler1->ler1_rdp & LE_C0_MERR) {
- printf("le%d: memory error in '%s'\n", nif->nif_unit, str);
- panic("memory error");
- }
-}
-
-void
-le_reset(nif, myea)
- struct netif *nif;
- u_char *myea;
-{
- struct lereg1 *ler1 = le_softc.sc_r1;
- struct lereg2 *ler2 = le_softc.sc_r2;
- unsigned int a;
- int timo = 40, stat, i;
-
- if (le_debug)
- {
- printf("le%d: le_reset called\n", nif->nif_unit);
- printf ("addr: 0x%x, data: 0x%x, xmit_mem: 0x%x, recv_mem: 0x%x\n",
- &ler1->ler1_rap, &ler1->ler1_rdp,
- le_softc.xmit_mem, le_softc.recv_mem);
- }
-
- /* Set IOASIC. */
- *(u_long *)0x90000004 = ((u_long)le_softc.recv_mem & 0x00ffffff) >> 15;
- *(u_long *)0x90000008 = ((u_long)le_softc.xmit_mem & 0x00ffffff) >> 13;
-
- ler1->ler1_rap = LE_CSR0;
- ler1->ler1_rdp = LE_C0_STOP; /* do nothing until we are finished */
-
- if (le_debug)
- printf ("le%d: stopped\n", nif->nif_unit);
-
- bzero(ler2, sizeof(*ler2));
-
- ler2->ler2_mode = LE_MODE_NORMAL;
- ler2->ler2_padr[0] = myea[1];
- ler2->ler2_padr[1] = myea[0];
- ler2->ler2_padr[2] = myea[3];
- ler2->ler2_padr[3] = myea[2];
- ler2->ler2_padr[4] = myea[5];
- ler2->ler2_padr[5] = myea[4];
-
-
- ler2->ler2_ladrf0 = 0;
- ler2->ler2_ladrf1 = 0;
-
- a = (u_int) ler2->ler2_rmd;
- ler2->ler2_rlen = LE_RLEN | 0;
- ler2->ler2_rdra = LE_GET_MD_ADDR (a);
-
- a = (u_int) ler2->ler2_tmd;
- ler2->ler2_tlen = LE_TLEN | 0;
- ler2->ler2_tdra = LE_GET_MD_ADDR (a);
-
- ler1->ler1_rap = LE_CSR1;
- a = (u_int) ler2;
- ler1->ler1_rdp = LE_GET_MD_ADDR (a);
- ler1->ler1_rap = LE_CSR2;
- ler1->ler1_rdp = 0;
-
- for (i = 0; i < LERBUF; i++)
- {
- a = (u_int) & ler2->ler2_rbuf[i];
- ler2->ler2_rmd[i].rmd0 = LE_GET_RECV_ADDR (a);
- ler2->ler2_rmd[i].rmd1_bits = LE_R1_OWN;
- ler2->ler2_rmd[i].rmd1_hadr = 0;
- ler2->ler2_rmd[i].rmd2 = -LEMTU;
- ler2->ler2_rmd[i].rmd3 = 0;
- }
- for (i = 0; i < LETBUF; i++)
- {
- ler2->ler2_tbuf[i] = (char *)(le_softc.xmit_mem + i * LEMTU);
- a = (u_int) ler2->ler2_tbuf[i];
- ler2->ler2_tmd[i].tmd0 = LE_GET_XMIT_ADDR (a);
- ler2->ler2_tmd[i].tmd1_bits = 0;
- ler2->ler2_tmd[i].tmd1_hadr = 0;
- ler2->ler2_tmd[i].tmd2 = 0;
- ler2->ler2_tmd[i].tmd3 = 0;
- }
-
- ler1->ler1_rap = LE_CSR3;
- ler1->ler1_rdp = LE_C3_BSWP;
-
- ler1->ler1_rap = LE_CSR0;
- ler1->ler1_rdp = LE_C0_INIT;
- do {
- if (--timo == 0) {
- printf("le%d: init timeout, stat = 0x%x\n",
- nif->nif_unit, stat);
- break;
- }
- stat = ler1->ler1_rdp;
- } while ((stat & LE_C0_IDON) == 0);
-
- ler1->ler1_rdp = LE_C0_IDON;
- le_softc.next_rmd = 0;
- le_softc.next_tmd = 0;
- ler1->ler1_rap = LE_CSR0;
- ler1->ler1_rdp = LE_C0_STRT /* | LE_C0_INEA */;
-/* printf ("C0: %b\n", ler1->ler1_rdp, LE_C0_BITS); TG */
-}
-
-int
-le_poll(desc, pkt, len)
- struct iodesc *desc;
- void *pkt;
- int len;
-{
- struct lereg1 *ler1 = le_softc.sc_r1;
- struct lereg2 *ler2 = le_softc.sc_r2;
- unsigned int a;
- int length;
- struct lermd *rmd;
-
-
- ler1->ler1_rap = LE_CSR0;
-
- if ((ler1->ler1_rdp & LE_C0_RINT) != 0)
- ler1->ler1_rdp = LE_C0_RINT;
- rmd = &ler2->ler2_rmd[le_softc.next_rmd];
- if (rmd->rmd1_bits & LE_R1_OWN) {
- return (0);
- }
- if (ler1->ler1_rdp & LE_C0_ERR)
- le_error(desc->io_netif, "le_poll", ler1);
- if (rmd->rmd1_bits & LE_R1_ERR) {
- printf("le%d_poll: rmd status 0x%x\n", desc->io_netif->nif_unit,
- rmd->rmd1_bits);
- length = 0;
- goto cleanup;
- }
- if ((rmd->rmd1_bits & (LE_R1_STP | LE_R1_ENP)) != (LE_R1_STP | LE_R1_ENP))
- panic("le_poll: chained packet");
-
- length = rmd->rmd3;
- if (length >= LEMTU) {
- length = 0;
- panic("csr0 when bad things happen: %x", ler1->ler1_rdp);
- goto cleanup;
- }
- if (!length)
- goto cleanup;
- length -= 4;
- if (length > 0) {
-
- /*
- * if buffer is smaller than the packet truncate it.
- * (is this wise?)
- */
- if (length > len)
- length = len;
-
- bcopy((void *)&ler2->ler2_rbuf[le_softc.next_rmd], pkt, length);
- }
-cleanup:
- a = (u_int) & ler2->ler2_rbuf[le_softc.next_rmd];
- rmd->rmd0 = LE_GET_RECV_ADDR (a);
- rmd->rmd1_hadr = 0;
- rmd->rmd2 = -LEMTU;
- le_softc.next_rmd =
- (le_softc.next_rmd == (LERBUF - 1)) ? 0 : (le_softc.next_rmd + 1);
- rmd->rmd1_bits = LE_R1_OWN;
-/* printf ("C0: %b\n", ler1->ler1_rdp, LE_C0_BITS); TG */
- return length;
-}
-
-int
-le_put(desc, pkt, len)
- struct iodesc *desc;
- void *pkt;
- size_t len;
-{
- volatile struct lereg1 *ler1 = le_softc.sc_r1;
- volatile struct lereg2 *ler2 = le_softc.sc_r2;
- volatile struct letmd *tmd;
- int timo = 100000, stat, i;
- unsigned int a;
-
- /* Check status. */
- ler1->ler1_rap = LE_CSR0;
- if (ler1->ler1_rdp & LE_C0_ERR)
- le_error(desc->io_netif, "le_put(way before xmit)", ler1);
-
- tmd = &ler2->ler2_tmd[le_softc.next_tmd];
- while (tmd->tmd1_bits & LE_T1_OWN)
- {
- printf("le%d: output buffer busy\n", desc->io_netif->nif_unit);
- }
-
- bcopy (pkt, (void *)ler2->ler2_tbuf[le_softc.next_tmd], len);
- if (len < 64)
- tmd->tmd2 = -64;
- else
- tmd->tmd2 = -len;
- tmd->tmd3 = 0;
- if (ler1->ler1_rdp & LE_C0_ERR)
- le_error(desc->io_netif, "le_put(before xmit)", ler1);
-
- tmd->tmd1_bits = LE_T1_STP | LE_T1_ENP | LE_T1_OWN;
- a = (u_int) ler2->ler2_tbuf[le_softc.next_tmd];
- tmd->tmd0 = LE_GET_XMIT_ADDR (a);
- tmd->tmd1_hadr = 0;
- ler1->ler1_rdp = LE_C0_TDMD;
- if (ler1->ler1_rdp & LE_C0_ERR)
- le_error(desc->io_netif, "le_put(after xmit)", ler1);
- do
- {
- if (--timo == 0) {
- printf("le%d: transmit timeout, stat = 0x%x\n",
- desc->io_netif->nif_unit, stat);
- if (ler1->ler1_rdp & LE_C0_ERR)
- le_error(desc->io_netif, "le_put(timeout)", ler1);
- break;
- }
- stat = ler1->ler1_rdp;
- udelay (1000);
- } while ((stat & LE_C0_TINT) == 0);
-/* printf ("C0: %b\n", ler1->ler1_rdp, LE_C0_BITS); TG */
- ler1->ler1_rdp = LE_C0_TINT;
- if (ler1->ler1_rdp & LE_C0_ERR) {
- if ((ler1->ler1_rdp & (LE_C0_BABL | LE_C0_CERR | LE_C0_MISS |
- LE_C0_MERR)) !=
- LE_C0_CERR)
- printf("le_put: xmit error, buf %d\n", le_softc.next_tmd);
- le_error(desc->io_netif, "le_put(xmit error)", ler1);
- }
- le_softc.next_tmd = 0;
- /* (le_softc.next_tmd == (LETBUF - 1)) ? 0 : le_softc.next_tmd + 1;*/
- if (tmd->tmd1_bits & LE_T1_DEF)
- le_stats.deferred++;
- if (tmd->tmd1_bits & LE_T1_ONE)
- le_stats.collisions++;
- if (tmd->tmd1_bits & LE_T1_MORE)
- le_stats.collisions += 2;
- if (tmd->tmd1_bits & LE_T1_ERR) {
- printf("le%d: transmit error, error = 0x%x\n", desc->io_netif->nif_unit,
- tmd->tmd3);
- return -1;
- }
- if (le_debug) {
- printf("le%d: le_put() successful: sent %d\n",
- desc->io_netif->nif_unit, len);
- printf("le%d: le_put(): tmd1_bits: %x tmd3: %x\n",
- desc->io_netif->nif_unit,
- (unsigned int) tmd->tmd1_bits,
- (unsigned int) tmd->tmd3);
- }
- return len;
-}
-
-int
-le_get(desc, pkt, len, timeout)
- struct iodesc *desc;
- void *pkt;
- size_t len;
- time_t timeout;
-{
- time_t t;
- int cc;
-
- t = getsecs();
- cc = 0;
- while (((getsecs() - t) < timeout) && !cc) {
- cc = le_poll(desc, pkt, len);
- }
- return cc;
-}
-/*
- * init le device. return 0 on failure, 1 if ok.
- */
-/* 32kb alignment required. */
-#define RECV_ALIGN 0x8000
-#define XMIT_ALIGN 0x2000
-void
-le_init(desc, machdep_hint)
- struct iodesc *desc;
- void *machdep_hint;
-{
- u_long mem;
- u_long xmit_mem;
- u_long recv_mem;
-
- struct netif *nif = desc->io_netif;
-
- if (le_debug)
- printf("le%d: le_init called\n", desc->io_netif->nif_unit);
- machdep_common_ether(desc->myea);
- bzero(&le_softc, sizeof(le_softc));
- le_softc.sc_r1 =
- (struct lereg1 *) le_config[desc->io_netif->nif_unit].phys_addr;
-
- mem = (u_long) alloc (2 * RECV_ALIGN + XMIT_ALIGN);
- recv_mem = (mem & ~(RECV_ALIGN - 1)) + RECV_ALIGN;
- xmit_mem = recv_mem + RECV_ALIGN;
-
- le_softc.sc_r2 = (struct lereg2 *) recv_mem;
- le_softc.recv_mem = (void *) recv_mem;
- le_softc.xmit_mem = (void *) xmit_mem;
- le_reset (desc->io_netif, desc->myea);
- printf ("device: %s%d attached to %s\n",
- nif->nif_driver->netif_bname,
- nif->nif_unit,
- ether_sprintf(desc->myea));
-}
-
-void
-le_end(nif)
- struct netif *nif;
-{
- struct lereg1 *ler1 = le_softc.sc_r1;
-
- if (le_debug)
- printf("le%d: le_end called\n", nif->nif_unit);
- ler1->ler1_rap = LE_CSR0;
- ler1->ler1_rdp = LE_C0_STOP;
-}
diff --git a/sys/arch/kbus/stand/netboot/if_lereg.h b/sys/arch/kbus/stand/netboot/if_lereg.h
deleted file mode 100644
index 28e2f087568..00000000000
--- a/sys/arch/kbus/stand/netboot/if_lereg.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/* $OpenBSD: if_lereg.h,v 1.3 2000/12/21 16:54:55 aaron Exp $ */
-
-/*-
- * Copyright (c) 1982, 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)if_lereg.h 8.2 (Berkeley) 10/30/93
- */
-
-#define LEMTU 1518
-#define LEMINSIZE 60 /* should be 64 if mode DTCR is set */
-#define LERBUF 8
-#define LERBUFLOG2 3
-#define LE_RLEN (LERBUFLOG2 << 13)
-#define LETBUF 1
-#define LETBUFLOG2 0
-#define LE_TLEN (LETBUFLOG2 << 13)
-
-/* Local Area Network Controller for Ethernet (LANCE) registers */
-struct lereg1 {
- volatile u_short ler1_rdp; /* register data port */
- char pad[0x20 - sizeof (u_short)];/* Pad. */
- volatile u_short ler1_rap; /* register address port */
-};
-/* register addresses */
-#define LE_CSR0 0 /* Control and status register */
-#define LE_CSR1 1 /* low address of init block */
-#define LE_CSR2 2 /* high address of init block */
-#define LE_CSR3 3 /* Bus master and control */
-
-/* Control and status register 0 (csr0) */
-#define LE_C0_ERR 0x8000 /* error summary */
-#define LE_C0_BABL 0x4000 /* transmitter timeout error */
-#define LE_C0_CERR 0x2000 /* collision */
-#define LE_C0_MISS 0x1000 /* missed a packet */
-#define LE_C0_MERR 0x0800 /* memory error */
-#define LE_C0_RINT 0x0400 /* receiver interrupt */
-#define LE_C0_TINT 0x0200 /* transmitter interrupt */
-#define LE_C0_IDON 0x0100 /* initialization done */
-#define LE_C0_INTR 0x0080 /* interrupt condition */
-#define LE_C0_INEA 0x0040 /* interrupt enable */
-#define LE_C0_RXON 0x0020 /* receiver on */
-#define LE_C0_TXON 0x0010 /* transmitter on */
-#define LE_C0_TDMD 0x0008 /* transmit demand */
-#define LE_C0_STOP 0x0004 /* disable all external activity */
-#define LE_C0_STRT 0x0002 /* enable external activity */
-#define LE_C0_INIT 0x0001 /* begin initialization */
-
-#define LE_C0_BITS \
- "\20\20ERR\17BABL\16CERR\15MISS\14MERR\13RINT\
-\12TINT\11IDON\10INTR\07INEA\06RXON\05TXON\04TDMD\03STOP\02STRT\01INIT"
-
-/* Control and status register 3 (csr3) */
-#define LE_C3_BSWP 0x4 /* byte swap */
-#define LE_C3_ACON 0x2 /* ALE control, eh? */
-#define LE_C3_BCON 0x1 /* byte control */
-/*
- * Current size is 13,758 bytes with 8 x 1518 receive buffers and
- * 1 x 1518 transmit buffer.
- */
-struct lereg2 {
- /* initialization block */
- volatile u_short ler2_mode; /* mode */
- volatile u_char ler2_padr[6]; /* physical address */
-#ifdef new_code
- volatile u_short ler2_ladrf[4]; /* logical address filter */
-#else
- volatile u_long ler2_ladrf0; /* logical address filter */
- volatile u_long ler2_ladrf1; /* logical address filter */
-#endif
- volatile u_short ler2_rdra; /* receive descriptor addr */
- volatile u_short ler2_rlen; /* rda high and ring size */
- volatile u_short ler2_tdra; /* transmit descriptor addr */
- volatile u_short ler2_tlen; /* tda high and ring size */
- /* receive message descriptors. bits/hadr are byte order dependent. */
- struct lermd {
- volatile u_short rmd0; /* low address of packet */
- volatile u_char rmd1_bits; /* descriptor bits */
- volatile u_char rmd1_hadr; /* high address of packet */
- volatile short rmd2; /* buffer byte count */
- volatile u_short rmd3; /* message byte count */
- } ler2_rmd[LERBUF];
- /* transmit message descriptors */
- struct letmd {
- volatile u_short tmd0; /* low address of packet */
- volatile u_char tmd1_bits; /* descriptor bits */
- volatile u_char tmd1_hadr; /* high address of packet */
- volatile short tmd2; /* buffer byte count */
- volatile u_short tmd3; /* transmit error bits */
- } ler2_tmd[LETBUF];
- volatile char ler2_rbuf[LERBUF][LEMTU];
- volatile char *ler2_tbuf[LETBUF];
-};
-/* Initialzation block (mode) */
-#define LE_MODE_PROM 0x8000 /* promiscuous mode */
-/* 0x7f80 reserved, must be zero */
-#define LE_MODE_INTL 0x0040 /* internal loopback */
-#define LE_MODE_DRTY 0x0020 /* disable retry */
-#define LE_MODE_COLL 0x0010 /* force a collision */
-#define LE_MODE_DTCR 0x0008 /* disable transmit CRC */
-#define LE_MODE_LOOP 0x0004 /* loopback mode */
-#define LE_MODE_DTX 0x0002 /* disable transmitter */
-#define LE_MODE_DRX 0x0001 /* disable receiver */
-#define LE_MODE_NORMAL 0 /* none of the above */
-
-
-/* Receive message descriptor 1 (rmd1_bits) */
-#define LE_R1_OWN 0x80 /* LANCE owns the packet */
-#define LE_R1_ERR 0x40 /* error summary */
-#define LE_R1_FRAM 0x20 /* framing error */
-#define LE_R1_OFLO 0x10 /* overflow error */
-#define LE_R1_CRC 0x08 /* CRC error */
-#define LE_R1_BUFF 0x04 /* buffer error */
-#define LE_R1_STP 0x02 /* start of packet */
-#define LE_R1_ENP 0x01 /* end of packet */
-
-#define LE_R1_BITS \
- "\20\10OWN\7ERR\6FRAM\5OFLO\4CRC\3BUFF\2STP\1ENP"
-
-/* Transmit message descriptor 1 (tmd1_bits) */
-#define LE_T1_OWN 0x80 /* LANCE owns the packet */
-#define LE_T1_ERR 0x40 /* error summary */
-#define LE_T1_MORE 0x10 /* multiple collisions */
-#define LE_T1_ONE 0x08 /* single collision */
-#define LE_T1_DEF 0x04 /* defferred transmit */
-#define LE_T1_STP 0x02 /* start of packet */
-#define LE_T1_ENP 0x01 /* end of packet */
-
-#define LE_T1_BITS \
- "\20\10OWN\7ERR\6RES\5MORE\4ONE\3DEF\2STP\1ENP"
-
-/* Transmit message descriptor 3 (tmd3) */
-#define LE_T3_BUFF 0x8000 /* buffer error */
-#define LE_T3_UFLO 0x4000 /* underflow error */
-#define LE_T3_LCOL 0x1000 /* late collision */
-#define LE_T3_LCAR 0x0800 /* loss of carrier */
-#define LE_T3_RTRY 0x0400 /* retry error */
-#define LE_T3_TDR_MASK 0x03ff /* time domain reflectometry counter */
-
-#define LE_XMD2_ONES 0xf000
-
-#define LE_T3_BITS \
- "\20\20BUFF\17UFLO\16RES\15LCOL\14LCAR\13RTRY"
-
-
-#define LE_GET_MD_ADDR(a) (((a) & 0x7fff) | 0x8000)
-#define LE_GET_RECV_ADDR(a) ((a) & 0x7fff)
-#define LE_GET_XMIT_ADDR(a) (((a) & 0x7fff) | 0xc000)
diff --git a/sys/arch/kbus/stand/netboot/intr.c b/sys/arch/kbus/stand/netboot/intr.c
deleted file mode 100644
index 6aeb832b30f..00000000000
--- a/sys/arch/kbus/stand/netboot/intr.c
+++ /dev/null
@@ -1,103 +0,0 @@
-#include <dev/ic/z8530reg.h>
-#include <machine/prom.h>
-#include <machine/sic.h>
-#include <machine/asi.h>
-#include <machine/asm.h>
-
-#define NOFAULT_CONTINUE 0x01
-#define NOFAULT_QUIET 0x02
-
-extern int nofault;
-
-#define CALL_ROM_COMMAND (**(void (**)(void))ROM_COMMAND)()
-#define GET_ROM_COMMAREA (*(struct prom_command_area **)ROM_COMM_AREA)
-
-void
-_exit (int val)
-{
- char *command = "reset intr";
-
- GET_ROM_COMMAREA->command_ptr = command;
- CALL_ROM_COMMAND;
-}
-
-#define NUMREGS 80
-
-/* Number of bytes of registers. */
-#define NUMREGBYTES (NUMREGS * 4)
-enum regnames
-{
- G0, G1, G2, G3, G4, G5, G6, G7,
- O0, O1, O2, O3, O4, O5, SP, O7,
- L0, L1, L2, L3, L4, L5, L6, L7,
- I0, I1, I2, I3, I4, I5, FP, I7,
-
- F0, F1, F2, F3, F4, F5, F6, F7,
- F8, F9, F10, F11, F12, F13, F14, F15,
- F16, F17, F18, F19, F20, F21, F22, F23,
- F24, F25, F26, F27, F28, F29, F30, F31,
- Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR,
- MMCR, FCR, FVAR, PDBA, FPAR, FTOR, FES, FTSR}; /* MMCR at 72. */
-
-
-extern int in_trap_handler;
-
-void
-handle_exception (unsigned long *registers)
-{
- int trap = (registers[TBR] >> 4) & 0xff;
-
- if (trap != 9 /*&& trap != 28*/ && !(nofault & NOFAULT_QUIET))
- {
- printf ("Trap %d: (in: %d)\n"
- "psr = 0x%x, tbr = 0x%x, pc = 0x%x, npc = 0x%x\n",
- trap, in_trap_handler,
- registers[PSR], registers[TBR], registers[PC], registers[NPC]);
- printf ("sp = %x fp = %x\n",
- registers[SP], registers[FP]);
- printf ("MMCR = %x, FCR = %x, FVAR = %x, PDBA = %x\n",
- registers[MMCR], registers[FCR],
- registers[FVAR], registers[PDBA]);
- printf ("FPAR = %x, FTOR = %x, FES = %x, FTSR = %x\n",
- registers[FPAR], registers[FTOR],
- registers[FES], registers[FTSR]);
- printf ("DIR: %x, IPR: %x, IRC: %x, IXR: %x, IXC: %x\n",
- lduba (ASI_DIR, 0) & SIC_DIR_MASK,
- lda (ASI_IPR, 0) & SIC_IPR_MASK,
- lduba (ASI_IRXC, 0) & 0x3,
- lda (ASI_IXR, 0) & 0xffff,
- lduba (ASI_ITXC, 0) & 0x3);
- }
-
- if (trap == 9 && (nofault & NOFAULT_CONTINUE))
- {
- nofault = 0;
- registers[PC] = registers[NPC];
- registers[NPC] += 4;
- }
- else if (trap == 28)
- {
- int ipv;
-
- ipv = lda (ASI_ACK_IPV, 0) & 0xffff;
-
-#if 1
- printf ("interrupt: vector: %d, info: %x, IRXC: %x\n",
- (ipv & SIC_IPV_IVL) >> 8,
- ipv & 0xff,
- lduba (ASI_IRXC, 0) & 0x3);
-#endif
- stba (ASI_IRXC, 0, SIC_IRC_E);
-
- switch ((ipv & SIC_IPV_IVL) >> 8)
- {
- case 137:
- zs_intr ();
- break;
- default:
- printf ("No handler for %d\n", ipv >> 8);
- }
- }
- else
- _exit (1);
-}
diff --git a/sys/arch/kbus/stand/netboot/panic.c b/sys/arch/kbus/stand/netboot/panic.c
deleted file mode 100644
index 3d7a2cbf58b..00000000000
--- a/sys/arch/kbus/stand/netboot/panic.c
+++ /dev/null
@@ -1,16 +0,0 @@
-
-#include <stdarg.h>
-#include "stand.h"
-
-__dead void
-panic(const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- printf(fmt, ap);
- printf("\n");
- va_end(ap);
- _exit ();
-}
-
diff --git a/sys/arch/kbus/stand/netboot/promboot.c b/sys/arch/kbus/stand/netboot/promboot.c
deleted file mode 100644
index 6eae8184a4a..00000000000
--- a/sys/arch/kbus/stand/netboot/promboot.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/* $OpenBSD: promboot.c,v 1.2 2000/03/03 00:54:50 todd Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
- * 4. The name of the Author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include "stand.h"
-#include "promboot.h"
-
-char prom_bootdev[32];
-char prom_bootfile[32];
-int prom_boothow;
-int debug;
-
-void
-prom_get_boot_info()
-{
-#if 0
- char c, *src, *dst;
- extern int devlun, ctrlun;
- extern char *oparg, *opargend;
-
-#ifdef DEBUG
- printf("prom_get_boot_info\n");
-#endif
-
- /* Get kernel filename */
- src = oparg;
- while (src && (*src == ' ' || *src == '\t'))
- src++;
-
- dst = prom_bootfile;
- if (src && *src != '-') {
- while (src && *src) {
- if (*src == ' ' || *src == '\t')
- break;
- *dst++ = *src++;
- }
- }
- *dst = '\0';
-
- /* Get boothowto flags */
- while (src && (*src == ' ' || *src == '\t'))
- src++;
- if (src && (*src == '-')) {
- while (*src) {
- switch (*src++) {
- case 'a':
- prom_boothow |= RB_ASKNAME;
- break;
- case 's':
- prom_boothow |= RB_SINGLE;
- break;
- case 'd':
- prom_boothow |= RB_KDB;
- debug = 1;
- break;
- }
- }
- }
-#ifdef DEBUG
- printf("promboot: device=\"%s\" file=\"%s\" how=0x%x\n",
- prom_bootdev, prom_bootfile, prom_boothow);
-#endif
-#endif
-}
diff --git a/sys/arch/kbus/stand/netboot/promboot.h b/sys/arch/kbus/stand/netboot/promboot.h
deleted file mode 100644
index 86b5aace21c..00000000000
--- a/sys/arch/kbus/stand/netboot/promboot.h
+++ /dev/null
@@ -1,5 +0,0 @@
-
-extern char prom_bootdev[];
-extern char prom_bootfile[];
-extern int prom_boothow;
-
diff --git a/sys/arch/kbus/stand/netboot/promcons.c b/sys/arch/kbus/stand/netboot/promcons.c
deleted file mode 100644
index 0f96a159b50..00000000000
--- a/sys/arch/kbus/stand/netboot/promcons.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* $OpenBSD: promcons.c,v 1.2 2000/03/03 00:54:51 todd Exp $ */
-
-/*
- * Copyright (c) 1996 Nivas Madhur
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
- * 4. The name of the Author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdarg.h>
-#include <sys/types.h>
-
-int
-getchar()
-{
- char c;
-
- __asm volatile("or r9, r0, 0\n
- tb0 0, r0, 496\n
- st.b r2, %0" : "=m" (c));
- return (c);
-}
-
-peekchar()
-{
- int have = 0;
-
- __asm volatile("or r9, r0, 1\n
- tb0 0, r0, 496\n
- bb1 2, r2, 1f\n
- or r2,r0, 1\n
- st r2, %0\n1:" : "=m" (have) :);
- return (have);
-}
-
-void
-putchar(c)
- int c;
-{
- if (c == '\n')
- putchar('\r');
- __asm volatile("or r9, r0, 0x20\n
- or r2, r0, %0\n
- tb0 0, r0, 496\n" : : "r" (c));
-}
-
diff --git a/sys/arch/kbus/stand/netboot/version.c b/sys/arch/kbus/stand/netboot/version.c
deleted file mode 100644
index 78cc563da62..00000000000
--- a/sys/arch/kbus/stand/netboot/version.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/* $OpenBSD: version.c,v 1.2 2000/03/03 00:54:51 todd Exp $ */
-
-/*
- * NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE.
- *
- * 1.1
- */
-
-char version[] = "$Revision: 1.2 $";
diff --git a/sys/arch/kbus/stand/netboot/zs.c b/sys/arch/kbus/stand/netboot/zs.c
deleted file mode 100644
index bf3fe9a6e64..00000000000
--- a/sys/arch/kbus/stand/netboot/zs.c
+++ /dev/null
@@ -1,173 +0,0 @@
-#include <dev/ic/z8530reg.h>
-#include <machine/prom.h>
-#include <machine/asm.h>
-
-void udelay (unsigned long usec);
-
-static unsigned char *zs0_a = (unsigned char *) 0x17012020;
-static unsigned char *zs0_b = (unsigned char *) 0x17012000;
-
-void
-zs_reg_write (unsigned char *zs_addr, unsigned char reg, unsigned char val)
-{
- *zs_addr = reg;
- udelay (2);
- *zs_addr = val;
-}
-
-unsigned char
-zs_reg_read (unsigned char *zs_addr, unsigned char reg)
-{
- *zs_addr = reg;
- udelay (2);
- return *zs_addr;
-}
-
-void
-zs0_putc (char c)
-{
- unsigned char r0;
-
- /* Wait until Tx is free. */
- do
- {
- *zs0_a = 0;
- udelay (2);
- }
- while ((*zs0_a & ZSRR0_TX_READY) == 0);
-
- /* Write the character. */
- zs0_a[0x10] = c;
- udelay (2);
-
- /* Wait until transmission. */
- do
- {
- *zs0_a = 0;
- udelay (2);
- }
- while ((*zs0_a & ZSRR0_TX_READY) == 0);
-}
-
-void
-putchar (char c)
-{
- if (c == '\n')
- zs0_putc ('\r');
- zs0_putc (c);
-}
-
-int
-getchar (void)
-{
- unsigned char r0;
-
- /* Wait until Rx is free. */
- do
- {
- *zs0_a = 0;
- udelay (2);
- }
- while ((*zs0_a & ZSRR0_RX_READY) == 0);
-
- /* Read the character. */
- return zs0_a[0x10];
-}
-
-void
-udelay (unsigned long usec)
-{
- register int i;
-
- while (usec--)
- for (i = 20; i; i--)
- ;
-}
-
-
-static void
-zs_loadreg (char *zsc, char *reg)
-{
- /* Reset int. */
- zs_reg_write (zsc, 0, ZSM_RESET_STINT);
- zs_reg_write (zsc, 0, ZSM_RESET_TXINT);
- zs_reg_write (zsc, 0, ZSM_RESET_ERR);
- zs_reg_write (zsc, 0, ZSM_RESET_IUS);
-
- /* Set vector. */
- zs_reg_write (zsc, 2, reg[2]);
-
- zs_reg_write (zsc, 3, reg[3] & ~ZSWR3_RX_ENABLE);
-
- zs_reg_write (zsc, 4, reg[4]);
-
- zs_reg_write (zsc, 5, reg[5] & ~ZSWR5_TX_ENABLE);
-
- zs_reg_write (zsc, 9, reg[9]);
-
- zs_reg_write (zsc, 10, reg[10]);
-
- zs_reg_write (zsc, 11, reg[11]);
- zs_reg_write (zsc, 12, reg[12]);
- zs_reg_write (zsc, 13, reg[13]);
- zs_reg_write (zsc, 14, reg[14]);
- zs_reg_write (zsc, 15, reg[15]);
-
- zs_reg_write (zsc, 3, reg[3]);
- zs_reg_write (zsc, 5, reg[5]);
- zs_reg_write (zsc, 1, reg[1]);
-}
-
-void
-set_zs (char *zsc)
-{
- static char regs[16]=
- {
- 0, /* 0 */
- ZSWR1_RIE | ZSWR1_SIE,
- 64, /* Vector. */
- ZSWR3_RX_8 | ZSWR3_RX_ENABLE,
- ZSWR4_CLK_X16 | ZSWR4_ONESB,
- ZSWR5_TX_8 | ZSWR5_TX_ENABLE,
- 0,
- 0,
- 0,
- ZSWR9_MASTER_IE, /* 9 */
- 0,
- ZSWR11_RXCLK_BAUD | ZSWR11_TXCLK_BAUD,
- 10, /* 12: baud rate. */
- 0,
- ZSWR14_BAUD_FROM_PCLK | ZSWR14_BAUD_ENA,
- 0
- };
- zs_loadreg (zsc, regs);
- zs_reg_write (zsc, 0, ZSWR0_CLR_INTR);
-}
-
-void
-disp_zs0_b (void)
-{
- int brg;
-
- set_zs (zs0_a);
- brg = ((zs_reg_read (zs0_a, 13) & 0xff) << 8)
- | (zs_reg_read (zs0_a, 12) & 0xff);
- printf ("brg = %d\n", brg);
- printf ("clock: %d\n", (brg + 2) * 2 * 9600 * 16);
-}
-
-void
-zs_intr (void)
-{
- char rr3 = zs_reg_read (zs0_a, 3);
-#if 1
- printf ("ZS status: 0x%x, pending: 0x%x\n",
- zs_reg_read (zs0_a, 0), rr3);
-#else
- putchar ('I');
-#endif
- /* Ack it. */
- if (rr3 & ZSRR3_IP_A_RX)
- printf ("char: 0x%x\n", zs0_a[0x10]);
- zs_reg_write (zs0_a, 0, ZSWR0_CLR_INTR);
-}
diff --git a/sys/arch/kbus/stand/sk/Makefile b/sys/arch/kbus/stand/sk/Makefile
deleted file mode 100644
index 5de2cb45554..00000000000
--- a/sys/arch/kbus/stand/sk/Makefile
+++ /dev/null
@@ -1,61 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2000/03/03 00:54:51 todd Exp $
-
-RELOC=0xfff10000
-
-S= ${.CURDIR}/../../../..
-
-SRTOBJ= crt0.o
-DIR_SA=$S/lib/libsa
-DIR_KERN=$S/lib/libkern
-M=$S/lib/libkern/arch/${MACHINE_ARCH}
-
-.if exists ($M/Makefile.inc)
-.PATH: $M
-.include "$M/Makefile.inc"
-.endif
-
-SRC_net= nfs.c rpc.c net.c ether.c arp.c in_cksum.c netif.c \
- bootparam.c rarp.c
-
-#SRC_sa = alloc.c bcopy.c memcpy.c close.c getfile.c open.c \
-# printf.c read.c strerror.c ufs.c globals.c lseek.c \
-# closeall.c dev.c dkcksum.c nullfs.c fstat.c
-
-SRC_sa = alloc.c memcpy.c memcmp.c memset.c strncmp.c close.c getfile.c \
- open.c printf.c read.c strerror.c ufs.c globals.c lseek.c \
- dev.c
-
-SRC_kern= ashrdi3.c bcmp.c bzero.c strcmp.c strlen.c strncpy.c __main.c \
- urem.S udiv.S sdiv.S umul.S rem.S
-
-SRC_here= clock.c devopen.c dvma.c gets.c panic.c \
- promboot.c zs.c exec_sun.c \
- boot.c conf.c version.c dev_net.c if_le.c intr.c app.c \
- probe.c
-
-SRCS= ${SRC_net} ${SRC_sa} ${SRC_kern} ${SRC_here}
-
-OBJS= ${SRTOBJ} ${SRCS:S/.c/.o/g:S/.S/.o/g}
-
-DEFS= -DSTANDALONE -DSUN_BOOTPARAMS # -DNFS_DEBUG -DDEBUG
-INCL=-I${.CURDIR} -I${S} -I${S}/lib/libsa -I${M}
-COPTS= #-fno-defer-pop
-CFLAGS= -g ${COPTS} ${DEFS} ${DBG} ${INCL}
-
-
-.PATH: ${DIR_SA} ${DIR_KERN} ${DIR_KERN_ARCH}
-
-all: sk
-
-.S.o:
- ${CC} -c ${CFLAGS} -o $@ $<
-
-sk: ${OBJS}
- ${LD} -N -Ttext ${RELOC} -e start -o $@ ${OBJS}
- cp $@ /tftpboot
-
-install:
- ${INSTALL} ${INSTALL_COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
- netboot.bin ${DESTDIR}${MDEC_DIR}/netboot
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/kbus/stand/sk/app.c b/sys/arch/kbus/stand/sk/app.c
deleted file mode 100644
index 617c69656d5..00000000000
--- a/sys/arch/kbus/stand/sk/app.c
+++ /dev/null
@@ -1,111 +0,0 @@
-#define _KERNEL
-#include <sys/param.h>
-#include <machine/psl.h>
-
-extern unsigned int hz_ticks;
-
-#define SPL_BODY(new_spl) \
-{ \
- int oldspl; \
- \
- /* Get old spl. */ \
- oldspl = lda (ASI_IPR, 0) & 0xff; \
- \
- setpil15(); \
- sta (ASI_IPR, 0, new_spl & 0xff); \
- setpil0(); \
- \
- return oldspl; \
-}
-
-int
-spl0 (void)
-SPL_BODY (0)
-
-int
-spl1 (void)
-SPL_BODY (140)
-
-int
-get_hz (void)
-{
- int sec;
- int ticks;
-
- sec = getsecs () + 1;
- while (getsecs () < sec)
- ;
- ticks = hz_ticks;
- setpil0 ();
- while (getsecs () < sec + 8)
- ;
- setpil15 ();
- return (hz_ticks - ticks) / 8;
-}
-
-void
-do_cmd (char *line)
-{
- char *argv[40];
- int argc;
- int i, j;
-
- for (argc = 0, i = 0; ; argc++)
- {
- while (line[i] == ' ')
- line[i++] = 0;
- if (line[i] == 0)
- break;
- argv[argc] = line + i;
- while (line[i] && line[i] != ' ')
- i++;
- }
-#if 0
- printf ("argc = %d, argv = ", argc);
- for (i = 0; i < argc; i++)
- printf ("%s ", argv[i]);
- printf ("\n");
-#endif
-
- if (argc == 0)
- return;
- if (strcmp (argv[0], "quit") == 0)
- _exit (0);
- else if (strcmp (argv[0], "le") == 0)
- le_disp_status ();
- else if (strcmp (argv[0], "ipr?") == 0)
- printf ("ipr = %d, pil = %d\n",
- lda (ASI_IPR, 0) & 0xff,
- (getpsr() & PSR_PIL) >> 8);
- else if (strcmp (argv[0], "pil0") == 0)
- setpil0 ();
- else if (strcmp (argv[0], "pil15") == 0)
- setpil15 ();
- else if (strcmp (argv[0], "spl0") == 0)
- spl0 ();
- else if (strcmp (argv[0], "spl1") == 0)
- spl1 ();
- else if (strcmp (argv[0], "le_intr") == 0)
- le_intr ();
- else if (strcmp (argv[0], "zs_intr") == 0)
- zs_intr ();
- else if (strcmp (argv[0], "sic?") == 0)
- printf ("DIR: %x, IPR: %x, IRC: %x, IXR: %x, IXC: %x\n",
- lduba (ASI_DIR, 0) & SIC_DIR_MASK,
- lda (ASI_IPR, 0) & SIC_IPR_MASK,
- lduba (ASI_IRXC, 0) & 0x3,
- lda (ASI_IXR, 0) & 0xffff,
- lduba (ASI_ITXC, 0) & 0x3);
- else if (strcmp (argv[0], "clk?") == 0)
- printf ("clk: %d\n", hz_ticks);
- else if (strcmp (argv[0], "init_kbd") == 0)
- init_kbd ();
- else if (strcmp (argv[0], "irxc0") == 0)
- stba (ASI_IRXC, 0, 0);
- else if (strcmp (argv[0], "irxc1") == 0)
- stba (ASI_IRXC, 0, 1);
- else if (strcmp (argv[0], "hz?") == 0)
- printf ("hz = %d\n", get_hz ());
- else
- printf ("Unknown command\n");
-}
diff --git a/sys/arch/kbus/stand/sk/boot.c b/sys/arch/kbus/stand/sk/boot.c
deleted file mode 100644
index f313c5fc8da..00000000000
--- a/sys/arch/kbus/stand/sk/boot.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/* $OpenBSD: boot.c,v 1.2 2000/03/03 00:54:51 todd Exp $ */
-
-/*-
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
- * 4. The name of the Author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)boot.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-
-#define _KERNEL
-#include <machine/sic.h>
-#include <machine/asi.h>
-#include <machine/asm.h>
-#include <machine/psl.h>
-
-#include "stand.h"
-#include "promboot.h"
-
-/*
- * Boot device is derived from ROM provided information.
- */
-#define LOADADDR 0x10000
-
-extern char version[];
-char defname[32] = "hello";
-char line[80];
-
-#if 0
-u_int bootdev = MAKEBOOTDEV(0, sdmajor, 0, 0, 0); /* disk boot */
-#endif
-u_int bootdev = MAKEBOOTDEV(1, 0, 0, 0, 0); /* network boot */
-
-char **environ;
-
-char *
-getenv (const char *str)
-{
- char **c;
- size_t len = strlen (str);
-
- for (c = environ; *c; c++)
- {
- if ((*c)[len] == '=' && strncmp (*c, str, len) == 0)
- return (*c) + len + 1;
- }
- return NULL;
-}
-
-void
-disp_hex (unsigned char c)
-{
- putchar ("0123456789abcdef"[c >> 4]);
- putchar ("0123456789abcdef"[c & 0x0f]);
- putchar (' ');
-}
-
-void
-dump (unsigned char *addr, int len)
-{
- int i, j;
-
- for (i = 0; i < len; i+= 16)
- {
- printf ("%x: ", i);
- for (j = 0; j < 16 && (i + j < len); j++)
- disp_hex(addr[i+j]);
- printf ("\n");
- }
-}
-
-extern int debug;
-
-void
-main (int argc, char *argv[], char *envp[])
-{
- char *cp, *file;
- int io;
- int ask = 0;
-
- environ = envp;
- printf(">> OpenBSD netboot [%s]\n", version);
- /* printf("model MVME%x\n", cputyp); */
-
- printf ("Intr: ");
- sic_init ();
- printf ("Enabled\n");
-
- disp_zs0_b ();
- udelay (10000);
-#if 0
- printf ("Before sendint...\n");
- sendint (1, 150);
- printf ("Again...\n");
- sendint (1, 150);
-#endif
-#if 0
- printf ("Set IPR to 160 and send 160\n");
- sta (ASI_IPR, 0, 0xa0);
- sendint (1, 161);
- sendint (1, 160);
- printf ("Set IPR to 0\n");
- sta (ASI_IPR, 0, 0);
-#endif
-#if 0
- printf ("Set psl to 15, sendint and reset it\n");
- setpil15();
- sendint (1, 155);
- sendint (1,160);
- sendint (1,160);
- setpil0();
-
- disp_date ();
- udelay (1000000);
- printf ("Exit\n");
- _exit (0);
-#endif
-
- le_low_init ();
-
- while (1)
- {
- printf ("SK> ");
- gets (line);
- do_cmd (line);
- }
-
- _exit (0);
-
- prom_get_boot_info();
- file = defname;
-
- cp = prom_bootfile;
- if (cp && *cp)
- file = cp;
-
- for (;;) {
- if (ask) {
- printf("boot: ");
- gets(line);
- if (line[0]) {
- prom_get_boot_info();
- }
- }
- exec_sun(file, (char *)LOADADDR, prom_boothow);
- printf("boot: %s\n", strerror(errno));
- ask = 1;
- }
-}
diff --git a/sys/arch/kbus/stand/sk/clock.c b/sys/arch/kbus/stand/sk/clock.c
deleted file mode 100644
index f0cdb090c27..00000000000
--- a/sys/arch/kbus/stand/sk/clock.c
+++ /dev/null
@@ -1,121 +0,0 @@
-#include <sys/types.h>
-
-#include "clockreg.h"
-#include "config.h"
-#include "clock.h"
-
-/*
- * BCD to decimal and decimal to BCD.
- */
-#define FROM_BCD(x,y) ((x) + 10 * (y))
-
-#define SECDAY (24 * 60 * 60)
-#define SECYR (SECDAY * 365)
-#define LEAPYEAR(y) (((y) & 3) == 0)
-
-/*
- * This code is defunct after 2068.
- * Will Unix still be here then??
- */
-const short dayyr[12] =
-{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
-
-static u_long
-chiptotime(sec, min, hour, day, mon, year)
- register int sec, min, hour, day, mon, year;
-{
- register int days, yr;
-
- if (year < 70)
- year = 70;
-
- /* simple sanity checks */
- if (year < 70 || mon < 1 || mon > 12 || day < 1 || day > 31)
- return (0);
- days = 0;
- for (yr = 70; yr < year; yr++)
- days += LEAPYEAR(yr) ? 366 : 365;
- days += dayyr[mon - 1] + day - 1;
- if (LEAPYEAR(yr) && mon > 2)
- days++;
- /* now have days since Jan 1, 1970; the rest is easy... */
- return (days * SECDAY + hour * 3600 + min * 60 + sec);
-}
-
-static u_char *rtc_byte = (u_char *) 0x17020000;
-
-static u_char
-rtc_read_reg (int reg)
-{
- u_char res;
-
- reg &= 0x0f;
- *rtc_byte = RTC_WRITE_ADDR | reg;
- *rtc_byte = reg;
- *rtc_byte = RTC_READ | 0x0f;
- res = *rtc_byte & 0x0f;
- *rtc_byte = RTC_WRITE_ADDR | 0x0f;
- *rtc_byte = 0x0f;
- return res;
-}
-
-time_t
-getsecs()
-{
- int sec, min, hour, hourl, hourh, day, mon, year;
-
- sec = FROM_BCD (rtc_read_reg (RTC_SEC_LOW),
- rtc_read_reg (RTC_SEC_HIGH));
- min = FROM_BCD (rtc_read_reg (RTC_MIN_LOW),
- rtc_read_reg (RTC_MIN_HIGH));
- day = FROM_BCD (rtc_read_reg (RTC_DAY_LOW),
- rtc_read_reg (RTC_DAY_HIGH));
- mon = FROM_BCD (rtc_read_reg (RTC_MON_LOW),
- rtc_read_reg (RTC_MON_HIGH));
- year = RTC_YEAR_BASE + FROM_BCD (rtc_read_reg (RTC_YEAR_LOW),
- rtc_read_reg (RTC_YEAR_HIGH));
- hourl = rtc_read_reg (RTC_HOUR_LOW);
- hourh = rtc_read_reg (RTC_HOUR_HIGH);
- if (hourh & RTC_HOUR_PM)
- hour = 12 + (hourh & 1) * 10 + hourl;
- else
- hour = (hourh & 0x03) * 10 + hourl;
- return (chiptotime(sec, min, hour, day, mon, year));
-}
-
-void
-disp_date (void)
-{
- static char *days[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
- int hour, hourl, hourh, day, wday, mon, year;
-
- wday = rtc_read_reg (RTC_WEEK_DAY);
- day = FROM_BCD (rtc_read_reg (RTC_DAY_LOW),
- rtc_read_reg (RTC_DAY_HIGH));
- mon = FROM_BCD (rtc_read_reg (RTC_MON_LOW),
- rtc_read_reg (RTC_MON_HIGH));
- year = RTC_YEAR_BASE + FROM_BCD (rtc_read_reg (RTC_YEAR_LOW),
- rtc_read_reg (RTC_YEAR_HIGH));
- hourl = rtc_read_reg (RTC_HOUR_LOW);
- hourh = rtc_read_reg (RTC_HOUR_HIGH);
-
- if (hourh & RTC_HOUR_PM)
- hour = 12 + (hourh & 1) * 10 + hourl;
- else
- hour = (hourh & 0x03) * 10 + hourl;
-
- printf ("Date: %s %d-%d-%d %d:%d%d:%d%d\n",
- days[wday],
- 1900 + year, mon, day,
- hour,
- rtc_read_reg (RTC_MIN_HIGH),
- rtc_read_reg (RTC_MIN_LOW),
- rtc_read_reg (RTC_SEC_HIGH),
- rtc_read_reg (RTC_SEC_LOW));
-}
-
-int
-getticks()
-{
- return getsecs() * 100;
-}
diff --git a/sys/arch/kbus/stand/sk/clock.h b/sys/arch/kbus/stand/sk/clock.h
deleted file mode 100644
index d61bc9b03b8..00000000000
--- a/sys/arch/kbus/stand/sk/clock.h
+++ /dev/null
@@ -1,6 +0,0 @@
-
-extern int hz;
-
-time_t getsecs();
-int getticks();
-
diff --git a/sys/arch/kbus/stand/sk/clockreg.h b/sys/arch/kbus/stand/sk/clockreg.h
deleted file mode 100644
index 96691a77c92..00000000000
--- a/sys/arch/kbus/stand/sk/clockreg.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $OpenBSD: clockreg.h,v 1.2 2000/03/03 00:54:51 todd Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)clockreg.h 8.1 (Berkeley) 6/11/93
- */
-
-/* RTC 58321. */
-#define RTC_STOP 0x80 /* Stop RTC clock. */
-#define RTC_WRITE 0x40 /* Write access. */
-#define RTC_READ 0x20 /* Read access. */
-#define RTC_WRITE_ADDR 0x10 /* Write address. */
-
-#define RTC_SEC_LOW 0x00 /* RTC seconds (low nibble). */
-#define RTC_SEC_HIGH 0x01 /* RTC seconds (high nibble). */
-#define RTC_MIN_LOW 0x02 /* RTC minutes (low nibble). */
-#define RTC_MIN_HIGH 0x03 /* RTC minutes (high nibble). */
-#define RTC_HOUR_LOW 0x04 /* RTC hours (low nibble). */
-#define RTC_HOUR_HIGH 0x05 /* RTC hours (high nibble). */
-#define RTC_HOUR_24 0x08 /* RTC 24 hours mode bit. */
-#define RTC_HOUR_PM 0x04 /* RTC p.m. bit. */
-#define RTC_WEEK_DAY 0x06 /* RTC day of the week. */
-#define RTC_DAY_LOW 0x07 /* RTC day of the month (low nibble). */
-#define RTC_DAY_HIGH 0x08 /* RTC day of the month (high nibble). */
-#define RTC_MON_LOW 0x09 /* RTC month (low nibble). */
-#define RTC_MON_HIGH 0x0a /* RTC month (high nibble). */
-#define RTC_YEAR_LOW 0x0b /* RTC year (low nibble). */
-#define RTC_YEAR_HIGH 0x0c /* RTC year (high nibble). */
-
-#define RTC_YEAR_BASE 68
-
diff --git a/sys/arch/kbus/stand/sk/conf.c b/sys/arch/kbus/stand/sk/conf.c
deleted file mode 100644
index f16d2c7f12f..00000000000
--- a/sys/arch/kbus/stand/sk/conf.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* $OpenBSD: conf.c,v 1.2 2000/03/03 00:54:51 todd Exp $ */
-
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-
-#include <stand.h>
-#include <nfs.h>
-#include <dev_net.h>
-
-struct fs_ops file_system[] = {
- { nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
-};
-int nfsys = sizeof(file_system) / sizeof(file_system[0]);
-
-struct devsw devsw[] = {
- { "net", net_strategy, net_open, net_close, net_ioctl },
-};
-int ndevs = sizeof(devsw) / sizeof(devsw[0]);
-
-extern struct netif_driver le_driver;
-
-struct netif_driver *netif_drivers[] = {
- &le_driver
-};
-int n_netif_drivers = sizeof(netif_drivers) / sizeof(netif_drivers[0]);
-
-
-/* XXX */
-int netif_debug;
-int debug;
-int errno;
diff --git a/sys/arch/kbus/stand/sk/config.h b/sys/arch/kbus/stand/sk/config.h
deleted file mode 100644
index 0bbb22e09f9..00000000000
--- a/sys/arch/kbus/stand/sk/config.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* $OpenBSD: config.h,v 1.2 2000/03/03 00:54:51 todd Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
- * 4. The name of the Author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* configuration information for base-line code */
-
-#if 0
-#define ETHER_ADDR_147 (0xfffe0778)
-#define ETHER_ADDR_16X (0xfffc0000+7980)
-#define ERAM_ADDR (0xfffe0774)
-#endif
-#define LANCE_REG_ADDR (0x90001000)
diff --git a/sys/arch/kbus/stand/sk/crt0.S b/sys/arch/kbus/stand/sk/crt0.S
deleted file mode 100644
index 03348ca60c5..00000000000
--- a/sys/arch/kbus/stand/sk/crt0.S
+++ /dev/null
@@ -1,860 +0,0 @@
-#include <machine/led.h>
-#include <machine/asi.h>
-#include <machine/kbus.h>
-#include <machine/psl.h>
-#include <machine/pmap.h>
-
- .text
-#define __WINSIZE 8
-
-#define DEF_TRAP(func,val) \
- mov val, %l3; \
- b func; \
- mov %wim, %l0; \
- nop
-
- .globl start
- .globl _exception_table
-_exception_table:
-start:
-reset:
- b real_start
- nop
- nop
- nop
-DEF_TRAP (bad_except, 1) ! 1: Instruction access
-DEF_TRAP (bad_except, 2) ! 2: Illegal Instruction
-DEF_TRAP (bad_except, 3) ! 3: Privilegied Instruction
-DEF_TRAP (bad_except, 4) ! 4: Floating-Point disabled
-DEF_TRAP (win_ovf, 5) ! 5: Window overflow
-DEF_TRAP (win_unf, 6) ! 6: Window undeflow
-DEF_TRAP (bad_except, 7) ! 7: Memory address not aligned
-DEF_TRAP (bad_except, 8) ! 8: Floating point exception
-#if 1
-DEF_TRAP (bad_except, 9) ! 9: data access exception
-#else
-DEF_TRAP (chk_data_tlbmiss, 9) ! 9: data access exception
-#endif
-DEF_TRAP (bad_except, 10) ! 10: Tag overflow
-DEF_TRAP (bad_except, 11) ! 11: -
-DEF_TRAP (bad_except, 12) ! 12: -
-DEF_TRAP (bad_except, 13) ! 13: -
-DEF_TRAP (bad_except, 14) ! 14: -
-DEF_TRAP (bad_except, 15) ! 15: -
-DEF_TRAP (bad_except, 16) ! 16: -
-DEF_TRAP (interrupt, 1) ! 17: Interrupt level 1
-DEF_TRAP (interrupt, 2) ! 18: Interrupt level 2
-DEF_TRAP (interrupt, 3) ! 19: Interrupt level 3
-DEF_TRAP (interrupt, 4) ! 20: Interrupt level 4
-DEF_TRAP (interrupt, 5) ! 21: Interrupt level 5
-DEF_TRAP (interrupt, 6) ! 22: Interrupt level 6
-DEF_TRAP (interrupt, 7) ! 23: Interrupt level 7
-DEF_TRAP (interrupt, 8) ! 24: Interrupt level 8
-DEF_TRAP (interrupt, 9) ! 25: Interrupt level 9
-DEF_TRAP (interrupt, 10) ! 26: Interrupt level 10
-DEF_TRAP (interrupt, 11) ! 27: Interrupt level 11
-DEF_TRAP (interrupt, 12) ! 28: Interrupt level 12
-DEF_TRAP (interrupt, 13) ! 29: Interrupt level 13
-DEF_TRAP (interrupt, 14) ! 30: Interrupt level 14
-DEF_TRAP (nmi, 15) ! 31: Interrupt level 15
-DEF_TRAP (bad_except, 32) ! 32: -
-DEF_TRAP (bad_except, 33) ! 33: -
-DEF_TRAP (bad_except, 34) ! 34: -
-DEF_TRAP (bad_except, 35) ! 35: -
-DEF_TRAP (bad_except, 36) ! 36: Coprocessor disabled
-DEF_TRAP (bad_except, 37) ! 37: -
-DEF_TRAP (bad_except, 38) ! 38: -
-DEF_TRAP (bad_except, 39) ! 39: -
-DEF_TRAP (bad_except, 40) ! 40: -
-DEF_TRAP (bad_except, 41) ! 41: -
-DEF_TRAP (bad_except, 42) ! 42: -
-DEF_TRAP (bad_except, 43) ! 43: -
-DEF_TRAP (bad_except, 44) ! 44: -
-DEF_TRAP (bad_except, 45) ! 45: -
-DEF_TRAP (bad_except, 46) ! 46: -
-DEF_TRAP (bad_except, 47) ! 47: -
-DEF_TRAP (bad_except, 48) ! 48: -
-DEF_TRAP (bad_except, 49) ! 49: -
-DEF_TRAP (bad_except, 50) ! 50: -
-DEF_TRAP (bad_except, 51) ! 51: -
-DEF_TRAP (bad_except, 52) ! 52: -
-DEF_TRAP (bad_except, 53) ! 53: -
-DEF_TRAP (bad_except, 54) ! 54: -
-DEF_TRAP (bad_except, 55) ! 55: -
-DEF_TRAP (bad_except, 56) ! 56: -
-DEF_TRAP (bad_except, 57) ! 57: -
-DEF_TRAP (bad_except, 58) ! 58: -
-DEF_TRAP (bad_except, 59) ! 59: -
-DEF_TRAP (bad_except, 60) ! 60: -
-DEF_TRAP (bad_except, 61) ! 61: -
-DEF_TRAP (bad_except, 62) ! 62: -
-DEF_TRAP (bad_except, 63) ! 63: -
-DEF_TRAP (bad_except, 64) ! 64: -
-DEF_TRAP (bad_except, 65) ! 65: -
-DEF_TRAP (bad_except, 66) ! 66: -
-DEF_TRAP (bad_except, 67) ! 67: -
-DEF_TRAP (bad_except, 68) ! 68: -
-DEF_TRAP (bad_except, 69) ! 69: -
-DEF_TRAP (bad_except, 70) ! 70: -
-DEF_TRAP (bad_except, 71) ! 71: -
-DEF_TRAP (bad_except, 72) ! 72: -
-DEF_TRAP (bad_except, 73) ! 73: -
-DEF_TRAP (bad_except, 74) ! 74: -
-DEF_TRAP (bad_except, 75) ! 75: -
-DEF_TRAP (bad_except, 76) ! 76: -
-DEF_TRAP (bad_except, 77) ! 77: -
-DEF_TRAP (bad_except, 78) ! 78: -
-DEF_TRAP (bad_except, 79) ! 79: -
-DEF_TRAP (bad_except, 80) ! 80: -
-DEF_TRAP (bad_except, 81) ! 81: -
-DEF_TRAP (bad_except, 82) ! 82: -
-DEF_TRAP (bad_except, 83) ! 83: -
-DEF_TRAP (bad_except, 84) ! 84: -
-DEF_TRAP (bad_except, 85) ! 85: -
-DEF_TRAP (bad_except, 86) ! 86: -
-DEF_TRAP (bad_except, 87) ! 87: -
-DEF_TRAP (bad_except, 88) ! 88: -
-DEF_TRAP (bad_except, 89) ! 89: -
-DEF_TRAP (bad_except, 90) ! 90: -
-DEF_TRAP (bad_except, 91) ! 91: -
-DEF_TRAP (bad_except, 92) ! 92: -
-DEF_TRAP (bad_except, 93) ! 93: -
-DEF_TRAP (bad_except, 94) ! 94: -
-DEF_TRAP (bad_except, 95) ! 95: -
-DEF_TRAP (bad_except, 96) ! 96: -
-DEF_TRAP (bad_except, 97) ! 97: -
-DEF_TRAP (bad_except, 98) ! 98: -
-DEF_TRAP (bad_except, 99) ! 99: -
-DEF_TRAP (bad_except, 100) ! 100: -
-DEF_TRAP (bad_except, 101) ! 101: -
-DEF_TRAP (bad_except, 102) ! 102: -
-DEF_TRAP (bad_except, 103) ! 103: -
-DEF_TRAP (bad_except, 104) ! 104: -
-DEF_TRAP (bad_except, 105) ! 105: -
-DEF_TRAP (bad_except, 106) ! 106: -
-DEF_TRAP (bad_except, 107) ! 107: -
-DEF_TRAP (bad_except, 108) ! 108: -
-DEF_TRAP (bad_except, 109) ! 109: -
-DEF_TRAP (bad_except, 110) ! 110: -
-DEF_TRAP (bad_except, 111) ! 111: -
-DEF_TRAP (bad_except, 112) ! 112: -
-DEF_TRAP (bad_except, 113) ! 113: -
-DEF_TRAP (bad_except, 114) ! 114: -
-DEF_TRAP (bad_except, 115) ! 115: -
-DEF_TRAP (bad_except, 116) ! 116: -
-DEF_TRAP (bad_except, 117) ! 117: -
-DEF_TRAP (bad_except, 118) ! 118: -
-DEF_TRAP (bad_except, 119) ! 119: -
-DEF_TRAP (bad_except, 120) ! 120: -
-DEF_TRAP (bad_except, 121) ! 121: -
-DEF_TRAP (bad_except, 122) ! 122: -
-DEF_TRAP (bad_except, 123) ! 123: -
-DEF_TRAP (bad_except, 124) ! 124: -
-DEF_TRAP (bad_except, 125) ! 125: -
-DEF_TRAP (bad_except, 126) ! 126: -
-DEF_TRAP (bad_except, 127) ! 127: -
-DEF_TRAP (bad_except, 128) ! 128: Trap instruction
-DEF_TRAP (bad_except, 129) ! 129: Trap instruction
-DEF_TRAP (bad_except, 130) ! 130: Trap instruction
-DEF_TRAP (bad_except, 131) ! 131: Trap instruction
-DEF_TRAP (bad_except, 132) ! 132: Trap instruction
-DEF_TRAP (bad_except, 133) ! 133: Trap instruction
-DEF_TRAP (bad_except, 134) ! 134: Trap instruction
-DEF_TRAP (bad_except, 135) ! 135: Trap instruction
-DEF_TRAP (bad_except, 136) ! 136: Trap instruction
-DEF_TRAP (bad_except, 137) ! 137: Trap instruction
-DEF_TRAP (bad_except, 138) ! 138: Trap instruction
-DEF_TRAP (bad_except, 139) ! 139: Trap instruction
-DEF_TRAP (bad_except, 140) ! 140: Trap instruction
-DEF_TRAP (bad_except, 141) ! 141: Trap instruction
-DEF_TRAP (bad_except, 142) ! 142: Trap instruction
-DEF_TRAP (bad_except, 143) ! 143: Trap instruction
-DEF_TRAP (bad_except, 144) ! 144: Trap instruction
-DEF_TRAP (bad_except, 145) ! 145: Trap instruction
-DEF_TRAP (bad_except, 146) ! 146: Trap instruction
-DEF_TRAP (bad_except, 147) ! 147: Trap instruction
-DEF_TRAP (bad_except, 148) ! 148: Trap instruction
-DEF_TRAP (bad_except, 149) ! 149: Trap instruction
-DEF_TRAP (bad_except, 150) ! 150: Trap instruction
-DEF_TRAP (bad_except, 151) ! 151: Trap instruction
-DEF_TRAP (bad_except, 152) ! 152: Trap instruction
-DEF_TRAP (bad_except, 153) ! 153: Trap instruction
-DEF_TRAP (bad_except, 154) ! 154: Trap instruction
-DEF_TRAP (bad_except, 155) ! 155: Trap instruction
-DEF_TRAP (bad_except, 156) ! 156: Trap instruction
-DEF_TRAP (bad_except, 157) ! 157: Trap instruction
-DEF_TRAP (bad_except, 158) ! 158: Trap instruction
-DEF_TRAP (bad_except, 159) ! 159: Trap instruction
-DEF_TRAP (bad_except, 160) ! 160: Trap instruction
-DEF_TRAP (bad_except, 161) ! 161: Trap instruction
-DEF_TRAP (bad_except, 162) ! 162: Trap instruction
-DEF_TRAP (bad_except, 163) ! 163: Trap instruction
-DEF_TRAP (bad_except, 164) ! 164: Trap instruction
-DEF_TRAP (bad_except, 165) ! 165: Trap instruction
-DEF_TRAP (bad_except, 166) ! 166: Trap instruction
-DEF_TRAP (bad_except, 167) ! 167: Trap instruction
-DEF_TRAP (bad_except, 168) ! 168: Trap instruction
-DEF_TRAP (bad_except, 169) ! 169: Trap instruction
-DEF_TRAP (bad_except, 170) ! 170: Trap instruction
-DEF_TRAP (bad_except, 171) ! 171: Trap instruction
-DEF_TRAP (bad_except, 172) ! 172: Trap instruction
-DEF_TRAP (bad_except, 173) ! 173: Trap instruction
-DEF_TRAP (bad_except, 174) ! 174: Trap instruction
-DEF_TRAP (bad_except, 175) ! 175: Trap instruction
-DEF_TRAP (bad_except, 176) ! 176: Trap instruction
-DEF_TRAP (bad_except, 177) ! 177: Trap instruction
-DEF_TRAP (bad_except, 178) ! 178: Trap instruction
-DEF_TRAP (bad_except, 179) ! 179: Trap instruction
-DEF_TRAP (bad_except, 180) ! 180: Trap instruction
-DEF_TRAP (bad_except, 181) ! 181: Trap instruction
-DEF_TRAP (bad_except, 182) ! 182: Trap instruction
-DEF_TRAP (bad_except, 183) ! 183: Trap instruction
-DEF_TRAP (bad_except, 184) ! 184: Trap instruction
-DEF_TRAP (bad_except, 185) ! 185: Trap instruction
-DEF_TRAP (bad_except, 186) ! 186: Trap instruction
-DEF_TRAP (bad_except, 187) ! 187: Trap instruction
-DEF_TRAP (bad_except, 188) ! 188: Trap instruction
-DEF_TRAP (bad_except, 189) ! 189: Trap instruction
-DEF_TRAP (bad_except, 190) ! 190: Trap instruction
-DEF_TRAP (bad_except, 191) ! 191: Trap instruction
-DEF_TRAP (bad_except, 192) ! 192: Trap instruction
-DEF_TRAP (bad_except, 193) ! 193: Trap instruction
-DEF_TRAP (bad_except, 194) ! 194: Trap instruction
-DEF_TRAP (bad_except, 195) ! 195: Trap instruction
-DEF_TRAP (bad_except, 196) ! 196: Trap instruction
-DEF_TRAP (bad_except, 197) ! 197: Trap instruction
-DEF_TRAP (bad_except, 198) ! 198: Trap instruction
-DEF_TRAP (bad_except, 199) ! 199: Trap instruction
-DEF_TRAP (bad_except, 200) ! 200: Trap instruction
-DEF_TRAP (bad_except, 201) ! 201: Trap instruction
-DEF_TRAP (bad_except, 202) ! 202: Trap instruction
-DEF_TRAP (bad_except, 203) ! 203: Trap instruction
-DEF_TRAP (bad_except, 204) ! 204: Trap instruction
-DEF_TRAP (bad_except, 205) ! 205: Trap instruction
-DEF_TRAP (bad_except, 206) ! 206: Trap instruction
-DEF_TRAP (bad_except, 207) ! 207: Trap instruction
-DEF_TRAP (bad_except, 208) ! 208: Trap instruction
-DEF_TRAP (bad_except, 209) ! 209: Trap instruction
-DEF_TRAP (bad_except, 210) ! 210: Trap instruction
-DEF_TRAP (bad_except, 211) ! 211: Trap instruction
-DEF_TRAP (bad_except, 212) ! 212: Trap instruction
-DEF_TRAP (bad_except, 213) ! 213: Trap instruction
-DEF_TRAP (bad_except, 214) ! 214: Trap instruction
-DEF_TRAP (bad_except, 215) ! 215: Trap instruction
-DEF_TRAP (bad_except, 216) ! 216: Trap instruction
-DEF_TRAP (bad_except, 217) ! 217: Trap instruction
-DEF_TRAP (bad_except, 218) ! 218: Trap instruction
-DEF_TRAP (bad_except, 219) ! 219: Trap instruction
-DEF_TRAP (bad_except, 220) ! 220: Trap instruction
-DEF_TRAP (bad_except, 221) ! 221: Trap instruction
-DEF_TRAP (bad_except, 222) ! 222: Trap instruction
-DEF_TRAP (bad_except, 223) ! 223: Trap instruction
-DEF_TRAP (bad_except, 224) ! 224: Trap instruction
-DEF_TRAP (bad_except, 225) ! 225: Trap instruction
-DEF_TRAP (bad_except, 226) ! 226: Trap instruction
-DEF_TRAP (bad_except, 227) ! 227: Trap instruction
-DEF_TRAP (bad_except, 228) ! 228: Trap instruction
-DEF_TRAP (bad_except, 229) ! 229: Trap instruction
-DEF_TRAP (bad_except, 230) ! 230: Trap instruction
-DEF_TRAP (bad_except, 231) ! 231: Trap instruction
-DEF_TRAP (bad_except, 232) ! 232: Trap instruction
-DEF_TRAP (bad_except, 233) ! 233: Trap instruction
-DEF_TRAP (bad_except, 234) ! 234: Trap instruction
-DEF_TRAP (bad_except, 235) ! 235: Trap instruction
-DEF_TRAP (bad_except, 236) ! 236: Trap instruction
-DEF_TRAP (bad_except, 237) ! 237: Trap instruction
-DEF_TRAP (bad_except, 238) ! 238: Trap instruction
-DEF_TRAP (bad_except, 239) ! 239: Trap instruction
-DEF_TRAP (bad_except, 240) ! 240: Trap instruction
-DEF_TRAP (bad_except, 241) ! 241: Trap instruction
-DEF_TRAP (bad_except, 242) ! 242: Trap instruction
-DEF_TRAP (bad_except, 243) ! 243: Trap instruction
-DEF_TRAP (bad_except, 244) ! 244: Trap instruction
-DEF_TRAP (bad_except, 245) ! 245: Trap instruction
-DEF_TRAP (bad_except, 246) ! 246: Trap instruction
-DEF_TRAP (bad_except, 247) ! 247: Trap instruction
-DEF_TRAP (bad_except, 248) ! 248: Trap instruction
-DEF_TRAP (bad_except, 249) ! 249: Trap instruction
-DEF_TRAP (bad_except, 250) ! 250: Trap instruction
-DEF_TRAP (bad_except, 251) ! 251: Trap instruction
-DEF_TRAP (bad_except, 252) ! 252: Trap instruction
-DEF_TRAP (bad_except, 253) ! 253: Trap instruction
-DEF_TRAP (bad_except, 254) ! 254: Trap instruction
-DEF_TRAP (bad_except, 255) ! 255: Trap instruction
-
- .reserve trapstack, 1000 * 4, "bss", 8
-
- .data
- .align 4
-
- .globl _in_trap_handler
-_in_trap_handler:
-in_trap_handler:
- .word 0
-
- .globl _debug_tbr
-_debug_tbr:
- .word 0
- .globl _debug_ret
-_debug_ret:
- .word 0
-
- .globl _nofault
-_nofault:
- .word 0
-
-led_xlat:
- .byte LED_0
- .byte LED_1
- .byte LED_2
- .byte LED_3
- .byte LED_4
- .byte LED_5
- .byte LED_6
- .byte LED_7
- .byte LED_8
- .byte LED_9
- .byte LED_A
- .byte LED_b
- .byte LED_C
- .byte LED_d
- .byte LED_E
- .byte LED_F
-
- .text
- .align 4
-
-
-#if 0
-excpt_dataaccess:
- ! %l3 contains the trap number.
- ! Disp it on the leds.
-
- ! Load the led table addressin %l4
- sethi %hi(led_xlat), %l4
- or %l4, %lo(led_xlat), %l4
-
- ! Convert %l3 into a led half word.
- and %l3, 0x0f, %l5
- ldub [%l4 + %l5], %l5
- srl %l3, 4, %l3
- and %l3, 0x0f, %l3
- ldub [%l4 + %l3], %l3
- and %l3, LED_DP, %l3
- sll %l3, 8, %l3
- or %l3, %l5, %l3
-
- ! Disp it on the led
- stha %l3, [%g0](0xc1)
-
- lda [%g0](0x81), %l3
- lda [%g0](0x82), %g0
- sethi %hi(_nofault), %l3
- st %g0, [%l3 + %lo(_nofault)]
-
- ! Return to the next instruction
- jmp %l2
- rett %l2 + 4
-#endif
-! This function is called when any SPARC trap (except window overflow or
-! underflow) occurs. It makes sure that the invalid register window is still
-! available before jumping into C code. It will also restore the world if you
-! return from handle_exception.
-
-! %l1 contains %pc
-! %l2 contains %npc
- .globl bad_except
-bad_except:
-interrupt:
- rd %psr, %l0
-#if 1
- ! %l3 contains the trap number.
- ! Disp it on the leds.
-
- ! Load the led table addressin %l4
- sethi %hi(led_xlat), %l4
- or %l4, %lo(led_xlat), %l4
-
- ! Convert %l3 into a led half word.
- and %l3, 0x0f, %l5
- ldub [%l4 + %l5], %l5
- srl %l3, 4, %l3
- and %l3, 0x0f, %l3
- ldub [%l4 + %l3], %l3
- and %l3, LED_DP, %l3
- sll %l3, 8, %l3
- or %l3, %l5, %l3
-
- ! Disp it on the led
- stha %l3, [%g0](ASI_LED)
-#endif
-#if 0
- ! Return
- jmp %l2
- rett %l2 + 4
-
- ! Wait for ever.
-1:
- b 1b
- nop
-#endif
-
- mov %wim, %l3
-
- ! Read FCR and FVAR now, otherwise data access to memory is disabled.
- lda [%g0](ASI_FCR), %l6
- lda [%g0](ASI_FVAR), %l7
-
- srl %l3, %l0, %l4 ! wim >> cwp
- cmp %l4, 1
- bne window_fine ! Branch if not in the invalid window
- nop
-
-! Handle window overflow
- mov %g1, %l4
- sll %l3, 1, %g1 ! Rotate wim left
- srl %l3, __WINSIZE-1, %l3
- or %g1, %l3, %g1
-
- save %g0, %g0, %g0 ! Slip into next window
- mov %g1, %wim ! Install the new wim
-
- std %l0, [%sp + 0 * 4] ! save L & I registers
- std %l2, [%sp + 2 * 4]
- std %l4, [%sp + 4 * 4]
- std %l6, [%sp + 6 * 4]
-
- std %i0, [%sp + 8 * 4]
- std %i2, [%sp + 10 * 4]
- std %i4, [%sp + 12 * 4]
- std %i6, [%sp + 14 * 4]
-
- restore ! Go back to trap window.
- mov %l4, %g1 ! Restore %g1
-
-window_fine:
- sethi %hi(in_trap_handler), %l4
- ld [%lo(in_trap_handler) + %l4], %l5
- tst %l5
- bg recursive_trap
- inc %l5
-
- set trapstack+1000*4, %sp ! Switch to trap stack
-
-recursive_trap:
- st %l5, [%lo(in_trap_handler) + %l4]
- sub %sp,(16+1+6+1+80)*4,%sp ! Make room for input & locals
- ! + hidden arg + arg spill
- ! + doubleword alignment
- ! + registers[72] local var
-
- std %g0, [%sp + (24 + 0) * 4] ! registers[Gx]
- std %g2, [%sp + (24 + 2) * 4]
- std %g4, [%sp + (24 + 4) * 4]
- std %g6, [%sp + (24 + 6) * 4]
-
- std %i0, [%sp + (24 + 8) * 4] ! registers[Ox]
- std %i2, [%sp + (24 + 10) * 4]
- std %i4, [%sp + (24 + 12) * 4]
- std %i6, [%sp + (24 + 14) * 4]
-
- mov %y, %l4
- mov %tbr, %l5
- st %l4, [%sp + (24 + 64) * 4] ! Y
- st %l0, [%sp + (24 + 65) * 4] ! PSR
- st %l3, [%sp + (24 + 66) * 4] ! WIM
- st %l5, [%sp + (24 + 67) * 4] ! TBR
- st %l1, [%sp + (24 + 68) * 4] ! PC
- st %l2, [%sp + (24 + 69) * 4] ! NPC
-
- or %l0, 0xf20, %l4
- mov %l4, %psr ! Turn on traps, disable interrupts
- nop
- nop
- nop
-
- set 0x1000, %l1
- btst %l1, %l0 ! FP enabled?
- be no_fpstore
- nop
-
-! Must save fsr first, to flush the FQ. This may cause a deferred fp trap, so
-! traps must be enabled to allow the trap handler to clean things up.
-
- st %fsr, [%sp + (24 + 70) * 4]
-
- std %f0, [%sp + (24 + 32) * 4]
- std %f2, [%sp + (24 + 34) * 4]
- std %f4, [%sp + (24 + 36) * 4]
- std %f6, [%sp + (24 + 38) * 4]
- std %f8, [%sp + (24 + 40) * 4]
- std %f10, [%sp + (24 + 42) * 4]
- std %f12, [%sp + (24 + 44) * 4]
- std %f14, [%sp + (24 + 46) * 4]
- std %f16, [%sp + (24 + 48) * 4]
- std %f18, [%sp + (24 + 50) * 4]
- std %f20, [%sp + (24 + 52) * 4]
- std %f22, [%sp + (24 + 54) * 4]
- std %f24, [%sp + (24 + 56) * 4]
- std %f26, [%sp + (24 + 58) * 4]
- std %f28, [%sp + (24 + 60) * 4]
- std %f30, [%sp + (24 + 62) * 4]
-no_fpstore:
-
-! call _get_in_break_mode
-! nop
-
- lda [%g0](ASI_MMCR), %l4
- st %l4, [%sp + (24 + 72) * 4]
-! Disable mmu
-! andn %l4, 1, %l4
-! sta %l4, [%g0](ASI_MMCR)
- st %l6, [%sp + (24 + 73) * 4]
- st %l7, [%sp + (24 + 74) * 4]
- lda [%g0](ASI_PDBA), %l4
- st %l4, [%sp + (24 + 75) * 4]
- lda [%g0](ASI_FPAR), %l4
- st %l4, [%sp + (24 + 76) * 4]
- lda [%g0](ASI_FTOR), %l4
- st %l4, [%sp + (24 + 77) * 4]
- lduha [%g0](ASI_FES), %l4
- st %l4, [%sp + (24 + 78) * 4]
- lda [%g0](ASI_FTSR), %l4
- st %l4, [%sp + (24 + 79) * 4]
-
- call _handle_exception
- add %sp, 24 * 4, %o0 ! Pass address of registers
-
-! Reload all of the registers that are not on the stack
-
- ld [%sp + (24 + 1) * 4], %g1 ! registers[Gx]
- ldd [%sp + (24 + 2) * 4], %g2
- ldd [%sp + (24 + 4) * 4], %g4
- ldd [%sp + (24 + 6) * 4], %g6
-
- ldd [%sp + (24 + 8) * 4], %i0 ! registers[Ox]
- ldd [%sp + (24 + 10) * 4], %i2
- ldd [%sp + (24 + 12) * 4], %i4
- ldd [%sp + (24 + 14) * 4], %i6
-
-! set 0xff00, %l2
-! ldd [%sp + (24 + 72) * 4], %l4
-! stda %l4, [%l2]0x1 ! DIA1, debug instr addr 1
- ! DIA2, debug instr addr 2
-! inc 8, %l2
-! ldd [%sp + (24 + 74) * 4], %l4
-! stda %l4, [%l2]0x1 ! DDA1, debug data addr 1
- ! DDA2, debug data addr 2
-! inc 8, %l2
-! ldd [%sp + (24 + 76) * 4], %l4
-! stda %l4, [%l2]0x1 ! DDV1, debug data value 1
- ! DDV2, debug data val 2
-! inc 8, %l2
-! ldd [%sp + (24 + 78) * 4], %l4
-! bset 0x200, %l4
-! stda %l4, [%l2]0x1 ! DCR, debug control reg
- ! DSR, debug control reg
-
-
- ldd [%sp + (24 + 64) * 4], %l0 ! Y & PSR
- ldd [%sp + (24 + 68) * 4], %l2 ! PC & NPC
-
- set 0x1000, %l5
- btst %l5, %l1 ! FP enabled?
- be no_fpreload
- nop
-
- ldd [%sp + (24 + 32) * 4], %f0
- ldd [%sp + (24 + 34) * 4], %f2
- ldd [%sp + (24 + 36) * 4], %f4
- ldd [%sp + (24 + 38) * 4], %f6
- ldd [%sp + (24 + 40) * 4], %f8
- ldd [%sp + (24 + 42) * 4], %f10
- ldd [%sp + (24 + 44) * 4], %f12
- ldd [%sp + (24 + 46) * 4], %f14
- ldd [%sp + (24 + 48) * 4], %f16
- ldd [%sp + (24 + 50) * 4], %f18
- ldd [%sp + (24 + 52) * 4], %f20
- ldd [%sp + (24 + 54) * 4], %f22
- ldd [%sp + (24 + 56) * 4], %f24
- ldd [%sp + (24 + 58) * 4], %f26
- ldd [%sp + (24 + 60) * 4], %f28
- ldd [%sp + (24 + 62) * 4], %f30
-
- ld [%sp + (24 + 70) * 4], %fsr
-no_fpreload:
-
- restore ! Ensure that previous window is valid
- save %g0, %g0, %g0 ! by causing a window_underflow trap
-
-
- mov %l1, %psr ! Make sure that traps are disabled
- ! for rett
- mov %l0, %y
- nop
-
- sethi %hi(in_trap_handler), %l4
- ld [%lo(in_trap_handler) + %l4], %l5
- dec %l5
- st %l5, [%lo(in_trap_handler) + %l4]
-
- jmpl %l2, %g0 ! Restore old PC
- rett %l3 ! Restore old nPC
-
- .text
- .align 4
-
-! Register window overflow handler. Come here when save would move us
-! into the invalid window. This routine runs with traps disabled, and
-! must be careful not to touch the condition codes, as PSR is never
-! restored.
-!
-! We are called with %l0 = wim, %l1 = pc, %l2 = npc
-win_ovf:
- save %g0, %g0, %g0
- std %l0, [%sp + (0*8)]
- rd %psr, %l0
- mov 1, %l1
- sll %l1, %l0, %l0
- wr %l0, 0, %wim
- std %l2, [%sp + (1*8)]
- std %l4, [%sp + (2*8)]
- std %l6, [%sp + (3*8)]
- std %i0, [%sp + (4*8)]
- std %i2, [%sp + (5*8)]
- std %i4, [%sp + (6*8)]
- std %i6, [%sp + (7*8)]
- restore
- jmpl %l1, %g0
- rett %l2
-
-! Register window underflow handler. Come here when restore would move us
-! into the invalid window. This routine runs with traps disabled, and
-! must be careful not to touch the condition codes, as PSR is never
-! restored.
-!
-! We are called with %l0 = wim, %l1 = pc, %l2 = npc
-win_unf:
- sll %l0, 1, %l3 ! Rotate wim left
- srl %l0, __WINSIZE-1, %l0
- or %l0, %l3, %l0
-
- mov %l0, %wim ! Install the new wim
-
- restore ! User window
- restore ! His caller window
-
- ldd [%sp + 0 * 4], %l0 ! restore L & I registers
- ldd [%sp + 2 * 4], %l2
- ldd [%sp + 4 * 4], %l4
- ldd [%sp + 6 * 4], %l6
-
- ldd [%sp + 8 * 4], %i0
- ldd [%sp + 10 * 4], %i2
- ldd [%sp + 12 * 4], %i4
- ldd [%sp + 14 * 4], %i6
-
- save %g0, %g0, %g0 ! Back to trap window
- save %g0, %g0, %g0
-
- jmpl %l1, %g0
- rett %l2
-
- .globl chk_data_tlbmiss
-chk_data_tlbmiss:
- ! Save PSR.
- rd %psr, %l0
-
- ! Read fault cause register.
- lda [ %g0 ] (0x81), %l7
-
- ! If nofault is null, go to bad_except.
- sethi %hi(_nofault), %l6
- ld [%l6 + %lo(_nofault)], %l5
- cmp %l5, %g0
- be 1f
- st %g0, [%l6 + %lo(_nofault)]
-
- ! Test if this is a tlb miss exception.
- btst 128, %l7
- bne,a have_data_tlbmiss
- lda [ %g0 ] (0x83), %l3
-1: rd %wim, %l0
- b interrupt
- mov 9, %l3
-
-have_data_tlbmiss:
- ! This is a tlb miss exception.
- ! %l3 now contains the page directory base register.
- ! Test if bit 2 is set.
- btst 2, %l3
- bne clean_data_tlbmiss
-
- ! Read the fault virtual address.
- lda [ %g0 ] (0x82), %l4
-
- ! Read the corresponding pde.
- srl %l4, 23, %l5
- sll %l5, 3, %l5
- ldd [ %l3 + %l5 ], %l6
-
- ! Store the pte into the cache.
- sta %l7, [ %l6 ] (0xaa)
-
- ! Read the pte corresponding to the virtual address.
- ! And store it into the cache.
- srl %l4, 11, %l5
- and %l5, 0xffc, %l5
- ld [ %l6 + %l5 ], %l7
- andn %l4, 3, %l4
- sta %l7, [ %l4 ] (0xaa)
-
- ! Return.
- wr %l0, %g0, %psr
- jmp %l1
- rett %l2
- nop
-clean_data_tlbmiss:
- andn %l3, 2, %l3
- srl %l4, 23, %l5
- sll %l5, 3, %l5
- ldd [ %l3 + %l5 ], %l6
- sta %l7, [ %l6 ] (0xaa)
- srl %l4, 11, %l5
- and %l5, 0xffc, %l5
- ld [ %l6 + %l5 ], %l7
- andn %l4, 3, %l4
- sta %l7, [ %l4 ] (0xaa)
- mov 1, %l5
- and %l0, 31, %l6
- sll %l5, %l6, %l5
- rd %wim, %l3
- btst %l5, %l3
- be data_must_clean
- wr %l0, %g0, %psr
- jmp %l1
- rett %l2
- nop
-data_must_clean:
- mov %l1, %sp
- mov %l2, %o7
- mov %g0, %l0
- mov %g0, %l1
- mov %g0, %l2
- mov %g0, %l3
- mov %g0, %l4
- mov %g0, %l5
- mov %g0, %l6
- mov %g0, %l7
- jmp %sp
- rett %o7
- nop
-
-nmi:
- set 400000, %l6
-nmi2:
- lda [%g0](ASI_BID), %l7
- deccc %l6
- be nmi3
- btst BID_NMI, %l7
- bne nmi2
- nop
- b nmi
- nop
-nmi3:
- set (LED_t << 8) | LED_1, %l0
- stha %l0, [%g0](ASI_LED)
-
- .globl _rom_reset
-_rom_reset:
- /*
- * like Startup. */
-
- ! Disable the mmu.
- lda [%g0] (ASI_MMCR), %o1
- andn %o1, MMCR_ME, %o1
- sta %o1, [%g0] (ASI_MMCR)
-
- ! Invalidate FTLB & GTLB.
- sta %g0, [%g0] (ASI_FGTLB_INV) ! 0x87
-
- ! Read the fault virtual address reg.
- lda [%g0] (ASI_FVAR), %g0
-
- ! Read the fault physical address reg.
- lda [%g0] (ASI_FPAR), %g0
-
- ! Read the fault time out reg.
- lda [%g0] (ASI_FTOR), %g0
-
- rd %psr, %g3 ! paranoia: make sure ...
- andn %g3, PSR_ET, %g3 ! we have traps off
- wr %g3, 0, %psr ! so that we can fiddle safely
- nop; nop; nop
-
- wr %g0, 0, %wim ! make sure we can set psr
- nop; nop; nop
- wr %g0, PSR_S|PSR_PS|PSR_PIL, %psr ! set initial psr
- nop; nop; nop
-
- wr %g0, 2, %wim ! set initial %wim (w1 invalid)
-
-! set USRSTACK - CCFSZ, %fp ! as if called from user code
-! set estack0 - CCFSZ - 80, %sp ! via syscall(boot_me_up) or somesuch
- rd %psr, %l0
- wr %l0, PSR_ET, %psr
- nop; nop; nop
-
-1: call __exit
- nop
- b 1b
- nop
-
-! Reset entry point
-real_start:
- ! Disp on the led (=0)
- sethi %hi(0xb6c0), %l1
- or %l1, %lo(0xB6c0), %l1
- stha %l1, [%g0](0xc1)
-
- ! Save the return point
- sethi %hi(_debug_ret), %l1
- st %o7, [%l1 + %lo(_debug_ret)]
-
- ! Just change the new TBR.
- mov %tbr, %l0
- sethi %hi(_debug_tbr), %l1
- st %l0, [%l1 + %lo(_debug_tbr)]
- sethi %hi(start), %l1
- wr %l1, %lo(start), %tbr
- nop
- nop
- nop
-
- ! Misc info
-! mov %sp, %o0
- ld [%sp + 0x5c], %o0
- ld [%sp + 0x60], %o1
- ld [%sp + 0x64], %o2
-
- ! Call main
- call _main
- nop
-
- ! Exit
- call __exit
- nop
- ret
-
- .globl _set_ipl
-_set_ipl:
- rd %psr, %o1
- andn %o1, 0xf00, %o1
- and %o0, 0x0f, %o0
- sll %o0, 8, %o0
- wr %o0, %o1, %psr
- nop
- nop
- nop
- retl
- nop
diff --git a/sys/arch/kbus/stand/sk/dev_disk.c b/sys/arch/kbus/stand/sk/dev_disk.c
deleted file mode 100644
index d038f7def29..00000000000
--- a/sys/arch/kbus/stand/sk/dev_disk.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/* $OpenBSD: dev_disk.c,v 1.2 2000/03/03 00:54:51 todd Exp $ */
-
-/*
- * Copyright (c) 1993 Paul Kranenburg
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Paul Kranenburg.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This module implements a "raw device" interface suitable for
- * use by the stand-alone I/O library UFS file-system code, and
- * possibly for direct access (i.e. boot from tape).
- *
- * The implementation is deceptively simple because it uses the
- * drivers provided by the Sun PROM monitor. Note that only the
- * PROM driver used to load the boot program is available here.
- */
-
-#include <sys/types.h>
-#include <machine/mon.h>
-#include <machine/saio.h>
-
-#include "stand.h"
-
-#include "dvma.h"
-#include "promdev.h"
-
-int
-disk_open(f, devname)
- struct open_file *f;
- char *devname; /* Device part of file name (or NULL). */
-{
- struct saioreq *sip;
- int error;
-
-#ifdef DEBUG_PROM
- printf("disk_open: %s\n", devname);
-#endif
-
- if ((error = prom_iopen(&sip)) != 0)
- return (error);
-
- f->f_devdata = sip;
- return 0;
-}
-
-int
-disk_close(f)
- struct open_file *f;
-{
- struct saioreq *sip;
-
- sip = f->f_devdata;
- prom_iclose(sip);
- f->f_devdata = NULL;
- return 0;
-}
-
-int
-disk_strategy(devdata, flag, dblk, size, buf, rsize)
- void *devdata;
- int flag;
- daddr_t dblk;
- u_int size;
- char *buf;
- u_int *rsize;
-{
- struct saioreq *si;
- struct boottab *ops;
- char *dmabuf;
- int si_flag, xcnt;
-
- si = devdata;
- ops = si->si_boottab;
-
-#ifdef DEBUG_PROM
- printf("disk_strategy: size=%d dblk=%d\n", size, dblk);
-#else
- twiddle();
-#endif
-
- dmabuf = dvma_mapin(buf, size);
-
- si->si_bn = dblk;
- si->si_ma = dmabuf;
- si->si_cc = size;
-
- si_flag = (flag == F_READ) ? SAIO_F_READ : SAIO_F_WRITE;
- xcnt = (*ops->b_strategy)(si, si_flag);
- dvma_mapout(dmabuf, size);
-
-#ifdef DEBUG_PROM
- printf("disk_strategy: xcnt = %x\n", xcnt);
-#endif
-
- if (xcnt <= 0)
- return (EIO);
-
- *rsize = xcnt;
- return (0);
-}
-
-int
-disk_ioctl()
-{
- return EIO;
-}
-
diff --git a/sys/arch/kbus/stand/sk/dev_disk.h b/sys/arch/kbus/stand/sk/dev_disk.h
deleted file mode 100644
index 9f05f74bd82..00000000000
--- a/sys/arch/kbus/stand/sk/dev_disk.h
+++ /dev/null
@@ -1,6 +0,0 @@
-
-int disk_open __P((struct open_file *, ...));
-int disk_close __P((struct open_file *));
-int disk_strategy __P((void *, int, daddr_t, u_int, char *, u_int *));
-int disk_ioctl();
-
diff --git a/sys/arch/kbus/stand/sk/dev_net.c b/sys/arch/kbus/stand/sk/dev_net.c
deleted file mode 100644
index 4a200a45360..00000000000
--- a/sys/arch/kbus/stand/sk/dev_net.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/* $OpenBSD: dev_net.c,v 1.3 2000/03/03 00:54:51 todd Exp $ */
-
-/*
- * Copyright (c) 1995 Gordon W. Ross
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- * 4. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Gordon W. Ross
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This module implements a "raw device" interface suitable for
- * use by the stand-alone I/O library NFS code. This interface
- * does not support any "block" access, and exists only for the
- * purpose of initializing the network interface, getting boot
- * parameters, and performing the NFS mount.
- *
- * At open time, this does:
- *
- * find interface - netif_open()
- * RARP for IP address - rarp_getipaddress()
- * RPC/bootparams - callrpc(d, RPC_BOOTPARAMS, ...)
- * RPC/mountd - nfs_mount(sock, ip, path)
- *
- * the root file handle from mountd is saved in a global
- * for use by the NFS open code (NFS/lookup).
- */
-
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-#include <netinet/in_systm.h>
-
-#include "stand.h"
-#include "net.h"
-#include "netif.h"
-#include "config.h"
-#include "bootparam.h"
-
-extern int nfs_root_node[]; /* XXX - get from nfs_mount() */
-
-struct in_addr myip, rootip, gateip, mask;
-char rootpath[FNAME_SIZE];
-
-int netdev_sock = -1;
-static int open_count;
-
-extern char *getenv (const char *);
-
-/*
- * Called by devopen after it sets f->f_dev to our devsw entry.
- * This opens the low-level device and sets f->f_devdata.
- */
-int
-net_open(f, devname)
- struct open_file *f;
- char *devname; /* Device part of file name (or NULL). */
-{
- int error = 0;
-
- /* On first open, do netif open, mount, etc. */
- if (open_count == 0) {
- /* Find network interface. */
- if ((netdev_sock = netif_open(devname)) < 0)
- return (error=ENXIO);
- if ((error = net_mountroot(f, devname)) != 0)
- return (error);
- }
- open_count++;
- f->f_devdata = nfs_root_node;
- return (error);
-}
-
-int
-net_close(f)
- struct open_file *f;
-{
- /* On last close, do netif close, etc. */
- if (open_count > 0)
- if (--open_count == 0)
- netif_close(netdev_sock);
- f->f_devdata = NULL;
-}
-
-int
-net_ioctl()
-{
- return EIO;
-}
-
-int
-net_strategy()
-{
- return EIO;
-}
-
-int
-net_mountroot(f, devname)
- struct open_file *f;
- char *devname; /* Device part of file name (or NULL). */
-{
- int error;
-
-#ifdef DEBUG
- printf("net_mountroot: %s\n", devname);
-#endif
-
- /*
- * Get info for NFS boot: our IP address, our hostname,
- * server IP address, and our root path on the server.
- * There are two ways to do this: The old, Sun way,
- * and the more modern, BOOTP way. (RFC951, RFC1048)
- */
-
-#ifdef SUN_BOOTPARAMS
- /* Get boot info using RARP and Sun bootparams. */
-
- /* Get our IP address. (rarp.c) */
- if (rarp_getipaddress(netdev_sock) == -1)
- return (EIO);
- printf("boot: client IP address: %s\n", intoa(myip.s_addr));
-
- /* Get our hostname, server IP address. */
- if (bp_whoami(netdev_sock))
- return (EIO);
- printf("boot: client name: %s\n", hostname);
-
- /* Get the root pathname. */
- if (bp_getfile(netdev_sock, "root", &rootip, rootpath))
- return (EIO);
-
-#else
-
- /* Get boot info using BOOTP way. (RFC951, RFC1048) */
- bootp(netdev_sock);
-
- printf("Using IP address: %s\n", intoa(myip.s_addr));
-
- printf("myip: %s (%s)", hostname, intoa(myip));
- if (gateip)
- printf(", gateip: %s", intoa(gateip));
- if (mask)
- printf(", mask: %s", intoa(mask));
- printf("\n");
-
-#endif
-
- printf("root addr=%s path=%s\n", intoa(rootip.s_addr), rootpath);
-
- /* Get the NFS file handle (mount). */
- error = nfs_mount(netdev_sock, rootip, rootpath);
-
- return (error);
-}
-
-/*
- * machdep_common_ether: get ethernet address
- */
-void
-machdep_common_ether(ether)
- u_char *ether;
-{
- char *ea = getenv ("ENETADDR");
- u_char c;
- int i;
-
- if (ea == NULL)
- panic ("ERROR: ethernet address not set!");
- else
- printf ("Try to parse %s\n", ea);
-
- for (i = 0; i < 6; i++)
- {
- if (*ea >= '0' && *ea <= '9')
- c = *ea - '0';
- else if (*ea >= 'a' && *ea <= 'f')
- c = *ea - 'a' + 10;
- else if (*ea >= 'A' && *ea <= 'F')
- c = *ea - 'A' + 10;
- else
- panic ("Bad character for enet addr (%s)", ea);
- ea++;
- if (i == 5 && *ea == 0)
- break;
- if (i < 5 && *ea == ':')
- {
- *ether++ = c;
- ea++;
- continue;
- }
- c <<= 4;
- if (*ea >= '0' && *ea <= '9')
- c |= *ea - '0';
- else if (*ea >= 'a' && *ea <= 'f')
- c |= *ea - 'a' + 10;
- else if (*ea >= 'A' && *ea <= 'F')
- c |= *ea - 'A' + 10;
- else
- panic ("Bad character for enet addr (%s)", ea);
- ea++;
- if (i != 5 && *ea != ':')
- panic ("Bad character for enet addr (%s)", ea);
- ea++;
- *ether++ = c;
- }
-
-}
diff --git a/sys/arch/kbus/stand/sk/dev_net.h b/sys/arch/kbus/stand/sk/dev_net.h
deleted file mode 100644
index 093ba193bfd..00000000000
--- a/sys/arch/kbus/stand/sk/dev_net.h
+++ /dev/null
@@ -1,6 +0,0 @@
-
-int net_open __P((struct open_file *, ...));
-int net_close __P((struct open_file *));
-int net_ioctl();
-int net_strategy();
-
diff --git a/sys/arch/kbus/stand/sk/devopen.c b/sys/arch/kbus/stand/sk/devopen.c
deleted file mode 100644
index 92c083983cb..00000000000
--- a/sys/arch/kbus/stand/sk/devopen.c
+++ /dev/null
@@ -1,32 +0,0 @@
-
-#include <sys/param.h>
-#include <stand.h>
-#include "promboot.h"
-
-/*
- * Open the device named by the combined device/file name
- * given as the "fname" arg, something like: "sd()bsd"
- *
- * However, Sun PROMs don't really let you choose which
- * device you will talk to. You can only open the device
- * that was used to load the boot program. Therefore, we
- * do not accept a "device" part in the "fname" string.
- * Pass the PROM device name to open in case it needs it.
- */
-int
-devopen(f, fname, file)
- struct open_file *f;
- const char *fname;
- char **file;
-{
- struct devsw *dp;
- char *cp, *path, *devname;
- int error;
-
- *file = (char*)fname;
- dp = &devsw[0];
- f->f_dev = dp;
- error = (*dp->dv_open)(f, prom_bootdev);
-
- return (error);
-}
diff --git a/sys/arch/kbus/stand/sk/disp-asi.c b/sys/arch/kbus/stand/sk/disp-asi.c
deleted file mode 100644
index 7510644f842..00000000000
--- a/sys/arch/kbus/stand/sk/disp-asi.c
+++ /dev/null
@@ -1,644 +0,0 @@
-#include <stdio.h>
-#include <sys/types.h>
-#include <kbus/mmu.h>
-#include <kbus/pte.h>
-#include <kbus/kbus.h>
-#include <kbus/led.h>
-#include "sparc-asm.h"
-#include "idprom.h"
-#include "eeprom.h"
-#include "prom.h"
-
-#define NOFAULT_CONTINUE 0x01
-#define NOFAULT_QUIET 0x02
-
-extern char edata, end;
-extern daddr_t debug_tbr, debug_ret;
-extern int nofault;
-extern char exception_table;
-
-void
-set_led (char val)
-{
- static const xtab[] =
- {
- LED_0, LED_1, LED_2, LED_3,
- LED_4, LED_5, LED_6, LED_7,
- LED_8, LED_9, LED_A, LED_b,
- LED_C, LED_d, LED_E, LED_F
- };
- write_asi_half (ASI_LED, 0, (LED_U << 8) | xtab[val & 0x0f]);
-}
-
-void
-set_debug (void)
-{
- char *old_tbr = (char *)(debug_tbr & 0xfffff000UL);
- char *new_tbr = &exception_table;
-
-#define COPY_VECTOR(n) memcpy (new_tbr + n * 16, old_tbr + n * 16, 16)
- COPY_VECTOR (0x1f);
- COPY_VECTOR (0xf0);
-}
-
-void
-disp (int n)
-{
- if (n > 0)
- disp (n - 1);
- printf ("In disp %d\n", n);
-}
-
-void
-dump_dg (void)
-{
- int i, j;
- unsigned char buf[16];
-
- for (i = 0; i < 2048; i += 16)
- {
- printf ("%03x: ", i);
- for (j = 0; j < 16; j++)
- {
- buf[j] = read_asi_byte (ASI_DIAG_RAM, (i + j) << 2);
- printf ("%02x ", buf[j]);
- }
- for (j = 0; j < 16; j++)
- if (buf[j] >= 32 && buf[j] <= 127)
- putchar (buf[j]);
- else
- putchar ('.');
- putchar ('\n');
- }
-}
-
-
-void
-uninitialize_dg (void)
-{
- unsigned int val;
-
- write_asi_byte (ASI_DIAG_RAM, 16 << 2, 0);
- val = read_asi (ASI_MMCR, 0);
- /* As a cold start and enable watch-dog. */
- val |= MMCR_CS /* | MMCR_WDEN */ ;
- write_asi (ASI_MMCR, 0, val);
-}
-
-void
-initialize_dg (void)
-{
- unsigned int val;
-
- write_asi_byte (ASI_DIAG_RAM, 16 << 2, 'G');
- val = read_asi (ASI_MMCR, 0);
- val &= ~MMCR_CS;
- write_asi (ASI_MMCR, 0, val);
-}
-
-void
-udelay (unsigned long usec)
-{
- register int i;
-
- while (usec--)
- for (i = 20; i; i--)
- ;
-}
-
-void
-play_with_led (void)
-{
- int i, j;
-
- for (i = 0; i < 10; i++)
- for (j = 0; j < 16; j++)
- {
- set_led (j);
- ta (j);
- udelay (100000);
- }
-}
-
-void
-disp_pte (unsigned long pte)
-{
- printf ("%08x ", pte);
- if (pte & PG_IO)
- printf ("io ");
- if (pte & PG_V)
- printf ("v ");
-}
-
-void
-dump_pde (unsigned long *pdba)
-{
- int i,j;
- unsigned long pte;
- unsigned long *ptp;
- unsigned long pt;
- unsigned long *optp;
-
- for (i = 0; i < NPDEPERPDT; i++)
- {
- printf ("(%03x) 0x%08x 0x%08x ", i, pdba[i * 2], pdba[i * 2 + 1]);
- if (i & 1)
- printf ("\n");
- }
-
-#if 1
- optp = 0;
- for (i = 0; i < NPDEPERPDT; i++)
- {
- ptp = (unsigned long *)pdba[2 * i];
- printf ("PT # %02x at 0x%08x\n", i, (unsigned long) ptp);
- if (ptp == optp)
- continue;
- if (((unsigned long) ptp & 0xff000000) != 0xff000000)
- continue;
- optp = ptp;
- for (j = 0; j < NPTEPERPT; j++)
- if (ptp[j] != 0)
- goto not_null;
- printf ("--- all entries are null\n");
- continue;
- not_null:
- for (j = 0; j < NPTEPERPT; j++)
- {
- printf ("%04x: ", j);
- disp_pte (ptp[j]);
- printf ("\n");
- }
- printf ("\n");
- }
-#endif
-}
-
-void
-dump_dtlb (void)
-{
- unsigned long i;
- unsigned long pte;
-
- for (i = 0xff000000UL; i != 0xff100000; i += 0x00002000)
- {
- pte = read_asi (ASI_GTLB_RDD, i);
- printf ("dtlb for 0x%08x: ", i);
- disp_pte (pte);
- printf ("\n");
- }
-}
-
-void
-dump_itlb (void)
-{
- unsigned long i;
- unsigned long pte;
-
- for (i = 0xfe000000UL; i != 0; i += 0x00001000)
- {
- pte = read_asi (ASI_GTLB_RDI, i);
- printf ("itlb for 0x%08x: ", i);
- disp_pte (pte);
- printf ("\n");
- }
-}
-
-#define MASK 0xffffe000
-void
-disp_dmap (void)
-{
- unsigned long i;
- unsigned long map;
- unsigned long pte;
-
- map = 0;
- for (i = 0x00002000UL; i != 0; i += 0x00002000)
- {
- pte = read_asi (ASI_GTLB_RDD, i);
- if ((pte & MASK) == map + i)
- continue;
- printf (" - 0x%08x\n", i);
- map = (pte & MASK) - i;
- printf ("Mapped at 0x%08x : 0x%08x", pte, i);
- }
-}
-
-void
-try_dtlb (void)
-{
- unsigned long addr = 0xffe00000;
- unsigned long val;
- unsigned long nval[16];
- int i;
-
- val = read_asi (ASI_GTLB_RDD, addr);
- printf ("DTLB: addr = 0x%08x, val = 0x%08x\n", addr, val);
- i = *(int *)addr;
- printf ("i = %d...", i);
- write_asi (ASI_GTLB_VALD, addr, 0);
- i = *(int *)addr;
- printf ("i = %d\n", i);
- for (i = 1; i < 16; i++)
- nval[i] = read_asi (ASI_GTLB_RDD, addr + i * 0x1000);
- nval[0] = read_asi (ASI_GTLB_RDD, addr);
- write_asi (ASI_GTLB_VALD, addr, val);
- for (i = 0; i < 16; i++)
- printf ("DTLB: addr = 0x%08x, nval[%d] = 0x%08x, val = 0x%08x\n",
- addr, i, nval[i], read_asi (ASI_GTLB_RDD, addr + i * 0x1000));
-}
-
-void
-dump_page (int pg)
-{
- int i;
- unsigned long *addr = (unsigned long *)0xff000000;
-
- for (i = 0; i < 2048; i++)
- {
- printf ("0x%04x: 0x%08x ", i, addr[i]);
- if ((i & 3) == 3)
- printf ("\n");
- }
-}
-
-int
-disp_prom_string (unsigned char *ptr, int maxlen)
-{
- int i;
- char c;
-
- for (i = 0; i < maxlen; i++)
- {
- c = ptr[i * ID_BYTE_OFFSET];
- if (c == 0)
- return i + 1;
- putchar (c);
- }
- return maxlen;
-}
-
-void
-probe_kbus (void)
-{
- unsigned char *pa;
- unsigned char *va;
- unsigned char *p;
- unsigned char c;
- unsigned char id;
- unsigned int offset;
- unsigned int size;
- unsigned int nbr_bytes_read;
- int i, j;
-
- for (i = 1; i < 8; i++)
- {
- printf ("Slot %d: ", i);
- fflush (stdout);
- pa = (char *)MK_IOADDR (SPACE_ID, i, 0);
- va = (unsigned char *) alloc_page ((daddr_t) pa, PG_IO | PG_V);
- again:
- nofault = NOFAULT_QUIET | NOFAULT_CONTINUE;
- id = va[0];
- if (nofault == 0)
- {
- printf ("-\n");
- continue;
- }
- printf ("id: 0x%02x -%c-", id, id & ID_MASK);
-#if 0
- for (j = 1; j < 8; j++)
- {
- nofault = NOFAULT_QUIET | NOFAULT_CONTINUE;
- c = va[j];
- if (nofault != 0)
- printf (", [%d] = 0x%02x", j, c);
- }
-#endif
-
- printf (" Minor: %d, rev: %c%c",
- va[ID_OFF_MINOR], va[ID_OFF_REVLEV1], va[ID_OFF_REVLEV2]);
- offset = ID_4BYTES_TO_LONG (va[ID_OFF_OFFSET1], va[ID_OFF_OFFSET2],
- va[ID_OFF_OFFSET3], va[ID_OFF_OFFSET4]);
- size = ID_4BYTES_TO_LONG (va[ID_OFF_SIZE1], va[ID_OFF_SIZE2],
- va[ID_OFF_SIZE3], va[ID_OFF_SIZE4]);
- printf (" offset: %ld, size: %ld", offset, size);
- nbr_bytes_read = 13;
- putchar (' ');
- nbr_bytes_read += disp_prom_string (va + ID_OFF_STRING,
- ID_MAX_STRING_SIZE);
- p = va + nbr_bytes_read * ID_BYTE_OFFSET;
- printf ("\n");
- if (nbr_bytes_read == size)
- printf ("All bytes read\n");
- else
- {
- printf ("%d bytes to read\n", size - nbr_bytes_read);
- switch (id & ID_MASK)
- {
- case ID_MEMORY_BOARD:
- printf ("Size: %d Mb\n", *p);
- break;
- case ID_SYSTEM_BOARD + 1:
- printf ("Hostid: %lx\n",
- ID_4BYTES_TO_LONG (p[ID_S_OFF_HOSTID1],
- p[ID_S_OFF_HOSTID2],
- p[ID_S_OFF_HOSTID3],
- p[ID_S_OFF_HOSTID4]));
- printf ("Serial: ");
- disp_prom_string (p + ID_S_OFF_SERIAL, ID_S_SERIAL_SIZE);
- printf ("\nEnet addr: %x:%x:%x:%x:%x:%x\n",
- p[ID_S_OFF_ENETADDR],
- p[ID_S_OFF_ENETADDR + 1 * ID_BYTE_OFFSET],
- p[ID_S_OFF_ENETADDR + 2 * ID_BYTE_OFFSET],
- p[ID_S_OFF_ENETADDR + 3 * ID_BYTE_OFFSET],
- p[ID_S_OFF_ENETADDR + 4 * ID_BYTE_OFFSET],
- p[ID_S_OFF_ENETADDR + 5 * ID_BYTE_OFFSET]);
- printf ("mfg date: ");
- disp_prom_string (p + ID_S_OFF_MFGDATE, ID_S_MFGDATE_SIZE);
- printf ("Oem flag: 0x%02x\n",
- p[ID_S_OFF_OEM_FLAG]);
- printf ("Banner: ");
- disp_prom_string (p + ID_S_OFF_BANNER, ID_S_BANNER_SIZE);
- printf ("\nCopyright: ");
- disp_prom_string (p + ID_S_OFF_COPYRIGHT, ID_S_COPYRIGHT_SIZE);
- printf ("\nLogo:\n");
- for (j = 0; j < ID_S_LOGOBITMAP_SIZE; j++)
- {
- int k;
- c = p[ID_S_OFF_LOGOBITMAP + j * ID_BYTE_OFFSET];
- for (k = 0; k < 8; k++)
- {
- putchar ((c & 0x80) ? '*': ' ');
- c <<= 1;
- }
- if ((j & 7) == 7)
- putchar ('\n');
- }
- break;
- case ID_GRAPHIC_BOARD:
- {
- int nbr_res = p[ID_G_OFF_RES_COUNT];
- int k;
-
- printf ("Type: %d, nbr of plane: %d, access size: %d, "
- "nbr of resolutions: %d\n",
- p[ID_G_OFF_TYPE], p[ID_G_OFF_NBR_PLANE],
- p[ID_G_OFF_ACCESS_SIZE], nbr_res);
- p += ID_G_OFF_FB_SIZES;
- for (k = 0; k < nbr_res; k++)
- {
- printf ("Res %d: %dx%d, xoff: %d, "
- "fb_size: 0x%08x, itbl: 0x%08x, font: 0x%08x\n",
- k,
- ID_2BYTES_TO_SHORT (p[ID_G_OFF_X_RES1],
- p[ID_G_OFF_X_RES2]),
- ID_2BYTES_TO_SHORT (p[ID_G_OFF_Y_RES1],
- p[ID_G_OFF_Y_RES2]),
- ID_2BYTES_TO_SHORT (p[ID_G_OFF_XOFFSET1],
- p[ID_G_OFF_XOFFSET2]),
- ID_4BYTES_TO_LONG (p[ID_G_OFF_FB_SIZE1],
- p[ID_G_OFF_FB_SIZE2],
- p[ID_G_OFF_FB_SIZE3],
- p[ID_G_OFF_FB_SIZE4]),
- ID_4BYTES_TO_LONG (p[ID_G_OFF_ITBL_OFF1],
- p[ID_G_OFF_ITBL_OFF2],
- p[ID_G_OFF_ITBL_OFF3],
- p[ID_G_OFF_ITBL_OFF4]),
- ID_4BYTES_TO_LONG (p[ID_G_OFF_FONT_OFF1],
- p[ID_G_OFF_FONT_OFF2],
- p[ID_G_OFF_FONT_OFF3],
- p[ID_G_OFF_FONT_OFF4]));
- p += ID_G_SIZE_FB_SIZES;
- }
- printf ("White value: 0x%08x, Black value: 0x%08x, "
- "fb offset: 0x%08x, kb offset: 0x%08x\n",
- ID_4BYTES_TO_LONG (p[ID_G_OFF_WHITE_OFF1],
- p[ID_G_OFF_WHITE_OFF2],
- p[ID_G_OFF_WHITE_OFF3],
- p[ID_G_OFF_WHITE_OFF4]),
- ID_4BYTES_TO_LONG (p[ID_G_OFF_BLACK_OFF1],
- p[ID_G_OFF_BLACK_OFF2],
- p[ID_G_OFF_BLACK_OFF3],
- p[ID_G_OFF_BLACK_OFF4]),
- ID_4BYTES_TO_LONG (p[ID_G_OFF_FB_OFF1],
- p[ID_G_OFF_FB_OFF2],
- p[ID_G_OFF_FB_OFF3],
- p[ID_G_OFF_FB_OFF4]),
- ID_4BYTES_TO_LONG (p[ID_G_OFF_KB_OFF1],
- p[ID_G_OFF_KB_OFF2],
- p[ID_G_OFF_KB_OFF3],
- p[ID_G_OFF_KB_OFF4]));
- }
- break;
- }
- }
- if (offset != 0)
- {
- printf ("Slot %d: ", i);
- va += offset;
- goto again;
- }
- }
-}
-
-void
-disp_eeprom (void)
-{
- unsigned char *va;
- unsigned char ch[16];
- int i, j;
-
- va = (unsigned char *) alloc_page ((daddr_t) 0x17002000, PG_IO | PG_V);
-
- printf ("Model: ");
- disp_prom_string (va + EEPROM_OFF_MODEL, EEPROM_SIZE_MODEL);
- printf ("\n");
- for (i = 0; i < EEPROM_SIZE; i += 16)
- {
- printf ("%03x: ", i);
- for (j = 0; j < 16; j++)
- {
- ch[j] = va[(i + j) * EEPROM_BYTE_OFFSET];
- printf ("%02x%c", ch[j], j == 7 ? '-' : ' ');
- }
- for (j = 0; j < 16; j++)
- putchar ((ch[j] < 32 || ch[j] > 127) ? '.' : ch[j]);
- putchar ('\n');
- }
-}
-
-#define ROM_VECTORS 0xff000000
-void
-disp_prom (void)
-{
- unsigned long *addr;
- int i;
- struct prom_command_area *ca;
-
- printf ("version: %s\n", *(unsigned long *)ROM_VERSION);
- printf ("DGRAM version: 0x%08x\n", *(unsigned long *)ROM_DGRAM);
- printf ("EE version: 0x%08x\n", *(unsigned long *)ROM_EEVERSION);
- printf ("ROM version: 0x%08x\n", *(unsigned long *)ROM_REVISION);
- ca = *(struct prom_command_area **) ROM_COMM_AREA;
- printf ("first_free: 0x%08x\n", ca->first_free);
- printf ("memsize: %d Mb\n", ca->memsize);
- printf ("ramdisk: 0x%08x\n", ca->ramdisk);
- printf ("iomap_addr: 0x%08x\n", ca->iomap_addr);
- printf ("row: %d, col: %d\n", ca->row, ca->col);
- printf ("silent: %d\n", ca->silent);
- addr = (unsigned long *)ca->iomap_addr;
- for (i = 0; i < 10; i++)
- printf ("%d: 0x%08x\n", i, addr[i]);
-
-}
-
-void
-start (int argc, char *argv[], char *envp[])
-{
- int i;
- char *addr;
- char *pa;
- unsigned char c;
-
- set_led (0);
- bzero (&edata, &end - &edata);
- set_led (1);
-
- printf ("Hello world\n\r");
- fflush (stdout);
-
- /* set_debug (); */
- setvbuf (stdout, NULL, _IONBF, 0);
-
- printf ("MMCR: 0x%08x\n", read_asi (ASI_MMCR, 0));
- printf ("PDBA: 0x%08x\n", read_asi (ASI_PDBA, 0));
- printf ("BID: 0x%08x\n", read_asi (ASI_BID, 0));
-
- printf ("ret: 0x%08x\n", debug_ret);
- printf ("tbr: old = 0x%08x, new = 0x%08x\n", debug_tbr, read_tbr ());
-
- printf ("Args:");
- for (i = 0; i < argc; i++)
- printf (" %s", argv[i]);
- putchar ('\n');
- for (i = 0; envp[i]; i++)
- printf ("%s\n", envp[i]);
-
-
-/* dump_dg (); */
- uninitialize_dg ();
-
-#if 0
- disp (10);
- play_with_led ();
-#endif
-
-#if 0
- set_led (0);
- for (i = -1; i ; i--)
- ;
- set_led (1);
-#endif
- disp_zs0_status ();
- nofault = 1;
- for (i = 0; i < 4; i++)
- {
- zs0_putc ('h');
- zs0_putc ('e');
- zs0_putc ('l');
- }
- zs0_putc ('\n');
- zs0_putc ('\r');
- if (nofault == 0)
- printf ("Fault\n");
-
- set_debug ();
- fflush (stdout);
-
- /* At first, initialize the mmu. */
- init_mmu ();
-
- /* Then, the serial line. */
- init_zs0 ();
-
- printf ("mmu Hello again\n");
-
- try_mmu ();
- /* Probe the hardware. */
- probe_kbus ();
- /* disp_eeprom (); */
-/* disp_prom (); */
-
-/* try_dtlb (); */
-/* dump_dtlb (); */
-
- ta (127);
- _exit ();
-#if 0
- dump_pde ((unsigned long*) 0xff23a000);
-#endif
-#if 0
- init_mmu ();
- try_mmu ();
-#endif
-
- ta (127);
-
- initialize_dg ();
- write (1, "end\n", 4);
-}
-
-#define NUMREGS 80
-
-/* Number of bytes of registers. */
-#define NUMREGBYTES (NUMREGS * 4)
-enum regnames
-{
- G0, G1, G2, G3, G4, G5, G6, G7,
- O0, O1, O2, O3, O4, O5, SP, O7,
- L0, L1, L2, L3, L4, L5, L6, L7,
- I0, I1, I2, I3, I4, I5, FP, I7,
-
- F0, F1, F2, F3, F4, F5, F6, F7,
- F8, F9, F10, F11, F12, F13, F14, F15,
- F16, F17, F18, F19, F20, F21, F22, F23,
- F24, F25, F26, F27, F28, F29, F30, F31,
- Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR,
- MMCR, FCR, FVAR, PDBA, FPAR, FTOR, FES, FTSR}; /* MMCR at 72. */
-
-
-void
-handle_exception (unsigned long *registers)
-{
- int trap = (registers[TBR] >> 4) & 0xff;
-
- if (trap == 15)
- _exit ();
-
- if (1 || trap != 9 || !(nofault & NOFAULT_QUIET))
- {
- printf ("Trap %d:\n"
- "psr = 0x%08x, tbr = 0x%08x, pc = 0x%08x, npc = 0x%08x\n",
- trap,
- registers[PSR], registers[TBR], registers[PC], registers[NPC]);
- printf ("sp = %08x, fp = %08x\n",
- registers[SP], registers[FP]);
- printf ("MMCR = %08x, FCR = %08x, FVAR = %08x, PDBA = %08x\n",
- registers[MMCR], registers[FCR],
- registers[FVAR], registers[PDBA]);
- printf ("FPAR = %08x, FTOR = %08x, FES = %08x, FTSR = %08x\n",
- registers[FPAR], registers[FTOR],
- registers[FES], registers[FTSR]);
- }
-
- if (trap == 9 && (nofault & NOFAULT_CONTINUE))
- {
- nofault = 0;
- registers[PC] = registers[NPC];
- registers[NPC] += 4;
- }
- else
- _exit ();
-}
-
diff --git a/sys/arch/kbus/stand/sk/dvma.c b/sys/arch/kbus/stand/sk/dvma.c
deleted file mode 100644
index 11526106c2a..00000000000
--- a/sys/arch/kbus/stand/sk/dvma.c
+++ /dev/null
@@ -1,68 +0,0 @@
-
-/*
- * The easiest way to deal with the need for DVMA mappings is
- * to just map the first four megabytes of RAM into DVMA space.
- * That way, dvma_mapin can just compute the DVMA alias address,
- * and dvma_mapout does nothing.
- */
-
-#include <sys/param.h>
-
-#define DVMA_BASE 0x00000000
-#define DVMA_MASK 0x00ffFFff
-#define DVMA_MAPLEN 0x400000 /* 4 MB */
-
-void
-dvma_init()
-{
-#if 0
- int segva, sme;
-
- for (segva = 0; segva < DVMA_MAPLEN; segva += NBSG) {
- sme = get_segmap(segva);
- set_segmap((DVMA_BASE | segva), sme);
- }
-#endif
-}
-
-/* Convert a local address to a DVMA address. */
-char *
-dvma_mapin(char *addr, int len)
-{
- int va = (int)addr;
-
- va |= DVMA_BASE;
- return ((char *) va);
-}
-
-/* Convert a DVMA address to a local address. */
-char *
-dvma_mapout(char *dmabuf, int len)
-{
- if (dmabuf < (char*)DVMA_BASE)
- panic("dvma_mapout");
- return (dmabuf - DVMA_BASE);
-}
-
-extern char *alloc(int len);
-char *
-dvma_alloc(int len)
-{
- char *mem;
-
- mem = alloc(len);
- if (!mem)
- return(mem);
- return(dvma_mapin(mem, len));
-}
-
-extern void free(void *ptr, int len);
-void
-dvma_free(char *dvma, int len)
-{
- char *mem;
-
- mem = dvma_mapout(dvma, len);
- if (mem)
- free(mem, len);
-}
diff --git a/sys/arch/kbus/stand/sk/dvma.h b/sys/arch/kbus/stand/sk/dvma.h
deleted file mode 100644
index 2b8be37cbe0..00000000000
--- a/sys/arch/kbus/stand/sk/dvma.h
+++ /dev/null
@@ -1,6 +0,0 @@
-
-char * dvma_mapin(char *pkt, int len);
-void dvma_mapout(char *dmabuf, int len);
-
-char * dvma_alloc(int len);
-
diff --git a/sys/arch/kbus/stand/sk/eeprom.h b/sys/arch/kbus/stand/sk/eeprom.h
deleted file mode 100644
index 97e028e41e6..00000000000
--- a/sys/arch/kbus/stand/sk/eeprom.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#define EEPROM_BYTE_OFFSET 8
-
-#define EEPROM_SIZE 0x400
-
-#define EEPROM_OFF_MODEL 0x08
-#define EEPROM_SIZE_MODEL 16
diff --git a/sys/arch/kbus/stand/sk/exec_sun.c b/sys/arch/kbus/stand/sk/exec_sun.c
deleted file mode 100644
index 4e523cecd65..00000000000
--- a/sys/arch/kbus/stand/sk/exec_sun.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/* $OpenBSD: exec_sun.c,v 1.2 2000/03/03 00:54:51 todd Exp $ */
-
-/*-
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
- * 4. The name of the Author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)boot.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <a.out.h>
-
-#include "stand.h"
-
-extern int debug;
-
-extern u_int bootdev;
-
-/*ARGSUSED*/
-exec_sun(file, loadaddr, howto)
- char *file;
- char *loadaddr;
- int howto;
-{
- register int io;
- struct exec x;
- int cc, magic;
- void (*entry)();
- register char *cp;
- register int *ip;
- int textlen;
-
-#ifdef DEBUG
- printf("exec_sun: file=%s loadaddr=0x%x\n", file, loadaddr);
-#endif
-
- io = open(file, 0);
- if (io < 0)
- return(-1);
-
- /*
- * Read in the exec header, and validate it.
- */
- if (read(io, (char *)&x, sizeof(x)) != sizeof(x))
- goto shread;
- if (N_BADMAG(x)) {
- errno = EFTYPE;
- goto closeout;
- }
-
- cp = x.a_entry; /* loadaddr; */
- textlen = x.a_text;
- magic = N_GETMAGIC(x);
- if (magic == ZMAGIC) {
- cp += sizeof(x);
- textlen -= sizeof(x);
- }
- entry = (void (*)())cp;
-
- printf ("Entry at %x\n", cp);
- /*
- * Leave a copy of the exec header before the text.
- * The sun3 kernel uses this to verify that the
- * symbols were loaded by this boot program.
- */
- bcopy(&x, cp - sizeof(x), sizeof(x));
-
- /*
- * Read in the text segment.
- */
- printf("%x", x.a_text);
- if (read(io, cp, textlen) != textlen)
- goto shread;
- cp += textlen;
-
- /*
- * NMAGIC may have a gap between text and data.
- */
- if (magic == NMAGIC) {
- register int mask = N_PAGSIZ(x) - 1;
- while ((int)cp & mask)
- *cp++ = 0;
- }
-
- /*
- * Read in the data segment.
- */
- printf("+%x", x.a_data);
- if (read(io, cp, x.a_data) != x.a_data)
- goto shread;
- cp += x.a_data;
-
- /*
- * Zero out the BSS section.
- * (Kernel does not do it itself)
- */
- printf("+%x", x.a_bss);
- cc = x.a_bss;
- while ((int)cp & 3) {
- *cp++ = 0;
- --cc;
- }
- ip = (int *)cp;
- cp += cc;
- while ((char *)ip < cp)
- *ip++ = 0;
-
- /*
- * Read in the symbol table and strings.
- * (Always set the symtab size word.)
- */
- *ip++ = x.a_syms;
- cp = (char *)ip;
-
- if (x.a_syms > 0) {
-
- /* Symbol table and string table length word. */
- cc = x.a_syms;
- printf("+[%x", cc);
- cc += sizeof(int); /* strtab length too */
- if (read(io, cp, cc) != cc)
- goto shread;
- cp += x.a_syms;
- ip = (int *)cp; /* points to strtab length */
- cp += sizeof(int);
-
- /* String table. Length word includes itself. */
- cc = *ip;
- printf("+%x]", cc);
- cc -= sizeof(int);
- if (cc <= 0)
- goto shread;
- if (read(io, cp, cc) != cc)
- goto shread;
- cp += cc;
- }
- printf("=%x\n", cp - loadaddr);
- close(io);
-
- if (debug) {
- printf("Debug mode - enter c to continue\n");
- }
-
- printf("Starting program at 0x%x\n", (int)entry);
- (*entry)(howto, bootdev, cp, 0, 0);
- panic("exec returned");
-
-shread:
- printf("exec: short read\n");
- errno = EIO;
-closeout:
- close(io);
- return(-1);
-}
diff --git a/sys/arch/kbus/stand/sk/gets.c b/sys/arch/kbus/stand/sk/gets.c
deleted file mode 100644
index b8594f49259..00000000000
--- a/sys/arch/kbus/stand/sk/gets.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/* $OpenBSD: gets.c,v 1.2 2000/03/03 00:54:51 todd Exp $ */
-
-/*-
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
- * 4. The name of the Author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)gets.c 8.1 (Berkeley) 6/11/93
- */
-
-#include "stand.h"
-
-/*
- * This implementation assumes that getchar() does echo, because
- * on some machines, it is hard to keep echo from being done.
- * Those that need it can do echo in their getchar() function.
- *
- * Yes, the code below will echo CR, DEL, and other control chars,
- * but sending CR or DEL here is harmless. All the other editing
- * characters will be followed by a newline, so it doesn't matter.
- * (Most terminals will not show them anyway.)
- */
-
-void
-gets(buf)
- char *buf;
-{
- register int c;
- register char *lp;
-
-top:
- lp = buf;
-
- for (;;) {
- c = getchar() & 0177;
-
- putchar(c);
-
- switch (c) {
-
- default:
- *lp++ = c;
- continue;
-
- case '\177':
- putchar('\b');
- /* fall through */
- case '\b':
- putchar(' ');
- putchar('\b');
- /* fall through */
- case '#':
- if (lp > buf)
- lp--;
- continue;
-
- /*
- * This is not very useful in a boot program.
- * (It costs you 52 bytes on m68k, gcc -O3).
- */
- case 'r'&037: {
- register char *p;
- putchar('\n');
- for (p = buf; p < lp; ++p)
- putchar(*p);
- continue;
- }
-
- case '@':
- case 'u'&037:
- case 'w'&037:
- putchar('\n');
- goto top;
-
- case '\r':
- putchar('\n');
- /* fall through */
- case '\n':
- *lp = '\0';
- return;
-
- } /* switch */
- }
- /*NOTREACHED*/
-}
diff --git a/sys/arch/kbus/stand/sk/idprom.h b/sys/arch/kbus/stand/sk/idprom.h
deleted file mode 100644
index 007b40674c1..00000000000
--- a/sys/arch/kbus/stand/sk/idprom.h
+++ /dev/null
@@ -1,90 +0,0 @@
-#define ID_BYTE_OFFSET 0x08
-
-#define ID_MASK 0x7f
-#define ID_OFF_MAJOR 0x00
-#define ID_OFF_MINOR 0x08
-#define ID_OFF_REVLEV1 0x10
-#define ID_OFF_REVLEV2 0x18
-#define ID_OFF_OFFSET1 0x20
-#define ID_OFF_OFFSET2 0x28
-#define ID_OFF_OFFSET3 0x30
-#define ID_OFF_OFFSET4 0x38
-#define ID_OFF_SIZE1 0x40
-#define ID_OFF_SIZE2 0x48
-#define ID_OFF_SIZE3 0x50
-#define ID_OFF_SIZE4 0x58
-#define ID_OFF_CKSUM 0x60
-#define ID_OFF_STRING 0x68
-
-#define ID_MAX_STRING_SIZE 129
-
-#define ID_4BYTES_TO_LONG(a1, a2, a3, a4) \
- ((a1 << 24) | (a2 << 16) | (a3 << 8) | a4)
-#define ID_2BYTES_TO_SHORT(a1, a2) ((a1 << 8) | a2)
-
-#define ID_MEMORY_BOARD 'M'
-#define ID_SYSTEM_BOARD 'S'
-#define ID_GRAPHIC_BOARD 'G'
-
-/* For the system board. */
-#define ID_S_SERIAL_SIZE 16
-#define ID_S_ENET_SIZE 6
-#define ID_S_MFGDATE_SIZE 6
-#define ID_S_BANNER_SIZE 64
-#define ID_S_COPYRIGHT_SIZE 64
-#define ID_S_LOGOBITMAP_SIZE 512
-
-#define ID_S_OFF_HOSTID1 0x000
-#define ID_S_OFF_HOSTID2 0x008
-#define ID_S_OFF_HOSTID3 0x010
-#define ID_S_OFF_HOSTID4 0x018
-#define ID_S_OFF_SERIAL 0x080
-#define ID_S_OFF_ENETADDR 0x180
-#define ID_S_OFF_MFGDATE 0x1c0
-#define ID_S_OFF_OEM_FLAG 0x1f0
-#define ID_S_OFF_BANNER 0x1f8
-#define ID_S_OFF_COPYRIGHT 0x3f8
-#define ID_S_OFF_LOGOBITMAP 0x5f8
-
-#define ID_G_OFF_TYPE 0x00
-#define ID_G_OFF_NBR_PLANE 0x08
-#define ID_G_OFF_ACCESS_SIZE 0x10
-#define ID_G_OFF_RES_COUNT 0x18
-
-#define ID_G_OFF_FB_SIZES 0x20
-#define ID_G_SIZE_FB_SIZES 0x90
-#define ID_G_OFF_X_RES1 0x00
-#define ID_G_OFF_X_RES2 0x08
-#define ID_G_OFF_Y_RES1 0x10
-#define ID_G_OFF_Y_RES2 0x18
-#define ID_G_OFF_XOFFSET1 0x20
-#define ID_G_OFF_XOFFSET2 0x28
-#define ID_G_OFF_FB_SIZE1 0x30
-#define ID_G_OFF_FB_SIZE2 0x38
-#define ID_G_OFF_FB_SIZE3 0x40
-#define ID_G_OFF_FB_SIZE4 0x48
-#define ID_G_OFF_ITBL_OFF1 0x50
-#define ID_G_OFF_ITBL_OFF2 0x58
-#define ID_G_OFF_ITBL_OFF3 0x60
-#define ID_G_OFF_ITBL_OFF4 0x68
-#define ID_G_OFF_FONT_OFF1 0x70
-#define ID_G_OFF_FONT_OFF2 0x78
-#define ID_G_OFF_FONT_OFF3 0x80
-#define ID_G_OFF_FONT_OFF4 0x88
-
-#define ID_G_OFF_WHITE_OFF1 0x00
-#define ID_G_OFF_WHITE_OFF2 0x08
-#define ID_G_OFF_WHITE_OFF3 0x10
-#define ID_G_OFF_WHITE_OFF4 0x18
-#define ID_G_OFF_BLACK_OFF1 0x20
-#define ID_G_OFF_BLACK_OFF2 0x28
-#define ID_G_OFF_BLACK_OFF3 0x30
-#define ID_G_OFF_BLACK_OFF4 0x38
-#define ID_G_OFF_FB_OFF1 0x40
-#define ID_G_OFF_FB_OFF2 0x48
-#define ID_G_OFF_FB_OFF3 0x50
-#define ID_G_OFF_FB_OFF4 0x58
-#define ID_G_OFF_KB_OFF1 0x60
-#define ID_G_OFF_KB_OFF2 0x68
-#define ID_G_OFF_KB_OFF3 0x70
-#define ID_G_OFF_KB_OFF4 0x78
diff --git a/sys/arch/kbus/stand/sk/if_le.c b/sys/arch/kbus/stand/sk/if_le.c
deleted file mode 100644
index 5e3cb3ff613..00000000000
--- a/sys/arch/kbus/stand/sk/if_le.c
+++ /dev/null
@@ -1,615 +0,0 @@
-/* $OpenBSD: if_le.c,v 1.3 2000/03/03 00:54:51 todd Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Theo de Raadt for Willowglen Singapore.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1993 Adam Glass
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Adam Glass.
- * 4. The name of the Author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/types.h>
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-
-#include "stand.h"
-#include "netif.h"
-#include "config.h"
-
-#include "if_lereg.h"
-
-int le_debug = 0;
-
-void le_end __P((struct netif *));
-void le_error __P((struct netif *, char *, volatile struct lereg1 *));
-int le_get __P((struct iodesc *, void *, size_t, time_t));
-void le_init __P((struct iodesc *, void *));
-int le_match __P((struct netif *, void *));
-int le_poll __P((struct iodesc *, void *, int));
-int le_probe __P((struct netif *, void *));
-int le_put __P((struct iodesc *, void *, size_t));
-static void le_reset __P((int unit));
-
-struct netif_stats le_stats;
-
-struct netif_dif le0_dif = {
- 0, /* unit */
- 1, /* nsel */
- &le_stats,
- 0,
- 0,
-};
-
-struct netif_driver le_driver = {
- "le", /* netif_bname */
- le_match, /* match */
- le_probe, /* probe */
- le_init, /* init */
- le_get, /* get */
- le_put, /* put */
- le_end, /* end */
- &le0_dif, /* netif_ifs */
- 1, /* netif_nifs */
-};
-
-static struct le_configuration {
- unsigned int phys_addr;
- int used;
- int init;
- unsigned char ea[8];
-} le_config[] = {
- { LANCE_REG_ADDR, 0, 0 }
-};
-
-int nle_config = sizeof(le_config) / (sizeof(le_config[0]));
-
-struct {
- struct lereg1 *sc_r1; /* LANCE registers */
- struct lereg2 *sc_r2; /* RAM */
- void *recv_mem;
- void *xmit_mem;
- int next_rmd;
- int next_tmd;
-} le_softc;
-
-int
-le_match(nif, machdep_hint)
- struct netif *nif;
- void *machdep_hint;
-{
- char *name;
- int i, val = 0;
-
- name = machdep_hint;
- if (name && !bcmp(le_driver.netif_bname, name, 2))
- val += 10;
- for (i = 0; i < nle_config; i++) {
- if (le_config[i].used)
- continue;
- if (le_debug)
- printf("le%d: le_match --> %d\n", i, val + 1);
- le_config[i].used++;
- return val + 1;
- }
- if (le_debug)
- printf("le%d: le_match --> 0\n", i);
- return 0;
-}
-
-int
-le_probe(nif, machdep_hint)
- struct netif *nif;
- void *machdep_hint;
-{
- /* the set unit is the current unit */
- if (le_debug)
- printf("le%d: le_probe called\n", nif->nif_unit);
-
- return 0;
-}
-
-void
-le_error(nif, str, ler1)
- struct netif *nif;
- char *str;
- volatile struct lereg1 *ler1;
-{
-
- printf ("le_error (%s) C0: %b\n", str, ler1->ler1_rdp, LE_C0_BITS);
- /* ler1->ler1_rap = LE_CSRO done in caller */
- if (ler1->ler1_rdp & LE_C0_BABL)
- panic("le%d: been babbling, found by '%s'",
- nif->nif_unit, str);
- if (ler1->ler1_rdp & LE_C0_CERR) {
- le_stats.collision_error++;
- ler1->ler1_rdp = LE_C0_CERR;
- }
- if (ler1->ler1_rdp & LE_C0_MISS) {
- le_stats.missed++;
- ler1->ler1_rdp = LE_C0_MISS;
- }
- if (ler1->ler1_rdp & LE_C0_MERR) {
- printf("le%d: memory error in '%s'\n", nif->nif_unit, str);
- panic("memory error");
- }
-}
-
-static void
-le_reset(unit)
- int unit;
-{
- struct lereg1 *ler1 = le_softc.sc_r1;
- struct lereg2 *ler2 = le_softc.sc_r2;
- unsigned int a;
- int timo = 40, stat, i;
-
- if (le_debug)
- {
- printf("le%d: le_reset called\n", unit);
- printf ("addr: 0x%x, data: 0x%x, xmit_mem: 0x%x, recv_mem: 0x%x\n",
- &ler1->ler1_rap, &ler1->ler1_rdp,
- le_softc.xmit_mem, le_softc.recv_mem);
- }
-
- /* Set IOASIC. */
- *(u_long *)0x90000004 = ((u_long)le_softc.recv_mem & 0x00ffffff) >> 15;
- *(u_long *)0x90000008 = ((u_long)le_softc.xmit_mem & 0x00ffffff) >> 13;
-
- ler1->ler1_rap = LE_CSR0;
- ler1->ler1_rdp = LE_C0_STOP; /* do nothing until we are finished */
-
- if (le_debug)
- printf ("le%d: stopped\n", unit);
-
- bzero(ler2, sizeof(*ler2));
-
- ler2->ler2_mode = LE_MODE_NORMAL;
- ler2->ler2_padr[0] = le_config[unit].ea[1];
- ler2->ler2_padr[1] = le_config[unit].ea[0];
- ler2->ler2_padr[2] = le_config[unit].ea[3];
- ler2->ler2_padr[3] = le_config[unit].ea[2];
- ler2->ler2_padr[4] = le_config[unit].ea[5];
- ler2->ler2_padr[5] = le_config[unit].ea[4];
-
-
- ler2->ler2_ladrf0 = 0;
- ler2->ler2_ladrf1 = 0;
-
- a = (u_int) ler2->ler2_rmd;
- ler2->ler2_rlen = LE_RLEN | 0;
- ler2->ler2_rdra = LE_GET_MD_ADDR (a);
-
- a = (u_int) ler2->ler2_tmd;
- ler2->ler2_tlen = LE_TLEN | 0;
- ler2->ler2_tdra = LE_GET_MD_ADDR (a);
-
- ler1->ler1_rap = LE_CSR1;
- a = (u_int) ler2;
- ler1->ler1_rdp = LE_GET_MD_ADDR (a);
- ler1->ler1_rap = LE_CSR2;
- ler1->ler1_rdp = 0;
-
- for (i = 0; i < LERBUF; i++)
- {
- a = (u_int) & ler2->ler2_rbuf[i];
- ler2->ler2_rmd[i].rmd0 = LE_GET_RECV_ADDR (a);
- ler2->ler2_rmd[i].rmd1_bits = LE_R1_OWN;
- ler2->ler2_rmd[i].rmd1_hadr = 0;
- ler2->ler2_rmd[i].rmd2 = -LEMTU;
- ler2->ler2_rmd[i].rmd3 = 0;
- }
- for (i = 0; i < LETBUF; i++)
- {
- ler2->ler2_tbuf[i] = (char *)(le_softc.xmit_mem + i * LEMTU);
- a = (u_int) ler2->ler2_tbuf[i];
- ler2->ler2_tmd[i].tmd0 = LE_GET_XMIT_ADDR (a);
- ler2->ler2_tmd[i].tmd1_bits = 0;
- ler2->ler2_tmd[i].tmd1_hadr = 0;
- ler2->ler2_tmd[i].tmd2 = 0;
- ler2->ler2_tmd[i].tmd3 = 0;
- }
-
- ler1->ler1_rap = LE_CSR3;
- ler1->ler1_rdp = LE_C3_BSWP;
-
- ler1->ler1_rap = LE_CSR0;
- ler1->ler1_rdp = LE_C0_INIT;
- do {
- if (--timo == 0) {
- printf("le%d: init timeout, stat = 0x%x\n",
- unit, stat);
- break;
- }
- stat = ler1->ler1_rdp;
- } while ((stat & LE_C0_IDON) == 0);
-
- ler1->ler1_rdp = LE_C0_IDON;
- le_softc.next_rmd = 0;
- le_softc.next_tmd = 0;
- ler1->ler1_rap = LE_CSR0;
- ler1->ler1_rdp = LE_C0_STRT | LE_C0_INEA;
-/* printf ("C0: %b\n", ler1->ler1_rdp, LE_C0_BITS); TG */
-}
-
-int
-le_poll(desc, pkt, len)
- struct iodesc *desc;
- void *pkt;
- int len;
-{
- struct lereg1 *ler1 = le_softc.sc_r1;
- struct lereg2 *ler2 = le_softc.sc_r2;
- unsigned int a;
- int length;
- struct lermd *rmd;
-
-
- ler1->ler1_rap = LE_CSR0;
-
- if ((ler1->ler1_rdp & LE_C0_RINT) != 0)
- ler1->ler1_rdp = LE_C0_RINT;
- rmd = &ler2->ler2_rmd[le_softc.next_rmd];
- if (rmd->rmd1_bits & LE_R1_OWN) {
- return (0);
- }
- if (ler1->ler1_rdp & LE_C0_ERR)
- le_error(desc->io_netif, "le_poll", ler1);
- if (rmd->rmd1_bits & LE_R1_ERR) {
- printf("le%d_poll: rmd status 0x%x\n", desc->io_netif->nif_unit,
- rmd->rmd1_bits);
- length = 0;
- goto cleanup;
- }
- if ((rmd->rmd1_bits & (LE_R1_STP | LE_R1_ENP)) != (LE_R1_STP | LE_R1_ENP))
- panic("le_poll: chained packet");
-
- length = rmd->rmd3;
- if (length >= LEMTU) {
- length = 0;
- panic("csr0 when bad things happen: %x", ler1->ler1_rdp);
- goto cleanup;
- }
- if (!length)
- goto cleanup;
- length -= 4;
- if (length > 0) {
-
- /*
- * if buffer is smaller than the packet truncate it.
- * (is this wise?)
- */
- if (length > len)
- length = len;
-
- bcopy((void *)&ler2->ler2_rbuf[le_softc.next_rmd], pkt, length);
- }
-cleanup:
- a = (u_int) & ler2->ler2_rbuf[le_softc.next_rmd];
- rmd->rmd0 = LE_GET_RECV_ADDR (a);
- rmd->rmd1_hadr = 0;
- rmd->rmd2 = -LEMTU;
- le_softc.next_rmd =
- (le_softc.next_rmd == (LERBUF - 1)) ? 0 : (le_softc.next_rmd + 1);
- rmd->rmd1_bits = LE_R1_OWN;
-/* printf ("C0: %b\n", ler1->ler1_rdp, LE_C0_BITS); TG */
- return length;
-}
-
-int
-le_put(desc, pkt, len)
- struct iodesc *desc;
- void *pkt;
- size_t len;
-{
- volatile struct lereg1 *ler1 = le_softc.sc_r1;
- volatile struct lereg2 *ler2 = le_softc.sc_r2;
- volatile struct letmd *tmd;
- int timo = 100000, stat, i;
- unsigned int a;
-
- /* Check status. */
- ler1->ler1_rap = LE_CSR0;
- if (ler1->ler1_rdp & LE_C0_ERR)
- le_error(desc->io_netif, "le_put(way before xmit)", ler1);
-
- tmd = &ler2->ler2_tmd[le_softc.next_tmd];
- while (tmd->tmd1_bits & LE_T1_OWN)
- {
- printf("le%d: output buffer busy\n", desc->io_netif->nif_unit);
- }
-
- bcopy (pkt, (void *)ler2->ler2_tbuf[le_softc.next_tmd], len);
- if (len < 64)
- tmd->tmd2 = -64;
- else
- tmd->tmd2 = -len;
- tmd->tmd3 = 0;
- if (ler1->ler1_rdp & LE_C0_ERR)
- le_error(desc->io_netif, "le_put(before xmit)", ler1);
-
- tmd->tmd1_bits = LE_T1_STP | LE_T1_ENP | LE_T1_OWN;
- a = (u_int) ler2->ler2_tbuf[le_softc.next_tmd];
- tmd->tmd0 = LE_GET_XMIT_ADDR (a);
- tmd->tmd1_hadr = 0;
- ler1->ler1_rdp = LE_C0_TDMD;
- if (ler1->ler1_rdp & LE_C0_ERR)
- le_error(desc->io_netif, "le_put(after xmit)", ler1);
- do
- {
- if (--timo == 0) {
- printf("le%d: transmit timeout, stat = 0x%x\n",
- desc->io_netif->nif_unit, stat);
- if (ler1->ler1_rdp & LE_C0_ERR)
- le_error(desc->io_netif, "le_put(timeout)", ler1);
- break;
- }
- stat = ler1->ler1_rdp;
- udelay (1000);
- } while ((stat & LE_C0_TINT) == 0);
-/* printf ("C0: %b\n", ler1->ler1_rdp, LE_C0_BITS); TG */
- ler1->ler1_rdp = LE_C0_TINT;
- if (ler1->ler1_rdp & LE_C0_ERR) {
- if ((ler1->ler1_rdp & (LE_C0_BABL | LE_C0_CERR | LE_C0_MISS |
- LE_C0_MERR)) !=
- LE_C0_CERR)
- printf("le_put: xmit error, buf %d\n", le_softc.next_tmd);
- le_error(desc->io_netif, "le_put(xmit error)", ler1);
- }
- le_softc.next_tmd = 0;
- /* (le_softc.next_tmd == (LETBUF - 1)) ? 0 : le_softc.next_tmd + 1;*/
- if (tmd->tmd1_bits & LE_T1_DEF)
- le_stats.deferred++;
- if (tmd->tmd1_bits & LE_T1_ONE)
- le_stats.collisions++;
- if (tmd->tmd1_bits & LE_T1_MORE)
- le_stats.collisions += 2;
- if (tmd->tmd1_bits & LE_T1_ERR) {
- printf("le%d: transmit error, error = 0x%x\n", desc->io_netif->nif_unit,
- tmd->tmd3);
- return -1;
- }
- if (le_debug) {
- printf("le%d: le_put() successful: sent %d\n",
- desc->io_netif->nif_unit, len);
- printf("le%d: le_put(): tmd1_bits: %x tmd3: %x\n",
- desc->io_netif->nif_unit,
- (unsigned int) tmd->tmd1_bits,
- (unsigned int) tmd->tmd3);
- }
- return len;
-}
-
-int
-le_get(desc, pkt, len, timeout)
- struct iodesc *desc;
- void *pkt;
- size_t len;
- time_t timeout;
-{
- time_t t;
- int cc;
-
- t = getsecs();
- cc = 0;
- while (((getsecs() - t) < timeout) && !cc) {
- cc = le_poll(desc, pkt, len);
- }
- return cc;
-}
-/*
- * init le device. return 0 on failure, 1 if ok.
- */
-/* 32kb alignment required. */
-#define RECV_ALIGN 0x8000
-#define XMIT_ALIGN 0x2000
-void
-le_low_init (void)
-{
- u_long mem;
- u_long xmit_mem;
- u_long recv_mem;
- int unit = 0;
-
- if (le_config[unit].init)
- return;
- else
- le_config[unit].init = 1;
-
- machdep_common_ether(le_config[unit].ea);
- printf ("le_low_init: addr is %s\n", ether_sprintf (le_config[unit].ea));
- bzero(&le_softc, sizeof(le_softc));
- le_softc.sc_r1 =
- (struct lereg1 *) le_config[unit].phys_addr;
-
- mem = (u_long) alloc (2 * RECV_ALIGN + XMIT_ALIGN);
- recv_mem = (mem & ~(RECV_ALIGN - 1)) + RECV_ALIGN;
- xmit_mem = recv_mem + RECV_ALIGN;
-
- le_softc.sc_r2 = (struct lereg2 *) recv_mem;
- le_softc.recv_mem = (void *) recv_mem;
- le_softc.xmit_mem = (void *) xmit_mem;
- le_reset (unit);
-}
-
-void
-le_init(desc, machdep_hint)
- struct iodesc *desc;
- void *machdep_hint;
-{
- u_long mem;
- u_long xmit_mem;
- u_long recv_mem;
-
- struct netif *nif = desc->io_netif;
- int unit = nif->nif_unit;
-
- if (le_debug)
- printf("le%d: le_init called\n", unit);
-
-/* le_low_init (); */
- bcopy (le_config[unit].ea, desc->myea, 6);
- printf ("device: %s%d attached to %s\n",
- nif->nif_driver->netif_bname,
- nif->nif_unit,
- ether_sprintf(desc->myea));
-}
-
-void
-le_end(nif)
- struct netif *nif;
-{
- struct lereg1 *ler1 = le_softc.sc_r1;
-
- if (le_debug)
- printf("le%d: le_end called\n", nif->nif_unit);
- ler1->ler1_rap = LE_CSR0;
- ler1->ler1_rdp = LE_C0_STOP;
-}
-
-void
-le_disp_status (void)
-{
- u_int16_t isr;
- struct lereg1 *ler1 = le_softc.sc_r1;
-
- ler1->ler1_rap = LE_CSR0;
- isr = ler1->ler1_rdp;
- printf ("le_int: isr = %x\n", isr);
-}
-
-void
-le_intr (void)
-{
- struct lereg1 *ler1 = le_softc.sc_r1;
- struct lereg2 *ler2 = le_softc.sc_r2;
- unsigned int a;
- int length;
- struct lermd *rmd;
- u_int16_t isr;
-
- if (!le_config[0].init)
- {
- printf ("le not init\n");
- return;
- }
-
- ler1->ler1_rap = LE_CSR0;
- isr = ler1->ler1_rdp;
- if (!(isr & LE_C0_INTR))
- {
- printf ("le: no intr\n");
- return;
- }
- printf ("le_int: isr = %x\n", isr);
-
- /* Clear the flags. */
- ler1->ler1_rdp = isr & (LE_C0_INEA | LE_C0_BABL | LE_C0_CERR | LE_C0_MISS
- | LE_C0_MERR | LE_C0_RINT | LE_C0_TINT | LE_C0_IDON);
-
- /* Return if nothing to read. */
- if (!(isr & LE_C0_RINT))
- return;
-
- rmd = &ler2->ler2_rmd[le_softc.next_rmd];
- if (rmd->rmd1_bits & LE_R1_OWN)
- return;
-
- if (isr & LE_C0_ERR)
- le_error(NULL, "le_poll", ler1);
- if (rmd->rmd1_bits & LE_R1_ERR)
- {
- printf("le%d_poll: rmd status 0x%x\n", 0,
- rmd->rmd1_bits);
- length = 0;
- goto cleanup;
- }
- if ((rmd->rmd1_bits & (LE_R1_STP | LE_R1_ENP)) != (LE_R1_STP | LE_R1_ENP))
- panic("le_poll: chained packet");
-
- length = rmd->rmd3;
- if (length >= LEMTU)
- {
- length = 0;
- panic("csr0 when bad things happen: %x", ler1->ler1_rdp);
- goto cleanup;
- }
- if (!length)
- goto cleanup;
- length -= 4;
- if (length > 0)
- {
-#if 0
- /*
- * if buffer is smaller than the packet truncate it.
- * (is this wise?)
- */
- if (length > len)
- length = len;
-
- bcopy((void *)&ler2->ler2_rbuf[le_softc.next_rmd], pkt, length);
-#endif
- }
-cleanup:
- a = (u_int) & ler2->ler2_rbuf[le_softc.next_rmd];
- rmd->rmd0 = LE_GET_RECV_ADDR (a);
- rmd->rmd1_hadr = 0;
- rmd->rmd2 = -LEMTU;
- le_softc.next_rmd =
- (le_softc.next_rmd == (LERBUF - 1)) ? 0 : (le_softc.next_rmd + 1);
- rmd->rmd1_bits = LE_R1_OWN;
- /* printf ("C0: %b\n", ler1->ler1_rdp, LE_C0_BITS); TG */
-}
diff --git a/sys/arch/kbus/stand/sk/if_lereg.h b/sys/arch/kbus/stand/sk/if_lereg.h
deleted file mode 100644
index 28e2f087568..00000000000
--- a/sys/arch/kbus/stand/sk/if_lereg.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/* $OpenBSD: if_lereg.h,v 1.3 2000/12/21 16:54:55 aaron Exp $ */
-
-/*-
- * Copyright (c) 1982, 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)if_lereg.h 8.2 (Berkeley) 10/30/93
- */
-
-#define LEMTU 1518
-#define LEMINSIZE 60 /* should be 64 if mode DTCR is set */
-#define LERBUF 8
-#define LERBUFLOG2 3
-#define LE_RLEN (LERBUFLOG2 << 13)
-#define LETBUF 1
-#define LETBUFLOG2 0
-#define LE_TLEN (LETBUFLOG2 << 13)
-
-/* Local Area Network Controller for Ethernet (LANCE) registers */
-struct lereg1 {
- volatile u_short ler1_rdp; /* register data port */
- char pad[0x20 - sizeof (u_short)];/* Pad. */
- volatile u_short ler1_rap; /* register address port */
-};
-/* register addresses */
-#define LE_CSR0 0 /* Control and status register */
-#define LE_CSR1 1 /* low address of init block */
-#define LE_CSR2 2 /* high address of init block */
-#define LE_CSR3 3 /* Bus master and control */
-
-/* Control and status register 0 (csr0) */
-#define LE_C0_ERR 0x8000 /* error summary */
-#define LE_C0_BABL 0x4000 /* transmitter timeout error */
-#define LE_C0_CERR 0x2000 /* collision */
-#define LE_C0_MISS 0x1000 /* missed a packet */
-#define LE_C0_MERR 0x0800 /* memory error */
-#define LE_C0_RINT 0x0400 /* receiver interrupt */
-#define LE_C0_TINT 0x0200 /* transmitter interrupt */
-#define LE_C0_IDON 0x0100 /* initialization done */
-#define LE_C0_INTR 0x0080 /* interrupt condition */
-#define LE_C0_INEA 0x0040 /* interrupt enable */
-#define LE_C0_RXON 0x0020 /* receiver on */
-#define LE_C0_TXON 0x0010 /* transmitter on */
-#define LE_C0_TDMD 0x0008 /* transmit demand */
-#define LE_C0_STOP 0x0004 /* disable all external activity */
-#define LE_C0_STRT 0x0002 /* enable external activity */
-#define LE_C0_INIT 0x0001 /* begin initialization */
-
-#define LE_C0_BITS \
- "\20\20ERR\17BABL\16CERR\15MISS\14MERR\13RINT\
-\12TINT\11IDON\10INTR\07INEA\06RXON\05TXON\04TDMD\03STOP\02STRT\01INIT"
-
-/* Control and status register 3 (csr3) */
-#define LE_C3_BSWP 0x4 /* byte swap */
-#define LE_C3_ACON 0x2 /* ALE control, eh? */
-#define LE_C3_BCON 0x1 /* byte control */
-/*
- * Current size is 13,758 bytes with 8 x 1518 receive buffers and
- * 1 x 1518 transmit buffer.
- */
-struct lereg2 {
- /* initialization block */
- volatile u_short ler2_mode; /* mode */
- volatile u_char ler2_padr[6]; /* physical address */
-#ifdef new_code
- volatile u_short ler2_ladrf[4]; /* logical address filter */
-#else
- volatile u_long ler2_ladrf0; /* logical address filter */
- volatile u_long ler2_ladrf1; /* logical address filter */
-#endif
- volatile u_short ler2_rdra; /* receive descriptor addr */
- volatile u_short ler2_rlen; /* rda high and ring size */
- volatile u_short ler2_tdra; /* transmit descriptor addr */
- volatile u_short ler2_tlen; /* tda high and ring size */
- /* receive message descriptors. bits/hadr are byte order dependent. */
- struct lermd {
- volatile u_short rmd0; /* low address of packet */
- volatile u_char rmd1_bits; /* descriptor bits */
- volatile u_char rmd1_hadr; /* high address of packet */
- volatile short rmd2; /* buffer byte count */
- volatile u_short rmd3; /* message byte count */
- } ler2_rmd[LERBUF];
- /* transmit message descriptors */
- struct letmd {
- volatile u_short tmd0; /* low address of packet */
- volatile u_char tmd1_bits; /* descriptor bits */
- volatile u_char tmd1_hadr; /* high address of packet */
- volatile short tmd2; /* buffer byte count */
- volatile u_short tmd3; /* transmit error bits */
- } ler2_tmd[LETBUF];
- volatile char ler2_rbuf[LERBUF][LEMTU];
- volatile char *ler2_tbuf[LETBUF];
-};
-/* Initialzation block (mode) */
-#define LE_MODE_PROM 0x8000 /* promiscuous mode */
-/* 0x7f80 reserved, must be zero */
-#define LE_MODE_INTL 0x0040 /* internal loopback */
-#define LE_MODE_DRTY 0x0020 /* disable retry */
-#define LE_MODE_COLL 0x0010 /* force a collision */
-#define LE_MODE_DTCR 0x0008 /* disable transmit CRC */
-#define LE_MODE_LOOP 0x0004 /* loopback mode */
-#define LE_MODE_DTX 0x0002 /* disable transmitter */
-#define LE_MODE_DRX 0x0001 /* disable receiver */
-#define LE_MODE_NORMAL 0 /* none of the above */
-
-
-/* Receive message descriptor 1 (rmd1_bits) */
-#define LE_R1_OWN 0x80 /* LANCE owns the packet */
-#define LE_R1_ERR 0x40 /* error summary */
-#define LE_R1_FRAM 0x20 /* framing error */
-#define LE_R1_OFLO 0x10 /* overflow error */
-#define LE_R1_CRC 0x08 /* CRC error */
-#define LE_R1_BUFF 0x04 /* buffer error */
-#define LE_R1_STP 0x02 /* start of packet */
-#define LE_R1_ENP 0x01 /* end of packet */
-
-#define LE_R1_BITS \
- "\20\10OWN\7ERR\6FRAM\5OFLO\4CRC\3BUFF\2STP\1ENP"
-
-/* Transmit message descriptor 1 (tmd1_bits) */
-#define LE_T1_OWN 0x80 /* LANCE owns the packet */
-#define LE_T1_ERR 0x40 /* error summary */
-#define LE_T1_MORE 0x10 /* multiple collisions */
-#define LE_T1_ONE 0x08 /* single collision */
-#define LE_T1_DEF 0x04 /* defferred transmit */
-#define LE_T1_STP 0x02 /* start of packet */
-#define LE_T1_ENP 0x01 /* end of packet */
-
-#define LE_T1_BITS \
- "\20\10OWN\7ERR\6RES\5MORE\4ONE\3DEF\2STP\1ENP"
-
-/* Transmit message descriptor 3 (tmd3) */
-#define LE_T3_BUFF 0x8000 /* buffer error */
-#define LE_T3_UFLO 0x4000 /* underflow error */
-#define LE_T3_LCOL 0x1000 /* late collision */
-#define LE_T3_LCAR 0x0800 /* loss of carrier */
-#define LE_T3_RTRY 0x0400 /* retry error */
-#define LE_T3_TDR_MASK 0x03ff /* time domain reflectometry counter */
-
-#define LE_XMD2_ONES 0xf000
-
-#define LE_T3_BITS \
- "\20\20BUFF\17UFLO\16RES\15LCOL\14LCAR\13RTRY"
-
-
-#define LE_GET_MD_ADDR(a) (((a) & 0x7fff) | 0x8000)
-#define LE_GET_RECV_ADDR(a) ((a) & 0x7fff)
-#define LE_GET_XMIT_ADDR(a) (((a) & 0x7fff) | 0xc000)
diff --git a/sys/arch/kbus/stand/sk/intr.c b/sys/arch/kbus/stand/sk/intr.c
deleted file mode 100644
index fecbd2b3d56..00000000000
--- a/sys/arch/kbus/stand/sk/intr.c
+++ /dev/null
@@ -1,173 +0,0 @@
-#include <dev/ic/z8530reg.h>
-#include <machine/prom.h>
-#include <machine/sic.h>
-#include <machine/asi.h>
-#include <machine/asm.h>
-
-#define NOFAULT_CONTINUE 0x01
-#define NOFAULT_QUIET 0x02
-
-extern int nofault;
-
-#define CALL_ROM_COMMAND (**(void (**)(void))ROM_COMMAND)()
-#define GET_ROM_COMMAREA (*(struct prom_command_area **)ROM_COMM_AREA)
-
-void
-_exit (int val)
-{
- char *command = "reset intr";
-
- GET_ROM_COMMAREA->command_ptr = command;
- CALL_ROM_COMMAND;
-}
-
-void
-sic_init (void)
-{
- unsigned char irc_status;
- unsigned char id;
- unsigned char v;
-
- set_ipl (0x0f);
-
- printf ("1");
- /* Disable the receiver. */
- irc_status = lduba (ASI_IRXC, 0);
- while (irc_status & SIC_IRC_E)
- {
- stba (ASI_IRXC, 0, irc_status & ~SIC_IRC_E);
- irc_status = lduba (ASI_IRXC, 0);
- printf ("2");
- }
-
- /* Enable all interruptions. */
- sta (ASI_IPR, 0, 0);
-
- printf ("3");
-
- /* Set device id. */
- id = lda (ASI_BID, 0) & 0x0f;
- stba (ASI_DIR, 0, id);
-
- printf ("4");
- /* Ack int. */
- lda (ASI_ACK_IPV, 0);
-
- printf ("5");
- /* Enable the receiver. */
- stba (ASI_IRXC, 0, irc_status | SIC_IRC_E);
-
- printf ("6");
- set_ipl (0);
- *(unsigned long *)0x17030000 = 0; /* id | 0x40; */
-
- printf ("7");
- /* Enable interruptions from the system board. */
- v = *(volatile char *)0x17031000;
- putchar ('8');
- printf ("9\n");
-}
-
-void
-sendint (int boardid, int level)
-{
- printf ("sendint level %d: ", level);
- if (lduba (ASI_ITXC, 0) & SIC_ITXC_E)
- {
- printf ("busy\n");
- return;
- }
- else
- printf ("not busy...\n");
- sta (ASI_IXR, 0, ((level & 0xff) << 8) | SIC_IXR_DIR | (boardid & 0x0f));
- stba (ASI_ITXC, 0, SIC_ITXC_E);
-}
-
-#define NUMREGS 80
-
-/* Number of bytes of registers. */
-#define NUMREGBYTES (NUMREGS * 4)
-enum regnames
-{
- G0, G1, G2, G3, G4, G5, G6, G7,
- O0, O1, O2, O3, O4, O5, SP, O7,
- L0, L1, L2, L3, L4, L5, L6, L7,
- I0, I1, I2, I3, I4, I5, FP, I7,
-
- F0, F1, F2, F3, F4, F5, F6, F7,
- F8, F9, F10, F11, F12, F13, F14, F15,
- F16, F17, F18, F19, F20, F21, F22, F23,
- F24, F25, F26, F27, F28, F29, F30, F31,
- Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR,
- MMCR, FCR, FVAR, PDBA, FPAR, FTOR, FES, FTSR}; /* MMCR at 72. */
-
-
-extern int in_trap_handler;
-unsigned int hz_ticks;
-
-void
-handle_exception (unsigned long *registers)
-{
- int trap = (registers[TBR] >> 4) & 0xff;
-
- if (trap != 9 && trap != 28 && !(nofault & NOFAULT_QUIET))
- {
- printf ("Trap %d: (in: %d)\n"
- "psr = 0x%x, tbr = 0x%x, pc = 0x%x, npc = 0x%x\n",
- trap, in_trap_handler,
- registers[PSR], registers[TBR], registers[PC], registers[NPC]);
- printf ("sp = %x fp = %x\n",
- registers[SP], registers[FP]);
- printf ("MMCR = %x, FCR = %x, FVAR = %x, PDBA = %x\n",
- registers[MMCR], registers[FCR],
- registers[FVAR], registers[PDBA]);
- printf ("FPAR = %x, FTOR = %x, FES = %x, FTSR = %x\n",
- registers[FPAR], registers[FTOR],
- registers[FES], registers[FTSR]);
- printf ("DIR: %x, IPR: %x, IRC: %x, IXR: %x, IXC: %x\n",
- lduba (ASI_DIR, 0) & SIC_DIR_MASK,
- lda (ASI_IPR, 0) & SIC_IPR_MASK,
- lduba (ASI_IRXC, 0) & 0x3,
- lda (ASI_IXR, 0) & 0xffff,
- lduba (ASI_ITXC, 0) & 0x3);
- }
-
- if (trap == 9 && (nofault & NOFAULT_CONTINUE))
- {
- nofault = 0;
- registers[PC] = registers[NPC];
- registers[NPC] += 4;
- }
- else if (trap == 28)
- {
- int ipv;
-
- ipv = lda (ASI_ACK_IPV, 0) & 0xffff;
-
-#if 1
- if ((ipv & SIC_IPV_IVL) >> 8 != 141)
- printf ("interrupt: vector: %d, info: %x, IRXC: %x\n",
- (ipv & SIC_IPV_IVL) >> 8,
- ipv & 0xff,
- lduba (ASI_IRXC, 0) & 0x3);
-#endif
- stba (ASI_IRXC, 0, SIC_IRC_E);
-
- switch ((ipv & SIC_IPV_IVL) >> 8)
- {
- case 137:
- zs_intr ();
- break;
- case 135:
- le_intr ();
- break;
- case 141:
- hz_ticks++;
- break;
- default:
- printf ("No handler for %d\n", ipv >> 8);
- }
- }
- else
- _exit (1);
-}
diff --git a/sys/arch/kbus/stand/sk/main.c b/sys/arch/kbus/stand/sk/main.c
deleted file mode 100644
index 0a6b59920b5..00000000000
--- a/sys/arch/kbus/stand/sk/main.c
+++ /dev/null
@@ -1,4 +0,0 @@
-main (int argc, char *argv[])
-{
- do_cmd (argv[1]);
-}
diff --git a/sys/arch/kbus/stand/sk/panic.c b/sys/arch/kbus/stand/sk/panic.c
deleted file mode 100644
index 3d7a2cbf58b..00000000000
--- a/sys/arch/kbus/stand/sk/panic.c
+++ /dev/null
@@ -1,16 +0,0 @@
-
-#include <stdarg.h>
-#include "stand.h"
-
-__dead void
-panic(const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- printf(fmt, ap);
- printf("\n");
- va_end(ap);
- _exit ();
-}
-
diff --git a/sys/arch/kbus/stand/sk/probe.c b/sys/arch/kbus/stand/sk/probe.c
deleted file mode 100644
index 8b6392dfd6d..00000000000
--- a/sys/arch/kbus/stand/sk/probe.c
+++ /dev/null
@@ -1,235 +0,0 @@
-#include <sys/types.h>
-#include <machine/kbus.h>
-#include "idprom.h"
-#include "eeprom.h"
-#include "prom.h"
-
-int
-disp_prom_string (unsigned char *ptr, int maxlen)
-{
- int i;
- char c;
-
- for (i = 0; i < maxlen; i++)
- {
- c = ptr[i * ID_BYTE_OFFSET];
- if (c == 0)
- return i + 1;
- putchar (c);
- }
- return maxlen;
-}
-
-void
-probe_kbus (void)
-{
- unsigned char *pa;
- unsigned char *va;
- unsigned char *p;
- unsigned char c;
- unsigned char id;
- unsigned int offset;
- unsigned int size;
- unsigned int nbr_bytes_read;
- int i, j;
-
- for (i = 1; i < 8; i++)
- {
- printf ("Slot %d: ", i);
- pa = (char *)MK_IOADDR (SPACE_ID, i, 0);
- va = (unsigned char *) alloc_page ((daddr_t) pa, PG_IO | PG_V);
- again:
- nofault = NOFAULT_QUIET | NOFAULT_CONTINUE;
- id = va[0];
- if (nofault == 0)
- {
- printf ("-\n");
- continue;
- }
- printf ("id: 0x%02x -%c-", id, id & ID_MASK);
-#if 0
- for (j = 1; j < 8; j++)
- {
- nofault = NOFAULT_QUIET | NOFAULT_CONTINUE;
- c = va[j];
- if (nofault != 0)
- printf (", [%d] = 0x%02x", j, c);
- }
-#endif
-
- printf (" Minor: %d, rev: %c%c",
- va[ID_OFF_MINOR], va[ID_OFF_REVLEV1], va[ID_OFF_REVLEV2]);
- offset = ID_4BYTES_TO_LONG (va[ID_OFF_OFFSET1], va[ID_OFF_OFFSET2],
- va[ID_OFF_OFFSET3], va[ID_OFF_OFFSET4]);
- size = ID_4BYTES_TO_LONG (va[ID_OFF_SIZE1], va[ID_OFF_SIZE2],
- va[ID_OFF_SIZE3], va[ID_OFF_SIZE4]);
- printf (" offset: %ld, size: %ld", offset, size);
- nbr_bytes_read = 13;
- putchar (' ');
- nbr_bytes_read += disp_prom_string (va + ID_OFF_STRING,
- ID_MAX_STRING_SIZE);
- p = va + nbr_bytes_read * ID_BYTE_OFFSET;
- printf ("\n");
- if (nbr_bytes_read == size)
- printf ("All bytes read\n");
- else
- {
- printf ("%d bytes to read\n", size - nbr_bytes_read);
- switch (id & ID_MASK)
- {
- case ID_MEMORY_BOARD:
- printf ("Size: %d Mb\n", *p);
- break;
- case ID_SYSTEM_BOARD + 1:
- printf ("Hostid: %lx\n",
- ID_4BYTES_TO_LONG (p[ID_S_OFF_HOSTID1],
- p[ID_S_OFF_HOSTID2],
- p[ID_S_OFF_HOSTID3],
- p[ID_S_OFF_HOSTID4]));
- printf ("Serial: ");
- disp_prom_string (p + ID_S_OFF_SERIAL, ID_S_SERIAL_SIZE);
- printf ("\nEnet addr: %x:%x:%x:%x:%x:%x\n",
- p[ID_S_OFF_ENETADDR],
- p[ID_S_OFF_ENETADDR + 1 * ID_BYTE_OFFSET],
- p[ID_S_OFF_ENETADDR + 2 * ID_BYTE_OFFSET],
- p[ID_S_OFF_ENETADDR + 3 * ID_BYTE_OFFSET],
- p[ID_S_OFF_ENETADDR + 4 * ID_BYTE_OFFSET],
- p[ID_S_OFF_ENETADDR + 5 * ID_BYTE_OFFSET]);
- printf ("mfg date: ");
- disp_prom_string (p + ID_S_OFF_MFGDATE, ID_S_MFGDATE_SIZE);
- printf ("Oem flag: 0x%02x\n",
- p[ID_S_OFF_OEM_FLAG]);
- printf ("Banner: ");
- disp_prom_string (p + ID_S_OFF_BANNER, ID_S_BANNER_SIZE);
- printf ("\nCopyright: ");
- disp_prom_string (p + ID_S_OFF_COPYRIGHT, ID_S_COPYRIGHT_SIZE);
- printf ("\nLogo:\n");
- for (j = 0; j < ID_S_LOGOBITMAP_SIZE; j++)
- {
- int k;
- c = p[ID_S_OFF_LOGOBITMAP + j * ID_BYTE_OFFSET];
- for (k = 0; k < 8; k++)
- {
- putchar ((c & 0x80) ? '*': ' ');
- c <<= 1;
- }
- if ((j & 7) == 7)
- putchar ('\n');
- }
- break;
- case ID_GRAPHIC_BOARD:
- {
- int nbr_res = p[ID_G_OFF_RES_COUNT];
- int k;
-
- printf ("Type: %d, nbr of plane: %d, access size: %d, "
- "nbr of resolutions: %d\n",
- p[ID_G_OFF_TYPE], p[ID_G_OFF_NBR_PLANE],
- p[ID_G_OFF_ACCESS_SIZE], nbr_res);
- p += ID_G_OFF_FB_SIZES;
- for (k = 0; k < nbr_res; k++)
- {
- printf ("Res %d: %dx%d, xoff: %d, "
- "fb_size: 0x%08x, itbl: 0x%08x, font: 0x%08x\n",
- k,
- ID_2BYTES_TO_SHORT (p[ID_G_OFF_X_RES1],
- p[ID_G_OFF_X_RES2]),
- ID_2BYTES_TO_SHORT (p[ID_G_OFF_Y_RES1],
- p[ID_G_OFF_Y_RES2]),
- ID_2BYTES_TO_SHORT (p[ID_G_OFF_XOFFSET1],
- p[ID_G_OFF_XOFFSET2]),
- ID_4BYTES_TO_LONG (p[ID_G_OFF_FB_SIZE1],
- p[ID_G_OFF_FB_SIZE2],
- p[ID_G_OFF_FB_SIZE3],
- p[ID_G_OFF_FB_SIZE4]),
- ID_4BYTES_TO_LONG (p[ID_G_OFF_ITBL_OFF1],
- p[ID_G_OFF_ITBL_OFF2],
- p[ID_G_OFF_ITBL_OFF3],
- p[ID_G_OFF_ITBL_OFF4]),
- ID_4BYTES_TO_LONG (p[ID_G_OFF_FONT_OFF1],
- p[ID_G_OFF_FONT_OFF2],
- p[ID_G_OFF_FONT_OFF3],
- p[ID_G_OFF_FONT_OFF4]));
- p += ID_G_SIZE_FB_SIZES;
- }
- printf ("White value: 0x%08x, Black value: 0x%08x, "
- "fb offset: 0x%08x, kb offset: 0x%08x\n",
- ID_4BYTES_TO_LONG (p[ID_G_OFF_WHITE_OFF1],
- p[ID_G_OFF_WHITE_OFF2],
- p[ID_G_OFF_WHITE_OFF3],
- p[ID_G_OFF_WHITE_OFF4]),
- ID_4BYTES_TO_LONG (p[ID_G_OFF_BLACK_OFF1],
- p[ID_G_OFF_BLACK_OFF2],
- p[ID_G_OFF_BLACK_OFF3],
- p[ID_G_OFF_BLACK_OFF4]),
- ID_4BYTES_TO_LONG (p[ID_G_OFF_FB_OFF1],
- p[ID_G_OFF_FB_OFF2],
- p[ID_G_OFF_FB_OFF3],
- p[ID_G_OFF_FB_OFF4]),
- ID_4BYTES_TO_LONG (p[ID_G_OFF_KB_OFF1],
- p[ID_G_OFF_KB_OFF2],
- p[ID_G_OFF_KB_OFF3],
- p[ID_G_OFF_KB_OFF4]));
- }
- break;
- }
- }
- if (offset != 0)
- {
- printf ("Slot %d: ", i);
- va += offset;
- goto again;
- }
- }
-}
-
-void
-disp_eeprom (void)
-{
- unsigned char *va;
- unsigned char ch[16];
- int i, j;
-
- va = (unsigned char *) alloc_page ((daddr_t) 0x17002000, PG_IO | PG_V);
-
- printf ("Model: ");
- disp_prom_string (va + EEPROM_OFF_MODEL, EEPROM_SIZE_MODEL);
- printf ("\n");
- for (i = 0; i < EEPROM_SIZE; i += 16)
- {
- printf ("%03x: ", i);
- for (j = 0; j < 16; j++)
- {
- ch[j] = va[(i + j) * EEPROM_BYTE_OFFSET];
- printf ("%02x%c", ch[j], j == 7 ? '-' : ' ');
- }
- for (j = 0; j < 16; j++)
- putchar ((ch[j] < 32 || ch[j] > 127) ? '.' : ch[j]);
- putchar ('\n');
- }
-}
-
-#define ROM_VECTORS 0xff000000
-void
-disp_prom (void)
-{
- unsigned long *addr;
- int i;
- struct prom_command_area *ca;
-
- printf ("version: %s\n", *(unsigned long *)ROM_VERSION);
- printf ("DGRAM version: 0x%08x\n", *(unsigned long *)ROM_DGRAM);
- printf ("EE version: 0x%08x\n", *(unsigned long *)ROM_EEVERSION);
- printf ("ROM version: 0x%08x\n", *(unsigned long *)ROM_REVISION);
- ca = *(struct prom_command_area **) ROM_COMM_AREA;
- printf ("first_free: 0x%08x\n", ca->first_free);
- printf ("memsize: %d Mb\n", ca->memsize);
- printf ("ramdisk: 0x%08x\n", ca->ramdisk);
- printf ("iomap_addr: 0x%08x\n", ca->iomap_addr);
- printf ("row: %d, col: %d\n", ca->row, ca->col);
- printf ("silent: %d\n", ca->silent);
- addr = (unsigned long *)ca->iomap_addr;
- for (i = 0; i < 10; i++)
- printf ("%d: 0x%08x\n", i, addr[i]);
-
-}
diff --git a/sys/arch/kbus/stand/sk/prom.h b/sys/arch/kbus/stand/sk/prom.h
deleted file mode 100644
index b39cfe32d6c..00000000000
--- a/sys/arch/kbus/stand/sk/prom.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#define ROM_VECTORS 0xff000000
-
-#define ROM_VERSION (ROM_VECTORS + 0)
-#define ROM_COMM_AREA (ROM_VECTORS + 8)
-#define ROM_COMMAND (ROM_VECTORS + 16)
-#define ROM_SLAVEHALT (ROM_VECTORS + 24)
-#define ROM_MSGBUFP (ROM_VECTORS + 32)
-#define ROM_DGRAM (ROM_VECTORS + 40)
-#define ROM_EEVERSION (ROM_VECTORS + 48)
-#define ROM_REVISION (ROM_VECTORS + 56)
-
-struct prom_command_area
-{
- char *command_ptr;
- int ret_val;
- int first_free;
- int memsize;
- int ramdisk;
- char *iomap_addr;
- int (*slave_start)();
- int row;
- int col;
- int silent;
-};
diff --git a/sys/arch/kbus/stand/sk/promboot.c b/sys/arch/kbus/stand/sk/promboot.c
deleted file mode 100644
index 1b203999eb1..00000000000
--- a/sys/arch/kbus/stand/sk/promboot.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/* $OpenBSD: promboot.c,v 1.2 2000/03/03 00:54:51 todd Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
- * 4. The name of the Author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include "stand.h"
-#include "promboot.h"
-
-char prom_bootdev[32];
-char prom_bootfile[32];
-int prom_boothow;
-int debug;
-
-void
-prom_get_boot_info()
-{
-#if 0
- char c, *src, *dst;
- extern int devlun, ctrlun;
- extern char *oparg, *opargend;
-
-#ifdef DEBUG
- printf("prom_get_boot_info\n");
-#endif
-
- /* Get kernel filename */
- src = oparg;
- while (src && (*src == ' ' || *src == '\t'))
- src++;
-
- dst = prom_bootfile;
- if (src && *src != '-') {
- while (src && *src) {
- if (*src == ' ' || *src == '\t')
- break;
- *dst++ = *src++;
- }
- }
- *dst = '\0';
-
- /* Get boothowto flags */
- while (src && (*src == ' ' || *src == '\t'))
- src++;
- if (src && (*src == '-')) {
- while (*src) {
- switch (*src++) {
- case 'a':
- prom_boothow |= RB_ASKNAME;
- break;
- case 's':
- prom_boothow |= RB_SINGLE;
- break;
- case 'd':
- prom_boothow |= RB_KDB;
- debug = 1;
- break;
- }
- }
- }
-#ifdef DEBUG
- printf("promboot: device=\"%s\" file=\"%s\" how=0x%x\n",
- prom_bootdev, prom_bootfile, prom_boothow);
-#endif
-#endif
-}
diff --git a/sys/arch/kbus/stand/sk/promboot.h b/sys/arch/kbus/stand/sk/promboot.h
deleted file mode 100644
index 86b5aace21c..00000000000
--- a/sys/arch/kbus/stand/sk/promboot.h
+++ /dev/null
@@ -1,5 +0,0 @@
-
-extern char prom_bootdev[];
-extern char prom_bootfile[];
-extern int prom_boothow;
-
diff --git a/sys/arch/kbus/stand/sk/promcons.c b/sys/arch/kbus/stand/sk/promcons.c
deleted file mode 100644
index 2c4cee4bbe4..00000000000
--- a/sys/arch/kbus/stand/sk/promcons.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* $OpenBSD: promcons.c,v 1.2 2000/03/03 00:54:52 todd Exp $ */
-
-/*
- * Copyright (c) 1996 Nivas Madhur
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
- * 4. The name of the Author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdarg.h>
-#include <sys/types.h>
-
-int
-getchar()
-{
- char c;
-
- __asm volatile("or r9, r0, 0\n
- tb0 0, r0, 496\n
- st.b r2, %0" : "=m" (c));
- return (c);
-}
-
-peekchar()
-{
- int have = 0;
-
- __asm volatile("or r9, r0, 1\n
- tb0 0, r0, 496\n
- bb1 2, r2, 1f\n
- or r2,r0, 1\n
- st r2, %0\n1:" : "=m" (have) :);
- return (have);
-}
-
-void
-putchar(c)
- int c;
-{
- if (c == '\n')
- putchar('\r');
- __asm volatile("or r9, r0, 0x20\n
- or r2, r0, %0\n
- tb0 0, r0, 496\n" : : "r" (c));
-}
-
diff --git a/sys/arch/kbus/stand/sk/version.c b/sys/arch/kbus/stand/sk/version.c
deleted file mode 100644
index ef29a415411..00000000000
--- a/sys/arch/kbus/stand/sk/version.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/* $OpenBSD: version.c,v 1.2 2000/03/03 00:54:52 todd Exp $ */
-
-/*
- * NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE.
- *
- * 1.1
- */
-
-char version[] = "$Revision: 1.2 $";
diff --git a/sys/arch/kbus/stand/sk/zs.c b/sys/arch/kbus/stand/sk/zs.c
deleted file mode 100644
index 4e1eae5dffb..00000000000
--- a/sys/arch/kbus/stand/sk/zs.c
+++ /dev/null
@@ -1,218 +0,0 @@
-#include <dev/ic/z8530reg.h>
-#include <machine/prom.h>
-#include <machine/asm.h>
-
-void udelay (unsigned long usec);
-
-static unsigned char *zs0_a = (unsigned char *) 0x17012020;
-static unsigned char *zs0_b = (unsigned char *) 0x17012000;
-static unsigned char *zs_ms = (unsigned char *) 0x17011020;
-static unsigned char *zs_kb = (unsigned char *) 0x17011000;
-
-void
-zs_reg_write (unsigned char *zs_addr, unsigned char reg, unsigned char val)
-{
- *zs_addr = reg;
- udelay (2);
- *zs_addr = val;
-}
-
-unsigned char
-zs_reg_read (unsigned char *zs_addr, unsigned char reg)
-{
- *zs_addr = reg;
- udelay (2);
- return *zs_addr;
-}
-
-void
-zs0_putc (char c)
-{
- unsigned char r0;
-
- /* Wait until Tx is free. */
- do
- {
- *zs0_a = 0;
- udelay (2);
- }
- while ((*zs0_a & ZSRR0_TX_READY) == 0);
-
- /* Write the character. */
- zs0_a[0x10] = c;
- udelay (2);
-
- /* Wait until transmission. */
- do
- {
- *zs0_a = 0;
- udelay (2);
- }
- while ((*zs0_a & ZSRR0_TX_READY) == 0);
-}
-
-void
-putchar (char c)
-{
- if (c == '\n')
- zs0_putc ('\r');
- zs0_putc (c);
-}
-
-int
-getchar (void)
-{
- unsigned char r0;
-
- /* Wait until Rx is free. */
- do
- {
- *zs0_a = 0;
- udelay (2);
- }
- while ((*zs0_a & ZSRR0_RX_READY) == 0);
-
- /* Read the character. */
- return zs0_a[0x10];
-}
-
-void
-udelay (unsigned long usec)
-{
- register int i;
-
- while (usec--)
- for (i = 20; i; i--)
- ;
-}
-
-
-static void
-zs_loadreg (char *zsc, char *reg)
-{
- /* Reset int. */
- zs_reg_write (zsc, 0, ZSM_RESET_STINT);
- zs_reg_write (zsc, 0, ZSM_RESET_TXINT);
- zs_reg_write (zsc, 0, ZSM_RESET_ERR);
- zs_reg_write (zsc, 0, ZSM_RESET_IUS);
-
- /* Set vector. */
- zs_reg_write (zsc, 2, reg[2]);
-
- zs_reg_write (zsc, 3, reg[3] & ~ZSWR3_RX_ENABLE);
-
- zs_reg_write (zsc, 4, reg[4]);
-
- zs_reg_write (zsc, 5, reg[5] & ~ZSWR5_TX_ENABLE);
-
- zs_reg_write (zsc, 9, reg[9]);
-
- zs_reg_write (zsc, 10, reg[10]);
-
- zs_reg_write (zsc, 11, reg[11]);
- zs_reg_write (zsc, 12, reg[12]);
- zs_reg_write (zsc, 13, reg[13]);
- zs_reg_write (zsc, 14, reg[14]);
- zs_reg_write (zsc, 15, reg[15]);
-
- zs_reg_write (zsc, 3, reg[3]);
- zs_reg_write (zsc, 5, reg[5]);
- zs_reg_write (zsc, 1, reg[1]);
-}
-
-void
-set_zs (char *zsc)
-{
- static char regs[16]=
- {
- 0, /* 0 */
- /* ZSWR1_RIE | */ ZSWR1_SIE,
- 64, /* Vector. */
- ZSWR3_RX_8 | ZSWR3_RX_ENABLE,
- ZSWR4_CLK_X16 | ZSWR4_ONESB,
- ZSWR5_TX_8 | ZSWR5_TX_ENABLE,
- 0,
- 0,
- 0,
- ZSWR9_MASTER_IE, /* 9 */
- 0,
- ZSWR11_RXCLK_BAUD | ZSWR11_TXCLK_BAUD,
- 10, /* 12: baud rate. */
- 0,
- ZSWR14_BAUD_FROM_PCLK | ZSWR14_BAUD_ENA,
- ZSWR15_BREAK_IE
- };
- zs_loadreg (zsc, regs);
- zs_reg_write (zsc, 0, ZSWR0_CLR_INTR);
-}
-
-void
-set_kbd_zs (char *zsc)
-{
- static char regs[16]=
- {
- 0, /* 0 */
- 0, /* ZSWR1_RIE | ZSWR1_SIE, */
- 64, /* Vector. */
- ZSWR3_RX_8 | ZSWR3_RX_ENABLE,
- ZSWR4_CLK_X1 | ZSWR4_ONESB | ZSWR4_PARENB,
- ZSWR5_TX_8 | ZSWR5_TX_ENABLE,
- 0,
- 0,
- 0,
- ZSWR9_MASTER_IE, /* 9 */
- 0,
- ZSWR11_RXCLK_RTXC | ZSWR11_TXCLK_RTXC
- | ZSWR11_TRXC_OUT_ENA | ZSWR11_TRXC_BAUD,
-#ifdef HZ_100
- /* HZ = 100 */
- 0xd2, /* 12: baud rate. */
- 0x30,
-#else
- /* HZ = 60 */
- 0x5c,
- 0x51,
-#endif
- ZSWR14_BAUD_FROM_PCLK | ZSWR14_BAUD_ENA,
- 0
- };
- zs_loadreg (zsc, regs);
- zs_reg_write (zsc, 0, ZSWR0_CLR_INTR);
-}
-
-void
-disp_zs0_b (void)
-{
- int brg;
-
- set_zs (zs0_a);
- brg = ((zs_reg_read (zs0_a, 13) & 0xff) << 8)
- | (zs_reg_read (zs0_a, 12) & 0xff);
- printf ("brg = %d\n", brg);
- printf ("clock: %d\n", (brg + 2) * 2 * 9600 * 16);
-}
-
-void
-init_kbd (void)
-{
- set_kbd_zs (zs_kb);
-}
-
-void
-zs_intr (void)
-{
- char rr3 = zs_reg_read (zs0_a, 3);
-#if 1
- printf ("ZS status: 0x%x, pending: 0x%x\n",
- zs_reg_read (zs0_a, 0), rr3);
-#else
- putchar ('I');
-#endif
-#if 0
- /* Ack it. */
- if (rr3 & ZSRR3_IP_A_RX)
- printf ("char: 0x%x\n", zs0_a[0x10]);
-#endif
- zs_reg_write (zs0_a, 0, ZSWR0_RESET_STATUS);
- zs_reg_write (zs0_a, 0, ZSWR0_CLR_INTR);
-}
diff --git a/sys/arch/pc532/Makefile b/sys/arch/pc532/Makefile
deleted file mode 100644
index 56051070bd5..00000000000
--- a/sys/arch/pc532/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-# $NetBSD: Makefile,v 1.2 1994/10/26 08:23:50 cgd Exp $
-
-# @(#)Makefile 7.3 (Berkeley) 6/9/91
-
-COMM= ../net/*.[ch] ../netimp/*.[ch] ../netinet/*.[ch] ../netns/*.[ch] \
- ../netiso/*.[ch] ../netccitt/*.[ch] \
- ../kern/*.c ../ufs/*.[ch] ../nfs/*.[ch] ../vm/*.[ch] ../sys/*.h
-
-# Makefile for pc532 tags file
-
-SUBDIR= stand
-
-TPC532= ../pc532/tags
-SPC532= ../pc532/pc532/*.[ch] ../pc532/include/*.h \
- ../pc532/dev/*.[ch] ../pc532/scsi/*.[ch]
-APC532= ../pc532/pc532/*.s
-
-# Directories in which to place pc532 tags links
-DPC532= dev include scsi
-
-tags:
- -ctags -dtf ${TPC532} ${COMM} ${SPC532}
- egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${APC532} | \
- sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
- >> ${TPC532}
- sort -o ${TPC532} ${TPC532}
-
-links:
- -for i in ${DPC532}; do \
- cd ../$$i && rm -f tags; ln -s ../tags tags; done
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/pc532/To.Do b/sys/arch/pc532/To.Do
deleted file mode 100644
index 225f3d636bc..00000000000
--- a/sys/arch/pc532/To.Do
+++ /dev/null
@@ -1,34 +0,0 @@
-$NetBSD: To.Do,v 1.5 1995/12/07 07:55:11 phil Exp $
-
-This is the "To Do" list for NetBSD/pc532
- (Order is not in order of importance.)
- (Last updated, 12/6/95)
-
-- improve scn driver (integrate mods from Phil Bunde)
-
-- get kernel debugger working
-
-- get the ncr interrupt driven scsi driver working debugged
-
-- write an aic scsi driver
-
-- improve copyin/out and friends (kernel work)
-
-- remove double mapping of the user area (kernel work)
-
-- get gdb working (partially done) including kernel debugging
-
-- man4 man pages
-
-- man8 man pages
-
-- mods to better support ffs boot loader
-
-- improve bim (detect a non-writeable disklabel, ...)
- write a bim.8
-
-- find or write a "usable" comm package to replace kermit for
- initial downloading.
-
-- find out why profiling does not accumulate any time
-
diff --git a/sys/arch/pc532/compile/.cvsignore b/sys/arch/pc532/compile/.cvsignore
deleted file mode 100644
index bb3497f0d62..00000000000
--- a/sys/arch/pc532/compile/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-DEFAULT
-INSTALL
-KLONDIKE
-STEELHEAD
diff --git a/sys/arch/pc532/conf/DEFAULT b/sys/arch/pc532/conf/DEFAULT
deleted file mode 100644
index 624b38c21f4..00000000000
--- a/sys/arch/pc532/conf/DEFAULT
+++ /dev/null
@@ -1,91 +0,0 @@
-#
-# DEFAULT: default install kernel
-# Only has scn0-5 are configured.
-# Instead of scn6/7 the lpt0/1 devices get into the kernel.
-#
-
-machine pc532
-
-maxusers 8 # estimated number of users
-options TIMEZONE=0, DST=0 # time zone to read RTC in
-options SWAPPAGER # paging
-options DEVPAGER # device node caching
-
-#options DDB # kernel debugger; recommended
-#options DIAGNOSTIC # internal consistency checking
-options KTRACE # system call tracing, a la ktrace(1)
-
-#options ACCOUNTING # process accounting
-options FIFO # fifos; recommended
-#options SYSVSHM # System V shared memory; broken
-#options SHMMAXPGS=1024
-#options LKM # loadable kernel modules
-
-# compatibility options
-#options COMPAT_09 # NetBSD 0.9,
-#options COMPAT_10 # NetBSD 1.0,
-options COMPAT_43 # and 4.3BSD
-#options TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD
-
-# file system options
-#options QUOTA # file system quotas
-options FFS # Berkeley fast file system
-#options LFS # log-structered file system
-options MFS # memory file system; uses RAM and swap
-options MSDOSFS # MS-DOS file system
-options CD9660 # ISO 9660 CD-ROM file system, with RR
-options NULLFS # loopback file system
-#options UMAPFS # NULLFS + uid and gid remapping
-options UNION # union file system
-#options PORTAL # /portal
-options FDESC # /dev/fd
-options KERNFS # /kern
-options PROCFS # /proc
-#options NFSSERVER # Network File System server
-options NFSCLIENT # Network File System client
-
-# networking options
-#options GATEWAY # packet forwarding
-options INET # IP + ICMP + TCP + UDP
-#options NS # XNS
-#options ISO,TPIP # OSI
-#options EON # OSI tunneling over IP
-#options CCITT,LLC,HDLC # X.25
-
-# pc532 specific options
-#options COMDEF_SPEED=B19200 # default baud on the scn chips
-options PLIP # PLIP driver in dev/lpt.c
-options DEV_RTC # RTC driver in pc532/mem.c
-options NO_INLINE_SPLX # don't inline splx calls
-
-config netbsd swap generic
-options GENERIC
-
-membus0 at root
-
-#ncr0 at membus?
-oldncr0 at membus?
-
-scsibus0 at scsi?
-
-sd* at scsibus? target ? lun ? # SCSI disks
-st* at scsibus? target ? lun ? # SCSI tapes
-cd* at scsibus? target ? lun ? # SCSI CD-ROMs
-
-scn0 at membus?
-scn1 at membus?
-scn2 at membus?
-scn3 at membus?
-scn4 at membus?
-scn5 at membus?
-
-lpt0 at membus? addr 0xffc80030 irq 7
-lpt1 at membus? addr 0xffc80034 irq 6
-
-pseudo-device pty 16 # pseudo-terminals
-pseudo-device loop 1 # loopback network
-pseudo-device vnd 2 # vnode devices
-pseudo-device bpfilter 4 # packet filter
-pseudo-device sl 1 # compressed SLIP
-pseudo-device ppp 1 # Point-to-Point Protocol
-pseudo-device tun 1 # network tunneling
diff --git a/sys/arch/pc532/conf/INSTALL b/sys/arch/pc532/conf/INSTALL
deleted file mode 100644
index d57b4758267..00000000000
--- a/sys/arch/pc532/conf/INSTALL
+++ /dev/null
@@ -1,65 +0,0 @@
-# $NetBSD: INSTALL,v 1.4 1995/11/30 00:58:39 jtc Exp $
-#
-# INSTALL -- install kernel
-#
-#
-
-# architecture type and name of kernel; REQUIRED
-machine "pc532"
-
-# time zone RTC is expected to be set in; REQUIRED
-options TIMEZONE=0, DST=0 # time zone to read RTC in
-options GENERIC
-
-# estimated number of users
-maxusers 2
-
-# paging of processes, and caching devices; REQUIRED
-options SWAPPAGER
-options DEVPAGER
-
-# networking options
-#options INET
-
-# generic SCSI system
-options SCSI
-
-# filesystems
-#options FIFO
-options MSDOSFS
-options FFS
-#options NFSCLIENT
-options CD9660
-
-# pc532 special options
-# options PLIP
-options NO_INLINE_SPLX
-
-config "netbsd" swap generic
-
-membus0 at root
-
-rd0 at membus?
-options RD_SIZE=0x200000
-
-#ncr0 at membus?
-oldncr0 at membus?
-scsibus0 at scsi?
-
-sd* at scsibus? target ? lun ?
-st* at scsibus? target ? lun ?
-cd* at scsibus? target ? lun ?
-
-scn0 at membus?
-scn1 at membus?
-scn2 at membus?
-scn3 at membus?
-#scn4 at membus?
-#scn5 at membus?
-
-#lpt0 at membus? addr 0xffc80030 irq 7
-#lpt1 at membus? addr 0xffc80034 irq 6
-
-#pseudo-device loop 1 # loopback network
-#pseudo-device sl 1 # compressed SLIP
-#pseudo-device ppp 1 # Point-to-Point Protocol
diff --git a/sys/arch/pc532/conf/KLONDIKE b/sys/arch/pc532/conf/KLONDIKE
deleted file mode 100644
index 9b9818694a0..00000000000
--- a/sys/arch/pc532/conf/KLONDIKE
+++ /dev/null
@@ -1,85 +0,0 @@
-# $NetBSD: KLONDIKE,v 1.3 1996/01/26 05:12:58 phil Exp $
-#
-# KLONDIKE: Matthias Pfaller's pc532
-#
-
-machine pc532
-
-maxusers 8 # estimated number of users
-options TIMEZONE=0, DST=0 # time zone to read RTC in
-options SWAPPAGER # paging
-options DEVPAGER # device node caching
-
-#options DDB # kernel debugger; recommended
-#options DIAGNOSTIC # internal consistency checking
-options KTRACE # system call tracing, a la ktrace(1)
-
-#options ACCOUNTING # process accounting
-options FIFO # fifos; recommended
-#options SYSVSHM # System V shared memory; broken
-#options SHMMAXPGS=1024
-#options LKM # loadable kernel modules
-
-# compatibility options
-options COMPAT_43 # 4.3 system calls
-
-# file system options
-#options QUOTA # file system quotas
-options FFS # Berkeley fast file system
-#options LFS # log-structered file system
-options MFS # memory file system; uses RAM and swap
-options MSDOSFS # MS-DOS file system
-options CD9660 # ISO 9660 CD-ROM file system, with RR
-options NULLFS # loopback file system
-#options UMAPFS # NULLFS + uid and gid remapping
-options UNION # union file system
-#options PORTAL # /portal
-#options FDESC # /dev/fd
-options KERNFS # /kern
-options PROCFS # /proc
-options NFSSERVER # Network File System server
-options NFSCLIENT # Network File System client
-
-# networking options
-#options GATEWAY # packet forwarding
-options INET # IP + ICMP + TCP + UDP
-#options NS # XNS
-#options ISO,TPIP # OSI
-#options EON # OSI tunneling over IP
-#options CCITT,LLC,HDLC # X.25
-
-# pc532 specific options
-options COMDEF_SPEED=B19200 # default baud on the scn chips
-options CON_BRK_PANIC # 3 breaks on tty0 -> panic? y/n
-options PLIP # PLIP driver in dev/lpt.c
-options DEV_RTC # RTC driver in pc532/mem.c
-
-config netbsd root on sd0a swap on sd0b and sd1b
-
-membus0 at root
-#clock0 at membus?
-#timer0 at membus?
-
-ncr0 at membus?
-
-scsibus0 at scsi?
-
-sd* at scsibus? target ? lun ? # SCSI disks
-st* at scsibus? target ? lun ? # SCSI tapes
-cd* at scsibus? target ? lun ? # SCSI CD-ROMs
-
-scn0 at membus?
-scn1 at membus?
-scn2 at membus?
-scn3 at membus?
-
-lpt0 at membus? addr 0xffc80030 irq 7
-lpt1 at membus? addr 0xffc80034 irq 6
-
-pseudo-device pty 16 # pseudo-terminals
-pseudo-device loop 1 # loopback network
-pseudo-device vnd 2 # vnode devices
-#pseudo-device bpfilter 4 # packet filter
-pseudo-device sl 1 # compressed SLIP
-#pseudo-device ppp 1 # Point-to-Point Protocol
-#pseudo-device tun 1 # ip tunneling
diff --git a/sys/arch/pc532/conf/Makefile.pc532 b/sys/arch/pc532/conf/Makefile.pc532
deleted file mode 100644
index a3b01a3ad36..00000000000
--- a/sys/arch/pc532/conf/Makefile.pc532
+++ /dev/null
@@ -1,156 +0,0 @@
-# $NetBSD: Makefile.pc532,v 1.15 1996/01/14 21:06:52 thorpej Exp $
-
-# Copyright 1990 W. Jolitz
-# @(#)Makefile.i386 7.1 5/10/91
-#
-# Makefile for NetBSD/532
-#
-# Edited by Philip A. Nelson
-#
-# This makefile is constructed from a machine description:
-# config machineid
-# Most changes should be made in the machine description
-# /sys/arch/pc532/conf/``machineid''
-# after which you should do
-# config machineid
-# Generic makefile changes should be made in
-# /sys/arch/pc532/conf/Makefile.pc532
-# after which config should be rerun for all machines.
-#
-# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE INVISIBLE TO MAKEFILE
-# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
-#
-# -DTRACE compile in kernel tracing hooks
-# -DQUOTA compile in file system quotas
-#
-
-TOUCH= touch -f -c
-AS= as
-LD= ld
-CC= cc
-CPP= cpp
-AWK= awk
-
-S= ../../../..
-PC532= ../..
-
-.s.o:; (${CPP} ${COPTS} ${PC532}/pc532/$*.s | ${AS} ${ASFLAGS} -o $*.o)
-
-INCLUDES= -I. -I$S -I$S/sys -I${PC532}
-COPTS= ${INCLUDES} ${IDENT} -D_KERNEL
-ASFLAGS=
-CFLAGS= -O -Werror -msb ${COPTS}
-
-### find out what to use for libkern
-.include "$S/lib/libkern/Makefile.inc"
-.ifndef PROF
-LIBKERN= ${KERNLIB}
-.else
-LIBKERN= ${KERNLIB_PROF}
-.endif
-
-### find out what to use for libcompat
-.include "$S/compat/common/Makefile.inc"
-.ifndef PROF
-LIBCOMPAT= ${COMPATLIB}
-.else
-LIBCOMPAT= ${COMPATLIB_PROF}
-.endif
-
-NORMAL_S= (${CPP} ${COPTS} ${PROF} $< | ${AS} ${ASFLAGS} -o $*.o)
-NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
-NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
-DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
-DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
-SYSTEM_OBJS=locore.o ${OBJS} param.o ioconf.o conf.o ${LIBKERN} \
- ${LIBCOMPAT}
-SYSTEM_DEP=Makefile ${SYSTEM_OBJS}
-SYSTEM_LD_HEAD= @echo loading $@; rm -f $@
-SYSTEM_LD= @${LD} -z -T FE002000 -o $@ -X vers.o ${SYSTEM_OBJS}
-SYSTEM_LD_TAIL= size $@ ; nm -n $@ > SYMMS ; chmod 755 $@
-
-%OBJS
-
-%CFILES
-
-%LOAD
-
-clean::
- rm -f eddep *netbsd tags *.o locore.i [a-uw-z]*.s \
- errs linterrs makelinks genassym
-
-#lint: /tmp param.c
-# @lint -hbxn -I. -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
-# ${CFILES} ioconf.c param.c | \
-# grep -v 'struct/union .* never defined' | \
-# grep -v 'possible pointer alignment problem'
-
-locore.o: assym.h ${PC532}/pc532/locore.s \
- ${PC532}/pc532/bcopy.s ${PC532}/pc532/bzero.s
-
-# the following is necessary because autoconf.o depends on #if GENERIC
-autoconf.o: Makefile
-
-# depend on network configuration
-af.o uipc_domain.o uipc_proto.o locore.o: Makefile
-if_tun.o if_loop.o if_ethersubr.o: Makefile
-in_proto.o: Makefile
-
-# depend on maxusers
-assym.s machdep.o: Makefile
-
-# depends on KDB (cons.o also depends on GENERIC)
-trap.o cons.o: Makefile
-
-assym.s: $S/sys/param.h machine/pte.h $S/sys/buf.h \
- $S/sys/vmmeter.h \
- $S/sys/proc.h $S/sys/msgbuf.h machine/vmparam.h
-
-assym.h: genassym
- ./genassym >assym.h
-
-genassym: ${PC532}/pc532/genassym.c
- ${CC} -static ${INCLUDES} -D_KERNEL ${IDENT} ${PARAM} \
- ${PC532}/pc532/genassym.c -o genassym
-
-depend: assym.h param.c
- sh /usr/bin/mkdep ${COPTS} ${CFILES} ioconf.c
- sh /usr/bin/mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${PC532}/pc532/genassym.c
-
-links:
- egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
- sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
- echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
- sort -u | comm -23 - dontlink | \
- sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
- sh makelinks && rm -f dontlink
-
-tags:
- @echo "see $S/kern/Makefile for tags"
-
-ioconf.o: ioconf.c $S/sys/param.h $S/sys/buf.h \
- ${PC532}/dev/device.h machine/icu.h
- ${CC} -c ${CFLAGS} ioconf.c
-
-conf.o: $S/sys/param.h $S/sys/systm.h $S/sys/buf.h $S/sys/ioctl.h \
- $S/sys/tty.h $S/sys/conf.h ${PC532}/pc532/conf.c
- ${CC} -traditional -c ${CFLAGS} ${PC532}/pc532/conf.c
-
-param.c: $S/conf/param.c
- -rm -f param.c
- cp $S/conf/param.c .
-
-param.o: param.c Makefile
- ${CC} -c ${CFLAGS} ${PARAM} param.c
-
-vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
- sh $S/conf/newvers.sh
- ${CC} ${CFLAGS} -c vers.c
-
-# for config.new
-newvers:
- sh $S/conf/newvers.sh
- ${CC} ${CFLAGS} -c vers.c
-
-%RULES
-
diff --git a/sys/arch/pc532/conf/STEELHEAD b/sys/arch/pc532/conf/STEELHEAD
deleted file mode 100644
index d89314eccaa..00000000000
--- a/sys/arch/pc532/conf/STEELHEAD
+++ /dev/null
@@ -1,86 +0,0 @@
-# $NetBSD: STEELHEAD,v 1.11 1996/01/25 19:36:36 phil Exp $
-#
-# STEELHEAD: Phil Nelson's pc532
-#
-machine "pc532"
-
-maxusers 10 # estimated number of users
-options TIMEZONE=0, DST=0 # time zone to read RTC in
-options SWAPPAGER # paging
-options DEVPAGER # device node caching
-#options DDB # kernel debugger; not working
-#options DIAGNOSTIC # internal consistency checking
-
-#options ACCOUNTING # process accounting
-options KTRACE # system call tracing, a la ktrace(1)
-options FIFO # fifos; recommended
-#options SYSVSHM # System V shared memory; broken
-#options "SHMMAXPGS=1024"
-#options LKM # loadable kernel modules
-
-# compatibility options
-options "COMPAT_43" # 4.3 system calls
-#options "TCP_COMPAT_42" # 4.2 networking ABI
-options "COMPAT_09" # NetBSD-0.9
-options "COMPAT_10" # NetBSD-1.0
-
-# file system options
-#options QUOTA # file system quotas
-options FFS # Berkeley fast file system
-#options FASTLINKS # fast symbolic links in FFS
-#options MFS # memory file system; uses RAM and swap
-options NFSSERVER # Network File System server
-options NFSCLIENT # Network File System client
-#options ISOFS # ISO 9660 CD-ROM file system, with RR
-#options MSDOSFS # MS-DOS FAT file system
-options FDESC # /dev/fd
-options KERNFS # kernel file system; recommended
-
-# networking options
-#options GATEWAY # packet forwarding
-options INET # IP
-#options NS # XNS
-#options CCITT # X.25
-#options ISO # OSI
-#options TPIP # ?
-#options EON # ?
-
-# pc532 specific options
-options "CONSOLE_SPEED=B19200" # default baud on the console (tty00)
-#options "RAMD_SIZE=1536000" # Size of the "boot strap ram disk"
-#options "RAMD_ADR=0x400000" # Adr of the "boot strap ram disk"
-options "CONFIG_NEW" # Use config.new stuff
-options "DEV_RTC" # /dev/rtc access to hardware clock
-options "CON_BRK_PANIC" # 3 breaks on tty0 -> panic? y/n
-
-config "netbsd" root on sd0 swap on sd0 and sd1 and vnd0a
-
-membus0 at root
-
-#rd0 at membus?
-
-#ncr0 at membus?
-oldncr0 at membus?
-
-scsibus0 at scsi?
-
-sd* at scsibus? target ? lun ? # SCSI disks
-st* at scsibus? target ? lun ? # SCSI tapes
-#cd* at scsibus? target ? lun ? # SCSI ???
-
-scn0 at membus?
-scn1 at membus?
-scn2 at membus?
-scn3 at membus?
-scn4 at membus?
-scn5 at membus?
-scn6 at membus?
-scn7 at membus?
-
-pseudo-device pty 16 # pseudo-terminals
-pseudo-device loop 1 # loopback network
-pseudo-device bpfilter 4 # packet filter
-pseudo-device sl 3 # compressed SLIP
-pseudo-device ppp 2 # Point-to-Point Protocol
-pseudo-device vnd 4 # Vnode devices
-#pseudo-device ether #
diff --git a/sys/arch/pc532/conf/files.pc532 b/sys/arch/pc532/conf/files.pc532
deleted file mode 100644
index 4e2b57d0da1..00000000000
--- a/sys/arch/pc532/conf/files.pc532
+++ /dev/null
@@ -1,82 +0,0 @@
-# $NetBSD: files.pc532,v 1.16 1995/11/30 00:58:42 jtc Exp $
-#
-# new style config file for pc532 architecture
-#
-
-# maxpartitions must be first item in files.${ARCH}.newconf
-maxpartitions 8
-
-maxusers 2 16 64
-
-device membus at root {[addr = -1], [irq = -1]}
-
-major {vnd = 5}
-
-device rd at membus: disk
-file arch/pc532/dev/rd.c rd needs-count
-major {rd = 3}
-
-#device timer at membus
-#device clock at membus
-file arch/pc532/pc532/clock.c # clock timer
-
-device scn at membus: tty
-file arch/pc532/dev/scn.c scn needs-flag
-
-device lpt at membus: ether, ifnet
-file arch/pc532/dev/lpt.c lpt needs-count
-
-define scsi {}
-
-device ncr at membus: scsi
-file arch/pc532/dev/ncr.c ncr needs-count
-device oldncr at membus: scsi
-file arch/pc532/dev/oldncr.c oldncr needs-count
-device dp at membus: scsi
-file arch/pc532/dev/dp.c dp needs-count
-device aic at membus: scsi
-file arch/pc532/dev/aic.c aic needs-count
-
-device scsibus at scsi {target = -1, lun = -1}
-
-device cd at scsibus: disk
-file scsi/cd.c cd needs-flag
-major {cd = 4}
-device sd at scsibus: disk
-file scsi/sd.c sd needs-flag
-major {sd = 0}
-device st at scsibus: tape
-file scsi/st.c st needs-flag
-major {st = 2}
-device ch at scsibus: disk
-file scsi/ch.c ch needs-flag
-device uk at scsibus: disk
-file scsi/uk.c uk needs-flag
-device su at scsibus: disk
-file scsi/su.c su needs-flag
-device ss at scsibus: tape
-file scsi/ss.c ss needs-flag
-
-file dev/cons.c
-file dev/cninit.c
-file scsi/scsiconf.c scsi
-file scsi/scsi_base.c scsi
-file scsi/scsi_ioctl.c scsi
-file arch/pc532/pc532/autoconf.c
-file arch/pc532/pc532/db_disasm.c ddb
-file arch/pc532/pc532/db_interface.c ddb
-file arch/pc532/pc532/db_trace.c ddb
-file arch/pc532/pc532/disksubr.c disk
-file arch/pc532/pc532/icuinit.c
-file arch/pc532/pc532/in_cksum.c inet
-file arch/pc532/pc532/intr.c
-file arch/pc532/pc532/machdep.c
-file arch/pc532/pc532/mem.c
-file arch/pc532/pc532/ns_cksum.c ns
-#file arch/pc532/pc532/ntoh.s
-file arch/pc532/pc532/pmap.c
-file arch/pc532/pc532/process_machdep.c
-file arch/pc532/pc532/random.s
-file arch/pc532/pc532/sys_machdep.c
-file arch/pc532/pc532/trap.c
-file arch/pc532/pc532/vm_machdep.c
diff --git a/sys/arch/pc532/dev/aic.c b/sys/arch/pc532/dev/aic.c
deleted file mode 100644
index f0c3e022f38..00000000000
--- a/sys/arch/pc532/dev/aic.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/* $NetBSD: aic.c,v 1.4 1995/08/12 20:31:10 mycroft Exp $ */
-
-/* Written by Phil Nelson for the pc532. Used source with the following
- * copyrights as a model.
- *
- * aic.c: A Adaptec 6250 driver for the pc532.
- */
-/*
- * (Mostly) Written by Julian Elischer (julian@tfs.com)
- * for TRW Financial Systems for use under the MACH(2.5) operating system.
- *
- * TRW Financial Systems, in accordance with their agreement with Carnegie
- * Mellon University, makes this software available to CMU to distribute
- * or use in any manner that they see fit as long as this message is kept with
- * the software. For this reason TFS also grants any other persons or
- * organisations permission to use or modify this software.
- *
- * TFS supplies this software to be publicly redistributed
- * on the understanding that TFS is not responsible for the correct
- * functioning of this software in any circumstances.
- */
-
-/*
- * a FEW lines in this driver come from a MACH adaptec-disk driver
- * so the copyright below is included:
- *
- * Copyright 1990 by Open Software Foundation,
- * Grenoble, FRANCE
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appears in all copies and
- * that both the copyright notice and this permission notice appear in
- * supporting documentation, and that the name of OSF or Open Software
- * Foundation not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission.
- *
- * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
- * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
- * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-#include "sys/types.h"
-#include "sys/param.h"
-#include "sys/systm.h"
-#include "sys/errno.h"
-#include "sys/ioctl.h"
-#include "sys/buf.h"
-#include "machine/stdarg.h"
-#include "sys/proc.h"
-#include "sys/user.h"
-#include "sys/dkbad.h"
-#include "sys/disklabel.h"
-#include "scsi/scsi_all.h"
-#include "scsi/scsiconf.h"
-
-#include "device.h"
-
-/* Some constants (may need to be changed!) */
-#define AIC_NSEG 16
-
-int aicprobe(struct pc532_device *);
-int aicattach(struct pc532_device *);
-int aic_scsi_cmd(struct scsi_xfer *);
-void aicminphys(struct buf *);
-long int aic_adapter_info(int);
-
-struct scsidevs *
-scsi_probe(int masunit, struct scsi_switch *sw, int physid, int type, int want);
-
-struct pc532_driver aicdriver = {
- aicprobe, aicattach, "aic",
-};
-
-struct scsi_switch dp_switch = {
- "aic",
- aic_scsi_cmd,
- aicminphys,
- 0,
- 0,
- aic_adapter_info,
- 0, 0, 0
-};
-
-int aicprobe(struct pc532_device *dvp)
-{
- return (0); /* All pc532s should have one, but it is not working now. */
-}
-
-
-int aicattach(struct pc532_device *dvp)
-{
- int r;
-
- r = scsi_attach(0, 7, &dp_switch,
- &dvp->pd_drive, &dvp->pd_unit, dvp->pd_flags);
-
- return(r);
-}
-
-void aicminphys(struct buf *bp)
-{
-
- if(bp->b_bcount > ((AIC_NSEG - 1) * NBPG))
- bp->b_bcount = ((AIC_NSEG - 1) * NBPG);
- minphys(bp);
-}
-
-long int aic_adapter_info(int unit)
-{
- return (1); /* only 1 outstanding request. */
-}
-
-
-/* Do a scsi command. */
-
-struct scsi_xfer *cur_xs;
-
-int aic_scsi_cmd(struct scsi_xfer *xs)
-{
-printf ("aic_scsi_cmd: ... \n");
- cur_xs = xs;
-
- return (HAD_ERROR);
-}
-
-void aic_intr (struct intrframe frame)
-{
-}
diff --git a/sys/arch/pc532/dev/device.h b/sys/arch/pc532/dev/device.h
deleted file mode 100644
index ed5aba7f4a0..00000000000
--- a/sys/arch/pc532/dev/device.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $NetBSD: device.h,v 1.2 1994/10/26 08:24:09 cgd Exp $ */
-
-/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)isa_device.h 7.1 (Berkeley) 5/9/91
- */
-
-/*
- * Per device structure.
- */
-struct pc532_device {
- struct pc532_driver *pd_driver;
- char *pd_name; /* device name */
- int pd_unit; /* unit number */
- int pd_drive; /* drive number */
- int pd_flags; /* flags needed */
- int pd_alive; /* device is present */
-};
-
-/*
- * Per-driver structure.
- *
- * Each device driver defines entries for a set of routines
- * as well as an array of types which are acceptable to it.
- * These are used at boot time by the configuration program.
- */
-struct pc532_driver {
- int (*probe)(); /* test whether device is present */
- int (*attach)(); /* setup driver for a device */
- char *name; /* device name */
-};
-
-extern struct pc532_device pc532_devtab_bio[], pc532_devtab_tty[],
- pc532_devtab_net[];
-
diff --git a/sys/arch/pc532/dev/dp.c b/sys/arch/pc532/dev/dp.c
deleted file mode 100644
index 17bc9979ef0..00000000000
--- a/sys/arch/pc532/dev/dp.c
+++ /dev/null
@@ -1,1046 +0,0 @@
-/* $NetBSD: dp.c,v 1.8 1995/08/12 20:31:11 mycroft Exp $ */
-
-/* Written by Phil Nelson for the pc532. Used source with the following
- * copyrights as a model.
- *
- * dp.c: A NCR DP8490 driver for the pc532.
- */
-
-/*
- * (Mostly) Written by Julian Elischer (julian@tfs.com)
- * for TRW Financial Systems for use under the MACH(2.5) operating system.
- *
- * TRW Financial Systems, in accordance with their agreement with Carnegie
- * Mellon University, makes this software available to CMU to distribute
- * or use in any manner that they see fit as long as this message is kept with
- * the software. For this reason TFS also grants any other persons or
- * organisations permission to use or modify this software.
- *
- * TFS supplies this software to be publicly redistributed
- * on the understanding that TFS is not responsible for the correct
- * functioning of this software in any circumstances.
- *
- */
-
-/*
- * a FEW lines in this driver come from a MACH adaptec-disk driver
- * so the copyright below is included:
- *
- * Copyright 1990 by Open Software Foundation,
- * Grenoble, FRANCE
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appears in all copies and
- * that both the copyright notice and this permission notice appear in
- * supporting documentation, and that the name of OSF or Open Software
- * Foundation not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission.
- *
- * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
- * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
- * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include <sys/buf.h>
-#include <machine/stdarg.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/dkbad.h>
-#include <sys/disklabel.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-
-#include <machine/frame.h>
-#include <machine/icu.h>
-
-#include "device.h"
-#include "dpreg.h"
-
-#define DP_DEBUG 0
-
-/* Some constants (may need to be changed!) */
-#define DP_NSEG 16
-
-int dpprobe(struct pc532_device *);
-int dpattach(struct pc532_device *);
-int dp_scsi_cmd(struct scsi_xfer *);
-void dpminphys(struct buf *);
-long int dp_adapter_info(int);
-void dp_intr(void);
-void dp_intr_work(void);
-
-struct scsidevs *
-scsi_probe(int masunit, struct scsi_switch *sw, int physid, int type, int want);
-
-struct pc532_driver dpdriver = {
- dpprobe, dpattach, "dp",
-};
-
-struct scsi_switch dp_switch = {
- "dp",
- dp_scsi_cmd,
- dpminphys,
- 0,
- 0,
- dp_adapter_info,
- 0, 0, 0
-};
-
-/* Sense command. */
-static u_char sense_cmd[] = { 3, 0, 0, 0, 0, 0};
-
-/* Do we need to initialize. */
-int dp_needs_init = 1;
-
-/* Do we need a reset . */
-int dp_needs_reset = 1;
-
-/* SCSI phase we are currently in . . . */
-int dp_scsi_phase;
-
-/* SCSI Driver state */
-int dp_dvr_state = DP_DVR_READY;
-
-/* For polled error reporting. */
-int dp_intr_retval;
-
-/* For counting the retries. */
-int dp_try_count;
-
-/* Give the interrupt routine access to the current scsi_xfer info block. */
-struct scsi_xfer *cur_xs = NULL;
-
-/* names of phases for debug printouts */
-const char *dp_phase_names[] = {
- "DATA OUT",
- "DATA IN",
- "CMD",
- "STATUS",
- "PHASE 4",
- "PHASE 5",
- "MSG OUT",
- "MSG IN",
-};
-
-/* Initial probe for a device. If it is using the dp controller,
- just say yes so that attach can be the one to find the real drive. */
-
-int dpprobe(struct pc532_device *dvp)
-{
- /* If we call this, we need to add SPL_DP to the bio mask! */
- PL_bio |= SPL_DP;
- PL_zero |= PL_bio;
-
- if (dp_needs_init)
- dp_initialize();
-
- if (dp_needs_reset)
- dp_reset();
-
- /* All pc532s should have one, so we don't check ! :) */
- return (1);
-}
-
-
-int dpattach(struct pc532_device *dvp)
-{
- int r;
-
- r = scsi_attach(0, 7, &dp_switch,
- &dvp->pd_drive, &dvp->pd_unit, dvp->pd_flags);
-
- return(r);
-}
-
-void dpminphys(struct buf *bp)
-{
-
- if(bp->b_bcount > ((DP_NSEG - 1) * NBPG))
- bp->b_bcount = ((DP_NSEG - 1) * NBPG);
- minphys(bp);
-}
-
-long int dp_adapter_info(int unit)
-{
- return (1); /* only 1 outstanding request. */
-}
-
-#if DP_DEBUG
-void
-dp_print_stat1(u_char stat1)
-{
- printf("stat1=");
- if ( stat1 & 0x80 ) printf(" /RST");
- if ( stat1 & 0x40 ) printf(" /BSY");
- if ( stat1 & 0x20 ) printf(" /REQ");
- if ( stat1 & 0x10 ) printf(" /MSG");
- if ( stat1 & 0x08 ) printf(" /CD");
- if ( stat1 & 0x04 ) printf(" /IO");
- if ( stat1 & 0x02 ) printf(" /SEL");
- if ( stat1 & 0x01 ) printf(" /DBP");
- printf("\n");
-}
-
-void
-dp_print_stat2(u_char stat2)
-{
- printf("stat2=");
- if ( stat2 & 0x80 ) printf(" EDMA");
- if ( stat2 & 0x40 ) printf(" DRQ");
- if ( stat2 & 0x20 ) printf(" SPER");
- if ( stat2 & 0x10 ) printf(" INT");
- if ( stat2 & 0x08 ) printf(" PHSM");
- if ( stat2 & 0x04 ) printf(" BSY");
- if ( stat2 & 0x02 ) printf(" /ATN");
- if ( stat2 & 0x01 ) printf(" /ACK");
- printf("\n");
-}
-#endif
-
-#if DP_DEBUG
-void
-dp_print_regs()
-{
- u_char stat1 = RD_ADR(u_char, DP_STAT1);
- u_char stat2 = RD_ADR(u_char, DP_STAT2);
- dp_print_stat1(stat1);
- dp_print_stat2(stat2);
-}
-#endif
-
-/* Do a scsi command. */
-
-int dp_scsi_cmd(struct scsi_xfer *xs)
-{
- struct iovec *iovp;
- int flags;
- int retval; /* Return values from functions. */
- int x; /* for splbio() & splhigh() */
- int dvr_state;
- int ti_val; /* For timeouts. */
-
-#if DP_DEBUG
- printf("\n");
-#endif
- x = splhigh();
- if (dp_dvr_state == DP_DVR_READY)
- dp_dvr_state = DP_DVR_STARTED;
- dvr_state = dp_dvr_state;
- splx(x);
-
- if (dvr_state != DP_DVR_STARTED)
- return (TRY_AGAIN_LATER);
-
- cur_xs = xs;
-
- /* Some initial checks. */
- flags = xs->flags;
- if (!(flags & INUSE)) {
-#if DP_DEBUG
- printf("dp xs not in use!\n");
-#endif
- xs->flags |= INUSE;
- }
- if (flags & ITSDONE) {
-#if DP_DEBUG
- printf("dp xs already done!\n");
-#endif
- xs->flags &= ~ITSDONE;
- }
- if (dp_needs_reset || (xs->flags & SCSI_RESET))
- dp_reset();
-#if DP_DEBUG
- printf ("scsi_cmd: flags=0x%x, targ=%d, lu=%d, cmdlen=%d, cmd=%x\n",
- xs->flags, xs->targ, xs->lu, xs->cmdlen, xs->cmd->opcode);
-#endif
-#if 1
- /* we don't always get NOMASK passed in, so this hack fakes it. */
- {
- if ( !initproc )
- xs->flags |= SCSI_NOMASK;
- }
-#endif
- if (!(xs->flags & SCSI_NOMASK)) {
- x = splbio();
- retval = dp_start_cmd(xs);
- splx(x);
- return retval;
- }
- /* No interrupts available! */
- retval = dp_start_cmd(xs);
- if (retval != SUCCESSFULLY_QUEUED)
- return retval;
-#if DP_DEBUG > 1
- printf("polling for interrupts\n");
-#endif
- ti_val = WAIT_MUL * xs->timeout;
- while (dp_dvr_state != DP_DVR_READY) {
- if (RD_ADR(u_char, DP_STAT2) & DP_S_IRQ) {
- dp_intr_work();
- ti_val = WAIT_MUL * xs->timeout;
- retval = dp_intr_retval;
- }
- if (--ti_val == 0) {
- /* Software Timeout! */
- xs->error = XS_SWTIMEOUT;
- dp_dvr_state = DP_DVR_READY;
- retval = HAD_ERROR;
- }
- }
- if (xs->error == XS_SWTIMEOUT) {
- /* Software Timeout! */
- printf ("scsi timeout!\n");
-#if DP_DEBUG
- dp_print_regs();
- printf("TCMD = 0x%x\n", RD_ADR(u_char, DP_TCMD));
-#endif
- dp_reset();
- }
-#if 1
- /* another hack: read cannot handle anything but SUCCESSFULLY_QUEUED */
- if (xs->cmd->opcode == 0x28)
- return SUCCESSFULLY_QUEUED;
-#endif
- return retval;
-}
-
-/*===========================================================================*
- * dp_intr *
- *===========================================================================*/
-
-/* This is where a lot of the work happens! This is called in non-interrupt
- mode when an interrupt would have happened. It is also the real interrupt
- routine. It uses dp_dvr_state to determine the next actions along with
- cur_xs->flags. */
-
-void dp_intr(void)
-{
- int x = splhigh();
-#if DP_DEBUG
- printf("\n REAL dp_intr\n");
-#endif
- dp_intr_work();
- splx(x);
-}
-
-void dp_intr_work(void)
-{
- u_char isr;
- u_char new_phase;
- u_char stat1;
- u_char stat2;
- static u_char status;
- static u_char message;
- int ret;
-
- scsi_select_ctlr (DP8490);
- WR_ADR(u_char, DP_EMR_ISR, DP_EF_ISR_NEXT);
- isr = RD_ADR (u_char, DP_EMR_ISR);
- dp_clear_isr();
-
- stat1 = RD_ADR(u_char, DP_STAT1);
- new_phase = (stat1 >> 2) & 7;
-
-#if DP_DEBUG
- printf ("dp_intr: dvr_state %d isr=0x%x new_phase = %d %s\n",
- dp_dvr_state, isr, new_phase, dp_phase_names[new_phase]);
-#if DP_DEBUG > 1
- dp_print_regs();
-#endif
-#endif
-#if 0
- /* de-assert the bus */
- WR_ADR(u_char, DP_ICMD, DP_EMODE);
- /* disable dma */
- RD_ADR(u_char, DP_MODE) &= ~DP_M_DMA;
-#endif
- if (isr & DP_ISR_BSYERR) {
-#if DP_DEBUG
- printf("dp_intr: Busy error\n");
-#endif
- }
- if (isr & DP_ISR_EDMA) {
-#if DP_DEBUG > 1
- printf("dp_intr: EDMA detected\n");
-#endif
- RD_ADR(u_char, DP_MODE) &= ~DP_M_DMA;
- WR_ADR(u_char, DP_ICMD, DP_EMODE);
- }
- if (!(isr & DP_ISR_APHS)) {
-#if DP_DEBUG > 1
- printf("dp_intr: Not an APHS!\n");
- printf("dp_intr: dvr_state %d isr=0x%x (exit)\n",
- dp_dvr_state, isr);
-#endif
- return;
- }
-
- switch (dp_dvr_state) {
- case DP_DVR_ARB: /* Next comes the command phase! */
- if (new_phase != DP_PHASE_CMD) {
-#if DP_DEBUG
- printf ("Phase mismatch cmd!\n");
-#endif
- goto phase_mismatch;
- }
- dp_dvr_state = DP_DVR_CMD;
- ret = dp_pdma_out(cur_xs->cmd, cur_xs->cmdlen, DP_PHASE_CMD);
- dp_clear_isr();
- break;
-
- case DP_DVR_CMD: /* Next comes the data i/o phase if needed. */
- /*
- * This state can potentially accept data in, data out,
- * or status for new_phase. data in or data out could
- * be skipped (new_phase is status) if an error was detected
- * in the command.
- */
- if (cur_xs->flags & SCSI_DATA_UIO) {
- /* UIO work. */
- panic ("scsi uio");
- }
- if (new_phase == DP_PHASE_DATAI) {
-#if 1
- /* just a quick hack until we
- can trust flags to be correct
- */
- if (!cur_xs->data) {
-#else
- if (!(cur_xs->flags & SCSI_DATA_IN)) {
-#endif
-#if DP_DEBUG
- printf("Phase mismatch in.\n");
-#endif
- goto phase_mismatch;
- }
- /* expect STAT phase next */
- dp_dvr_state = DP_DVR_DATA;
- ret = dp_pdma_in(cur_xs->data, cur_xs->datalen,
- DP_PHASE_DATAI);
- dp_clear_isr();
- break;
- }
- else if (new_phase == DP_PHASE_DATAO) {
-#if 1
- /* just a quick hack until we
- can trust flags to be correct
- */
- if (!cur_xs->data) {
-#else
- if (!(cur_xs->flags & SCSI_DATA_OUT)) {
-#endif
-#if DP_DEBUG
- printf("Phase mismatch out.\n");
-#endif
- goto phase_mismatch;
- }
- /* expect STAT phase next */
- dp_dvr_state = DP_DVR_DATA;
- ret = dp_pdma_out(cur_xs->data, cur_xs->datalen,
- DP_PHASE_DATAO);
- dp_clear_isr();
- break;
- }
- /* Fall through to next phase. */
- case DP_DVR_DATA: /* Next comes the stat phase */
- if (new_phase != DP_PHASE_STATUS) {
-#if DP_DEBUG
- printf("Phase mismatch stat.\n");
-#endif
- goto phase_mismatch;
- }
- dp_dvr_state = DP_DVR_STAT;
- dp_pdma_in(&status, 1, DP_PHASE_STATUS);
- dp_clear_isr();
-#if DP_DEBUG > 1
- printf("status = 0x%x\n", status);
-#endif
- break;
-
- case DP_DVR_STAT:
- if (new_phase != DP_PHASE_MSGI) {
-#if DP_DEBUG
- printf ("msgi phase mismatch\n");
-#endif
- goto phase_mismatch;
- }
- dp_dvr_state = DP_DVR_MSGI;
- dp_pdma_in(&message, 1, DP_PHASE_MSGI);
- dp_clear_isr();
-#if DP_DEBUG > 1
- printf("message = 0x%x\n", message);
-#endif
-#if 0
- if (status != SCSI_OK && dp_try_count < cur_xs->retries) {
- printf("dp_intr: retry: dp_try_count = %d\n",
- dp_try_count);
- dp_restart_cmd();
- }
-#endif
- break;
-
- default:
-phase_mismatch:
- /* TEMP error generation!!! */
- dp_reset();
- dp_dvr_state = DP_DVR_READY;
- cur_xs->error = XS_DRIVER_STUFFUP;
- dp_intr_retval = HAD_ERROR;
- /* If this true interrupt code, call the done routine. */
- if (cur_xs->when_done) {
- (*(cur_xs->when_done))(cur_xs->done_arg, cur_xs->done_arg2);
- }
- }
-
- if (dp_dvr_state == DP_DVR_MSGI) {
-#if DP_DEBUG > 1
- printf ("dvr_stat: dp_try_count = %d\n", dp_try_count);
-#endif
- WR_ADR (u_char, DP_MODE, 0); /* Turn off monbsy, dma, ... */
- if (status == SCSI_OK) {
- cur_xs->error = XS_NOERROR;
- dp_intr_retval = COMPLETE;
- } else if (status & SCSI_BUSY) {
- cur_xs->error = XS_BUSY;
- dp_intr_retval = HAD_ERROR;
- } else if (status & SCSI_CHECK) {
- /* Do a sense command. */
- cur_xs->error = XS_SENSE;
- dp_intr_retval = HAD_ERROR;
- dp_get_sense (cur_xs);
- }
- cur_xs->flags |= ITSDONE;
- dp_dvr_state = DP_DVR_READY;
-#if DP_DEBUG > 1
- printf("calling wakeup on 0x%x\n", cur_xs);
-#endif
- wakeup((caddr_t) cur_xs);
- /* If this true interrupt code, call the done routine. */
- if (cur_xs->when_done) {
-#if DP_DEBUG > 1
- printf("dp_intr: calling when_done 0x%x\n", cur_xs->when_done);
-#endif
- (*(cur_xs->when_done))(cur_xs->done_arg, cur_xs->done_arg2);
- }
- }
-#if DP_DEBUG > 1
- printf ("exit dp_intr.\n");
-#endif
-}
-
-
-/*===========================================================================*
- * dp_initialize *
- *===========================================================================*/
-
-dp_initialize()
-{
-#if DP_DEBUG
- printf("dp_initialize()\n");
-#endif
- scsi_select_ctlr (DP8490);
- WR_ADR (u_char, DP_ICMD, DP_EMODE); /* Set Enhanced mode */
- WR_ADR (u_char, DP_MODE, 0); /* Disable everything. */
- WR_ADR (u_char, DP_EMR_ISR, DP_EF_RESETIP);
- WR_ADR (u_char, DP_EMR_ISR, DP_EF_NOP);
- WR_ADR (u_char, DP_SER, 0x80); /* scsi adr 7. */
- dp_scsi_phase = DP_PHASE_NONE;
- dp_needs_init = 0;
-}
-
-/*===========================================================================*
- * dp_reset *
- *===========================================================================*/
-
-/*
- * Reset dp SCSI bus.
- */
-
-dp_reset()
-{
- volatile int i;
- int x = splbio();
-
- scsi_select_ctlr (DP8490);
- WR_ADR (u_char, DP_MODE, 0); /* get into harmless state */
- WR_ADR (u_char, DP_OUTDATA, 0);
- WR_ADR (u_char, DP_ICMD, DP_A_RST|DP_EMODE); /* assert RST on SCSI bus */
- for (i = 55; i; --i); /* wait 25 usec */
- WR_ADR (u_char, DP_ICMD, DP_EMODE); /* deassert RST, get off bus */
- WR_ADR (u_char, DP_EMR_ISR, DP_EF_ISR_NEXT | DP_EMR_APHS);
- WR_ADR (u_char, DP_EMR_ISR, DP_INT_MASK); /* set interrupt mask */
- splx(x);
- for (i = 800000; i; --i); /* wait 360 msec */
- dp_needs_reset = 0;
-}
-
-/*===========================================================================*
- * dp_wait_bus_free *
- *===========================================================================*/
-/* Wait for the SCSI bus to become free. Currently polled because I am
- * assuming a single initiator configuration -- so this code would not be
- * running if the bus were busy.
- */
-int
-dp_wait_bus_free()
-{
- int i;
- u_char stat1;
- volatile int j;
-
- /* get into a harmless state */
- WR_ADR (u_char, DP_TCMD, 0);
- WR_ADR (u_char, DP_MODE, 0); /* return to initiator mode */
- WR_ADR (u_char, DP_ICMD, DP_EMODE); /* clear SEL, disable data out */
- i = WAIT_MUL * 2000;
- while (i--) {
- /* Must be clear for 2 usec, so read twice */
- stat1 = RD_ADR (u_char, DP_STAT1);
- if (stat1 & (DP_S_BSY | DP_S_SEL)) continue;
- for (j = 5; j; j--);
- stat1 = RD_ADR (u_char, DP_STAT1);
- if (stat1 & (DP_S_BSY | DP_S_SEL)) continue;
- return OK;
- }
-#if DP_DEBUG
- printf("wait bus free failed\n");
- dp_print_stat1(stat1);
-#endif
- dp_needs_reset = 1;
- return NOT_OK;
-}
-
-/*===========================================================================*
- * dp_select *
- *===========================================================================*/
-/* Select SCSI device, set up for command transfer.
- */
-int
-dp_select(adr)
-long adr;
-{
- int i, stat1;
-
-#if DP_DEBUG > 1
- printf("dp_select(0x%x)\n", adr);
-#endif
- WR_ADR (u_char, DP_TCMD, 0); /* get to harmless state */
- WR_ADR (u_char, DP_MODE, 0); /* get to harmless state */
- WR_ADR (u_char, DP_OUTDATA, adr); /* SCSI bus address */
- WR_ADR (u_char, DP_ICMD, DP_A_SEL | DP_ENABLE_DB | DP_EMODE);
- for (i = 0;; ++i) { /* wait for target to assert SEL */
- stat1 = RD_ADR (u_char, DP_STAT1);
- if (stat1 & DP_S_BSY) break; /* select successful */
- if (i > WAIT_MUL * 2000) { /* timeout */
- u_char isr;
- WR_ADR(u_char, DP_EMR_ISR, DP_EF_ISR_NEXT);
- isr = RD_ADR (u_char, DP_EMR_ISR);
-#if DP_DEBUG
- printf ("SCSI: SELECT timeout adr %d\n", adr);
- dp_print_regs();
- printf("ICMD = 0x%x isr = 0x%x\n", RD_ADR(u_char, DP_ICMD), isr);
-#endif
- dp_reset();
- return NOT_OK;
- }
- }
- WR_ADR (u_char, DP_ICMD, DP_EMODE); /* clear SEL, disable data out */
- WR_ADR (u_char, DP_OUTDATA, 0);
- dp_clear_isr();
- WR_ADR (u_char, DP_TCMD, 4); /* bogus phase, guarantee mismatch */
- WR_ADR (u_char, DP_MODE, DP_M_BSY | DP_M_DMA);
- return OK;
-}
-
-/*===========================================================================*
- * scsi_select_ctlr
- *===========================================================================*/
-/* Select a SCSI device.
- */
-scsi_select_ctlr (ctlr)
-int ctlr;
-{
- /* May need other stuff here to syncronize between dp & aic. */
-
- RD_ADR (u_char, ICU_IO) &= ~ICU_SCSI_BIT; /* i/o, not port */
- RD_ADR (u_char, ICU_DIR) &= ~ICU_SCSI_BIT; /* output */
- if (ctlr == DP8490)
- RD_ADR (u_char, ICU_DATA) &= ~ICU_SCSI_BIT; /* select = 0 for 8490 */
- else
- RD_ADR (u_char, ICU_DATA) |= ICU_SCSI_BIT; /* select = 1 for AIC6250 */
-}
-
-/*===========================================================================*
- * dp_start_cmd *
- *===========================================================================*/
-
-int dp_start_cmd(struct scsi_xfer *xs)
-{
-#if 0
- WR_ADR (u_char, DP_OUTDATA, 1 << xs->targ); /* SCSI bus address */
- WR_ADR (u_char, DP_EMR_ISR, DP_EF_ARB);
- dp_dvr_state = DP_DVR_ARB;
-#else
-
- /* This is not the "right" way to start it. We should just have the
- chip do the select for us and interrupt at the end. */
-
- if (!dp_wait_bus_free()) {
-#if DP_DEBUG
- printf("dp_start_cmd: DP DRIVER BUSY\n");
-#endif
- xs->error = XS_BUSY;
- return TRY_AGAIN_LATER;
- }
-
- if (!dp_select(1 << xs->targ)) {
-#if DP_DEBUG
- printf("dp_start_cmd: DP DRIVER STUFFUP\n");
-#endif
- xs->error = XS_DRIVER_STUFFUP;
- return HAD_ERROR;
- }
-#endif
-
- /* After selection, we now wait for the APHS interrupt! */
- dp_dvr_state = DP_DVR_ARB; /* Just finished the select/arbitration */
- dp_try_count = 1;
-
- if (!(xs->flags & SCSI_NOMASK)) {
- /* Set up the timeout! */
-#if DP_DEBUG > 1
- printf ("dp_start_cmd: dp timeouts not done\n");
-#endif
- }
- return SUCCESSFULLY_QUEUED;
-}
-
-/*===========================================================================*
- * dp_restart_cmd *
- *===========================================================================*/
-
-int dp_restart_cmd()
-{
-#if 0
- WR_ADR (u_char, DP_OUTDATA, xs->targ); /* SCSI bus address */
- WR_ADR (u_char, DP_EMR_ISR, DP_EF_ARB);
- dp_dvr_state = DP_DVR_ARB;
-#endif
-
- /* This is not the "right" way to start it. We should just have the
- chip do the select for us and interrupt at the end. */
-
- DELAY(50);
-#if DP_DEBUG
- printf ("restart .. stat1=0x%x stat2=0x%x\n", RD_ADR(u_char, DP_STAT1),
- RD_ADR(u_char, DP_STAT2));
-#endif
- if (!dp_wait_bus_free()) {
- cur_xs->error = XS_BUSY;
- return;
- }
-
-#if DP_DEBUG
- printf ("restart .1 stat1=0x%x stat2=0x%x\n", RD_ADR(u_char, DP_STAT1),
- RD_ADR(u_char, DP_STAT2));
- printf ("cur_xs->targ=%d\n",cur_xs->targ);
-#endif
- if (!dp_select (1 << cur_xs->targ)) {
- cur_xs->error = XS_DRIVER_STUFFUP;
- return;
- }
-
-#if DP_DEBUG
- printf ("restart .2 stat1=0x%x stat2=0x%x\n", RD_ADR(u_char, DP_STAT1),
- RD_ADR(u_char, DP_STAT2));
-#endif
- /* After selection, we now wait for the APHS interrupt! */
- dp_dvr_state = DP_DVR_ARB; /* Just finished the select/arbitration */
- dp_try_count++;
-
- if (!(cur_xs->flags & SCSI_NOMASK)) {
- /* Set up the timeout! */
-#if DP_DEBUG
- printf ("dp_restart_cmd: dp timeouts not done\n");
-#endif
- }
-}
-
-/*===========================================================================*
- * dp_pdma_out *
- *===========================================================================*/
-
-/* Note: in NetBSD, the scsi dma addresses are set by the mapping hardware
- to inhibit cache. There is therefore, no need to worry about cache hits
- during access to dma addresses. */
-
-int dp_pdma_out(char *buf, int count, int phase)
-{
- int cnt;
- int ret = OK;
- u_int stat2;
-
-#if DP_DEBUG
- printf("dp_pdma_out: write %d bytes\n", count);
-#endif
-#if DP_DEBUG > 1
- if (RD_ADR(u_char, DP_STAT2) & DP_S_IRQ)
- printf("WARNING: stat2:IRQ set on call to dp_pdma_out\n");
-#endif
-
- /* Set it up. */
- WR_ADR(u_char, DP_TCMD, phase);
- RD_ADR(u_char, DP_MODE) |= DP_M_DMA;
- WR_ADR(u_char, DP_ICMD, DP_ENABLE_DB | DP_EMODE);
- WR_ADR(u_char, DP_START_SEND, 0);
-
- /* Do the pdma: first longs, then bytes. */
- while (count > sizeof(long)) {
- WR_ADR(long, DP_DMA, *(((long *)buf)++));
- count -= sizeof(long);
- }
- while (count-- > 1) {
- WR_ADR(u_char, DP_DMA, *(buf++));
- }
-
- /* wait for DRQ to be asserted for the last byte, or an
- * interrupt request to be signaled
- */
- while (1) {
- stat2 = RD_ADR(u_char, DP_STAT2);
- if (stat2 & (DP_S_IRQ | DP_S_DRQ)) break;
- }
-
- if (stat2 & DP_S_DRQ) {
- WR_ADR(u_char, DP_DMA_EOP, *buf);
- }
- else {
- /* dma error! */
-#if DP_DEBUG
- printf ("dma write error!\n");
- dp_print_stat1(RD_ADR(u_char, DP_STAT1));
- dp_print_stat2(stat2);
-#endif
- cur_xs->error = XS_DRIVER_STUFFUP;
- /* Clear dma mode, just in case, and disable the bus. */
- RD_ADR (u_char, DP_MODE) &= ~DP_M_DMA;
- WR_ADR (u_char, DP_ICMD, DP_EMODE);
- ret = NOT_OK;
- }
-#if 0
- /* Clear dma mode, just in case, and disable the bus. */
- RD_ADR (u_char, DP_MODE) &= ~DP_M_DMA;
- WR_ADR (u_char, DP_ICMD, DP_EMODE);
-#endif
-
- return ret;
-}
-
-/*===========================================================================*
- * dp_pdma_in *
- *===========================================================================*/
-
-/* Note: in NetBSD, the scsi dma addresses are set by the mapping hardware
- to inhibit cache. There is therefore, no need to worry about cache hits
- during access to dma addresses. */
-
-int dp_pdma_in(char *buf, int count, int phase)
-{
- int ret = OK;
- int i_count = count;
- u_int stat2;
- u_char *dma_adr = (u_char *) DP_DMA; /* Address for last few bytes. */
-
-#if DP_DEBUG > 1
- printf("dp_pdma_in: read %d bytes\n", count);
-#endif
- /* Set it up. */
- WR_ADR(u_char, DP_TCMD, phase);
- RD_ADR(u_char, DP_MODE) |= DP_M_DMA;
- WR_ADR(u_char, DP_EMR_ISR, DP_EF_START_RCV | DP_EMR_APHS);
-
- /* Do the pdma */
- while (count >= sizeof(long)) {
- *(((long *)buf)++) = RD_ADR(long, DP_DMA);
- count -= sizeof(long);
- }
-
- while (count-- > 0) {
- *(buf++) = RD_ADR(u_char, (dma_adr++));
- }
-
- /* Clear dma mode, just in case, and disable the bus. */
- RD_ADR(u_char, DP_MODE) &= ~DP_M_DMA;
- WR_ADR(u_char, DP_ICMD, DP_EMODE);
- return ret;
-}
-
-dp_wait_for_edma()
-{
- int i;
-
- for (i = 0; i < 1000000; ++i) {
- u_char tcmd = RD_ADR(u_char, DP_TCMD);
- if (tcmd & DP_TCMD_EDMA) {
-#if DP_DEBUG > 1
- printf("dp_wait_for_phase: EDMA detected\n");
-#endif
- RD_ADR(u_char, DP_MODE) &= ~DP_M_DMA;
- WR_ADR(u_char, DP_ICMD, DP_EMODE);
- return;
- }
- }
- printf("wait for edma timeout\n");
-#if DP_DEBUG
- dp_print_regs();
-#endif
- panic("dp: wait for edma");
-}
-
-dp_wait_for_phase(u_char phase)
-{
- int i;
- u_char isr;
-
-#if DP_DEBUG > 1
- printf("wait for phase %d...", phase);
-#endif
- /* set the TCR register */
- WR_ADR(u_char, DP_TCMD, phase);
- /* wait for phase match */
- for (i = 0; i < 1000000; ++i) {
- u_char stat2 = RD_ADR(u_char, DP_STAT2);
- if (stat2 & DP_S_PHASE) {
-#if DP_DEBUG > 1
- printf("done\n");
-#endif
- /* completely clear the isr */
- WR_ADR(u_char, DP_EMR_ISR, DP_EF_ISR_NEXT);
- isr = RD_ADR (u_char, DP_EMR_ISR);
- dp_clear_isr();
- return;
- }
- }
- printf("wait for phase %d timeout\n", phase);
-#if DP_DEBUG
- dp_print_regs();
-#endif
- panic("dp: wait for phase");
-}
-
-/*===========================================================================*
- * dp_get_sense *
- *===========================================================================*/
-
-dp_get_sense (struct scsi_xfer *xs)
-{
- u_char status;
- u_char message;
- u_char isr;
- int ret;
-
- bzero((u_char *) &xs->sense, sizeof(xs->sense));
-
- /* completely clear the isr on entry */
- WR_ADR(u_char, DP_EMR_ISR, DP_EF_ISR_NEXT);
- isr = RD_ADR (u_char, DP_EMR_ISR);
- dp_clear_isr();
-
- RD_ADR(u_char, DP_MODE) &= ~DP_M_DMA;
- WR_ADR(u_char, DP_ICMD, DP_EMODE);
-
-#if DP_DEBUG > 2
- printf ("sense 1: wait bus free\n");
-#endif
- if (!dp_wait_bus_free()) {
-#if DP_DEBUG > 2
- printf("sense 1: wait-bus-free failed\n");
-#endif
- xs->error = XS_BUSY;
- return;
- }
-
-#if DP_DEBUG > 2
- printf ("sense 2: select device\n");
-#endif
- if (!dp_select (1 << xs->targ)) {
-#if DP_DEBUG
- printf("sense 2: select failed\n");
-#endif
- xs->error = XS_DRIVER_STUFFUP;
- return;
- }
- /* completely clear the isr */
- WR_ADR(u_char, DP_EMR_ISR, DP_EF_ISR_NEXT);
- isr = RD_ADR (u_char, DP_EMR_ISR);
- dp_clear_isr();
-
- /* send the command */
- sense_cmd[1] = xs->lu << 5;
-#if 0
- sense_cmd[4] = sizeof(struct scsi_sense_data);
-#else
- sense_cmd[4] = 0x04;
-#endif
- dp_wait_for_phase(DP_PHASE_CMD);
- ret = dp_pdma_out(sense_cmd, sizeof(sense_cmd), DP_PHASE_CMD);
- if (ret != OK) {
-#if DP_DEBUG
- printf("dp_pdma_out: ret=%d\n", ret);
-#endif
- return;
- }
-
- /* read sense data */
- dp_wait_for_edma();
- dp_wait_for_phase(DP_PHASE_DATAI);
- ret = dp_pdma_in((u_char *) &xs->sense, sense_cmd[4], DP_PHASE_DATAI);
- if (ret != OK) {
-#if DP_DEBUG
- printf ("dp_pdma_in: ret=%d\n", ret);
-#endif
- }
-
- /* read status */
- dp_wait_for_phase(DP_PHASE_STATUS);
- ret = dp_pdma_in(&status, 1, DP_PHASE_STATUS);
- if (ret != OK) {
-#if DP_DEBUG
- printf ("dp_pdma_in: ret=%d\n", ret);
-#endif
- }
-
- /* read message */
- dp_wait_for_phase(DP_PHASE_MSGI);
- ret = dp_pdma_in(&message, 1, DP_PHASE_MSGI);
- if (ret != OK) {
-#if DP_DEBUG
- printf ("dp_pdma_in: ret=%d\n", ret);
-#endif
- }
-
-#if DP_DEBUG
- printf("sense status = 0x%x\n", status);
- printf(" sense (0x%x) valid = %d code = 0x%x class = 0x%x\n",
- *(u_char *) &xs->sense,
- xs->sense.valid, xs->sense.error_code, xs->sense.error_class);
-#endif
-
- if (status & SCSI_BUSY) {
- xs->error = XS_BUSY;
- }
- WR_ADR (u_char, DP_MODE, 0); /* Turn off monbsy, dma, ... */
-}
diff --git a/sys/arch/pc532/dev/dpreg.h b/sys/arch/pc532/dev/dpreg.h
deleted file mode 100644
index df1af1257bd..00000000000
--- a/sys/arch/pc532/dev/dpreg.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* $NetBSD: dpreg.h,v 1.6 1994/10/26 08:24:11 cgd Exp $ */
-
-/*
- * Copyright (c) 1993 Philip A. Nelson.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Philip A. Nelson.
- * 4. The name of Philip A. Nelson may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY PHILIP NELSON ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL PHILIP NELSON BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * dp.h: defines for the dp driver.
- */
-
-/* Most of this comes from the Minix dp driver by Bruce Culbertson. */
-
-/* NCR 8490 SCSI controller registers
- */
-#define DP_CTL 0xffd00000 /* base for control registers */
-#define DP_DMA 0xffe00000 /* base for data registers */
-#define DP_DMA_EOP 0xffeff000 /* SCSI DMA with EOP asserted */
-#define DP_CURDATA (DP_CTL+0)
-#define DP_OUTDATA (DP_CTL+0)
-#define DP_ICMD (DP_CTL+1)
-#define DP_MODE (DP_CTL+2)
-#define DP_TCMD (DP_CTL+3)
-#define DP_STAT1 (DP_CTL+4)
-#define DP_SER (DP_CTL+4)
-#define DP_STAT2 (DP_CTL+5)
-#define DP_START_SEND (DP_CTL+5)
-#define DP_INDATA (DP_CTL+6)
-#define DP_EMR_ISR (DP_CTL+7)
-
-/* Bits in NCR 8490 registers
- */
-#define DP_A_RST 0x80
-#define DP_A_SEL 0x04
-#define DP_S_SEL 0x02
-#define DP_S_REQ 0x20
-#define DP_S_BSY 0x40
-#define DP_S_BSYERR 0x04
-#define DP_S_PHASE 0x08
-#define DP_S_IRQ 0x10
-#define DP_S_DRQ 0x40
-#define DP_TCMD_EDMA 0x80 /* true end of dma in tcmd */
-#define DP_M_DMA 0x02
-#define DP_M_BSY 0x04
-#define DP_M_EDMA 0x08
-#define DP_ENABLE_DB 0x01
-#define DP_EMODE 0x40 /* enhanced mode */
-#define DP_EF_NOP 0x00 /* enhanced functions */
-#define DP_EF_ARB 0x01
-#define DP_EF_RESETIP 0x02
-#define DP_EF_START_RCV 0x04
-#define DP_EF_ISR_NEXT 0x06
-#define DP_EMR_APHS 0x80
-#define DP_ISR_BSYERR 0x04
-#define DP_ISR_APHS 0x08
-#define DP_ISR_DPHS 0x10
-#define DP_ISR_EDMA 0x20
-#define DP_INT_MASK (~(DP_ISR_APHS | DP_ISR_BSYERR | DP_ISR_EDMA))
-
-#define DP_PHASE_DATAO 0 /* Data out */
-#define DP_PHASE_DATAI 1 /* Data in */
-#define DP_PHASE_CMD 2 /* CMD out */
-#define DP_PHASE_STATUS 3 /* Status in */
-#define DP_PHASE_MSGO 6 /* Message out */
-#define DP_PHASE_MSGI 7 /* Message in */
-
-#define DP_PHASE_NONE 4 /* will mismatch all phases (??) */
-
-/* Driver state. Helps interrupt code decide what to do next. */
-#define DP_DVR_READY 0
-#define DP_DVR_STARTED 1
-#define DP_DVR_ARB 2
-#define DP_DVR_CMD 3
-#define DP_DVR_DATA 4
-#define DP_DVR_STAT 5
-#define DP_DVR_MSGI 6
-#define DP_DVR_SENSE 7
-
-#define dp_clear_isr() /* clear 8490 interrupts */ \
- WR_ADR (u_char, DP_EMR_ISR, DP_EF_RESETIP); \
- WR_ADR (u_char, DP_EMR_ISR, DP_EF_NOP | DP_EMR_APHS);
-
-/* Status of interrupt routine.
- */
-#define ISR_NOTDONE 0
-#define ISR_OK 1
-#define ISR_BSYERR 2
-#define ISR_RSTERR 3
-#define ISR_BADPHASE 4
-#define ISR_TIMEOUT 5
-#define ISR_DMACNTERR 6
-
-#define ICU_ADR 0xfffffe00
-#define ICU_IO (ICU_ADR+20)
-#define ICU_DIR (ICU_ADR+21)
-#define ICU_DATA (ICU_ADR+19)
-#define ICU_SCSI_BIT 0x80
-
-/* Miscellaneous
- */
-#define WAIT_MUL 1000 /* Estimate! .. for polling. */
-
-#define OK 1
-#define NOT_OK 0
diff --git a/sys/arch/pc532/dev/lpt.c b/sys/arch/pc532/dev/lpt.c
deleted file mode 100644
index b851f22b527..00000000000
--- a/sys/arch/pc532/dev/lpt.c
+++ /dev/null
@@ -1,878 +0,0 @@
-/* $NetBSD: lpt.c,v 1.7 1995/11/30 00:58:45 jtc Exp $ */
-
-/*
- * Copyright (c) 1994 Matthias Pfaller.
- * Copyright (c) 1994 Poul-Henning Kamp
- * Copyright (c) 1993, 1994 Charles Hannum.
- * Copyright (c) 1990 William F. Jolitz, TeleMuse
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This software is a component of "386BSD" developed by
- * William F. Jolitz, TeleMuse.
- * 4. Neither the name of the developer nor the name "386BSD"
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS A COMPONENT OF 386BSD DEVELOPED BY WILLIAM F. JOLITZ
- * AND IS INTENDED FOR RESEARCH AND EDUCATIONAL PURPOSES ONLY. THIS
- * SOFTWARE SHOULD NOT BE CONSIDERED TO BE A COMMERCIAL PRODUCT.
- * THE DEVELOPER URGES THAT USERS WHO REQUIRE A COMMERCIAL PRODUCT
- * NOT MAKE USE OF THIS WORK.
- *
- * FOR USERS WHO WISH TO UNDERSTAND THE 386BSD SYSTEM DEVELOPED
- * BY WILLIAM F. JOLITZ, WE RECOMMEND THE USER STUDY WRITTEN
- * REFERENCES SUCH AS THE "PORTING UNIX TO THE 386" SERIES
- * (BEGINNING JANUARY 1991 "DR. DOBBS JOURNAL", USA AND BEGINNING
- * JUNE 1991 "UNIX MAGAZIN", GERMANY) BY WILLIAM F. JOLITZ AND
- * LYNNE GREER JOLITZ, AS WELL AS OTHER BOOKS ON UNIX AND THE
- * ON-LINE 386BSD USER MANUAL BEFORE USE. A BOOK DISCUSSING THE INTERNALS
- * OF 386BSD ENTITLED "386BSD FROM THE INSIDE OUT" WILL BE AVAILABLE LATE 1992.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE DEVELOPER BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-/*
- * Device Driver for Matthias's parallel printer port.
- * This driver is based on the i386 lpt driver and
- * some IP code from Poul-Henning Kamp.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/buf.h>
-#include <sys/kernel.h>
-#include <sys/ioctl.h>
-#include <sys/uio.h>
-#include <sys/device.h>
-#include <sys/syslog.h>
-#include <sys/malloc.h>
-#include <machine/cpu.h>
-
-#include "lpt.h"
-#include "lptreg.h"
-
-#if defined(INET) && defined(PLIP)
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <net/if_types.h>
-#include <net/netisr.h>
-#include <net/route.h>
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/in_var.h>
-#include <netinet/ip.h>
-#include <netinet/if_ether.h>
-#endif
-
-#define LPT_INVERT (LPC_NBUSY|LPC_NERROR|LPC_NACK|LPC_ONLINE)
-#define LPT_MASK (LPC_NBUSY|LPC_NERROR|LPC_NACK|LPC_NOPAPER|LPC_ONLINE)
-
-#define TIMEOUT hz*16 /* wait up to 16 seconds for a ready */
-#define STEP hz/4
-
-#define LPTPRI (PZERO+8)
-#define LPT_BSIZE 1024
-
-#if defined(INET) && defined(PLIP)
-#ifndef PLIPMTU /* MTU for the plip# interfaces */
-#if defined(COMPAT_PLIP10)
-#define PLIPMTU 1600 /* Linux 1.0.x */
-#elif defined(COMPAT_PLIP11)
-#define PLIPMTU (ETHERMTU - ifp->if_hdrlen) /* Linux 1.1.x */
-#else
-#define PLIPMTU ETHERMTU /* Linux 1.3.x */
-#endif
-#endif
-
-#ifndef PLIPMXSPIN1 /* DELAY factor for the plip# interfaces */
-#define PLIPMXSPIN1 2000 /* Spinning for remote intr to happen */
-#endif
-
-#ifndef PLIPMXSPIN2 /* DELAY factor for the plip# interfaces */
-#define PLIPMXSPIN2 6000 /* Spinning for remote handshake to happen */
-#endif
-
-#ifndef PLIPMXERRS /* Max errors before !RUNNING */
-#define PLIPMXERRS 20
-#endif
-#ifndef PLIPMXRETRY
-#define PLIPMXRETRY 20 /* Max number of retransmits */
-#endif
-#ifndef PLIPRETRY
-#define PLIPRETRY hz/50 /* Time between retransmits */
-#endif
-#endif
-
-struct lpt_softc {
- struct device sc_dev;
- size_t sc_count;
- u_char *sc_inbuf;
- u_char *sc_cp;
- volatile struct i8255 *sc_i8255;
- int sc_irq;
- u_char sc_state;
-#define LPT_OPEN 0x01 /* device is open */
-#define LPT_INIT 0x02 /* waiting to initialize for open */
-
- u_char sc_status;
- u_char sc_flags;
-#define LPT_AUTOLF 0x20 /* automatic LF on CR */
-#define LPT_NOPRIME 0x40 /* don't prime on open */
-
-#if defined(INET) && defined(PLIP)
- struct arpcom sc_arpcom;
- u_char *sc_ifbuf;
- int sc_ifierrs; /* consecutive input errors */
- int sc_ifoerrs; /* consecutive output errors */
- int sc_ifsoftint; /* i/o software interrupt */
- volatile int sc_pending; /* interrputs pending */
-#define PLIP_IPENDING 1
-#define PLIP_OPENDING 2
-
-#if defined(COMPAT_PLIP10)
- u_char sc_adrcksum;
-#endif
-#endif
-};
-
-#define LPTUNIT(s) (minor(s) & 0x1f)
-#define LPTFLAGS(s) (minor(s) & 0xe0)
-
-static int lptmatch(struct device *, void *, void *aux);
-static void lptattach(struct device *, struct device *, void *);
-static void lptintr(struct lpt_softc *);
-static int notready(u_char, struct lpt_softc *);
-static void lptout(void *arg);
-static int pushbytes(struct lpt_softc *);
-
-#if defined(INET) && defined(PLIP)
-/* Functions for the plip# interface */
-static void plipattach(struct lpt_softc *,int);
-static int plipioctl(struct ifnet *, u_long, caddr_t);
-static void plipsoftint(struct lpt_softc *);
-static void plipinput(struct lpt_softc *);
-static void plipstart(struct ifnet *);
-static void plipoutput(struct lpt_softc *);
-#endif
-
-struct cfdriver lptcd = {
- NULL,
- "lpt",
- lptmatch,
- lptattach,
- DV_TTY,
- sizeof(struct lpt_softc),
- NULL,
- 0
-};
-
-lptmatch(struct device *parent, void *cf, void *aux)
-{
- volatile struct i8255 *i8255 =
- (volatile struct i8255 *)((struct cfdata *)cf)->cf_loc[0];
- int unit = ((struct cfdata *)cf)->cf_unit;
-
- if (unit >= LPT_MAX)
- return(0);
-
- if ((int) i8255 == -1)
- i8255 = LPT_ADR(unit);
-
- i8255->port_control = LPT_PROBE_MODE;
-
- i8255->port_control = LPT_PROBE_CLR;
- if ((i8255->port_c & LPT_PROBE_MASK) != 0)
- return 0;
-
- i8255->port_control = LPT_PROBE_SET;
- if ((i8255->port_c & LPT_PROBE_MASK) == 0)
- return 0;
-
- i8255->port_control = LPT_PROBE_CLR;
- if ((i8255->port_c & LPT_PROBE_MASK) != 0)
- return 0;
-
- i8255->port_control = LPT_MODE;
- i8255->port_a = LPA_ACTIVE | LPA_NPRIME;
-
- return 1;
-}
-
-void
-lptattach(struct device *parent, struct device *self, void *aux)
-{
- struct lpt_softc *sc = (struct lpt_softc *) self;
- volatile struct i8255 *i8255 =
- (volatile struct i8255 *)self->dv_cfdata->cf_loc[0];
-
- if ((sc->sc_irq = self->dv_cfdata->cf_loc[1]) == -1)
- sc->sc_irq = LPT_IRQ(self->dv_unit);
-
- if ((int)i8255 == -1)
- i8255 = LPT_ADR(self->dv_unit);
- i8255->port_control = LPT_MODE;
- i8255->port_a = LPA_ACTIVE | LPA_NPRIME;
- i8255->port_control = LPT_IRQDISABLE;
-
- sc->sc_state = 0;
- sc->sc_i8255 = i8255;
-
-#if defined(INET) && defined(PLIP)
- plipattach(sc, self->dv_unit);
-#endif
- intr_establish(sc->sc_irq, lptintr, sc, sc->sc_dev.dv_xname,
- IPL_NONE, FALLING_EDGE);
- printf(" addr 0x%x, irq %d\n", (int) i8255, sc->sc_irq);
-}
-
-/*
- * Reset the printer, then wait until it's selected and not busy.
- */
-int
-lptopen(dev_t dev, int flag)
-{
- struct lpt_softc *sc = (struct lpt_softc *) lptcd.cd_devs[LPTUNIT(dev)];
- volatile struct i8255 *i8255 = sc->sc_i8255;
- u_char flags = LPTFLAGS(dev);
- int error;
- int spin;
-
- if (LPTUNIT(dev) >= NLPT || !sc)
- return ENXIO;
-
- if (sc->sc_state)
- return EBUSY;
-
-#if defined(INET) && defined(PLIP)
- if (sc->sc_arpcom.ac_if.if_flags & IFF_UP)
- return EBUSY;
-#endif
-
- sc->sc_state = LPT_INIT;
- sc->sc_flags = flags;
-
- if ((flags & LPT_NOPRIME) == 0) {
- /* assert INIT for 100 usec to start up printer */
- i8255->port_a &= ~LPA_NPRIME;
- DELAY(100);
- }
-
- if (flags & LPT_AUTOLF)
- i8255->port_a |= LPA_ALF | LPA_SELECT | LPA_NPRIME;
- else
- i8255->port_a = (i8255->port_a & ~LPA_ALF)
- | LPA_SELECT | LPA_NPRIME;
-
- /* wait till ready (printer running diagnostics) */
- for (spin = 0; notready(i8255->port_c, sc); spin += STEP) {
- if (spin >= TIMEOUT) {
- sc->sc_state = 0;
- return EBUSY;
- }
-
- /* wait 1/4 second, give up if we get a signal */
- if (error = tsleep((caddr_t)sc, LPTPRI | PCATCH, "lptopen",
- STEP) != EWOULDBLOCK) {
- sc->sc_state = 0;
- return error;
- }
- }
-
- sc->sc_inbuf = malloc(LPT_BSIZE, M_DEVBUF, M_WAITOK);
- sc->sc_status =
- sc->sc_count = 0;
- sc->sc_state = LPT_OPEN;
-
- return 0;
-}
-
-int
-notready(u_char status, struct lpt_softc *sc)
-{
- status ^= LPT_INVERT;
-
- if (status != sc->sc_status) {
- if (status & LPC_NOPAPER)
- log(LOG_NOTICE, "%s: out of paper\n", sc->sc_dev.dv_xname);
- if (status & LPC_ONLINE)
- log(LOG_NOTICE, "%s: offline\n", sc->sc_dev.dv_xname);
- if (status & LPC_NERROR)
- log(LOG_NOTICE, "%s: output error\n", sc->sc_dev.dv_xname);
- if (status & LPC_NACK)
- log(LOG_NOTICE, "%s: NACK low\n", sc->sc_dev.dv_xname);
- if (status & LPC_NBUSY)
- log(LOG_NOTICE, "%s: NBUSY low\n", sc->sc_dev.dv_xname);
- sc->sc_status = status;
- }
- return status & LPT_MASK;
-}
-
-void
-lptout(void *arg)
-{
- struct lpt_softc *sc = (struct lpt_softc *) arg;
- if (sc->sc_count > 0)
- sc->sc_i8255->port_control = LPT_IRQENABLE;
-}
-
-/*
- * Close the device, and free the local line buffer.
- */
-lptclose(dev_t dev, int flag)
-{
- struct lpt_softc *sc = (struct lpt_softc *) lptcd.cd_devs[LPTUNIT(dev)];
-
- if (sc->sc_count)
- (void) pushbytes(sc);
-
- sc->sc_i8255->port_control = LPT_IRQDISABLE;
- sc->sc_state = 0;
- free(sc->sc_inbuf, M_DEVBUF);
-
- return 0;
-}
-
-int
-pushbytes(struct lpt_softc *sc)
-{
- volatile struct i8255 *i8255 = sc->sc_i8255;
- int error;
-
- while (sc->sc_count > 0) {
- i8255->port_control = LPT_IRQENABLE;
- if (error = tsleep((caddr_t)sc, LPTPRI | PCATCH,
- "lptwrite", 0))
- return error;
- }
- return 0;
-}
-
-/*
- * Copy a line from user space to a local buffer, then call pushbytes to
- * get the chars moved to the output queue.
- */
-lptwrite(dev_t dev, struct uio *uio)
-{
- struct lpt_softc *sc = (struct lpt_softc *) lptcd.cd_devs[LPTUNIT(dev)];
- size_t n;
- int error = 0;
-
- if (sc->sc_count) return EBUSY;
- while (n = min(LPT_BSIZE, uio->uio_resid)) {
- uiomove(sc->sc_cp = sc->sc_inbuf, n, uio);
- sc->sc_count = n;
- error = pushbytes(sc);
- if (error) {
- /*
- * Return accurate residual if interrupted or timed
- * out.
- */
- uio->uio_resid += sc->sc_count;
- sc->sc_count = 0;
- return error;
- }
- }
- return 0;
-}
-
-/*
- * Handle printer interrupts which occur when the printer is ready to accept
- * another char.
- */
-void
-lptintr(struct lpt_softc *sc)
-{
- volatile struct i8255 *i8255 = sc->sc_i8255;
-
-#if defined(INET) && defined(PLIP)
- if(sc->sc_arpcom.ac_if.if_flags & IFF_UP) {
- i8255->port_a &= ~LPA_ACKENABLE;
- sc->sc_pending |= PLIP_IPENDING;
- softintr(sc->sc_ifsoftint);
- return;
- }
-#endif
-
- if ((sc->sc_state & LPT_OPEN) == 0) {
- i8255->port_control = LPT_IRQDISABLE;
- return;
- }
-
- if (sc->sc_count) {
- /* is printer online and ready for output? */
- if (notready(i8255->port_c, sc)) {
- i8255->port_control = LPT_IRQDISABLE;
- timeout(lptout, sc, STEP);
- return;
- }
- /* send char */
- i8255->port_a &= ~LPA_ACTIVE;
- i8255->port_b = *sc->sc_cp++;
- i8255->port_a |= LPA_ACTIVE;
- sc->sc_count--;
- }
-
- if (sc->sc_count == 0) {
- /* none, wake up the top half to get more */
- i8255->port_control = LPT_IRQDISABLE;
- wakeup((caddr_t)sc);
- }
-}
-
-int
-lptioctl(dev_t dev, int cmd, caddr_t data, int flag)
-{
- int error = 0;
-
- switch (cmd) {
- default:
- error = EINVAL;
- }
-
- return error;
-}
-
-#if defined(INET) && defined(PLIP)
-
-static void
-plipattach(struct lpt_softc *sc, int unit)
-{
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
-
- sc->sc_ifbuf = NULL;
- ifp->if_unit = unit;
- ifp->if_name = "plip";
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS;
- ifp->if_output = ether_output;
- ifp->if_start = plipstart;
- ifp->if_ioctl = plipioctl;
- ifp->if_watchdog = 0;
-
- ifp->if_type = IFT_ETHER;
- ifp->if_addrlen = 6;
- ifp->if_hdrlen = 14;
- ifp->if_mtu = PLIPMTU;
- sc->sc_ifsoftint = intr_establish(SOFTINT, plipsoftint, sc,
- sc->sc_dev.dv_xname, IPL_NET, 0);
-
- if_attach(ifp);
-}
-
-/*
- * Process an ioctl request.
- */
-static int
-plipioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
-{
- struct proc *p = curproc;
- struct lpt_softc *sc = (struct lpt_softc *) lptcd.cd_devs[ifp->if_unit];
- volatile struct i8255 *i8255 = sc->sc_i8255;
- struct ifaddr *ifa = (struct ifaddr *)data;
- struct ifreq *ifr = (struct ifreq *)data;
- int s;
- int error = 0;
-
- switch (cmd) {
-
- case SIOCSIFFLAGS:
- if (((ifp->if_flags & IFF_UP) == 0) &&
- (ifp->if_flags & IFF_RUNNING)) {
- ifp->if_flags &= ~IFF_RUNNING;
- sc->sc_i8255->port_control = LPT_MODE;
- i8255->port_a = LPA_ACTIVE | LPA_NPRIME;
- if (sc->sc_ifbuf)
- free(sc->sc_ifbuf, M_DEVBUF);
- sc->sc_ifbuf = NULL;
- }
- if (((ifp->if_flags & IFF_UP)) &&
- ((ifp->if_flags & IFF_RUNNING) == 0)) {
- if (sc->sc_state) {
- error = EBUSY;
- break;
- }
- if (!sc->sc_ifbuf)
- sc->sc_ifbuf =
- malloc(ifp->if_mtu + ifp->if_hdrlen,
- M_DEVBUF, M_WAITOK);
- ifp->if_flags |= IFF_RUNNING;
- sc->sc_i8255->port_control = LPT_IRQDISABLE;
- sc->sc_i8255->port_b = 0;
- sc->sc_i8255->port_a |= LPA_ACKENABLE;
- }
- break;
-
- case SIOCSIFADDR:
- if (ifa->ifa_addr->sa_family == AF_INET) {
- if (!sc->sc_ifbuf)
- sc->sc_ifbuf =
- malloc(PLIPMTU + ifp->if_hdrlen,
- M_DEVBUF, M_WAITOK);
- sc->sc_arpcom.ac_enaddr[0] = 0xfc;
- sc->sc_arpcom.ac_enaddr[1] = 0xfc;
- bcopy((caddr_t)&IA_SIN(ifa)->sin_addr,
- (caddr_t)&sc->sc_arpcom.ac_enaddr[2], 4);
- sc->sc_arpcom.ac_ipaddr = IA_SIN(ifa)->sin_addr;
-#if defined(COMPAT_PLIP10)
- if (ifp->if_flags & IFF_LINK0) {
- int i;
- sc->sc_arpcom.ac_enaddr[0] = 0xfd;
- sc->sc_arpcom.ac_enaddr[1] = 0xfd;
- for (i = sc->sc_adrcksum = 0; i < 5; i++)
- sc->sc_adrcksum += sc->sc_arpcom.ac_enaddr[i];
- sc->sc_adrcksum *= 2;
- }
-#endif
- ifp->if_flags |= IFF_RUNNING | IFF_UP;
-#if 0
- for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) {
- struct sockaddr_dl *sdl;
- if ((sdl = (struct sockaddr_dl *)ifa->ifa_addr) &&
- sdl->sdl_family == AF_LINK) {
- sdl->sdl_type = IFT_ETHER;
- sdl->sdl_alen = ifp->if_addrlen;
- bcopy((caddr_t)((struct arpcom *)ifp)->ac_enaddr,
- LLADDR(sdl), ifp->if_addrlen);
- break;
- }
- }
-#endif
- sc->sc_i8255->port_control = LPT_IRQDISABLE;
- sc->sc_i8255->port_b = 0;
- sc->sc_i8255->port_a |= LPA_ACKENABLE;
- arp_ifinit(&sc->sc_arpcom, ifa);
- } else
- error = EAFNOSUPPORT;
- break;
-
- case SIOCAIFADDR:
- case SIOCDIFADDR:
- case SIOCSIFDSTADDR:
- if (ifa->ifa_addr->sa_family != AF_INET)
- error = EAFNOSUPPORT;
- break;
-
- case SIOCSIFMTU:
- if ((error = suser(p->p_ucred, &p->p_acflag)))
- return(error);
- if (ifp->if_mtu != ifr->ifr_metric) {
- ifp->if_mtu = ifr->ifr_metric;
- if (sc->sc_ifbuf) {
- s = splimp();
- free(sc->sc_ifbuf, M_DEVBUF);
- sc->sc_ifbuf =
- malloc(ifp->if_mtu + ifp->if_hdrlen,
- M_DEVBUF, M_WAITOK);
- splx(s);
- }
- }
- break;
-
- case SIOCGIFMTU:
- ifr->ifr_metric = ifp->if_mtu;
- break;
-
- default:
- error = EINVAL;
- }
- return (error);
-}
-
-static void
-plipsoftint(struct lpt_softc *sc)
-{
- int pending = sc->sc_pending;
-
- while (sc->sc_pending & PLIP_IPENDING) {
- pending |= sc->sc_pending;
- sc->sc_pending = 0;
- plipinput(sc);
- }
-
- if (pending & PLIP_OPENDING)
- plipoutput(sc);
-}
-
-static int
-plipreceive(volatile struct i8255 *i8255, u_char *buf, int len)
-{
- int i;
- u_char cksum = 0, c;
-
- while (len--) {
- i = PLIPMXSPIN2;
- while ((i8255->port_c & LPC_NBUSY) != 0)
- if (i-- < 0) return -1;
- c = i8255->port_c >> 4;
- i8255->port_b = 0x11;
- while ((i8255->port_c & LPC_NBUSY) == 0)
- if (i-- < 0) return -1;
- c |= i8255->port_c & 0xf0;
- i8255->port_b = 0x01;
- cksum += (*buf++ = c);
- }
- return(cksum);
-}
-
-static void
-plipinput(struct lpt_softc *sc)
-{
- extern struct mbuf *m_devget(char *, int, int, struct ifnet *, void (*)());
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
- volatile struct i8255 *i8255 = sc->sc_i8255;
- struct mbuf *m;
- struct ether_header *eh;
- u_char *p = sc->sc_ifbuf, minibuf[4];
- int c, i = 0, s, len, cksum;
-
- if (!(i8255->port_c & LPC_NACK)) {
- i8255->port_a |= LPA_ACKENABLE;
- ifp->if_collisions++;
- return;
- }
- i8255->port_b = 0x01;
- i8255->port_a &= ~(LPA_ACKENABLE | LPA_ACTIVE);
-
-#if defined(COMPAT_PLIP10)
- if (ifp->if_flags & IFF_LINK0) {
- if (plipreceive(i8255, minibuf, 3) < 0) goto err;
- len = (minibuf[1] << 8) | minibuf[2];
- if (len > (ifp->if_mtu + ifp->if_hdrlen)) goto err;
-
- switch (minibuf[0]) {
- case 0xfc:
- p[0] = p[ 6] = ifp->ac_enaddr[0];
- p[1] = p[ 7] = ifp->ac_enaddr[1];
- p[2] = p[ 8] = ifp->ac_enaddr[2];
- p[3] = p[ 9] = ifp->ac_enaddr[3];
- p[4] = p[10] = ifp->ac_enaddr[4];
- p += 5;
- if ((cksum = plipreceive(i8255, p, 1)) < 0) goto err;
- p += 6;
- if ((c = plipreceive(i8255, p, len - 11)) < 0) goto err;
- cksum += c + sc->sc_adrcksum;
- c = p[1]; p[1] = p[2]; p[2] = c;
- cksum &= 0xff;
- break;
- case 0xfd:
- if ((cksum = plipreceive(i8255, p, len)) < 0) goto err;
- break;
- default:
- goto err;
- }
- } else
-#endif
- {
- if (plipreceive(i8255, minibuf, 2) < 0) goto err;
- len = (minibuf[1] << 8) | minibuf[0];
- if (len > (ifp->if_mtu + ifp->if_hdrlen)) {
- log(LOG_NOTICE, "plip%d: packet > MTU\n", ifp->if_unit);
- goto err;
- }
- if ((cksum = plipreceive(i8255, p, len)) < 0) goto err;
- }
-
- if (plipreceive(i8255, minibuf, 1) < 0) goto err;
- if (cksum != minibuf[0]) {
- log(LOG_NOTICE, "plip%d: checksum error\n", ifp->if_unit);
- goto err;
- }
- i8255->port_b = 0x00;
-
- s = splimp();
- if (m = m_devget(sc->sc_ifbuf, len, 0, ifp, NULL)) {
- /* We assume that the header fit entirely in one mbuf. */
- eh = mtod(m, struct ether_header *);
- m->m_pkthdr.len -= sizeof(*eh);
- m->m_len -= sizeof(*eh);
- m->m_data += sizeof(*eh);
- ether_input(ifp, eh, m);
- }
- splx(s);
- sc->sc_ifierrs = 0;
- ifp->if_ipackets++;
- i8255->port_a |= LPA_ACKENABLE | LPA_ACTIVE;
- return;
-
-err:
- i8255->port_b = 0x00;
-
- if (sc->sc_ifierrs < PLIPMXERRS) {
- i8255->port_a |= LPA_ACKENABLE | LPA_ACTIVE;
- } else {
- /* We are not able to send receive anything for now,
- * so stop wasting our time and leave the interrupt
- * disabled.
- */
- if (sc->sc_ifierrs == PLIPMXERRS)
- log(LOG_NOTICE, "plip%d: rx hard error\n", ifp->if_unit);
- i8255->port_a |= LPA_ACTIVE;
- }
- ifp->if_ierrors++;
- sc->sc_ifierrs++;
- return;
-}
-
-static int
-pliptransmit(volatile struct i8255 *i8255, u_char *buf, int len)
-{
- int i;
- u_char cksum = 0, c;
-
- while (len--) {
- i = PLIPMXSPIN2;
- cksum += (c = *buf++);
- while ((i8255->port_c & LPC_NBUSY) == 0)
- if (i-- < 0) return -1;
- i8255->port_b = c & 0x0f;
- i8255->port_b = c & 0x0f | 0x10;
- c >>= 4;
- while ((i8255->port_c & LPC_NBUSY) != 0)
- if (i-- < 0) return -1;
- i8255->port_b = c | 0x10;
- i8255->port_b = c;
- }
- return(cksum);
-}
-
-/*
- * Setup output on interface.
- */
-static void
-plipstart(struct ifnet *ifp)
-{
- struct lpt_softc *sc = (struct lpt_softc *) lptcd.cd_devs[ifp->if_unit];
- sc->sc_pending |= PLIP_OPENDING;
- softintr(sc->sc_ifsoftint);
-}
-
-static void
-plipoutput(struct lpt_softc *sc)
-{
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
- volatile struct i8255 *i8255 = sc->sc_i8255;
- struct mbuf *m0, *m;
- u_char minibuf[4], cksum;
- int len, i, s;
-
- if (ifp->if_flags & IFF_OACTIVE)
- return;
- ifp->if_flags |= IFF_OACTIVE;
-
- if (sc->sc_ifoerrs)
- untimeout((void (*)(void *))plipoutput, sc);
-
- for (;;) {
- s = splnet();
- IF_DEQUEUE(&ifp->if_snd, m0);
- splx(s);
- if (!m0)
- break;
-
- for (len = 0, m = m0; m; m = m->m_next)
- len += m->m_len;
-#if defined(COMPAT_PLIP10)
- if (ifp->if_flags & IFF_LINK0) {
- minibuf[0] = 3;
- minibuf[1] = 0xfd;
- minibuf[2] = len >> 8;
- minibuf[3] = len;
- } else
-#endif
- {
- minibuf[0] = 2;
- minibuf[1] = len;
- minibuf[2] = len >> 8;
- }
-
- /* Trigger remote interrupt */
- i = PLIPMXSPIN1;
- do {
- if (sc->sc_pending & PLIP_IPENDING) {
- i8255->port_b = 0x00;
- sc->sc_pending = 0;
- plipinput(sc);
- i = PLIPMXSPIN1;
- } else if (i-- < 0)
- goto retry;
- /* Retrigger remote interrupt */
- i8255->port_b = 0x08;
- } while ((i8255->port_c & LPC_NERROR) == 0);
- i8255->port_a &= ~(LPA_ACKENABLE | LPA_ACTIVE);
-
- if (pliptransmit(i8255, minibuf + 1, minibuf[0]) < 0) goto retry;
- for (cksum = 0, m = m0; m; m = m->m_next) {
- i = pliptransmit(i8255, mtod(m, u_char *), m->m_len);
- if (i < 0) goto retry;
- cksum += i;
- }
- if (pliptransmit(i8255, &cksum, 1) < 0) goto retry;
- i = PLIPMXSPIN2;
- while ((i8255->port_c & LPC_NBUSY) == 0)
- if (i-- < 0) goto retry;
- i8255->port_b = 0x00;
-
- ifp->if_opackets++;
- ifp->if_obytes += len + 4;
- sc->sc_ifoerrs = 0;
- s = splimp();
- m_freem(m0);
- splx(s);
- i8255->port_a |= LPA_ACKENABLE;
- }
- i8255->port_a |= LPA_ACTIVE;
- ifp->if_flags &= ~IFF_OACTIVE;
- return;
-
-retry:
- if (i8255->port_c & LPC_NACK)
- ifp->if_collisions++;
- else
- ifp->if_oerrors++;
-
- ifp->if_flags &= ~IFF_OACTIVE;
- i8255->port_b = 0x00;
-
- if ((ifp->if_flags & (IFF_RUNNING | IFF_UP)) == (IFF_RUNNING | IFF_UP)
- && sc->sc_ifoerrs < PLIPMXRETRY) {
- s = splnet();
- IF_PREPEND(&ifp->if_snd, m0);
- splx(s);
- i8255->port_a |= LPA_ACKENABLE | LPA_ACTIVE;
- timeout((void (*)(void *))plipoutput, sc, PLIPRETRY);
- } else {
- if (sc->sc_ifoerrs == PLIPMXRETRY) {
- log(LOG_NOTICE, "plip%d: tx hard error\n", ifp->if_unit);
- }
- s = splimp();
- m_freem(m0);
- splx(s);
- i8255->port_a |= LPA_ACTIVE;
- }
- sc->sc_ifoerrs++;
-}
-
-#endif
diff --git a/sys/arch/pc532/dev/lptreg.h b/sys/arch/pc532/dev/lptreg.h
deleted file mode 100644
index 6298f1fe291..00000000000
--- a/sys/arch/pc532/dev/lptreg.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* $NetBSD: lptreg.h,v 1.3 1995/05/16 07:30:35 phil Exp $ */
-
-/*
- * Copyright (c) 1994 Matthias Pfaller.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Matthias Pfaller.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * lptreg.h: definitions for the lpt driver.
- *
- */
-
-struct i8255 {
- unsigned char port_a; /* Port A data (r/w) */
- unsigned char port_b; /* Port B data (r/w) */
- unsigned char port_c; /* Port C data (r/w) */
- unsigned char port_control; /* Port control (-/w) */
-};
-
-/* port_a */
-#define LPA_ALF 0x01
-#define LPA_SELECT 0x02
-#define LPA_NPRIME 0x04
-#define LPA_ACKENABLE 0x08 /* Enable Ack interrupts */
-#define LPA_ACTIVE 0x10 /* Device active led */
-
-/* port_c */
-#define LPC_IRQ 0x01
-#define LPC_NSTROBE 0x02
-#define LPC_NBUSY 0x08 /* Negative logic! */
-#define LPC_NERROR 0x10
-#define LPC_ONLINE 0x20
-#define LPC_NOPAPER 0x40
-#define LPC_NACK 0x80
-
-/* port_control */
-#define LPT_PROBE_MODE 0x8c
-#define LPT_MODE 0x8d /* Port A: Output, Mode 0 */
- /* Port B: Output, Mode 1 */
- /* Port C: Input */
-#define LPT_IRQENABLE 0x05 /* Enable LPT interrupts */
-#define LPT_IRQDISABLE 0x04 /* Disable LPT interrupts */
-
-#define LPT_PROBE_MASK 0x08
-#define LPT_PROBE_SET 0x07
-#define LPT_PROBE_CLR 0x06
-
- /* Default mapped address */
-#define LPT_ADR(unit) (((volatile struct i8255 *)0xFFC80030) + unit)
- /* Default interrupts */
-#define LPT_IRQ(unit) (unit?IR_TTY3 - 1:IR_TTY3)
-#define LPT_MAX 2 /* Maximum number of lpt interfaces*/
diff --git a/sys/arch/pc532/dev/ncr.c b/sys/arch/pc532/dev/ncr.c
deleted file mode 100644
index 06e179f7a85..00000000000
--- a/sys/arch/pc532/dev/ncr.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/* $OpenBSD: ncr.c,v 1.4 2000/03/03 00:54:54 todd Exp $ */
-/* $NetBSD: ncr.c,v 1.21 1995/11/30 00:58:47 jtc Exp $ */
-
-/*
- * Copyright (c) 1994 Matthias Pfaller.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Matthias Pfaller.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-#include <sys/buf.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsi_message.h>
-#include <scsi/scsiconf.h>
-#include <machine/stdarg.h>
-
-/*
- * Include the driver definitions
- */
-#include "ncr5380reg.h"
-#include "ncrreg.h"
-
-/*
- * Set the various driver options
- */
-#define NREQ 18 /* Size of issue queue */
-#define AUTO_SENSE 1 /* Automatically issue a request-sense */
-
-#define DRNAME ncr /* used in various prints */
-#undef DBG_SEL /* Show the selection process */
-#undef DBG_REQ /* Show enqueued/ready requests */
-#undef DBG_NOWRITE /* Do not allow writes to the targets */
-#undef DBG_PIO /* Show the polled-I/O process */
-#undef DBG_INF /* Show information transfer process */
-#undef DBG_NOSTATIC /* No static functions, all in DDB trace*/
-#define DBG_PID /* Keep track of driver */
-#undef REAL_DMA /* Use DMA if sensible */
-#undef REAL_DMA_POLL 0 /* 1: Poll for end of DMA-transfer */
-#define USE_PDMA /* Use special pdma-transfer function */
-
-/*
- * Softc of currently active controller (a bit of fake; we only have one)
- */
-static struct ncr_softc *cur_softc;
-
-/*
- * Function decls:
- */
-static int transfer_pdma __P((u_char *, u_char *, u_long *));
-static void ncr_intr __P((void *));
-static void ncr_soft_intr __P((void *));
-#define scsi_dmaok(x) 0
-#define pdma_ready() 0
-#define fair_to_keep_dma() 1
-#define claimed_dma() 1
-#define reconsider_dma()
-#define ENABLE_NCR5380(sc) do { \
- scsi_select_ctlr(DP8490); \
- cur_softc = sc; \
- } while (0)
-
-void
-delay(timeo)
- int timeo;
-{
- int len;
- for (len=0; len < timeo * 2; len++);
-}
-
-static int
-machine_match(pdp, cdp, auxp, cfd)
- struct device *pdp;
- struct cfdata *cdp;
- void *auxp;
- struct cfdriver *cfd;
-{
- if(cdp->cf_unit != 0) /* Only one unit */
- return(0);
- return(1);
-}
-
-static void
-scsi_mach_init(sc)
- struct ncr_softc *sc;
-{
- register int i;
- intr_disable(IR_SCSI1);
- i = intr_establish(SOFTINT, ncr_soft_intr, sc, sc->sc_dev.dv_xname,
- IPL_BIO, 0);
- intr_establish(IR_SCSI1, ncr_intr, (void *)i, sc->sc_dev.dv_xname,
- IPL_BIO, RISING_EDGE);
- printf(" addr 0x%x, irq %d", NCR5380, IR_SCSI1);
-}
-
-/*
- * 5380 interrupt.
- */
-static void
-ncr_intr(softint)
- void *softint;
-{
- int ctrlr = scsi_select_ctlr(DP8490);
- if (NCR5380->ncr_dmstat & SC_IRQ_SET) {
- intr_disable(IR_SCSI1);
- softintr((int)softint);
- }
- scsi_select_ctlr(ctrlr);
-}
-
-static void
-ncr_soft_intr(sc)
- void *sc;
-{
- int ctrlr = scsi_select_ctlr(DP8490);
- ncr_ctrl_intr(sc);
- intr_enable(IR_SCSI1);
- scsi_select_ctlr(ctrlr);
-}
-
-/*
- * PDMA stuff
- */
-#define movsd(from, to, n) do { \
- register int r0 __asm ("r0") = n; \
- register u_char *r1 __asm("r1") = from; \
- register u_char *r2 __asm("r2") = to; \
- __asm volatile ("movsd" \
- : "=r" (r1), "=r" (r2) \
- : "0" (r1), "1" (r2), "r" (r0) \
- : "r0", "memory" \
- ); \
- from = r1; to = r2; \
- } while (0)
-
-#define movsb(from, to, n) do { \
- register int r0 __asm ("r0") = n; \
- register u_char *r1 __asm("r1") = from; \
- register u_char *r2 __asm("r2") = to; \
- __asm volatile ("movsb" \
- : "=r" (r1), "=r" (r2) \
- : "0" (r1), "1" (r2), "r" (r0) \
- : "r0", "memory" \
- ); \
- from = r1; to = r2; \
- } while (0)
-
-#define TIMEOUT 1000000
-#define READY(dataout) do { \
- for (i = TIMEOUT; i > 0; i--) { \
- /*if (!(NCR5380->ncr_dmstat & SC_PHS_MTCH)) {*/ \
- if (NCR5380->ncr_dmstat & SC_IRQ_SET) { \
- if (dataout) NCR5380->ncr_icom &= ~SC_ADTB; \
- NCR5380->ncr_mode = IMODE_BASE; \
- *count = len; \
- if ((idstat = NCR5380->ncr_idstat) & SC_S_REQ) \
- *phase = (idstat >> 2) & 7; \
- else \
- *phase = NR_PHASE; \
- return(1); \
- } \
- if (NCR5380->ncr_dmstat & SC_DMA_REQ) break; \
- delay(1); \
- } \
- if (i <= 0) panic("ncr0: pdma timeout"); \
- } while (0)
-
-#define byte_data ((volatile u_char *)pdma)
-#define word_data ((volatile u_short *)pdma)
-#define long_data ((volatile u_long *)pdma)
-
-#define W1(n) *byte_data = *(data + n)
-#define W2(n) *word_data = *((u_short *)data + n)
-#define W4(n) *long_data = *((u_long *)data + n)
-#define R1(n) *(data + n) = *byte_data
-#define R4(n) *((u_long *)data + n) = *long_data
-
-static int
-transfer_pdma(phase, data, count)
- u_char *phase;
- u_char *data;
- u_long *count;
-{
- register volatile u_char *pdma = PDMA_ADDRESS;
- register int len = *count, i, idstat;
-
- if (len < 256) {
- transfer_pio(phase, data, count, 0);
- return(1);
- }
- NCR5380->ncr_tcom = *phase;
- scsi_clr_ipend();
- if (PH_IN(*phase)) {
- NCR5380->ncr_icom = 0;
- NCR5380->ncr_mode = IMODE_BASE | SC_M_DMA | SC_MON_BSY;
- NCR5380->ncr_ircv = 0;
- while (len >= 256) {
- READY(0);
- di();
- movsd((u_char *)pdma, data, 64);
- len -= 256;
- ei();
- }
- if (len) {
- di();
- while (len) {
- READY(0);
- R1(0);
- data++;
- len--;
- }
- ei();
- }
- } else {
- NCR5380->ncr_mode = IMODE_BASE | SC_M_DMA | SC_MON_BSY;
- NCR5380->ncr_icom = SC_ADTB;
- NCR5380->ncr_dmstat = SC_S_SEND;
- while (len >= 256) {
- /* The second ready is to
- * compensate for DMA-prefetch.
- * Since we adjust len only at
- * the end of the block, there
- * is no need to correct the
- * residue.
- */
- READY(1);
- di();
- W1(0); READY(1); W1(1); W2(1);
- data += 4;
- movsd(data, (u_char *)pdma, 63);
- ei();
- len -= 256;
- }
- if (len) {
- READY(1);
- di();
- while (len) {
- W1(0);
- READY(1);
- data++;
- len--;
- }
- ei();
- }
- i = TIMEOUT;
- while (((NCR5380->ncr_dmstat & (SC_DMA_REQ|SC_PHS_MTCH))
- == SC_PHS_MTCH) && --i);
- if (!i)
- printf("ncr0: timeout waiting for SC_DMA_REQ.\n");
- *byte_data = 0;
- }
-
-ncr_timeout_error:
- NCR5380->ncr_mode = IMODE_BASE;
- if((idstat = NCR5380->ncr_idstat) & SC_S_REQ)
- *phase = (idstat >> 2) & 7;
- else
- *phase = NR_PHASE;
- *count = len;
- return(1);
-}
-
-/*
- * Last but not least... Include the general driver code
- */
-#include "ncr5380.c"
diff --git a/sys/arch/pc532/dev/ncr5380.c b/sys/arch/pc532/dev/ncr5380.c
deleted file mode 100644
index cfd3dc4a12d..00000000000
--- a/sys/arch/pc532/dev/ncr5380.c
+++ /dev/null
@@ -1,1947 +0,0 @@
-/* $NetBSD: ncr5380.c,v 1.7 1996/01/26 05:04:12 phil Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-#ifdef DBG_NOSTATIC
-# define static
-#endif
-#ifdef DBG_SEL
-# define DBG_SELPRINT(a,b) printf(a,b)
-#else
-# define DBG_SELPRINT(a,b)
-#endif
-#ifdef DBG_PIO
-# define DBG_PIOPRINT(a,b,c) printf(a,b,c)
-#else
-# define DBG_PIOPRINT(a,b,c)
-#endif
-#ifdef DBG_INF
-# define DBG_INFPRINT(a,b,c) a(b,c)
-#else
-# define DBG_INFPRINT(a,b,c)
-#endif
-#ifdef DBG_PID
- static char *last_hit = NULL, *olast_hit = NULL;
-# define PID(a) olast_hit = last_hit; last_hit = a;
-#else
-# define PID(a)
-#endif
-
-/*
- * Bit mask of targets you want debugging to be shown
- */
-u_char dbg_target_mask = 0x7f;
-
-/*
- * Set bit for target when parity checking must be disabled.
- * My (LWP) Maxtor 7245S seems to generate parity errors on about 50%
- * of all transfers while the data is correct!?
- */
-u_char ncr5380_no_parchk = 0xff;
-
-/*
- * This is the default sense-command we send.
- */
-static u_char sense_cmd[] = {
- REQUEST_SENSE, 0, 0, 0, sizeof(struct scsi_sense_data), 0
-};
-
-/*
- * True if the main co-routine is running
- */
-static volatile int main_running = 0;
-
-/*
- * Mask of targets selected
- */
-static u_char busy;
-
-static void ncr5380_minphys(struct buf *bp);
-static int ncr5380_scsi_cmd(struct scsi_xfer *xs);
-static int ncr5380_show_scsi_cmd(struct scsi_xfer *xs);
-
-struct scsi_adapter ncr5380_switch = {
- ncr5380_scsi_cmd, /* scsi_cmd() */
- ncr5380_minphys, /* scsi_minphys() */
- 0, /* open_target_lu() */
- 0 /* close_target_lu() */
-};
-
-struct scsi_device ncr5380_dev = {
- NULL, /* use default error handler */
- NULL, /* do not have a start functio */
- NULL, /* have no async handler */
- NULL /* Use default done routine */
-};
-
-
-static SC_REQ req_queue[NREQ];
-static SC_REQ *free_head = NULL; /* Free request structures */
-
-
-/*
- * Inline functions:
- */
-
-/*
- * Determine the size of a SCSI command.
- */
-extern __inline__ int command_size(opcode)
-u_char opcode;
-{
- switch ((opcode >> 4) & 0xf) {
- case 0:
- case 1:
- return (6);
- case 2:
- case 3:
- return (10);
- }
- return (12);
-}
-
-
-/*
- * Wait for request-line to become active. When it doesn't return 0.
- * Otherwise return != 0.
- * The timeouts in the 'wait_req_*' functions are arbitrary and rather
- * large. In 99% of the invocations nearly no timeout is needed but in
- * some cases (especially when using my tapedrive, a Tandberg 3600) the
- * device is busy internally and the first SCSI-phase will be delayed.
- */
-extern __inline__ int wait_req_true(void)
-{
- int timeout = 25000;
-
- while (!(GET_5380_REG(NCR5380_IDSTAT) & SC_S_REQ) && --timeout)
- delay(1);
- return (GET_5380_REG(NCR5380_IDSTAT) & SC_S_REQ);
-}
-
-/*
- * Wait for request-line to become inactive. When it doesn't return 0.
- * Otherwise return != 0.
- */
-extern __inline__ int wait_req_false(void)
-{
- int timeout = 25000;
-
- while ((GET_5380_REG(NCR5380_IDSTAT) & SC_S_REQ) && --timeout)
- delay(1);
- return (!(GET_5380_REG(NCR5380_IDSTAT) & SC_S_REQ));
-}
-
-extern __inline__ void ack_message()
-{
- SET_5380_REG(NCR5380_ICOM, 0);
-}
-
-extern __inline__ void nack_message(SC_REQ *reqp, u_char msg)
-{
- SET_5380_REG(NCR5380_ICOM, SC_A_ATN);
- reqp->msgout = msg;
-}
-
-extern __inline__ void finish_req(SC_REQ *reqp)
-{
- int sps;
- struct scsi_xfer *xs = reqp->xs;
-
-#ifdef REAL_DMA
- /*
- * If we bounced, free the bounce buffer
- */
- if (reqp->dr_flag & DRIVER_BOUNCING)
- free_bounceb(reqp->bounceb);
-#endif /* REAL_DMA */
-#ifdef DBG_REQ
- if (dbg_target_mask & (1 << reqp->targ_id))
- show_request(reqp, "DONE");
-#endif
-#ifdef DBG_ERR_RET
- if (reqp->xs->error != 0)
- show_request(reqp, "ERR_RET");
-#endif
-
- /*
- * Return request to free-q
- */
- sps = splbio();
- reqp->next = free_head;
- free_head = reqp;
- splx(sps);
-
- xs->flags |= ITSDONE;
- scsi_done(xs);
-}
-
-/*
- * Auto config stuff....
- */
-int ncr_cprint __P((void *auxp, const char *));
-void ncr_attach __P((struct device *, struct device *, void *));
-int ncr_match __P((struct device *, struct cfdata *, void *));
-
-/*
- * Tricks to make driver-name configurable
- */
-#define CFNAME(n) __CONCAT(n,cd)
-#define CFSTRING(n) __STRING(n)
-
-struct cfdriver CFNAME(DRNAME) = {
- NULL, CFSTRING(DRNAME), (cfmatch_t)ncr_match, ncr_attach,
- DV_DULL, sizeof(struct ncr_softc), NULL, 0 };
-
-int
-ncr_match(pdp, cdp, auxp)
-struct device *pdp;
-struct cfdata *cdp;
-void *auxp;
-{
- return (machine_match(pdp, cdp, auxp, &CFNAME(DRNAME)));
-}
-
-void
-ncr_attach(pdp, dp, auxp)
-struct device *pdp, *dp;
-void *auxp;
-{
- struct ncr_softc *sc;
- int i;
-
- sc = (struct ncr_softc *)dp;
-
- sc->sc_link.adapter_softc = sc;
- sc->sc_link.adapter_target = 7;
- sc->sc_link.adapter = &ncr5380_switch;
- sc->sc_link.device = &ncr5380_dev;
- sc->sc_link.openings = NREQ - 1;
-
- /*
- * bitmasks
- */
- sc->sc_noselatn = 0;
- sc->sc_selected = 0;
-
- /*
- * Initialize machine-type specific things...
- */
- scsi_mach_init(sc);
- printf("\n");
-
- /*
- * Initialize request queue freelist.
- */
- for (i = 0; i < NREQ; i++) {
- req_queue[i].next = free_head;
- free_head = &req_queue[i];
- }
-
- /*
- * Initialize the host adapter
- */
- scsi_idisable();
- ENABLE_NCR5380(sc);
- SET_5380_REG(NCR5380_ICOM, 0);
- SET_5380_REG(NCR5380_MODE, IMODE_BASE);
- SET_5380_REG(NCR5380_TCOM, 0);
- SET_5380_REG(NCR5380_IDSTAT, 0);
- scsi_ienable();
-
- /*
- * attach all scsi units on us
- */
- config_found(dp, &sc->sc_link, ncr_cprint);
-}
-
-/*
- * print diag if name is NULL else just extra
- */
-int
-ncr_cprint(auxp, name)
-void *auxp;
-const char *name;
-{
- if (name == NULL)
- return (UNCONF);
- return (QUIET);
-}
-/*
- * End of auto config stuff....
- */
-
-/*
- * Carry out a request from the high level driver.
- */
-static int
-ncr5380_scsi_cmd(struct scsi_xfer *xs)
-{
- int sps;
- SC_REQ *reqp;
- int flags = xs->flags;
-
- /*
- * We do not queue RESET commands
- */
- if (flags & SCSI_RESET) {
- scsi_reset(xs->sc_link->adapter_softc);
- return (COMPLETE);
- }
-
- /*
- * Get a request block
- */
- sps = splbio();
- if ((reqp = free_head) == 0) {
- splx(sps);
- return (TRY_AGAIN_LATER);
- }
- free_head = reqp->next;
- reqp->next = NULL;
- splx(sps);
-
- /*
- * Initialize our private fields
- */
- reqp->dr_flag = (flags & SCSI_POLL) ? DRIVER_NOINT : 0;
- reqp->phase = NR_PHASE;
- reqp->msgout = MSG_NOOP;
- reqp->status = SCSGOOD;
- reqp->link = NULL;
- reqp->xs = xs;
- reqp->targ_id = xs->sc_link->target;
- reqp->targ_lun = xs->sc_link->lun;
- reqp->xdata_ptr = (u_char*)xs->data;
- reqp->xdata_len = xs->datalen;
- bcopy(xs->cmd, &reqp->xcmd, sizeof(struct scsi_generic));
- reqp->xcmd.bytes[0] |= reqp->targ_lun << 5;
-
- /*
- * Sanity check on flags...
- */
- if (flags & ITSDONE) {
- ncr_tprint(reqp, "scsi_cmd: command already done.....\n");
- xs->flags &= ~ITSDONE;
- }
- if (!(flags & INUSE)) {
- ncr_tprint(reqp, "scsi_cmd: command not in use.....\n");
- xs->flags |= ~INUSE;
- }
-
-#ifdef REAL_DMA
- /*
- * Check if DMA can be used on this request
- */
- if (scsi_dmaok(reqp))
- reqp->dr_flag |= DRIVER_DMAOK;
-#endif /* REAL_DMA */
-
- /*
- * Insert the command into the issue queue. Note that 'REQUEST SENSE'
- * commands are inserted at the head of the queue since any command
- * will clear the existing contingent allegience condition and the sense
- * data is only valid while the condition exists.
- * When possible, link the command to a previous command to the same
- * target. This is not very sensible when AUTO_SENSE is not defined!
- * Interrupts are disabled while we are fiddling with the issue-queue.
- */
- sps = splbio();
- if ((issue_q == NULL) || (reqp->xcmd.opcode == REQUEST_SENSE)) {
- reqp->next = issue_q;
- issue_q = reqp;
- }
- else {
- SC_REQ *tmp, *link;
-
- tmp = issue_q;
- link = NULL;
- do {
- if (!link && (tmp->targ_id == reqp->targ_id) && !tmp->link)
- link = tmp;
- } while (tmp->next && (tmp = tmp->next));
- tmp->next = reqp;
-#ifdef AUTO_SENSE
- if (link) {
- link->link = reqp;
- link->xcmd.bytes[link->xs->cmdlen - 2] |= 1;
- }
-#endif
- }
- splx(sps);
-
-#ifdef DBG_REQ
- if (dbg_target_mask & (1 << reqp->targ_id))
- show_request(reqp, (reqp->xcmd.opcode == REQUEST_SENSE) ?
- "HEAD":"TAIL");
-#endif
-
- run_main(xs->sc_link->adapter_softc);
-
- if (xs->flags & (SCSI_POLL|ITSDONE))
- return (COMPLETE); /* We're booting or run_main has completed */
- return (SUCCESSFULLY_QUEUED);
-}
-
-static void
-ncr5380_minphys(struct buf *bp)
-{
- if (bp->b_bcount > MIN_PHYS)
- bp->b_bcount = MIN_PHYS;
- minphys(bp);
-}
-#undef MIN_PHYS
-
-static int
-ncr5380_show_scsi_cmd(struct scsi_xfer *xs)
-{
- u_char *b = (u_char *) xs->cmd;
- int i = 0;
-
- if (!(xs->flags & SCSI_RESET)) {
- printf("(%d:%d:%d,0x%x)-", xs->sc_link->scsibus,
- xs->sc_link->target, xs->sc_link->lun, xs->sc_link->flags);
- while (i < xs->cmdlen) {
- if (i)
- printf(",");
- printf("%x",b[i++]);
- }
- printf("-\n");
- }
- else {
- printf("(%d:%d:%d)-RESET-\n",
- xs->sc_link->scsibus,xs->sc_link->target, xs->sc_link->lun);
- }
-}
-
-/*
- * The body of the driver.
- */
-static void
-scsi_main(sc)
-struct ncr_softc *sc;
-{
- SC_REQ *req, *prev;
- int itype;
- int sps;
-
- /*
- * While running in the driver SCSI-interrupts are disabled.
- */
- scsi_idisable();
- ENABLE_NCR5380(sc);
-
- PID("scsi_main1");
- for (;;) {
- sps = splbio();
- if (!connected) {
- /*
- * Check if it is fair keep any exclusive access to DMA
- * claimed. If not, stop queueing new jobs so the discon_q
- * will be eventually drained and DMA can be given up.
- */
- if (!fair_to_keep_dma())
- goto main_exit;
-
- /*
- * Search through the issue-queue for a command
- * destined for a target that isn't busy.
- */
- prev = NULL;
- for (req=issue_q; req != NULL; prev = req, req = req->next) {
- if (!(busy & (1 << req->targ_id))) {
- /*
- * Found one, remove it from the issue queue
- */
- if (prev == NULL)
- issue_q = req->next;
- else prev->next = req->next;
- req->next = NULL;
- break;
- }
- }
-
- /*
- * When a request has just ended, we get here before an other
- * device detects that the bus is free and that it can
- * reconnect. The problem is that when this happens, we always
- * baffle the device because our (initiator) id is higher. This
- * can cause a sort of starvation on slow devices. So we check
- * for a pending reselection here.
- * Note that 'connected' will be non-null if the reselection
- * succeeds.
- */
- if ((GET_5380_REG(NCR5380_IDSTAT) & (SC_S_SEL|SC_S_IO))
- == (SC_S_SEL|SC_S_IO)){
- if (req != NULL) {
- req->next = issue_q;
- issue_q = req;
- }
- splx(sps);
-
- reselect(sc);
- scsi_clr_ipend();
- goto connected;
- }
-
- /*
- * The host is not connected and there is no request
- * pending, exit.
- */
- if (req == NULL) {
- PID("scsi_main2");
- goto main_exit;
- }
-
- /*
- * Re-enable interrupts before handling the request.
- */
- splx(sps);
-
-#ifdef DBG_REQ
- if (dbg_target_mask & (1 << req->targ_id))
- show_request(req, "TARGET");
-#endif
- /*
- * We found a request. Try to connect to the target. If the
- * initiator fails arbitration, the command is put back in the
- * issue queue.
- */
- if (scsi_select(req, 0)) {
- sps = splbio();
- req->next = issue_q;
- issue_q = req;
- splx(sps);
-#ifdef DBG_REQ
- if (dbg_target_mask & (1 << req->targ_id))
- ncr_tprint(req, "Select failed\n");
-#endif
- }
- }
- else splx(sps);
-connected:
- if (connected) {
-#ifdef REAL_DMA
- /*
- * If the host is currently connected but a 'real-dma' transfer
- * is in progress, the 'end-of-dma' interrupt restarts main.
- * So quit.
- */
- sps = splbio();
- if (connected && (connected->dr_flag & DRIVER_IN_DMA)) {
- PID("scsi_main3");
- goto main_exit;
- }
- splx(sps);
-#endif /* REAL_DMA */
-
- /*
- * Let the target guide us through the bus-phases
- */
- while (information_transfer() == -1)
- ;
- }
- }
- /* NEVER TO REACH HERE */
- panic("ncr5380-SCSI: not designed to come here");
-
-main_exit:
- /*
- * We enter here with interrupts disabled. We are about to exit main
- * so interrupts should be re-enabled. Because interrupts are edge
- * triggered, we could already have missed the interrupt. Therefore
- * we check the IRQ-line here and re-enter when we really missed a
- * valid interrupt.
- */
- PID("scsi_main4");
- scsi_ienable();
- SET_5380_REG(NCR5380_IDSTAT, SC_HOST_ID);
- if (GET_5380_REG(NCR5380_DMSTAT) & SC_IRQ_SET) {
- if ((itype = check_intr(sc)) != INTR_SPURIOUS) {
- scsi_idisable();
- splx(sps);
-
- if (itype == INTR_RESEL)
- reselect(sc);
-#ifdef REAL_DMA
- else dma_ready();
-#else
- else {
- if (pdma_ready())
- goto connected;
- panic("Got DMA interrupt without DMA");
- }
-#endif
- scsi_clr_ipend();
- goto connected;
- }
- }
- reconsider_dma();
-
- main_running = 0;
- splx(sps);
- PID("scsi_main5");
-}
-
-#ifdef REAL_DMA
-/*
- * The SCSI-DMA interrupt.
- * This interrupt can only be triggered when running in non-polled DMA
- * mode. When DMA is not active, it will be silently ignored, it is usually
- * to late because the EOP interrupt of the controller happens just a tiny
- * bit earlier. It might become usefull when scatter/gather is implemented,
- * because in that case only part of the DATAIN/DATAOUT transfer is taken
- * out of a single buffer.
- */
-static void
-ncr_dma_intr(sc)
-struct ncr_softc *sc;
-{
- SC_REQ *reqp;
- int dma_done;
-
- PID("ncr_dma_intr");
- if ((reqp = connected) && (reqp->dr_flag & DRIVER_IN_DMA)) {
- scsi_idisable();
- if (!(dma_done = dma_ready())) {
- transfer_dma(reqp, reqp->phase, 0);
- return;
- }
- run_main(sc);
- }
-}
-#endif /* REAL_DMA */
-
-/*
- * The SCSI-controller interrupt. This interrupt occurs on reselections and
- * at the end of non-polled DMA-interrupts. It is assumed to be called from
- * the machine-dependent hardware interrupt.
- */
-static void
-ncr_ctrl_intr(sc)
-struct ncr_softc *sc;
-{
- int itype;
- int dma_done;
-
- while (GET_5380_REG(NCR5380_DMSTAT) & SC_IRQ_SET) {
- scsi_idisable();
- if ((itype = check_intr(sc)) != INTR_SPURIOUS) {
- if (itype == INTR_RESEL)
- reselect(sc);
- else {
-#ifdef REAL_DMA
- if (!(dma_done = dma_ready())) {
- transfer_dma(connected, connected->phase, 0);
- return;
- }
-#else
- if (pdma_ready())
- return;
- panic("Got DMA interrupt without DMA");
-#endif
- }
- scsi_clr_ipend();
- }
- run_main(sc);
- return;
- }
- PID("ncr_ctrl_intr1");
-}
-
-/*
- * Initiate a connection path between the host and the target. The function
- * first goes into arbitration for the SCSI-bus. When this succeeds, the target
- * is selected and an 'IDENTIFY' message is send.
- * Returns -1 when the arbitration failed. Otherwise 0 is returned. When
- * the target does not respond (to either selection or 'MESSAGE OUT') the
- * 'done' function is executed.
- * The result code given by the driver can be influenced by setting 'code'
- * to a non-zero value. This is the case when 'select' is called by abort.
- */
-static int
-scsi_select(reqp, code)
-SC_REQ *reqp;
-{
- u_long timeout;
- u_char tmp[1];
- u_char phase;
- u_long cnt;
- int sps;
- u_int8_t atn_flag;
- u_int8_t targ_bit;
- struct ncr_softc *sc;
-
- sc = reqp->xs->sc_link->adapter_softc;
- DBG_SELPRINT ("Starting arbitration\n", 0);
- PID("scsi_select1");
-
- sps = splbio();
-
- /*
- * Prevent a race condition here. If a reslection interrupt occurred
- * between the decision to pick a new request and the call to select,
- * we abort the selection.
- * Interrupts are lowered when the 5380 is setup to arbitrate for the
- * bus.
- */
- if (connected) {
- splx(sps);
- PID("scsi_select2");
- return (-1);
- }
-
- /*
- * Set phase bits to 0, otherwise the 5380 won't drive the bus during
- * selection.
- */
- SET_5380_REG(NCR5380_TCOM, 0);
- SET_5380_REG(NCR5380_ICOM, 0);
-
- /*
- * Arbitrate for the bus.
- */
- SET_5380_REG(NCR5380_DATA, SC_HOST_ID);
- SET_5380_REG(NCR5380_MODE, SC_ARBIT);
-
- splx(sps);
-
- cnt = 10;
- while (!(GET_5380_REG(NCR5380_ICOM) & SC_AIP) && --cnt)
- delay(1);
-
- if (!(GET_5380_REG(NCR5380_ICOM) & SC_AIP)) {
- SET_5380_REG(NCR5380_MODE, IMODE_BASE);
- SET_5380_REG(NCR5380_ICOM, 0);
- DBG_SELPRINT ("Arbitration lost, bus not free\n",0);
- PID("scsi_select3");
- return (-1);
- }
-
- /* The arbitration delay is 2.2 usecs */
- delay(3);
-
- /*
- * Check the result of the arbitration. If we failed, return -1.
- */
- if (GET_5380_REG(NCR5380_ICOM) & SC_LA) {
- SET_5380_REG(NCR5380_MODE, IMODE_BASE);
- SET_5380_REG(NCR5380_ICOM, 0);
- PID("scsi_select4");
- return (-1);
- }
-
- /*
- * The spec requires that we should read the data register to
- * check for higher id's and check the SC_LA again.
- */
- tmp[0] = GET_5380_REG(NCR5380_DATA);
- if (tmp[0] & ~((SC_HOST_ID << 1) - 1)) {
- SET_5380_REG(NCR5380_MODE, IMODE_BASE);
- SET_5380_REG(NCR5380_ICOM, 0);
- DBG_SELPRINT ("Arbitration lost, higher id present\n",0);
- PID("scsi_select5");
- return (-1);
- }
- if (GET_5380_REG(NCR5380_ICOM) & SC_LA) {
- SET_5380_REG(NCR5380_MODE, IMODE_BASE);
- SET_5380_REG(NCR5380_ICOM, 0);
- DBG_SELPRINT ("Arbitration lost, deassert SC_ARBIT\n",0);
- PID("scsi_select6");
- return (-1);
- }
- SET_5380_REG(NCR5380_ICOM, SC_A_SEL | SC_A_BSY);
- if (GET_5380_REG(NCR5380_ICOM) & SC_LA) {
- SET_5380_REG(NCR5380_MODE, IMODE_BASE);
- SET_5380_REG(NCR5380_ICOM, 0);
- DBG_SELPRINT ("Arbitration lost, deassert SC_A_SEL\n", 0);
- PID("scsi_select7");
- return (-1);
- }
- /* Bus settle delay + Bus clear delay = 1.2 usecs */
- delay(2);
- DBG_SELPRINT ("Arbitration complete\n", 0);
-
- /*
- * Now that we won the arbitration, start the selection.
- */
- targ_bit = 1 << reqp->targ_id;
- SET_5380_REG(NCR5380_DATA, SC_HOST_ID | targ_bit);
-
- if (sc->sc_noselatn & targ_bit)
- atn_flag = 0;
- else
- atn_flag = SC_A_ATN;
-
- /*
- * Raise ATN while SEL is true before BSY goes false from arbitration,
- * since this is the only way to guarantee that we'll get a MESSAGE OUT
- * phase immediately after the selection.
- */
- SET_5380_REG(NCR5380_ICOM, SC_A_BSY | SC_A_SEL | atn_flag | SC_ADTB);
- SET_5380_REG(NCR5380_MODE, IMODE_BASE);
-
- /*
- * Turn off reselection interrupts
- */
- SET_5380_REG(NCR5380_IDSTAT, 0);
-
- /*
- * Reset BSY. The delay following it, surpresses a glitch in the
- * 5380 which causes us to see our own BSY signal instead of that of
- * the target.
- */
- SET_5380_REG(NCR5380_ICOM, SC_A_SEL | atn_flag | SC_ADTB);
- delay(1);
-
- /*
- * Wait for the target to react, the specs call for a timeout of
- * 250 ms.
- */
- cnt = 25000;
- while (!(GET_5380_REG(NCR5380_IDSTAT) & SC_S_BSY) && --cnt)
- delay(10);
-
- if (!(GET_5380_REG(NCR5380_IDSTAT) & SC_S_BSY)) {
- /*
- * There is no reaction from the target, start the selection
- * timeout procedure. We release the databus but keep SEL
- * asserted. After that we wait a 'selection abort time' (200
- * usecs) and 2 deskew delays (90 ns) and check BSY again.
- * When BSY is asserted, we assume the selection succeeded,
- * otherwise we release the bus.
- */
- SET_5380_REG(NCR5380_ICOM, SC_A_SEL | atn_flag);
- delay(201);
- if (!(GET_5380_REG(NCR5380_IDSTAT) & SC_S_BSY)) {
- SET_5380_REG(NCR5380_ICOM, 0);
- reqp->xs->error = code ? code : XS_SELTIMEOUT;
- DBG_SELPRINT ("Target %d not responding to sel\n",
- reqp->targ_id);
- finish_req(reqp);
- PID("scsi_select8");
- return (0);
- }
- }
- SET_5380_REG(NCR5380_ICOM, atn_flag);
-
- DBG_SELPRINT ("Target %d responding to select.\n", reqp->targ_id);
-
- /*
- * The SCSI-interrupts are disabled while a request is being handled.
- */
- scsi_idisable();
-
- /*
- * If we did not request ATN, then don't try to send IDENTIFY.
- */
- if (atn_flag == 0) {
- reqp->phase = PH_CMD;
- goto identify_failed;
- }
-
- /*
- * Here we prepare to send an 'IDENTIFY' message.
- * Allow disconnect only when interrups are allowed.
- */
-#if 1
- /* def YES_DISCONNECT_RECONNECT_IS_WORKING */
- tmp[0] = MSG_IDENTIFY(reqp->targ_lun,
- (reqp->dr_flag & DRIVER_NOINT) ? 0 : 1);
-#else
- tmp[0] = MSG_IDENTIFY(reqp->targ_lun,
- (reqp->dr_flag & DRIVER_NOINT) ? 0 : 0);
-#endif
- cnt = 1;
- phase = PH_MSGOUT;
-
- /*
- * Since we followed the SCSI-spec and raised ATN while SEL was true
- * but before BSY was false during the selection, a 'MESSAGE OUT'
- * phase should follow. Unfortunately, this does not happen on
- * all targets (Asante ethernet devices, for example), so we must
- * check the actual mode if the message transfer fails--if the
- * new phase is PH_CMD and has never been successfully selected
- * w/ATN in the past, then we assume that it is an old device
- * that doesn't support select w/ATN.
- */
- if (transfer_pio(&phase, tmp, &cnt, 0) || cnt) {
-
- if ((phase == PH_CMD) && !(sc->sc_selected & targ_bit)) {
- DBG_SELPRINT ("Target %d: not responding to ATN.\n",
- reqp->targ_id);
- sc->sc_noselatn |= targ_bit;
- reqp->phase = PH_CMD;
- goto identify_failed;
- }
-
- DBG_SELPRINT ("Target %d: failed to send identify\n",
- reqp->targ_id);
- /*
- * Try to disconnect from the target. We cannot leave
- * it just hanging here.
- */
- if (!reach_msg_out(sc, sizeof(struct scsi_generic))) {
- u_long len = 1;
- u_char phase = PH_MSGOUT;
- u_char msg = MSG_ABORT;
-
- transfer_pio(&phase, &msg, &len, 0);
- }
- else scsi_reset(sc);
-
- SET_5380_REG(NCR5380_ICOM, 0);
- reqp->xs->error = code ? code : XS_DRIVER_STUFFUP;
- finish_req(reqp);
- PID("scsi_select9");
- return (0);
- }
- reqp->phase = PH_MSGOUT;
-
-identify_failed:
- sc->sc_selected |= targ_bit;
-
-#ifdef notyet /* LWP: Do we need timeouts in the driver? */
- /*
- * Command is connected, start timer ticking.
- */
- ccb_p->xtimeout = ccb_p->timeout + Lbolt;
-#endif
-
- connected = reqp;
- busy |= targ_bit;
- PID("scsi_select10");
- return (0);
-}
-
-/*
- * Return codes:
- * -1: quit main, trigger on interrupt
- * 0: keep on running main.
- */
-static int
-information_transfer()
-{
- SC_REQ *reqp = connected;
- u_char tmp, phase;
- u_long len;
-
- PID("info_transf1");
- /*
- * Clear pending interrupts from 5380-chip.
- */
- scsi_clr_ipend();
-
- /*
- * We only have a valid SCSI-phase when REQ is asserted. Something
- * is deadly wrong when BSY has dropped.
- */
- tmp = GET_5380_REG(NCR5380_IDSTAT);
-
- if (!(tmp & SC_S_BSY)) {
- busy &= ~(1 << reqp->targ_id);
- connected = NULL;
- reqp->xs->error = XS_BUSY;
- finish_req(reqp);
- PID("info_transf2");
- return (0);
- }
-
- if (tmp & SC_S_REQ) {
- phase = (tmp >> 2) & 7;
- if (phase != reqp->phase) {
- reqp->phase = phase;
- DBG_INFPRINT(show_phase, reqp, phase);
- }
- }
- else return (-1);
-
- switch (phase) {
- case PH_DATAOUT:
-#ifdef DBG_NOWRITE
- ncr_tprint(reqp, "NOWRITE set -- write attempt aborted.");
- reqp->msgout = MSG_ABORT;
- SET_5380_REG(NCR5380_ICOM, SC_A_ATN);
- return (-1);
-#endif /* DBG_NOWRITE */
- /*
- * If this is the first write using DMA, fill
- * the bounce buffer.
- */
- if (reqp->xdata_ptr == reqp->xs->data) { /* XXX */
- if (reqp->dr_flag & DRIVER_BOUNCING)
- bcopy(reqp->xdata_ptr, reqp->bounceb, reqp->xdata_len);
- }
-
- case PH_DATAIN:
-#ifdef REAL_DMA
- if (reqp->dr_flag & DRIVER_DMAOK) {
- int poll = REAL_DMA_POLL|(reqp->dr_flag & DRIVER_NOINT);
- transfer_dma(reqp, phase, poll);
- if (!poll)
- return (0);
- }
- else
-#endif
- {
- PID("info_transf3");
- len = reqp->xdata_len;
-#ifdef USE_PDMA
- if (transfer_pdma(&phase, reqp->xdata_ptr, &len) == 0)
- return (0);
-#else
- transfer_pio(&phase, reqp->xdata_ptr, &len, 0);
-#endif
- reqp->xdata_ptr += reqp->xdata_len - len;
- reqp->xdata_len = len;
- }
- return (-1);
- case PH_MSGIN:
- /*
- * We only expect single byte messages here.
- */
- len = 1;
- transfer_pio(&phase, &tmp, &len, 1);
- reqp->message = tmp;
- return (handle_message(reqp, tmp));
- case PH_MSGOUT:
- len = 1;
- transfer_pio(&phase, &reqp->msgout, &len, 0);
- if (reqp->msgout == MSG_ABORT) {
- busy &= ~(1 << reqp->targ_id);
- connected = NULL;
- reqp->xs->error = XS_DRIVER_STUFFUP;
- finish_req(reqp);
- PID("info_transf4");
- return (0);
- }
- reqp->msgout = MSG_NOOP;
- return (-1);
- case PH_CMD :
- len = command_size(reqp->xcmd.opcode);
- transfer_pio(&phase, (u_char *)&reqp->xcmd, &len, 0);
- PID("info_transf5");
- return (-1);
- case PH_STATUS:
- len = 1;
- transfer_pio(&phase, &tmp, &len, 0);
- reqp->status = tmp;
- PID("info_transf6");
- return (-1);
- default :
- ncr_tprint(reqp, "Unknown phase\n");
- }
- PID("info_transf7");
- return (-1);
-}
-
-/*
- * Handle the message 'msg' send to us by the target.
- * Return values:
- * 0 : The current command has completed.
- * -1 : Get on to the next phase.
- */
-static int
-handle_message(reqp, msg)
-SC_REQ *reqp;
-u_int msg;
-{
- SC_REQ *prev, *req;
- int sps;
-
- PID("hmessage1");
- switch (msg) {
- /*
- * Linking lets us reduce the time required to get
- * the next command to the device, skipping the arbitration
- * and selection time. In the current implementation,
- * we merely have to start the next command pointed
- * to by 'next_link'.
- */
- case MSG_LINK_CMD_COMPLETE:
- case MSG_LINK_CMD_COMPLETEF:
- if (reqp->link == NULL) {
- ncr_tprint(reqp, "No link for linked command");
- nack_message(reqp, MSG_ABORT);
- PID("hmessage2");
- return (-1);
- }
- ack_message();
-
- if (!(reqp->dr_flag & DRIVER_AUTOSEN)) {
- reqp->xs->resid = reqp->xdata_len;
- reqp->xs->error = 0;
- }
-
-#ifdef AUTO_SENSE
- if (check_autosense(reqp, 1) == -1)
- return (-1);
-#endif /* AUTO_SENSE */
-
-#ifdef DBG_REQ
- if (dbg_target_mask & (1 << reqp->targ_id))
- show_request(reqp->link, "LINK");
-#endif
- /*
- * Unlink the 'linked' request from the issue_q
- */
- sps = splbio();
- prev = NULL;
- req = issue_q;
- for (; req != NULL; prev = req, req = req->next) {
- if (req == reqp->link)
- break;
- }
- if (req == NULL)
- panic("Inconsistent issue_q");
- if (prev == NULL)
- issue_q = req->next;
- else prev->next = req->next;
- req->next = NULL;
- connected = reqp->link;
- splx(sps);
-
- finish_req(reqp);
- PID("hmessage3");
- return (-1);
- case MSG_ABORT:
- case MSG_CMDCOMPLETE:
- ack_message();
- connected = NULL;
- busy &= ~(1 << reqp->targ_id);
- if (!(reqp->dr_flag & DRIVER_AUTOSEN)) {
- reqp->xs->resid = reqp->xdata_len;
- reqp->xs->error = 0;
- }
-
-#ifdef AUTO_SENSE
- if (check_autosense(reqp, 0) == -1) {
- PID("hmessage4");
- return (0);
- }
-#endif /* AUTO_SENSE */
-
- finish_req(reqp);
- PID("hmessage5");
- return (0);
- case MSG_MESSAGE_REJECT:
- ack_message();
- PID("hmessage6");
- return (-1);
- case MSG_DISCONNECT:
- ack_message();
-#ifdef DBG_REQ
- if (dbg_target_mask & (1 << reqp->targ_id))
- show_request(reqp, "DISCON");
-#endif
- sps = splbio();
- connected = NULL;
- reqp->next = discon_q;
- discon_q = reqp;
- splx(sps);
- PID("hmessage7");
- return (0);
- case MSG_SAVEDATAPOINTER:
- case MSG_RESTOREPOINTERS:
- /*
- * We save pointers implicitely at disconnect.
- * So we can ignore these messages.
- */
- ack_message();
- PID("hmessage8");
- return (-1);
- case MSG_EXTENDED:
- nack_message(reqp, MSG_MESSAGE_REJECT);
- PID("hmessage9");
- return (-1);
- default:
- ncr_tprint(reqp, "Unknown message %x\n", msg);
- return (-1);
- }
- PID("hmessage10");
- return (-1);
-}
-
-/*
- * Handle reselection. If a valid reconnection occurs, connected
- * points at the reconnected command. The command is removed from the
- * disconnected queue.
- */
-static void
-reselect(sc)
-struct ncr_softc *sc;
-{
- u_char phase;
- u_long len;
- u_char msg;
- u_char target_mask;
- int abort = 0;
- SC_REQ *tmp, *prev;
-
- PID("reselect1");
- target_mask = GET_5380_REG(NCR5380_DATA) & ~SC_HOST_ID;
-
- /*
- * At this point, we have detected that our SCSI-id is on the bus,
- * SEL is true and BSY was false for at least one bus settle
- * delay (400 ns.).
- * We must assert BSY ourselves, until the target drops the SEL signal.
- * The SCSI-spec specifies no maximum time for this, so we have to
- * choose something long enough to suit all targets.
- */
- SET_5380_REG(NCR5380_ICOM, SC_A_BSY);
- len = 250000;
- while ((GET_5380_REG(NCR5380_IDSTAT) & SC_S_SEL) && (len > 0)) {
- delay(1);
- len--;
- }
- if (GET_5380_REG(NCR5380_IDSTAT) & SC_S_SEL) {
- /* Damn SEL isn't dropping */
- scsi_reset(sc);
- return;
- }
-
- SET_5380_REG(NCR5380_ICOM, 0);
-
- /*
- * Check if the reselection is still valid. Check twice because
- * of possible line glitches - cheaper than delay(1) and we need
- * only a few nanoseconds.
- */
- if (!(GET_5380_REG(NCR5380_IDSTAT) & SC_S_BSY)) {
- if (!(GET_5380_REG(NCR5380_IDSTAT) & SC_S_BSY)) {
- ncr_aprint(sc, "Stepped into the reselection timeout\n");
- return;
- }
- }
-
- /*
- * Get the expected identify message.
- */
- phase = PH_MSGIN;
- len = 1;
- transfer_pio(&phase, &msg, &len, 0);
- if (len || !MSG_ISIDENTIFY(msg)) {
- ncr_aprint(sc, "Expecting IDENTIFY, got 0x%x\n", msg);
- abort = 1;
- }
- else {
- /*
- * Find the command reconnecting
- */
- for (tmp = discon_q, prev = NULL; tmp; prev = tmp, tmp = tmp->next){
- if (target_mask == (1 << tmp->targ_id)) {
- if (prev)
- prev->next = tmp->next;
- else discon_q = tmp->next;
- tmp->next = NULL;
- break;
- }
- }
- if (tmp == NULL) {
- ncr_aprint(sc, "No disconnected job for targetmask %x\n",
- target_mask);
- abort = 1;
- }
- }
- if (abort) {
- msg = MSG_ABORT;
- len = 1;
- phase = PH_MSGOUT;
-
- SET_5380_REG(NCR5380_ICOM, SC_A_ATN);
- transfer_pio(&phase, &msg, &len, 0);
- }
- else {
- connected = tmp;
-#ifdef DBG_REQ
- if (dbg_target_mask & (1 << tmp->targ_id))
- show_request(tmp, "RECON");
-#endif
- }
- PID("reselect2");
-}
-
-/*
- * Transfer data in a given phase using programmed I/O.
- * Returns -1 when a different phase is entered without transferring the
- * maximum number of bytes, 0 if all bytes transferred or exit is in the same
- * phase.
- */
-static int
-transfer_pio(phase, data, len, dont_drop_ack)
-u_char *phase;
-u_char *data;
-u_long *len;
-int dont_drop_ack;
-{
- u_int cnt = *len;
- u_char ph = *phase;
- u_char tmp, new_icom;
-
- DBG_PIOPRINT ("SCSI: transfer_pio start: phase: %d, len: %d\n", ph,cnt);
- PID("tpio1");
- SET_5380_REG(NCR5380_TCOM, ph);
- do {
- if (!wait_req_true()) {
- DBG_PIOPRINT ("SCSI: transfer_pio: missing REQ\n", 0, 0);
- break;
- }
- if (((GET_5380_REG(NCR5380_IDSTAT) >> 2) & 7) != ph) {
- DBG_PIOPRINT ("SCSI: transfer_pio: phase mismatch\n", 0, 0);
- break;
- }
- if (PH_IN(ph)) {
- *data++ = GET_5380_REG(NCR5380_DATA);
- SET_5380_REG(NCR5380_ICOM, SC_A_ACK);
- if ((cnt == 1) && dont_drop_ack)
- new_icom = SC_A_ACK;
- else new_icom = 0;
- }
- else {
- SET_5380_REG(NCR5380_DATA, *data++);
-
- /*
- * The SCSI-standard suggests that in the 'MESSAGE OUT' phase,
- * the initiator should drop ATN on the last byte of the
- * message phase after REQ has been asserted for the handshake
- * but before the initiator raises ACK.
- */
- if (!( (ph == PH_MSGOUT) && (cnt > 1) )) {
- SET_5380_REG(NCR5380_ICOM, SC_ADTB);
- SET_5380_REG(NCR5380_ICOM, SC_ADTB | SC_A_ACK);
- new_icom = 0;
- }
- else {
- SET_5380_REG(NCR5380_ICOM, SC_ADTB | SC_A_ATN);
- SET_5380_REG(NCR5380_ICOM, SC_ADTB|SC_A_ATN|SC_A_ACK);
- new_icom = SC_A_ATN;
- }
- }
- if (!wait_req_false()) {
- DBG_PIOPRINT ("SCSI: transfer_pio - REQ not dropping\n", 0, 0);
- break;
- }
- SET_5380_REG(NCR5380_ICOM, new_icom);
-
- } while (--cnt);
-
- if ((tmp = GET_5380_REG(NCR5380_IDSTAT)) & SC_S_REQ)
- *phase = (tmp >> 2) & 7;
- else *phase = NR_PHASE;
- *len = cnt;
- DBG_PIOPRINT ("SCSI: transfer_pio done: phase: %d, len: %d\n",
- *phase, cnt);
- PID("tpio2");
- if (!cnt || (*phase == ph))
- return (0);
- return (-1);
-}
-
-#ifdef REAL_DMA
-/*
- * Start a DMA-transfer on the device using the current pointers.
- * If 'poll' is true, the function busy-waits until DMA has completed.
- */
-static void
-transfer_dma(reqp, phase, poll)
-SC_REQ *reqp;
-u_int phase;
-int poll;
-{
- int dma_done;
- u_char mbase = 0;
- int sps;
-
-again:
- PID("tdma1");
-
- /*
- * We should be in phase, otherwise we are not allowed to
- * drive the bus.
- */
- SET_5380_REG(NCR5380_TCOM, phase);
-
- /*
- * Defer interrupts until DMA is fully running.
- */
- sps = splbio();
-
- /*
- * Clear pending interrupts and parity errors.
- */
- scsi_clr_ipend();
-
- if (!poll) {
- /*
- * Enable SCSI interrupts and set IN_DMA flag, set 'mbase'
- * to the interrupts we want enabled.
- */
- scsi_ienable();
- reqp->dr_flag |= DRIVER_IN_DMA;
- mbase = SC_E_EOPI | SC_MON_BSY;
- }
- else scsi_idisable();
- mbase |= IMODE_BASE | SC_M_DMA;
- scsi_dma_setup(reqp, phase, mbase);
-
- splx(sps);
-
- if (poll) {
- /*
- * On polled-dma transfers, we wait here until the
- * 'end-of-dma' condition occurs.
- */
- poll_edma(reqp);
- if (!(dma_done = dma_ready()))
- goto again;
- }
- PID("tdma2");
-}
-
-/*
- * Check results of a DMA data-transfer.
- */
-static int
-dma_ready()
-{
- SC_REQ *reqp = connected;
- int dmstat, is_edma;
- long bytes_left, bytes_done;
-
- is_edma = get_dma_result(reqp, &bytes_left);
- dmstat = GET_5380_REG(NCR5380_DMSTAT);
-
- /*
- * Check if the call is sensible and not caused by any spurious
- * interrupt.
- */
- if (!is_edma && !(dmstat & (SC_END_DMA|SC_BSY_ERR))
- && (dmstat & SC_PHS_MTCH) ) {
- ncr_tprint(reqp, "dma_ready: spurious call"
- "(dm:%x,last_hit: %s)\n",
-#ifdef DBG_PID
- dmstat, last_hit);
-#else
- dmstat, "unknown");
-#endif
- return (0);
- }
-
- /*
- * Clear all (pending) interrupts.
- */
- scsi_clr_ipend();
-
- /*
- * Update various transfer-pointers/lengths
- */
- bytes_done = reqp->dm_cur->dm_count - bytes_left;
-
- if ((reqp->dr_flag & DRIVER_BOUNCING) && (PH_IN(reqp->phase))) {
- /*
- * Copy the bytes read until now from the bounce buffer
- * to the 'real' destination. Flush the data-cache
- * before copying.
- */
- PCIA();
- bcopy(reqp->bouncerp, reqp->xdata_ptr, bytes_done);
- reqp->bouncerp += bytes_done;
- }
-
- reqp->xdata_ptr = &reqp->xdata_ptr[bytes_done]; /* XXX */
- reqp->xdata_len -= bytes_done; /* XXX */
- if ((reqp->dm_cur->dm_count -= bytes_done) == 0)
- reqp->dm_cur++;
- else reqp->dm_cur->dm_addr += bytes_done;
-
- if (PH_IN(reqp->phase) && (dmstat & SC_PAR_ERR)) {
- if (!(ncr5380_no_parchk & (1 << reqp->targ_id)))
- /* XXX: Should be parity error ???? */
- reqp->xs->error = XS_DRIVER_STUFFUP;
- }
-
- /*
- * DMA mode should always be reset even when we will continue with the
- * next chain. It is also essential to clear the MON_BUSY because
- * when LOST_BUSY is unexpectedly set, we will not be able to drive
- * the bus....
- */
- SET_5380_REG(NCR5380_MODE, IMODE_BASE);
-
-
- if ((dmstat & SC_BSY_ERR) || !(dmstat & SC_PHS_MTCH)
- || (reqp->dm_cur > reqp->dm_last) || (reqp->xs->error)) {
-
- /*
- * Tell interrupt functions DMA mode has ended.
- */
- reqp->dr_flag &= ~DRIVER_IN_DMA;
-
- /*
- * Clear mode and icom
- */
- SET_5380_REG(NCR5380_MODE, IMODE_BASE);
- SET_5380_REG(NCR5380_ICOM, 0);
-
- if (dmstat & SC_BSY_ERR) {
- if (!reqp->xs->error)
- reqp->xs->error = XS_BUSY;
- finish_req(reqp);
- PID("dma_ready1");
- return (1);
- }
-
- if (reqp->xs->error != 0) {
-ncr_tprint(reqp, "dma-ready: code = %d\n", reqp->xs->error); /* LWP */
- reqp->msgout = MSG_ABORT;
- SET_5380_REG(NCR5380_ICOM, SC_A_ATN);
- }
- PID("dma_ready2");
- return (1);
- }
- return (0);
-}
-#endif /* REAL_DMA */
-
-static int
-check_autosense(reqp, linked)
-SC_REQ *reqp;
-int linked;
-{
- int sps;
-
- /*
- * If we not executing an auto-sense and the status code
- * is request-sense, we automatically issue a request
- * sense command.
- */
- PID("cautos1");
- if (!(reqp->dr_flag & DRIVER_AUTOSEN)) {
- switch (reqp->status & SCSMASK) {
- case SCSCHKC:
- bcopy(sense_cmd, &reqp->xcmd, sizeof(sense_cmd));
- reqp->xdata_ptr = (u_char *)&reqp->xs->sense;
- reqp->xdata_len = sizeof(reqp->xs->sense);
- reqp->dr_flag |= DRIVER_AUTOSEN;
- reqp->dr_flag &= ~DRIVER_DMAOK;
- if (!linked) {
- sps = splbio();
- reqp->next = issue_q;
- issue_q = reqp;
- splx(sps);
- }
- else reqp->xcmd.bytes[4] |= 1;
-
-#ifdef DBG_REQ
- bzero(reqp->xdata_ptr, reqp->xdata_len);
- if (dbg_target_mask & (1 << reqp->targ_id))
- show_request(reqp, "AUTO-SENSE");
-#endif
- PID("cautos2");
- return (-1);
-
- case SCSBUSY:
- reqp->xs->error = XS_BUSY;
- return (0);
- }
- }
- else {
- /*
- * An auto-sense has finished
- */
- if ((reqp->status & SCSMASK) != SCSGOOD)
- reqp->xs->error = XS_DRIVER_STUFFUP; /* SC_E_AUTOSEN; */
- else reqp->xs->error = XS_SENSE;
- reqp->status = SCSCHKC;
- }
- PID("cautos3");
- return (0);
-}
-
-static int
-reach_msg_out(sc, len)
-struct ncr_softc *sc;
-u_long len;
-{
- u_char phase;
- u_char data;
-
- ncr_aprint(sc, "Trying to reach Message-out phase\n");
- if ((phase = GET_5380_REG(NCR5380_IDSTAT)) & SC_S_REQ)
- phase = (phase >> 2) & 7;
- else return (-1);
- ncr_aprint(sc, "Trying to reach Message-out phase, now: %d\n", phase);
- if (phase == PH_MSGOUT)
- return (0);
-
- SET_5380_REG(NCR5380_TCOM, phase);
-
- do {
- if (!wait_req_true())
- break;
- if (((GET_5380_REG(NCR5380_IDSTAT) >> 2) & 7) != phase)
- break;
- if (PH_IN(phase)) {
- data = GET_5380_REG(NCR5380_DATA);
- SET_5380_REG(NCR5380_ICOM, SC_A_ACK | SC_A_ATN);
- }
- else {
- SET_5380_REG(NCR5380_DATA, 0);
- SET_5380_REG(NCR5380_ICOM, SC_ADTB|SC_A_ACK|SC_A_ATN);
- }
- if (!wait_req_false())
- break;
- SET_5380_REG(NCR5380_ICOM, SC_A_ATN);
- } while (--len);
-
- if ((phase = GET_5380_REG(NCR5380_IDSTAT)) & SC_S_REQ) {
- phase = (phase >> 2) & 7;
- if (phase == PH_MSGOUT) {
- ncr_aprint(sc, "Message-out phase reached.\n");
- return (0);
- }
- }
- return (-1);
-}
-
-static void
-scsi_reset(sc)
-struct ncr_softc *sc;
-{
- SC_REQ *tmp, *next;
- int sps;
-
- ncr_aprint(sc, "Resetting SCSI-bus\n");
-
- PID("scsi_reset1");
- sps = splbio();
- SET_5380_REG(NCR5380_ICOM, SC_A_RST);
- delay(1);
- SET_5380_REG(NCR5380_ICOM, 0);
-
- /*
- * None of the jobs in the discon_q will ever be reconnected,
- * notify this to the higher level code.
- */
- for (tmp = discon_q; tmp ;) {
- next = tmp->next;
- tmp->next = NULL;
- tmp->xs->error = XS_TIMEOUT;
- busy &= ~(1 << tmp->targ_id);
- finish_req(tmp);
- tmp = next;
- }
- discon_q = NULL;
-
- /*
- * The current job will never finish either.
- * The problem is that we can't finish the job because an instance
- * of main is running on it. Our best guess is that the job is currently
- * doing REAL-DMA. In that case 'dma_ready()' should correctly finish
- * the job because it detects BSY-loss.
- */
- if (tmp = connected) {
- if (tmp->dr_flag & DRIVER_IN_DMA) {
- tmp->xs->error = XS_DRIVER_STUFFUP;
-#ifdef REAL_DMA
- dma_ready();
-#endif
- }
- }
- splx(sps);
- PID("scsi_reset2");
-}
-
-/*
- * Check validity of the IRQ set by the 5380. If the interrupt is valid,
- * the appropriate action is carried out (reselection or DMA ready) and
- * INTR_RESEL or INTR_DMA is returned. Otherwise a console notice is written
- * and INTR_SPURIOUS is returned.
- */
-static int
-check_intr(sc)
-struct ncr_softc *sc;
-{
- SC_REQ *reqp;
-
- if ((GET_5380_REG(NCR5380_IDSTAT) & (SC_S_SEL|SC_S_IO))
- ==(SC_S_SEL|SC_S_IO))
- return (INTR_RESEL);
- else {
- if ((reqp = connected) && (reqp->dr_flag & DRIVER_IN_DMA)){
- reqp->dr_flag &= ~DRIVER_IN_DMA;
- return (INTR_DMA);
- }
- }
- scsi_clr_ipend();
- printf("-->");
- scsi_show();
- ncr_aprint(sc, "Spurious interrupt.\n");
- return (INTR_SPURIOUS);
-}
-
-#ifdef REAL_DMA
-/*
- * Check if DMA can be used for this request. This function also builds
- * the dma-chain.
- */
-static int
-scsi_dmaok(reqp)
-SC_REQ *reqp;
-{
- u_long phy_buf;
- u_long phy_len;
- void *req_addr;
- u_long req_len;
- struct dma_chain *dm;
-
- /*
- * Initialize locals and requests' DMA-chain.
- */
- req_len = reqp->xdata_len;
- req_addr = (void*)reqp->xdata_ptr;
- dm = reqp->dm_cur = reqp->dm_last = reqp->dm_chain;
- dm->dm_count = dm->dm_addr = 0;
- reqp->dr_flag &= ~DRIVER_BOUNCING;
-
- /*
- * Do not accept zero length DMA.
- */
- if (req_len == 0)
- return (0);
-
- /*
- * LWP: I think that this restriction is not strictly nessecary.
- */
- if ((req_len & 0x1) || ((u_int)req_addr & 0x3))
- return (0);
-
- /*
- * Build the DMA-chain.
- */
- dm->dm_addr = phy_buf = kvtop(req_addr);
- while (req_len) {
- if (req_len < (phy_len = NBPG - ((u_long)req_addr & PGOFSET)))
- phy_len = req_len;
-
- req_addr += phy_len;
- req_len -= phy_len;
- dm->dm_count += phy_len;
-
- if (req_len) {
- u_long tmp = kvtop(req_addr);
-
- if ((phy_buf + phy_len) != tmp) {
- if (wrong_dma_range(reqp, dm)) {
- if (reqp->dr_flag & DRIVER_BOUNCING)
- goto bounceit;
- return (0);
- }
-
- if (++dm >= &reqp->dm_chain[MAXDMAIO]) {
- ncr_tprint(reqp,"dmaok: DMA chain too long!\n");
- return (0);
- }
- dm->dm_count = 0;
- dm->dm_addr = tmp;
- }
- phy_buf = tmp;
- }
- }
- if (wrong_dma_range(reqp, dm)) {
- if (reqp->dr_flag & DRIVER_BOUNCING)
- goto bounceit;
- return (0);
- }
- reqp->dm_last = dm;
- return (1);
-
-bounceit:
- if ((reqp->bounceb = alloc_bounceb(reqp->xdata_len)) == NULL) {
- /*
- * If we can't get a bounce buffer, forget DMA
- */
- reqp->dr_flag &= ~DRIVER_BOUNCING;
- return(0);
- }
- /*
- * Initialize a single DMA-range containing the bounced request
- */
- dm = reqp->dm_cur = reqp->dm_last = reqp->dm_chain;
- dm->dm_addr = kvtop(reqp->bounceb);
- dm->dm_count = reqp->xdata_len;
- reqp->bouncerp = reqp->bounceb;
-
- return (1);
-}
-#endif /* REAL_DMA */
-
-static void
-run_main(sc)
-struct ncr_softc *sc;
-{
- int sps = splbio();
-
- if (!main_running) {
- /*
- * If shared resources are required, claim them
- * before entering 'scsi_main'. If we can't get them
- * now, assume 'run_main' will be called when the resource
- * becomes available.
- */
- if (!claimed_dma()) {
- splx(sps);
- return;
- }
- main_running = 1;
- splx(sps);
- scsi_main(sc);
- }
- else splx(sps);
-}
-
-/*
- * Prefix message with full target info.
- */
-static void
-ncr_tprint(SC_REQ *reqp, char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- sc_print_addr(reqp->xs->sc_link);
- printf("%r", fmt, ap);
- va_end(ap);
-}
-
-/*
- * Prefix message with adapter info.
- */
-static void
-ncr_aprint(struct ncr_softc *sc, char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- printf("%s : %r", sc->sc_dev.dv_xname, fmt, ap);
- va_end(ap);
-}
-/****************************************************************************
- * Start Debugging Functions *
- ****************************************************************************/
-static void
-show_data_sense(xs)
-struct scsi_xfer *xs;
-{
- u_char *p1, *p2;
- int i;
- int sz;
-
- p1 = (u_char *) xs->cmd;
- p2 = (u_char *)&xs->sense;
- if (*p2 == 0)
- return; /* No(n)sense */
- printf("cmd[%d,%d]: ", xs->cmdlen, sz = command_size(*p1));
- for (i = 0; i < sz; i++)
- printf("%x ", p1[i]);
- printf("\nsense: ");
- for (i = 0; i < sizeof(xs->sense); i++)
- printf("%x ", p2[i]);
- printf("\n");
-}
-
-static void
-show_request(reqp, qtxt)
-SC_REQ *reqp;
-char *qtxt;
-{
- printf("REQ-%s: %d %x[%d] cmd[0]=%x S=%x M=%x R=%x resid=%d %s\n",
- qtxt, reqp->targ_id, reqp->xdata_ptr, reqp->xdata_len,
- reqp->xcmd.opcode, reqp->status, reqp->message,
- reqp->xs->error, reqp->xs->resid, reqp->link ? "L":"");
- if ((reqp->status & SCSMASK) == SCSCHKC)
- show_data_sense(reqp->xs);
-}
-
-static char *sig_names[] = {
- "PAR", "SEL", "I/O", "C/D", "MSG", "REQ", "BSY", "RST",
- "ACK", "ATN", "LBSY", "PMATCH", "IRQ", "EPAR", "DREQ", "EDMA"
-};
-
-static void
-show_signals(dmstat, idstat)
-u_char dmstat, idstat;
-{
- u_short tmp, mask;
- int i, j, need_pipe;
-
- tmp = idstat | ((dmstat & 3) << 8);
- printf("Bus signals (%02x/%02x): ", idstat, dmstat & 3);
- for (mask = 1, j = need_pipe = 0; mask <= tmp; mask <<= 1, j++) {
- if (tmp & mask)
- printf("%s%s", need_pipe++ ? "|" : "", sig_names[j]);
- }
- printf("\nDma status (%02x): ", dmstat);
- for (mask = 4, j = 10, need_pipe = 0; mask <= dmstat; mask <<= 1, j++) {
- if (dmstat & mask)
- printf("%s%s", need_pipe++ ? "|" : "", sig_names[j]);
- }
- printf("\n");
-}
-
-scsi_show()
-{
- SC_REQ *tmp;
- int sps = splhigh();
- u_char idstat, dmstat;
-
-#ifndef DBG_PID
- #define last_hit ""
- #define olast_hit ""
-#endif
-
- for (tmp = issue_q; tmp; tmp = tmp->next)
- show_request(tmp, "ISSUED");
- for (tmp = discon_q; tmp; tmp = tmp->next)
- show_request(tmp, "DISCONNECTED");
- if (connected)
- show_request(connected, "CONNECTED");
- idstat = GET_5380_REG(NCR5380_IDSTAT);
- dmstat = GET_5380_REG(NCR5380_DMSTAT);
- show_signals(dmstat, idstat);
- if (connected)
- printf("phase = %d, ", connected->phase);
- printf("busy:%x, last_hit:%s, olast_hit:%s spl:%04x\n", busy,
- last_hit, olast_hit, sps);
-
- splx(sps);
-}
diff --git a/sys/arch/pc532/dev/ncr5380reg.h b/sys/arch/pc532/dev/ncr5380reg.h
deleted file mode 100644
index 07fc0c00be3..00000000000
--- a/sys/arch/pc532/dev/ncr5380reg.h
+++ /dev/null
@@ -1,258 +0,0 @@
-/* $NetBSD: ncr5380reg.h,v 1.4 1995/11/30 00:58:54 jtc Exp $ */
-
-/*
- * Copyright (c) 1995 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _NCR5380REG_H
-#define _NCR5380REG_H
-/*
- * NCR5380 common interface definitions.
- */
-
-/*
- * Register numbers: (first argument to GET/SET_5380_REG )
- */
-#define NCR5380_DATA 0 /* Data register */
-#define NCR5380_ICOM 1 /* Initiator command register */
-#define NCR5380_MODE 2 /* Mode register */
-#define NCR5380_TCOM 3 /* Target command register */
-#define NCR5380_IDSTAT 4 /* Bus status register */
-#define NCR5380_DMSTAT 5 /* DMA status register */
-#define NCR5380_TRCV 6 /* Target receive register */
-#define NCR5380_IRCV 7 /* Initiator receive register */
-
-/*
- * Definitions for Initiator command register.
- */
-#define SC_A_RST 0x80 /* RW - Assert RST */
-#define SC_TEST 0x40 /* W - Test mode */
-#define SC_AIP 0x40 /* R - Arbitration in progress */
-#define SC_LA 0x20 /* R - Lost arbitration */
-#define SC_A_ACK 0x10 /* RW - Assert ACK */
-#define SC_A_BSY 0x08 /* RW - Assert BSY */
-#define SC_A_SEL 0x04 /* RW - Assert SEL */
-#define SC_A_ATN 0x02 /* RW - Assert ATN */
-#define SC_ADTB 0x01 /* RW - Assert Data To Bus */
-
-/*
- * Definitions for mode register
- */
-#define SC_B_DMA 0x80 /* RW - Block mode DMA (not on TT!) */
-#define SC_T_MODE 0x40 /* RW - Target mode */
-#define SC_E_PAR 0x20 /* RW - Enable parity check */
-#define SC_E_PARI 0x10 /* RW - Enable parity interrupt */
-#define SC_E_EOPI 0x08 /* RW - Enable End Of Process Interrupt */
-#define SC_MON_BSY 0x04 /* RW - Monitor BSY */
-#define SC_M_DMA 0x02 /* RW - Set DMA mode */
-#define SC_ARBIT 0x01 /* RW - Arbitrate */
-
-/*
- * Definitions for tcom register
- */
-#define SC_LBS 0x80 /* RW - Last Byte Send (not on TT!) */
-#define SC_A_REQ 0x08 /* RW - Assert REQ */
-#define SC_A_MSG 0x04 /* RW - Assert MSG */
-#define SC_A_CD 0x02 /* RW - Assert C/D */
-#define SC_A_IO 0x01 /* RW - Assert I/O */
-
-/*
- * Definitions for idstat register
- */
-#define SC_S_RST 0x80 /* R - RST is set */
-#define SC_S_BSY 0x40 /* R - BSY is set */
-#define SC_S_REQ 0x20 /* R - REQ is set */
-#define SC_S_MSG 0x10 /* R - MSG is set */
-#define SC_S_CD 0x08 /* R - C/D is set */
-#define SC_S_IO 0x04 /* R - I/O is set */
-#define SC_S_SEL 0x02 /* R - SEL is set */
-#define SC_S_PAR 0x01 /* R - Parity bit */
-
-/*
- * Definitions for dmastat register
- */
-#define SC_END_DMA 0x80 /* R - End of DMA */
-#define SC_DMA_REQ 0x40 /* R - DMA request */
-#define SC_PAR_ERR 0x20 /* R - Parity error */
-#define SC_IRQ_SET 0x10 /* R - IRQ is active */
-#define SC_PHS_MTCH 0x08 /* R - Phase Match */
-#define SC_BSY_ERR 0x04 /* R - Busy error */
-#define SC_ATN_STAT 0x02 /* R - State of ATN line */
-#define SC_ACK_STAT 0x01 /* R - State of ACK line */
-#define SC_S_SEND 0x00 /* W - Start DMA output */
-
-#define SC_CLINT { /* Clear interrupts */ \
- int i = GET_5380_REG(NCR5380_IRCV); \
- }
-
-
-/*
- * Definition of SCSI-bus phases. The values are determined by signals
- * on the SCSI-bus. DO NOT CHANGE!
- * The values must be used to index the pointers in SCSI-PARMS.
- */
-#define NR_PHASE 8
-#define PH_DATAOUT 0
-#define PH_DATAIN 1
-#define PH_CMD 2
-#define PH_STATUS 3
-#define PH_RES1 4
-#define PH_RES2 5
-#define PH_MSGOUT 6
-#define PH_MSGIN 7
-
-#define PH_OUT(phase) (!(phase & 1)) /* TRUE if output phase */
-#define PH_IN(phase) (phase & 1) /* TRUE if input phase */
-
-/*
- * Id of Host-adapter
- */
-#define SC_HOST_ID 0x80
-
-/*
- * Base setting for 5380 mode register
- */
-#define IMODE_BASE SC_E_PAR
-
-/*
- * SCSI completion status codes, should move to sys/scsi/????
- */
-#define SCSMASK 0x1e /* status code mask */
-#define SCSGOOD 0x00 /* good status */
-#define SCSCHKC 0x02 /* check condition */
-#define SCSBUSY 0x08 /* busy status */
-#define SCSCMET 0x04 /* condition met / good */
-
-/*
- * Return values of check_intr()
- */
-#define INTR_SPURIOUS 0
-#define INTR_RESEL 2
-#define INTR_DMA 3
-
-struct ncr_softc {
- struct device sc_dev;
- struct scsi_link sc_link;
-
- /*
- * Some (pre-SCSI2) devices don't support select with ATN.
- * If the device responds to select with ATN by going into
- * command phase (ignoring ATN), then we flag it in the
- * following bitmask.
- * We also keep track of which devices have been selected
- * before. This allows us to not even try raising ATN if
- * the target doesn't respond to it the first time.
- */
- u_int8_t sc_noselatn;
- u_int8_t sc_selected;
-};
-
-/*
- * Max. number of dma-chains per request
- */
-#define MAXDMAIO (MAXPHYS/NBPG + 1)
-
-/*
- * Some requests are not contiguous in physical memory. We need to break them
- * up into contiguous parts for DMA.
- */
-struct dma_chain {
- u_int dm_count;
- u_long dm_addr;
-};
-
-/*
- * Define our issue, free and disconnect queue's.
- */
-typedef struct req_q {
- struct req_q *next; /* next in free, issue or discon queue */
- struct req_q *link; /* next linked command to execute */
- struct scsi_xfer *xs; /* request from high-level driver */
- u_short dr_flag; /* driver state */
- u_char phase; /* current SCSI phase */
- u_char msgout; /* message to send when requested */
- u_char targ_id; /* target for command */
- u_char targ_lun; /* lun for command */
- u_char status; /* returned status byte */
- u_char message; /* returned message byte */
- u_char *bounceb; /* allocated bounce buffer */
- u_char *bouncerp; /* bounce read-pointer */
- struct dma_chain dm_chain[MAXDMAIO];
- struct dma_chain *dm_cur; /* current dma-request */
- struct dma_chain *dm_last; /* last dma-request */
- long xdata_len; /* length of transfer */
- u_char *xdata_ptr; /* virtual address of transfer */
- struct scsi_generic xcmd; /* command to execute */
-} SC_REQ;
-
-/*
- * Values for dr_flag:
- */
-#define DRIVER_IN_DMA 0x01 /* Non-polled DMA activated */
-#define DRIVER_AUTOSEN 0x02 /* Doing automatic sense */
-#define DRIVER_NOINT 0x04 /* We are booting: no interrupts */
-#define DRIVER_DMAOK 0x08 /* DMA can be used on this request */
-#define DRIVER_BOUNCING 0x10 /* Using the bounce buffer */
-
-/* XXX: Should go to ncr5380var.h */
-static SC_REQ *issue_q = NULL; /* Commands waiting to be issued*/
-static SC_REQ *discon_q = NULL; /* Commands disconnected */
-static SC_REQ *connected = NULL; /* Command currently connected */
-
-/*
- * Function decls:
- */
-static int transfer_pio __P((u_char *, u_char *, u_long *, int));
-static int wait_req_true __P((void));
-static int wait_req_false __P((void));
-static int scsi_select __P((SC_REQ *, int));
-static int handle_message __P((SC_REQ *, u_int));
-static void ack_message __P((void));
-static void nack_message __P((SC_REQ *, u_char));
-static int information_transfer __P((void));
-static void reselect __P((struct ncr_softc *));
-static int dma_ready __P((void));
-static void transfer_dma __P((SC_REQ *, u_int, int));
-static int check_autosense __P((SC_REQ *, int));
-static int reach_msg_out __P((struct ncr_softc *, u_long));
-static int check_intr __P((struct ncr_softc *));
-static void scsi_reset __P((struct ncr_softc *));
-static int scsi_dmaok __P((SC_REQ *));
-static void run_main __P((struct ncr_softc *));
-static void scsi_main __P((struct ncr_softc *));
-static void ncr_ctrl_intr __P((struct ncr_softc *));
-static void ncr_dma_intr __P((struct ncr_softc *));
-static void ncr_tprint __P((SC_REQ *, char *, ...));
-static void ncr_aprint __P((struct ncr_softc *, char *, ...));
-
-static void show_request __P((SC_REQ *, char *));
-static void show_phase __P((SC_REQ *, int));
-static void show_signals __P((u_char, u_char));
-
-#endif /* _NCR5380REG_H */
diff --git a/sys/arch/pc532/dev/ncr_5380.h b/sys/arch/pc532/dev/ncr_5380.h
deleted file mode 100644
index 4d209f5671f..00000000000
--- a/sys/arch/pc532/dev/ncr_5380.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/* $NetBSD: ncr_5380.h,v 1.4 1995/08/25 07:30:37 phil Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1991,1990,1989 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-/*
- * File: scsi_5380.h
- * Author: Alessandro Forin, Carnegie Mellon University
- * Date: 5/91
- *
- * Defines for the NCR 5380 (SCSI chip), aka Am5380
- *
- * Modified for the pc532 by Phil Nelson. 1/94
- */
-
-/*
- * Register map
- */
-
-typedef struct {
- volatile unsigned char sci_data; /* r: Current data */
-#define sci_odata sci_data /* w: Out data */
-
- volatile unsigned char sci_icmd; /* rw: Initiator command */
-
- volatile unsigned char sci_mode; /* rw: Mode */
-
- volatile unsigned char sci_tcmd; /* rw: Target command */
-
- volatile unsigned char sci_bus_csr; /* r: Bus Status */
-#define sci_sel_enb sci_bus_csr /* w: Select enable */
-
- volatile unsigned char sci_csr; /* r: Status */
-#define sci_dma_send sci_csr /* w: Start dma send data */
-
- volatile unsigned char sci_idata; /* r: Input data */
-#define sci_trecv sci_idata /* w: Start dma receive, target */
-
- volatile unsigned char sci_iack; /* r: Interrupt Acknowledge */
-#define sci_irecv sci_iack /* w: Start dma receive, initiator */
-} sci_regmap_t;
-
-
-/*
- * Initiator command register
- */
-
-#define SCI_ICMD_DATA 0x01 /* rw: Assert data bus */
-#define SCI_ICMD_ATN 0x02 /* rw: Assert ATN signal */
-#define SCI_ICMD_SEL 0x04 /* rw: Assert SEL signal */
-#define SCI_ICMD_BSY 0x08 /* rw: Assert BSY signal */
-#define SCI_ICMD_ACK 0x10 /* rw: Assert ACK signal */
-#define SCI_ICMD_LST 0x20 /* r: Lost arbitration */
-#define SCI_ICMD_DIFF SCI_ICMD_LST /* w: Differential cable */
-#define SCI_ICMD_AIP 0x40 /* r: Arbitration in progress */
-#define SCI_ICMD_TEST SCI_ICMD_AIP /* w: Test mode */
-#define SCI_ICMD_RST 0x80 /* rw: Assert RST signal */
-
-
-/*
- * Mode register
- */
-
-#define SCI_MODE_ARB 0x01 /* rw: Start arbitration */
-#define SCI_MODE_DMA 0x02 /* rw: Enable DMA xfers */
-#define SCI_MODE_MONBSY 0x04 /* rw: Monitor BSY signal */
-#define SCI_MODE_DMA_IE 0x08 /* rw: Enable DMA complete interrupt */
-#define SCI_MODE_PERR_IE 0x10 /* rw: Interrupt on parity errors */
-#define SCI_MODE_PAR_CHK 0x20 /* rw: Check parity */
-#define SCI_MODE_TARGET 0x40 /* rw: Target mode (Initiator if 0) */
-#define SCI_MODE_BLOCKDMA 0x80 /* rw: Block-mode DMA handshake (MBZ) */
-
-
-/*
- * Target command register
- */
-
-#define SCI_TCMD_IO 0x01 /* rw: Assert I/O signal */
-#define SCI_TCMD_CD 0x02 /* rw: Assert C/D signal */
-#define SCI_TCMD_MSG 0x04 /* rw: Assert MSG signal */
-#define SCI_TCMD_PHASE_MASK 0x07 /* r: Mask for current bus phase */
-#define SCI_TCMD_REQ 0x08 /* rw: Assert REQ signal */
-#define SCI_TCMD_LAST_SENT 0x80 /* ro: Last byte was xferred
- * (not on 5380/1) */
-
-#define SCI_PHASE(x) SCSI_PHASE(x)
-
-/*
- * Current (SCSI) Bus status
- */
-
-#define SCI_BUS_DBP 0x01 /* r: Data Bus parity */
-#define SCI_BUS_SEL 0x02 /* r: SEL signal */
-#define SCI_BUS_IO 0x04 /* r: I/O signal */
-#define SCI_BUS_CD 0x08 /* r: C/D signal */
-#define SCI_BUS_MSG 0x10 /* r: MSG signal */
-#define SCI_BUS_REQ 0x20 /* r: REQ signal */
-#define SCI_BUS_BSY 0x40 /* r: BSY signal */
-#define SCI_BUS_RST 0x80 /* r: RST signal */
-
-#define SCI_CUR_PHASE(x) SCSI_PHASE((x)>>2)
-
-/*
- * Bus and Status register
- */
-
-#define SCI_CSR_ACK 0x01 /* r: ACK signal */
-#define SCI_CSR_ATN 0x02 /* r: ATN signal */
-#define SCI_CSR_DISC 0x04 /* r: Disconnected (BSY==0) */
-#define SCI_CSR_PHASE_MATCH 0x08 /* r: Bus and SCI_TCMD match */
-#define SCI_CSR_INT 0x10 /* r: Interrupt request */
-#define SCI_CSR_PERR 0x20 /* r: Parity error */
-#define SCI_CSR_DREQ 0x40 /* r: DMA request */
-#define SCI_CSR_DONE 0x80 /* r: DMA count is zero */
-
-
-/* icu scsi chip switching */
-
-#define ICU_ADR 0xfffffe00
-#define ICU_IO (ICU_ADR+20)
-#define ICU_DIR (ICU_ADR+21)
-#define ICU_DATA (ICU_ADR+19)
-#define ICU_SCSI_BIT 0x80
diff --git a/sys/arch/pc532/dev/ncr_defs.h b/sys/arch/pc532/dev/ncr_defs.h
deleted file mode 100644
index 952661c3b54..00000000000
--- a/sys/arch/pc532/dev/ncr_defs.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* $NetBSD: ncr_defs.h,v 1.4 1995/08/25 07:30:39 phil Exp $ */
-
-/*-
- * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo,
- * Michael L. Finch, Bradley A. Grantham, and
- * Lawrence A. Kesteloot
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the Alice Group.
- * 4. The names of the Alice Group or any of its members may not be used
- * to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE ALICE GROUP BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _SCSI_DEFS_H
-#define _SCSI_DEFS_H
-
-#define SCSI_PHASE_DATA_OUT 0x0
-#define SCSI_PHASE_DATA_IN 0x1
-#define SCSI_PHASE_CMD 0x2
-#define SCSI_PHASE_STATUS 0x3
-#define SCSI_PHASE_UNSPEC1 0x4
-#define SCSI_PHASE_UNSPEC2 0x5
-#define SCSI_PHASE_MESSAGE_OUT 0x6
-#define SCSI_PHASE_MESSAGE_IN 0x7
-
-#define SCSI_PHASE(x) ((x)&0x7)
-
-/* These should be fixed up. */
-
-#define SCSI_RET_SUCCESS 0
-#define SCSI_RET_RETRY 1
-#define SCSI_RET_DEVICE_DOWN 2
-#define SCSI_RET_COMMAND_FAIL 3
-
-#endif
diff --git a/sys/arch/pc532/dev/ncrreg.h b/sys/arch/pc532/dev/ncrreg.h
deleted file mode 100644
index f9b0c47dd50..00000000000
--- a/sys/arch/pc532/dev/ncrreg.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $OpenBSD: ncrreg.h,v 1.4 2000/03/03 00:54:54 todd Exp $ */
-/* $NetBSD: ncrreg.h,v 1.3 1995/11/30 00:58:56 jtc Exp $ */
-
-/*
- * Copyright (c) 1994 Matthias Pfaller.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Matthias Pfaller.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifndef _NCRREG_H
-#define _NCRREG_H
-
-#define PDMA_ADDRESS ((volatile u_char *) 0xffe00000)
-#define NCR5380 ((volatile struct ncr5380 *) 0xffd00000)
-#define MIN_PHYS 0x20000
-
-struct ncr5380 {
- volatile u_char regs[8]; /* use only the odd bytes */
-};
-
-#define ncr_data regs[0] /* Data register */
-#define ncr_icom regs[1] /* Initiator command register */
-#define ncr_mode regs[2] /* Mode register */
-#define ncr_tcom regs[3] /* Target command register */
-#define ncr_idstat regs[4] /* Bus status register */
-#define ncr_dmstat regs[5] /* DMA status register */
-#define ncr_trcv regs[6] /* Target receive register */
-#define ncr_ircv regs[7] /* Initiator receive register */
-
-#define GET_5380_REG(rnum) NCR5380->regs[rnum]
-#define SET_5380_REG(rnum,val) (NCR5380->regs[rnum] = val)
-#define scsi_ienable() intr_enable(IR_SCSI1)
-#define scsi_idisable() intr_disable(IR_SCSI1)
-#define scsi_clr_ipend() do { \
- int i = GET_5380_REG(NCR5380_IRCV); \
- } while (0)
-
-#endif /* _NCRREG_H */
diff --git a/sys/arch/pc532/dev/oldncr.c b/sys/arch/pc532/dev/oldncr.c
deleted file mode 100644
index 24b95d104a4..00000000000
--- a/sys/arch/pc532/dev/oldncr.c
+++ /dev/null
@@ -1,953 +0,0 @@
-/* $NetBSD: oldncr.c,v 1.2 1995/08/27 04:07:54 phil Exp $ */
-
-/*
- * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo,
- * Michael L. Finch, Bradley A. Grantham, and
- * Lawrence A. Kesteloot
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the Alice Group.
- * 4. The names of the Alice Group or any of its members may not be used
- * to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE ALICE GROUP BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* Modified for use with the pc532 by Phil Nelson, June 94. */
-
-#define PSEUDO_DMA 1
-
-static int ncr_debug=1;
-
-#include <sys/types.h>
-#include <sys/malloc.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/errno.h>
-#include <sys/buf.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/device.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsi_debug.h>
-#include <scsi/scsiconf.h>
-
-#include <machine/icu.h>
-
-#include "ncr_defs.h"
-#include "ncr_5380.h"
-
-#define NCR5380 DP8490
-
-#define SCI_PHASE_DISC 0 /* sort of ... */
-#define SCI_CLR_INTR(regs) {register int temp = regs->sci_iack;}
-#define SCI_ACK(ptr,phase) (ptr)->sci_tcmd = (phase)
-#define SCSI_TIMEOUT_VAL 10000000
-#define WAIT_FOR_NOT_REQ(ptr) { \
- int scsi_timeout = SCSI_TIMEOUT_VAL; \
- while ( ((ptr)->sci_bus_csr & SCI_BUS_REQ) && \
- ((ptr)->sci_bus_csr & SCI_BUS_REQ) && \
- ((ptr)->sci_bus_csr & SCI_BUS_REQ) && \
- (--scsi_timeout) ); \
- if (!scsi_timeout) { \
- printf("scsi timeout--WAIT_FOR_NOT_REQ---ncr.c, \
- line %d.\n", __LINE__); \
- goto scsi_timeout_error; \
- } \
- }
-
-#define WAIT_FOR_REQ(ptr) { \
- int scsi_timeout = SCSI_TIMEOUT_VAL; \
- while ( (((ptr)->sci_bus_csr & SCI_BUS_REQ) == 0) && \
- (((ptr)->sci_bus_csr & SCI_BUS_REQ) == 0) && \
- (((ptr)->sci_bus_csr & SCI_BUS_REQ) == 0) && \
- (--scsi_timeout) ); \
- if (!scsi_timeout) { \
- printf("scsi timeout--WAIT_FOR_REQ---ncr.c, \
- line %d.\n", __LINE__); \
- goto scsi_timeout_error; \
- } \
- }
-#define WAIT_FOR_BSY(ptr) { \
- int scsi_timeout = SCSI_TIMEOUT_VAL; \
- while ((((ptr)->sci_bus_csr & SCI_BUS_BSY) == 0) && \
- (((ptr)->sci_bus_csr & SCI_BUS_BSY) == 0) && \
- (((ptr)->sci_bus_csr & SCI_BUS_BSY) == 0) && \
- (--scsi_timeout) ); \
- if (!scsi_timeout) { \
- printf("scsi timeout--WAIT_FOR_BSY---ncr.c, \
- line %d.\n", __LINE__); \
- goto scsi_timeout_error; \
- } \
- }
-
-#ifdef DDB
-int Debugger();
-#else
-#define Debugger() panic("Should call Debugger here (mac/dev/ncr.c).")
-#endif
-
-typedef unsigned long int physaddr;
-typedef sci_regmap_t sci_padded_regmap_t;
-
-#define NNCR5380 1
-
-struct ncr5380_softc {
- struct device sc_dev;
- struct scsi_link sc_link;
-};
-
-/* From the mapping of the pc532 address space. See pc532/machdep.c */
-static volatile sci_padded_regmap_t *ncr = (sci_regmap_t *) 0xffd00000;
-static volatile long *sci_4byte_addr= (long *) 0xffe00000;
-static volatile u_char *sci_1byte_addr=(u_char *) 0xffe00000;
-
-static void ncr5380_minphys(struct buf *bp);
-static int ncr5380_scsi_cmd(struct scsi_xfer *xs);
-
-static int ncr5380_show_scsi_cmd(struct scsi_xfer *xs);
-static int ncr5380_reset_target(int adapter, int target);
-static int ncr5380_poll(int adapter, int timeout);
-static int ncr5380_send_cmd(struct scsi_xfer *xs);
-
-extern void ncr5380_intr(int adapter);
-extern void spinwait(int);
-
-static int scsi_gen(int adapter, int id, int lun,
- struct scsi_generic *cmd, int cmdlen,
- void *databuf, int datalen);
-static int scsi_group0(int adapter, int id, int lun,
- int opcode, int addr, int len,
- int flags, caddr_t databuf, int datalen);
-
-static char scsi_name[] = "ncr";
-
-struct scsi_adapter ncr5380_switch = {
- ncr5380_scsi_cmd, /* scsi_cmd() */
- ncr5380_minphys, /* scsi_minphys() */
- 0, /* open_target_lu() */
- 0 /* close_target_lu() */
-};
-
-/* This is copied from julian's bt driver */
-/* "so we have a default dev struct for our link struct." */
-struct scsi_device ncr_dev = {
- NULL, /* Use default error handler. */
- NULL, /* have a queue, served by this (?) */
- NULL, /* have no async handler. */
- NULL /* Use default "done" routine. */
-};
-
-extern int matchbyname();
-static int ncrprobe();
-static void ncrattach();
-
-struct cfdriver oldncrcd =
- { NULL, "ncr", ncrprobe, ncrattach,
- DV_DULL, sizeof(struct ncr5380_softc), NULL, 0 };
-
-static int
-ncrprobe(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
-/* int unit = cf->cf_unit; */
- struct ncr5380_softc *ncr5380 = (void *)self;
-
-#if 0
-DELETE THIS ????
- if (unit >= NNCR5380) {
- printf("ncr5380attach: unit %d more than %d configured.\n",
- unit+1, NNCR5380);
- return 0;
- }
- ncr5380 = malloc(sizeof(struct ncr5380_data), M_TEMP, M_NOWAIT);
- if (!ncr5380) {
- printf("ncr5380attach: Can't malloc.\n");
- return 0;
- }
-
- bzero(ncr5380, sizeof(*ncr5380));
- ncr5380data[unit] = ncr5380;
-#endif
-
- /* If we call this, we need to add SPL_DP to the bio mask! */
- /* PL_bio |= SPL_DP; Not yet ... no interrupts */
-
- return 1;
-}
-
-static void
-ncrattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- register volatile sci_padded_regmap_t *regs = ncr;
- struct ncr5380_softc *ncr5380 = (void *)self;
- int r;
-
- ncr5380->sc_link.adapter_softc = ncr5380;
-/* ncr5380->sc_link.scsibus = 0; */
- ncr5380->sc_link.adapter_target = 7;
- ncr5380->sc_link.adapter = &ncr5380_switch;
- ncr5380->sc_link.device = &ncr_dev;
- ncr5380->sc_link.openings = 1;
-
- printf("\n");
-
- config_found(self, &(ncr5380->sc_link), NULL);
-}
-
-#define MIN_PHYS 65536 /*BARF!!!!*/
-static void
-ncr5380_minphys(struct buf *bp)
-{
- if (bp->b_bcount > MIN_PHYS) {
- printf("Uh-oh... ncr5380_minphys setting bp->b_bcount = %x.\n", MIN_PHYS);
- bp->b_bcount = MIN_PHYS;
- }
- minphys(bp);
-}
-#undef MIN_PHYS
-
-static int
-ncr5380_scsi_cmd(struct scsi_xfer *xs)
-{
- int flags, s, r;
-
- flags = xs->flags;
- if (xs->bp) flags |= (SCSI_NOSLEEP);
- if ( flags & ITSDONE ) {
- printf("Already done?");
- xs->flags &= ~ITSDONE;
- }
- if ( ! ( flags & INUSE ) ) {
- printf("Not in use?");
- xs->flags |= INUSE;
- }
-
- if ( flags & SCSI_RESET ) {
- printf("flags & SCSIRESET.\n");
- s = splbio();
- ncr5380_reset_target(xs->sc_link->scsibus,
- xs->sc_link->target);
- splx(s);
- return(COMPLETE);
- }
-
- xs->resid = 0; /* Default value? */
- r = ncr5380_send_cmd(xs);
- xs->flags |= ITSDONE;
- scsi_done(xs);
- switch(r) {
- case COMPLETE: case SUCCESSFULLY_QUEUED:
- r = SUCCESSFULLY_QUEUED;
- if (xs->flags&SCSI_POLL)
- r = COMPLETE;
- break;
- default:
- break;
- }
- return r;
-}
-
-static int
-ncr5380_show_scsi_cmd(struct scsi_xfer *xs)
-{
- u_char *b = (u_char *) xs->cmd;
- int i = 0;
-
- if ( ! ( xs->flags & SCSI_RESET ) ) {
- printf("ncr5380(%d:%d:%d)-",
- xs->sc_link->scsibus, xs->sc_link->target, xs->sc_link->lun);
- while (i < xs->cmdlen) {
- if (i) printf(",");
- printf("%x",b[i++]);
- }
- printf("-\n");
- } else {
- printf("ncr5380(%d:%d:%d)-RESET-\n",
- xs->sc_link->scsibus, xs->sc_link->target, xs->sc_link->lun);
- }
-}
-
-/*
- * Actual chip control.
- */
-
-void
-delay(int timeo)
-{
- int len;
- for (len=0;len<timeo*2;len++);
-}
-
-#if 0
-extern void
-spinwait(int ms)
-{
- while (ms--)
- delay(500);
-}
-#endif
-
-extern void
-ncr5380_intr(int adapter)
-{
- register volatile sci_padded_regmap_t *regs = ncr;
-
- SCI_CLR_INTR(regs);
- regs->sci_mode = 0x00;
-}
-
-extern int
-scsi_irq_intr(void)
-{
- register volatile sci_padded_regmap_t *regs = ncr;
-
-/* if (regs->sci_csr != SCI_CSR_PHASE_MATCH)
- printf("scsi_irq_intr called (not just phase match -- "
- "csr = 0x%x, bus_csr = 0x%x).\n",
- regs->sci_csr, regs->sci_bus_csr);
- ncr5380_intr(0); */
- return 1;
-}
-
-extern int
-scsi_drq_intr(void)
-{
-/* printf("scsi_drq_intr called.\n"); */
-/* ncr5380_intr(0); */
- return 1;
-}
-
-static int
-ncr5380_reset_target(int adapter, int target)
-{
- register volatile sci_padded_regmap_t *regs = ncr;
- int dummy;
-
- scsi_select_ctlr (DP8490);
- regs->sci_icmd = SCI_ICMD_TEST;
- regs->sci_icmd = SCI_ICMD_TEST | SCI_ICMD_RST;
- delay(2500);
- regs->sci_icmd = 0;
-
- regs->sci_mode = 0;
- regs->sci_tcmd = SCI_PHASE_DISC;
- regs->sci_sel_enb = 0;
-
- SCI_CLR_INTR(regs);
- SCI_CLR_INTR(regs);
-}
-
-
-static int
-ncr5380_send_cmd(struct scsi_xfer *xs)
-{
- int s, i, sense;
-
-#if 0
- ncr5380_show_scsi_cmd(xs);
-#endif
- s = splbio();
- sense = scsi_gen( xs->sc_link->scsibus, xs->sc_link->target,
- xs->sc_link->lun, xs->cmd, xs->cmdlen,
- xs->data, xs->datalen );
- splx(s);
- switch (sense) {
- case 0x00:
- xs->error = XS_NOERROR;
- return (COMPLETE);
- case 0x02: /* Check condition */
- for (i = 10; i; i--) {
- s = splbio();
- sense = scsi_group0(xs->sc_link->scsibus,
- xs->sc_link->target,
- xs->sc_link->lun,
- 0x3, 0x0,
- sizeof(struct scsi_sense_data),
- 0, (caddr_t) &(xs->sense),
- sizeof(struct scsi_sense_data));
- splx(s);
- if (sense == 0) break;
- if (sense == 8
- && (xs->flags & SCSI_NOSLEEP) == 0)
- tsleep((caddr_t)&lbolt, PRIBIO, "ncrbusy", 0);
- }
- if (!i)
- printf("ncr(%d:%d): Sense failed (dev busy)\n",
- xs->sc_link->target, xs->sc_link->lun);
- xs->error = XS_SENSE;
- return COMPLETE;
- case 0x08: /* Busy */
- xs->error = XS_BUSY;
- return COMPLETE;
- default:
- xs->error = XS_DRIVER_STUFFUP;
- return COMPLETE;
- }
-}
-
-static int
-select_target(register volatile sci_padded_regmap_t *regs,
- u_char myid, u_char tid, int with_atn)
-{
- register u_char bid, icmd;
- int ret = SCSI_RET_RETRY;
-
- if ((regs->sci_bus_csr & (SCI_BUS_BSY|SCI_BUS_SEL)) &&
- (regs->sci_bus_csr & (SCI_BUS_BSY|SCI_BUS_SEL)) &&
- (regs->sci_bus_csr & (SCI_BUS_BSY|SCI_BUS_SEL)))
- return ret;
-
- /* for our purposes.. */
- myid = 1 << myid;
- tid = 1 << tid;
-
- regs->sci_sel_enb = 0; /*myid; we don't want any interrupts. */
- regs->sci_tcmd = 0; /* get into a harmless state */
- regs->sci_mode = 0; /* get into a harmless state */
-
- regs->sci_odata = myid;
- regs->sci_mode = SCI_MODE_ARB;
-/* regs->sci_mode |= SCI_MODE_ARB; */
- /* AIP might not set if BSY went true after we checked */
- for (bid = 0; bid < 20; bid++) /* 20usec circa */
- if (regs->sci_icmd & SCI_ICMD_AIP)
- break;
- if ((regs->sci_icmd & SCI_ICMD_AIP) == 0) {
- goto lost;
- }
-
- spinwait(2); /* 2.2us arb delay */
-
- if (regs->sci_icmd & SCI_ICMD_LST) {
- goto lost;
- }
-
- regs->sci_mode &= ~SCI_MODE_PAR_CHK;
- bid = regs->sci_data;
-
- if ((bid & ~myid) > myid) {
- goto lost;
- }
- if (regs->sci_icmd & SCI_ICMD_LST) {
- goto lost;
- }
-
- /* Won arbitration, enter selection phase now */
- icmd = regs->sci_icmd & ~(SCI_ICMD_DIFF|SCI_ICMD_TEST);
- icmd |= (with_atn ? (SCI_ICMD_SEL|SCI_ICMD_ATN) : SCI_ICMD_SEL);
- icmd |= SCI_ICMD_BSY;
- regs->sci_icmd = icmd;
-
- if (regs->sci_icmd & SCI_ICMD_LST) {
- goto nosel;
- }
-
- /* XXX a target that violates specs might still drive the bus XXX */
- /* XXX should put our id out, and after the delay check nothi XXX */
- /* XXX ng else is out there. XXX */
-
- delay(0);
-
- regs->sci_tcmd = 0;
- regs->sci_odata = myid | tid;
- regs->sci_sel_enb = 0;
-
-/* regs->sci_mode &= ~SCI_MODE_ARB; 2 deskew delays, too */
- regs->sci_mode = 0; /* 2 deskew delays, too */
-
- icmd |= SCI_ICMD_DATA;
- icmd &= ~(SCI_ICMD_BSY);
-
- regs->sci_icmd = icmd;
-
- /* bus settle delay, 400ns */
- delay(2); /* too much (was 2) ? */
-
-/* regs->sci_mode |= SCI_MODE_PAR_CHK; */
-
- {
- register int timeo = 2500;/* 250 msecs in 100 usecs chunks */
- while ((regs->sci_bus_csr & SCI_BUS_BSY) == 0) {
- if (--timeo > 0) {
- delay(100);
- } else {
- goto nodev;
- }
- }
- }
-
- icmd &= ~(SCI_ICMD_DATA|SCI_ICMD_SEL);
- regs->sci_icmd = icmd;
-/* regs->sci_sel_enb = myid;*/ /* looks like we should NOT have it */
- return SCSI_RET_SUCCESS;
-nodev:
- ret = SCSI_RET_DEVICE_DOWN;
- regs->sci_sel_enb = myid;
-nosel:
- icmd &= ~(SCI_ICMD_DATA|SCI_ICMD_SEL|SCI_ICMD_ATN);
- regs->sci_icmd = icmd;
-lost:
- regs->sci_mode = 0;
-
- return ret;
-}
-
-sci_data_out(regs, phase, count, data)
- register sci_padded_regmap_t *regs;
- unsigned char *data;
-{
- register unsigned char icmd;
- register int cnt=0;
-
- /* ..checks.. */
-
- icmd = regs->sci_icmd & ~(SCI_ICMD_DIFF|SCI_ICMD_TEST);
-loop:
- if (SCI_CUR_PHASE(regs->sci_bus_csr) != phase)
- return cnt;
-
- WAIT_FOR_REQ(regs);
- icmd |= SCI_ICMD_DATA;
- regs->sci_icmd = icmd;
- regs->sci_odata = *data++;
- icmd |= SCI_ICMD_ACK;
- regs->sci_icmd = icmd;
-
- icmd &= ~(SCI_ICMD_DATA|SCI_ICMD_ACK);
- WAIT_FOR_NOT_REQ(regs);
- regs->sci_icmd = icmd;
- ++cnt;
- if (--count > 0)
- goto loop;
-scsi_timeout_error:
- return cnt;
-}
-
-sci_data_in(regs, phase, count, data)
- register sci_padded_regmap_t *regs;
- unsigned char *data;
-{
- register unsigned char icmd;
- register int cnt=0;
-
- /* ..checks.. */
-
- icmd = regs->sci_icmd & ~(SCI_ICMD_DIFF|SCI_ICMD_TEST);
-
-loop:
- if (SCI_CUR_PHASE(regs->sci_bus_csr) != phase)
- return cnt;
-
- WAIT_FOR_REQ(regs);
- *data++ = regs->sci_data;
- icmd |= SCI_ICMD_ACK;
- regs->sci_icmd = icmd;
-
- icmd &= ~SCI_ICMD_ACK;
- WAIT_FOR_NOT_REQ(regs);
- regs->sci_icmd = icmd;
- ++cnt;
- if (--count > 0)
- goto loop;
-
-scsi_timeout_error:
- return cnt;
-}
-
-static int
-command_transfer(register volatile sci_padded_regmap_t *regs,
- int maxlen, u_char *data, u_char *status, u_char *msg)
-{
- int xfer=0, phase;
-
-/* printf("command_transfer called for 0x%x.\n", *data); */
-
- regs->sci_icmd = 0;
-
- while (1) {
-
- WAIT_FOR_REQ(regs);
-
- phase = SCI_CUR_PHASE(regs->sci_bus_csr);
-
- switch (phase) {
- case SCSI_PHASE_CMD:
- SCI_ACK(regs,SCSI_PHASE_CMD);
- xfer += sci_data_out(regs, SCSI_PHASE_CMD,
- maxlen, data);
- return xfer;
- case SCSI_PHASE_DATA_IN:
- printf("Data in phase in command_transfer?\n");
- return 0;
- case SCSI_PHASE_DATA_OUT:
- printf("Data out phase in command_transfer?\n");
- return 0;
- case SCSI_PHASE_STATUS:
- SCI_ACK(regs,SCSI_PHASE_STATUS);
- printf("status in command_transfer.\n");
- sci_data_in(regs, SCSI_PHASE_STATUS,
- 1, status);
- break;
- case SCSI_PHASE_MESSAGE_IN:
- SCI_ACK(regs,SCSI_PHASE_MESSAGE_IN);
- printf("msgin in command_transfer.\n");
- sci_data_in(regs, SCSI_PHASE_MESSAGE_IN,
- 1, msg);
- break;
- case SCSI_PHASE_MESSAGE_OUT:
- SCI_ACK(regs,SCSI_PHASE_MESSAGE_OUT);
- sci_data_out(regs, SCSI_PHASE_MESSAGE_OUT,
- 1, msg);
- break;
- default:
- printf("Unexpected phase 0x%x in "
- "command_transfer().\n", phase);
-scsi_timeout_error:
- return xfer;
- break;
- }
- }
-}
-
-static int
-data_transfer(register volatile sci_padded_regmap_t *regs,
- int maxlen, u_char *data, u_char *status, u_char *msg)
-{
- int retlen = 0, xfer, phase;
-
- regs->sci_icmd = 0;
-
- *status = 0;
-
- while (1) {
-
- WAIT_FOR_REQ(regs);
-
- phase = SCI_CUR_PHASE(regs->sci_bus_csr);
-
- switch (phase) {
- case SCSI_PHASE_CMD:
- printf("Command phase in data_transfer().\n");
- return retlen;
- case SCSI_PHASE_DATA_IN:
- SCI_ACK(regs,SCSI_PHASE_DATA_IN);
-#if PSEUDO_DMA
- xfer = sci_pdma_in(regs, SCSI_PHASE_DATA_IN,
- maxlen, data);
-#else
- xfer = sci_data_in(regs, SCSI_PHASE_DATA_IN,
- maxlen, data);
-#endif
- retlen += xfer;
- maxlen -= xfer;
- break;
- case SCSI_PHASE_DATA_OUT:
- SCI_ACK(regs,SCSI_PHASE_DATA_OUT);
-#if PSEUDO_DMA
- xfer = sci_pdma_out(regs, SCSI_PHASE_DATA_OUT,
- maxlen, data);
-#else
- xfer = sci_data_out(regs, SCSI_PHASE_DATA_OUT,
- maxlen, data);
-#endif
- retlen += xfer;
- maxlen -= xfer;
- break;
- case SCSI_PHASE_STATUS:
- SCI_ACK(regs,SCSI_PHASE_STATUS);
- sci_data_in(regs, SCSI_PHASE_STATUS,
- 1, status);
- break;
- case SCSI_PHASE_MESSAGE_IN:
- SCI_ACK(regs,SCSI_PHASE_MESSAGE_IN);
- sci_data_in(regs, SCSI_PHASE_MESSAGE_IN,
- 1, msg);
- if (*msg == 0) {
- return retlen;
- } else {
- printf( "message 0x%x in "
- "data_transfer.\n", *msg);
- }
- break;
- case SCSI_PHASE_MESSAGE_OUT:
- SCI_ACK(regs,SCSI_PHASE_MESSAGE_OUT);
- sci_data_out(regs, SCSI_PHASE_MESSAGE_OUT,
- 1, msg);
- break;
- default:
- printf( "Unexpected phase 0x%x in "
- "data_transfer().\n", phase);
-scsi_timeout_error:
- return retlen;
- break;
- }
- }
-}
-
-static int
-scsi_request(register volatile sci_padded_regmap_t *regs,
- int target, int lun, u_char *cmd, int cmdlen,
- char *databuf, int datalen, int *sent, int *ret)
-{
-/* Returns 0 on success, -1 on internal error, or the status byte */
- int cmd_bytes_sent, r;
- u_char stat, msg, c;
-
- *sent = 0;
- scsi_select_ctlr (DP8490);
-
- if ( ( r = select_target(regs, 7, target, 1) ) != SCSI_RET_SUCCESS) {
- *ret = r;
- SCI_CLR_INTR(regs);
- switch (r) {
- case SCSI_RET_RETRY:
- return 0x08;
- default:
- printf("select_target(target %d, lun %d) failed(%d).\n",
- target, lun, r);
- case SCSI_RET_DEVICE_DOWN:
- return -1;
- }
- }
-
- c = 0x80 | lun;
-
- if ((cmd_bytes_sent = command_transfer(regs, cmdlen,
- (u_char *) cmd, &stat, &c))
- != cmdlen) {
- SCI_CLR_INTR(regs);
- *ret = SCSI_RET_COMMAND_FAIL;
- printf("Data underrun sending CCB (%d bytes of %d, sent).\n",
- cmd_bytes_sent, cmdlen);
- return -1;
- }
-
- *sent=data_transfer(regs, datalen, (u_char *)databuf,
- &stat, &msg);
-
- *ret = 0;
-
- return stat;
-}
-
-static int
-scsi_gen(int adapter, int id, int lun, struct scsi_generic *cmd,
- int cmdlen, void *databuf, int datalen)
-{
- register volatile sci_padded_regmap_t *regs = ncr;
- int i,j,sent,ret;
-
- cmd->bytes[0] |= ((u_char) lun << 5);
-
- i = scsi_request(regs, id, lun, (u_char *) cmd, cmdlen,
- databuf, datalen, &sent, &ret);
-
- return i;
-}
-
-static int
-scsi_group0(int adapter, int id, int lun, int opcode, int addr, int len,
- int flags, caddr_t databuf, int datalen)
-{
- register volatile sci_padded_regmap_t *regs = ncr;
- unsigned char cmd[6];
- int i,j,sent,ret;
-
- cmd[0] = opcode; /* Operation code */
- cmd[1] = (lun << 5) | ((addr >> 16) & 0x1F); /* Lun & MSB of addr */
- cmd[2] = (addr >> 8) & 0xFF; /* addr */
- cmd[3] = addr & 0xFF; /* LSB of addr */
- cmd[4] = len; /* Allocation length */
- cmd[5] = flags; /* Link/Flag */
-
- i = scsi_request(regs, id, lun, cmd, 6, databuf, datalen, &sent, &ret);
-
- return i;
-}
-
-/* pseudo-dma action */
-
-#if PSEUDO_DMA
-
-#define TIMEOUT 1000000
-#define READY(poll) \
- i = TIMEOUT; \
- while ((regs->sci_csr & (SCI_CSR_DREQ|SCI_CSR_PHASE_MATCH)) \
- !=(SCI_CSR_DREQ|SCI_CSR_PHASE_MATCH)) \
- if ( !(regs->sci_csr & SCI_CSR_PHASE_MATCH) \
- || !(regs->sci_bus_csr & SCI_BUS_BSY) \
- || (i-- < 0) ) { \
- printf("ncr.c: timeout counter = %d, len = %d count=%d (count-len %d).\n", \
- i, len,count,count-len); \
- printf("ncr_debug = %d, 1=out, 2=in",ncr_debug); \
- /*dump_regs();*/ \
- if (poll && !(regs->sci_csr & SCI_CSR_PHASE_MATCH)) { \
- regs->sci_icmd &= ~SCI_ICMD_DATA; \
- len--; \
- } else { \
- regs->sci_mode &= ~SCI_MODE_DMA; \
- } \
- return count-len; \
- }
-
-#define W1 *byte_data = *data++
-#define W4 *long_data = *((long*)data)++
-
-sci_pdma_out(regs, phase, count, data)
- register volatile sci_padded_regmap_t *regs;
- int phase;
- int count;
- u_char *data;
-{
- register volatile long *long_data = sci_4byte_addr;
- register volatile u_char *byte_data = sci_1byte_addr;
- register int len = count, i;
-
-ncr_debug=1;
-
- if (count < 128)
- return sci_data_out(regs, phase, count, data);
-
- WAIT_FOR_BSY(regs);
- regs->sci_mode |= SCI_MODE_DMA;
- regs->sci_icmd |= SCI_ICMD_DATA;
- regs->sci_dma_send = 0;
-
- while ( len >= 64 ) {
- READY(1); W1; READY(1); W1; READY(1); W1; READY(1); W1;
- READY(1);
- W4;W4;W4; W4;W4;W4;W4; W4;W4;W4;W4; W4;W4;W4;W4;
- len -= 64;
- }
- while (len) {
- READY(1);
- W1;
- len--;
- }
- i = TIMEOUT;
- while ( ((regs->sci_csr & (SCI_CSR_DREQ|SCI_CSR_PHASE_MATCH))
- == SCI_CSR_PHASE_MATCH) && --i);
- if (!i)
- printf("ncr.c:%d: timeout waiting for SCI_CSR_DREQ.\n", __LINE__);
- *byte_data = 0;
-scsi_timeout_error:
- regs->sci_mode &= ~SCI_MODE_DMA;
- return count-len;
-}
-
-#undef W1
-#undef W4
-
-#define R4 *((long *)data)++ = *long_data
-#define R1 *data++ = *byte_data
-
-sci_pdma_in(regs, phase, count, data)
- register volatile sci_padded_regmap_t *regs;
- int phase;
- int count;
- u_char *data;
-{
- register volatile long *long_data = sci_4byte_addr;
- register volatile u_char *byte_data = sci_1byte_addr;
- register int len = count, i;
-
-ncr_debug=2;
- if (count < 128)
- return sci_data_in(regs, phase, count, data);
-
-/* printf("Called sci_pdma_in(0x%x, 0x%x, %d, 0x%x.\n", regs, phase, count, data); */
-
- WAIT_FOR_BSY(regs);
- regs->sci_mode |= SCI_MODE_DMA;
- regs->sci_icmd |= SCI_ICMD_DATA;
- regs->sci_irecv = 0;
-
- while (len >= 1024) {
- READY(0);
- R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4;
- R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; /* 128 */
- READY(0);
- R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4;
- R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; /* 256 */
- READY(0);
- R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4;
- R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; /* 384 */
- READY(0);
- R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4;
- R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; /* 512 */
- READY(0);
- R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4;
- R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; /* 640 */
- READY(0);
- R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4;
- R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; /* 768 */
- READY(0);
- R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4;
- R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; /* 896 */
- READY(0);
- R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4;
- R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; /*1024 */
- len -= 1024;
- }
- while (len >= 128) {
- READY(0);
- R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4;
- R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; R4;R4;R4;R4; /* 128 */
- len -= 128;
- }
- while (len) {
- READY(0);
- R1;
- len--;
- }
-scsi_timeout_error:
- regs->sci_mode &= ~SCI_MODE_DMA;
- return count - len;
-}
-#undef R4
-#undef R1
-#endif
-
-/* Some stuff from dp.c ... */
-
-
-#if 0
-/* Select a SCSI device.
- */
-int scsi_select_ctlr (int ctlr)
-{
- /* May need other stuff here to syncronize between dp & aic. */
-
- RD_ADR (u_char, ICU_IO) &= ~ICU_SCSI_BIT; /* i/o, not port */
- RD_ADR (u_char, ICU_DIR) &= ~ICU_SCSI_BIT; /* output */
- if (ctlr == NCR5380)
- RD_ADR (u_char, ICU_DATA) &= ~ICU_SCSI_BIT; /* select = 0 for 8490 */
- else
- RD_ADR (u_char, ICU_DATA) |= ICU_SCSI_BIT; /* select = 1 for AIC6250 */
-}
-#endif
diff --git a/sys/arch/pc532/dev/rd.c b/sys/arch/pc532/dev/rd.c
deleted file mode 100644
index 4feb90bb7d1..00000000000
--- a/sys/arch/pc532/dev/rd.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/* $OpenBSD: rd.c,v 1.3 2000/03/03 00:54:54 todd Exp $ */
-/*
- * Copyright (c) 1995 Philip A. Nelson.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Philip A. Nelson.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/buf.h>
-#include <sys/device.h>
-#include <sys/conf.h>
-#include <sys/disk.h>
-
-static int rdmatch(struct device *parent, void *cf, void *aux);
-static void rdattach(struct device *parent, struct device *self, void *aux);
-
-struct rdsoftc {
- struct device sc_dev; /* generic device glue */
- struct disk sc_dkdev; /* generic disk glue */
-};
-
-struct cfdriver rdcd = {
- NULL,
- "rd",
- rdmatch,
- rdattach,
- DV_DISK,
- sizeof(struct rdsoftc),
- NULL,
- 0
-};
-
-void rdstrategy __P((struct buf *));
-
-struct dkdriver rddkdriver = { rdstrategy };
-
-#if !defined(RD_SIZE)
-# define RD_SIZE 0x200000
-#endif
-
-u_char ram_disk[RD_SIZE] = "Ramdiskorigin";
-
-static int
-rdmatch(parent, cf, aux)
- struct device *parent;
- void *cf, *aux;
-{
- return(((struct cfdata *)cf)->cf_unit == 0);
-}
-
-static void
-rdattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct rdsoftc *sc = (struct rdsoftc *)self;
-
- printf(" addr 0x%x, size 0x%x\n", ram_disk, RD_SIZE);
-
- /*
- * Initialize and attach the disk structure.
- */
- bzero(&sc->sc_dkdev, sizeof(sc->sc_dkdev));
- sc->sc_dkdev.dk_driver = &rddkdriver;
- sc->sc_dkdev.dk_name = sc->sc_dev.dv_xname;
- disk_attach(&sc->sc_dkdev);
-}
-
-
-/* operational routines */
-
-int
-rdopen(dev, flags, devtype, p)
- dev_t dev;
- int flags, devtype;
- struct proc *p;
-{
- if (minor(dev) == 0)
- return(0);
- else
- return(ENXIO);
-}
-
-int
-rdclose(dev, flags, devtype, p)
- dev_t dev;
- int flags, devtype;
- struct proc *p;
-{
- return(0);
-}
-
-int
-rdioctl(dev, cmd, addr, flag, p)
- dev_t dev;
- u_long cmd;
- int flag;
- caddr_t addr;
- struct proc *p;
-{
- return(ENOTTY);
-}
-
-int
-rdsize(dev)
- dev_t dev;
-{
- if (minor(dev) == 0)
- return(RD_SIZE / DEV_BSIZE);
- else
- return(0);
-}
-
-int
-rddump(dev, blkno, va, size)
- dev_t dev;
- daddr_t blkno;
- caddr_t va;
- size_t size;
-{
- return(ENXIO);
-}
-
-void
-rdstrategy(bp)
- struct buf *bp;
-{
- int loc, size;
- char *adr;
-
- if (minor(bp->b_dev) == 0)
- loc = bp->b_blkno * DEV_BSIZE;
- else {
- bp->b_error = EINVAL;
- bp->b_flags |= B_ERROR;
- return;
- }
- size = bp->b_bcount;
- adr = (char *) bp->b_un.b_addr;
- if (loc + size > sizeof(ram_disk)) {
- bp->b_error = EINVAL;
- bp->b_flags |= B_ERROR;
- return;
- }
- if (bp->b_flags & B_READ)
- bcopy(&ram_disk[loc], adr, size);
- else
- bcopy(adr, &ram_disk[loc], size);
- biodone(bp);
-}
-
-int
-rdread(dev, uio)
- dev_t dev;
- struct uio *uio;
-{
- return(physio(rdstrategy, NULL, dev, B_READ, minphys, uio));
-}
-
-int
-rdwrite(dev, uio)
- dev_t dev;
- struct uio *uio;
-{
- return(physio(rdstrategy, NULL, dev, B_WRITE, minphys, uio));
-}
diff --git a/sys/arch/pc532/dev/scn.c b/sys/arch/pc532/dev/scn.c
deleted file mode 100644
index b1d6cf6b1c1..00000000000
--- a/sys/arch/pc532/dev/scn.c
+++ /dev/null
@@ -1,1127 +0,0 @@
-/* $NetBSD: scn.c,v 1.23 1996/01/25 19:50:39 phil Exp $ */
-
-/*
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)com.c 7.5 (Berkeley) 5/16/91
- */
-
-#include "scn.h"
-
-#if NSCN > 0
-
-/* #define KERN_MORE */
-
-/* The pc532 has 4 duarts! */
-#define NLINES 8
-
-/*
- * scn2681 driver for the pc532. Phil Nelson Feb 8, 1993
- *
- */
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/select.h>
-#include <sys/tty.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/uio.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/types.h>
-#include <sys/device.h>
-
-#include <dev/cons.h>
-
-#include <machine/icu.h>
-
-#include "scnreg.h"
-
-#include "sl.h"
-
-struct scn_softc {
- struct device scn_dev;
- struct tty *scn_tty;
- struct rs232_s scn_line;
- char scn_swflags;
-#define SCN_SW_SOFTCAR 0x01
-#define SCN_SW_CLOCAL 0x02
-#define SCN_SW_CRTSCTS 0x04
-};
-
-int scnprobe __P((struct device *, void *, void *));
-void scnattach __P((struct device *, struct device *, void *));
-int scnintr __P((int));
-int scnparam __P((struct tty *, struct termios *));
-void scnstart __P((struct tty *));
-int scnopen __P((dev_t, int, int, struct proc *));
-int scnclose __P((dev_t, int, int, struct proc *));
-
-struct cfdriver scncd =
- { NULL, "scn", scnprobe, scnattach,
- DV_TTY, sizeof(struct scn_softc), NULL, 0 };
-
-/* int scnsoftCAR;
-int scn_active; To Be Deleted ... */
-int scnconsole = SCN_CONSOLE;
-int scnconsinit = 0;
-int scndefaultrate = TTYDEF_SPEED;
-int scnmajor;
-
-struct duart_info uart[(NLINES+1)/2];
-/* struct rs232_s line[NLINES];
- struct tty *scn_tty[NLINES]; To be deleted. */
-
-struct speedtab scnspeedtab[] = {
- 0, 0x40, /* code for line-hangup */
- 50, 0x00,
- 75, 0x10,
- 110, 0x21,
- 134, 0x22,
- 150, 0x13,
- 200, 0x03,
- 300, 0x24,
- 600, 0x25,
- 1050, 0x07,
- 1200, 0x26,
- 1800, 0x1a,
- 2000, 0x17,
- 2400, 0x28,
- 4800, 0x29,
- 7200, 0x0a,
- 9600, 0x2b,
- 19200, 0x1c,
- 38400, 0x0c,
- 57600, 0x60, /* An illegal speed....? */
- -1, -1
-};
-
-#define getspeedcode(sp,val) \
- { int i=0; \
- while (scnspeedtab[i].sp_speed != -1 && \
- scnspeedtab[i].sp_speed != sp) \
- i++; \
- val = scnspeedtab[i].sp_code; \
- }
-
-/* Unit is 0-7. Other parts of the minor number are things like
- hardware cts/rts handshaking. (XXX how?) */
-
-#define UNIT(x) (minor(x) & 0x7)
-
-/* Which uart is the device on? */
-#define UART(x) (UNIT(x) >> 1)
-
-extern struct tty *constty;
-
-#ifdef KGDB
-#include "machine/remote-sl.h"
-
-extern int kgdb_dev;
-extern int kgdb_rate;
-extern int kgdb_debug_init;
-#endif
-
-
-/* Debug routine to print out the rs line structures. */
-void print_rs (struct rs232_s *rs)
-{
- printf ("\nline frame overrun parity break\n");
- printf ("tty%1d state=%2x f=%2d o=%2d p=%2d b=%2d in=%x, out=%x grp=%d\n",
- rs->unit, rs->framing_errors, rs->overrun_errors,
- rs->parity_errors, rs->break_interrupts,
- rs->uart->i_speed[rs->a_or_b], rs->uart->o_speed[rs->a_or_b],
- rs->uart->speed_grp);
-}
-
-
-/*==========================================================================*
- * scn_config *
- *==========================================================================*/
-static
-int scn_config(unit, in_speed, out_speed, parity, stop_bits, data_bits )
-int unit; /* which rs line */
-int in_speed; /* input speed: 110, 300, 1200, etc */
-int out_speed; /* output speed: 110, 300, 1200, etc */
-int parity; /* some parity */
-int stop_bits; /* 2 (110 baud) or 1 (other speeds) */
-int data_bits; /* 5, 6, 7, or 8 */
-{
-/* Set various line control parameters for RS232 I/O. */
-
- register struct rs232_s *rs;
- char mr1_val, mr2_val;
- int sp_grp, sp_both;
- char set_speed; /* Non zero if we need to set the speed. */
- char a_or_b; /* Used for ease of access. */
- int in_code;
- int out_code;
- int x;
-
- /* Get the speed codes. */
- getspeedcode(in_speed,in_code);
- getspeedcode(out_speed,out_code);
-
- /* Check for speed errors. */
- if (in_code == -1 || out_code == -1)
- return (EINVAL);
-
- /* Set up rs pointer. */
- if (unit >= scncd.cd_ndevs)
- return ENXIO;
- rs = &((struct scn_softc *)scncd.cd_devs[unit])->scn_line;
- a_or_b = rs->a_or_b;
-
- /* Check out the Speeds. There are two groups of speeds. If the new
- speeds are not in the same group, or the other line is not the same
- speed of the other group, do not change the speeds. Also, if the
- in speed and the out speed are in different groups, use the in speed. */
-
- set_speed = FALSE;
- if ( (in_code != rs->uart->i_code[a_or_b])
- || (out_code != rs->uart->o_code[a_or_b])) {
-
- /* We need to set the speeds .*/
- set_speed = TRUE;
-
- if ( ((in_code & LC_SP_GRP) != (out_code & LC_SP_GRP))
- && (((in_code | out_code) & LC_SP_BOTH) != 1) ) {
- /* Input speed and output speed are different groups. */
- return (EINVAL);
- }
-
- sp_grp = ((in_code | out_code) & LC_SP_GRP)>>4;
- sp_both = in_code & out_code & LC_SP_BOTH;
-
- /* Check for compatibility and set the uart values */
- if (sp_both)
- sp_grp = rs->uart->speed_grp;
- else
- if ((sp_grp != rs->uart->speed_grp)
- && !(rs->uart->i_code[1-a_or_b] & rs->uart->o_code[1-a_or_b]
- & LC_SP_BOTH)) {
- /* Can't change group, don`t change the speed rates. */
- return (EINVAL);
- }
- rs->uart->i_code[a_or_b] = in_code;
- rs->uart->o_code[a_or_b] = out_code;
- rs->uart->i_speed[a_or_b] = in_speed;
- rs->uart->o_speed[a_or_b] = out_speed;
- }
-
- /* Lock out interrupts while setting the parameters. (Just for safety.)
- */
- x=spltty();
- WR_ADR (u_char, rs->cmd_port, CMD_MR1);
- mr1_val = RD_ADR (u_char, rs->mr_port);
- mr2_val = RD_ADR (u_char, rs->mr_port);
- if ((((mr1_val & 0xe0) | parity | data_bits) != mr1_val) ||
- (((mr2_val & 0xf0) | stop_bits) != mr2_val)) {
- WR_ADR (u_char, rs->cmd_port, CMD_MR1);
- WR_ADR (u_char, rs->mr_port, (mr1_val & 0xe0) | parity | data_bits);
- WR_ADR (u_char, rs->mr_port, (mr2_val & 0xf0) | stop_bits);
- }
- if (set_speed) {
- if (rs->uart->speed_grp != sp_grp) {
- /* Change the group! */
- rs->uart->speed_grp = sp_grp;
- WR_ADR (u_char, rs->acr_port, (sp_grp << 7) | rs->uart->acr_int_bits);
- }
- WR_ADR (u_char, rs->speed_port, ((in_code & 0x0f) << 4)
- | (out_code & 0x0f));
- }
- DELAY(96000/out_speed);
-
- splx(x);
- return (0);
-}
-
-
-scnprobe(parent, cf, aux)
- struct device *parent;
- void *cf;
- void *aux;
-{
- int unit = ((struct cfdata *)cf)->cf_unit;
-
- if (unit >= NLINES) {
- return(0); /* dev is "not working." */
- } else {
- return(1); /* dev is "working." */
- }
-}
-
-void
-scnattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- static char scnints[4] = { IR_TTY0, IR_TTY1, IR_TTY2, IR_TTY3 };
- struct scn_softc *sc = (void *) self;
- struct tty *tp;
- u_char unit = sc->scn_dev.dv_unit;
- u_char duart = unit >> 1;
- register struct rs232_s *rs = &sc->scn_line;
- int x;
- int speed;
- long line_base;
- long uart_base;
- long scn_first_adr;
-
- if (unit == 0) DELAY(5); /* Let the output go out.... */
-
- sc->scn_swflags |= SCN_SW_SOFTCAR;
-
- /* Record unit number, uart, channel a_or_b. */
- rs->unit = unit;
- rs->uart = &uart[unit >> 1];
- rs->a_or_b = unit % 2;
-
- /* Establish interrupt vector */
- if (rs->a_or_b == 0) {
- /* Arg 0 is special, so we must pass "unit + 1" */
- intr_establish(scnints[unit >> 1], (void (*)(void *))scnintr,
- (void *)(unit + 1), sc->scn_dev.dv_xname, IPL_TTY, FALLING_EDGE);
- }
-
- /* Precalculate port numbers for speed. Magic numbers in the code (once). */
- scn_first_adr = SCN_FIRST_MAP_ADR; /* to get around a gcc bug. */
- line_base = scn_first_adr + LINE_SZ * unit;
- uart_base = scn_first_adr + UART_SZ * duart;
- rs->xmit_port = DATA_ADR;
- rs->recv_port = DATA_ADR;
- rs->mr_port = MR_ADR;
- rs->stat_port = STAT_ADR;
- rs->speed_port = SPEED_ADR;
- rs->cmd_port = CMD_ADR;
- rs->acr_port = ACR_ADR;
- rs->ip_port = IP_ADR;
- rs->opset_port = SET_OP_ADR;
- rs->opclr_port = CLR_OP_ADR;
-
- /* Initialize error counts */
- rs->framing_errors = 0;
- rs->overrun_errors = 0;
- rs->parity_errors = 0;
- rs->break_interrupts = 0;
-
- /* Set up the hardware to a base state, in particular
- * o reset transmitter and receiver
- * o set speeds and configurations
- * o receiver interrupts only (RxRDY and BREAK)
- */
-
- x = spltty();
- istop(rs); /* CTS off... */
-
- WR_ADR (u_char, rs->cmd_port, CMD_DIS_RX | CMD_DIS_TX);
- WR_ADR (u_char, rs->cmd_port, CMD_RESET_RX);
- WR_ADR (u_char, rs->cmd_port, CMD_RESET_TX);
- WR_ADR (u_char, rs->cmd_port, CMD_RESET_ERR);
- WR_ADR (u_char, rs->cmd_port, CMD_RESET_BRK);
- WR_ADR (u_char, rs->cmd_port, CMD_MR1);
- WR_ADR (u_char, rs->mr_port, 0); /* No receiver control of RTS. */
- WR_ADR (u_char, rs->mr_port, 0);
-#if 1
- if (unit != 0) {
- WR_ADR (u_char, rs->mr_port, 0x80); /* Enable receiver control of RTS */
- WR_ADR (u_char, rs->mr_port, 0x10); /* Enable CTS transmitter control */
- }
-#endif
-
- /* Initialize the uart structure if this is channel A. */
- if (rs->a_or_b == 0) {
- /* uart ports */
- rs->uart->isr_port = ISR_ADR;
- rs->uart->imr_port = IMR_ADR;
- rs->uart->ipcr_port = IPCR_ADR;
- rs->uart->opcr_port = OPCR_ADR;
-
- /* Disable all interrupts. */
- WR_ADR (u_char, rs->uart->imr_port, 0);
- rs->uart->imr_int_bits = 0;
-
- /* Output port config */
- WR_ADR (u_char, rs->uart->opcr_port, 0);
-
- /* Speeds... */
- rs->uart->speed_grp = 1;
- rs->uart->acr_int_bits = 0;
- /* Set initial speed to an illegal code that can be changed to
- any other baud. */
- rs->uart->i_code[0] = rs->uart->o_code[0] =
- rs->uart->i_code[1] = rs->uart->o_code[1] = 0x2f;
- rs->uart->i_speed[0] = rs->uart->o_speed[0] =
- rs->uart->i_speed[1] = rs->uart->o_speed[1] = 0x0;
- }
-
-#if 0
- rs->uart->acr_int_bits |= ACR_CTS << rs->a_or_b; /* Set CTS int */
-#endif
- WR_ADR (u_char, rs->acr_port,
- (rs->uart->speed_grp << 7) | rs->uart->acr_int_bits);
-#ifdef CONSOLE_SPEED
- if (unit == 0)
-{ printf ("scn_config on unit 0\n");
- scn_config(unit, CONSOLE_SPEED, CONSOLE_SPEED,
- LC_NONE, LC_STOP1, LC_BITS8);
-}
- else
-#endif
- scn_config(unit, scndefaultrate, scndefaultrate,
- LC_NONE, LC_STOP1, LC_BITS8);
-
- /* Turn on the Rx and Tx. */
- WR_ADR (u_char, rs->cmd_port, CMD_ENA_RX | CMD_ENA_TX);
-
- /* Set up the interrupts. */
- rs->uart->imr_int_bits
- |= (/*IMR_RX_INT | IMR_TX_INT |*/ unit?IMR_BRK_INT:0) << (4*rs->a_or_b) | IMR_IP_INT;
- WR_ADR (u_char, rs->uart->imr_port, rs->uart->imr_int_bits);
-
- splx(x);
-
-#ifdef KGDB
- if (kgdb_dev == makedev(scnmajor, unit+1)) {
- if (scnconsole == unit)
- kgdb_dev = -1; /* can't debug over console port */
- else {
- (void) scninit(unit, kgdb_rate);
- if (kgdb_debug_init) {
- /*
- * Print prefix of device name,
- * let kgdb_connect print the rest.
- */
- printf("scn%d: ", unit);
- kgdb_connect(1);
- } else
- printf("scn%d: kgdb enabled\n", unit);
- }
- }
-#endif
-
- /* print the device number... */
- printf (" addr 0x%x\n", line_base);
-}
-
-/* ARGSUSED */
-scnopen(dev_t dev, int flag, int mode, struct proc *p)
-{
- struct scn_softc *sc;
- register struct tty *tp;
- register int unit = UNIT(dev);
- register struct rs232_s *rs;
- int error = 0;
- int x;
-
- /* Set up rs pointer. */
- if (unit >= scncd.cd_ndevs)
- return ENXIO;
- sc = scncd.cd_devs[unit];
- if (!sc)
- return ENXIO;
- rs = &sc->scn_line;
-
- x = spltty();
-
- if(!sc->scn_tty) {
- tp = sc->scn_tty = ttymalloc();
- } else
- tp = sc->scn_tty;
-
- tp->t_oproc = scnstart;
- tp->t_param = scnparam;
- tp->t_dev = dev;
- if ((tp->t_state & TS_ISOPEN) == 0) {
- tp->t_state |= TS_WOPEN;
- ttychars(tp);
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- tp->t_cflag = TTYDEF_CFLAG;
- if (sc->scn_swflags & SCN_SW_CLOCAL)
- tp->t_cflag |= CLOCAL;
- if (sc->scn_swflags & SCN_SW_CRTSCTS)
- tp->t_cflag |= CRTSCTS;
- tp->t_lflag = TTYDEF_LFLAG;
- tp->t_ispeed = tp->t_ospeed = scndefaultrate;
- scnparam(tp, &tp->t_termios);
- ttsetwater(tp);
-
- /* Turn on DTR and RTS. */
- istart(rs);
- rx_ints_on (rs);
-
- /* Carrier? XXX fix more like i386 */
- if ((sc->scn_swflags & SCN_SW_SOFTCAR) || get_dcd(rs))
- tp->t_state |= TS_CARR_ON;
- } else if (tp->t_state&TS_XCLUDE && p->p_ucred->cr_uid != 0) {
- splx(x);
- return (EBUSY);
- }
-
- /* wait for carrier if necessary */
- if ((flag & O_NONBLOCK) == 0)
- while ((tp->t_cflag & CLOCAL) == 0 &&
- (tp->t_state & TS_CARR_ON) == 0) {
- tp->t_state |= TS_WOPEN;
- error = ttysleep(tp, (caddr_t)&tp->t_rawq,
- TTIPRI | PCATCH, ttopen, 0);
- if (error) {
- /* XXX should turn off chip if we're the
- only waiter */
- splx(x);
- return error;
- }
- }
- splx(x);
-
- return (*linesw[tp->t_line].l_open)(dev, tp);
-}
-
-/*ARGSUSED*/
-scnclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- register int unit = UNIT(dev);
- struct scn_softc *sc = scncd.cd_devs[unit];
- register struct tty *tp = sc->scn_tty;
- register struct rs232_s *rs = &sc->scn_line;
-
- (*linesw[tp->t_line].l_close)(tp, flag);
-#ifdef KGDB
- /* do not disable interrupts if debugging */
- if (kgdb_dev != makedev(scnmajor, unit))
-#endif
- if ((tp->t_state&TS_ISOPEN) == 0)
- rx_ints_off (rs);
- if (tp->t_cflag&HUPCL || tp->t_state&TS_WOPEN ||
- (tp->t_state&TS_ISOPEN) == 0) {
- WR_ADR (u_char, rs->opclr_port, DTR_BIT << rs->a_or_b);
- DELAY (10);
- WR_ADR (u_char, rs->opset_port, DTR_BIT << rs->a_or_b);
- }
- ttyclose(tp);
-#if 0
- if ((tp->t_state&TS_ISOPEN) == 0) {
- ttyfree(tp);
- sc->scn_tty = (struct tty *)NULL;
- }
-#endif
- return(0);
-}
-
-scnread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
-{
- register struct scn_softc *sc = scncd.cd_devs[UNIT(dev)];
- register struct tty *tp = sc->scn_tty;
-
- return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
-}
-
-scnwrite(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
-{
- register struct scn_softc *sc = scncd.cd_devs[UNIT(dev)];
- register struct tty *tp = sc->scn_tty;
-
- return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
-}
-
-struct tty *
-scntty(dev)
- dev_t dev;
-{
- register struct scn_softc *sc = scncd.cd_devs[UNIT(dev)];
- register struct tty *tp = sc->scn_tty;
-
- return (tp);
-}
-
-void cts_int (struct rs232_s *rs, struct tty *tp)
-{
-}
-
-#if 0
-scnintr(int uart_no)
-{
- int line0 = uart_no << 1;
- int line1 = (uart_no << 1)+1;
-
- register struct scn_softc *sc0 = scncd.cd_devs[line0];
- register struct scn_softc *sc1 = scncd.cd_devs[line1];
-
- register struct tty *tp0 = sc0->scn_tty;
- register struct tty *tp1 = sc1->scn_tty;
-
- register struct rs232_s *rs0 = &sc0->scn_line;
- register struct rs232_s *rs1 = &sc1->scn_line;
-
- register struct duart_info *uart = rs0->uart;
-
- char rs_work = TRUE;
-
- u_char rs_stat;
- u_char rs_ipcr;
- u_char ch;
-
-
- rs_stat = RD_ADR(u_char, uart->isr_port);
- printf ("scnintr, rs_stat = 0x%x\n", rs_stat);
-
- if (rs_stat & IMR_BRK_INT) {
- /* A break interrupt! */
- rs0->lstatus = RD_ADR(u_char, rs0->stat_port);
- printf ("lstatus = 0x%x\n", rs0->lstatus);
- if (rs0->lstatus & SR_BREAK) {
- ++rs0->break_interrupts;
- RD_ADR(u_char, rs0->recv_port); /* Toss zero character. */
- rs_stat &= ~IMR_RX_INT;
- }
- WR_ADR (u_char, rs0->cmd_port, CMD_RESET_BRK);
- rs0->lstatus = RD_ADR(u_char, rs0->stat_port);
- printf ("lstatus = 0x%x\n", rs0->lstatus);
- }
- if (rs_stat & IMR_RX_INT) {
- ch = RD_ADR(u_char, rs0->recv_port);
- printf ("input ch = \"%c\"\n", ch);
- }
-}
-/* Change this for real interrupts! */
-_scnintr(int uart_no)
-
-#else
-
-/* Change this for real interrupts! */
-scnintr(int line1)
-#endif
-{
- register struct scn_softc *sc0 = scncd.cd_devs[line1 - 1];
- register struct scn_softc *sc1 = scncd.cd_devs[line1];
-
- register struct tty *tp0 = sc0->scn_tty;
- register struct tty *tp1 = sc1->scn_tty;
-
- register struct rs232_s *rs0 = &sc0->scn_line;
- register struct rs232_s *rs1 = &sc1->scn_line;
-
- register struct duart_info *uart = rs0->uart;
-
- char rs_work = TRUE;
-
- u_char rs_stat;
- u_char rs_ipcr;
- u_char ch;
-
-#ifdef CON_BRK_PANIC
- u_char nr_brk = 0;
-#endif
-
- while (rs_work) {
- /* Loop to pick up ALL pending interrupts for device.
- */
- rs_work = FALSE;
- rs_stat = RD_ADR(u_char, uart->isr_port);
-/* if (rs_stat & ~(IMR_TX_INT | IMR_TXB_INT)) printf ("scn intr rs_stat = 0x%x\n", rs_stat); */
- if ((rs_stat & IMR_TX_INT) && (tp0 != NULL)
- && (tp0->t_state & TS_BUSY)) {
- /* output char done. */
- tp0->t_state &= ~(TS_BUSY|TS_FLUSH);
- tx_ints_off(rs0);
- if (tp0->t_line)
- (*linesw[tp0->t_line].l_start)(tp0);
- else
- scnstart(tp0);
- rs_work = TRUE;
- }
- if (rs_stat & IMR_BRK_INT && (tp0 != NULL)) {
- /* A break interrupt! */
- rs0->lstatus = RD_ADR(u_char, rs0->stat_port);
- if (rs0->lstatus & SR_BREAK) {
- ++rs0->break_interrupts;
- RD_ADR(u_char, rs0->recv_port); /* Toss zero character. */
- rs_stat &= ~IMR_RX_INT;
- }
- WR_ADR (u_char, rs0->cmd_port, CMD_RESET_BRK);
- rs_work = TRUE;
-#ifdef CON_BRK_PANIC
- if (line1 == 1 && (rs0->lstatus & SR_BREAK)) {
- if (++nr_brk >= 3) {
- char c;
- printf("\r\nDo you want a dump (y/n)? ");
- do
- c = cngetc();
- while (c != 'y' && c != 'n');
- printf("%c\r\n", c);
- if (c == 'y') {
- panic("Panic Button");
- }
- }
- }
-#endif
- }
- if (rs_stat & IMR_RX_INT && (tp0 != NULL)) {
- ch = RD_ADR(u_char, rs0->recv_port);
- if (tp0->t_state & TS_ISOPEN)
- (*linesw[tp0->t_line].l_rint)(ch, tp0);
- rs_work = TRUE;
-#ifdef CON_BRK_PANIC
- if (line1 == 1) nr_brk = 0;
-#endif
- }
- if ((rs_stat & IMR_TXB_INT) && (tp1 != NULL)
- && (tp1->t_state & TS_BUSY)) {
- /* output char done. */
- tp1->t_state &= ~(TS_BUSY|TS_FLUSH);
- tx_ints_off(rs1);
- if (tp1->t_line)
- (*linesw[tp1->t_line].l_start)(tp1);
- else
- scnstart(tp1);
- rs_work = TRUE;
- }
- if (rs_stat & IMR_BRKB_INT && (tp1 != NULL)) {
- /* A break interrupt! */
- rs1->lstatus = RD_ADR(u_char, rs1->stat_port);
- if (rs1->lstatus & SR_BREAK) {
- ++rs1->break_interrupts;
- RD_ADR(u_char, rs1->recv_port); /* Toss zero character. */
- rs_stat &= ~IMR_RXB_INT;
- }
- WR_ADR (u_char, rs1->cmd_port, CMD_RESET_BRK);
- rs_work = TRUE;
- }
- if (rs_stat & IMR_RXB_INT && (tp1 != NULL)) {
- ch = RD_ADR(u_char, rs1->recv_port);
- if (tp1->t_state & TS_ISOPEN)
- (*linesw[tp1->t_line].l_rint)(ch, tp1);
- rs_work = TRUE;
- }
- if (rs_stat & IMR_IP_INT) {
- rs_work = TRUE;
- rs_ipcr = RD_ADR (u_char, uart->ipcr_port);
-#if 0
- /* RTS/CTS stuff! */
- if (rs_ipcr & IPCR_CTS)
- cts_int(rs0, tp0);
- if (rs_ipcr & (IPCR_CTS << 1))
- cts_int(rs1, tp1);
-#endif
-#if 0
- if (rs_ipcr & ACR_DCD)
- dcd_int(rs0, tp0);
- if (rs_ipcr & (ACR_DCD << 1))
- dcd_int(rs1, tp1);
-#endif
- }
- }
-}
-
-
-scnioctl(dev, cmd, data, flag, p)
- dev_t dev;
- int cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- register int unit = UNIT(dev);
- register struct scn_softc *sc = scncd.cd_devs[unit];
- register struct tty *tp = sc->scn_tty;
- register struct rs232_s *rs = &sc->scn_line;
- register scn;
- register int error;
-
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
- if (error >= 0)
- return (error);
- error = ttioctl(tp, cmd, data, flag, p);
- if (error >= 0)
- return (error);
-
- switch (cmd) {
-
- case TIOCSBRK:
- WR_ADR(u_char, rs->cmd_port, CMD_START_BRK);
- break;
-
- case TIOCCBRK:
- WR_ADR (u_char, rs->cmd_port, CMD_STOP_BRK);
- break;
-
- case TIOCSDTR:
- WR_ADR(u_char, rs->opset_port,
- (DTR_BIT | RTS_BIT) << rs->a_or_b);
- break;
-
- case TIOCCDTR:
- WR_ADR(u_char, rs->opclr_port,
- (DTR_BIT | RTS_BIT) << rs->a_or_b);
- break;
-
- case TIOCMSET:
-/* (void) scnmctl(dev, *(int *)data, DMSET); */
- rs->scn_bits = *(long *)data;
- break;
-
- case TIOCMBIS:
-/* (void) scnmctl(dev, *(int *)data, DMBIS); */
- rs->scn_bits |= *(int *)data;
- break;
-
- case TIOCMBIC:
-/* (void) scnmctl(dev, *(int *)data, DMBIC); */
- rs->scn_bits &= ~(*(int *)data);
- break;
-
- case TIOCMGET:
-/* *(int *)data = scnmctl(dev, 0, DMGET); */
- *(int *)data = rs->scn_bits;
- break;
-
-/* 386 case TIOCGFLAGS: {
- int bits = 0;
-
- if (sc->sc_swflags & COM_SW_SOFTCAR)
- bits |= TIOCFLAG_SOFTCAR;
- if (sc->sc_swflags & COM_SW_CLOCAL)
- bits |= TIOCFLAG_CLOCAL;
- if (sc->sc_swflags & COM_SW_CRTSCTS)
- bits |= TIOCFLAG_CRTSCTS;
- if (sc->sc_swflags & COM_SW_MDMBUF)
- bits |= TIOCFLAG_MDMBUF;
-
- *(int *)data = bits;
- break;
- }
- case TIOCSFLAGS: {
- int userbits, driverbits = 0;
-
- error = suser(p->p_ucred, &p->p_acflag);
- if (error != 0)
- return(EPERM);
-
- userbits = *(int *)data;
- if ((userbits & TIOCFLAG_SOFTCAR) ||
- (sc->sc_hwflags & COM_HW_CONSOLE))
- driverbits |= COM_SW_SOFTCAR;
- if (userbits & TIOCFLAG_CLOCAL)
- driverbits |= COM_SW_CLOCAL;
- if (userbits & TIOCFLAG_CRTSCTS)
- driverbits |= COM_SW_CRTSCTS;
- if (userbits & TIOCFLAG_MDMBUF)
- driverbits |= COM_SW_MDMBUF;
-
- sc->sc_swflags = driverbits;
- break;
- }
-*/
- default:
- return (ENOTTY);
- }
- return (0);
-}
-
-scnparam(tp, t)
- register struct tty *tp;
- register struct termios *t;
-{
- int cflag = t->c_cflag;
- int unit = UNIT(tp->t_dev);
- register struct scn_softc *sc = scncd.cd_devs[unit];
- int parity = LC_NONE,
- stop_bits = LC_STOP1,
- data_bits = LC_BITS8;
- int error;
- struct rs232_s *rs = &sc->scn_line;
-
- /* Is this a hang up? */
- if (t->c_ospeed == B0) {
- WR_ADR (u_char, rs->opclr_port, DTR_BIT << rs->a_or_b);
- DELAY (10);
- WR_ADR (u_char, rs->opset_port, DTR_BIT << rs->a_or_b);
- return(0);
- }
-
- /* Parity? */
- if (cflag&PARENB) {
- if ((cflag&PARODD) == 0)
- parity = LC_EVEN;
- else
- parity = LC_ODD;
- }
-
- /* Stop bits. */
- if (cflag&CSTOPB)
- stop_bits = LC_STOP1;
-
- /* Data bits. */
- switch (cflag&CSIZE) {
- case CS5:
- data_bits = LC_BITS5; break;
- case CS6:
- data_bits = LC_BITS6; break;
- case CS7:
- data_bits = LC_BITS7; break;
- case CS8:
- data_bits = LC_BITS8; break;
- }
-
- error = scn_config (unit, t->c_ispeed, t->c_ospeed, parity, stop_bits,
- data_bits);
-
- /* If successful, copy to tty */
- if (!error) {
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- tp->t_cflag = cflag;
- }
-
- return (error);
-}
-
-void
-scnstart(tp)
- register struct tty *tp;
-{
- int s, c;
- int unit = UNIT(tp->t_dev);
- register struct scn_softc *sc = scncd.cd_devs[unit];
- struct rs232_s *rs = &sc->scn_line;
-
- s = spltty();
- if (tp->t_state & (TS_BUSY|TS_TTSTOP))
- goto out;
- if (tp->t_outq.c_cc <= tp->t_lowat) {
- if (tp->t_state&TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
- if (tp->t_outq.c_cc == 0)
- goto out;
- tp->t_state |= TS_BUSY;
- if (tx_rdy(rs)) {
- c = getc(&tp->t_outq);
- WR_ADR(u_char, rs->xmit_port, c);
- tx_ints_on(rs);
- }
-out:
- splx(s);
-}
-
-/*
- * Stop output on a line.
- */
-/*ARGSUSED*/
-scnstop(tp, flag)
- register struct tty *tp;
-{
- register int s;
-
- s = spltty();
- if (tp->t_state & TS_BUSY) {
- if ((tp->t_state&TS_TTSTOP)==0)
- tp->t_state |= TS_FLUSH;
- }
- splx(s);
-}
-
-/*
- * Following are all routines needed for SCN to act as console
- */
-
-scncnprobe(cp)
- struct consdev *cp;
-{
- /* locate the major number */
- for (scnmajor = 0; scnmajor < nchrdev; scnmajor++)
- if (cdevsw[scnmajor].d_open == scnopen)
- break;
-
- /* make sure hardware exists? XXX */
-
- /* initialize required fields */
- cp->cn_dev = makedev(scnmajor, SCN_CONSOLE);
- cp->cn_pri = CN_NORMAL;
- return 1;
-}
-
-scncninit(cp)
- struct consdev *cp;
-{
-#if 0
- int unit = UNIT(cp->cn_dev);
-
- scninit(unit, scndefaultrate);
- scnconsole = unit;
- scnconsinit = 1;
-#endif
-}
-
-scninit(unit, rate)
- int unit, rate;
-{
-#if 0
- register int scn;
- int s;
- short stat;
-
-#ifdef lint
- stat = unit; if (stat) return;
-#endif
- scn = scn_addr[unit];
- s = splhigh();
- outb(com+com_cfcr, CFCR_DLAB);
- rate = ttspeedtab(comdefaultrate, comspeedtab);
- outb(com+com_data, rate & 0xFF);
- outb(com+com_ier, rate >> 8);
- outb(com+com_cfcr, CFCR_8BITS);
- outb(com+com_ier, IER_ERXRDY | IER_ETXRDY);
- outb(com+com_fifo, FIFO_ENABLE|FIFO_RCV_RST|FIFO_XMT_RST|FIFO_TRIGGER_14);
- stat = inb(com+com_iir);
- splx(s);
-#endif
-}
-
-#if 0
-int
-scnselect(dev, rw, p)
- dev_t dev;
- int rw;
- struct proc *p;
-{
- register struct tty *tp = scn_tty[UNIT(dev)];
- int nread;
- int s = spltty();
- struct proc *selp;
-
- switch (rw) {
-
- case FREAD:
- nread = ttnread(tp);
- if (nread > 0 ||
- ((tp->t_cflag&CLOCAL) == 0 && (tp->t_state&TS_CARR_ON) == 0))
- goto win;
- selrecord(p, &tp->t_rsel);
- break;
-
- case FWRITE:
- if (tp->t_outq.c_cc <= tp->t_lowat)
- goto win;
- selrecord(p, &tp->t_wsel);
- break;
- }
- splx(s);
- return (0);
- win:
- splx(s);
- return (1);
-}
-#endif
-
-
-/* So the kernel can write in unmapped mode! */
-int _mapped = 0;
-
-/*
- * Console kernel input character routine.
- */
-
-char
-scncngetc(dev_t dev)
-{
- char c;
- int x = spltty();
- WR_ADR (u_char, SCN_FIRST_MAP_ADR + 14, (RTS_BIT | DTR_BIT));
- while (0 == (RD_ADR (u_char, SCN_CON_MAP_STAT) & SR_RX_RDY));
- c = RD_ADR(u_char, SCN_CON_MAP_DATA);
- splx(x);
- return c;
-}
-
-/* pc532 does not turn off console polling. */
-char
-scncnpollc(dev_t dev, int on)
-{
-}
-
-
-/*
- * Console kernel output character routine.
- */
-
-/* A simple kernel level "more" for debugging output. */
-#ifdef KERN_MORE
-int ___lines = 0;
-#endif
-
-scncnputc (dev_t dev, char c)
-{
- int x = spltty();
-
- if (c == '\n') scncnputc(dev,'\r');
- if (_mapped) {
- while (0 == (RD_ADR (u_char, SCN_CON_MAP_STAT) & SR_TX_RDY));
- WR_ADR (u_char, SCN_CON_MAP_DATA, c);
- while (0 == (RD_ADR (u_char, SCN_CON_MAP_STAT) & SR_TX_RDY));
- RD_ADR(u_char, SCN_CON_MAP_ISR);
- } else {
- while (0 == (RD_ADR (u_char, SCN_CON_STAT) & SR_TX_RDY));
- WR_ADR (u_char, SCN_CON_DATA, c);
- while (0 == (RD_ADR (u_char, SCN_CON_STAT) & SR_TX_RDY));
- RD_ADR(u_char, SCN_CON_ISR);
- }
-#ifdef KERN_MORE
- if (c == '\n' && ___lines >= 0)
- {
- if (++___lines == 22) {
- ___lines = 0;
- scncnputc(dev,'m');scncnputc(dev,'o');scncnputc(dev,'r');
- scncnputc(dev,'e');scncnputc(dev,':');scncnputc(dev,' ');
- scncngetc(dev);
- scncnputc(dev,'\n');
- }
- }
-#endif
- splx(x);
-}
-
-#endif
diff --git a/sys/arch/pc532/dev/scnreg.h b/sys/arch/pc532/dev/scnreg.h
deleted file mode 100644
index 569ce9c5db7..00000000000
--- a/sys/arch/pc532/dev/scnreg.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/* $NetBSD: scnreg.h,v 1.5 1994/10/26 08:24:19 cgd Exp $ */
-
-/*
- * Copyright (c) 1993 Philip A. Nelson.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Philip A. Nelson.
- * 4. The name of Philip A. Nelson may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY PHILIP NELSON ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL PHILIP NELSON BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * scnreg.h: definitions for the scn serial driver.
- */
-
-/* Constants. */
-#ifdef COMDEF_SPEED
-#undef TTYDEF_SPEED
-#define TTYDEF_SPEED COMDEF_SPEED /* default baud rate */
-#endif
-
-#define SCN_FIRST_ADR 0x28000000 /* address of first RS232 port */
-#define SCN_FIRST_MAP_ADR 0xFFC80000 /* mapped address of first port */
-
-#define SCN_SIZE 0x8 /* address space for port */
-
-#define SCN_CONSOLE 0 /* minor number of console */
-
-#define SCN_CON_MAP_STAT 0xFFC80001 /* raw addresses for console */
-#define SCN_CON_MAP_DATA 0xFFC80003 /* Mapped .... */
-#define SCN_CON_MAP_ISR 0xFFC80005
-
-#define SCN_CON_STAT 0x28000001 /* raw addresses for console */
-#define SCN_CON_DATA 0x28000003 /* Unmapped .... */
-#define SCN_CON_ISR 0x28000005
-
-
-/* SCN2691 registers, values. */
-#define LINE_SZ 0x08
-#define UART_SZ 0x10
-#define MR_ADR (line_base+0)
-#define STAT_ADR (line_base+1)
-#define SPEED_ADR (line_base+1)
-#define CMD_ADR (line_base+2)
-#define DATA_ADR (line_base+3)
-#define IPCR_ADR (uart_base+4)
-#define ACR_ADR (uart_base+4)
-#define ISR_ADR (uart_base+5)
-#define IMR_ADR (uart_base+5)
-#define IP_ADR (uart_base+13)
-#define OPCR_ADR (uart_base+13)
-#define SET_OP_ADR (uart_base+14)
-#define CLR_OP_ADR (uart_base+15)
-
-/* Data Values */
-#define LC_ODD 0x04
-#define LC_EVEN 0x00
-#define LC_NONE 0x10
-#define LC_STOP1 0x07
-#define LC_STOP2 0x0f
-#define LC_BITS5 0x00
-#define LC_BITS6 0x01
-#define LC_BITS7 0x02
-#define LC_BITS8 0x03
-#define LC_CHARS 0x03
-#define LC_CHARS_SHIFT 0x08
-#define LC_SP_GRP 0x10
-#define LC_SP_BOTH 0x20
-
-#define RTS_BIT 0x1
-#define CTS_BIT 0x1
-#define DTR_BIT 0x4
-#define DCD_BIT 0x4
-
-/* CR (command) register values. */
-#define CMD_ENA_RX 0x01
-#define CMD_DIS_RX 0x02
-#define CMD_ENA_TX 0x04
-#define CMD_DIS_TX 0x08
-#define CMD_MR1 0x10
-#define CMD_RESET_RX 0x20
-#define CMD_RESET_TX 0x30
-#define CMD_RESET_ERR 0x40
-#define CMD_RESET_BRK 0x50
-#define CMD_START_BRK 0x60
-#define CMD_STOP_BRK 0x70
-
-/* SR register */
-#define SR_RX_RDY 0x01
-#define SR_TX_RDY 0x04
-#define SR_BREAK 0x80
-#define SR_FRAME 0x40
-#define SR_PARITY 0x20
-#define SR_OVERRUN 0x10
-
-/* Output port configuration. */
-#define OPCR_CONFIG 0x00
-
-/* Input port interrupt config. */
-#define ACR_CTS 0x01
-#define ACR_DCD 0x04
-#define IPCR_CTS 0x10
-#define IPCR_DCD 0x40
-
-/* Interrupt configurations. */
-#define IMR_IP_INT 0x80
-#define IMR_BRK_INT 0x04
-#define IMR_RX_INT 0x02
-#define IMR_TX_INT 0x01
-#define IMR_BRKB_INT 0x40
-#define IMR_RXB_INT 0x20
-#define IMR_TXB_INT 0x10
-
-/* If we need a delay.... */
-#define DELAY(x) {int i; for (i=0; i<x*10000; i++); }
-
-#define istart(rs) \
- (WR_ADR(u_char, rs->opset_port, (RTS_BIT | DTR_BIT) << (rs)->a_or_b))
-
-#define istop(rs) \
- (WR_ADR(u_char, rs->opclr_port, RTS_BIT << (rs)->a_or_b))
-
-#define get_dcd(rs) \
- (RD_ADR(u_char, rs->ip_port) & (DCD_BIT << (1-rs->a_or_b)))
-
-#define tx_rdy(rs) \
- (RD_ADR(u_char, rs->stat_port) & SR_TX_RDY)
-
-/* Interrupts on and off. */
-#define tx_ints_off(rs) \
- { rs->uart->imr_int_bits &= ~((IMR_TX_INT) << (4*rs->a_or_b)); \
- WR_ADR (u_char, rs->uart->imr_port, rs->uart->imr_int_bits); }
-
-#define tx_ints_on(rs) \
- { rs->uart->imr_int_bits |= (IMR_TX_INT) << (4*rs->a_or_b); \
- WR_ADR (u_char, rs->uart->imr_port, rs->uart->imr_int_bits); }
-
-#define rx_ints_off(rs) \
- { rs->uart->imr_int_bits &= ~((IMR_RX_INT) << (4*rs->a_or_b)); \
- WR_ADR (u_char, rs->uart->imr_port, rs->uart->imr_int_bits); }
-
-#define rx_ints_on(rs) \
- { rs->uart->imr_int_bits |= (IMR_RX_INT) << (4*rs->a_or_b); \
- WR_ADR (u_char, rs->uart->imr_port, rs->uart->imr_int_bits); }
-
-/* Structure definitions. */
-typedef unsigned long port_t;
-
-/* The DUART description table */
-struct duart_info {
- char i_speed[2], o_speed[2]; /* Channel A and B speeds. */
- char i_code[2], o_code[2]; /* Channel A and B speeds. */
- char speed_grp; /* ACR bit 7 */
- char acr_int_bits; /* ACR bits 0-6 */
- char imr_int_bits; /* IMR bits current set. */
-
- port_t isr_port;
- port_t imr_port;
- port_t ipcr_port;
- port_t opcr_port;
-};
-
-/* RS232 device structure, one per device. */
-struct rs232_s {
- int unit; /* unit number of this line (base 0) */
- struct duart_info *uart; /* pointer to uart struct */
- char a_or_b; /* 0 => A, 1 => B */
-
- long scn_bits; /* Temp! for TIOCM ... */
-
- port_t xmit_port; /* i/o ports */
- port_t recv_port;
- port_t mr_port;
- port_t stat_port; /* sra or srb */
- port_t speed_port; /* csra or csrb */
- port_t cmd_port; /* cra or crb */
- port_t acr_port;
- port_t ip_port;
- port_t opset_port;
- port_t opclr_port;
-
- unsigned char lstatus; /* last line status */
- unsigned framing_errors; /* error counts (no reporting yet) */
- unsigned overrun_errors;
- unsigned parity_errors;
- unsigned break_interrupts;
-
-};
-
diff --git a/sys/arch/pc532/include/ansi.h b/sys/arch/pc532/include/ansi.h
deleted file mode 100644
index fcdfde20c2e..00000000000
--- a/sys/arch/pc532/include/ansi.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* $NetBSD: ansi.h,v 1.8 1996/11/15 22:38:56 jtc Exp $ */
-
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ansi.h 8.2 (Berkeley) 1/4/94
- */
-
-#ifndef _ANSI_H_
-#define _ANSI_H_
-
-/*
- * Types which are fundamental to the implementation and may appear in
- * more than one standard header are defined here. Standard headers
- * then use:
- * #ifdef _BSD_SIZE_T_
- * typedef _BSD_SIZE_T_ size_t;
- * #undef _BSD_SIZE_T_
- * #endif
- */
-#define _BSD_CLOCK_T_ unsigned long /* clock() */
-#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */
-#define _BSD_SIZE_T_ unsigned int /* sizeof() */
-#define _BSD_SSIZE_T_ int /* byte count or error */
-#define _BSD_TIME_T_ int /* time() */
-#define _BSD_VA_LIST_ char * /* va_list */
-#define _BSD_CLOCKID_T_ int
-#define _BSD_TIMER_T_ int
-
-/*
- * Runes (wchar_t) is declared to be an ``int'' instead of the more natural
- * ``unsigned long'' or ``long''. Two things are happening here. It is not
- * unsigned so that EOF (-1) can be naturally assigned to it and used. Also,
- * it looks like 10646 will be a 31 bit standard. This means that if your
- * ints cannot hold 32 bits, you will be in trouble. The reason an int was
- * chosen over a long is that the is*() and to*() routines take ints (says
- * ANSI C), but they use _RUNE_T_ instead of int. By changing it here, you
- * lose a bit of ANSI conformance, but your programs will still work.
- *
- * Note that _WCHAR_T_ and _RUNE_T_ must be of the same type. When wchar_t
- * and rune_t are typedef'd, _WCHAR_T_ will be undef'd, but _RUNE_T remains
- * defined for ctype.h.
- */
-#define _BSD_WCHAR_T_ int /* wchar_t */
-#define _BSD_WINT_T_ int /* wint_t */
-#define _BSD_RUNE_T_ int /* rune_t */
-
-/*
- * We describe off_t here so its declaration can be visible to
- * stdio without pulling in all of <sys/type.h>, thus appeasing ANSI.
- */
-#define _BSD_OFF_T_ long long /* file offset */
-
-#endif /* _ANSI_H_ */
diff --git a/sys/arch/pc532/include/asm.h b/sys/arch/pc532/include/asm.h
deleted file mode 100644
index f5b55b12f9e..00000000000
--- a/sys/arch/pc532/include/asm.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* $NetBSD: asm.h,v 1.6 1996/01/26 08:10:10 phil Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1992 Carnegie Mellon University
- * Copyright (c) 1992 Helsinki University of Technology
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON AND HELSINKI UNIVERSITY OF TECHNOLOGY ALLOW FREE USE
- * OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON AND
- * HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIM ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-
-/*
- * File: asm.h
- * Author: Johannes Helander, Tero Kivinen, Tatu Ylonen
- * Modified by Phil Nelson for NetBSD.
- * Modified by Matthias Pfaller for PIC.
- * Helsinki University of Technology 1992.
- */
-
-#ifndef _MACHINE_ASM_H_
-#define _MACHINE_ASM_H_
-
-#ifdef __STDC__
-#define CAT(a, b) a ## b
-#define EX(x) _ ## x
-#define LEX(x) _ ## x ## :
-#else
-#define CAT(a, b) a/**/b
-#define EX(x) _/**/x
-#define LEX(x) _/**/x/**/:
-#endif
-
-#define FRAME enter [],0
-#define EMARF exit []
-
-#define S_ARG0 4(sp)
-#define S_ARG1 8(sp)
-#define S_ARG2 12(sp)
-#define S_ARG3 16(sp)
-
-#define B_ARG0 8(fp)
-#define B_ARG1 12(fp)
-#define B_ARG2 16(fp)
-#define B_ARG3 20(fp)
-
-#define ALIGN 0
-
-#ifdef PIC
-#define PIC_PROLOGUE \
- sprd sb,tos; \
- addr __GLOBAL_OFFSET_TABLE_(pc),r1; \
- lprd sb,r1
-#define PIC_EPILOGUE \
- lprd sb,tos
-#define PIC_GOT(x) 0(x(sb))
-
-#define PIC_S_ARG0 8(sp)
-#define PIC_S_ARG1 12(sp)
-#define PIC_S_ARG2 16(sp)
-#define PIC_S_ARG3 20(sp)
-#else
-#define PIC_PROLOGUE
-#define PIC_EPILOGUE
-#define PIC_GOT(x) x(pc)
-
-#define PIC_S_ARG0 4(sp)
-#define PIC_S_ARG1 8(sp)
-#define PIC_S_ARG2 12(sp)
-#define PIC_S_ARG3 16(sp)
-#endif
-
-#ifdef PROF
-#define MC1 .data; 1:; .long 0; .text
-#define MC2 addr 1b(pc),r0; bsr mcount
-#else
-#define MC1
-#define MC2
-#endif
-
-#define DECL(x) MC1; .globl x; .type x,@function; .align ALIGN; CAT(x,:); MC2
-
-#define ENTRY(x) DECL(EX(x))
-#define Entry(x) DECL(EX(x))
-#define ASENTRY(x) DECL(x)
-#define ASMSTR .asciz
-
-#define SVC svc
-
-#endif
diff --git a/sys/arch/pc532/include/cdefs.h b/sys/arch/pc532/include/cdefs.h
deleted file mode 100644
index 06dcfa332d2..00000000000
--- a/sys/arch/pc532/include/cdefs.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* $NetBSD: cdefs.h,v 1.2 1995/03/23 20:10:38 jtc Exp $ */
-
-/*
- * Written by J.T. Conklin <jtc@wimsey.com> 01/17/95.
- * Public domain.
- */
-
-#ifndef _MACHINE_CDEFS_H_
-#define _MACHINE_CDEFS_H_
-
-#ifdef __STDC__
-#define _C_LABEL(x) _STRING(_ ## x)
-#else
-#define _C_LABEL(x) _STRING(_/**/x)
-#endif
-
-#ifdef __GNUC__
-#ifdef __STDC__
-#define __indr_reference(sym,alias) \
- __asm__(".stabs \"_" #alias "\",11,0,0,0"); \
- __asm__(".stabs \"_" #sym "\",1,0,0,0")
-#define __warn_references(sym,msg) \
- __asm__(".stabs \"" msg "\",30,0,0,0"); \
- __asm__(".stabs \"_" #sym "\",1,0,0,0")
-#else
-#define __indr_reference(sym,alias) \
- __asm__(".stabs \"_/**/alias\",11,0,0,0"); \
- __asm__(".stabs \"_/**/sym\",1,0,0,0")
-#define __warn_references(sym,msg) \
- __asm__(".stabs msg,30,0,0,0"); \
- __asm__(".stabs \"_/**/sym\",1,0,0,0")
-#endif
-#else
-#define __warn_references(sym,msg) /* nothing */
-#endif
-
-#endif /* !_MACHINE_CDEFS_H_ */
diff --git a/sys/arch/pc532/include/cpu.h b/sys/arch/pc532/include/cpu.h
deleted file mode 100644
index 1c4199407bd..00000000000
--- a/sys/arch/pc532/include/cpu.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/* $OpenBSD: cpu.h,v 1.2 1998/03/01 00:37:46 niklas Exp $ */
-/* $NetBSD: cpu.h,v 1.12 1995/06/28 02:55:56 cgd Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)cpu.h 5.4 (Berkeley) 5/9/91
- */
-
-#ifndef _MACHINE_CPU_H_
-#define _MACHINE_CPU_H_
-/*
- * Definitions unique to ns532 cpu support.
- *
- * modified from 386 code for the pc532 by Phil Nelson (12/92)
- */
-
-#include "machine/psl.h"
-#include "machine/frame.h"
-
-/*
- * definitions of cpu-dependent requirements
- * referenced in generic code
- */
-#define cpu_swapin(p) /* nothing */
-#define cpu_set_init_frame(p,fp) (p)->p_md.md_regs = fp
-#define cpu_swapout(p) panic("cpu_swapout: can't get here");
-
-/* XXX needed? PAN
- * function vs. inline configuration;
- * these are defined to get generic functions
- * rather than inline or machine-dependent implementations
- */
-#define NEED_MINMAX /* need {,i,l,ul}{min,max} functions */
-#define NEED_FFS /* need ffs function */
-#define NEED_BCMP /* need bcmp function */
-#define NEED_STRLEN /* need strlen function */
-
-/*
- * Arguments to hardclock, softclock and gatherstats
- * encapsulate the previous machine state in an opaque
- * clockframe; for now, use generic intrframe.
- */
-
-#define clockframe intrframe
-
-#define CLKF_USERMODE(framep) ((framep)->if_psr & PSR_USR)
-#define CLKF_BASEPRI(framep) ((framep)->if_pl == imask[IPL_ZERO])
-#define CLKF_PC(framep) ((framep)->if_pc)
-#define CLKF_INTR(frame) (0) /* XXX should have an interrupt stack */
-
-#ifdef _KERNEL
-#include <machine/icu.h>
-#endif
-
-/*
- * Preempt the current process if in interrupt from user mode,
- * or after the current trap/syscall if in system mode.
- */
-int want_resched; /* resched() was called */
-#define need_resched() (want_resched = 1, setsoftast())
-
-/*
- * Give a profiling tick to the current process from the softclock
- * interrupt. On the pc532, request an ast to send us through trap(),
- * marking the proc as needing a profiling tick.
- */
-#define profile_tick(p, framep) ((p)->p_flag |= P_OWEUPC, setsoftast())
-#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, setsoftast())
-
-/*
- * Notify the current process (p) that it has a signal pending,
- * process as soon as possible.
- */
-#define signotify(p) setsoftast()
-
-/*
- * CTL_MACHDEP definitions.
- */
-#define CPU_CONSDEV 1 /* dev_t: console terminal device */
-#define CPU_MAXID 2 /* number of valid machdep ids */
-
-#define CTL_MACHDEP_NAMES { \
- { 0, 0 }, \
- { "console_device", CTLTYPE_STRUCT }, \
-}
-
-#ifdef _KERNEL
-
-/*
- * Prototypes from pmap.c:
- */
-void pmap_bootstrap __P((vm_offset_t, vm_offset_t));
-vm_offset_t pmap_map __P((vm_offset_t, vm_offset_t, vm_offset_t, int));
-
-#endif /* _KERNEL */
-
-#endif
diff --git a/sys/arch/pc532/include/cpufunc.h b/sys/arch/pc532/include/cpufunc.h
deleted file mode 100644
index 4d9e46b824a..00000000000
--- a/sys/arch/pc532/include/cpufunc.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* $NetBSD: cpufunc.h,v 1.1 1996/01/26 05:37:16 phil Exp $ */
-
-/*
- * Copyright (c) 1996 Matthias Pfaller.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Matthias Pfaller.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _NS532_CPUFUNC_H_
-#define _NS532_CPUFUNC_H_
-
-/*
- * Load a mmu register.
- */
-#define lmr(reg, src) __asm __volatile("lmr " #reg ",%0" : : "g" (src))
-
-/*
- * Store a mmu register.
- */
-#define smr(reg, dst) __asm __volatile("smr " #reg ",%0" : "=g" (dst) :)
-
-/*
- * Load the FPU status register.
- */
-#define lfsr(src) __asm __volatile("lfsr %0" : : "g" (src))
-
-/*
- * Store the FPU status register.
- */
-#define sfsr(src) __asm __volatile("sfsr %0" : "=g" (src) :)
-
-/*
- * Load a processor register.
- */
-#define lprd(reg, src) __asm __volatile("lprd " #reg ",%0" : : "g" (src))
-#define lprw(reg, src) __asm __volatile("lprw " #reg ",%0" : : "g" (src))
-#define lprb(reg, src) __asm __volatile("lprb " #reg ",%0" : : "g" (src))
-
-/*
- * Store a processor register.
- */
-#define sprd(reg, dst) __asm __volatile("sprd " #reg ",%0" : "=g" (dst) :)
-#define sprw(reg, dst) __asm __volatile("sprw " #reg ",%0" : "=g" ((short) (dst)) :)
-#define sprb(reg, dst) __asm __volatile("sprb " #reg ",%0" : "=g" ((char) (dst)) :)
-
-/*
- * Move data. This can be used to force
- * gcc to load a register variable.
- */
-#define movd(src, dst) __asm __volatile("movd %1,%0" : "=g" (dst) : "g" (src))
-
-/*
- * Load the ptb. This loads ptb0 and ptb1 to
- * avoid a cpu-bug when using dual address
- * space instructions.
- */
-#define load_ptb(src) __asm __volatile("lmr ptb0,%0; lmr ptb1,%0" : : "g" (src))
-
-/*
- * Flush tlb. Just to be save this flushes
- * kernelmode and usermode translations.
- */
-#define tlbflush() __asm __volatile("smr ptb0,r0; lmr ptb0,r0; lmr ptb1,r0" : : : "r0")
-
-/*
- * Bits in the cfg register.
- */
-#define CFG_I 0x0001 /* Enable vectored interrupts */
-#define CFG_F 0x0002 /* Enable floating-point instruction set */
-#define CFG_M 0x0004 /* Enable memory management instruction set */
-#define CFG_ONE 0x00f0 /* Must be one */
-#define CFG_DE 0x0100 /* Enable direct exception mode */
-#define CFG_DC 0x0200 /* Enable data cache */
-#define CFG_LDC 0x0400 /* Lock data cache */
-#define CFG_IC 0x0800 /* Enable instruction cache */
-#define CFG_LIC 0x1000 /* Lock instruction cache */
-#define CFG_PF 0x2000 /* Enable pipelined floating-point execution */
-
-#endif /* !_NS532_CPUFUNC_H_ */
diff --git a/sys/arch/pc532/include/db_machdep.h b/sys/arch/pc532/include/db_machdep.h
deleted file mode 100644
index cfff2199bf5..00000000000
--- a/sys/arch/pc532/include/db_machdep.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* $NetBSD: db_machdep.h,v 1.3 1994/10/26 08:24:24 cgd Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1992 Carnegie Mellon University
- * Copyright (c) 1992 Helsinki University of Technology
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON AND HELSINKI UNIVERSITY OF TECHNOLOGY ALLOW FREE USE
- * OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON AND
- * HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIM ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-/*
- * HISTORY
- * 11-May-92 Tero Kivinen (kivinen) at Helsinki University of Technology
- * Created.
- *
- */
-/*
- * File: ns532/db_machdep.h
- * Author: Tero Kivinen, Helsinki University of Technology 1992.
- *
- * Machine-dependent defines for kernel debugger.
- *
- * modified by Phil Nelson for inclusion in 532bsd.
- *
- */
-
-#ifndef _MACHINE_DB_MACHDEP_H_
-#define _MACHINE_DB_MACHDEP_H_
-
-/* #include <mach/ns532/vm_types.h> */
-/* #include <mach/ns532/vm_param.h> */
-#include <vm/vm_prot.h>
-#include <vm/vm_param.h>
-#include <vm/vm_inherit.h>
-#include <vm/lock.h>
-
-/* #include <ns532/thread.h> /* for thread_status */
-#include <machine/frame.h> /* For struct trapframe */
-
-#include <machine/psl.h>
-#include <machine/trap.h>
-
-typedef vm_offset_t db_addr_t; /* address - unsigned */
-typedef int db_expr_t; /* expression - signed */
-
-typedef struct ns532_saved_state db_regs_t;
-db_regs_t ddb_regs; /* register state */
-#define DDB_REGS (&ddb_regs)
-
-#define PC_REGS(regs) ((db_addr_t)(regs)->pc)
-
-#define BKPT_INST 0xf2 /* breakpoint instruction */
-#define BKPT_SIZE (1) /* size of breakpoint inst */
-#define BKPT_SET(inst) (BKPT_INST)
-
-#define db_clear_single_step(regs) ((regs)->psr &= ~PSR_T)
-#define db_set_single_step(regs) ((regs)->psr |= PSR_T)
-
-#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BPT)
-#define IS_WATCHPOINT_TRAP(type, code) ((type) == T_WATCHPOINT)
-
-#define I_BSR 0x02
-#define I_JSR 0x7f /* and low 3 bits of next byte are 0x6 */
-#define I_RET 0x12
-#define I_RETT 0x42
-#define I_RETI 0x52
-
-#define inst_trap_return(ins) (((ins)&0xff) == I_RETT || \
- ((ins)&0xff) == I_RETI)
-#define inst_return(ins) (((ins)&0xff) == I_RET)
-#define inst_call(ins) (((ins)&0xff) == I_BSR || \
- (((ins)&0xff) == I_JSR && \
- ((ins)&0x0700) == 0x0600))
-
-#define inst_load(ins) 0
-#define inst_store(ins) 0
-
-extern int db_active_ipl;
-
-/* access capability and access macros */
-
-#define DB_ACCESS_LEVEL 2 /* access any space */
-#define DB_CHECK_ACCESS(addr,size,task) \
- db_check_access(addr,size,task)
-#define DB_PHYS_EQ(task1,addr1,task2,addr2) \
- db_phys_eq(task1,addr1,task2,addr2)
-#define DB_VALID_KERN_ADDR(addr) \
- ((addr) >= VM_MIN_KERNEL_ADDRESS && \
- (addr) < VM_MAX_KERNEL_ADDRESS)
-#define DB_VALID_ADDRESS(addr,user) \
- ((!(user) && DB_VALID_KERN_ADDR(addr)) || \
- ((user) && (addr) < VM_MIN_KERNEL_ADDRESS))
-
-boolean_t db_check_access(/* vm_offset_t, int, task_t */);
-boolean_t db_phys_eq(/* task_t, vm_offset_t, task_t, vm_offset_t */);
-
-/* macros for printing OS server dependent task name */
-
-#define DB_TASK_NAME(task) db_task_name(task)
-#define DB_TASK_NAME_TITLE "COMMAND "
-#define DB_TASK_NAME_LEN 23
-#define DB_NULL_TASK_NAME "? "
-
-void db_task_name(/* task_t */);
-
-/* macro for checking if a thread has used floating point */
-
-#define db_thread_fp_used(thread) ((thread)->pcb->fps && (thread)->pcb->fps->valid)
-
-#endif
diff --git a/sys/arch/pc532/include/disklabel.h b/sys/arch/pc532/include/disklabel.h
deleted file mode 100644
index 0142c9807e4..00000000000
--- a/sys/arch/pc532/include/disklabel.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* $NetBSD: disklabel.h,v 1.1 1994/10/14 18:27:14 cgd Exp $ */
-
-/*
- * Copyright (c) 1994 Christopher G. Demetriou
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christopher G. Demetriou.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_DISKLABEL_H_
-#define _MACHINE_DISKLABEL_H_
-
-#define LABELSECTOR 0 /* sector containing label */
-#define LABELOFFSET 64 /* offset of label in sector */
-#define MAXPARTITIONS 8 /* number of partitions */
-#define RAW_PART 2 /* raw partition: xx?c */
-
-/* Just a dummy */
-struct cpu_disklabel {
- int cd_dummy; /* must have one element. */
-};
-
-#endif /* _MACHINE_DISKLABEL_H_ */
diff --git a/sys/arch/pc532/include/endian.h b/sys/arch/pc532/include/endian.h
deleted file mode 100644
index 7ce75030424..00000000000
--- a/sys/arch/pc532/include/endian.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $OpenBSD: endian.h,v 1.7 1999/05/10 16:02:14 espie Exp $ */
-
-/*-
- * Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Niklas Hallqvist.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _PC532_ENDIAN_H_
-#define _PC532_ENDIAN_H_
-
-#ifdef __GNUC__
-
-#define __swap32md(x) ({ \
- u_int32_t __swap32md_x = (x); \
- \
- __asm ("rotw 8,%1; rotd 16,%1; rotw 8,%1" : \
- "=r" (__swap32md_x) : "0" (__swap32md_x)); \
- __swap32md_x; \
-})
-
-#define __swap16md(x) ({ \
- u_int16_t __swap16md_x = (x); \
- \
- __asm ("rotw 8,%1" : "=r" (__swap16md_x) : "0" (__swap16md_x)); \
- __swap16md_x; \
-})
-
-/* Tell sys/endian.h we have MD variants of the swap macros. */
-#define MD_SWAP
-
-#endif /* __GNUC__ */
-
-#define BYTE_ORDER LITTLE_ENDIAN
-#include <sys/endian.h>
-
-#endif /* _PC532_ENDIAN_H_ */
diff --git a/sys/arch/pc532/include/exec.h b/sys/arch/pc532/include/exec.h
deleted file mode 100644
index 6628ce8520e..00000000000
--- a/sys/arch/pc532/include/exec.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $NetBSD: exec.h,v 1.7 1994/10/26 08:24:26 cgd Exp $ */
-
-/*
- * Copyright (c) 1993 Paul Kranenburg
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _PC532_EXEC_H_
-#define _PC532_EXEC_H_
-
-#define __LDPGSZ 4096
-
-/* Relocation format. */
-struct relocation_info_pc532 {
- int r_address; /* offset in text or data segment */
- unsigned int r_symbolnum : 22, /* ordinal number of add symbol */
- r_copy : 1, /* run time copy */
- r_relative : 1, /* load address relative */
- r_pcrel : 1, /* 1 if value should be pc-relative */
- r_length : 2, /* log base 2 of value's width */
- r_extern : 1, /* 1 if need to add symbol to value */
- r_jmptable : 1, /* relocate to jump table */
- r_disp : 2, /* ns32k data type */
- r_baserel : 1; /* linkage table relative */
-};
-#define relocation_info relocation_info_pc532
-
-#define ARCH_ELFSIZE 32
-
-#define ELF_TARG_CLASS ELFCLASS32
-#define ELF_TARG_DATA ELFDATA2LSB
-#define ELF_TARG_MACH EM_32K
-
-#define _NLIST_DO_AOUT
-
-#define _KERN_DO_AOUT
-
-#endif /* _PC532_EXEC_H_ */
diff --git a/sys/arch/pc532/include/float.h b/sys/arch/pc532/include/float.h
deleted file mode 100644
index 6dcf8d9ea44..00000000000
--- a/sys/arch/pc532/include/float.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* $NetBSD: float.h,v 1.7 1995/06/20 20:45:48 jtc Exp $ */
-
-/*
- * Copyright (c) 1989 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)float.h 7.1 (Berkeley) 5/8/90
- */
-
-#ifndef _PC532_FLOAT_H_
-#define _PC532_FLOAT_H_
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-int __flt_rounds __P((void));
-__END_DECLS
-
-#define FLT_RADIX 2 /* b */
-#define FLT_ROUNDS __flt_rounds()
-
-#define FLT_MANT_DIG 24 /* p */
-#define FLT_EPSILON 1.19209290E-07F /* b**(1-p) */
-#define FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */
-#define FLT_MIN_EXP (-125) /* emin */
-#define FLT_MIN 1.17549435E-38F /* b**(emin-1) */
-#define FLT_MIN_10_EXP (-37) /* ceil(log10(b**(emin-1))) */
-#define FLT_MAX_EXP 128 /* emax */
-#define FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */
-#define FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */
-
-#define DBL_MANT_DIG 53
-#define DBL_EPSILON 2.2204460492503131E-16
-#define DBL_DIG 15
-#define DBL_MIN_EXP (-1021)
-#define DBL_MIN 2.2250738585072014E-308
-#define DBL_MIN_10_EXP (-307)
-#define DBL_MAX_EXP 1024
-#define DBL_MAX 1.7976931348623157E+308
-#define DBL_MAX_10_EXP 308
-
-#define LDBL_MANT_DIG DBL_MANT_DIG
-#define LDBL_EPSILON DBL_EPSILON
-#define LDBL_DIG DBL_DIG
-#define LDBL_MIN_EXP DBL_MIN_EXP
-#define LDBL_MIN DBL_MIN
-#define LDBL_MIN_10_EXP DBL_MIN_10_EXP
-#define LDBL_MAX_EXP DBL_MAX_EXP
-#define LDBL_MAX DBL_MAX
-#define LDBL_MAX_10_EXP DBL_MAX_10_EXP
-
-#endif /* _PC532_FLOAT_H_ */
diff --git a/sys/arch/pc532/include/frame.h b/sys/arch/pc532/include/frame.h
deleted file mode 100644
index 674f8eb7d5d..00000000000
--- a/sys/arch/pc532/include/frame.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* $NetBSD: frame.h,v 1.4 1994/10/26 08:24:28 cgd Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)frame.h 5.2 (Berkeley) 1/18/91
- */
-
-#ifndef _MACHINE_FRAME_H_
-#define _MACHINE_FRAME_H_
-
-#include <sys/signal.h>
-#include <machine/reg.h>
-
-/*
- * System stack frames.
- */
-
-/*
- * Exception/Trap Stack Frame
- */
-
-struct trapframe {
- long tf_msr; /* For abt. 0 for others. */
- long tf_tear; /* For abt. 0 for others. */
- long tf_trapno;
- long tf_reg[8]; /* R7 - R0 from enter */
- long tf_usp;
- long tf_sb;
- long tf_fp; /* From enter */
- /* below portion defined in 532 hardware */
- long tf_pc;
- u_short tf_mod; /* Not used in direct excption mode. */
- u_short tf_psr;
-};
-
-/* Interrupt stack frame */
-
-struct intrframe {
- long if_vec;
- long if_pl; /* the "processor level" for clock. */
- long if_reg[8]; /* R7 - R0 from enter */
- long if_usp;
- long if_sb;
- long if_fp; /* From enter */
- /* below portion defined in 532 hardware */
- long if_pc;
- u_short if_mod; /* Not used in direct excption mode. */
- u_short if_psr;
-};
-
-/*
- * System Call Stack Frame
- */
-
-struct syscframe {
- long sf_reg[8]; /* R7 - R0 from enter */
- long sf_usp;
- long sf_sb;
- long sf_fp; /* From enter */
- /* below portion defined in 532 hardware */
- long sf_pc;
- u_short sf_mod; /* Not used in direct excption mode. */
- u_short sf_psr;
-};
-
-/*
- * Signal frame
- */
-struct sigframe {
- int sf_signum;
- int sf_code;
- struct sigcontext *sf_scp;
- sig_t sf_handler;
- struct sigcontext sf_sc;
-} ;
-
-#endif
diff --git a/sys/arch/pc532/include/icu.h b/sys/arch/pc532/include/icu.h
deleted file mode 100644
index e669036e5d1..00000000000
--- a/sys/arch/pc532/include/icu.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* $NetBSD: icu.h,v 1.5 1995/08/25 07:52:18 phil Exp $ */
-
-/*
- * Copyright (c) 1993 Philip A. Nelson.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Philip A. Nelson.
- * 4. The name of Philip A. Nelson may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY PHILIP NELSON ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL PHILIP NELSON BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * icu.h
- */
-
-/* icu.h: defines for use with the ns32532 icu. */
-
-#ifndef _MACHINE_ICU_H_
-#define _MACHINE_ICU_H_
-
-/* We don't use vector interrupts, but make it right anyway */
-#define VEC_ICU 0x10
-
-/* The address of the ICU! */
-#define ICU_ADR 0xfffffe00
-
-/* ICU clock speed. */
-#define ICU_CLK_HZ 3686400/4 /* raw ICU clock speed */
-
-/* ICU registers
- */
-#define HVCT 0
-#define SVCT 1
-#define ELTG 2
-#define TPL 4
-#define IPND 6
-#define ISRV 8
-#define IMSK 10
-#define CSRC 12
-#define FPRT 14
-#define MCTL 16
-#define OCASN 17
-#define CIPTR 18
-#define PDAT 19
-#define IPS 20
-#define PDIR 21
-#define CCTL 22
-#define CICTL 23
-#define LCSV 24
-#define HCSV 26
-#define LCCV 28
-#define HCCV 30
-
-/* Byte and Word access to ICU registers
- */
-#define ICUB(n) *((unsigned char *)(ICU_ADR + n))
-#define ICUW(n) *((unsigned short *)(ICU_ADR + n))
-
-#ifndef LOCORE
-/* Interrupt trigger modes
- */
-enum {HIGH_LEVEL, LOW_LEVEL, RISING_EDGE, FALLING_EDGE} int_modes;
-#endif /* !LOCORE */
-
-/* Hardware interrupt request lines.
- */
-#define IR_CLK 2 /* highest priority */
-#define IR_SCSI0 5 /* Adaptec 6250 */
-#define IR_SCSI1 4 /* NCR DP8490 */
-#define IR_TTY0 13
-#define IR_TTY0RDY 12
-#define IR_TTY1 11
-#define IR_TTY1RDY 10
-#define IR_TTY2 9
-#define IR_TTY2RDY 8
-#define IR_TTY3 7
-#define IR_TTY3RDY 6
-
-/* edge polarity
- * 0 0 falling edge
- * 0 1 rising edge
- * 1 0 low level
- * 1 1 high level
- *
- */
-#define IEDGE 0
-#define IPOLARITY 0
-
-#define ints_off bicpsrw PSR_I
-#define ints_on bispsrw PSR_I
-
-/* SCSI controllers */
-#define AIC6250 0
-#define DP8490 1
-#define ICU_SCSI_BIT 0x80
-
-#ifndef LOCORE
-/*
- * Select a SCSI controller.
- */
-static __inline int
-scsi_select_ctlr(int ctlr)
-{
- int old;
-
- old = (ICUB(PDAT) & ICU_SCSI_BIT) == 0;
- if (ctlr == DP8490)
- ICUB(PDAT) &= ~ICU_SCSI_BIT; /* select = 0 for 8490 */
- else
- ICUB(PDAT) |= ICU_SCSI_BIT; /* select = 1 for AIC6250 */
- return(old);
-}
-#endif /* !LOCORE */
-#endif /* _MACHINE_ICU_H_ */
diff --git a/sys/arch/pc532/include/ieeefp.h b/sys/arch/pc532/include/ieeefp.h
deleted file mode 100644
index 58a853dfa72..00000000000
--- a/sys/arch/pc532/include/ieeefp.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Written by J.T. Conklin, Apr 28, 1995
- * Public domain.
- */
-
-#ifndef _PC532_IEEEFP_H_
-#define _PC532_IEEEFP_H_
-
-/* defined just to keep prototypes in machine independant header happy. */
-typedef int fp_except;
-
-typedef enum {
- FP_RN=0, /* round to nearest representable number */
- FP_RZ=1, /* round to zero (truncate) */
- FP_RP=2, /* round toward positive infinity */
- FP_RM=3 /* round toward negative infinity */
-} fp_rnd;
-
-#endif /* _PC532_IEEEFP_H_ */
diff --git a/sys/arch/pc532/include/jmpbuf.h b/sys/arch/pc532/include/jmpbuf.h
deleted file mode 100644
index 4b477c7a3b5..00000000000
--- a/sys/arch/pc532/include/jmpbuf.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $NetBSD: jmpbuf.h,v 1.3 1994/10/26 08:24:30 cgd Exp $ */
-
-/*
- * Copyright (c) 1993 Philip A. Nelson.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Philip A. Nelson.
- * 4. The name of Philip A. Nelson may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY PHILIP NELSON ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL PHILIP NELSON BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * machine/setjmp.h : for support of the library routines.
- */
-
-#ifndef _MACHINE_JMPBUF_H_
-#define _MACHINE_JMPBUF_H_
-
-/* These are byte offsets into the jmp buffer. */
-
-#define JMP_BUF_R3 0
-#define JMP_BUF_R4 4
-#define JMP_BUF_R5 8
-#define JMP_BUF_R6 12
-#define JMP_BUF_R7 16
-#define JMP_BUF_PC 20
-#define JMP_BUF_SP 24
-#define JMP_BUF_FP 28
-#define JMP_BUF_SB 32
-#define JMP_BUF_SIGMASK 36
-
-#endif
diff --git a/sys/arch/pc532/include/limits.h b/sys/arch/pc532/include/limits.h
deleted file mode 100644
index c5899232d8a..00000000000
--- a/sys/arch/pc532/include/limits.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* $NetBSD: limits.h,v 1.7 1994/10/26 08:24:31 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)limits.h 7.2 (Berkeley) 6/28/90
- */
-
-#ifndef _MACHINE_LIMITS_H_
-#define _MACHINE_LIMITS_H_
-
-#define CHAR_BIT 8 /* number of bits in a char */
-#define MB_LEN_MAX 1 /* no multibyte characters */
-
-#define SCHAR_MIN (-0x7f-1) /* min value for a signed char */
-#define SCHAR_MAX 0x7f /* max value for a signed char */
-
-#define UCHAR_MAX 0xff /* max value for an unsigned char */
-#define CHAR_MAX 0x7f /* max value for a char */
-#define CHAR_MIN (-0x7f-1) /* min value for a char */
-
-#define USHRT_MAX 0xffff /* max value for an unsigned short */
-#define SHRT_MAX 0x7fff /* max value for a short */
-#define SHRT_MIN (-0x7fff-1) /* min value for a short */
-
-#define UINT_MAX 0xffffffff /* max value for an unsigned int */
-#define INT_MAX 0x7fffffff /* max value for an int */
-#define INT_MIN (-0x7fffffff-1) /* min value for an int */
-
-#define ULONG_MAX 0xffffffffUL /* max value for an unsigned long */
-#define LONG_MAX 0x7fffffff /* max value for a long */
-#define LONG_MIN (-0x7fffffff-1) /* min value for a long */
-
-#if !defined(_ANSI_SOURCE)
-#define SSIZE_MAX INT_MAX /* max value for a ssize_t */
-
-#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
-#define SIZE_T_MAX UINT_MAX /* max value for a size_t */
-
-#define UID_MAX UINT_MAX /* max value for a uid_t */
-#define GID_MAX UINT_MAX /* max value for a gid_t */
-
-#define UQUAD_MAX 0xffffffffffffffffULL /* max unsigned quad */
-#define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */
-#define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */
-#define ULLONG_MAX (UQUAD_MAX) /* max value for unsigned long long */
-#define LLONG_MAX (QUAD_MAX) /* max value for a signed long long */
-#define LLONG_MIN (QUAD_MIN) /* min value for a signed long long */
-
-#endif /* !_POSIX_SOURCE && !_XOPEN_SOURCE */
-#endif /* !_ANSI_SOURCE */
-
-#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE)
-#define LONG_BIT 32
-#define WORD_BIT 32
-
-#define DBL_DIG 15
-#define DBL_MIN 2.2250738585072014E-308
-#define DBL_MAX 1.7976931348623157E+308
-
-#define FLT_DIG 6
-#define FLT_MAX 3.40282347E+38F
-#define FLT_MIN 1.17549435E-38F
-#endif
-
-#endif /* _MACHINE_LIMITS_H_ */
diff --git a/sys/arch/pc532/include/mtpr.h b/sys/arch/pc532/include/mtpr.h
deleted file mode 100644
index c487c474e9f..00000000000
--- a/sys/arch/pc532/include/mtpr.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $NetBSD: mtpr.h,v 1.3 1994/10/26 08:24:32 cgd Exp $ */
-
-/* EMPTY */
diff --git a/sys/arch/pc532/include/param.h b/sys/arch/pc532/include/param.h
deleted file mode 100644
index cdbb0a709ee..00000000000
--- a/sys/arch/pc532/include/param.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/* $OpenBSD: param.h,v 1.2 1997/02/28 22:57:39 niklas Exp $ */
-/* $NetBSD: param.h,v 1.12 1995/06/26 06:56:05 cgd Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)param.h 5.8 (Berkeley) 6/28/91
- */
-
-/*
- * Machine dependent constants for NS 32532.
- *
- * Derived from the i386 param.h by Phil Nelson.
- *
- */
-
-#ifndef _MACHINE_PARAM_H_
-#define _MACHINE_PARAM_H_
-
-#ifdef _KERNEL
-#include <machine/cpu.h>
-#endif
-
-#define MACHINE "pc532"
-#define _MACHINE pc532
-#define MACHINE_ARCH "ns32k"
-#define _MACHINE_ARCH ns32k
-#define MID_MACHINE MID_NS32532
-
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value
- * for all data types (int, long, ...). The result is u_int and
- * must be cast to any desired pointer type.
- */
-#define ALIGNBYTES (sizeof(int) - 1)
-#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
-
-#define NBPG 4096 /* bytes/page */
-#define PGOFSET (NBPG-1) /* byte offset into page */
-#define PGSHIFT 12 /* LOG2(NBPG) */
-#define NPTEPG (NBPG/(sizeof (struct pte)))
-
-#define NBPDR (1024*NBPG) /* bytes/page dir */
-#define PDROFSET (NBPDR-1) /* byte offset into page dir */
-#define PDRSHIFT 22 /* LOG2(NBPDR) */
-
-#define KERNBASE 0xFE000000 /* start of kernel virtual */
-#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT)
-
-#define DEV_BSIZE 512
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define BLKDEV_IOSIZE 4096 /* Was 2048 (pan) */
-#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
-
-#define CLSIZE 1
-#define CLSIZELOG2 0
-
-/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
-#define SSIZE 1 /* initial stack size/NBPG */
-#define SINCR 1 /* increment of stack/NBPG */
-
-#define UPAGES 2 /* pages of u-area */
-#define USPACE (UPAGES * NBPG)
-
-/*
- * Constants related to network buffer management.
- * MCLBYTES must be no larger than CLBYTES (the software page size), and,
- * on machines that exchange pages of input or output buffers with mbuf
- * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
- * of the hardware page size.
- */
-#ifndef MSIZE
-#define MSIZE 128 /* size of an mbuf */
-#endif /* MSIZE */
-
-#ifndef MCLSHIFT
-#define MCLSHIFT 11 /* convert bytes to m_buf clusters */
-#endif /* MCLSHIFT */
-#define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */
-#define MCLOFSET (MCLBYTES - 1) /* offset within a m_buf cluster */
-
-#ifndef NMBCLUSTERS
-#define NMBCLUSTERS 512 /* map size, max cluster allocation */
-#endif
-
-/*
- * Size of kernel malloc arena in CLBYTES-sized logical pages
- */
-#ifndef NKMEMCLUSTERS
-#define NKMEMCLUSTERS (2048*1024/CLBYTES)
-#endif
-
-/*
- * Some macros for units conversion
- */
-
-/* pages ("clicks") to disk blocks */
-#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
-
-/* clicks to bytes */
-#define ctob(x) ((x) << PGSHIFT)
-#define btoc(x) (((x) + PGOFSET) >> PGSHIFT)
-
-/* bytes to disk blocks */
-#define btodb(x) ((x) >> DEV_BSHIFT)
-#define dbtob(x) ((x) << DEV_BSHIFT)
-
-
-/*
- * Map a ``block device block'' to a file system block.
- * This should be device dependent, and will be if we
- * add an entry to cdevsw/bdevsw for that purpose.
- * For now though just use DEV_BSIZE.
- */
-#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
-
-
-/*
- * Mach derived conversion macros
- */
-#define ns532_round_pdr(x) ((((unsigned)(x)) + NBPDR - 1) & ~(NBPDR-1))
-#define ns532_trunc_pdr(x) ((unsigned)(x) & ~(NBPDR-1))
-#define ns532_round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1))
-#define ns532_trunc_page(x) ((unsigned)(x) & ~(NBPG-1))
-#define ns532_btod(x) ((unsigned)(x) >> PDRSHIFT)
-#define ns532_dtob(x) ((unsigned)(x) << PDRSHIFT)
-#define ns532_btop(x) ((unsigned)(x) >> PGSHIFT)
-#define ns532_ptob(x) ((unsigned)(x) << PGSHIFT)
-
-#ifndef _KERNEL
-#define DELAY(n) { volatile int N = (n); while (--N > 0); }
-#endif
-
-/* Macros to read and write from absolute addresses. */
-
-#define WR_ADR(type,adr,val) (*((volatile type *)(adr))=(val))
-#define RD_ADR(type,adr) (*((volatile type *)(adr)))
-
-#endif
diff --git a/sys/arch/pc532/include/pcb.h b/sys/arch/pc532/include/pcb.h
deleted file mode 100644
index e9ed77517f0..00000000000
--- a/sys/arch/pc532/include/pcb.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* $NetBSD: pcb.h,v 1.6 1995/03/28 18:18:24 jtc Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pcb.h 5.10 (Berkeley) 5/12/91
- */
-
-#ifndef _MACHINE_PCB_H_
-#define _MACHINE_PCB_H_
-
-/*
- * PC 532 process control block
- *
- * Phil Nelson, 12/8/92
- *
- */
-
-/* The registers as pushed from a trap/interrupt with the
- exception of USP and SB, and they are placed by software. */
-struct on_stack {
- long pcb_reg[8]; /* R7 - R0 from enter */
- long pcb_usp; /* User stack pointer, by software. */
- long pcb_sb; /* Static Base pointer, by software. */
- long pcb_fp; /* From enter */
- long pcb_pc; /* From the trap/interrupt */
- u_short pcb_mod; /* in direct exception mode. */
- u_short pcb_psr;
-};
-
-struct pcb {
- /* Put in a pointer to the trap/interrupt frame. */
- struct on_stack *pcb_onstack;
-
- /* Floating point stuff */
- long pcb_fsr; /* fpu status reg */
- double pcb_freg[8]; /* F0 - F7 */
-
- /* Saved during a "swtch" */
-
- long pcb_ksp; /* Kernel stack -- sp0. */
- long pcb_kfp; /* Kernel fp. */
- long pcb_ptb; /* ptb0 */
- long pcb_pl; /* "processor level" */
-
-/*
- * Software pcb (extension)
- */
- u_short pcb_flags; /* Used? PAN */
- caddr_t pcb_onfault; /* copyin/out fault recovery */
-};
-
-/*
- * The pcb is augmented with machine-dependent additional data for
- * core dumps. For the pc532, there is nothing to add.
- */
-struct md_coredump {
- long md_pad[8];
-};
-
-
-#ifdef _KERNEL
-struct pcb *curpcb; /* our current running pcb */
-#endif
-
-#endif
diff --git a/sys/arch/pc532/include/pmap.h b/sys/arch/pc532/include/pmap.h
deleted file mode 100644
index 5e198f27d3e..00000000000
--- a/sys/arch/pc532/include/pmap.h
+++ /dev/null
@@ -1,241 +0,0 @@
-/* $NetBSD: pmap.h,v 1.7 1995/05/11 16:53:07 jtc Exp $ */
-
-/*
- * Copyright (c) 1991 Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and William Jolitz of UUNET Technologies Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pmap.h 7.4 (Berkeley) 5/12/91
- */
-
-/*
- * Derived from hp300 version by Mike Hibler, this version by William
- * Jolitz uses a recursive map [a pde points to the page directory] to
- * map the page tables using the pagetables themselves. This is done to
- * reduce the impact on kernel virtual memory for lots of sparse address
- * space, and to reduce the cost of memory to each process.
- *
- * from hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90
- */
-
-#ifndef _MACHINE_PMAP_H_
-#define _MACHINE_PMAP_H_
-
-/*
- * 532 page table entry and page table directory
- * Phil Nelson, 12/92
- *
- * modified from the 386 stuff by W.Jolitz, 8/89
- */
-
-struct pde /* First level PTE */
-{
-unsigned long
- pd_v:1, /* valid bit */
- pd_prot:2, /* access control */
- pd_mbz1:4, /* reserved, must be zero */
- pd_u:1, /* hardware maintained 'used' bit */
- pd_mbz2:1, /* reserved, must be zero */
- :3, /* reserved for software */
- pd_pfnum:20; /* physical page frame number of pte's*/
-};
-
-#define PD_MASK 0xffc00000 /* page directory address bits */
-#define PT_MASK 0x003ff000 /* page table address bits */
-#define PD_SHIFT 22 /* page directory address shift */
-#define PG_SHIFT 12 /* page table address shift */
-
-struct pte
-{
-unsigned int
- pg_v:1, /* valid bit */
- pg_prot:2, /* access control */
- pg_mbz1:3, /* reserved, must be zero */
- pg_nc:1, /* 'uncacheable page' bit */
- pg_u:1, /* hardware maintained 'used' bit */
- pg_m:1, /* hardware maintained modified bit */
- pg_w:1, /* software, wired down page */
- :2, /* software (unused) */
- pg_pfnum:20; /* physical page frame number */
-};
-
-#define PG_V 0x00000001
-#define PG_RO 0x00000000
-#define PG_RW 0x00000002
-#define PG_u 0x00000004
-#define PG_PROT 0x00000006 /* all protection bits . */
-#define PG_W 0x00000200 /* Wired bit (user def) */
-#define PG_N 0x00000040 /* Non-cacheable */
-#define PG_M 0x00000100
-#define PG_U 0x00000080
-#define PG_FRAME 0xfffff000
-
-
-#define PG_NOACC 0
-#define PG_KR 0x00000000
-#define PG_KW 0x00000002
-#define PG_URKR 0x00000004
-#define PG_URKW 0x00000004
-#define PG_UW 0x00000006
-
-/* Garbage for current bastardized pager that assumes a hp300 */
-#define PG_NV 0
-#define PG_CI 0
-
-/*
- * Page Protection Exception bits
- */
-
-#define PGEX_TEX 0x03 /* Which exception. */
-#define PGEX_DDT 0x04 /* Data direction: 0 => read */
-#define PGEX_UST 0x08 /* user/super 0 => supervisor */
-#define PGEX_STT 0xf0 /* CPU status. */
-
-#define PGEX_P PGEX_TEX /* Protection violation vs. not present */
-#define PGEX_W PGEX_DDT /* during a Write cycle */
-#define PGEX_U PGEX_UST /* access from User mode (UPL) */
-
-typedef struct pde pd_entry_t; /* page directory entry */
-typedef struct pte pt_entry_t; /* Mach page table entry */
-
-/*
- * One page directory, shared between
- * kernel and user modes.
- */
-#define NS532_PAGE_SIZE NBPG
-#define NS532_PDR_SIZE NBPDR
-
-#define NS532_KPDES 8 /* KPT page directory size */
-#define NS532_UPDES NBPDR/sizeof(struct pde)-8 /* UPT page directory size */
-
-#define UPTDI 0x3f6 /* ptd entry for u./kernel&user stack */
-#define PTDPTDI 0x3f7 /* ptd entry that points to ptd! */
-#define KPTDI_FIRST 0x3f8 /* start of kernel virtual pde's */
-#define KPTDI_LAST 0x3ff /* last of kernel virtual pde's */
-
-/*
- * Address of current and alternate address space page table maps
- * and directories.
- */
-#ifdef _KERNEL
-extern struct pte PTmap[], APTmap[], Upte;
-extern struct pde PTD[], APTD[], PTDpde, APTDpde, Upde;
-extern pt_entry_t *Sysmap;
-
-extern int IdlePTD; /* physical address of "Idle" state directory */
-#endif
-
-/*
- * virtual address to page table entry and
- * to physical address. Likewise for alternate address space.
- * Note: these work recursively, thus vtopte of a pte will give
- * the corresponding pde that in turn maps it.
- */
-#define vtopte(va) (PTmap + ns532_btop(va))
-#define kvtopte(va) vtopte(va)
-#define ptetov(pt) (ns532_ptob(pt - PTmap))
-#define vtophys(va) (ns532_ptob(vtopte(va)->pg_pfnum) | ((int)(va) & PGOFSET))
-#define ispt(va) ((va) >= UPT_MIN_ADDRESS && (va) <= KPT_MAX_ADDRESS)
-
-#define avtopte(va) (APTmap + ns532_btop(va))
-#define ptetoav(pt) (NS532_ptob(pt - APTmap))
-#define avtophys(va) (ns532_ptob(avtopte(va)->pg_pfnum) | ((int)(va) & PGOFSET))
-
-/*
- * macros to generate page directory/table indicies
- */
-
-#define pdei(va) (((va)&PD_MASK)>>PD_SHIFT)
-#define ptei(va) (((va)&PT_MASK)>>PG_SHIFT)
-
-/*
- * Pmap stuff
- */
-
-struct pmap {
- pd_entry_t *pm_pdir; /* KVA of page directory */
- boolean_t pm_pdchanged; /* pdir changed */
- short pm_dref; /* page directory ref count */
- short pm_count; /* pmap reference count */
- simple_lock_data_t pm_lock; /* lock on pmap */
- struct pmap_statistics pm_stats; /* pmap statistics */
- long pm_ptpages; /* more stats: PT pages */
-};
-
-typedef struct pmap *pmap_t;
-
-/*
- * Macros for speed
- */
-#define PMAP_ACTIVATE(pmapp, pcbp) \
- if ((pmapp) != NULL /*&& (pmapp)->pm_pdchanged */) { \
- (pcbp)->pcb_ptb = \
- pmap_extract(pmap_kernel(),(vm_offset_t)(pmapp)->pm_pdir); \
- if ((pmapp) == &curproc->p_vmspace->vm_pmap) \
- _load_ptb0((pcbp)->pcb_ptb); \
- (pmapp)->pm_pdchanged = FALSE; \
- }
-
-#define PMAP_DEACTIVATE(pmapp, pcbp)
-
-/*
- * For each vm_page_t, there is a list of all currently valid virtual
- * mappings of that page. An entry is a pv_entry_t, the list is pv_table.
- */
-typedef struct pv_entry {
- struct pv_entry *pv_next; /* next pv_entry */
- pmap_t pv_pmap; /* pmap where mapping lies */
- vm_offset_t pv_va; /* virtual address for mapping */
- int pv_flags; /* flags */
-} *pv_entry_t;
-
-#define PV_ENTRY_NULL ((pv_entry_t) 0)
-
-#define PV_CI 0x01 /* all entries must be cache inhibited */
-#define PV_PTPAGE 0x02 /* entry maps a page table page */
-
-#ifdef _KERNEL
-
-pv_entry_t pv_table; /* array of entries, one per page */
-struct pmap kernel_pmap_store;
-
-#define pa_index(pa) atop(pa - vm_first_phys)
-#define pa_to_pvh(pa) (&pv_table[pa_index(pa)])
-
-#define pmap_kernel() (&kernel_pmap_store)
-#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
-
-#endif /* _KERNEL */
-
-#endif
diff --git a/sys/arch/pc532/include/proc.h b/sys/arch/pc532/include/proc.h
deleted file mode 100644
index c4a53bfb776..00000000000
--- a/sys/arch/pc532/include/proc.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $NetBSD: proc.h,v 1.4 1994/10/26 08:24:37 cgd Exp $ */
-
-/*
- * Copyright (c) 1991 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)proc.h 7.1 (Berkeley) 5/15/91
- */
-
-#ifndef _MACHINE_PROC_H_
-#define _MACHINE_PROC_H_
-
-/*
- * Machine-dependent part of the proc structure for the pc532.
- */
-struct mdproc {
- int *md_regs; /* pointer to regs on the stack */
-};
-
-#endif
diff --git a/sys/arch/pc532/include/profile.h b/sys/arch/pc532/include/profile.h
deleted file mode 100644
index 1e1a51f222e..00000000000
--- a/sys/arch/pc532/include/profile.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $NetBSD: profile.h,v 1.4 1995/03/28 18:18:30 jtc Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)profile.h 8.1 (Berkeley) 6/11/93
- */
-
-/* pc532 version, 5/15/94.
- */
-
-#define _MCOUNT_DECL static __inline void _mcount
-
-#define MCOUNT \
-extern void mcount __P((void)) __asm("mcount"); \
-void \
-mcount() \
-{ \
- int selfpc, frompcindex; \
- /* \
- * find the return address for mcount, \
- * and the return address for mcount's caller. \
- * \
- * selfpc = pc pushed by mcount call \
- */ \
- __asm("movd 4(fp),%0" : "=r" (selfpc)); \
- /* \
- * frompcindex = pc pushed by call into self. \
- */ \
- __asm("movd 4(0(fp)),%0" : "=r" (frompcindex)); \
- _mcount(frompcindex, selfpc); \
-}
-
-#ifdef _KERNEL
-/*
- * Note that we assume splhigh() and splx() cannot call mcount()
- * recursively.
- */
-#define MCOUNT_ENTER s = splhigh()
-#define MCOUNT_EXIT splx(s)
-#endif /* _KERNEL */
diff --git a/sys/arch/pc532/include/psl.h b/sys/arch/pc532/include/psl.h
deleted file mode 100644
index 3cc8449b1df..00000000000
--- a/sys/arch/pc532/include/psl.h
+++ /dev/null
@@ -1,241 +0,0 @@
-/* $NetBSD: psl.h,v 1.13 1995/09/26 20:16:21 phil Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)psl.h 5.2 (Berkeley) 1/18/91
- */
-
-#ifndef _MACHINE_PSL_H_
-#define _MACHINE_PSL_H_
-
-/*
- * 32532 processor status longword.
- */
-#define PSL_C 0x00000001 /* carry bit */
-#define PSL_T 0x00000002 /* trace enable bit */
-#define PSL_L 0x00000004 /* less bit */
-#define PSL_V 0x00000010 /* overflow bit */
-#define PSL_F 0x00000020 /* flag bit */
-#define PSL_Z 0x00000040 /* zero bit */
-#define PSL_N 0x00000080 /* negative bit */
-
-#define PSL_USER 0x00000100 /* User mode bit */
-#define PSL_US 0x00000200 /* User stack mode bit */
-#define PSL_P 0x00000400 /* Prevent TRC trap */
-#define PSL_I 0x00000800 /* interrupt enable bit */
-
-#define PSL_USERSET (PSL_USER | PSL_US | PSL_I)
-#define PSL_USERSTATIC (PSL_USER | PSL_US | PSL_I)
-
-/* The PSR versions ... */
-#define PSR_USR PSL_USER
-
-#ifdef _KERNEL
-#include <machine/icu.h>
-/*
- * Interrupt levels
- */
-#define IPL_NONE -1
-#define IPL_ZERO 0 /* level 0 */
-#define IPL_BIO 1 /* block I/O */
-#define IPL_NET 2 /* network */
-#define IPL_TTY 3 /* terminal */
-#define IPL_CLOCK 4 /* clock */
-#define IPL_IMP 5 /* memory allocation */
-#define NIPL 6 /* number of interrupt priority levels */
-#define IPL_NAMES {"zero", "bio", "net", "tty", "clock", "imp"}
-
-/*
- * Preassigned software interrupts
- */
-#define SOFTINT 16
-#define SIR_CLOCK (SOFTINT+0)
-#define SIR_CLOCKMASK (1 << SIR_CLOCK)
-#define SIR_NET (SOFTINT+1)
-#define SIR_NETMASK ((1 << SIR_NET) | SIR_CLOCKMASK)
-#define SIR_ALLMASK 0xffff0000
-
-#ifndef LOCORE
-/*
- * Structure of the software interrupt table
- */
-struct iv {
- void (*iv_vec)();
- void *iv_arg;
- int iv_cnt;
- char *iv_use;
-};
-
-extern unsigned int imask[], Cur_pl, idisabled, sirpending, astpending;
-extern void intr_init();
-extern void check_sir();
-extern int intr_establish(int, void (*)(), void *, char *, int, int);
-extern struct iv ivt[];
-
-/*
- * Disable/Enable CPU-Interrupts
- */
-#define di() /* Removing the nop will give you *BIG* trouble */ \
- __asm __volatile("bicpsrw 0x800 ; nop" : : : "cc")
-#define ei() __asm __volatile("bispsrw 0x800" : : : "cc")
-
-/*
- * Globaly disable/enable specific interrupts
- * (overriding spl0)
- */
-#define intr_disable(ir) do { \
- di(); \
- ICUW(IMSK) = Cur_pl | (idisabled |= (1 << ir)); \
- ei(); \
- } while(0)
-
-#define intr_enable(ir) do { \
- di(); \
- ICUW(IMSK) = Cur_pl | (idisabled &= ~(1 << ir)); \
- ei(); \
- } while(0)
-
-/*
- * Add a mask to Cur_pl, and return the old value of Cur_pl.
- */
-#if !defined(NO_INLINE_SPLX) || defined(DEFINE_SPLX)
-# ifndef NO_INLINE_SPLX
-static __inline
-# endif
-int
-splraise(register int ncpl)
-{
- register int ocpl;
- di();
- ocpl = Cur_pl;
- ncpl |= ocpl;
- ICUW(IMSK) = ncpl | idisabled;
- Cur_pl = ncpl;
- ei();
- return(ocpl);
-}
-
-/*
- * Restore a value to Cur_pl (unmasking interrupts).
- *
- * NOTE: We go to the trouble of returning the old value of cpl for
- * the benefit of some splsoftclock() callers. This extra work is
- * usually optimized away by the compiler.
- */
-# ifndef DEFINE_SPLX
-static
-# endif
-# ifndef NO_INLINE_SPLX
-__inline
-# endif
-int
-splx(register int ncpl)
-{
- register int ocpl;
- di();
- ocpl = Cur_pl;
- ICUW(IMSK) = ncpl | idisabled;
- Cur_pl = ncpl;
- if (sirpending && ncpl == imask[IPL_ZERO]) {
- Cur_pl |= SIR_ALLMASK;
- check_sir();
- Cur_pl = ncpl;
- }
- ei();
- return (ocpl);
-}
-
-/*
- * This special version of splx returns with interrupts disabled.
- */
-# ifdef DEFINE_SPLX
-int
-splx_di(register int ncpl)
-{
- register int ocpl;
- di();
- ocpl = Cur_pl;
- ICUW(IMSK) = ncpl | idisabled;
- Cur_pl = ncpl;
- if (sirpending && ncpl == imask[IPL_ZERO]) {
- Cur_pl |= SIR_ALLMASK;
- check_sir();
- Cur_pl = ncpl;
- }
- return (ocpl);
-}
-# endif
-#endif
-
-/*
- * Hardware interrupt masks
- */
-#define splbio() splraise(imask[IPL_BIO])
-#define splnet() splraise(imask[IPL_NET])
-#define spltty() splraise(imask[IPL_TTY])
-#define splclock() splraise(imask[IPL_CLOCK])
-#define splimp() splraise(imask[IPL_IMP])
-#define splstatclock() splclock()
-
-/*
- * Software interrupt masks
- *
- * NOTE: spllowersoftclock() is used by hardclock() to lower the priority from
- * clock to softclock before it calls softclock().
- */
-#define spllowersoftclock() splx(SIR_CLOCKMASK|imask[IPL_ZERO])
-#define splsoftclock() splraise(SIR_CLOCKMASK)
-#define splsoftnet() splraise(SIR_NETMASK)
-
-/*
- * Miscellaneous
- */
-#define splhigh() splraise(-1)
-#define spl0() splx(imask[IPL_ZERO])
-#define splnone() spl0()
-
-/*
- * Software interrupt registration
- */
-#define softintr(n) (sirpending |= (1 << (n)))
-#define setsoftast() (astpending = 1)
-#define setsoftclock() softintr(SIR_CLOCK)
-#define setsoftnet() softintr(SIR_NET)
-
-#endif /* !LOCORE */
-#endif /* _KERNEL */
-
-#endif /* _MACHINE_PSL_H_ */
diff --git a/sys/arch/pc532/include/pte.h b/sys/arch/pc532/include/pte.h
deleted file mode 100644
index 1479088f900..00000000000
--- a/sys/arch/pc532/include/pte.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* $NetBSD: pte.h,v 1.1 1996/01/26 08:06:40 phil Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pte.h 5.5 (Berkeley) 5/9/91
- */
-
-/*
- * NS532 page table entry and page table directory
- * (derived from 386 page table entry by W.Jolitz, 8/89)
- *
- * There are two major kinds of pte's: those which have ever existed (and are
- * thus either now in core or on the swap device), and those which have
- * never existed, but which will be filled on demand at first reference.
- * There is a structure describing each. There is also an ancillary
- * structure used in page clustering.
- */
-
-#ifndef _NS532_PTE_H_
-#define _NS532_PTE_H_
-
-#define PDSHIFT 22 /* LOG2(NBPDR) */
-#define NBPD (1 << PDSHIFT) /* bytes/page dir */
-#define PDOFSET (NBPD-1) /* byte offset into page dir */
-#define NPTEPD (NBPD / NBPG)
-
-#ifndef LOCORE
-typedef int pd_entry_t; /* page directory entry */
-typedef int pt_entry_t; /* Mach page table entry */
-#endif
-
-#define PD_MASK 0xffc00000 /* page directory address bits */
-#define PT_MASK 0x003ff000 /* page table address bits */
-
-#define PG_V 0x00000001 /* present */
-#define PG_RO 0x00000000 /* read-only by user and kernel */
-#define PG_RW 0x00000002 /* read-write by user */
-#define PG_u 0x00000004 /* accessible by user */
-#define PG_PROT 0x00000006 /* all protection bits */
-#define PG_N 0x00000040 /* non-cacheable */
-#define PG_U 0x00000080 /* has been used */
-#define PG_M 0x00000100 /* has been modified */
-#define PG_W 0x00000200 /* page is wired */
-#define PG_FRAME 0xfffff000 /* page frame mask */
-
-#define PG_FZERO 0
-#define PG_FTEXT 1
-#define PG_FMAX (PG_FTEXT)
-
-#define PG_NOACC 0
-#define PG_KR 0x00000000
-#define PG_KW 0x00000002
-#define PG_URKR 0x00000004
-#define PG_URKW 0x00000004
-#define PG_UW 0x00000006
-
-#ifndef LOCORE
-#ifdef _KERNEL
-/* utilities defined in pmap.c */
-extern pt_entry_t *Sysmap;
-#endif
-#endif
-
-#endif /* _NS532_PTE_H_ */
diff --git a/sys/arch/pc532/include/ptrace.h b/sys/arch/pc532/include/ptrace.h
deleted file mode 100644
index 395182d4bc4..00000000000
--- a/sys/arch/pc532/include/ptrace.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $NetBSD: ptrace.h,v 1.6 1995/07/28 08:00:17 phil Exp $ */
-
-/*
- * Copyright (c) 1993 Christopher G. Demetriou
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christopher G. Demetriou.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software withough specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * pc532-dependent ptrace definitions
- */
-#define PT_STEP (PT_FIRSTMACH + 0)
-#define PT_GETREGS (PT_FIRSTMACH + 1)
-#define PT_SETREGS (PT_FIRSTMACH + 2)
-#define PT_GETFPREGS (PT_FIRSTMACH + 3)
-#define PT_SETFPREGS (PT_FIRSTMACH + 4)
diff --git a/sys/arch/pc532/include/reg.h b/sys/arch/pc532/include/reg.h
deleted file mode 100644
index 49c87ea3967..00000000000
--- a/sys/arch/pc532/include/reg.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* $NetBSD: reg.h,v 1.10 1995/08/29 22:40:59 phil Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)reg.h 5.5 (Berkeley) 1/18/91
- */
-
-/* Modified for the pc532... 2/1/93 by Phil Nelson
- */
-
-#ifndef _MACHINE_REG_H_
-#define _MACHINE_REG_H_
-
-/*
- * Location of the users' stored
- * registers within appropriate frame of 'trap' and 'syscall', relative to
- * base of stack frame.
- * Normal usage is u.u_ar0[XX] in kernel.
- */
-
-/* When referenced during a trap/exception and a syscall,
- registers are at these offsets from p-p_regs*/
-
-#define REG_R0 (7)
-#define REG_R1 (6)
-#define REG_R2 (5)
-#define REG_R3 (4)
-#define REG_R4 (3)
-#define REG_R5 (2)
-#define REG_R6 (1)
-#define REG_R7 (0)
-
-#define REG_SP (8)
-#define REG_SB (9)
-#define REG_FP (10)
-#define REG_PC (11)
-#define REG_PSR (12)
-
-/* The reg struct .. in the order of above. */
-
-struct reg {
- int r_r7;
- int r_r6;
- int r_r5;
- int r_r4;
- int r_r3;
- int r_r2;
- int r_r1;
- int r_r0;
-
- int r_sp;
- int r_sb;
- int r_fp;
- int r_pc;
- short r_mod;
- short r_psr;
-};
-
-struct fpreg {
- int r_fsr;
- double r_freg[8];
-};
-#endif /* _MACHINE_REG_H_ */
diff --git a/sys/arch/pc532/include/setjmp.h b/sys/arch/pc532/include/setjmp.h
deleted file mode 100644
index 5a080a0ab7c..00000000000
--- a/sys/arch/pc532/include/setjmp.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* $NetBSD: setjmp.h,v 1.1 1994/12/20 10:37:01 cgd Exp $ */
-
-/*
- * machine/setjmp.h: machine dependent setjmp-related information.
- */
-
-#define _JBLEN 10 /* size, in longs, of a jmp_buf */
diff --git a/sys/arch/pc532/include/signal.h b/sys/arch/pc532/include/signal.h
deleted file mode 100644
index 810bfd6c45a..00000000000
--- a/sys/arch/pc532/include/signal.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $NetBSD: signal.h,v 1.5 1995/01/10 19:01:36 jtc Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)signal.h 7.16 (Berkeley) 3/17/91
- */
-
-#ifndef _MACHINE_SIGNAL_H_
-#define _MACHINE_SIGNAL_H_
-
-typedef int sig_atomic_t;
-
-#ifndef _ANSI_SOURCE
-/*
- * Get the "code" values
- */
-#include <machine/trap.h>
-
-/*
- * Information pushed on stack when a signal is delivered.
- * This is used by the kernel to restore state following
- * execution of the signal handler. It is also made available
- * to the handler to allow it to restore state properly if
- * a non-standard exit is performed.
- */
-struct sigcontext {
- int sc_onstack; /* sigstack state to restore */
- int sc_mask; /* signal mask to restore */
- int sc_sp; /* sp to restore */
- int sc_fp; /* fp to restore */
- int sc_sb; /* sb to restore */
- int sc_pc; /* pc to restore */
- int sc_ps; /* psl to restore */
- int sc_reg[8]; /* The registers */
-};
-
-#endif /* !_ANSI_SOURCE */
-#endif /* !_MACHINE_SIGNAL_H_ */
diff --git a/sys/arch/pc532/include/stdarg.h b/sys/arch/pc532/include/stdarg.h
deleted file mode 100644
index ec5096edcbd..00000000000
--- a/sys/arch/pc532/include/stdarg.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* $NetBSD: stdarg.h,v 1.12 1995/12/25 23:15:34 mycroft Exp $ */
-
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)stdarg.h 8.1 (Berkeley) 6/10/93
- */
-
-#ifndef _PC532_STDARG_H_
-#define _PC532_STDARG_H_
-
-#include <machine/ansi.h>
-
-typedef _BSD_VA_LIST_ va_list;
-
-#define __va_size(type) \
- (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long))
-
-#define va_start(ap, last) \
- ((ap) = (va_list)&(last) + __va_size(last))
-
-#define va_arg(ap, type) \
- (*(type *)((ap) += __va_size(type), (ap) - __va_size(type)))
-
-#define va_end(ap) ((void)0)
-
-#endif /* !_PC532_STDARG_H_ */
diff --git a/sys/arch/pc532/include/trap.h b/sys/arch/pc532/include/trap.h
deleted file mode 100644
index 034423fa8ea..00000000000
--- a/sys/arch/pc532/include/trap.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* $NetBSD: trap.h,v 1.3 1994/10/26 08:24:44 cgd Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1992 Carnegie Mellon University
- * Copyright (c) 1992 Helsinki University of Technology
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON AND HELSINKI UNIVERSITY OF TECHNOLOGY ALLOW FREE USE
- * OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON AND
- * HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIM ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-/*
- * File: ns532/trap.h
- * Author: Tatu Ylonen, Helsinki University of Technology 1992.
- * Modified for NetBSD by Phil Nelson
- * Hardware trap vectors for ns532.
- */
-
-#ifndef _MACHINE_TRAP_H_
-#define _MACHINE_TRAP_H_
-
-#define T_NVI 0 /* non-vectored interrupt */
-#define T_NMI 1 /* non-maskable interrupt */
-#define T_ABT 2 /* abort */
-#define T_SLAVE 3 /* coprocessor trap */
-#define T_ILL 4 /* illegal operation in user mode */
-#define T_SVC 5 /* supervisor call */
-#define T_DVZ 6 /* divide by zero */
-#define T_FLG 7 /* flag instruction */
-#define T_BPT 8 /* breakpoint instruction */
-#define T_TRC 9 /* trace trap */
-#define T_UND 10 /* undefined instruction */
-#define T_RBE 11 /* restartable bus error */
-#define T_NBE 12 /* non-restartable bus error */
-#define T_OVF 13 /* integer overflow trap */
-#define T_DBG 14 /* debug trap */
-#define T_RESERVED 15 /* reserved */
-
-/* Not a real trap. */
-#define T_WATCHPOINT 17 /* watchpoint */
-
-/* To allow for preemption */
-#define T_INTERRUPT 18 /* trap code from interrupt! */
-
-/* To include system/user mode in the trap information. */
-#define T_USER 32
-
-#define PARRDU_PHYS 0x28000040 /* Read parity error */
-#define PARCLU_PHYS 0x28000050 /* Clear parity error */
-
-#define PARRDU_VM 0xFFC80040 /* Read parity error */
-#define PARCLU_VM 0xFFC80050 /* Clear parity error */
-
-/* memory management status register bits and meanings. */
-#define MSR_STT 0xf0 /* CPU status. */
-#define STT_SEQ_INS 0x80 /* Sequential instruction fetch */
-#define STT_NSQ_INS 0x90 /* Non-sequential instruction fetch */
-#define STT_DATA 0xa0 /* Data transfer */
-#define STT_RMW 0xb0 /* Read/modify/write */
-#define STT_REA 0xc0 /* Read for effective address */
-
-#define MSR_UST 0x08 /* User/supervisor */
-#define UST_USER 0x08 /* User mode is 1. Super = 0 */
-
-#define MSR_DDT 0x04 /* Data Direction */
-#define DDT_WRITE 0x04 /* Write is 1. Read is 0 */
-
-#define MSR_TEX 0x03 /* Exception kind. */
-#define TEX_PTE1 0x01 /* First level PTE invalid */
-#define TEX_PTE2 0x02 /* Second level PTE invalid */
-#define TEX_PROT 0x03 /* Protection violation */
-
-#endif
diff --git a/sys/arch/pc532/include/types.h b/sys/arch/pc532/include/types.h
deleted file mode 100644
index 099e0af4487..00000000000
--- a/sys/arch/pc532/include/types.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* $NetBSD: types.h,v 1.12 1995/12/09 04:41:41 mycroft Exp $ */
-/* $OpenBSD: types.h,v 1.5 1999/01/08 03:04:08 millert Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)types.h 7.5 (Berkeley) 3/9/91
- */
-
-#ifndef _MACHINE_TYPES_H_
-#define _MACHINE_TYPES_H_
-
-#include <sys/cdefs.h>
-
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
-typedef struct _physadr {
- int r[1];
-} *physadr;
-
-typedef struct label_t {
- int val[6];
-} label_t;
-#endif
-
-typedef unsigned long vm_offset_t;
-typedef unsigned long vm_size_t;
-
-/*
- * Basic integral types. Omit the typedef if
- * not possible for a machine/compiler combination.
- */
-#define __BIT_TYPES_DEFINED__
-typedef __signed char int8_t;
-typedef unsigned char u_int8_t;
-typedef unsigned char uint8_t;
-typedef short int16_t;
-typedef unsigned short u_int16_t;
-typedef unsigned short uint16_t;
-typedef int int32_t;
-typedef unsigned int u_int32_t;
-typedef unsigned int uint32_t;
-/* LONGLONG */
-typedef long long int64_t;
-/* LONGLONG */
-typedef unsigned long long u_int64_t;
-/* LONGLONG */
-typedef unsigned long long uint64_t;
-
-typedef int32_t register_t;
-
-#define __SWAP_BROKEN
-#define __FORK_BRAINDAMAGE
-
-#endif /* _MACHTYPES_H_ */
diff --git a/sys/arch/pc532/include/varargs.h b/sys/arch/pc532/include/varargs.h
deleted file mode 100644
index 301235c4dd4..00000000000
--- a/sys/arch/pc532/include/varargs.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* $NetBSD: varargs.h,v 1.12 1995/12/26 01:16:30 mycroft Exp $ */
-
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)varargs.h 8.2 (Berkeley) 3/22/94
- */
-
-#ifndef _PC532_VARARGS_H_
-#define _PC532_VARARGS_H_
-
-#include <machine/stdarg.h>
-
-#if __GNUC__ == 1
-#define __va_ellipsis
-#else
-#define __va_ellipsis ...
-#endif
-
-#define va_alist __builtin_va_alist
-#define va_dcl long __builtin_va_alist; __va_ellipsis
-
-#undef va_start
-#define va_start(ap) \
- ((ap) = (va_list)&__builtin_va_alist)
-
-#endif /* !_PC532_VARARGS_H_ */
diff --git a/sys/arch/pc532/include/vmparam.h b/sys/arch/pc532/include/vmparam.h
deleted file mode 100644
index cee95ebf38a..00000000000
--- a/sys/arch/pc532/include/vmparam.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/* $NetBSD: vmparam.h,v 1.6 1995/02/14 18:52:29 phil Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)vmparam.h 5.9 (Berkeley) 5/12/91
- */
-
-#ifndef _MACHINE_VMPARAM_H_
-#define _MACHINE_VMPARAM_H_
-
-/*
- * Machine dependent constants for 532.
- */
-
-/*
- * Virtual address space arrangement. On 532, both user and kernel
- * share the address space, not unlike the vax.
- * USRTEXT is the start of the user text/data space, while USRSTACK
- * is the top (end) of the user stack. Immediately above the user stack
- * resides the user structure, which is UPAGES long and contains the
- * kernel stack.
- *
- * Immediately after the user structure is the page table map, and then
- * kernal address space.
- */
-#define USRTEXT 0x1000 /* For NetBSD... */
-#define USRSTACK 0xFDBFE000
-#define BTOPUSRSTACK (0xFDC00-(UPAGES)) /* btop(USRSTACK) */
-#define LOWPAGES 0
-#define HIGHPAGES UPAGES
-
-/*
- * Virtual memory related constants, all in bytes
- */
-#define MAXTSIZ (16*1024*1024) /* max text size */
-#ifndef DFLDSIZ
-#define DFLDSIZ (24*1024*1024) /* initial data size limit */
-#endif
-#ifndef MAXDSIZ
-#define MAXDSIZ (128*1024*1024) /* max data size */
-#endif
-#ifndef DFLSSIZ
-#define DFLSSIZ (1*1024*1024) /* initial stack size limit */
-#endif
-#ifndef MAXSSIZ
-#define MAXSSIZ (8*1024*1024) /* max stack size */
-#endif
-
-/*
- * Default sizes of swap allocation chunks (see dmap.h).
- * The actual values may be changed in vminit() based on MAXDSIZ.
- * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024.
- */
-#define DMMIN 32 /* smallest swap allocation */
-#define DMMAX 4096 /* largest potential swap allocation */
-#define DMTEXT 1024 /* swap allocation for text */
-
-/*
- * Sizes of the system and user portions of the system page table.
- */
-#define SYSPTSIZE (2*NPTEPG)
-#define USRPTSIZE (2*NPTEPG)
-
-/*
- * Size of User Raw I/O map
- */
-#define USRIOSIZE 64
-
-/*
- * The size of the clock loop.
- */
-#define LOOPPAGES (maxfree - firstfree)
-
-/*
- * The time for a process to be blocked before being very swappable.
- * This is a number of seconds which the system takes as being a non-trivial
- * amount of real time. You probably shouldn't change this;
- * it is used in subtle ways (fractions and multiples of it are, that is, like
- * half of a ``long time'', almost a long time, etc.)
- * It is related to human patience and other factors which don't really
- * change over time.
- */
-#define MAXSLP 20
-
-/*
- * A swapped in process is given a small amount of core without being bothered
- * by the page replacement algorithm. Basically this says that if you are
- * swapped in you deserve some resources. We protect the last SAFERSS
- * pages against paging and will just swap you out rather than paging you.
- * Note that each process has at least UPAGES+CLSIZE pages which are not
- * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this
- * number just means a swapped in process is given around 25k bytes.
- * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81),
- * so we loan each swapped in process memory worth 100$, or just admit
- * that we don't consider it worthwhile and swap it out to disk which costs
- * $30/mb or about $0.75.
- * { wfj 6/16/89: Retail AT memory expansion $800/megabyte, loan of $17
- * on disk costing $7/mb or $0.18 (in memory still 100:1 in cost!) }
- */
-#define SAFERSS 8 /* nominal ``small'' resident set size
- protected against replacement */
-
-/*
- * DISKRPM is used to estimate the number of paging i/o operations
- * which one can expect from a single disk controller.
- */
-#define DISKRPM 60
-
-/*
- * Klustering constants. Klustering is the gathering
- * of pages together for pagein/pageout, while clustering
- * is the treatment of hardware page size as though it were
- * larger than it really is.
- *
- * KLMAX gives maximum cluster size in CLSIZE page (cluster-page)
- * units. Note that KLMAX*CLSIZE must be <= DMMIN in dmap.h.
- */
-
-#define KLMAX (4/CLSIZE)
-#define KLSEQL (2/CLSIZE) /* in klust if vadvise(VA_SEQL) */
-#define KLIN (4/CLSIZE) /* default data/stack in klust */
-#define KLTXT (4/CLSIZE) /* default text in klust */
-#define KLOUT (4/CLSIZE)
-
-/*
- * KLSDIST is the advance or retard of the fifo reclaim for sequential
- * processes data space.
- */
-#define KLSDIST 3 /* klusters advance/retard for seq. fifo */
-
-#if 0
-/*
- * Paging thresholds (see vm_sched.c).
- * Strategy of 1/19/85:
- * lotsfree is 512k bytes, but at most 1/4 of memory
- * desfree is 200k bytes, but at most 1/8 of memory
- * minfree is 64k bytes, but at most 1/2 of desfree
- */
-#define LOTSFREE (512 * 1024)
-#define LOTSFREEFRACT 4
-#define DESFREE (200 * 1024)
-#define DESFREEFRACT 8
-#define MINFREE (64 * 1024)
-#define MINFREEFRACT 2
-#endif
-
-/*
- * There are two clock hands, initially separated by HANDSPREAD bytes
- * (but at most all of user memory). The amount of time to reclaim
- * a page once the pageout process examines it increases with this
- * distance and decreases as the scan rate rises.
- */
-#define HANDSPREAD (2 * 1024 * 1024)
-
-/*
- * The number of times per second to recompute the desired paging rate
- * and poke the pagedaemon.
- */
-#define RATETOSCHEDPAGING 4
-
-/*
- * Believed threshold (in megabytes) for which interleaved
- * swapping area is desirable.
- */
-#define LOTSOFMEM 2
-
-#define mapin(pte, v, pfnum, prot) \
- {(*(int *)(pte) = ((pfnum)<<PGSHIFT) | (prot)) ; }
-
-/*
- * Mach derived constants
- */
-
-/* user/kernel map constants */
-#define VM_MIN_ADDRESS ((vm_offset_t)0)
-#define VM_MAXUSER_ADDRESS ((vm_offset_t)0xFDBFE000)
-#define UPT_MIN_ADDRESS ((vm_offset_t)0xFDC00000)
-#define UPT_MAX_ADDRESS ((vm_offset_t)0xFDFF7000)
-#define VM_MAX_ADDRESS UPT_MAX_ADDRESS
-#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)0xFDFF7000)
-#define UPDT VM_MIN_KERNEL_ADDRESS
-#define KPT_MIN_ADDRESS ((vm_offset_t)0xFDFF8000)
-#define KPT_MAX_ADDRESS ((vm_offset_t)0xFDFFF000)
-#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)0xFF7FF000)
-
-/* virtual sizes (bytes) for various kernel submaps */
-#define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES)
-#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES)
-#define VM_PHYS_SIZE (USRIOSIZE*CLBYTES)
-
-/* # of kernel PT pages (initial only, can grow dynamically) */
-#define VM_KERNEL_PT_PAGES ((vm_size_t)2) /* XXX: SYSPTSIZE */
-
-/* pcb base */
-#define pcbb(p) ((u_int)(p)->p_addr)
-
-#endif
diff --git a/sys/arch/pc532/pc532/autoconf.c b/sys/arch/pc532/pc532/autoconf.c
deleted file mode 100644
index 2012501ed2f..00000000000
--- a/sys/arch/pc532/pc532/autoconf.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/* $NetBSD: autoconf.c,v 1.16 1995/12/28 19:16:55 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)autoconf.c 7.1 (Berkeley) 5/9/91
- */
-
-/*
- * Setup the system to run on the current machine.
- *
- * Configure() is called at boot time and initializes the vba
- * device tables and the memory controller monitoring. Available
- * devices are determined (from possibilities mentioned in ioconf.c),
- * and the drivers are initialized.
- */
-
-#include <sys/param.h>
-#include <sys/disklabel.h>
-#include <sys/conf.h>
-#include <sys/systm.h>
-#include <sys/reboot.h>
-#include <sys/buf.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-
-/*
- * The following several variables are related to
- * the configuration process, and are used in initializing
- * the machine.
- */
-
-extern int cold; /* cold start flag initialized in locore.s */
-
-/*
- * Determine i/o configuration for a machine.
- */
-configure()
-{
- extern int safepri;
- int i;
- static char *ipl_names[] = IPL_NAMES;
-
- /* Start the clocks. */
- startrtclock();
-
- /* Find out what the hardware configuration looks like! */
- if (config_rootfound("membus", "membus") == 0)
- panic ("No mem bus found!");
-
- for (i = 0; i < NIPL; i++)
- printf("%s%s=%x", i?", ":"", ipl_names[i], imask[i]);
- printf("\n");
-
- safepri = imask[IPL_ZERO];
- spl0();
-
-#if GENERIC
- if ((boothowto & RB_ASKNAME) == 0)
- setroot();
- setconf();
-#else
- setroot();
-#endif
-
- /*
- * Configure swap area and related system
- * parameter based on device(s) used.
- */
- swapconf();
- dumpconf();
- cold = 0;
-}
-
-/*
- * Configure swap space and related parameters.
- */
-swapconf()
-{
- register struct swdevt *swp;
- register int nblks;
- extern int Maxmem;
-
-
- for (swp = swdevt; swp->sw_dev > 0; swp++)
- {
- unsigned d = major(swp->sw_dev);
-
- if (d >= nblkdev) break;
- if (bdevsw[d].d_psize) {
- nblks = (*bdevsw[d].d_psize)(swp->sw_dev);
- if (nblks > 0 &&
- (swp->sw_nblks == 0 || swp->sw_nblks > nblks))
- swp->sw_nblks = nblks;
- else
- swp->sw_nblks = 0;
- }
- swp->sw_nblks = ctod(dtoc(swp->sw_nblks));
-
- }
-}
-
-#define DOSWAP /* change swdevt and dumpdev */
-u_long bootdev = 0; /* should be dev_t, but not until 32 bits */
-
-static char devname[][2] = {
- 's','d', /* 0 = sd */
- 's','w', /* 1 = sw */
- 's','t', /* 2 = st */
- 'r','d', /* 3 = rd */
- 'c','d', /* 4 = cd */
-};
-
-/*
- * Attempt to find the device from which we were booted.
- * If we can do so, and not instructed not to do so,
- * change rootdev to correspond to the load device.
- */
-setroot()
-{
- int majdev, mindev, unit, part, adaptor;
- dev_t temp, orootdev;
- struct swdevt *swp;
-
- if (boothowto & RB_DFLTROOT ||
- (bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC)
- return;
- majdev = (bootdev >> B_TYPESHIFT) & B_TYPEMASK;
- if (majdev > sizeof(devname) / sizeof(devname[0]))
- return;
- adaptor = (bootdev >> B_ADAPTORSHIFT) & B_ADAPTORMASK;
- part = (bootdev >> B_PARTITIONSHIFT) & B_PARTITIONMASK;
- unit = (bootdev >> B_UNITSHIFT) & B_UNITMASK;
- mindev = (unit * MAXPARTITIONS) + part;
- orootdev = rootdev;
- rootdev = makedev(majdev, mindev);
- /*
- * If the original rootdev is the same as the one
- * just calculated, don't need to adjust the swap configuration.
- */
- if (rootdev == orootdev)
- return;
- printf("changing root device to %c%c%d%c\n",
- devname[majdev][0], devname[majdev][1],
- unit, part + 'a');
-
-#ifdef DOSWAP
- for (swp = swdevt; swp->sw_dev != NODEV; swp++) {
- if (majdev == major(swp->sw_dev) &&
- (mindev / MAXPARTITIONS)
- == (minor(swp->sw_dev) / MAXPARTITIONS)) {
- temp = swdevt[0].sw_dev;
- swdevt[0].sw_dev = swp->sw_dev;
- swp->sw_dev = temp;
- break;
- }
- }
- if (swp->sw_dev == NODEV)
- return;
-
- /*
- * If dumpdev was the same as the old primary swap device, move
- * it to the new primary swap device.
- */
- if (temp == dumpdev)
- dumpdev = swdevt[0].sw_dev;
-#endif
-}
-
-/* mem bus stuff */
-
-static int membusprobe();
-static void membusattach();
-
-struct cfdriver membuscd =
- { NULL, "membus", membusprobe, membusattach,
- DV_DULL, sizeof(struct device), NULL, 0 };
-
-static int
-membusprobe(parent, cf, aux)
- struct device *parent;
- struct cfdata *cf;
- void *aux;
-{
- return (strcmp(cf->cf_driver->cd_name, "membus") == 0);
-}
-
-static void
-membusattach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- printf ("\n");
- while (config_found(self, NULL, NULL))
- ;
-}
diff --git a/sys/arch/pc532/pc532/bcopy.s b/sys/arch/pc532/pc532/bcopy.s
deleted file mode 100644
index eb463bf8a18..00000000000
--- a/sys/arch/pc532/pc532/bcopy.s
+++ /dev/null
@@ -1,83 +0,0 @@
-/* $NetBSD: bcopy.s,v 1.6 1996/01/26 08:11:46 phil Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1992 Carnegie Mellon University
- * Copyright (c) 1992 Helsinki University of Technology
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON AND HELSINKI UNIVERSITY OF TECHNOLOGY ALLOW FREE USE
- * OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON AND
- * HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIM ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-/*
- * File: ns532/bcopy.s
- * Author: Tatu Ylonen, Jukka Virtanen
- * Helsinki University of Technology 1992.
- */
-
- .text
-
-/* ovbcopy (from, to, bcount) -- does overlapping stuff */
-
-ENTRY(bcopy)
-ENTRY(ovbcopy)
- enter [],0
- movd B_ARG0,r1 /* from */
- movd B_ARG1,r2 /* to */
- cmpd r2, r1
- bls common /* safe to do standard thing */
- movd B_ARG2,r0 /* bcount */
- addd r1, r0 /* add to start of from */
- cmpd r2, r0
- bhs common /* safe to do standard thing */
-
-/* Must do a reverse copy (and assume that the start is on a
- word boundry . . . so we move the "remaining" bytes first) */
-
- movd B_ARG2, r0 /* bcount */
- addqd -1, r0
- addd r0, r1
- addd r0, r2
- addqd 1, r0
- andd 3, r0
- movsb b /* move bytes backwards */
- addqd -3, r1 /* change to double pointer */
- addqd -3, r2 /* ditto */
- movd B_ARG2, r0
- lshd -2,r0
- movsd b /* move words backwards */
- exit []
- ret 0
-
-/* bcopy(from, to, bcount) -- non overlapping */
-
-/* ENTRY(bcopy) -- same as ovbcopy until furthur notice.... */
- enter [],0
- movd B_ARG0,r1 /* from */
- movd B_ARG1,r2 /* to */
-common: movd B_ARG2,r0 /* bcount */
- lshd -2,r0
- movsd /* move words */
- movd B_ARG2,r0
- andd 3,r0
- movsb /* move bytes */
- exit []
- ret 0
diff --git a/sys/arch/pc532/pc532/bzero.s b/sys/arch/pc532/pc532/bzero.s
deleted file mode 100644
index 470b7fc68ce..00000000000
--- a/sys/arch/pc532/pc532/bzero.s
+++ /dev/null
@@ -1,97 +0,0 @@
-/* $OpenBSD: bzero.s,v 1.3 2000/03/03 00:54:55 todd Exp $ */
-/* $NetBSD: bzero.s,v 1.3 1996/01/26 08:11:47 phil Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1992 Carnegie Mellon University
- * Copyright (c) 1992 Helsinki University of Technology
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON AND HELSINKI UNIVERSITY OF TECHNOLOGY ALLOW FREE USE
- * OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON AND
- * HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIM ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-/*
- * File: ns532/bzero.s
- * Author: Tero Kivinen, Helsinki University of Technology 1992.
- *
- */
-
-
-/*
- * bzero(char * addr, unsigned int length)
- */
-
- .text
-ENTRY(bzero)
- enter [],0
- movd B_ARG0,r1 /* addr */
- movd B_ARG1,r2 /* length */
- movd r1,r0 /* align addr */
- andd 3,r0
- cmpqd 0,r0
- beq wstart /* already aligned */
- negd r0,r0
- addqd 4,r0
- cmpd r0,r2
- bhi bytes /* not enough data to align */
-b1loop: movqb 0,0(r1) /* zero bytes */
- addqd 1,r1
- addqd -1,r2
- acbd -1,r0,b1loop
-wstart: movd r2,r0 /* length */
- lshd -6,r0
- cmpqd 0,r0
- beq phase2
-w1loop: movqd 0,0(r1) /* zero words */
- movqd 0,4(r1)
- movqd 0,8(r1)
- movqd 0,12(r1)
- movqd 0,16(r1)
- movqd 0,20(r1)
- movqd 0,24(r1)
- movqd 0,28(r1)
- movqd 0,32(r1)
- movqd 0,36(r1)
- movqd 0,40(r1)
- movqd 0,44(r1)
- movqd 0,48(r1)
- movqd 0,52(r1)
- movqd 0,56(r1)
- movqd 0,60(r1)
- addd 64,r1
- acbd -1,r0,w1loop
-phase2: movd r2,r0 /* length */
- andd 63,r0
- lshd -2,r0
- cmpqd 0,r0
- beq bytes
-w2loop: movqd 0,0(r1)
- addqd 4,r1
- acbd -1,r0,w2loop
-bytes: movd r2,r0 /* length */
- andd 3,r0
- cmpqd 0,r0
- beq done
-bloop: movqb 0,0(r1) /* zero bytes */
- addqd 1,r1
- acbb -1,r0,bloop
-done: exit []
- ret 0
diff --git a/sys/arch/pc532/pc532/clock.c b/sys/arch/pc532/pc532/clock.c
deleted file mode 100644
index 81bcc8f8353..00000000000
--- a/sys/arch/pc532/pc532/clock.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/* $NetBSD: clock.c,v 1.11 1995/05/16 07:30:46 phil Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz and Don Ahn.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)clock.c 7.2 (Berkeley) 5/12/91
- *
- */
-
-/*
- * Primitive clock interrupt routines.
- *
- * Improved by Phil Budne ... 10/17/94.
- * Pulled over code from i386/isa/clock.c (Matthias Pfaller 12/03/94).
- */
-
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-
-#include <machine/icu.h>
-
-void spinwait __P((int));
-
-void
-startrtclock()
-{
- int timer = (ICU_CLK_HZ) / hz;
-
- /* Write the timer values to the ICU. */
- WR_ADR (unsigned short, ICU_ADR + HCSV, timer);
- WR_ADR (unsigned short, ICU_ADR + HCCV, timer);
-
- /* Establish interrupt vector */
- intr_establish(IR_CLK, hardclock, NULL, "clock", IPL_CLOCK,
- FALLING_EDGE);
-}
-
-void
-cpu_initclocks()
-{
- /* enable clock interrupt */
- WR_ADR (unsigned char, ICU_ADR +CICTL, 0x30);
-}
-
-void
-spinwait(int millisecs)
-{
- DELAY(5000 * millisecs);
-}
-
-DELAY(n)
-{
- volatile int N = (n);
- while (--N > 0)
- ;
-}
-
-void
-setstatclockrate(int dummy)
-{
- printf ("setstatclockrate\n");
-}
-
-
-static int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-
-static int
-yeartoday(year)
- int year;
-{
-
- return((year % 4) ? 365 : 366);
-}
-
-int
-hexdectodec(n)
- char n;
-{
-
- return(((n >> 4) & 0x0F) * 10 + (n & 0x0F));
-}
-
-char
-dectohexdec(n)
- int n;
-{
-
- return((char)(((n / 10) << 4) & 0xF0) | ((n % 10) & 0x0F));
-}
-
-static int timeset;
-struct rtc_st {
- unsigned char rtc_csec;
- unsigned char rtc_sec;
- unsigned char rtc_min;
- unsigned char rtc_hr;
- unsigned char rtc_dow;
- unsigned char rtc_dom;
- unsigned char rtc_mon;
- unsigned char rtc_yr;
-};
-
-/*
- * Initialize the time of day register, based on the time base which is, e.g.
- * from a filesystem.
- */
-void
-inittodr(base)
- time_t base;
-{
- /*
- * We ignore the suggested time for now and go for the RTC
- * clock time stored in the CMOS RAM.
- */
- struct rtc_st rtclk;
- time_t n;
- int csec, sec, min, hr, dom, mon, yr;
- int i, days = 0;
- int s;
- extern int have_rtc;
-
- timeset = 1;
- if (!have_rtc) {
- time.tv_sec = base;
- return;
- }
-
- rw_rtc((unsigned char *)&rtclk, 0);
-
- csec = hexdectodec(rtclk.rtc_csec);
- sec = hexdectodec(rtclk.rtc_sec);
- min = hexdectodec(rtclk.rtc_min);
- hr = hexdectodec(rtclk.rtc_hr);
- dom = hexdectodec(rtclk.rtc_dom);
- mon = hexdectodec(rtclk.rtc_mon);
- yr = hexdectodec(rtclk.rtc_yr);
- yr = (yr < 70) ? yr + 100 : yr;
-
- /*
- * Check to see if it was really the rtc
- * by checking for bad date info.
- */
- if (sec > 59 || min > 59 || hr > 23 || dom > 31 || mon > 12) {
- printf("inittodr: No clock found\n");
- time.tv_sec = base;
- return;
- }
-
- n = sec + 60 * min + 3600 * hr;
- n += (dom - 1) * 3600 * 24;
-
- if (yeartoday(yr) == 366)
- month[1] = 29;
- for (i = mon - 2; i >= 0; i--)
- days += month[i];
- month[1] = 28;
- for (i = 70; i < yr; i++)
- days += yeartoday(i);
- n += days * 3600 * 24;
-
- n += tz.tz_minuteswest * 60;
- if (tz.tz_dsttime)
- n -= 3600;
- s = splclock();
- time.tv_sec = n;
- time.tv_usec = csec * 10000;
- splx(s);
-}
-
-/*
- * Reset the clock.
- */
-void
-resettodr()
-{
- struct rtc_st rtclk;
- time_t n;
- int diff, i, j;
- int s;
-
- /*
- * We might have been called by boot() due to a crash early
- * on. Don't reset the clock chip in this case.
- */
- if (!timeset)
- return;
-
- diff = tz.tz_minuteswest * 60;
- if (tz.tz_dsttime)
- diff -= 3600;
-
- s = splclock();
- n = (time.tv_sec - diff) % (3600 * 24); /* hrs+mins+secs */
- rtclk.rtc_csec = dectohexdec(time.tv_usec / 10000);
- rtclk.rtc_sec = dectohexdec(n%60);
- n /= 60;
- rtclk.rtc_min = dectohexdec(n%60);
- rtclk.rtc_hr = dectohexdec(n/60);
-
- n = (time.tv_sec - diff) / (3600 * 24); /* days */
- splx(s);
- rtclk.rtc_dow = (n + 4) % 7; /* 1/1/70 is Thursday */
-
- for (j = 1970, i = yeartoday(j); n >= i; j++, i = yeartoday(j))
- n -= i;
-
- rtclk.rtc_yr = dectohexdec(j - 1900);
-
- if (i == 366)
- month[1] = 29;
- for (i = 0; n >= month[i]; i++)
- n -= month[i];
- month[1] = 28;
- rtclk.rtc_mon = dectohexdec(++i);
-
- rtclk.rtc_dom = dectohexdec(++n);
-
- rw_rtc((unsigned char *)&rtclk, 1);
-}
diff --git a/sys/arch/pc532/pc532/conf.c b/sys/arch/pc532/pc532/conf.c
deleted file mode 100644
index 8b089b4bfc9..00000000000
--- a/sys/arch/pc532/pc532/conf.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/* $OpenBSD: conf.c,v 1.13 2000/09/26 14:03:54 art Exp $ */
-
-/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)conf.c 7.9 (Berkeley) 5/28/91
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/conf.h>
-#include <sys/vnode.h>
-
-int ttselect __P((dev_t, int, struct proc *));
-
-#include "sd.h"
-bdev_decl(sw);
-#include "st.h"
-#include "cd.h"
-#include "ch.h"
-#include "ss.h"
-#include "uk.h"
-#include "rd.h"
-bdev_decl(rd);
-#include "vnd.h"
-#include "ccd.h"
-
-struct bdevsw bdevsw[] =
-{
- bdev_disk_init(NSD,sd), /* 0: SCSI disk */
- bdev_swap_init(1,sw), /* 1: swap pseudo-device */
- bdev_tape_init(NST,st), /* 2: SCSI tape */
- bdev_disk_init(NRD,rd), /* 3: ram disk */
- bdev_disk_init(NCD,cd), /* 4: SCSI CD-ROM */
- bdev_disk_init(NVND,vnd), /* 5: vnode disk driver */
- bdev_disk_init(NCCD,ccd), /* 6: concatenated disk driver */
-};
-int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
-
-/* open, close, write, ioctl */
-#define cdev_lpt_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), \
- (dev_type_read((*))) enodev, dev_init(c,n,write), \
- dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
- 0, seltrue, (dev_type_mmap((*))) enodev, 0}
-
-#define mmread mmrw
-#define mmwrite mmrw
-cdev_decl(mm);
-cdev_decl(sw);
-#include "pty.h"
-#include "scn.h"
-cdev_decl(scn);
-cdev_decl(rd);
-cdev_decl(fd);
-#include "bpfilter.h"
-#include "tun.h"
-#include "lpt.h"
-cdev_decl(lpt);
-#ifdef XFS
-#include <xfs/nxfs.h>
-cdev_decl(xfs_dev);
-#endif
-
-#ifdef IPFILTER
-#define NIPF 1
-#else
-#define NIPF 0
-#endif
-
-struct cdevsw cdevsw[] =
-{
- cdev_cn_init(1,cn), /* 0: virtual console */
- cdev_ctty_init(1,ctty), /* 1: controlling terminal */
- cdev_mm_init(1,mm), /* 2: /dev/{null,mem,kmem,...} */
- cdev_disk_init(NSD,sd), /* 3: SCSI disk */
- cdev_swap_init(1,sw), /* 4: /dev/drum (swap device) */
- cdev_tty_init(NPTY,pts), /* 5: pseudo-tty slave */
- cdev_ptc_init(NPTY,ptc), /* 6: pseudo-tty master */
- cdev_log_init(1,log), /* 7: /dev/klog */
- cdev_tty_init(NSCN,scn), /* 8: serial ports */
- cdev_disk_init(NRD,rd), /* 9: RAM disk */
- cdev_tape_init(NST,st), /* 10: SCSI tape */
- cdev_fd_init(1,fd), /* 11: file descriptor pseudo-device */
- cdev_disk_init(NCD,cd), /* 12: SCSI CD-ROM */
- cdev_disk_init(NVND,vnd), /* 13: vnode disk driver */
- cdev_bpftun_init(NBPFILTER,bpf),/* 14: Berkeley packet filter */
- cdev_bpftun_init(NTUN,tun), /* 15: network tunnel */
- cdev_ch_init(NCH,ch), /* 16: SCSI media changer */
- cdev_lpt_init(NLPT, lpt), /* 17: Centronics */
- cdev_disk_init(NCCD,ccd), /* 18: concatenated disk driver */
- cdev_gen_ipf(NIPF,ipl), /* 19: IP filter log */
- cdev_random_init(1,random), /* 20: random data source */
- cdev_uk_init(NUK,uk), /* 21: unknown SCSI */
- cdev_ss_init(NSS,ss), /* 22: SCSI scanner */
- cdev_notdef(), /* 23 */
- cdev_notdef(), /* 24 */
- cdev_notdef(), /* 25 */
- cdev_notdef(), /* 26 */
- cdev_notdef(), /* 27 */
- cdev_notdef(), /* 28 */
- cdev_notdef(), /* 29 */
- cdev_notdef(), /* 30 */
- cdev_notdef(), /* 31 */
- cdev_notdef(), /* 32 */
- cdev_notdef(), /* 33 */
- cdev_notdef(), /* 34 */
- cdev_notdef(), /* 35 */
- cdev_notdef(), /* 36 */
- cdev_notdef(), /* 37 */
- cdev_notdef(), /* 38 */
- cdev_notdef(), /* 39 */
- cdev_notdef(), /* 40 */
- cdev_notdef(), /* 41 */
- cdev_notdef(), /* 42 */
- cdev_notdef(), /* 43 */
- cdev_notdef(), /* 44 */
- cdev_notdef(), /* 45 */
- cdev_notdef(), /* 46 */
- cdev_notdef(), /* 47 */
- cdev_notdef(), /* 48 */
- cdev_notdef(), /* 49 */
- cdev_notdef(), /* 50 */
-#ifdef XFS
- cdev_xfs_init(NXFS,xfs_dev), /* 51: xfs communication device */
-#else
- cdev_notdef(), /* 51 */
-#endif
-};
-int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
-
-int mem_no = 2; /* major device number of memory special file */
-
-/*
- * Swapdev is a fake device implemented
- * in sw.c used only internally to get to swstrategy.
- * It cannot be provided to the users, because the
- * swstrategy routine munches the b_dev and b_blkno entries
- * before calling the appropriate driver. This would horribly
- * confuse, e.g. the hashing routines. Instead, /dev/drum is
- * provided as a character (raw) device.
- */
-dev_t swapdev = makedev(1, 0);
-
-/*
- * Returns true if dev is /dev/mem or /dev/kmem.
- */
-iskmemdev(dev)
- dev_t dev;
-{
-
- return (major(dev) == mem_no && minor(dev) < 2);
-}
-
-/*
- * Returns true if dev is /dev/zero.
- */
-iszerodev(dev)
- dev_t dev;
-{
-
- return (major(dev) == mem_no && minor(dev) == 12);
-}
-
-dev_t
-getnulldev()
-{
- return makedev(mem_no, 2);
-}
-
-static int chrtoblktbl[] = {
- /* XXXX This needs to be dynamic for LKMs. */
- /*VCHR*/ /*VBLK*/
- /* 0 */ NODEV,
- /* 1 */ NODEV,
- /* 2 */ NODEV,
- /* 3 */ 0,
- /* 4 */ NODEV,
- /* 5 */ NODEV,
- /* 6 */ NODEV,
- /* 7 */ NODEV,
- /* 8 */ NODEV,
- /* 9 */ 3,
- /* 10 */ 2,
- /* 11 */ NODEV,
- /* 12 */ 4,
- /* 13 */ 5,
- /* 14 */ NODEV,
- /* 15 */ NODEV,
- /* 16 */ NODEV,
- /* 17 */ NODEV,
- /* 18 */ 6
-};
-
-/*
- * Convert a character device number to a block device number.
- */
-chrtoblk(dev)
- dev_t dev;
-{
- int blkmaj;
-
- if (major(dev) >= nchrdev ||
- major(dev) > sizeof(chrtoblktbl)/sizeof(chrtoblktbl[0]))
- return (NODEV);
- blkmaj = chrtoblktbl[major(dev)];
- if (blkmaj == NODEV)
- return (NODEV);
- return (makedev(blkmaj, minor(dev)));
-}
-
-/*
- * This entire table could be autoconfig()ed but that would mean that
- * the kernel's idea of the console would be out of sync with that of
- * the standalone boot. I think it best that they both use the same
- * known algorithm unless we see a pressing need otherwise.
- */
-#include <dev/cons.h>
-
-cons_decl(scn);
-
-struct consdev constab[] = {
-#if NSCN > 0
- cons_init(scn),
-#endif
- { 0 },
-};
diff --git a/sys/arch/pc532/pc532/db_disasm.c b/sys/arch/pc532/pc532/db_disasm.c
deleted file mode 100644
index 71336343565..00000000000
--- a/sys/arch/pc532/pc532/db_disasm.c
+++ /dev/null
@@ -1,1899 +0,0 @@
-/* $NetBSD: db_disasm.c,v 1.2 1994/10/26 08:24:55 cgd Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1992 Carnegie Mellon University
- * Copyright (c) 1992 Helsinki University of Technology
- * Copyright (c) 1992 Bob Krause, Bruce Culbertson
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON AND HELSINKI UNIVERSITY OF TECHNOLOGY AND BOB
- * KRAUSE AND BRUCE CULBERTSON ALLOW FREE USE OF THIS SOFTWARE IN ITS
- * "AS IS" CONDITION. CARNEGIE MELLON AND HELSINKI UNIVERSITY OF
- * TECHNOLOGY AND BOB KRAUSE AND BRUCE CULBERTSON DISCLAIM ANY
- * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
- * USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-/*
- * From Bruce Culbertson's and Bob Krause's ROM monitor for the pc532
- * adapted to pc532 Mach by Tero Kivinen and Tatu Ylonen at Helsinki
- * University of Technology.
- */
-
-/*
- * Adapted for 532bsd (386bsd port) by Phil Nelson.
- *
- * Not yet complete!
- *
- */
-
-#define STATIC static
-
-/* #include <mach/boolean.h> */
-#include <machine/db_machdep.h>
-#include <ddb/db_access.h>
-#include <ddb/db_sym.h>
-#include <ddb/db_variables.h>
-#include <machine/pmap.h>
-#include <vm/vm_map.h>
-/* #include <kern/thread.h> */
-
-struct operand {
- int o_mode; /* address mode */
- int o_reg0; /* first register */
- int o_reg1; /* second register */
- long o_disp0; /* first displacment value */
- long o_disp1; /* second displacement value */
- int o_iscale; /* scaled indexing factor */
- int o_ireg; /* scaled indexing register */
-};
-
-struct insn {
- int i_format; /* instruction format */
- int i_op; /* operation code */
- char i_monic[8]; /* mneumonic string */
- unsigned char i_iol; /* integer operand length */
- struct operand i_opr[4]; /* operands */
-};
-
-/* Addressing modes (not the same format as in a machine instruction) */
-#define AMODE_NONE 0 /* operand not used by instruction */
-#define AMODE_REG 1 /* register */
-#define AMODE_RREL 2 /* register relative */
-#define AMODE_MREL 3 /* memory relative */
-#define AMODE_IMM 4 /* immediate */
-#define AMODE_ABS 5 /* absolute */
-#define AMODE_EXT 6 /* external */
-#define AMODE_TOS 7 /* top of stack */
-#define AMODE_MSPC 8 /* memory space */
-#define AMODE_REGLIST 9 /* a register list */
-#define AMODE_QUICK 10 /* quick integer (-8 .. +7) */
-#define AMODE_INVALID 11 /* invalid address mode found */
-#define AMODE_AREG 12 /* CPU dedicated register */
-#define AMODE_BLISTB 13 /* byte length bit list */
-#define AMODE_BLISTW 14 /* word length bit list */
-#define AMODE_BLISTD 15 /* double-word length bit list */
-#define AMODE_SOPT 16 /* options in string instructions */
-#define AMODE_CFG 17 /* configuration bits */
-#define AMODE_MREG 18 /* memory management register */
-#define AMODE_CINV 19 /* cache invalidate options */
-
-/* Instruction types */
-#define ITYPE_FMT0 0
-#define ITYPE_FMT1 1
-#define ITYPE_FMT2 2
-#define ITYPE_FMT3 3
-#define ITYPE_FMT4 4
-#define ITYPE_FMT5 5
-#define ITYPE_FMT6 6
-#define ITYPE_FMT7 7
-#define ITYPE_FMT8 8
-#define ITYPE_FMT9 9
-#define ITYPE_NOP 10
-#define ITYPE_FMT11 11
-#define ITYPE_FMT12 12
-#define ITYPE_UNDEF 13
-#define ITYPE_FMT14 14
-#define ITYPE_FMT15 15
-
-/* Table to determine the 'condition' field of an instruction */
-STATIC
-char cond_table[16][3] = {
- "eq", /* equal */
- "ne", /* not equal */
- "cs", /* carry set */
- "cc", /* carry clear */
- "hi", /* higher */
- "ls", /* lower or same */
- "gt", /* greater than */
- "le", /* less than or equal */
- "fs", /* flag set */
- "fc", /* flag clear */
- "lo", /* lower */
- "hs", /* higher or same */
- "lt", /* less than */
- "ge", /* greater than or equal */
- "r", /* unconditional branch */
- "??" /* never branch (nop) */
-};
-
-#define IOL(x) (((x)&0x3) + 1)
-#define IOL_BYTE 1 /* Byte (8-bits) */
-#define IOL_WORD 2 /* Word (16-bits) */
-#define IOL_NONE 3 /* Does not apply */
-#define IOL_DOUBLE 4 /* Double Word (32-bits) */
-
-STATIC
-char iol_table[5][2] = {
- "?", /* Should never appear */
- "b", /* byte */
- "w", /* word */
- "?", /* undefined */
- "d" /* double word */
-};
-
-STATIC
-char fol_table[2][2] = {
- "l", /* long floating-point */
- "f" /* standard floating-point */
-};
-
-STATIC
-char scale_table[5][2] = {
- "?", /* no scaled indexing */
- "b", /* byte */
- "w", /* word */
- "d", /* double-word */
- "q" /* quad-word */
-};
-
-STATIC
-char cfg_table[4][2] = {
- "i", /* vectored interrupt enable */
- "f", /* floating point enable */
- "m", /* memory management enable */
- "c" /* custom slave enable */
-};
-
-STATIC
-char sopt_table[8][4] = {
- "", /* no options */
- "b", /* backward */
- "w", /* while match */
- "b,w", /* backward, while match */
- "?", /* undefined */
- "b,?", /* undefined */
- "u", /* until match */
- "b,u" /* backward, until match */
-};
-
-#define AREG_US 0x0 /* user stack */
-#define AREG_FP 0x8 /* frame pointer */
-#define AREG_SP 0x9 /* stack pointer */
-#define AREG_SB 0xa /* static base */
-#define AREG_PSR 0xd /* processor status register */
-#define AREG_INTBASE 0xe /* interrupt base */
-#define AREG_MOD 0xf /* module */
-
-/* Floating-point operand length field masks */
-#define FOL_SINGLE 0x1 /* Single Precision (32-bits) */
-#define FOL_DOUBLE 0x0 /* Double Precision (64-bits) */
-
-#define FMT0_COND(x) (((x)&0xf0)>>4) /* Condition code for fmt 0 */
-#define FMT1_OP(x) (((x)&0xf0)>>4) /* Op code for fmt 1 */
-#define FMT2_OP(x) (((x)&0x70)>>4) /* Op code for fmt 2 */
-#define FMT2_COND(x, y) (((x)>>7) + (((y)&0x80)<<1)) /* Condition code for fmt 2 */
-#define FMT3_OP(x) ((x)&0x7) /* bits 2-4 of fmt 3 op code */
-#define FMT4_OP(x) (((x)&0x3c)>>2) /* Op code for fmt 4 */
-#define FMT5_OP(x) (((x)&0x3c)>>2) /* op code for fmt 5 */
-#define FMT6_OP(x) (((x)&0x3c)>>2) /* op code for fmt 6 */
-#define FMT7_OP(x) (((x)&0x3c)>>2) /* op code for fmt 7 */
-#define FMT8_OP(x, y) ((((x)&0xc0)>>6) + ((y)&0x4))
-#define FMT8_REG(x) (((x)&0x38)>>3) /* register operand for fmt 8 */
-#define FMT8_SU 1 /* register value -> movsu */
-#define FMT8_US 3 /* register value -> movus */
-#define FMT9_OP(x) (((x)&0x38)>>3) /* op code for fmt 9 */
-#define FMT9_F(x) (((x)&0x4)>>2) /* float type for fmt 9 */
-#define FMT11_OP(x) (((x)&0x3c)>>2) /* op code for fmt 11 */
-#define FMT12_OP(x) (((x)&0x3c)>>2) /* op code for fmt 12 */
-#define FMT11_F(x) ((x)&01) /* float type for fmt 11 */
-#define FMT12_F(x) ((x)&01) /* float type for fmt 12 */
-#define FMT14_OP(x) (((x)&0x3c)>>2) /* op code for fmt 14 */
-
-#define GEN_R0 0 /* register 0 */
-#define GEN_R1 1 /* register 1 */
-#define GEN_R2 2 /* register 2 */
-#define GEN_R3 3 /* register 3 */
-#define GEN_R4 4 /* register 4 */
-#define GEN_R5 5 /* register 5 */
-#define GEN_R6 6 /* register 6 */
-#define GEN_R7 7 /* register 7 */
-#define GEN_RR0 8 /* register 0 relative */
-#define GEN_RR1 9 /* register 1 relative */
-#define GEN_RR2 10 /* register 2 relative */
-#define GEN_RR3 11 /* register 3 relative */
-#define GEN_RR4 12 /* register 4 relative */
-#define GEN_RR5 13 /* register 5 relative */
-#define GEN_RR6 14 /* register 6 relative */
-#define GEN_RR7 15 /* register 7 relative */
-#define GEN_FRMR 16 /* frame memory relative */
-#define GEN_SPMR 17 /* stack memory relative */
-#define GEN_SBMR 18 /* static memory relative */
-#define GEN_RES 19 /* reserved for future use */
-#define GEN_IMM 20 /* immediate */
-#define GEN_ABS 21 /* absolute */
-#define GEN_EXT 22 /* external */
-#define GEN_TOS 23 /* top of stack */
-#define GEN_FRM 24 /* frame memory */
-#define GEN_SPM 25 /* stack memory */
-#define GEN_SBM 26 /* static memory */
-#define GEN_PCM 27 /* program memory */
-#define GEN_SIB 28 /* scaled index, bytes */
-#define GEN_SIW 29 /* scaled index, words */
-#define GEN_SID 30 /* scaled index, double words */
-#define GEN_SIQ 31 /* scaled index, quad words */
-
-STATIC
-unsigned char fmttab[128] = {
-/* This is really an array of 256 nibbles. The index is the first
- * byte of an instruction opcode. The value in the array is the
- * instruction format corresponding to that first byte.
- *
- * group 1st byte insn format insn type
- */
-(4+ /* 00000000 format 4 add .b */
-(4*16)), /* 00000001 format 4 add .w */
-(1+ /* 00000010 format 1 bsr */
-(4*16)), /* 00000011 format 4 add .l */
-(4+ /* 00000100 format 4 cmp .b */
-(4*16)), /* 00000101 format 4 cmp .w */
-(13+ /* 00000110 format 19 undefined */
-(4*16)), /* 00000111 format 4 cmp .l */
-(4+ /* 00001000 format 4 bic .b */
-(4*16)), /* 00001001 format 4 bic .w */
-(0+ /* 00001010 format 0 beq */
-(4*16)), /* 00001011 format 4 bic .w */
-(2+ /* 00001100 format 2 addq .b */
-(2*16)), /* 00001101 format 2 addq .w */
-(5+ /* 00001110 format 5 */
-(2*16)), /* 00001111 format 2 addq .l */
-(4+ /* 00010000 format 4 addc .b */
-(4*16)), /* 00010001 format 4 addc .w */
-(1+ /* 00010010 format 1 ret */
-(4*16)), /* 00010011 format 4 addc .l */
-(4+ /* 00010100 format 4 mov .b */
-(4*16)), /* 00010101 format 4 mov .w */
-(15+ /* 00010110 format 15 */
-(4*16)), /* 00010111 format 4 mov .l */
-(4+ /* 00011000 format 4 or .b */
-(4*16)), /* 00011001 format 4 or .w */
-(0+ /* 00011010 format 0 bne */
-(4*16)), /* 00011011 format 4 or .l */
-(2+ /* 00011100 format 2 cmpq .b */
-(2*16)), /* 00011101 format 2 cmpq .w */
-(14+ /* 00011110 format 14 */
-(2*16)), /* 00011111 format 2 cmpq .l */
-(4+ /* 00100000 format 4 sub .b */
-(4*16)), /* 00100001 format 4 sub .w */
-(1+ /* 00100010 format 1 cxp */
-(4*16)), /* 00100011 format 4 sub .l */
-(4+ /* 00100100 format 4 addr .b */
-(4*16)), /* 00100101 format 4 addr .w */
-(13+ /* 00100110 format 19 undefined */
-(4*16)), /* 00100111 format 4 addr .l */
-(4+ /* 00101000 format 4 and .b */
-(4*16)), /* 00101001 format 4 and .w */
-(0+ /* 00101010 format 0 bcs */
-(4*16)), /* 00101011 format 4 and .l */
-(2+ /* 00101100 format 2 spr .b */
-(2*16)), /* 00101101 format 2 spr .w */
-(8+ /* 00101110 format 8 */
-(2*16)), /* 00101111 format 2 spr .l */
-(4+ /* 00110000 format 4 subc .b */
-(4*16)), /* 00110001 format 4 subc .w */
-(1+ /* 00110010 format 1 rxp */
-(4*16)), /* 00110011 format 4 subc .l */
-(4+ /* 00110100 format 4 tbit .b */
-(4*16)), /* 00110101 format 4 tbit .w */
-(15+ /* 00110110 format 15 */
-(4*16)), /* 00110111 format 4 tbit .l */
-(4+ /* 00111000 format 4 xor .b */
-(4*16)), /* 00111001 format 4 xor .w */
-(0+ /* 00111010 format 0 bcc */
-(4*16)), /* 00111011 format 4 xor .l */
-(2+ /* 00111100 format 2 scond .b */
-(2*16)), /* 00111101 format 2 scond .w */
-(9+ /* 00111110 format 9 */
-(2*16)), /* 00111111 format 2 scond .l */
-(4+ /* 01000000 format 4 add .b */
-(4*16)), /* 01000001 format 4 add .w */
-(1+ /* 01000010 format 1 rett */
-(4*16)), /* 01000011 format 4 add .l */
-(4+ /* 01000100 format 4 cmp .b */
-(4*16)), /* 01000101 format 4 cmp .w */
-(13+ /* 01000110 format 19 undefined */
-(4*16)), /* 01000111 format 4 cmp .l */
-(4+ /* 01001000 format 4 bic .b */
-(4*16)), /* 01001001 format 4 bic .w */
-(0+ /* 01001010 format 0 bhi */
-(4*16)), /* 01001011 format 4 bic .l */
-(2+ /* 01001100 format 2 acb .b */
-(2*16)), /* 01001101 format 2 acb .w */
-(6+ /* 01001110 format 6 */
-(2*16)), /* 01001111 format 2 acb .l */
-(4+ /* 01010000 format 4 addc .b */
-(4*16)), /* 01010001 format 4 addc .w */
-(1+ /* 01010010 format 1 reti */
-(4*16)), /* 01010011 format 4 addc .l */
-(4+ /* 01010100 format 4 mov .b */
-(4*16)), /* 01010101 format 4 mov .w */
-(15+ /* 01010110 format 15 */
-(4*16)), /* 01010111 format 4 mov .l */
-(4+ /* 01011000 format 4 or .b */
-(4*16)), /* 01011001 format 4 or .w */
-(0+ /* 01011010 format 0 bis */
-(4*16)), /* 01011011 format 4 or .l */
-(2+ /* 01011100 format 2 movq .b */
-(2*16)), /* 01011101 format 2 movq .w */
-(13+ /* 01011110 format 16 undefined */
-(2*16)), /* 01011111 format 2 movq .l */
-(4+ /* 01100000 format 4 sub .b */
-(4*16)), /* 01100001 format 4 sub .w */
-(1+ /* 01100010 format 1 save */
-(4*16)), /* 01100011 format 4 sub .l */
-(4+ /* 01100100 format 4 addr .b */
-(4*16)), /* 01100101 format 4 addr .w */
-(13+ /* 01100110 format 19 undefined */
-(4*16)), /* 01100111 format 4 addr .l */
-(4+ /* 01101000 format 4 and .b */
-(4*16)), /* 01101001 format 4 and .w */
-(0+ /* 01101010 format 0 bgt */
-(4*16)), /* 01101011 format 4 and .l */
-(2+ /* 01101100 format 2 lpr .b */
-(2*16)), /* 01101101 format 2 lpr .w */
-(8+ /* 01101110 format 8 */
-(2*16)), /* 01101111 format 2 lpr .l */
-(4+ /* 01110000 format 4 subc .b */
-(4*16)), /* 01110001 format 4 subc .w */
-(1+ /* 01110010 format 1 restore */
-(4*16)), /* 01110011 format 4 subc .l */
-(4+ /* 01110100 format 4 tbit .b */
-(4*16)), /* 01110101 format 4 tbit .w */
-(15+ /* 01110110 format 15 */
-(4*16)), /* 01110111 format 4 tbit .l */
-(4+ /* 01111000 format 4 xor .b */
-(4*16)), /* 01111001 format 4 xor .w */
-(0+ /* 01111010 format 0 ble */
-(4*16)), /* 01111011 format 4 xor .l */
-(3+ /* 01111100 format 3 */
-(3*16)), /* 01111101 format 3 */
-(13+ /* 01111110 format 10 undefined */
-(3*16)), /* 01111111 format 3 */
-(4+ /* 10000000 format 4 add .b */
-(4*16)), /* 10000001 format 4 add .w */
-(1+ /* 10000010 format 1 enter */
-(4*16)), /* 10000011 format 4 add .l */
-(4+ /* 10000100 format 4 cmp .b */
-(4*16)), /* 10000101 format 4 cmp .w */
-(13+ /* 10000110 format 19 undefined */
-(4*16)), /* 10000111 format 4 cmp .l */
-(4+ /* 10001000 format 4 bic .b */
-(4*16)), /* 10001001 format 4 bic .w */
-(0+ /* 10001010 format 0 bfs */
-(4*16)), /* 10001011 format 4 bic .l */
-(2+ /* 10001100 format 2 addq .b */
-(2*16)), /* 10001101 format 2 addq .w */
-(13+ /* 10001110 format 18 undefined */
-(2*16)), /* 10001111 format 2 addq .l */
-(4+ /* 10010000 format 4 addc .b */
-(4*16)), /* 10010001 format 4 addc .w */
-(1+ /* 10010010 format 1 exit */
-(4*16)), /* 10010011 format 4 addc .l */
-(4+ /* 10010100 format 4 mov .b */
-(4*16)), /* 10010101 format 4 mov .w */
-(15+ /* 10010110 format 15 */
-(4*16)), /* 10010111 format 4 mov .l */
-(4+ /* 10011000 format 4 or .b */
-(4*16)), /* 10011001 format 4 or .w */
-(0+ /* 10011010 format 0 bfc */
-(4*16)), /* 10011011 format 4 or .l */
-(2+ /* 10011100 format 2 cmpq .b */
-(2*16)), /* 10011101 format 2 cmpq .w */
-(13+ /* 10011110 format 13 undefined */
-(2*16)), /* 10011111 format 2 cmpq .l */
-(4+ /* 10100000 format 4 sub .b */
-(4*16)), /* 10100001 format 4 sub .w */
-(10+ /* 10100010 format 1 nop */
-(4*16)), /* 10100011 format 4 sub .l */
-(4+ /* 10100100 format 4 addr .b */
-(4*16)), /* 10100101 format 4 addr .w */
-(13+ /* 10100110 format 19 undefined */
-(4*16)), /* 10100111 format 4 addr .l */
-(4+ /* 10101000 format 4 and .b */
-(4*16)), /* 10101001 format 4 and .w */
-(0+ /* 10101010 format 0 blo */
-(4*16)), /* 10101011 format 4 and .l */
-(2+ /* 10101100 format 2 spr .b */
-(2*16)), /* 10101101 format 2 spr .w */
-(8+ /* 10101110 format 8 */
-(2*16)), /* 10101111 format 2 spr .l */
-(4+ /* 10110000 format 4 subc .b */
-(4*16)), /* 10110001 format 4 subc .w */
-(1+ /* 10110010 format 1 wait */
-(4*16)), /* 10110011 format 4 subc .l */
-(4+ /* 10110100 format 4 tbit .b */
-(4*16)), /* 10110101 format 4 tbit .w */
-(15+ /* 10110110 format 15 */
-(4*16)), /* 10110111 format 4 tbit .l */
-(4+ /* 10111000 format 4 xor .b */
-(4*16)), /* 10111001 format 4 xor .w */
-(0+ /* 10111010 format 0 bhs */
-(4*16)), /* 10111011 format 4 xor .l */
-(2+ /* 10111100 format 2 scond .b */
-(2*16)), /* 10111101 format 2 scond .w */
-(11+ /* 10111110 format 11 */
-(2*16)), /* 10111111 format 2 scond .l */
-(4+ /* 11000000 format 4 add .b */
-(4*16)), /* 11000001 format 4 add .w */
-(1+ /* 11000010 format 1 dia */
-(4*16)), /* 11000011 format 4 add .l */
-(4+ /* 11000100 format 4 cmp .b */
-(4*16)), /* 11000101 format 4 cmp .w */
-(13+ /* 11000110 format 19 undefined */
-(4*16)), /* 11000111 format 4 cmp .l */
-(4+ /* 11001000 format 4 bic .b */
-(4*16)), /* 11001001 format 4 bic .w */
-(0+ /* 11001010 format 0 blt */
-(4*16)), /* 11001011 format 4 bic .l */
-(2+ /* 11001100 format 2 acb .b */
-(2*16)), /* 11001101 format 2 acb .w */
-(7+ /* 11001110 format 7 */
-(2*16)), /* 11001111 format 2 acb .l */
-(4+ /* 11010000 format 4 addc .b */
-(4*16)), /* 11010001 format 4 addc .w */
-(1+ /* 11010010 format 1 flag */
-(4*16)), /* 11010011 format 4 addc .l */
-(4+ /* 11010100 format 4 mov .b */
-(4*16)), /* 11010101 format 4 mov .w */
-(15+ /* 11010110 format 15 */
-(4*16)), /* 11010111 format 4 mov .l */
-(4+ /* 11011000 format 4 or .b */
-(4*16)), /* 11011001 format 4 or .w */
-(0+ /* 11011010 format 0 bqt */
-(4*16)), /* 11011011 format 4 or .l */
-(2+ /* 11011100 format 2 movq .b */
-(2*16)), /* 11011101 format 2 movq .w */
-(13+ /* 11011110 format 17 undefined */
-(2*16)), /* 11011111 format 2 movq .l */
-(4+ /* 11100000 format 4 sub .b */
-(4*16)), /* 11100001 format 4 sub .w */
-(1+ /* 11100010 format 1 svc */
-(4*16)), /* 11100011 format 4 sub .l */
-(4+ /* 11100100 format 4 addr .b */
-(4*16)), /* 11100101 format 4 addr .w */
-(13+ /* 11100110 format 19 undefined */
-(4*16)), /* 11100111 format 4 addr .l */
-(4+ /* 11101000 format 4 and .b */
-(4*16)), /* 11101001 format 4 and .w */
-(0+ /* 11101010 format 0 b */
-(4*16)), /* 11101011 format 4 and .l */
-(2+ /* 11101100 format 2 lpr .b */
-(2*16)), /* 11101101 format 2 lpr .w */
-(8+ /* 11101110 format 8 */
-(2*16)), /* 11101111 format 2 lpr .l */
-(4+ /* 11110000 format 4 subc .b */
-(4*16)), /* 11110001 format 4 subc .w */
-(1+ /* 11110010 format 1 bpt */
-(4*16)), /* 11110011 format 4 subc .l */
-(4+ /* 11110100 format 4 tbit .b */
-(4*16)), /* 11110101 format 4 tbit .w */
-(15+ /* 11110110 format 15 */
-(4*16)), /* 11110111 format 4 tbit .l */
-(4+ /* 11111000 format 4 xor .b */
-(4*16)), /* 11111001 format 4 xor .w */
-(10+ /* 11111010 format 0 nop */
-(4*16)), /* 11111011 format 4 xor .l */
-(13+ /* 11111100 format 3 undefined */
-(13*16)), /* 11111101 format 3 undefined */
-((12+ /* 11111110 format 12 new 532 */
-13*16)) }; /* 11111111 format 3 undefined */
-
-STATIC
-char fmt1_table[16][8] = {
- "bsr", /* branch to subroutine */
- "ret", /* return from subroutine */
- "cxp", /* call external procedure */
- "rxp", /* return from external procedure */
- "rett", /* return from trap */
- "reti", /* return from interrupt */
- "save", /* save general purpose registers */
- "restore", /* restore general purpose registers */
- "enter", /* enter new procedure context */
- "exit", /* exit procedure context */
- "nop", /* no operation */
- "wait", /* wait fro interrupt */
- "dia", /* diagnose */
- "flag", /* flag trap */
- "svc", /* supervisor call trap */
- "bpt" /* breakpoint trap */
-};
-
-#define FMT1_BSR 0x0 /* branch to subroutine */
-#define FMT1_RET 0x1 /* return from subroutine */
-#define FMT1_CXP 0x2 /* call external procedure */
-#define FMT1_RXP 0x3 /* return from external procedure */
-#define FMT1_RETT 0x4 /* return from trap */
-#define FMT1_RETI 0x5 /* return from interrupt */
-#define FMT1_SAVE 0x6 /* save general purpose registers */
-#define FMT1_RESTORE 0x7 /* restore general purpose registers */
-#define FMT1_ENTER 0x8 /* enter new procedure context */
-#define FMT1_EXIT 0x9 /* exit procedure context */
-#define FMT1_NOP 0xa /* no operation */
-#define FMT1_WAIT 0xb /* wait fro interrupt */
-#define FMT1_DIA 0xc /* diagnose */
-#define FMT1_FLAG 0xd /* flag trap */
-#define FMT1_SVC 0xe /* supervisor call trap */
-#define FMT1_BPT 0xf /* breakpoint trap */
-
-STATIC
-char fmt2_table[7][5] = {
- "addq", /* add quick */
- "cmpq", /* compare quick */
- "spr", /* save processor register */
- "s", /* save condition as boolean */
- "acb", /* add, compare and branch */
- "movq", /* move quick */
- "lpr" /* load processor register */
-};
-
-#define FMT2_ADDQ 0x0 /* add quick */
-#define FMT2_CMPQ 0x1 /* compare quick */
-#define FMT2_SPR 0x2 /* store processr oregister */
-#define FMT2_SCOND 0x3 /* save condition as boolean */
-#define FMT2_ACB 0x4 /* add, compare and branch */
-#define FMT2_MOVQ 0x5 /* move quick */
-#define FMT2_LPR 0x6 /* load processor register */
-
-STATIC
-char fmt3_table[8][7] = {
- "cxpd", /* call external procedure with descriptor */
- "bicpsr", /* bit clear in PSR */
- "jump", /* jump */
- "bispsr", /* bit set in PSR */
- "??3??", /* UNDEFINED */
- "adjsp", /* adjust stack pointer */
- "jsr", /* jump to subroutine */
- "case" /* case branch */
-};
-
-#define FMT3_CXPD 0x0 /* call external procedure with descriptor */
-#define FMT3_BICPSR 0x1 /* bit clear in PSR */
-#define FMT3_JUMP 0x2 /* jump */
-#define FMT3_BISPSR 0x3 /* bit set in PSR */
-#define FMT3_UNDEF 0x4 /* UNDEFINED */
-#define FMT3_ADJSP 0x5 /* adjust stack pointer */
-#define FMT3_JSR 0x6 /* jump to subroutine */
-#define FMT3_CASE 0x7 /* case branch */
-
-STATIC
-char fmt4_table[16][5] = {
- "add", /* add */
- "cmp", /* compare */
- "bic", /* bit clear */
- "?4?", /* UNDEFINED */
- "addc", /* add with carry */
- "mov", /* move */
- "or", /* or */
- "?4?", /* UNDEFINED */
- "sub", /* subtract */
- "addr", /* compute effective address */
- "and", /* and */
- "?4?", /* UNDEFINED */
- "subc", /* subtract with carry */
- "tbit", /* test bit */
- "xor", /* exclusive or */
- "?4?" /* UNDEFINED */
-};
-
-#define FMT4_ADD 0x0 /* add */
-#define FMT4_CMP 0x1 /* compare */
-#define FMT4_BIC 0x2 /* bit clear */
-#define FMT4_ADDC 0x4 /* add with carry */
-#define FMT4_MOV 0x5 /* move */
-#define FMT4_OR 0x6 /* or */
-#define FMT4_SUB 0x8 /* subtract */
-#define FMT4_ADDR 0x9 /* compute effective address */
-#define FMT4_AND 0xa /* and */
-#define FMT4_SUBC 0xc /* subtract with carry */
-#define FMT4_TBIT 0xd /* test bit */
-#define FMT4_XOR 0xe /* exclusive or */
-
-STATIC
-char fmt5_table[4][7] = {
- "movs", /* move string */
- "cmps", /* compare string */
- "setcfg", /* set configuration register */
- "skps" /* skip string */
-};
-
-#define FMT5_MOVS 0x0 /* move string */
-#define FMT5_CMPS 0x1 /* compare string */
-#define FMT5_SETCFG 0x2 /* set configuration register */
-#define FMT5_SKPS 0x3 /* skip string */
-
-STATIC
-char fmt6_table[16][6] = {
- "rot", /* rotate */
- "ash", /* arithmetic shift */
- "cbit", /* clear bit */
- "cbiti", /* clear bit interlocked */
- "??6??", /* undefined */
- "lsh", /* logical shift */
- "sbit", /* set bit */
- "sbiti", /* set bit interlocked */
- "neg", /* negate */
- "not", /* not */
- "??6??", /* undefined */
- "subp", /* subtract packed decimal */
- "abs", /* absolute value */
- "com", /* complement */
- "ibit", /* invert bit */
- "addp" /* add packed decimal */
-};
-
-#define FMT6_ROT 0x0 /* rotate */
-#define FMT6_ASH 0x1 /* arithmetic shift */
-#define FMT6_CBIT 0x2 /* clear bit */
-#define FMT6_CBITI 0x3 /* clear bit interlocked */
-#define FMT6_UNDEF1 0x4 /* undefined */
-#define FMT6_LSH 0x5 /* logical shift */
-#define FMT6_SBIT 0x6 /* s#define FMT6_NOT 0x9 /* not */
-#define FMT6_UNDEF2 0xa /* undefined */
-#define FMT6_SUBP 0xb /* subtract packed decimal */
-#define FMT6_ABS 0xc /* absolute value */
-#define FMT6_COM 0xd /* complement */
-#define FMT6_IBIT 0xe /* invert bit */
-#define FMT6_ADDP 0xf /* add packed decimal */
-
-STATIC
-char fmt7_table[16][7] = {
- "movm", /* move multiple */
- "cmpm", /* compare multiple */
- "inss", /* insert field short */
- "exts", /* extract field short */
- "movxb", /* move with sign-extention byte to word */
- "movzb", /* move with zero-extention byte to word */
- "movz", /* move with zero extention i to double */
- "movx", /* move with sign-extention i to double */
- "mul", /* multiply */
- "mei", /* multiply extended integer */
- "?7?", /* undefined */
- "dei", /* divide extended integer */
- "quo", /* quotient */
- "rem", /* remainder */
- "mod", /* modulus */
- "div" /* divide */
-};
-
-#define FMT7_MOVM 0x0 /* move multiple */
-#define FMT7_CMPM 0x1 /* compare multiple */
-#define FMT7_INSS 0x2 /* insert field short */
-#define FMT7_EXTS 0x3 /* extract field short */
-#define FMT7_MOVXBW 0x4 /* move with sign-extention byte to word */
-#define FMT7_MOVZBW 0x5 /* move with zero-extention byte to word */
-#define FMT7_MOVZD 0x6 /* move with zero extention i to double */
-#define FMT7_MOVXD 0x7 /* move with sign-extention i to double */
-#define FMT7_MUL 0x8 /* multiply */
-#define FMT7_MEI 0x9 /* multiply extended integer */
-#define FMT7_UNDEF 0xa /* undefined */
-#define FMT7_DEI 0xb /* divide extended integer */
-#define FMT7_QUO 0xc /* quotient */
-#define FMT7_REM 0xd /* remainder */
-#define FMT7_MOD 0xe /* modulus */
-#define FMT7_DIV 0xf /* divide */
-
-STATIC
-char fmt8_table[8][6] = {
- "ext", /* extract field */
- "cvtp", /* convert to bit pointer */
- "ins", /* insert field */
- "check", /* bounds check */
- "index", /* calculate index */
- "ffs", /* find first set bit */
- "mov", /* move supervisor to/from user space */
- "??8??" /* undefined */
-};
-
-#define FMT8_EXT 0x0 /* extract field */
-#define FMT8_CVTP 0x1 /* convert to bit pointer */
-#define FMT8_INS 0x2 /* insert field */
-#define FMT8_CHECK 0x3 /* bounds check */
-#define FMT8_INDEX 0x4 /* calculate index */
-#define FMT8_FFS 0x5 /* find first set bit */
-#define FMT8_MOV 0x6 /* move supervisor to/from user space */
-#define FMT8_UNDEF 0x7 /* undefined */
-
-STATIC
-char fmt9_table[8][6] = {
- "mov", /* move converting integer to floating point */
- "lfsr", /* load floating-point status register */
- "movlf", /* move long floating to floating */
- "movfl", /* move floating to long floating */
- "round", /* round floating to integer */
- "trunc", /* truncate floating to integer */
- "sfsr", /* store floating-point status register */
- "floor" /* floor floating to integer */
-};
-
-#define FMT9_MOV 0x0 /* move converting integer to floating point */
-#define FMT9_LFSR 0x1 /* load floating-point status register */
-#define FMT9_MOVLF 0x2 /* move long floating to floating */
-#define FMT9_MOVFL 0x3 /* move floating to long floating */
-#define FMT9_ROUND 0x4 /* round floating to integer */
-#define FMT9_TRUNC 0x5 /* truncate floating to integer */
-#define FMT9_SFSR 0x6 /* store floating-point status register */
-#define FMT9_FLOOR 0x7 /* floor floating to integer */
-
-#define NOP 0xff; /* catch all nop instruction */
-
-STATIC
-char fmt11_table[16][4] = {
- "add", /* add floating */
- "mov", /* move floating */
- "cmp", /* compare floating */
- "?f?", /* undefined */
- "sub", /* subtract floating */
- "neg", /* negate floating */
- "?f?", /* undefined */
- "?f?", /* undefined */
- "div", /* divide floating */
- "?f?", /* undefined */
- "?f?", /* undefined */
- "?f?", /* undefined */
- "mul", /* multiply floating */
- "abs", /* absolute value floating */
- "?f?", /* undefined */
- "?f?" /* undefined */
-};
-
-STATIC
-char fmt12_table[16][6] = {
- "?f?", /* 0 undefined */
- "?f?", /* 1 undefined */
- "poly", /* 2 */
- "dot", /* 3 */
- "scalb", /* 4 */
- "logb", /* 5 */
- "?f?", /* 6 undefined */
- "?f?", /* 7 undefined */
- "?f?", /* 8 undefined */
- "?f?", /* 9 undefined */
- "?f?", /* 10 undefined */
- "?f?", /* 11 undefined */
- "?f?", /* 12 undefined */
- "?f?", /* 13 undefined */
- "?f?", /* 14 undefined */
- "?f?", /* 15 undefined */
-};
-
-#define FMT11_ADD 0x0 /* add floating */
-#define FMT11_MOV 0x1 /* move floating */
-#define FMT11_CMP 0x2 /* compare floating */
-#define FMT11_UNDEF1 0x3 /* undefined */
-#define FMT11_SUB 0x4 /* subtract floating */
-#define FMT11_NEG 0x5 /* negate floating */
-#define FMT11_UNDEF2 0x6 /* undefined */
-#define FMT11_UNDEF3 0x7 /* undefined */
-#define FMT11_DIV 0x8 /* divide floating */
-#define FMT11_UNDEF4 0x9 /* undefined */
-#define FMT11_UNDEF5 0xa /* undefined */
-#define FMT11_UNDEF6 0xb /* undefined */
-#define FMT11_MUL 0xc /* multiply floating */
-#define FMT11_ABS 0xd /* absolute value floating */
-#define FMT11_UNDEF7 0xe /* undefined */
-#define FMT11_UNDEF8 0xf /* undefined */
-
-#define FMT12_POLY 2
-#define FMT12_DOT 3
-#define FMT12_SCALB 4
-#define FMT12_LOGB 5
-
-STATIC
-char fmt14_table[][6] = {
- "rdval", /* validate address for reading */
- "wrval", /* validate address for writing */
- "lmr", /* load memory managemnet register */
- "smr", /* store memory management register */
- "???",
- "???",
- "???",
- "???",
- "???",
- "cinv",
-};
-
-#define FMT14_RDVAL 0x0 /* validate address for reading */
-#define FMT14_WRVAL 0x1 /* validate address for writing */
-#define FMT14_LMR 0x2 /* load memory managemnet register */
-#define FMT14_SMR 0x3 /* store memory management register */
-#define FMT14_CINV 0x9 /* cache invalidate */
-
-/*
- * These are indices into regTable. Keep in sync!
- */
-#define REG_R0 0 /* General Register 0 */
-#define REG_F0 8 /* Floating Point 0 */
-#define REG_PC 32 /* Program counter */
-#define REG_USP (REG_PC+1)
-#define REG_ISP (REG_PC+2)
-#define REG_FP (REG_PC+3)
-#define REG_SB (REG_PC+4)
-#define REG_INTBASE (REG_PC+5)
-#define REG_MOD (REG_PC+6)
-#define REG_PSR (REG_PC+7)
-#define REG_UPSR (REG_PC+8)
-#define REG_DCR (REG_PC+9)
-#define REG_DSR (REG_PC+10)
-#define REG_CAR (REG_PC+11)
-#define REG_BPC (REG_PC+12)
-#define REG_CFG (REG_PC+13)
-
-#define REG_PTB0 46
-#define REG_PTB1 (REG_PTB0+1)
-#define REG_IVAR0 (REG_PTB0+2)
-#define REG_IVAR1 (REG_PTB0+3)
-#define REG_TEAR (REG_PTB0+4)
-#define REG_MCR (REG_PTB0+5)
-#define REG_MSR (REG_PTB0+6)
-
-#define REG_FSR 53
-#define REG_SP (REG_FSR+1)
-#define REG_NIL (REG_FSR+2)
-
-struct regTable {
- char *name;
-};
-
-STATIC
-struct regTable regTable[] = {
- {"r0"}, /* General Register 0 */
- {"r1"}, /* General Register 1 */
- {"r2"}, /* General Register 2 */
- {"r3"}, /* General Register 3 */
- {"r4"}, /* General Register 4 */
- {"r5"}, /* General Register 5 */
- {"r6"}, /* General Register 6 */
- {"r7"}, /* General Register 7 */
- {"f0"}, /* Floating Point 0 */
- {"f1"}, /* Floating Point 1 */
- {"f2"}, /* Floating Point 2 */
- {"f3"}, /* Floating Point 3 */
- {"f4"}, /* Floating Point 4 */
- {"f5"}, /* Floating Point 5 */
- {"f6"}, /* Floating Point 6 */
- {"f7"}, /* Floating Point 7 */
- {"l1l"}, /* Floating Point L1 */
- {"l1h"}, /* Floating Point L1 */
- {"l3l"}, /* Floating Point L3 */
- {"l3h"}, /* Floating Point L3 */
- {"l5l"}, /* Floating Point L5 */
- {"l5h"}, /* Floating Point L5 */
- {"l7l"}, /* Floating Point L7 */
- {"l7h"}, /* Floating Point L7 */
- {"l0"},
- {"l1"},
- {"l2"},
- {"l3"},
- {"l4"},
- {"l5"},
- {"l6"},
- {"l7"},
- {"pc"}, /* Program counter */
- {"usp"}, /* 532 */
- {"isp"}, /* 532 */
- {"fp"}, /* Frame Pointer */
- {"sb"}, /* Static Base */
- {"intbase"}, /* Interrupt Base */
- {"mod"}, /* Module Register */
- {"psr"}, /* Processor Status */
- {"upsr"}, /* Processor Status */
- {"dcr"}, /* 532 */
- {"dsr"}, /* 532 */
- {"car"}, /* 532 */
- {"bpc"}, /* 532 */
- {"cfg"}, /* 532 */
- {"ptb0"}, /* Page Table Base 0 */
- {"ptb1"}, /* Page Table Base 1 */
- {"ivar0"}, /* 532 */
- {"ivar1"}, /* 532 */
- {"tear"}, /* 532 */
- {"mcr"}, /* 532 */
- {"msr"}, /* Memory Management Status */
- {"fsr"}, /* Floating Point Status */
- {"sp"}, /* x(x(sp)) adr mode */
- {"???"}, /* unknown reg */
-};
-
-#define REGTABLESZ ((sizeof regTable) / (sizeof (struct regTable)))
-
-#define GetShort(x, y) ((((x) & 0x80) >> 7) + (((y) & 0x7) << 1))
-#define GetGen0(x) (((x) & 0xf8) >> 3)
-#define GetGen1(x,y) ((((x) & 0xc0) >> 6) + (((y) & 0x7) << 2))
-#define GetGenSI(x) (int)((((x) & 0x1c) == 0x1c) ? (((x) & 0x3) + 1) : 0)
-#define ScaledFields(input, reg, gen) \
- ((reg) = ((input) & 0x7), \
- (gen) = (((input) & 0xf8) >> 3))
-
-STATIC unsigned char cpuRegTable [] = {
- REG_UPSR, REG_DCR, REG_BPC, REG_DSR,
- REG_CAR, REG_NIL, REG_NIL, REG_NIL,
- REG_FP, REG_SP, REG_SB, REG_USP,
- REG_CFG, REG_PSR, REG_INTBASE, REG_MOD,
-};
-
-STATIC unsigned char mmuRegTable [] = {
- REG_NIL, REG_NIL, REG_NIL, REG_NIL,
- REG_NIL, REG_NIL, REG_NIL, REG_NIL,
- REG_NIL, REG_MCR, REG_MSR, REG_TEAR,
- REG_PTB0, REG_PTB1,REG_IVAR0, REG_IVAR1,
-};
-
-void db_reverseBits();
-
-#define get_byte(l,t) ((unsigned char) db_get_task_value(l, 1, FALSE, t))
-
-void db_formatOperand(operand, loc, task)
- struct operand *operand;
- db_addr_t loc;
- task_t task;
-{
- int need_comma, i, mask, textlen;
-
- switch (operand->o_mode) {
-
- case AMODE_REG:
- case AMODE_AREG:
- case AMODE_MREG:
- db_printf("%s", regTable[operand->o_reg0].name);
- break;
-
- case AMODE_MREL:
- db_task_printsym((db_addr_t) operand->o_disp1,
- DB_STGY_ANY, task);
- db_printf("(");
- db_task_printsym((db_addr_t) operand->o_disp0,
- DB_STGY_ANY, task);
- db_printf("(%s))",regTable[operand->o_reg0].name);
- break;
-
- case AMODE_QUICK:
- case AMODE_IMM:
- db_task_printsym((db_addr_t) operand->o_disp0,
- DB_STGY_ANY, task);
- break;
-
- case AMODE_ABS:
- db_printf("@");
- db_task_printsym((db_addr_t) operand->o_disp0,
- DB_STGY_ANY, task);
- break;
-
- case AMODE_EXT:
- db_printf("ext(%ld)", operand->o_disp0);
- if (operand->o_disp1)
- db_printf("+%ld", operand->o_disp1);
- break;
-
- case AMODE_TOS:
- db_printf("tos");
- break;
-
- case AMODE_RREL:
- case AMODE_MSPC:
- db_task_printsym((db_addr_t) operand->o_disp0,
- DB_STGY_XTRN, task);
- db_printf("(%s)",regTable[operand->o_reg0].name);
- break;
-
- case AMODE_REGLIST:
- db_printf("[");
- need_comma = 0;
- for (i = 0; i < 8; i++) {
- mask = (1<<i);
- if (operand->o_reg0&mask) {
- if (need_comma)
- db_printf(",");
- db_printf("r%d", i);
- need_comma = 1;
- }
- }
- db_printf("]");
- break;
-
- case AMODE_BLISTB:
- i = 7;
- goto bitlist;
-
- case AMODE_BLISTW:
- i = 15;
- goto bitlist;
-
- case AMODE_BLISTD:
- i = 31;
-
-bitlist:
- db_printf("B'");
- for (; i >= 0; i--, textlen++) {
- mask = (1<<i);
- if (operand->o_disp0&mask)
- db_printf("1");
- else
- db_printf("0");
- }
- break;
-
- case AMODE_SOPT:
- i = operand->o_disp0>>1;
- db_printf("%s", sopt_table[i]);
- break;
-
- case AMODE_CFG:
- db_printf("[");
- need_comma = 0;
- for (i = 0;i < 3;i++) {
- mask = 1<<i;
- if (operand->o_disp0&mask) {
- if (need_comma)
- db_printf(",");
- db_printf("%s",cfg_table[i]);
- need_comma = 1;
- }
- }
- db_printf("]");
- break;
-
- case AMODE_CINV:
- { /* print cache invalidate flags */
- char *p;
- int i, need_comma = 0;
-
- for (i = 4, p = "AID"; i; i >>= 1, ++p)
- if (i & operand->o_disp0) {
- if (need_comma)
- db_printf(",");
- db_printf("%c",*p);
- need_comma = 1;
- }
- }
- break;
-
- case AMODE_INVALID:
- db_printf("?");
- break;
- }
- if (operand->o_iscale) {
- db_printf("[r%d:", operand->o_ireg);
- db_printf("%s]",scale_table[operand->o_iscale]);
- }
-}
-
-void db_formatAsm(insn, loc, task, altfmt)
- struct insn *insn;
- db_addr_t loc;
- task_t task;
- boolean_t altfmt;
-{
- int i, j;
-
- db_printf("%s\t", &insn->i_monic[0]);
-
- for (i = 0; i < 4 && insn->i_opr[i].o_mode != AMODE_NONE; i++) {
- if (i != 0) {
- db_printf(",");
- }
- db_formatOperand(&insn->i_opr[i], loc, task);
- }
- j = 0;
- for (i = 0; i < 4 && insn->i_opr[i].o_mode != AMODE_NONE; i++) {
- if (insn->i_opr[i].o_mode == AMODE_MSPC ||
- insn->i_opr[i].o_mode == AMODE_RREL) {
- register struct db_variable *regp;
- db_expr_t value;
-
- if (strcmp(db_regs->name, "pc") == 0) {
- value = loc;
- } else {
- if (!altfmt) {
- continue;
- }
- for (regp = db_regs; regp < db_eregs; regp++) {
- if (strcmp(regp->name,
- regTable[insn->
- i_opr[i].o_reg0].
- name) == 0) {
- break;
- }
- }
- db_read_write_variable(regp, &value,
- DB_VAR_GET, 0);
- }
- if (j != 0) {
- db_printf(",");
- } else {
- db_printf("\t<");
- }
- db_task_printsym((db_addr_t)
- insn->i_opr[i].o_disp0 + value,
- DB_STGY_XTRN, task);
- j++;
- }
- }
- if (j != 0) {
- db_printf(">");
- }
-}
-
-void db_initInsn (insn)
- struct insn *insn;
-{
- insn->i_opr[0].o_mode = AMODE_NONE;
- insn->i_opr[0].o_iscale = 0;
- insn->i_opr[1].o_mode = AMODE_NONE;
- insn->i_opr[1].o_iscale = 0;
- insn->i_opr[2].o_mode = AMODE_NONE;
- insn->i_opr[2].o_iscale = 0;
- insn->i_opr[3].o_mode = AMODE_NONE;
- insn->i_opr[3].o_iscale = 0;
-}
-
-int db_disp(loc, result, task)
- db_addr_t loc;
- long *result;
- task_t task;
-{
- unsigned int b;
-
- b = get_byte(loc, task);
- if (!(b & 0x80)) { /* one byte */
- *result = ((b & 0x40) ? 0xffffffc0L : 0) | (b & 0x3f);
- return(1);
- } else if (!(b & 0x40)) { /* two byte */
- *result =
- ((b & 0x20) ? 0xffffe000L : 0) | ((b & 0x1f) << 8);
- b = get_byte(loc + 1, task);
- *result |= b;
- return 2;
- } else { /* four byte */
- *result =
- ((b & 0x20) ? 0xe0000000L : 0) | /* bug fix 8/28 */
- ((b & 0x1f) << 24); /* bug fix 7/21 */
- b = get_byte(loc + 1, task);
- *result |= (b << 16);
- b = get_byte(loc + 2, task);
- *result |= (b << 8);
- b = get_byte(loc + 3, task);
- *result |= b;
- return(4);
- }
-}
-
-int db_decode_operand(loc, byte, operand, iol, task)
- db_addr_t loc;
- unsigned char byte;
- struct operand *operand;
- unsigned char iol;
- task_t task;
-{
- register int i, consumed = 0;
- unsigned long value;
-
- switch (byte) {
-
- case GEN_R0:
- case GEN_R1:
- case GEN_R2:
- case GEN_R3:
- case GEN_R4:
- case GEN_R5:
- case GEN_R6:
- case GEN_R7:
- operand->o_mode = AMODE_REG;
- operand->o_reg0 = REG_R0 + byte;
- break;
-
- case GEN_RR0:
- case GEN_RR1:
- case GEN_RR2:
- case GEN_RR3:
- case GEN_RR4:
- case GEN_RR5:
- case GEN_RR6:
- case GEN_RR7:
- operand->o_mode = AMODE_RREL;
- operand->o_reg0 = REG_R0 + (byte&0x7);
- goto one_disp;
-
- case GEN_FRMR:
- operand->o_reg0 = REG_FP;
- operand->o_mode = AMODE_MREL;
- goto two_disp;
-
- case GEN_SPMR:
- operand->o_reg0 = REG_SP;
- operand->o_mode = AMODE_MREL;
- goto two_disp;
-
- case GEN_SBMR:
- operand->o_reg0 = REG_SB;
- operand->o_mode = AMODE_MREL;
- goto two_disp;
-
- case GEN_IMM:
- operand->o_mode = AMODE_IMM;
- /* fix to sign extend */
- value = (get_byte(loc, task) & 0x80)? 0xffffffff: 0;
- for (i = 0; i < iol; i++) {
- value = (value << 8) + get_byte(loc + i, task);
- }
- operand->o_disp0 = value;
- consumed = iol;
- break;
-
- case GEN_ABS:
- operand->o_mode = AMODE_ABS;
- goto one_disp;
-
- case GEN_EXT:
- operand->o_mode = AMODE_EXT;
- goto two_disp;
-
- case GEN_TOS:
- operand->o_mode = AMODE_TOS;
- break;
-
- case GEN_FRM:
- operand->o_mode = AMODE_MSPC;
- operand->o_reg0 = REG_FP;
- goto one_disp;
-
- case GEN_SPM:
- operand->o_mode = AMODE_MSPC;
- operand->o_reg0 = REG_SP;
- goto one_disp;
-
- case GEN_SBM:
- operand->o_mode = AMODE_MSPC;
- operand->o_reg0 = REG_SB;
- goto one_disp;
-
- case GEN_PCM:
- operand->o_mode = AMODE_MSPC;
- operand->o_reg0 = REG_PC;
- goto one_disp;
-
- default:
- operand->o_mode = AMODE_INVALID;
- break;
-
-two_disp:
- consumed = db_disp(loc, &operand->o_disp0, task);
- consumed += db_disp(loc + consumed, &operand->o_disp1, task);
- break;
-
-one_disp:
- consumed = db_disp(loc, &operand->o_disp0, task);
- break;
- }
- return(consumed);
-}
-
-int db_gen(insn, loc, mask, byte0, byte1, task)
- struct insn *insn;
- db_addr_t loc;
- int mask; /* 1 to get gen1, 2 to get gen2 */
- unsigned char byte0, byte1;
- task_t task;
-{
- int opr = 0, opr2, consumed = 0;
- unsigned char gen0, gen1;
-
- gen0 = GetGen0(byte1); /* mask and shift gen fields */
- gen1 = GetGen1(byte0, byte1); /* gen0 is really 1, gen1 is 2 */
-
- while (insn->i_opr[opr].o_mode != AMODE_NONE)
- opr++;
-
- if (mask & 0x1) {
- if (insn->i_opr[opr].o_iscale = GetGenSI(gen0)) {
- ScaledFields(get_byte(loc, task),
- insn->i_opr[opr].o_ireg, gen0);
- consumed++;
- }
- opr2 = opr + 1;
- } else {
- opr2 = opr;
- }
-
- if (mask & 0x2 &&
- (insn->i_opr[opr2].o_iscale = GetGenSI(gen1))) {
- ScaledFields(get_byte(loc + consumed, task),
- insn->i_opr[opr2].o_ireg, gen1);
- consumed++;
- }
-
- if (mask & 0x1) {
- consumed += db_decode_operand(loc + consumed, gen0,
- &insn->i_opr[opr], insn->i_iol,
- task);
- }
- if (mask & 0x2) {
- consumed += db_decode_operand(loc + consumed, gen1,
- &insn->i_opr[opr2], insn->i_iol,
- task);
- }
- return(consumed);
-}
-
-int db_dasm_ns32k(insn, loc, task)
- struct insn *insn;
- db_addr_t loc; /* start addr of this insn */
- task_t task;
-{
- unsigned char byte0, byte1, byte2;
- int i, j;
- int consumed;
-
- insn->i_iol = IOL_NONE; /* Don't assume any operand length */
- byte0 = get_byte(loc, task); /* look at first byte in insn */
- consumed = 1;
- i = byte0 / 2; /* get index into fmttab */
- if (byte0 % 2)
- j = ((fmttab[i] & 0xf0) >> 4);
- else
- j = (fmttab[i]) & 0x0f;
-
- insn->i_format = j; /* set insn type */
-
- switch (j) {
- case ITYPE_FMT0:
- insn->i_op = FMT0_COND(byte0); /* condition code field */
- insn->i_monic[0] = 'b';
- insn->i_monic[1] = cond_table[insn->i_op][0];
- insn->i_monic[2] = cond_table[insn->i_op][1];
- insn->i_monic[3] = '\0';
- insn->i_opr[0].o_mode = AMODE_IMM; /* MSPC implied */
- insn->i_opr[0].o_reg0 = REG_PC;
- consumed += db_disp(loc + consumed, &insn->i_opr[0].o_disp0,
- task);
- insn->i_opr[0].o_disp0 += loc;
- break;
-
- case ITYPE_FMT1:
- insn->i_op = FMT1_OP(byte0);
- strcpy(insn->i_monic, fmt1_table[insn->i_op]);
- switch (insn->i_op) {
- case FMT1_CXP:
- case FMT1_RXP:
- case FMT1_RET:
- case FMT1_RETT:
- insn->i_opr[0].o_mode = AMODE_IMM;
- consumed += db_disp(loc + consumed,
- &insn->i_opr[0].o_disp0, task);
- break;
-
- case FMT1_BSR:
- insn->i_opr[0].o_mode = AMODE_IMM; /* MSPC implied */
- insn->i_opr[0].o_reg0 = REG_PC;
- consumed += db_disp(loc + consumed,
- &insn->i_opr[0].o_disp0, task);
- insn->i_opr[0].o_disp0 += loc;
- break;
-
- case FMT1_SAVE:
- case FMT1_RESTORE:
- case FMT1_ENTER:
- case FMT1_EXIT:
- insn->i_opr[0].o_mode = AMODE_REGLIST;
- insn->i_opr[0].o_reg0 = get_byte(loc + consumed, task);
- consumed++;
- if (insn->i_op == FMT1_EXIT ||
- insn->i_op == FMT1_RESTORE) /* WBC bug fix */
- db_reverseBits (&(insn->i_opr[0].o_reg0));
- if (insn->i_op == FMT1_ENTER) {
- /* MSPC implied */
- insn->i_opr[1].o_mode = AMODE_IMM;
- insn->i_opr[1].o_reg0 = REG_PC;
- consumed += db_disp(loc + consumed,
- &insn->i_opr[1].o_disp0,
- task);
- }
- break;
- }
- break;
-
- case ITYPE_FMT2:
- byte1 = get_byte(loc + consumed, task);
- consumed++;
- insn->i_op = FMT2_OP(byte0);
- insn->i_iol = IOL(byte0);
- i = GetShort(byte0, byte1);
- strcpy(insn->i_monic, fmt2_table[insn->i_op]);
- switch (insn->i_op) {
-
- case FMT2_SCOND:
- strcat(insn->i_monic, cond_table[i]);
- break;
-
- case FMT2_ADDQ:
- case FMT2_CMPQ:
- case FMT2_ACB:
- case FMT2_MOVQ:
- if (i&0x08) { /* negative quick value */
- insn->i_opr[0].o_disp0 = i;
- insn->i_opr[0].o_disp0 |= 0xfffffff0;
- } else {
- insn->i_opr[0].o_disp0 = i;
- }
- insn->i_opr[0].o_mode = AMODE_QUICK;
- break;
-
- case FMT2_LPR:
- case FMT2_SPR:
- insn->i_opr[0].o_reg0 = cpuRegTable [i];
- insn->i_opr[0].o_mode = AMODE_AREG;
- break;
- }
- consumed += db_gen(insn, loc + consumed, 0x1, 0, byte1, task);
- strcat(insn->i_monic, iol_table[insn->i_iol]);
- if (insn->i_op == FMT2_ACB) {
- consumed += db_disp(loc + consumed,
- &insn->i_opr[2].o_disp0, task);
- insn->i_opr[2].o_disp0 += loc;
- insn->i_opr[2].o_mode = AMODE_IMM;
- }
- break;
-
- case ITYPE_FMT3:
- insn->i_format = ITYPE_FMT3;
- byte1 = get_byte(loc + consumed, task);
- consumed++;
- insn->i_op = FMT3_OP(byte1);
- insn->i_iol = IOL(byte0);
- strcpy(insn->i_monic, fmt3_table[insn->i_op]);
- consumed += db_gen(insn, loc + consumed, 0x1, 0, byte1, task);
- switch (insn->i_op) {
-
- case FMT3_CXPD:
- case FMT3_JUMP:
- case FMT3_JSR:
- if (insn->i_iol != IOL_DOUBLE)
- insn->i_format = ITYPE_UNDEF;
- break;
-
- case FMT3_BICPSR:
- case FMT3_BISPSR:
- if (insn->i_iol == IOL_DOUBLE) {
- insn->i_format = ITYPE_UNDEF;
- break;
- }
- if (insn->i_opr[0].o_mode == AMODE_IMM) {
- if (insn->i_iol == IOL_BYTE)
- insn->i_opr[0].o_mode = AMODE_BLISTB;
- else
- insn->i_opr[0].o_mode = AMODE_BLISTW;
- }
- /* fall through */
-
- case FMT3_CASE:
- case FMT3_ADJSP:
- strcat(insn->i_monic, iol_table[insn->i_iol]);
- break;
-
- case FMT3_UNDEF:
- insn->i_format = ITYPE_UNDEF;
- break;
-
- }
- break;
-
- case ITYPE_FMT4:
- byte1 = get_byte(loc + consumed, task);
- consumed++;
- insn->i_op = FMT4_OP(byte0);
- insn->i_iol = IOL(byte0);
- strcpy(insn->i_monic, fmt4_table[insn->i_op]);
- consumed += db_gen(insn, loc + consumed, 0x3, byte0,
- byte1, task);
- if (insn->i_op == FMT4_ADDR) {
- if (insn->i_iol != IOL_DOUBLE)
- insn->i_format = ITYPE_UNDEF;
- }
- else
- strcat(insn->i_monic, iol_table[insn->i_iol]);
- break;
-
- case ITYPE_FMT5:
- byte1 = get_byte(loc + consumed, task);
- consumed++;
- insn->i_op = FMT5_OP(byte1);
- if (insn->i_op > FMT5_SKPS) {
- insn->i_format = ITYPE_UNDEF;
- break;
- }
- strcpy(insn->i_monic, fmt5_table[insn->i_op]);
- byte2 = get_byte(loc + consumed, task);
- consumed++;
- insn->i_opr[0].o_disp0 = GetShort(byte1, byte2);
- insn->i_iol = IOL(byte1);
- switch (insn->i_op) {
-
- case FMT5_MOVS:
- case FMT5_CMPS:
- case FMT5_SKPS:
- if (insn->i_opr[0].o_disp0&0x1)
- strcat(insn->i_monic, "t");
- else
- strcat(insn->i_monic,
- iol_table[insn->i_iol]);
- insn->i_opr[0].o_mode = AMODE_SOPT;
- break;
-
- case FMT5_SETCFG:
- insn->i_opr[0].o_mode = AMODE_CFG;
- break;
- }
- break;
-
- case ITYPE_FMT6:
- byte1 = get_byte(loc + consumed, task);
- consumed++;
- byte2 = get_byte(loc + consumed, task);
- consumed++;
- insn->i_op = FMT6_OP(byte1);
- insn->i_iol = IOL(byte1);
- strcpy(insn->i_monic, fmt6_table[insn->i_op]);
- strcat(insn->i_monic, iol_table[insn->i_iol]);
- if (insn->i_op == FMT6_ROT ||
- insn->i_op == FMT6_ASH ||
- insn->i_op == FMT6_LSH)
- {
- insn->i_iol = 1; /* shift and rotate special case */
- }
- if (insn->i_op == FMT6_UNDEF1 ||
- insn->i_op == FMT6_UNDEF2) {
- insn->i_format = ITYPE_UNDEF;
- break;
- }
- consumed += db_gen(insn, loc + consumed, 0x3, byte1, byte2,
- task);
- break;
-
- case ITYPE_FMT7:
- byte1 = get_byte(loc + consumed, task);
- consumed++;
- byte2 = get_byte(loc + consumed, task);
- consumed++;
- insn->i_op = FMT7_OP(byte1);
- strcpy(insn->i_monic, fmt7_table[insn->i_op]);
- insn->i_iol = IOL(byte1);
- strcat(insn->i_monic, iol_table[insn->i_iol]);
- consumed += db_gen(insn, loc + consumed, 0x3, byte1, byte2,
- task);
- switch (insn->i_op) {
-
- case FMT7_MOVM:
- case FMT7_CMPM:
- consumed += db_disp(loc + consumed,
- &insn->i_opr[2].o_disp0, task);
- /* WBC bug fix */
- insn->i_opr[2].o_mode = AMODE_IMM;
- break;
-
- case FMT7_INSS:
- case FMT7_EXTS:
- byte2 = get_byte(loc + consumed, task);
- consumed++;
- insn->i_opr[2].o_disp0 = ((byte2&0xe0)>>5);
- insn->i_opr[2].o_mode = AMODE_IMM;
- insn->i_opr[3].o_disp0 = ((byte2&0x1f) + 1);
- insn->i_opr[3].o_mode = AMODE_IMM;
- break;
-
- case FMT7_MOVZD:
- case FMT7_MOVXD:
- strcat(insn->i_monic, "d");
- break;
-
- case FMT7_UNDEF:
- insn->i_format = ITYPE_UNDEF;
- break;
- }
- break;
-
- case ITYPE_FMT8:
- byte1 = get_byte(loc + consumed, task);
- consumed++;
- byte2 = get_byte(loc + consumed, task);
- consumed++;
- insn->i_op = FMT8_OP(byte0, byte1);
- strcpy(insn->i_monic, fmt8_table[insn->i_op]);
- insn->i_iol = IOL(byte1);
- switch (insn->i_op) {
-
- case FMT8_MOV:
- if (FMT8_REG(byte1) == FMT8_SU)
- strcat(insn->i_monic, "su");
- else if (FMT8_REG(byte1) == FMT8_US)
- strcat(insn->i_monic, "us");
- else
- strcat(insn->i_monic, "??");
- /* fall through */
-
- case FMT8_EXT:
- case FMT8_INS:
- case FMT8_CHECK:
- case FMT8_INDEX:
- case FMT8_FFS:
- strcat(insn->i_monic, iol_table[insn->i_iol]);
- /* fall through */
-
- case FMT8_CVTP:
- if (insn->i_op != FMT8_FFS && insn->i_op != FMT8_MOV) {
- insn->i_opr[0].o_reg0 =
- REG_R0 + FMT8_REG(byte1);
- insn->i_opr[0].o_mode = AMODE_REG;
- }
- consumed += db_gen(insn, loc + consumed, 0x3, byte1,
- byte2, task);
- if (insn->i_op == FMT8_EXT ||
- insn->i_op == FMT8_INS) {
- consumed += db_disp(loc + consumed,
- &insn->i_opr[3].o_disp0,
- task);
- insn->i_opr[3].o_mode = AMODE_IMM;
- }
- break;
-
- default:
- insn->i_format = ITYPE_UNDEF;
- break;
- }
- break;
-
- case ITYPE_FMT9:
- byte1 = get_byte(loc + consumed, task);
- consumed++;
- byte2 = get_byte(loc + consumed, task);
- consumed++;
- insn->i_op = FMT9_OP(byte1);
- strcpy(insn->i_monic, fmt9_table[insn->i_op]);
- insn->i_iol = IOL(byte1);
- i = FMT9_F(byte1);
- switch (insn->i_op) {
-
- case FMT9_MOV:
- strcat(insn->i_monic, iol_table[insn->i_iol]);
- strcat(insn->i_monic, fol_table[i]);
- consumed += db_gen(insn, loc + consumed, 0x3, byte1,
- byte2, task);
- if (insn->i_opr[1].o_mode == AMODE_REG)
- insn->i_opr[1].o_reg0 =
- REG_F0 + (insn->i_opr[1].o_reg0 - REG_R0);
- break;
-
- case FMT9_LFSR:
- consumed += db_gen(insn, loc + consumed, 0x1,
- byte1, byte2, task);
- break;
-
- case FMT9_SFSR:
- consumed += db_gen(insn, loc + consumed, 0x2,
- byte1, byte2, task);
- break;
-
- case FMT9_MOVLF:
- case FMT9_MOVFL:
- consumed += db_gen(insn, loc + consumed, 0x3, byte1,
- byte2, task);
- if (insn->i_opr[0].o_mode == AMODE_REG)
- insn->i_opr[0].o_reg0 =
- REG_F0 + (insn->i_opr[0].o_reg0 - REG_R0);
- if (insn->i_opr[1].o_mode == AMODE_REG)
- insn->i_opr[1].o_reg0 =
- REG_F0 + (insn->i_opr[1].o_reg0 - REG_R0);
- break;
-
- case FMT9_ROUND:
- case FMT9_TRUNC:
- case FMT9_FLOOR:
- strcat(insn->i_monic, fol_table[i]);
- strcat(insn->i_monic, iol_table[insn->i_iol]);
- consumed += db_gen(insn, loc + consumed, 0x3, byte1,
- byte2, task);
- if (insn->i_opr[0].o_mode == AMODE_REG)
- insn->i_opr[0].o_reg0 =
- REG_F0 + (insn->i_opr[0].o_reg0 - REG_R0);
- break;
- }
- break;
-
- case ITYPE_NOP:
- insn->i_op = NOP;
- strcpy(insn->i_monic, "nop");
- break;
-
- case ITYPE_FMT11:
- byte1 = get_byte(loc + consumed, task);
- consumed++;
- byte2 = get_byte(loc + consumed, task);
- consumed++;
- insn->i_op = FMT11_OP(byte1);
- switch (insn->i_op) {
-
- case FMT11_ADD:
- case FMT11_MOV:
- case FMT11_CMP:
- case FMT11_SUB:
- case FMT11_NEG:
- case FMT11_DIV:
- case FMT11_MUL:
- case FMT11_ABS:
- strcpy(insn->i_monic, fmt11_table[insn->i_op]);
- strcat(insn->i_monic, fol_table[FMT11_F(byte1)]);
- consumed += db_gen(insn, loc + consumed, 0x3, byte1,
- byte2, task);
- if (insn->i_opr[0].o_mode == AMODE_REG)
- insn->i_opr[0].o_reg0 =
- REG_F0 + (insn->i_opr[0].o_reg0 - REG_R0);
- if (insn->i_opr[1].o_mode == AMODE_REG)
- insn->i_opr[1].o_reg0 =
- REG_F0 + (insn->i_opr[1].o_reg0 - REG_R0);
- break;
-
- default:
- insn->i_format = ITYPE_UNDEF;
- break;
-
- }
- break;
-
- case ITYPE_FMT12:
- byte1 = get_byte(loc + consumed, task);
- consumed++;
- byte2 = get_byte(loc + consumed, task);
- consumed++;
- insn->i_op = FMT12_OP(byte1);
- switch (insn->i_op) {
-
- case FMT12_POLY:
- case FMT12_DOT:
- case FMT12_SCALB:
- case FMT12_LOGB:
- strcpy(insn->i_monic, fmt12_table[insn->i_op]);
- strcat(insn->i_monic, fol_table[FMT12_F(byte1)]);
- consumed += db_gen(insn, loc + consumed, 0x3, byte1,
- byte2, task);
- if (insn->i_opr[0].o_mode == AMODE_REG)
- insn->i_opr[0].o_reg0 =
- REG_F0 + (insn->i_opr[0].o_reg0 - REG_R0);
- if (insn->i_opr[1].o_mode == AMODE_REG)
- insn->i_opr[1].o_reg0 =
- REG_F0 + (insn->i_opr[1].o_reg0 - REG_R0);
- break;
-
- default:
- insn->i_format = ITYPE_UNDEF;
- break;
-
- }
- break;
-
- case ITYPE_UNDEF:
- strcpy(insn->i_monic, "???");
- break;
-
- case ITYPE_FMT14:
- byte1 = get_byte(loc + consumed, task);
- consumed++;
- byte2 = get_byte(loc + consumed, task);
- consumed++;
- insn->i_op = FMT14_OP(byte1);
- insn->i_iol = 4;
- strcpy(insn->i_monic, fmt14_table[insn->i_op]);
- switch (insn->i_op) {
-
- case FMT14_CINV:
- insn->i_opr[0].o_disp0 = GetShort(byte1, byte2);
- insn->i_opr[0].o_mode = AMODE_CINV;
- consumed += db_gen(insn, loc + consumed, 0x1,
- byte1/* was 0*/, byte2, task);
- break;
-
- case FMT14_LMR:
- case FMT14_SMR:
- insn->i_opr[0].o_reg0 =
- mmuRegTable[GetShort(byte1, byte2)];
- insn->i_opr[0].o_mode = AMODE_REG;
- /* fall through */
-
- case FMT14_RDVAL:
- case FMT14_WRVAL:
- consumed += db_gen(insn, loc + consumed, 0x1,
- byte1/* was 0*/, byte2, task);
- break;
- }
- break;
-
- default:
- insn->i_format = ITYPE_UNDEF;
- strcpy(insn->i_monic, "???");
- break;
- }
- return(consumed);
-}
-
-/*
- * Reverse the order of the bits in the LS byte of *ip.
- */
-void db_reverseBits (ip)
- int *ip;
-{
- int i, src, dst;
-
- src = *ip;
- dst = 0;
- for (i = 0; i < 8; ++i) {
- dst = (dst << 1) | (src & 1);
- src >>= 1;
- }
- *ip = dst;
-}
-
-/*
- * Disassemble instruction at 'loc'. 'altfmt' specifies an
- * (optional) alternate format. Return address of start of
- * next instruction.
- */
-db_addr_t
-db_disasm(loc, altfmt, task)
- db_addr_t loc;
- boolean_t altfmt;
- task_t task;
-{
- int ate;
- struct insn insn;
-
- db_initInsn(&insn);
- ate = db_dasm_ns32k(&insn, loc, task);
- if (altfmt) {
- int i;
-
- for(i = 0; i < ate; i++) {
- db_printf("%02x",
- db_get_task_value(loc + i, 1, FALSE,
- task) & 0xff);
- }
- if (i < 4)
- db_printf("\t");
- db_printf("\t");
- }
- db_formatAsm(&insn, loc, task, altfmt);
- db_printf("\n");
- return loc + ate;
-}
diff --git a/sys/arch/pc532/pc532/db_interface.c b/sys/arch/pc532/pc532/db_interface.c
deleted file mode 100644
index f22be4739fa..00000000000
--- a/sys/arch/pc532/pc532/db_interface.c
+++ /dev/null
@@ -1,436 +0,0 @@
-/* $NetBSD: db_interface.c,v 1.3 1995/04/10 13:15:43 mycroft Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1992 Carnegie Mellon University
- * Copyright (c) 1992 Helsinki University of Technology
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON AND HELSINKI UNIVERSITY OF TECHNOLOGY ALLOW FREE USE
- * OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON AND
- * HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIM ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-/*
- * File: ns532/db_interface.c
- * Author: Tero Kivinen, Helsinki University of Technology 1992.
- *
- * Interface to new kernel debugger.
- */
-
-#include <sys/reboot.h>
-#include <vm/pmap.h>
-
-#include <ns532/thread.h>
-#include <ns532/db_machdep.h>
-#include <ns532/trap.h>
-#include <ns532/setjmp.h>
-#include <ns532/machparam.h>
-#include <mach/vm_param.h>
-#include <vm/vm_map.h>
-#include <kern/thread.h>
-#include <kern/task.h>
-#include <ddb/db_task_thread.h>
-
-int db_active = 0;
-
-/*
- * Received keyboard interrupt sequence.
- */
-void
-kdb_kbd_trap(regs)
- struct ns532_saved_state *regs;
-{
- if (db_active == 0) {
- printf("\n\nkernel: keyboard interrupt\n");
- kdb_trap(-1, 0, regs);
- }
-}
-
-extern char * trap_type[];
-extern int TRAP_TYPES;
-
-/*
- * Print trap reason.
- */
-void
-kdbprinttrap(type, code)
- int type, code;
-{
- printf("kernel: ");
- if (type > TRAP_TYPES)
- printf("type %d", type);
- else
- printf("%s", trap_type[type]);
- printf(" trap, code=%x\n", code);
-}
-
-/*
- * kdb_trap - field a TRACE or BPT trap
- */
-
-extern jmp_buf_t *db_recover;
-
-int db_active_ipl;
-
-kdb_trap(type, code, regs)
- int type, code;
- register struct ns532_saved_state *regs;
-{
- int s;
-
- s = splsched();
- db_active_ipl = s;
-
- switch (type) {
- case T_BPT: /* breakpoint */
- case T_WATCHPOINT: /* watchpoint */
- case T_TRC: /* trace step */
- case T_DBG: /* hardware debug trap */
- case -1: /* keyboard interrupt */
- break;
-
- default:
- if (db_recover) {
- db_printf("Caught ");
- if (type > TRAP_TYPES)
- db_printf("type %d", type);
- else
- db_printf("%s", trap_type[type]);
- db_printf(" trap, code = %x, pc = %x\n",
- code, regs->pc);
- db_error("");
- /*NOTREACHED*/
- }
- kdbprinttrap(type, code);
- }
-
- /* Should switch to kdb's own stack here. */
-
- ddb_regs = *regs;
-
- db_active++;
- cnpollc(TRUE);
- db_task_trap(type, code, (DDB_REGS->psr & PSR_U) == 0);
- cnpollc(FALSE);
- db_active--;
-
- if ((type = T_BPT) &&
- (db_get_task_value(PC_REGS(DDB_REGS), BKPT_SIZE, FALSE, TASK_NULL)
- == BKPT_INST))
- PC_REGS(DDB_REGS) += BKPT_SIZE;
-
- *regs = ddb_regs;
- (void) splx(s);
- return (1);
-}
-
-int
-db_user_to_kernel_address(task, addr, kaddr, flag)
- task_t task;
- vm_offset_t addr;
- unsigned *kaddr;
- int flag;
-{
- register pt_entry_t *ptp;
-
- ptp = pmap_pte(task->map->pmap, addr);
- if (ptp == PT_ENTRY_NULL || (*ptp & NS532_PTE_VALID) == 0) {
- if (flag) {
- db_printf("\nno memory is assigned to address %08x\n",
- addr);
- db_error(0);
- /* NOTREACHED */
- }
- return(-1);
- }
- *kaddr = (unsigned)ptetokv(*ptp) + (addr & (NS532_PGBYTES-1));
- return(0);
-}
-
-/*
- * Read bytes from kernel address space for debugger.
- */
-
-void
-db_read_bytes(addr, size, data, task)
- vm_offset_t addr;
- register int size;
- register char *data;
- task_t task;
-{
- register char *src;
- register int n;
- unsigned kern_addr;
-
- src = (char *)addr;
- if (addr >= VM_MIN_KERNEL_ADDRESS || task == TASK_NULL) {
- if (task == TASK_NULL)
- task = db_current_task();
- while (--size >= 0) {
- if (addr++ < VM_MIN_KERNEL_ADDRESS &&
- task == TASK_NULL) {
- db_printf("\nbad address %x\n", addr);
- db_error(0);
- /* NOTREACHED */
- }
- *data++ = *src++;
- }
- return;
- }
- while (size > 0) {
- if (db_user_to_kernel_address(task, addr, &kern_addr, 1) < 0)
- return;
- src = (char *)kern_addr;
- n = ns532_trunc_page(addr + NS532_PGBYTES) - addr;
- if (n > size)
- n = size;
- size -= n;
- addr += n;
- while (--n >= 0)
- *data++ = *src++;
- }
-}
-
-/*
- * Write bytes to kernel address space for debugger.
- */
-void
-db_write_bytes(addr, size, data, task)
- vm_offset_t addr;
- register int size;
- register char *data;
- task_t task;
-{
- register char *dst;
-
- register pt_entry_t *ptep0 = 0;
- pt_entry_t oldmap0 = 0;
- vm_offset_t addr1;
- register pt_entry_t *ptep1 = 0;
- pt_entry_t oldmap1 = 0;
- extern char etext;
- void db_write_bytes_user_space();
-
- if ((addr < VM_MIN_KERNEL_ADDRESS) ^
- ((addr + size) <= VM_MIN_KERNEL_ADDRESS)) {
- db_error("\ncannot write data into mixed space\n");
- /* NOTREACHED */
- }
- if (addr < VM_MIN_KERNEL_ADDRESS) {
- if (task) {
- db_write_bytes_user_space(addr, size, data, task);
- return;
- } else if (db_current_task() == TASK_NULL) {
- db_printf("\nbad address %x\n", addr);
- db_error(0);
- /* NOTREACHED */
- }
- }
-
- if (addr >= VM_MIN_KERNEL_ADDRESS &&
- addr <= (vm_offset_t)&etext)
- {
- ptep0 = pmap_pte(pmap_kernel(), addr);
- oldmap0 = *ptep0;
- *ptep0 |= NS532_PTE_WRITE;
-
- addr1 = ns532_trunc_page(addr + size - 1);
- if (ns532_trunc_page(addr) != addr1) {
- /* data crosses a page boundary */
-
- ptep1 = pmap_pte(pmap_kernel(), addr1);
- oldmap1 = *ptep1;
- *ptep1 |= NS532_PTE_WRITE;
- }
- _flush_tlb();
- }
-
- dst = (char *)addr;
-
- while (--size >= 0) {
- *dst++ = *data++;
- _flush_instruction_cache_addr(dst);
- }
-
- if (ptep0) {
- *ptep0 = oldmap0;
- if (ptep1) {
- *ptep1 = oldmap1;
- }
- _flush_tlb();
- }
-}
-
-void
-db_write_bytes_user_space(addr, size, data, task)
- vm_offset_t addr;
- register int size;
- register char *data;
- task_t task;
-{
- register char *dst;
- register n;
- unsigned kern_addr;
-
- while (size > 0) {
- if (db_user_to_kernel_address(task, addr, &kern_addr, 1) < 0)
- return;
- dst = (char *)kern_addr;
- n = ns532_trunc_page(addr+NS532_PGBYTES) - addr;
- if (n > size)
- n = size;
- size -= n;
- addr += n;
- while (--n >= 0)
- *dst++ = *data++;
- }
-}
-
-boolean_t
-db_check_access(addr, size, task)
- vm_offset_t addr;
- register int size;
- task_t task;
-{
- register n;
- unsigned kern_addr;
-
- if (addr >= VM_MIN_KERNEL_ADDRESS) {
- if (kernel_task == TASK_NULL)
- return(TRUE);
- task = kernel_task;
- } else if (task == TASK_NULL) {
- if (current_thread() == THREAD_NULL)
- return(FALSE);
- task = current_thread()->task;
- }
- while (size > 0) {
- if (db_user_to_kernel_address(task, addr, &kern_addr, 0) < 0)
- return(FALSE);
- n = ns532_trunc_page(addr+NS532_PGBYTES) - addr;
- if (n > size)
- n = size;
- size -= n;
- addr += n;
- }
- return(TRUE);
-}
-
-boolean_t
-db_phys_eq(task1, addr1, task2, addr2)
- task_t task1;
- vm_offset_t addr1;
- task_t task2;
- vm_offset_t addr2;
-{
- unsigned kern_addr1, kern_addr2;
-
- if (addr1 >= VM_MIN_KERNEL_ADDRESS || addr2 >= VM_MIN_KERNEL_ADDRESS)
- return(FALSE);
- if ((addr1 & (NS532_PGBYTES-1)) != (addr2 & (NS532_PGBYTES-1)))
- return(FALSE);
- if (task1 == TASK_NULL) {
- if (current_thread() == THREAD_NULL)
- return(FALSE);
- task1 = current_thread()->task;
- }
- if (db_user_to_kernel_address(task1, addr1, &kern_addr1, 0) < 0
- || db_user_to_kernel_address(task2, addr2, &kern_addr2) < 0)
- return(FALSE);
- return(kern_addr1 == kern_addr2);
-}
-
-#define DB_USER_STACK_ADDR (VM_MIN_KERNEL_ADDRESS)
-#define DB_NAME_SEARCH_LIMIT (DB_USER_STACK_ADDR-(NS532_PGBYTES*3))
-
-static int
-db_search_null(task, svaddr, evaddr, skaddr, flag)
- task_t task;
- unsigned *svaddr;
- unsigned evaddr;
- unsigned *skaddr;
- int flag;
-{
- register unsigned vaddr;
- register unsigned *kaddr;
-
- kaddr = (unsigned *)*skaddr;
- for (vaddr = *svaddr; vaddr > evaddr; vaddr -= sizeof(unsigned)) {
- if (vaddr % NS532_PGBYTES == 0) {
- vaddr -= sizeof(unsigned);
- if (db_user_to_kernel_address(task, vaddr,
- skaddr, 0) < 0)
- return(-1);
- kaddr = (unsigned *)*skaddr;
- } else {
- vaddr -= sizeof(unsigned);
- kaddr--;
- }
- if ((*kaddr == 0) ^ (flag == 0)) {
- *svaddr = vaddr;
- *skaddr = (unsigned)kaddr;
- return(0);
- }
- }
- return(-1);
-}
-
-void
-db_task_name(task)
- task_t task;
-{
- register char *p;
- register n;
- unsigned vaddr, kaddr;
-
- vaddr = DB_USER_STACK_ADDR;
- kaddr = 0;
-
- /*
- * skip nulls at the end
- */
- if (db_search_null(task, &vaddr,
- DB_NAME_SEARCH_LIMIT, &kaddr, 0) < 0) {
- db_printf(DB_NULL_TASK_NAME);
- return;
- }
- /*
- * search start of args
- */
- if (db_search_null(task, &vaddr,
- DB_NAME_SEARCH_LIMIT, &kaddr, 1) < 0) {
- db_printf(DB_NULL_TASK_NAME);
- return;
- }
-
- n = DB_TASK_NAME_LEN-1;
- p = (char *)kaddr + sizeof(unsigned);
- for (vaddr += sizeof(int); vaddr < DB_USER_STACK_ADDR && n > 0;
- vaddr++, p++, n--) {
- if (vaddr % NS532_PGBYTES == 0) {
- (void)db_user_to_kernel_address(task,
- vaddr, &kaddr, 0);
- p = (char*)kaddr;
- }
- db_printf("%c", (*p < ' ' || *p > '~')? ' ': *p);
- }
- while (n-- >= 0) /* compare with >= 0 for one more space */
- db_printf(" ");
-}
diff --git a/sys/arch/pc532/pc532/db_trace.c b/sys/arch/pc532/pc532/db_trace.c
deleted file mode 100644
index 321adf3e793..00000000000
--- a/sys/arch/pc532/pc532/db_trace.c
+++ /dev/null
@@ -1,681 +0,0 @@
-/* $NetBSD: db_trace.c,v 1.2 1994/10/26 08:24:58 cgd Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1992 Carnegie Mellon University
- * Copyright (c) 1992 Helsinki University of Technology
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON AND HELSINKI UNIVERSITY OF TECHNOLOGY ALLOW FREE USE
- * OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON AND
- * HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIM ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-/*
- * File: ns532/db_trace.c
- * Author: Tero Kivinen, Tatu Ylonen
- * Helsinki University of Technology 1992.
- *
- * Stack trace and special register support for debugger.
- */
-
-
-#include <mach/boolean.h>
-#include <machine/db_machdep.h>
-#include <machine/pic.h>
-
-#include <ddb/db_access.h>
-#include <ddb/db_sym.h>
-#include <ddb/db_variables.h>
-
-#include <kern/thread.h>
-
-int db_spec_regs();
-int db_ns532_reg_value();
-int db_ns532_kreg_value();
-
-/*
- * Machine register set.
- */
-struct db_variable db_regs[] = {
- { "r0", (long *)&ddb_regs.r0, db_ns532_reg_value },
- { "r1", (long *)&ddb_regs.r1, db_ns532_reg_value },
- { "r2", (long *)&ddb_regs.r2, db_ns532_reg_value },
- { "r3", (long *)&ddb_regs.r3, db_ns532_reg_value },
- { "r4", (long *)&ddb_regs.r4, db_ns532_reg_value },
- { "r5", (long *)&ddb_regs.r5, db_ns532_reg_value },
- { "r6", (long *)&ddb_regs.r6, db_ns532_reg_value },
- { "r7", (long *)&ddb_regs.r7, db_ns532_reg_value },
- { "sp", (long *)&ddb_regs.usp, db_ns532_reg_value },
- { "fp", (long *)&ddb_regs.fp, db_ns532_reg_value },
- { "sb", (long *)&ddb_regs.sb, db_ns532_reg_value },
- { "pc", (long *)&ddb_regs.pc, db_ns532_reg_value },
- { "psr",(long *)&ddb_regs.psr, db_ns532_reg_value },
- { "tear",(long *)&ddb_regs.tear,db_ns532_reg_value },
- { "msr",(long *)&ddb_regs.msr, db_ns532_reg_value },
- { "ipl",(long *)&db_active_ipl,db_ns532_reg_value },
-#ifdef FLOATS_SAVED
- { "f0", (long *)&ddb_regs.l0a, db_ns532_reg_value },
- { "f1", (long *)&ddb_regs.l0b, db_ns532_reg_value },
- { "f2", (long *)&ddb_regs.l1a, db_ns532_reg_value },
- { "f3", (long *)&ddb_regs.l1b, db_ns532_reg_value },
- { "f4", (long *)&ddb_regs.l2a, db_ns532_reg_value },
- { "f5", (long *)&ddb_regs.l2b, db_ns532_reg_value },
- { "f6", (long *)&ddb_regs.l3a, db_ns532_reg_value },
- { "f7", (long *)&ddb_regs.l3b, db_ns532_reg_value },
- { "fsr",(long *)&ddb_regs.fsr, db_ns532_reg_value },
-#endif FLOATS_SAVED
- { "ksp", (long *) 0, db_spec_regs },
- { "intbase", (long *) 0, db_spec_regs },
- { "ptb", (long *) 0, db_spec_regs },
- { "ivar", (long *) 0, db_spec_regs },
- { "rtear", (long *) 0, db_spec_regs }, /* current reg value */
- { "mcr", (long *) 0, db_spec_regs },
- { "rmsr", (long *) 0, db_spec_regs }, /* current reg value */
- { "dcr", (long *) 0, db_spec_regs },
- { "dsr", (long *) 0, db_spec_regs },
- { "car", (long *) 0, db_spec_regs },
- { "bpc", (long *) 0, db_spec_regs },
- { "cfg", (long *) 0, db_spec_regs }
-};
-struct db_variable *db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
-
-struct db_regs_bits_s {
- char *name;
- char *bitfld;
-};
-
-struct db_regs_bits_s db_regs_bits[] = {
- "psr", "0,0,0,0: ,0,0,0,0: ,0,0,0,0: ,0,0,0,0: ,0,0,0,0: ,i,p,s,u,n,z,f,v,0,l,t,c",
- "fsr", "0,0,0,0: ,0,0,0,0: ,0,0,0,0: ,0,0,0,rmb,s5,s4,s3,s2,s1,s0,@roundm,if,ien,uf,uen,@trapt",
- "mcr", "0,0,0,0: ,0,0,0,0: ,0,0,0,0: ,0,0,0,0: ,0,0,0,0: ,0,0,0,0: ,0,0,0,0: ,ao,ds,ts,tu",
- "msr", "0,0,0,0: ,0,0,0,0: ,0,0,0,0: ,0,0,0,0: ,0,0,0,0 :,0,0,0,0: ,@sst,ust,ddt,@tex",
- "rmsr", "0,0,0,0: ,0,0,0,0: ,0,0,0,0: ,0,0,0,0: ,0,0,0,0 :,0,0,0,0: ,@sst,ust,ddt,@tex",
- "dcr", "0,0,0,0: ,0,0,0,0: ,den,sd,ud,pce,tr,bcp,si,0: ,0,0,0,0: ,0,0,0,bf,cae,crd,cwr,vnp,cbe3,cbe2,cbe1,cbe0",
- "dsr", "rd,bpc,bex,bca,0,0,0,0: ,0,0,0,0: ,0,0,0,0: ,0,0,0,0: ,0,0,0,0: ,0,0,0,0: ,0,0,0,0",
- "cfg", "0,0,0,0: ,0,0,0,0: ,0,0,0,0: ,0,0,0,0: ,0,0,pf,lic,ic,ldc,dc,de,1,1,1,1,c,m,f,i"
- };
-
-struct db_regs_bits_s *db_eregs_bits = db_regs_bits +
- sizeof(db_regs_bits)/sizeof(db_regs_bits[0]);
-
-struct db_regs_fields_s {
- char *name;
- int bits;
- char *values;
-};
-
-struct db_regs_fields_s db_regs_fields[] = {
- "trapt", 3, "None,Underflow,Overflow,Div by 0,Ill inst,Invalid oper,Inexact res,Reserved",
- "roundm", 2, "Nearest,Zero,Pos inf,Neg inf",
- "tex", 2, "None,1st PTE inv,2nd PTE inv,Prot",
- "sst", 4, "0000,0001,0010,0011,0100,0101,0110,0111,Seq.ins.fetch,Non.seq.ins.fetch,Data transfer,Read-modify-write,Read eff.addr,1101,1110,1111"
-};
-
-struct db_regs_fields_s *db_eregs_fields = db_regs_fields +
- sizeof(db_regs_fields)/sizeof(db_regs_fields[0]);
-
-/*
- * Stack trace.
- */
-#define INKERNEL(va) (((vm_offset_t)(va)) >= VM_MIN_KERNEL_ADDRESS)
-
-struct ns532_frame {
- struct ns532_frame *f_frame;
- int f_retaddr;
- int f_arg0;
-};
-
-#define TRAP 1
-#define INTERRUPT 2
-#define SYSCALL 3
-
-struct ns532_kregs {
- char *name;
- int offset;
-} ns532_kregs[] = {
- { "r3", (int)(&((struct ns532_kernel_state *)0)->k_r3) },
- { "r4", (int)(&((struct ns532_kernel_state *)0)->k_r4) },
- { "r5", (int)(&((struct ns532_kernel_state *)0)->k_r5) },
- { "r6", (int)(&((struct ns532_kernel_state *)0)->k_r6) },
- { "r7", (int)(&((struct ns532_kernel_state *)0)->k_r7) },
- { "sp", (int)(&((struct ns532_kernel_state *)0)->k_sp) },
- { "fp", (int)(&((struct ns532_kernel_state *)0)->k_fp) },
- { "pc", (int)(&((struct ns532_kernel_state *)0)->k_pc) },
- { 0 },
-};
-
-int *
-db_lookup_ns532_kreg(name, kregp)
- char *name;
- int *kregp;
-{
- register struct ns532_kregs *kp;
-
- for (kp = ns532_kregs; kp->name; kp++) {
- if (strcmp(name, kp->name) == 0)
- return((int *)((int)kregp + kp->offset));
- }
- return(0);
-}
-
-int
-db_ns532_reg_value(vp, valuep, flag, ap)
- struct db_variable *vp;
- db_expr_t *valuep;
- int flag;
- db_var_aux_param_t ap;
-{
- int *dp = 0;
- db_expr_t null_reg = 0;
- register thread_t thread = ap->thread;
-
- if (db_option(ap->modif, 'u')) {
- if (thread == THREAD_NULL) {
- if ((thread = current_thread()) == THREAD_NULL)
- db_error("no user registers\n");
- }
- if (thread == current_thread()) {
- if ((ddb_regs.psr & PSR_U) == 0)
- dp = vp->valuep;
- }
- } else {
- if (thread == THREAD_NULL || thread == current_thread()) {
- dp = vp->valuep;
- } else if ((thread->state & TH_SWAPPED) == 0 &&
- thread->kernel_stack) {
- dp = db_lookup_ns532_kreg(vp->name,
- (int *)(STACK_IKS(thread->kernel_stack)));
- if (dp == 0)
- dp = &null_reg;
- } else if ((thread->state & TH_SWAPPED) &&
- thread->swap_func != thread_exception_return) {
- /* only pc is valid */
- if (vp->valuep == (int *) &ddb_regs.pc) {
- dp = (int *)(&thread->swap_func);
- } else {
- dp = &null_reg;
- }
- }
- }
- if (dp == 0) {
- if (thread->pcb == 0)
- db_error("no pcb\n");
- dp = (int *)((int)(&thread->pcb->iss) +
- ((int)vp->valuep - (int)&ddb_regs));
- }
- if (flag == DB_VAR_SET)
- *dp = *valuep;
- else
- *valuep = *dp;
- return(0);
-}
-
-db_addr_t db_trap_symbol_value = 0;
-db_addr_t db_intr_symbol_value = 0;
-boolean_t db_trace_symbols_found = FALSE;
-
-void
-db_find_trace_symbols()
-{
- db_expr_t value;
- if (db_value_of_name("_trap", &value))
- db_trap_symbol_value = (db_addr_t) value;
- if (db_value_of_name("_interrupt", &value))
- db_intr_symbol_value = (db_addr_t) value;
- db_trace_symbols_found = TRUE;
-}
-
-/*
- * Figure out how many arguments were passed into the frame at "fp".
- */
-int db_numargs_default = 5;
-
-int
-db_numargs(fp, task)
- struct ns532_frame *fp;
- task_t task;
-{
- int a;
- char *nextaddr;
-
- nextaddr = (char *) db_get_task_value((int) &fp->f_frame, 4,
- FALSE, task);
- a = nextaddr-(char *)fp-8;
- a /= 4;
- if (a < 0 || a > 16)
- a = db_numargs_default;
- return a;
-}
-
-extern int (*ivect[])();
-
-/*
- * Figure out the next frame up in the call stack.
- * For trap(), we print the address of the faulting instruction and
- * proceed with the calling frame. We return the ip that faulted.
- * If the trap was caused by jumping through a bogus pointer, then
- * the next line in the backtrace will list some random function as
- * being called. It should get the argument list correct, though.
- * It might be possible to dig out from the next frame up the name
- * of the function that faulted, but that could get hairy.
- */
-void
-db_nextframe(fp, ip, frame_type, thread)
- struct ns532_frame **fp; /* in/out */
- db_addr_t *ip; /* out */
- int frame_type; /* in */
- thread_t thread; /* in */
-{
- extern char * trap_type[];
- extern int TRAP_TYPES;
-
- struct ns532_saved_state *saved_regs;
- int vector;
- task_t task = (thread != THREAD_NULL)? thread->task: TASK_NULL;
-
- switch(frame_type) {
- case TRAP:
- /*
- * We know that trap() has 1 argument and we know that
- * it is an (int *).
- */
- saved_regs = (struct ns532_saved_state *)
- db_get_value((int) &((*fp)->f_arg0), 4, FALSE);
- if (saved_regs->trapno >= 0 &&
- saved_regs->trapno < TRAP_TYPES) {
- db_printf(">>>>>> %s trap at ",
- trap_type[saved_regs->trapno]);
- } else {
- db_printf(">>>>>> trap (number %d) at ",
- saved_regs->trapno & 0xffff);
- }
- db_task_printsym(saved_regs->pc, DB_STGY_PROC, task);
- db_printf(" <<<<<<\n");
- *fp = (struct ns532_frame *)saved_regs->fp;
- *ip = (db_addr_t)saved_regs->pc;
- break;
- case INTERRUPT:
- /*
- * We know that interrupt() has 3 argument.
- */
-
- vector = db_get_value((int) &((*fp)->f_arg0), 4, FALSE);
- saved_regs = (struct ns532_saved_state *)
- db_get_value((int) &((*fp)->f_arg0) + 8, 4, FALSE);
- db_printf(">>>>>> ");
- if (vector >=0 && vector < NINTR) {
- db_task_printsym((int) ivect[vector],
- DB_STGY_PROC, task);
- db_printf(" interrupt at ");
- } else {
- db_printf("interrupt vector %d at ", vector);
- }
- db_task_printsym(saved_regs->pc, DB_STGY_PROC, task);
- db_printf(" <<<<<<\n");
- *fp = (struct ns532_frame *)saved_regs->fp;
- *ip = (db_addr_t)saved_regs->pc;
- break;
- default:
- *ip = (db_addr_t)
- db_get_task_value((int) &(*fp)->f_retaddr, 4, FALSE, task);
- *fp = (struct ns532_frame *)
- db_get_task_value((int) &(*fp)->f_frame, 4, FALSE, task);
- break;
- }
-}
-
-void
-db_stack_trace_cmd(addr, have_addr, count, modif)
- db_expr_t addr;
- boolean_t have_addr;
- db_expr_t count;
- char *modif;
-{
- struct ns532_frame *frame, *lastframe;
- int *argp;
- db_addr_t callpc;
- int frame_type;
- boolean_t kernel_only = TRUE;
- boolean_t trace_thread = FALSE;
- char *filename;
- int linenum;
- task_t task;
- thread_t th;
- int user_frame = 0;
- extern unsigned db_maxoff;
-
-
- if (!db_trace_symbols_found)
- db_find_trace_symbols();
-
- {
- register char *cp = modif;
- register char c;
-
- while ((c = *cp++) != 0) {
- if (c == 't')
- trace_thread = TRUE;
- if (c == 'u')
- kernel_only = FALSE;
- }
- }
-
- if (count == -1)
- count = 65535;
-
- if (!have_addr && !trace_thread) {
- frame = (struct ns532_frame *)ddb_regs.fp;
- callpc = (db_addr_t)ddb_regs.pc;
- th = current_thread();
- task = (th != THREAD_NULL) ? th->task : TASK_NULL;
- } else if (trace_thread) {
- if (have_addr) {
- th = (thread_t) addr;
- if (!db_check_thread_address_valid(th))
- return;
- } else {
- th = db_default_thread;
- if (th = THREAD_NULL)
- current_thread();
- if (th == THREAD_NULL) {
- db_printf("no active thread\n");
- return;
- }
- }
- task = th->task;
- if (th == current_thread()) {
- frame = (struct ns532_frame *)ddb_regs.fp;
- callpc = (db_addr_t)ddb_regs.pc;
- } else {
- if (th->pcb == 0) {
- db_printf("thread has no pcb\n");
- return;
- }
- if ((th->state & TH_SWAPPED) ||
- th->kernel_stack == 0) {
- register struct ns532_saved_state *iss =
- &th->pcb->iss;
-
- db_printf("Continuation ");
- db_task_printsym(th->swap_func, DB_STGY_PROC,
- task);
- db_printf("\n");
-
- frame = (struct ns532_frame *) (iss->fp);
- callpc = (db_addr_t) (iss->pc);
- } else {
- register struct ns532_kernel_state *iks;
- iks = STACK_IKS(th->kernel_stack);
- frame = (struct ns532_frame *) (iks->k_fp);
- callpc = (db_addr_t) (iks->k_pc);
- }
- }
- } else {
- frame = (struct ns532_frame *)addr;
- th = (db_default_thread)? db_default_thread: current_thread();
- task = (th != THREAD_NULL)? th->task: TASK_NULL;
- callpc = (db_addr_t)db_get_task_value((int)&frame->f_retaddr,
- 4, FALSE, task);
- }
-
- if (!INKERNEL(callpc) && !INKERNEL(frame)) {
- db_printf(">>>>>> user space <<<<<<\n");
- user_frame++;
- }
-
- while (count-- && frame != 0) {
- register int narg;
- char * name;
- db_expr_t offset;
-
- if (INKERNEL(callpc) && user_frame == 0) {
- db_addr_t call_func = 0;
-
- db_symbol_values(db_search_task_symbol(callpc,
- DB_STGY_XTRN,
- &offset,
- TASK_NULL),
- &name, &call_func);
- if (call_func == db_trap_symbol_value) {
- frame_type = TRAP;
- narg = 1;
- } else if (call_func == db_intr_symbol_value) {
- frame_type = INTERRUPT;
- narg = 3;
-#ifdef SYSCALL_FRAME_IMPLEMENTED
- } else if (call_func == db_syscall_symbol_value) {
- frame_type = SYSCALL;
- goto next_frame;
-#endif
- } else {
- frame_type = 0;
- narg = db_numargs(frame, task);
- }
- } else if ((INKERNEL(callpc) == 0) != (INKERNEL(frame) == 0)) {
- frame_type = 0;
- narg = -1;
- } else {
- frame_type = 0;
- narg = db_numargs(frame, task);
- }
-
- db_find_task_sym_and_offset(callpc, &name, &offset, task);
- if (name == 0 || offset > db_maxoff) {
- db_printf("0x%x(", callpc);
- offset = 0;
- } else
- db_printf("%s(", name);
-
- argp = &frame->f_arg0;
- while (narg > 0) {
- db_printf("%x",
- db_get_task_value((int)argp,4,FALSE,task));
- argp++;
- if (--narg != 0)
- db_printf(",");
- }
- if (narg < 0)
- db_printf("...");
- db_printf(")");
- if (offset) {
- db_printf("+%x", offset);
- }
- if (db_line_at_pc(0, &filename, &linenum, callpc)) {
- db_printf(" [%s", filename);
- if (linenum > 0)
- db_printf(":%d", linenum);
- printf("]");
- }
-
- db_printf("\n");
- next_frame:
- lastframe = frame;
- db_nextframe(&frame, &callpc, frame_type, th);
-
- if (frame == 0) {
- /* end of chain */
- break;
- }
- if (!INKERNEL(lastframe) ||
- (!INKERNEL(callpc) && !INKERNEL(frame)))
- user_frame++;
- if (user_frame == 1) {
- db_printf(">>>>>> user space <<<<<<\n");
- if (kernel_only)
- break;
- }
- if (frame <= lastframe) {
- if (INKERNEL(lastframe) && !INKERNEL(frame))
- continue;
- db_printf("Bad frame pointer: 0x%x\n", frame);
- break;
- }
- }
-}
-
-/**********************************************
-
- Get/Set value of special registers.
-
- *********************************************/
-
-int db_spec_regs(vp, valp, what)
- struct db_variable *vp;
- db_expr_t *valp;
- int what;
-{
- if (strcmp(vp->name, "intbase") == 0)
- if (what == DB_VAR_GET)
- *valp = _get_intbase();
- else
- _set_intbase(*valp);
- else if (strcmp(vp->name, "ptb") == 0)
- if (what == DB_VAR_GET)
- *valp = _get_ptb();
- else
- _set_ptb(*valp);
- else if (strcmp(vp->name, "ivar") == 0)
- if (what == DB_VAR_GET)
- *valp = 0;
- else
- _invalidate_page(*valp);
- else if (strcmp(vp->name, "rtear") == 0)
- if (what == DB_VAR_GET)
- *valp = _get_tear();
- else
- _set_tear(*valp);
- else if (strcmp(vp->name, "mcr") == 0)
- if (what == DB_VAR_GET)
- *valp = _get_mcr();
- else
- _set_mcr(*valp);
- else if (strcmp(vp->name, "rmsr") == 0)
- if (what == DB_VAR_GET)
- *valp = _get_msr();
- else
- _set_msr(*valp);
- else if (strcmp(vp->name, "dcr") == 0)
- if (what == DB_VAR_GET)
- *valp = _get_dcr();
- else
- _set_dcr(*valp);
- else if (strcmp(vp->name, "dsr") == 0)
- if (what == DB_VAR_GET)
- *valp = _get_dsr();
- else
- _set_dsr(*valp);
- else if (strcmp(vp->name, "car") == 0)
- if (what == DB_VAR_GET)
- *valp = _get_car();
- else
- _set_car(*valp);
- else if (strcmp(vp->name, "bpc") == 0)
- if (what == DB_VAR_GET)
- *valp = _get_bpc();
- else
- _set_bpc(*valp);
- else if (strcmp(vp->name, "cfg") == 0)
- if (what == DB_VAR_GET)
- *valp = _get_cfg();
- else
- _set_cfg(*valp);
- else if (strcmp(vp->name, "ksp") == 0)
- if (what == DB_VAR_GET)
- *valp = _get_ksp();
- else
- _set_ksp(*valp);
- else
- db_printf("Internal error, unknown register in db_spec_regs");
-}
-
-/***************************************************
-
- Print special bit mask registers in bitmask format
-
- **************************************************/
-
-int db_print_spec_reg(vp, valuep)
- struct db_variable *vp;
- db_expr_t valuep;
-{
- struct db_regs_bits_s *dbrb;
- int i;
- char *p, buf[256];
-
- for (dbrb = db_regs_bits; dbrb < db_eregs_bits; dbrb++)
- if (strcmp(dbrb->name, vp->name) == 0)
- break;
- if (dbrb == db_eregs_bits)
- return 1;
- db_printf("\t<");
- p = dbrb->bitfld;
- for (i = 31 ; i >= 0 && *p ; i--) { /* All bits */
- if (*p >= '0' && *p <= '9') { /* is number */
- for (; *p != ',' && *p; p++) /* Skip number */
- ;
- if (*p == ',')
- p++;
- } else { /* Is text */
- char *q;
- strcpy(buf, p);
- for(q = buf; *q != ',' && *q; q++, p++) /* Find end */
- ;
- if (*p == ',')
- p++;
- *q='\0';
- if (buf[0] == '@') { /* Is bitfield */
- struct db_regs_fields_s *df;
- q=buf+1; /* Find field */
- for (df = db_regs_fields;
- df < db_eregs_fields; df++)
- if (strcmp(df->name, q) == 0)
- break;
- if (df == db_eregs_fields)
- db_printf("Internal error in print_spec_regs [%s]\n", buf);
- else {
- unsigned int ff;
- db_printf("%s=", q); /* Print field */
- ff = (~(0xffffffff << df->bits)) &
- (valuep>>(i-(df->bits-1)));
- i += df->bits; /* Find value */
- for (q = df->values;
- ff > 0 && *q; ff--, q++)
- for (;*q != ',' && *q; q++)
- ;
- if (*q != '\0') {
- strcpy(buf, q);
- for(q = buf; *q != ',' && *q;
- q++)
- ;
- *q='\0';
- db_printf("%s "); /* Print value */
- } else
- db_printf(" ");
- }
- } else { /* Normal bit */
- if ((1<<i) & valuep) {
- db_printf("%s ", buf);
- }
- }
- }
- }
- db_printf(">");
- return 0;
-}
diff --git a/sys/arch/pc532/pc532/disksubr.c b/sys/arch/pc532/pc532/disksubr.c
deleted file mode 100644
index 4ee049bc736..00000000000
--- a/sys/arch/pc532/pc532/disksubr.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/* $NetBSD: disksubr.c,v 1.7 1995/08/25 07:49:05 phil Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
- */
-
-#include "param.h"
-#include "systm.h"
-#include "buf.h"
-#include "disklabel.h"
-#include "syslog.h"
-
-#define b_cylin b_resid
-
-/*
- * Attempt to read a disk label from a device
- * using the indicated strategy routine.
- * The label must be partly set up before this:
- * secpercyl and anything required in the strategy routine
- * (e.g., sector size) must be filled in before calling us.
- * Returns null on success and an error string on failure.
- */
-char *
-readdisklabel(dev, strat, lp, osdep, spoofonly)
- dev_t dev;
- void (*strat)();
- register struct disklabel *lp;
- struct cpu_disklabel *osdep;
- int spoofonly;
-{
- register struct buf *bp;
- struct disklabel *dlp;
- char *msg = NULL;
-
- if (lp->d_secperunit == 0)
- lp->d_secperunit = 0x1fffffff;
- lp->d_npartitions = 1;
- if (lp->d_partitions[0].p_size == 0)
- lp->d_partitions[0].p_size = 0x1fffffff;
- lp->d_partitions[0].p_offset = 0;
-
- bp = geteblk((int)lp->d_secsize);
- bp->b_dev = dev;
- bp->b_blkno = LABELSECTOR;
- bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
- bp->b_cylin = LABELSECTOR / lp->d_secpercyl;
- (*strat)(bp);
- if (biowait(bp)) {
- msg = "I/O error";
- } else for (dlp = (struct disklabel *)bp->b_un.b_addr;
- dlp <= (struct disklabel *)(bp->b_un.b_addr+DEV_BSIZE-sizeof(*dlp));
- dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
- if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
- if (msg == NULL)
- msg = "no disk label";
- } else if (dlp->d_npartitions > MAXPARTITIONS ||
- dkcksum(dlp) != 0)
- msg = "disk label corrupted";
- else {
- *lp = *dlp;
- msg = NULL;
- break;
- }
- }
- bp->b_flags = B_INVAL | B_AGE;
- brelse(bp);
- return (msg);
-}
-
-/*
- * Check new disk label for sensibility
- * before setting it.
- */
-setdisklabel(olp, nlp, openmask, osdep)
- register struct disklabel *olp, *nlp;
- u_long openmask;
- struct cpu_disklabel *osdep;
-{
- register i;
- register struct partition *opp, *npp;
-
- if (nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC ||
- dkcksum(nlp) != 0)
- return (EINVAL);
- while ((i = ffs((long)openmask)) != 0) {
- i--;
- openmask &= ~(1 << i);
- if (nlp->d_npartitions <= i)
- return (EBUSY);
- opp = &olp->d_partitions[i];
- npp = &nlp->d_partitions[i];
- if (npp->p_offset != opp->p_offset || npp->p_size < opp->p_size)
- return (EBUSY);
- /*
- * Copy internally-set partition information
- * if new label doesn't include it. XXX
- */
- if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
- npp->p_fstype = opp->p_fstype;
- npp->p_fsize = opp->p_fsize;
- npp->p_frag = opp->p_frag;
- npp->p_cpg = opp->p_cpg;
- }
- }
- nlp->d_checksum = 0;
- nlp->d_checksum = dkcksum(nlp);
- *olp = *nlp;
- return (0);
-}
-
-/* encoding of disk minor numbers, should be elsewhere... */
-#define dkunit(dev) (minor(dev) >> 3)
-#define dkpart(dev) (minor(dev) & 07)
-#define dkminor(unit, part) (((unit) << 3) | (part))
-
-/*
- * Write disk label back to device after modification.
- */
-writedisklabel(dev, strat, lp, osdep)
- dev_t dev;
- void (*strat)();
- register struct disklabel *lp;
- struct cpu_disklabel *osdep;
-{
- struct buf *bp;
- struct disklabel *dlp;
- int labelpart;
- int error = 0;
-
- labelpart = dkpart(dev);
- if (lp->d_partitions[labelpart].p_offset != 0) {
- if (lp->d_partitions[0].p_offset != 0)
- return (EXDEV); /* not quite right */
- labelpart = 0;
- }
- bp = geteblk((int)lp->d_secsize);
- bp->b_dev = makedev(major(dev), dkminor(dkunit(dev), labelpart));
- bp->b_blkno = LABELSECTOR;
- bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_READ;
- (*strat)(bp);
- if (error = biowait(bp))
- goto done;
- for (dlp = (struct disklabel *)bp->b_un.b_addr;
- dlp <= (struct disklabel *)
- (bp->b_un.b_addr + lp->d_secsize - sizeof(*dlp));
- dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
- if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
- dkcksum(dlp) == 0) {
- *dlp = *lp;
- bp->b_flags = B_WRITE;
- (*strat)(bp);
- error = biowait(bp);
- goto done;
- }
- }
- /* Write it in the regular place. */
- *(struct disklabel *)bp->b_data = *lp;
- bp->b_flags = B_BUSY | B_WRITE;
- (*strat)(bp);
- error = biowait(bp);
- goto done;
-
-done:
- brelse(bp);
- return (error);
-}
-
-
-/*
- * Determine the size of the transfer, and make sure it is
- * within the boundaries of the partition. Adjust transfer
- * if needed, and signal errors or early completion.
- */
-int
-bounds_check_with_label(bp, lp, osdep, wlabel)
- struct buf *bp;
- struct disklabel *lp;
- struct cpu_disklabel *osdep;
- int wlabel;
-{
- struct partition *p = lp->d_partitions + dkpart(bp->b_dev);
- int maxsz = p->p_size,
- sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT;
-
- /* Check to see if it is the label sector and it is write only. */
- if (bp->b_blkno + p->p_offset <= LABELSECTOR &&
- (bp->b_flags & B_READ) == 0 && wlabel == 0) {
- bp->b_error = EROFS;
- goto bad;
- }
- /* beyond partition? */
- if (bp->b_blkno < 0 || bp->b_blkno + sz > maxsz) {
- /* if exactly at end of disk, return an EOF */
- if (bp->b_blkno == maxsz) {
- bp->b_resid = bp->b_bcount;
- return(0);
- }
- /* or truncate if part of it fits */
- sz = maxsz - bp->b_blkno;
- if (sz <= 0) {
- bp->b_error = EINVAL;
- goto bad;
- }
- bp->b_bcount = sz << DEV_BSHIFT;
- }
-
- /* calculate cylinder for disksort to order transfers with */
- bp->b_cylin = (bp->b_blkno + p->p_offset) / lp->d_secpercyl;
- return(1);
-
-bad:
- bp->b_flags |= B_ERROR;
- return(-1);
-}
-
-/* XXX unknown */
-int
-dk_establish()
-{}
diff --git a/sys/arch/pc532/pc532/genassym.c b/sys/arch/pc532/pc532/genassym.c
deleted file mode 100644
index 487cd8c72b3..00000000000
--- a/sys/arch/pc532/pc532/genassym.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/* $NetBSD: genassym.c,v 1.8 1995/06/09 05:59:58 phil Exp $ */
-
-/*-
- * Copyright (c) 1982, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)genassym.c 5.11 (Berkeley) 5/10/91
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/resourcevar.h>
-#include <sys/device.h>
-#include <vm/vm.h>
-#include <sys/user.h>
-
-#include <machine/cpu.h>
-#include <machine/trap.h>
-
-#include <stdio.h>
-
-main()
-{
- struct proc *p = (struct proc *)0;
- struct user *up = (struct user *)0;
- struct rusage *rup = (struct rusage *)0;
- struct uprof *uprof = (struct uprof *)0;
- struct pcb *pcb = (struct pcb *)0;
- struct on_stack *regs = (struct on_stack *)0;
- struct iv *iv = (struct iv *)0;
- struct vmmeter *vm = 0;
- register unsigned i;
-
- printf("#define\tKERNBASE 0x%x\n", KERNBASE);
- printf("#define\tUDOT_SZ %d\n", sizeof(struct user));
- printf("#define\tP_FORW %d\n", &p->p_forw);
- printf("#define\tP_BACK %d\n", &p->p_back);
- printf("#define\tP_VMSPACE %d\n", &p->p_vmspace);
- printf("#define\tP_ADDR %d\n", &p->p_addr);
- printf("#define\tP_PRIORITY %d\n", &p->p_priority);
- printf("#define\tP_STAT %d\n", &p->p_stat);
- printf("#define\tP_WCHAN %d\n", &p->p_wchan);
- printf("#define\tP_FLAG %d\n", &p->p_flag);
- printf("#define\tP_PID %d\n", &p->p_pid);
-
- printf("#define\tSSLEEP %d\n", SSLEEP);
- printf("#define\tSRUN %d\n", SRUN);
- printf("#define\tUPAGES %d\n", UPAGES);
- printf("#define\tHIGHPAGES %d\n", HIGHPAGES);
- printf("#define\tCLSIZE %d\n", CLSIZE);
- printf("#define\tNBPG %d\n", NBPG);
- printf("#define\tNPTEPG %d\n", NPTEPG);
- printf("#define\tPGSHIFT %d\n", PGSHIFT);
- printf("#define\tSYSPTSIZE %d\n", SYSPTSIZE);
- printf("#define\tUSRPTSIZE %d\n", USRPTSIZE);
-
- printf("#define\tKERN_STK_START 0x%x\n",
- USRSTACK + UPAGES*NBPG);
- printf("#define\tKSTK_SIZE %d\n", UPAGES*NBPG);
- printf("#define\tON_STK_SIZE %d\n", sizeof(struct on_stack));
- printf("#define\tREGS_USP %d\n", &regs->pcb_usp);
- printf("#define\tREGS_FP %d\n", &regs->pcb_fp);
- printf("#define\tREGS_SB %d\n", &regs->pcb_sb);
- printf("#define\tREGS_PSR %d\n", &regs->pcb_psr);
-
- printf("#define\tPCB_ONSTACK %d\n", &pcb->pcb_onstack);
- printf("#define\tPCB_FSR %d\n", &pcb->pcb_fsr);
- for (i=0; i<8; i++)
- printf("#define\tPCB_F%d %d\n", i, &pcb->pcb_freg[i]);
- printf("#define\tPCB_KSP %d\n", &pcb->pcb_ksp);
- printf("#define\tPCB_KFP %d\n", &pcb->pcb_kfp);
- printf("#define\tPCB_PTB %d\n", &pcb->pcb_ptb);
- printf("#define\tPCB_PL %d\n", &pcb->pcb_pl);
- printf("#define\tPCB_FLAGS %d\n", &pcb->pcb_flags);
- printf("#define\tPCB_ONFAULT %d\n", &pcb->pcb_onfault);
-
- printf("#define\tV_TRAP %d\n", &vm->v_trap);
- printf("#define\tV_INTR %d\n", &vm->v_intr);
-
- printf("#define\tIV_VEC %d\n", &iv->iv_vec);
- printf("#define\tIV_ARG %d\n", &iv->iv_arg);
- printf("#define\tIV_CNT %d\n", &iv->iv_cnt);
- printf("#define\tIV_USE %d\n", &iv->iv_use);
-
- printf("#define\tUSRSTACK 0x%x\n", USRSTACK);
-#ifdef SYSVSHM
- printf("#define\tSHMMAXPGS %d\n", SHMMAXPGS);
-#endif
- printf("#define\tENOENT %d\n", ENOENT);
- printf("#define\tEFAULT %d\n", EFAULT);
- printf("#define\tENAMETOOLONG %d\n", ENAMETOOLONG);
- exit(0);
-}
diff --git a/sys/arch/pc532/pc532/icuinit.c b/sys/arch/pc532/pc532/icuinit.c
deleted file mode 100644
index 79ed7d7b718..00000000000
--- a/sys/arch/pc532/pc532/icuinit.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/* $NetBSD: icuinit.c,v 1.3 1994/10/26 08:25:03 cgd Exp $ */
-
-/*
- * Copyright (c) 1993 Philip A. Nelson.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Philip A. Nelson.
- * 4. The name of Philip A. Nelson may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY PHILIP NELSON ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL PHILIP NELSON BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* icuinit.c - C support for 532 icu stuff. */
-
-#include <sys/param.h>
-#include <machine/cpu.h>
-#include <machine/icu.h>
-
-/* Table for initializing ICU. Written in order to ICU.
- * Monitor has already set
- * CCTL=0x15 MCTL=0 LCSV=13 IPS=0 PDIR=0xfe PDAT=0xfe
- */
-struct icu_init_type {
- unsigned char offset;
- unsigned char val;
-} icu_tab [] = {
- {IMSK, 0xff}, /* mask off ints for now */
- {IMSK+1, 0xff}, /* " */
- {CIPTR, IR_CLK << 4}, /* clock int vector (CIPTR) */
- {CICTL, 0x00}, /* clock interrupt enable (CICTL) */
- {IPS, 0x7e}, /* 0=i/o, 1=int_req */
- {PDIR, 0x7e}, /* 1=in, 0=out */
- {OCASN, 0}, /* clock output (n/a) */
- {PDAT, 0xfe}, /* keep ROM at high mem */
- {ISRV, 0}, /* int in service (set by hw) */
- {ISRV+1, 0}, /* int in service */
- {CSRC, 0}, /* cascade source */
- {CSRC+1, 0}, /* cascade source */
- {SVCT, VEC_ICU}, /* isr vector */
- {FPRT, 0}, /* priority */
- {TPL, IPOLARITY & 0xff}, /* polarity */
- {TPL+1, IPOLARITY >> 8}, /* " */
- {ELTG, IEDGE & 0xff}, /* edge trigger (0 = edge) */
- {ELTG+1, IEDGE >> 8}, /* " */
- {MCTL, 0x02}, /* fixed priority */
- {CCTL, 0x1c}, /* prescale, no cat, run clocks */
-};
-#define ICUTAB_SZ (sizeof (icu_tab) / sizeof (struct icu_init_type))
-
-
-/*===========================================================================*
- * icu_init
- *===========================================================================*/
-
-/* Initialize interrupt control unit. Starts clock interrupts.
- */
-
-icu_init()
-{
- struct icu_init_type *p;
-
- for (p = icu_tab; p < icu_tab + ICUTAB_SZ; ++p)
- WR_ADR (unsigned char, ICU_ADR + p->offset, p->val);
-}
-
diff --git a/sys/arch/pc532/pc532/in_cksum.c b/sys/arch/pc532/pc532/in_cksum.c
deleted file mode 100644
index e45b6ef8d6c..00000000000
--- a/sys/arch/pc532/pc532/in_cksum.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/* $NetBSD: in_cksum.c,v 1.4 1995/08/29 22:37:44 phil Exp $ */
-
-/*-
- * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from tahoe: in_cksum.c 1.2 86/01/05
- * @(#)in_cksum.c 1.3 (Berkeley) 1/19/91
- */
-
-#include <sys/param.h>
-#include <sys/mbuf.h>
-
-/*
- * Checksum routine for Internet Protocol family headers.
- *
- * This routine is very heavily used in the network
- * code and should be modified for each CPU to be as fast as possible.
- *
- * This implementation is the ns32k version.
- */
-
-#define REDUCE {sum = (sum & 0xffff) + (sum >> 16);}
-#define ADDCARRY {if (sum > 0xffff) sum -= 0xffff;}
-#define SWAP {sum <<= 8;}
-#define ADVANCE(x) {w += x; mlen -= x;}
-
-/*
- * Thanks to gcc we don't have to guess
- * which registers contain sum & w.
- */
-#define Asm __asm __volatile
-#define ADD(n) Asm("addd " #n "(%2),%0" : "=r" (sum) : "0" (sum), "r" (w))
-#define ADC(n) Asm("addcd " #n "(%2),%0" : "=r" (sum) : "0" (sum), "r" (w))
-#define MOP Asm("addcd 0,%0" : "=r" (sum) : "0" (sum))
-#define UNSWAP Asm("rotd 8,%0" : "=r" (sum) : "0" (sum))
-#define ADDBYTE {sum += *w; SWAP; byte_swapped ^= 1;}
-#define ADDWORD {sum += *(u_short *)w;}
-
-int
-in_cksum(m, len)
- register struct mbuf *m;
- register int len;
-{
- register u_char *w;
- register unsigned sum = 0;
- register int mlen = 0;
- int byte_swapped = 0;
-
- for (; m && len; m = m->m_next) {
- mlen = m->m_len;
- if (mlen == 0)
- continue;
- w = mtod(m, u_char *);
- if (len < mlen)
- mlen = len;
- len -= mlen;
- if (mlen < 16)
- goto short_mbuf;
- /*
- * Force to long boundary so we do longword aligned
- * memory operations
- */
- if ((3 & (long)w) != 0) {
- REDUCE;
- if ((1 & (long)w) != 0) {
- ADDBYTE;
- ADVANCE(1);
- }
- if ((2 & (long)w) != 0) {
- ADDWORD;
- ADVANCE(2);
- }
- }
- /*
- * Align 4 bytes past a 16-byte cache line boundary.
- */
- if ((4 & (long)w) == 0) {
- ADD(0);
- MOP;
- ADVANCE(4);
- }
- if ((8 & (long)w) != 0) {
- ADD(0); ADC(4);
- MOP;
- ADVANCE(8);
- }
- /*
- * Do as much of the checksum as possible 32 bits at at time.
- * In fact, this loop is unrolled to make overhead from
- * branches &c small.
- */
- while (mlen >= 32) {
- /*
- * Add with carry 16 words and fold in the last carry
- * by adding a 0 with carry.
- *
- * Use the burst fill delay for pointer update.
- */
- ADD(0); ADC(4); ADC(8); ADC(12);
- MOP;
- w += 32;
- ADD(-16); ADC(-12); ADC(-8); ADC(-4);
- MOP;
- mlen -= 32;
- }
- if (mlen >= 16) {
- ADD(12); ADC(0); ADC(4); ADC(8);
- MOP;
- ADVANCE(16);
- }
- short_mbuf:
- if (mlen >= 8) {
- ADD(0); ADC(4);
- MOP;
- ADVANCE(8);
- }
- if (mlen >= 4) {
- ADD(0);
- MOP;
- ADVANCE(4);
- }
- if (mlen > 0) {
- REDUCE;
- if (mlen >= 2) {
- ADDWORD;
- ADVANCE(2);
- }
- if (mlen >= 1) {
- ADDBYTE;
- }
- }
- }
-
- if (len)
- printf("cksum: out of data\n");
- if (byte_swapped) {
- UNSWAP;
- }
- REDUCE;
- ADDCARRY;
- return (sum ^ 0xffff);
-}
-
diff --git a/sys/arch/pc532/pc532/intr.c b/sys/arch/pc532/pc532/intr.c
deleted file mode 100644
index fe97663614b..00000000000
--- a/sys/arch/pc532/pc532/intr.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/* $OpenBSD: intr.c,v 1.6 2000/03/03 00:54:55 todd Exp $ */
-/* $NetBSD: intr.c,v 1.5 1995/09/26 20:16:26 phil Exp $ */
-
-/*
- * Copyright (c) 1994 Matthias Pfaller.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Matthias Pfaller.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#define DEFINE_SPLX
-#include <sys/param.h>
-#include <sys/vmmeter.h>
-#include <sys/systm.h>
-#include <net/netisr.h>
-#include <machine/psl.h>
-
-#define INTS 32
-struct iv ivt[INTS];
-static int next_sir = 16;
-unsigned int imask[NIPL] = {0xffffffff};
-unsigned int Cur_pl = 0xffffffff, idisabled, sirpending, astpending;
-
-static void softnet();
-static void badhard(struct intrframe *);
-static void badsoft(void *);
-
-/*
- * Initialize the interrupt system.
- */
-void
-intr_init()
-{
- int i;
- for (i = 0; i < 16; i++)
- ivt[i].iv_vec = badhard;
-
- for (i = 16; i < 32; i++) {
- ivt[i].iv_vec = badsoft;
- ivt[i].iv_arg = (void *)i;
- }
-
- intr_establish(SOFTINT, softclock, NULL, "softclock", IPL_CLOCK, 0);
- intr_establish(SOFTINT, softnet, NULL, "softnet", IPL_NET, 0);
-
- for (i = 1; i < NIPL; i++)
- imask[i] |= SIR_ALLMASK;
-}
-
-/*
- * Handle pending software interrupts.
- * This function has to be entered with interrupts disabled and
- * it will return with interrupts disabled.
- */
-void
-check_sir()
-{
- register unsigned int cirpending, mask;
- register struct iv *iv;
-
- while (cirpending = sirpending) {
- sirpending = 0;
- ei();
- for (iv = ivt + 16, mask = 0x10000;
- cirpending & -mask; mask <<= 1, iv++) {
- if ((cirpending & mask) != 0) {
- cnt.v_soft++;
- iv->iv_cnt++;
- iv->iv_vec(iv->iv_arg);
- }
- }
- di();
- }
- return;
-}
-
-/*
- * Establish an interrupt. If intr is set to SOFTINT, a software interrupt
- * is allocated.
- */
-int
-intr_establish(int intr, void (*vector)(), void *arg, char *use,
- int level, int mode)
-{
- if (intr == SOFTINT) {
- if (next_sir >= INTS)
- panic("No software interrupts left");
- di();
- intr = next_sir++;
- } else {
- if (ivt[intr].iv_vec != badhard) {
- printf("Interrupt %d already allocated\n", intr);
- return(-1);
- }
- di();
- switch (mode) {
- case RISING_EDGE:
- ICUW(TPL) |= (1 << intr);
- ICUW(ELTG) &= ~(1 << intr);
- break;
- case FALLING_EDGE:
- ICUW(TPL) &= ~(1 << intr);
- ICUW(ELTG) &= ~(1 << intr);
- break;
- case HIGH_LEVEL:
- ICUW(TPL) |= (1 << intr);
- ICUW(ELTG) |= (1 << intr);
- break;
- case LOW_LEVEL:
- ICUW(TPL) &= ~(1 << intr);
- ICUW(ELTG) |= (1 << intr);
- break;
- default:
- panic("Unknown interrupt mode");
- }
- }
- ivt[intr].iv_vec = vector;
- ivt[intr].iv_arg = arg;
- ivt[intr].iv_cnt = 0;
- ivt[intr].iv_use = use;
- ei();
- if (level > IPL_ZERO)
- imask[level] |= 1 << intr;
-#include "sl.h"
-#include "ppp.h"
-#if NSL > 0 || NPPP > 0
- /* In the presence of SLIP or PPP, splimp > spltty. */
- imask[IPL_IMP] |= imask[IPL_TTY];
-#endif
- /*
- * There are network and disk drivers that use free() at interrupt
- * time, so imp > (net | bio).
- */
- imask[IPL_IMP] |= imask[IPL_NET] | imask[IPL_BIO];
- imask[IPL_ZERO] &= ~(1 << intr);
- return(intr);
-}
-
-/*
- * Network software interrupt routine
- */
-static void
-softnet()
-{
- register int isr;
-
- di(); isr = netisr; netisr = 0; ei();
- if (isr == 0) return;
-#ifdef INET
-#include "ether.h"
-#if NETHER > 0
- if (isr & (1 << NETISR_ARP)) arpintr();
-#endif
- if (isr & (1 << NETISR_IP)) ipintr();
-#endif
-#ifdef INET6
- if (isr & (1 << NETISR_IPV6)) ip6intr();
-#endif
-#ifdef NETATALK
- if (isr & (1 << NETISR_ATALK)) atintr();
-#endif
-#ifdef IMP
- if (isr & (1 << NETISR_IMP)) impintr();
-#endif
-#ifdef NS
- if (isr & (1 << NETISR_NS)) nsintr();
-#endif
-#ifdef ISO
- if (isr & (1 << NETISR_ISO)) clnlintr();
-#endif
-#ifdef CCITT
- if (isr & (1 << NETISR_CCITT)) ccittintr();
-#endif
-#include "ppp.h"
-#if NPPP > 0
- if (isr & (1 << NETISR_PPP)) pppintr();
-#endif
-#include "bridge.h"
-#if NBRIDGE > 0
- if (isr & (1 << NETISR_BRIDGE)) bridgeintr();
-#endif
-}
-
-/*
- * Default hardware interrupt handler
- */
-static void
-badhard(struct intrframe *frame)
-{
- static int bad_count = 0;
- di();
- bad_count++;
- if (bad_count < 5)
- printf("Unknown hardware interrupt: vec=%d pc=0x%08x psr=0x%04x cpl=0x%08x\n",
- frame->if_vec, frame->if_pc, frame->if_psr, frame->if_pl);
-
- if (bad_count == 5)
- printf("Too many unknown hardware interrupts, quitting reporting them.\n");
- ei();
-}
-
-/*
- * Default software interrupt handler
- */
-static void
-badsoft(void *n)
-{
- static int bad_count = 0;
- bad_count++;
- if (bad_count < 5)
- printf("Unknown software interrupt: vec=%d\n", (int)n);
-
- if (bad_count == 5)
- printf("Too many unknown software interrupts, quitting reporting them.\n");
-}
diff --git a/sys/arch/pc532/pc532/locore.s b/sys/arch/pc532/pc532/locore.s
deleted file mode 100644
index 0637e3ebe6c..00000000000
--- a/sys/arch/pc532/pc532/locore.s
+++ /dev/null
@@ -1,1193 +0,0 @@
-/* $NetBSD: locore.s,v 1.30 1995/11/30 00:59:00 jtc Exp $ */
-
-/*
- * Copyright (c) 1993 Philip A. Nelson.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Philip A. Nelson.
- * 4. The name of Philip A. Nelson may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY PHILIP NELSON ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL PHILIP NELSON BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * locore.s
- *
- * locore.s,v 1.2 1993/09/13 07:26:47 phil Exp
- */
-
-/*
- * locore.s - - assembler routines needed for BSD stuff. (ns32532/pc532)
- *
- * Phil Nelson, Dec 6, 1992
- *
- */
-
-/* This is locore.s! */
-#define LOCORE
-
-/* Get the defines... */
-#include <machine/asm.h>
-#include <machine/icu.h>
-#include "assym.h"
-
-/* define some labels */
-#define PSR_U 0x100
-#define PSR_S 0x200
-#define PSR_P 0x400
-#define PSR_I 0x800
-
-#define CFG_IVEC 0x1
-#define CFG_FPU 0x2
-#define CFG_MEM 0x4
-#define CFG_DE 0x100
-#define CFG_DATA 0x200
-#define CFG_DLCK 0x400
-#define CFG_INS 0x800
-#define CFG_ILCK 0x1000
-
-/* Initial Kernel stack page and the Idle processes' stack. */
-#define KERN_INT_SP 0xFFC00FFC
-
-/* Global Data */
-
-.data
-.globl _cold, __save_sp, __save_fp, __old_intbase
-_cold: .long 1
-__save_sp: .long 0
-__save_fp: .long 0
-__old_intbase: .long 0
-__have_fpu: .long 0
-
-.text
-.globl start
-.globl _C_LABEL(kernel_text)
-_C_LABEL(kernel_text) = start
-start:
- br here_we_go
-
- .align 4 /* So the trap table is double aligned. */
-int_base_tab: /* Here is the fixed jump table for traps! */
- .long __int
- .long __trap_nmi
- .long __trap_abt
- .long __trap_slave
- .long __trap_ill
- .long __trap_svc
- .long __trap_dvz
- .long __trap_flg
- .long __trap_bpt
- .long __trap_trc
- .long __trap_und
- .long __trap_rbe
- .long __trap_nbe
- .long __trap_ovf
- .long __trap_dbg
- .long __trap_reserved
-
-here_we_go: /* This is the actual start of the locore code! */
-
- bicpsrw PSR_I /* make sure interrupts are off. */
- bicpsrw PSR_S /* make sure we are using sp0. */
- lprd sb, 0 /* gcc expects this. */
- sprd sp, __save_sp(pc) /* save monitor's sp. */
- sprd fp, __save_fp(pc) /* save monitor's fp. */
- sprd intbase, __old_intbase(pc) /* save monitor's intbase. */
-
-.globl _bootdev
-.globl _boothowto
- /* Save the registers loaded by the boot program ... if the kernel
- was loaded by the boot program. */
- cmpd 0xc1e86394, r3
- bne zero_bss
- movd r7, _boothowto(pc)
- movd r6, _bootdev(pc)
-
-zero_bss:
- /* Zero the bss segment. */
- addr _end(pc),r0 # setup to zero the bss segment.
- addr _edata(pc),r1
- subd r1,r0 # compute _end - _edata
- movd r0,tos # push length
- addr _edata(pc),tos # push address
- bsr _bzero # zero the bss segment
-
- bsr __low_level_init /* Do the low level setup. */
-
- lprd sp, KERN_INT_SP # use the idle/interrupt stack.
- lprd fp, KERN_INT_SP # use the idle/interrupt stack.
-
- /* Load cfg register is bF6 (IC,DC,DE,M,F) or bF4 */
- sprd cfg, r0
- tbitb 1, r0 /* Test the F bit! */
- bfc cfg_no_fpu
- movqd 1, __have_fpu(pc)
- lprd cfg, 0xbf6
- br jmphi
-
-cfg_no_fpu:
- lprd cfg, 0xbf4
-
-/* Now jump to high addresses after starting mapping! */
-
-jmphi:
- addr here(pc), r0
- ord KERNBASE, r0
- jump 0(r0)
-
-here:
- lprd intbase, int_base_tab /* set up the intbase. */
-
- /* stack and frame pointer are pointing at high memory. */
-
- bsr _init532 /* Set thing up to call main()! */
-
- /* Get the proc0 kernel stack and pcb set up. */
- movd KERN_STK_START, r1 /* Standard sp start! */
- lprd sp, r1 /* Load it! */
- lprd fp, USRSTACK /* fp for the user. */
- lprd usp, USRSTACK /* starting stack for the user. */
-
- /* Build the "trap" frame to return to address 0 in user space! */
- movw PSR_I|PSR_S|PSR_U, tos /* psr - user/user stack/interrupts */
- movw 0, tos /* mod - 0! */
- movd 0, tos /* pc - 0 after module table */
- enter [],8 /* Extra space is for USP */
- movqd 0, tos /* Zero the registers in the pcb. */
- movqd 0, tos
- movqd 0, tos
- movqd 0, tos
- movqd 0, tos
- movqd 0, tos
- movqd 0, tos
- movqd 0, tos
- movqd 0, REGS_SB(sp)
-
- /* Now things should be ready to start _main! */
-
- addr 0(sp), tos
- bsr _main /* Start the kernel! */
- movd tos, r0 /* Pop addr */
-
- /* We should only get here in proc 1. */
- movd _curproc(pc), r1
- cmpqd 0, r1
- beq main_panic
- movd P_PID(r1),r0
- cmpqd 1, r0
- bne main_panic
- lprd usp, REGS_USP(sp)
- lprd sb, REGS_SB(sp)
-
- exit [r0,r1,r2,r3,r4,r5,r6,r7]
- rett 0
-
-main_panic:
- addr main_panic_str(pc), tos
- bsr _panic
-
-main_panic_str:
- .asciz "After main -- no curproc or not proc 1."
-
-/* Signal support */
-.align 2
-.globl _sigcode
-.globl _esigcode
-_sigcode:
- jsr 0(12(sp))
- movd 103, r0
- svc
-.align 2
-_esigcode:
-
-/* To get the ptb0 register set correctly. */
-
-ENTRY(_load_ptb0)
- movd S_ARG0, r0
- andd ~KERNBASE, r0
- lmr ptb0, r0
- ret 0
-
-ENTRY(_load_ptb1)
- movd S_ARG0, r0
- andd ~KERNBASE, r0
- lmr ptb1, r0
- ret 0
-
-ENTRY (_get_ptb0)
- smr ptb0, r0
- ret 0
-
-ENTRY (tlbflush)
- smr ptb0, r0
- lmr ptb0, r0
- ret 0
-
-ENTRY (_get_sp_adr) /* for use in testing.... */
- addr 4(sp), r0
- ret 0
-
-ENTRY (_get_ret_adr)
- movd 0(sp), r0
- ret 0
-
-ENTRY (_get_fp_ret)
- movd 4(fp), r0
- ret 0
-
-ENTRY (_get_2fp_ret)
- movd 4(0(fp)), r0
- ret 0
-
-ENTRY (_get_fp)
- addr 0(fp), r0
- ret 0
-
-/* reboot the machine :) if possible */
-
-ENTRY(low_level_reboot)
-
- movd -1,tos
- bsr _splx
- cmpqd 0,tos
- ints_off /* Stop things! */
- addr xxxlow(pc), r0 /* jump to low memory */
- andd ~KERNBASE, r0
- movd r0, tos
- ret 0
-xxxlow:
- lmr mcr, 0 /* Turn off mapping. */
- lprd sp, __save_sp(pc) /* get monitor's sp. */
- jump 0x10000032 /* Jump to the ROM! */
-
-
-/* To get back to the rom monitor .... */
-ENTRY(bpt_to_monitor)
-
-/* Switch to monitor's stack. */
- ints_off
- bicpsrw PSR_S /* make sure we are using sp0. */
- sprd psr, tos /* Push the current psl. */
- save [r1,r2,r3,r4]
- sprd sp, r1 /* save kernel's sp */
- sprd fp, r2 /* save kernel's fp */
- sprd intbase, r3 /* Save current intbase. */
- smr ptb0, r4 /* Save current ptd! */
-
-/* Change to low addresses */
- lmr ptb0, _IdlePTD(pc) /* Load the idle ptd */
- addr low(pc), r0
- andd ~KERNBASE, r0
- movd r0, tos
- ret 0
-
-low:
-/* Turn off mapping. */
- smr mcr, r0
- lmr mcr, 0
- lprd sp, __save_sp(pc) /* restore monitors sp */
- lprd fp, __save_fp(pc) /* restore monitors fp */
- lprd intbase, __old_intbase(pc) /* restore monitors intbase */
- bpt
-
-/* Reload kernel stack AND return. */
- lprd intbase, r3 /* restore kernel's intbase */
- lprd fp, r2 /* restore kernel's fp */
- lprd sp, r1 /* restore kernel's sp */
- lmr mcr, r0
- addr highagain(pc), r0
- ord KERNBASE, r0
- jump 0(r0)
-highagain:
- lmr ptb0, r4 /* Get the last ptd! */
- restore [r1,r2,r3,r4]
- lprd psr, tos /* restore psl */
- ints_on
- ret 0
-
-
-/*===========================================================================*
- * ram_size *
- *===========================================================================*
-
- char *
- ram_size (start)
- char *start;
-
- Determines RAM size.
-
- First attempt: write-and-read-back (WRB) each page from start
- until WRB fails or get a parity error. This didn't work because
- address decoding wraps around.
-
- New algorithm:
-
- ret = round-up-page (start);
- loop:
- if (!WRB or parity or wrap) return ret;
- ret += pagesz; (* check end of RAM at powers of two *)
- goto loop;
-
- Several things make this tricky. First, the value read from
- an address will be the same value written to the address if
- the cache is on -- regardless of whether RAM is located at
- the address. Hence the cache must be disabled. Second,
- reading an unpopulated RAM address is likely to produce a
- parity error. Third, a value written to an unpopulated address
- can be held by capacitance on the bus and can be correctly
- read back if there is no intervening bus cycle. Hence,
- read and write two patterns.
-
-*/
-
-cfg_dc = 0x200
-pagesz = 0x1000
-pattern0 = 0xa5a5a5a5
-pattern1 = 0x5a5a5a5a
-nmi_vec = 0x44
-parity_clr = 0x28000050
-
-/*
- r0 current page, return value
- r1 old config register
- r2 temp config register
- r3 pattern0
- r4 pattern1
- r5 old nmi vector
- r6 save word at @0
- r7 save word at @4
-*/
-.globl _ram_size
-_ram_size:
- enter [r1,r2,r3,r4,r5,r6,r7],0
- # initialize things
- movd @0,r6 #save 8 bytes of first page
- movd @4,r7
- movd 0,@0 #zero 8 bytes of first page
- movd 0,@4
- sprw cfg,r1 #turn off data cache
- movw r1,r2 #r1 = old config
- andw ~cfg_dc,r2 # was: com cfg_dc,r2
- lprw cfg,r2
- movd @nmi_vec,r5 #save old NMI vector
- addr tmp_nmi(pc),@nmi_vec #tmp NMI vector
- movd 8(fp),r0 #r0 = start
- addr pagesz-1(r0),r0 #round up to page
- andd ~(pagesz-1),r0 # was: com (pagesz-1),r0
- movd pattern0,r3
- movd pattern1,r4
-rz_loop:
- movd r3,0(r0) #write 8 bytes
- movd r4,4(r0)
- lprw cfg,r2 #flush write buffer
- cmpd r3,0(r0) #read back and compare
- bne rz_exit
- cmpd r4,4(r0)
- bne rz_exit
- cmpqd 0,@0 #check for address wrap
- bne rz_exit
- cmpqd 0,@4 #check for address wrap
- bne rz_exit
- addr pagesz(r0),r0 #next page
- br rz_loop
-rz_exit:
- movd r6,@0 #restore 8 bytes of first page
- movd r7,@4
- lprd cfg,r1 #turn data cache back on
- movd r5,@nmi_vec #restore NMI vector
- movd parity_clr,r2
- movb 0(r2),r2 #clear parity status
- exit [r1,r2,r3,r4,r5,r6,r7]
- ret 0
-
-tmp_nmi: #come here if parity error
- addr rz_exit(pc),0(sp) #modify return addr to exit
- rett 0
-
-/* Low level kernel support routines. */
-
-/* External symbols that are needed. */
-/* .globl EX(cnt) */
-.globl EX(curproc)
-.globl EX(curpcb)
-.globl EX(qs)
-.globl EX(whichqs)
-.globl EX(want_resched)
-.globl EX(Cur_pl)
-
-/*
- User/Kernel copy routines ... {fu,su}{word,byte} and copyin/coyinstr
-
- These are "Fetch User" or "Save user" word or byte. They return -1 if
- a page fault occurs on access.
-*/
-
-ENTRY(fuword)
-ENTRY(fuiword)
- enter [r2],0
- movd _curpcb(pc), r2
- addr fusufault(pc), PCB_ONFAULT(r2)
- movd 0(B_ARG0), r0
- br fusu_ret
-
-ENTRY(fubyte)
-ENTRY(fuibyte)
- enter [r2],0
- movd _curpcb(pc), r2
- addr fusufault(pc), PCB_ONFAULT(r2)
- movzbd 0(B_ARG0), r0
- br fusu_ret
-
-ENTRY(suword)
-ENTRY(suiword)
- enter [r2],0
- movqd 4, tos
- movd B_ARG0, tos
- bsr _check_user_write
- adjspd -8
- cmpqd 0, r0
- bne fusufault
- movd _curpcb(pc), r2
- addr fusufault(pc), PCB_ONFAULT(r2)
- movqd 0, r0
- movd B_ARG1,0(B_ARG0)
- br fusu_ret
-
-ENTRY(subyte)
-ENTRY(suibyte)
- enter [r2],0
- movqd 1, tos
- movd B_ARG0, tos
- bsr _check_user_write
- adjspd -8
- cmpqd 0, r0
- bne fusufault
- movd _curpcb(pc), r2
- addr fusufault(pc), PCB_ONFAULT(r2)
- movqd 0, r0
- movb B_ARG1, 0(B_ARG0)
- br fusu_ret
-
-fusufault:
- movqd -1, r0
-fusu_ret:
- movqd 0, PCB_ONFAULT(r2)
- exit [r2]
- ret 0
-
-/* Two more fu/su routines .... for now ... just return -1. */
-ENTRY(fuswintr)
-ENTRY(suswintr)
- movqd -1, r0
- ret 0
-
-/* C prototype: copyin ( int *usrc, int *kdst, u_int i)
- C prototype: copyout ( int *ksrc, int *udst, u_int i)
-
- i is the number of Bytes! to copy!
-
- Similar code....
- */
-
-ENTRY(copyout)
- enter [r2,r3],0
-# Check for copying priviledges! i.e. copy on write!
- movd B_ARG2, tos /* Length */
- movd B_ARG1, tos /* adr */
- bsr _check_user_write
- adjspd -8
- cmpqd 0, r0
- bne cifault
- br docopy
-
-ENTRY(copyin)
- enter [r2,r3],0
-docopy:
- movd _curpcb(pc), r3
- addr cifault(pc), PCB_ONFAULT(r3)
- movd B_ARG2, r0 /* Length! */
- movd B_ARG0, r1 /* Src adr */
- movd B_ARG1, r2 /* Dst adr */
- movsb /* Move it! */
- movqd 0, r0
- movqd 0, PCB_ONFAULT(r3)
- exit [r2,r3]
- ret 0
-
-cifault:
- movd EFAULT, r0
- movd _curpcb(pc), r3
- movqd 0, PCB_ONFAULT(r3)
- exit [r2,r3]
- ret 0
-
-
-/*****************************************************************************/
-
-/*
- * The following primitives manipulate the run queues.
- * _whichqs tells which of the 32 queues _qs
- * have processes in them. Setrq puts processes into queues, Remrq
- * removes them from queues. The running process is on no queue,
- * other processes are on a queue related to p->p_pri, divided by 4
- * actually to shrink the 0-127 range of priorities into the 32 available
- * queues.
- */
- .globl _whichqs,_qs,_cnt,_panic
-
-/*
- * setrunqueue(struct proc *p);
- * Insert a process on the appropriate queue. Should be called at splclock().
- */
-ENTRY(setrunqueue)
- movd S_ARG0, r0
- movd r2, tos
-
- cmpqd 0, P_BACK(r0) /* should not be on q already */
- bne 1f
- cmpqd 0, P_WCHAN(r0)
- bne 1f
- cmpb SRUN, P_STAT(r0)
- bne 1f
-
- movzbd P_PRIORITY(r0),r1
- lshd -2,r1
- sbitd r1,_whichqs(pc) /* set queue full bit */
- addr _qs(pc)[r1:q], r1 /* locate q hdr */
- movd P_BACK(r1),r2 /* locate q tail */
- movd r1, P_FORW(r0) /* set p->p_forw */
- movd r0, P_BACK(r1) /* update q's p_back */
- movd r0, P_FORW(r2) /* update tail's p_forw */
- movd r2, P_BACK(r0) /* set p->p_back */
- movd tos, r2
- ret 0
-
-1: addr 2f(pc),tos /* Was on the list! */
- bsr _panic
-2: .asciz "setrunqueue problem!"
-
-/*
- * remrunqueue(struct proc *p);
- * Remove a process from its queue. Should be called at splclock().
- */
-ENTRY(remrunqueue)
- movd S_ARG0, r1
- movd r2, tos
- movzbd P_PRIORITY(r1), r0
-
- lshd -2, r0
- tbitd r0, _whichqs(pc)
- bfc 1f
-
- movd P_BACK(r1), r2 /* Address of prev. item */
- movqd 0, P_BACK(r1) /* Clear reverse link */
- movd P_FORW(r1), r1 /* Addr of next item. */
- movd r1, P_FORW(r2) /* Unlink item. */
- movd r2, P_BACK(r1)
- cmpd r1, r2 /* r1 = r2 => empty queue */
- bne 2f
-
- cbitd r0, _whichqs(pc) /* mark q as empty */
-
-2: movd tos, r2
- ret 0
-
-1: addr 2f(pc),tos /* No queue entry! */
- bsr _panic
-2: .asciz "remrunqueue problem!"
-
-/* Switch to another process from kernel code... */
-
-ENTRY(cpu_switch)
- ints_off /* to make sure cpu_switch runs to completion. */
- enter [r0,r1,r2,r3,r4,r5,r6,r7],0
-/* addqd 1, _cnt+V_SWTCH(pc) */
-
- movd _curproc(pc), r0
- cmpqd 0, r0
- beq sw1
-
- /* Save "kernel context" - - user context is saved at trap/svc.
- Kernel registers are saved at entry to swtch. */
-
- movd P_ADDR(r0), r0
- sprd sp, PCB_KSP(r0)
- sprd fp, PCB_KFP(r0)
- smr ptb0, PCB_PTB(r0)
-
- /* Save the Cur_pl. */
- movd _Cur_pl(pc), PCB_PL(r0)
-
- movqd 0, _curproc(pc) /* no current proc! */
-
-sw1: /* Get something from a Queue! */
- ints_off /* Just in case we came from Idle. */
- movqd 0, r0
- ffsd _whichqs(pc), r0
- bfs Idle
-
- /* Get the process and unlink it from the queue. */
- addr _qs(pc)[r0:q], r1 /* address of qs entry! */
- movd 0(r1), r2 /* get process pointer! */
- movd P_FORW(r2), r3 /* get address of next entry. */
-
- /* Test code */
- cmpqd 0, r3
- bne notzero
- bsr _dump_qs
-notzero:
-
- /* unlink the entry. */
- movd r3, 0(r1) /* New head pointer. */
- movd r1, P_BACK(r3) /* New reverse pointer. */
- cmpd r1, r3 /* Empty? */
- bne restart
-
- /* queue is empty, turn off whichqs. */
- cbitd r0, _whichqs(pc)
-
-restart: /* r2 has pointer to new proc.. */
-
- /* Reload the new kernel context ... r2 points to proc entry. */
- movqd 0, P_BACK(r2) /* NULL p_forw */
- movqd 0, _want_resched(pc) /* We did a resched! */
- movd P_ADDR(r2), r3 /* get new pcb pointer */
-
-
- /* Do we need to reload floating point here? */
-
- lmr ptb0, PCB_PTB(r3)
- lprd sp, PCB_KSP(r3)
- lprd fp, PCB_KFP(r3)
- movw PCB_FLAGS(r3), r4 /* Get the flags. */
-
- movd r2, _curproc(pc)
- movd r3, _curpcb(pc)
-
- /* Restore the previous processor level. */
- movd PCB_PL(r3), tos
- bsr _splx
- cmpqd 0,tos
- /* Return to the caller of swtch! */
- exit [r0,r1,r2,r3,r4,r5,r6,r7]
- ret 0
-
-/*
- * The idle process!
- */
-Idle:
- lprd sp, KERN_INT_SP /* Set up the "interrupt" stack. */
- movqd 0, r0
- ffsd _whichqs(pc), r0
- bfc sw1
- movd _imask(pc),tos
- bsr _splx
- cmpqd 0,tos
- wait /* Wait for interrupt. */
- br sw1
-
-/* As part of the fork operation, we need to prepare a user are for
- execution, to be resumed by swtch()...
-
- C proto is low_level_fork (struct user *up)
-
- up is a pointer the the "user" struct in the child.
- We copy the kernel stack and update the pcb of the child to
- return from low_level_fork twice.
-
- The first return should return a 0. The "second" return should
- be because of a swtch() and should return a 1.
-
-*/
-
-ENTRY(low_level_fork)
- enter [r0,r1,r2,r3,r4,r5,r6,r7],0
-
- /* Save "kernel context" - - user context is saved at trap/svc.
- Kernel registers are saved at entry to swtch. */
-
- movd B_ARG0, r2 /* Gets the paddr field of child. */
- sprd sp, PCB_KSP(r2)
- sprd fp, PCB_KFP(r2)
- /* Don't save ptb0 because child has a different ptb0! */
- movd _Cur_pl(pc), PCB_PL(r2)
-
- /* Copy the kernel stack from this process to new stack. */
- addr 0(sp), r1 /* Source address */
- movd r1, r3 /* Calculate the destination address */
- subd USRSTACK, r3 /* Get the offset */
- addd r3, r2 /* r2 had B_ARG0 in it. now the dest addr */
- movd r2, r5 /* Save the destination address */
- movd KSTK_SIZE, r0 /* Calculate the length of the kernel stack. */
- subd r3, r0
-
- movd r0, r4 /* Check for a double alligned stack. */
- andd 3, r4
- cmpqd 0, r4
- beq kcopy
- addr m_ll_fork(pc),tos /* panic if not double alligned. */
- bsr _panic
-
-kcopy:
- lshd -2,r0 /* Divide by 4 to get # of doubles. */
- movsd /* Copy the stack! */
-
- /* Set parent to return 0. */
- movqd 0,28(sp)
-
- /* Set child to return 1. */
- movqd 1,28(r5)
-
- exit [r0,r1,r2,r3,r4,r5,r6,r7]
- ret 0
-
-m_ll_fork: .asciz "_low_level_fork: kstack not double alligned."
-
-/*
- * savectx(struct pcb *pcb, int altreturn);
- * Update pcb, saving current processor state and arranging for alternate
- * return in cpu_switch() if altreturn is true.
- */
-ENTRY(savectx)
- enter [r0,r1,r2,r3,r4,r5,r6,r7],0
- movd B_ARG0, r2
- sprd sp,PCB_KSP(r2)
- sprd fp,PCB_KFP(r2)
- movd _Cur_pl(pc),PCB_PL(r2)
- exit [r0,r1,r2,r3,r4,r5,r6,r7]
- ret 0
-
-ENTRY(_trap_nmi)
- enter [r0,r1,r2,r3,r4,r5,r6,r7],8
- sprd usp, REGS_USP(sp)
- sprd sb, REGS_SB(sp)
- movqd 1, tos
- br all_trap
-
-ENTRY(_trap_abt)
- enter [r0,r1,r2,r3,r4,r5,r6,r7],8
- sprd usp, REGS_USP(sp)
- sprd sb, REGS_SB(sp)
- movqd 2, tos
- smr tear, tos
- smr msr, tos
- br abt_trap
-
-ENTRY(_trap_slave)
- enter [r0,r1,r2,r3,r4,r5,r6,r7],8
- sprd usp, REGS_USP(sp)
- sprd sb, REGS_SB(sp)
- movqd 3, tos
- br all_trap
-
-ENTRY(_trap_ill)
- enter [r0,r1,r2,r3,r4,r5,r6,r7],8
- sprd usp, REGS_USP(sp)
- sprd sb, REGS_SB(sp)
- movqd 4, tos
- br all_trap
-
-ENTRY(_trap_svc)
- enter [r0,r1,r2,r3,r4,r5,r6,r7],8
- sprd usp, REGS_USP(sp)
- sprd sb, REGS_SB(sp)
- lprd sb, 0 /* for the kernel */
-
- /* Have an fpu? */
- cmpqd 0, __have_fpu(pc)
- beq svc_no_fpu
-
- /* Save the FPU registers. */
- movd _curpcb(pc), r3
- sfsr PCB_FSR(r3)
- movl f0,PCB_F0(r3)
- movl f1,PCB_F1(r3)
- movl f2,PCB_F2(r3)
- movl f3,PCB_F3(r3)
- movl f4,PCB_F4(r3)
- movl f5,PCB_F5(r3)
- movl f6,PCB_F6(r3)
- movl f7,PCB_F7(r3)
-
- /* Call the system. */
- bsr _syscall
-
- /* Restore the FPU registers. */
- movd _curpcb(pc), r3
- lfsr PCB_FSR(r3)
- movl PCB_F0(r3),f0
- movl PCB_F1(r3),f1
- movl PCB_F2(r3),f2
- movl PCB_F3(r3),f3
- movl PCB_F4(r3),f4
- movl PCB_F5(r3),f5
- movl PCB_F6(r3),f6
- movl PCB_F7(r3),f7
-
- /* Restore the usp and sb. */
- lprd usp, REGS_USP(sp)
- lprd sb, REGS_SB(sp)
-
- exit [r0,r1,r2,r3,r4,r5,r6,r7]
- rett 0
-
-svc_no_fpu:
- /* Call the system. */
- bsr _syscall
-
- /* Restore the usp and sb. */
- lprd usp, REGS_USP(sp)
- lprd sb, REGS_SB(sp)
-
- exit [r0,r1,r2,r3,r4,r5,r6,r7]
- rett 0
-
-ENTRY(_trap_dvz)
- enter [r0,r1,r2,r3,r4,r5,r6,r7],8
- sprd usp, REGS_USP(sp)
- sprd sb, REGS_SB(sp)
- movqd 6, tos
- br all_trap
-
-ENTRY(_trap_flg)
- cinv ia, r0
- addqd 1, tos /* Increment return address */
- rett 0
-
-ENTRY(_trap_bpt)
- enter [r0,r1,r2,r3,r4,r5,r6,r7],8
- sprd usp, REGS_USP(sp)
- sprd sb, REGS_SB(sp)
- movd 8, tos
- br all_trap
-
-ENTRY(_trap_trc)
- enter [r0,r1,r2,r3,r4,r5,r6,r7],8
- sprd usp, REGS_USP(sp)
- sprd sb, REGS_SB(sp)
- movd 9, tos
- br all_trap
-
-ENTRY(_trap_und)
- enter [r0,r1,r2,r3,r4,r5,r6,r7],8
- sprd usp, REGS_USP(sp)
- sprd sb, REGS_SB(sp)
- movd 10, tos
- br all_trap
-
-ENTRY(_trap_rbe)
- enter [r0,r1,r2,r3,r4,r5,r6,r7],8
- sprd usp, REGS_USP(sp)
- sprd sb, REGS_SB(sp)
- movd 11, tos
- br all_trap
-
-ENTRY(_trap_nbe)
- enter [r0,r1,r2,r3,r4,r5,r6,r7],8
- sprd usp, REGS_USP(sp)
- sprd sb, REGS_SB(sp)
- movd 12, tos
- br all_trap
-
-ENTRY(_trap_ovf)
- enter [r0,r1,r2,r3,r4,r5,r6,r7],8
- sprd usp, REGS_USP(sp)
- sprd sb, REGS_SB(sp)
- movd 13, tos
- br all_trap
-
-ENTRY(_trap_dbg)
- enter [r0,r1,r2,r3,r4,r5,r6,r7],8
- sprd usp, REGS_USP(sp)
- sprd sb, REGS_SB(sp)
- movd 14, tos
- br all_trap
-
-ENTRY(_trap_reserved)
- enter [r0,r1,r2,r3,r4,r5,r6,r7],8
- sprd usp, REGS_USP(sp)
- sprd sb, REGS_SB(sp)
- movd 15, tos
-all_trap:
- movqd 0,tos /* Add 2 zeros for msr,tear in frame. */
- movqd 0,tos
-
-abt_trap:
- lprd sb, 0 /* for the kernel */
-
- /* Was this a real process? */
- cmpqd 0, _curproc(pc)
- beq trap_no_fpu
-
- /* Have an fpu? */
- cmpqd 0, __have_fpu(pc)
- beq trap_no_fpu
-
- /* Save the FPU registers. */
- movd _curpcb(pc), r3 /* R3 is saved by gcc. */
- sfsr PCB_FSR(r3)
- movl f0,PCB_F0(r3)
- movl f1,PCB_F1(r3)
- movl f2,PCB_F2(r3)
- movl f3,PCB_F3(r3)
- movl f4,PCB_F4(r3)
- movl f5,PCB_F5(r3)
- movl f6,PCB_F6(r3)
- movl f7,PCB_F7(r3)
-
- bsr _trap
- adjspd -12 /* Pop off software part of trap frame. */
-
- /* Restore the FPU registers. */
- lfsr PCB_FSR(r3)
- movl PCB_F0(r3),f0
- movl PCB_F1(r3),f1
- movl PCB_F2(r3),f2
- movl PCB_F3(r3),f3
- movl PCB_F4(r3),f4
- movl PCB_F5(r3),f5
- movl PCB_F6(r3),f6
- movl PCB_F7(r3),f7
-
- /* Reload the usp and sb just in case anything has changed. */
- lprd usp, REGS_USP(sp)
- lprd sb, REGS_SB(sp)
-
- exit [r0,r1,r2,r3,r4,r5,r6,r7]
- rett 0
-
-trap_no_fpu:
- bsr _trap
- adjspd -12 /* Pop off software part of trap frame. */
-
- /* Reload the usp and sb just in case anything has changed. */
- lprd usp, REGS_USP(sp)
- lprd sb, REGS_SB(sp)
-
- exit [r0,r1,r2,r3,r4,r5,r6,r7]
- rett 0
-
-/* Interrupt service routines.... */
-ENTRY(_int)
- enter [r0,r1,r2,r3,r4,r5,r6,r7],8
- sprd usp,REGS_USP(sp)
- sprd sb,REGS_SB(sp)
- lprd sb,0 /* for the kernel */
- movd _Cur_pl(pc), tos
- movb @ICU_ADR+HVCT,r0 /* fetch vector */
- andd 0x0f,r0
- movd r0,tos
- movqd 1,r1
- lshd r0,r1
- orw r1,_Cur_pl(pc) /* or bit to Cur_pl */
- orw r1,@ICU_ADR+IMSK /* and to IMSK */
- /* bits set by idisabled in IMSK */
- /* have to be preserved */
- ints_off /* flush pending writes */
- ints_on /* and now turn ints on */
- addqd 1,_intrcnt(pc)[r0:d]
- lshd 4,r0
- addqd 1,_cnt+V_INTR(pc)
- addqd 1,_ivt+IV_CNT(r0) /* increment counters */
- movd _ivt+IV_ARG(r0),r1 /* get argument */
- cmpqd 0,r1
- bne 1f
- addr 0(sp),r1 /* NULL -> push frame address */
-1: movd r1,tos
- movd _ivt+IV_VEC(r0),r0 /* call the handler */
- jsr 0(r0)
-
- adjspd -8 /* Remove arg and vec from stack */
- bsr _splx_di /* Restore Cur_pl */
- cmpqd 0,tos
-
- tbitw 8, REGS_PSR(sp) /* In system mode? */
- bfs do_user_intr /* branch if yes! */
-
- lprd usp, REGS_USP(sp)
- lprd sb, REGS_SB(sp)
- exit [r0,r1,r2,r3,r4,r5,r6,r7]
- rett 0
-
-do_user_intr:
- /* Do "user" mode interrupt processing, including preemption. */
- ints_off
- movd _curproc(pc), r2
- cmpqd 0,r2
- beq intr_panic
-
- /* Have an fpu? */
- cmpqd 0, __have_fpu(pc)
- beq intr_no_fpu
-
- /* Save the FPU registers. */
- movd _curpcb(pc), r3 /* R3 is saved by gcc. */
- sfsr PCB_FSR(r3)
- movl f0,PCB_F0(r3)
- movl f1,PCB_F1(r3)
- movl f2,PCB_F2(r3)
- movl f3,PCB_F3(r3)
- movl f4,PCB_F4(r3)
- movl f5,PCB_F5(r3)
- movl f6,PCB_F6(r3)
- movl f7,PCB_F7(r3)
-
-intr_no_fpu:
- /* turn on interrupts! */
- ints_on
-
- cmpqd 0, _want_resched(pc)
- beq do_usr_ret
- movd 18, tos
- movqd 0,tos
- movqd 0,tos
- bsr _trap
- adjspd -12 /* Pop off software part of trap frame. */
-
-do_usr_ret:
-
- /* Have an fpu? */
- cmpqd 0, __have_fpu(pc)
- beq intr_ret_no_fpu
-
- /* Restore the FPU registers. r3 should be as set before. */
- lfsr PCB_FSR(r3)
- movl PCB_F0(r3),f0
- movl PCB_F1(r3),f1
- movl PCB_F2(r3),f2
- movl PCB_F3(r3),f3
- movl PCB_F4(r3),f4
- movl PCB_F5(r3),f5
- movl PCB_F6(r3),f6
- movl PCB_F7(r3),f7
-
-intr_ret_no_fpu:
- lprd usp, REGS_USP(sp)
- lprd sb, REGS_SB(sp)
- exit [r0,r1,r2,r3,r4,r5,r6,r7]
- rett 0
-
-intr_panic:
- addr intr_panic_msg(pc),tos /* panic if not double alligned. */
- bsr _panic
-
-intr_panic_msg:
- .asciz "user mode interrupt with no current process!"
-
-/* Include all other .s files. */
-#include "bcopy.s"
-#include "bzero.s"
-
-
-/* pmap support??? ..... */
-
-/*
- * Note: This version greatly munged to avoid various assembler errors
- * that may be fixed in newer versions of gas. Perhaps newer versions
- * will have more pleasant appearance.
- */
-
- .set IDXSHIFT,10
- .set SYSTEM,0xFE000000 # virtual address of system start
- /*note: gas copys sign bit (e.g. arithmetic >>), can't do SYSTEM>>22! */
- .set SYSPDROFF,0x3F8 # Page dir index of System Base
-
-/*
- * PTmap is recursive pagemap at top of virtual address space.
- * Within PTmap, the page directory can be found (third indirection).
- */
-#define PDRPDROFF 0x03F7 /* page dir index of page dir */
- .globl _PTmap, _PTD, _PTDpde, _Sysmap
- .set _PTmap,0xFDC00000
- .set _PTD,0xFDFF7000
- .set _Sysmap,0xFDFF8000
- .set _PTDpde,0xFDFF7000+4*PDRPDROFF
-
-/*
- * APTmap, APTD is the alternate recursive pagemap.
- * It's used when modifying another process's page tables.
- */
-#define APDRPDROFF 0x03FE /* page dir index of page dir */
- .globl _APTmap, _APTD, _APTDpde
- .set _APTmap,0xFF800000
- .set _APTD,0xFFBFE000
- .set _APTDpde,0xFDFF7000+4*APDRPDROFF
-
-/*
- * Access to each processes kernel stack is via a region of
- * per-process address space (at the beginning), immediatly above
- * the user process stack.
- */
-#if 0
- .set _kstack, USRSTACK
- .globl _kstack
-#endif
- .set PPDROFF,0x3F6
-/* # .set PPTEOFF,0x400-UPAGES # 0x3FE */
- .set PPTEOFF,0x3FE
-
-.data
-.globl _PDRPDROFF
-_PDRPDROFF:
- .long PDRPDROFF
-
-/* vmstat -i uses the following labels and __int even increments the
- * counters. This information is also availiable from ivt[n].iv_use
- * and ivt[n].iv_cnt in much better form.
- */
- .globl _intrnames, _eintrnames, _intrcnt, _eintrcnt
-_intrnames:
- .asciz "int 0"
- .asciz "int 1"
- .asciz "int 2"
- .asciz "int 3"
- .asciz "int 4"
- .asciz "int 5"
- .asciz "int 6"
- .asciz "int 7"
- .asciz "int 8"
- .asciz "int 9"
- .asciz "int 10"
- .asciz "int 11"
- .asciz "int 12"
- .asciz "int 13"
- .asciz "int 14"
- .asciz "int 15"
-_eintrnames:
-_intrcnt:
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
-_eintrcnt:
diff --git a/sys/arch/pc532/pc532/machdep.c b/sys/arch/pc532/pc532/machdep.c
deleted file mode 100644
index 949f44674f8..00000000000
--- a/sys/arch/pc532/pc532/machdep.c
+++ /dev/null
@@ -1,1142 +0,0 @@
-/* $NetBSD: machdep.c,v 1.43 1996/01/15 05:30:47 phil Exp $ */
-
-/*-
- * Copyright (c) 1982, 1987, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)machdep.c 7.4 (Berkeley) 6/3/91
- */
-
-/*
- * Modified for the pc532 by Phil Nelson. 2/3/93
- */
-
-static char rcsid[] = "/b/source/CVS/src/sys/arch/pc532/pc532/machdep.c,v 1.2 1993/09/13 07:26:49 phil Exp";
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/signalvar.h>
-#include <sys/kernel.h>
-#include <sys/map.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/exec.h>
-#include <sys/buf.h>
-#include <sys/reboot.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/timeout.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/msgbuf.h>
-#include <sys/vnode.h>
-#include <sys/device.h>
-#include <sys/sysctl.h>
-#include <sys/mount.h>
-#include <sys/syscallargs.h>
-
-#include <dev/cons.h>
-
-#include <net/netisr.h>
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-
-#include <machine/psl.h>
-#include <machine/reg.h>
-#include <machine/cpu.h>
-#include <machine/pmap.h>
-#include <machine/icu.h>
-
-extern vm_offset_t avail_end;
-extern struct user *proc0paddr;
-
-vm_map_t buffer_map;
-
-/* A local function... */
-void reboot_cpu();
-void dumpsys __P((void));
-
-
-/* the following is used externally (sysctl_hw) */
-char machine[] = "pc532";
-char cpu_model[] = "ns32532";
-
-/*
- * Declare these as initialized data so we can patch them.
- */
-int nswbuf = 0;
-#ifdef NBUF
-int nbuf = NBUF;
-#else
-int nbuf = 0;
-#endif
-#ifdef BUFPAGES
-int bufpages = BUFPAGES;
-#else
-int bufpages = 0;
-#endif
-int msgbufmapped = 0; /* set when safe to use msgbuf */
-
-
-/* Real low level initialization. This is called in unmapped mode and
- sets up the initial page directory and page tables for the kernel.
- This routine is the first to be called by locore.s to get the
- kernel running at the correct place in memory.
- */
-
-extern char end[], _edata[];
-extern vm_offset_t avail_start;
-extern vm_offset_t avail_end;
-
-int physmem = 0;
-int maxmem = 0;
-
-vm_offset_t KPTphys;
-
-int IdlePTD;
-int start_page;
-int _istack;
-
-int low_mem_map;
-
-/* Support for VERY low debugging ... in case we get NO output.
- (e.g. in case pmap does not work and can't do regular mapped
- output. */
-#if VERYLOWDEBUG
-#include <pc532/umprintf.c>
-#endif
-
-void
-_low_level_init ()
-{
- int ix, ix1, ix2;
- int p0, p1, p2;
- extern int _mapped;
-
-#if VERYLOWDEBUG
- umprintf ("starting low level init\n");
-#endif
-
- mem_size = ram_size(end);
- physmem = btoc(mem_size);
- start_page = (((int)&end + NS532_PAGE_SIZE) & ~(NS532_PAGE_SIZE-1))
- & 0xffffff;
- avail_start = start_page;
- avail_end = mem_size - NS532_PAGE_SIZE;
-
-#if VERYLOWDEBUG
- umprintf ("mem_size = 0x%x\nphysmem=%x\nstart_page=0x%x\navail_end=0x%x\n",
- mem_size, physmem, start_page, avail_end);
-#endif
-
-
- /* Initialize the mmu with a simple memory map. */
-
- /* A new interrupt stack, i.e. not the rom monitor's. */
- _istack = avail_start;
- avail_start += NS532_PAGE_SIZE;
-
- /* The page directory that starts the entire mapping. */
- p0 = (int) avail_start;
- IdlePTD = p0;
- KPTphys = p0;
- avail_start += NS532_PAGE_SIZE;
-
- /* First clear out the page table directory. */
- bzero((char *)p0, NS532_PAGE_SIZE);
-
- /* Now for the memory mapped I/O, the ICU and the eprom. */
- p1 = (int) avail_start;
- avail_start += NS532_PAGE_SIZE;
- bzero ((char *)p1, NS532_PAGE_SIZE);
-
- /* Addresses here start at FFC00000... */
-
- /* Map the interrupt stack to FFC00000 - FFC00FFF */
- WR_ADR(int, p1, _istack+3);
-
- /* All futhur entries are cache inhibited. => 0x4? in low bits. */
-
- /* The Duarts and Parity. Addresses FFC80000 */
- WR_ADR(int, p1+4*0x80, 0x28000043);
-
- /* SCSI Polled (Reduced space.) Addresses FFD00000 - FFDFFFFF */
- for (ix = 0x100; ix < 0x200; ix++)
- WR_ADR(int, p1 + ix*4, 0x30000043 + ((ix - 0x100)<<12));
-
- /* SCSI "DMA" (Reduced space.) Addresses FFE00000 - FFEEFFFF */
- for (ix = 0x200; ix < 0x2ff; ix++)
- WR_ADR(int, p1 + ix*4, 0x38000043 + ((ix - 0x200)<<12));
-
- /* SCSI "DMA" With A22 (EOP) Addresses FFEFF000 - FFEFFFFF */
- WR_ADR(int, p1 + 0x2ff*4, 0x38400043);
-
- /* The e-prom Addresses FFF00000 - FFF3FFFF */
- for (ix = 0x300; ix < 0x340; ix++)
- WR_ADR(int, p1 + ix*4, 0x10000043 + ((ix - 0x300)<<12));
-
- /* Finally the ICU! Addresses FFFFF000 - FFFFFFFF */
- WR_ADR(int, p1+4*0x3ff, 0xFFFFF043);
-
- /* Add the memory mapped I/O entry in the directory. */
- WR_ADR(int, p0+4*1023, p1 + 0x43);
-
- /* Map the kernel pages starting at FE00000 and at 0.
- It also maps any pages past the end of the kernel,
- up to the value of avail_start at this point.
- These pages currently are:
- 1 - interrupt stack
- 2 - Top level page table
- 3 - 2nd level page table for I/O
- 4 - 2nd level page table for the kernel & low memory
- 5-7 will be allocated as 2nd level page tables by pmap_bootstrap.
- */
-
- low_mem_map = p2 = (int) avail_start;
- avail_start += NS532_PAGE_SIZE;
- bzero ((char *)p2, NS532_PAGE_SIZE);
- WR_ADR(int,p0+4*pdei(KERNBASE), p2 + 3);
- WR_ADR(int,p0, p2+3);
-
- for (ix = 0; ix < (avail_start)/NS532_PAGE_SIZE; ix++) {
- WR_ADR(int, p2 + ix*4, NS532_PAGE_SIZE * ix + 3);
- }
-
- /* Load the ptb0 register and start mapping. */
-
- _mapped = 1;
- _load_ptb0 (p0);
- asm(" lmr mcr, 3"); /* Start the machine mapping, 1 vm space. */
-
-}
-
-extern void icu_init();
-
-/* init532 is the first procedure called in mapped mode by locore.s
- */
-
-init532()
-{
- int free_pages;
- void (**int_tab)();
- extern int _save_sp;
-
-/*#include "ddb.h" */
-#if NDDB > 0
- kdb_init();
- if (boothowto & RB_KDB)
- Debugger();
-#endif
-
- /* Initialize the pmap stuff.... */
- pmap_bootstrap (avail_start, 0);
- /* now running on new page tables, configured, and u/iom is accessible */
-
- /* Set up the proc0paddr struct. */
- proc0paddr->u_pcb.pcb_flags = 0;
- proc0paddr->u_pcb.pcb_pl = 0xffffffff;
- proc0paddr->u_pcb.pcb_ptb = IdlePTD;
- proc0paddr->u_pcb.pcb_onstack =
- (struct on_stack *) proc0paddr + UPAGES*NBPG
- - sizeof (struct on_stack);
-
- /* Set up the ICU. */
- icu_init();
- intr_init();
-}
-
-
-/*
- * Machine-dependent startup code
- */
-int boothowto = 0, Maxmem = 0;
-long dumplo;
-int physmem, maxmem;
-
-extern int bootdev;
-extern cyloffset;
-
-/* pmap_enter prototype */
-void pmap_enter __P((register pmap_t, vm_offset_t, register vm_offset_t,
- vm_prot_t, boolean_t));
-
-void
-cpu_startup(void)
-{
- register int unixsize;
- register unsigned i;
- register struct pte *pte;
- int mapaddr, j;
- register caddr_t v;
- int maxbufs, base, residual;
- extern long Usrptsize;
- vm_offset_t minaddr, maxaddr;
- vm_size_t size;
- int firstaddr;
-
- /*
- * Initialize error message buffer (at end of core).
- */
-
- /* avail_end was pre-decremented in pmap_bootstrap to compensate */
- for (i = 0; i < btoc(sizeof (struct msgbuf)); i++)
- pmap_enter(pmap_kernel(), (vm_offset_t) msgbufp,
- avail_end + i * NBPG, VM_PROT_ALL, TRUE);
- msgbufmapped = 1;
-
-#ifdef KDB
- kdb_init(); /* startup kernel debugger */
-#endif
- /*
- * Good {morning,afternoon,evening,night}.
- */
- printf(version);
- printf("\nreal mem = 0x%x\n", ctob(physmem));
-
- /*
- * Allocate space for system data structures.
- * The first available kernel virtual address is in "v".
- * As pages of kernel virtual memory are allocated, "v" is incremented.
- * As pages of memory are allocated and cleared,
- * "firstaddr" is incremented.
- * An index into the kernel page table corresponding to the
- * virtual memory address maintained in "v" is kept in "mapaddr".
- */
-
- /*
- * Make two passes. The first pass calculates how much memory is
- * needed and allocates it. The second pass assigns virtual
- * addresses to the various data structures.
- */
- firstaddr = 0;
-again:
- v = (caddr_t)firstaddr;
-
-#define valloc(name, type, num) \
- (name) = (type *)v; v = (caddr_t)((name)+(num))
-#define valloclim(name, type, num, lim) \
- (name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num)))
- valloc(timeouts, struct timeout, ntimeout);
-#ifdef SYSVSHM
- valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
-#endif
- /*
- * Determine how many buffers to allocate.
- * Use 10% of memory for the first 2 Meg, 5% of the remaining
- * memory. Insure a minimum of 16 buffers.
- * We allocate 1/2 as many swap buffer headers as file i/o buffers.
- */
- if (bufpages == 0)
- if (physmem < (2 * 1024 * 1024))
- bufpages = physmem / 10 / CLSIZE;
- else
- bufpages = ((2 * 1024 * 1024 + physmem) / 20) / CLSIZE;
-
- bufpages = min(NKMEMCLUSTERS*2/5, bufpages); /* XXX ? - cgd */
-
- if (nbuf == 0) {
- nbuf = bufpages / 2;
- if (nbuf < 16) {
- nbuf = 16;
- /* XXX (cgd) -- broken vfs_bio currently demands this */
- bufpages = 32;
- }
- }
-
- if (nswbuf == 0) {
- nswbuf = (nbuf / 2) &~ 1; /* force even */
- if (nswbuf > 256)
- nswbuf = 256; /* sanity */
- }
- valloc(swbuf, struct buf, nswbuf);
- valloc(buf, struct buf, nbuf);
-
- /*
- * End of first pass, size has been calculated so allocate memory
- */
- if (firstaddr == 0) {
- size = (vm_size_t)(v - firstaddr);
- firstaddr = (int)kmem_alloc(kernel_map, round_page(size));
- if (firstaddr == 0)
- panic("startup: no room for tables");
- goto again;
- }
-
- /*
- * End of second pass, addresses have been assigned
- */
- if ((vm_size_t)(v - firstaddr) != size)
- panic("startup: table size inconsistency");
-
- /*
- * Now allocate buffers proper. They are different than the above
- * in that they usually occupy more virtual memory than physical.
- */
- size = MAXBSIZE * nbuf;
- buffer_map = kmem_suballoc(kernel_map, (vm_offset_t *)&buffers,
- &maxaddr, size, TRUE);
- minaddr = (vm_offset_t)buffers;
- if (vm_map_find(buffer_map, vm_object_allocate(size), (vm_offset_t)0,
- &minaddr, size, FALSE) != KERN_SUCCESS)
- panic("startup: cannot allocate buffers");
- base = bufpages / nbuf;
- residual = bufpages % nbuf;
- if (base >= MAXBSIZE) {
- /* don't want to alloc more physical mem than needed */
- base = MAXBSIZE;
- residual = 0;
- }
- for (i = 0; i < nbuf; i++) {
- vm_size_t curbufsize;
- vm_offset_t curbuf;
-
- /*
- * First <residual> buffers get (base+1) physical pages
- * allocated for them. The rest get (base) physical pages.
- *
- * The rest of each buffer occupies virtual space,
- * but has no physical memory allocated for it.
- */
- curbuf = (vm_offset_t)buffers + i * MAXBSIZE;
- curbufsize = CLBYTES * (i < residual ? base+1 : base);
- vm_map_pageable(buffer_map, curbuf, curbuf+curbufsize, FALSE);
- vm_map_simplify(buffer_map, curbuf);
- }
-
-
- /*
- * Allocate a submap for exec arguments. This map effectively
- * limits the number of processes exec'ing at any time.
- */
- exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
- 16*NCARGS, TRUE);
-
- /*
- * Allocate a submap for physio
- */
- phys_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
- VM_PHYS_SIZE, TRUE);
-
- /*
- * Finally, allocate mbuf pool. Since mclrefcnt is an off-size
- * we use the more space efficient malloc in place of kmem_alloc.
- */
- mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES,
- M_MBUF, M_NOWAIT);
- bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES);
- mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
- VM_MBUF_SIZE, FALSE);
- /*
- * Initialize timeouts
- */
- timeout_init();
-
- printf("avail mem = 0x%x\n", ptoa(cnt.v_free_count));
- printf("using %d buffers containing %d bytes of memory\n",
- nbuf, bufpages * CLBYTES);
-
- /*
- * Set up buffers, so they can be used to read disk labels.
- */
- bufinit();
-
- /*
- * Configure the system.
- */
- if (boothowto & RB_CONFIG) {
-#ifdef BOOT_CONFIG
- user_config();
-#else
- printf("kernel does not support -c; continuing..\n");
-#endif
- }
- configure();
-}
-
-#ifdef PGINPROF
-/*
- * Return the difference (in microseconds)
- * between the current time and a previous
- * time as represented by the arguments.
- * If there is a pending clock interrupt
- * which has not been serviced due to high
- * ipl, return error code.
- */
-/*ARGSUSED*/
-vmtime(otime, olbolt, oicr)
- register int otime, olbolt, oicr;
-{
-
- return (((time.tv_sec-otime)*60 + lbolt-olbolt)*16667);
-}
-#endif
-
-/*
- * Send an interrupt to process.
- *
- * Stack is set up to allow sigcode stored
- * in u. to call routine, followed by kcall
- * to sigreturn routine below. After sigreturn
- * resets the signal mask, the stack, and the
- * frame pointer, it returns to the user
- * specified pc, psl.
- */
-
-void
-sendsig(catcher, sig, mask, code)
- sig_t catcher;
- int sig, mask;
- u_long code;
-{
- register struct proc *p = curproc;
- register int *regs;
- register struct sigframe *fp;
- struct sigacts *ps = p->p_sigacts;
- int oonstack;
- extern char sigcode[], esigcode[];
-
- regs = p->p_md.md_regs;
- oonstack = ps->ps_sigstk.ss_flags & SS_ONSTACK;
-
- /*
- * Allocate space for the signal handler context.
- */
- if ((ps->ps_flags & SAS_ALTSTACK) && !oonstack &&
- (ps->ps_sigonstack & sigmask(sig))) {
- fp = (struct sigframe *)(ps->ps_sigstk.ss_sp +
- ps->ps_sigstk.ss_size - sizeof(struct sigframe));
- ps->ps_sigstk.ss_flags |= SS_ONSTACK;
- } else {
- fp = (struct sigframe *)(regs[REG_SP]
- - sizeof(struct sigframe));
- }
-
- if ((unsigned)fp <= (unsigned)p->p_vmspace->vm_maxsaddr + MAXSSIZ - ctob(p->p_vmspace->vm_ssize))
- (void)grow(p, (unsigned)fp);
-
- if (useracc((caddr_t)fp, sizeof (struct sigframe), B_WRITE) == 0) {
- /*
- * Process has trashed its stack; give it an illegal
- * instruction to halt it in its tracks.
- */
- SIGACTION(p, SIGILL) = SIG_DFL;
- sig = sigmask(SIGILL);
- p->p_sigignore &= ~sig;
- p->p_sigcatch &= ~sig;
- p->p_sigmask &= ~sig;
- psignal(p, SIGILL);
- return;
- }
-
- /*
- * Build the argument list for the signal handler.
- */
- fp->sf_signum = sig;
- fp->sf_code = code;
- fp->sf_scp = &fp->sf_sc;
- fp->sf_handler = catcher;
-
- /* save registers */
- bcopy (regs, fp->sf_scp->sc_reg, 8*sizeof(int));
-
- /*
- * Build the signal context to be used by sigreturn.
- */
- fp->sf_sc.sc_onstack = oonstack;
- fp->sf_sc.sc_mask = mask;
- fp->sf_sc.sc_sp = regs[REG_SP];
- fp->sf_sc.sc_fp = regs[REG_FP];
- fp->sf_sc.sc_pc = regs[REG_PC];
- fp->sf_sc.sc_ps = regs[REG_PSR];
- fp->sf_sc.sc_sb = regs[REG_SB];
- regs[REG_SP] = (int)fp;
- regs[REG_PC] = (int)(((char *)PS_STRINGS) - (esigcode - sigcode));
-}
-
-/*
- * System call to cleanup state after a signal
- * has been taken. Reset signal mask and
- * stack state from context left by sendsig (above).
- * Return to previous pc and psl as specified by
- * context left by sendsig. Check carefully to
- * make sure that the user has not modified the
- * psl to gain improper priviledges or to cause
- * a machine fault.
- */
-int
-sys_sigreturn(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct sys_sigreturn_args /* {
- syscallarg(struct sigcontext *) sigcntxp;
- } */ *uap = v;
- register struct sigcontext *scp;
- register struct sigframe *fp;
- register int *regs = p->p_md.md_regs;
- fp = (struct sigframe *) regs[REG_SP] ;
-
- if (useracc((caddr_t)fp, sizeof (*fp), 0) == 0)
- return(EINVAL);
-
- /* restore registers */
- bcopy (fp->sf_scp->sc_reg, regs, 8*sizeof(int));
-
- scp = fp->sf_scp;
- if (useracc((caddr_t)scp, sizeof (*scp), 0) == 0)
- return(EINVAL);
-#ifdef notyet
- if ((scp->sc_ps & PSL_MBZ) != 0 || (scp->sc_ps & PSL_MBO) != PSL_MBO) {
- return(EINVAL);
- }
-#endif
- if (scp->sc_onstack & 01)
- p->p_sigacts->ps_sigstk.ss_flags |= SS_ONSTACK;
- else
- p->p_sigacts->ps_sigstk.ss_flags &= ~SS_ONSTACK;
- p->p_sigmask = scp->sc_mask &~
- (sigmask(SIGKILL)|sigmask(SIGCONT)|sigmask(SIGSTOP));
- regs[REG_FP] = scp->sc_fp;
- regs[REG_SP] = scp->sc_sp;
- regs[REG_PC] = scp->sc_pc;
- regs[REG_PSR] = scp->sc_ps;
- regs[REG_SB] = scp->sc_sb;
- return(EJUSTRETURN);
-}
-
-int waittime = -1;
-struct pcb dumppcb;
-
-void
-boot(howto)
- int howto;
-{
- register int devtype; /* r10 == major of root dev */
- extern const char *panicstr;
- extern int cold;
- int nomsg = 1;
-
- if(cold) {
- printf("cold boot: hit reset please");
- for(;;);
- }
- boothowto = howto;
- if ((howto&RB_NOSYNC) == 0 && waittime < 0) {
- extern struct proc proc0;
- /* defeat against panic on sync XXX */
- if (curproc == NULL)
- curproc = proc0;
-
- waittime = 0;
- vfs_shutdown();
- /*
- * If we've been adjusting the clock, the todr
- * will be out of synch; adjust it now. (non panic!)
- */
- if (panicstr == 0)
- resettodr();
-
- DELAY(10000); /* wait for printf to finish */
- }
- splhigh();
- devtype = major(rootdev);
-
- if (howto&RB_HALT) {
- printf ("\nThe operating system has halted.\n\n");
- cpu_reset();
- for(;;) ;
- /*NOTREACHED*/
- } else {
- if (howto & RB_DUMP) {
-#if STACK_DUMP
- /* dump the stack! */
- { int *fp = (int *)_get_fp();
- int i=0;
- while ((u_int)fp < (u_int)UPT_MIN_ADDRESS-40) {
- printf ("0x%x (@0x%x), ", fp[1], fp);
- fp = (int *)fp[0];
- if (++i == 3) { printf ("\n"); i=0; }
- }
- }
-#endif
- savectx(&dumppcb, 0);
- dumppcb.pcb_ptb = _get_ptb0();
- dumpsys();
- }
- doshutdownhooks();
- }
-
- printf("rebooting ...");
- reboot_cpu();
- for(;;) ;
- /*NOTREACHED*/
-}
-
-void
-microtime(tvp)
- register struct timeval *tvp;
-{
- int s = splhigh();
-
- *tvp = time;
- tvp->tv_usec += tick;
- while (tvp->tv_usec >= 1000000) {
- tvp->tv_sec++;
- tvp->tv_usec -= 1000000;
- }
- splx(s);
-}
-
-/*
- * Strange exec values! (Do we want to support a minix a.out header?)
- */
-int
-cpu_exec_aout_makecmds()
-{
- return ENOEXEC;
-};
-
-/*
- * Clear registers on exec
- */
-void
-setregs(p, entry, stack, retval)
- struct proc *p;
- struct exec_package *entry;
- u_long stack;
- register_t *retval;
-{
- struct on_stack *r = (struct on_stack *)p->p_md.md_regs;
- int i;
-
-/* printf ("Setregs: entry = %x, stack = %x, (usp = %x)\n", entry, stack,
- r->pcb_usp); */
-
- /* Start fp at stack also! */
- r->pcb_usp = stack;
- r->pcb_fp = stack;
- r->pcb_pc = entry->ep_entry;
- r->pcb_psr = PSL_USERSET;
- r->pcb_reg[0] = (int)PS_STRINGS;
- for (i=1; i<8; i++) r->pcb_reg[i] = 0;
-
- p->p_addr->u_pcb.pcb_flags = 0;
-}
-
-
-extern struct pte *CMAP1, *CMAP2;
-extern caddr_t CADDR1, CADDR2;
-/*
- * zero out physical memory
- * specified in relocation units (NBPG bytes)
- */
-clearseg(n)
-{
- /* map page n in to virtual address CADDR2 */
- *(int *)CMAP2 = PG_V | PG_KW | ctob(n);
- tlbflush();
- bzero(CADDR2,NBPG);
- *(int *) CADDR2 = 0;
-}
-
-/*
- * copy a page of physical memory
- * specified in relocation units (NBPG bytes)
- */
-copyseg(frm, n)
-{
- /* map page n in to virtual address CADDR2 */
- *(int *)CMAP2 = PG_V | PG_KW | ctob(n);
- tlbflush();
- bcopy((void *)frm, (void *)CADDR2, NBPG);
-}
-
-/*
- * copy a page of physical memory
- * specified in relocation units (NBPG bytes)
- */
-physcopyseg(frm, to)
-{
- /* map page frm in to virtual address CADDR1 */
- *(int *)CMAP1 = PG_V | PG_KW | ctob(frm);
- /* map page to in to virtual address CADDR2 */
- *(int *)CMAP2 = PG_V | PG_KW | ctob(to);
- tlbflush();
- bcopy(CADDR1, CADDR2, NBPG);
-}
-
-/*
- * insert an element into a queue
- */
-#undef insque
-_insque(element, head)
- register struct prochd *element, *head;
-{
- element->ph_link = head->ph_link;
- head->ph_link = (struct proc *)element;
- element->ph_rlink = (struct proc *)head;
- ((struct prochd *)(element->ph_link))->ph_rlink=(struct proc *)element;
-}
-
-/*
- * remove an element from a queue
- */
-#undef remque
-_remque(element)
- register struct prochd *element;
-{
- ((struct prochd *)(element->ph_link))->ph_rlink = element->ph_rlink;
- ((struct prochd *)(element->ph_rlink))->ph_link = element->ph_link;
- element->ph_rlink = (struct proc *)0;
-}
-
-vmunaccess() {printf ("vmunaccess!\n");}
-
-/*
- * Below written in C to allow access to debugging code
- */
-copyinstr(fromaddr, toaddr, maxlength, lencopied) size_t *lencopied, maxlength;
- void *toaddr, *fromaddr; {
- int c,tally;
-
- tally = 0;
- while (maxlength--) {
- c = fubyte(fromaddr++);
- if (c == -1) {
- if(lencopied) *lencopied = tally;
- return(EFAULT);
- }
- tally++;
- *(char *)toaddr++ = (char) c;
- if (c == 0){
- if(lencopied) *lencopied = (u_int)tally;
- return(0);
- }
- }
- if(lencopied) *lencopied = (u_int)tally;
- return(ENAMETOOLONG);
-}
-
-copyoutstr(fromaddr, toaddr, maxlength, lencopied) size_t *lencopied, maxlength;
- void *fromaddr, *toaddr; {
- int c;
- int tally;
-
- tally = 0;
- while (maxlength--) {
- c = subyte(toaddr++, *(char *)fromaddr);
- if (c == -1) return(EFAULT);
- tally++;
- if (*(char *)fromaddr++ == 0){
- if(lencopied) *lencopied = tally;
- return(0);
- }
- }
- if(lencopied) *lencopied = tally;
- return(ENAMETOOLONG);
-}
-
-copystr(fromaddr, toaddr, maxlength, lencopied) size_t *lencopied, maxlength;
- void *fromaddr, *toaddr; {
- u_int tally;
-
- tally = 0;
- while (maxlength--) {
- *(u_char *)toaddr = *(u_char *)fromaddr++;
- tally++;
- if (*(u_char *)toaddr++ == 0) {
- if(lencopied) *lencopied = tally;
- return(0);
- }
- }
- if(lencopied) *lencopied = tally;
- return(ENAMETOOLONG);
-}
-
-/*
- * These variables are needed by /sbin/savecore
- */
-u_long dumpmag = 0x8fca0101; /* magic number */
-int dumpsize = 0; /* pages */
-long dumplo = 0; /* blocks */
-
-/*
- * This is called by configure to set dumplo and dumpsize.
- * Dumps always skip the first CLBYTES of disk space
- * in case there might be a disk label stored there.
- * If there is extra space, put dump at the end to
- * reduce the chance that swapping trashes it.
- */
-void
-dumpconf()
-{
- int nblks; /* size of dump area */
- int maj;
-
- if (dumpdev == NODEV)
- return;
- maj = major(dumpdev);
- if (maj < 0 || maj >= nblkdev)
- panic("dumpconf: bad dumpdev=0x%x", dumpdev);
- if (bdevsw[maj].d_psize == NULL)
- return;
- nblks = (*bdevsw[maj].d_psize)(dumpdev);
- if (nblks <= ctod(1))
- return;
-
- dumpsize = physmem;
-
- /* Always skip the first CLBYTES, in case there is a label there. */
- if (dumplo < ctod(1))
- dumplo = ctod(1);
-
- /* Put dump at end of partition, and make it fit. */
- if (dumpsize > dtoc(nblks - dumplo))
- dumpsize = dtoc(nblks - dumplo);
- if (dumplo < nblks - ctod(dumpsize))
- dumplo = nblks - ctod(dumpsize);
-}
-
-/*
- * Doadump comes here after turning off memory management and
- * getting on the dump stack, either when called above, or by
- * the auto-restart code.
- */
-#define BYTES_PER_DUMP NBPG /* must be a multiple of pagesize XXX small */
-static vm_offset_t dumpspace;
-
-vm_offset_t
-reserve_dumppages(p)
- vm_offset_t p;
-{
-
- dumpspace = p;
- return (p + BYTES_PER_DUMP);
-}
-
-void
-dumpsys()
-{
- unsigned bytes, i, n;
- int maddr, psize;
- daddr_t blkno;
- int (*dump) __P((dev_t, daddr_t, caddr_t, size_t));
- int error = 0;
- int c;
-
- msgbufmapped = 0; /* don't record dump msgs in msgbuf */
- if (dumpdev == NODEV)
- return;
-
- /*
- * For dumps during autoconfiguration,
- * if dump device has already configured...
- */
- if (dumpsize == 0)
- dumpconf();
- if (dumplo < 0)
- return;
- printf("\ndumping to dev %x, offset %d\n", dumpdev, dumplo);
-
- psize = (*bdevsw[major(dumpdev)].d_psize)(dumpdev);
- printf("dump ");
- if (psize == -1) {
- printf("area unavailable\n");
- return;
- }
-
-#if 0 /* XXX this doesn't work. grr. */
- /* toss any characters present prior to dump */
- while (sget() != NULL); /*syscons and pccons differ */
-#endif
-
- bytes = mem_size;
- maddr = 0;
- blkno = dumplo;
- dump = bdevsw[major(dumpdev)].d_dump;
- for (i = 0; i < bytes; i += n) {
- /* Print out how many MBs we to go. */
- n = bytes - i;
- if (n && (n % (1024*1024)) == 0)
- printf("%d ", n / (1024 * 1024));
-
- /* Limit size for next transfer. */
- if (n > BYTES_PER_DUMP)
- n = BYTES_PER_DUMP;
-
- (void) pmap_map(dumpspace, maddr, maddr + n, VM_PROT_READ);
- error = (*dump)(dumpdev, blkno, (caddr_t)dumpspace, n);
- if (error)
- break;
- maddr += n;
- blkno += btodb(n); /* XXX? */
-
-#if 0 /* XXX this doesn't work. grr. */
- /* operator aborting dump? */
- if (sget() != NULL) {
- error = EINTR;
- break;
- }
-#endif
- }
-
- switch (error) {
-
- case ENXIO:
- printf("device bad\n");
- break;
-
- case EFAULT:
- printf("device not ready\n");
- break;
-
- case EINVAL:
- printf("area improper\n");
- break;
-
- case EIO:
- printf("i/o error\n");
- break;
-
- case EINTR:
- printf("aborted from console\n");
- break;
-
- case 0:
- printf("succeeded\n");
- break;
-
- default:
- printf("error %d\n", error);
- break;
- }
- printf("\n\n");
- delay(5000000); /* 5 seconds */
-}
-
-/* Stub function for reboot_cpu. */
-
-void reboot_cpu()
-{
- extern void low_level_reboot();
-
- /* Point Low MEMORY to Kernel Memory! */
- *((int *)PTD) = low_mem_map+3; /* PTD[pdei(KERNBASE)]; */
- low_level_reboot();
-
-}
-
-int
-sys_sysarch(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct sysarch_args /* {
- syscallarg(int) op;
- syscallarg(char *) parms;
- } */ *uap = v;
-
- return ENOSYS;
-}
-
-/*
- * consinit:
- * initialize the system console.
- * XXX - shouldn't deal with this cons_initted thing, but then,
- * it shouldn't be called from init386 either.
- */
-static int cons_initted;
-
-void
-consinit()
-{
- if (!cons_initted) {
- cninit();
- cons_initted = 1;
- }
-}
-
-/* DEBUG routine */
-
-void dump_qs()
-{ int ix;
- struct proc *ptr;
-
- for (ix=0; ix<NQS; ix++)
- if (qs[ix].ph_link != qs[ix].ph_rlink)
- {
- ptr = qs[ix].ph_link;
- do {
- printf ("qs[%d]: 0x%x 0x%x\n", ix, ptr->p_forw, ptr->p_back);
- ptr = ptr->p_forw;
- } while (ptr != (struct proc *)0 && ptr != qs[ix].ph_link);
- }
- panic("nil P_BACK");
-}
-
-/*
- * machine dependent system variables.
- */
-cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
- int *name;
- u_int namelen;
- void *oldp;
- size_t *oldlenp;
- void *newp;
- size_t newlen;
- struct proc *p;
-{
- dev_t consdev;
-
- /* all sysctl names at this level are terminal */
- if (namelen != 1)
- return (ENOTDIR); /* overloaded */
-
- switch (name[0]) {
- case CPU_CONSDEV:
- if (cn_tab != NULL)
- consdev = cn_tab->cn_dev;
- else
- consdev = NODEV;
- return (sysctl_rdstruct(oldp, oldlenp, newp, &consdev,
- sizeof consdev));
- default:
- return (EOPNOTSUPP);
- }
- /* NOTREACHED */
-}
diff --git a/sys/arch/pc532/pc532/mem.c b/sys/arch/pc532/pc532/mem.c
deleted file mode 100644
index f89da31cdde..00000000000
--- a/sys/arch/pc532/pc532/mem.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/* $NetBSD: mem.c,v 1.13 1995/09/26 20:16:30 phil Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)mem.c 8.3 (Berkeley) 1/12/94
- */
-
-/*
- * Memory special file
- */
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/buf.h>
-#include <sys/systm.h>
-#include <sys/uio.h>
-#include <sys/malloc.h>
-
-#include <machine/cpu.h>
-
-#include <vm/vm.h>
-
-extern char *vmmap; /* poor name! */
-caddr_t zeropage;
-
-#ifndef NO_RTC
-int have_rtc = 1; /* For access to rtc. */
-#else
-int have_rtc = 0; /* For no rtc. */
-#endif
-#define ROM_ORIGIN 0xFFF00000 /* Mapped origin! */
-
-/* Do the actual reading and writing of the rtc. We have to read
- and write the entire contents at a time. rw = 0 => read,
- rw = 1 => write. */
-
-void rw_rtc (unsigned char *buffer, int rw)
-{
- static unsigned char magic[8] =
- {0xc5, 0x3a, 0xa3, 0x5c, 0xc5, 0x3a, 0xa3, 0x5c};
- volatile unsigned char * const rom_p = (unsigned char *)ROM_ORIGIN;
- unsigned char *bp;
- unsigned char dummy; /* To defeat optimization */
-
- /* Read or write to the real time chip. Address line A0 functions as
- * data input, A2 is used as the /write signal. Accesses to the RTC
- * are always done to one of the addresses (unmapped):
- *
- * 0x10000000 - write a '0' bit
- * 0x10000001 - write a '1' bit
- * 0x10000004 - read a bit
- *
- * Data is output from the RTC using D0. To read or write time
- * information, the chip has to be activated first, to distinguish
- * clock accesses from normal ROM reads. This is done by writing,
- * bit by bit, a magic pattern to the chip. Before that, a dummy read
- * assures that the chip's pattern comparison register pointer is
- * reset. The RTC register file is always read or written wholly,
- * even if we are only interested in a part of it.
- */
-
- /* Activate the real time chip */
- dummy = rom_p[4]; /* Synchronize the comparison reg. */
-
- for (bp=magic; bp<magic+8; bp++) {
- int i;
- for (i=0; i<8; i++)
- dummy = rom_p[ (*bp>>i) & 0x01 ];
- }
-
- if (rw == 0) {
- /* Read the time from the RTC. Do this even this is
- a write, since the user might have only given
- partial data and the RTC must always be written
- completely.
- */
-
- for (bp=buffer; bp<buffer+8; bp++) {
- int i;
- for (i=0; i<8; i++) {
- *bp >>= 1;
- *bp |= ((rom_p[4] & 0x01) ? 0x80 : 0x00);
- }
- }
- } else {
- /* Write to the RTC */
- for (bp=buffer; bp<buffer+8; bp++) {
- int i;
- for (i=0; i<8; i++)
- dummy = rom_p[ (*bp>>i) & 0x01 ];
- }
- }
-}
-
-/*ARGSUSED*/
-int
-mmopen(dev, flag, mode)
- dev_t dev;
- int flag, mode;
-{
-
- return (0);
-}
-
-/*ARGSUSED*/
-int
-mmclose(dev, flag, mode)
- dev_t dev;
- int flag, mode;
-{
-
- return (0);
-}
-
-/*ARGSUSED*/
-int
-mmrw(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- register vm_offset_t o, v;
- register int c;
- register struct iovec *iov;
- int error = 0;
- static int physlock;
- /* /dev/rtc support. */
- unsigned char buffer[8];
-
- if (minor(dev) == 0) {
- /* lock against other uses of shared vmmap */
- while (physlock > 0) {
- physlock++;
- error = tsleep((caddr_t)&physlock, PZERO | PCATCH,
- "mmrw", 0);
- if (error)
- return (error);
- }
- physlock = 1;
- }
- while (uio->uio_resid > 0 && error == 0) {
- iov = uio->uio_iov;
- if (iov->iov_len == 0) {
- uio->uio_iov++;
- uio->uio_iovcnt--;
- if (uio->uio_iovcnt < 0)
- panic("mmrw");
- continue;
- }
- switch (minor(dev)) {
-
-/* minor device 0 is physical memory */
- case 0:
- v = uio->uio_offset;
- pmap_enter(pmap_kernel(), (vm_offset_t)vmmap,
- trunc_page(v), uio->uio_rw == UIO_READ ?
- VM_PROT_READ : VM_PROT_WRITE, TRUE);
- o = uio->uio_offset & PGOFSET;
- c = min(uio->uio_resid, (int)(NBPG - o));
- error = uiomove((caddr_t)vmmap + o, c, uio);
- pmap_remove(pmap_kernel(), (vm_offset_t)vmmap,
- (vm_offset_t)vmmap + NBPG);
- continue;
-
-/* minor device 1 is kernel memory */
- case 1:
- v = uio->uio_offset;
- c = min(iov->iov_len, MAXPHYS);
- if (!kernacc((caddr_t)v, c,
- uio->uio_rw == UIO_READ ? B_READ : B_WRITE))
- return (EFAULT);
- error = uiomove((caddr_t)v, c, uio);
- continue;
-
-/* minor device 2 is EOF/RATHOLE */
- case 2:
- if (uio->uio_rw == UIO_WRITE)
- uio->uio_resid = 0;
- return (0);
-
-#ifdef DEV_RTC
-/* minor device 3 is the realtime clock. */
- case 3:
- if (!have_rtc)
- return (ENXIO);
-
- /* Calc offsets and lengths. */
- v = uio->uio_offset;
- if (v > 8)
- return (0); /* EOF */
- c = iov->iov_len;
- if (v+c > 8)
- c = 8-v;
-
- rw_rtc(buffer, 0); /* Read the rtc. */
-
- error = uiomove((caddr_t)&buffer[v], c, uio);
-
- if (uio->uio_rw == UIO_READ || error)
- return (error);
-
- rw_rtc(buffer, 1); /* Write the rtc. */
-
- return (error);
-#endif
-
-/* minor device 12 (/dev/zero) is source of nulls on read, rathole on write */
- case 12:
- if (uio->uio_rw == UIO_WRITE) {
- c = iov->iov_len;
- break;
- }
- if (zeropage == NULL) {
- zeropage = (caddr_t)
- malloc(CLBYTES, M_TEMP, M_WAITOK);
- bzero(zeropage, CLBYTES);
- }
- c = min(iov->iov_len, CLBYTES);
- error = uiomove(zeropage, c, uio);
- continue;
-
- default:
- return (ENXIO);
- }
- if (error)
- break;
- iov->iov_base += c;
- iov->iov_len -= c;
- uio->uio_offset += c;
- uio->uio_resid -= c;
- }
- if (minor(dev) == 0) {
-unlock:
- if (physlock > 1)
- wakeup((caddr_t)&physlock);
- physlock = 0;
- }
- return (error);
-}
-
-int
-mmmmap(dev, off, prot)
- dev_t dev;
- int off, prot;
-{
- return (-1);
-}
-
-/*ARGSUSED*/
-int
-mmioctl(dev, cmd, data, flags, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flags;
- struct proc *p;
-{
- return (EOPNOTSUPP);
-}
diff --git a/sys/arch/pc532/pc532/ns_cksum.c b/sys/arch/pc532/pc532/ns_cksum.c
deleted file mode 100644
index 34660d2ecd2..00000000000
--- a/sys/arch/pc532/pc532/ns_cksum.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/* $NetBSD: ns_cksum.c,v 1.2 1994/10/26 08:25:11 cgd Exp $ */
-
-/*
- * Copyright (c) 1982, 1988 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ns_cksum.c 7.7 (Berkeley) 4/29/91
- */
-
-#include "sys/param.h"
-#include "sys/mbuf.h"
-
-/*
- * Checksum routine for Network Systems Protocol Packets (Big-Endian).
- *
- * This routine is very heavily used in the network
- * code and should be modified for each CPU to be as fast as possible.
- */
-
-#define ADDCARRY(x) { if ((x) > 65535) (x) -= 65535; }
-#define FOLD(x) {l_util.l = (x); (x) = l_util.s[0] + l_util.s[1]; ADDCARRY(x);}
-
-u_short
-ns_cksum(m, len)
- register struct mbuf *m;
- register int len;
-{
- register u_short *w;
- register int sum = 0;
- register int mlen = 0;
- register int sum2;
-
- union {
- u_short s[2];
- long l;
- } l_util;
-
- for (;m && len; m = m->m_next) {
- if (m->m_len == 0)
- continue;
- /*
- * Each trip around loop adds in
- * word from one mbuf segment.
- */
- w = mtod(m, u_short *);
- if (mlen == -1) {
- /*
- * There is a byte left from the last segment;
- * ones-complement add it into the checksum.
- */
-#if BYTE_ORDER == BIG_ENDIAN
- sum += *(u_char *)w;
-#else
- sum += *(u_char *)w << 8;
-#endif
- sum += sum;
- w = (u_short *)(1 + (char *)w);
- mlen = m->m_len - 1;
- len--;
- FOLD(sum);
- } else
- mlen = m->m_len;
- if (len < mlen)
- mlen = len;
- len -= mlen;
- /*
- * We can do a 16 bit ones complement sum using
- * 32 bit arithmetic registers for adding,
- * with carries from the low added
- * into the high (by normal carry-chaining)
- * so long as we fold back before 16 carries have occured.
- */
- if (1 & (int) w)
- goto uuuuglyy;
-#ifndef TINY
-/* -DTINY reduces the size from 1250 to 550, but slows it down by 22% */
- while ((mlen -= 32) >= 0) {
- sum += w[0]; sum += sum; sum += w[1]; sum += sum;
- sum += w[2]; sum += sum; sum += w[3]; sum += sum;
- sum += w[4]; sum += sum; sum += w[5]; sum += sum;
- sum += w[6]; sum += sum; sum += w[7]; sum += sum;
- FOLD(sum);
- sum += w[8]; sum += sum; sum += w[9]; sum += sum;
- sum += w[10]; sum += sum; sum += w[11]; sum += sum;
- sum += w[12]; sum += sum; sum += w[13]; sum += sum;
- sum += w[14]; sum += sum; sum += w[15]; sum += sum;
- FOLD(sum);
- w += 16;
- }
- mlen += 32;
-#endif
- while ((mlen -= 8) >= 0) {
- sum += w[0]; sum += sum; sum += w[1]; sum += sum;
- sum += w[2]; sum += sum; sum += w[3]; sum += sum;
- FOLD(sum);
- w += 4;
- }
- mlen += 8;
- while ((mlen -= 2) >= 0) {
- sum += *w++; sum += sum;
- }
- goto commoncase;
-uuuuglyy:
-#if BYTE_ORDER == BIG_ENDIAN
-#define ww(n) (((u_char *)w)[n + n + 1])
-#define vv(n) (((u_char *)w)[n + n])
-#else
-#if BYTE_ORDER == LITTLE_ENDIAN
-#define vv(n) (((u_char *)w)[n + n + 1])
-#define ww(n) (((u_char *)w)[n + n])
-#endif
-#endif
- sum2 = 0;
-#ifndef TINY
- while ((mlen -= 32) >= 0) {
- sum += ww(0); sum += sum; sum += ww(1); sum += sum;
- sum += ww(2); sum += sum; sum += ww(3); sum += sum;
- sum += ww(4); sum += sum; sum += ww(5); sum += sum;
- sum += ww(6); sum += sum; sum += ww(7); sum += sum;
- FOLD(sum);
- sum += ww(8); sum += sum; sum += ww(9); sum += sum;
- sum += ww(10); sum += sum; sum += ww(11); sum += sum;
- sum += ww(12); sum += sum; sum += ww(13); sum += sum;
- sum += ww(14); sum += sum; sum += ww(15); sum += sum;
- FOLD(sum);
- sum2 += vv(0); sum2 += sum2; sum2 += vv(1); sum2 += sum2;
- sum2 += vv(2); sum2 += sum2; sum2 += vv(3); sum2 += sum2;
- sum2 += vv(4); sum2 += sum2; sum2 += vv(5); sum2 += sum2;
- sum2 += vv(6); sum2 += sum2; sum2 += vv(7); sum2 += sum2;
- FOLD(sum2);
- sum2 += vv(8); sum2 += sum2; sum2 += vv(9); sum2 += sum2;
- sum2 += vv(10); sum2 += sum2; sum2 += vv(11); sum2 += sum2;
- sum2 += vv(12); sum2 += sum2; sum2 += vv(13); sum2 += sum2;
- sum2 += vv(14); sum2 += sum2; sum2 += vv(15); sum2 += sum2;
- FOLD(sum2);
- w += 16;
- }
- mlen += 32;
-#endif
- while ((mlen -= 8) >= 0) {
- sum += ww(0); sum += sum; sum += ww(1); sum += sum;
- sum += ww(2); sum += sum; sum += ww(3); sum += sum;
- FOLD(sum);
- sum2 += vv(0); sum2 += sum2; sum2 += vv(1); sum2 += sum2;
- sum2 += vv(2); sum2 += sum2; sum2 += vv(3); sum2 += sum2;
- FOLD(sum2);
- w += 4;
- }
- mlen += 8;
- while ((mlen -= 2) >= 0) {
- sum += ww(0); sum += sum;
- sum2 += vv(0); sum2 += sum2;
- w++;
- }
- sum += (sum2 << 8);
-commoncase:
- if (mlen == -1) {
-#if BYTE_ORDER == BIG_ENDIAN
- sum += *(u_char *)w << 8;
-#else
- sum += *(u_char *)w;
-#endif
- }
- FOLD(sum);
- }
- if (mlen == -1) {
- /* We had an odd number of bytes to sum; assume a garbage
- byte of zero and clean up */
- sum += sum;
- FOLD(sum);
- }
- /*
- * sum has already been kept to low sixteen bits.
- * just examine result and exit.
- */
- if(sum==0xffff) sum = 0;
- return (sum);
-}
diff --git a/sys/arch/pc532/pc532/ntoh.s b/sys/arch/pc532/pc532/ntoh.s
deleted file mode 100644
index 8801e9a1bbf..00000000000
--- a/sys/arch/pc532/pc532/ntoh.s
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $NetBSD: ntoh.s,v 1.2 1994/10/26 08:25:12 cgd Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1992 Carnegie Mellon University
- * Copyright (c) 1992 Helsinki University of Technology
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON AND HELSINKI UNIVERSITY OF TECHNOLOGY ALLOW FREE USE
- * OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON AND
- * HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIM ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-
-#include <machine/asm.h>
-
- .text
-ENTRY(ntohl)
-ENTRY(htonl)
- movd S_ARG0,r0
- rotw 8,r0
- rotd 16,r0
- rotw 8,r0
- ret 0
-
-
-ENTRY(ntohs)
-ENTRY(htons)
- movzwd S_ARG0,r0
- rotw 8,r0
- ret 0
diff --git a/sys/arch/pc532/pc532/oc_cksum.s b/sys/arch/pc532/pc532/oc_cksum.s
deleted file mode 100644
index cb42cdb26f3..00000000000
--- a/sys/arch/pc532/pc532/oc_cksum.s
+++ /dev/null
@@ -1,67 +0,0 @@
-/* $NetBSD: oc_cksum.s,v 1.2 1994/10/26 08:25:13 cgd Exp $ */
-
-/*
- * Copyright (c) 1993 Philip A. Nelson.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Philip A. Nelson.
- * 4. The name of Philip A. Nelson may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY PHILIP NELSON ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL PHILIP NELSON BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * oc_cksum: ones complement 16 bit checksum for NS32532
- *
- * oc_cksum (buffer, count, strtval)
- *
- * Do a 16 bit one's complement sum of 'count' bytes from 'buffer'.
- * 'strtval' is the starting value of the sum (usually zero).
- */
-
-
-#include <machine/asm.h>
-
- /* This could use some tuning for better speed. */
-
- .globl _oc_cksum
-_oc_cksum:
- movd S_ARG0,r2 /* buffer */
- movd S_ARG1,r1 /* count */
- movd S_ARG2,r0 /* strtval */
-
-loop:
- cmpqd 1, r1
- ble oneleft
- addw 0(r2), r0
- addqd 2,r2
- addqd -2,r1
- br loop
-
-oneleft:
- bls done
- movqd 0, r1
- movb 0(r2), r1
- addw r1, r0
-done:
- ret 0
diff --git a/sys/arch/pc532/pc532/pmap.c b/sys/arch/pc532/pc532/pmap.c
deleted file mode 100644
index bf6089666fa..00000000000
--- a/sys/arch/pc532/pc532/pmap.c
+++ /dev/null
@@ -1,1945 +0,0 @@
-/* $NetBSD: pmap.c,v 1.10 1995/08/25 07:49:13 phil Exp $ */
-
-/*
- * Copyright (c) 1991 Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and William Jolitz of UUNET Technologies Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pmap.c 7.7 (Berkeley) 5/12/91
- */
-
-/*
- * Derived from hp300 version by Mike Hibler, this version by William
- * Jolitz uses a recursive map [a pde points to the page directory] to
- * map the page tables using the pagetables themselves. This is done to
- * reduce the impact on kernel virtual memory for lots of sparse address
- * space, and to reduce the cost of memory to each process.
- *
- * Derived from: hp300/@(#)pmap.c 7.1 (Berkeley) 12/5/90
- */
-
-/*
- * Reno i386 version, from Mike Hibler's hp300 version.
- */
-
-/*
- * Most recently made to be a pc532 pmap! (Phil Nelson, 1/14/93)
- */
-
-/*
- * Manages physical address maps.
- *
- * In addition to hardware address maps, this
- * module is called upon to provide software-use-only
- * maps which may or may not be stored in the same
- * form as hardware maps. These pseudo-maps are
- * used to store intermediate results from copy
- * operations to and from address spaces.
- *
- * Since the information managed by this module is
- * also stored by the logical address mapping module,
- * this module may throw away valid virtual-to-physical
- * mappings at almost any time. However, invalidations
- * of virtual-to-physical mappings must be done as
- * requested.
- *
- * In order to cope with hardware architectures which
- * make virtual-to-physical map invalidates expensive,
- * this module may delay invalidate or reduced protection
- * operations until such time as they are actually
- * necessary. This module is given full information as
- * to which processors are currently using which maps,
- * and to when physical maps must be made correct.
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/malloc.h>
-#include <sys/user.h>
-
-#include <vm/vm.h>
-#include <vm/vm_param.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-
-/* Prototypes of routines used here. */
-
-vm_offset_t pmap_extract(pmap_t, vm_offset_t);
-void pmap_activate(register pmap_t, struct pcb *);
-extern vm_offset_t reserve_dumppages __P((vm_offset_t));
-
-/*
- * Allocate various and sundry SYSMAPs used in the days of old VM
- * and not yet converted. XXX.
- */
-
-#define BSDVM_COMPAT 1
-
-#ifdef DEBUG
-struct {
- int kernel; /* entering kernel mapping */
- int user; /* entering user mapping */
- int ptpneeded; /* needed to allocate a PT page */
- int pwchange; /* no mapping change, just wiring or protection */
- int wchange; /* no mapping change, just wiring */
- int mchange; /* was mapped but mapping to different page */
- int managed; /* a managed page */
- int firstpv; /* first mapping for this PA */
- int secondpv; /* second mapping for this PA */
- int ci; /* cache inhibited */
- int unmanaged; /* not a managed page */
- int flushes; /* cache flushes */
-} enter_stats;
-struct {
- int calls;
- int removes;
- int pvfirst;
- int pvsearch;
- int ptinvalid;
- int uflushes;
- int sflushes;
-} remove_stats;
-
-int debugmap = 0;
-int pmapdebug = 0; /* 0xffff */
-#define PDB_FOLLOW 0x0001
-#define PDB_INIT 0x0002
-#define PDB_ENTER 0x0004
-#define PDB_REMOVE 0x0008
-#define PDB_CREATE 0x0010
-#define PDB_PTPAGE 0x0020
-#define PDB_CACHE 0x0040
-#define PDB_BITS 0x0080
-#define PDB_COLLECT 0x0100
-#define PDB_PROTECT 0x0200
-#define PDB_PDRTAB 0x0400
-#define PDB_PARANOIA 0x2000
-#define PDB_WIRING 0x4000
-#define PDB_PVDUMP 0x8000
-
-int pmapvacflush = 0;
-#define PVF_ENTER 0x01
-#define PVF_REMOVE 0x02
-#define PVF_PROTECT 0x04
-#define PVF_TOTAL 0x80
-#endif
-
-/*
- * Get PDEs and PTEs for user/kernel address space
- */
-#define pmap_pde(m, v) (&((m)->pm_pdir[((vm_offset_t)(v) >> PD_SHIFT)&1023]))
-
-#define pmap_pte_pa(pte) (*(int *)(pte) & PG_FRAME)
-
-#define pmap_pde_v(pte) ((pte)->pd_v)
-#define pmap_pte_w(pte) ((pte)->pg_w)
-/* #define pmap_pte_ci(pte) ((pte)->pg_ci) */
-#define pmap_pte_m(pte) ((pte)->pg_m)
-#define pmap_pte_u(pte) ((pte)->pg_u)
-#define pmap_pte_v(pte) ((pte)->pg_v)
-#define pmap_pte_set_w(pte, v) ((pte)->pg_w = (v))
-#define pmap_pte_set_prot(pte, v) ((pte)->pg_prot = (v))
-
-
-/* for debug output */
-#define pg printf
-
-/*
- * Given a map and a machine independent protection code,
- * convert to a ns532 protection code.
- */
-#define pte_prot(m, p) (protection_codes[p])
-int protection_codes[8];
-
-struct user *proc0paddr;
-struct pmap kernel_pmap_store;
-
-vm_offset_t avail_start; /* PA of first available physical page */
-vm_offset_t avail_end; /* PA of last available physical page */
-vm_size_t mem_size; /* memory size in bytes */
-vm_offset_t virtual_avail; /* VA of first avail page (after kernel bss)*/
-vm_offset_t virtual_end; /* VA of last avail page (end of kernel AS) */
-vm_offset_t vm_first_phys; /* PA of first managed page */
-vm_offset_t vm_last_phys; /* PA just past last managed page */
-int ns532pagesperpage; /* PAGE_SIZE / NS532_PAGE_SIZE */
-boolean_t pmap_initialized = FALSE; /* Has pmap_init completed? */
-short *pmap_attributes; /* reference and modify bits */
-
-boolean_t pmap_testbit();
-void pmap_clear_modify();
-
-#if BSDVM_COMPAT
-#include "msgbuf.h"
-
-/*
- * All those kernel PT submaps that BSD is so fond of
- */
-struct pte *CMAP1, *CMAP2, *xxx_mmap;
-caddr_t CADDR1, CADDR2, vmmap;
-struct pte *msgbufmap;
-struct msgbuf *msgbufp;
-#endif
-
-vm_offset_t KPTphys;
-extern int PDRPDROFF;
-
-/*
- * Bootstrap memory allocator. This function allows for early dynamic
- * memory allocation until the virtual memory system has been bootstrapped.
- * After that point, either kmem_alloc or malloc should be used. This
- * function works by stealing pages from the (to be) managed page pool,
- * stealing virtual address space, then mapping the pages and zeroing them.
- *
- * It should be used from pmap_bootstrap till vm_page_startup, afterwards
- * it cannot be used, and will generate a panic if tried. Note that this
- * memory will never be freed, and in essence it is wired down.
- */
-void *
-pmap_bootstrap_alloc(size)
- int size;
-{
- extern boolean_t vm_page_startup_initialized;
- vm_offset_t val;
-
- if (vm_page_startup_initialized)
- panic("pmap_bootstrap_alloc: called after startup initialized")\
-;
- size = round_page(size);
- val = virtual_avail;
-
- virtual_avail = pmap_map(virtual_avail, avail_start,
- avail_start + size, VM_PROT_READ|VM_PROT_WRITE);
- avail_start += size;
-
- blkclr ((caddr_t) val, size);
- return ((void *) val);
-}
-
-
-
-/* static */
-void
-v_probe(pmap_t pmap, vm_offset_t va)
-{
- int *ptr;
- struct pde *pde_entry;
- struct pte *pte_entry;
-
- /* get a pointer to the top level page table entry */
- pde_entry = pmap_pde(pmap, va);
- if (!pmap_pde_v(pde_entry)) {
- printf("va 0x%x, no top-level entry\n", va);
- return;
- }
- ptr = (int *) pde_entry;
- pte_entry = ((struct pte *) ((*ptr & PG_FRAME) | KERNBASE)) + ptei(va);
- ptr = (int *) pte_entry;
- if (!pmap_pte_v(pte_entry)) {
- printf("pte_entry 0x%x *pte_entry 0x%x\n", ptr, *ptr);
- printf("va 0x%x, no 2nd-level entry\n", va);
- return;
- }
- /* print the page table entry */
- printf("v_probe: va 0x%x pa 0x%x entry 0x%x\n",
- va, (*ptr & PG_FRAME) | (va & ~PG_FRAME), *ptr);
-}
-
-static
-void
-map_page(pmap_t pmap, vm_offset_t va, vm_offset_t pa)
-{
- int *ptr;
- struct pde *pde_entry;
- struct pte *pte_entry;
-
- /* get a pointer to the top level page table entry */
- pde_entry = pmap_pde(pmap, va);
- if (!pmap_pde_v(pde_entry)) {
- printf("map_page(0x%x, 0x%x, 0x%x) failed\n", pmap, va, pa);
- panic("missing 2nd level page table");
- }
- /* get a pointer to the 2nd level table entry */
- ptr = (int *) pde_entry;
- pte_entry = ((struct pte *) (*ptr & PG_FRAME)) + ptei(va);
- if (pmap_pte_v(pte_entry)) {
- printf("map_page(0x%x, 0x%x, 0x%x) failed\n", pmap, va, pa);
- panic("2nd level page table entry already valid");
- }
- /* make the page table entry */
- ptr = (int *) pte_entry;
- *ptr = pa | PG_V | PG_KW;
- /* just to be safe */
- tlbflush();
-}
-
-/*
- * Map in physical page 'pa' to virtual address 'va', and install
- * as a 2nd level page table at index 'index' for the given
- * pmap.
- */
-static
-void
-map_page_table(pmap_t pmap, int index, vm_offset_t va, vm_offset_t pa)
-{
- int *ptr = (int *) &pmap->pm_pdir[index];
- if (*ptr) {
- printf("2nd level table present for index %x\n", index);
- panic("remapping 2nd level table");
- }
- /* map in the 2nd level table */
- map_page(pmap_kernel(), va, pa);
- /* init the 2nd level table to all invalid */
- bzero(pa, NBPG);
- /* install the 2nd level table */
- *ptr = pa | PG_V | PG_KW;
- /* just to be safe */
- tlbflush();
-}
-
-/*
- * Bootstrap the system enough to run with virtual memory.
- * Map the kernel's code and data, and allocate the system page table.
- *
- * On the Ns532 this is called after mapping has already been enabled
- * and just syncs the pmap module with what has already been done.
- * [We can't call it easily with mapping off since the kernel is not
- * mapped with PA == VA, hence we would have to relocate every address
- * from the linked base (virtual) address 0xFE000000 to the actual
- * (physical) address starting relative to 0]
- */
-struct pte *pmap_pte();
-
-void
-pmap_bootstrap(firstaddr, loadaddr)
- vm_offset_t firstaddr;
- vm_offset_t loadaddr;
-{
- int x, *ptr;
-#if BSDVM_COMPAT
- vm_offset_t va;
- struct pte *pte;
-#endif
- extern vm_offset_t maxmem, physmem;
-
- ns532pagesperpage = 1; /* PAGE_SIZE / NS532_PAGE_SIZE; */
-
- /*
- * Initialize protection array.
- */
- ns532_protection_init();
-
- /* setup avail_start, avail_end, virtual_avail, virtual_end */
- avail_start = firstaddr;
- avail_end = mem_size;
-
- /* XXX: allow for msgbuf */
- avail_end -= ns532_round_page(sizeof(struct msgbuf));
-
- virtual_avail = avail_start + KERNBASE;
- virtual_end = VM_MAX_KERNEL_ADDRESS;
-
- /*
- * Create Kernel page directory table and page maps.
- */
- pmap_kernel()->pm_pdir = (pd_entry_t *) (KPTphys + KERNBASE);
- /* recursively map in ptb0 */
- ptr = ((int *) pmap_kernel()->pm_pdir) + PDRPDROFF;
- if (*ptr) {
- printf("ptb0 0x%x offset 0x%x should be 0 but is 0x%x\n",
- pmap_kernel()->pm_pdir, PDRPDROFF, *ptr);
- bpt_to_monitor();
- }
- /* don't add KERNBASE as this has to be a physical address */
- *ptr = KPTphys | PG_V | PG_KW;
- /* fill in the rest of the top-level kernel VA entries */
- for (x = ns532_btod(VM_MIN_KERNEL_ADDRESS);
- x < ns532_btod(VM_MAX_KERNEL_ADDRESS); x++) {
- ptr = (int *) &pmap_kernel()->pm_pdir[x];
- /* only fill in the entries not yet made in _low_level_init() */
- if (!*ptr) {
- /* map in the page table */
- map_page_table(pmap_kernel(), x,
- virtual_avail, avail_start);
- avail_start += NBPG;
- virtual_avail += NBPG;
- }
- }
- /* map in the kernel stack for process 0 */
- /* install avail_start as a 2nd level table for index 0x3f6 */
- map_page_table(pmap_kernel(), 0x3f6, virtual_avail, avail_start);
- avail_start += NBPG;
- virtual_avail += NBPG;
- /* reserve UPAGES pages */
- proc0paddr = (struct user *) virtual_avail;
- curpcb = (struct pcb *) proc0paddr;
- va = ns532_dtob(0x3f6) | ns532_ptob(0x3fe); /* USRSTACK ? */
- for (x = 0; x < UPAGES; ++x) {
- map_page(pmap_kernel(), va, avail_start);
- map_page(pmap_kernel(), virtual_avail, avail_start);
- bzero(va, NBPG);
- va += NBPG;
- avail_start += NBPG;
- virtual_avail += NBPG;
- }
-
- simple_lock_init(&pmap_kernel()->pm_lock);
- pmap_kernel()->pm_count = 1;
-
-#ifdef DEBUG
- printf("avail_start = 0x%x\n", avail_start);
- printf("avail_end = 0x%x\n", avail_end);
- printf("virtual_avail = 0x%x\n", virtual_avail);
- printf("virtual_end = 0x%x\n", virtual_end);
-#endif
-
-#if BSDVM_COMPAT
- /*
- * Allocate all the submaps we need
- */
-#define SYSMAP(c, p, v, n) \
- v = (c)va; va += ((n)*NS532_PAGE_SIZE); p = pte; pte += (n);
-
- va = virtual_avail;
- pte = pmap_pte(pmap_kernel(), va);
-
- SYSMAP(caddr_t ,CMAP1 ,CADDR1 ,1 )
- SYSMAP(caddr_t ,CMAP2 ,CADDR2 ,1 )
- SYSMAP(caddr_t ,xxx_mmap ,vmmap ,1 )
- SYSMAP(struct msgbuf * ,msgbufmap ,msgbufp ,1 )
- virtual_avail = va;
-#endif
- virtual_avail = reserve_dumppages(va);
-#ifdef DEBUG
- printf("virtual_avail = 0x%x\n", virtual_avail);
-#endif
- tlbflush();
- /* XXX why do we do this??? - MM */
- *(int *)PTD = 0;
- tlbflush();
-}
-
-/*
- * Initialize the pmap module.
- * Called by vm_init, to initialize any structures that the pmap
- * system needs to map virtual memory.
- */
-void
-pmap_init(phys_start, phys_end)
- vm_offset_t phys_start, phys_end;
-{
- int result;
- vm_offset_t addr, addr2;
- vm_size_t npg, s;
- int rv;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_INIT))
- printf("pmap_init(0x%x, 0x%x)\n", phys_start, phys_end);
-#endif
-
- if (PAGE_SIZE != NBPG)
- panic("pmap_init: CLSIZE != 1");
- /*
- * Now that kernel map has been allocated, we can mark as
- * unavailable regions which we have mapped in locore.
- */
-
-#if 0
- /* the following reserves the (virtual) i/o space */
- addr = 0xffc00000;
- result = vm_map_find(kernel_map, NULL, (vm_offset_t) 0,
- &addr, NBPG, FALSE);
- if (result != KERN_SUCCESS) {
- printf("vm_map_find for virtual i/o space failed %d\n", result);
- }
-
- /* reserve the used page tables following the kernel */
- /* bumped this to 10 pages just to be paranoid */
- addr = (vm_offset_t) KERNBASE + KPTphys;
- vm_object_reference(kernel_object);
- result = vm_map_find(kernel_map, kernel_object, addr,
- &addr, 10*NBPG, FALSE);
- if (result != KERN_SUCCESS) {
- printf("vm_map_find for kernel page maps failed %d\n", result);
- }
-#endif
- /*
- * Allocate memory for random pmap data structures. Includes the
- * pv_head_table and pmap_attributes.
- */
- npg = atop(phys_end - phys_start);
- s = (vm_size_t) (sizeof(struct pv_entry) * npg + 2*npg);
- s = round_page(s);
- addr = (vm_offset_t) kmem_alloc(kernel_map, s);
- pv_table = (pv_entry_t) addr;
- addr += sizeof(struct pv_entry) * npg;
- pmap_attributes = (short *) addr;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_INIT)
- printf("pmap_init: %x bytes (%x pgs): tbl %x attr %x\n",
- s, npg, pv_table, pmap_attributes);
-#endif
-
- /*
- * Now it is safe to enable pv_table recording.
- */
- vm_first_phys = phys_start;
- vm_last_phys = phys_end;
- pmap_initialized = TRUE;
-}
-
-/*
- * Used to map a range of physical addresses into kernel
- * virtual address space.
- *
- * For now, VM is already on, we only need to map the
- * specified memory.
- */
-vm_offset_t
-pmap_map(virt, start, end, prot)
- vm_offset_t virt;
- vm_offset_t start;
- vm_offset_t end;
- int prot;
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_map(%x, %x, %x, %x)\n", virt, start, end, prot);
-#endif
- while (start < end) {
- pmap_enter(pmap_kernel(), virt, start, prot, FALSE);
- virt += PAGE_SIZE;
- start += PAGE_SIZE;
- }
- return(virt);
-}
-
-/*
- * Create and return a physical map.
- *
- * If the size specified for the map
- * is zero, the map is an actual physical
- * map, and may be referenced by the
- * hardware.
- *
- * If the size specified is non-zero,
- * the map will be used in software only, and
- * is bounded by that size.
- *
- * [ just allocate a ptd and mark it uninitialize -- should we track
- * with a table which process has which ptd? -wfj ]
- */
-
-pmap_t
-pmap_create(size)
- vm_size_t size;
-{
- register pmap_t pmap;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- printf("pmap_create(%x)\n", size);
-#endif
- /*
- * Software use map does not need a pmap
- */
- if (size)
- return(NULL);
-
- /* XXX: is it ok to wait here? */
- pmap = (pmap_t) malloc(sizeof *pmap, M_VMPMAP, M_WAITOK);
-#ifdef notifwewait
- if (pmap == NULL)
- panic("pmap_create: cannot allocate a pmap");
-#endif
- bzero(pmap, sizeof(*pmap));
- pmap_pinit(pmap);
- return (pmap);
-}
-
-/*
- * Initialize a preallocated and zeroed pmap structure,
- * such as one in a vmspace structure.
- */
-void
-pmap_pinit(pmap)
- register struct pmap *pmap;
-{
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- pg("pmap_pinit(%x)\n", pmap);
-#endif
-
- /*
- * No need to allocate page table space yet but we do need a
- * valid page directory table.
- */
- pmap->pm_pdir = (pd_entry_t *) kmem_alloc(kernel_map, NBPG);
-
- /* wire in kernel global address entries */
- bcopy(PTD+KPTDI_FIRST, pmap->pm_pdir+KPTDI_FIRST,
- (KPTDI_LAST-KPTDI_FIRST+1)*4);
-
- /* install self-referential address mapping entry */
- *(int *)(pmap->pm_pdir+PTDPTDI) =
- (int)pmap_extract(pmap_kernel(), (vm_offset_t) pmap->pm_pdir)
- | PG_V | PG_KW;
-
- pmap->pm_count = 1;
- simple_lock_init(&pmap->pm_lock);
-}
-
-/*
- * Retire the given physical map from service.
- * Should only be called if the map contains
- * no valid mappings.
- */
-void
-pmap_destroy(pmap)
- register pmap_t pmap;
-{
- int count;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_destroy(%x)\n", pmap);
-#endif
- if (pmap == NULL)
- return;
-
- simple_lock(&pmap->pm_lock);
- count = --pmap->pm_count;
- simple_unlock(&pmap->pm_lock);
- if (count == 0) {
- pmap_release(pmap);
- free((caddr_t)pmap, M_VMPMAP);
- }
-}
-
-/*
- * Release any resources held by the given physical map.
- * Called when a pmap initialized by pmap_pinit is being released.
- * Should only be called if the map contains no valid mappings.
- */
-void
-pmap_release(pmap)
- register struct pmap *pmap;
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- pg("pmap_release(%x)\n", pmap);
-#endif
-#ifdef notdef /* DIAGNOSTIC */
- /* count would be 0 from pmap_destroy... */
- simple_lock(&pmap->pm_lock);
- if (pmap->pm_count != 1)
- panic("pmap_release count");
-#endif
- kmem_free(kernel_map, (vm_offset_t)pmap->pm_pdir, NBPG);
-}
-
-/*
- * Add a reference to the specified pmap.
- */
-void
-pmap_reference(pmap)
- pmap_t pmap;
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_reference(%x)\n", pmap);
-#endif
- if (pmap != NULL) {
- simple_lock(&pmap->pm_lock);
- pmap->pm_count++;
- simple_unlock(&pmap->pm_lock);
- }
-}
-
-/*
- * Remove the given range of addresses from the specified map.
- *
- * It is assumed that the start and end are properly
- * rounded to the page size.
- */
-void
-pmap_remove(pmap, sva, eva)
- struct pmap *pmap;
- register vm_offset_t sva;
- register vm_offset_t eva;
-{
- register pt_entry_t *ptp,*ptq;
- vm_offset_t va;
- vm_offset_t pa;
- pt_entry_t *pte;
- pv_entry_t pv, npv;
- int ix;
- int s, bits;
-
-#ifdef DEBUG
- pt_entry_t opte;
-
- if (pmapdebug & (PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT))
- pg("pmap_remove(%x, %x, %x)\n", pmap, sva, eva);
-#endif
-
- if (pmap == NULL)
- return;
-
- /* are we current address space or kernel? */
- if (pmap->pm_pdir[PTDPTDI].pd_pfnum == PTDpde.pd_pfnum
- || pmap == pmap_kernel())
- ptp=PTmap;
-
- /* otherwise, we are alternate address space */
- else {
- if (pmap->pm_pdir[PTDPTDI].pd_pfnum
- != APTDpde.pd_pfnum) {
- APTDpde = pmap->pm_pdir[PTDPTDI];
- tlbflush();
- }
- ptp=APTmap;
- }
-#ifdef DEBUG
- remove_stats.calls++;
-#endif
-
- /* this is essential since we must check the PDE(sva) for precense */
- while (sva <= eva && !pmap_pde_v(pmap_pde(pmap, sva)))
- sva = (sva & PD_MASK) + (1<<PD_SHIFT);
- sva = ns532_btop(sva);
- eva = ns532_btop(eva);
-
- for (; sva < eva; sva++) {
- /*
- * Weed out invalid mappings.
- * Note: we assume that the page directory table is
- * always allocated, and in kernel virtual.
- */
- ptq=ptp+sva;
- while((sva & 0x3ff) && !pmap_pte_pa(ptq))
- {
- if(++sva >= eva)
- return;
- ptq++;
- }
-
-
- if(!(sva & 0x3ff)) /* Only check once in a while */
- {
- if (!pmap_pde_v(pmap_pde(pmap, ns532_ptob(sva))))
- {
- /* We can race ahead here, straight to next pde.. */
- sva = (sva & 0xffc00) + (1<<10) -1 ;
- continue;
- }
- }
- if(!pmap_pte_pa(ptp+sva))
- continue;
-
- pte = ptp + sva;
- pa = pmap_pte_pa(pte);
- va = ns532_ptob(sva);
-#ifdef DEBUG
- opte = *pte;
- remove_stats.removes++;
-#endif
- /*
- * Update statistics
- */
- if (pmap_pte_w(pte))
- pmap->pm_stats.wired_count--;
- pmap->pm_stats.resident_count--;
-
- /*
- * Invalidate the PTEs.
- * XXX: should cluster them up and invalidate as many
- * as possible at once.
- */
-#ifdef DEBUG
- if (pmapdebug & PDB_REMOVE)
- printf("remove: inv %x ptes at pte %x pa %x va %x\n",
- ns532pagesperpage, pte, pa, va);
-#endif
- bits = ix = 0;
- do {
- bits |= *(int *)pte & (PG_U|PG_M);
- *(int *)pte++ = 0;
- /*TBIS(va + ix * NS532_PAGE_SIZE);*/
- } while (++ix != ns532pagesperpage);
- if (curproc && pmap == &curproc->p_vmspace->vm_pmap)
- pmap_activate(pmap, (struct pcb *)curproc->p_addr);
-#if 0
-/* commented out in 386 version as well */
- /* are we current address space or kernel? */
- if (pmap->pm_pdir[PTDPTDI].pd_pfnum == PTDpde.pd_pfnum
- || pmap == pmap_kernel()) {
- _load_ptb0(curpcb->pcb_ptb);
- }
-#endif
- tlbflush();
-
-#ifdef needednotdone
-reduce wiring count on page table pages as references drop
-#endif
-
- /*
- * Remove from the PV table (raise IPL since we
- * may be called at interrupt time).
- */
- if (pa < vm_first_phys || pa >= vm_last_phys)
- continue;
- pv = pa_to_pvh(pa);
- s = splimp();
- /*
- * If it is the first entry on the list, it is actually
- * in the header and we must copy the following entry up
- * to the header. Otherwise we must search the list for
- * the entry. In either case we free the now unused entry.
- */
- if (pmap == pv->pv_pmap && va == pv->pv_va) {
- npv = pv->pv_next;
- if (npv) {
- *pv = *npv;
- free((caddr_t)npv, M_VMPVENT);
- } else
- pv->pv_pmap = NULL;
-#ifdef DEBUG
- remove_stats.pvfirst++;
-#endif
- } else {
- for (npv = pv->pv_next; npv; npv = npv->pv_next) {
-#ifdef DEBUG
- remove_stats.pvsearch++;
-#endif
- if (pmap == npv->pv_pmap && va == npv->pv_va)
- break;
- pv = npv;
- }
-#ifdef DEBUG
- if (npv == NULL) {
- printf("vm_first_phys %x pa %x vm_last_phys %x\n",
- vm_first_phys, pa, vm_last_phys);
- panic("pmap_remove: PA not in pv_tab");
- }
-#endif
- pv->pv_next = npv->pv_next;
- free((caddr_t)npv, M_VMPVENT);
- pv = pa_to_pvh(pa);
- }
-
-#ifdef notdef
-[tally number of pagetable pages, if sharing of ptpages adjust here]
-#endif
- /*
- * Update saved attributes for managed page
- */
- pmap_attributes[pa_index(pa)] |= bits;
- splx(s);
- }
-#ifdef notdef
-[cache and tlb flushing, if needed]
-#endif
-}
-
-/*
- * Routine: pmap_remove_all
- * Function:
- * Removes this physical page from
- * all physical maps in which it resides.
- * Reflects back modify bits to the pager.
- */
-void
-pmap_remove_all(pa)
- vm_offset_t pa;
-{
- register pv_entry_t pv;
- int s;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT))
- printf("pmap_remove_all(%x)", pa);
- /*pmap_pvdump(pa);*/
-#endif
- /*
- * Not one of ours
- */
- if (pa < vm_first_phys || pa >= vm_last_phys)
- return;
-
- pv = pa_to_pvh(pa);
- s = splimp();
- /*
- * Do it the easy way for now
- */
- while (pv->pv_pmap != NULL) {
-#ifdef DEBUG
- if (!pmap_pde_v(pmap_pde(pv->pv_pmap, pv->pv_va)) ||
- pmap_pte_pa(pmap_pte(pv->pv_pmap, pv->pv_va)) != pa)
- panic("pmap_remove_all: bad mapping");
-#endif
- pmap_remove(pv->pv_pmap, pv->pv_va, pv->pv_va + PAGE_SIZE);
- }
- splx(s);
-}
-
-/*
- * Routine: pmap_copy_on_write
- * Function:
- * Remove write privileges from all
- * physical maps for this physical page.
- */
-void
-pmap_copy_on_write(pa)
- vm_offset_t pa;
-{
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_PROTECT))
- printf("pmap_copy_on_write(%x)", pa);
-#endif
- pmap_changebit(pa, /* was PG_RO, TRUE */ PG_RW, FALSE);
-}
-
-/*
- * Set the physical protection on the
- * specified range of this map as requested.
- */
-void
-pmap_protect(pmap, sva, eva, prot)
- register pmap_t pmap;
- vm_offset_t sva, eva;
- vm_prot_t prot;
-{
- register pt_entry_t *pte;
- register vm_offset_t va;
- register int ix;
- int ns532prot;
- boolean_t firstpage = TRUE;
- register pt_entry_t *ptp;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_PROTECT))
- printf("pmap_protect(%x, %x, %x, %x)", pmap, sva, eva, prot);
-#endif
- if (pmap == NULL)
- return;
-
- if ((prot & VM_PROT_READ) == VM_PROT_NONE) {
- pmap_remove(pmap, sva, eva);
- return;
- }
- if (prot & VM_PROT_WRITE)
- return;
-
- /* are we current address space or kernel? */
- if (pmap->pm_pdir[PTDPTDI].pd_pfnum == PTDpde.pd_pfnum
- || pmap == pmap_kernel())
- ptp=PTmap;
-
- /* otherwise, we are alternate address space */
- else {
- if (pmap->pm_pdir[PTDPTDI].pd_pfnum
- != APTDpde.pd_pfnum) {
- APTDpde = pmap->pm_pdir[PTDPTDI];
- tlbflush();
- }
- ptp=APTmap;
- }
- for (va = sva; va < eva; va += PAGE_SIZE) {
- /*
- * Page table page is not allocated.
- * Skip it, we don't want to force allocation
- * of unnecessary PTE pages just to set the protection.
- */
- if (!pmap_pde_v(pmap_pde(pmap, va))) {
- /* XXX: avoid address wrap around */
- if (va >= ns532_trunc_pdr((vm_offset_t)-1))
- break;
- va = ns532_round_pdr(va + PAGE_SIZE) - PAGE_SIZE;
- continue;
- }
-
- pte = ptp + ns532_btop(va);
-
- /*
- * Page not valid. Again, skip it.
- * Should we do this? Or set protection anyway?
- */
- if (!pmap_pte_v(pte))
- continue;
-
- ix = 0;
- ns532prot = pte_prot(pmap, prot);
- if(va < UPT_MAX_ADDRESS)
- ns532prot |= 2 /*PG_u*/;
- do {
- /* clear VAC here if PG_RO? */
- pmap_pte_set_prot(pte++, ns532prot);
- /*TBIS(va + ix * NS532_PAGE_SIZE);*/
- } while (++ix != ns532pagesperpage);
- }
- if (curproc && pmap == &curproc->p_vmspace->vm_pmap)
- pmap_activate(pmap, (struct pcb *)curproc->p_addr);
-}
-
-/*
- * Insert the given physical page (p) at
- * the specified virtual address (v) in the
- * target physical map with the protection requested.
- *
- * If specified, the page will be wired down, meaning
- * that the related pte can not be reclaimed.
- *
- * NB: This is the only routine which MAY NOT lazy-evaluate
- * or lose information. That is, this routine must actually
- * insert this page into the given map NOW.
- */
-void
-pmap_enter(pmap, va, pa, prot, wired)
- register pmap_t pmap;
- vm_offset_t va;
- register vm_offset_t pa;
- vm_prot_t prot;
- boolean_t wired;
-{
- register pt_entry_t *pte;
- register int npte, ix;
- vm_offset_t opa;
- boolean_t cacheable = TRUE;
- boolean_t checkpv = TRUE;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_ENTER))
- printf("pmap_enter(%x, %x, %x, %x, %x)\n",
- pmap, va, pa, prot, wired);
-#endif
- if (pmap == NULL)
- return;
-
- if(va >= VM_MAX_KERNEL_ADDRESS)
- panic("pmap_enter: toobig");
- /* also, should not muck with PTD va! */
-
-#ifdef DEBUG
- if (pmap == pmap_kernel())
- enter_stats.kernel++;
- else
- enter_stats.user++;
-#endif
-
- /*
- * Page Directory table entry not valid, we need a new PT page
- */
- pte = pmap_pte(pmap, va);
- if (!pte)
- panic("ptdi %x", pmap->pm_pdir[PTDPTDI]);
-
-#ifdef DEBUG
- if (pmapdebug & PDB_ENTER)
- printf("enter: pte %x, *pte %x ", pte, *(int *)pte);
-#endif
-
-
- if (pmap_pte_v(pte)) {
- register vm_offset_t opa;
-
- opa = pmap_pte_pa(pte);
-
- /*
- * Mapping has not changed, must be protection or wiring change.
- */
- if (opa == pa) {
-#ifdef DEBUG
- enter_stats.pwchange++;
-#endif
- /*
- * Wiring change, just update stats.
- * We don't worry about wiring PT pages as they remain
- * resident as long as there are valid mappings in them.
- * Hence, if a user page is wired, the PT page will be also.
- */
- if (wired && !pmap_pte_w(pte) || !wired && pmap_pte_w(pte)) {
-#ifdef DEBUG
- if (pmapdebug & PDB_ENTER)
- pg("enter: wiring change -> %x ", wired);
-#endif
- if (wired)
- pmap->pm_stats.wired_count++;
- else
- pmap->pm_stats.wired_count--;
-#ifdef DEBUG
- enter_stats.wchange++;
-#endif
- }
- goto validate;
- }
-
- /*
- * Mapping has changed, invalidate old range and fall through to
- * handle validating new mapping.
- */
-#ifdef DEBUG
- if (pmapdebug & PDB_ENTER)
- printf("enter: removing old mapping %x pa %x ", va, opa);
-#endif
- pmap_remove(pmap, va, va + NBPG);
-#ifdef DEBUG
- enter_stats.mchange++;
-#endif
- }
-
- /*
- * Enter on the PV list if part of our managed memory
- * Note that we raise IPL while manipulating pv_table
- * since pmap_enter can be called at interrupt time.
- */
-/* if (pmap_valid_page(pa)) in the i386 version ... */
- if (pa >= vm_first_phys && pa < vm_last_phys) {
- register pv_entry_t pv, npv;
- int s;
-
-#ifdef DEBUG
- enter_stats.managed++;
-#endif
- pv = pa_to_pvh(pa);
- s = splimp();
-#ifdef DEBUG
- if (pmapdebug & PDB_ENTER)
- printf("enter: pv at %x: %x/%x/%x\n",
- pv, pv->pv_va, pv->pv_pmap, pv->pv_next);
-#endif
- /*
- * No entries yet, use header as the first entry
- */
- if (pv->pv_pmap == NULL) {
-#ifdef DEBUG
- enter_stats.firstpv++;
-#endif
- pv->pv_va = va;
- pv->pv_pmap = pmap;
- pv->pv_next = NULL;
- pv->pv_flags = 0;
- }
- /*
- * There is at least one other VA mapping this page.
- * Place this entry after the header.
- */
- else {
- /*printf("second time: ");*/
-#ifdef DEBUG
- for (npv = pv; npv; npv = npv->pv_next)
- if (pmap == npv->pv_pmap && va == npv->pv_va)
- panic("pmap_enter: already in pv_tab");
-#endif
- npv = (pv_entry_t)
- malloc(sizeof *npv, M_VMPVENT, M_NOWAIT);
- if (npv == NULL)
- panic("pmap_enter: malloc returned NULL");
- npv->pv_va = va;
- npv->pv_pmap = pmap;
- npv->pv_next = pv->pv_next;
- pv->pv_next = npv;
-#ifdef DEBUG
- if (!npv->pv_next)
- enter_stats.secondpv++;
-#endif
- }
- splx(s);
- }
- /*
- * Assumption: if it is not part of our managed memory
- * then it must be device memory which may be volitile.
- */
- if (pmap_initialized) {
- checkpv = cacheable = FALSE;
-#ifdef DEBUG
- enter_stats.unmanaged++;
-#endif
- }
-
- /*
- * Increment counters
- */
- pmap->pm_stats.resident_count++;
- if (wired)
- pmap->pm_stats.wired_count++;
-
-validate:
- /*
- * Now validate mapping with desired protection/wiring.
- * Assume uniform modified and referenced status for all
- * Ns532 pages in a MACH page.
- */
- npte = (pa & PG_FRAME) | pte_prot(pmap, prot) | PG_V;
- npte |= (*(int *)pte & (PG_M|PG_U));
- if (wired)
- npte |= PG_W;
- if (va < VM_MAXUSER_ADDRESS) /* i.e. below USRSTACK */
- npte |= PG_u;
- else if (va < UPT_MAX_ADDRESS)
- /* pagetables need to be user RW, for some reason, and the
- * user area must be writable too. Anything above
- * VM_MAXUSER_ADDRESS is protected from user access by
- * the user data and code segment descriptors, so this is OK.
- *
- * andrew@werple.apana.org.au
- */
- npte |= PG_u | PG_RW;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_ENTER)
- printf("enter: new pte value %x\n", npte);
-#endif
- ix = 0;
- do {
- *(int *)pte++ = npte;
- /*TBIS(va);*/
- npte += NS532_PAGE_SIZE;
- va += NS532_PAGE_SIZE;
- } while (++ix != ns532pagesperpage);
- pte--;
-#ifdef DEBUGx
-cache, tlb flushes
-#endif
-#if 0
- pads(pmap);
- _load_ptb0(((struct pcb *)curproc->p_addr)->pcb_ptb);
-#endif
- tlbflush();
-}
-
-/*
- * pmap_page_protect:
- *
- * Lower the permission for all mappings to a given page.
- */
-void
-pmap_page_protect(phys, prot)
- vm_offset_t phys;
- vm_prot_t prot;
-{
- switch (prot) {
- case VM_PROT_READ:
- case VM_PROT_READ|VM_PROT_EXECUTE:
- pmap_copy_on_write(phys);
- break;
- case VM_PROT_ALL:
- break;
- default:
- pmap_remove_all(phys);
- break;
- }
-}
-
-/*
- * Routine: pmap_change_wiring
- * Function: Change the wiring attribute for a map/virtual-address
- * pair.
- * In/out conditions:
- * The mapping must already exist in the pmap.
- */
-void
-pmap_change_wiring(pmap, va, wired)
- register pmap_t pmap;
- vm_offset_t va;
- boolean_t wired;
-{
- register pt_entry_t *pte;
- register int ix;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_change_wiring(%x, %x, %x)\n", pmap, va, wired);
-#endif
- if (pmap == NULL)
- return;
-
- pte = pmap_pte(pmap, va);
-#ifdef DEBUG
- /*
- * Page table page is not allocated.
- * Should this ever happen? Ignore it for now,
- * we don't want to force allocation of unnecessary PTE pages.
- */
- if (!pmap_pde_v(pmap_pde(pmap, va))) {
- if (pmapdebug & PDB_PARANOIA)
- pg("pmap_change_wiring: invalid PDE for %x\n", va);
- return;
- }
- /*
- * Page not valid. Should this ever happen?
- * Just continue and change wiring anyway.
- */
- if (!pmap_pte_v(pte)) {
- if (pmapdebug & PDB_PARANOIA)
- pg("pmap_change_wiring: invalid PTE for %x\n", va);
- }
-#endif
- if (wired && !pmap_pte_w(pte) || !wired && pmap_pte_w(pte)) {
- if (wired)
- pmap->pm_stats.wired_count++;
- else
- pmap->pm_stats.wired_count--;
- }
- /*
- * Wiring is not a hardware characteristic so there is no need
- * to invalidate TLB.
- */
- ix = 0;
- do {
- pmap_pte_set_w(pte++, wired);
- } while (++ix != ns532pagesperpage);
-}
-
-/*
- * Routine: pmap_pte
- * Function:
- * Extract the page table entry associated
- * with the given map/virtual_address pair.
- * [ what about induced faults -wfj]
- */
-
-struct pte *pmap_pte(pmap, va)
- register pmap_t pmap;
- vm_offset_t va;
-{
-#ifdef DEBUGx
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_pte(%x, %x) ->\n", pmap, va);
-#endif
- if (pmap && pmap_pde_v(pmap_pde(pmap, va))) {
-
- /* are we current address space or kernel? */
- if (pmap->pm_pdir[PTDPTDI].pd_pfnum == PTDpde.pd_pfnum
- || pmap == pmap_kernel())
- return ((struct pte *) vtopte(va));
-
- /* otherwise, we are alternate address space */
- else {
- if (pmap->pm_pdir[PTDPTDI].pd_pfnum
- != APTDpde.pd_pfnum) {
- APTDpde = pmap->pm_pdir[PTDPTDI];
- tlbflush();
- }
- return((struct pte *) avtopte(va));
- }
- }
- return(0);
-}
-
-/*
- * Routine: pmap_extract
- * Function:
- * Extract the physical page address associated
- * with the given map/virtual_address pair.
- */
-
-vm_offset_t
-pmap_extract(pmap, va)
- register pmap_t pmap;
- vm_offset_t va;
-{
- register vm_offset_t pa;
-
-#ifdef DEBUGx
- if (pmapdebug & PDB_FOLLOW)
- pg("pmap_extract(%x, %x) -> ", pmap, va);
-#endif
- pa = 0;
- if (pmap && pmap_pde_v(pmap_pde(pmap, va))) {
- pa = *(int *) pmap_pte(pmap, va);
- }
- if (pa)
- pa = (pa & PG_FRAME) | (va & ~PG_FRAME);
-#ifdef DEBUGx
- if (pmapdebug & PDB_FOLLOW)
- printf("%x\n", pa);
-#endif
- return(pa);
-}
-
-/*
- * Copy the range specified by src_addr/len
- * from the source map to the range dst_addr/len
- * in the destination map.
- *
- * This routine is only advisory and need not do anything.
- */
-void pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr)
- pmap_t dst_pmap;
- pmap_t src_pmap;
- vm_offset_t dst_addr;
- vm_size_t len;
- vm_offset_t src_addr;
-{
-/* printf ("pmap_copy: dst=0x%x src=0x%x d_addr=0x%x len=0x%x s_addr=0x%x\n",
- dst_pmap, src_pmap, dst_addr, len, src_addr); */
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_copy(%x, %x, %x, %x, %x)\n",
- dst_pmap, src_pmap, dst_addr, len, src_addr);
-#endif
-}
-
-/*
- * Require that all active physical maps contain no
- * incorrect entries NOW. [This update includes
- * forcing updates of any address map caching.]
- *
- * Generally used to insure that a thread about
- * to run will see a semantically correct world.
- */
-void pmap_update()
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_update()");
-#endif
- tlbflush();
-}
-
-/*
- * Routine: pmap_collect
- * Function:
- * Garbage collects the physical map system for
- * pages which are no longer used.
- * Success need not be guaranteed -- that is, there
- * may well be pages which are not referenced, but
- * others may be collected.
- * Usage:
- * Called by the pageout daemon when pages are scarce.
- * [ needs to be written -wfj ]
- */
-void
-pmap_collect(pmap)
- pmap_t pmap;
-{
- register vm_offset_t pa;
- register pv_entry_t pv;
- register int *pte;
- vm_offset_t kpa;
- int s;
-
-#ifdef DEBUG
- int *pde;
- int opmapdebug;
-#endif
- if (pmap != pmap_kernel())
- return;
-}
-
-/* [ macro again?, should I force kstack into user map here? -wfj ] */
-void
-pmap_activate(pmap, pcbp)
- register pmap_t pmap;
- struct pcb *pcbp;
-{
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_PDRTAB))
- pg("pmap_activate(%x, %x)\n", pmap, pcbp);
-#endif
- PMAP_ACTIVATE(pmap, pcbp);
-#ifdef DEBUG
- {
- int x;
- printf("pde ");
- for(x=0x3f6; x < 0x3fA; x++)
- printf("%x ", pmap->pm_pdir[x]);
- pads(pmap);
- pg(" pcb_ptb %x\n", pcbp->pcb_ptb);
- }
-#endif
-}
-
-/*
- * pmap_zero_page zeros the specified (machine independent)
- * page by mapping the page into virtual memory and using
- * bzero to clear its contents, one machine dependent page
- * at a time.
- */
-void
-pmap_zero_page(phys)
- register vm_offset_t phys;
-{
- register int ix;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_zero_page(%x)\n", phys);
-#endif
- phys >>= PG_SHIFT;
- ix = 0;
- do {
- clearseg(phys++);
- } while (++ix != ns532pagesperpage);
-}
-
-/*
- * pmap_copy_page copies the specified (machine independent)
- * page by mapping the page into virtual memory and using
- * bcopy to copy the page, one machine dependent page at a
- * time.
- */
-void
-pmap_copy_page(src, dst)
- register vm_offset_t src, dst;
-{
- register int ix;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_copy_page(%x, %x)", src, dst);
-#endif
- src >>= PG_SHIFT;
- dst >>= PG_SHIFT;
- ix = 0;
- do {
- physcopyseg(src++, dst++);
- } while (++ix != ns532pagesperpage);
-}
-
-
-/*
- * Routine: pmap_pageable
- * Function:
- * Make the specified pages (by pmap, offset)
- * pageable (or not) as requested.
- *
- * A page which is not pageable may not take
- * a fault; therefore, its page table entry
- * must remain valid for the duration.
- *
- * This routine is merely advisory; pmap_enter
- * will specify that these pages are to be wired
- * down (or not) as appropriate.
- */
-void
-pmap_pageable(pmap, sva, eva, pageable)
- pmap_t pmap;
- vm_offset_t sva, eva;
- boolean_t pageable;
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_pageable(%x, %x, %x, %x)\n",
- pmap, sva, eva, pageable);
-#endif
- /*
- * If we are making a PT page pageable then all valid
- * mappings must be gone from that page. Hence it should
- * be all zeros and there is no need to clean it.
- * Assumptions:
- * - we are called with only one page at a time
- * - PT pages have only one pv_table entry
- */
- if (pmap == pmap_kernel() && pageable && sva + PAGE_SIZE == eva) {
- register pv_entry_t pv;
- register vm_offset_t pa;
-
-#ifdef DEBUG
- if ((pmapdebug & (PDB_FOLLOW|PDB_PTPAGE)) == PDB_PTPAGE)
- printf("pmap_pageable(%x, %x, %x, %x)\n",
- pmap, sva, eva, pageable);
-#endif
- /*if (!pmap_pde_v(pmap_pde(pmap, sva)))
- return;*/
- if(pmap_pte(pmap, sva) == 0)
- return;
- pa = pmap_pte_pa(pmap_pte(pmap, sva));
- if (pa < vm_first_phys || pa >= vm_last_phys)
- return;
- pv = pa_to_pvh(pa);
- /*if (!ispt(pv->pv_va))
- return;*/
-#ifdef DEBUG
- if (pv->pv_va != sva || pv->pv_next) {
- pg("pmap_pageable: bad PT page va %x next %x\n",
- pv->pv_va, pv->pv_next);
- return;
- }
-#endif
- /*
- * Mark it unmodified to avoid pageout
- */
- pmap_clear_modify(pa);
-#ifdef needsomethinglikethis
- if (pmapdebug & PDB_PTPAGE)
- pg("pmap_pageable: PT page %x(%x) unmodified\n",
- sva, *(int *)pmap_pte(pmap, sva));
- if (pmapdebug & PDB_WIRING)
- pmap_check_wiring("pageable", sva);
-#endif
- }
-}
-
-/*
- * Clear the modify bits on the specified physical page.
- */
-
-void
-pmap_clear_modify(pa)
- vm_offset_t pa;
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_clear_modify(%x)", pa);
-#endif
- pmap_changebit(pa, PG_M, FALSE);
-}
-
-/*
- * pmap_clear_reference:
- *
- * Clear the reference bit on the specified physical page.
- */
-
-void pmap_clear_reference(pa)
- vm_offset_t pa;
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_clear_reference(%x)", pa);
-#endif
- pmap_changebit(pa, PG_U, FALSE);
-}
-
-/*
- * pmap_is_referenced:
- *
- * Return whether or not the specified physical page is referenced
- * by any physical maps.
- */
-
-boolean_t
-pmap_is_referenced(pa)
- vm_offset_t pa;
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW) {
- boolean_t rv = pmap_testbit(pa, PG_U);
- printf("pmap_is_referenced(%x) -> %c", pa, "FT"[rv]);
- return(rv);
- }
-#endif
- return(pmap_testbit(pa, PG_U));
-}
-
-/*
- * pmap_is_modified:
- *
- * Return whether or not the specified physical page is modified
- * by any physical maps.
- */
-
-boolean_t
-pmap_is_modified(pa)
- vm_offset_t pa;
-{
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW) {
- boolean_t rv = pmap_testbit(pa, PG_M);
- printf("pmap_is_modified(%x) -> %c\n", pa, "FT"[rv]);
- return(rv);
- }
-#endif
- return(pmap_testbit(pa, PG_M));
-}
-
-vm_offset_t
-pmap_phys_address(ppn)
- int ppn;
-{
- return(ns532_ptob(ppn));
-}
-
-/*
- * Miscellaneous support routines follow
- */
-
-ns532_protection_init()
-{
- register int *kp, prot;
-
- kp = protection_codes;
- for (prot = 0; prot < 8; prot++) {
- switch (prot) {
- case VM_PROT_NONE | VM_PROT_NONE | VM_PROT_NONE:
- *kp++ = 0;
- break;
- case VM_PROT_READ | VM_PROT_NONE | VM_PROT_NONE:
- case VM_PROT_READ | VM_PROT_NONE | VM_PROT_EXECUTE:
- case VM_PROT_NONE | VM_PROT_NONE | VM_PROT_EXECUTE:
- *kp++ = PG_RO;
- break;
- case VM_PROT_NONE | VM_PROT_WRITE | VM_PROT_NONE:
- case VM_PROT_NONE | VM_PROT_WRITE | VM_PROT_EXECUTE:
- case VM_PROT_READ | VM_PROT_WRITE | VM_PROT_NONE:
- case VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE:
- *kp++ = PG_RW;
- break;
- }
- }
-}
-
-boolean_t
-pmap_testbit(pa, bit)
- register vm_offset_t pa;
- int bit;
-{
- register pv_entry_t pv;
- register int *pte, ix;
- int s;
-
- if (pa < vm_first_phys || pa >= vm_last_phys)
- return(FALSE);
-
- pv = pa_to_pvh(pa);
- s = splimp();
- /*
- * Check saved info first
- */
- if (pmap_attributes[pa_index(pa)] & bit) {
- splx(s);
- return(TRUE);
- }
- /*
- * Not found, check current mappings returning
- * immediately if found.
- */
- if (pv->pv_pmap != NULL) {
- for (; pv; pv = pv->pv_next) {
- pte = (int *) pmap_pte(pv->pv_pmap, pv->pv_va);
- ix = 0;
- do {
- if (*pte++ & bit) {
- splx(s);
- return(TRUE);
- }
- } while (++ix != ns532pagesperpage);
- }
- }
- splx(s);
- return(FALSE);
-}
-
-pmap_changebit(pa, bit, setem)
- register vm_offset_t pa;
- int bit;
- boolean_t setem;
-{
- register pv_entry_t pv;
- register int *pte, npte, ix;
- vm_offset_t va;
- int s;
- boolean_t firstpage = TRUE;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_BITS)
- printf("pmap_changebit(%x, %x, %s)",
- pa, bit, setem ? "set" : "clear");
-#endif
- if (pa < vm_first_phys || pa >= vm_last_phys)
- return;
-
- pv = pa_to_pvh(pa);
- s = splimp();
- /*
- * Clear saved attributes (modify, reference)
- */
- if (!setem)
- pmap_attributes[pa_index(pa)] &= ~bit;
-
- /*
- * Loop over all current mappings setting/clearing as appropos
- * If setting RO do we need to clear the VAC?
- */
-
- if (pv->pv_pmap != NULL) {
-#ifdef DEBUG
- int toflush = 0;
-#endif
- for (; pv; pv = pv->pv_next) {
-#ifdef DEBUG
- toflush |= (pv->pv_pmap == pmap_kernel()) ? 2 : 1;
-#endif
- va = pv->pv_va;
-
- /*
- * XXX don't write protect pager mappings
- */
- if (bit == PG_RO) {
- extern vm_offset_t pager_sva, pager_eva;
-
- if (va >= pager_sva && va < pager_eva)
- continue;
- }
-
- pte = (int *) pmap_pte(pv->pv_pmap, va);
- ix = 0;
- do {
- if (setem)
- npte = *pte | bit;
- else
- npte = *pte & ~bit;
- if (*pte != npte) {
- *pte = npte;
- /*TBIS(va);*/
- }
- va += NS532_PAGE_SIZE;
- pte++;
- } while (++ix != ns532pagesperpage);
-
- if (curproc && pv->pv_pmap == &curproc->p_vmspace->vm_pmap)
- pmap_activate(pv->pv_pmap, (struct pcb *)curproc->p_addr);
- }
-#ifdef somethinglikethis
- if (setem && bit == PG_RO && (pmapvacflush & PVF_PROTECT)) {
- if ((pmapvacflush & PVF_TOTAL) || toflush == 3)
- DCIA();
- else if (toflush == 2)
- DCIS();
- else
- DCIU();
- }
-#endif
- }
- splx(s);
-}
-
-#ifdef DEBUG
-pmap_pvdump(pa)
- vm_offset_t pa;
-{
- register pv_entry_t pv;
-
- printf("pa %x", pa);
- for (pv = pa_to_pvh(pa); pv; pv = pv->pv_next) {
- printf(" -> pmap %x, va %x, flags %x",
- pv->pv_pmap, pv->pv_va, pv->pv_flags);
- pads(pv->pv_pmap);
- }
- printf(" ");
-}
-
-#ifdef notyet
-pmap_check_wiring(str, va)
- char *str;
- vm_offset_t va;
-{
- vm_map_entry_t entry;
- register int count, *pte;
-
- va = trunc_page(va);
- if (!pmap_pde_v(pmap_pde(pmap_kernel(), va)) ||
- !pmap_pte_v(pmap_pte(pmap_kernel(), va)))
- return;
-
- if (!vm_map_lookup_entry(pt_map, va, &entry)) {
- pg("wired_check: entry for %x not found\n", va);
- return;
- }
- count = 0;
- for (pte = (int *)va; pte < (int *)(va+PAGE_SIZE); pte++)
- if (*pte)
- count++;
- if (entry->wired_count != count)
- pg("*%s*: %x: w%d/a%d\n",
- str, va, entry->wired_count, count);
-}
-#endif
-
-/* print address space of pmap*/
-pads(pm)
- pmap_t pm;
-{
- unsigned va, i, j;
- struct pte *ptep;
- int num=0;
-
-/* if(pm == pmap_kernel()) return; */
- for (i = 0; i < 1024; i++)
- if(pm->pm_pdir[i].pd_v)
- for (j = 0; j < 1024 ; j++) {
- va = (i<<22)+(j<<12);
- if (pm == pmap_kernel() && va < 0xfe000000)
- continue;
- if (pm != pmap_kernel() && va > UPT_MAX_ADDRESS)
- continue;
- ptep = pmap_pte(pm, va);
- if(pmap_pte_v(ptep)) {
- if (num % 4 == 0) printf (" ");
- printf("%8x:%8x", va, *(int *)ptep);
- if (++num %4 == 0)
- printf ("\n");
- else
- printf (" ");
- }
- } ;
- if (num % 4 != 0) printf ("\n");
-}
-
-pmap_print (pmap_t pm, unsigned int start, unsigned int stop)
-{
- unsigned va, i, j;
- struct pte *ptep;
- int num;
-
- printf ("pmap_print: pm_pdir = 0x%x\n", pm->pm_pdir);
- printf (" map between 0x%x and 0x%x\n", start, stop);
- for (i = 0; i < 1024; i++)
- if (pm->pm_pdir != 0) {
- if(pm->pm_pdir[i].pd_v && (start>>22) <= i
- && (stop>>22) >= i) {
- printf ("1st Level Entry 0x%x, 2nd PA = 0x%x000\n",
- i, pm->pm_pdir[i].pd_pfnum);
- num = 0;
- for (j = 0; j < 1024 ; j++) {
- va = (i<<22)+(j<<12);
- ptep = pmap_pte(pm, va);
- if(ptep->pg_v && start <= va && stop >= va) {
- if (num % 5 == 0) printf (" ");
- printf("%8x:%05x", va, ptep->pg_pfnum);
- if (++num %5 == 0)
- printf ("\n");
- else
- printf (" ");
- }
- } ;
- if (num % 5 != 0) printf ("\n");
- };
- };
- if (num % 5 != 0) printf ("\n");
-}
-#endif
diff --git a/sys/arch/pc532/pc532/process_machdep.c b/sys/arch/pc532/pc532/process_machdep.c
deleted file mode 100644
index fecbcd2d193..00000000000
--- a/sys/arch/pc532/pc532/process_machdep.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/* $NetBSD: process_machdep.c,v 1.8 1995/09/26 20:16:32 phil Exp $ */
-
-/*
- * Copyright (c) 1993 The Regents of the University of California.
- * Copyright (c) 1993 Jan-Simon Pendry
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Jan-Simon Pendry.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* Modified by Phil Nelson for the pc532 port. 1/12/94 */
-
-/*
- * This file may seem a bit stylized, but that so that it's easier to port.
- * Functions to be implemented here are:
- *
- * process_read_regs(proc, regs)
- * Get the current user-visible register set from the process
- * and copy it into the regs structure (<machine/reg.h>).
- * The process is stopped at the time read_regs is called.
- *
- * process_write_regs(proc, regs)
- * Update the current register set from the passed in regs
- * structure. Take care to avoid clobbering special CPU
- * registers or privileged bits in the PSL.
- * The process is stopped at the time write_regs is called.
- *
- * process_sstep(proc)
- * Arrange for the process to trap after executing a single instruction.
- *
- * process_set_pc(proc)
- * Set the process's program counter.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/time.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/vnode.h>
-#include <sys/ptrace.h>
-#include <machine/psl.h>
-#include <machine/reg.h>
-#include <machine/frame.h>
-
-static inline struct reg *
-process_regs(p)
- struct proc *p;
-{
- void *ptr;
-
- if ((p->p_flag & P_INMEM) == 0)
- return (NULL);
-
- ptr = (char *)p->p_addr + ((char *)p->p_md.md_regs - (char *)USRSTACK);
- return (ptr);
-}
-
-int
-process_read_regs(p, regs)
- struct proc *p;
- struct reg *regs;
-{
- struct reg *pregs;
-
- pregs = process_regs(p);
- if (pregs == NULL)
- return (EIO);
-
- *regs = *pregs;
- return (0);
-}
-
-int
-process_write_regs(p, regs)
- struct proc *p;
- struct reg *regs;
-{
- struct reg *pregs;
-
- pregs = process_regs(p);
- if (pregs == NULL)
- return (EIO);
-
- if (((regs->r_psr ^ pregs->r_psr) & PSL_USERSTATIC) != 0)
- return (EPERM);
-
- *pregs = *regs;
- return (0);
-}
-
-int
-process_read_fpregs(p, regs)
- struct proc *p;
- struct fpreg *regs;
-{
- if ((p->p_flag & P_INMEM) == 0)
- return (EIO);
-
- bcopy(&p->p_addr->u_pcb.pcb_fsr, regs, sizeof(*regs));
- return (0);
-}
-
-int
-process_write_fpregs(p, regs)
- struct proc *p;
- struct fpreg *regs;
-{
- if ((p->p_flag & P_INMEM) == 0)
- return (EIO);
-
- bcopy(regs, &p->p_addr->u_pcb.pcb_fsr, sizeof(*regs));
- return (0);
-}
-
-int
-process_sstep(p, sstep)
- struct proc *p;
- int sstep;
-{
- struct reg *pregs;
-
- pregs = process_regs(p);
- if (pregs == NULL)
- return (EIO);
-
- if (sstep)
- pregs->r_psr |= PSL_T;
- else
- pregs->r_psr &= ~PSL_T;
-
- return (0);
-}
-
-int
-process_set_pc(p, addr)
- struct proc *p;
- caddr_t addr;
-{
- struct reg *pregs;
-
- pregs = process_regs(p);
- if (pregs == NULL)
- return (EIO);
-
- pregs->r_pc = (int)addr;
-
- return (0);
-}
diff --git a/sys/arch/pc532/pc532/random.s b/sys/arch/pc532/pc532/random.s
deleted file mode 100644
index d56ad9d693c..00000000000
--- a/sys/arch/pc532/pc532/random.s
+++ /dev/null
@@ -1,76 +0,0 @@
-/* $NetBSD: random.s,v 1.2 1994/10/26 08:25:17 cgd Exp $ */
-
-/*
- * Copyright (c) 1990,1993 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that: (1) source code distributions
- * retain the above copyright notice and this paragraph in its entirety, (2)
- * distributions including binary code include the above copyright notice and
- * this paragraph in its entirety in the documentation or other materials
- * provided with the distribution, and (3) all advertising materials mentioning
- * features or use of this software display the following acknowledgement:
- * ``This product includes software developed by the University of California,
- * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
- * the University nor the names of its contributors may be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Here is a very good random number generator. This implementation is
- * based on ``Two Fast Implementations of the "Minimal Standard" Random
- * Number Generator'', David G. Carta, Communications of the ACM, Jan 1990,
- * Vol 33 No 1. Do NOT modify this code unless you have a very thorough
- * understanding of the algorithm. It's trickier than you think. If
- * you do change it, make sure that its 10,000'th invocation returns
- * 1043618065.
- *
- * Here is easier-to-decipher pseudocode:
- *
- * p = (16807*seed)<30:0> # e.g., the low 31 bits of the product
- * q = (16807*seed)<62:31> # e.g., the high 31 bits starting at bit 32
- * if (p + q < 2^31)
- * seed = p + q
- * else
- * seed = ((p + q) & (2^31 - 1)) + 1
- * return (seed);
- *
- * The result is in (0,2^31), e.g., it's always positive.
- *
- * written by Phil Nelson for ns32k.
- */
-
-#include <machine/asm.h>
-
- .data
- .globl __randseed
-__randseed:
- .long 1
-
- .text
-ENTRY(random)
- enter [r2],0
- movzwd __randseed(pc), r2 /* 1st 16 bit multiply */
- muld 16807, r2 /* result is positive */
- movd r2, r1
- bicd 0xffff0000, r2 /* save bottom 16 bits */
- ashd -16, r1 /* move top 16 to bottom */
- movzwd __randseed+2(pc), r0 /* 2n 16 bit multiply */
- muld 16807, r0
- addd r0, r1 /* add to top 16 bits of first */
- movd r1, r0 /* save a copy in r0 */
- bicd 0xffff8000, r1 /* move "bottom" 15 to r2 */
- ashd 16, r1
- addd r2, r1 /* this is now p! */
- ashd -15, r0 /* this is now q! */
- addd r1, r0 /* q+r */
- bfc nocarry
- subd 0x7fffffff, r0
-
-nocarry:
- movd r0, __randseed(pc)
- exit [r2]
- ret 0
diff --git a/sys/arch/pc532/pc532/swapgeneric.c b/sys/arch/pc532/pc532/swapgeneric.c
deleted file mode 100644
index 33685357263..00000000000
--- a/sys/arch/pc532/pc532/swapgeneric.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/* $NetBSD: swapgeneric.c,v 1.1 1995/08/25 07:49:14 phil Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)swapgeneric.c 5.5 (Berkeley) 5/9/91
- */
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/buf.h>
-#include <sys/systm.h>
-#include <sys/reboot.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-
-#include "sd.h"
-#include "cd.h"
-#ifdef RAMD_SIZE
-#define NRD 1
-#else
-#define NRD 0
-#endif
-
-/*
- * Generic configuration; all in one
- */
-dev_t rootdev = NODEV;
-dev_t argdev = NODEV;
-dev_t dumpdev = NODEV;
-int nswap;
-struct swdevt swdevt[] = {
- { NODEV, 1, 0 },
- { NODEV, 0, 0 },
-};
-long dumplo;
-int dmmin, dmmax, dmtext;
-
-#if NSD > 0
-extern struct cfdriver sdcd;
-#endif
-#if NCD > 0
-extern struct cfdriver cdcd;
-#endif
-#if NRD > 0
-extern struct cfdriver rdcd;
-#endif
-
-struct genericconf {
- struct cfdriver *gc_driver;
- char *gc_name;
- dev_t gc_major;
-} genericconf[] = {
-#if NSD > 0
- { &sdcd, "sd", 0 },
-#endif
-#if NCD > 0
- { &cdcd, "cd", 4 },
-#endif
-#if NRD > 0
- { &rdcd, "rd", 3 },
-#endif
- { 0 }
-};
-
-extern int ffs_mountroot();
-int (*mountroot)() = ffs_mountroot;
-
-setconf()
-{
- register struct genericconf *gc;
- int unit, swaponroot = 0;
-
- if (rootdev != NODEV)
- goto doswap;
-
- if (genericconf[0].gc_driver == 0)
- goto verybad;
-
- if (boothowto & RB_ASKNAME) {
- char name[128];
-retry:
- printf("root device? ");
- gets(name);
- for (gc = genericconf; gc->gc_driver; gc++)
- if (gc->gc_name[0] == name[0] &&
- gc->gc_name[1] == name[1])
- goto gotit;
- goto bad;
-gotit:
- if (name[3] == '*') {
- name[3] = name[4];
- swaponroot++;
- }
- if (name[2] >= '0' && name[2] <= '7' && name[3] == 0) {
- unit = name[2] - '0';
- goto found;
- }
- printf("bad/missing unit number\n");
-bad:
- printf("use:\n");
- for (gc = genericconf; gc->gc_driver; gc++)
- printf("\t%s%%d\n", gc->gc_name);
- goto retry;
- }
- unit = 0;
- for (gc = genericconf; gc->gc_driver; gc++) {
- if (gc->gc_driver->cd_ndevs > unit &&
- gc->gc_driver->cd_devs[unit]) {
- printf("root on %s0\n", gc->gc_name);
- goto found;
- }
- }
-verybad:
- printf("no suitable root -- hit any key to reboot\n");
- printf("\n>");
- cngetc();
- cpu_reset();
- for (;;) ;
-
-found:
- rootdev = makedev(gc->gc_major, unit * MAXPARTITIONS);
-doswap:
- swdevt[0].sw_dev = argdev = dumpdev =
- makedev(major(rootdev), minor(rootdev) + 1);
- /* swap size and dumplo set during autoconfigure */
- if (swaponroot)
- rootdev = dumpdev;
-}
-
-gets(cp)
- char *cp;
-{
- register char *lp;
- register c;
-
- lp = cp;
- for (;;) {
- printf("%c", c = cngetc()&0177);
- switch (c) {
- case '\n':
- case '\r':
- *lp++ = '\0';
- printf("\r\n");
- return;
- case '\b':
- case '\177':
- if (lp > cp) {
- printf(" \b");
- lp--;
- }
- continue;
- case '#':
- lp--;
- if (lp < cp)
- lp = cp;
- continue;
- case '@':
- case 'u'&037:
- lp = cp;
- printf("%c", '\n');
- continue;
- default:
- *lp++ = c;
- }
- }
-}
diff --git a/sys/arch/pc532/pc532/sys_machdep.c b/sys/arch/pc532/pc532/sys_machdep.c
deleted file mode 100644
index 56f9f98dbcc..00000000000
--- a/sys/arch/pc532/pc532/sys_machdep.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* $NetBSD: sys_machdep.c,v 1.5 1995/09/26 20:16:34 phil Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)sys_machdep.c 5.5 (Berkeley) 1/19/91
- */
-
-
diff --git a/sys/arch/pc532/pc532/trap.c b/sys/arch/pc532/pc532/trap.c
deleted file mode 100644
index 88273d20b43..00000000000
--- a/sys/arch/pc532/pc532/trap.c
+++ /dev/null
@@ -1,571 +0,0 @@
-/* $NetBSD: trap.c,v 1.13 1995/06/09 06:00:10 phil Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the University of Utah, and William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)trap.c 7.4 (Berkeley) 5/13/91
- */
-
-/*
- * 532 Trap and System call handling
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/user.h>
-#include <sys/acct.h>
-#include <sys/kernel.h>
-#ifdef KTRACE
-#include <sys/ktrace.h>
-#endif
-#include <sys/syscall.h>
-
-#include <vm/vm_param.h>
-#include <vm/pmap.h>
-#include <vm/vm_map.h>
-
-#include <machine/cpu.h>
-#include <machine/trap.h>
-#include <machine/psl.h>
-
-
-
-unsigned rcr2();
-extern short cpl;
-
-/*
- * trap(frame):
- * Exception, fault, and trap interface to BSD kernel. This
- * common code is called from assembly language IDT gate entry
- * routines that prepare a suitable stack frame, and restore this
- * frame after the exception has been processed. Note that the
- * effect is as if the arguments were passed call by reference.
- */
-/*ARGSUSED*/
-trap(frame)
- struct trapframe frame;
-{
- register int i;
- register struct proc *p = curproc;
- struct timeval sticks;
- int ucode, type, tear, msr;
-
- cnt.v_trap++;
-
- type = frame.tf_trapno;
- tear = frame.tf_tear;
- msr = frame.tf_msr;
-
- if (curpcb->pcb_onfault && frame.tf_trapno != T_ABT) {
-copyfault:
- frame.tf_pc = (int)curpcb->pcb_onfault;
- return;
- }
-
-#ifdef DDB
- if (curpcb && curpcb->pcb_onfault) {
- if (frame.tf_trapno == T_BPTFLT
- || frame.tf_trapno == T_TRCTRAP)
- if (kdb_trap (type, 0, &frame))
- return;
- }
-#endif
-
- if (curpcb == 0 || curproc == 0) goto we_re_toast;
-
- if ((frame.tf_psr & PSL_USER) == PSL_USER) {
- type |= T_USER;
-#ifdef notdef
- sticks = p->p_stime;
-#endif
- p->p_md.md_regs = (int *)&(frame.tf_reg);
- }
-
- ucode = 0;
-
- switch (type) {
-
- default:
- we_re_toast:
-#ifdef KDB
- if (kdb_trap(&psl))
- return;
-#endif
-#ifdef DDB
- if (kdb_trap (type, 0, &frame))
- return;
-#endif
-
- printf("bad trap: type=%d, pc=0x%x, tear=0x%x, msr=0x%x\n",
- type, frame.tf_pc, frame.tf_tear, frame.tf_msr);
- panic("trap");
- /*NOTREACHED*/
-
- case T_ABT: /* System level pagefault! */
- if (((msr & MSR_STT) == STT_SEQ_INS)
- || ((msr & MSR_STT) == STT_NSQ_INS))
- {
- printf ("System pagefault: pc=0x%x, tear=0x%x, msr=0x%x\n",
- frame.tf_pc, frame.tf_tear, frame.tf_msr);
- goto we_re_toast;
- }
-
- /* fall into */
- case T_ABT | T_USER: /* User level pagefault! */
-/* if (type == (T_ABT | T_USER))
- printf ("pagefault: pc=0x%x, tear=0x%x, msr=0x%x\n",
- frame.tf_pc, frame.tf_tear, frame.tf_msr); */
- {
- register vm_offset_t va;
- register struct vmspace *vm = p->p_vmspace;
- register vm_map_t map;
- int rv;
- vm_prot_t ftype;
- extern vm_map_t kernel_map;
- unsigned nss,v;
-
- va = trunc_page((vm_offset_t)tear);
- /*
- * Avoid even looking at pde_v(va) for high va's. va's
- * above VM_MAX_KERNEL_ADDRESS don't correspond to normal
- * PDE's (half of them correspond to APDEpde and half to
- * an unmapped kernel PDE). va's betweeen 0xFEC00000 and
- * VM_MAX_KERNEL_ADDRESS correspond to unmapped kernel PDE's
- * (XXX - why are only 3 initialized when 6 are required to
- * reach VM_MAX_KERNEL_ADDRESS?). Faulting in an unmapped
- * kernel page table would give inconsistent PTD's.
- *
- * XXX - faulting in unmapped page tables wastes a page if
- * va turns out to be invalid.
- *
- * XXX - should "kernel address space" cover the kernel page
- * tables? Might have same problem with PDEpde as with
- * APDEpde (or there may be no problem with APDEpde).
- */
- if (va > 0xFEBFF000) {
- v = KERN_FAILURE; /* becomes SIGSEGV */
- goto nogo;
- }
- /*
- * It is only a kernel address space fault iff:
- * 1. (type & T_USER) == 0 and
- * 2. pcb_onfault not set or
- * 3. pcb_onfault set but supervisor space fault
- * The last can occur during an exec() copyin where the
- * argument space is lazy-allocated.
- */
- if (type == T_ABT && va >= KERNBASE)
- map = kernel_map;
- else
- map = &vm->vm_map;
- if ((msr & MSR_DDT) == DDT_WRITE
- || (msr & MSR_STT) == STT_RMW)
- ftype = VM_PROT_READ | VM_PROT_WRITE;
- else
- ftype = VM_PROT_READ;
-
-#ifdef DEBUG
- if (map == kernel_map && va == 0) {
- printf("trap: bad kernel access at %x\n", va);
- goto we_re_toast;
- }
-#endif
-
- nss = 0;
- if ((caddr_t)va >= vm->vm_maxsaddr
- && (caddr_t)va < (caddr_t)VM_MAXUSER_ADDRESS
- && map != kernel_map) {
- nss = clrnd(btoc((unsigned)vm->vm_maxsaddr
- + MAXSSIZ - (unsigned)va));
- if (nss > btoc(p->p_rlimit[RLIMIT_STACK].rlim_cur)) {
-/*pg("trap rlimit %d, maxsaddr %x va %x ", nss, vm->vm_maxsaddr, va);*/
- rv = KERN_FAILURE;
- goto nogo;
- }
- }
-
- /* check if page table is mapped, if not, fault it first */
-#define pde_v(v) (PTD[((v)>>PD_SHIFT)&1023].pd_v)
- if (!pde_v(va)) {
- v = trunc_page(vtopte(va));
- rv = vm_fault(map, v, ftype, FALSE);
- if (rv != KERN_SUCCESS) goto nogo;
- /* check if page table fault, increment wiring */
- vm_map_pageable(map, v, round_page(v+1), FALSE);
- } else v=0;
- rv = vm_fault(map, va, ftype, FALSE);
-
- if (rv == KERN_SUCCESS) {
- /*
- * XXX: continuation of rude stack hack
- */
- if (nss > vm->vm_ssize)
- vm->vm_ssize = nss;
- va = trunc_page(vtopte(va));
- /* for page table, increment wiring
- as long as not a page table fault as well */
- if (!v && map != kernel_map)
- vm_map_pageable(map, va, round_page(va+1), FALSE);
- if (type == T_ABT)
- return;
- goto out;
- }
-nogo:
- if (type == T_ABT) {
- if (curpcb->pcb_onfault)
- goto copyfault;
- printf("vm_fault(0x%x, 0x%x, 0x%x, 0) -> 0x%x\n",
- map, va, ftype, rv);
- printf(" type 0x%x, tear 0x%x msr 0x%x\n",
- type, tear, msr);
- goto we_re_toast;
- }
- i = SIGSEGV;
- break;
- }
-
- case T_UND | T_USER: /* undefined instruction */
- case T_ILL | T_USER: /* Illegal instruction! */
- ucode = type &~ T_USER;
- i = SIGILL;
- break;
-
- case T_NVI | T_USER: /* Non-vectored interrupt */
- case T_NMI | T_USER: /* non-maskable interrupt */
- case T_FLG | T_USER: /* flag instruction */
- goto we_re_toast;
-
- case T_NBE | T_USER: /* non-restartable bus error */
- ucode = type &~ T_USER;
- i = SIGBUS;
- break;
-
- case T_RBE | T_USER: /* restartable bus error */
- return;
-
- case T_SLAVE | T_USER: /* coprocessor trap */
- ucode = type &~ T_USER;
-/* ucode = FPE_INTDIV_TRAP; */
- i = SIGFPE;
- break;
-
- case T_DVZ | T_USER: /* divide by zero */
- ucode = type &~ T_USER;
-/* ucode = FPE_INTDIV_TRAP; */
- i = SIGFPE;
- break;
-
- case T_OVF | T_USER: /* integer overflow trap */
- ucode = type &~ T_USER;
-/* ucode = FPE_INTOVF_TRAP; */
- i = SIGFPE;
- break;
-
-
- case T_TRC | T_USER: /* trace trap */
- case T_BPT | T_USER: /* breakpoint instruction */
- case T_DBG | T_USER: /* debug trap */
- frame.tf_psr &= ~PSL_P;
- i = SIGTRAP;
- break;
-
- case T_INTERRUPT | T_USER: /* Allow Process Switch */
-/* if ((p->p_flag & SOWEUPC) && p->p_stats->p_prof.pr_scale) {
- addupc(frame.tf_eip, &p->p_stats->p_prof, 1);
- p->p_flag &= ~SOWEUPC;
- } */
- goto out;
-
- } /* End of switch */
-
- trapsignal(p, i, ucode);
- if ((type & T_USER) == 0)
- return;
-out:
- while (i = CURSIG(p))
- postsig(i);
- p->p_priority = p->p_usrpri;
- if (want_resched) {
- /*
- * Since we are curproc, clock will normally just change
- * our priority without moving us from one queue to another
- * (since the running process is not on a queue.)
- * If that happened after we setrunqueue ourselves but
- * before we switch()'ed, we might not be on the queue
- * indicated by our priority.
- */
- (void) splstatclock();
- setrunqueue(p);
- p->p_stats->p_ru.ru_nivcsw++;
- mi_switch();
- (void) splnone();
- while (i = CURSIG(p))
- postsig(i);
- }
- if (p->p_stats->p_prof.pr_scale) {
- int ticks;
-
-#ifdef YO_WHAT
- struct timeval *tv = &p->p_stime;
-
- ticks = ((tv->tv_sec - syst.tv_sec) * 1000 +
- (tv->tv_usec - syst.tv_usec) / 1000) / (tick / 1000);
- if (ticks) {
-#ifdef PROFTIMER
- extern int profscale;
- addupc(frame.tf_eip, &p->p_stats->p_prof,
- ticks * profscale);
-#else
-/* addupc(frame.tf_pc, &p->p_stats->p_prof, ticks); */
-#endif
- }
-#endif
- }
- curpriority = p->p_priority;
-}
-
-
-/*
- * syscall(frame):
- * System call request from POSIX system call gate interface to kernel.
- * Like trap(), argument is call by reference.
- */
-/*ARGSUSED*/
-syscall(frame)
- volatile struct syscframe frame;
-{
-
- register caddr_t params;
- register int i;
- register struct sysent *callp;
- register struct proc *p;
- struct timeval sticks;
- int error, opc, nsys;
- int args[8], rval[2];
- int code;
-
- cnt.v_syscall++;
-
- /* is this a user? */
- if ((frame.sf_psr & PSL_USER) != PSL_USER)
- panic("syscall - process not in user mode.");
-
- p = curproc;
-#ifdef notdef
- sticks = p->p_stime;
-#endif
- code = frame.sf_reg[REG_R0];
- p->p_md.md_regs = (int *) & (frame.sf_reg);
- params = (caddr_t)frame.sf_usp + sizeof (int) ;
-
- callp = p->p_emul->e_sysent;
- nsys = p->p_emul->e_nsysent;
-
- /* Set new return address and save old one. */
- opc = frame.sf_pc++;
-
- switch (code) {
- case SYS_syscall:
- code = fuword(params);
- params += sizeof(int);
- break;
-
- case SYS___syscall:
- code = fuword(params + _QUAD_LOWWORD * sizeof(int));
- params += sizeof(quad_t);
- break;
-
- default:
- /* do nothing by default */
- break;
- }
-
- /* Guard against bad sys call numbers! */
- if (code < 0 || code >= nsys)
- callp += p->p_emul->e_nosys; /* indir (illegal) */
- else
- callp += code;
-
- if ((i = callp->sy_argsize) &&
- (error = copyin(params, (caddr_t)args, (u_int)i))) {
- frame.sf_reg[REG_R0] = error;
- frame.sf_psr |= PSL_C;
-#ifdef SYSCALL_DEBUG
- scdebug_call(p, code, callp->sy_narg, i, args);
-#endif
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSCALL))
- ktrsyscall(p, code, i, &args);
-#endif
- goto done;
- }
-#ifdef SYSCALL_DEBUG
- scdebug_call(p, code, callp->sy_narg, i, args);
-#endif
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSCALL))
- ktrsyscall(p, code, i, &args);
-#endif
- rval[0] = 0;
- rval[1] = 0;
- error = (*callp->sy_call)(p, args, rval);
- if (error == ERESTART)
- frame.sf_pc = opc;
- else if (error != EJUSTRETURN) {
- if (error) {
- frame.sf_reg[REG_R0] = error;
- frame.sf_psr |= PSL_C;
- } else {
- frame.sf_reg[REG_R0] = rval[0];
- frame.sf_reg[REG_R1] = rval[1];
- frame.sf_psr &= ~PSL_C;
- }
- }
- /* else if (error == EJUSTRETURN) */
- /* nothing to do */
-done:
- /*
- * Reinitialize proc pointer `p' as it may be different
- * if this is a child returning from fork syscall.
- */
- p = curproc;
- while (i = CURSIG(p))
- postsig(i);
- p->p_priority = p->p_usrpri;
- if (want_resched) {
- /*
- * Since we are curproc, clock will normally just change
- * our priority without moving us from one queue to another
- * (since the running process is not on a queue.)
- * If that happened after we setrunqeue ourselves but before
- * we switch()'ed, we might not be on the queue indicated by
- * our priority.
- */
- (void) splstatclock();
- setrunqueue(p);
- p->p_stats->p_ru.ru_nivcsw++;
- mi_switch();
- (void) splnone();
- while (i = CURSIG(p))
- postsig(i);
- }
- if (p->p_stats->p_prof.pr_scale) {
- int ticks;
-#ifdef YO_WHAT
- struct timeval *tv = &p->p_stime;
-
- ticks = ((tv->tv_sec - syst.tv_sec) * 1000 +
- (tv->tv_usec - syst.tv_usec) / 1000) / (tick / 1000);
- if (ticks) {
-#ifdef PROFTIMER
- extern int profscale;
- addupc(frame.sf_pc, &p->p_stats->p_prof,
- ticks * profscale);
-#else
-/* addupc(frame.sf_pc, &p->p_stats->p_prof, ticks); */
-#endif
- }
-#endif
- }
- curpriority = p->p_priority;
-#ifdef SYSCALL_DEBUG
- scdebug_ret(p, code, error, rval[0]);
-#endif
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSRET))
- ktrsysret(p, code, error, rval[0]);
-#endif
-
-}
-
-/* For the child, do the stuff after mi_swtch() in syscall so
- low_level_fork does not have to rethread the kernel stack. */
-void
-ll_fork_sig()
-{
- register struct proc *p = curproc;
- int i;
-
- (void) splnone();
- while (i = CURSIG(p))
- postsig(i);
-}
-
-
-/* #define dbg_user */
-/* Other stuff.... */
-int
-check_user_write ( u_long addr, u_long size)
-{
- int rv;
- vm_offset_t va;
-
-#ifdef dbg_user
-printf ("ck_ur_wr: addr=0x%x, size=0x%x", addr, size);
-#endif
- /* check for all possible places! */
- va = trunc_page((vm_offset_t) addr);
- if (va > VM_MAXUSER_ADDRESS) return (1);
-
- while ((u_long)va < (addr + size)) {
- /* check for copy on write access. */
-#ifdef dbg_user
-printf (" (0x%x:%d)", va, vtopte(va)->pg_prot);
-#endif
- if (!(vtopte(va)->pg_v) || vtopte(va)->pg_prot != 3 ) {
-#ifdef dbg_user
-printf (" fault");
-#endif
- rv = vm_fault(&curproc->p_vmspace->vm_map, va,
- VM_PROT_READ | VM_PROT_WRITE, FALSE);
- if (rv != KERN_SUCCESS)
-#ifdef dbg_user
-{ printf (" bad\n");
-#endif
- return(1);
-#ifdef dbg_user
-}
-#endif
- }
- va += NBPG;
- }
-#ifdef dbg_user
-printf ("\n");
-#endif
-
- return (0);
-}
diff --git a/sys/arch/pc532/pc532/umprintf.c b/sys/arch/pc532/pc532/umprintf.c
deleted file mode 100644
index 21d4d2cb108..00000000000
--- a/sys/arch/pc532/pc532/umprintf.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* $NetBSD: umprintf.c,v 1.3 1994/10/26 08:25:20 cgd Exp $ */
-
-/*-
- * Copyright (c) 1986, 1988, 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * hacked out from ..
- * @(#)subr_prf.c 7.30 (Berkeley) 6/29/91
- */
-
-#include <stdarg.h>
-static char *ksprintn __P((u_long num, int base, int *len));
-
-void
-umprintf(char *fmt,...)
-{
- va_list ap;
- char *p;
- int tmp;
- int base;
- unsigned long ul;
- char ch;
-
- va_start (ap,fmt);
-
- for (;;) {
- while ((ch = *fmt++) != '%') {
- if (ch == '\0')
- return;
- scncnputc(0, ch);
- }
- ch = *fmt++;
- switch (ch) {
- case 'd':
- ul = va_arg(ap, u_long);
- base = 10;
- goto number;
- case 'x':
- ul = va_arg(ap, u_long);
- base = 16;
-number: p = ksprintn(ul, base, &tmp);
- while (ch = *p--)
- scncnputc(0,ch);
- break;
- default:
- scncnputc(0,ch);
- }
- }
-}
-
-/*
- * Put a number (base <= 16) in a buffer in reverse order; return an
- * optional length and a pointer to the NULL terminated (preceded?)
- * buffer.
- */
-static char *
-ksprintn(ul, base, lenp)
- register u_long ul;
- register int base, *lenp;
-{ /* A long in base 8, plus NULL. */
- static char buf[sizeof(long) * NBBY / 3 + 2];
- register char *p;
- int d;
-
- p = buf;
- *p='\0';
- do {
- d = ul % base;
- if (d < 10)
- *++p = '0' + d;
- else
- *++p = 'a' + d - 10;
- } while (ul /= base);
- if (lenp)
- *lenp = p - buf;
- return (p);
-}
diff --git a/sys/arch/pc532/pc532/vm_machdep.c b/sys/arch/pc532/pc532/vm_machdep.c
deleted file mode 100644
index 126ba47d3c1..00000000000
--- a/sys/arch/pc532/pc532/vm_machdep.c
+++ /dev/null
@@ -1,351 +0,0 @@
-/* $NetBSD: vm_machdep.c,v 1.11 1995/08/29 22:37:54 phil Exp $ */
-
-/*-
- * Copyright (c) 1982, 1986 The Regents of the University of California.
- * Copyright (c) 1989, 1990 William Jolitz
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department, and William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/malloc.h>
-#include <sys/vnode.h>
-#include <sys/buf.h>
-#include <sys/user.h>
-#include <sys/core.h>
-#include <sys/exec.h>
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-
-#include <machine/cpu.h>
-
-/*
- * Finish a fork operation, with process p2 nearly set up.
- * Copy and update the kernel stack and pcb, making the child
- * ready to run, and marking it so that it can return differently
- * than the parent. Returns 1 in the child process, 0 in the parent.
- * We currently double-map the user area so that the stack is at the same
- * address in each process; in the future we will probably relocate
- * the frame pointers on the stack after copying.
- */
-cpu_fork(p1, p2, stack, stacksize)
- register struct proc *p1, *p2;
- void *stack;
- size_t stacksize;
-{
- struct user *up = p2->p_addr;
- int foo, offset, addr, i;
-
- /*
- * Copy pcb from proc p1 to p2.
- * _low_level_init will copy the kernel stack as cheeply as
- * possible.
- */
- p2->p_addr->u_pcb = p1->p_addr->u_pcb;
- p2->p_addr->u_pcb.pcb_onstack =
- (struct on_stack *) p2->p_addr + USPACE
- - sizeof (struct on_stack);
-
- /*
- * Wire top of address space of child to it's kstack.
- * First, fault in a page of pte's to map it.
- */
- addr = trunc_page((u_int)vtopte(USRSTACK));
- vm_map_pageable(&p2->p_vmspace->vm_map, addr, addr+USPACE, FALSE);
- for (i=0; i < UPAGES; i++)
- pmap_enter(&p2->p_vmspace->vm_pmap, USRSTACK+i*NBPG,
- pmap_extract(pmap_kernel(), ((int)p2->p_addr)+i*NBPG),
- VM_PROT_READ, TRUE);
-
- pmap_activate(&p2->p_vmspace->vm_pmap, &up->u_pcb);
-
- /*
- * Low_level_fork returns twice! First with a 0 in the
- * parent space and Second with a 1 in the child.
- * XXX the child should use stack, stack+stacksize as
- * the stack if stack is not NULL.
- */
-
- return (low_level_fork(up));
-}
-
-
-#ifdef notyet
-
-/*
- * cpu_exit is called as the last action during exit.
- *
- * We change to an inactive address space and a "safe" stack,
- * passing thru an argument to the new stack. Now, safely isolated
- * from the resources we're shedding, we release the address space
- * and any remaining machine-dependent resources, including the
- * memory for the user structure and kernel stack.
- *
- * Next, we assign a dummy context to be written over by swtch,
- * calling it to send this process off to oblivion.
- * [The nullpcb allows us to minimize cost in swtch() by not having
- * a special case].
- */
-struct proc *swtch_to_inactive();
-
-void
-cpu_exit(p)
- register struct proc *p;
-{
- static struct pcb nullpcb; /* pcb to overwrite on last swtch */
-
- /* free cporcessor (if we have it) */
- if( p == npxproc) npxproc =0;
-
- /* move to inactive space and stack, passing arg accross */
- p = swtch_to_inactive(p);
-
- /* drop per-process resources */
- vmspace_free(p->p_vmspace);
- kmem_free(kernel_map, (vm_offset_t)p->p_addr, ctob(UPAGES));
-
- p->p_addr = (struct user *) &nullpcb;
- splstatclock();
- cpu_switch();
- /* NOTREACHED */
-}
-#else
-void
-cpu_exit(p)
- register struct proc *p;
-{
-
- splstatclock();
- cpu_switch();
- /* Not reached. */
- panic ("cpu_exit! swtch returned!");
-}
-
-void
-cpu_wait(p)
- struct proc *p;
-{
-
- /* drop per-process resources */
- vmspace_free(p->p_vmspace);
- kmem_free(kernel_map, (vm_offset_t)p->p_addr, ctob(UPAGES));
-}
-#endif
-
-
-/*
- * Dump the machine specific segment at the start of a core dump.
- */
-int
-cpu_coredump(p, vp, cred, chdr)
- struct proc *p;
- struct vnode *vp;
- struct ucred *cred;
- struct core *chdr;
-{
- int error;
- struct {
- struct reg regs;
- struct fpreg fpregs;
- } cpustate;
- struct coreseg cseg;
-
- CORE_SETMAGIC(*chdr, COREMAGIC, MID_NS32532, 0);
- chdr->c_hdrsize = ALIGN(sizeof(*chdr));
- chdr->c_seghdrsize = ALIGN(sizeof(cseg));
- chdr->c_cpusize = sizeof(cpustate);
- cpustate.regs = *((struct reg *)p->p_md.md_regs);
- cpustate.fpregs = *((struct fpreg *)&p->p_addr->u_pcb.pcb_fsr);
-
- CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_NS32532, CORE_CPU);
- cseg.c_addr = 0;
- cseg.c_size = chdr->c_cpusize;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
- (off_t)chdr->c_hdrsize, UIO_SYSSPACE,
- IO_NODELOCKED|IO_UNIT, cred, NULL, p);
- if (error)
- return error;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cpustate, sizeof(cpustate),
- (off_t)(chdr->c_hdrsize + chdr->c_seghdrsize), UIO_SYSSPACE,
- IO_NODELOCKED|IO_UNIT, cred, NULL, p);
-
- if (!error)
- chdr->c_nseg++;
-
- return error;
-}
-
-
-/*
- * Set a red zone in the kernel stack after the u. area.
- */
-setredzone(pte, vaddr)
- u_short *pte;
- caddr_t vaddr;
-{
-/* eventually do this by setting up an expand-down stack segment
- for ss0: selector, allowing stack access down to top of u.
- this means though that protection violations need to be handled
- thru a double fault exception that must do an integral task
- switch to a known good context, within which a dump can be
- taken. a sensible scheme might be to save the initial context
- used by sched (that has physical memory mapped 1:1 at bottom)
- and take the dump while still in mapped mode */
-}
-
-/*
- * Move pages from one kernel virtual address to another.
- * Both addresses are assumed to reside in the Sysmap,
- * and size must be a multiple of CLSIZE.
- */
-pagemove(from, to, size)
- register caddr_t from, to;
- int size;
-{
- register struct pte *fpte, *tpte;
-
- if (size % CLBYTES)
- panic("pagemove");
- fpte = kvtopte(from);
- tpte = kvtopte(to);
- while (size > 0) {
- *tpte++ = *fpte;
- *(int *)fpte++ = 0;
- from += NBPG;
- to += NBPG;
- size -= NBPG;
- }
- tlbflush();
-}
-
-/*
- * Convert kernel VA to physical address
- */
-kvtop(addr)
- register caddr_t addr;
-{
- vm_offset_t va;
- va = pmap_extract(pmap_kernel(), (vm_offset_t)addr);
- if (va == 0)
- panic("kvtop: zero page frame");
- return((int)va);
-}
-
-extern vm_map_t phys_map;
-
-/*
- * Map an IO request into kernel virtual address space. Requests fall into
- * one of five catagories:
- *
- * B_PHYS|B_UAREA: User u-area swap.
- * Address is relative to start of u-area (p_addr).
- * B_PHYS|B_PAGET: User page table swap.
- * Address is a kernel VA in usrpt (Usrptmap).
- * B_PHYS|B_DIRTY: Dirty page push.
- * Address is a VA in proc2's address space.
- * B_PHYS|B_PGIN: Kernel pagein of user pages.
- * Address is VA in user's address space.
- * B_PHYS: User "raw" IO request.
- * Address is VA in user's address space.
- *
- * All requests are (re)mapped into kernel VA space via the useriomap
- * (a name with only slightly more meaning than "kernelmap")
- */
-vmapbuf(bp)
- register struct buf *bp;
-{
- register int npf;
- register caddr_t addr;
- register long flags = bp->b_flags;
- struct proc *p;
- int off;
- vm_offset_t kva;
- register vm_offset_t pa;
-
- if ((flags & B_PHYS) == 0)
- panic("vmapbuf");
- addr = bp->b_saveaddr = bp->b_un.b_addr;
- off = (int)addr & PGOFSET;
- p = bp->b_proc;
- npf = btoc(round_page(bp->b_bcount + off));
- kva = kmem_alloc_wait(phys_map, ctob(npf));
- bp->b_un.b_addr = (caddr_t) (kva + off);
- while (npf--) {
- pa = pmap_extract(&p->p_vmspace->vm_pmap, (vm_offset_t)addr);
- if (pa == 0)
- panic("vmapbuf: null page frame");
- pmap_enter(vm_map_pmap(phys_map), kva, trunc_page(pa),
- VM_PROT_READ|VM_PROT_WRITE, TRUE);
- addr += PAGE_SIZE;
- kva += PAGE_SIZE;
- }
-}
-
-/*
- * Free the io map PTEs associated with this IO operation.
- * We also invalidate the TLB entries and restore the original b_addr.
- */
-vunmapbuf(bp)
- register struct buf *bp;
-{
- register int npf;
- register caddr_t addr = bp->b_un.b_addr;
- vm_offset_t kva;
-
- if ((bp->b_flags & B_PHYS) == 0)
- panic("vunmapbuf");
- npf = btoc(round_page(bp->b_bcount + ((int)addr & PGOFSET)));
- kva = (vm_offset_t)((int)addr & ~PGOFSET);
- kmem_free_wakeup(phys_map, kva, ctob(npf));
- bp->b_un.b_addr = bp->b_saveaddr;
- bp->b_saveaddr = NULL;
-}
-
-/*
- * (Force reset the processor by invalidating the entire address space!)
- * Well, lets just hang!
- */
-cpu_reset()
-{
- splhigh();
- while (1);
-}
diff --git a/sys/arch/pc532/stand/Makefile b/sys/arch/pc532/stand/Makefile
deleted file mode 100644
index 70405bfa716..00000000000
--- a/sys/arch/pc532/stand/Makefile
+++ /dev/null
@@ -1,98 +0,0 @@
-# $NetBSD: Makefile,v 1.8 1995/11/30 00:59:05 jtc Exp $
-
-# @(#)Makefile 8.1 (Berkeley) 6/10/93
-
-#DESTDIR=
-STANDDIR=${DESTDIR}/stand
-# load at 0x400000 - 30 * 1024 - 0x10000
-# that way the boot code will be at the correct
-# address if the floppy image is started from memory
-# NOTE: alloc() function takes memory after _end
-RELOC= 3E8800
-
-CONS= -DSCNCONSOLE
-DEFS= -DSTANDALONE ${CONS}
-CFLAGS= -O ${INCPATH} ${DEFS} -fwritable-strings
-
-SRCS= cons.c devopen.c scn.c scsi_low.c scsi_hi.c \
- conf.c prf.c tgets.c machdep.c sd.c rd.c filesystem.c
-
-S= ${.CURDIR}/../../..
-SAREL=
-KERNREL=
-
-.PATH: ${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
-.PATH: ${S}/stand ${S}/lib/libsa
-
-INCPATH=-I${.CURDIR} -I${.CURDIR}/../.. -I${S} -I${S}/lib/libsa
-
-### find out what to use for libs
-.include "../../../lib/libkern/Makefile.inc"
-LIBKERN= ${KERNLIB}
-
-NO_NET=
-.include "../../../lib/libsa/Makefile.inc"
-LIBSA= ${SALIB}
-
-#LIBS= ${LIBSA} ${.OBJDIR}/libdrive.a \
-# ${LIBKERN} ${LIBSA} ${LIBKERN}
-LIBS= ${LIBSA} ${.OBJDIR}/libdrive.a \
- ${LIBKERN} ${LIBSA}
-
-BOOTS= boot zboot.o
-ALL= ${BOOTS}
-
-all: ${ALL}
-
-${BOOTS}: ${LIBS}
-
-OBJS= ${SRCS:N*.h:R:S/$/.o/g}
-${.OBJDIR}/libdrive.a: ${OBJS}
- ar crv $@ $?
- ranlib $@
-
-# depend on DEFS
-
-devopen.o machdep.o srt0.o: Makefile
-cons.o: Makefile
-
-# startups
-
-srt0.o: ${.CURDIR}/srt0.s
- cpp ${INCPATH} ${DEFS} ${.CURDIR}/srt0.s | as -o srt0.o
-
-# new boot
-boot: boot.o srt0.o ${LIBS}
- ld -z -T ${RELOC} -e begin srt0.o boot.o ${LIBS} -o $@
- @size boot
-
-zboot.o: inflate.o
- ld -r srt0.o inflate.o $(LIBS) -o zboot.o
-
-# new boot user mode test
-TESTBOOT= boot.o test.o $(SC) ${LIBS}
-# objects from regular libc;
-SC= cerror.o syscall.o malloc.o sbrk.o getpagesize.o
-testboot: $(TESTBOOT)
- ld -o testboot /usr/lib/crt0.o $(TESTBOOT) ${LIBS} -o $@
-
-$(SC): /usr/lib/libc.a
- ar x /usr/lib/libc.a $(SC)
-
-# utilities
-
-install: ${ALL}
- cp ${ALL} ${DESTDIR}/usr/mdec
-
-.include <bsd.dep.mk>
-.include <bsd.obj.mk>
-.include <bsd.subdir.mk>
-
-FRC:
-
-# clean ...
-
-clean::
- rm -f ${ALL} ${.OBJDIR}/libdrive.a ${OBJS} boot.o srt0.o inflate.o
-
-cleandir: clean
diff --git a/sys/arch/pc532/stand/README b/sys/arch/pc532/stand/README
deleted file mode 100644
index a835dde57e6..00000000000
--- a/sys/arch/pc532/stand/README
+++ /dev/null
@@ -1,26 +0,0 @@
-$NetBSD: README,v 1.2 1994/10/26 08:25:43 cgd Exp $
-
-pc532 stand/boot
-Phil Budne <phil@ultimate.com> 5/19/1994
-
-Based on hp300 stand/pboot.c, uses libso
- (lacks the fun "spinner" that the i386 boot program displays)
-
-May be debugged under usermode (using "testboot" image)
-
-Passes howto, bootdev, & symbols to booted program;
- r3/ magic value 0xc1e86394 (3253232532)
- r4/ end of symbols
- r5/ physical load address (typ 0x2000)
- r6/ bootdev
- r7/ howto (flags: RB_{ASKNAME,KDB,SINGLE,HALT})
-
-All files have Berzerkley style copyrights, except libso files from
-Jordan Hubbard's "libso" (which in turn come from Bruce Culbertson's
-ROM monitor); scsi_hi.c scsi_lo.c so.h
-
-TODO:
-
-check if kernel will overlap boot program!
-pick up initial how and boot dev
-
diff --git a/sys/arch/pc532/stand/boot.c b/sys/arch/pc532/stand/boot.c
deleted file mode 100644
index 2dbc986aba7..00000000000
--- a/sys/arch/pc532/stand/boot.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/* $OpenBSD: boot.c,v 1.4 2000/03/03 00:54:55 todd Exp $ */
-/* $NetBSD: boot.c,v 1.5 1995/11/30 00:59:06 jtc Exp $ */
-
-/*-
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)boot.c 8.1 (Berkeley) 6/10/93
- */
-
-#ifndef lint
-static char rcsid[] = "$OpenBSD: boot.c,v 1.4 2000/03/03 00:54:55 todd Exp $";
-#endif /* not lint */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <a.out.h>
-#include "stand.h"
-#include "samachdep.h"
-
-/*
- * Boot program... bits in `howto' determine whether boot stops to
- * ask for system name. Boot device is derived from ROM provided
- * information.
- */
-
-extern unsigned opendev;
-extern int noconsole;
-extern int testing;
-
-char *ssym, *esym;
-
-char *name;
-char *names[] = {
- "/netbsd", "/onetbsd", "/netbsd.old",
-};
-#define NUMNAMES (sizeof(names)/sizeof(char *))
-#define LOADADDR ((char *)0x2000)
-
-static int bdev, bctlr, bunit, bpart;
-
-main()
-{
- int currname = 0;
- int io;
-
- cninit();
- scsiinit();
-
- printf("\n>> NetBSD BOOT pc532 [$Revision: 1.4 $]\n");
-
- bdev = B_TYPE(bootdev);
- bctlr = B_CONTROLLER(bootdev);
- bunit = B_UNIT(bootdev);
- bpart = B_PARTITION(bootdev);
-
- for (;;) {
- name = names[currname++];
- if (currname == NUMNAMES)
- currname = 0;
-
- if (!noconsole) {
- howto = 0;
- getbootdev(&howto);
- }
- else
- printf(": %s\n", name);
-
- io = open(name, 0);
-
- if (io >= 0) {
- copyunix(howto, opendev, io);
- close(io);
- }
- else
- printf("boot: %s\n", strerror(errno));
- }
-}
-
-/*ARGSUSED*/
-copyunix(howto, devtype, io)
- register int howto; /* boot flags */
- register u_int devtype; /* boot device */
- register int io;
-{
- struct exec x;
- int i;
- register char *load; /* load addr for unix */
- register char *addr;
- char *file;
- int dev, ctlr, unit, part;
-
- /* XXX use devtype? */
- dev = B_TYPE(opendev);
- ctlr = B_CONTROLLER(opendev);
- unit = B_UNIT(opendev);
- part = B_PARTITION(opendev);
- /* get the file name part of name */
- devparse(name, &i, &i, &i, &i, &i, &file);
-
- i = read(io, (char *)&x, sizeof(x));
- if (i != sizeof(x) || N_BADMAG(x)) {
- printf("Bad format\n");
- return;
- }
- addr = LOADADDR; /* Always load at LOADADDR */
- load = (char *)(x.a_entry & 0x00ffff00); /* XXX make less magical? */
- printf("Booting %s%d%c:%s @ 0x%x\n",
- devsw[dev].dv_name, unit + (8*ctlr), 'a' + part, file, load);
-
- if (testing) {
- load = addr = alloc(2*1024*1024); /* XXX stat the file? */
- if (!addr) {
- printf("alloc failed\n");
- exit(1);
- }
- }
-
- /* Text */
- printf("%d", x.a_text);
- if (N_GETMAGIC(x) == ZMAGIC && lseek(io, 0, SEEK_SET) == -1)
- goto shread;
- if (read(io, addr, x.a_text) != x.a_text)
- goto shread;
- addr += x.a_text;
- if (N_GETMAGIC(x) == NMAGIC)
- while ((int)addr & CLOFSET)
- *addr++ = 0;
- /* Data */
- printf("+%d", x.a_data);
- if (read(io, addr, x.a_data) != x.a_data)
- goto shread;
- addr += x.a_data;
-
- /* Bss */
- printf("+%d", x.a_bss);
- bzero( addr, x.a_bss );
- addr += x.a_bss;
-
- /* Symbols */
- ssym = load + (addr - LOADADDR);
- bcopy(&x.a_syms, addr, sizeof(x.a_syms));
- addr += sizeof(x.a_syms);
- printf(" [%d+", x.a_syms);
- if (x.a_syms && read(io, addr, x.a_syms) != x.a_syms)
- goto shread;
- addr += x.a_syms;
-
- /* read size of string table */
- i = 0;
- if (x.a_syms && read(io, &i, sizeof(int)) != sizeof(int))
- goto shread;
-
- /* read strings */
- printf("%d]", i);
- bcopy(&i, addr, sizeof(int));
- if (i) {
- i -= sizeof(int);
- addr += sizeof(int);
- if (read(io, addr, i) != i)
- goto shread;
- addr += i;
- }
-
- if (load != LOADADDR) {
- bcopy(LOADADDR, load, addr - LOADADDR);
- addr = load + (addr - LOADADDR);
- }
-#define round_to_size(x,t) \
- (((int)(x) + sizeof(t) - 1) & ~(sizeof(t) - 1))
- esym = (char *)round_to_size(addr - load,int);
-#undef round_to_size
-
- /* and note the end address of all this */
- printf(" total=0x%x", addr);
-
- x.a_entry &= 0xffffff;
- printf(" start 0x%x\n", x.a_entry);
-
-#ifdef DEBUG
- printf("ssym=0x%x esym=0x%x\n", ssym, esym);
- printf("\n\nReturn to boot...\n");
- getchar();
-#endif
-
- if (!testing) {
-#ifdef __GNUC__
- /* do NOT change order!!
- * the following are passed as args, and are in registers
- * clobbered by the last two movd's!!!
- */
- asm(" movd %0,r5" : : "g" (load));
- asm(" movd %0,r6" : : "g" (devtype));
- asm(" movd %0,r7" : : "g" (howto));
-
- /* magic value for locore.s to look for (3253232532) */
- asm(" movd %0,r3" : : "i" (0xc1e86394));
- asm(" movd %0,r4" : : "g" (esym));
-#endif /* __GNUC__ */
- (*((int (*)()) x.a_entry))();
- }
- return;
-shread:
- printf("Short read\n");
- return;
-}
-
-char line[100];
-
-getbootdev(howto)
- int *howto;
-{
- char c, *ptr = line;
-
- printf("Boot: [[[%s%d%c:]%s][-abdrs]] :- ",
- devsw[bdev].dv_name, bunit + (8 * bctlr), 'a'+bpart, name);
-
- if (tgets(line)) {
- while (c = *ptr) {
- while (c == ' ')
- c = *++ptr;
- if (!c)
- return;
- if (c == '-')
- while ((c = *++ptr) && c != ' ')
- switch (c) {
- case 'a':
- *howto |= RB_ASKNAME;
- continue;
- case 'b':
- *howto |= RB_HALT;
- continue;
- case 'd':
- *howto |= RB_KDB;
- continue;
- case 'r':
- *howto |= RB_DFLTROOT;
- continue;
- case 's':
- *howto |= RB_SINGLE;
- continue;
- }
- else {
- name = ptr;
- while ((c = *++ptr) && c != ' ');
- if (c)
- *ptr++ = 0;
- }
- }
- } else
- printf("\n");
-}
diff --git a/sys/arch/pc532/stand/conf.c b/sys/arch/pc532/stand/conf.c
deleted file mode 100644
index 6f4a50da0a8..00000000000
--- a/sys/arch/pc532/stand/conf.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $NetBSD: conf.c,v 1.3 1995/08/29 21:55:42 phil Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)conf.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include "stand.h"
-
-int rdstrategy __P((void *devdata, int rw,
- daddr_t blk, u_int size, char *buf, u_int *rsize));
-int rdopen __P((struct open_file *f, ...));
-
-int sdstrategy __P((void *devdata, int rw,
- daddr_t blk, u_int size, char *buf, u_int *rsize));
-int sdopen __P((struct open_file *f, ...));
-
-#define sdioctl noioctl
-#define rdioctl noioctl
-
-struct devsw devsw[] = {
- { "sd", sdstrategy, sdopen, nullsys, sdioctl }, /*0*/
- { NULL, NULL, NULL, NULL, NULL },
- { NULL, NULL, NULL, NULL, NULL },
- { "rd", rdstrategy, rdopen, nullsys, rdioctl }, /*3*/
-};
-
-int ndevs = (sizeof(devsw)/sizeof(devsw[0]));
diff --git a/sys/arch/pc532/stand/cons.c b/sys/arch/pc532/stand/cons.c
deleted file mode 100644
index 307a58539c5..00000000000
--- a/sys/arch/pc532/stand/cons.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/* $NetBSD: cons.c,v 1.3 1995/08/29 21:55:43 phil Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: cons.c 1.7 92/02/28
- *
- * @(#)cons.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <dev/cons.h>
-#include "samachdep.h"
-
-#ifdef SCNCONSOLE
-int scnprobe(), scninit(), scngetchar(), scnputchar();
-#endif
-
-struct consdev constab[] = {
-#ifdef SCNCONSOLE
- { scnprobe, scninit, scngetchar, scnputchar },
-#endif
- { 0 },
-};
-
-struct consdev *cn_tab;
-int noconsole;
-
-cninit()
-{
- register struct consdev *cp;
-
- cn_tab = NULL;
- noconsole = 1;
- for (cp = constab; cp->cn_probe; cp++) {
- (*cp->cn_probe)(cp);
- if (cp->cn_pri > CN_DEAD &&
- (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri))
- cn_tab = cp;
- }
- if (cn_tab) {
- (*cn_tab->cn_init)(cn_tab);
- noconsole = 0;
- }
-}
-
-cngetc()
-{
- if (cn_tab)
- return((*cn_tab->cn_getc)(cn_tab->cn_dev));
- return(0);
-}
-
-cnputc(c)
- int c;
-{
- if (cn_tab)
- (*cn_tab->cn_putc)(cn_tab->cn_dev, c);
-}
diff --git a/sys/arch/pc532/stand/devopen.c b/sys/arch/pc532/stand/devopen.c
deleted file mode 100644
index 4ddac7c398a..00000000000
--- a/sys/arch/pc532/stand/devopen.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/* $NetBSD: devopen.c,v 1.4 1995/08/29 21:55:44 phil Exp $ */
-
-/*-
- * Copyright (c) 1993 John Brezak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-
-#include "stand.h"
-#include "samachdep.h"
-
-u_int opendev;
-
-#define ispart(c) ((c) >= 'a' && (c) <= 'h')
-
-atoi(char *cp)
-{
- int val = 0;
- while(isdigit(*cp))
- val = val * 10 + (*cp++ - '0');
- return(val);
-}
-
-usage()
-{
- printf("\
-Usage: device(adaptor, controller, drive, partition)file\n\
- <device><unit><partitonletter>:file\n\
-");
-}
-
-devlookup(char *d, int len)
-{
- struct devsw *dp = devsw;
- int i;
-
- for (i = 0; i < ndevs; i++, dp++)
- if (dp->dv_name && strncmp(dp->dv_name, d, len) == 0)
- return(i);
-
- printf("No such device - Configured devices are:\n");
- for (dp = devsw, i = 0; i < ndevs; i++, dp++)
- if (dp->dv_name)
- printf(" %s", dp->dv_name);
- printf("\n");
- errno = ENODEV;
- return(-1);
-}
-
-/*
- * Parse a device spec in one of two forms.
- *
- * dev(adapt, ctlr, unit, part)file
- * [A-Za-z]*[0-9]*[A-Za-z]:file
- * dev unit part
- */
-devparse(char *fname, int *dev, int *adapt, int *ctlr, int *unit, int *part, char **file)
-{
- int *argp, i;
- char *s, *args[4];
-
- /* get device name and make lower case */
- for (s = fname; *s && *s != '/' && *s != ':' && *s != '('; s++)
- if (isupper(*s)) *s = tolower(*s);
-
- /* first form */
- if (*s == '(') {
- /* lookup device and get index */
- if ((*dev = devlookup(fname, s - fname)) < 0)
- goto baddev;
-
- /* tokenize device ident */
- args[0] = ++s;
- for (i = 1; *s && *s != ')'; s++) {
- if (i > 3)
- goto baddev;
- if (*s == ',')
- args[i++] = ++s;
- }
- switch(i) {
- case 4:
- *adapt = atoi(args[0]);
- *ctlr = atoi(args[1]);
- *unit = atoi(args[2]);
- *part = atoi(args[3]);
- break;
- case 3:
- *ctlr = atoi(args[0]);
- *unit = atoi(args[1]);
- *part = atoi(args[2]);
- break;
- case 2:
- *unit = atoi(args[0]);
- *part = atoi(args[1]);
- break;
- case 1:
- *part = atoi(args[0]);
- break;
- case 0:
- break;
- }
- *file = ++s;
- }
-
- /* second form */
- else if (*s == ':') {
- /* isolate device */
- for (s = fname; *s != ':' && !isdigit(*s); s++);
-
- /* lookup device and get index */
- if ((*dev = devlookup(fname, s - fname)) < 0)
- goto baddev;
-
- /* isolate unit */
- if ((*unit = atoi(s)) > ((1 << (sizeof(char) * 8)) - 1))
- goto bad;
- for (; isdigit(*s); s++);
-
- /* translate partition */
- if (!ispart(*s))
- goto bad;
-
- *part = *s++ - 'a';
- if (*s != ':')
- goto bad;
- *file = ++s;
- }
-
- /* no device present */
- else
- *file = fname;
-
- /* return the remaining unparsed part as the file to boot */
- return(0);
-
- bad:
- usage();
-
- baddev:
- return(-1);
-}
-
-
-devopen(f, fname, file)
- struct open_file *f;
- const char *fname;
- char **file;
-{
- int n, error;
- int dev, ctlr, unit, part;
- int adapt = 0; /* XXX not used on HP */
- struct devsw *dp = &devsw[0];
-
- dev = B_TYPE(bootdev);
- ctlr = B_CONTROLLER(bootdev);
- unit = B_UNIT(bootdev);
- part = B_PARTITION(bootdev);
-
- if (error = devparse(fname, &dev, &adapt, &ctlr, &unit, &part, file))
- return(error);
-
- dp = &devsw[dev];
-
- if (!dp->dv_open)
- return(ENODEV);
-
- opendev = MAKEBOOTDEV(dev, adapt, ctlr, unit, part);
-
- f->f_dev = dp;
-
- if ((error = (*dp->dv_open)(f, ctlr, unit, part)) == 0)
- return(0);
-
- printf("%s(%d,%d,%d,%d): %s\n", devsw[dev].dv_name,
- adapt, ctlr, unit, part, strerror(error));
-
- return(error);
-}
diff --git a/sys/arch/pc532/stand/filesystem.c b/sys/arch/pc532/stand/filesystem.c
deleted file mode 100644
index 3d0ff77b8d1..00000000000
--- a/sys/arch/pc532/stand/filesystem.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $NetBSD: filesystem.c,v 1.2 1994/10/26 08:25:48 cgd Exp $ */
-
-/*
- * Copyright (c) 1993 Philip A. Nelson.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Philip A. Nelson.
- * 4. The name of Philip A. Nelson may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY PHILIP NELSON ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL PHILIP NELSON BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stand.h>
-#include <ufs.h>
-
-struct fs_ops file_system[] =
-{ ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat };
-
-int nfsys = sizeof(file_system)/sizeof(struct fs_ops);
diff --git a/sys/arch/pc532/stand/inflate.c b/sys/arch/pc532/stand/inflate.c
deleted file mode 100644
index ec9fb67efa6..00000000000
--- a/sys/arch/pc532/stand/inflate.c
+++ /dev/null
@@ -1,1433 +0,0 @@
-/* $OpenBSD: inflate.c,v 1.3 2000/03/03 00:54:55 todd Exp $ */
-/*
- * Copyright (c) 1995 Matthias Pfaller.
- *
- * Most of this code is from the unzip512 distribution and was put
- * in the public domain by Mark Adler 1994.
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Matthias Pfaller.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <a.out.h>
-#include "stand.h"
-#include "samachdep.h"
-
-#ifndef EOF
-#define EOF -1
-#endif
-typedef unsigned char uch; /* code assumes unsigned bytes; these type- */
-typedef unsigned short ush; /* defs replace byte/UWORD/ULONG (which are */
-typedef unsigned long ulg; /* predefined on some systems) & match zip */
-
-extern int qflag;
-extern uch slide[];
-extern ulg crc_32_tab[];
-
-#define NEXTBYTE nextbyte()
-#define FLUSH(n) flush(n)
-#define WSIZE 0x8000
-#define memzero(dest, len) bzero(dest, len)
-
-/* Function prototypes */
-#ifndef OF
-# ifdef __STDC__
-# define OF(a) a
-# else /* !__STDC__ */
-# define OF(a) ()
-# endif /* ?__STDC__ */
-#endif
-
-/* From: funzip.c -- put in the public domain by Mark Adler */
-
-#define VERSION "3.83 of 28 August 1994"
-
-/*
-
- All funzip does is take a zip file from stdin and decompress the
- first entry to stdout. The entry has to be either deflated or
- stored. If the entry is encrypted, then the decryption password
- must be supplied on the command line as the first argument.
-
- funzip needs to be linked with inflate.o and crypt.o compiled from
- the unzip source. If decryption is desired, the full version of
- crypt.c (and crypt.h) from zcrypt21.zip or later must be used.
-
- */
-
-/* compression methods */
-#define STORED 0
-#define DEFLATED 8
-
-/* PKZIP header definitions */
-#define ZIPMAG 0x4b50 /* two-byte zip lead-in */
-#define LOCREM 0x0403 /* remaining two bytes in zip signature */
-#define LOCSIG 0x04034b50L /* full signature */
-#define LOCFLG 4 /* offset of bit flag */
-#define CRPFLG 1 /* bit for encrypted entry */
-#define EXTFLG 8 /* bit for extended local header */
-#define LOCHOW 6 /* offset of compression method */
-#define LOCTIM 8 /* file mod time (for decryption) */
-#define LOCCRC 12 /* offset of crc */
-#define LOCSIZ 16 /* offset of compressed size */
-#define LOCLEN 20 /* offset of uncompressed length */
-#define LOCFIL 24 /* offset of file name field length */
-#define LOCEXT 26 /* offset of extra field length */
-#define LOCHDR 28 /* size of local header, including LOCREM */
-#define EXTHDR 16 /* size of extended local header, inc sig */
-
-/* GZIP header definitions */
-#define GZPMAG 0x8b1f /* two-byte gzip lead-in */
-#define GZPHOW 0 /* offset of method number */
-#define GZPFLG 1 /* offset of gzip flags */
-#define GZPMUL 2 /* bit for multiple-part gzip file */
-#define GZPISX 4 /* bit for extra field present */
-#define GZPISF 8 /* bit for filename present */
-#define GZPISC 16 /* bit for comment present */
-#define GZPISE 32 /* bit for encryption */
-#define GZPTIM 2 /* offset of Unix file modification time */
-#define GZPEXF 6 /* offset of extra flags */
-#define GZPCOS 7 /* offset of operating system compressed on */
-#define GZPHDR 8 /* length of minimal gzip header */
-
-/* Macros for getting two-byte and four-byte header values */
-#define SH(p) ((ush)(uch)((p)[0]) | ((ush)(uch)((p)[1]) << 8))
-#define LG(p) ((ulg)(SH(p)) | ((ulg)(SH((p)+2)) << 16))
-
-/* Function prototypes */
-ulg updcrc OF((uch *, ulg));
-int inflate OF((void));
-void err OF((int, char *));
-
-/* Globals */
-uch *outptr; /* points to next byte in output buffer */
-ulg outcnt; /* bytes in output buffer */
-ulg outsiz; /* total bytes written to out */
-int encrypted; /* flag to turn on decryption */
-int qflag = 1; /* turn off messages in inflate.c */
-uch slide[WSIZE];
-uch *addr, *load, *esym;
-extern uch *r3, *r6, *r7;
-int bsize;
-
-/* Masks for inflate.c */
-ush mask_bits[] = {
- 0x0000,
- 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
- 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
-};
-
-extern uch input_data[];
-uch *datap = input_data;
-struct exec x;
-
-int nextbyte()
-{
- extern int input_len;
-
- if (!(input_len & 0x1fff))
- twiddle();
- if (input_len-- > 0)
- return(*datap++);
- else
- return(EOF);
-}
-
-int nextblock(p, n)
-char *p;
-int n;
-{
- extern int input_len;
-
- twiddle();
- if (input_len < n)
- return(0);
- memcpy(p, datap, n);
- input_len -= n;
- datap += n;
- return(n);
-}
-
-ulg updcrc(s, n)
-uch *s; /* pointer to bytes to pump through */
-ulg n; /* number of bytes in s[] */
-/* Run a set of bytes through the crc shift register. If s is a NULL
- pointer, then initialize the crc shift register contents instead.
- Return the current crc in either case. */
-{
- register ulg c; /* temporary variable */
-
- static ulg crc = 0xffffffffL; /* shift register contents */
-
- if (s == (uch *)NULL)
- c = 0xffffffffL;
- else
- {
- c = crc;
- while (n--)
- c = crc_32_tab[((int)c ^ (*s++)) & 0xff] ^ (c >> 8);
- }
- crc = c;
- return c ^ 0xffffffffL; /* (instead of ~c for 64-bit machines) */
-}
-
-void nextstate()
-{
- static int state = 0;
-
- switch (state) {
- case 0:
- if (N_BADMAG(x))
- panic("Bad exec format");
- load = addr = (uch *)(x.a_entry & 0x00ffff00);
- printf("Uncompressing @ 0x%x\n", addr);
- bsize = x.a_text;
- if (N_GETMAGIC(x) == ZMAGIC) {
- bcopy(&x, addr, sizeof(x));
- addr += sizeof(x);
- bsize -= sizeof(x);
- }
- printf("%d", x.a_text);
- state = 1;
- break;
-
- case 1:
- if (N_GETMAGIC(x) == NMAGIC)
- while ((int)addr & CLOFSET)
- *addr++ = 0;
- bsize = x.a_data;
- printf("+%d", x.a_data);
- state = 2;
- break;
-
- case 2:
- printf("+%d", x.a_bss);
- bzero(addr, x.a_bss );
- addr += x.a_bss;
- bcopy(&x.a_syms, addr, sizeof(x.a_syms));
- addr += sizeof(x.a_syms);
- printf(" [%d+", x.a_syms);
- if (x.a_syms) {
- bsize = x.a_syms + sizeof(int);
- state = 3;
- break;
- }
- printf("0]");
-
- case 4:
- printf(" total 0x%x", addr);
- x.a_entry &= 0xffffff;
- printf(" start 0x%x\n", x.a_entry);
-#define round_to_size(x,t) \
- (((int)(x) + sizeof(t) - 1) & ~(sizeof(t) - 1))
- esym = (char *)round_to_size(addr - load, int);
-#undef round_to_size
- state = -1;
- break;
-
- case 3:
- printf("%d]", ((int *)addr)[-1]);
- bsize = ((int *)addr)[-1] - sizeof(int);
- state = 4;
- break;
-
- case -1:
- printf("Already at EOF\n");
- break;
- }
-}
-
-int flush(w) /* used by inflate.c (FLUSH macro) */
-ulg w; /* number of bytes to flush */
-{
- uch *p = slide;
-
- updcrc(slide, w);
- outsiz += w;
-
- while (bsize <= w) {
- bcopy(p, addr, bsize);
- p += bsize;
- addr += bsize;
- w -= bsize;
- nextstate();
- }
- if (w) {
- bcopy(p, addr, w);
- addr += w;
- bsize -= w;
- }
- return(0);
-}
-
-main()
-{
- ush n;
- uch h[LOCHDR]; /* first local header (GZPHDR < LOCHDR) */
- int g = 0; /* true if gzip format */
- char *s = "";
-
- cninit();
-
- addr = (uch *)&x;
- bsize = sizeof(x);
-
- /* read local header, check validity, and skip name and extra fields */
- n = nextbyte(); n |= nextbyte() << 8;
- if (n == ZIPMAG)
- {
- if (nextblock((char *)h, LOCHDR) != LOCHDR || SH(h) != LOCREM)
- panic("invalid zip file");
- if (SH(h + LOCHOW) != STORED && SH(h + LOCHOW) != DEFLATED)
- panic("first entry not deflated or stored--can't funzip");
- for (n = SH(h + LOCFIL); n--; ) g = nextbyte();
- for (n = SH(h + LOCEXT); n--; ) g = nextbyte();
- g = 0;
- encrypted = h[LOCFLG] & CRPFLG;
- }
- else if (n == GZPMAG)
- {
- if (nextblock((char *)h, GZPHDR) != GZPHDR)
- panic("invalid gzip file");
- if (h[GZPHOW] != DEFLATED)
- panic("gzip file not deflated");
- if (h[GZPFLG] & GZPMUL)
- panic("cannot handle multi-part gzip files");
- if (h[GZPFLG] & GZPISX)
- {
- n = nextbyte(); n |= nextbyte() << 8;
- while (n--) g = nextbyte();
- }
- if (h[GZPFLG] & GZPISF)
- while ((g = nextbyte()) != 0 && g != EOF) ;
- if (h[GZPFLG] & GZPISC)
- while ((g = nextbyte()) != 0 && g != EOF) ;
- g = 1;
- encrypted = h[GZPFLG] & GZPISE;
- }
- else
- panic("input not a zip or gzip file");
-
- /* if entry encrypted, decrypt and validate encryption header */
- if (encrypted)
- panic("cannot decrypt entry (need to recompile with full crypt.c)");
-
- /* prepare output buffer and crc */
- outptr = slide;
- outcnt = 0L;
- outsiz = 0L;
- updcrc(NULL, 0L);
-
- /* decompress */
- if (g || h[LOCHOW])
- { /* deflated entry */
- int r;
-
- if ((r = inflate()) != 0)
- if (r == 3)
- panic("out of memory");
- else
- panic("invalid compressed data--format violated");
- inflate_free();
- }
- else
- { /* stored entry */
- register ulg n;
-
- n = LG(h + LOCLEN);
- if (n != LG(h + LOCSIZ)) {
- printf("len %ld, siz %ld\n", n, LG(h + LOCSIZ));
- panic("invalid compressed data--length mismatch");
- }
- while (n--) {
- ush c = nextbyte();
- *outptr++ = (uch)c;
- if (++outcnt == WSIZE) /* do FlushOutput() */
- {
- flush(outcnt);
- outptr = slide;
- outcnt = 0L;
- }
- }
- if (outcnt) /* flush one last time; no need to reset outptr/outcnt */
- flush(outcnt);
- }
-
- /* if extended header, get it */
- if (g)
- {
- if (nextblock((char *)h + LOCCRC, 8) != 8)
- panic("gzip file ended prematurely");
- }
- else
- if ((h[LOCFLG] & EXTFLG) &&
- nextblock((char *)h + LOCCRC - 4, EXTHDR) != EXTHDR)
- panic("zip file ended prematurely");
-
- /* validate decompression */
- if (LG(h + LOCCRC) != updcrc(slide, 0L))
- panic("invalid compressed data--crc error");
- if (LG(h + (g ? LOCSIZ : LOCLEN)) != outsiz)
- panic("invalid compressed data--length error");
-
- /* check if there are more entries */
- if (!g && nextblock((char *)h, 4) == 4 && LG(h) == LOCSIG)
- printf("funzip warning: zip file has more than one entry--rest ignored\n");
-
- asm(" movd %0,r3" : : "g" (r3)); /* magic */
- asm(" movd %0,r4" : : "g" (esym));
- asm(" movd %0,r5" : : "g" (load));
- asm(" movd %0,r6" : : "g" (r6)); /* devtype */
- asm(" movd %0,r7" : : "g" (r7)); /* howto */
-
- (*((int (*)()) x.a_entry))();
-}
-
-/* Table of CRC-32's of all single-byte values (made by makecrc.c) */
-ulg crc_32_tab[] = {
- 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
- 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
- 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
- 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
- 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
- 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
- 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
- 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
- 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
- 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
- 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
- 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
- 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
- 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
- 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
- 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
- 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
- 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
- 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
- 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
- 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
- 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
- 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
- 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
- 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
- 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
- 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
- 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
- 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
- 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
- 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
- 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
- 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
- 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
- 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
- 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
- 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
- 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
- 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
- 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
- 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
- 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
- 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
- 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
- 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
- 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
- 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
- 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
- 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
- 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
- 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
- 0x2d02ef8dL
-};
-
-/* From: inflate.c -- put in the public domain by Mark Adler
- version c14o, 23 August 1994 */
-
-/*
- Inflate deflated (PKZIP's method 8 compressed) data. The compression
- method searches for as much of the current string of bytes (up to a
- length of 258) in the previous 32K bytes. If it doesn't find any
- matches (of at least length 3), it codes the next byte. Otherwise, it
- codes the length of the matched string and its distance backwards from
- the current position. There is a single Huffman code that codes both
- single bytes (called "literals") and match lengths. A second Huffman
- code codes the distance information, which follows a length code. Each
- length or distance code actually represents a base value and a number
- of "extra" (sometimes zero) bits to get to add to the base value. At
- the end of each deflated block is a special end-of-block (EOB) literal/
- length code. The decoding process is basically: get a literal/length
- code; if EOB then done; if a literal, emit the decoded byte; if a
- length then get the distance and emit the referred-to bytes from the
- sliding window of previously emitted data.
-
- There are (currently) three kinds of inflate blocks: stored, fixed, and
- dynamic. The compressor outputs a chunk of data at a time and decides
- which method to use on a chunk-by-chunk basis. A chunk might typically
- be 32K to 64K, uncompressed. If the chunk is uncompressible, then the
- "stored" method is used. In this case, the bytes are simply stored as
- is, eight bits per byte, with none of the above coding. The bytes are
- preceded by a count, since there is no longer an EOB code.
-
- If the data is compressible, then either the fixed or dynamic methods
- are used. In the dynamic method, the compressed data is preceded by
- an encoding of the literal/length and distance Huffman codes that are
- to be used to decode this block. The representation is itself Huffman
- coded, and so is preceded by a description of that code. These code
- descriptions take up a little space, and so for small blocks, there is
- a predefined set of codes, called the fixed codes. The fixed method is
- used if the block ends up smaller that way (usually for quite small
- chunks); otherwise the dynamic method is used. In the latter case, the
- codes are customized to the probabilities in the current block and so
- can code it much better than the pre-determined fixed codes can.
-
- The Huffman codes themselves are decoded using a mutli-level table
- lookup, in order to maximize the speed of decoding plus the speed of
- building the decoding tables. See the comments below that precede the
- lbits and dbits tuning parameters.
- */
-
-
-/*
- Notes beyond the 1.93a appnote.txt:
-
- 1. Distance pointers never point before the beginning of the output
- stream.
- 2. Distance pointers can point back across blocks, up to 32k away.
- 3. There is an implied maximum of 7 bits for the bit length table and
- 15 bits for the actual data.
- 4. If only one code exists, then it is encoded using one bit. (Zero
- would be more efficient, but perhaps a little confusing.) If two
- codes exist, they are coded using one bit each (0 and 1).
- 5. There is no way of sending zero distance codes--a dummy must be
- sent if there are none. (History: a pre 2.0 version of PKZIP would
- store blocks with no distance codes, but this was discovered to be
- too harsh a criterion.) Valid only for 1.93a. 2.04c does allow
- zero distance codes, which is sent as one code of zero bits in
- length.
- 6. There are up to 286 literal/length codes. Code 256 represents the
- end-of-block. Note however that the static length tree defines
- 288 codes just to fill out the Huffman codes. Codes 286 and 287
- cannot be used though, since there is no length base or extra bits
- defined for them. Similarily, there are up to 30 distance codes.
- However, static trees define 32 codes (all 5 bits) to fill out the
- Huffman codes, but the last two had better not show up in the data.
- 7. Unzip can check dynamic Huffman blocks for complete code sets.
- The exception is that a single code would not be complete (see #4).
- 8. The five bits following the block type is really the number of
- literal codes sent minus 257.
- 9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits
- (1+6+6). Therefore, to output three times the length, you output
- three codes (1+1+1), whereas to output four times the same length,
- you only need two codes (1+3). Hmm.
- 10. In the tree reconstruction algorithm, Code = Code + Increment
- only if BitLength(i) is not zero. (Pretty obvious.)
- 11. Correction: 4 Bits: # of Bit Length codes - 4 (4 - 19)
- 12. Note: length code 284 can represent 227-258, but length code 285
- really is 258. The last length deserves its own, short code
- since it gets used a lot in very redundant files. The length
- 258 is special since 258 - 3 (the min match length) is 255.
- 13. The literal/length and distance code bit lengths are read as a
- single stream of lengths. It is possible (and advantageous) for
- a repeat code (16, 17, or 18) to go across the boundary between
- the two sets of lengths.
- */
-
-
-#define PKZIP_BUG_WORKAROUND /* PKZIP 1.93a problem--live with it */
-
-/*
- inflate.h must supply the uch slide[WSIZE] array and the NEXTBYTE,
- FLUSH() and memzero macros. If the window size is not 32K, it
- should also define WSIZE. If INFMOD is defined, it can include
- compiled functions to support the NEXTBYTE and/or FLUSH() macros.
- There are defaults for NEXTBYTE and FLUSH() below for use as
- examples of what those functions need to do. Normally, you would
- also want FLUSH() to compute a crc on the data. inflate.h also
- needs to provide these typedefs:
-
- typedef unsigned char uch;
- typedef unsigned short ush;
- typedef unsigned long ulg;
-
- This module uses the external functions malloc() and free() (and
- probably memset() or bzero() in the memzero() macro). Their
- prototypes are normally found in <string.h> and <stdlib.h>.
- */
-
-/* Warning: the fwrite above might not work on 16-bit compilers, since
- 0x8000 might be interpreted as -32,768 by the library function. */
-
-/* Huffman code lookup table entry--this entry is four bytes for machines
- that have 16-bit pointers (e.g. PC's in the small or medium model).
- Valid extra bits are 0..13. e == 15 is EOB (end of block), e == 16
- means that v is a literal, 16 < e < 32 means that v is a pointer to
- the next table, which codes e - 16 bits, and lastly e == 99 indicates
- an unused code. If a code with e == 99 is looked up, this implies an
- error in the data. */
-struct huft {
- uch e; /* number of extra bits or operation */
- uch b; /* number of bits in this code or subcode */
- union {
- ush n; /* literal, length base, or distance base */
- struct huft *t; /* pointer to next level of table */
- } v;
-};
-
-int huft_build OF((unsigned *, unsigned, unsigned, ush *, ush *,
- struct huft **, int *));
-int huft_free OF((struct huft *));
-int inflate_codes OF((struct huft *, struct huft *, int, int));
-int inflate_stored OF((void));
-int inflate_fixed OF((void));
-int inflate_dynamic OF((void));
-int inflate_block OF((int *));
-int inflate OF((void));
-int inflate_free OF((void));
-
-
-/* The inflate algorithm uses a sliding 32K byte window on the uncompressed
- stream to find repeated byte strings. This is implemented here as a
- circular buffer. The index is updated simply by incrementing and then
- and'ing with 0x7fff (32K-1). */
-/* It is left to other modules to supply the 32K area. It is assumed
- to be usable as if it were declared "uch slide[32768];" or as just
- "uch *slide;" and then malloc'ed in the latter case. The definition
- must be in unzip.h, included above. */
-unsigned wp; /* current position in slide */
-
-
-/* Tables for deflate from PKZIP's appnote.txt. */
-static unsigned border[] = { /* Order of the bit length code lengths */
- 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
-static ush cplens[] = { /* Copy lengths for literal codes 257..285 */
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
- 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
- /* note: see note #13 above about the 258 in this list. */
-static ush cplext[] = { /* Extra bits for literal codes 257..285 */
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
- 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99}; /* 99==invalid */
-static ush cpdist[] = { /* Copy offsets for distance codes 0..29 */
- 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
- 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
- 8193, 12289, 16385, 24577};
-static ush cpdext[] = { /* Extra bits for distance codes */
- 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
- 7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
- 12, 12, 13, 13};
-
-/* And'ing with mask[n] masks the lower n bits */
-ush mask[] = {
- 0x0000,
- 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
- 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
-};
-
-
-/* Macros for inflate() bit peeking and grabbing.
- The usage is:
-
- NEEDBITS(j)
- x = b & mask[j];
- DUMPBITS(j)
-
- where NEEDBITS makes sure that b has at least j bits in it, and
- DUMPBITS removes the bits from b. The macros use the variable k
- for the number of bits in b. Normally, b and k are register
- variables for speed, and are initialized at the begining of a
- routine that uses these macros from a global bit buffer and count.
-
- In order to not ask for more bits than there are in the compressed
- stream, the Huffman tables are constructed to only ask for just
- enough bits to make up the end-of-block code (value 256). Then no
- bytes need to be "returned" to the buffer at the end of the last
- block. See the huft_build() routine.
- */
-
-ulg bb; /* bit buffer */
-unsigned bk; /* bits in bit buffer */
-
-#ifndef CHECK_EOF
-# define NEEDBITS(n) {while(k<(n)){b|=((ulg)NEXTBYTE)<<k;k+=8;}}
-#else
-# define NEEDBITS(n) {while(k<(n)){int c=NEXTBYTE;if(c==EOF)return 1;\
- b|=((ulg)c)<<k;k+=8;}}
-#endif /* Piet Plomp: change "return 1" to "break" */
-
-#define DUMPBITS(n) {b>>=(n);k-=(n);}
-
-
-/*
- Huffman code decoding is performed using a multi-level table lookup.
- The fastest way to decode is to simply build a lookup table whose
- size is determined by the longest code. However, the time it takes
- to build this table can also be a factor if the data being decoded
- is not very long. The most common codes are necessarily the
- shortest codes, so those codes dominate the decoding time, and hence
- the speed. The idea is you can have a shorter table that decodes the
- shorter, more probable codes, and then point to subsidiary tables for
- the longer codes. The time it costs to decode the longer codes is
- then traded against the time it takes to make longer tables.
-
- This results of this trade are in the variables lbits and dbits
- below. lbits is the number of bits the first level table for literal/
- length codes can decode in one step, and dbits is the same thing for
- the distance codes. Subsequent tables are also less than or equal to
- those sizes. These values may be adjusted either when all of the
- codes are shorter than that, in which case the longest code length in
- bits is used, or when the shortest code is *longer* than the requested
- table size, in which case the length of the shortest code in bits is
- used.
-
- There are two different values for the two tables, since they code a
- different number of possibilities each. The literal/length table
- codes 286 possible values, or in a flat code, a little over eight
- bits. The distance table codes 30 possible values, or a little less
- than five bits, flat. The optimum values for speed end up being
- about one bit more than those, so lbits is 8+1 and dbits is 5+1.
- The optimum values may differ though from machine to machine, and
- possibly even between compilers. Your mileage may vary.
- */
-
-
-int lbits = 9; /* bits in base literal/length lookup table */
-int dbits = 6; /* bits in base distance lookup table */
-
-
-/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */
-#define BMAX 16 /* maximum bit length of any code (16 for explode) */
-#define N_MAX 288 /* maximum number of codes in any set */
-
-
-unsigned hufts; /* track memory usage */
-
-void *malloc(n)
-int n;
-{
- void *p;
- p = alloc(n + sizeof(n));
- if (!p)
- return(NULL);
- *((int *)p) = n;
- p += sizeof(n);
- return(p);
-}
-
-int huft_build(b, n, s, d, e, t, m)
-unsigned *b; /* code lengths in bits (all assumed <= BMAX) */
-unsigned n; /* number of codes (assumed <= N_MAX) */
-unsigned s; /* number of simple-valued codes (0..s-1) */
-ush *d; /* list of base values for non-simple codes */
-ush *e; /* list of extra bits for non-simple codes */
-struct huft **t; /* result: starting table */
-int *m; /* maximum lookup bits, returns actual */
-/* Given a list of code lengths and a maximum table size, make a set of
- tables to decode that set of codes. Return zero on success, one if
- the given code set is incomplete (the tables are still built in this
- case), two if the input is invalid (all zero length codes or an
- oversubscribed set of lengths), and three if not enough memory.
- The code with value 256 is special, and the tables are constructed
- so that no bits beyond that code are fetched when that code is
- decoded. */
-{
- unsigned a; /* counter for codes of length k */
- unsigned c[BMAX+1]; /* bit length count table */
- unsigned el; /* length of EOB code (value 256) */
- unsigned f; /* i repeats in table every f entries */
- int g; /* maximum code length */
- int h; /* table level */
- register unsigned i; /* counter, current code */
- register unsigned j; /* counter */
- register int k; /* number of bits in current code */
- int lx[BMAX+1]; /* memory for l[-1..BMAX-1] */
- int *l = lx+1; /* stack of bits per table */
- register unsigned *p; /* pointer into c[], b[], or v[] */
- register struct huft *q; /* points to current table */
- struct huft r; /* table entry for structure assignment */
- struct huft *u[BMAX]; /* table stack */
- static unsigned v[N_MAX]; /* values in order of bit length */
- register int w; /* bits before this table == (l * h) */
- unsigned x[BMAX+1]; /* bit offsets, then code stack */
- unsigned *xp; /* pointer into x */
- int y; /* number of dummy codes added */
- unsigned z; /* number of entries in current table */
-
-
- /* Generate counts for each bit length */
- el = n > 256 ? b[256] : BMAX; /* set length of EOB code, if any */
- memzero((char *)c, sizeof(c));
- p = b; i = n;
- do {
- c[*p]++; p++; /* assume all entries <= BMAX */
- } while (--i);
- if (c[0] == n) /* null input--all zero length codes */
- {
- *t = (struct huft *)NULL;
- *m = 0;
- return 0;
- }
-
-
- /* Find minimum and maximum length, bound *m by those */
- for (j = 1; j <= BMAX; j++)
- if (c[j])
- break;
- k = j; /* minimum code length */
- if ((unsigned)*m < j)
- *m = j;
- for (i = BMAX; i; i--)
- if (c[i])
- break;
- g = i; /* maximum code length */
- if ((unsigned)*m > i)
- *m = i;
-
-
- /* Adjust last length count to fill out codes, if needed */
- for (y = 1 << j; j < i; j++, y <<= 1)
- if ((y -= c[j]) < 0)
- return 2; /* bad input: more codes than bits */
- if ((y -= c[i]) < 0)
- return 2;
- c[i] += y;
-
-
- /* Generate starting offsets into the value table for each length */
- x[1] = j = 0;
- p = c + 1; xp = x + 2;
- while (--i) { /* note that i == g from above */
- *xp++ = (j += *p++);
- }
-
-
- /* Make a table of values in order of bit lengths */
- p = b; i = 0;
- do {
- if ((j = *p++) != 0)
- v[x[j]++] = i;
- } while (++i < n);
-
-
- /* Generate the Huffman codes and for each, make the table entries */
- x[0] = i = 0; /* first Huffman code is zero */
- p = v; /* grab values in bit order */
- h = -1; /* no tables yet--level -1 */
- w = l[-1] = 0; /* no bits decoded yet */
- u[0] = (struct huft *)NULL; /* just to keep compilers happy */
- q = (struct huft *)NULL; /* ditto */
- z = 0; /* ditto */
-
- /* go through the bit lengths (k already is bits in shortest code) */
- for (; k <= g; k++)
- {
- a = c[k];
- while (a--)
- {
- /* here i is the Huffman code of length k bits for value *p */
- /* make tables up to required level */
- while (k > w + l[h])
- {
- w += l[h++]; /* add bits already decoded */
-
- /* compute minimum size table less than or equal to *m bits */
- z = (z = g - w) > (unsigned)*m ? *m : z; /* upper limit */
- if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */
- { /* too few codes for k-w bit table */
- f -= a + 1; /* deduct codes from patterns left */
- xp = c + k;
- while (++j < z) /* try smaller tables up to z bits */
- {
- if ((f <<= 1) <= *++xp)
- break; /* enough codes to use up j bits */
- f -= *xp; /* else deduct codes from patterns */
- }
- }
- if ((unsigned)w + j > el && (unsigned)w < el)
- j = el - w; /* make EOB code end at table */
- z = 1 << j; /* table entries for j-bit table */
- l[h] = j; /* set table size in stack */
-
- /* allocate and link in new table */
- if ((q = (struct huft *)malloc((z + 1)*sizeof(struct huft))) ==
- (struct huft *)NULL)
- {
- if (h)
- huft_free(u[0]);
- return 3; /* not enough memory */
- }
- hufts += z + 1; /* track memory usage */
- *t = q + 1; /* link to list for huft_free() */
- *(t = &(q->v.t)) = (struct huft *)NULL;
- u[h] = ++q; /* table starts after link */
-
- /* connect to last table, if there is one */
- if (h)
- {
- x[h] = i; /* save pattern for backing up */
- r.b = (uch)l[h-1]; /* bits to dump before this table */
- r.e = (uch)(16 + j); /* bits in this table */
- r.v.t = q; /* pointer to this table */
- j = (i & ((1 << w) - 1)) >> (w - l[h-1]);
- u[h-1][j] = r; /* connect to last table */
- }
- }
-
- /* set up table entry in r */
- r.b = (uch)(k - w);
- if (p >= v + n)
- r.e = 99; /* out of values--invalid code */
- else if (*p < s)
- {
- r.e = (uch)(*p < 256 ? 16 : 15); /* 256 is end-of-block code */
- r.v.n = *p++; /* simple code is just the value */
- }
- else
- {
- r.e = (uch)e[*p - s]; /* non-simple--look up in lists */
- r.v.n = d[*p++ - s];
- }
-
- /* fill code-like entries with r */
- f = 1 << (k - w);
- for (j = i >> w; j < z; j += f)
- q[j] = r;
-
- /* backwards increment the k-bit code i */
- for (j = 1 << (k - 1); i & j; j >>= 1)
- i ^= j;
- i ^= j;
-
- /* backup over finished tables */
- while ((i & ((1 << w) - 1)) != x[h])
- w -= l[--h]; /* don't need to update q */
- }
- }
-
-
- /* return actual size of base table */
- *m = l[0];
-
-
- /* Return true (1) if we were given an incomplete table */
- return y != 0 && g != 1;
-}
-
-
-
-int huft_free(t)
-struct huft *t; /* table to free */
-/* Free the malloc'ed tables built by huft_build(), which makes a linked
- list of the tables it made, with the links in a dummy first entry of
- each table. */
-{
- register struct huft *p, *q;
-
-
- /* Go through linked list, freeing from the malloced (t[-1]) address. */
- p = t;
- while (p != (struct huft *)NULL)
- {
- q = (--p)->v.t;
- free(((void *)p) - sizeof(int), ((int *)p)[-1]);
- p = q;
- }
- return 0;
-}
-
-
-
-#ifdef ASM_INFLATECODES
-# define inflate_codes(tl,td,bl,bd) flate_codes(tl,td,bl,bd,(uch *)slide)
- int flate_codes OF((struct huft *, struct huft *, int, int, uch *));
-
-#else
-
-int inflate_codes(tl, td, bl, bd)
-struct huft *tl, *td; /* literal/length and distance decoder tables */
-int bl, bd; /* number of bits decoded by tl[] and td[] */
-/* inflate (decompress) the codes in a deflated (compressed) block.
- Return an error code or zero if it all goes ok. */
-{
- register unsigned e; /* table entry flag/number of extra bits */
- unsigned n, d; /* length and index for copy */
- unsigned w; /* current window position */
- struct huft *t; /* pointer to table entry */
- unsigned ml, md; /* masks for bl and bd bits */
- register ulg b; /* bit buffer */
- register unsigned k; /* number of bits in bit buffer */
-
-
- /* make local copies of globals */
- b = bb; /* initialize bit buffer */
- k = bk;
- w = wp; /* initialize window position */
-
-
- /* inflate the coded data */
- ml = mask[bl]; /* precompute masks for speed */
- md = mask[bd];
- while (1) /* do until end of block */
- {
- NEEDBITS((unsigned)bl)
- if ((e = (t = tl + ((unsigned)b & ml))->e) > 16)
- do {
- if (e == 99)
- return 1;
- DUMPBITS(t->b)
- e -= 16;
- NEEDBITS(e)
- } while ((e = (t = t->v.t + ((unsigned)b & mask[e]))->e) > 16);
- DUMPBITS(t->b)
- if (e == 16) /* then it's a literal */
- {
- slide[w++] = (uch)t->v.n;
- if (w == WSIZE)
- {
- FLUSH(w);
- w = 0;
- }
- }
- else /* it's an EOB or a length */
- {
- /* exit if end of block */
- if (e == 15)
- break;
-
- /* get length of block to copy */
- NEEDBITS(e)
- n = t->v.n + ((unsigned)b & mask[e]);
- DUMPBITS(e);
-
- /* decode distance of block to copy */
- NEEDBITS((unsigned)bd)
- if ((e = (t = td + ((unsigned)b & md))->e) > 16)
- do {
- if (e == 99)
- return 1;
- DUMPBITS(t->b)
- e -= 16;
- NEEDBITS(e)
- } while ((e = (t = t->v.t + ((unsigned)b & mask[e]))->e) > 16);
- DUMPBITS(t->b)
- NEEDBITS(e)
- d = w - t->v.n - ((unsigned)b & mask[e]);
- DUMPBITS(e)
-
- /* do the copy */
- do {
- n -= (e = (e = WSIZE - ((d &= WSIZE-1) > w ? d : w)) > n ? n : e);
-#ifndef NOMEMCPY
- if (w - d >= e) /* (this test assumes unsigned comparison) */
- {
- memcpy(slide + w, slide + d, e);
- w += e;
- d += e;
- }
- else /* do it slow to avoid memcpy() overlap */
-#endif /* !NOMEMCPY */
- do {
- slide[w++] = slide[d++];
- } while (--e);
- if (w == WSIZE)
- {
- FLUSH(w);
- w = 0;
- }
- } while (n);
- }
- }
-
-
- /* restore the globals from the locals */
- wp = w; /* restore global window pointer */
- bb = b; /* restore global bit buffer */
- bk = k;
-
-
- /* done */
- return 0;
-}
-
-#endif /* ASM_INFLATECODES */
-
-
-
-int inflate_stored()
-/* "decompress" an inflated type 0 (stored) block. */
-{
- unsigned n; /* number of bytes in block */
- unsigned w; /* current window position */
- register ulg b; /* bit buffer */
- register unsigned k; /* number of bits in bit buffer */
-
-
- /* make local copies of globals */
- b = bb; /* initialize bit buffer */
- k = bk;
- w = wp; /* initialize window position */
-
-
- /* go to byte boundary */
- n = k & 7;
- DUMPBITS(n);
-
-
- /* get the length and its complement */
- NEEDBITS(16)
- n = ((unsigned)b & 0xffff);
- DUMPBITS(16)
- NEEDBITS(16)
- if (n != (unsigned)((~b) & 0xffff))
- return 1; /* error in compressed data */
- DUMPBITS(16)
-
-
- /* read and output the compressed data */
- while (n--)
- {
- NEEDBITS(8)
- slide[w++] = (uch)b;
- if (w == WSIZE)
- {
- FLUSH(w);
- w = 0;
- }
- DUMPBITS(8)
- }
-
-
- /* restore the globals from the locals */
- wp = w; /* restore global window pointer */
- bb = b; /* restore global bit buffer */
- bk = k;
- return 0;
-}
-
-
-/* Globals for literal tables (built once) */
-struct huft *fixed_tl = (struct huft *)NULL;
-struct huft *fixed_td;
-int fixed_bl, fixed_bd;
-
-int inflate_fixed()
-/* decompress an inflated type 1 (fixed Huffman codes) block. We should
- either replace this with a custom decoder, or at least precompute the
- Huffman tables. */
-{
- /* if first time, set up tables for fixed blocks */
- if (fixed_tl == (struct huft *)NULL)
- {
- int i; /* temporary variable */
- static unsigned l[288]; /* length list for huft_build */
-
- /* literal table */
- for (i = 0; i < 144; i++)
- l[i] = 8;
- for (; i < 256; i++)
- l[i] = 9;
- for (; i < 280; i++)
- l[i] = 7;
- for (; i < 288; i++) /* make a complete, but wrong code set */
- l[i] = 8;
- fixed_bl = 7;
- if ((i = huft_build(l, 288, 257, cplens, cplext,
- &fixed_tl, &fixed_bl)) != 0)
- {
- fixed_tl = (struct huft *)NULL;
- return i;
- }
-
- /* distance table */
- for (i = 0; i < 30; i++) /* make an incomplete code set */
- l[i] = 5;
- fixed_bd = 5;
- if ((i = huft_build(l, 30, 0, cpdist, cpdext, &fixed_td, &fixed_bd)) > 1)
- {
- huft_free(fixed_tl);
- fixed_tl = (struct huft *)NULL;
- return i;
- }
- }
-
-
- /* decompress until an end-of-block code */
- return inflate_codes(fixed_tl, fixed_td, fixed_bl, fixed_bd) != 0;
-}
-
-
-
-int inflate_dynamic()
-/* decompress an inflated type 2 (dynamic Huffman codes) block. */
-{
- int i; /* temporary variables */
- unsigned j;
- unsigned l; /* last length */
- unsigned m; /* mask for bit lengths table */
- unsigned n; /* number of lengths to get */
- struct huft *tl; /* literal/length code table */
- struct huft *td; /* distance code table */
- int bl; /* lookup bits for tl */
- int bd; /* lookup bits for td */
- unsigned nb; /* number of bit length codes */
- unsigned nl; /* number of literal/length codes */
- unsigned nd; /* number of distance codes */
-#ifdef PKZIP_BUG_WORKAROUND
- static unsigned ll[288+32]; /* literal/length and distance code lengths */
-#else
- static unsigned ll[286+30]; /* literal/length and distance code lengths */
-#endif
- register ulg b; /* bit buffer */
- register unsigned k; /* number of bits in bit buffer */
-
-
- /* make local bit buffer */
- b = bb;
- k = bk;
-
-
- /* read in table lengths */
- NEEDBITS(5)
- nl = 257 + ((unsigned)b & 0x1f); /* number of literal/length codes */
- DUMPBITS(5)
- NEEDBITS(5)
- nd = 1 + ((unsigned)b & 0x1f); /* number of distance codes */
- DUMPBITS(5)
- NEEDBITS(4)
- nb = 4 + ((unsigned)b & 0xf); /* number of bit length codes */
- DUMPBITS(4)
-#ifdef PKZIP_BUG_WORKAROUND
- if (nl > 288 || nd > 32)
-#else
- if (nl > 286 || nd > 30)
-#endif
- return 1; /* bad lengths */
-
-
- /* read in bit-length-code lengths */
- for (j = 0; j < nb; j++)
- {
- NEEDBITS(3)
- ll[border[j]] = (unsigned)b & 7;
- DUMPBITS(3)
- }
- for (; j < 19; j++)
- ll[border[j]] = 0;
-
-
- /* build decoding table for trees--single level, 7 bit lookup */
- bl = 7;
- if ((i = huft_build(ll, 19, 19, NULL, NULL, &tl, &bl)) != 0)
- {
- if (i == 1)
- huft_free(tl);
- return i; /* incomplete code set */
- }
-
-
- /* read in literal and distance code lengths */
- n = nl + nd;
- m = mask[bl];
- i = l = 0;
- while ((unsigned)i < n)
- {
- NEEDBITS((unsigned)bl)
- j = (td = tl + ((unsigned)b & m))->b;
- DUMPBITS(j)
- j = td->v.n;
- if (j < 16) /* length of code in bits (0..15) */
- ll[i++] = l = j; /* save last length in l */
- else if (j == 16) /* repeat last length 3 to 6 times */
- {
- NEEDBITS(2)
- j = 3 + ((unsigned)b & 3);
- DUMPBITS(2)
- if ((unsigned)i + j > n)
- return 1;
- while (j--)
- ll[i++] = l;
- }
- else if (j == 17) /* 3 to 10 zero length codes */
- {
- NEEDBITS(3)
- j = 3 + ((unsigned)b & 7);
- DUMPBITS(3)
- if ((unsigned)i + j > n)
- return 1;
- while (j--)
- ll[i++] = 0;
- l = 0;
- }
- else /* j == 18: 11 to 138 zero length codes */
- {
- NEEDBITS(7)
- j = 11 + ((unsigned)b & 0x7f);
- DUMPBITS(7)
- if ((unsigned)i + j > n)
- return 1;
- while (j--)
- ll[i++] = 0;
- l = 0;
- }
- }
-
-
- /* free decoding table for trees */
- huft_free(tl);
-
-
- /* restore the global bit buffer */
- bb = b;
- bk = k;
-
-
- /* build the decoding tables for literal/length and distance codes */
- bl = lbits;
- if ((i = huft_build(ll, nl, 257, cplens, cplext, &tl, &bl)) != 0)
- {
- return i; /* incomplete code set */
- }
- bd = dbits;
- if ((i = huft_build(ll + nl, nd, 0, cpdist, cpdext, &td, &bd)) != 0)
- {
- if (i == 1 && !qflag) {
-#ifdef PKZIP_BUG_WORKAROUND
- i = 0;
- }
-#else
- huft_free(td);
- }
- huft_free(tl);
- return i; /* incomplete code set */
-#endif
- }
-
-
- /* decompress until an end-of-block code */
- if (inflate_codes(tl, td, bl, bd))
- return 1;
-
-
- /* free the decoding tables, return */
- huft_free(tl);
- huft_free(td);
- return 0;
-}
-
-
-
-int inflate_block(e)
-int *e; /* last block flag */
-/* decompress an inflated block */
-{
- unsigned t; /* block type */
- register ulg b; /* bit buffer */
- register unsigned k; /* number of bits in bit buffer */
-
-
- /* make local bit buffer */
- b = bb;
- k = bk;
-
-
- /* read in last block bit */
- NEEDBITS(1)
- *e = (int)b & 1;
- DUMPBITS(1)
-
-
- /* read in block type */
- NEEDBITS(2)
- t = (unsigned)b & 3;
- DUMPBITS(2)
-
-
- /* restore the global bit buffer */
- bb = b;
- bk = k;
-
-
- /* inflate that block type */
- if (t == 2)
- return inflate_dynamic();
- if (t == 0)
- return inflate_stored();
- if (t == 1)
- return inflate_fixed();
-
-
- /* bad block type */
- return 2;
-}
-
-
-
-int inflate()
-/* decompress an inflated entry */
-{
- int e; /* last block flag */
- int r; /* result code */
- unsigned h; /* maximum struct huft's malloc'ed */
-
-
- /* initialize window, bit buffer */
- wp = 0;
- bk = 0;
- bb = 0;
-
-
- /* decompress until the last block */
- h = 0;
- do {
- hufts = 0;
- if ((r = inflate_block(&e)) != 0)
- return r;
- if (hufts > h)
- h = hufts;
- } while (!e);
-
-
- /* flush out slide */
- FLUSH(wp);
-
-
- /* return success */
- return 0;
-}
-
-
-
-int inflate_free()
-{
- if (fixed_tl != (struct huft *)NULL)
- {
- huft_free(fixed_td);
- huft_free(fixed_tl);
- fixed_td = fixed_tl = (struct huft *)NULL;
- }
- return 0;
-}
diff --git a/sys/arch/pc532/stand/machdep.c b/sys/arch/pc532/stand/machdep.c
deleted file mode 100644
index ec044477f0b..00000000000
--- a/sys/arch/pc532/stand/machdep.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* $NetBSD: machdep.c,v 1.2 1994/10/26 08:25:49 cgd Exp $ */
-
-/*
- * Copyright (c) 1994 Philip L. Budne.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Philip L. Budne.
- * 4. The name of Philip L. Budne may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY PHILIP NELSON ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL PHILIP NELSON BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * pc532 standalone machdep code
- * Phil Budne, May 10, 1994
- *
- */
-
-#include <sys/types.h>
-#include "samachdep.h"
-
-int testing = 0;
-
-void
-bzero( char *addr, int len )
-{
- while (len-- > 0)
- *addr++ = '\0';
-}
-
-/* XXX TEMP; would like to use code more like hp300 scsi.c */
-
-void
-scsiinit(void)
-{
-}
-
-int
-scsialive(int ctlr)
-{
- return 1; /* controller always alive! */
-}
-
-/* call functions in scsi_hi.c */
-#include "so.h"
-
-int
-scsi_tt_read(ctlr, slave, buf, len, blk, nblk)
- int ctlr, slave;
- u_char *buf;
- u_int len;
- daddr_t blk;
- u_int nblk;
-{
-#if 0
-printf("scsi_tt_read ctlr %d, slave %d, len %d, blk %d, nblk %d\n",
- ctlr, slave, len, blk, nblk );
-#endif
- if (sc_rdwt(DISK_READ, blk, buf, nblk, 1<<slave, 0) == 0)
- return 0;
- return -2;
-}
-
-int
-scsi_tt_write(ctlr, slave, buf, len, blk, nblk)
- int ctlr, slave;
- u_char *buf;
- u_int len;
- daddr_t blk;
- u_int nblk;
-{
-#if 0
- if (sc_rdwt(DISK_WRITE, blk, buf, nblk, 1<<slave, 0) == 0)
- return 0;
-#endif
- return -2;
-}
diff --git a/sys/arch/pc532/stand/prf.c b/sys/arch/pc532/stand/prf.c
deleted file mode 100644
index e9db7e63e57..00000000000
--- a/sys/arch/pc532/stand/prf.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/* $NetBSD: prf.c,v 1.2 1994/10/26 08:25:50 cgd Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)prf.c 8.1 (Berkeley) 6/10/93
- */
-
-getchar()
-{
- register int c;
-
- while((c = cngetc()) == 0)
- ;
- if (c == '\r')
- c = '\n';
- else if (c == ('c'&037)) {
- panic("^C");
- /* NOTREACHED */
- }
- if (c != '\b' && c != '\177')
- putchar(c);
- return(c);
-}
-
-tgetchar()
-{
- register int c;
-
- if ((c = cngetc()) == 0)
- return(0);
-
- if (c == '\r')
- c = '\n';
- else if (c == ('c'&037)) {
- panic("^C");
- /* NOTREACHED */
- }
- if (c != '\b' && c != '\177')
- putchar(c);
- return(c);
-}
-
-putchar(c)
- register int c;
-{
- cnputc(c);
- if (c == '\n')
- cnputc('\r');
-}
diff --git a/sys/arch/pc532/stand/rd.c b/sys/arch/pc532/stand/rd.c
deleted file mode 100644
index 4f3c3620a68..00000000000
--- a/sys/arch/pc532/stand/rd.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <sys/param.h>
-#include "stand.h"
-#include "samachdep.h"
-
-#ifndef RD_START
-#define RD_START 0x288000
-#endif
-
-rdopen(f, ctlr, unit, part)
- struct open_file *f;
- int ctlr, unit, part;
-{
- f->f_devdata = (void *) RD_START;
- return(0);
-}
-
-int
-rdstrategy(ss, func, dblk, size, buf, rsize)
- void *ss;
- int func;
- daddr_t dblk; /* block number */
- u_int size; /* request size in bytes */
- void *buf;
- u_int *rsize; /* out: bytes transferred */
-{
- memcpy(buf, ss + (dblk << DEV_BSHIFT), size);
- *rsize = size;
- return(0);
-}
diff --git a/sys/arch/pc532/stand/samachdep.h b/sys/arch/pc532/stand/samachdep.h
deleted file mode 100644
index a48383f54d5..00000000000
--- a/sys/arch/pc532/stand/samachdep.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* $NetBSD: samachdep.h,v 1.2 1994/10/26 08:25:51 cgd Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)samachdep.h 8.1 (Berkeley) 6/10/93
- */
-
-#define NSCSI 1
-#define NSD 8
-
-extern int howto;
-extern unsigned int bootdev;
diff --git a/sys/arch/pc532/stand/scn.c b/sys/arch/pc532/stand/scn.c
deleted file mode 100644
index b8637d16c38..00000000000
--- a/sys/arch/pc532/stand/scn.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/* $NetBSD: scn.c,v 1.3 1995/08/29 21:55:49 phil Exp $ */
-
-/*-
- * Copyright (c) 1994 Philip L. Budne.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Philip L. Budne.
- * 4. The name of Philip L. Budne may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY PHILIP BUDNE ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL PHILIP BUDNE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * scn.c -- scn2681/2692/68881 standalone console driver
- * Phil Budne, May 10, 1994
- *
- */
-
-#ifdef SCNCONSOLE
-#include <sys/types.h>
-#include <dev/cons.h>
-
-#define DUART 0x28000000
-
-/* registers */
-#define SCN_STAT 1
-#define SCN_DATA 3
-
-/* status bits */
-#define STAT_RXRDY 0x01
-#define STAT_TXRDY 0x04
-
-#ifndef SCNCNUNIT
-#define SCNCNUNIT 0
-#endif
-
-unsigned char * volatile scncnaddr = (unsigned char *) DUART + 8 * SCNCNUNIT;
-
-scnprobe(cp)
- struct consdev *cp;
-{
- /* the only game in town */
- cp->cn_pri = CN_NORMAL; /* XXX remote? */
-}
-
-scninit(cp)
- struct consdev *cp;
-{
- /* leave things they way the PROM set them */
-}
-
-scngetchar(cp)
- struct consdev *cp;
-{
- register unsigned char * volatile scn = scncnaddr;
-
- if ((scn[SCN_STAT] & STAT_RXRDY) == 0)
- return(0);
- return scn[SCN_DATA];
-}
-
-scnputchar(cp, c)
- struct consdev *cp;
- register int c;
-{
- register unsigned char * volatile scn = scncnaddr;
- register int timo;
- short stat;
-
- /* wait a reasonable time for the transmitter to come ready */
- timo = 50000;
- while (((stat = scn[SCN_STAT]) & STAT_TXRDY) == 0 && --timo)
- ;
- scn[SCN_DATA] = c;
-#if 0
- /* wait for this transmission to complete */
- timo = 1000000;
- while (((stat = scn[SCN_STAT]) & STAT_TXRDY) == 0 && --timo)
- ;
-#endif
-}
-#endif
diff --git a/sys/arch/pc532/stand/scsi_hi.c b/sys/arch/pc532/stand/scsi_hi.c
deleted file mode 100644
index 866273596d5..00000000000
--- a/sys/arch/pc532/stand/scsi_hi.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/* $NetBSD: scsi_hi.c,v 1.3 1994/10/26 08:25:53 cgd Exp $ */
-
-/****************************************************************************
- * NS32K Monitor SCSI high-level driver
- * Bruce Culbertson
- * 8 March 1990
- * (This source is public domain source)
- *
- * There are three monitor SCSI commands. "Read" and "write" I think are
- * fairly self explanatory once you read the help messages. They, in fact,
- * execute the "extended read", "extended write", and "request sense"
- * commands from the SCSI standard.
- *
- * "Raw" lets you execute any SCSI command but you need a SCSI reference to
- * know what the commands are and what their formats are. The SCSI
- * standard specifies that there are six buffers which, for example, hold a
- * SCSI command or are the source or destination for data. You provide
- * "raw" with an array of pointers to the six buffers. Using "edit", you
- * can enter a SCSI command somewhere in memory and you can create the
- * array of pointers. The array must actually be eight entries long; two
- * entries are not used. By typing "raw <array address>", the SCSI command
- * is executed.
- *
- * By the way, "read", "write", and "raw" talk only to the DP8490 SCSI
- * controller. I have not had time to read the Adaptec data sheet and
- * write a driver for it.
- ****************************************************************************/
-#include "so.h"
-
-#define OK 0
-#define NOT_OK OK+1
-#define PRIVATE
-#define PUBLIC
-#define U8 unsigned char
-
-long scsiAdr = DEFAULT_SCSI_ADR, /* default SCSI address */
- scsiLun = DEFAULT_SCSI_LUN;
-
-struct cmd_desc { /* SCSI command description */
- const U8 *cmd; /* command string */
- const U8 *odata; /* data to output, if any */
- const struct cmd_desc *chain; /* next command */
-};
-
-struct drive { /* SCSI drive description */
- U8 adr, lun; /* SCSI address and LUN */
- U8 flags; /* drive characteristics */
- U8 stat; /* drive state */
- const struct cmd_desc *init; /* list of initialize commands */
-};
-/* for drive.flags */
-#define EXTENDED_RDWR 1 /* device does extended read, write */
-#define EXTENDED_SENSE 2 /* device does extended sense */
-/* for drive.stat */
-#define INITIALIZED 1 /* device is initialized */
-
-#ifdef OMTI
-/* These SCSI commands initialize a OMTI 5200 SCSI controller with a 360K
- * floppy at LUN=1 and an ST-225 at LUN=0.
- */
-const U8 floppy_parms_cmd[] = {0xc2, 0x20, 0, 0, 0, 0};
-const U8 floppy_parms_data[] = {0, 3, 0x27, 0xa, 0, 0, 0, 0x80, 1, 0};
-const U8 floppy_format_cmd[] = {0xc0, 0x20, 0, 0, 9, 0x8b};
-const U8 floppy_recal_cmd[] = {1, 0x20, 0, 0, 0, 0};
-const U8 wini_parms_cmd[] = {0xc2, 0, 0, 0, 0, 0};
-const U8 wini_parms_data[] = {0, 0, 0, 3, 2, 0x63, 0, 1, 0x10, 0};
-const U8 wini_recal_cmd[] = {1, 0, 0, 0, 0, 0};
-const struct cmd_desc floppy_init2 =
- {floppy_recal_cmd, 0, 0};
-const struct cmd_desc floppy_init1 =
- {floppy_format_cmd, 0, &floppy_init2};
-const struct cmd_desc floppy_init0 =
- {floppy_parms_cmd, floppy_parms_data, &floppy_init1};
-const struct cmd_desc wini_init1 =
- {wini_recal_cmd, 0, 0};
-const struct cmd_desc wini_init0 =
- {wini_parms_cmd, wini_parms_data, &wini_init1};
-#endif
-
-PRIVATE struct drive drive_tbl[] = {
-#ifdef OMTI
- {1, 0, 0, 0, &wini_init0},
- {1, 1, 0, 0, &floppy_init0},
-#endif
- {0, 0, EXTENDED_RDWR | EXTENDED_SENSE, 1, 0},
-};
-#define DRV_TBL_SZ (sizeof (drive_tbl) / sizeof (struct drive))
-
-/* Round up to multiple of four since SCSI transfers are always multiples
- * of four bytes.
- */
-#define CMD_LEN 12 /* longest SCSI command */
-#define SENSE_LEN 24 /* extended sense length */
-#define MSG_LEN 4
-#define STAT_LEN 4
-
-#define MAX_SCSI_RETRIES 6
-#define CMD_IX 2
-#define CMD_SENSE 0x03
-#define CMD_READ 0x08
-#define CMD_WRITE 0x0a
-#define CMD_XREAD 0x28
-#define CMD_XWRITE 0x2a
-PRIVATE U8 cmd_buf[CMD_LEN];
-
-#define SENSE_KEY 2
-#define NO_SENSE 0
-#define RECOVERY_ERR 1
-#define UNIT_ATTN 6
-#define ADD_SENSE_CODE 12
-#define SENSE_RST 0x29
-PRIVATE U8 sense_buf[SENSE_LEN];
-
-#define CHECK_CONDITION 2
-#define STAT_IX 3
-#define STAT_MASK 0x1f
-PRIVATE U8 stat_buf[STAT_LEN];
-#define IMSG_IX 7
-PRIVATE U8 msg_buf[MSG_LEN];
-
-#define ODATA_IX 0
-#define IDATA_IX 1
-PRIVATE struct scsi_args scsi_args;
-
-/*===========================================================================*
- * sc_rdwt *
- *===========================================================================*/
-/* Carry out a read or write request for the SCSI disk. */
-PRIVATE int
-sc_rdwt(op, block, ram_adr, len, sc_adr, lun)
-long block, ram_adr, len, sc_adr, lun;
-{
- int retries, ret;
- U8 *p;
- struct drive *dp;
-
- /* get drive characteristics */
- for (dp = drive_tbl; dp < drive_tbl + DRV_TBL_SZ - 1; ++dp)
- if (dp->adr == sc_adr && dp->lun == lun) break;
- if (dp == drive_tbl + DRV_TBL_SZ - 1) {
- dp->adr = sc_adr; /* have default, set adr, lun */
- dp->lun = lun;
- }
- for (retries = 0; retries < MAX_SCSI_RETRIES; ++retries) {
- if (dp->init && !(dp->stat & INITIALIZED))
- if (OK != sc_initialize (dp)) {
- printf("SCSI cannot initialize device\n");
- return NOT_OK;
- }
- p = cmd_buf; /* build SCSI command */
- if (dp->flags & EXTENDED_RDWR) { /* use extended commands */
- *p++ = (op == DISK_READ)? CMD_XREAD: CMD_XWRITE;
- *p++ = lun << 5;
- *p++ = (block >> 24) & 0xff;
- *p++ = (block >> 16) & 0xff;
- *p++ = (block >> 8) & 0xff;
- *p++ = (block >> 0) & 0xff;
- *p++ = 0;
- *p++ = (len >> 8) & 0xff;
- *p++ = (len >> 0) & 0xff;
- *p = 0;
- } else { /* use short (SASI) commands */
- *p++ = (op == DISK_READ)? CMD_READ: CMD_WRITE;
- *p++ = (lun << 5) | ((block >> 16) & 0x1f);
- *p++ = (block >> 8) & 0xff;
- *p++ = (block >> 0) & 0xff;
- *p++ = len;
- *p = 0;
- }
- if (op == DISK_READ)
- ret = exec_scsi_hi (cmd_buf, (U8 *)ram_adr, (U8 *)0, dp);
- else
- ret = exec_scsi_hi (cmd_buf, (U8 *)0, (U8 *)ram_adr, dp);
- if (OK == ret) return OK;
- dp->stat &= ~INITIALIZED;
- }
- printf("SCSI %s, block %d failed even after retries\n",
- op == DISK_READ? "READ": "WRITE", block);
- return NOT_OK;
-}
-
-/*===========================================================================*
- * sc_initialize *
- *===========================================================================*/
-/* Execute the list of initialization commands for the given drive.
- */
-int
-sc_initialize (dp)
-struct drive *dp;
-{
- const struct cmd_desc *cp;
-
- for (cp = dp->init; cp != 0; cp = cp->chain)
- if (OK != exec_scsi_hi (cp->cmd, 0, cp->odata, dp)) {
- dp->stat &= ~INITIALIZED;
- return NOT_OK;
- }
- dp->stat |= INITIALIZED;
- return OK;
-}
-
-/*===========================================================================*
- * exec_scsi_hi *
- *===========================================================================*/
-/* Execute a "high-level" SCSI command. This means execute a low level
- * command and, if it fails, execute a request sense to find out why.
- */
-PRIVATE int
-exec_scsi_hi(cmd, data_in, data_out, dp)
-U8 *cmd, *data_out, *data_in;
-struct drive *dp;
-{
- scsi_args.ptr[CMD_IX] = (long)cmd;
- scsi_args.ptr[STAT_IX] = (long)stat_buf;
- scsi_args.ptr[IMSG_IX] = (long)msg_buf;
- scsi_args.ptr[IDATA_IX] = (long)data_in;
- scsi_args.ptr[ODATA_IX] = (long)data_out;
- if (OK != exec_scsi_low (&scsi_args, dp->adr))
- return NOT_OK;
- *stat_buf &= STAT_MASK; /* strip off lun */
- if (*stat_buf == 0)
- /* Success -- this should be the usual case */
- return OK;
- if (*stat_buf != CHECK_CONDITION) {
- /* do not know how to handle this so return error */
- printf("SCSI device returned unknown status: %d\n", *stat_buf);
- return NOT_OK;
- }
- /* Something funny happened, need to execute request-sense command
- * to learn more.
- */
- if (OK == get_sense(dp))
- /* Something funny happened, but the device recovered from it and
- * the command succeeded.
- */
- return OK;
- return NOT_OK;
-}
-
-/*===========================================================================*
- * get_sense *
- *===========================================================================*/
-/* Execute a "request sense" SCSI command and check results. When a SCSI
- * command returns CHECK_CONDITION, a request-sense command must be executed.
- * A request-sense command provides information about the original command.
- * The original command might have succeeded, in which case it does not
- * need to be retried and OK is returned. Examples: read error corrected
- * with error correction code, or error corrected by retries performed by
- * the SCSI device. The original command also could have failed, in
- * which case NOT_OK is returned.
- */
-#define XLOGICAL_ADR \
- (sense_buf[3]<<24 | sense_buf[4]<<16 | sense_buf[5]<<8 | sense_buf[6])
-#define LOGICAL_ADR \
- (sense_buf[1]<<16 | sense_buf[2]<<8 | sense_buf[3])
-
-PRIVATE int
-get_sense (dp)
-struct drive *dp;
-{
- U8 *p;
-
- p = cmd_buf; /* build SCSI command */
- *p++ = CMD_SENSE;
- *p++ = dp->lun << 5;
- *p++ = 0;
- *p++ = 0;
- *p++ = (dp->flags & EXTENDED_SENSE)? SENSE_LEN: 0;
- *p = 0;
- scsi_args.ptr[IDATA_IX] = (long)sense_buf;
- scsi_args.ptr[ODATA_IX] = 0;
- scsi_args.ptr[CMD_IX] = (long)cmd_buf;
- scsi_args.ptr[STAT_IX] = (long)stat_buf;
- scsi_args.ptr[IMSG_IX] = (long)msg_buf;
- if (OK != exec_scsi_low (&scsi_args, dp->adr)) {
- printf("SCSI SENSE command failed\n");
- return NOT_OK;
- }
- if ((*stat_buf & STAT_MASK) != 0) {
- printf("SCSI SENSE returned wrong status %d\n", *stat_buf);
- return NOT_OK;
- }
- if (0 == (dp->flags & EXTENDED_SENSE)) {
- printf("SCSI request sense, code 0x%x, log_adr 0x%x\n",
- sense_buf[0], LOGICAL_ADR);
- return NOT_OK;
- }
- switch (sense_buf[SENSE_KEY] & 0xf) {
- case NO_SENSE:
- case UNIT_ATTN: /* reset */
- return NOT_OK; /* must retry command */
- case RECOVERY_ERR:
- /* eventually, we probably do not want to hear about these. */
- printf("SCSI ok with recovery, code 0x%x, logical address 0x%x\n",
- sense_buf[ADD_SENSE_CODE], XLOGICAL_ADR);
- return OK; /* orig command was ok with recovery */
- default:
- printf("SCSI failure: key 0x%x code 0x%x log adr 0x%x sense buf 0x%x\n",
- sense_buf[SENSE_KEY], sense_buf[ADD_SENSE_CODE],
- XLOGICAL_ADR, sense_buf);
- return NOT_OK; /* orig command failed */
- }
-}
diff --git a/sys/arch/pc532/stand/scsi_low.c b/sys/arch/pc532/stand/scsi_low.c
deleted file mode 100644
index 6fd2bc643f8..00000000000
--- a/sys/arch/pc532/stand/scsi_low.c
+++ /dev/null
@@ -1,426 +0,0 @@
-/* $NetBSD: scsi_low.c,v 1.4 1994/12/09 21:04:42 phil Exp $ */
-
-/****************************************************************************
- * NS32K Monitor SCSI low-level driver
- * Bruce Culbertson
- * 8 March 1990
- * (This source is public domain source.)
- *
- * Originally written by Bruce Culbertson for a ns32016 port of Minix.
- * Adapted from that for the pc532 (ns32632) monitor.
- * Adapted from that for NetBSD/pc532 by Philip L. Bunde.
- *
- * Do not use DMA -- makes 32016 and pc532 versions compatible.
- * Do not use interrupts -- makes it harder for the user code to bomb
- * this code.
- ****************************************************************************/
-
-#include "so.h"
-
-#define OK 0
-#define NOT_OK OK+1
-#define PRIVATE
-#define PUBLIC
-#define WR_ADR(adr,val) (*((volatile unsigned char *)(adr))=(val))
-#define RD_ADR(adr) (*((volatile unsigned char *)(adr)))
-#define AIC6250 0
-#define DP8490 1
-#define MAX_CACHE 0x10000
-
-/* SCSI bus phases
- */
-#define PH_ODATA 0
-#define PH_IDATA 1
-#define PH_CMD 2
-#define PH_STAT 3
-#define PH_IMSG 7
-#define PH_NONE 8
-#define PH_IN(phase) ((phase) & 1)
-
-/* NCR5380 SCSI controller registers
- */
-#define SC_CTL 0x30000000 /* base for control registers */
-#define SC_DMA 0x38000000 /* base for data registers */
-#define SC_CURDATA SC_CTL+0
-#define SC_OUTDATA SC_CTL+0
-#define SC_ICMD SC_CTL+1
-#define SC_MODE SC_CTL+2
-#define SC_TCMD SC_CTL+3
-#define SC_STAT1 SC_CTL+4
-#define SC_STAT2 SC_CTL+5
-#define SC_START_SEND SC_CTL+5
-#define SC_INDATA SC_CTL+6
-#define SC_RESETIP SC_CTL+7
-#define SC_START_RCV SC_CTL+7
-
-/* Bits in NCR5380 registers
- */
-#define SC_A_RST 0x80
-#define SC_A_SEL 0x04
-#define SC_S_SEL 0x02
-#define SC_S_REQ 0x20
-#define SC_S_BSY 0x40
-#define SC_S_BSYERR 0x04
-#define SC_S_PHASE 0x08
-#define SC_S_IRQ 0x10
-#define SC_S_DRQ 0x40
-#define SC_M_DMA 0x02
-#define SC_M_BSY 0x04
-#define SC_ENABLE_DB 0x01
-
-/* Status of interrupt routine, returned in m1_i1 field of message.
- */
-#define ISR_NOTDONE 0
-#define ISR_OK 1
-#define ISR_BSYERR 2
-#define ISR_RSTERR 3
-#define ISR_BADPHASE 4
-#define ISR_TIMEOUT 5
-
-#define ICU_ADR 0xfffffe00
-#define ICU_IO (ICU_ADR+20)
-#define ICU_DIR (ICU_ADR+21)
-#define ICU_DATA (ICU_ADR+19)
-#define ICU_SCSI_BIT 0x80
-
-/* Miscellaneous
- */
-#define MAX_WAIT 2000000
-#define SC_LOG_LEN 32
-
-PRIVATE struct scsi_args *sc_ptrs;
-PRIVATE char sc_cur_phase,
- sc_reset_done = 1,
- sc_have_msg,
- sc_accept_int,
- sc_dma_dir;
-
-long sc_dma_port = SC_DMA,
- sc_dma_adr;
-
-#ifdef DEBUG
-struct sc_log {
- unsigned char stat1, stat2;
-} sc_log [SC_LOG_LEN],
- *sc_log_head = sc_log;
-int sc_spurious_int;
-#endif
-unsigned char
- sc_watchdog_error; /* watch dog error */
-
-/* error messages */
-char *scsi_errors[] = {
- 0, /* ISR_NOTDONE */
- 0, /* ISR_OK */
- "busy error", /* ISR_BSYERR */
- "reset error", /* ISR_RSTERR */
- "NULL pointer for current phase", /* ISR_BADPHASE */
- "timeout", /* ISR_TIMEOUT */
-};
-
-/*===========================================================================*
- * exec_scsi_low *
- *===========================================================================*/
-/* Execute a generic SCSI command. Passed pointers to eight buffers:
- * data-out, data-in, command, status, dummy, dummy, message-out, message-in.
- */
-PUBLIC
-int
-exec_scsi_low (args, scsi_adr)
-struct scsi_args *args;
-long scsi_adr;
-{
- int ret;
-
- sc_ptrs = args; /* make pointers globally accessible */
- scCtlrSelect (DP8490);
- if (!sc_reset_done) sc_reset();
- /* TCMD has some undocumented behavior in initiator mode. I think the
- * data bus cannot be enabled if i/o is asserted.
- */
- WR_ADR (SC_TCMD, 0);
- if (OK != sc_wait_bus_free ()) { /* bus-free phase */
- printf("SCSI: bus not free\n");
- return NOT_OK;
- }
- sc_cur_phase = PH_NONE;
- sc_have_msg = 0;
- if (OK != sc_select (scsi_adr)) /* select phase */
- return NOT_OK;
- sc_watchdog_error = 0;
- ret = sc_receive (); /* isr does the rest */
- if (ret == ISR_OK) return OK;
- else {
- sc_reset();
- printf("SCSI: %s\n", scsi_errors[ret]);
- return NOT_OK;
- }
-}
-
-/*===========================================================================*
- * sc_reset *
- *===========================================================================*/
-/*
- * Reset SCSI bus.
- */
-PRIVATE
-sc_reset()
-{
- volatile int i;
-
- WR_ADR (SC_MODE, 0); /* get into harmless state */
- WR_ADR (SC_OUTDATA, 0);
- WR_ADR (SC_ICMD, SC_A_RST); /* assert RST on SCSI bus */
- i = 200; /* wait 25 usec */
- while (i--);
- WR_ADR (SC_ICMD, 0); /* deassert RST, get off bus */
- sc_reset_done = 1;
-}
-
-/*===========================================================================*
- * sc_wait_bus_free *
- *===========================================================================*/
-PRIVATE int
-sc_wait_bus_free()
-{
- int i = MAX_WAIT;
- volatile int j;
-
- while (i--) {
- /* Must be clear for 2 usec, so read twice */
- if (RD_ADR (SC_STAT1) & (SC_S_BSY | SC_S_SEL)) continue;
- for (j = 0; j < 25; ++j);
- if (RD_ADR (SC_STAT1) & (SC_S_BSY | SC_S_SEL)) continue;
- return OK;
- }
- sc_reset_done = 0;
- return NOT_OK;
-}
-
-/*===========================================================================*
- * sc_select *
- *===========================================================================*/
-/* This duplicates much of the work that the interrupt routine would do on a
- * phase mismatch and, in fact, the original plan was to just do the select,
- * let a phase mismatch occur, and let the interrupt routine do the rest.
- * That didn't work because the 5380 did not reliably generate the phase
- * mismatch interrupt after selection.
- */
-PRIVATE int
-sc_select(adr)
-long adr;
-{
- int i, stat1;
- long new_ptr;
-
- WR_ADR (SC_OUTDATA, adr); /* SCSI bus address */
- WR_ADR (SC_ICMD, SC_A_SEL | SC_ENABLE_DB);
- for (i = 0;; ++i) { /* wait for target to assert SEL */
- stat1 = RD_ADR (SC_STAT1);
- if (stat1 & SC_S_BSY) break; /* select successful */
- if (i > MAX_WAIT) { /* timeout */
- printf("SCSI: SELECT timeout\n");
- sc_reset();
- return NOT_OK;
- }
- }
- WR_ADR (SC_ICMD, 0); /* clear SEL, disable data out */
- WR_ADR (SC_OUTDATA, 0);
- for (i = 0;; ++i) { /* wait for target to assert REQ */
- if (stat1 & SC_S_REQ) break; /* target requesting transfer */
- if (i > MAX_WAIT) { /* timeout */
- printf("SCSI: REQ timeout\n");
- sc_reset();
- return NOT_OK;
- }
- stat1 = RD_ADR (SC_STAT1);
- }
- sc_cur_phase = (stat1 >> 2) & 7; /* get new phase from controller */
- if (sc_cur_phase != PH_CMD) {
- printf("SCSI: bad phase = %d\n", sc_cur_phase);
- sc_reset();
- return NOT_OK;
- }
- new_ptr = sc_ptrs->ptr[PH_CMD];
- if (new_ptr == 0) {
- printf("SCSI: NULL command pointer\n");
- sc_reset();
- return NOT_OK;
- }
- sc_accept_int = 1;
- sc_dma_setup (DISK_WRITE, new_ptr);
- WR_ADR (SC_TCMD, PH_CMD);
- WR_ADR (SC_ICMD, SC_ENABLE_DB);
- WR_ADR (SC_MODE, SC_M_BSY | SC_M_DMA);
- WR_ADR (SC_START_SEND, 0);
- return OK;
-}
-
-/*===========================================================================*
- * scsi_interrupt *
- *===========================================================================*/
-/* SCSI interrupt handler.
- */
-PUBLIC
-int
-scsi_interrupt()
-{
- unsigned char stat2, dummy;
- long new_ptr;
- int ret = ISR_NOTDONE;
-
- stat2 = RD_ADR (SC_STAT2); /* get status before clearing request */
-
-# ifdef DEBUG /* debugging log of interrupts */
- sc_log_head->stat1 = RD_ADR (SC_STAT1);
- sc_log_head->stat2 = stat2;
- if (++sc_log_head >= sc_log + SC_LOG_LEN) sc_log_head = sc_log;
- sc_log_head->stat1 = sc_log_head->stat2 = 0xff;
-# endif
-
- for (;;) {
- dummy = RD_ADR (SC_RESETIP); /* clear interrupt request */
- if (!sc_accept_int || /* return if spurious interrupt */
- (!sc_watchdog_error &&
- (stat2 & SC_S_BSYERR) == 0 && (stat2 & SC_S_PHASE) == 1))
- {
-# ifdef DEBUG
- ++sc_spurious_int;
-# endif
- return ret;
- }
- RD_ADR (SC_MODE) &= ~SC_M_DMA; /* clear DMA mode */
- WR_ADR (SC_ICMD, 0); /* disable data bus */
- if (sc_cur_phase != PH_NONE) { /* if did DMA, save the new pointer */
- new_ptr = sc_dma_adr; /* fetch new pointer from DMA cntlr */
- if (sc_cur_phase == PH_IMSG && /* have message? */
- new_ptr != sc_ptrs->ptr[PH_IMSG]) sc_have_msg = 1;
- sc_ptrs->ptr[sc_cur_phase] = /* save pointer */
- new_ptr;
- }
- if (sc_watchdog_error) ret = ISR_TIMEOUT;
- else if (stat2 & SC_S_BSYERR) { /* target deasserted BSY? */
- if (sc_have_msg) ret = ISR_OK;
- else ret = ISR_BSYERR;
- } else if (!(stat2 & SC_S_PHASE)) { /* if phase mismatch, setup new phase */
- sc_cur_phase = /* get new phase from controller */
- (RD_ADR (SC_STAT1) >> 2) & 7;
- new_ptr = sc_ptrs->ptr[sc_cur_phase];
- if (new_ptr == 0) ret = ISR_BADPHASE;
- else {
- WR_ADR (SC_TCMD, sc_cur_phase); /* write new phase into TCMD */
- if (PH_IN (sc_cur_phase)) { /* set DMA controller */
- sc_dma_setup (DISK_READ, new_ptr);
- RD_ADR (SC_MODE) |= SC_M_DMA;
- WR_ADR (SC_START_RCV, 0); /* tell SCSI to start DMA */
- } else {
- sc_dma_setup (DISK_WRITE, new_ptr);
- RD_ADR (SC_MODE) |= SC_M_DMA;
- WR_ADR (SC_ICMD, SC_ENABLE_DB);
- WR_ADR (SC_START_SEND, 0);
- }
- }
- } else ret = ISR_RSTERR;
- if (ret != ISR_NOTDONE) { /* if done, send message to task */
- sc_watchdog_error = 0;
- sc_accept_int = 0;
- WR_ADR (SC_MODE, 0); /* clear monbsy, dma */
- break; /* reti re-enables ints */
- }
- if (0 == ((stat2 = /* check for another interrupt */
- RD_ADR (SC_STAT2)) & SC_S_IRQ))
- {
- break;
- }
- }
- return ret;
-}
-
-/*===========================================================================*
- * sc_dma_setup *
- *===========================================================================*/
-/* Fake DMA setup. Just store pointers and direction in global variables.
- *
- * The pseudo-DMA is subtler than it looks because of the cache.
- *
- * 1) When accessing I/O devices through a cache, some mechanism is
- * necessary to ensure you access the device rather than the cache.
- * On the 32532, the IODEC signal is supposed to be asserted for I/O
- * addresses to accomplish this. However, a bug makes this much
- * slower than necessary and severely hurts pseudo-DMA performance.
- * Hence, IODEC is not asserted for the SCSI DMA port.
- *
- * 2) Because of (1), we must devise our own method of forcing the
- * SCSI DMA port to be read. 0x8000000 addresses have been decoded
- * to all access this port. By always using new addresses to access
- * the DMA port (wrapping only after reading MAX_CACHE bytes), we
- * force cache misses and, hence, device reads. Since the cache
- * is write-through, we do not need to worry about writes.
- *
- * 3) It is possible to miss the last few bytes of a transfer if
- * bus transfer size is not considered. The loop in sc_receive()
- * transfers data until the interrupt signal is asserted. If
- * bytes are transferred, the attempt to move the first byte of a
- * double word causes the whole word to be read into the cache.
- * Then the byte is transferred. If reading the double word
- * completed the SCSI transfer, then the loop exits since
- * interrupt is asserted. However, the last few bytes have only
- * been moved into the cache -- they have not been moved to the
- * DMA destination.
- *
- * 4) It is also possible to miss the first few bytes of a transfer.
- * If the address used to access pseudo-dma port is not double word
- * aligned, the whole double word is read into the cache, and then
- * data is moved from the middle of the word (i.e. something other
- * than the first bytes read from the SCSI controller) by the
- * pseudo-dma loop in sc_receive().
- */
-sc_dma_setup (dir, adr)
-int dir;
-long adr;
-{
- if (sc_dma_port > SC_DMA + MAX_CACHE) sc_dma_port = SC_DMA;
- sc_dma_dir = dir;
- sc_dma_adr = adr;
-}
-
-/*===========================================================================*
- * sc_receive *
- *===========================================================================*/
-/* Replacement for Minix receive(), which waits for a message. This code
- * spins, waiting for data to transfer or interrupt requests to handle.
- * See sc_dma_setup for details.
- */
-int
-sc_receive()
-{
- int stat2, isr_ret;
-
- for (;;) {
- stat2 = RD_ADR (SC_STAT2);
- if (stat2 & SC_S_IRQ) {
- if (ISR_NOTDONE != (isr_ret = scsi_interrupt())) break;
- } else if (stat2 & SC_S_DRQ) { /* test really not necessary on pc532 */
- if (sc_dma_dir == DISK_READ)
- *((long *)sc_dma_adr)++ = *((volatile long *)sc_dma_port)++;
- else *((volatile long *)sc_dma_port)++ = *((long *)sc_dma_adr)++;
- }
- }
- return isr_ret;
-}
-
-/*===========================================================================*
- * scCtlrSelect
- *===========================================================================*/
-/* Select a SCSI device.
- */
-scCtlrSelect (ctlr)
-int ctlr;
-{
- RD_ADR (ICU_IO) &= ~ICU_SCSI_BIT; /* i/o, not port */
- RD_ADR (ICU_DIR) &= ~ICU_SCSI_BIT; /* output */
- if (ctlr == DP8490)
- RD_ADR (ICU_DATA) &= ~ICU_SCSI_BIT; /* select = 0 for 8490 */
- else
- RD_ADR (ICU_DATA) |= ICU_SCSI_BIT; /* select = 1 for AIC6250 */
-}
diff --git a/sys/arch/pc532/stand/sd.c b/sys/arch/pc532/stand/sd.c
deleted file mode 100644
index ff6ea431607..00000000000
--- a/sys/arch/pc532/stand/sd.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/* $NetBSD: sd.c,v 1.4 1995/08/29 21:55:50 phil Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory and the Systems
- * Programming Group of the University of Utah Computer Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: sd.c 1.9 92/12/21$
- *
- * @(#)sd.c 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * SCSI CCS disk driver
- */
-
-#include <sys/param.h>
-#include <sys/disklabel.h>
-#include "stand.h"
-#include "samachdep.h"
-
-struct sd_softc {
- int sc_ctlr;
- int sc_unit;
- int sc_part;
- char sc_retry;
- char sc_alive;
- struct disklabel sc_label;
-} sd_softc[NSCSI][NSD];
-
-#ifdef SD_DEBUG
-int debug = SD_DEBUG;
-#endif
-
-#define SDRETRY 2
-
-sdinit(ctlr, unit)
- int ctlr, unit;
-{
- register struct sd_softc *ss = &sd_softc[ctlr][unit];
-
- /* HP version does test_unit_ready
- * followed by read_capacity to get blocksize
- */
- ss->sc_alive = 1;
- return (1);
-}
-
-sdreset(ctlr, unit)
- int ctlr, unit;
-{
-}
-
-char io_buf[MAXBSIZE];
-
-sdgetinfo(ss)
- register struct sd_softc *ss;
-{
- register struct disklabel *lp;
- char *msg, *getdisklabel();
- int sdstrategy(), i, err;
-
- lp = &sd_softc[ss->sc_ctlr][ss->sc_unit].sc_label;
- bzero((caddr_t)lp, sizeof *lp);
- lp->d_secsize = DEV_BSIZE;
- lp->d_secpercyl = 1;
- lp->d_npartitions = MAXPARTITIONS;
- lp->d_partitions[ss->sc_part].p_offset = 0;
- lp->d_partitions[ss->sc_part].p_size = 0x7fffffff;
-
- if (err = sdstrategy(ss, F_READ,
- LABELSECTOR, DEV_BSIZE, io_buf, &i) < 0) {
- printf("sdgetinfo: sdstrategy error %d\n", err);
- return 0;
- }
-
- msg = getdisklabel(io_buf, lp);
- if (msg) {
- printf("sd(%d,%d,%d): %s\n",
- ss->sc_ctlr, ss->sc_unit, ss->sc_part, msg);
- return 0;
- }
- return(1);
-}
-
-sdopen(f, ctlr, unit, part)
- struct open_file *f;
- int ctlr, unit, part;
-{
- register struct sd_softc *ss;
- register struct disklabel *lp;
-
-#ifdef SD_DEBUG
- if (debug)
- printf("sdopen: ctlr=%d unit=%d part=%d\n",
- ctlr, unit, part);
-#endif
-
- if (ctlr >= NSCSI || !scsialive(ctlr))
- return (EADAPT);
- if (unit >= NSD)
- return (ECTLR);
- ss = &sd_softc[ctlr][unit]; /* XXX alloc()? keep pointers? */
- ss->sc_part = part;
- ss->sc_unit = unit;
- ss->sc_ctlr = ctlr;
- if (!ss->sc_alive) {
- if (!sdinit(ctlr, unit))
- return (ENXIO);
- if (!sdgetinfo(ss))
- return (ERDLAB);
- }
- lp = &sd_softc[ctlr][unit].sc_label;
- if (part >= lp->d_npartitions || lp->d_partitions[part].p_size == 0)
- return (EPART);
-
- f->f_devdata = (void *)ss;
- return (0);
-}
-
-int
-sdstrategy(ss, func, dblk, size, buf, rsize)
- register struct sd_softc *ss;
- int func;
- daddr_t dblk; /* block number */
- u_int size; /* request size in bytes */
- char *buf;
- u_int *rsize; /* out: bytes transferred */
-{
- register int ctlr = ss->sc_ctlr;
- register int unit = ss->sc_unit;
- register int part = ss->sc_part;
- register struct partition *pp = &ss->sc_label.d_partitions[part];
- u_int nblk = size >> DEV_BSHIFT;
- u_int blk = dblk + pp->p_offset;
- char stat;
-
- if (size == 0)
- return(0);
-
- ss->sc_retry = 0;
-
-#ifdef SD_DEBUG
- if (debug)
- printf("sdstrategy(%d,%d): size=%d blk=%d nblk=%d\n",
- ctlr, unit, size, blk, nblk);
-#endif
-
-retry:
- if (func == F_READ)
- stat = scsi_tt_read(ctlr, unit, buf, size, blk, nblk);
- else
- stat = scsi_tt_write(ctlr, unit, buf, size, blk, nblk);
- if (stat) {
- printf("sd(%d,%d,%d): block=%x, error=0x%x\n",
- ctlr, unit, ss->sc_part, blk, stat);
- if (++ss->sc_retry > SDRETRY)
- return(EIO);
- goto retry;
- }
- *rsize = size;
-
- return(0);
-}
diff --git a/sys/arch/pc532/stand/so.h b/sys/arch/pc532/stand/so.h
deleted file mode 100644
index 63c85ef9d5a..00000000000
--- a/sys/arch/pc532/stand/so.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* $NetBSD: so.h,v 1.2 1994/10/26 08:25:57 cgd Exp $ */
-
-#ifndef _SO_H_INCLUDE
-#define _SO_H_INCLUDE
-
-/* Definitions for standalone I/O lib */
-
-#define DUART0 0x28000000
-#define DUART1 0x28000020
-#define DUART2 0x28000040
-#define DUART3 0x28000060
-#define PARRDU 0x28000080
-#define PARCLU 0x280000A0
-#define SCSI_POLLED 0x30000000
-#define SCSI_DMA 0x38000000
-#define ICU_ADDR 0xFFFFFE00
-
-/* Which UART to use by default */
-#define DEFAULT_UART 0
-
-/* Which SCSI device to use by default */
-#define DEFAULT_SCSI_ADR 1
-#define DEFAULT_SCSI_LUN 0
-
-/* Low level scsi operation codes */
-#define DISK_READ 3
-#define DISK_WRITE 4
-
-/* The size of a disk block */
-#define DBLKSIZE 512
-
-/* Some disk address that will never be used */
-#define INSANE_BADDR 0x800000
-
-struct scsi_args {
- long ptr [8];
-};
-
-#ifndef NULL
-#define NULL 0L
-#endif
-
-/*
- * The next macro defines where the "break" area in memory ends for
- * malloc() and friends. The area between edata and this address will
- * then be reserved and should not be used for anything else (or you will
- * no doubt have big problems). Depending on where your program's end-of-data
- * is, you may wish to locate this in such a way as to usurp a minimum
- * amount of memory.
- */
-#define BREAK_END_ADDR ((char *)0x400000) /* to 4MB */
-
-/* Selectivly enable inline functions */
-#ifndef NO_INLINE
-#define Inline inline
-#else
-#define Inline
-#endif
-
-extern void fatal(), warn();
-extern long ulimit(int, long);
-extern int brk(char *);
-extern char *sbrk(int);
-
-extern int sc_rdwt();
-
-#endif /* _SO_H_INCLUDE */
diff --git a/sys/arch/pc532/stand/srt0.s b/sys/arch/pc532/stand/srt0.s
deleted file mode 100644
index fe7eaa8c127..00000000000
--- a/sys/arch/pc532/stand/srt0.s
+++ /dev/null
@@ -1,91 +0,0 @@
-/* $NetBSD: srt0.s,v 1.3 1995/08/29 21:55:51 phil Exp $ */
-
-/*-
- * Copyright (c) 1994 Philip L. Budne.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Philip L. Budne.
- * 4. The name of Philip L. Budne may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY PHILIP NELSON ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL PHILIP NELSON BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * srt0.s -- standalone C startup
- * Phil Budne, May 10, 1994
- *
- * from: pc532 kernel locore.s
- * Phil Nelson, Dec 6, 1992
- *
- */
-
-#define PSR_S 0x200
-#define PSR_I 0x800
-
-.data
-.globl _howto, _bootdev, _r3, _r6, _r7
-__save_sp: .long 0
-__save_fp: .long 0
-_bootdev: .long 0
-_howto: .long 0
-_r3: .long 0
-_r6: .long 0
-_r7: .long 0
-
-.text
-.globl begin
-begin:
- bicpsrw PSR_I /* make sure interrupts are off. */
- bicpsrw PSR_S /* make sure we are using sp0. */
-
- /* In case we are zboot: */
- movd r3,_r3(pc) /* magic */
- movd r6,_r6(pc) /* devtype */
- movd r7,_r7(pc) /* howto */
-
- lprd sb, 0 /* gcc expects this. */
- sprd sp, __save_sp(pc) /* save monitor's sp. */
- sprd fp, __save_fp(pc) /* save monitor's fp. */
-/* sprd intbase, __old_intbase(pc) /* save monitor's intbase. */
- movqd 0, _howto(pc)
-
-restart:
- /* Zero the bss segment. */
- addr _end(pc),r0 # setup to zero the bss segment.
- addr _edata(pc),r1
- subd r1,r0 # compute _end - _edata
- movd r0,tos # push length
- addr _edata(pc),tos # push address
-
- movqd 0,_bootdev(pc) # XXX trash bootdev
- bsr _bzero # zero the bss segment
- bsr _main
- /* fall */
-
-.globl __rtt
-__rtt: lprd sp, __save_sp(pc) /* restore monitor's sp. */
- lprd fp, __save_fp(pc) /* restore monitor's fp. */
-/* XXX just return to monitor??? */
- movqd 3, _howto /* RB_SINGLE|RB_ASKNAME */
- br restart
diff --git a/sys/arch/pc532/stand/test.c b/sys/arch/pc532/stand/test.c
deleted file mode 100644
index 9d41480cb19..00000000000
--- a/sys/arch/pc532/stand/test.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/* $NetBSD: test.c,v 1.2 1994/10/26 08:25:59 cgd Exp $ */
-
-/*-
- * Copyright (c) 1994 Philip L. Budne.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Philip L. Budne.
- * 4. The name of Philip L. Budne may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY PHILIP BUDNE ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL PHILIP BUDNE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*-
- * Allow test of "boot" (and presumably other "stand" utils)
- * under user mode.
- *
- * Phil Budne <phil@ultimate.com> May 10, 1994
- */
-
-/* my /sys/sys/syscall.h is out of sync w.r.t. lseek?? */
-#include "/usr/include/sys/syscall.h"
-#include <sys/types.h>
-
-extern int errno;
-
-int testing = 1;
-int bootdev;
-int howto;
-
-_open( char *fname, int mode )
-{
- return syscall( SYS_open, fname, mode );
-}
-
-_read( int fd, char *buf, int len )
-{
- return syscall( SYS_read, fd, buf, len );
-}
-
-_write( int fd, char *buf, int len )
-{
- return syscall( SYS_write, fd, buf, len );
-}
-
-/*
- * I'd like to strangle the jerk who thought it
- * was a cool idea to change lseek, rather than creating
- * a new "qseek" to handle long long offsets
- */
-_lseek( int fd, off_t pos, int whence )
-{
- return syscall( SYS_lseek, fd, 0, pos, whence );
-}
-
-int fd = -1;
-
-opendisk(int unit)
-{
- char fname[32];
- static int _unit = -1;
-
- if (unit == _unit)
- return;
-
- if (fd >= 0) {
- close(fd);
- fd = -1;
- }
- _unit = unit;
-
-#if 0
- sprintf( fname, "/dev/r%s%dc", "sd", unit );
-#else
- strcpy( fname, "/dev/rsd0c" );
-#endif
- fd = _open( fname, 0 );
- if (fd < 0) {
- printf("open %s failed\n", fname );
- return;
- }
- printf("opened %s (fd %d)\n", fname, fd );
-}
-
-void
-bzero( char *addr, int len )
-{
- while (len-- > 0)
- *addr++ = '\0';
-}
-
-/* XXX TEMP; would like to use code more like hp300 scsi.c */
-
-void
-scsiinit(void)
-{
-}
-
-int
-scsialive(int ctlr)
-{
- return 1; /* controller always alive! */
-}
-
-#define BPS 512
-scsi_tt_read(ctlr, slave, buf, len, blk, nblk)
- char *buf;
-{
- int pos;
-#if 0
-printf("scsi_tt_read(ctlr %d, slave %d, buf 0x%x, len %d, blk %d, nblk %d)\n",
- ctlr, slave, buf, len, blk, nblk);
-#endif
-
- opendisk(slave);
-
- pos = _lseek( fd, blk * BPS, 0 );
- if (pos != blk * BPS) {
- printf("lseek pos %d error %d\n", pos, errno );
- return errno;
- }
- if (_read( fd, buf, nblk * BPS ) != nblk * BPS) {
- printf("read errno %d\n", errno );
- return errno;
- }
- return 0;
-}
-
-scsi_tt_write()
-{
- return -1;
-}
-
-#include <sys/types.h>
-#include <dev/cons.h>
-
-scnprobe(cp)
- struct consdev *cp;
-{
- /* the only game in town */
- cp->cn_pri = CN_NORMAL; /* XXX remote? */
-}
-
-scninit(cp)
- struct consdev *cp;
-{
-}
-
-scnputchar(c)
- int c;
-{
- char c2;
- c2 = c;
- _write(0, &c2, 1);
-}
-
-scngetchar()
-{
- char c;
- _read(0, &c, 1);
- return c;
-}
-
-_rtt() {
- syscall( SYS_exit, 1 );
-}
-
-alloc(int size)
-{
- return malloc(size);
-}
diff --git a/sys/arch/pc532/stand/tgets.c b/sys/arch/pc532/stand/tgets.c
deleted file mode 100644
index 232affa930a..00000000000
--- a/sys/arch/pc532/stand/tgets.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* $NetBSD: tgets.c,v 1.2 1994/10/26 08:26:00 cgd Exp $ */
-
-/*-
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)gets.c 8.1 (Berkeley) 6/11/93
- */
-
-tgets(buf)
- char *buf;
-{
- register int c;
- int i;
- register char *lp = buf;
-
- for (i = 2400000; i > 0; i--) {
- c = tgetchar() & 0177;
- if (c) {
- for (;;) {
- switch (c) {
- case '\n':
- case '\r':
- *lp = '\0';
- return;
- case '\b':
- case '\177':
- if (lp > buf) {
- lp--;
- putchar('\b');
- putchar(' ');
- putchar('\b');
- }
- break;
- case '#':
- if (lp > buf)
- --lp;
- break;
- case 'r'&037: {
- register char *p;
-
- putchar('\n');
- for (p = buf; p < lp; ++p)
- putchar(*p);
- break;
- }
- case '@':
- case 'u'&037:
- case 'w'&037:
- lp = buf;
- putchar('\n');
- break;
- default:
- *lp++ = c;
- }
- c = getchar() & 0177;
- }
- }
- }
- return(0);
-}
diff --git a/sys/arch/wgrisc/Makefile b/sys/arch/wgrisc/Makefile
deleted file mode 100644
index f7662790d1b..00000000000
--- a/sys/arch/wgrisc/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-# $OpenBSD: Makefile,v 1.3 2000/03/03 00:54:56 todd Exp $
-# from: @(#)Makefile 8.1 (Berkeley) 6/16/93
-
-# Makefile for pica links, tags file
-
-.include "../../kern/Make.tags.inc"
-
-all:
- @echo "make links or tags only"
-
-DIRS= conf dev dist include pica
-
-links::
- -for i in ${DIRS}; do \
- (cd $$i && { rm -f tags; ln -s ${SYSTAGS} tags; }) done
-
-PICA= /sys/pica/dev/*.[ch] /sys/pica/include/*.[ch] \
- /sys/pica/pica/*.[ch] /sys/pica/ultrix/*.[ch]
-APICA= /sys/pica/pica/*.s
-
-tags::
- -ctags -wdtif ${COMM} ${PICA}
- egrep "^LEAF(.*)|^[AN]LEAF(.*)|^NON_LEAF(.*)" ${APICA} | \
- sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
- >> tags
- sort -o tags tags
-
-obj: _SUBDIRUSE
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/wgrisc/compile/.cvsignore b/sys/arch/wgrisc/compile/.cvsignore
deleted file mode 100644
index db5b0e04a3a..00000000000
--- a/sys/arch/wgrisc/compile/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-GENERIC
diff --git a/sys/arch/wgrisc/conf/DISKLESS b/sys/arch/wgrisc/conf/DISKLESS
deleted file mode 100644
index 744607c9c24..00000000000
--- a/sys/arch/wgrisc/conf/DISKLESS
+++ /dev/null
@@ -1,77 +0,0 @@
-#
-# Generic configuration file for MIPS R4400 PICA system
-#
-
-machine riscpc
-
-maxusers 8
-
-# does not really do anything anymore, but this replaces "ident GENERIC"
-#options GENERIC
-
-# Need to set locally
-options TIMEZONE="8*60" # minutes west of GMT (for)
-options DST=1 # use daylight savings rules
-
-# Standard system options
-options SWAPPAGER # swap pager (anonymous and swap space)
-options VNODEPAGER # vnode pager (mapped files)
-options DEVPAGER # device pager (mapped devices)
-options DIAGNOSTIC # extra kernel debugging checks
-options DEBUG # extra kernel debugging support
-options "COMPAT_43" # compatibility with 4.3BSD binaries
-#options KTRACE # system call tracing support
-options "NKMEMCLUSTERS=1024" # 4K pages in kernel malloc pool
-#options KGDB # support for kernel gdb
-#options "KGDBRATE=19200" # kernel gdb port rate (default 9600)
-#options "KGDBDEV=15*256+0" # device for kernel gdb
-
-# System V options
-options SYSVMSG # System V-like message queues
-options SYSVSEM # System V-like semaphores
-options SYSVSHM # System V-like memory sharing
-options SHMMAXPGS=1024 # 1024 pages is the default
-options NATIVE_ELF
-
-# Filesystem options
-options FIFO # POSIX fifo support (in all filesystems)
-options FFS,QUOTA # fast filesystem with user and group quotas
-options MFS # memory-based filesystem
-options NFSCLIENT # Sun NFS-compatible filesystem (client)
-options NFSSERVER # Sun NFS-compatible filesystem (server)
-options KERNFS # kernel data-structure filesystem
-#options MSDOSFS # Ability to read write MS-Dos filsystem
-#options CD9660 # ISO 9660 + Rock Ridge file system
-options FDESC # user file descriptor filesystem
-#options UMAPFS # uid/gid remapping filesystem
-#options NULLFS # null layer filesystem
-#options LFS # Log-based filesystem (still experimental)
-#options PORTAL # portal filesystem (still experimental)
-
-# Networking options
-options INET # Internet protocols
-options "TCP_COMPAT_42" # compatibility with 4.2BSD TCP/IP
-options GATEWAY # IP packet forwarding
-#options MULTICAST # Multicast support
-#options MROUTING # Multicast routing support
-#options ISO # OSI networking
-#options TPIP
-#options EON
-
-config bsd root on nfs swap on nfs
-
-mainbus0 at root
-cpu* at mainbus0
-
-pica* at mainbus0
-clock0 at pica?
-com0 at pica?
-com1 at pica?
-sn0 at pica?
-
-pseudo-device sl 2 # serial-line IP ports
-pseudo-device ppp 2 # serial-line PPP ports
-pseudo-device pty 64 # pseudo ptys
-pseudo-device bpfilter 16 # packet filter ports
-pseudo-device loop
-pseudo-device vnd 4 # virtual disk
diff --git a/sys/arch/wgrisc/conf/GENERIC b/sys/arch/wgrisc/conf/GENERIC
deleted file mode 100644
index b64c99939fd..00000000000
--- a/sys/arch/wgrisc/conf/GENERIC
+++ /dev/null
@@ -1,129 +0,0 @@
-# $OpenBSD: GENERIC,v 1.5 2000/01/09 22:00:26 itojun Exp $
-#
-# Generic configuration file for Willowglen RISC-PC 9100
-#
-
-machine wgrisc
-
-maxusers 8
-
-# Need to set locally
-options TIMEZONE=0 # minutes west of GMT (for)
-options DST=0 # use daylight savings rules
-
-# Standard system options
-options SWAPPAGER # swap pager (anonymous and swap space)
-options DEVPAGER # device pager (mapped devices)
-
-options DIAGNOSTIC # extra kernel debugging checks
-options KTRACE # system call tracing support
-options DEBUG # extra kernel debugging support
-options COMPAT_43 # compatibility with 4.3BSD binaries
-
-# System V options
-#options SYSVMSG # System V-like message queues
-#options SYSVSEM # System V-like semaphores
-#options SYSVSHM # System V-like memory sharing
-options SHMMAXPGS=1024 # 1024 pages is the default
-options NATIVE_ELF # Arc systems uses ELF as native format
-
-# Filesystem options
-#options CD9660 # ISO 9660 + Rock Ridge file system
-#options FDESC # user file descriptor filesystem (/dev/fd)
-options FIFO # POSIX fifo support (in all filesystems)
-options FFS,QUOTA # fast filesystem with user and group quotas
-#options KERNFS # kernel data-structure filesystem
-#options LFS # Log-based filesystem (still experimental)
-#options MFS # memory-based filesystem
-#options MSDOSFS # Ability to read write MS-Dos filsystem
-options NFSCLIENT # Sun NFS-compatible filesystem (client)
-#options NFSSERVER # Sun NFS-compatible filesystem (server)
-#options NULLFS # null layer filesystem
-#options PORTAL # portal filesystem (still experimental)
-#options PROCFS # /proc
-#options UMAPFS # uid/gid remapping filesystem
-#options UNION # union file system
-
-
-# Networking options
-options GATEWAY # IP packet forwarding
-options INET # Internet protocols
-#options NS # XNS
-#options IPX # IPX+SPX
-#options ISO,TPIP # OSI networking
-#options EON # OSI tunneling over IP
-#options CCITT,LLC,HDLC # X.25
-#options IPFILTER # IP packet filter for security
-
-#options TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP
-#options MULTICAST # Multicast support
-#options MROUTING # Multicast routing support
-
-# Special options
-options MACHINE_NONCONTIG # Support noncontigous memory.
-options CONADDR=0xae400000 # serial console I/O address.
-
-# Specify storage configuration (its a joke..)
-config bsd swap generic
-
-#
-# Definition of system
-#
-mainbus0 at root
-cpu* at mainbus0
-
-riscbus* at mainbus0
-isabr* at mainbus0
-
-clock0 at riscbus?
-com0 at riscbus?
-com1 at riscbus?
-com2 at riscbus?
-com3 at riscbus?
-#sn0 at riscbus?
-
-asc0 at riscbus?
-scsibus* at asc?
-
-fl0 at riscbus?
-
-#
-# ISA Bus.
-#
-
-isa* at isabr?
-
-com4 at isa? port 0x3e8 irq 4
-com5 at isa? port 0x2e8 irq 3
-
-ep0 at isa? port ? irq ? # 3C509 ethernet cards
-ed0 at isa? port 0x280 iomem 0xd0000 irq 9 # WD/SMC, 3C503, and NE[12]000
-#ed1 at isa? port 0x250 iomem 0xd8000 irq 9 # ethernet cards
-#ed2 at isa? port 0x300 iomem 0xcc000 irq 10 #
-
-#
-# SCSI Bus devices
-#
-
-sd* at scsibus? target ? lun ?
-#st* at scsibus? target ? lun ?
-#cd* at scsibus? target ? lun ?
-#ch* at scsibus? target ? lun ?
-#ss* at scsibus? target ? lun ?
-#uk* at scsibus? target ? lun ?
-
-#
-pseudo-device loop 1 # network loopback
-pseudo-device bpfilter 8 # packet filter ports
-#pseudo-device sl 2 # serial-line IP ports
-#pseudo-device ppp 2 # serial-line PPP ports
-#pseudo-device tun 2 # network tunneling over tty
-
-pseudo-device pty 64 # pseudo ptys
-pseudo-device tb 1 # tablet line discipline
-pseudo-device vnd 4 # paging to files
-#pseudo-device ccd 4 # concatenated disk devices
-
-# for IPv6
-pseudo-device gif 4
-#pseudo-device faith 1
diff --git a/sys/arch/wgrisc/conf/Makefile.wgrisc b/sys/arch/wgrisc/conf/Makefile.wgrisc
deleted file mode 100644
index c48b4a11c5a..00000000000
--- a/sys/arch/wgrisc/conf/Makefile.wgrisc
+++ /dev/null
@@ -1,181 +0,0 @@
-# $OpenBSD: Makefile.wgrisc,v 1.3 1997/09/15 02:40:38 deraadt Exp $
-
-# @(#)Makefile.wgrisc 8.2 (Berkeley) 2/16/94
-#
-# Makefile for 4.4 BSD
-#
-# This makefile is constructed from a machine description:
-# config machineid
-# Most changes should be made in the machine description
-# /sys/arch/MACHINE/conf/``machineid''
-# after which you should do
-# config machineid
-# Machine generic makefile changes should be made in
-# /sys/arch/MACHINE/conf/Makefile.``machinetype''
-# after which config should be rerun for all machines of that type.
-#
-# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
-# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
-#
-# -DTRACE compile in kernel tracing hooks
-# -DQUOTA compile in file system quotas
-
-
-# DEBUG is set to -g by config if debugging is requested (config -g).
-# PROF is set to -pg by config if profiling is requested (config -p).
-AS?= as
-CC?= cc
-CPP?= cpp
-LD?= ld
-STRIP?= strip -d
-TOUCH?= touch -f -c
-
-# source tree is located via $S relative to the compilation directory
-S= ../../../..
-WGRISC= ../..
-
-INCLUDES= -I. -I$S/arch -I$S
-CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL -Dwgrisc
-CFLAGS= ${DEBUG} -O2 -Werror -mno-abicalls -mips1 -mcpu=r3000
-AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE
-
-### find out what to use for libkern
-.include "$S/lib/libkern/Makefile.inc"
-.ifndef PROF
-LIBKERN= ${KERNLIB}
-.else
-LIBKERN= ${KERNLIB_PROF}
-.endif
-
-### find out what to use for libcompat
-.include "$S/compat/common/Makefile.inc"
-.ifndef PROF
-LIBCOMPAT= ${COMPATLIB}
-.else
-LIBCOMPAT= ${COMPATLIB_PROF}
-.endif
-
-# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
-# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
-# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
-# is marked as config-dependent.
-
-USRLAND_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
-USRLAND_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
-
-NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
-NORMAL_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
-
-DRIVER_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
-DRIVER_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
-
-NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
-NORMAL_S_C= ${AS} ${COPTS} ${PARAM} $< -o $@
-
-%OBJS
-
-%CFILES
-
-%SFILES
-
-# load lines for config "xxx" will be emitted as:
-# xxx: ${SYSTEM_DEP} swapxxx.o
-# ${SYSTEM_LD_HEAD}
-# ${SYSTEM_LD} swapxxx.o
-# ${SYSTEM_LD_TAIL}
-
-SYSTEM_OBJ= locore.o fp.o ${OBJS} param.o ioconf.o ${LIBKERN} \
- ${LIBCOMPAT}
-#
-SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
-SYSTEM_LD_HEAD= rm -f $@
-SYSTEM_LD= -@if [ X${DEBUG} = X-g ]; \
- then strip=-X; \
- else strip=-x; \
- fi; \
- echo ${LD} $$strip -o $@ -e start -T ../../conf/ld.script \
- '$${SYSTEM_OBJ}' vers.o; \
- ${LD} $$strip -o $@ -e start -T ../../conf/ld.script \
- ${SYSTEM_OBJ} vers.o
-#
-SYSTEM_LD_TAIL= chmod 755 $@; \
- size $@
-
-%LOAD
-
-newvers:
- sh $S/conf/newvers.sh
- ${CC} $(CFLAGS) -c vers.c
-
-clean::
- rm -f eddep bsd bsd.gdb bsd.ecoff tags *.o locore.i [a-z]*.s \
- Errs errs linterrs makelinks genassym
-
-lint: /tmp param.c
- @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
- ${CFILES} ioconf.c param.c
-
-symbols.sort: ${WGRISC}/wgrisc/symbols.raw
- grep -v '^#' ${WGRISC}/wgrisc/symbols.raw \
- | sed 's/^ //' | sort -u > symbols.sort
-
-locore.o: ${WGRISC}/wgrisc/locore.S ${WGRISC}/include/asm.h \
- ${WGRISC}/include/cpu.h ${WGRISC}/include/reg.h assym.h
- ${NORMAL_S} -mips1 ${WGRISC}/wgrisc/locore.S
-
-fp.o: ${WGRISC}/wgrisc/fp.S ${WGRISC}/include/asm.h \
- ${WGRISC}/include/cpu.h ${WGRISC}/include/reg.h assym.h
- ${NORMAL_S} -mips1 ${WGRISC}/wgrisc/fp.S
-
-# the following are necessary because the files depend on the types of
-# cpu's included in the system configuration
-clock.o machdep.o autoconf.o conf.o: Makefile
-
-# depend on network configuration
-uipc_domain.o uipc_proto.o vfs_conf.o: Makefile
-if_tun.o if_loop.o if_ethersubr.o: Makefile
-in_proto.o: Makefile
-
-assym.h: genassym
- ./genassym >assym.h
-
-genassym: genassym.o
- ${HOSTCC} -o $@ genassym.o
-
-genassym.o: ${WGRISC}/wgrisc/genassym.c
- ${HOSTCC} ${INCLUDES} ${IDENT} -D_KERNEL -Dwgrisc -c $<
-
-links:
- egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
- sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
- echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
- sort -u | comm -23 - dontlink | \
- sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
- sh makelinks && rm -f dontlink
-
-tags:
- @echo "see $S/kern/Makefile for tags"
-
-ioconf.o: ioconf.c
- ${NORMAL_C}
-
-param.c: $S/conf/param.c
- rm -f param.c
- cp $S/conf/param.c .
-
-param.o: param.c Makefile
- ${NORMAL_C_C}
-
-newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
- sh $S/conf/newvers.sh
- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
-
-depend:: .depend
-.depend: ${SRCS} assym.h param.c
- mkdep ${AFLAGS} ${CPPFLAGS} ${WGRISC}/wgrisc/locore.s
- mkdep -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
- mkdep -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
- mkdep -a ${CFLAGS} ${CPPFLAGS} ${PARAM} ${WGRISC}/wgrisc/genassym.c
-
-%RULES
-
diff --git a/sys/arch/wgrisc/conf/files.wgrisc b/sys/arch/wgrisc/conf/files.wgrisc
deleted file mode 100644
index f7daa6d0887..00000000000
--- a/sys/arch/wgrisc/conf/files.wgrisc
+++ /dev/null
@@ -1,111 +0,0 @@
-# $OpenBSD: files.wgrisc,v 1.3 1997/08/24 12:01:12 pefo Exp $
-#
-# maxpartitions must be first item in files.${ARCH}
-#
-maxpartitions 8
-
-maxusers 2 8 64
-
-# Required files
-
-
-file arch/wgrisc/wgrisc/autoconf.c
-file arch/wgrisc/wgrisc/conf.c
-file arch/wgrisc/wgrisc/cpu_exec.c
-file arch/wgrisc/wgrisc/disksubr.c
-file arch/wgrisc/wgrisc/machdep.c
-file arch/wgrisc/wgrisc/minidebug.c
-file arch/wgrisc/wgrisc/mem.c
-file arch/wgrisc/wgrisc/pmap.c
-file arch/wgrisc/wgrisc/process_machdep.c
-file arch/wgrisc/wgrisc/sys_machdep.c
-file arch/wgrisc/wgrisc/trap.c
-file arch/wgrisc/wgrisc/vm_machdep.c
-
-#
-# Machine-independent ATAPI drivers
-#
-
-include "../../../dev/atapi/files.atapi"
-
-
-#
-# System BUS types
-#
-
-define mainbus {}
-device mainbus
-attach mainbus at root
-file arch/wgrisc/wgrisc/mainbus.c mainbus
-
-# Our CPU configurator
-device cpu
-attach cpu at mainbus # not optional
-file arch/wgrisc/wgrisc/cpu.c cpu
-
-#
-# LOCALBUS bus autoconfiguration devices
-#
-device riscbus {}
-attach riscbus at mainbus # { slot = -1, offset = -1 }
-file arch/wgrisc/riscbus/riscbus.c riscbus
-
-# Real time clock, must have one..
-device clock
-attach clock at riscbus
-file arch/wgrisc/wgrisc/clock.c clock
-file arch/wgrisc/wgrisc/clock_dp.c clock
-
-# Ethernet chip
-device sn
-attach sn at riscbus: ifnet, ether
-file arch/wgrisc/dev/if_sn.c sn needs-count
-
-# Use machine independent SCSI driver routines
-include "../../../scsi/files.scsi"
-major {sd = 0}
-major {cd = 3}
-
-# Machine dependent SCSI interface driver
-device asc: scsi
-attach asc at riscbus
-file arch/wgrisc/dev/asc.c asc needs-count
-
-# FLASH Memory device driver
-device fl
-attach fl at riscbus
-file arch/wgrisc/dev/flash.c fl needs-count
-
-#
-# ISA
-#
-device isabr {} : isabus
-attach isabr at mainbus
-file arch/wgrisc/isa/isabus.c isabr
-
-#
-# Stock isa bus support
-#
-define pcmcia {} # XXX dummy decl...
-
-include "../../../dev/isa/files.isa"
-
-# National Semiconductor DS8390/WD83C690-based boards
-# (WD/SMC 80x3 family, SMC Ultra [8216], 3Com 3C503, NE[12]000, and clones)
-# XXX conflicts with other ports; can't be in files.isa
-device ed: ether, ifnet
-attach ed at isa with ed_isa
-attach ed at pcmcia with ed_pcmcia
-file dev/isa/if_ed.c ed & (ed_isa | ed_pcmcia) needs-flag
-
-# 8250/16[45]50-based "com" ports
-attach com at riscbus with com_risc
-file arch/wgrisc/dev/com_risc.c com_risc
-
-#
-
-file dev/cons.c
-file dev/cninit.c
-file netinet/in_cksum.c
-file netns/ns_cksum.c ns
-
diff --git a/sys/arch/wgrisc/conf/ld.script b/sys/arch/wgrisc/conf/ld.script
deleted file mode 100644
index 12f80cef7c1..00000000000
--- a/sys/arch/wgrisc/conf/ld.script
+++ /dev/null
@@ -1,74 +0,0 @@
-OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips",
- "elf32-littlemips")
-OUTPUT_ARCH(mips)
-ENTRY(_start)
-SECTIONS
-{
- /* Read-only sections, merged into text segment: */
- . = 0x80040000 + SIZEOF_HEADERS;
- .text :
- {
- _ftext = . ;
- *(.text)
- *(.rodata)
- *(.rodata1)
- *(.reginfo)
- *(.init)
- *(.stub)
- /* .gnu.warning sections are handled specially by elf32.em. */
- *(.gnu.warning)
- } =0
- _etext = .;
- PROVIDE (etext = .);
- .fini : { *(.fini) } =0
- .data :
- {
- _fdata = . ;
- *(.data)
- CONSTRUCTORS
- }
- .data1 : { *(.data1) }
- .ctors : { *(.ctors) }
- .dtors : { *(.dtors) }
- _gp = ALIGN(16) + 0x7ff0;
- .got :
- {
- *(.got.plt) *(.got)
- }
- /* We want the small data sections together, so single-instruction offsets
- can access them all, and initialized data all before uninitialized, so
- we can shorten the on-disk segment size. */
- .sdata : { *(.sdata) }
- .lit8 : { *(.lit8) }
- .lit4 : { *(.lit4) }
- _edata = .;
- PROVIDE (edata = .);
- __bss_start = .;
- _fbss = .;
- .sbss : { *(.sbss) *(.scommon) }
- .bss :
- {
- *(.dynbss)
- *(.bss)
- *(COMMON)
- }
- _end = . ;
- PROVIDE (end = .);
- /* These are needed for ELF backends which have not yet been
- converted to the new style linker. */
- .stab 0 : { *(.stab) }
- .stabstr 0 : { *(.stabstr) }
- /* DWARF debug sections.
- Symbols in the .debug DWARF section are relative to the beginning of the
- section so we begin .debug at 0. It's not clear yet what needs to happen
- for the others. */
- .debug 0 : { *(.debug) }
- .debug_srcinfo 0 : { *(.debug_srcinfo) }
- .debug_aranges 0 : { *(.debug_aranges) }
- .debug_pubnames 0 : { *(.debug_pubnames) }
- .debug_sfnames 0 : { *(.debug_sfnames) }
- .line 0 : { *(.line) }
- /* These must appear regardless of . */
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
-}
diff --git a/sys/arch/wgrisc/dev/asc.c b/sys/arch/wgrisc/dev/asc.c
deleted file mode 100644
index 4b8bd892559..00000000000
--- a/sys/arch/wgrisc/dev/asc.c
+++ /dev/null
@@ -1,2101 +0,0 @@
-/* $OpenBSD: asc.c,v 1.4 2001/01/25 03:50:49 todd Exp $ */
-/* $NetBSD: asc.c,v 1.10 1994/12/05 19:11:12 dean Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell and Rick Macklem.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)asc.c 8.3 (Berkeley) 7/3/94
- */
-
-/*
- * Mach Operating System
- * Copyright (c) 1991,1990,1989 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-/*
- * HISTORY
- * Log: scsi_53C94_hdw.c,v
- * Revision 2.5 91/02/05 17:45:07 mrt
- * Added author notices
- * [91/02/04 11:18:43 mrt]
- *
- * Changed to use new Mach copyright
- * [91/02/02 12:17:20 mrt]
- *
- * Revision 2.4 91/01/08 15:48:24 rpd
- * Added continuation argument to thread_block.
- * [90/12/27 rpd]
- *
- * Revision 2.3 90/12/05 23:34:48 af
- * Recovered from pmax merge.. and from the destruction of a disk.
- * [90/12/03 23:40:40 af]
- *
- * Revision 2.1.1.1 90/11/01 03:39:09 af
- * Created, from the DEC specs:
- * "PMAZ-AA TURBOchannel SCSI Module Functional Specification"
- * Workstation Systems Engineering, Palo Alto, CA. Aug 27, 1990.
- * And from the NCR data sheets
- * "NCR 53C94, 53C95, 53C96 Advances SCSI Controller"
- * [90/09/03 af]
- */
-
-/*
- * File: scsi_53C94_hdw.h
- * Author: Alessandro Forin, Carnegie Mellon University
- * Date: 9/90
- *
- * Bottom layer of the SCSI driver: chip-dependent functions
- *
- * This file contains the code that is specific to the NCR 53C94
- * SCSI chip (Host Bus Adapter in SCSI parlance): probing, start
- * operation, and interrupt routine.
- */
-
-/*
- * This layer works based on small simple 'scripts' that are installed
- * at the start of the command and drive the chip to completion.
- * The idea comes from the specs of the NCR 53C700 'script' processor.
- *
- * There are various reasons for this, mainly
- * - Performance: identify the common (successful) path, and follow it;
- * at interrupt time no code is needed to find the current status
- * - Code size: it should be easy to compact common operations
- * - Adaptability: the code skeleton should adapt to different chips without
- * terrible complications.
- * - Error handling: and it is easy to modify the actions performed
- * by the scripts to cope with strange but well identified sequences
- *
- */
-
-#include <asc.h>
-#if NASC > 0
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/dkstat.h>
-#include <sys/buf.h>
-#include <sys/proc.h>
-#include <sys/conf.h>
-#include <sys/errno.h>
-#include <sys/device.h>
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-
-#include <machine/cpu.h>
-#include <machine/autoconf.h>
-#include <machine/pio.h>
-
-#include <wgrisc/dev/scsi.h>
-#include <wgrisc/dev/ascreg.h>
-#include <wgrisc/dev/dma.h>
-
-#include <wgrisc/riscbus/riscbus.h>
-#include <wgrisc/wgrisc/wgrisctype.h>
-
-#define readback(a) { register int foo; foo = (a); }
-extern int cputype;
-
-/*
- * In 4ns ticks.
- */
-int asc_to_scsi_period[] = {
- 32,
- 33,
- 34,
- 35,
- 5,
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12,
- 13,
- 14,
- 15,
- 16,
- 17,
- 18,
- 19,
- 20,
- 21,
- 22,
- 23,
- 24,
- 25,
- 26,
- 27,
- 28,
- 29,
- 30,
- 31,
-};
-
-/*
- * Internal forward declarations.
- */
-static void asc_reset();
-static void asc_startcmd();
-
-#ifdef DEBUG
-int asc_debug = 1;
-int asc_debug_cmd;
-int asc_debug_bn;
-int asc_debug_sz;
-#define NLOG 16
-struct asc_log {
- u_int status;
- u_char state;
- u_char msg;
- int target;
- int resid;
-} asc_log[NLOG], *asc_logp = asc_log;
-#define PACK(unit, status, ss, ir) \
- ((unit << 24) | (status << 16) | (ss << 8) | ir)
-#endif
-
-/*
- * Scripts are entries in a state machine table.
- * A script has four parts: a pre-condition, an action, a command to the chip,
- * and an index into asc_scripts for the next state. The first triggers error
- * handling if not satisfied and in our case it is formed by the
- * values of the interrupt register and status register, this
- * basically captures the phase of the bus and the TC and BS
- * bits. The action part is just a function pointer, and the
- * command is what the 53C94 should be told to do at the end
- * of the action processing. This command is only issued and the
- * script proceeds if the action routine returns TRUE.
- * See asc_intr() for how and where this is all done.
- */
-typedef struct script {
- int condition; /* expected state at interrupt time */
- int (*action)(); /* extra operations */
- int command; /* command to the chip */
- struct script *next; /* index into asc_scripts for next state */
-} script_t;
-
-/* Matching on the condition value */
-#define SCRIPT_MATCH(ir, csr) ((ir) | (((csr) & 0x67) << 8))
-
-/* forward decls of script actions */
-static int script_nop(); /* when nothing needed */
-static int asc_end(); /* all come to an end */
-static int asc_get_status(); /* get status from target */
-static int asc_dma_in(); /* start reading data from target */
-static int asc_last_dma_in(); /* cleanup after all data is read */
-static int asc_resume_in(); /* resume data in after a message */
-static int asc_resume_dma_in(); /* resume DMA after a disconnect */
-static int asc_dma_out(); /* send data to target via dma */
-static int asc_last_dma_out(); /* cleanup after all data is written */
-static int asc_resume_out(); /* resume data out after a message */
-static int asc_resume_dma_out(); /* resume DMA after a disconnect */
-static int asc_sendsync(); /* negotiate sync xfer */
-static int asc_replysync(); /* negotiate sync xfer */
-static int asc_msg_in(); /* process a message byte */
-static int asc_disconnect(); /* process an expected disconnect */
-
-/* Define the index into asc_scripts for various state transitions */
-#define SCRIPT_DATA_IN 0
-#define SCRIPT_CONTINUE_IN 2
-#define SCRIPT_DATA_OUT 3
-#define SCRIPT_CONTINUE_OUT 5
-#define SCRIPT_SIMPLE 6
-#define SCRIPT_GET_STATUS 7
-#define SCRIPT_DONE 8
-#define SCRIPT_MSG_IN 9
-#define SCRIPT_REPLY_SYNC 11
-#define SCRIPT_TRY_SYNC 12
-#define SCRIPT_DISCONNECT 15
-#define SCRIPT_RESEL 16
-#define SCRIPT_RESUME_IN 17
-#define SCRIPT_RESUME_DMA_IN 18
-#define SCRIPT_RESUME_OUT 19
-#define SCRIPT_RESUME_DMA_OUT 20
-#define SCRIPT_RESUME_NO_DATA 21
-
-/*
- * Scripts
- */
-script_t asc_scripts[] = {
- /* start data in */
- {SCRIPT_MATCH(ASC_INT_FC | ASC_INT_BS, ASC_PHASE_DATAI), /* 0 */
- asc_dma_in, ASC_CMD_XFER_INFO | ASC_CMD_DMA,
- &asc_scripts[SCRIPT_DATA_IN + 1]},
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_STATUS), /* 1 */
- asc_last_dma_in, ASC_CMD_I_COMPLETE,
- &asc_scripts[SCRIPT_GET_STATUS]},
-
- /* continue data in after a chunk is finished */
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_DATAI), /* 2 */
- asc_dma_in, ASC_CMD_XFER_INFO | ASC_CMD_DMA,
- &asc_scripts[SCRIPT_DATA_IN + 1]},
-
- /* start data out */
- {SCRIPT_MATCH(ASC_INT_FC | ASC_INT_BS, ASC_PHASE_DATAO), /* 3 */
- asc_dma_out, ASC_CMD_XFER_INFO | ASC_CMD_DMA,
- &asc_scripts[SCRIPT_DATA_OUT + 1]},
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_STATUS), /* 4 */
- asc_last_dma_out, ASC_CMD_I_COMPLETE,
- &asc_scripts[SCRIPT_GET_STATUS]},
-
- /* continue data out after a chunk is finished */
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_DATAO), /* 5 */
- asc_dma_out, ASC_CMD_XFER_INFO | ASC_CMD_DMA,
- &asc_scripts[SCRIPT_DATA_OUT + 1]},
-
- /* simple command with no data transfer */
- {SCRIPT_MATCH(ASC_INT_FC | ASC_INT_BS, ASC_PHASE_STATUS), /* 6 */
- script_nop, ASC_CMD_I_COMPLETE,
- &asc_scripts[SCRIPT_GET_STATUS]},
-
- /* get status and finish command */
- {SCRIPT_MATCH(ASC_INT_FC, ASC_PHASE_MSG_IN), /* 7 */
- asc_get_status, ASC_CMD_MSG_ACPT,
- &asc_scripts[SCRIPT_DONE]},
- {SCRIPT_MATCH(ASC_INT_DISC, 0), /* 8 */
- asc_end, ASC_CMD_NOP,
- &asc_scripts[SCRIPT_DONE]},
-
- /* message in */
- {SCRIPT_MATCH(ASC_INT_FC, ASC_PHASE_MSG_IN), /* 9 */
- asc_msg_in, ASC_CMD_MSG_ACPT,
- &asc_scripts[SCRIPT_MSG_IN + 1]},
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_MSG_IN), /* 10 */
- script_nop, ASC_CMD_XFER_INFO,
- &asc_scripts[SCRIPT_MSG_IN]},
-
- /* send synchonous negotiation reply */
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_MSG_OUT), /* 11 */
- asc_replysync, ASC_CMD_XFER_INFO,
- &asc_scripts[SCRIPT_REPLY_SYNC]},
-
- /* try to negotiate synchonous transfer parameters */
- {SCRIPT_MATCH(ASC_INT_FC | ASC_INT_BS, ASC_PHASE_MSG_OUT), /* 12 */
- asc_sendsync, ASC_CMD_XFER_INFO,
- &asc_scripts[SCRIPT_TRY_SYNC + 1]},
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_MSG_IN), /* 13 */
- script_nop, ASC_CMD_XFER_INFO,
- &asc_scripts[SCRIPT_MSG_IN]},
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_COMMAND), /* 14 */
- script_nop, ASC_CMD_XFER_INFO | ASC_CMD_DMA,
- &asc_scripts[SCRIPT_RESUME_NO_DATA]},
-
- /* handle a disconnect */
- {SCRIPT_MATCH(ASC_INT_DISC, ASC_PHASE_DATAO), /* 15 */
- asc_disconnect, ASC_CMD_ENABLE_SEL,
- &asc_scripts[SCRIPT_RESEL]},
-
- /* reselect sequence: this is just a placeholder so match fails */
- {SCRIPT_MATCH(0, ASC_PHASE_MSG_IN), /* 16 */
- script_nop, ASC_CMD_MSG_ACPT,
- &asc_scripts[SCRIPT_RESEL]},
-
- /* resume data in after a message */
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_DATAI), /* 17 */
- asc_resume_in, ASC_CMD_XFER_INFO | ASC_CMD_DMA,
- &asc_scripts[SCRIPT_DATA_IN + 1]},
-
- /* resume partial DMA data in after a message */
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_DATAI), /* 18 */
- asc_resume_dma_in, ASC_CMD_XFER_INFO | ASC_CMD_DMA,
- &asc_scripts[SCRIPT_DATA_IN + 1]},
-
- /* resume data out after a message */
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_DATAO), /* 19 */
- asc_resume_out, ASC_CMD_XFER_INFO | ASC_CMD_DMA,
- &asc_scripts[SCRIPT_DATA_OUT + 1]},
-
- /* resume partial DMA data out after a message */
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_DATAO), /* 20 */
- asc_resume_dma_out, ASC_CMD_XFER_INFO | ASC_CMD_DMA,
- &asc_scripts[SCRIPT_DATA_OUT + 1]},
-
- /* resume after a message when there is no more data */
- {SCRIPT_MATCH(ASC_INT_BS, ASC_PHASE_STATUS), /* 21 */
- script_nop, ASC_CMD_I_COMPLETE,
- &asc_scripts[SCRIPT_GET_STATUS]},
-};
-
-/*
- * State kept for each active SCSI device.
- */
-typedef struct scsi_state {
- script_t *script; /* saved script while processing error */
- struct scsi_generic cmd;/* storage for scsi command */
- int statusByte; /* status byte returned during STATUS_PHASE */
- u_int dmaBufSize; /* DMA buffer size */
- int dmalen; /* amount to transfer in this chunk */
- int dmaresid; /* amount not transferred if chunk suspended */
- int cmdlen; /* length of command in cmd */
- int buflen; /* total remaining amount of data to transfer */
- vm_offset_t buf; /* current pointer within scsicmd->buf */
- int flags; /* see below */
- int msglen; /* number of message bytes to read */
- int msgcnt; /* number of message bytes received */
- u_char sync_period; /* DMA synchronous period */
- u_char sync_offset; /* DMA synchronous xfer offset or 0 if async */
- u_char msg_out; /* next MSG_OUT byte to send */
- u_char msg_in[16]; /* buffer for multibyte messages */
-} State;
-
-/* state flags */
-#define DISCONN 0x001 /* true if currently disconnected from bus */
-#define DMA_IN_PROGRESS 0x002 /* true if data DMA started */
-#define DMA_IN 0x004 /* true if reading from SCSI device */
-#define DMA_OUT 0x010 /* true if writing to SCSI device */
-#define DID_SYNC 0x020 /* true if synchronous offset was negotiated */
-#define TRY_SYNC 0x040 /* true if try neg. synchronous offset */
-#define PARITY_ERR 0x080 /* true if parity error seen */
-#define CHECK_SENSE 0x100 /* true if doing sense command */
-
-struct dma_softc_t;
-/*
- * State kept for each active SCSI host interface (53C94).
- */
-struct asc_softc {
- struct device sc_dev; /* use as a device */
- asc_regmap_t *regs; /* chip address */
- dma_softc_t dma; /* dma control structure */
- int sc_id; /* SCSI ID of this interface */
- int myidmask; /* ~(1 << myid) */
- int state; /* current SCSI connection state */
- int target; /* target SCSI ID if busy */
- script_t *script; /* next expected interrupt & action */
- struct scsi_xfer *cmdq[ASC_NCMD];/* Pointer to queued commands */
- struct scsi_xfer *cmd[ASC_NCMD];/* Pointer to current active command */
- State st[ASC_NCMD]; /* state info for each active command */
- int min_period; /* Min transfer period clk/byte */
- int max_period; /* Max transfer period clk/byte */
- int ccf; /* CCF, whatever that really is? */
- int timeout_250; /* 250ms timeout */
- int tb_ticks; /* 4ns. ticks/tb channel ticks */
- struct scsi_link sc_link; /* scsi link struct */
-};
-
-#define ASC_STATE_IDLE 0 /* idle state */
-#define ASC_STATE_BUSY 1 /* selecting or currently connected */
-#define ASC_STATE_TARGET 2 /* currently selected as target */
-#define ASC_STATE_RESEL 3 /* currently waiting for reselect */
-
-typedef struct asc_softc *asc_softc_t;
-
-static char dma_buffer[MAXPHYS]; /*yieek*/ /*XXX*/
-
-/*
- * Autoconfiguration data for config.
- */
-int ascmatch __P((struct device *, void *, void *));
-void ascattach __P((struct device *, struct device *, void *));
-int ascprint(void *, const char *);
-
-struct cfattach asc_ca = {
- sizeof(struct asc_softc), ascmatch, ascattach
-};
-struct cfdriver asc_cd = {
- NULL, "asc", DV_DULL, NULL, 0
-};
-
-/*
- * Glue to the machine dependent scsi
- */
-int asc_scsi_cmd __P((struct scsi_xfer *));
-void asc_minphys __P((struct buf *));
-
-struct scsi_adapter asc_switch = {
- asc_scsi_cmd,
- asc_minphys,
- NULL,
- NULL,
-};
-
-struct scsi_device asc_dev = {
-/*XXX*/ NULL, /* Use default error handler */
-/*XXX*/ NULL, /* have a queue, served by this */
-/*XXX*/ NULL, /* have no async handler */
-/*XXX*/ NULL, /* Use default 'done' routine */
-};
-
-static void asc_start();
-static int asc_intr();
-
-/*
- * Match driver based on name
- */
-int
-ascmatch(parent, match, aux)
- struct device *parent;
- void *match;
- void *aux;
-{
- struct cfdata *cf = match;
- struct confargs *ca = aux;
-
- if(!BUS_MATCHNAME(ca, "asc"))
- return(0);
- return(1);
-}
-
-void
-ascattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- register struct confargs *ca = aux;
- register asc_softc_t asc = (void *)self;
- register asc_regmap_t *regs;
- int id, s, i;
- int bufsiz;
-
- /*
- * Initialize hw descriptor, cache some pointers
- */
- asc->regs = (asc_regmap_t *)BUS_CVTADDR(ca);
-
- /*
- * Set up machine dependencies.
- * 1) how to do dma
- * 2) timing based on chip clock frequency
- */
- switch (cputype) {
- case WGRISC9100:
- bufsiz = MAXPHYS; /* Scatter gather in software */
- break;
- default:
- bufsiz = 64 * 1024;
- };
- /*
- * Now for timing. WGRISC has a 20Mhz
- */
- switch (cputype) {
- case WGRISC9100:
- asc->min_period = ASC_MIN_PERIOD20;
- asc->max_period = ASC_MAX_PERIOD20;
- asc->ccf = ASC_CCF(20);
- asc->timeout_250 = ASC_TIMEOUT_250(20, asc->ccf);
- asc->tb_ticks = 10;
- asc->dma.dma_ch = DMA_CH0;
- break;
- default:
- asc->min_period = ASC_MIN_PERIOD12;
- asc->max_period = ASC_MAX_PERIOD12;
- asc->ccf = ASC_CCF(13);
- asc->timeout_250 = ASC_TIMEOUT_250(13, asc->ccf);
- asc->tb_ticks = 20;
- break;
- };
-
- asc->state = ASC_STATE_IDLE;
- asc->target = -1;
-
- regs = asc->regs;
-
- /*
- * Reset chip, fully. Note that interrupts are already enabled.
- */
- s = splbio();
-
- /* preserve our ID for now */
-#if 0
- asc->sc_id = regs->asc_cnfg1 & ASC_CNFG1_MY_BUS_ID;
-#else
- asc->sc_id = 7; /* XXX Until boot roms set up scsi id */
-#endif
- asc->myidmask = ~(1 << asc->sc_id);
-
- asc_reset(asc, regs);
-
- /*
- * Our SCSI id on the bus.
- * The user can set this via the prom on 3maxen/picaen.
- * If this changes it is easy to fix: make a default that
- * can be changed as boot arg.
- */
-#ifdef unneeded
- regs->asc_cnfg1 = (regs->asc_cnfg1 & ~ASC_CNFG1_MY_BUS_ID) |
- (scsi_initiator_id[unit] & 0x7);
- asc->sc_id = regs->asc_cnfg1 & ASC_CNFG1_MY_BUS_ID;
-#endif
- id = asc->sc_id;
- splx(s);
-
- /*
- * Give each target its DMA buffer region.
- * The buffer address is the same for all targets,
- * the allocated dma viritual scatter/gather space.
- */
- for (i = 0; i < ASC_NCMD; i++) {
- asc->st[i].dmaBufSize = bufsiz;
- }
-
- /*
- * Set up interrupt handler.
- */
- BUS_INTR_ESTABLISH(ca, asc_intr, (void *)asc);
-
- printf(": NCR53C94, target %d\n", id);
-
- /*
- * Fill in the prototype scsi link.
- */
- asc->sc_link.adapter_softc = asc;
- asc->sc_link.adapter_target = asc->sc_id;
- asc->sc_link.adapter = &asc_switch;
- asc->sc_link.device = &asc_dev;
- asc->sc_link.openings = 2;
-
- /*
- * Now try to attach all the sub devices.
- */
- config_found(self, &asc->sc_link, ascprint);
-}
-
-int
-ascprint(aux, name)
- void *aux;
- const char *name;
-{
-}
-
-/*
- * Driver breaks down request transfer size.
- */
-void
-asc_minphys(bp)
- struct buf *bp;
-{
- minphys(bp);
-}
-
-/*
- * Start activity on a SCSI device.
- * We maintain information on each device separately since devices can
- * connect/disconnect during an operation.
- */
-int
-asc_scsi_cmd(xs)
- struct scsi_xfer *xs;
-{
- struct scsi_link *sc_link = xs->sc_link;
- struct asc_softc *asc = sc_link->adapter_softc;
- State *state = &asc->st[sc_link->target];
-
- int flags, s;
-
- flags = xs->flags;
-
- /*
- * Flush caches for any data buffer
- */
- if(xs->datalen != 0) {
-#ifdef R4K
- R4K_HitFlushDCache(xs->data, xs->datalen);
-#else
-#ifndef ASC_NOFLUSH
- R3K_FlushDCache();
-#endif
-#endif
- }
- /*
- * The hack on the next few lines are to avoid buffers
- * mapped to UADDR. Realloc to the kva uarea address.
- */
- if((u_int)(xs->data) >= UADDR) {
- xs->data = ((u_int)(xs->data) & ~UADDR) + (u_char *)(curproc->p_addr);
- }
-
- /*
- * Check if another command is already in progress.
- * We may have to change this if we allow SCSI devices with
- * separate LUNs.
- */
- s = splbio();
- if (asc->cmd[sc_link->target]) {
- if (asc->cmdq[sc_link->target]) {
- splx(s);
- printf("asc_scsi_cmd: called when target busy");
- xs->error = XS_DRIVER_STUFFUP;
- return TRY_AGAIN_LATER;
- }
- asc->cmdq[sc_link->target] = xs;
- splx(s);
- return SUCCESSFULLY_QUEUED;
- }
- asc->cmd[sc_link->target] = xs;
-
- /*
- * Going to launch.
- * Make a local copy of the command and some pointers.
- */
- asc_startcmd(asc, sc_link->target);
-
- /*
- * If in startup, interrupts not usable yet.
- */
- if(flags & SCSI_POLL) {
- return(asc_poll(asc,sc_link->target));
- }
- splx(s);
- return SUCCESSFULLY_QUEUED;
-}
-
-int
-asc_poll(asc, target)
- struct asc_softc *asc;
- int target;
-{
- struct scsi_xfer *scsicmd = asc->cmd[target];
- int count = scsicmd->timeout * 10;
-
- while(count) {
- if(asc->regs->asc_status &ASC_CSR_INT) {
- asc_intr(asc);
- }
- if(scsicmd->flags & ITSDONE)
- break;
- DELAY(5);
- count--;
- }
- if(count == 0) {
- scsicmd->error = XS_TIMEOUT;
- asc_end(asc, 0, 0, 0);
- }
- return COMPLETE;
-}
-
-static void
-asc_reset(asc, regs)
- asc_softc_t asc;
- asc_regmap_t *regs;
-{
- int i;
-
- /*
- * Reset chip and SCSI bus. Put everything in a known state.
- */
- regs->asc_cmd = ASC_CMD_RESET;
- wbflush(); DELAY(25);
- regs->asc_cmd = ASC_CMD_NOP;
- wbflush(); DELAY(25);
- regs->asc_cmd = ASC_CMD_BUS_RESET;
- wbflush();
- while(!(regs->asc_status & ASC_CSR_INT)) {
- /*void*/
- }
- regs->asc_cmd = ASC_CMD_RESET;
- wbflush(); DELAY(25);
- regs->asc_cmd = ASC_CMD_NOP;
- wbflush(); DELAY(25);
-
- /*
- * Set up various chip parameters
- */
- regs->asc_ccf = asc->ccf;
- wbflush(); DELAY(25);
- regs->asc_sel_timo = asc->timeout_250;
- /* restore our ID */
- regs->asc_cnfg1 = asc->sc_id | ASC_CNFG1_P_CHECK;
- /* include ASC_CNFG2_SCSI2 if you want to allow SCSI II commands */
- regs->asc_cnfg2 = /* ASC_CNFG2_RFB | ASC_CNFG2_SCSI2 | */ ASC_CNFG2_EPL;
- regs->asc_cnfg3 = 0;
- /* zero anything else */
- ASC_TC_PUT(regs, 0);
- regs->asc_syn_p = asc->min_period;
- regs->asc_syn_o = 0; /* async for now */
- wbflush();
-}
-
-/*
- * Start a SCSI command on a target.
- */
-static void
-asc_startcmd(asc, target)
- asc_softc_t asc;
- int target;
-{
- asc_regmap_t *regs;
- State *state;
- struct scsi_xfer *scsicmd;
- int i, len;
-
- /*
- * See if another target is currently selected on this SCSI bus.
- */
- if (asc->target >= 0)
- return;
-
- regs = asc->regs;
-
- /*
- * If a reselection is in progress, it is Ok to ignore it since
- * the ASC will automatically cancel the command and flush
- * the FIFO if the ASC is reselected before the command starts.
- * If we try to use ASC_CMD_DISABLE_SEL, we can hang the system if
- * a reselect occurs before starting the command.
- */
-
- asc->state = ASC_STATE_BUSY;
- asc->target = target;
-
- /* cache some pointers */
- scsicmd = asc->cmd[target];
- state = &asc->st[target];
-
- /*
- * Init the chip and target state.
- */
- state->flags = state->flags & (DID_SYNC | CHECK_SENSE);
- state->script = (script_t *)0;
- state->msg_out = SCSI_NO_OP;
-
- /*
- * Set up for DMA of command output. Also need to flush cache.
- */
- if(!(state->flags & CHECK_SENSE)) {
- bcopy(scsicmd->cmd, &state->cmd, scsicmd->cmdlen);
- state->cmdlen = scsicmd->cmdlen;
- state->buf = (vm_offset_t)scsicmd->data;
- state->buflen = scsicmd->datalen;
- }
- len = state->cmdlen;
- state->dmalen = len;
-
-#ifdef DEBUG
- if (asc_debug > 1) {
- printf("asc_startcmd: %s target %d cmd %x len %d\n",
- asc->sc_dev.dv_xname, target,
- state->cmd.opcode, state->buflen);
- }
-#endif
-
- /* check for simple SCSI command with no data transfer */
- if(state->flags & CHECK_SENSE) {
- asc->script = &asc_scripts[SCRIPT_DATA_IN];
- state->flags |= DMA_IN;
- }
- else if (scsicmd->flags & SCSI_DATA_OUT) {
- asc->script = &asc_scripts[SCRIPT_DATA_OUT];
- state->flags |= DMA_OUT;
- }
- else if (scsicmd->flags & SCSI_DATA_IN) {
- asc->script = &asc_scripts[SCRIPT_DATA_IN];
- state->flags |= DMA_IN;
- }
- else if (state->buflen == 0) {
- /* check for sync negotiation */
- if ((scsicmd->flags & /* SCSICMD_USE_SYNC */ 0) &&
- !(state->flags & DID_SYNC)) {
- asc->script = &asc_scripts[SCRIPT_TRY_SYNC];
- state->flags |= TRY_SYNC;
- } else
- asc->script = &asc_scripts[SCRIPT_SIMPLE];
- state->buf = (vm_offset_t)0;
- }
-
-#ifdef DEBUG
- asc_debug_cmd = state->cmd.opcode;
- if (state->cmd.opcode == SCSI_READ_EXT) {
- asc_debug_bn = (state->cmd.bytes[1] << 24) |
- (state->cmd.bytes[2] << 16) |
- (state->cmd.bytes[3] << 8) |
- state->cmd.bytes[4];
- asc_debug_sz = (state->cmd.bytes[6] << 8) | state->cmd.bytes[7];
- }
- asc_logp->status = PACK(asc->sc_dev.dv_unit, 0, 0, asc_debug_cmd);
- asc_logp->target = asc->target;
- asc_logp->state = asc->script - asc_scripts;
- asc_logp->msg = SCSI_DIS_REC_IDENTIFY;
- asc_logp->resid = scsicmd->datalen;
- if (++asc_logp >= &asc_log[NLOG])
- asc_logp = asc_log;
-#endif
-
- /* preload the FIFO with the message and command to be sent */
- regs->asc_fifo = SCSI_DIS_REC_IDENTIFY | (scsicmd->sc_link->lun & 0x07);
-
- for( i = 0; i < len; i++ ) {
- regs->asc_fifo = ((caddr_t)&state->cmd)[i];
- }
- ASC_TC_PUT(regs, 0);
- readback(regs->asc_cmd);
- regs->asc_cmd = ASC_CMD_DMA;
- readback(regs->asc_cmd);
-
- regs->asc_dbus_id = target;
- readback(regs->asc_dbus_id);
- regs->asc_syn_p = state->sync_period;
- readback(regs->asc_syn_p);
- regs->asc_syn_o = state->sync_offset;
- readback(regs->asc_syn_o);
-
-/*XXX PEFO */
-/* we are not using sync transfer now, need to check this if we will */
-
- if (state->flags & TRY_SYNC)
- regs->asc_cmd = ASC_CMD_SEL_ATN_STOP;
- else
- regs->asc_cmd = ASC_CMD_SEL_ATN;
- readback(regs->asc_cmd);
-}
-
-/*
- * Interrupt routine
- * Take interrupts from the chip
- *
- * Implementation:
- * Move along the current command's script if
- * all is well, invoke error handler if not.
- */
-int
-asc_intr(sc)
- void *sc;
-{
- asc_softc_t asc = sc;
- asc_regmap_t *regs = asc->regs;
- State *state;
- script_t *scpt;
- int ss, ir, status;
-
- /* collect ephemeral information */
- status = regs->asc_status;
- ss = regs->asc_ss;
-
- if ((status & ASC_CSR_INT) == 0) /* Make sure it's a real interrupt */
- return;
-
- ir = regs->asc_intr; /* this resets the previous two */
- scpt = asc->script;
-
-#ifdef DEBUG
- asc_logp->status = PACK(asc->sc_dev.dv_unit, status, ss, ir);
- asc_logp->target = (asc->state == ASC_STATE_BUSY) ? asc->target : -1;
- asc_logp->state = scpt - asc_scripts;
- asc_logp->msg = -1;
- asc_logp->resid = 0;
- if (++asc_logp >= &asc_log[NLOG])
- asc_logp = asc_log;
- if (asc_debug > 2)
- printf("asc_intr: status %x ss %x ir %x cond %d:%x\n",
- status, ss, ir, scpt - asc_scripts, scpt->condition);
-#endif
-
- /* check the expected state */
- if (SCRIPT_MATCH(ir, status) == scpt->condition) {
- /*
- * Perform the appropriate operation, then proceed.
- */
- if ((*scpt->action)(asc, status, ss, ir)) {
- regs->asc_cmd = scpt->command;
- readback(regs->asc_cmd);
- asc->script = scpt->next;
- }
- goto done;
- }
-
- /*
- * Check for parity error.
- * Hardware will automatically set ATN
- * to request the device for a MSG_OUT phase.
- */
- if (status & ASC_CSR_PE) {
- printf("%s: SCSI device %d: incomming parity error seen\n",
- asc->sc_dev.dv_xname, asc->target);
- asc->st[asc->target].flags |= PARITY_ERR;
- }
-
- /*
- * Check for gross error.
- * Probably a bug in a device driver.
- */
- if (status & ASC_CSR_GE) {
- printf("%s: SCSI device %d: gross error\n",
- asc->sc_dev.dv_xname, asc->target);
- goto abort;
- }
-
- /* check for message in or out */
- if ((ir & ~ASC_INT_FC) == ASC_INT_BS) {
- register int len, fifo;
-
- state = &asc->st[asc->target];
- switch (ASC_PHASE(status)) {
- case ASC_PHASE_DATAI:
- case ASC_PHASE_DATAO:
- ASC_TC_GET(regs, len);
- fifo = regs->asc_flags & ASC_FLAGS_FIFO_CNT;
- printf("asc_intr: data overrun: buflen %d dmalen %d tc %d fifo %d\n",
- state->buflen, state->dmalen, len, fifo);
- goto abort;
-
- case ASC_PHASE_MSG_IN:
- break;
-
- case ASC_PHASE_MSG_OUT:
- /*
- * Check for parity error.
- * Hardware will automatically set ATN
- * to request the device for a MSG_OUT phase.
- */
- if (state->flags & PARITY_ERR) {
- state->flags &= ~PARITY_ERR;
- state->msg_out = SCSI_MESSAGE_PARITY_ERROR;
- /* reset message in counter */
- state->msglen = 0;
- } else
- state->msg_out = SCSI_NO_OP;
- regs->asc_fifo = state->msg_out;
- regs->asc_cmd = ASC_CMD_XFER_INFO;
- readback(regs->asc_cmd);
- goto done;
-
- case ASC_PHASE_STATUS:
- /* probably an error in the SCSI command */
- asc->script = &asc_scripts[SCRIPT_GET_STATUS];
- regs->asc_cmd = ASC_CMD_I_COMPLETE;
- readback(regs->asc_cmd);
- goto done;
-
- default:
- goto abort;
- }
-
- if (state->script)
- goto abort;
-
- /*
- * OK, message coming in clean up whatever is going on.
- * Get number of bytes left to transferred from byte counter
- * counter decrements when data is trf on the SCSI bus
- */
- ASC_TC_GET(regs, len);
- fifo = regs->asc_flags & ASC_FLAGS_FIFO_CNT;
- /* flush any data in the FIFO */
- if (fifo && !(state->flags & DMA_IN_PROGRESS)) {
-printf("asc_intr: fifo flush %d len %d fifo %x\n", fifo, len, regs->asc_fifo);
- regs->asc_cmd = ASC_CMD_FLUSH;
- readback(regs->asc_cmd);
- DELAY(2);
- }
- else if (fifo && state->flags & DMA_IN_PROGRESS) {
- if (state->flags & DMA_OUT) {
- len += fifo; /* Bytes dma'ed but not sent */
- }
- else if (state->flags & DMA_IN) {
- u_char *cp;
-
- printf("asc_intr: IN: dmalen %d len %d fifo %d\n",
- state->dmalen, len, fifo); /* XXX */
- }
- regs->asc_cmd = ASC_CMD_FLUSH;
- readback(regs->asc_cmd);
- DELAY(2);
- }
- if (len && (state->flags & DMA_IN_PROGRESS)) {
- /* save number of bytes still to be sent or received */
- state->dmaresid = len;
- state->flags &= ~DMA_IN_PROGRESS;
- ASC_TC_PUT(regs, 0);
-#ifdef DEBUG
- if (asc_logp == asc_log)
- asc_log[NLOG - 1].resid = len;
- else
- asc_logp[-1].resid = len;
-#endif
- /* setup state to resume to */
- if (state->flags & DMA_IN) {
- /*
- * Since the ASC_CNFG3_SRB bit of the
- * cnfg3 register bit is not set,
- * we just transferred an extra byte.
- * Since we can't resume on an odd byte
- * boundary, we copy the valid data out
- * and resume DMA at the start address.
- */
- if (len & 1) {
- printf("asc_intr: msg in len %d (fifo %d)\n",
- len, fifo); /* XXX */
- len = state->dmalen - len;
- goto do_in;
- }
- DMA_END(&asc->dma);
- state->script =
- &asc_scripts[SCRIPT_RESUME_DMA_IN];
- } else if (state->flags & DMA_OUT)
- state->script =
- &asc_scripts[SCRIPT_RESUME_DMA_OUT];
- else
- state->script = asc->script;
- } else if (state->flags & DMA_IN) {
- if (len) {
-#ifdef DEBUG
- printf("asc_intr: 1: bn %d len %d (fifo %d)\n",
- asc_debug_bn, len, fifo); /* XXX */
-#endif
- goto abort;
- }
- /* setup state to resume to */
- if (state->flags & DMA_IN_PROGRESS) {
- len = state->dmalen;
- state->flags &= ~DMA_IN_PROGRESS;
- do_in:
- DMA_END(&asc->dma);
- state->buf += len;
- state->buflen -= len;
- }
- if (state->buflen)
- state->script =
- &asc_scripts[SCRIPT_RESUME_IN];
- else
- state->script =
- &asc_scripts[SCRIPT_RESUME_NO_DATA];
- } else if (state->flags & DMA_OUT) {
- if (len) {
- printf("asc_intr: 2: len %d (fifo %d)\n", len,
- fifo); /* XXX */
-/* XXX THEO */
-#if 1
- regs->asc_cmd = ASC_CMD_FLUSH;
- readback(regs->asc_cmd);
- DELAY(2);
- len = 0;
-#else
- goto abort;
-#endif
- }
- /*
- * If this is the last chunk, the next expected
- * state is to get status.
- */
- if (state->flags & DMA_IN_PROGRESS) {
- state->flags &= ~DMA_IN_PROGRESS;
- DMA_END(&asc->dma);
- len = state->dmalen;
- state->buf += len;
- state->buflen -= len;
- }
- if (state->buflen)
- state->script =
- &asc_scripts[SCRIPT_RESUME_OUT];
- else
- state->script =
- &asc_scripts[SCRIPT_RESUME_NO_DATA];
- } else if (asc->script == &asc_scripts[SCRIPT_SIMPLE])
- state->script = &asc_scripts[SCRIPT_RESUME_NO_DATA];
- else
- state->script = asc->script;
-
- /* setup to receive a message */
- asc->script = &asc_scripts[SCRIPT_MSG_IN];
- state->msglen = 0;
- regs->asc_cmd = ASC_CMD_XFER_INFO;
- readback(regs->asc_cmd);
- goto done;
- }
-
- /* check for SCSI bus reset */
- if (ir & ASC_INT_RESET) {
- register int i;
-
- printf("%s: SCSI bus reset!!\n", asc->sc_dev.dv_xname);
- /* need to flush any pending commands */
- for (i = 0; i < ASC_NCMD; i++) {
- if (!asc->cmd[i])
- continue;
- asc->cmd[i]->error = XS_DRIVER_STUFFUP;
- asc_end(asc, 0, 0, 0);
- }
- /* rearbitrate synchronous offset */
- for (i = 0; i < ASC_NCMD; i++) {
- asc->st[i].sync_offset = 0;
- asc->st[i].flags = 0;
- }
- asc->target = -1;
- return;
- }
-
- /* check for command errors */
- if (ir & ASC_INT_ILL)
- goto abort;
-
- /* check for disconnect */
- if (ir & ASC_INT_DISC) {
- state = &asc->st[asc->target];
- switch (asc->script - asc_scripts) {
- case SCRIPT_DONE:
- case SCRIPT_DISCONNECT:
- /*
- * Disconnects can happen normally when the
- * command is complete with the phase being
- * either ASC_PHASE_DATAO or ASC_PHASE_MSG_IN.
- * The SCRIPT_MATCH() only checks for one phase
- * so we can wind up here.
- * Perform the appropriate operation, then proceed.
- */
- if ((*scpt->action)(asc, status, ss, ir)) {
- regs->asc_cmd = scpt->command;
- readback(regs->asc_cmd);
- asc->script = scpt->next;
- }
- goto done;
-
- case SCRIPT_TRY_SYNC:
- case SCRIPT_SIMPLE:
- case SCRIPT_DATA_IN:
- case SCRIPT_DATA_OUT: /* one of the starting scripts */
- if (ASC_SS(ss) == 0) {
- /* device did not respond */
- if (regs->asc_flags & ASC_FLAGS_FIFO_CNT) {
- regs->asc_cmd = ASC_CMD_FLUSH;
- readback(regs->asc_cmd);
- }
- asc->cmd[asc->target]->error = XS_DRIVER_STUFFUP;
- asc_end(asc, status, ss, ir);
- return;
- }
- /* FALLTHROUGH */
-
- default:
- printf("%s: SCSI device %d: unexpected disconnect\n",
- asc->sc_dev.dv_xname, asc->target);
-#ifdef DEBUG
- asc_DumpLog("asc_disc");
-#endif
- /*
- * On rare occasions my RZ24 does a disconnect during
- * data in phase and the following seems to keep it
- * happy.
- * XXX Should a scsi disk ever do this??
- */
- asc->script = &asc_scripts[SCRIPT_RESEL];
- asc->state = ASC_STATE_RESEL;
- state->flags |= DISCONN;
- regs->asc_cmd = ASC_CMD_ENABLE_SEL;
- readback(regs->asc_cmd);
- return;
- }
- }
-
- /* check for reselect */
- if (ir & ASC_INT_RESEL) {
- unsigned fifo, id, msg;
-
- fifo = regs->asc_flags & ASC_FLAGS_FIFO_CNT;
- if (fifo < 2)
- goto abort;
- /* read unencoded SCSI ID and convert to binary */
- msg = regs->asc_fifo & asc->myidmask;
- for (id = 0; (msg & 1) == 0; id++)
- msg >>= 1;
- /* read identify message */
- msg = regs->asc_fifo;
-#ifdef DEBUG
- if (asc_logp == asc_log)
- asc_log[NLOG - 1].msg = msg;
- else
- asc_logp[-1].msg = msg;
-#endif
- asc->state = ASC_STATE_BUSY;
- asc->target = id;
- state = &asc->st[id];
- asc->script = state->script;
- state->script = (script_t *)0;
- if (!(state->flags & DISCONN))
- goto abort;
- state->flags &= ~DISCONN;
- regs->asc_syn_p = state->sync_period;
- regs->asc_syn_o = state->sync_offset;
- regs->asc_cmd = ASC_CMD_MSG_ACPT;
- readback(regs->asc_cmd);
- goto done;
- }
-
- /* check if we are being selected as a target */
- if (ir & (ASC_INT_SEL | ASC_INT_SEL_ATN))
- goto abort;
-
- /*
- * 'ir' must be just ASC_INT_FC.
- * This is normal if canceling an ASC_ENABLE_SEL.
- */
-
-done:
- wbflush();
- /*
- * If the next interrupt comes in immediatly the interrupt
- * dispatcher (which we are returning to) will catch it
- * before returning to the interrupted code.
- */
- return;
-
-abort:
-#ifdef DEBUG
- asc_DumpLog("asc_intr");
-#endif
-#if 0
- panic("asc_intr");
-#else
- boot(4); /* XXX */
-#endif
-}
-
-/*
- * All the many little things that the interrupt
- * routine might switch to.
- */
-
-/* ARGSUSED */
-static int
-script_nop(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- return (1);
-}
-
-/* ARGSUSED */
-static int
-asc_get_status(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register int data;
-
- /*
- * Get the last two bytes in the FIFO.
- */
- if ((data = regs->asc_flags & ASC_FLAGS_FIFO_CNT) != 2) {
- printf("asc_get_status: cmdreg %x, fifo cnt %d\n",
- regs->asc_cmd, data); /* XXX */
-#ifdef DEBUG
- asc_DumpLog("get_status"); /* XXX */
-#endif
- if (data < 2) {
- asc->regs->asc_cmd = ASC_CMD_MSG_ACPT;
- readback(asc->regs->asc_cmd);
- return (0);
- }
- do {
- data = regs->asc_fifo;
- } while ((regs->asc_flags & ASC_FLAGS_FIFO_CNT) > 2);
- }
-
- /* save the status byte */
- asc->st[asc->target].statusByte = data = regs->asc_fifo;
-#ifdef DEBUG
- if (asc_logp == asc_log)
- asc_log[NLOG - 1].msg = data;
- else
- asc_logp[-1].msg = data;
-#endif
-
- /* get the (presumed) command_complete message */
- if ((data = regs->asc_fifo) == SCSI_COMMAND_COMPLETE)
- return (1);
-
-#ifdef DEBUG
- printf("asc_get_status: status %x cmd %x\n",
- asc->st[asc->target].statusByte, data);
- asc_DumpLog("asc_get_status");
-#endif
- return (0);
-}
-
-/* ARGSUSED */
-static int
-asc_end(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- struct scsi_xfer *scsicmd;
- struct scsi_link *sc_link;
- State *state;
- int i, target;
-
- asc->state = ASC_STATE_IDLE;
- target = asc->target;
- asc->target = -1;
- scsicmd = asc->cmd[target];
- sc_link = scsicmd->sc_link;
- asc->cmd[target] = (struct scsi_xfer *)0;
- state = &asc->st[target];
-
-#ifdef DEBUG
- if (asc_debug > 1) {
- printf("asc_end: %s target %d cmd %x err %d resid %d\n",
- asc->sc_dev.dv_xname, target,
- state->cmd.opcode, scsicmd->error, state->buflen);
- }
-#endif
-#ifdef DIAGNOSTIC
- if (target < 0 || !scsicmd)
- panic("asc_end");
-#endif
-
- /* look for disconnected devices */
- for (i = 0; i < ASC_NCMD; i++) {
- if (!asc->cmd[i] || !(asc->st[i].flags & DISCONN))
- continue;
- asc->regs->asc_cmd = ASC_CMD_ENABLE_SEL;
- readback(asc->regs->asc_cmd);
- asc->state = ASC_STATE_RESEL;
- asc->script = &asc_scripts[SCRIPT_RESEL];
- break;
- }
-
- if(scsicmd->error == XS_NOERROR && !(state->flags & CHECK_SENSE)) {
- if((state->statusByte & ST_MASK) == SCSI_CHECK) {
- struct scsi_sense *ss = (void *)&state->cmd;
- /* Save return values */
- scsicmd->resid = state->buflen;
- scsicmd->status = state->statusByte;
- /* Set up sense request command */
- bzero(ss, sizeof(*ss));
- ss->opcode = REQUEST_SENSE;
- ss->byte2 = sc_link->lun << 5;
- ss->length = sizeof(struct scsi_sense_data);
- state->cmdlen = sizeof(*ss);
- state->buf = (vm_offset_t)&scsicmd->sense;
- state->buflen = sizeof(struct scsi_sense_data);
- state->flags |= CHECK_SENSE;
-#ifdef R4K
- R4K_HitFlushDCache(state->buf, state->buflen);
-#else
-#ifndef ASC_NOFLUSH
- R3K_FlushDCache();
-#endif
-#endif
- asc->cmd[target] = scsicmd;
- asc_startcmd(asc, target);
- return(0);
- }
- }
-
- if(scsicmd->error == XS_NOERROR && (state->flags & CHECK_SENSE)) {
- scsicmd->error = XS_SENSE;
- }
- else {
- scsicmd->resid = state->buflen;
- }
- state->flags &= ~CHECK_SENSE;
-
- /*
- * Look for another device that is ready.
- * May want to keep last one started and increment for fairness
- * rather than always starting at zero.
- */
- for (i = 0; i < ASC_NCMD; i++) {
- if (asc->cmd[i] == 0 && asc->cmdq[i] != 0) {
- asc->cmd[i] = asc->cmdq[i];
- asc->cmdq[i] = 0;
- }
- }
- for (i = 0; i < ASC_NCMD; i++) {
- /* don't restart a disconnected command */
- if (!asc->cmd[i] || (asc->st[i].flags & DISCONN))
- continue;
- asc_startcmd(asc, i);
- break;
- }
-
- /* signal device driver that the command is done */
- scsicmd->flags |= ITSDONE;
- scsi_done(scsicmd);
-
- return (0);
-}
-
-/* ARGSUSED */
-static int
-asc_dma_in(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register State *state = &asc->st[asc->target];
- register int len;
-
- /* check for previous chunk in buffer */
- if (state->flags & DMA_IN_PROGRESS) {
- /*
- * Only count bytes that have been copied to memory.
- * There may be some bytes in the FIFO if synchonous transfers
- * are in progress.
- */
- DMA_END(&asc->dma);
- ASC_TC_GET(regs, len);
- len = state->dmalen - len;
- state->buf += len;
- state->buflen -= len;
- }
-
- /* setup to start reading the next chunk */
- len = state->buflen;
-#ifdef DEBUG
- if (asc_logp == asc_log)
- asc_log[NLOG - 1].resid = len;
- else
- asc_logp[-1].resid = len;
-#endif
- if (len > state->dmaBufSize)
- len = state->dmaBufSize;
- state->dmalen = len;
- DMA_START(&asc->dma, (caddr_t)state->buf, len, DMA_FROM_DEV);
- ASC_TC_PUT(regs, len);
-#ifdef DEBUG
- if (asc_debug > 2)
- printf("asc_dma_in: buflen %d, len %d\n", state->buflen, len);
-#endif
-
- /* check for next chunk */
- state->flags |= DMA_IN_PROGRESS;
- if (len != state->buflen) {
- regs->asc_cmd = ASC_CMD_XFER_INFO | ASC_CMD_DMA;
- readback(regs->asc_cmd);
- asc->script = &asc_scripts[SCRIPT_CONTINUE_IN];
- return (0);
- }
- return (1);
-}
-
-/* ARGSUSED */
-static int
-asc_last_dma_in(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register State *state = &asc->st[asc->target];
- register int len, fifo;
-
- DMA_END(&asc->dma);
- ASC_TC_GET(regs, len);
- fifo = regs->asc_flags & ASC_FLAGS_FIFO_CNT;
-#ifdef DEBUG
- if (asc_debug > 2)
- printf("asc_last_dma_in: buflen %d dmalen %d tc %d fifo %d\n",
- state->buflen, state->dmalen, len, fifo);
-#endif
- if (fifo) {
- /* device must be trying to send more than we expect */
- regs->asc_cmd = ASC_CMD_FLUSH;
- readback(regs->asc_cmd);
- }
- state->flags &= ~DMA_IN_PROGRESS;
- len = state->dmalen - len;
- state->buflen -= len;
-
- return (1);
-}
-
-/* ARGSUSED */
-static int
-asc_resume_in(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register State *state = &asc->st[asc->target];
- register int len;
-
- /* setup to start reading the next chunk */
- len = state->buflen;
-#ifdef DEBUG
- if (asc_logp == asc_log)
- asc_log[NLOG - 1].resid = len;
- else
- asc_logp[-1].resid = len;
-#endif
- if (len > state->dmaBufSize)
- len = state->dmaBufSize;
- state->dmalen = len;
-#ifdef DEBUG
- if (asc_logp == asc_log)
- asc_log[NLOG - 1].resid = len;
- else
- asc_logp[-1].resid = len;
-#endif
- DMA_START(&asc->dma, (caddr_t)state->buf, len, DMA_FROM_DEV);
- ASC_TC_PUT(regs, len);
-#ifdef DEBUG
- if (asc_debug > 2)
- printf("asc_resume_in: buflen %d, len %d\n", state->buflen,
- len);
-#endif
-
- /* check for next chunk */
- state->flags |= DMA_IN_PROGRESS;
- if (len != state->buflen) {
- regs->asc_cmd = ASC_CMD_XFER_INFO | ASC_CMD_DMA;
- readback(regs->asc_cmd);
- asc->script = &asc_scripts[SCRIPT_CONTINUE_IN];
- return (0);
- }
- return (1);
-}
-
-/* ARGSUSED */
-static int
-asc_resume_dma_in(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register State *state = &asc->st[asc->target];
- register int len, off;
-
- /* setup to finish reading the current chunk */
- len = state->dmaresid;
- off = state->dmalen - len;
- if ((off & 1) && state->sync_offset) {
- printf("asc_resume_dma_in: odd xfer dmalen %d len %d off %d\n",
- state->dmalen, len, off); /* XXX */
- regs->asc_res_fifo = ((u_char *)state->buf)[off];
-/*XXX Need to flush cache ? */
- }
- DMA_START(&asc->dma, (caddr_t)state->buf + off, len, DMA_FROM_DEV);
- ASC_TC_PUT(regs, len);
-#ifdef DEBUG
- if (asc_debug > 2)
- printf("asc_resume_dma_in: buflen %d dmalen %d len %d off %d\n",
- state->dmalen, state->buflen, len, off);
-#endif
-
- /* check for next chunk */
- state->flags |= DMA_IN_PROGRESS;
- if (state->dmalen != state->buflen) {
- regs->asc_cmd = ASC_CMD_XFER_INFO | ASC_CMD_DMA;
- readback(regs->asc_cmd);
- asc->script = &asc_scripts[SCRIPT_CONTINUE_IN];
- return (0);
- }
- return (1);
-}
-
-/* ARGSUSED */
-static int
-asc_dma_out(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register State *state = &asc->st[asc->target];
- register int len, fifo;
-
- if (state->flags & DMA_IN_PROGRESS) {
- /* check to be sure previous chunk was finished */
- ASC_TC_GET(regs, len);
- fifo = regs->asc_flags & ASC_FLAGS_FIFO_CNT;
- if (len || fifo)
- printf("asc_dma_out: buflen %d dmalen %d tc %d fifo %d\n",
- state->buflen, state->dmalen, len, fifo); /* XXX */
- len += fifo;
- len = state->dmalen - len;
- state->buf += len;
- state->buflen -= len;
- }
-
- /* setup for this chunk */
- len = state->buflen;
-#ifdef DEBUG
- if (asc_logp == asc_log)
- asc_log[NLOG - 1].resid = len;
- else
- asc_logp[-1].resid = len;
-#endif
- if (len > state->dmaBufSize)
- len = state->dmaBufSize;
- state->dmalen = len;
- DMA_START(&asc->dma, (caddr_t)state->buf, len, DMA_TO_DEV);
- ASC_TC_PUT(regs, len);
-#ifdef DEBUG
- if (asc_debug > 2)
- printf("asc_dma_out: buflen %d, len %d\n", state->buflen, len);
-#endif
-
- /* check for next chunk */
- state->flags |= DMA_IN_PROGRESS;
- if (len != state->buflen) {
- regs->asc_cmd = ASC_CMD_XFER_INFO | ASC_CMD_DMA;
- readback(regs->asc_cmd);
- asc->script = &asc_scripts[SCRIPT_CONTINUE_OUT];
- return (0);
- }
- return (1);
-}
-
-/* ARGSUSED */
-static int
-asc_last_dma_out(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register State *state = &asc->st[asc->target];
- register int len, fifo;
-
- ASC_TC_GET(regs, len);
- fifo = regs->asc_flags & ASC_FLAGS_FIFO_CNT;
-#ifdef DEBUG
- if (asc_debug > 2)
- printf("asc_last_dma_out: buflen %d dmalen %d tc %d fifo %d\n",
- state->buflen, state->dmalen, len, fifo);
-#endif
- if (fifo) {
- len += fifo;
- regs->asc_cmd = ASC_CMD_FLUSH;
- readback(regs->asc_cmd);
- }
- state->flags &= ~DMA_IN_PROGRESS;
- len = state->dmalen - len;
- state->buflen -= len;
- return (1);
-}
-
-/* ARGSUSED */
-static int
-asc_resume_out(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register State *state = &asc->st[asc->target];
- register int len;
-
- /* setup for this chunk */
- len = state->buflen;
-#ifdef DEBUG
- if (asc_logp == asc_log)
- asc_log[NLOG - 1].resid = len;
- else
- asc_logp[-1].resid = len;
-#endif
- if (len > state->dmaBufSize)
- len = state->dmaBufSize;
- state->dmalen = len;
-#ifdef DEBUG
- if (asc_logp == asc_log)
- asc_log[NLOG - 1].resid = len;
- else
- asc_logp[-1].resid = len;
-#endif
- DMA_START(&asc->dma, (caddr_t)state->buf, len, DMA_TO_DEV);
- ASC_TC_PUT(regs, len);
-#ifdef DEBUG
- if (asc_debug > 2)
- printf("asc_resume_out: buflen %d, len %d\n", state->buflen,
- len);
-#endif
-
- /* check for next chunk */
- state->flags |= DMA_IN_PROGRESS;
- if (len != state->buflen) {
- regs->asc_cmd = ASC_CMD_XFER_INFO | ASC_CMD_DMA;
- readback(regs->asc_cmd);
- asc->script = &asc_scripts[SCRIPT_CONTINUE_OUT];
- return (0);
- }
- return (1);
-}
-
-/* ARGSUSED */
-static int
-asc_resume_dma_out(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register State *state = &asc->st[asc->target];
- register int len, off;
-
- /* setup to finish writing this chunk */
- len = state->dmaresid;
- off = state->dmalen - len;
- if (off & 1) {
- printf("asc_resume_dma_out: odd xfer dmalen %d len %d off %d\n",
- state->dmalen, len, off); /* XXX */
- regs->asc_fifo = ((u_char *)state->buf)[off];
-/*XXX Need to flush Cache ? */
- off++;
- len--;
- }
- DMA_START(&asc->dma, (caddr_t)state->buf + off, len, DMA_TO_DEV);
- ASC_TC_PUT(regs, len);
-#ifdef DEBUG
- if (asc_debug > 2)
- printf("asc_resume_dma_out: buflen %d dmalen %d len %d off %d\n",
- state->dmalen, state->buflen, len, off);
-#endif
-
- /* check for next chunk */
- state->flags |= DMA_IN_PROGRESS;
- if (state->dmalen != state->buflen) {
- regs->asc_cmd = ASC_CMD_XFER_INFO | ASC_CMD_DMA;
- readback(regs->asc_cmd);
- asc->script = &asc_scripts[SCRIPT_CONTINUE_OUT];
- return (0);
- }
- return (1);
-}
-
-/* ARGSUSED */
-static int
-asc_sendsync(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register State *state = &asc->st[asc->target];
-
- /* send the extended synchronous negotiation message */
- regs->asc_fifo = SCSI_EXTENDED_MSG;
- wbflush();
- regs->asc_fifo = 3;
- wbflush();
- regs->asc_fifo = SCSI_SYNCHRONOUS_XFER;
- wbflush();
- regs->asc_fifo = SCSI_MIN_PERIOD;
- wbflush();
- regs->asc_fifo = ASC_MAX_OFFSET;
- /* state to resume after we see the sync reply message */
- state->script = asc->script + 2;
- state->msglen = 0;
- return (1);
-}
-
-/* ARGSUSED */
-static int
-asc_replysync(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register State *state = &asc->st[asc->target];
-
-#ifdef DEBUG
- if (asc_debug > 2)
- printf("asc_replysync: %x %x\n",
- asc_to_scsi_period[state->sync_period] * asc->tb_ticks,
- state->sync_offset);
-#endif
- /* send synchronous transfer in response to a request */
- regs->asc_fifo = SCSI_EXTENDED_MSG;
- wbflush();
- regs->asc_fifo = 3;
- wbflush();
- regs->asc_fifo = SCSI_SYNCHRONOUS_XFER;
- wbflush();
- regs->asc_fifo = asc_to_scsi_period[state->sync_period] * asc->tb_ticks;
- wbflush();
- regs->asc_fifo = state->sync_offset;
- regs->asc_cmd = ASC_CMD_XFER_INFO;
- readback(regs->asc_cmd);
-
- /* return to the appropriate script */
- if (!state->script) {
-#ifdef DEBUG
- asc_DumpLog("asc_replsync");
-#endif
- panic("asc_replysync");
- }
- asc->script = state->script;
- state->script = (script_t *)0;
- return (0);
-}
-
-/* ARGSUSED */
-static int
-asc_msg_in(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register asc_regmap_t *regs = asc->regs;
- register State *state = &asc->st[asc->target];
- register int msg;
- int i;
-
- /* read one message byte */
- msg = regs->asc_fifo;
-#ifdef DEBUG
- if (asc_logp == asc_log)
- asc_log[NLOG - 1].msg = msg;
- else
- asc_logp[-1].msg = msg;
-#endif
-
- /* check for multi-byte message */
- if (state->msglen != 0) {
- /* first byte is the message length */
- if (state->msglen < 0) {
- state->msglen = msg;
- return (1);
- }
- if (state->msgcnt >= state->msglen)
- goto abort;
- state->msg_in[state->msgcnt++] = msg;
-
- /* did we just read the last byte of the message? */
- if (state->msgcnt != state->msglen)
- return (1);
-
- /* process an extended message */
-#ifdef DEBUG
- if (asc_debug > 2)
- printf("asc_msg_in: msg %x %x %x\n",
- state->msg_in[0],
- state->msg_in[1],
- state->msg_in[2]);
-#endif
- switch (state->msg_in[0]) {
- case SCSI_SYNCHRONOUS_XFER:
- state->flags |= DID_SYNC;
- state->sync_offset = state->msg_in[2];
-
- /* convert SCSI period to ASC period */
- i = state->msg_in[1] / asc->tb_ticks;
- if (i < asc->min_period)
- i = asc->min_period;
- else if (i >= asc->max_period) {
- /* can't do sync transfer, period too long */
- printf("%s: SCSI device %d: sync xfer period too long (%d)\n",
- asc->sc_dev.dv_xname, asc->target, i);
- i = asc->max_period;
- state->sync_offset = 0;
- }
- if ((i * asc->tb_ticks) != state->msg_in[1])
- i++;
- state->sync_period = i & 0x1F;
-
- /*
- * If this is a request, check minimums and
- * send back an acknowledge.
- */
- if (!(state->flags & TRY_SYNC)) {
- regs->asc_cmd = ASC_CMD_SET_ATN;
- readback(regs->asc_cmd);
-
- if (state->sync_period < asc->min_period)
- state->sync_period =
- asc->min_period;
- if (state->sync_offset > ASC_MAX_OFFSET)
- state->sync_offset =
- ASC_MAX_OFFSET;
- asc->script = &asc_scripts[SCRIPT_REPLY_SYNC];
- regs->asc_syn_p = state->sync_period;
- readback(regs->asc_syn_p);
- regs->asc_syn_o = state->sync_offset;
- readback(regs->asc_syn_o);
- regs->asc_cmd = ASC_CMD_MSG_ACPT;
- readback(regs->asc_cmd);
- return (0);
- }
-
- regs->asc_syn_p = state->sync_period;
- readback(regs->asc_syn_p);
- regs->asc_syn_o = state->sync_offset;
- readback(regs->asc_syn_o);
- goto done;
-
- default:
- printf("%s: SCSI device %d: rejecting extended message 0x%x\n",
- asc->sc_dev.dv_xname, asc->target,
- state->msg_in[0]);
- goto reject;
- }
- }
-
- /* process first byte of a message */
-#ifdef DEBUG
- if (asc_debug > 2)
- printf("asc_msg_in: msg %x\n", msg);
-#endif
- switch (msg) {
-#if 0
- case SCSI_MESSAGE_REJECT:
- printf(" did not like SYNCH xfer "); /* XXX */
- state->flags |= DID_SYNC;
- regs->asc_cmd = ASC_CMD_MSG_ACPT;
- readback(regs->asc_cmd);
- status = asc_wait(regs, ASC_CSR_INT);
- ir = regs->asc_intr;
- /* some just break out here, some dont */
- if (ASC_PHASE(status) == ASC_PHASE_MSG_OUT) {
- regs->asc_fifo = SCSI_ABORT;
- regs->asc_cmd = ASC_CMD_XFER_INFO;
- readback(regs->asc_cmd);
- status = asc_wait(regs, ASC_CSR_INT);
- ir = regs->asc_intr;
- }
- if (ir & ASC_INT_DISC) {
- asc_end(asc, status, 0, ir);
- return (0);
- }
- goto status;
-#endif /* 0 */
-
- case SCSI_EXTENDED_MSG: /* read an extended message */
- /* setup to read message length next */
- state->msglen = -1;
- state->msgcnt = 0;
- return (1);
-
- case SCSI_NO_OP:
- break;
-
- case SCSI_SAVE_DATA_POINTER:
- /* expect another message */
- return (1);
-
- case SCSI_RESTORE_POINTERS:
- /*
- * Need to do the following if resuming synchonous data in
- * on an odd byte boundary.
- regs->asc_cnfg2 |= ASC_CNFG2_RFB;
- */
- break;
-
- case SCSI_DISCONNECT:
- if (state->flags & DISCONN)
- goto abort;
- state->flags |= DISCONN;
- regs->asc_cmd = ASC_CMD_MSG_ACPT;
- readback(regs->asc_cmd);
- asc->script = &asc_scripts[SCRIPT_DISCONNECT];
- return (0);
-
- default:
- printf("%s: SCSI device %d: rejecting message 0x%x\n",
- asc->sc_dev.dv_xname, asc->target, msg);
- reject:
- /* request a message out before acknowledging this message */
- state->msg_out = SCSI_MESSAGE_REJECT;
- regs->asc_cmd = ASC_CMD_SET_ATN;
- readback(regs->asc_cmd);
- }
-
-done:
- /* return to original script */
- regs->asc_cmd = ASC_CMD_MSG_ACPT;
- readback(regs->asc_cmd);
- if (!state->script) {
- abort:
-#ifdef DEBUG
- asc_DumpLog("asc_msg_in");
-#endif
- panic("asc_msg_in");
- }
- asc->script = state->script;
- state->script = (script_t *)0;
- return (0);
-}
-
-/* ARGSUSED */
-static int
-asc_disconnect(asc, status, ss, ir)
- register asc_softc_t asc;
- register int status, ss, ir;
-{
- register State *state = &asc->st[asc->target];
-
-#ifdef DIAGNOSTIC
- if (!(state->flags & DISCONN)) {
- printf("asc_disconnect: device %d: DISCONN not set!\n",
- asc->target);
- }
-#endif /* DIAGNOSTIC */
- asc->target = -1;
- asc->state = ASC_STATE_RESEL;
- return (1);
-}
-
-#ifdef DEBUG
-/*
- * Dump the log buffer.
- */
-asc_DumpLog(str)
- char *str;
-{
- register struct asc_log *lp;
- register u_int status;
-
- printf("asc: %s: cmd %x bn %d cnt %d\n", str, asc_debug_cmd,
- asc_debug_bn, asc_debug_sz);
- lp = asc_logp;
- do {
- status = lp->status;
- printf("asc%d tgt %d status %x ss %x ir %x cond %d:%x msg %x resid %d\n",
- status >> 24,
- lp->target,
- (status >> 16) & 0xFF,
- (status >> 8) & 0xFF,
- status & 0XFF,
- lp->state,
- asc_scripts[lp->state].condition,
- lp->msg, lp->resid);
- if (++lp >= &asc_log[NLOG])
- lp = asc_log;
- } while (lp != asc_logp);
-}
-#endif /* DEBUG */
-
-#endif /* NASC > 0 */
diff --git a/sys/arch/wgrisc/dev/ascreg.h b/sys/arch/wgrisc/dev/ascreg.h
deleted file mode 100644
index b97502853d6..00000000000
--- a/sys/arch/wgrisc/dev/ascreg.h
+++ /dev/null
@@ -1,326 +0,0 @@
-/* $OpenBSD: ascreg.h,v 1.1.1.1 1997/02/06 16:02:42 pefo Exp $ */
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell and Rick Macklem.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)ascreg.h 8.1 (Berkeley) 6/10/93
- * $Id: ascreg.h,v 1.1.1.1 1997/02/06 16:02:42 pefo Exp $
- */
-
-/*
- * Mach Operating System
- * Copyright (c) 1991,1990,1989 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-/*
- * HISTORY
- * Log: scsi_53C94.h,v
- * Revision 2.4 91/02/05 17:44:59 mrt
- * Added author notices
- * [91/02/04 11:18:32 mrt]
- *
- * Changed to use new Mach copyright
- * [91/02/02 12:17:11 mrt]
- *
- * Revision 2.3 90/12/05 23:34:46 af
- * Documented max DMA xfer size.
- * [90/12/03 23:39:36 af]
- *
- * Revision 2.1.1.1 90/11/01 03:38:54 af
- * Created, from the DEC specs:
- * "PMAZ-AA TURBOchannel SCSI Module Functional Specification"
- * Workstation Systems Engineering, Palo Alto, CA. Aug 27, 1990.
- * And from the NCR data sheets
- * "NCR 53C94, 53C95, 53C96 Advanced SCSI Controller"
- * [90/09/03 af]
- */
-
-/*
- * File: scsi_53C94.h
- * Author: Alessandro Forin, Carnegie Mellon University
- * Date: 9/90
- *
- * Defines for the NCR 53C94 ASC (SCSI interface)
- * Some gotcha came from the "86C01/53C94 DMA lab work" written
- * by Ken Stewart (NCR MED Logic Products Applications Engineer)
- * courtesy of NCR. Thanks Ken !
- */
-
-#define ASC_OFFSET_53C94 0x0 /* from module base */
-
-#define ASC_NCMD 7 /* Number of simultaneous cmds */
-
-/*
- * Synch xfer parameters, and timing conversions
- */
-#define SCSI_MIN_PERIOD 50 /* in 4 nsecs units */
-#define ASC_MIN_PERIOD40 8 /* in CLKS/BYTE, 1 CLK = 25nsecs */
-#define ASC_MIN_PERIOD25 5 /* in CLKS/BYTE, 1 CLK = 40nsecs */
-#define ASC_MIN_PERIOD20 4 /* in CLKS/BYTE, 1 CLK = 50nsecs */
-#define ASC_MIN_PERIOD12 3 /* in CLKS/BYTE, 1 CLK = 80nsecs */
-#define ASC_MAX_PERIOD40 56 /* in CLKS/BYTE, 1 CLK = 25nsecs */
-#define ASC_MAX_PERIOD25 35 /* in CLKS/BYTE, 1 CLK = 40nsecs */
-#define ASC_MAX_PERIOD20 28 /* in CLKS/BYTE, 1 CLK = 50nsecs */
-#define ASC_MAX_PERIOD12 18 /* in CLKS/BYTE, 1 CLK = 80nsecs */
-#define ASC_MAX_OFFSET 15 /* pure number */
-/*
- * Register map, padded as needed
- */
-
-typedef volatile struct {
- u_char asc_tc_lsb; /* 00 rw: Transfer Counter LSB */
- u_char asc_tc_msb; /* 01 rw: Transfer Counter MSB */
- u_char asc_fifo; /* 02 rw: FIFO top */
- u_char asc_cmd; /* 03 rw: Command */
- u_char asc_status; /* 04 r: Status */
-#define asc_dbus_id asc_status /* 04 w: Destination Bus ID */
- u_char asc_intr; /* 05 r: Interrupt */
-#define asc_sel_timo asc_intr /* 05 w: (re)select timeout */
- u_char asc_ss; /* 06 r: Sequence Step */
-#define asc_syn_p asc_ss /* 06 w: synchronous period */
- u_char asc_flags; /* 07 r: FIFO flags + seq step */
-#define asc_syn_o asc_flags /* 07 w: synchronous offset */
- u_char asc_cnfg1; /* 08 rw: Configuration 1 */
- u_char asc_ccf; /* 09 w: Clock Conv. Factor */
- u_char asc_test; /* 0a w: Test Mode */
- u_char asc_cnfg2; /* 0b rw: Configuration 2 */
- u_char asc_cnfg3; /* 0c rw: Configuration 3 */
- u_char asc_res_fifo; /* 0d w: Reserve FIFO byte */
- u_char asc_tc_xsb; /* 0e rw: Transfer Counter Xtended */
-} asc_regmap_t;
-
-/*
- * Transfer Count: access macros
- * That a NOP is required after loading the dma counter
- * I learned on the NCR test code. Sic.
- */
-
-#define ASC_TC_MAX 0x10000
-
-#define ASC_TC_GET(ptr, val) \
- val = (ptr)->asc_tc_lsb | ((ptr)->asc_tc_msb << 8) | ((ptr)->asc_tc_xsb << 16)
-#define ASC_TC_PUT(ptr, val) \
- (ptr)->asc_tc_lsb = (val); \
- (ptr)->asc_tc_msb = (val) >> 8; \
- (ptr)->asc_tc_xsb = (val) >> 16; \
- (ptr)->asc_cmd = ASC_CMD_NOP | ASC_CMD_DMA;
-
-/*
- * Command register (command codes)
- */
-
-#define ASC_CMD_DMA 0x80
- /* Miscellaneous */
-#define ASC_CMD_NOP 0x00
-#define ASC_CMD_FLUSH 0x01
-#define ASC_CMD_RESET 0x02
-#define ASC_CMD_BUS_RESET 0x03
- /* Initiator state */
-#define ASC_CMD_XFER_INFO 0x10
-#define ASC_CMD_I_COMPLETE 0x11
-#define ASC_CMD_MSG_ACPT 0x12
-#define ASC_CMD_XFER_PAD 0x18
-#define ASC_CMD_SET_ATN 0x1a
-#define ASC_CMD_CLR_ATN 0x1b
- /* Target state */
-#define ASC_CMD_SND_MSG 0x20
-#define ASC_CMD_SND_STATUS 0x21
-#define ASC_CMD_SND_DATA 0x22
-#define ASC_CMD_DISC_SEQ 0x23
-#define ASC_CMD_TERM 0x24
-#define ASC_CMD_T_COMPLETE 0x25
-#define ASC_CMD_DISC 0x27
-#define ASC_CMD_RCV_MSG 0x28
-#define ASC_CMD_RCV_CDB 0x29
-#define ASC_CMD_RCV_DATA 0x2a
-#define ASC_CMD_RCV_CMD 0x2b
-#define ASC_CMD_ABRT_DMA 0x04
- /* Disconnected state */
-#define ASC_CMD_RESELECT 0x40
-#define ASC_CMD_SEL 0x41
-#define ASC_CMD_SEL_ATN 0x42
-#define ASC_CMD_SEL_ATN_STOP 0x43
-#define ASC_CMD_ENABLE_SEL 0x44
-#define ASC_CMD_DISABLE_SEL 0x45
-#define ASC_CMD_SEL_ATN3 0x46
-
-/*
- * Status register, and phase encoding
- */
-
-#define ASC_CSR_INT 0x80
-#define ASC_CSR_GE 0x40
-#define ASC_CSR_PE 0x20
-#define ASC_CSR_TC 0x10
-#define ASC_CSR_VGC 0x08
-#define ASC_CSR_MSG 0x04
-#define ASC_CSR_CD 0x02
-#define ASC_CSR_IO 0x01
-
-#define ASC_PHASE(csr) ((csr) & 0x7)
-#define ASC_PHASE_DATAO 0x0
-#define ASC_PHASE_DATAI 0x1
-#define ASC_PHASE_COMMAND 0x2
-#define ASC_PHASE_STATUS 0x3
- /* 4..5 ANSI reserved */
-#define ASC_PHASE_MSG_OUT 0x6
-#define ASC_PHASE_MSG_IN 0x7
-
-/*
- * Destination Bus ID
- */
-
-#define ASC_DEST_ID_MASK 0x07
-
-/*
- * Interrupt register
- */
-
-#define ASC_INT_RESET 0x80
-#define ASC_INT_ILL 0x40
-#define ASC_INT_DISC 0x20
-#define ASC_INT_BS 0x10
-#define ASC_INT_FC 0x08
-#define ASC_INT_RESEL 0x04
-#define ASC_INT_SEL_ATN 0x02
-#define ASC_INT_SEL 0x01
-
-/*
- * Timeout register:
- *
- * val = (timeout * CLK_freq) / (8192 * CCF);
- */
-
-#define ASC_TIMEOUT_250(clk, ccf) (((clk) * 31) / (ccf))
-
-/*
- * Sequence Step register
- */
-
-#define ASC_SS_RESERVED 0xf0
-#define ASC_SS_SOM 0x08
-#define ASC_SS_MASK 0x07
-#define ASC_SS(ss) ((ss) & ASC_SS_MASK)
-
-/*
- * Synchronous Transfer Period
- */
-
-#define ASC_STP_MASK 0x1f
-#define ASC_STP_MIN 0x05 /* 5 clk per byte */
-#define ASC_STP_MAX 0x04 /* after ovfl, 35 clk/byte */
-
-/*
- * FIFO flags
- */
-
-#define ASC_FLAGS_SEQ_STEP 0xe0
-#define ASC_FLAGS_FIFO_CNT 0x1f
-
-/*
- * Synchronous offset
- */
-
-#define ASC_SYNO_MASK 0x0f /* 0 -> asyn */
-
-/*
- * Configuration 1
- */
-
-#define ASC_CNFG1_SLOW 0x80
-#define ASC_CNFG1_SRD 0x40
-#define ASC_CNFG1_P_TEST 0x20
-#define ASC_CNFG1_P_CHECK 0x10
-#define ASC_CNFG1_TEST 0x08
-#define ASC_CNFG1_MY_BUS_ID 0x07
-
-/*
- * CCF register
- */
-
-#define ASC_CCF(clk) ((((clk) - 1) / 5) + 1)
-
-/*
- * Test register
- */
-
-#define ASC_TEST_XXXX 0xf8
-#define ASC_TEST_HI_Z 0x04
-#define ASC_TEST_I 0x02
-#define ASC_TEST_T 0x01
-
-/*
- * Configuration 2
- */
-
-#define ASC_CNFG2_RFB 0x80
-#define ASC_CNFG2_EPL 0x40
-#define ASC_CNFG2_EBC 0x20
-#define ASC_CNFG2_DREQ_HIZ 0x10
-#define ASC_CNFG2_SCSI2 0x08
-#define ASC_CNFG2_BPA 0x04
-#define ASC_CNFG2_RPE 0x02
-#define ASC_CNFG2_DPE 0x01
-
-/*
- * Configuration 3
- */
-
-#define ASC_CNFG3_RESERVED 0xf8
-#define ASC_CNFG3_SRB 0x04
-#define ASC_CNFG3_ALT_DMA 0x02
-#define ASC_CNFG3_T8 0x01
-
-#define ST_MASK 0x3e
diff --git a/sys/arch/wgrisc/dev/com_risc.c b/sys/arch/wgrisc/dev/com_risc.c
deleted file mode 100644
index a4a88f11d36..00000000000
--- a/sys/arch/wgrisc/dev/com_risc.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/* $OpenBSD: com_risc.c,v 1.3 1999/02/01 16:39:50 pefo Exp $ */
-
-/*
- * Copyright (c) 1993, 1994 Charles Hannum.
- * Copyright (c) 1990 William F. Jolitz, TeleMuse
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This software is a component of "386BSD" developed by
- * William F. Jolitz, TeleMuse.
- * 4. Neither the name of the developer nor the name "386BSD"
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS A COMPONENT OF 386BSD DEVELOPED BY WILLIAM F. JOLITZ
- * AND IS INTENDED FOR RESEARCH AND EDUCATIONAL PURPOSES ONLY. THIS
- * SOFTWARE SHOULD NOT BE CONSIDERED TO BE A COMMERCIAL PRODUCT.
- * THE DEVELOPER URGES THAT USERS WHO REQUIRE A COMMERCIAL PRODUCT
- * NOT MAKE USE OF THIS WORK.
- *
- * FOR USERS WHO WISH TO UNDERSTAND THE 386BSD SYSTEM DEVELOPED
- * BY WILLIAM F. JOLITZ, WE RECOMMEND THE USER STUDY WRITTEN
- * REFERENCES SUCH AS THE "PORTING UNIX TO THE 386" SERIES
- * (BEGINNING JANUARY 1991 "DR. DOBBS JOURNAL", USA AND BEGINNING
- * JUNE 1991 "UNIX MAGAZIN", GERMANY) BY WILLIAM F. JOLITZ AND
- * LYNNE GREER JOLITZ, AS WELL AS OTHER BOOKS ON UNIX AND THE
- * ON-LINE 386BSD USER MANUAL BEFORE USE. A BOOK DISCUSSING THE INTERNALS
- * OF 386BSD ENTITLED "386BSD FROM THE INSIDE OUT" WILL BE AVAILABLE LATE 1992.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE DEVELOPER BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Device Driver for AT parallel printer port
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/tty.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/intr.h>
-
-#include <dev/isa/isavar.h> /* XXX for isa_chipset_tag_t in com_softc */
-
-#include <dev/ic/comreg.h>
-#include <dev/ic/comvar.h>
-#include <dev/ic/ns16550reg.h>
-
-/* Macros to clear/set/test flags. */
-#define SET(t, f) (t) |= (f)
-#define CLR(t, f) (t) &= ~(f)
-#define ISSET(t, f) ((t) & (f))
-
-#undef CONADDR /* This is stupid but using devs before config .. */
-#define CONADDR 0xae400000
-
-int com_risc_probe __P((struct device *, void *, void *));
-void com_risc_attach __P((struct device *, struct device *, void *));
-
-struct cfattach com_risc_ca = {
- sizeof(struct com_softc), com_risc_probe, com_risc_attach
-};
-
-int
-com_risc_probe(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- int iobase, needioh;
- int rv = 1;
- struct confargs *ca = aux;
-
- if(!BUS_MATCHNAME(ca, "com"))
- return(0);
- iobase = (long)BUS_CVTADDR(ca);
- iot = 0;
- needioh = 1;
-
- /* if it's in use as console, it's there. */
- if (iobase == comconsaddr && !comconsattached)
- goto out;
-
- if (needioh && bus_space_map(iot, iobase, COM_NPORTS, 0, &ioh)) {
- rv = 0;
- goto out;
- }
- rv = comprobe1(iot, ioh);
- if (needioh)
- bus_space_unmap(iot, ioh, COM_NPORTS);
-
-out:
- return (rv);
-}
-
-void
-com_risc_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct com_softc *sc = (void *)self;
- int iobase;
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- struct confargs *ca = aux;
-
- sc->sc_hwflags = 0;
- sc->sc_swflags = 0;
- sc->sc_iobase = iobase = (bus_addr_t)BUS_CVTADDR(ca);
- sc->sc_ioh = ioh = (bus_space_handle_t)iobase;
- sc->sc_iot = iot = 0;
-
- if (iobase == comconsaddr) {
- comconsattached = 1;
-
- /*
- * Need to reset baud rate, etc. of next print so reset
- * comconsinit. Also make sure console is always "hardwired".
- */
- delay(1000); /* wait for output to finish */
- comconsinit = 0;
- SET(sc->sc_hwflags, COM_HW_CONSOLE);
- SET(sc->sc_swflags, COM_SW_SOFTCAR);
- }
-
-
- /* look for a NS 16550AF UART with FIFOs */
- sc->sc_fifolen = 1;
- bus_space_write_1(iot, ioh, com_fifo,
- FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_14);
- delay(100);
- if (ISSET(bus_space_read_1(iot, ioh, com_iir), IIR_FIFO_MASK) ==
- IIR_FIFO_MASK) {
- if (ISSET(bus_space_read_1(iot, ioh, com_fifo),
- FIFO_TRIGGER_14) == FIFO_TRIGGER_14) {
- SET(sc->sc_hwflags, COM_HW_FIFO);
- printf(": ns16550a, working fifo\n");
- sc->sc_fifolen = 16;
- }
- else {
- printf(": ns16550, broken fifo\n");
- }
- }
- else {
- printf(": ns8250 or ns16450, no fifo\n");
- }
- bus_space_write_1(iot, ioh, com_fifo, 0);
-
- /* disable interrupts */
- bus_space_write_1(iot, ioh, com_ier, 0);
- bus_space_write_1(iot, ioh, com_mcr, 0);
-
- BUS_INTR_ESTABLISH(ca, comintr, (void *)(long)sc);
-
-#ifdef KGDB
- if (kgdb_dev == makedev(commajor, unit)) {
- if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE))
- kgdb_dev = -1; /* can't debug over console port */
- else {
- cominit(iot, ioh, kgdb_rate);
- if (kgdb_debug_init) {
- /*
- * Print prefix of device name,
- * let kgdb_connect print the rest.
- */
- printf("%s: ", sc->sc_dev.dv_xname);
- kgdb_connect(1);
- } else
- printf("%s: kgdb enabled\n",
- sc->sc_dev.dv_xname);
- }
- }
-#endif
-
- /* XXX maybe move up some? */
- if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE))
- printf("%s: console\n", sc->sc_dev.dv_xname);
-}
diff --git a/sys/arch/wgrisc/dev/dma.h b/sys/arch/wgrisc/dev/dma.h
deleted file mode 100644
index 899cd8ff838..00000000000
--- a/sys/arch/wgrisc/dev/dma.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/* $OpenBSD: dma.h,v 1.4 1997/07/21 11:26:10 pefo Exp $ */
-
-/*
- * Copyright (c) 1996 Per Fogelstrom
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-extern vm_map_t phys_map;
-
-/*
- * Little endian mips uses bounce buffer so flush
- * for dma is not requiered.
- */
-
-#ifdef MIPSEL
-#define ASC_NOFLUSH
-#endif
-
-/*
- * Structure used to control dma.
- */
-
-typedef struct dma_softc {
- struct device sc_dev; /* use as a device */
- struct esp_softc *sc_esp;
- int dma_ch;
- vm_offset_t dma_va; /* Viritual address for transfer */
- vm_offset_t req_va; /* Original request va */
- int req_size; /* Request size */
- int mode; /* Mode register value and direction */
- int sc_active; /* Active flag */
- char **sc_dmaaddr; /* Pointer to dma address in dev */
- int *sc_dmalen; /* Pointer to len counter in dev */
-} dma_softc_t;
-
-#define DMA_TO_DEV 0
-#define DMA_FROM_DEV 1
-
-#define DMA_CH0 0
-#define DMA_CH1 1
-
-#define DMA_RESET(r)
-#if 0
-#define DMA_START(a, b, c, d) \
- { \
- int dcmd; \
- int xcmd; \
- int pa; \
- int sz; \
- if((vm_offset_t)(b) < VM_MIN_KERNEL_ADDRESS) { \
- pa = CACHED_TO_PHYS(b); \
- } \
- else { \
- pa = pmap_extract(vm_map_pmap(phys_map), (vm_offset_t)(b));\
- } \
- sz = c; \
- if(sz + (pa & (NBPG - 1)) > NBPG) { \
- sz = NBPG - (pa & (NBPG - 1)); \
- } \
- dcmd = ((d) == DMA_FROM_DEV) ? 0x30 : 0x10; \
- if((a)->dma_ch == DMA_CH0) { \
- out32(R3715_DMA_ADR0, pa); \
- out32(R3715_DMA_CNT0, sz - 1); \
- xcmd = ~0x30; \
- } \
- else { \
- out32(R3715_DMA_ADR1, pa); \
- out32(R3715_DMA_CNT1, sz - 1); \
- dcmd = dcmd << 6; \
- xcmd = ~(0x30 << 6); \
- } \
- dcmd |= (1 << 26); \
- out32(R3715_IO_TIMING, (in32(R3715_IO_TIMING) & xcmd) | dcmd);\
- }
-#else
-#define DMA_START(a, b, c, d) \
- { \
- int dcmd; \
- int xcmd; \
- int pa; \
- int sz; \
- pa = CACHED_TO_PHYS(dma_buffer); \
- (a)->req_va = (vm_offset_t)(b); \
- (a)->req_size = c; \
- (a)->mode = d; \
- sz = c; \
- if((d) == DMA_TO_DEV) { \
- int *_p = (int *)PHYS_TO_UNCACHED(pa); \
- int *_v = (int *)b; \
- int _n = sz; \
- if(_n) { \
- copynswap(_v, _p, _n); \
- } \
- } \
- dcmd = ((d) == DMA_FROM_DEV) ? 0x30 : 0x10; \
- if((a)->dma_ch == DMA_CH0) { \
- out32(R3715_DMA_ADR0, pa); \
- out32(R3715_DMA_CNT0, sz - 1); \
- xcmd = ~0x30; \
- } \
- else { \
- out32(R3715_DMA_ADR1, pa); \
- out32(R3715_DMA_CNT1, sz - 1); \
- dcmd = dcmd << 6; \
- xcmd = ~(0x30 << 6); \
- } \
- dcmd |= (1 << 26); \
- /* Switch direction before enable */ \
- out32(R3715_IO_TIMING, (in32(R3715_IO_TIMING) & xcmd) | \
- (dcmd & ~0x410)); \
- (void)in16(RISC_STATUS); \
- out32(R3715_IO_TIMING, (in32(R3715_IO_TIMING) & xcmd) | dcmd);\
- }
-#endif
-#define DMA_MAP(a, b, c, d)
-#define DMA_INTR(r)
-#define DMA_DRAIN(r)
-#define DMA_END(c) \
- { \
- int resudial; \
- if((c)->dma_ch == DMA_CH0) { \
- out32(R3715_IO_TIMING, in32(R3715_IO_TIMING) & ~0x10); \
- resudial = in32(R3715_DMA_CNT0); \
- } \
- else { \
- out32(R3715_IO_TIMING, in32(R3715_IO_TIMING) & ~0x400); \
- resudial = in32(R3715_DMA_CNT1); \
- } \
- if(resudial) \
- resudial++; \
- if((c)->mode == DMA_FROM_DEV) { \
- int *_v = (int *)(c)->req_va; \
- int *_p = (int *)PHYS_TO_UNCACHED(CACHED_TO_PHYS(dma_buffer)); \
- int _n = (c)->req_size - resudial; \
- if(_n) { \
- copynswap(_p, _v, _n); \
- } \
- } \
- }
diff --git a/sys/arch/wgrisc/dev/flash.c b/sys/arch/wgrisc/dev/flash.c
deleted file mode 100644
index 44641a401fc..00000000000
--- a/sys/arch/wgrisc/dev/flash.c
+++ /dev/null
@@ -1,852 +0,0 @@
-/* $OpenBSD: flash.c,v 1.3 1998/10/03 21:18:59 millert Exp $ */
-
-/*
- * Copyright (c) 1997 Per Fogelstrom
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom for Willowglen Singapore.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/uio.h>
-#include <sys/buf.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/fcntl.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-#include <machine/pio.h>
-
-#include <wgrisc/riscbus/riscbus.h>
-#include <wgrisc/dev/flashreg.h>
-#include <wgrisc/wgrisc/wgrisctype.h>
-
-extern int cputype;
-
-void flattach __P((struct device *, struct device *, void *));
-int flmatch __P((struct device *, void *, void *));
-
-#define FLUNIT(dev) ((dev & 0xf0) >> 4)
-#define FLPART(dev) (minor(dev) & 0x0f)
-#define MAKEFLDEV(maj, unit, part) MAKEDISKDEV(maj, unit, part)
-
-#define FLLABELDEV(dev) (MAKEFLDEV(major(dev), FLUNIT(dev), RAW_PART))
-
-
-
-/*
- * Flash cache stuff
- */
-
-#define MAX_BLKS 64 /* Define size of cache */
-
-#ifdef IS_THERE_A_16BIT_STORE_PROBLEM
-struct flctag {
- u_int16_t next; /* Pointer to next on list */
- u_int16_t offset; /* Flash memory block offset */
- u_int16_t age; /* LSW of time last updated */
- u_int16_t stat; /* Status */
-};
-
-struct flcache {
- int magic;
- u_int16_t free; /* List of free blocks */
- u_int16_t nfree; /* Number of free blocks left */
- u_int16_t lbusy; /* Last busy block */
- u_int16_t stat; /* Cache status */
- char *cache; /* Pointer to cache data area */
-
- struct flctag flcblk[MAX_BLKS]; /* Flash cache block tags */
-};
-#else
-struct flctag {
- u_int32_t next; /* Pointer to next on list */
- u_int32_t offset; /* Flash memory block offset */
- u_int32_t age; /* LSW of time last updated */
- u_int32_t stat; /* Status */
-};
-
-struct flcache {
- int magic;
- u_int32_t free; /* List of free blocks */
- u_int32_t nfree; /* Number of free blocks left */
- u_int32_t lbusy; /* Last busy block */
- u_int32_t stat; /* Cache status */
- char *cache; /* Pointer to cache data area */
-
- struct flctag flcblk[MAX_BLKS]; /* Flash cache block tags */
-};
-#endif
-
-#define FLC_MAGIC 0xf1cac3e0
-
-#define BLK_SFREE 0x0001 /* Sanity check blk on free */
-#define BLK_SBUSY 0x0002 /* Sanity check blk on busy */
-#define BLK_ONFREE 0x0010 /* Block is on free list */
-#define BLK_ONBUSY 0x0020 /* Block is on busy list */
-
-#define BLK_FIND 0 /* Serach cmd "find" */
-#define BLK_FORCE 1 /* Search cmd "must find" */
-#define BLK_LAST 2 /* Search cmd "put last" if found */
-
-/* Flash memory type descriptor */
-
-struct fltype {
- char *fl_name;
- int fl_size;
- int fl_blksz;
- u_char fl_manf;
- u_char fl_type;
-};
-struct fltype fllist[] = {
- { "Samsung KM29N16000", 2097152, 4096, 0xec, 0x64 },
- { NULL },
-};
-
-struct flsoftc {
- struct device sc_dev;
- int sc_prot;
- size_t sc_size;
- int sc_present;
- int sc_opncnt;
- struct flcache *sc_cache;
- struct fltype *sc_ftype;
- struct disklabel sc_label;
-};
-
-struct cfattach fl_ca = {
- sizeof(struct flsoftc), flmatch, flattach
-};
-struct cfdriver fl_cd = {
- NULL, "fl", DV_DISK, 0 /* Yes! We want is as root device */
-};
-
-static void flgetdisklabel __P((dev_t, struct flsoftc *));
-static void flinitcache __P((struct flsoftc *));
-void flstrategy __P((struct buf *));
-
-
-int
-flmatch(parent, cf, args)
- struct device *parent;
- void *cf;
- void *args;
-{
- struct confargs *ca = args;
-
- if(!BUS_MATCHNAME(ca, "fl"))
- return(0);
- return(1);
-}
-
-void
-flattach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- struct confargs *ca = args;
- struct flsoftc *sc = (struct flsoftc *)self;
- struct fltype *flist;
- int i, manf, type;
- u_int32_t next;
- struct flctag *blkbase;
-
- switch(cputype) {
- case WGRISC9100: /* WGRISC9100 can have 4 chips */
- sc->sc_opncnt = 0;
- sc->sc_present = 0;
- sc->sc_ftype = NULL;
- OUT_FL_CTRL(0, 0); /* All CS lines high */
- for(i = 0; i < 4; i++) {
- OUT_FL_CLE(FL_READID, (1 << i));
- OUT_FL_ALE1(0, (1 << i));
- manf = IN_FL_DATA;
- type = IN_FL_DATA;
- flist = fllist;
- while(flist->fl_name != 0) {
- if(flist->fl_manf == manf &&
- flist->fl_type == type) {
- sc->sc_present |= 1 << i;
- sc->sc_size += flist->fl_size;
- if(sc->sc_ftype == NULL) {
- sc->sc_ftype = flist;
- }
- else if(sc->sc_ftype == flist) {
- }
-/* XXX Protection test type dependent ? */
- OUT_FL_CLE(FL_READSTAT, (1 << i));
- if(!(IN_FL_DATA & FLST_UNPROT)) {
- sc->sc_prot = 1;
- }
- break;
- }
- flist++;
- }
- }
- break;
-
- default:
- printf("fl: Unknown cputype '%d'", cputype);
- }
- if(sc->sc_ftype != NULL) {
- printf(" %s, %d*%d bytes%s.", sc->sc_ftype->fl_name,
- sc->sc_size / sc->sc_ftype->fl_size,
- sc->sc_ftype->fl_size,
- sc->sc_prot ? " Write protected" : "");
- }
- else {
- printf("WARNING! Flash type not identified!");
- }
- printf("\n");
-
- /*
- * Now set up the sram cache. We usually have 128k sram
- * on the board and we use up 25% or 32kb of this for the
- * flash cache.
- */
-
- sc->sc_cache = (struct flcache *)(RISC_SRAM_START+16);
- blkbase = &sc->sc_cache->flcblk[0];
-
- if(sc->sc_cache->magic != FLC_MAGIC) {
- printf("fl0: *WARNING* flash cache not initialized!");
- printf(" Initializing to %d blocks.\n", MAX_BLKS-1);
-
- flinitcache(sc);
- }
- else { /* Cache initialized. Make sanity check. */
- for(i = 1; i < MAX_BLKS; i++) {
- blkbase[i].stat &= ~(BLK_SFREE | BLK_SBUSY);
- }
- next = sc->sc_cache->free;
- i = 0;
- while(next && (next < MAX_BLKS) && (i < MAX_BLKS)) {
- blkbase[next].stat |= BLK_SFREE;
- next = blkbase[next].next;
- i++;
- }
- i = 0;
- next = blkbase[0].next;
- while(next && (next < MAX_BLKS) && (i < MAX_BLKS)) {
- blkbase[next].stat |= BLK_SBUSY;
- next = blkbase[next].next;
- i++;
- }
- for(i = 1; i < MAX_BLKS; i++) {
- switch(blkbase[i].stat & (BLK_SBUSY|BLK_SFREE|BLK_ONFREE|BLK_ONBUSY)) {
- case BLK_SBUSY|BLK_ONBUSY:
- case BLK_SFREE|BLK_ONFREE:
- break;
-
- default:
- printf("fl0: cache sanity err blk %d stat %x\n",
- i, blkbase[i].stat);
- break;
- }
- }
- }
-}
-
-static void
-flinitcache(sc)
- struct flsoftc *sc;
-{
- int i;
- struct flctag *blkbase;
-
- blkbase = &sc->sc_cache->flcblk[0];
- for(i = 1; i < MAX_BLKS; i++) {
- blkbase[i].next = i+1;
- blkbase[i].stat = BLK_ONFREE;
- }
- blkbase[MAX_BLKS-1].next = 0; /* mark end */
- sc->sc_cache->free = 1; /* first free */
- sc->sc_cache->nfree = MAX_BLKS-1;
- blkbase[0].next = 0; /* no busy blocks */
- sc->sc_cache->lbusy = 0; /* no busy blocks */
- sc->sc_cache->stat = 0;
- sc->sc_cache->cache = (char *)sc->sc_cache + sizeof(struct flcache);
- sc->sc_cache->magic = FLC_MAGIC;
-}
-
-/*
- * Return index to cached block if in cache.
- * Also execute command.
- */
-static int
-flblkincache(sc, offs, command)
- struct flsoftc *sc;
- size_t offs;
- int command;
-{
- u_int32_t next, prev, offset;
- struct flctag *blkbase;
-
- offset = offs >> DEV_BSHIFT;
- blkbase = &sc->sc_cache->flcblk[0];
- next = blkbase[0].next;
- prev = 0;
-
- while(next && (blkbase[next].offset != offset)) {
- prev = next;
- next = blkbase[next].next;
- }
- if(next && (command == BLK_LAST)) {
- if(sc->sc_cache->lbusy != next) {
- blkbase[prev].next = blkbase[next].next;
- blkbase[next].next = 0;
- blkbase[sc->sc_cache->lbusy].next = next;
- sc->sc_cache->lbusy = next;
- }
- return(next); /* already last */
- }
- if(next || (command != BLK_FORCE))
- return(next);
-
- /* BLK_FORCE */
- printf("fl0: expected offset %x not found in cache!!\n", offset);
- next = blkbase[0].next;
- while(next) {
- printf("%d/%x ",next, blkbase[next].offset);
- next = blkbase[next].next;
- }
- printf("\n");
- next = sc->sc_cache->free;
- while(next) {
- printf("%d/%x ",next, blkbase[next].offset);
- next = blkbase[next].next;
- }
- printf("\n");
-mdbpanic();
-
- return(0);
-}
-
-/*
- * Return block erase status.
- */
-static int
-flblkerased(sc, blk, offs, cnt)
- struct flsoftc *sc;
- size_t offs;
- size_t cnt;
-{
- int chip;
- u_int32_t blkadr;
- int erased = TRUE;
-
- chip = 1 << (offs / sc->sc_ftype->fl_size);
- blkadr = offs % sc->sc_ftype->fl_size;
-
- OUT_FL_CLE(FL_READ1, chip);
- OUT_FL_ALE3(blkadr, chip);
- WAIT_FL_RDY;
- while(cnt--) {
- if(IN_FL_DATA != 0xff)
- erased = FALSE;
- }
- return(erased);
-}
-
-static int
-flgetblk(sc, blk, offs, cnt)
- struct flsoftc *sc;
- char *blk;
- size_t offs;
- size_t cnt;
-{
- int chip;
- u_int32_t blkadr;
-
- chip = 1 << (offs / sc->sc_ftype->fl_size);
- blkadr = offs % sc->sc_ftype->fl_size;
-
- OUT_FL_CLE(FL_READ1, chip);
- OUT_FL_ALE3(blkadr, chip);
- WAIT_FL_RDY;
- while(cnt--) {
- *blk++ = IN_FL_DATA;
- }
- return(0);
-}
-
-static int
-flputblk(sc, blk, offs, cnt)
- struct flsoftc *sc;
- char *blk;
- size_t offs;
- size_t cnt;
-{
- int chip;
- u_int32_t blkadr;
-
- chip = 1 << (offs / sc->sc_ftype->fl_size);
- blkadr = offs % sc->sc_ftype->fl_size;
-
- OUT_FL_CLE(FL_SEQDI, chip);
- OUT_FL_ALE3(blkadr, chip);
- while(cnt--) {
- OUT_FL_DATA(*blk);
- blk++;
- }
- OUT_FL_CLE(FL_PGPROG, chip);
- WAIT_FL_RDY;
- OUT_FL_CLE(FL_READSTAT, chip);
- if(IN_FL_DATA & FLST_ERROR) {
- return(-1);
- }
- return(0);
-}
-
-static int
-fleraseblk(sc, offs)
- struct flsoftc *sc;
- size_t offs;
-{
- int chip;
- u_int32_t blkadr;
-
- chip = 1 << (offs / sc->sc_ftype->fl_size);
- blkadr = offs % sc->sc_ftype->fl_size;
-
- OUT_FL_CLE(FL_BLERASE, chip);
- OUT_FL_ALE2(blkadr, chip);
- OUT_FL_CLE(FL_REERASE, chip);
- WAIT_FL_RDY;
- OUT_FL_CLE(FL_READSTAT, chip);
- if(IN_FL_DATA & FLST_ERROR) {
- return(-1);
- }
- return(0);
-}
-
-/*
- * Get next free block and put it last on busy list.
- */
-static int
-flgetfree(sc, offs)
- struct flsoftc *sc;
- size_t offs;
-{
- u_int32_t blkno;
- struct flctag *blkbase;
-
- blkbase = &sc->sc_cache->flcblk[0];
- blkno = sc->sc_cache->free;
- if(blkno) {
- sc->sc_cache->free = blkbase[blkno].next;
- sc->sc_cache->nfree--;
- blkbase[blkno].next = 0;
- blkbase[blkno].stat = BLK_ONBUSY;
- blkbase[blkno].offset = offs >> DEV_BSHIFT;
- blkbase[blkno].age = 0; /* XXX ticks! */
- blkbase[sc->sc_cache->lbusy].next = blkno;
- sc->sc_cache->lbusy = blkno;
- }
- return(blkno);
-}
-
-/*
- * Put block from busy list on free list.
- */
-static void
-flputfree(sc, blkno)
- struct flsoftc *sc;
- u_int32_t blkno;
-{
- struct flctag *cblk, *rblk;
-
- if(blkno) {
- cblk = &sc->sc_cache->flcblk[0];
- rblk = &sc->sc_cache->flcblk[blkno];
-
- while(cblk->next && cblk->next != blkno) {
- cblk = &sc->sc_cache->flcblk[cblk->next];
- }
- cblk->next = rblk->next;
- if(sc->sc_cache->lbusy == blkno) {
- sc->sc_cache->lbusy = cblk - &sc->sc_cache->flcblk[0];
- }
-
- rblk->next = sc->sc_cache->free;
- rblk->stat = BLK_ONFREE;
- sc->sc_cache->free = blkno;
- sc->sc_cache->nfree++;
- }
-}
-
-/*
- * Push back a block (4k) to the flash. We first need to get
- * any used pages not in cache before erasing.
- */
-
-static int
-flpushblk(sc, offs)
- struct flsoftc *sc;
- size_t offs;
-{
- int i;
- u_int32_t blkno, offset;
- int error = 0;
- char *blk;
-
-printf("fl: pushing block %d to flash.\n", offs);
- offset = offs;
- for(i = 0; i < 8; i++) {
- if(flblkincache(sc, offset, BLK_FIND) == 0) {
- if((blkno = flgetfree(sc, offset)) != 0) {
- blk = &sc->sc_cache->cache[blkno*512];
- flgetblk(sc, blk, offset, 256);
- flgetblk(sc, blk + 256, offset + 256, 256);
- }
- else {
- error = EIO;
- }
- }
- offset += DEV_BSIZE;
- }
- if(error == 0 && fleraseblk(sc, offs))
- error = EIO;
-
- if(error == 0) {
- offset = offs;
- for(i = 0; i < 8; i++) {
- blkno = flblkincache(sc, offset, BLK_FORCE);
- blk = &sc->sc_cache->cache[blkno*512];
- if(flputblk(sc, blk, offset, 256))
- error = EIO;
- if(flputblk(sc, blk + 256, offset + 256, 256))
- error = EIO;
- offset += DEV_BSIZE;
- flputfree(sc, blkno);
- }
- }
- return(error);
-}
-
-
-/*
- * Read a block (512 bytes) either from cache or from flash.
- */
-static int
-flreadblk(sc, blk, offs)
- struct flsoftc *sc;
- char *blk;
- size_t offs;
-{
- int error = 0;
- u_int32_t blkno;
-
- if((blkno = flblkincache(sc, offs, BLK_FIND)) != 0) {
- bcopy(&sc->sc_cache->cache[blkno*512], blk, 512);
- }
- else {
- error |= flgetblk(sc, blk, offs, 256);
- error |= flgetblk(sc, blk+256, offs+256, 256);
- }
- return(error);
-}
-
-/*
- * Write a block (512 bytes) to cache. If no room in cache
- * make room by pushing data back into the flash memory.
- */
-static int
-flwriteblk(sc, blk, offs)
- struct flsoftc *sc;
- char *blk;
- size_t offs;
-{
- int error = 0;
- u_int32_t blkno, offset;
-
- /* In cache? */
- if((blkno = flblkincache(sc, offs, BLK_LAST)) != 0) {
- bcopy(blk, &sc->sc_cache->cache[blkno*512], 512);
- }
- /* Add to cache */
- else {
- if(sc->sc_cache->nfree < 8) {
- /* Push busy blocks to get a free one */
- /* XXX We just pick first busy not in same 4k
- * XXX as the one we need space for, now */
- blkno = sc->sc_cache->flcblk[0].next;
- do {
- offset = sc->sc_cache->flcblk[blkno].offset;
- offset <<= DEV_BSHIFT;
- offset &= ~4095;
- blkno = sc->sc_cache->flcblk[blkno].next;
- } while(offset == (offs & ~4095));
-
- error = flpushblk(sc, offset);
- }
- blkno = flgetfree(sc, offs);
- if(blkno) {
- bcopy(blk, &sc->sc_cache->cache[blkno*512], 512);
- }
- else {
- error = EIO;
- }
- }
- return(error);
-}
-
-
-/*ARGSUSED*/
-int
-flopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- struct flsoftc *sc;
-
- if (FLUNIT(dev) >= fl_cd.cd_ndevs || fl_cd.cd_devs[FLUNIT(dev)] == NULL)
- return (ENODEV);
- sc = (struct flsoftc *) fl_cd.cd_devs[FLUNIT(dev)];
- flgetdisklabel(dev, sc);
- sc->sc_opncnt++;
- return(0);
-}
-
-/*ARGSUSED*/
-int
-flclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- struct flsoftc *sc;
- u_int32_t offset, blkno;
-
- sc = (struct flsoftc *) fl_cd.cd_devs[FLUNIT(dev)];
- sc->sc_opncnt--;
- if(sc->sc_opncnt == 0) {
- while((blkno = sc->sc_cache->flcblk[0].next) != 0) {
- offset = sc->sc_cache->flcblk[blkno].offset;
- offset <<= DEV_BSHIFT;
- offset &= ~4095;
- flpushblk(sc, offset);
- }
- }
- return(0);
-}
-
-/*ARGSUSED*/
-int
-flioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_char *data;
- int cmd, flag;
- struct proc *p;
-{
- int unit = FLUNIT(dev);
- struct flsoftc *sc = (struct flsoftc *) fl_cd.cd_devs[unit];
- struct cpu_disklabel clp;
- struct disklabel lp, *lpp;
- int error = 0;
-
- switch (cmd) {
-
- /*
- * Very basic disklabel handling.
- */
- case DIOCGDINFO:
- *(struct disklabel *)data = sc->sc_label;
- break;
-
- case DIOCWDINFO:
- case DIOCSDINFO:
- if((flag & FWRITE) == 0) {
- error = EBADF;
- break;
- }
- error = setdisklabel(&sc->sc_label,
- (struct disklabel *)data, 0, &clp);
- if((error == 0) && (cmd == DIOCWDINFO)) {
- error = writedisklabel(FLLABELDEV(dev),
- flstrategy,
- &sc->sc_label, &clp);
- }
- break;
-
- case DIOCWLABEL:
- if((flag & FWRITE) == 0)
- error = EBADF;
- break;
-
- default:
- error = EINVAL;
- break;
- }
- return(error);
-}
-
-void
-flstrategy(bp)
- struct buf *bp;
-{
- int unit = FLUNIT(bp->b_dev);
- struct flsoftc *sc = (struct flsoftc *) fl_cd.cd_devs[unit];
- int error = 0;
- size_t offs, xfer, cnt;
- caddr_t buf;
-
- offs = bp->b_blkno << DEV_BSHIFT; /* Start address */
- buf = bp->b_data;
- bp->b_resid = bp->b_bcount;
- if(offs < sc->sc_size) {
- xfer = bp->b_resid;
- if(offs + xfer > sc->sc_size) {
- xfer = sc->sc_size - offs;
- }
- if(bp->b_flags & B_READ) {
- bp->b_resid -= xfer;
- while(xfer > 0) {
- cnt = (xfer > DEV_BSIZE) ? DEV_BSIZE : xfer;
- flreadblk(sc, buf, offs, cnt);
- xfer -= cnt;
- offs += cnt;
- buf += cnt;
- }
- }
- else {
- while(xfer > 0) {
- cnt = (xfer > DEV_BSIZE) ? DEV_BSIZE : xfer;
- if(flwriteblk(sc, buf, offs, cnt))
- error = EIO;
- xfer -= cnt;
- buf += cnt;
- offs += cnt;
- bp->b_resid -= cnt;
- }
- }
- }
- else if(!(bp->b_flags & B_READ)) { /* No space for write */
- error = EIO;
- }
- if(error) {
- bp->b_error = error;
- bp->b_flags |= B_ERROR;
- }
-
- biodone(bp);
-}
-
-/*ARGSUSED*/
-int
-flread(dev, uio, ioflag)
- dev_t dev;
- struct uio *uio;
- int ioflag;
-{
- return (physio(flstrategy, NULL, dev, B_READ, minphys, uio));
-}
-
-/*ARGSUSED*/
-int
-flwrite(dev, uio, ioflag)
- dev_t dev;
- struct uio *uio;
- int ioflag;
-{
- return (physio(flstrategy, NULL, dev, B_WRITE, minphys, uio));
-}
-
-int
-fldump(dev, blkno, va, size)
- dev_t dev;
- daddr_t blkno;
- caddr_t va;
- size_t size;
-{
- return(ENODEV);
-}
-
-int
-flsize(dev)
- dev_t dev;
-{
- return(0);
-}
-
-/*
- * Create a disklabel from the flash ram info.
- */
-static void
-flgetdisklabel(dev, sc)
- dev_t dev;
- struct flsoftc *sc;
-{
- struct disklabel *lp = &sc->sc_label;
- struct cpu_disklabel clp;
- char *errstring;
-
- bzero(lp, sizeof(struct disklabel));
- bzero(&clp, sizeof(struct cpu_disklabel));
-
- lp->d_secsize = 1 << DEV_BSHIFT;
- lp->d_ntracks = 1;
- lp->d_nsectors = sc->sc_size >> DEV_BSHIFT;
- lp->d_ncylinders = 1;
- lp->d_secpercyl = lp->d_nsectors;
-
- strncpy(lp->d_typename, "FLASH disk", 16);
- lp->d_type = DTYPE_SCSI; /* XXX This is a fake! */
- strncpy(lp->d_packname, "fictitious", 16);
- lp->d_secperunit = lp->d_nsectors;
- lp->d_rpm = 3600;
- lp->d_interleave = 1;
- lp->d_flags = 0;
-
- lp->d_partitions[RAW_PART].p_offset = 0;
- lp->d_partitions[RAW_PART].p_size =
- lp->d_secperunit * (lp->d_secsize / DEV_BSIZE);
- lp->d_partitions[RAW_PART].p_fstype = FS_UNUSED;
- lp->d_npartitions = RAW_PART + 1;
-
- lp->d_magic = DISKMAGIC;
- lp->d_magic2 = DISKMAGIC;
- lp->d_checksum = dkcksum(lp);
-
- /*
- * Call the generic disklabel extraction routine
- */
- errstring = readdisklabel(FLLABELDEV(dev), flstrategy, lp, &clp, 0);
- if (errstring) {
- printf("%s: %s\n", sc->sc_dev.dv_xname, errstring);
- }
-}
-
diff --git a/sys/arch/wgrisc/dev/flashreg.h b/sys/arch/wgrisc/dev/flashreg.h
deleted file mode 100644
index d06eb7688ef..00000000000
--- a/sys/arch/wgrisc/dev/flashreg.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* $OpenBSD: flashreg.h,v 1.1 1997/02/23 21:59:28 pefo Exp $ */
-
-/*
- * Copyright (c) 1997 Per Fogelstrom
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom for Willowglen Singapore.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-/*
- * Definitions for the Samsung KM29N16000 2M/8 NAND Flash Memory.
- */
-
-/* Commands */
-
-#define FL_SEQDI 0x80 /* Sequential data input */
-#define FL_READ1 0x00 /* Read 1 (normal read */
-#define FL_READ2 0x50 /* Read 2 (extended read */
-#define FL_READID 0x90 /* Read chip id */
-#define FL_RESET 0xff /* Chip control reset */
-#define FL_PGPROG 0x10 /* Page program */
-#define FL_BLERASE 0x60 /* Block erase */
-#define FL_SUERASE 0xb0 /* Suspend erase */
-#define FL_REERASE 0xd0 /* Resume erase */
-#define FL_READSTAT 0x70 /* Read status */
-#define FL_READREG 0xe0 /* Read register */
-
-/* Status */
-#define FLST_ERROR 0x01 /* Error in Program/Erase */
-#define FLST_ESUSP 0x20 /* Erase suspended */
-#define FLST_RDY 0x40 /* Ready */
-#define FLST_UNPROT 0x80 /* Memory not wr protected */
-
-/* Handy macros */
-#define FLC_ALE 0x80 /* Control reg ALE bit */
-#define FLC_CLE 0x40 /* Control reg CLE bit */
-#define FLC_NCS 0x3f /* CS bits */
-
-#define WAIT_FL_RDY \
- while((inb(RISC_STATUS) & 0x10) == 0)
-
-#define OUT_FL_CTRL(x, cs) \
- do { \
- outb(RISC_FLASH_CTRL, (x) | (FLC_NCS ^ (cs))); \
- wbflush(); \
- } while(0)
-
-#define OUT_FL_DATA(x) \
- outb(RISC_FLASH_WRITE, (x))
-
-#define IN_FL_DATA \
- inb(RISC_FLASH_READ)
-
-#define OUT_FL_CLE(cmd, cs) \
- do { \
- OUT_FL_CTRL(FLC_CLE, (cs)); \
- OUT_FL_DATA(cmd); \
- OUT_FL_CTRL(0, cs); \
- } while(0);
-
-#define OUT_FL_ALE1(addr, cs) \
- do { \
- register int _a = addr; \
- OUT_FL_CTRL(FLC_ALE, (cs)); \
- OUT_FL_DATA(_a); \
- OUT_FL_CTRL(0, cs); \
- } while(0);
-
-#define OUT_FL_ALE2(addr, cs) \
- do { \
- register int _a = addr; \
- OUT_FL_CTRL(FLC_ALE, (cs)); \
- OUT_FL_DATA(_a >> 8); \
- OUT_FL_DATA(_a >> 16); \
- OUT_FL_CTRL(0, cs); \
- } while(0);
-
-#define OUT_FL_ALE3(addr, cs) \
- do { \
- register int _a = addr; \
- OUT_FL_CTRL(FLC_ALE, (cs)); \
- OUT_FL_DATA(_a); \
- OUT_FL_DATA(_a >> 8); \
- OUT_FL_DATA(_a >> 16); \
- OUT_FL_CTRL(0, cs); \
- } while(0);
-
diff --git a/sys/arch/wgrisc/dev/if_sn.c b/sys/arch/wgrisc/dev/if_sn.c
deleted file mode 100644
index 6aacfb8c859..00000000000
--- a/sys/arch/wgrisc/dev/if_sn.c
+++ /dev/null
@@ -1,1281 +0,0 @@
-/* $OpenBSD: if_sn.c,v 1.3 1999/05/13 15:44:50 jason Exp $ */
-/*
- * National Semiconductor SONIC Driver
- * Copyright (c) 1991 Algorithmics Ltd (http://www.algor.co.uk)
- * You may use, copy, and modify this program so long as you retain the
- * copyright line.
- *
- * This driver has been substantially modified since Algorithmics donated
- * it.
- */
-
-#include "sn.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/buf.h>
-#include <sys/protosw.h>
-#include <sys/socket.h>
-#include <sys/syslog.h>
-#include <sys/ioctl.h>
-#include <sys/errno.h>
-#include <sys/device.h>
-#include <machine/autoconf.h>
-
-#include <net/if.h>
-#include <net/netisr.h>
-#include <net/route.h>
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/in_var.h>
-#include <netinet/ip.h>
-#include <netinet/if_ether.h>
-#endif
-
-#include <vm/vm.h>
-
-#include "bpfilter.h"
-#if NBPFILTER > 0
-#include <net/bpf.h>
-#include <net/bpfdesc.h>
-#endif
-
-#define SONICDW 32
-typedef unsigned char uchar;
-
-#include <wgrisc/dev/if_sn.h>
-#define SWR(a, x) (a) = (x)
-#define SRD(a) ((a) & 0xffff)
-
-#include <machine/cpu.h>
-#include <wgrisc/riscbus/riscbus.h>
-
-/*
- * Statistics collected over time
- */
-struct sn_stats {
- int ls_opacks; /* packets transmitted */
- int ls_ipacks; /* packets received */
- int ls_tdr; /* contents of tdr after collision */
- int ls_tdef; /* packets where had to wait */
- int ls_tone; /* packets with one retry */
- int ls_tmore; /* packets with more than one retry */
- int ls_tbuff; /* transmit buff errors */
- int ls_tuflo; /* " uflo " */
- int ls_tlcol;
- int ls_tlcar;
- int ls_trtry;
- int ls_rbuff; /* receive buff errors */
- int ls_rfram; /* framing */
- int ls_roflo; /* overflow */
- int ls_rcrc;
- int ls_rrng; /* rx ring sequence error */
- int ls_babl; /* chip babl error */
- int ls_cerr; /* collision error */
- int ls_miss; /* missed packet */
- int ls_merr; /* memory error */
- int ls_copies; /* copies due to out of range mbufs */
- int ls_maxmbufs; /* max mbufs on transmit */
- int ls_maxslots; /* max ring slots on transmit */
-};
-
-struct sn_softc {
- struct device sc_dev;
- struct arpcom sc_ac;
-#define sc_if sc_ac.ac_if /* network visible interface */
-#define sc_enaddr sc_ac.ac_enaddr /* hardware ethernet address */
-
- struct sonic_reg *sc_csr; /* hardware pointer */
- int sc_rxmark; /* position in rx ring for reading buffs */
-
- int sc_rramark; /* index into rra of wp */
-
- int sc_txhead; /* index of first TDA passed to chip */
- int sc_missed; /* missed packet counter */
- struct RXpkt *sc_lrxp; /* last RDA available to chip */
- struct sn_stats sc_sum;
- short sc_iflags;
-} sn_softc;
-
-int snmatch __P((struct device *, void *, void *));
-void snattach __P((struct device *, struct device *, void *));
-
-struct cfattach sn_ca = {
- sizeof(struct sn_softc), snmatch, snattach
-};
-struct cfdriver sn_cd = {
- NULL, "sn", DV_IFNET, NULL, 0
-};
-
-#undef assert
-#undef _assert
-
-#ifdef NDEBUG
-#define assert(e) ((void)0)
-#define _assert(e) ((void)0)
-#else
-#define _assert(e) assert(e)
-#ifdef __STDC__
-#define assert(e) ((e) ? (void)0 : __assert("sn ", __FILE__, __LINE__, #e))
-#else /* PCC */
-#define assert(e) ((e) ? (void)0 : __assert("sn "__FILE__, __LINE__, "e"))
-#endif
-#endif
-
-void
-m_check(m)
- struct mbuf *m;
-{
- if (m->m_flags & M_EXT) {
- assert(m->m_len >= 0);
- assert(m->m_len <= m->m_ext.ext_size);
- assert(m->m_data >= &m->m_ext.ext_buf[0]);
- assert(m->m_data <= &m->m_ext.ext_buf[m->m_ext.ext_size]);
- assert(m->m_data + m->m_len <= &m->m_ext.ext_buf[m->m_ext.ext_size]);
- } else if (m->m_flags & M_PKTHDR) {
- assert(m->m_len >= 0);
- assert(m->m_len <= MHLEN);
- assert(m->m_data >= m->m_pktdat);
- assert(m->m_data <= &m->m_pktdat[MHLEN]);
- assert(m->m_data + m->m_len <= &m->m_pktdat[MHLEN]);
- } else {
- assert(m->m_len >= 0);
- assert(m->m_len <= MLEN);
- assert(m->m_data >= m->m_dat);
- assert(m->m_data <= &m->m_dat[MLEN]);
- assert(m->m_data + m->m_len <= &m->m_dat[MLEN]);
- }
-}
-
-void
-m_checkm(m)
- struct mbuf *m;
-{
- while (m) {
- m_check(m);
- m = m->m_next;
- }
-}
-
-int ethdebug = 0;
-
-int snintr __P((struct sn_softc *));
-int snioctl __P((struct ifnet *ifp, u_long cmd, caddr_t data));
-void snstart __P((struct ifnet *ifp));
-void snwatchdog __P((struct ifnet *ifp));
-void snreset __P((struct sn_softc *sc));
-
-/*
- * SONIC buffers need to be aligned 16 or 32 bit aligned.
- * These macros calculate and verify alignment.
- */
-#if SONICDW == 32
-#define SONICALIGN 4
-#else
-#define SONICALIGN 2
-#endif
-#define SOALIGN(array) (((int)array+SONICALIGN-1) & ~(SONICALIGN-1))
-#define SOALIGNED(p) (!(((uint)p)&(SONICALIGN-1)))
-
-#define UPPER(x) ((unsigned)(x) >> 16)
-#define LOWER(x) ((unsigned)(x) & 0xffff)
-
-#define NRRA 32 /* # receive resource descriptors */
-#define RRAMASK 0x1f /* why it must be poer of two */
-
-#define NRBA 16 /* # receive buffers < NRRA */
-#define NRDA NRBA /* # receive descriptors */
-#define NTDA 4 /* # transmit descriptors */
-
-#define CDASIZE sizeof(struct CDA)
-#define RRASIZE (NRRA*sizeof(struct RXrsrc))
-#define RDASIZE (NRDA*sizeof(struct RXpkt))
-#define TDASIZE (NTDA*sizeof(struct TXpkt))
-
-#define FCSSIZE 4 /* size of FCS append te received packets */
-
-/*
- * maximum recieve packet size plus 2 byte pad to make each
- * one aligned. 4 byte slop (required for eobc)
- */
-#define RBASIZE (sizeof(struct ether_header) + ETHERMTU + FCSSIZE + 2 + 4)
-
-/*
- * space requiered for descriptors
- */
-#define DESC_SIZE (RRASIZE + CDASIZE + RDASIZE + TDASIZE + SONICALIGN - 1)
-
-/*
- * Nicely aligned pointers into the sonicbuffers
- * p_ points at physical (K1_SEG) addresses.
- * v_ is sonic local address used by sonic.
- */
-struct RXrsrc *p_rra; /* receiver resource descriptors */
-struct RXrsrc *v_rra;
-struct RXpkt *p_rda; /* receiver desriptors */
-struct RXpkt *v_rda;
-struct TXpkt *p_tda; /* transmitter descriptors */
-struct TXpkt *v_tda;
-struct CDA *p_cda; /* CAM descriptors */
-struct CDA *v_cda;
-char *p_rba; /* receive buffer area base */
-char *v_rba;
-
-/* Meta transmit descriptors */
-struct mtd {
- struct mtd *mtd_link;
- struct TXpkt *mtd_txp;
- struct mbuf *mtd_mbuf;
-} mtda[NTDA];
-
-struct mtd *mtdfree; /* list of free meta transmit descriptors */
-struct mtd *mtdhead; /* head of descriptors assigned to chip */
-struct mtd *mtdtail; /* tail of descriptors assigned to chip */
-struct mtd *mtdnext; /* next descriptor to give to chip */
-
-void mtd_free __P((struct mtd *));
-struct mtd *mtd_alloc __P((void));
-
-int sngetaddr __P((struct sn_softc *sc));
-int sninit __P((struct sn_softc *sc));
-int snstop __P((struct sn_softc *sc));
-int sonicput __P((struct sn_softc *sc, struct mbuf *m0));
-
-void camdump __P((struct sn_softc *sc));
-
-int
-snmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct cfdata *cf = match;
- struct confargs *ca = aux;
-
- /* XXX CHECK BUS */
- /* make sure that we're looking for this type of device. */
- if (!BUS_MATCHNAME(ca, "sonic"))
- return (0);
-
- return (1);
-}
-
-/*
- * Interface exists: make available by filling in network interface
- * record. System will initialize the interface when it is ready
- * to accept packets.
- */
-void
-snattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct sn_softc *sc = (void *)self;
- struct confargs *ca = aux;
- struct ifnet *ifp = &sc->sc_if;
- struct cfdata *cf = sc->sc_dev.dv_cfdata;
- int p, pp;
-
- sc->sc_csr = (struct sonic_reg *)BUS_CVTADDR(ca);
-
-/*
- * because the sonic is basicly 16bit device it 'concatenates'
- * a higher buffer address to a 16 bit offset this will cause wrap
- * around problems near the end of 64k !!
- */
- p = RISC_SONIC_SRAM;
- pp = RISC_SONIC_SRAM - (FRAGMAX * NTDA * 4096);
-
- if ((p ^ (p + TDASIZE)) & 0x10000)
- p = (p + 0x10000) & ~0xffff;
- p_tda = (struct TXpkt *) p;
- v_tda = (struct TXpkt *)(p - pp);
- p += TDASIZE;
-
- if ((p ^ (p + RRASIZE + CDASIZE)) & 0x10000)
- p = (p + 0x10000) & ~0xffff;
- p_rra = (struct RXrsrc *) p;
- v_rra = (struct RXrsrc *)(p - pp);
- p += RRASIZE;
-
- if ((p ^ (p + RDASIZE)) & 0x10000)
- p = (p + 0x10000) & ~0xffff;
- p_rda = (struct RXpkt *) p;
- v_rda = (struct RXpkt *)(p - pp);
- p += RDASIZE;
-
- p_cda = (struct CDA *) p;
- v_cda = (struct CDA *)(p - pp);
- p += CDASIZE;
-
- p += 4096 - (p & (4095));
- p_rba = (char *)p;
- v_rba = (char *)(p - pp);
- p += NRBA * RBASIZE;
-
- printf(": bufsize %d",p - RISC_SONIC_SRAM);
-
-#if 0
- camdump(sc);
-#endif
- sngetaddr(sc);
- printf(" address %s\n", ether_sprintf(sc->sc_enaddr));
-
-#if 0
-printf("\nsonic buffers: rra=0x%x cda=0x%x rda=0x%x tda=0x%x rba=0x%x\n",
- p_rra, p_cda, p_rda, p_tda, p_rba);
-printf("sonic buffers: rra=0x%x cda=0x%x rda=0x%x tda=0x%x rba=0x%x\n",
- v_rra, v_cda, v_rda, v_tda, v_rba);
-printf("mapped to offset 0x%x size 0x%x\n", SONICBUF - pp, p - SONICBUF);
-#endif
-
- BUS_INTR_ESTABLISH(ca, (intr_handler_t)snintr, (void *)sc);
-
- bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ);
- ifp->if_softc = sc;
- ifp->if_ioctl = snioctl;
- ifp->if_start = snstart;
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
- ifp->if_watchdog = snwatchdog;
-#if NBPFILTER > 0
- bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
-#endif
- if_attach(ifp);
- ether_ifattach(ifp);
-}
-
-int
-snioctl(ifp, cmd, data)
- struct ifnet *ifp;
- u_long cmd;
- caddr_t data;
-{
- struct ifaddr *ifa;
- struct sn_softc *sc = ifp->if_softc;
- int s = splnet(), err = 0;
- int temp;
- int error;
-
- if ((error = ether_ioctl(ifp, &sc->sc_ac, cmd, data)) > 0) {
- splx(s);
- return error;
- }
-
- switch (cmd) {
-
- case SIOCSIFADDR:
- ifa = (struct ifaddr *)data;
- ifp->if_flags |= IFF_UP;
- switch (ifa->ifa_addr->sa_family) {
-#ifdef INET
- case AF_INET:
- (void)sninit(ifp->if_softc);
- arp_ifinit(&sc->sc_ac, ifa);
- break;
-#endif
- default:
- (void)sninit(ifp->if_softc);
- break;
- }
- break;
-
- case SIOCSIFFLAGS:
- if ((ifp->if_flags & IFF_UP) == 0 &&
- ifp->if_flags & IFF_RUNNING) {
- snstop(ifp->if_softc);
- ifp->if_flags &= ~IFF_RUNNING;
- } else if (ifp->if_flags & IFF_UP &&
- (ifp->if_flags & IFF_RUNNING) == 0)
- (void)sninit(ifp->if_softc);
- /*
- * If the state of the promiscuous bit changes, the interface
- * must be reset to effect the change.
- */
- if (((ifp->if_flags ^ sc->sc_iflags) & IFF_PROMISC) &&
- (ifp->if_flags & IFF_RUNNING)) {
- sc->sc_iflags = ifp->if_flags;
- printf("change in flags\n");
- temp = sc->sc_if.if_flags & IFF_UP;
- snreset(sc);
- sc->sc_if.if_flags |= temp;
- snstart(ifp);
- }
- break;
-
- case SIOCADDMULTI:
- case SIOCDELMULTI:
- if(cmd == SIOCADDMULTI)
- err = ether_addmulti((struct ifreq *)data, &sc->sc_ac);
- else
- err = ether_delmulti((struct ifreq *)data, &sc->sc_ac);
-
- if (err == ENETRESET) {
- /*
- * Multicast list has changed; set the hardware
- * filter accordingly. But remember UP flag!
- */
- temp = sc->sc_if.if_flags & IFF_UP;
- snreset(sc);
- sc->sc_if.if_flags |= temp;
- err = 0;
- }
- break;
- default:
- err = EINVAL;
- }
- splx(s);
- return (err);
-}
-
-/*
- * Encapsulate a packet of type family for the local net.
- * Use trailer local net encapsulation if enough data in first
- * packet leaves a multiple of 512 bytes of data in remainder.
- */
-void
-snstart(ifp)
- struct ifnet *ifp;
-{
- struct sn_softc *sc = ifp->if_softc;
- struct mbuf *m;
- int len;
-
- if ((sc->sc_if.if_flags & IFF_RUNNING) == 0)
- return;
- IF_DEQUEUE(&sc->sc_if.if_snd, m);
- if (m == 0)
- return;
-
- /*
- * If there is nothing in the o/p queue, and there is room in
- * the Tx ring, then send the packet directly. Otherwise append
- * it to the o/p queue.
- */
- if (!sonicput(sc, m)) { /* not enough space */
- IF_PREPEND(&sc->sc_if.if_snd, m);
- }
-#if NBPFILTER > 0
- /*
- * If bpf is listening on this interface, let it
- * see the packet before we commit it to the wire.
- */
- if (sc->sc_if.if_bpf)
- bpf_mtap(sc->sc_if.if_bpf, m);
-#endif
-
- sc->sc_if.if_opackets++; /* # of pkts */
- sc->sc_sum.ls_opacks++; /* # of pkts */
-}
-
-/*
- * This is called from sonicioctl() when /etc/ifconfig is run to set
- * the address or switch the i/f on.
- */
-void caminitialise __P((void));
-void camentry __P((int, u_char *ea));
-void camprogram __P((struct sn_softc *));
-void initialise_tda __P((struct sn_softc *));
-void initialise_rda __P((struct sn_softc *));
-void initialise_rra __P((struct sn_softc *));
-
-/*
- * reset and restart the SONIC. Called in case of fatal
- * hardware/software errors.
- */
-void
-snreset(sc)
- struct sn_softc *sc;
-{
- snstop(sc);
- sninit(sc);
-}
-
-int
-sninit(sc)
- struct sn_softc *sc;
-{
- struct sonic_reg *csr = sc->sc_csr;
- int s, error;
-
- if (sc->sc_if.if_flags & IFF_RUNNING)
- /* already running */
- return (0);
-
- s = splnet();
-
- csr->s_cr = CR_RST; /* s_dcr only accessable reset mode! */
-
- /* config it */
- csr->s_dcr = DCR_LBR | DCR_SYNC | DCR_WAIT0 | DCR_DW32 | DCR_DMABLOCK |
- DCR_RFT16 | DCR_TFT16;
- csr->s_rcr = RCR_BRD | RCR_LBNONE;
- csr->s_imr = IMR_PRXEN | IMR_PTXEN | IMR_TXEREN | IMR_HBLEN | IMR_LCDEN;
-
- /* clear pending interrupts */
- csr->s_isr = 0x7fff;
-
- /* clear tally counters */
- csr->s_crct = -1;
- csr->s_faet = -1;
- csr->s_mpt = -1;
-
- initialise_tda(sc);
- initialise_rda(sc);
- initialise_rra(sc);
-
- /* enable the chip */
- csr->s_cr = 0;
- wbflush();
-
- /* program the CAM with our address */
- caminitialise();
- camentry(0, sc->sc_enaddr);
- camprogram(sc);
-
- /* get it to read resource descriptors */
- csr->s_cr = CR_RRRA;
- wbflush();
- while (csr->s_cr & CR_RRRA)
- continue;
-
- /* enable rx */
- csr->s_cr = CR_RXEN;
- wbflush();
-
- /* flag interface as "running" */
- sc->sc_if.if_flags |= IFF_RUNNING;
-
- splx(s);
- return (0);
-
-bad:
- snstop(sc);
- return (error);
-}
-
-/*
- * close down an interface and free its buffers
- * Called on final close of device, or if sninit() fails
- * part way through.
- */
-int
-snstop(sc)
- struct sn_softc *sc;
-{
- struct mtd *mtd;
- int s = splnet();
-
- /* stick chip in reset */
- sc->sc_csr->s_cr = CR_RST;
- wbflush();
-
- /* free all receive buffers (currently static so nothing to do) */
-
- /* free all pending transmit mbufs */
- while (mtd = mtdhead) {
- mtdhead = mtdhead->mtd_link;
- if (mtd->mtd_mbuf)
- m_freem(mtd->mtd_mbuf);
- mtd->mtd_mbuf = 0;
- mtd_free(mtd);
- }
- mtdnext = mtd_alloc();
-
- sc->sc_if.if_timer = 0;
- sc->sc_if.if_flags &= ~(IFF_RUNNING | IFF_UP);
-
- splx(s);
- return (0);
-}
-
-/*
- * Called if any Tx packets remain unsent after 5 seconds,
- * In all cases we just reset the chip, and any retransmission
- * will be handled by higher level protocol timeouts.
- */
-void
-snwatchdog(ifp)
- struct ifnet *ifp;
-{
- struct sn_softc *sc = ifp->if_softc;
- int temp;
-
- if (mtdhead && mtdhead->mtd_mbuf) {
- /* something still pending for transmit */
- if (mtdhead->mtd_txp->status == 0)
- log(LOG_ERR, "%s: Tx - timeout\n",
- sc->sc_if.if_xname);
- else
- log(LOG_ERR, "%s: Tx - lost interrupt\n",
- sc->sc_if.if_xname);
- temp = sc->sc_if.if_flags & IFF_UP;
- snreset(sc);
- sc->sc_if.if_flags |= temp;
- }
-}
-/*
- * stuff packet into sonic (at splnet)
-*/
-int
-sonicput(sc, m0)
- struct sn_softc *sc;
- struct mbuf *m0;
-{
- struct sonic_reg *csr = sc->sc_csr;
- struct TXpkt *txp;
- struct mtd *mtdnew;
- struct mbuf *m;
- int len = 0, fr = 0;
- int i;
- int fragoffset; /* Offset in viritual dma space for fragment */
-
- /* grab the replacement mtd */
- if ((mtdnew = mtd_alloc()) == 0)
- return (0);
-
- /* this packet goes to mdtnext fill in the TDA */
- mtdnext->mtd_mbuf = m0;
- txp = mtdnext->mtd_txp;
- SWR(txp->config, 0);
- fragoffset = (txp - p_tda) * FRAGMAX * 4096;
-
- /*
- * Now fill in the fragments. Each fragment maps to it's
- * own dma page. Fragments crossing a dma page boundary
- * are split up in two fragments. This is somewhat stupid
- * because the dma mapper can do the work, but it helps
- * keeping the fragments in order. (read lazy programmer).
- */
- for (m = m0; m; m = m->m_next) {
- unsigned va = (unsigned) mtod(m, caddr_t);
- int resid = m->m_len;
-
-#if has_to_be_fixed
- if(resid != 0) {
- R4K_HitFlushDCache(va, resid);
- }
-#endif
- len += resid;
-
- while (resid) {
- unsigned pa;
- unsigned n;
-
- pa = (va & PGOFSET) + fragoffset;
- n = resid;
- if (n > NBPG - (va & PGOFSET)) {
- n = NBPG - (va & PGOFSET);
- }
- if (fr < FRAGMAX) {
- SWR(txp->u[fr].frag_ptrlo, LOWER(pa));
- SWR(txp->u[fr].frag_ptrhi, UPPER(pa));
- SWR(txp->u[fr].frag_size, n);
- }
- fr++;
- va += n;
- resid -= n;
- fragoffset += 4096;
- }
- }
- /*
- * pad out last fragment for minimum size
- */
- if (len < ETHERMIN + sizeof(struct ether_header) && fr < FRAGMAX) {
- int pad = ETHERMIN + sizeof(struct ether_header) - len;
- static char zeros[64];
- unsigned pa;
-
- pa = ((unsigned)zeros & PGOFSET) + fragoffset;
- SWR(txp->u[fr].frag_ptrlo, LOWER(pa));
- SWR(txp->u[fr].frag_ptrhi, UPPER(pa));
- SWR(txp->u[fr].frag_size, pad);
- fr++;
- len = ETHERMIN + sizeof(struct ether_header);
- }
-
- if (fr > FRAGMAX) {
- mtd_free(mtdnew);
- m_freem(m0);
- log(LOG_ERR, "%s: tx too many fragments %d\n",
- sc->sc_if.if_xname, fr);
- sc->sc_if.if_oerrors++;
- return (len);
- }
-
- SWR(txp->frag_count, fr);
- SWR(txp->pkt_size, len);
-
- /* link onto the next mtd that will be used */
- SWR(txp->u[fr].tlink, LOWER(v_tda + (mtdnew->mtd_txp - p_tda)) | EOL);
-
- if (mtdhead == 0) {
- /* no current transmit list start with this one */
- mtdtail = mtdhead = mtdnext;
- csr->s_ctda = LOWER(v_tda + (txp - p_tda));
- } else {
- /*
- * have a transmit list append it to end note
- * mtdnext is already physicaly linked to mtdtail in
- * mtdtail->mtd_txp->u[mtdtail->mtd_txp->frag_count].tlink
- */
- SWR(mtdtail->mtd_txp->u[mtdtail->mtd_txp->frag_count].tlink,
- SRD(mtdtail->mtd_txp->u[mtdtail->mtd_txp->frag_count].tlink) & ~EOL);
- mtdtail = mtdnext;
- }
- mtdnext->mtd_link = mtdnew;
- mtdnext = mtdnew;
-
- /* make sure chip is running */
- wbflush();
- csr->s_cr = CR_TXP;
- wbflush();
- sc->sc_if.if_timer = 5; /* 5 seconds to watch for failing to transmit */
- return (len);
-}
-
-/*
- * Read out the ethernet address from the cam. It is stored
- * there by the boot when doing a loopback test. Thus we don't
- * have to fetch it from nv ram.
- */
-int
-sngetaddr(sc)
- struct sn_softc *sc;
-{
- unsigned i, x, y;
- char *cp, *ea;
-
-#if 0
- sc->sc_csr->s_cr = CR_RST;
- wbflush();
- sc->sc_csr->s_cep = 0;
- i = sc->sc_csr->s_cap2;
- wbflush();
- sc->sc_enaddr[5] = i >> 8;
- sc->sc_enaddr[4] = i;
- i = sc->sc_csr->s_cap1;
- wbflush();
- sc->sc_enaddr[3] = i >> 8;
- sc->sc_enaddr[2] = i;
- i = sc->sc_csr->s_cap0;
- wbflush();
- sc->sc_enaddr[1] = i >> 8;
- sc->sc_enaddr[0] = i;
-
- sc->sc_csr->s_cr = 0;
- wbflush();
-#else
- sc->sc_enaddr[0] = 0x08;
- sc->sc_enaddr[1] = 0x00;
- sc->sc_enaddr[2] = 0x20;
- sc->sc_enaddr[3] = 0xa0;
- sc->sc_enaddr[4] = 0x66;
- sc->sc_enaddr[5] = 0x54;
-#endif
- return (0);
-}
-
-void sonictxint __P((struct sn_softc *));
-void sonicrxint __P((struct sn_softc *));
-
-int sonic_read __P((struct sn_softc *, struct RXpkt *));
-struct mbuf *sonic_get __P((struct sn_softc *, struct ether_header *, int));
-
-void
-mtd_free(mtd)
- struct mtd *mtd;
-{
- mtd->mtd_link = mtdfree;
- mtdfree = mtd;
-}
-
-struct mtd *
-mtd_alloc()
-{
- struct mtd *mtd = mtdfree;
-
- if (mtd) {
- mtdfree = mtd->mtd_link;
- mtd->mtd_link = 0;
- }
- return (mtd);
-}
-
-/*
- * CAM support
- */
-void
-caminitialise()
-{
- int i;
-
- for (i = 0; i < MAXCAM; i++)
- SWR(p_cda->desc[i].cam_ep, i);
- SWR(p_cda->enable, 0);
-}
-
-void
-camentry(entry, ea)
- int entry;
- u_char *ea;
-{
- SWR(p_cda->desc[entry].cam_ep, entry);
- SWR(p_cda->desc[entry].cam_ap2, (ea[5] << 8) | ea[4]);
- SWR(p_cda->desc[entry].cam_ap1, (ea[3] << 8) | ea[2]);
- SWR(p_cda->desc[entry].cam_ap0, (ea[1] << 8) | ea[0]);
- SWR(p_cda->enable, SRD(p_cda->enable) | (1 << entry));
-}
-
-void
-camprogram(sc)
- struct sn_softc *sc;
-{
- struct sonic_reg *csr;
- int timeout;
- int i;
-
- csr = sc->sc_csr;
- csr->s_cdp = LOWER(v_cda);
- csr->s_cdc = MAXCAM;
- csr->s_cr = CR_LCAM;
- wbflush();
-
- timeout = 10000;
- while (csr->s_cr & CR_LCAM && timeout--)
- continue;
- if (timeout == 0) {
- /* XXX */
- panic("sonic: CAM initialisation failed");
- }
- timeout = 10000;
- while ((csr->s_isr & ISR_LCD) == 0 && timeout--)
- continue;
-
- if (csr->s_isr & ISR_LCD)
- csr->s_isr = ISR_LCD;
- else
- printf("sonic: CAM initialisation without interrupt\n");
-}
-
-#if 0
-void
-camdump(sc)
- struct sn_softc *sc;
-{
- struct sonic_reg *csr = sc->sc_csr;
- int i;
-
- printf("CAM entries:\n");
- csr->s_cr = CR_RST;
- wbflush();
-
- for (i = 0; i < 16; i++) {
- ushort ap2, ap1, ap0;
- csr->s_cep = i;
- wbflush();
- ap2 = csr->s_cap2;
- ap1 = csr->s_cap1;
- ap0 = csr->s_cap0;
- printf("%d: ap2=0x%x ap1=0x%x ap0=0x%x\n", i, ap2, ap1, ap0);
- }
- printf("CAM enable 0x%x\n", csr->s_cep);
-
- csr->s_cr = 0;
- wbflush();
-}
-#endif
-
-void
-initialise_tda(sc)
- struct sn_softc *sc;
-{
- struct sonic_reg *csr;
- struct mtd *mtd;
- int i;
-
- csr = sc->sc_csr;
-
- mtdfree = mtdhead = mtdtail = (struct mtd *) 0;
-
- for (i = 0; i < NTDA; i++) {
- mtd = &mtda[i];
- mtd->mtd_txp = &p_tda[i];
- mtd->mtd_mbuf = (struct mbuf *) 0;
- mtd_free(mtd);
- }
- mtdnext = mtd_alloc();
-
- csr->s_utda = UPPER(v_tda);
-}
-
-void
-initialise_rda(sc)
- struct sn_softc *sc;
-{
- struct sonic_reg *csr;
- int i;
-
- csr = sc->sc_csr;
-
- /* link the RDA's together into a circular list */
- for (i = 0; i < (NRDA - 1); i++) {
- SWR(p_rda[i].rlink, LOWER(&v_rda[i + 1]));
- SWR(p_rda[i].in_use, 1);
- }
- SWR(p_rda[NRDA - 1].rlink, LOWER(&v_rda[0]) | EOL);
- SWR(p_rda[NRDA - 1].in_use, 1);
-
- /* mark end of receive descriptor list */
- sc->sc_lrxp = &p_rda[NRDA - 1];
-
- sc->sc_rxmark = 0;
-
- csr->s_urda = UPPER(&v_rda[0]);
- csr->s_crda = LOWER(&v_rda[0]);
- wbflush();
-}
-
-void
-initialise_rra(sc)
- struct sn_softc *sc;
-{
- struct sonic_reg *csr;
- int i;
-
- csr = sc->sc_csr;
-
- csr->s_eobc = RBASIZE / 2 - 2; /* must be >= MAXETHERPKT */
- csr->s_urra = UPPER(v_rra);
- csr->s_rsa = LOWER(v_rra);
- csr->s_rea = LOWER(&v_rra[NRRA]);
- csr->s_rrp = LOWER(v_rra);
- csr->s_rsc = 0;
-
- /* fill up SOME of the rra with buffers */
- for (i = 0; i < NRBA; i++) {
- SWR(p_rra[i].buff_ptrhi, UPPER(&v_rba[i * RBASIZE]));
- SWR(p_rra[i].buff_ptrlo, LOWER(&v_rba[i * RBASIZE]));
- SWR(p_rra[i].buff_wchi, UPPER(RBASIZE / 2));
- SWR(p_rra[i].buff_wclo, LOWER(RBASIZE / 2));
- }
- sc->sc_rramark = NRBA;
- csr->s_rwp = LOWER(&v_rra[sc->sc_rramark]);
- wbflush();
-}
-
-int
-snintr(sc)
- struct sn_softc *sc;
-{
- struct sonic_reg *csr = sc->sc_csr;
- int isr;
-
- while (isr = (csr->s_isr & ISR_ALL)) {
- /* scrub the interrupts that we are going to service */
- csr->s_isr = isr;
- wbflush();
-
- if (isr & (ISR_BR | ISR_LCD | ISR_PINT | ISR_TC))
- printf("sonic: unexpected interrupt status 0x%x\n", isr);
-
- if (isr & (ISR_TXDN | ISR_TXER))
- sonictxint(sc);
-
- if (isr & ISR_PKTRX)
- sonicrxint(sc);
-
- if (isr & (ISR_HBL | ISR_RDE | ISR_RBE | ISR_RBAE | ISR_RFO)) {
- if (isr & ISR_HBL)
- printf("sonic: no heartbeat\n");
- if (isr & ISR_RDE)
- printf("sonic: receive descriptors exhausted\n");
- if (isr & ISR_RBE)
- printf("sonic: receive buffers exhausted\n");
- if (isr & ISR_RBAE)
- printf("sonic: receive buffer area exhausted\n");
- if (isr & ISR_RFO)
- printf("sonic: receive FIFO overrun\n");
- }
- if (isr & (ISR_CRC | ISR_FAE | ISR_MP)) {
-#ifdef notdef
- if (isr & ISR_CRC)
- sc->sc_crctally++;
- if (isr & ISR_FAE)
- sc->sc_faetally++;
- if (isr & ISR_MP)
- sc->sc_mptally++;
-#endif
- }
- }
- return (1);
-}
-
-/*
- * Transmit interrupt routine
- */
-void
-sonictxint(sc)
- struct sn_softc *sc;
-{
- struct TXpkt *txp;
- struct sonic_reg *csr;
- struct mtd *mtd;
-
- if (mtdhead == (struct mtd *) 0)
- return;
-
- csr = sc->sc_csr;
-
- while (mtd = mtdhead) {
- struct mbuf *m = mtd->mtd_mbuf;
-
- if (m == 0)
- break;
-
- txp = mtd->mtd_txp;
-
- if (SRD(txp->status) == 0) /* it hasn't really gone yet */
- return;
-
- if (ethdebug) {
- struct ether_header *eh = mtod(m, struct ether_header *);
- printf("xmit status=0x%x len=%d type=0x%x from %s",
- txp->status,
- txp->pkt_size,
- htons(eh->ether_type),
- ether_sprintf(eh->ether_shost));
- printf(" (to %s)\n", ether_sprintf(eh->ether_dhost));
- }
- m_freem(m);
- mtd->mtd_mbuf = 0;
- mtdhead = mtd->mtd_link;
-
- mtd_free(mtd);
-
- if ((SRD(txp->status) & TCR_PTX) == 0) {
- printf("sonic: Tx packet status=0x%x\n", txp->status);
-
- if (mtdhead != mtdnext) {
- printf("resubmitting remaining packets\n");
- csr->s_ctda = LOWER(v_tda + (mtdhead->mtd_txp - p_tda));
- csr->s_cr = CR_TXP;
- wbflush();
- return;
- }
- }
- }
- /* mtdhead should be at mtdnext (go) */
- assert(mtdhead == mtdnext);
- assert(mtdhead->mtd_link == 0);
- mtdhead = 0;
-
- /* and start feeding any queued packets to chip */
- while (1) {
- struct mbuf *m;
-
- IF_DEQUEUE(&sc->sc_if.if_snd, m);
- if (m == 0) /* nothing left to send */
- break;
- if (!sonicput(sc, m)) { /* not enough space */
- IF_PREPEND(&sc->sc_if.if_snd, m);
- break;
- }
- }
-}
-
-/*
- * Receive interrupt routine
- */
-void
-sonicrxint(sc)
- struct sn_softc *sc;
-{
- struct sonic_reg *csr = sc->sc_csr;
- struct RXpkt *rxp;
- u_long addr;
- int orra;
-
- rxp = &p_rda[sc->sc_rxmark];
-
- while (SRD(rxp->in_use) == 0) {
- unsigned status = SRD(rxp->status);
- if ((status & RCR_LPKT) == 0)
- printf("sonic: more than one packet in RBA!\n");
- assert(PSNSEQ(SRD(rxp->seq_no)) == 0);
-
- if (status & RCR_PRX) {
- if (sonic_read(sc, rxp)) {
- sc->sc_if.if_ipackets++;
- sc->sc_sum.ls_ipacks++;
- sc->sc_missed = 0;
- }
- } else
- sc->sc_if.if_ierrors++;
-
- /*
- * give receive buffer area back to chip XXX what buffer
- * did the sonic use for this descriptor answer look at
- * the rba sequence number !!
- */
- orra = RBASEQ(SRD(rxp->seq_no)) & RRAMASK;
-
- assert(SRD(rxp->pkt_ptrhi) == SRD(p_rra[orra].buff_ptrhi));
- assert(SRD(rxp->pkt_ptrlo) == SRD(p_rra[orra].buff_ptrlo));
-if(SRD(rxp->pkt_ptrlo) != SRD(p_rra[orra].buff_ptrlo))
-printf("%x,%x\n",SRD(rxp->pkt_ptrlo),SRD(p_rra[orra].buff_ptrlo));
- assert(SRD(p_rra[orra].buff_wclo));
-
- /*
- * orra is now empty of packets and can be freed if
- * sonic read didnt copy it out then we would have to
- * wait !!
- * (dont bother add it back in again straight away)
- */
- p_rra[sc->sc_rramark] = p_rra[orra];
-
- /* zap old rra for fun */
- p_rra[orra].buff_wchi = 0;
- p_rra[orra].buff_wclo = 0;
-
- sc->sc_rramark = (sc->sc_rramark + 1) & RRAMASK;
- csr->s_rwp = LOWER(&v_rra[sc->sc_rramark]);
- wbflush();
-
- /*
- * give recieve descriptor back to chip simple
- * list is circular
- */
- SWR(rxp->in_use, 1);
- SWR(rxp->rlink, SRD(rxp->rlink) | EOL);
- SWR(sc->sc_lrxp->rlink, SRD(sc->sc_lrxp->rlink) & ~EOL);
- sc->sc_lrxp = rxp;
-
- if (++sc->sc_rxmark >= NRDA)
- sc->sc_rxmark = 0;
- rxp = &p_rda[sc->sc_rxmark];
- }
-}
-
-/*
- * sonic_read -- pull packet off interface and forward to
- * appropriate protocol handler
- */
-int
-sonic_read(sc, rxp)
- struct sn_softc *sc;
- struct RXpkt *rxp;
-{
- struct ifnet *ifp = &sc->sc_if;
- /*extern char *ether_sprintf();*/
- struct ether_header *et;
- struct mbuf *m;
- int len, off, i;
- caddr_t pkt;
-
- /*
- * Get input data length.
- * Get pointer to ethernet header (in input buffer).
- * Deal with trailer protocol: if type is PUP trailer
- * get true type from first 16-bit word past data.
- * Remember that type was trailer by setting off.
- */
-
- len = SRD(rxp->byte_count) - sizeof(struct ether_header) - FCSSIZE;
- pkt = (caddr_t)((SRD(rxp->pkt_ptrhi) << 16) | SRD(rxp->pkt_ptrlo));
- pkt = pkt - v_rba + p_rba;
- et = (struct ether_header *)pkt;
-
- if (ethdebug) {
- printf("rcvd 0x%x status=0x%x, len=%d type=0x%x from %s",
- et, rxp->status, len, htons(et->ether_type),
- ether_sprintf(et->ether_shost));
- printf(" (to %s)\n", ether_sprintf(et->ether_dhost));
- }
- if (len < ETHERMIN || len > ETHERMTU) {
- printf("sonic: invalid packet length %d bytes\n", len);
- return (0);
- }
-
-#if NBPFILTER > 0
- /*
- * Check if there's a bpf filter listening on this interface.
- * If so, hand off the raw packet to enet.
- */
- if (sc->sc_if.if_bpf)
- bpf_tap(sc->sc_if.if_bpf, pkt,
- len + sizeof(struct ether_header));
-#endif
- m = sonic_get(sc, et, len);
- if (m == NULL)
- return (0);
- ether_input(ifp, et, m);
- return(1);
-}
-
-#define sonicdataaddr(eh, off, type) ((type)(((caddr_t)((eh)+1)+(off))))
-
-/*
- * munge the recieved packet into an mbuf chain
- * because we are using stupif buffer management this
- * is slow.
-*/
-struct mbuf *
-sonic_get(sc, eh, datalen)
- struct sn_softc *sc;
- struct ether_header *eh;
- int datalen;
-{
- struct mbuf *m;
- struct mbuf *top = 0, **mp = &top;
- int len;
- char *spkt = sonicdataaddr(eh, 0, caddr_t);
- char *epkt = spkt + datalen;
- char *cp = spkt;
-
- epkt = cp + datalen;
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (m == 0)
- return (0);
- m->m_pkthdr.rcvif = &sc->sc_if;
- m->m_pkthdr.len = datalen;
- m->m_len = MHLEN;
-
- while (datalen > 0) {
- if (top) {
- MGET(m, M_DONTWAIT, MT_DATA);
- if (m == 0) {
- m_freem(top);
- return (0);
- }
- m->m_len = MLEN;
- }
- len = min(datalen, epkt - cp);
- if (len >= MINCLSIZE) {
- MCLGET(m, M_DONTWAIT);
- if (m->m_flags & M_EXT)
- m->m_len = len = min(len, MCLBYTES);
- else
- len = m->m_len;
- } else {
- /*
- * Place initial small packet/header at end of mbuf.
- */
- if (len < m->m_len) {
- if (top == 0 && len + max_linkhdr <= m->m_len)
- m->m_data += max_linkhdr;
- m->m_len = len;
- } else
- len = m->m_len;
- }
- bcopy(cp, mtod(m, caddr_t), (unsigned) len);
- cp += len;
- *mp = m;
- mp = &m->m_next;
- datalen -= len;
- if (cp == epkt)
- cp = spkt;
- }
- return (top);
-}
diff --git a/sys/arch/wgrisc/dev/if_sn.h b/sys/arch/wgrisc/dev/if_sn.h
deleted file mode 100644
index 37fa3a5135c..00000000000
--- a/sys/arch/wgrisc/dev/if_sn.h
+++ /dev/null
@@ -1,347 +0,0 @@
-/* $OpenBSD: if_sn.h,v 1.1.1.1 1997/02/06 16:02:42 pefo Exp $ */
-/*
- * Copyright (c) 1991 Algorithmics Ltd (http://www.algor.co.uk)
- * You may use, copy, and modify this program so long as you retain the
- * copyright line.
- */
-
-/*
- * if_sonic.h -- National Semiconductor DP83932BVF (SONIC)
- */
-
-/*
- * Accessing SONIC data structures and registers as 32 bit values
- * makes code endianess independent. The SONIC is however always in
- * bigendian mode so it is necessary to ensure that data structures shared
- * between the CPU and the SONIC are always in bigendian order.
- */
-
-/*
- * Receive Resource Descriptor
- * This structure describes the buffers into which packets
- * will be received. Note that more than one packet may be
- * packed into a single buffer if constraints permit.
- */
-#if SONICDW == 32
-struct RXrsrc {
- u_long buff_ptrlo; /* buffer address LO */
- u_long buff_ptrhi; /* buffer address HI */
- u_long buff_wclo; /* buffer size (16bit words) LO */
- u_long buff_wchi; /* buffer size (16bit words) HI */
-};
-#endif
-
-/*
- * Receive Descriptor
- * This structure holds information about packets received.
- */
-#if SONICDW == 32
-struct RXpkt {
- u_long status; /* + receive status */
- u_long byte_count; /* + packet byte count (including FCS) */
- u_long pkt_ptrlo; /* + packet data LO (in RBA) */
- u_long pkt_ptrhi; /* + packet data HI (in RBA) */
- u_long seq_no; /* + RBA sequence numbers */
- u_long rlink; /* link to next receive descriptor */
- u_long in_use; /* + packet available to SONIC */
- u_long pad; /* pad to multiple of 16 bytes */
-};
-#endif
-#define RBASEQ(x) (((x)>>8)&0xff)
-#define PSNSEQ(x) ((x) & 0xff)
-
-/*
- * Transmit Descriptor
- * This structure holds information about packets to be transmitted.
- */
-#define FRAGMAX 31 /* maximum number of fragments in a packet */
-#if SONICDW == 32
-struct TXpkt {
- u_long status; /* + transmitted packet status */
- u_long config; /* transmission configuration */
- u_long pkt_size; /* entire packet size in bytes */
- u_long frag_count; /* # fragments in packet */
- union {
- struct {
- u_long _frag_ptrlo; /* pointer to packet fragment LO */
- u_long _frag_ptrhi; /* pointer to packet fragment HI */
- u_long _frag_size; /* fragment size */
- } u_frag;
- struct {
- u_long _tlink; /* link to next transmit descriptor */
- } u_link;
- } u[FRAGMAX+1]; /* +1 makes tcp->u[FRAGMAX].u_link.link valid! */
-};
-#endif
-
-#define frag_ptrlo u_frag._frag_ptrlo
-#define frag_ptrhi u_frag._frag_ptrhi
-#define frag_size u_frag._frag_size
-#define tlink u_link._tlink
-
-#define EOL 0x0001 /* end of list marker for link fields */
-
-#define MAXCAM 16 /* number of user entries in CAM */
-#if SONICDW == 32
-struct CDA {
- struct {
- u_long cam_ep; /* CAM Entry Pointer */
- u_long cam_ap0; /* CAM Address Port 0 xx-xx-xx-xx-YY-YY */
- u_long cam_ap1; /* CAM Address Port 1 xx-xx-YY-YY-xxxx */
- u_long cam_ap2; /* CAM Address Port 2 YY-YY-xx-xx-xx-xx */
- } desc[MAXCAM];
- u_long enable; /* mask enabling CAM entries */
-};
-#endif
-
-/*
- * SONIC registers as seen by the processor
- */
-struct sonic_reg {
- volatile u_long s_cr; /* 00: Command */
- volatile u_long s_dcr; /* 01: Data Configuration */
- volatile u_long s_rcr; /* 02: Receive Control */
- volatile u_long s_tcr; /* 03: Transmit Control */
- volatile u_long s_imr; /* 04: Interrupt Mask */
- volatile u_long s_isr; /* 05: Interrupt Status */
- volatile u_long s_utda; /* 06: Upper Transmit Descriptor Address */
- volatile u_long s_ctda; /* 07: Current Transmit Descriptor Address */
- volatile u_long _s_tps; /* 08* Transmit Packet Size */
- volatile u_long _s_tfc; /* 09* Transmit Fragment Count */
- volatile u_long _s_tsa0; /* 0a* Transmit Start Address 0 */
- volatile u_long _s_tsa1; /* 0b* Transmit Start Address 1 */
- volatile u_long _s_tfs; /* 0c* Transmit Fragment Size */
- volatile u_long s_urda; /* 0d: Upper Receive Descriptor Address */
- volatile u_long s_crda; /* 0e: Current Receive Descriptor Address */
- volatile u_long _s_crba0; /* 0f* Current Receive Buffer Address 0 */
- volatile u_long _s_crba1; /* 10* Current Receive Buffer Address 1 */
- volatile u_long _s_rbwc0; /* 11* Remaining Buffer Word Count 0 */
- volatile u_long _s_rbwc1; /* 12* Remaining Buffer Word Count 1 */
- volatile u_long s_eobc; /* 13: End Of Buffer Word Count */
- volatile u_long s_urra; /* 14: Upper Receive Resource Address */
- volatile u_long s_rsa; /* 15: Resource Start Address */
- volatile u_long s_rea; /* 16: Resource End Address */
- volatile u_long s_rrp; /* 17: Resource Read Pointer */
- volatile u_long s_rwp; /* 18: Resource Write Pointer */
- volatile u_long _s_trba0; /* 19* Temporary Receive Buffer Address 0 */
- volatile u_long _s_trba1; /* 1a* Temporary Receive Buffer Address 1 */
- volatile u_long _s_tbwc0; /* 1b* Temporary Buffer Word Count 0 */
- volatile u_long _s_tbwc1; /* 1c* Temporary Buffer Word Count 1 */
- volatile u_long _s_addr0; /* 1d* Address Generator 0 */
- volatile u_long _s_addr1; /* 1e* Address Generator 1 */
- volatile u_long _s_llfa; /* 1f* Last Link Field Address */
- volatile u_long _s_ttda; /* 20* Temp Transmit Descriptor Address */
- volatile u_long s_cep; /* 21: CAM Entry Pointer */
- volatile u_long s_cap2; /* 22: CAM Address Port 2 */
- volatile u_long s_cap1; /* 23: CAM Address Port 1 */
- volatile u_long s_cap0; /* 24: CAM Address Port 0 */
- volatile u_long s_ce; /* 25: CAM Enable */
- volatile u_long s_cdp; /* 26: CAM Descriptor Pointer */
- volatile u_long s_cdc; /* 27: CAM Descriptor Count */
- volatile u_long s_sr; /* 28: Silicon Revision */
- volatile u_long s_wt0; /* 29: Watchdog Timer 0 */
- volatile u_long s_wt1; /* 2a: Watchdog Timer 1 */
- volatile u_long s_rsc; /* 2b: Receive Sequence Counter */
- volatile u_long s_crct; /* 2c: CRC Error Tally */
- volatile u_long s_faet; /* 2d: FAE Tally */
- volatile u_long s_mpt; /* 2e: Missed Packet Tally */
- volatile u_long _s_mdt; /* 2f* Maximum Deferral Timer */
- volatile u_long _s_rtc; /* 30* Receive Test Control */
- volatile u_long _s_ttc; /* 31* Transmit Test Control */
- volatile u_long _s_dtc; /* 32* DMA Test Control */
- volatile u_long _s_cc0; /* 33* CAM Comparison 0 */
- volatile u_long _s_cc1; /* 34* CAM Comparison 1 */
- volatile u_long _s_cc2; /* 35* CAM Comparison 2 */
- volatile u_long _s_cm; /* 36* CAM Match */
- volatile u_long :32; /* 37* reserved */
- volatile u_long :32; /* 38* reserved */
- volatile u_long _s_rbc; /* 39* Receiver Byte Count */
- volatile u_long :32; /* 3a* reserved */
- volatile u_long _s_tbo; /* 3b* Transmitter Backoff Counter */
- volatile u_long _s_trc; /* 3c* Transmitter Random Counter */
- volatile u_long _s_tbm; /* 3d* Transmitter Backoff Mask */
- volatile u_long :32; /* 3e* Reserved */
- volatile u_long s_dcr2; /* 3f Data Configuration 2 (AVF) */
-};
-
-/*
- * Register Interpretations
- */
-
-/*
- * The command register is used for issuing commands to the SONIC.
- * With the exception of CR_RST, the bit is reset when the operation
- * completes.
- */
-#define CR_LCAM 0x0200 /* load CAM with descriptor at s_cdp */
-#define CR_RRRA 0x0100 /* read next RRA descriptor at s_rrp */
-#define CR_RST 0x0080 /* software reset */
-#define CR_ST 0x0020 /* start timer */
-#define CR_STP 0x0010 /* stop timer */
-#define CR_RXEN 0x0008 /* receiver enable */
-#define CR_RXDIS 0x0004 /* receiver disable */
-#define CR_TXP 0x0002 /* transmit packets */
-#define CR_HTX 0x0001 /* halt transmission */
-
-/*
- * The data configuration register establishes the SONIC's bus cycle
- * operation. This register can only be accessed when the SONIC is in
- * reset mode (s_cr.CR_RST is set.)
- */
-#define DCR_EXBUS 0x8000 /* extended bus mode (AVF) */
-#define DCR_LBR 0x2000 /* latched bus retry */
-#define DCR_PO1 0x1000 /* programmable output 1 */
-#define DCR_PO0 0x0800 /* programmable output 0 */
-#define DCR_STERM 0x0400 /* synchronous termination */
-#define DCR_USR1 0x0200 /* reflects USR1 input pin */
-#define DCR_USR0 0x0100 /* reflects USR0 input pin */
-#define DCR_WC1 0x0080 /* wait state control 1 */
-#define DCR_WC0 0x0040 /* wait state control 0 */
-#define DCR_DW 0x0020 /* data width select */
-#define DCR_BMS 0x0010 /* DMA block mode select */
-#define DCR_RFT1 0x0008 /* receive FIFO threshold control 1 */
-#define DCR_RFT0 0x0004 /* receive FIFO threshold control 0 */
-#define DCR_TFT1 0x0002 /* transmit FIFO threshold control 1 */
-#define DCR_TFT0 0x0001 /* transmit FIFO threshold control 0 */
-
-/* data configuration register aliases */
-#define DCR_SYNC DCR_STERM /* synchronous (memory cycle 2 clocks) */
-#define DCR_ASYNC 0 /* asynchronous (memory cycle 3 clocks) */
-
-#define DCR_WAIT0 0 /* 0 wait states added */
-#define DCR_WAIT1 DCR_WC0 /* 1 wait state added */
-#define DCR_WAIT2 DCR_WC1 /* 2 wait states added */
-#define DCR_WAIT3 (DCR_WC1|DCR_WC0) /* 3 wait states added */
-
-#define DCR_DW16 0 /* use 16-bit DMA accesses */
-#define DCR_DW32 DCR_DW /* use 32-bit DMA accesses */
-
-#define DCR_DMAEF 0 /* DMA until TX/RX FIFO has emptied/filled */
-#define DCR_DMABLOCK DCR_BMS /* DMA until RX/TX threshold crossed */
-
-#define DCR_RFT4 0 /* receive threshold 4 bytes */
-#define DCR_RFT8 DCR_RFT0 /* receive threshold 8 bytes */
-#define DCR_RFT16 DCR_RFT1 /* receive threshold 16 bytes */
-#define DCR_RFT24 (DCR_RFT1|DCR_RFT0) /* receive threshold 24 bytes */
-
-#define DCR_TFT8 0 /* transmit threshold 8 bytes */
-#define DCR_TFT16 DCR_TFT0 /* transmit threshold 16 bytes */
-#define DCR_TFT24 DCR_TFT1 /* transmit threshold 24 bytes */
-#define DCR_TFT28 (DCR_TFT1|DCR_TFT0) /* transmit threshold 28 bytes */
-
-/*
- * The receive control register is used to filter incoming packets and
- * provides status information on packets received.
- * The contents of the register are copied into the RXpkt.status field
- * when a packet is received. RCR_MC - RCR_PRX are then reset.
- */
-#define RCR_ERR 0x8000 /* accept packets with CRC errors */
-#define RCR_RNT 0x4000 /* accept runt (length < 64) packets */
-#define RCR_BRD 0x2000 /* accept broadcast packets */
-#define RCR_PRO 0x1000 /* accept all physical address packets */
-#define RCR_AMC 0x0800 /* accept all multicast packets */
-#define RCR_LB1 0x0400 /* loopback control 1 */
-#define RCR_LB0 0x0200 /* loopback control 0 */
-#define RCR_MC 0x0100 /* multicast packet received */
-#define RCR_BC 0x0080 /* broadcast packet received */
-#define RCR_LPKT 0x0040 /* last packet in RBA (RBWC < EOBC) */
-#define RCR_CRS 0x0020 /* carrier sense activity */
-#define RCR_COL 0x0010 /* collision activity */
-#define RCR_CRC 0x0008 /* CRC error */
-#define RCR_FAE 0x0004 /* frame alignment error */
-#define RCR_LBK 0x0002 /* loopback packet received */
-#define RCR_PRX 0x0001 /* packet received without errors */
-
-/* receiver control register aliases */
-/* the loopback control bits provide the following options */
-#define RCR_LBNONE 0 /* no loopback - normal operation */
-#define RCR_LBMAC RCR_LB0 /* MAC loopback */
-#define RCR_LBENDEC RCR_LB1 /* ENDEC loopback */
-#define RCR_LBTRANS (RCR_LB1|RCR_LB0) /* transceiver loopback */
-
-/*
- * The transmit control register controls the SONIC's transmit operations.
- * TCR_PINT - TCR_EXDIS are loaded from the TXpkt.config field at the
- * start of transmission. TCR_EXD-TCR_PTX are cleared at the beginning
- * of transmission and updated when the transmission is completed.
- */
-#define TCR_PINT 0x8000 /* interrupt when transmission starts */
-#define TCR_POWC 0x4000 /* program out of window collision timer */
-#define TCR_CRCI 0x2000 /* transmit packet without 4 byte FCS */
-#define TCR_EXDIS 0x1000 /* disable excessive deferral timer */
-#define TCR_EXD 0x0400 /* excessive deferrals occurred (>3.2ms) */
-#define TCR_DEF 0x0200 /* deferred transmissions occurred */
-#define TCR_NCRS 0x0100 /* carrier not present during transmission */
-#define TCR_CRSL 0x0080 /* carrier lost during transmission */
-#define TCR_EXC 0x0040 /* excessive collisions (>16) detected */
-#define TCR_OWC 0x0020 /* out of window (bad) collision occurred */
-#define TCR_PMB 0x0008 /* packet monitored bad - the tansmitted
- * packet had a bad source address or CRC */
-#define TCR_FU 0x0004 /* FIFO underrun (memory access failed) */
-#define TCR_BCM 0x0002 /* byte count mismatch (TXpkt.pkt_size
- * != sum(TXpkt.frag_size) */
-#define TCR_PTX 0x0001 /* packet transmitted without errors */
-
-/* transmit control register aliases */
-#define TCR_OWCSFD 0 /* start after start of frame delimiter */
-#define TCR_OWCPRE TCR_POWC /* start after first bit of preamble */
-
-
-/*
- * The interrupt mask register masks the interrupts that
- * are generated from the interrupt status register.
- * All reserved bits should be written with 0.
- */
-#define IMR_BREN 0x4000 /* bus retry occurred enable */
-#define IMR_HBLEN 0x2000 /* heartbeat lost enable */
-#define IMR_LCDEN 0x1000 /* load CAM done interrupt enable */
-#define IMR_PINTEN 0x0800 /* programmable interrupt enable */
-#define IMR_PRXEN 0x0400 /* packet received enable */
-#define IMR_PTXEN 0x0200 /* packet transmitted enable */
-#define IMR_TXEREN 0x0100 /* transmit error enable */
-#define IMR_TCEN 0x0080 /* timer complete enable */
-#define IMR_RDEEN 0x0040 /* receive descriptors exhausted enable */
-#define IMR_RBEEN 0x0020 /* receive buffers exhausted enable */
-#define IMR_RBAEEN 0x0010 /* receive buffer area exceeded enable */
-#define IMR_CRCEN 0x0008 /* CRC tally counter rollover enable */
-#define IMR_FAEEN 0x0004 /* FAE tally counter rollover enable */
-#define IMR_MPEN 0x0002 /* MP tally counter rollover enable */
-#define IMR_RFOEN 0x0001 /* receive FIFO overrun enable */
-
-
-/*
- * The interrupt status register indicates the source of an interrupt when
- * the INT pin goes active. The interrupt is acknowledged by writing
- * the appropriate bit(s) in this register.
- */
-#define ISR_ALL 0xffff /* all interrupts */
-#define ISR_BR 0x4000 /* bus retry occurred */
-#define ISR_HBL 0x2000 /* CD heartbeat lost */
-#define ISR_LCD 0x1000 /* load CAM command has completed */
-#define ISR_PINT 0x0800 /* programmed interrupt from TXpkt.config */
-#define ISR_PKTRX 0x0400 /* packet received */
-#define ISR_TXDN 0x0200 /* no remaining packets to be transmitted */
-#define ISR_TXER 0x0100 /* packet transmission caused error */
-#define ISR_TC 0x0080 /* timer complete */
-#define ISR_RDE 0x0040 /* receive descriptors exhausted */
-#define ISR_RBE 0x0020 /* receive buffers exhausted */
-#define ISR_RBAE 0x0010 /* receive buffer area exceeded */
-#define ISR_CRC 0x0008 /* CRC tally counter rollover */
-#define ISR_FAE 0x0004 /* FAE tally counter rollover */
-#define ISR_MP 0x0002 /* MP tally counter rollover */
-#define ISR_RFO 0x0001 /* receive FIFO overrun */
-
-/*
- * The second data configuration register allows additional user defined
- * pins to be controlled. These bits are only available if s_dcr.DCR_EXBUS
- * is set.
- */
-#define DCR2_EXPO3 0x8000 /* EXUSR3 output */
-#define DCR2_EXPO2 0x4000 /* EXUSR2 output */
-#define DCR2_EXPO1 0x2000 /* EXUSR1 output */
-#define DCR2_EXPO0 0x1000 /* EXUSR0 output */
-#define DCR2_PHL 0x0010 /* extend HOLD signal by 1/2 clock */
-#define DCR2_LRDY 0x0008 /* set latched ready mode */
-#define DCR2_PCM 0x0004 /* packet compress on match */
-#define DCR2_PCNM 0x0002 /* packet compress on mismatch */
-#define DCR2_RJM 0x0001 /* reject on match */
diff --git a/sys/arch/wgrisc/dev/scsi.h b/sys/arch/wgrisc/dev/scsi.h
deleted file mode 100644
index ffbd9965a87..00000000000
--- a/sys/arch/wgrisc/dev/scsi.h
+++ /dev/null
@@ -1,559 +0,0 @@
-/* $OpenBSD: scsi.h,v 1.1.1.1 1997/02/06 16:02:41 pefo Exp $ */
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)scsi.h 8.1 (Berkeley) 6/10/93
- * $Id: scsi.h,v 1.1.1.1 1997/02/06 16:02:41 pefo Exp $
- *
- * scsi.h --
- *
- * Common declarations for SCSI command formaters. This file only covers
- * definitions pertaining to the SCSI common command set that are
- * common to all SCSI device types (ie disk, tapes, WORM, printers, etc).
- * Some of the references from the proceedings of the
- * 1984 Mini/Micro Northeast conference might help in understanding SCSI.
- *
- * from: Header: /sprite/src/kernel/dev/RCS/scsi.h,
- * v 9.1 90/02/13 23:11:24 jhh Exp SPRITE (Berkeley)
- * $Id: scsi.h,v 1.1.1.1 1997/02/06 16:02:41 pefo Exp $
- */
-
-#ifndef _SCSI_H
-#define _SCSI_H
-
-/*
- * "Standard" SCSI Commands.
- * SCSI commands are divided into 8 groups as follows:
- * Group0 (0x00 - 0x1f). Basic commands. 6 bytes long
- * Group1 (0x20 - 0x3f). Extended command. 10 bytes.
- * Group2 (0x40 - 0x5f). Reserved.
- * Group2 (0x60 - 0x7f). Reserved.
- * Group2 (0x80 - 0x9f). Reserved.
- * Group2 (0xa0 - 0xbf). Reserved.
- * Group6 (0xc0 - 0xdf). Vendor Unique
- * Group7 (0xe0 - 0xff). Vendor Unique
- */
-
-/*
- * Scsi Group0 commands all are 6 bytes and have a format according to
- * struct ScsiGroup0Cmd.
- */
-#define SCSI_TEST_UNIT_READY 0x00
-#define SCSI_REZERO_UNIT 0x01
-#define SCSI_REWIND 0x01
-#define SCSI_REQUEST_SENSE 0x03
-#define SCSI_FORMAT_UNIT 0x04
-#define SCSI_READ_BLOCK_LIMITS 0x05
-#define SCSI_REASSIGN_BLOCKS 0x07
-#define SCSI_READ 0x08
-#define SCSI_WRITE 0x0a
-#define SCSI_SEEK 0x0b
-#define SCSI_TRACK_SELECT 0x0b
-#define SCSI_READ_REVERSE 0x0f
-#define SCSI_WRITE_EOF 0x10
-#define SCSI_SPACE 0x11
-#define SCSI_INQUIRY 0x12
-#define SCSI_VERIFY 0x13
-#define SCSI_READ_BUFFER 0x14
-#define SCSI_MODE_SELECT 0x15
-#define SCSI_RESERVE_UNIT 0x16
-#define SCSI_RELEASE_UNIT 0x17
-#define SCSI_COPY 0x18
-#define SCSI_ERASE_TAPE 0x19
-#define SCSI_MODE_SENSE 0x1a
-#define SCSI_START_STOP 0x1b
-#define SCSI_LOAD_UNLOAD 0x1b
-#define SCSI_RECV_DIAG_RESULTS 0x1c
-#define SCSI_SEND_DIAGNOSTIC 0x1d
-#define SCSI_PREVENT_ALLOW 0x1e
-
-/*
- * Group1 commands are all 10 bytes and have a format according to
- * struct ScsiGroup1Cmd.
- */
-#define SCSI_READ_CAPACITY 0x25
-#define SCSI_READ_EXT 0x28
-#define SCSI_WRITE_EXT 0x2a
-#define SCSI_SEEK_EXT 0x2b
-#define SCSI_WRITE_VERIFY 0x2e
-#define SCSI_VERIFY_EXT 0x2f
-#define SCSI_SEARCH_HIGH 0x30
-#define SCSI_SEARCH_EQUAL 0x31
-#define SCSI_SEARCH_LOW 0x32
-#define SCSI_SET_LIMITS 0x33
-#define SCSI_COMPARE 0x39
-#define SCSI_COPY_VERIFY 0x3a
-
-/*
- * Control byte flags for Group0 and Group1 commands.
- *
- * SCSI_CTRL_LINK - This is used to prevent a bus free phase between commands.
- * If the command terminates successfully, a SCSI_LINKED_CMD_COMPLETE
- * message is returned instead of the normal SCSI_COMMAND_COMPLETE message. * The last command in a chain should not have this bit set
- * (and consequently gets a normal SCSI_COMMAND_COMPLETE message).
- * SCSI_CTRL_LINK_FLAG - This bit should only set when SCSI_CTRL_LINK is set and
- * causes a SCSI_LINKED_FLAGED_CMD_COMPLETE to be returned instead of
- * a SCSI_LINKED_CMD_COMPLETE.
- */
-#define SCSI_CTRL_LINK 0x01 /* Link commands (no bus free phase) */
-#define SCSI_CTRL_LINK_INTR 0x02 /* Interrupt after linked command */
-
-/*
- * The standard group0 6-byte SCSI control block. Note that the
- * fields between highAddr and blockCount inclusive are command dependent.
- * The definitions Addr and BlockCount cover most of the commands we will
- * use.
- */
-typedef struct ScsiGroup0Cmd {
- u_char command; /* command code, defined below. The
- * upper three bits of this are zero
- * to indicate the control block is
- * only 6 bytes long */
-#if BYTE_ORDER == BIG_ENDIAN
- u_char unitNumber :3; /* Logical Unit (LUN) to which to
- * pass the command. The device
- * has already been selected using
- * the "targetID" bit. */
- u_char highAddr :5; /* High bits of address */
-#else
- u_char highAddr :5; /* High bits of address */
- u_char unitNumber :3; /* Logical Unit (LUN) to which to
- * pass the command. The device
- * has already been selected using
- * the "targetID" bit. */
-#endif
- u_char midAddr; /* Middle bits of address */
- u_char lowAddr; /* Low bits of address */
- u_char blockCount; /* Blocks to transfer */
- u_char control; /* See flags for common bits */
-} ScsiGroup0Cmd;
-
-/*
- * Format of a SCSI_START_STOP command. This is a group 0 command, but
- * the command contents are different.
- */
-typedef struct ScsiStartStopCmd {
-#if BYTE_ORDER == BIG_ENDIAN
- u_char command; /* command code, defined below. The
- * upper three bits of this are zero
- * to indicate the control block is
- * only 6 bytes long */
- u_char unitNumber :3; /* Logical Unit (LUN) to which to
- * pass the command. The device
- * has already been selected using
- * the "targetID" bit. */
- u_char pad1 :4; /* Reserved */
- u_char immed :1; /* Immediate status bit */
- u_char pad2; /* Reserved */
- u_char pad3; /* Reserved */
- u_char pad4 :6; /* Reserved */
- u_char loadEject :1; /* Load or eject medium */
- u_char start :1; /* Start or stop medium */
- u_char control; /* See flags for common bits */
-#else
- u_char command; /* command code, defined below. The
- * upper three bits of this are zero
- * to indicate the control block is
- * only 6 bytes long */
- u_char immed :1; /* Immediate status bit */
- u_char pad1 :4; /* Reserved */
- u_char unitNumber :3; /* Logical Unit (LUN) to which to
- * pass the command. The device
- * has already been selected using
- * the "targetID" bit. */
- u_char pad2; /* Reserved */
- u_char pad3; /* Reserved */
- u_char start :1; /* Start or stop medium */
- u_char loadEject :1; /* Load or eject medium */
- u_char pad4 :6; /* Reserved */
- u_char control; /* See flags for common bits */
-#endif
-} ScsiStartStopCmd;
-
-/*
- * The standard group1 10-byte SCSI control block. Note that the
- * fields between highAddr and blockCount inclusive are command dependent.
- * The definitions Addr and BlockCount cover most of the commands we will
- * use.
- */
-typedef struct ScsiGroup1Cmd {
- u_char command; /* command code, defined below. The
- * upper three bits of this are zero
- * to indicate the control block is
- * only 6 bytes long */
-#if BYTE_ORDER == BIG_ENDIAN
- u_char unitNumber :3; /* Logical Unit (LUN) to which to
- * pass the command. The device
- * has already been selected using
- * the "targetID" bit. */
- u_char pad1 :5; /* Reserved */
-#else
- u_char pad1 :5; /* Reserved */
- u_char unitNumber :3; /* Logical Unit (LUN) to which to
- * pass the command. The device
- * has already been selected using
- * the "targetID" bit. */
-#endif
- u_char highAddr; /* High bits of address */
- u_char midHighAddr; /* Middle high bits of address */
- u_char midLowAddr; /* Middle low bits of address */
- u_char lowAddr; /* Low bits of address */
- u_char pad2; /* Reserved */
- u_char highBlockCount; /* High bits of blocks to transfer */
- u_char lowBlockCount; /* Low bits of blocks to transfer */
- u_char control; /* See flags for common bits */
-} ScsiGroup1Cmd;
-
-/*
- * SCSI status completion information.
- * This is returned by the device when a command completes.
- */
-#define SCSI_STATUS_CHECKCOND 0x02 /* Check Condition (ie., read sense) */
-#define SCSI_STATUS_CONDMET 0x04 /* Condition Met (ie., search worked) */
-#define SCSI_STATUS_BUSY 0x08
-#define SCSI_STATUS_INTERMED 0x10 /* Intermediate status sent */
-#define SCSI_STATUS_EXT 0x80 /* Extended status valid */
-
-/*
- * Sense information provided after some errors. This is divided into
- * two kinds, classes 0-6, and class 7. This is 30 bytes big to allow
- * for the drive specific sense bytes that follow the standard 4 byte header.
- *
- * For extended sense, this buffer may be cast into another type. Also
- * The actual size of the sense data returned is used to detect what
- * kind of tape drive is out there. Kludgy, but true.
- */
-typedef struct ScsiClass0Sense {
-#if BYTE_ORDER == BIG_ENDIAN
- u_char valid :1; /* Sense data is valid */
- u_char error :7; /* 3 bits class and 4 bits code */
-#else
- u_char error :7; /* 3 bits class and 4 bits code */
- u_char valid :1; /* Sense data is valid */
-#endif
- u_char highAddr; /* High byte of block address */
- u_char midAddr; /* Middle byte of block address */
- u_char lowAddr; /* Low byte of block address */
- u_char sense[26]; /* Target specific sense data */
-} ScsiClass0Sense;
-
-/*
- * Definitions for errors in the sense data. The error field is specified
- * as a 3 bit class and 4 bit code, but it is easier to treat it as a
- * single 7 bit field.
- */
-#define SCSI_NO_SENSE_DATA 0x00
-#define SCSI_NOT_READY 0x04
-#define SCSI_NOT_LOADED 0x09
-#define SCSI_INSUF_CAPACITY 0x0a
-#define SCSI_HARD_DATA_ERROR 0x11
-#define SCSI_WRITE_PROTECT 0x17
-#define SCSI_CORRECTABLE_ERROR 0x18
-#define SCSI_FILE_MARK 0x1c
-#define SCSI_INVALID_COMMAND 0x20
-#define SCSI_UNIT_ATTENTION 0x30
-#define SCSI_END_OF_MEDIA 0x34
-
-/*
- * The standard "extended" sense data returned by SCSI devices. This
- * has an error field of 0x70, for a "class 7" error.
- */
-typedef struct ScsiClass7Sense {
-#if BYTE_ORDER == BIG_ENDIAN
- u_char valid :1; /* Sense data is valid */
- u_char error7 :7; /* == 0x70 */
- u_char pad1; /* Also "segment number" for copy */
- u_char fileMark :1; /* File mark on device */
- u_char endOfMedia :1; /* End of media reached */
- u_char badBlockLen :1; /* Block length mis-match (Exabyte) */
- u_char pad2 :1;
- u_char key :4; /* Sense keys defined below */
- u_char info1; /* Information byte 1 */
- u_char info2; /* Information byte 2 */
- u_char info3; /* Information byte 3 */
- u_char info4; /* Information byte 4 */
- u_char length; /* Number of additional info bytes */
-#else
- u_char error7 :7; /* == 0x70 */
- u_char valid :1; /* Sense data is valid */
- u_char pad1; /* Also "segment number" for copy */
- u_char key :4; /* Sense keys defined below */
- u_char pad2 :1;
- u_char badBlockLen :1; /* Block length mis-match (Exabyte) */
- u_char endOfMedia :1; /* End of media reached */
- u_char fileMark :1; /* File mark on device */
- u_char info1; /* Information byte 1 */
- u_char info2; /* Information byte 2 */
- u_char info3; /* Information byte 3 */
- u_char info4; /* Information byte 4 */
- u_char length; /* Number of additional info bytes */
-#endif
-} ScsiClass7Sense; /* 8 Bytes */
-
-/*
- * Key values for standardized sense class 7.
- */
-#define SCSI_CLASS7_NO_SENSE 0
-#define SCSI_CLASS7_RECOVERABLE 1
-#define SCSI_CLASS7_NOT_READY 2
-#define SCSI_CLASS7_MEDIA_ERROR 3
-#define SCSI_CLASS7_HARDWARE_ERROR 4
-#define SCSI_CLASS7_ILLEGAL_REQUEST 5
-
-/*
- * These seem to have different meanings to different vendors....
- */
-#define SCSI_CLASS7_MEDIA_CHANGE 6
-#define SCSI_CLASS7_UNIT_ATTN 6
-
-#define SCSI_CLASS7_WRITE_PROTECT 7
-#define SCSI_CLASS7_BLANK_CHECK 8
-#define SCSI_CLASS7_VENDOR 9
-#define SCSI_CLASS7_POWER_UP_FAILURE 10
-#define SCSI_CLASS7_ABORT 11
-#define SCSI_CLASS7_EQUAL 12
-#define SCSI_CLASS7_OVERFLOW 13
-#define SCSI_CLASS7_RESERVED_14 14
-#define SCSI_CLASS7_RESERVED_15 15
-
-/*
- * Data return by the SCSI inquiry command.
- */
-typedef struct ScsiInquiryData {
-#if BYTE_ORDER == BIG_ENDIAN
- u_char type; /* Peripheral Device type. See below. */
- u_char rmb:1; /* Removable Medium bit. */
- u_char qualifier:7; /* Device type qualifier. */
- u_char version; /* Version info. */
- u_char reserved:4; /* reserved. */
- u_char format:4; /* Response format. */
- u_char length; /* length of data returned. */
- u_char reserved2[2]; /* Reserved */
- u_char flags; /* SCSI II flags (see below) */
- u_char vendorID[8]; /* Vendor ID (ASCII) */
- u_char productID[16]; /* Product ID (ASCII) */
- u_char revLevel[4]; /* Revision level (ASCII) */
- u_char revData[8]; /* Revision data (ASCII) */
-#else
- u_char type; /* Peripheral Device type. See below. */
- u_char qualifier:7; /* Device type qualifier. */
- u_char rmb:1; /* Removable Medium bit. */
- u_char version; /* Version info. */
- u_char format:4; /* Response format. */
- u_char reserved:4; /* reserved. */
- u_char length; /* length of data returned. */
- u_char reserved2[2]; /* Reserved */
- u_char flags; /* SCSI II flags (see below) */
- u_char vendorID[8]; /* Vendor ID (ASCII) */
- u_char productID[16]; /* Product ID (ASCII) */
- u_char revLevel[4]; /* Revision level (ASCII) */
- u_char revData[8]; /* Revision data (ASCII) */
-#endif
-} ScsiInquiryData;
-
-/*
- * The SCSI Peripheral type ID codes as return by the SCSI_INQUIRY command.
- *
- * SCSI_DISK_TYPE - Direct Access Device.
- * SCSI_TAPE_TYPE - Sequential Access Device.
- * SCSI_PRINTER_TYPE - Printer Device.
- * SCSI_HOST_TYPE - Processor Device.
- * SCSI_WORM_TYPE - Write-Once Read-Multiple Device.
- * SCSI_ROM_TYPE - Read-Only Direct Access Device.
- * SCSI_SCANNER_TYPE - Scanner device.
- * SCSI_OPTICAL_MEM_TYPE - Optical memory device.
- * SCSI_MEDIUM_CHANGER_TYPE - Medium changer device.
- * SCSI_COMMUNICATIONS_TYPE - Communications device.
- * SCSI_NODEVICE_TYPE - Logical Unit not present or implemented.
- *
- * Note that codes 0xa-0x7e are reserved and 0x80-0xff are vendor unique.
- */
-#define SCSI_DISK_TYPE 0
-#define SCSI_TAPE_TYPE 1
-#define SCSI_PRINTER_TYPE 2
-#define SCSI_HOST_TYPE 3
-#define SCSI_WORM_TYPE 4
-#define SCSI_ROM_TYPE 5
-#define SCSI_SCANNER_TYPE 6
-#define SCSI_OPTICAL_MEM_TYPE 7
-#define SCSI_MEDIUM_CHANGER_TYPE 8
-#define SCSI_COMMUNICATIONS_TYPE 9
-#define SCSI_NODEVICE_TYPE 0x7f
-
-/*
- * The SCSI I & II inquiry flags.
- *
- * SCSI_REL_ADR - Relative addressing supported.
- * SCSI_WIDE_32 - 32 bit wide SCSI bus transfers supported.
- * SCSI_WIDE_16 - 16 bit wide SCSI bus transfers supported.
- * SCSI_SYNC - Synchronous data transfers supported.
- * SCSI_LINKED - Linked commands supported.
- * SCSI_CMD_QUEUE - Tagged command queuing supported.
- * SCSI_SOFT_RESET - Soft RESET alternative suported.
- */
-#define SCSI_REL_ADR 0x80
-#define SCSI_WIDE_32 0x40
-#define SCSI_WIDE_16 0x20
-#define SCSI_SYNC 0x10
-#define SCSI_LINKED 0x08
-#define SCSI_CMD_QUEUE 0x02
-#define SCSI_SOFT_RESET 0x01
-
-/*
- * Standard header for SCSI_MODE_SENSE and SCSI_MODE_SELECT commands for tapes.
- */
-typedef struct ScsiTapeModeSelectHdr {
- u_char len; /* length */
- u_char media; /* media type */
-#if BYTE_ORDER == BIG_ENDIAN
- u_char writeprot:1; /* Write protected media */
- u_char bufferedMode:3; /* Type of buffer to be done. */
- u_char speed:4; /* Drive speed. */
-#else
- u_char speed:4; /* Drive speed. */
- u_char bufferedMode:3; /* Type of buffer to be done. */
- u_char writeprot:1; /* Write protected media */
-#endif
- u_char length; /* Block descriptor length. */
- u_char density; /* tape density code */
- u_char blocks_2; /* number of blocks (MSB) */
- u_char blocks_1; /* number of blocks */
- u_char blocks_0; /* number of blocks (LSB) */
- u_char reserved; /* */
- u_char block_size2; /* Tape block size (MSB) */
- u_char block_size1; /* Tape block size */
- u_char block_size0; /* Tape block size (LSB) */
- u_char vendor[6]; /* vendor specific data */
-} ScsiTapeModeSelectHdr;
-
-/*
- * Definitions of SCSI messages.
- *
- * SCSI_COMMAND_COMPLETE - After a command has completed, successfully
- * or not, this is returned to the host from the target.
- *
- * SCSI_EXTENDED_MSG - Indicates that a multi-byte message is being sent.
- *
- * The following messages are used with connect/disconnect:
- * SCSI_SAVE_DATA_POINTER - Sent from target to host to request saving
- * of current DMA address and count. Indicates a pending dis-connect.
- * SCSI_RESTORE_POINTER - Sent from the target to the host to request
- * restoring pointers saved before a disconnect
- * SCSI_DISCONNECT - Sent from the target to the host to disconnect.
- * SCSI_ABORT - Sent from the host to the target to abort current request.
- * SCSI_MESSAGE_REJECT - Indicates receipt, by either host or target, of
- * an unimplemented message.
- * SCSI_NO_OP - Sent from host to target if it has no real message to send.
- * SCSI_MESSAGE_PARITY_ERROR - Sent from host to target on message parity error
- * SCSI_BUS_RESET - Sent from host to target to reset all current I/O
- *
- * SCSI_IDENTIFY - The low order two bits of this message type indicate
- * the Logical Unit of the Target which is requesting a reconnect.
- * SCSI_DIS_REC_IDENTIFY - Sent from the host to a target to indicate
- * is supports connect/dis-connect
- *
- */
-#define SCSI_COMMAND_COMPLETE 0x00
-#define SCSI_EXTENDED_MSG 0x01
-#define SCSI_SAVE_DATA_POINTER 0x02
-#define SCSI_RESTORE_POINTERS 0x03
-#define SCSI_DISCONNECT 0x04
-#define SCSI_ABORT 0x06
-#define SCSI_MESSAGE_REJECT 0x07
-#define SCSI_NO_OP 0x08
-#define SCSI_MESSAGE_PARITY_ERROR 0x09
-#define SCSI_LINKED_CMD_COMPLETE 0x0A
-#define SCSI_LINKED_FLAGED_CMD_COMPLETE 0x0B
-#define SCSI_BUS_RESET 0x0C
-
-#define SCSI_IDENTIFY 0x80
-#define SCSI_DIS_REC_IDENTIFY 0xc0
-
-/*
- * Extended message types (2nd byte of SCSI_EXTENDED_MSG).
- */
-#define SCSI_MODIFY_DATA_PTR 0x00
-#define SCSI_SYNCHRONOUS_XFER 0x01
-#define SCSI_EXTENDED_IDENTIFY 0x02 /* only in SCSI I */
-#define SCSI_WIDE_XFER 0x03
-
-/*
- * Driver ioctl's for various scsi operations.
- */
-#ifndef _IOCTL_
-#include <sys/ioctl.h>
-#endif
-
-/*
- * Control for SCSI "format" mode.
- *
- * "Format" mode allows a privileged process to issue direct SCSI
- * commands to a drive (it is intended primarily to allow on-line
- * formatting). SDIOCSFORMAT with a non-zero arg will put the drive
- * into format mode; a zero arg will take it out. When in format
- * mode, only the process that issued the SDIOCFORMAT can read or
- * write the drive.
- *
- * In format mode, process is expected to
- * - do SDIOCSCSICOMMAND to supply cdb for next SCSI op
- * - do read or write as appropriate for cdb
- * - if i/o error, optionally do SDIOCSENSE to get completion
- * status and sense data from last scsi operation.
- */
-
-struct scsi_fmt_cdb {
- int len; /* cdb length (in bytes) */
- u_char cdb[28]; /* cdb to use on next read/write */
-};
-
-struct scsi_fmt_sense {
- u_int status; /* completion status of last op */
- u_char sense[32]; /* sense data (if any) from last op */
-};
-
-#define SDIOCSFORMAT _IOW('S', 0x1, int)
-#define SDIOCGFORMAT _IOR('S', 0x2, int)
-#define SDIOCSCSICOMMAND _IOW('S', 0x3, struct scsi_fmt_cdb)
-#define SDIOCSENSE _IOR('S', 0x4, struct scsi_fmt_sense)
-
-#ifdef _KERNEL
-/*
- * Routines.
- */
-extern void scsiGroup0Cmd();
-extern void scsiGroup1Cmd();
-#endif /* _KERNEL */
-
-#endif /* _SCSI_H */
diff --git a/sys/arch/wgrisc/include/ansi.h b/sys/arch/wgrisc/include/ansi.h
deleted file mode 100644
index 79657796abb..00000000000
--- a/sys/arch/wgrisc/include/ansi.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* $OpenBSD: ansi.h,v 1.6 2000/02/22 17:29:14 millert Exp $ */
-/* $NetBSD: ansi.h,v 1.5 1994/10/26 21:09:33 cgd Exp $ */
-
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ansi.h 8.2 (Berkeley) 1/4/94
- */
-
-#ifndef _ANSI_H_
-#define _ANSI_H_
-
-/*
- * Types which are fundamental to the implementation and may appear in
- * more than one standard header are defined here. Standard headers
- * then use:
- * #ifdef _BSD_SIZE_T_
- * typedef _BSD_SIZE_T_ size_t;
- * #undef _BSD_SIZE_T_
- * #endif
- */
-#define _BSD_CLOCK_T_ unsigned long /* clock() */
-#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */
-#define _BSD_SIZE_T_ unsigned int /* sizeof() */
-#define _BSD_SSIZE_T_ int /* byte count or error */
-#define _BSD_TIME_T_ int /* time() */
-#define _BSD_VA_LIST_ char * /* va_list */
-#define _BSD_CLOCKID_T_ int
-#define _BSD_TIMER_T_ int
-
-/*
- * Runes (wchar_t) is declared to be an ``int'' instead of the more natural
- * ``unsigned long'' or ``long''. Two things are happening here. It is not
- * unsigned so that EOF (-1) can be naturally assigned to it and used. Also,
- * it looks like 10646 will be a 31 bit standard. This means that if your
- * ints cannot hold 32 bits, you will be in trouble. The reason an int was
- * chosen over a long is that the is*() and to*() routines take ints (says
- * ANSI C), but they use _RUNE_T_ instead of int. By changing it here, you
- * lose a bit of ANSI conformance, but your programs will still work.
- *
- * Note that _WCHAR_T_ and _RUNE_T_ must be of the same type. When wchar_t
- * and rune_t are typedef'd, _WCHAR_T_ will be undef'd, but _RUNE_T remains
- * defined for ctype.h.
- */
-#define _BSD_WCHAR_T_ int /* wchar_t */
-#define _BSD_WINT_T_ int /* wint_t */
-#define _BSD_RUNE_T_ int /* rune_t */
-
-/*
- * We describe off_t here so its declaration can be visible to
- * stdio without pulling in all of <sys/type.h>, thus appeasing ANSI.
- */
-#define _BSD_OFF_T_ long long /* file offset */
-
-#endif /* _ANSI_H_ */
diff --git a/sys/arch/wgrisc/include/asm.h b/sys/arch/wgrisc/include/asm.h
deleted file mode 100644
index e5c8f892109..00000000000
--- a/sys/arch/wgrisc/include/asm.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/* $OpenBSD: asm.h,v 1.2 1997/05/11 16:26:00 pefo Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (C) 1989 Digital Equipment Corporation.
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appears in all copies.
- * Digital Equipment Corporation makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- */
-
-#ifndef _MACHASMDEFS
-#define _MACHASMDEFS
-
-#include <machine/regdef.h>
-
-#ifndef ABICALLS
-#define ABICALLS .abicalls
-#endif
-
-#if defined(ABICALLS) && !defined(_KERNEL)
- ABICALLS
-#endif
-
-#define RCSID(x)
-
-#define _C_LABEL(x) x
-
-/*
- * Define how to access unaligned data word
- */
-#ifdef MIPSEL
-#define LWLO lwl
-#define LWHI lwr
-#define SWLO swl
-#define SWHI swr
-#endif
-#ifdef MIPSEB
-#define LWLO lwr
-#define LWHI lwl
-#define SWLO swr
-#define SWHI swl
-#endif
-
-/*
- * Code for setting gp reg if abicalls are used.
- */
-#if defined(ABICALLS) && !defined(_KERNEL)
-#define ABISETUP \
- .set noreorder; \
- .cpload t9; \
- .set reorder;
-#else
-#define ABISETUP
-#endif
-
-/*
- * Define -pg profile entry code.
- */
-#if defined(GPROF) || defined(PROF)
-#define MCOUNT \
- .set noreorder; \
- .set noat; \
- move $1,$31; \
- jal _mcount; \
- subu sp,sp,8; \
- .set reorder; \
- .set at;
-#else
-#define MCOUNT
-#endif
-
-/*
- * LEAF(x)
- *
- * Declare a leaf routine.
- */
-#define LEAF(x) \
- .align 3; \
- .globl x; \
- .ent x, 0; \
-x: ; \
- .frame sp, 0, ra; \
- ABISETUP \
- MCOUNT
-
-#define ALEAF(x) \
- .globl x; \
-x:
-
-/*
- * NLEAF(x)
- *
- * Declare a non-profiled leaf routine.
- */
-#define NLEAF(x) \
- .align 3; \
- .globl x; \
- .ent x, 0; \
-x: ; \
- .frame sp, 0, ra; \
- ABISETUP
-
-/*
- * NON_LEAF(x)
- *
- * Declare a non-leaf routine (a routine that makes other C calls).
- */
-#define NON_LEAF(x, fsize, retpc) \
- .align 3; \
- .globl x; \
- .ent x, 0; \
-x: ; \
- .frame sp, fsize, retpc; \
- ABISETUP \
- MCOUNT
-
-/*
- * NNON_LEAF(x)
- *
- * Declare a non-profiled non-leaf routine
- * (a routine that makes other C calls).
- */
-#define NNON_LEAF(x, fsize, retpc) \
- .align 3; \
- .globl x; \
- .ent x, 0; \
-x: ; \
- .frame sp, fsize, retpc \
- ABISETUP
-
-/*
- * END(x)
- *
- * Mark end of a procedure.
- */
-#define END(x) \
- .end x
-
-#define STAND_FRAME_SIZE 24
-#define STAND_RA_OFFSET 20
-
-/*
- * Macros to panic and printf from assembly language.
- */
-#define PANIC(msg) \
- la a0, 9f; \
- jal panic; \
- MSG(msg)
-
-#define PRINTF(msg) \
- la a0, 9f; \
- jal printf; \
- MSG(msg)
-
-#define MSG(msg) \
- .rdata; \
-9: .asciiz msg; \
- .text
-
-#define ASMSTR(str) \
- .asciiz str; \
- .align 3
-
-#endif /* _MACHASMDEFS */
diff --git a/sys/arch/wgrisc/include/autoconf.h b/sys/arch/wgrisc/include/autoconf.h
deleted file mode 100644
index 43faf8c8538..00000000000
--- a/sys/arch/wgrisc/include/autoconf.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* $OpenBSD: autoconf.h,v 1.1.1.1 1997/02/06 16:02:42 pefo Exp $ */
-/* $NetBSD: autoconf.h,v 1.1 1995/02/13 23:07:31 cgd Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-/*
- * Machine-dependent structures of autoconfiguration
- */
-
-#ifndef _ARC_AUTOCONF_H_
-#define _ARC_AUTOCONF_H_
-
-struct confargs;
-
-typedef int (*intr_handler_t) __P((void *));
-
-struct abus {
- struct device *ab_dv; /* back-pointer to device */
- int ab_type; /* bus type (see below) */
- void (*ab_intr_establish) /* bus's set-handler function */
- __P((struct confargs *, intr_handler_t, void *));
- void (*ab_intr_disestablish) /* bus's unset-handler function */
- __P((struct confargs *));
- caddr_t (*ab_cvtaddr) /* convert slot/offset to address */
- __P((struct confargs *));
- int (*ab_matchname) /* see if name matches driver */
- __P((struct confargs *, char *));
-};
-
-#define BUS_MAIN 1 /* mainbus */
-#define BUS_RISC 2 /* RISC Bus */
-#define BUS_ISABR 3 /* ISA Bridge Bus */
-
-#define BUS_INTR_ESTABLISH(ca, handler, val) \
- (*(ca)->ca_bus->ab_intr_establish)((ca), (handler), (val))
-#define BUS_INTR_DISESTABLISH(ca) \
- (*(ca)->ca_bus->ab_intr_establish)(ca)
-#define BUS_CVTADDR(ca) \
- (*(ca)->ca_bus->ab_cvtaddr)(ca)
-#define BUS_MATCHNAME(ca, name) \
- (*(ca)->ca_bus->ab_matchname)((ca), (name))
-
-struct confargs {
- char *ca_name; /* Device name. */
- int ca_slot; /* Device slot. */
- int ca_offset; /* Offset into slot. */
- struct abus *ca_bus; /* bus device resides on. */
-};
-
-void set_clockintr __P((void (*)(struct clockframe *)));
-void set_iointr __P((void (*)(void *, int)));
-int badaddr __P((void *, u_int64_t));
-
-#endif /* _ARC_AUTOCONF_H_ */
diff --git a/sys/arch/wgrisc/include/bus.h b/sys/arch/wgrisc/include/bus.h
deleted file mode 100644
index eaf2d84a27a..00000000000
--- a/sys/arch/wgrisc/include/bus.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/* $OpenBSD: bus.h,v 1.3 1997/02/20 11:50:46 pefo Exp $ */
-
-/*
- * Copyright (c) 1996 Niklas Hallqvist. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christopher G. Demetriou
- * for the NetBSD Project.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _ARC_BUS_H_
-#define _ARC_BUS_H_
-
-#ifdef __STDC__
-#define CAT(a,b) a##b
-#define CAT3(a,b,c) a##b##c
-#else
-#define CAT(a,b) a/**/b
-#define CAT3(a,b,c) a/**/b/**/c
-#endif
-
-/*
- * Bus access types.
- */
-typedef u_int32_t bus_addr_t;
-typedef u_int32_t bus_size_t;
-typedef u_int32_t bus_space_handle_t;
-typedef u_int32_t bus_space_tag_t;
-
-/*
- * Access methods for bus resources
- */
-#define bus_space_map(t, addr, size, cacheable, bshp) \
- ((*(bshp) = (t) + (addr)), 0)
-#define bus_space_unmap(t, bsh, size)
-
-#define bus_space_read(n,m) \
-static __inline CAT3(u_int,m,_t) \
-CAT(bus_space_read_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
- bus_addr_t ba) \
-{ \
- return *(volatile CAT3(u_int,m,_t) *)(bsh + ba); \
-}
-
-bus_space_read(1,8)
-bus_space_read(2,16)
-bus_space_read(4,32)
-
-#define bus_space_read_8 !!! bus_space_read_8 unimplemented !!!
-
-#define bus_space_read_multi_1(t, h, o, a, c) do { \
- insb((h) + (o), (a), (c)); \
- } while(0)
-
-#define bus_space_read_multi_2(t, h, o, a, c) do { \
- insw((h) + (o), (a), (c)); \
- } while(0)
-
-#define bus_space_read_multi_4(t, h, o, a, c) do { \
- insl((h) + (o), (a), (c)); \
- } while(0)
-
-#define bus_space_read_multi_8 !!! bus_space_read_multi_8 not implemented !!!
-
-#define bus_space_write(n,m) \
-static __inline void \
-CAT(bus_space_write_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
- bus_addr_t ba, CAT3(u_int,m,_t) x) \
-{ \
- *(volatile CAT3(u_int,m,_t) *)(bsh + ba) = x; \
-}
-
-bus_space_write(1,8)
-bus_space_write(2,16)
-bus_space_write(4,32)
-
-#define bus_space_write_8 !!! bus_space_write_8 unimplemented !!!
-
-
-#define bus_space_write_multi_1(t, h, o, a, c) do { \
- outsb((h) + (o), (a), (c)); \
- } while(0)
-
-#define bus_space_write_multi_2(t, h, o, a, c) do { \
- outsw((h) + (o), (a), (c)); \
- } while(0)
-
-#define bus_space_write_multi_4(t, h, o, a, c) do { \
- outsl((h) + (o), (a), (c)); \
- } while(0)
-
-#define bus_space_write_multi_8 !!! bus_space_write_multi_8 not implemented !!!
-
-/* These are OpenBSD extensions to the general NetBSD bus interface. */
-#define bus_space_read_raw_multi(n,m,l) \
-static __inline void \
-CAT(bus_space_read_raw_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \
- bus_addr_t ba, u_int8_t *buf, bus_size_t cnt) \
-{ \
- CAT(bus_space_read_multi_,n)(bst, bsh, ba, (CAT3(u_int,m,_t) *)buf, \
- cnt >> l); \
-}
-
-bus_space_read_raw_multi(2,16,1)
-bus_space_read_raw_multi(4,32,2)
-
-#define bus_space_read_raw_multi_8 \
- !!! bus_space_read_raw_multi_8 not implemented !!!
-
-#define bus_space_write_raw_multi(n,m,l) \
-static __inline void \
-CAT(bus_space_write_raw_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh,\
- bus_addr_t ba, const u_int8_t *buf, bus_size_t cnt) \
-{ \
- CAT(bus_space_write_multi_,n)(bst, bsh, ba, \
- (const CAT3(u_int,m,_t) *)buf, cnt >> l); \
-}
-
-bus_space_write_raw_multi(2,16,1)
-bus_space_write_raw_multi(4,32,2)
-
-#define bus_space_write_raw_multi_8 \
- !!! bus_space_write_raw_multi_8 not implemented !!!
-
-#endif /* _ARC_BUS_H_ */
diff --git a/sys/arch/wgrisc/include/cdefs.h b/sys/arch/wgrisc/include/cdefs.h
deleted file mode 100644
index bac77176316..00000000000
--- a/sys/arch/wgrisc/include/cdefs.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* $OpenBSD: cdefs.h,v 1.1.1.1 1997/02/06 16:02:42 pefo Exp $ */
-/* $NetBSD: cdefs.h,v 1.3 1995/05/03 06:04:54 mellon Exp $ */
-
-/*
- * Copyright (c) 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#ifndef _MACHINE_CDEFS_H_
-#define _MACHINE_CDEFS_H_
-
-#define _C_LABEL(x) _STRING(x)
-
-#define __indr_references(sym,msg) /* nothing */
-#define __warn_references(sym,msg) /* nothing */
-
-#endif /* !_MACHINE_CDEFS_H_ */
diff --git a/sys/arch/wgrisc/include/cpu.h b/sys/arch/wgrisc/include/cpu.h
deleted file mode 100644
index 6930cf212d8..00000000000
--- a/sys/arch/wgrisc/include/cpu.h
+++ /dev/null
@@ -1,417 +0,0 @@
-/* $OpenBSD: cpu.h,v 1.1.1.1 1997/02/06 16:02:42 pefo Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell and Rick Macklem.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (C) 1989 Digital Equipment Corporation.
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appears in all copies.
- * Digital Equipment Corporation makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * from: @(#)cpu.h 8.4 (Berkeley) 1/4/94
- */
-
-#ifndef _CPU_H_
-#define _CPU_H_
-
-#define KUSEG_ADDR 0x0
-#define CACHED_MEMORY_ADDR 0x80000000
-#define UNCACHED_MEMORY_ADDR 0xa0000000
-#define KSEG2_ADDR 0xc0000000
-#define MAX_MEM_ADDR 0xbe000000
-#define RESERVED_ADDR 0xbfc80000
-
-#define CACHED_TO_PHYS(x) ((unsigned)(x) & 0x1fffffff)
-#define PHYS_TO_CACHED(x) ((unsigned)(x) | CACHED_MEMORY_ADDR)
-#define UNCACHED_TO_PHYS(x) ((unsigned)(x) & 0x1fffffff)
-#define PHYS_TO_UNCACHED(x) ((unsigned)(x) | UNCACHED_MEMORY_ADDR)
-#define VA_TO_CINDEX(x) ((unsigned)(x) & 0xffffff | CACHED_MEMORY_ADDR)
-
-#ifdef _KERNEL
-/*
- * The bits in the cause register. There are actually no diff here
- * between the R3K and the R4K except from the width of the EXC field.
- * However the bit 6 and bit 7 of the R3K cause register is always '0'
- * so we do not make any distinguishing between them.
- *
- *
- * CR_BR_DELAY Exception happened in branch delay slot.
- * CR_COP_ERR Coprocessor error.
- * CR_IP Interrupt pending bits defined below.
- * CR_EXC_CODE The exception type (see exception codes below).
- */
-#define CR_BR_DELAY 0x80000000
-#define CR_COP_ERR 0x30000000
-#define CR_EXC_CODE 0x0000007C
-#define CR_IP 0x0000FF00
-#define CR_EXC_CODE_SHIFT 2
-
-/*
- * The bits in the status register. All bits are active when set to 1.
- */
-#define SR_COP_USABILITY 0xf0000000 /* R3K - R4K */
-#define SR_COP_0_BIT 0x10000000 /* R3K - R4K */
-#define SR_COP_1_BIT 0x20000000 /* R3K - R4K */
-#define SR_RE 0x02000000 /* R3K - R4K */
-#define SR_BOOT_EXC_VEC 0x00400000 /* R3K - R4K */
-#define SR_TLB_SHUTDOWN 0x00200000 /* R3K - R4K */
-#define SR_INT_MASK 0x0000ff00 /* R3K - R4K */
-#ifndef R4K
-#define SR_DIAG_CPE 0x00100000 /* R3K */
-#define SR_CACHE_MISS 0x00080000 /* R3K */
-#define SR_DIAG_PZ 0x00040000 /* R3K */
-#define SR_SWAP_CACHES 0x00020000 /* R3K */
-#define SR_ISOL_CACHES 0x00010000 /* R3K */
-#define SR_KU_OLD 0x00000020 /* R3K */
-#define SR_INT_ENA_OLD 0x00000010 /* R3K */
-#define SR_KU_PREV 0x00000008 /* R3K */
-#define SR_INT_ENA_PREV 0x00000004 /* R3K */
-#define SR_KU_CUR 0x00000002 /* R3K */
-#else
-#define SR_RP 0x08000000 /* R4K */
-#define SR_FR_32 0x04000000 /* R4K */
-#define SR_SOFT_RESET 0x00100000 /* R4K */
-#define SR_DIAG_CH 0x00040000 /* R4K */
-#define SR_DIAG_CE 0x00020000 /* R4K */
-#define SR_DIAG_PE 0x00010000 /* R4K */
-#define SR_KX 0x00000080 /* R4K */
-#define SR_SX 0x00000040 /* R4K */
-#define SR_UX 0x00000020 /* R4K */
-#define SR_KSU_MASK 0x00000018 /* R4K */
-#define SR_KSU_USER 0x00000010 /* R4K */
-#define SR_KSU_SUPER 0x00000008 /* R4K */
-#define SR_KSU_KERNEL 0x00000000 /* R4K */
-#define SR_ERL 0x00000004 /* R4K */
-#define SR_EXL 0x00000002 /* R4K */
-#endif
-#define SR_INT_ENAB 0x00000001 /* R3K - R4K */
-
-/*
- * The interrupt masks. These are the same for R3K and R4K.
- * If a bit in the mask is 1 then the interrupt is enabled (or pending).
- */
-#define INT_MASK 0xff00 /* Provide MAXIMUM enable set */
-#define HARD_INT_MASK (0xfc00 & INT_MASK)
-#define INT_MASK_5 0x8000 /* Not used (R4K on chip timer) */
-#define INT_MASK_4 0x4000
-#define INT_MASK_3 0x2000
-#define INT_MASK_2 0x1000
-#define INT_MASK_1 0x0800
-#define INT_MASK_0 0x0400
-#define SOFT_INT_MASK_1 0x0200
-#define SOFT_INT_MASK_0 0x0100
-
-/*
- * Location of exception vectors.
- */
-#define R4K_RESET_EXC_VEC 0xBFC00000
-#define R4K_TLB_MISS_EXC_VEC 0x80000000
-#define R4K_XTLB_MISS_EXC_VEC 0x80000080
-#define R4K_CACHE_ERR_EXC_VEC 0x80000100
-#define R4K_GEN_EXC_VEC 0x80000180
-
-#define R3K_RESET_EXC_VEC 0xBFC00000
-#define R3K_TLB_MISS_EXC_VEC 0x80000000
-#define R3K_GEN_EXC_VEC 0x80000080
-
-/*
- * Coprocessor 0 registers:
- */
-#define COP_0_TLB_INDEX $0
-#define COP_0_TLB_RANDOM $1
-#define COP_0_TLB_LO0 $2
-#define COP_0_TLB_LO1 $3 /* R4K only */
-#define COP_0_R3K_CONF $3 /* R3K only */
-#define COP_0_TLB_CONTEXT $4
-#define COP_0_TLB_PG_MASK $5
-#define COP_0_TLB_WIRED $6
-#define COP_0_BAD_VADDR $8
-#define COP_0_TLB_HI $10
-#define COP_0_STATUS_REG $12
-#define COP_0_CAUSE_REG $13
-#define COP_0_EXC_PC $14
-#define COP_0_PRID $15
-#define COP_0_CONFIG $16
-#define COP_0_LLADDR $17
-#define COP_0_WATCH_LO $18
-#define COP_0_WATCH_HI $19
-#define COP_0_TLB_XCONTEXT $20
-#define COP_0_ECC $26
-#define COP_0_CACHE_ERR $27
-#define COP_0_TAG_LO $28
-#define COP_0_TAG_HI $29
-#define COP_0_ERROR_PC $30
-
-/*
- * Values for the code field in a break instruction.
- */
-#define BREAK_INSTR 0x0000000d
-#define BREAK_VAL_MASK 0x03ff0000
-#define BREAK_VAL_SHIFT 16
-#define BREAK_KDB_VAL 512
-#define BREAK_SSTEP_VAL 513
-#define BREAK_BRKPT_VAL 514
-#define BREAK_SOVER_VAL 515
-#define BREAK_KDB (BREAK_INSTR | (BREAK_KDB_VAL << BREAK_VAL_SHIFT))
-#define BREAK_SSTEP (BREAK_INSTR | (BREAK_SSTEP_VAL << BREAK_VAL_SHIFT))
-#define BREAK_BRKPT (BREAK_INSTR | (BREAK_BRKPT_VAL << BREAK_VAL_SHIFT))
-#define BREAK_SOVER (BREAK_INSTR | (BREAK_SOVER_VAL << BREAK_VAL_SHIFT))
-
-/*
- * Mininum and maximum cache sizes.
- */
-#define MIN_CACHE_SIZE (4 * 1024)
-#define MAX_CACHE_SIZE (256 * 1024)
-
-/*
- * The floating point version and status registers.
- */
-#define FPC_ID $0
-#define FPC_CSR $31
-
-/*
- * The floating point coprocessor status register bits.
- */
-#define FPC_ROUNDING_BITS 0x00000003
-#define FPC_ROUND_RN 0x00000000
-#define FPC_ROUND_RZ 0x00000001
-#define FPC_ROUND_RP 0x00000002
-#define FPC_ROUND_RM 0x00000003
-#define FPC_STICKY_BITS 0x0000007c
-#define FPC_STICKY_INEXACT 0x00000004
-#define FPC_STICKY_UNDERFLOW 0x00000008
-#define FPC_STICKY_OVERFLOW 0x00000010
-#define FPC_STICKY_DIV0 0x00000020
-#define FPC_STICKY_INVALID 0x00000040
-#define FPC_ENABLE_BITS 0x00000f80
-#define FPC_ENABLE_INEXACT 0x00000080
-#define FPC_ENABLE_UNDERFLOW 0x00000100
-#define FPC_ENABLE_OVERFLOW 0x00000200
-#define FPC_ENABLE_DIV0 0x00000400
-#define FPC_ENABLE_INVALID 0x00000800
-#define FPC_EXCEPTION_BITS 0x0003f000
-#define FPC_EXCEPTION_INEXACT 0x00001000
-#define FPC_EXCEPTION_UNDERFLOW 0x00002000
-#define FPC_EXCEPTION_OVERFLOW 0x00004000
-#define FPC_EXCEPTION_DIV0 0x00008000
-#define FPC_EXCEPTION_INVALID 0x00010000
-#define FPC_EXCEPTION_UNIMPL 0x00020000
-#define FPC_COND_BIT 0x00800000
-#define FPC_FLUSH_BIT 0x01000000
-#define FPC_MBZ_BITS 0xfe7c0000
-
-/*
- * Constants to determine if have a floating point instruction.
- */
-#define OPCODE_SHIFT 26
-#define OPCODE_C1 0x11
-
-/*
- * The number of TLB entries and the first one that write random hits.
- */
-#define R3K_NUM_TLB_ENTRIES 64
-#define R4K_NUM_TLB_ENTRIES 48 /* Pairs, totals 96 */
-#define R3K_NUM_WIRED_ENTRIES 8
-#define R4K_NUM_WIRED_ENTRIES 8
-#define R3K_PID_SHIFT 6
-#define R3K_PID_MASK 0xfc00
-#define R4K_PID_SHIFT 0
-#define R4K_PID_MASK 0x00ff
-#define R3K_TLB_INDEX_SHIFT 8
-#define R4K_TLB_INDEX_SHIFT 0
-
-/*
- * The number of process id entries.
- */
-#define R3K_NUM_PIDS 32
-#define R4K_NUM_PIDS 256
-
-#endif /* _KERNEL */
-
-
-
-/*
- * Exported definitions unique to mips cpu support.
- */
-
-/*
- * definitions of cpu-dependent requirements
- * referenced in generic code
- */
-#define COPY_SIGCODE /* copy sigcode above user stack in exec */
-
-#define cpu_wait(p) /* nothing */
-#define cpu_set_init_frame(p, fp) /* nothing */
-#define cpu_swapout(p) panic("cpu_swapout: can't get here");
-
-#ifndef _LOCORE
-/*
- * Arguments to hardclock and gatherstats encapsulate the previous
- * machine state in an opaque clockframe.
- */
-struct clockframe {
- int pc; /* program counter at time of interrupt */
- int sr; /* status register at time of interrupt */
- int cr; /* cause register at time of interrupt */
-};
-
-#ifndef R4K
-#define CLKF_USERMODE(fp) ((fp)->sr & SR_KU_PREV)
-#define CLKF_BASEPRI(fp) ((~(fp)->sr & (INT_MASK|SR_INT_ENA_PREV)) == 0)
-#else
-#define CLKF_USERMODE(fp) ((fp)->sr & SR_KSU_USER)
-#define CLKF_BASEPRI(fp) ((~(fp)->sr & (INT_MASK|SR_INT_ENAB)) == 0)
-#endif
-#define CLKF_PC(fp) ((fp)->pc)
-#define CLKF_INTR(fp) (0)
-
-/*
- * Preempt the current process if in interrupt from user mode,
- * or after the current trap/syscall if in system mode.
- */
-#define need_resched() { want_resched = 1; aston(); }
-
-/*
- * Give a profiling tick to the current process when the user profiling
- * buffer pages are invalid. On the PICA, request an ast to send us
- * through trap, marking the proc as needing a profiling tick.
- */
-#define need_proftick(p) { (p)->p_flag |= P_OWEUPC; aston(); }
-
-/*
- * Notify the current process (p) that it has a signal pending,
- * process as soon as possible.
- */
-#define signotify(p) aston()
-
-#define aston() (astpending = 1)
-
-int astpending; /* need to trap before returning to user mode */
-int want_resched; /* resched() was called */
-
-/*
- * CPU identification, from PRID register.
- */
-union cpuprid {
- int cpuprid;
- struct {
-#if BYTE_ORDER == BIG_ENDIAN
- u_int pad1:16; /* reserved */
- u_int cp_imp:8; /* implementation identifier */
- u_int cp_majrev:4; /* major revision identifier */
- u_int cp_minrev:4; /* minor revision identifier */
-#else
- u_int cp_minrev:4; /* minor revision identifier */
- u_int cp_majrev:4; /* major revision identifier */
- u_int cp_imp:8; /* implementation identifier */
- u_int pad1:16; /* reserved */
-#endif
- } cpu;
-};
-
-/*
- * CTL_MACHDEP definitions.
- */
-#define CPU_CONSDEV 1 /* dev_t: console terminal device */
-#define CPU_MAXID 2 /* number of valid machdep ids */
-
-#define CTL_MACHDEP_NAMES { \
- { 0, 0 }, \
- { "console_device", CTLTYPE_STRUCT }, \
-}
-
-#endif /* !_LOCORE */
-
-/*
- * MIPS CPU types (cp_imp).
- */
-#define MIPS_R2000 0x01 /* MIPS R2000 CPU ISA I */
-#define MIPS_R3000 0x02 /* MIPS R3000 CPU ISA I */
-#define MIPS_R6000 0x03 /* MIPS R6000 CPU ISA II */
-#define MIPS_R4000 0x04 /* MIPS R4000/4400 CPU ISA III */
-#define MIPS_R3LSI 0x05 /* LSI Logic R3000 derivate ISA I */
-#define MIPS_R6000A 0x06 /* MIPS R6000A CPU ISA II */
-#define MIPS_R3IDT 0x07 /* IDT R3000 derivate ISA I */
-#define MIPS_R10000 0x09 /* MIPS R10000/T5 CPU ISA IV */
-#define MIPS_R4200 0x0a /* MIPS R4200 CPU (ICE) ISA III */
-#define MIPS_UNKC1 0x0b /* unnanounced product cpu ISA III */
-#define MIPS_UNKC2 0x0c /* unnanounced product cpu ISA III */
-#define MIPS_R8000 0x10 /* MIPS R8000 Blackbird/TFP ISA IV */
-#define MIPS_R4600 0x20 /* QED R4600 Orion ISA III */
-#define MIPS_R3SONY 0x21 /* Sony R3000 based CPU ISA I */
-#define MIPS_R3TOSH 0x22 /* Toshiba R3000 based CPU ISA I */
-#define MIPS_R3NKK 0x23 /* NKK R3000 based CPU ISA I */
-
-/*
- * MIPS FPU types
- */
-#define MIPS_SOFT 0x00 /* Software emulation ISA I */
-#define MIPS_R2360 0x01 /* MIPS R2360 FPC ISA I */
-#define MIPS_R2010 0x02 /* MIPS R2010 FPC ISA I */
-#define MIPS_R3010 0x03 /* MIPS R3010 FPC ISA I */
-#define MIPS_R6010 0x04 /* MIPS R6010 FPC ISA II */
-#define MIPS_R4010 0x05 /* MIPS R4000/R4400 FPC ISA II */
-#define MIPS_R31LSI 0x06 /* LSI Logic derivate ISA I */
-#define MIPS_R10010 0x09 /* MIPS R10000/T5 FPU ISA IV */
-#define MIPS_R4210 0x0a /* MIPS R4200 FPC (ICE) ISA III */
-#define MIPS_UNKF1 0x0b /* unnanounced product cpu ISA III */
-#define MIPS_R8000 0x10 /* MIPS R8000 Blackbird/TFP ISA IV */
-#define MIPS_R4600 0x20 /* QED R4600 Orion ISA III */
-#define MIPS_R3SONY 0x21 /* Sony R3000 based FPU ISA I */
-#define MIPS_R3TOSH 0x22 /* Toshiba R3000 based FPU ISA I */
-#define MIPS_R3NKK 0x23 /* NKK R3000 based FPU ISA I */
-
-#if defined(_KERNEL) && !defined(_LOCORE)
-union cpuprid cpu_id;
-union cpuprid fpu_id;
-u_int CpuPrimaryDataCacheSize;
-u_int CpuPrimaryInstCacheSize;
-u_int CpuPrimaryDataCacheLSize;
-u_int CpuPrimaryInstCacheLSize;
-u_int CpuCacheAliasMask;
-u_int CpuTwoWayCache;
-
-extern struct intr_tab intr_tab[];
-#endif
-
-/*
- * Enable realtime clock (always enabled).
- */
-#define enablertclock()
-
-#endif /* _CPU_H_ */
diff --git a/sys/arch/wgrisc/include/disklabel.h b/sys/arch/wgrisc/include/disklabel.h
deleted file mode 100644
index 08624f00d05..00000000000
--- a/sys/arch/wgrisc/include/disklabel.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* $OpenBSD: disklabel.h,v 1.6 1998/02/19 20:36:37 deraadt Exp $ */
-/* $NetBSD: disklabel.h,v 1.3 1996/03/09 20:52:54 ghudson Exp $ */
-
-/*
- * Copyright (c) 1994 Christopher G. Demetriou
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christopher G. Demetriou.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_DISKLABEL_H_
-#define _MACHINE_DISKLABEL_H_
-
-#define LABELSECTOR 1 /* sector containing label */
-#define LABELOFFSET 0 /* offset of label in sector */
-#define MAXPARTITIONS 16 /* number of partitions */
-#define RAW_PART 2 /* raw partition: ie. rsd0c */
-
-/* DOS partition table -- located in boot block */
-#define DOSBBSECTOR 0 /* DOS boot block relative sector # */
-#define DOSPARTOFF 446
-#define NDOSPART 4
-
-struct dos_partition {
- u_int8_t dp_flag; /* bootstrap flags */
- u_int8_t dp_shd; /* starting head */
- u_int8_t dp_ssect; /* starting sector */
- u_int8_t dp_scyl; /* starting cylinder */
- u_int8_t dp_typ; /* partition type (see below) */
- u_int8_t dp_ehd; /* end head */
- u_int8_t dp_esect; /* end sector */
- u_int8_t dp_ecyl; /* end cylinder */
- u_int32_t dp_start; /* absolute starting sector number */
- u_int32_t dp_size; /* partition size in sectors */
-};
-
-/* Known DOS partition types. */
-#define DOSPTYP_UNUSED 0x00 /* Unused partition */
-#define DOSPTYP_FAT12 0x01 /* 12-bit FAT */
-#define DOSPTYP_FAT16S 0x04 /* 16-bit FAT, less than 32M */
-#define DOSPTYP_EXTEND 0x05 /* Extended; contains sub-partitions */
-#define DOSPTYP_FAT16B 0x06 /* 16-bit FAT, more than 32M */
-#define DOSPTYP_FAT32 0x0b /* 32-bit FAT */
-#define DOSPTYP_FAT16C 0x0e /* 16-bit FAT, CHS-mapped */
-#define DOSPTYP_ONTRACK 0x54
-#define DOSPTYP_LINUX 0x83 /* That other thing */
-#define DOSPTYP_FREEBSD 0xa5 /* FreeBSD partition type */
-#define DOSPTYP_OPENBSD 0xa6 /* OpenBSD partition type */
-#define DOSPTYP_NETBSD 0xa9 /* NetBSD partition type */
-
-#include <sys/dkbad.h>
-struct cpu_disklabel {
- struct dos_partition dosparts[NDOSPART];
- struct dkbad bad;
-};
-
-#define DKBAD(x) ((x)->bad)
-
-/* Isolate the relevant bits to get sector and cylinder. */
-#define DPSECT(s) ((s) & 0x3f)
-#define DPCYL(c, s) ((c) + (((s) & 0xc0) << 2))
-
-#endif /* _MACHINE_DISKLABEL_H_ */
diff --git a/sys/arch/wgrisc/include/dlfcn.h b/sys/arch/wgrisc/include/dlfcn.h
deleted file mode 100644
index 309c7123d8f..00000000000
--- a/sys/arch/wgrisc/include/dlfcn.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* $OpenBSD: dlfcn.h,v 1.1.1.1 1997/02/06 16:02:44 pefo Exp $ */
-
-/*
- * Copyright (c) 1996 Per Fogelstrom
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#ifndef _DLFCN_H
-#define _DLFCN_H 1
-
-/*
- * This is a dummy file. Empty until libdl has been done.
- */
-
-#endif /* _DLFCN_H */
diff --git a/sys/arch/wgrisc/include/ecoff.h b/sys/arch/wgrisc/include/ecoff.h
deleted file mode 100644
index d2dc03fc806..00000000000
--- a/sys/arch/wgrisc/include/ecoff.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* $OpenBSD: ecoff.h,v 1.1.1.1 1997/02/06 16:02:42 pefo Exp $ */
-/* $NetBSD: ecoff.h,v 1.4 1995/06/16 02:07:33 mellon Exp $ */
-
-/*
- * Copyright (c) 1994 Adam Glass
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Adam Glass.
- * 4. The name of the Author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL Adam Glass BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#define ECOFF_LDPGSZ 4096
-
-#define ECOFF_PAD
-
-#define ECOFF_MACHDEP \
- u_long ea_gprmask; \
- u_long ea_cprmask[4]; \
- u_long ea_gp_value
-
-#define ECOFF_MAGIC_MIPSEL 0x0162
-#define ECOFF_BADMAG(ex) ((ex)->f.f_magic != ECOFF_MAGIC_MIPSEL)
-
-#define ECOFF_SEGMENT_ALIGNMENT(ep) ((ep)->a.vstamp < 23 ? 8 : 16)
-
-struct ecoff_symhdr {
- int16_t sh_magic;
- int16_t sh_vstamp;
- int32_t sh_linemax;
- int32_t sh_densenummax;
- int32_t sh_procmax;
- int32_t sh_lsymmax;
- int32_t sh_optsymmax;
- int32_t sh_auxxymmax;
- int32_t sh_lstrmax;
- int32_t sh_estrmax;
- int32_t sh_fdmax;
- int32_t sh_rfdmax;
- int32_t sh_esymmax;
- long sh_linesize;
- long sh_lineoff;
- long sh_densenumoff;
- long sh_procoff;
- long sh_lsymoff;
- long sh_optsymoff;
- long sh_auxsymoff;
- long sh_lstroff;
- long sh_estroff;
- long sh_fdoff;
- long sh_rfdoff;
- long sh_esymoff;
-};
-/* Some day they will make up their minds.... */
-#define esymMax sh_esymmax
-#define cbExtOffset sh_esymoff
-#define cbSsExtOffset sh_estroff
-
-struct ecoff_extsym {
- long es_value;
- int es_strindex;
- unsigned es_type:6;
- unsigned es_class:5;
- unsigned :1;
- unsigned es_symauxindex:20;
- unsigned es_jmptbl:1;
- unsigned es_cmain:1;
- unsigned es_weakext:1;
- unsigned :29;
- int es_indexfld;
-};
-
diff --git a/sys/arch/wgrisc/include/elf_abi.h b/sys/arch/wgrisc/include/elf_abi.h
deleted file mode 100644
index 63ca890a0b4..00000000000
--- a/sys/arch/wgrisc/include/elf_abi.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $OpenBSD: elf_abi.h,v 1.2 1997/07/31 21:23:31 pefo Exp $ */
-
-/*
- * Copyright (c) 1996 Per Fogelstrom
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-/* From MIPS ABI supplemental */
-
-/* Architecture dependent Segment types - p_type */
-#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */
-
-/* Architecture dependent d_tag field for Elf32_Dyn. */
-#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime Linker Interface ID */
-#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */
-#define DT_MIPS_ICHECKSUM 0x70000003 /* Cksum of ext. str. and com. sizes */
-#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */
-#define DT_MIPS_FLAGS 0x70000005 /* Flags */
-#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Segment base address */
-#define DT_MIPS_CONFLICT 0x70000008 /* Adr of .conflict section */
-#define DT_MIPS_LIBLIST 0x70000009 /* Address of .liblist section */
-#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local .GOT entries */
-#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of .conflict entries */
-#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of .liblist entries */
-#define DT_MIPS_SYMTABNO 0x70000011 /* Number of .dynsym entries */
-#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */
-#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in .dynsym */
-#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */
-#define DT_MIPS_RLD_MAP 0x70000016 /* Address of debug map pointer */
-
-#define DT_PROCNUM (DT_MIPS_HIPAGENO - DT_LOPROC + 1)
diff --git a/sys/arch/wgrisc/include/endian.h b/sys/arch/wgrisc/include/endian.h
deleted file mode 100644
index c171db5d391..00000000000
--- a/sys/arch/wgrisc/include/endian.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* $OpenBSD: endian.h,v 1.6 1999/05/10 16:02:16 espie Exp $ */
-
-/*-
- * Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Niklas Hallqvist.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _WGRISC_ENDIAN_H_
-#define _WGRISC_ENDIAN_H_
-
-#define BYTE_ORDER LITTLE_ENDIAN
-#include <sys/endian.h>
-
-#endif /* _WGRISC_ENDIAN_H_ */
diff --git a/sys/arch/wgrisc/include/exec.h b/sys/arch/wgrisc/include/exec.h
deleted file mode 100644
index ae6b0503df6..00000000000
--- a/sys/arch/wgrisc/include/exec.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $OpenBSD: exec.h,v 1.2 2001/01/22 14:51:07 art Exp $ */
-/* $NetBSD: exec.h,v 1.5 1994/10/26 21:09:39 cgd Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)exec.h 8.1 (Berkeley) 6/10/93
- */
-
-#define __LDPGSZ 4096
-
-/*
- * Define what exec "formats" we should handle.
- */
-#define NATIVE_EXEC_ELF
-#define EXEC_SCRIPT
-
-#define ARCH_ELFSIZE 32
-
-#define ELF_TARG_CLASS ELFCLASS32
-#define ELF_TARG_DATA ELFDATA2LSB
-#define ELF_TARG_MACH EM_MIPS
-
-/*
- * This is what we want nlist(3) to handle.
- */
-#define _NLIST_DO_AOUT /* support a.out */
-#define _NLIST_DO_ELF /* support ELF */
-#define _NLIST_DO_ECOFF /* support ECOFF */
-
-/*
- * This is what we want the kernel to handle.
- */
-#define _KERN_DO_ELF
-
diff --git a/sys/arch/wgrisc/include/float.h b/sys/arch/wgrisc/include/float.h
deleted file mode 100644
index 2eb31b1adc9..00000000000
--- a/sys/arch/wgrisc/include/float.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $OpenBSD: float.h,v 1.2 1997/08/01 21:35:36 deraadt Exp $ */
-/* $NetBSD: float.h,v 1.7 1995/06/20 20:45:50 jtc Exp $ */
-
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)float.h 8.1 (Berkeley) 6/10/93
- */
-
-#ifndef _MIPS_FLOAT_H_
-#define _MIPS_FLOAT_H_
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-int __flt_rounds __P((void));
-__END_DECLS
-
-#define FLT_RADIX 2 /* b */
-#define FLT_ROUNDS __flt_rounds()
-
-#define FLT_MANT_DIG 24 /* p */
-#define FLT_EPSILON 1.19209290E-07F /* b**(1-p) */
-#define FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */
-#define FLT_MIN_EXP -125 /* emin */
-#define FLT_MIN 1.17549435E-38F /* b**(emin-1) */
-#define FLT_MIN_10_EXP -37 /* ceil(log10(b**(emin-1))) */
-#define FLT_MAX_EXP 128 /* emax */
-#define FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */
-#define FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */
-
-#define DBL_MANT_DIG 53
-#define DBL_EPSILON 2.2204460492503131E-16
-#define DBL_DIG 15
-#define DBL_MIN_EXP -1021
-#define DBL_MIN 2.225073858507201E-308
-#define DBL_MIN_10_EXP -307
-#define DBL_MAX_EXP 1024
-#define DBL_MAX 1.797693134862316E+308
-#define DBL_MAX_10_EXP 308
-
-#define LDBL_MANT_DIG DBL_MANT_DIG
-#define LDBL_EPSILON DBL_EPSILON
-#define LDBL_DIG DBL_DIG
-#define LDBL_MIN_EXP DBL_MIN_EXP
-#define LDBL_MIN DBL_MIN
-#define LDBL_MIN_10_EXP DBL_MIN_10_EXP
-#define LDBL_MAX_EXP DBL_MAX_EXP
-#define LDBL_MAX DBL_MAX
-#define LDBL_MAX_10_EXP DBL_MAX_10_EXP
-
-#endif /* _MIPS_FLOAT_H_ */
diff --git a/sys/arch/wgrisc/include/frame.h b/sys/arch/wgrisc/include/frame.h
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/sys/arch/wgrisc/include/frame.h
+++ /dev/null
diff --git a/sys/arch/wgrisc/include/ieeefp.h b/sys/arch/wgrisc/include/ieeefp.h
deleted file mode 100644
index bf46440cc56..00000000000
--- a/sys/arch/wgrisc/include/ieeefp.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* $OpenBSD: ieeefp.h,v 1.1.1.1 1997/02/06 16:02:43 pefo Exp $ */
-
-/*
- * Written by J.T. Conklin, Apr 11, 1995
- * Public domain.
- */
-
-#ifndef _MIPS_IEEEFP_H_
-#define _MIPS_IEEEFP_H_
-
-typedef int fp_except;
-#define FP_X_IMP 0x01 /* imprecise (loss of precision) */
-#define FP_X_UFL 0x02 /* underflow exception */
-#define FP_X_OFL 0x04 /* overflow exception */
-#define FP_X_DZ 0x08 /* divide-by-zero exception */
-#define FP_X_INV 0x10 /* invalid operation exception */
-
-typedef enum {
- FP_RN=0, /* round to nearest representable number */
- FP_RZ=1, /* round to zero (truncate) */
- FP_RP=2, /* round toward positive infinity */
- FP_RM=3 /* round toward negative infinity */
-} fp_rnd;
-
-#endif /* _MIPS_IEEEFP_H_ */
diff --git a/sys/arch/wgrisc/include/intr.h b/sys/arch/wgrisc/include/intr.h
deleted file mode 100644
index ed48fcbed03..00000000000
--- a/sys/arch/wgrisc/include/intr.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/* $NetBSD: intr.h,v 1.5 1996/05/13 06:11:28 mycroft Exp $ */
-
-/*
- * Copyright (c) 1996 Charles M. Hannum. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles M. Hannum.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _ARC_INTR_H_
-#define _ARC_INTR_H_
-
-/* Interrupt priority `levels'; not mutually exclusive. */
-#define IPL_BIO 0 /* block I/O */
-#define IPL_NET 1 /* network */
-#define IPL_TTY 2 /* terminal */
-#define IPL_CLOCK 3 /* clock */
-#define IPL_IMP 4 /* memory allocation */
-#define IPL_NONE 5 /* nothing */
-#define IPL_HIGH 6 /* everything */
-
-/* Interrupt sharing types. */
-#define IST_NONE 0 /* none */
-#define IST_PULSE 1 /* pulsed */
-#define IST_EDGE 2 /* edge-triggered */
-#define IST_LEVEL 3 /* level-triggered */
-
-/* Soft interrupt masks. */
-#define SIR_CLOCK 31
-#define SIR_CLOCKMASK ((1 << SIR_CLOCK))
-#define SIR_NET 30
-#define SIR_NETMASK ((1 << SIR_NET) | SIR_CLOCKMASK)
-#define SIR_TTY 29
-#define SIR_TTYMASK ((1 << SIR_TTY) | SIR_CLOCKMASK)
-#define SIR_ALLMASK (SIR_CLOCKMASK | SIR_NETMASK | SIR_TTYMASK)
-
-#ifndef _LOCORE
-
-volatile int cpl, ipending, astpending;
-int imask[7];
-
-#if 0
-extern void Xspllower __P((void));
-
-static __inline int splraise __P((int));
-static __inline int spllower __P((int));
-static __inline void splx __P((int));
-static __inline void softintr __P((int));
-
-/*
- * Add a mask to cpl, and return the old value of cpl.
- */
-static __inline int
-splraise(ncpl)
- register int ncpl;
-{
- register int ocpl = cpl;
-
- cpl = ocpl | ncpl;
- return (ocpl);
-}
-
-/*
- * Restore a value to cpl (unmasking interrupts). If any unmasked
- * interrupts are pending, call Xspllower() to process them.
- */
-static __inline void
-splx(ncpl)
- register int ncpl;
-{
-
- cpl = ncpl;
- if (ipending & ~ncpl)
- Xspllower();
-}
-
-/*
- * Same as splx(), but we return the old value of spl, for the
- * benefit of some splsoftclock() callers.
- */
-static __inline int
-spllower(ncpl)
- register int ncpl;
-{
- register int ocpl = cpl;
-
- cpl = ncpl;
- if (ipending & ~ncpl)
- Xspllower();
- return (ocpl);
-}
-#endif
-
-/*
- * Hardware interrupt masks
- */
-#if 0
-#define splbio() splraise(imask[IPL_BIO])
-#define splnet() splraise(imask[IPL_NET])
-#define spltty() splraise(imask[IPL_TTY])
-#define splclock() splraise(imask[IPL_CLOCK])
-#define splimp() splraise(imask[IPL_IMP])
-#define splstatclock() splclock()
-
-/*
- * Software interrupt masks
- *
- * NOTE: spllowersoftclock() is used by hardclock() to lower the priority from
- * clock to softclock before it calls softclock().
- */
-#define spllowersoftclock() spllower(SIR_CLOCKMASK)
-#define splsoftclock() splraise(SIR_CLOCKMASK)
-#define splsoftnet() splraise(SIR_NETMASK)
-#define splsofttty() splraise(SIR_TTYMASK)
-
-/*
- * Miscellaneous
- */
-#define splhigh() splraise(-1)
-#define spl0() spllower(0)
-
-#endif
-/*
- * Software interrupt registration
- *
- * We hand-code this to ensure that it's atomic.
- */
-static __inline void
-softintr(mask)
- register int mask;
-{
-
- __asm __volatile("orl %0,_ipending" : : "ir" (mask));
-}
-
-#define setsoftast() (astpending = 1)
-#define setsoftclock() softintr(1 << SIR_CLOCK)
-#define setsoftnet() softintr(1 << SIR_NET)
-#define setsofttty() softintr(1 << SIR_TTY)
-
-#endif /* _LOCORE */
-
-#endif /* _ARC_INTR_H_ */
diff --git a/sys/arch/wgrisc/include/kbdreg.h b/sys/arch/wgrisc/include/kbdreg.h
deleted file mode 100644
index 0e24cf8b926..00000000000
--- a/sys/arch/wgrisc/include/kbdreg.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* $OpenBSD: kbdreg.h,v 1.1.1.1 1997/02/06 16:02:43 pefo Exp $ */
-
-/*
- * Copyright (c) 1996 Per Fogelstrom
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * Keyboard definitions
- *
- */
-
-#define KBSTATP (0x61) /* controller status port (I) */
-#define KBS_DIB 0x01 /* data in buffer */
-#define KBS_IBF 0x02 /* input buffer low */
-#define KBS_WARM 0x04 /* input buffer low */
-#define KBS_OCMD 0x08 /* output buffer has command */
-#define KBS_NOSEC 0x10 /* security lock not engaged */
-#define KBS_TERR 0x20 /* transmission error */
-#define KBS_RERR 0x40 /* receive error */
-#define KBS_PERR 0x80 /* parity error */
-
-#define KBCMDP (0x61) /* controller port (O) */
-#define KBDATAP (0x60) /* data port (I) */
-#define KBOUTP (0x60) /* data port (O) */
-
-#define K_RDCMDBYTE 0x20
-#define K_LDCMDBYTE 0x60
-
-#define KC8_TRANS 0x40 /* convert to old scan codes */
-#define KC8_MDISABLE 0x20 /* disable mouse */
-#define KC8_KDISABLE 0x10 /* disable keyboard */
-#define KC8_IGNSEC 0x08 /* ignore security lock */
-#define KC8_CPU 0x04 /* exit from protected mode reset */
-#define KC8_MENABLE 0x02 /* enable mouse interrupt */
-#define KC8_KENABLE 0x01 /* enable keyboard interrupt */
-#define CMDBYTE (KC8_TRANS|KC8_CPU|KC8_MENABLE|KC8_KENABLE)
-
-/* keyboard commands */
-#define KBC_RESET 0xFF /* reset the keyboard */
-#define KBC_RESEND 0xFE /* request the keyboard resend the last byte */
-#define KBC_SETDEFAULT 0xF6 /* resets keyboard to its power-on defaults */
-#define KBC_DISABLE 0xF5 /* as per KBC_SETDEFAULT, but also disable key scanning */
-#define KBC_ENABLE 0xF4 /* enable key scanning */
-#define KBC_TYPEMATIC 0xF3 /* set typematic rate and delay */
-#define KBC_SETTABLE 0xF0 /* set scancode translation table */
-#define KBC_MODEIND 0xED /* set mode indicators (i.e. LEDs) */
-#define KBC_ECHO 0xEE /* request an echo from the keyboard */
-
-/* keyboard responses */
-#define KBR_EXTENDED 0xE0 /* extended key sequence */
-#define KBR_RESEND 0xFE /* needs resend of command */
-#define KBR_ACK 0xFA /* received a valid command */
-#define KBR_OVERRUN 0x00 /* flooded */
-#define KBR_FAILURE 0xFD /* diagnosic failure */
-#define KBR_BREAK 0xF0 /* break code prefix - sent on key release */
-#define KBR_RSTDONE 0xAA /* reset complete */
-#define KBR_ECHO 0xEE /* echo response */
diff --git a/sys/arch/wgrisc/include/kcore.h b/sys/arch/wgrisc/include/kcore.h
deleted file mode 100644
index e9e91061a29..00000000000
--- a/sys/arch/wgrisc/include/kcore.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $OpenBSD: kcore.h,v 1.1.1.1 1997/02/06 16:02:44 pefo Exp $ */
-/* $NetBSD: kcore.h,v 1.1 1996/03/10 21:55:18 leo Exp $ */
-
-/*
- * Copyright (c) 1996 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MIPS_KCORE_H_
-#define _MIPS_KCORE_H_
-
-#define NPHYS_RAM_SEGS 8
-
-typedef struct cpu_kcore_hdr {
- vm_offset_t kernel_pa; /* Phys. address of kernel VA 0 */
- int mmutype;
- phys_ram_seg_t ram_segs[NPHYS_RAM_SEGS];
-} cpu_kcore_hdr_t;
-
-#endif /* _MIPS_KCORE_H_ */
diff --git a/sys/arch/wgrisc/include/kdbparam.h b/sys/arch/wgrisc/include/kdbparam.h
deleted file mode 100644
index 3bc3a5c7bfb..00000000000
--- a/sys/arch/wgrisc/include/kdbparam.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* $OpenBSD: kdbparam.h,v 1.1.1.1 1997/02/06 16:02:43 pefo Exp $ */
-/* $NetBSD: kdbparam.h,v 1.4 1994/10/26 21:09:42 cgd Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)kdbparam.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Machine dependent definitions for kdb.
- */
-
-#if BYTE_ORDER == LITTLE_ENDIAN
-#define kdbshorten(w) ((w) & 0xFFFF)
-#define kdbbyte(w) ((w) & 0xFF)
-#define kdbitol(a,b) ((long)(((b) << 16) | ((a) & 0xFFFF)))
-#define kdbbtol(a) ((long)(a))
-#endif
-
-#define LPRMODE "%R"
-#define OFFMODE "+%R"
-
-#define SETBP(ins) BREAK_BRKPT
-
-/* return the program counter value modified if we are in a delay slot */
-#define kdbgetpc(pcb) (kdbvar[kdbvarchk('t')] < 0 ? \
- (pcb).pcb_regs[34] + 4 : (pcb).pcb_regs[34])
-#define kdbishiddenreg(p) ((p) >= &kdbreglist[33])
-#define kdbisbreak(type) (((type) & CR_EXC_CODE) == 0x24)
-
-/* check for address wrap around */
-#define kdbaddrwrap(addr,newaddr) (((addr)^(newaddr)) >> 31)
-
-/* declare machine dependent routines defined in kadb.c */
-void kdbprinttrap __P((unsigned, unsigned));
-void kdbsetsstep __P((void));
-void kdbclrsstep __P((void));
-void kdbreadc __P((char *));
-void kdbwrite __P((char *, int));
-void kdbprintins __P((int, long));
-void kdbstacktrace __P((int));
-char *kdbmalloc __P((int));
diff --git a/sys/arch/wgrisc/include/limits.h b/sys/arch/wgrisc/include/limits.h
deleted file mode 100644
index b4ef30f8352..00000000000
--- a/sys/arch/wgrisc/include/limits.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* $OpenBSD: limits.h,v 1.4 2000/07/31 20:06:04 millert Exp $ */
-/* $NetBSD: limits.h,v 1.8 1995/03/28 18:19:16 jtc Exp $ */
-
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)limits.h 8.3 (Berkeley) 1/4/94
- */
-
-#ifndef _MACHINE_LIMITS_H_
-#define _MACHINE_LIMITS_H_
-
-#define CHAR_BIT 8 /* number of bits in a char */
-#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */
-
-#ifdef _KERNEL
-#define CLK_TCK 100 /* ticks per second */
-#endif
-
-/*
- * According to ANSI (section 2.2.4.2), the values below must be usable by
- * #if preprocessing directives. Additionally, the expression must have the
- * same type as would an expression that is an object of the corresponding
- * type converted according to the integral promotions. The subtraction for
- * INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an
- * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
- * These numbers work for pcc as well. The UINT_MAX and ULONG_MAX values
- * are written as hex so that GCC will be quiet about large integer constants.
- */
-#define SCHAR_MAX 127 /* min value for a signed char */
-#define SCHAR_MIN (-128) /* max value for a signed char */
-
-#define UCHAR_MAX 255 /* max value for an unsigned char */
-#define CHAR_MAX 127 /* max value for a char */
-#define CHAR_MIN (-128) /* min value for a char */
-
-#define USHRT_MAX 65535 /* max value for an unsigned short */
-#define SHRT_MAX 32767 /* max value for a short */
-#define SHRT_MIN (-32768) /* min value for a short */
-
-#define UINT_MAX 0xffffffff /* max value for an unsigned int */
-#define INT_MAX 2147483647 /* max value for an int */
-#define INT_MIN (-2147483647-1) /* min value for an int */
-
-#define ULONG_MAX 0xffffffff /* max value for an unsigned long */
-#define LONG_MAX 2147483647 /* max value for a long */
-#define LONG_MIN (-2147483647-1) /* min value for a long */
-
-#if !defined(_ANSI_SOURCE)
-#define SSIZE_MAX INT_MAX /* max value for a ssize_t */
-
-#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
-#define SIZE_T_MAX UINT_MAX /* max value for a size_t */
-
-#define UID_MAX UINT_MAX /* max value for a uid_t */
-#define GID_MAX UINT_MAX /* max value for a gid_t */
-
-/* GCC requires that quad constants be written as expressions. */
-#define UQUAD_MAX ((u_quad_t)0-1) /* max value for a uquad_t */
- /* max value for a quad_t */
-#define QUAD_MAX ((quad_t)(UQUAD_MAX >> 1))
-#define QUAD_MIN (-QUAD_MAX-1) /* min value for a quad_t */
-#define ULLONG_MAX (UQUAD_MAX) /* max value for unsigned long long */
-#define LLONG_MAX (QUAD_MAX) /* max value for a signed long long */
-#define LLONG_MIN (QUAD_MIN) /* min value for a signed long long */
-
-#endif /* !_POSIX_SOURCE && !_XOPEN_SOURCE */
-#endif /* !_ANSI_SOURCE */
-
-#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE)
-#define LONG_BIT 32
-#define WORD_BIT 32
-
-#define DBL_DIG 15
-#define DBL_MAX 1.797693134862316E+308
-#define DBL_MIN 2.225073858507201E-308
-
-#define FLT_DIG 6
-#define FLT_MAX 3.40282347E+38F
-#define FLT_MIN 1.17549435E-38F
-#endif
-
-#endif /* _MACHINE_LIMITS_H_ */
diff --git a/sys/arch/wgrisc/include/link.h b/sys/arch/wgrisc/include/link.h
deleted file mode 100644
index 4f8d8bac081..00000000000
--- a/sys/arch/wgrisc/include/link.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/* $OpenBSD: link.h,v 1.2 1997/07/31 15:42:28 pefo Exp $ */
-
-/*
- * Copyright (c) 1996 Per Fogelstrom
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#ifndef _LINK_H
-#define _LINK_H 1
-
-#include <elf_abi.h>
-#include <machine/elf_abi.h>
-
-/*
- * Debug rendezvous struct. Pointer to this is set up in the
- * target code pointed by the DT_MIPS_RLD_MAP tag. If it is
- * defined.
- */
-
-struct r_debug {
- int r_version; /* Protocol version. */
- struct link_map *r_map; /* Head of list of loaded objects. */
-
- /* This is the address of a function internal to the run-time linker,
- that will always be called when the linker begins to map in a
- library or unmap it, and again when the mapping change is complete.
- The debugger can set a breakpoint at this address if it wants to
- notice shared object mapping changes. */
- Elf32_Addr r_brk;
- enum {
- /* This state value describes the mapping change taking place when
- the `r_brk' address is called. */
- RT_CONSISTENT, /* Mapping change is complete. */
- RT_ADD, /* Adding a new object. */
- RT_DELETE, /* Removing an object mapping. */
- } r_state;
-
- Elf32_Addr r_ldbase; /* Base address the linker is loaded at. */
- };
-
-/* This symbol refers to the "dynamic structure" in the `.dynamic' section
- of whatever module refers to `_DYNAMIC'. So, to find its own
- `struct r_debug', a program could do:
- for (dyn = _DYNAMIC; dyn->d_tag != DT_NULL)
- if (dyn->d_tag == DT_MIPS_RLD_MAP) r_debug = (struct r_debug) dyn->d_un.d_ptr;
- */
-
-extern Elf32_Dyn _DYNAMIC[];
-
-
-/* Structure describing a loaded shared object. The `l_next' and `l_prev'
- members form a chain of all the shared objects loaded at startup.
-
- These data structures exist in space used by the run-time dynamic linker;
- modifying them may have disastrous results. */
-
-struct link_map
- {
- /* These first few members are part of the protocol with the debugger.
- This is the same format used in SVR4. */
-
- Elf32_Addr l_addr; /* Base address shared object is loaded at. */
- Elf32_Addr l_offs; /* Offset */
- char *l_name; /* Absolute file name object was found in. */
- Elf32_Dyn *l_ld; /* Dynamic section of the shared object. */
- struct link_map *l_next, *l_prev; /* Chain of loaded objects. */
-
- /* All following members are internal to the dynamic linker.
- They may change without notice. */
-
- const char *l_libname; /* Name requested (before search). */
-
- /* Indexed pointers to dynamic section. */
- Elf32_Dyn *l_info[DT_NUM + DT_PROCNUM];
-
- const Elf32_Phdr *l_phdr; /* Pointer to program header table in core. */
- Elf32_Word l_phnum; /* Number of program header entries. */
- Elf32_Addr l_entry; /* Entry point location. */
-
- /* Symbol hash table. */
- Elf32_Word l_nbuckets;
- const Elf32_Word *l_buckets, *l_chain;
-
- unsigned int l_opencount; /* Reference count for dlopen/dlclose. */
- enum /* Where this object came from. */
- {
- lt_executable, /* The main executable program. */
- lt_interpreter, /* The interpreter: the dynamic linker. */
- lt_library, /* Library needed by main executable. */
- lt_loaded, /* Extra run-time loaded shared object. */
- } l_type:2;
- unsigned int l_deps_loaded:1; /* Nonzero if DT_NEEDED items loaded. */
- unsigned int l_relocated:1; /* Nonzero if object's relocations done. */
- unsigned int l_init_called:1; /* Nonzero if DT_INIT function called. */
- unsigned int l_init_running:1; /* Nonzero while DT_INIT function runs. */
- };
-
-#endif /* _LINK_H */
diff --git a/sys/arch/wgrisc/include/memconf.h b/sys/arch/wgrisc/include/memconf.h
deleted file mode 100644
index eb51c946bb3..00000000000
--- a/sys/arch/wgrisc/include/memconf.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $OpenBSD: memconf.h,v 1.1.1.1 1997/02/06 16:02:44 pefo Exp $ */
-
-/*
- * Copyright (c) 1996 Per Fogelstrom
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Memory config list used by pmap_bootstrap.
- */
-
-#ifndef _MEMCONF_H_
-#define _MEMCONF_H_
-
-struct mem_descriptor {
- vm_offset_t mem_start;
- u_int mem_size;
-};
-
-#ifdef _KERNEL
-#define MAXMEMSEGS 16
-extern struct mem_descriptor mem_layout[];
-#endif
-
-#endif
diff --git a/sys/arch/wgrisc/include/mips_opcode.h b/sys/arch/wgrisc/include/mips_opcode.h
deleted file mode 100644
index 821a3f0e09c..00000000000
--- a/sys/arch/wgrisc/include/mips_opcode.h
+++ /dev/null
@@ -1,260 +0,0 @@
-/* $OpenBSD: mips_opcode.h,v 1.1.1.1 1997/02/06 16:02:43 pefo Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)mips_opcode.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Define the instruction formats and opcode values for the
- * MIPS instruction set.
- */
-
-/*
- * Define the instruction formats.
- */
-typedef union {
- unsigned word;
-
-#if BYTE_ORDER == LITTLE_ENDIAN
- struct {
- unsigned imm: 16;
- unsigned rt: 5;
- unsigned rs: 5;
- unsigned op: 6;
- } IType;
-
- struct {
- unsigned target: 26;
- unsigned op: 6;
- } JType;
-
- struct {
- unsigned func: 6;
- unsigned shamt: 5;
- unsigned rd: 5;
- unsigned rt: 5;
- unsigned rs: 5;
- unsigned op: 6;
- } RType;
-
- struct {
- unsigned func: 6;
- unsigned fd: 5;
- unsigned fs: 5;
- unsigned ft: 5;
- unsigned fmt: 4;
- unsigned : 1; /* always '1' */
- unsigned op: 6; /* always '0x11' */
- } FRType;
-#endif
-} InstFmt;
-
-/*
- * Values for the 'op' field.
- */
-#define OP_SPECIAL 000
-#define OP_BCOND 001
-#define OP_J 002
-#define OP_JAL 003
-#define OP_BEQ 004
-#define OP_BNE 005
-#define OP_BLEZ 006
-#define OP_BGTZ 007
-
-#define OP_ADDI 010
-#define OP_ADDIU 011
-#define OP_SLTI 012
-#define OP_SLTIU 013
-#define OP_ANDI 014
-#define OP_ORI 015
-#define OP_XORI 016
-#define OP_LUI 017
-
-#define OP_COP0 020
-#define OP_COP1 021
-#define OP_COP2 022
-#define OP_COP3 023
-#define OP_BEQL 024
-#define OP_BNEL 025
-#define OP_BLEZL 026
-#define OP_BGTZL 027
-
-#define OP_DADDI 030
-#define OP_DADDIU 031
-#define OP_LDL 032
-#define OP_LDR 033
-
-#define OP_LB 040
-#define OP_LH 041
-#define OP_LWL 042
-#define OP_LW 043
-#define OP_LBU 044
-#define OP_LHU 045
-#define OP_LWR 046
-#define OP_LHU 045
-#define OP_LWR 046
-#define OP_LWU 047
-
-#define OP_SB 050
-#define OP_SH 051
-#define OP_SWL 052
-#define OP_SW 053
-#define OP_SDL 054
-#define OP_SDR 055
-#define OP_SWR 056
-#define OP_CACHE 057
-
-#define OP_LL 060
-#define OP_LWC1 061
-#define OP_LWC2 062
-#define OP_LWC3 063
-#define OP_LLD 064
-#define OP_LD 067
-
-#define OP_SC 070
-#define OP_SWC1 071
-#define OP_SWC2 072
-#define OP_SWC3 073
-#define OP_SCD 074
-#define OP_SD 077
-
-/*
- * Values for the 'func' field when 'op' == OP_SPECIAL.
- */
-#define OP_SLL 000
-#define OP_SRL 002
-#define OP_SRA 003
-#define OP_SLLV 004
-#define OP_SRLV 006
-#define OP_SRAV 007
-
-#define OP_JR 010
-#define OP_JALR 011
-#define OP_SYSCALL 014
-#define OP_BREAK 015
-#define OP_SYNC 017
-
-#define OP_MFHI 020
-#define OP_MTHI 021
-#define OP_MFLO 022
-#define OP_MTLO 023
-#define OP_DSLLV 024
-#define OP_DSRLV 026
-#define OP_DSRAV 027
-
-#define OP_MULT 030
-#define OP_MULTU 031
-#define OP_DIV 032
-#define OP_DIVU 033
-#define OP_DMULT 034
-#define OP_DMULTU 035
-#define OP_DDIV 036
-#define OP_DDIVU 037
-
-
-#define OP_ADD 040
-#define OP_ADDU 041
-#define OP_SUB 042
-#define OP_SUBU 043
-#define OP_AND 044
-#define OP_OR 045
-#define OP_XOR 046
-#define OP_NOR 047
-
-#define OP_SLT 052
-#define OP_SLTU 053
-#define OP_DADD 054
-#define OP_DADDU 055
-#define OP_DSUB 056
-#define OP_DSUBU 057
-
-#define OP_TGE 060
-#define OP_TGEU 061
-#define OP_TLT 062
-#define OP_TLTU 063
-#define OP_TEQ 064
-#define OP_TNE 066
-
-#define OP_DSLL 070
-#define OP_DSRL 072
-#define OP_DSRA 073
-#define OP_DSLL32 074
-#define OP_DSRL32 076
-#define OP_DSRA32 077
-
-/*
- * Values for the 'func' field when 'op' == OP_BCOND.
- */
-#define OP_BLTZ 000
-#define OP_BGEZ 001
-#define OP_BLTZL 002
-#define OP_BGEZL 003
-
-#define OP_TGEI 010
-#define OP_TGEIU 011
-#define OP_TLTI 012
-#define OP_TLTIU 013
-#define OP_TEQI 014
-#define OP_TNEI 016
-
-#define OP_BLTZAL 020
-#define OP_BLTZAL 020
-#define OP_BGEZAL 021
-#define OP_BLTZALL 022
-#define OP_BGEZALL 023
-
-/*
- * Values for the 'rs' field when 'op' == OP_COPz.
- */
-#define OP_MF 000
-#define OP_DMF 001
-#define OP_MT 004
-#define OP_DMT 005
-#define OP_BCx 010
-#define OP_BCy 014
-#define OP_CF 002
-#define OP_CT 006
-
-/*
- * Values for the 'rt' field when 'op' == OP_COPz.
- */
-#define COPz_BC_TF_MASK 0x01
-#define COPz_BC_TRUE 0x01
-#define COPz_BC_FALSE 0x00
-#define COPz_BCL_TF_MASK 0x02
-#define COPz_BCL_TRUE 0x02
-#define COPz_BCL_FALSE 0x00
diff --git a/sys/arch/wgrisc/include/param.h b/sys/arch/wgrisc/include/param.h
deleted file mode 100644
index f788a31ad68..00000000000
--- a/sys/arch/wgrisc/include/param.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/* $OpenBSD: param.h,v 1.4 1997/05/11 16:26:02 pefo Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: machparam.h 1.11 89/08/14
- * from: @(#)param.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Machine dependent constants for Willowglen Mips RISC machines:
- */
-#define MACHINE "wgrisc"
-#define _MACHINE wgrisc
-#define MACHINE_ARCH "mips"
-#define _MACHINE_ARCH mips
-#define MID_MACHINE MID_PMAX /* XXX Bogus, but needed for now... */
-
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value for all
- * data types (int, long, ...). The result is u_int and must be cast to
- * any desired pointer type.
- */
-#define ALIGNBYTES 7
-#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
-
-#define NBPG 4096 /* bytes/page */
-#define PGOFSET (NBPG-1) /* byte offset into page */
-#define PGSHIFT 12 /* LOG2(NBPG) */
-#define NPTEPG (NBPG/4)
-
-#define NBSEG 0x400000 /* bytes/segment */
-#define SEGOFSET (NBSEG-1) /* byte offset into segment */
-#define SEGSHIFT 22 /* LOG2(NBSEG) */
-
-#define KERNBASE 0x80000000 /* start of kernel virtual */
-#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT)
-
-#define DEV_BSIZE 512
-#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
-#define BLKDEV_IOSIZE 2048
-/* XXX Maxphys temporary changed to 32K while SCSI driver is fixed. */
-#define MAXPHYS (32 * 1024) /* max raw I/O transfer size */
-
-#define CLSIZE 1
-#define CLSIZELOG2 0
-
-/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
-#define SSIZE 1 /* initial stack size/NBPG */
-#define SINCR 1 /* increment of stack/NBPG */
-
-#define UPAGES 2 /* pages of u-area */
-#define UADDR 0xffffc000 /* address of u */
-#define USPACE (UPAGES*NBPG) /* size of u-area in bytes */
-#define UVPN (UADDR>>PGSHIFT)/* virtual page number of u */
-#define KERNELSTACK (UADDR+UPAGES*NBPG) /* top of kernel stack */
-
-/*
- * Constants related to network buffer management.
- * MCLBYTES must be no larger than CLBYTES (the software page size), and,
- * on machines that exchange pages of input or output buffers with mbuf
- * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
- * of the hardware page size.
- */
-#define MSIZE 128 /* size of an mbuf */
-#define MCLSHIFT 11 /* log2(MCLBYTES) */
-#define MCLBYTES (1 << MCLSHIFT) /* enough for whole Ethernet packet */
-#define MCLOFSET (MCLBYTES - 1)
-#ifndef NMBCLUSTERS
-#ifdef GATEWAY
-#define NMBCLUSTERS 2048 /* map size, max cluster allocation */
-#else
-#define NMBCLUSTERS 1024 /* map size, max cluster allocation */
-#endif
-#endif
-
-/*
- * Size of kernel malloc arena in CLBYTES-sized logical pages
- */
-#ifndef NKMEMCLUSTERS
-#define NKMEMCLUSTERS (4096*1024/CLBYTES)
-#endif
-
-/* pages ("clicks") (4096 bytes) to disk blocks */
-#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
-#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
-
-/* pages to bytes */
-#define ctob(x) ((x) << PGSHIFT)
-#define btoc(x) (((x) + PGOFSET) >> PGSHIFT)
-
-/* bytes to disk blocks */
-#define btodb(x) ((x) >> DEV_BSHIFT)
-#define dbtob(x) ((x) << DEV_BSHIFT)
-
-/*
- * Map a ``block device block'' to a file system block.
- * This should be device dependent, and should use the bsize
- * field from the disk label.
- * For now though just use DEV_BSIZE.
- */
-#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
-
-/*
- * Mach derived conversion macros
- */
-#define mips_round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1))
-#define mips_trunc_page(x) ((unsigned)(x) & ~(NBPG-1))
-#define mips_btop(x) ((unsigned)(x) >> PGSHIFT)
-#define mips_ptob(x) ((unsigned)(x) << PGSHIFT)
-
-#ifdef _KERNEL
-#ifndef _LOCORE
-extern int (*Mach_splnet)(), (*Mach_splbio)(), (*Mach_splimp)(),
- (*Mach_spltty)(), (*Mach_splclock)(), (*Mach_splstatclock)();
-#define splnet() ((*Mach_splnet)())
-#define splbio() ((*Mach_splbio)())
-#define splimp() ((*Mach_splimp)())
-#define spltty() ((*Mach_spltty)())
-#define splclock() ((*Mach_splclock)())
-#define splstatclock() ((*Mach_splstatclock)())
-
-/*
- * Delay is based on an assumtion that each time in the loop
- * takes 3 clocks. Three is for branch and subtract in the delay slot.
- */
-extern int cpuspeed;
-#define DELAY(n) { register int N = cpuspeed * (n); while ((N -= 3) > 0); }
-#endif
-
-#else /* !_KERNEL */
-#define DELAY(n) { register int N = (n); while (--N > 0); }
-#endif /* !_KERNEL */
diff --git a/sys/arch/wgrisc/include/pcb.h b/sys/arch/wgrisc/include/pcb.h
deleted file mode 100644
index efcaaf2df13..00000000000
--- a/sys/arch/wgrisc/include/pcb.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* $OpenBSD: pcb.h,v 1.1.1.1 1997/02/06 16:02:43 pefo Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: pcb.h 1.13 89/04/23
- * from: @(#)pcb.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * ARC process control block
- */
-struct pcb
-{
- int pcb_regs[71]; /* saved CPU and floating point registers */
- label_t pcb_context; /* kernel context for resume */
- int pcb_onfault; /* for copyin/copyout faults */
- void *pcb_segtab; /* copy of pmap pm_segtab */
-};
-
-/*
- * The pcb is augmented with machine-dependent additional data for
- * core dumps. For the WGRISC, there is nothing to add.
- */
-struct md_coredump {
- long md_pad[8];
-};
diff --git a/sys/arch/wgrisc/include/pio.h b/sys/arch/wgrisc/include/pio.h
deleted file mode 100644
index 2ebf8abd47f..00000000000
--- a/sys/arch/wgrisc/include/pio.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* $OpenBSD: pio.h,v 1.1.1.1 1997/02/06 16:02:43 pefo Exp $ */
-
-/*
- * Copyright (c) 1995 Per Fogelstrom. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * I/O macros.
- */
-
-#define outb(a,v) (*(volatile unsigned char*)(a) = (v))
-#define outw(a,v) (*(volatile unsigned short*)(a) = (v))
-#define out16(a,v) outw(a,v)
-#define outl(a,v) (*(volatile unsigned int*)(a) = (v))
-#define out32(a,v) outl(a,v)
-#define inb(a) (*(volatile unsigned char*)(a))
-#define inw(a) (*(volatile unsigned short*)(a))
-#define in16(a) inw(a)
-#define inl(a) (*(volatile unsigned int*)(a))
-#define in32(a) inl(a)
-
diff --git a/sys/arch/wgrisc/include/pmap.h b/sys/arch/wgrisc/include/pmap.h
deleted file mode 100644
index 371080a0aa2..00000000000
--- a/sys/arch/wgrisc/include/pmap.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* $OpenBSD: pmap.h,v 1.1.1.1 1997/02/06 16:02:43 pefo Exp $ */
-
-/*
- * Copyright (c) 1987 Carnegie-Mellon University
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)pmap.h 8.1 (Berkeley) 6/10/93
- */
-
-#ifndef _PMAP_MACHINE_
-#define _PMAP_MACHINE_
-
-/*
- * The user address space is 2Gb (0x0 - 0x80000000).
- * User programs are laid out in memory as follows:
- * address
- * USRTEXT 0x00400000
- * USRDATA 0x10000000
- * USRSTACK 0x7FFFFFFF
- *
- * The user address space is mapped using a two level structure where
- * virtual address bits 30..22 are used to index into a segment table which
- * points to a page worth of PTEs (4096 page can hold 1024 PTEs).
- * Bits 21..12 are then used to index a PTE which describes a page within
- * a segment.
- *
- * The wired entries in the TLB will contain the following:
- * 0-1 (UPAGES) for curproc user struct and kernel stack.
- *
- * Note: The kernel doesn't use the same data structures as user programs.
- * All the PTE entries are stored in a single array in Sysmap which is
- * dynamically allocated at boot time.
- */
-
-#define mips_trunc_seg(x) ((vm_offset_t)(x) & ~SEGOFSET)
-#define mips_round_seg(x) (((vm_offset_t)(x) + SEGOFSET) & ~SEGOFSET)
-#define pmap_segmap(m, v) ((m)->pm_segtab->seg_tab[((v) >> SEGSHIFT)])
-
-#define PMAP_SEGTABSIZE 512
-
-union pt_entry;
-
-struct segtab {
- union pt_entry *seg_tab[PMAP_SEGTABSIZE];
-};
-
-/*
- * Machine dependent pmap structure.
- */
-typedef struct pmap {
- int pm_count; /* pmap reference count */
- simple_lock_data_t pm_lock; /* lock on pmap */
- struct pmap_statistics pm_stats; /* pmap statistics */
- int pm_tlbpid; /* address space tag */
- u_int pm_tlbgen; /* TLB PID generation number */
- struct segtab *pm_segtab; /* pointers to pages of PTEs */
-} *pmap_t;
-
-/*
- * Defines for pmap_attributes[phys_mach_page];
- */
-#define PMAP_ATTR_MOD 0x01 /* page has been modified */
-#define PMAP_ATTR_REF 0x02 /* page has been referenced */
-
-#ifdef _KERNEL
-extern char *pmap_attributes; /* reference and modify bits */
-extern struct pmap kernel_pmap_store;
-
-#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
-#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count)
-#define pmap_kernel() (&kernel_pmap_store)
-
-#define PMAP_PREFER(pa, va) pmap_prefer((pa), (va))
-
-#endif /* _KERNEL */
-
-#endif /* _PMAP_MACHINE_ */
diff --git a/sys/arch/wgrisc/include/proc.h b/sys/arch/wgrisc/include/proc.h
deleted file mode 100644
index b786274b258..00000000000
--- a/sys/arch/wgrisc/include/proc.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* $OpenBSD: proc.h,v 1.1.1.1 1997/02/06 16:02:43 pefo Exp $ */
-/* $NetBSD: proc.h,v 1.4 1994/10/26 21:09:52 cgd Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)proc.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Machine-dependent part of the proc structure.
- */
-struct mdproc {
- int *md_regs; /* registers on current frame */
- int md_flags; /* machine-dependent flags */
- int md_upte[UPAGES]; /* ptes for mapping u page */
- int md_ss_addr; /* single step address for ptrace */
- int md_ss_instr; /* single step instruction for ptrace */
-};
-
-/* md_flags */
-#define MDP_FPUSED 0x0001 /* floating point coprocessor used */
diff --git a/sys/arch/wgrisc/include/profile.h b/sys/arch/wgrisc/include/profile.h
deleted file mode 100644
index 61cdbe23873..00000000000
--- a/sys/arch/wgrisc/include/profile.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $OpenBSD: profile.h,v 1.1.1.1 1997/02/06 16:02:43 pefo Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)profile.h 8.1 (Berkeley) 6/10/93
- */
-
-#define _MCOUNT_DECL static void ___mcount
-
-#define MCOUNT \
- __asm(".globl _mcount;" \
- ".type _mcount,@function;" \
- "_mcount:;" \
- ".set noreorder;" \
- ".set noat;" \
- ".cpload $25;" \
- "sw $4,8($29);" \
- "sw $5,12($29);" \
- "sw $6,16($29);" \
- "sw $7,20($29);" \
- "sw $1,0($29);" \
- "sw $31,4($29);" \
- "move $5,$31;" \
- "jal ___mcount;" \
- "move $4,$1;" \
- "lw $4,8($29);" \
- "lw $5,12($29);" \
- "lw $6,16($29);" \
- "lw $7,20($29);" \
- "lw $31,4($29);" \
- "lw $1,0($29);" \
- "addu $29,$29,8;" \
- "j $31;" \
- "move $31,$1;" \
- ".set reorder;" \
- ".set at");
-
-#ifdef _KERNEL
-/*
- * The following two macros do splhigh and splx respectively.
- * They have to be defined this way because these are real
- * functions on the MIPS, and we do not want to invoke mcount
- * recursively.
- */
-#define MCOUNT_ENTER s = _splhigh()
-
-#define MCOUNT_EXIT _splx(s)
-#endif /* _KERNEL */
diff --git a/sys/arch/wgrisc/include/psl.h b/sys/arch/wgrisc/include/psl.h
deleted file mode 100644
index 0b6d3498cea..00000000000
--- a/sys/arch/wgrisc/include/psl.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* $OpenBSD: psl.h,v 1.1.1.1 1997/02/06 16:02:43 pefo Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)psl.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <machine/cpu.h>
-
-#define PSL_LOWIPL (INT_MASK | SR_INT_ENAB)
-
-#define R3K_PSL_USERSET ( SR_KU_OLD | SR_INT_ENA_OLD | \
- SR_KU_PREV | SR_INT_ENA_PREV | \
- INT_MASK)
-
-#define R4K_PSL_USERSET ( SR_KSU_USER | SR_INT_ENAB | \
- SR_EXL | INT_MASK)
-
-/*
- * Macros to decode processor status word.
- */
-#define R3K_USERMODE(ps) ((ps) & SR_KU_PREV)
-#define R3K_BASEPRI(ps) (((ps) & (INT_MASK | SR_INT_ENA_PREV)) \
- == (INT_MASK | SR_INT_ENA_PREV))
-
-#define R4K_USERMODE(ps) (((ps) & SR_KSU_MASK) == SR_KSU_USER)
-#define R4K_BASEPRI(ps) (((ps) & (INT_MASK | SR_INT_ENA_PREV)) \
- == (INT_MASK | SR_INT_ENA_PREV))
diff --git a/sys/arch/wgrisc/include/pte.h b/sys/arch/wgrisc/include/pte.h
deleted file mode 100644
index a6f462b0efc..00000000000
--- a/sys/arch/wgrisc/include/pte.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/* $OpenBSD: pte.h,v 1.1.1.1 1997/02/06 16:02:43 pefo Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: pte.h 1.11 89/09/03
- * from: @(#)pte.h 8.1 (Berkeley) 6/10/93
- */
-
-#ifndef _LOCORE
-/*
- * R3000 hardware page table entry
- * R4000 hardware page table entry
- */
-struct pte {
-#if BYTE_ORDER == BIG_ENDIAN
-#ifdef R4K
-unsigned int pg_prot:2, /* SW: access control */
- pg_pfnum:24, /* HW: core page frame number or 0 */
- pg_attr:3, /* HW: cache attribute */
- pg_m:1, /* HW: modified (dirty) bit */
- pg_v:1, /* HW: valid bit */
- pg_g:1; /* HW: ignore pid bit */
-#else
-unsigned int pg_pfnum:20, /* HW: core page frame number or 0 */
- pg_n:1, /* HW: non-cacheable bit */
- pg_m:1, /* HW: modified (dirty) bit */
- pg_v:1, /* HW: valid bit */
- pg_g:1, /* HW: ignore pid bit */
- :4,
- pg_swapm:1, /* SW: page must be forced to swap */
- pg_fod:1, /* SW: is fill on demand (=0) */
- pg_prot:2; /* SW: access control */
-#endif
-#endif
-#if BYTE_ORDER == LITTLE_ENDIAN
-#ifdef R4K
-unsigned int pg_g:1, /* HW: ignore pid bit */
- pg_v:1, /* HW: valid bit */
- pg_m:1, /* HW: modified (dirty) bit */
- pg_attr:3, /* HW: cache attribute */
- pg_pfnum:24, /* HW: core page frame number or 0 */
- pg_prot:2; /* SW: access control */
-#else
-unsigned int pg_prot:2, /* SW: access control */
- pg_fod:1, /* SW: is fill on demand (=0) */
- pg_swapm:1, /* SW: page must be forced to swap */
- :4,
- pg_g:1, /* HW: ignore pid bit */
- pg_v:1, /* HW: valid bit */
- pg_m:1, /* HW: modified (dirty) bit */
- pg_n:1, /* HW: non-cacheable bit */
- pg_pfnum:20; /* HW: core page frame number or 0 */
-#endif
-#endif
-};
-
-/*
- * Structure defining an tlb entry data set.
- */
-
-struct tlb {
- int tlb_mask;
- int tlb_hi;
- int tlb_lo0;
- int tlb_lo1;
-};
-
-typedef union pt_entry {
- unsigned int pt_entry; /* for copying, etc. */
- struct pte pt_pte; /* for getting to bits by name */
-} pt_entry_t; /* Mach page table entry */
-#endif /* _LOCORE */
-
-#define PT_ENTRY_NULL ((pt_entry_t *) 0)
-
-#ifdef R4K
-#define PG_SVPN 0xfffff000 /* Software page no mask */
-#define PG_HVPN 0xffffe000 /* Hardware page no mask */
-#define PG_ODDPG 0x00001000 /* Odd even pte entry */
-#define PG_ASID 0x000000ff /* Address space ID */
-#define PG_G 0x00000001 /* HW */
-#define PG_V 0x00000002
-#define PG_NV 0x00000000
-#define PG_M 0x00000004
-#define PG_ATTR 0x0000003f
-#define PG_UNCACHED 0x00000010
-#define PG_CACHED 0x00000018
-#define PG_CACHEMODE 0x00000038
-#define PG_FRAME 0x3fffffc0
-#define PG_RO 0x40000000 /* SW */
-#define PG_WIRED 0x80000000 /* SW */
-#define PG_SHIFT 6
-#define PG_SIZE_4K 0x00000000
-#define PG_SIZE_16K 0x00006000
-#define PG_SIZE_64K 0x0001e000
-#define PG_SIZE_256K 0x0007e000
-#define PG_SIZE_1M 0x001fe000
-#define PG_SIZE_4M 0x007fe000
-#define PG_SIZE_16M 0x01ffe000
-
-#else /* R3K */
-#define PG_PROT 0x00000003 /* Software bits */
-#define PG_RW 0x00000000 /* Read/Write mapped */
-#define PG_RO 0x00000001 /* Read only mapped */
-#define PG_WIRED 0x00000002 /* Page is wired down */
-#define PG_G 0x00000100 /* Global mapped */
-#define PG_V 0x00000200 /* Page is valid */
-#define PG_NV 0x00000000 /* Page is NOT valid */
-#define PG_M 0x00000400 /* Page is dirty */
-#define PG_UNCACHED 0x00000800 /* Non cachable page */
-#define PG_CACHED 0x00000000 /* Non cachable page */
-#define PG_CACHEMODE 0x00000800
-#define PG_FRAME 0xfffff000
-#define PG_SHIFT 0 /* VPN already in place */
-#endif
-
-#define PG_ROPAGE (PG_V | PG_RO | PG_CACHED) /* Write protected */
-#define PG_RWPAGE (PG_V | PG_M | PG_CACHED) /* Not wr-prot not clean */
-#define PG_CWPAGE (PG_V | PG_CACHED) /* Not wr-prot but clean */
-#define PG_IOPAGE (PG_G | PG_V | PG_M | PG_UNCACHED)
-
-#define vad_to_pfn(x) (((unsigned)(x) >> PG_SHIFT) & PG_FRAME)
-#define vad_to_pfn64(x) (((quad_t)(x) >> PG_SHIFT) & PG_FRAME)
-#define pfn_to_vad(x) (((x) & PG_FRAME) << PG_SHIFT)
-#define vad_to_vpn(x) ((unsigned)(x) & PG_SVPN)
-#define vpn_to_vad(x) ((x) & PG_SVPN)
-/* User viritual to pte page entry */
-#define uvtopte(adr) (((adr) >> PGSHIFT) & (NPTEPG -1))
-
-#if defined(_KERNEL) && !defined(_LOCORE)
-/*
- * Kernel virtual address to page table entry and visa versa.
- */
-#define kvtopte(va) \
- (Sysmap + (((vm_offset_t)(va) - VM_MIN_KERNEL_ADDRESS) >> PGSHIFT))
-#define ptetokv(pte) \
- ((((pt_entry_t *)(pte) - Sysmap) << PGSHIFT) + VM_MIN_KERNEL_ADDRESS)
-
-extern pt_entry_t *Sysmap; /* kernel pte table */
-extern u_int Sysmapsize; /* number of pte's in Sysmap */
-#endif
diff --git a/sys/arch/wgrisc/include/ptrace.h b/sys/arch/wgrisc/include/ptrace.h
deleted file mode 100644
index 6503e809b39..00000000000
--- a/sys/arch/wgrisc/include/ptrace.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $OpenBSD: ptrace.h,v 1.1.1.1 1997/02/06 16:02:43 pefo Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)ptrace.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Machine dependent trace commands.
- *
- */
-
-#define PT_GETREGS (PT_FIRSTMACH+0)
-#define PT_SETREGS (PT_FIRSTMACH+1)
-#define PT_STEP (PT_FIRSTMACH+2)
diff --git a/sys/arch/wgrisc/include/reg.h b/sys/arch/wgrisc/include/reg.h
deleted file mode 100644
index f343120462b..00000000000
--- a/sys/arch/wgrisc/include/reg.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* $OpenBSD: reg.h,v 1.1.1.1 1997/02/06 16:02:43 pefo Exp $ */
-/* $NetBSD: reg.h,v 1.6 1995/12/20 02:00:27 jonathan Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: reg.h 1.1 90/07/09
- * @(#)reg.h 8.2 (Berkeley) 1/11/94
- */
-
-#ifndef _MACHINE_REG_H_
-#define _MACHINE_REG_H_
-/*
- * Location of the users' stored
- * registers relative to ZERO.
- * Usage is p->p_regs[XX].
- *
- * must be visible to assembly code.
- */
-#include <machine/regnum.h>
-
-/*
- * Register set accessible via /proc/$pid/reg
- */
-struct reg {
- int r_regs[71]; /* numbered as above */
-};
-#endif /*_MACHINE_REG_H_*/
diff --git a/sys/arch/wgrisc/include/regdef.h b/sys/arch/wgrisc/include/regdef.h
deleted file mode 100644
index ac5f6ec3494..00000000000
--- a/sys/arch/wgrisc/include/regdef.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $OpenBSD: regdef.h,v 1.1.1.1 1997/02/06 16:02:43 pefo Exp $ */
-/* $NetBSD: regdef.h,v 1.4 1994/10/26 21:09:58 cgd Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell. This file is derived from the MIPS RISC
- * Architecture book by Gerry Kane.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)regdef.h 8.1 (Berkeley) 6/10/93
- */
-
-#define zero $0 /* always zero */
-#define AT $at /* assembler temp */
-#define v0 $2 /* return value */
-#define v1 $3
-#define a0 $4 /* argument registers */
-#define a1 $5
-#define a2 $6
-#define a3 $7
-#define t0 $8 /* temp registers (not saved across subroutine calls) */
-#define t1 $9
-#define t2 $10
-#define t3 $11
-#define t4 $12
-#define t5 $13
-#define t6 $14
-#define t7 $15
-#define s0 $16 /* saved across subroutine calls (callee saved) */
-#define s1 $17
-#define s2 $18
-#define s3 $19
-#define s4 $20
-#define s5 $21
-#define s6 $22
-#define s7 $23
-#define t8 $24 /* two more temp registers */
-#define t9 $25
-#define k0 $26 /* kernel temporary */
-#define k1 $27
-#define gp $28 /* global pointer */
-#define sp $29 /* stack pointer */
-#define s8 $30 /* one more callee saved */
-#define ra $31 /* return address */
diff --git a/sys/arch/wgrisc/include/regnum.h b/sys/arch/wgrisc/include/regnum.h
deleted file mode 100644
index df346a92e47..00000000000
--- a/sys/arch/wgrisc/include/regnum.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* $OpenBSD: regnum.h,v 1.1.1.1 1997/02/06 16:02:44 pefo Exp $ */
-/* $NetBSD: reg.h,v 1.5 1995/01/18 06:40:12 mellon Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: reg.h 1.1 90/07/09
- * @(#)reg.h 8.2 (Berkeley) 1/11/94
- */
-
-/*
- * Location of the users' stored
- * registers relative to ZERO.
- * Usage is p->p_regs[XX].
- */
-#define ZERO 0
-#define AST 1
-#define V0 2
-#define V1 3
-#define A0 4
-#define A1 5
-#define A2 6
-#define A3 7
-#define T0 8
-#define T1 9
-#define T2 10
-#define T3 11
-#define T4 12
-#define T5 13
-#define T6 14
-#define T7 15
-#define S0 16
-#define S1 17
-#define S2 18
-#define S3 19
-#define S4 20
-#define S5 21
-#define S6 22
-#define S7 23
-#define T8 24
-#define T9 25
-#define K0 26
-#define K1 27
-#define GP 28
-#define SP 29
-#define S8 30
-#define RA 31
-#define SR 32
-#define PS SR /* alias for SR */
-#define MULLO 33
-#define MULHI 34
-#define BADVADDR 35
-#define CAUSE 36
-#define PC 37
-
-#define FPBASE 38
-#define F0 (FPBASE+0)
-#define F1 (FPBASE+1)
-#define F2 (FPBASE+2)
-#define F3 (FPBASE+3)
-#define F4 (FPBASE+4)
-#define F5 (FPBASE+5)
-#define F6 (FPBASE+6)
-#define F7 (FPBASE+7)
-#define F8 (FPBASE+8)
-#define F9 (FPBASE+9)
-#define F10 (FPBASE+10)
-#define F11 (FPBASE+11)
-#define F12 (FPBASE+12)
-#define F13 (FPBASE+13)
-#define F14 (FPBASE+14)
-#define F15 (FPBASE+15)
-#define F16 (FPBASE+16)
-#define F17 (FPBASE+17)
-#define F18 (FPBASE+18)
-#define F19 (FPBASE+19)
-#define F20 (FPBASE+20)
-#define F21 (FPBASE+21)
-#define F22 (FPBASE+22)
-#define F23 (FPBASE+23)
-#define F24 (FPBASE+24)
-#define F25 (FPBASE+25)
-#define F26 (FPBASE+26)
-#define F27 (FPBASE+27)
-#define F28 (FPBASE+28)
-#define F29 (FPBASE+29)
-#define F30 (FPBASE+30)
-#define F31 (FPBASE+31)
-#define FSR (FPBASE+32)
-
-#ifdef IPCREG
-#define NIPCREG (FSR + 1)
-int ipcreg[NIPCREG] = {
- ZERO, AST, V0, V1, A0, A1, A2, A3, T0, T1, T2, T3, T4, T5, T6, T7,
- S0, S1, S2, S3, S4, S5, S6, S7, T8, T9, K0, K1, GP, SP, S8, RA,
- SR, MULLO, MULHI, BADVADDR, CAUSE, PC,
- F0, F1, F2, F3, F4, F5, F6, F7,
- F8, F9, F10, F11, F12, F13, F14, F15,
- F16, F17, F18, F19, F20, F21, F22, F23,
- F24, F25, F26, F27, F28, F29, F30, F31, FSR,
-};
-#endif
diff --git a/sys/arch/wgrisc/include/reloc.h b/sys/arch/wgrisc/include/reloc.h
deleted file mode 100644
index dd75526e638..00000000000
--- a/sys/arch/wgrisc/include/reloc.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* $OpenBSD: reloc.h,v 1.1.1.1 1997/02/06 16:02:44 pefo Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)reloc.h 8.1 (Berkeley) 6/10/93
- * from: Header: reloc.h,v 1.6 92/06/20 09:59:37 torek Exp
- */
-
diff --git a/sys/arch/wgrisc/include/setjmp.h b/sys/arch/wgrisc/include/setjmp.h
deleted file mode 100644
index 6bd67727883..00000000000
--- a/sys/arch/wgrisc/include/setjmp.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $OpenBSD: setjmp.h,v 1.1.1.1 1997/02/06 16:02:43 pefo Exp $ */
-/* $NetBSD: setjmp.h,v 1.1 1994/12/20 10:37:05 cgd Exp $ */
-
-/*
- * machine/setjmp.h: machine dependent setjmp-related information.
- */
-
-#define _JBLEN 83 /* size, in longs, of a jmp_buf */
diff --git a/sys/arch/wgrisc/include/signal.h b/sys/arch/wgrisc/include/signal.h
deleted file mode 100644
index dc1f5160f88..00000000000
--- a/sys/arch/wgrisc/include/signal.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $OpenBSD: signal.h,v 1.1.1.1 1997/02/06 16:02:43 pefo Exp $ */
-/* $NetBSD: signal.h,v 1.6 1995/01/18 06:42:01 mellon Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)signal.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Machine-dependent signal definitions
- */
-
-typedef int sig_atomic_t;
-
-#ifndef _ANSI_SOURCE
-/*
- * Information pushed on stack when a signal is delivered.
- * This is used by the kernel to restore state following
- * execution of the signal handler. It is also made available
- * to the handler to allow it to restore state properly if
- * a non-standard exit is performed.
- */
-struct sigcontext {
- int sc_onstack; /* sigstack state to restore */
- int sc_mask; /* signal mask to restore */
- int sc_pc; /* pc at time of signal */
- int sc_regs[32]; /* processor regs 0 to 31 */
- int mullo, mulhi; /* mullo and mulhi registers... */
- int sc_fpused; /* fp has been used */
- int sc_fpregs[33]; /* fp regs 0 to 31 and csr */
- int sc_fpc_eir; /* floating point exception instruction reg */
- int xxx[8]; /* XXX reserved */
-};
-
-#endif /* !_ANSI_SOURCE */
diff --git a/sys/arch/wgrisc/include/stdarg.h b/sys/arch/wgrisc/include/stdarg.h
deleted file mode 100644
index 26603cf2adb..00000000000
--- a/sys/arch/wgrisc/include/stdarg.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $OpenBSD: stdarg.h,v 1.1.1.1 1997/02/06 16:02:43 pefo Exp $ */
-/* $NetBSD: stdarg.h,v 1.7 1995/03/28 18:19:28 jtc Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)stdarg.h 8.1 (Berkeley) 6/10/93
- */
-
-#ifndef _MIPS_STDARG_H_
-#define _MIPS_STDARG_H_
-
-#include <machine/ansi.h>
-
-typedef _BSD_VA_LIST_ va_list;
-
-#define __va_promote(type) \
- (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
-
-#define va_start(ap, last) \
- (ap = ((char *)&(last) + __va_promote(last)))
-
-#ifdef _KERNEL
-#define va_arg(ap, type) \
- ((type *)(ap += sizeof(type)))[-1]
-#else
-#define va_arg(ap, type) \
- ((type *)(ap += sizeof(type) == sizeof(int) ? sizeof(type) : \
- sizeof(type) > sizeof(int) ? \
- (-(int)(ap) & (sizeof(type) - 1)) + sizeof(type) : \
- (abort(), 0)))[-1]
-#endif
-
-#define va_end(ap) ((void) 0)
-
-#endif /* !_MIPS_STDARG_H_ */
diff --git a/sys/arch/wgrisc/include/trap.h b/sys/arch/wgrisc/include/trap.h
deleted file mode 100644
index 54e7c7626e6..00000000000
--- a/sys/arch/wgrisc/include/trap.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $OpenBSD: trap.h,v 1.1.1.1 1997/02/06 16:02:43 pefo Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: trap.h 1.1 90/07/09
- * from: @(#)trap.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Trap codes
- * also known in trap.c for name strings
- */
-
-#define T_INT 0 /* Interrupt pending */
-#define T_TLB_MOD 1 /* TLB modified fault */
-#define T_TLB_LD_MISS 2 /* TLB miss on load or ifetch */
-#define T_TLB_ST_MISS 3 /* TLB miss on a store */
-#define T_ADDR_ERR_LD 4 /* Address error on a load or ifetch */
-#define T_ADDR_ERR_ST 5 /* Address error on a store */
-#define T_BUS_ERR_IFETCH 6 /* Bus error on an ifetch */
-#define T_BUS_ERR_LD_ST 7 /* Bus error on a load or store */
-#define T_SYSCALL 8 /* System call */
-#define T_BREAK 9 /* Breakpoint */
-#define T_RES_INST 10 /* Reserved instruction exception */
-#define T_COP_UNUSABLE 11 /* Coprocessor unusable */
-#define T_OVFLOW 12 /* Arithmetic overflow */
-#define T_TRAP 13 /* Trap instruction */
-#define T_VCEI 14 /* Viritual coherency instruction */
-#define T_FPE 15 /* Floating point exception */
-#define T_WATCH 23 /* Watch address reference */
-#define T_VCED 31 /* Viritual coherency data */
-
-#define T_USER 0x20 /* user-mode flag or'ed with type */
diff --git a/sys/arch/wgrisc/include/types.h b/sys/arch/wgrisc/include/types.h
deleted file mode 100644
index e5120d58e84..00000000000
--- a/sys/arch/wgrisc/include/types.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* $OpenBSD: types.h,v 1.3 1999/01/08 03:04:09 millert Exp $ */
-/* $NetBSD: types.h,v 1.10 1995/07/06 03:39:43 cgd Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)types.h 8.3 (Berkeley) 1/5/94
- */
-
-#ifndef _MACHTYPES_H_
-#define _MACHTYPES_H_
-
-#include <sys/cdefs.h>
-
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
-typedef struct _physadr {
- int r[1];
-} *physadr;
-
-typedef struct label_t {
- int val[12];
-} label_t;
-#endif
-
-typedef unsigned long vm_offset_t;
-typedef unsigned long vm_size_t;
-
-/*
- * Basic integral types. Omit the typedef if
- * not possible for a machine/compiler combination.
- */
-#define __BIT_TYPES_DEFINED__
-typedef __signed char int8_t;
-typedef unsigned char u_int8_t;
-typedef unsigned char uint8_t;
-typedef short int16_t;
-typedef unsigned short u_int16_t;
-typedef unsigned short uint16_t;
-typedef int int32_t;
-typedef unsigned int u_int32_t;
-typedef unsigned int uint32_t;
-/* LONGLONG */
-typedef long long int64_t;
-/* LONGLONG */
-typedef unsigned long long u_int64_t;
-/* LONGLONG */
-typedef unsigned long long uint64_t;
-
-typedef int32_t register_t;
-
-#define __BDEVSW_DUMP_OLD_TYPE
-#define __SWAP_BROKEN
-#define __FORK_BRAINDAMAGE
-
-#endif /* _MACHTYPES_H_ */
diff --git a/sys/arch/wgrisc/include/varargs.h b/sys/arch/wgrisc/include/varargs.h
deleted file mode 100644
index 90fb8b0cf3e..00000000000
--- a/sys/arch/wgrisc/include/varargs.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* $OpenBSD: varargs.h,v 1.1.1.1 1997/02/06 16:02:43 pefo Exp $ */
-/* $NetBSD: varargs.h,v 1.8 1995/03/28 18:19:30 jtc Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)varargs.h 8.2 (Berkeley) 3/22/94
- */
-
-#ifndef _MIPS_VARARGS_H_
-#define _MIPS_VARARGS_H_
-
-#include <machine/ansi.h>
-
-typedef _BSD_VA_LIST_ va_list;
-
-#define va_dcl int va_alist; ...
-
-#define va_start(ap) \
- ap = (char *)&va_alist
-
-#ifdef _KERNEL
-#define va_arg(ap, type) \
- ((type *)(ap += sizeof(type)))[-1]
-#else
-#define va_arg(ap, type) \
- ((type *)(ap += sizeof(type) == sizeof(int) ? sizeof(type) : \
- sizeof(type) > sizeof(int) ? \
- (-(int)(ap) & (sizeof(type) - 1)) + sizeof(type) : \
- (abort(), 0)))[-1]
-#endif
-
-#define va_end(ap) ((void) 0)
-
-#endif /* !_MIPS_VARARGS_H_ */
diff --git a/sys/arch/wgrisc/include/vmparam.h b/sys/arch/wgrisc/include/vmparam.h
deleted file mode 100644
index d9d55fe2eb7..00000000000
--- a/sys/arch/wgrisc/include/vmparam.h
+++ /dev/null
@@ -1,229 +0,0 @@
-/* $OpenBSD: vmparam.h,v 1.1.1.1 1997/02/06 16:02:43 pefo Exp $ */
-/* $NetBSD: vmparam.h,v 1.5 1994/10/26 21:10:10 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: vmparam.h 1.16 91/01/18
- * @(#)vmparam.h 8.2 (Berkeley) 4/22/94
- */
-
-/*
- * Machine dependent constants.
- */
-/*
- * USRTEXT is the start of the user text/data space, while USRSTACK
- * is the top (end) of the user stack.
- */
-#define USRTEXT 0x00400000
-#define USRSTACK 0x80000000 /* Start of user stack */
-
-/*
- * Virtual memory related constants, all in bytes
- */
-#ifndef MAXTSIZ
-#define MAXTSIZ (24*1024*1024) /* max text size */
-#endif
-#ifndef DFLDSIZ
-#define DFLDSIZ (32*1024*1024) /* initial data size limit */
-#endif
-#ifndef MAXDSIZ
-#define MAXDSIZ (32*1024*1024) /* max data size */
-#endif
-#ifndef DFLSSIZ
-#define DFLSSIZ (1024*1024) /* initial stack size limit */
-#endif
-#ifndef MAXSSIZ
-#define MAXSSIZ MAXDSIZ /* max stack size */
-#endif
-
-/*
- * Default sizes of swap allocation chunks (see dmap.h).
- * The actual values may be changed in vminit() based on MAXDSIZ.
- * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024.
- * DMMIN should be at least ctod(1) so that vtod() works.
- * vminit() insures this.
- */
-#define DMMIN 32 /* smallest swap allocation */
-#define DMMAX 4096 /* largest potential swap allocation */
-
-/*
- * Sizes of the system and user portions of the system page table.
- */
-/* SYSPTSIZE IS SILLY; (really number of buffers for I/O) */
-#define SYSPTSIZE 1228
-#define USRPTSIZE 1024
-
-/*
- * PTEs for mapping user space into the kernel for phyio operations.
- * 16 pte's are enough to cover 8 disks * MAXBSIZE.
- */
-#ifndef USRIOSIZE
-#define USRIOSIZE 32
-#endif
-
-/*
- * PTEs for system V style shared memory.
- * This is basically slop for kmempt which we actually allocate (malloc) from.
- */
-#ifndef SHMMAXPGS
-#define SHMMAXPGS 1024 /* 4mb */
-#endif
-
-/*
- * Boundary at which to place first MAPMEM segment if not explicitly
- * specified. Should be a power of two. This allows some slop for
- * the data segment to grow underneath the first mapped segment.
- */
-#define MMSEG 0x200000
-
-/*
- * The size of the clock loop.
- */
-#define LOOPPAGES (maxfree - firstfree)
-
-/*
- * The time for a process to be blocked before being very swappable.
- * This is a number of seconds which the system takes as being a non-trivial
- * amount of real time. You probably shouldn't change this;
- * it is used in subtle ways (fractions and multiples of it are, that is, like
- * half of a ``long time'', almost a long time, etc.)
- * It is related to human patience and other factors which don't really
- * change over time.
- */
-#define MAXSLP 20
-
-/*
- * A swapped in process is given a small amount of core without being bothered
- * by the page replacement algorithm. Basically this says that if you are
- * swapped in you deserve some resources. We protect the last SAFERSS
- * pages against paging and will just swap you out rather than paging you.
- * Note that each process has at least UPAGES+CLSIZE pages which are not
- * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this
- * number just means a swapped in process is given around 25k bytes.
- * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81),
- * so we loan each swapped in process memory worth 100$, or just admit
- * that we don't consider it worthwhile and swap it out to disk which costs
- * $30/mb or about $0.75.
- */
-#define SAFERSS 4 /* nominal ``small'' resident set size
- protected against replacement */
-
-/*
- * DISKRPM is used to estimate the number of paging i/o operations
- * which one can expect from a single disk controller.
- */
-#define DISKRPM 60
-
-/*
- * Klustering constants. Klustering is the gathering
- * of pages together for pagein/pageout, while clustering
- * is the treatment of hardware page size as though it were
- * larger than it really is.
- *
- * KLMAX gives maximum cluster size in CLSIZE page (cluster-page)
- * units. Note that ctod(KLMAX*CLSIZE) must be <= DMMIN in dmap.h.
- * ctob(KLMAX) should also be less than MAXPHYS (in vm_swp.c)
- * unless you like "big push" panics.
- */
-
-#ifdef notdef /* XXX */
-#define KLMAX (4/CLSIZE)
-#define KLSEQL (2/CLSIZE) /* in klust if vadvise(VA_SEQL) */
-#define KLIN (4/CLSIZE) /* default data/stack in klust */
-#define KLTXT (4/CLSIZE) /* default text in klust */
-#define KLOUT (4/CLSIZE)
-#else
-#define KLMAX (1/CLSIZE)
-#define KLSEQL (1/CLSIZE)
-#define KLIN (1/CLSIZE)
-#define KLTXT (1/CLSIZE)
-#define KLOUT (1/CLSIZE)
-#endif
-
-/*
- * KLSDIST is the advance or retard of the fifo reclaim for sequential
- * processes data space.
- */
-#define KLSDIST 3 /* klusters advance/retard for seq. fifo */
-
-/*
- * Paging thresholds (see vm_sched.c).
- * Strategy of 1/19/85:
- * lotsfree is 512k bytes, but at most 1/4 of memory
- * desfree is 200k bytes, but at most 1/8 of memory
- */
-#define LOTSFREE (512 * 1024)
-#define LOTSFREEFRACT 4
-#define DESFREE (200 * 1024)
-#define DESFREEFRACT 8
-
-/*
- * There are two clock hands, initially separated by HANDSPREAD bytes
- * (but at most all of user memory). The amount of time to reclaim
- * a page once the pageout process examines it increases with this
- * distance and decreases as the scan rate rises.
- */
-#define HANDSPREAD (2 * 1024 * 1024)
-
-/*
- * The number of times per second to recompute the desired paging rate
- * and poke the pagedaemon.
- */
-#define RATETOSCHEDPAGING 4
-
-/*
- * Believed threshold (in megabytes) for which interleaved
- * swapping area is desirable.
- */
-#define LOTSOFMEM 2
-
-/*
- * Mach derived constants
- */
-
-/* user/kernel map constants */
-#define VM_MIN_ADDRESS ((vm_offset_t)0x00000000)
-#define VM_MAXUSER_ADDRESS ((vm_offset_t)0x80000000)
-#define VM_MAX_ADDRESS ((vm_offset_t)0x80000000)
-#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)0xC0000000)
-#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)0xFFFFC000)
-
-/* virtual sizes (bytes) for various kernel submaps */
-#define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES)
-#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES)
-#define VM_PHYS_SIZE (USRIOSIZE*CLBYTES)
diff --git a/sys/arch/wgrisc/isa/isa_machdep.h b/sys/arch/wgrisc/isa/isa_machdep.h
deleted file mode 100644
index 843300f0d33..00000000000
--- a/sys/arch/wgrisc/isa/isa_machdep.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* $OpenBSD: isa_machdep.h,v 1.2 1998/06/29 05:47:42 downsj Exp $ */
-
-/*
- * Copyright (c) 1996 Per Fogelstrom
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Per Fogelstrom
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _ISA_MACHDEP_H_
-#define _ISA_MACHDEP_H_
-
-typedef struct wgrisc_isa_bus *isa_chipset_tag_t;
-
-/*
- * I/O macros to access isa bus ports/memory.
- * At the first glance theese macros may seem inefficient.
- * However, the cpu executes an instruction every 7.5ns
- * so the bus is much slower so it doesn't matter, really.
- */
-#define isa_outb(x,y) outb(isa_io_base + (x), y)
-#define isa_inb(x) inb(isa_io_base + (x))
-
-extern int isa_io_base; /* Base address for ISA I/O space */
-extern int isa_mem_base; /* Base address for ISA MEM space */
-
-struct wgrisc_isa_bus {
- void *ic_data;
-
- void (*ic_attach_hook) __P((struct device *, struct device *,
- struct isabus_attach_args *));
- void *(*ic_intr_establish) __P((isa_chipset_tag_t, int, int, int,
- int (*)(void *), void *, char *));
- void (*ic_intr_disestablish) __P((isa_chipset_tag_t, void *));
-};
-
-
-/*
- * Functions provided to machine-independent ISA code.
- */
-#define isa_attach_hook(p, s, a) /* \
- (*(a)->iba_ic->ic_attach_hook)((p), (s), (a)) */
-#define isa_intr_establish(c, i, t, l, f, a, w) \
- (*(c)->ic_intr_establish)((c)->ic_data, (i), (t), (l), (f), (a), (w))
-#define isa_intr_disestablish(c, h) \
- (*(c)->ic_intr_disestablish)((c)->ic_data, (h))
-
-#define __NO_ISA_INTR_CHECK /* FIXME */
-
-/*
- * Interrupt control struct used to control the ICU setup.
- */
-
-struct intrhand {
- struct intrhand *ih_next;
- int (*ih_fun) __P((void *));
- void *ih_arg;
- u_long ih_count;
- int ih_level;
- int ih_irq;
- char *ih_what;
-};
-
-#endif /* _ISA_MACHDEP_H_ */
diff --git a/sys/arch/wgrisc/isa/isabus.c b/sys/arch/wgrisc/isa/isabus.c
deleted file mode 100644
index 6a64a92b85c..00000000000
--- a/sys/arch/wgrisc/isa/isabus.c
+++ /dev/null
@@ -1,350 +0,0 @@
-/* $OpenBSD: isabus.c,v 1.1.1.1 1997/02/06 16:02:42 pefo Exp $ */
-
-/*
- * Copyright (c) 1996 Per Fogelstrom
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/time.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-
-#include <machine/cpu.h>
-#include <machine/pio.h>
-#include <machine/autoconf.h>
-#include <machine/intr.h>
-#include <machine/bus.h>
-
-#include <wgrisc/wgrisc/wgrisctype.h>
-#include <wgrisc/riscbus/riscbus.h>
-
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
-#include <wgrisc/isa/isa_machdep.h>
-
-static int beeping;
-
-struct isabr_softc {
- struct device sc_dv;
- struct wgrisc_isa_bus wgrisc_isa_cs;
- struct abus sc_bus;
-};
-
-/* Definition of the driver for autoconfig. */
-int isabrmatch(struct device *, void *, void *);
-void isabrattach(struct device *, struct device *, void *);
-int isabrprint(void *, const char *);
-
-struct cfattach isabr_ca = {
- sizeof(struct isabr_softc), isabrmatch, isabrattach
-};
-struct cfdriver isabr_cd = {
- NULL, "isabr", DV_DULL, NULL, 0
-};
-
-void *isabr_intr_establish __P((isa_chipset_tag_t, int, int, int,
- int (*)(void *), void *, char *));
-void isabr_intr_disestablish __P((isa_chipset_tag_t, void*));
-int isabr_iointr __P((unsigned int, struct clockframe *));
-
-extern int cputype;
-
-int
-isabrmatch(parent, cfdata, aux)
- struct device *parent;
- void *cfdata;
- void *aux;
-{
- struct cfdata *cf = cfdata;
- struct confargs *ca = aux;
-
- /* Make sure that we're looking for a ISABR. */
- if (strcmp(ca->ca_name, isabr_cd.cd_name) != 0)
- return (0);
-
- return (1);
-}
-
-void
-isabrattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct isabr_softc *sc = (struct isabr_softc *)self;
- struct isabus_attach_args iba;
-
- printf("\n");
-
- /* set up interrupt handlers */
- switch(cputype) {
- case WGRISC9100:
- set_intr(INT_MASK_3 | INT_MASK_5, isabr_iointr, 1);
- break;
- default:
- panic("isabrattach: unkown cputype!");
- }
-
-/*XXX we may remove the abus part of the softc struct... */
- sc->sc_bus.ab_dv = (struct device *)sc;
- sc->sc_bus.ab_type = BUS_ISABR;
-
- sc->wgrisc_isa_cs.ic_intr_establish = isabr_intr_establish;
- sc->wgrisc_isa_cs.ic_intr_disestablish = isabr_intr_disestablish;
-
- iba.iba_busname = "isa";
- iba.iba_iot = (bus_space_tag_t)isa_io_base;
- iba.iba_memt = (bus_space_tag_t)isa_mem_base;
- iba.iba_ic = &sc->wgrisc_isa_cs;
- config_found(self, &iba, isabrprint);
-}
-
-int
-isabrprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
- struct confargs *ca = aux;
-
- if (pnp)
- printf("%s at %s", ca->ca_name, pnp);
- printf(" isa_io_base 0x%lx isa_mem_base 0x%lx", isa_io_base, isa_mem_base);
- return (UNCONF);
-}
-
-/*
- * Interrupt system driver code
- * ============================
- */
-
-int intmask;
-int intrmask[16], intrlevel[16];
-struct intrhand *intrhand[16];
-
-int fakeintr(void *a) {return 0;}
-
-/*
- * Recalculate the interrupt masks from scratch.
- * We could code special registry and deregistry versions of this function that
- * would be faster, but the code would be nastier, and we don't expect this to
- * happen very much anyway.
- */
-void
-intr_calculatemasks()
-{
- int irq, level;
- struct intrhand *q;
-
- /* First, figure out which levels each IRQ uses. */
- for (irq = 0; irq < 16; irq++) {
- register int levels = 0;
- for (q = intrhand[irq]; q; q = q->ih_next)
- levels |= 1 << q->ih_level;
- intrlevel[irq] = levels;
- }
-
- /* Then figure out which IRQs use each level. */
- for (level = 0; level < 5; level++) {
- register int irqs = 0;
- for (irq = 0; irq < 8; irq++)
- if (intrlevel[irq] & (1 << level))
- irqs |= 1 << irq;
- imask[level] = irqs | SIR_ALLMASK;
- }
-
- /*
- * There are tty, network and disk drivers that use free() at interrupt
- * time, so imp > (tty | net | bio).
- */
- imask[IPL_IMP] |= imask[IPL_TTY] | imask[IPL_NET] | imask[IPL_BIO];
-
- /*
- * Enforce a hierarchy that gives slow devices a better chance at not
- * dropping data.
- */
- imask[IPL_TTY] |= imask[IPL_NET] | imask[IPL_BIO];
- imask[IPL_NET] |= imask[IPL_BIO];
-
- /*
- * These are pseudo-levels.
- */
- imask[IPL_NONE] = 0x00000000;
- imask[IPL_HIGH] = 0xffffffff;
-
- /* And eventually calculate the complete masks. */
- for (irq = 0; irq < 16; irq++) {
- register int irqs = 1 << irq;
- for (q = intrhand[irq]; q; q = q->ih_next)
- irqs |= imask[q->ih_level];
- intrmask[irq] = irqs | SIR_ALLMASK;
- }
-
- /* Lastly, determine which IRQs are actually in use. */
- {
- register int irqs = 0;
- for (irq = 0; irq < 16; irq++)
- if (intrhand[irq])
- irqs |= 1 << irq;
- intmask = ~irqs;
- }
-}
-
-/*
- * Establish a ISA bus interrupt.
- */
-void *
-isabr_intr_establish(ic, irq, type, level, ih_fun, ih_arg, ih_what)
- isa_chipset_tag_t ic;
- int irq;
- int type;
- int level;
- int (*ih_fun) __P((void *));
- void *ih_arg;
- char *ih_what;
-{
- struct intrhand **p, *q, *ih;
- static struct intrhand fakehand = {NULL, fakeintr};
- extern int cold;
-
- /* no point in sleeping unless someone can free memory. */
- ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK);
- if (ih == NULL)
- panic("isa_intr_establish: can't malloc handler info");
-
- /*
- * Figure out where to put the handler.
- * This is O(N^2), but we want to preserve the order, and N is
- * generally small.
- */
- for (p = &intrhand[irq]; (q = *p) != NULL; p = &q->ih_next)
- ;
-
- /*
- * Actually install a fake handler momentarily, since we might be doing
- * this with interrupts enabled and don't want the real routine called
- * until masking is set up.
- */
- fakehand.ih_level = level;
- *p = &fakehand;
-
- switch(irq) {
- case 5:
- break;
- case 6:
- intmask |= R3715_ISAIRQ_6;
- break;
- case 7:
- intmask |= R3715_ISAIRQ_7;
- break;
- case 9:
- intmask |= R3715_ISAIRQ_9;
- break;
- case 10:
- intmask |= R3715_ISAIRQ_10;
- break;
- case 11:
- intmask |= R3715_ISAIRQ_11;
- break;
- default:
- printf("non available irq '%d' requested\n",irq);
- panic("isa_intr_establish: can't establish");
- }
- out32(R3715_INT_MASK, intmask);
-
- /*
- * Poke the real handler in now.
- */
- ih->ih_fun = ih_fun;
- ih->ih_arg = ih_arg;
- ih->ih_count = 0;
- ih->ih_next = NULL;
- ih->ih_level = level;
- ih->ih_irq = irq;
- ih->ih_what = ih_what;
- *p = ih;
-
- return (ih);
-}
-
-void
-isabr_intr_disestablish(ic, arg)
- isa_chipset_tag_t ic;
- void *arg;
-{
-}
-
-/*
- * Process an interrupt from the ISA bus.
- */
-int
-isabr_iointr(mask, cf)
- unsigned mask;
- struct clockframe *cf;
-{
- struct intrhand *ih;
- int isa_vector;
- int cause;
-
- do {
- switch(cputype) {
- case WGRISC9100:
- cause = in32(R3715_INT_CAUSE) & in32(R3715_INT_MASK);
- if(mask & INT_MASK_5) {
- isa_vector = 5;
- mask = 0; /* Do this only once */
- }
- else if(cause & R3715_ISAIRQ_11)
- isa_vector = 11;
- else if(cause & R3715_ISAIRQ_7)
- isa_vector = 7;
- else if(cause & R3715_ISAIRQ_6)
- isa_vector = 6;
- else if(cause & R3715_ISAIRQ_9)
- isa_vector = 9;
- else if(cause & R3715_ISAIRQ_10)
- isa_vector = 10;
- else
- isa_vector = -1;
- break;
- }
-
- ih = intrhand[isa_vector];
- while(ih) {
- (*ih->ih_fun)(ih->ih_arg);
- ih = ih->ih_next;
- }
- } while(isa_vector != -1);
-
- return(~0); /* Dont reenable */
-}
-
diff --git a/sys/arch/wgrisc/riscbus/riscbus.c b/sys/arch/wgrisc/riscbus/riscbus.c
deleted file mode 100644
index 70dfdc5f365..00000000000
--- a/sys/arch/wgrisc/riscbus/riscbus.c
+++ /dev/null
@@ -1,320 +0,0 @@
-/* $OpenBSD: riscbus.c,v 1.4 1999/01/11 05:12:10 millert Exp $ */
-
-/*
- * Copyright (c) 1996 Per Fogelstrom
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/device.h>
-
-#include <machine/cpu.h>
-#include <machine/pio.h>
-#include <machine/autoconf.h>
-
-#include <wgrisc/riscbus/riscbus.h>
-#include <wgrisc/wgrisc/wgrisctype.h>
-
-struct riscbus_softc {
- struct device sc_dv;
- struct abus sc_bus;
- struct riscbus_dev *sc_devs;
-};
-
-/* Definition of the driver for autoconfig. */
-int riscbusmatch(struct device *, void *, void *);
-void riscbusattach(struct device *, struct device *, void *);
-int riscbusprint(void *, const char *);
-
-struct cfattach riscbus_ca = {
- sizeof(struct riscbus_softc), riscbusmatch, riscbusattach
-};
-struct cfdriver riscbus_cd = {
- NULL, "riscbus", DV_DULL, NULL, 0
-};
-
-void riscbus_intr_establish __P((struct confargs *, int (*)(void *), void *));
-void riscbus_intr_disestablish __P((struct confargs *));
-caddr_t riscbus_cvtaddr __P((struct confargs *));
-int riscbus_matchname __P((struct confargs *, char *));
-int riscbus_iointr __P((unsigned, struct clockframe *));
-int riscbus_clkintr __P((unsigned, struct clockframe *));
-
-extern int cputype;
-
-/*
- * Interrupt dispatch table.
- */
-struct riscbus_int_desc int_table[] = {
- {0, riscbus_intrnull, (void *)NULL, 0 }, /* 0 */
- {0, riscbus_intrnull, (void *)NULL, 0 }, /* 1 */
- {0, riscbus_intrnull, (void *)NULL, 0 }, /* 2 */
- {0, riscbus_intrnull, (void *)NULL, 0 }, /* 3 */
- {0, riscbus_intrnull, (void *)NULL, 0 }, /* 4 */
- {0, riscbus_intrnull, (void *)NULL, 0 }, /* 5 */
- {0, riscbus_intrnull, (void *)NULL, 0 }, /* 6 */
- {0, riscbus_intrnull, (void *)NULL, 0 }, /* 7 */
- {0, riscbus_intrnull, (void *)NULL, 0 }, /* 8 */
- {0, riscbus_intrnull, (void *)NULL, 0 }, /* 9 */
- {0, riscbus_intrnull, (void *)NULL, 0 }, /* 10 */
- {0, riscbus_intrnull, (void *)NULL, 0 }, /* 11 */
- {0, riscbus_intrnull, (void *)NULL, 0 }, /* 12 */
- {0, riscbus_intrnull, (void *)NULL, 0 }, /* 13 */
- {0, riscbus_intrnull, (void *)NULL, 0 }, /* 14 */
- {0, riscbus_intrnull, (void *)NULL, 0 }, /* 15 */
-};
-
-struct riscbus_dev {
- struct confargs ps_ca;
- u_int ps_mask;
- intr_handler_t ps_handler;
- void *ps_base;
-};
-#ifdef WGRISC9100
-struct riscbus_dev wgrisc9100_cpu[] = {
- {{ "dp8571rtc", 0, 0, },
- INT_MASK_2, riscbus_intrnull, (void *)RISC_RTC, },
- {{ "sonic", 1, 0, },
- INT_MASK_4, riscbus_intrnull, (void *)RISC_SONIC, },
- {{ "asc", 2, 0, },
- INT_MASK_1, riscbus_intrnull, (void *)RISC_SCSI, },
- {{ "com", 3, NULL, },
- INT_MASK_5, riscbus_intrnull, (void *)RISC_COM0, },
- {{ "com", 4, 0, },
- INT_MASK_5, riscbus_intrnull, (void *)RISC_COM1, },
- {{ "com", 5, 0, },
- INT_MASK_5, riscbus_intrnull, (void *)RISC_COM2, },
- {{ "com", 6, 0, },
- INT_MASK_5, riscbus_intrnull, (void *)RISC_COM3, },
- {{ "fl", 7, 0, },
- 0, NULL, (void *)NULL, },
- {{ NULL, -1, NULL, },
- 0, NULL, (void *)NULL, },
-};
-#define NUM_RISC_DEVS (sizeof(wgrisc9100_cpu) / sizeof(struct riscbus_dev))
-#endif
-
-struct riscbus_dev *riscbus_cpu_devs[] = {
- NULL, /* 0: Unused */
-#ifdef WGRISC9100
- wgrisc9100_cpu, /* 1: WGRISC 9100 R3081 board */
-#else
- NULL,
-#endif
-};
-int nriscbus_cpu_devs = sizeof riscbus_cpu_devs / sizeof riscbus_cpu_devs[0];
-
-int local_int_mask = 0; /* Local interrupt enable mask */
-
-int
-riscbusmatch(parent, cfdata, aux)
- struct device *parent;
- void *cfdata;
- void *aux;
-{
- struct cfdata *cf = cfdata;
- struct confargs *ca = aux;
-
- /* Make sure that we're looking for a RISC bus. */
- if (strcmp(ca->ca_name, riscbus_cd.cd_name) != 0)
- return (0);
-
- /* Make sure that unit exists. */
- if (cf->cf_unit != 0 ||
- cputype > nriscbus_cpu_devs || riscbus_cpu_devs[cputype] == NULL)
- return (0);
-
- return (1);
-}
-
-void
-riscbusattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct riscbus_softc *sc = (struct riscbus_softc *)self;
- struct confargs *nca;
- int i;
-
- printf("\n");
-
- /* keep our CPU device description handy */
- sc->sc_devs = riscbus_cpu_devs[cputype];
-
- /* set up interrupt handlers */
- set_intr(INT_MASK_1 | INT_MASK_4 | INT_MASK_5, riscbus_iointr, 2);
-
- sc->sc_bus.ab_dv = (struct device *)sc;
- sc->sc_bus.ab_type = BUS_RISC;
- sc->sc_bus.ab_intr_establish = riscbus_intr_establish;
- sc->sc_bus.ab_intr_disestablish = riscbus_intr_disestablish;
- sc->sc_bus.ab_cvtaddr = riscbus_cvtaddr;
- sc->sc_bus.ab_matchname = riscbus_matchname;
-
- /* Try to configure each attached device */
- for (i = 0; sc->sc_devs[i].ps_ca.ca_slot >= 0; i++) {
-
- if(sc->sc_devs[i].ps_ca.ca_name == NULL)
- continue; /* Empty slot */
-
- nca = &sc->sc_devs[i].ps_ca;
- nca->ca_bus = &sc->sc_bus;
-
- /* Tell the autoconfig machinery we've found the hardware. */
- config_found(self, nca, riscbusprint);
- }
-}
-
-int
-riscbusprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
- struct confargs *ca = aux;
-
- if (pnp)
- printf("%s at %s", ca->ca_name, pnp);
- printf(" slot %ld offset 0x%lx", ca->ca_slot, ca->ca_offset);
- return (UNCONF);
-}
-
-caddr_t
-riscbus_cvtaddr(ca)
- struct confargs *ca;
-{
- struct riscbus_softc *sc = riscbus_cd.cd_devs[0];
-
- return(sc->sc_devs[ca->ca_slot].ps_base + ca->ca_offset);
-
-}
-
-void
-riscbus_intr_establish(ca, handler, val)
- struct confargs *ca;
- intr_handler_t handler;
- void *val;
-{
- struct riscbus_softc *sc = riscbus_cd.cd_devs[0];
-
- int slot;
-
- slot = ca->ca_slot;
-
- if(int_table[slot].int_mask != 0) {
- panic("riscbus intr already set");
- }
- else {
- int_table[slot].int_mask = sc->sc_devs[slot].ps_mask;
- local_int_mask |= int_table[slot].int_mask;
- int_table[slot].int_hand = handler;
- int_table[slot].param = val;
- }
- if(slot == 0) { /* Slot 0 is special, clock */
- set_intr(int_table[0].int_mask, riscbus_clkintr, 0);
- }
-}
-
-void
-riscbus_intr_disestablish(ca)
- struct confargs *ca;
-{
- struct riscbus_softc *sc = riscbus_cd.cd_devs[0];
-
- int slot;
-
- slot = ca->ca_slot;
- if(slot = 0) { /* Slot 0 is special, clock */
- }
- else {
- local_int_mask &= ~int_table[slot].int_mask;
- int_table[slot].int_mask = 0;
- int_table[slot].int_hand = riscbus_intrnull;
- int_table[slot].param = (void *)NULL;
- }
-}
-
-int
-riscbus_matchname(ca, name)
- struct confargs *ca;
- char *name;
-{
-
- return (strcmp(name, ca->ca_name) == 0);
-}
-
-int
-riscbus_intrnull(val)
- void *val;
-{
- panic("uncaught RISCBUS interrupt for slot %d", val);
-}
-
-/*
- * Handle riscbus i/o interrupt the generic way.
- */
-int
-riscbus_iointr(mask, cf)
- unsigned mask;
- struct clockframe *cf;
-{
- int i;
-
- for(i = 0; i < NUM_RISC_DEVS; i++) {
- if(mask & int_table[i].int_mask)
- (*int_table[i].int_hand)(int_table[i].param);
- }
- return(~0); /* Dont reenable */
-}
-
-/*
- * Handle riscbus interval clock interrupt.
- */
-int
-riscbus_clkintr(mask, cf)
- unsigned mask;
- struct clockframe *cf;
-{
- int temp;
-
- switch (cputype) {
-
- case WGRISC9100:
- if(dpclock_interrupt())
- hardclock(cf);
- break;
- }
-
- /* Re-enable clock interrupts */
- splx(int_table[0].int_mask | SR_INT_ENAB);
-
- return(~int_table[0].int_mask); /* Keep clock interrupts enabled */
-}
-
diff --git a/sys/arch/wgrisc/riscbus/riscbus.h b/sys/arch/wgrisc/riscbus/riscbus.h
deleted file mode 100644
index 5b8bb362c97..00000000000
--- a/sys/arch/wgrisc/riscbus/riscbus.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/* $OpenBSD: riscbus.h,v 1.2 1997/05/11 16:26:03 pefo Exp $ */
-
-/*
- * Copyright (c) 1996 Per Fogelstrom
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#ifndef RISCBUS_H
-#define RISCBUS_H 1
-
-#define RISC_PHYS_MIN 0x00000000 /* 256 Meg */
-#define RISC_PHYS_MAX 0x01ffffff
-
-/*
- * Memory map
- */
-
-#define RISC_PHYS_MEMORY_START 0x00000000
-#define RISC_PHYS_MEMORY_END 0x01ffffff /* 256 Meg in 8 slots */
-
-#define RISC_SRAM_START 0xbfb00000 /* Static ram */
-
-/*
- * I/O map
- */
-
-#define RISC_ISA_IO_BASE 0xac000000 /* ISA I/O base adderss */
-#define RISC_ISA_MEM_BASE 0xad000000 /* ISA MEM base adderss */
-#define RISC_LOCAL_IO_BASE 0xae000000 /* I/O Base address */
-
-#define RISC_COM0 0xae400000 /* 16550 */
-#define RISC_COM1 0xae410000 /* 16550 */
-#define RISC_COM2 0xae420000 /* 16550 */
-#define RISC_COM3 0xae430000 /* 16550 */
-#define RISC_SCSI 0xae440000 /* AMD53C94 */
-#define RISC_RTC 0xae450000 /* DP8571 */
-#define RISC_SONIC 0xae460000 /* DP83932 */
-#define RISC_SONIC_SRAM 0xae470000 /* 2 * 32KB 70ns sram */
-
-#define RISC_CTRL1 0xae800000 /* Watchdog control */
-#define RISC_CTRL2 0xae810000 /* System control */
-#define RISC_STATUS 0xae820000 /* System status */
-#define RISC_FLASH_CTRL 0xae840000 /* Flash */
-#define RISC_FLASH_WRITE 0xae850000 /* Flash */
-#define RISC_FLASH_READ 0xae860000 /* Flash */
-#define RISC_LEDS 0xae870000 /* System LEDS */
-
-/*
- * I/O map of R3715 chip.
- */
-#define R3715_ROM_CONF 0xbd000000 /* Rom config reg */
-#define R3715_PIO_VAL 0xbd000040 /* PIO value reg */
-#define R3715_PIO_CTRL 0xbd000044 /* PIO control reg */
-#define R3715_PIO_READ 0xbd00005c /* PIO read (pin) reg */
-#define R3715_TC_VAL 0xbd000048 /* Timer/Counter value reg */
-#define R3715_TC_CTRL 0xbd00004c /* Timer/Counter control reg */
-#define R3715_INT_CAUSE 0xbd000050 /* R3715 Interrupt cause */
-#define R3715_INT_MASK 0xbd000054 /* R3715 Interrupt mask */
-#define R3715_INT_WRITE 0xbd000060 /* R3715 Interrupt write */
-#define R3715_DRAM_CTRL 0xbd000058 /* R3715 DRAM Control */
-#define R3715_DMA_ADR0 0xbd000080 /* R3715 DMA Address 0 */
-#define R3715_DMA_ADR1 0xbd000084 /* R3715 DMA Address 1 */
-#define R3715_DMA_CNT0 0xbd000090 /* R3715 DMA Size count 0 */
-#define R3715_DMA_CNT1 0xbd000044 /* R3715 DMA Size count 1 */
-#define R3715_IO_TIMING 0xbd0000a0 /* R3715 I/O Timing control */
-
-/*
- * R3715 Interrupt control register bits.
- */
-#define R3715_ISAIRQ_11 0x00100000
-#define R3715_ISAIRQ_7 0x00200000
-#define R3715_ISAIRQ_6 0x00400000
-#define R3715_ISAIRQ_9 0x00800000
-#define R3715_ISAIRQ_10 0x01000000
-#define R3715_DSPINT 0x02000000
-#define R3715_TIMINT 0x00000010
-#define R3715_DMA_INT0 0x00000020
-#define R3715_DMA_INT1 0x00000040
-
-#ifndef _LOCORE
-/*
- * Interrupt vector descriptor for device on risc bus.
- */
-struct riscbus_int_desc {
- int int_mask; /* Mask to call handler at */
- intr_handler_t int_hand; /* Interrupt handler */
- void *param; /* Parameter to send to handler */
- int spl_mask; /* Spl mask for interrupt */
-};
-
-int riscbus_intrnull __P((void *));
-#endif /* _LOCORE */
-#endif /* RISCBUS_H */
diff --git a/sys/arch/wgrisc/stand/Makefile b/sys/arch/wgrisc/stand/Makefile
deleted file mode 100644
index 9cef7d5d895..00000000000
--- a/sys/arch/wgrisc/stand/Makefile
+++ /dev/null
@@ -1,77 +0,0 @@
-# $NetBSD: Makefile,v 1.5 1995/01/18 06:53:36 mellon Exp $
-# @(#)Makefile 8.3 (Berkeley) 2/16/94
-
-DESTDIR=
-STAND= ../../stand
-#VPATH= ${STAND}
-
-# RELOC=80200000 allows for boot prog up to 1D0000 (1900544) bytes long
-RELOC= 80200000
-
-S= ../../..
-INCLUDES= -I. -I$S/arch -I$S -I$S/lib/libsa
-CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL -Dwgrisc
-CDIAGFLAGS= -Werror -Wall -Wno-uninitialized -Wno-format
-
-
-DEFS= -DSTANDALONE -DDEBUG
-CFLAGS= ${DEBUG} -O2 ${CDIAGFLAGS} -mno-abicalls -mips1 -mcpu=r3000
-AFLAGS= -O2 ${INCPATH} ${DEFS} -DLOCORE
-
-### find out what to use for libkern
-.include "$S/lib/libkern/Makefile.inc"
-LIBKERN= ${KERNLIB}
-
-.include "$S/lib/libsa/Makefile.inc"
-
-# not yet: need to write libsa/Makefile.inc first
-LIBS= ${KERNLIB} ${SALIB}
-
-DRIVERS= rz.c
-SRCS= ${DRIVERS}
-#STUFF= callvec.c devopen.c getenv.c gets.c strcmp.c
-STUFF=
-
-ALL= boot
-
-.s.o:
- ${CPP} -E ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \
- ${AS} -o ${.TARGET}
-
-all: ${ALL}
-
-boot: ${LIBS}
-
-#libsa/libsa.a::
-# cd libsa; make
-
-${.OBJDIR}/libdrive.a: ${DRIVERS:.c=.o}
- ar crv $@ $?
- ranlib $@
-
-# depend on DEFS
-
-
-# bootable from real disks
-
-boot: start.o boot.o filesystem.o ${LIBS}
- ld -N -Ttext ${RELOC} -e __start start.o boot.o filesystem.o ${LIBS} -o boot.elf
- elf2ecoff boot.elf boot
-
-start.o: ${.CURDIR}/start.S
-
-mkboot: ${.CURDIR}/mkboot.c
- ${CC} ${CFLAGS} -o mkboot ${.CURDIR}/mkboot.c
-
-# utilities
-
-clean::
- rm -f .depend *.o *.exe *.i errs make.out core*
- rm -f a.out ${ALL}
- rm -f libdrive.a
- cd libsa; make cleandir
-
-install:
-
-.include <bsd.dep.mk>
-.include <bsd.obj.mk>
diff --git a/sys/arch/wgrisc/stand/Makefile.inc b/sys/arch/wgrisc/stand/Makefile.inc
deleted file mode 100644
index 6134f2b753e..00000000000
--- a/sys/arch/wgrisc/stand/Makefile.inc
+++ /dev/null
@@ -1,21 +0,0 @@
-# $OpenBSD: Makefile.inc,v 1.2 1997/07/21 06:58:11 pefo Exp $
-
-CPPFLAGS+=-Wall -Werror -I. -Imachine
-CPPFLAGS+=-D_STANDALONE -DSTRIPPED -DALLOC_FIRST_FIT -DNO_SYM_LINKS
-CFLAGS+=-O2 -mno-abicalls -mips1 -mcpu=r3000
-BOOTREL=0x3000
-BOOTMAGIC=0xdeadbeef
-
-.if exists(${SADIR}/libsa/obj)
-LIBSA=${SADIR}/libsa/obj/libsa.a
-.else
-LIBSA=${SADIR}/libsa/libsa.a
-.endif
-.if exists(${SADIR}/libz/obj)
-LIBZ=${SADIR}/libz/obj/libz.a
-.else
-LIBZ=${SADIR}/libz/libz.a
-.endif
-
-BINDIR= /usr/mdec
-
diff --git a/sys/arch/wgrisc/stand/boot/Makefile b/sys/arch/wgrisc/stand/boot/Makefile
deleted file mode 100644
index 06c3d12b698..00000000000
--- a/sys/arch/wgrisc/stand/boot/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 1997/07/21 06:58:11 pefo Exp $
-
-PROG=boot
-SADIR=${.CURDIR}/..
-SRCS=start.S boot.c filesystem.c conf.c sd.c fl.c
-CFLAGS+=$(SACFLAGS) -I${.CURDIR}/../../../../lib/libsa -I${.CURDIR}/../libsa
-CFLAGS+=-D__INTERNAL_LIBSA_CREAD
-
-LD=ld
-LDFLAGS+= -T ld.script -x -e __start
-LDADD= ${LIBSA}
-
-all: machine-links boot.bin
-
-machine-links:
- @rm -f machine wgrisc
- @ln -fs ${.CURDIR}/../.. wgrisc
- @ln -fs ${.CURDIR}/../../include machine
-
-${PROG}: $(OBJS) $(LDADD)
- $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LDADD)
-
-${PROG}.bin: ${PROG}
- cp ${PROG} ${PROG}.tmp
- strip -s ${PROG}.tmp
- dd if=${PROG}.tmp of=${PROG}.bin bs=512 skip=8 count=1
- dd if=/dev/zero of=${PROG}.bin bs=512 seek=1 count=1
- dd if=${PROG}.tmp of=${PROG}.bin bs=512 skip=9 seek=2 count=14
- rm ${PROG}.tmp
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/wgrisc/stand/boot/boot.c b/sys/arch/wgrisc/stand/boot/boot.c
deleted file mode 100644
index 2e7cf0742ff..00000000000
--- a/sys/arch/wgrisc/stand/boot/boot.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $OpenBSD: boot.c,v 1.2 1997/07/21 06:58:12 pefo Exp $ */
-
-/*
- * Copyright (c) 1997 Per Fogelstrom
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <sys/exec.h>
-#include <sys/exec_elf.h>
-#include <stand.h>
-#include <errno.h>
-
-
-void gets __P((char *));
-ssize_t read __P((int, void *, size_t));
-int close __P((int));
-void prom_write __P((int, char *, int));
-
-void main __P((int, char **));
-int loadfile __P((char *));
-/*
- */
-void
-main(argc, argv)
- int argc;
- char **argv;
-{
-static char boot[] = {"Boot:"};
- char *cp = boot;
- int ask, entry;
- char line[1024];
-
- ask = 1;
-
- if(strcmp(argv[0], "man") != 0) {
- cp = argv[0];
- ask = 0;
- }
- while(1) {
- do {
- printf("%s\n", cp);
- if (ask) {
- gets(line);
- cp = line;
- argv[0] = cp;
- argc = 1;
- }
- } while(ask && line[0] == '\0');
-
- entry = loadfile(cp);
- if (entry != -1) {
- ((void (*)())entry)(argc, argv, 0, 0);
- }
- ask = 1;
- cp = boot;
- }
-}
-
-/*
- * Open 'filename', read in program and return the entry point or -1 if error.
- */
-int
-loadfile(fname)
- register char *fname;
-{
- int fd, i;
- Elf32_Ehdr eh;
- Elf32_Phdr *ph;
- u_long phsize;
- char *errs = 0;
-
- if ((fd = oopen(fname, 0)) < 0) {
- errs="open(%s) err: %d\n";
- goto err;
- }
-
- /* read the elf header */
- if(oread(fd, (char *)&eh, sizeof(eh)) != sizeof(eh)) {
- goto serr;
- }
-
- phsize = eh.e_phnum * sizeof(Elf32_Phdr);
- ph = (Elf32_Phdr *) alloc(phsize);
- olseek(fd, eh.e_phoff, 0);
- if(oread(fd, (char *)ph, phsize) != phsize) {
- goto serr;
- }
-
- for(i = 0; i < eh.e_phnum; i++, ph++) {
- if(ph->p_type == PT_LOAD) {
- olseek(fd, ph->p_offset, 0);
- if(oread(fd, (char *)ph->p_paddr, ph->p_filesz) != ph->p_filesz) {
- goto serr;
- }
- }
- }
- return(eh.e_entry);
-serr:
- errs = "rd(%s) sz err\n";
-err:
- printf(errs, fname, errno);
- return (-1);
-}
-
diff --git a/sys/arch/wgrisc/stand/boot/conf.c b/sys/arch/wgrisc/stand/boot/conf.c
deleted file mode 100644
index 3c991b8edbe..00000000000
--- a/sys/arch/wgrisc/stand/boot/conf.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $OpenBSD: conf.c,v 1.2 1997/07/21 06:58:12 pefo Exp $ */
-
-/*
- * Copyright (c) 1997 Per Fogelstrom
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-#include <stand.h>
-
-int errno;
-
-extern void nullsys();
-extern int nodev();
-extern int noioctl();
-
-int sdstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
-int sdopen __P((struct open_file *, ...));
-int sdclose __P((struct open_file *));
-
-int flstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
-int flopen __P((struct open_file *, ...));
-int flclose __P((struct open_file *));
-
-#define sdioctl noioctl
-#define flioctl noioctl
-
-struct devsw devsw[] = {
- { "sd", sdstrategy, sdopen, sdclose, sdioctl }, /*0*/
- { "fl", flstrategy, flopen, flclose, flioctl }, /*1*/
-};
-
-int ndevs = (sizeof(devsw)/sizeof(devsw[0]));
diff --git a/sys/arch/wgrisc/stand/boot/filesystem.c b/sys/arch/wgrisc/stand/boot/filesystem.c
deleted file mode 100644
index b35709b9ad2..00000000000
--- a/sys/arch/wgrisc/stand/boot/filesystem.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* $NetBSD: filesystem.c,v 1.2 1995/02/16 02:33:05 cgd Exp $ */
-
-/*
- * Copyright (c) 1993 Philip A. Nelson.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Philip A. Nelson.
- * 4. The name of Philip A. Nelson may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY PHILIP NELSON ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL PHILIP NELSON BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * filesystem.c
- */
-
-#include <stand.h>
-#include <ufs.h>
-
-struct fs_ops file_system[] = {
- { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat },
-};
-
-int nfsys = sizeof(file_system)/sizeof(struct fs_ops);
-
diff --git a/sys/arch/wgrisc/stand/boot/fl.c b/sys/arch/wgrisc/stand/boot/fl.c
deleted file mode 100644
index 0b67ab7af00..00000000000
--- a/sys/arch/wgrisc/stand/boot/fl.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* $OpenBSD: fl.c,v 1.2 2001/01/25 03:50:49 todd Exp $ */
-
-/*
- * Copyright (c) 1997 Per Fogelstrom
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <stdarg.h>
-
-#include <stand.h>
-#include <sys/param.h>
-
-int prom_seek __P((int, long, int));
-int disk_read __P((int, char *, int, int));
-int disk_open __P((char *, int));
-
-struct fl_softc {
- int sc_fd; /* PROM file id */
-};
-
-int
-flstrategy(devdata, rw, bn, reqcnt, addr, cnt)
- void *devdata;
- int rw;
- daddr_t bn;
- u_int reqcnt;
- char *addr;
- u_int *cnt; /* out: number of bytes transferred */
-{
- struct fl_softc *sc = (struct fl_softc *)devdata;
- int s;
- long offset;
-
- offset = bn * DEV_BSIZE;
-
- s = disk_read(sc->sc_fd, addr, offset, reqcnt);
- if (s < 0)
- return (-s);
- *cnt = s;
- return (0);
-}
-
-/*
- * We only deal with flash 0 here. We need to be small.
- */
-int
-flopen(struct open_file *f, ...)
-{
- struct fl_softc *sc;
- int fd;
- static char device[] = "fl(0)";
-
- fd = disk_open(device, 0);
- if (fd < 0) {
- return (ENXIO);
- }
-
- sc = alloc(sizeof(struct fl_softc));
- f->f_devdata = (void *)sc;
-
- sc->sc_fd = fd;
-
- return (0);
-}
-
-int
-flclose(f)
- struct open_file *f;
-{
-#ifdef FANCY
- free(f->f_devdata, sizeof(struct fl_softc));
- f->f_devdata = (void *)0;
-#endif
- return (0);
-}
diff --git a/sys/arch/wgrisc/stand/boot/ld.script b/sys/arch/wgrisc/stand/boot/ld.script
deleted file mode 100644
index f81b4908653..00000000000
--- a/sys/arch/wgrisc/stand/boot/ld.script
+++ /dev/null
@@ -1,74 +0,0 @@
-OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips",
- "elf32-littlemips")
-OUTPUT_ARCH(mips)
-ENTRY(_start)
-SECTIONS
-{
- /* Read-only sections, merged into text segment: */
- . = 0x80200000;
- .text :
- {
- _ftext = . ;
- *(.text)
- *(.rodata)
- *(.rodata1)
- *(.reginfo)
- *(.init)
- *(.stub)
- /* .gnu.warning sections are handled specially by elf32.em. */
- *(.gnu.warning)
- } =0
- _etext = .;
- PROVIDE (etext = .);
- .fini : { *(.fini) } =0
- .data :
- {
- _fdata = . ;
- *(.data)
- CONSTRUCTORS
- }
- .data1 : { *(.data1) }
- .ctors : { *(.ctors) }
- .dtors : { *(.dtors) }
- _gp = ALIGN(16) + 0x7ff0;
- .got :
- {
- *(.got.plt) *(.got)
- }
- /* We want the small data sections together, so single-instruction offsets
- can access them all, and initialized data all before uninitialized, so
- we can shorten the on-disk segment size. */
- .sdata : { *(.sdata) }
- .lit8 : { *(.lit8) }
- .lit4 : { *(.lit4) }
- _edata = .;
- PROVIDE (edata = .);
- __bss_start = .;
- _fbss = .;
- .sbss : { *(.sbss) *(.scommon) }
- .bss :
- {
- *(.dynbss)
- *(.bss)
- *(COMMON)
- }
- _end = . ;
- PROVIDE (end = .);
- /* These are needed for ELF backends which have not yet been
- converted to the new style linker. */
- .stab 0 : { *(.stab) }
- .stabstr 0 : { *(.stabstr) }
- /* DWARF debug sections.
- Symbols in the .debug DWARF section are relative to the beginning of the
- section so we begin .debug at 0. It's not clear yet what needs to happen
- for the others. */
- .debug 0 : { *(.debug) }
- .debug_srcinfo 0 : { *(.debug_srcinfo) }
- .debug_aranges 0 : { *(.debug_aranges) }
- .debug_pubnames 0 : { *(.debug_pubnames) }
- .debug_sfnames 0 : { *(.debug_sfnames) }
- .line 0 : { *(.line) }
- /* These must appear regardless of . */
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
-}
diff --git a/sys/arch/wgrisc/stand/boot/sd.c b/sys/arch/wgrisc/stand/boot/sd.c
deleted file mode 100644
index a89abe8704b..00000000000
--- a/sys/arch/wgrisc/stand/boot/sd.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/* $NetBSD: sd.c,v 1.6 1995/06/28 10:22:35 jonathan Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)sd.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <stdarg.h>
-
-#include <stand.h>
-#include <sys/param.h>
-#include <sys/disklabel.h>
-
-int prom_seek __P((int, long, int));
-int disk_read __P((int, char *, int, int));
-int disk_open __P((char *, int));
-
-struct sd_softc {
- int sc_fd; /* PROM file id */
- int sc_part; /* disk partition number */
- struct disklabel sc_label; /* disk label for this disk */
-};
-
-int
-sdstrategy(devdata, rw, bn, reqcnt, addr, cnt)
- void *devdata;
- int rw;
- daddr_t bn;
- u_int reqcnt;
- char *addr;
- u_int *cnt; /* out: number of bytes transferred */
-{
- struct sd_softc *sc = (struct sd_softc *)devdata;
- struct partition *pp = &sc->sc_label.d_partitions[sc->sc_part];
- int s;
- long offset;
-
- offset = (pp->p_offset + bn) * DEV_BSIZE;
-
- s = disk_read(sc->sc_fd, addr, offset, reqcnt);
- if (s < 0)
- return (-s);
- *cnt = s;
- return (0);
-}
-
-int
-sdopen(struct open_file *f, ...)
-{
- int ctlr, unit, part;
-
- struct sd_softc *sc;
- struct disklabel *lp;
- int i, fd;
- char *msg = "rd err";
- char buf[DEV_BSIZE];
- int cnt;
- daddr_t labelsector;
- static char device[] = "sd(0)";
- va_list ap;
-
- va_start(ap, f);
-
- ctlr = va_arg(ap, int);
- unit = va_arg(ap, int);
- part = va_arg(ap, int);
- if (unit >= 7 || part >= 16)
- return (ENXIO);
-
- device[3] = unit + '0';
- fd = disk_open(device, 0);
- if (fd < 0) {
- return (ENXIO);
- }
-
- sc = alloc(sizeof(struct sd_softc));
- bzero(sc, sizeof(struct sd_softc));
- f->f_devdata = (void *)sc;
-
- sc->sc_fd = fd;
- sc->sc_part = part;
-
- lp = &sc->sc_label;
- lp->d_secsize = DEV_BSIZE;
- lp->d_secpercyl = 1;
- lp->d_npartitions = MAXPARTITIONS;
- lp->d_partitions[part].p_offset = 0;
- lp->d_partitions[part].p_size = 0x7fff0000;
-
- labelsector = LABELSECTOR;
-
-#ifdef USE_DOSBBSECTOR
- /* First check for any DOS partition table */
- i = sdstrategy(sc, F_READ, (daddr_t)DOSBBSECTOR, DEV_BSIZE, buf, &cnt);
- if (!(i || cnt != DEV_BSIZE)) {
- struct dos_partition dp, *dp2;
- bcopy(buf + DOSPARTOFF, &dp, NDOSPART * sizeof(dp));
- for (dp2=&dp, i=0; i < NDOSPART; i++, dp2++) {
- if (dp2->dp_size) {
- if((dp2->dp_typ == DOSPTYP_OPENBSD) ||
- (dp2->dp_typ == DOSPTYP_FREEBSD)) {
- labelsector += dp2->dp_start;
- break;
- }
- }
- }
- }
- else {
- goto bad;
- }
-#endif
-
-
- /* try to read disk label and partition table information */
- i = sdstrategy(sc, F_READ, (daddr_t)labelsector, DEV_BSIZE, buf, &cnt);
- if (i || cnt != DEV_BSIZE) {
- goto bad;
- }
- msg = getdisklabel(buf, lp);
- if (msg) {
- goto bad;
- }
-
- if (part >= lp->d_npartitions || lp->d_partitions[part].p_size == 0) {
- msg = "no part";
-bad:
- printf("sd%d: %s\n", unit, msg);
- return (ENXIO);
- }
- return (0);
-}
-
-int
-sdclose(f)
- struct open_file *f;
-{
-#ifdef FANCY
- free(f->f_devdata, sizeof(struct sd_softc));
- f->f_devdata = (void *)0;
-#endif
- return (0);
-}
diff --git a/sys/arch/wgrisc/stand/boot/start.S b/sys/arch/wgrisc/stand/boot/start.S
deleted file mode 100644
index a3aa0f0ebb9..00000000000
--- a/sys/arch/wgrisc/stand/boot/start.S
+++ /dev/null
@@ -1,238 +0,0 @@
-/* $OpenBSD: start.S,v 1.2 1997/07/21 06:58:13 pefo Exp $ */
-
-/*
- * Copyright (c) 1997 Per Fogelstrom
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#define ABICALLS
-
-#include <machine/regdef.h>
-#include <machine/asm.h>
-
-/*
- * Frame required for the debugger (if we have any)
- */
-#define START_FRAME ((4 * 4) + 4 + 4)
-
- .globl __start
-__start:
- .set noreorder
- la gp, _gp
- la sp, __start - START_FRAME # Stack below program
- sw zero, START_FRAME - 4(sp) # Zero out old ra for debugger
- sw zero, START_FRAME - 8(sp) # Zero out old fp for debugger
- move s0, a0 # save argc
- move s1, a1 # save argv
-
- la a0, __start+512 # Merge together from
- la a1, __start+1024 # disklabel split.
- jal memcpy
- li a2, 8192 - 1024
-
- la a0, edata # clear BSS
- li a1, 0
- la a2, end
- jal memset # memset(edata, 0, end - edata)
- subu a2, a2, a0
-
- move a0, s0 # restore argc
- jal main # main(argc, argv)
- move a1, s1 # restore argv
-/* MAIN NEVER RETURNS */
-
-
-/* dummy routines return 0 */
- .globl getenv
- .globl __main
-getenv:
-__main:
- .set noreorder
- j ra
- li v0, 0
-
- .globl strcmp
-strcmp:
- .set noreorder
-1:
- lbu v0, 0(a0)
- lbu v1, 0(a1)
- beqz v0, 2f
- addu a0, a0, 1
- beq v0, v1, 1b
- addu a1, a1, 1
-2:
- jr ra
- subu v0, v0, v1
-
- .globl strlen
-strlen:
- .set noreorder
- li v0, 0
-1:
- lbu v1, 0(a0)
- addu a0, a0, 1
- bnez v1, 1b
- addu v0, v0, 1
-
- jr ra
- addu v0, v0, -1
-
- .globl memset
-memset:
- .set noreorder
- move v0, a0
-1:
- beqz a2, 2f
- addu a2, a2, -1
-
- sb a1, 0(a0)
- b 1b
- addu a0, a0, 1
-2:
- jr ra
- nop
-
- .globl memcpy
-memcpy:
- .set noreorder
- beqz a2, 3f
- move v0, a0
- sltu v1, a1, a0
- beqz v1, 1f
- li a3, 1 /* Forward copy */
-
- li a3, -1 /* Backwrads copy */
- addu a0, a2
- b 2f
- addu a1, a2
-
-1:
- lbu v1, 0(a1)
- addu a2, a2, -1
- sb v1, 0(a0)
-2:
- addu a0, a0, a3
- bnez a2, 1b
- addu a1, a1, a3
-
-3:
- jr ra
- nop
-
- .globl twiddle
-twiddle:
- .set noreorder
- la v0, twc+4
- lw a0, -4(v0)
- li a1, 7
- addu a0, a0, 2
- sw a0, -4(v0)
- and a1, a0, a1
- add a1, a1, v0
-
- li a0, 1 /* Stdout */
- b prom_write
- li a2, 2
-
-/*
- * Boot rom entrypoints.
- */
-
-#define BOOTVEC 0xbfc00500 /* Address of boot vector table */
-
- .globl getchar
-getchar:
- .set noreorder
- sw ra, 4(sp)
-
- move a1, sp
- li a0, 0
- jal prom_read
- li a2, 1
-
- lw ra, 4(sp)
- lbu v0, 0(sp)
- jr ra
- nop
-
- .globl disk_open
-disk_open:
- .set noreorder
- b __go
- li v0, 96
-
- .globl disk_read
-disk_read:
- .set noreorder
- b __go
- li v0, 100
-
- .globl prom_read
-prom_read:
- .set noreorder
- b __go
- li v0, 0
-
- .globl putchar
-putchar:
- .set noreorder
- sb a0, 0(sp)
- move a1, sp
- li a0, 1 /* Stdout */
- li a2, 1
-/* -- fall through -- */
- .globl prom_write
-prom_write:
- .set noreorder
- b __go
- li v0, 4
-
- .globl printf
-printf:
- .set noreorder
- b __go
- li v0, 20
-
- .globl panic
-panic:
-
-__go:
- .set noreorder
- lw v0, BOOTVEC(v0)
- nop
- jr v0
- nop
-
- .align 2
- .globl twc
-twc: .word 0
-tws: .ascii "\\\b-\b/\b-\b"
-
diff --git a/sys/arch/wgrisc/stand/libsa/Makefile b/sys/arch/wgrisc/stand/libsa/Makefile
deleted file mode 100644
index e93b5a2df4a..00000000000
--- a/sys/arch/wgrisc/stand/libsa/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-# $OpenBSD: Makefile,v 1.3 1997/07/21 06:58:14 pefo Exp $
-
-LIB= sa
-
-S=${.CURDIR}/../../../..
-DIR_SA= $S/lib/libsa
-DIR_KERN=$S/lib/libkern
-
-CFLAGS+=$(SACFLAGS) -D__INTERNAL_LIBSA_CREAD -DNO_READDIR -fno-inline
-CFLAGS+=-DSTART=$(START)
-CFLAGS+=${DEBUGFLAGS} -I${.CURDIR} -I${.CURDIR}/..
-CFLAGS+=-I$(S)/lib/libsa -I$(S)
-
-SRCS= alloc.c close.c dev.c disklabel.c dkcksum.c getfile.c ioctl.c \
- lseek.c open.c read.c ufs.c write.c devopen.c \
- gets.c memcpy.c memset.c strcat.c strlen.c \
- strncpy.c
-
-.PATH: ${DIR_SA} ${DIR_KERN}
-
-all: ${SALIB}
-
-NOPROFILE=noprofile
-NOPIC=nopic
-
-.include <bsd.lib.mk>
diff --git a/sys/arch/wgrisc/stand/libsa/devopen.c b/sys/arch/wgrisc/stand/libsa/devopen.c
deleted file mode 100644
index 0c1c68f36b6..00000000000
--- a/sys/arch/wgrisc/stand/libsa/devopen.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* $OpenBSD: devopen.c,v 1.3 1997/07/21 06:58:14 pefo Exp $ */
-
-/*
- * Copyright (c) 1997 Per Fogelstrom
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <lib/libsa/stand.h>
-
-static int
-a2i(ch)
- char *ch;
-{
- unsigned int v;
-
- v = *ch - '0';
- if(v > 9)
- v = 0;
- return(v);
-}
-
-int
-devopen(f, fname, file)
- struct open_file *f;
- const char *fname;
- char **file; /* out */
-{
- const char *cp;
- char *ncp;
- struct devsw *dp;
- unsigned int c;
- int ctlr = 0, unit = 0, part = 0;
- char namebuf[20];
- int rc, n;
-
- cp = fname;
- ncp = namebuf;
-
- while ((c = *cp++) != '\0' && c != '(') {
- *ncp++ = c;
- }
- *ncp = '\0';
-
- if(c == '(') {
- /* get controller number */
- ctlr = a2i(cp);
- cp += 2;
- /* get SCSI device number */
- unit = a2i(cp);
- cp += 2;
- /* get partition number */
- part = a2i(cp);
- cp += 2;
- if (cp[-1] != ')')
- return (ENXIO);
- }
-
- dp = devsw;
- n = ndevs;
- while(n--) {
- if (strcmp (namebuf, dp->dv_name) == 0) {
- rc = (dp->dv_open)(f, ctlr, unit, part);
- if (!rc) {
- f->f_dev = dp;
- if (file && *cp != '\0')
- *file = (char *)cp;
- }
- return (rc);
- }
- dp++;
- }
- return ENXIO;
-}
diff --git a/sys/arch/wgrisc/stand/libsa/getenv.c b/sys/arch/wgrisc/stand/libsa/getenv.c
deleted file mode 100644
index e1341b47588..00000000000
--- a/sys/arch/wgrisc/stand/libsa/getenv.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* $OpenBSD: getenv.c,v 1.2 1997/05/11 16:17:55 pefo Exp $ */
-
-/*
- * Copyright (c) 1997 Per Fogelstrom
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD for
- * Willowglen Services PTE, by Per Fogelstrom, Opsycon AB.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-char *
-getenv(s)
- char *s;
-{
- return(0);
-}
diff --git a/sys/arch/wgrisc/stand/libsa/gets.c b/sys/arch/wgrisc/stand/libsa/gets.c
deleted file mode 100644
index 359e40d988a..00000000000
--- a/sys/arch/wgrisc/stand/libsa/gets.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $OpenBSD: gets.c,v 1.2 1997/07/21 06:58:15 pefo Exp $ */
-/* $NetBSD: gets.c,v 1.5.2.1 1995/10/13 19:54:26 pk Exp $ */
-
-/*-
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)gets.c 8.1 (Berkeley) 6/11/93
- */
-
-#include "stand.h"
-
-void
-gets(buf)
- char *buf;
-{
- int c;
- char *lp;
-
- for (lp = buf;;)
- switch (c = getchar() & 0177) {
- case '\n':
- case '\r':
- *lp = '\0';
- return;
- case '\b':
- case '\177':
- if (lp > buf) {
- lp--;
- putchar('\b');
- putchar(' ');
- putchar('\b');
- }
- break;
- default:
- *lp = c;
- lp++;
- }
- /*NOTREACHED*/
-}
diff --git a/sys/arch/wgrisc/stand/libsa/ufs.c b/sys/arch/wgrisc/stand/libsa/ufs.c
deleted file mode 100644
index bfd995db942..00000000000
--- a/sys/arch/wgrisc/stand/libsa/ufs.c
+++ /dev/null
@@ -1,762 +0,0 @@
-/* $OpenBSD: ufs.c,v 1.1 1997/07/21 06:58:15 pefo Exp $ */
-/* $NetBSD: ufs.c,v 1.16 1996/09/30 16:01:22 ws Exp $ */
-
-/*-
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * The Mach Operating System project at Carnegie-Mellon University.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *
- * Copyright (c) 1990, 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Author: David Golub
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-/*
- * Stand-alone file reading package.
- */
-
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <ufs/ffs/fs.h>
-#include <ufs/ufs/dinode.h>
-#include <ufs/ufs/dir.h>
-#include <lib/libkern/libkern.h>
-
-#include "stand.h"
-
-/*
- * In-core open file.
- */
-struct file {
- off_t f_seekp; /* seek pointer */
- struct fs *f_fs; /* pointer to super-block */
- struct dinode f_di; /* copy of on-disk inode */
- int f_nindir[NIADDR];
- /* number of blocks mapped by
- indirect block at level i */
- char *f_blk[NIADDR]; /* buffer for indirect block at
- level i */
- size_t f_blksize[NIADDR];
- /* size of buffer */
- daddr_t f_blkno[NIADDR];/* disk address of block in buffer */
- char *f_buf; /* buffer for data block */
- size_t f_buf_size; /* size of data block */
- daddr_t f_buf_blkno; /* block number of data block */
-};
-
-static int read_inode __P((ino_t, struct open_file *));
-static int block_map __P((struct open_file *, daddr_t, daddr_t *));
-static int buf_read_file __P((struct open_file *, char **, size_t *));
-static int search_directory __P((char *, struct open_file *, ino_t *));
-#ifdef COMPAT_UFS
-static void ffs_oldfscompat __P((struct fs *));
-#endif
-
-/*
- * Read a new inode into a file structure.
- */
-static int
-read_inode(inumber, f)
- ino_t inumber;
- struct open_file *f;
-{
- register struct file *fp = (struct file *)f->f_fsdata;
- register struct fs *fs = fp->f_fs;
- char *buf;
- size_t rsize;
- int rc;
-
- /*
- * Read inode and save it.
- */
- buf = alloc(fs->fs_bsize);
- twiddle();
- rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
- fsbtodb(fs, ino_to_fsba(fs, inumber)), fs->fs_bsize,
- buf, &rsize);
- if (rc)
- goto out;
- if (rsize != fs->fs_bsize) {
- rc = EIO;
- goto out;
- }
-
- {
- register struct dinode *dp;
-
- dp = (struct dinode *)buf;
- fp->f_di = dp[ino_to_fsbo(fs, inumber)];
- }
-
- /*
- * Clear out the old buffers
- */
- {
- register int level;
-
- for (level = 0; level < NIADDR; level++)
- fp->f_blkno[level] = -1;
- fp->f_buf_blkno = -1;
- }
-out:
- free(buf, fs->fs_bsize);
- return (rc);
-}
-
-/*
- * Given an offset in a file, find the disk block number that
- * contains that block.
- */
-static int
-block_map(f, file_block, disk_block_p)
- struct open_file *f;
- daddr_t file_block;
- daddr_t *disk_block_p; /* out */
-{
- register struct file *fp = (struct file *)f->f_fsdata;
- register struct fs *fs = fp->f_fs;
- int level;
- int idx;
- daddr_t ind_block_num;
- daddr_t *ind_p;
- int rc;
-
- /*
- * Index structure of an inode:
- *
- * di_db[0..NDADDR-1] hold block numbers for blocks
- * 0..NDADDR-1
- *
- * di_ib[0] index block 0 is the single indirect block
- * holds block numbers for blocks
- * NDADDR .. NDADDR + NINDIR(fs)-1
- *
- * di_ib[1] index block 1 is the double indirect block
- * holds block numbers for INDEX blocks for blocks
- * NDADDR + NINDIR(fs) ..
- * NDADDR + NINDIR(fs) + NINDIR(fs)**2 - 1
- *
- * di_ib[2] index block 2 is the triple indirect block
- * holds block numbers for double-indirect
- * blocks for blocks
- * NDADDR + NINDIR(fs) + NINDIR(fs)**2 ..
- * NDADDR + NINDIR(fs) + NINDIR(fs)**2
- * + NINDIR(fs)**3 - 1
- */
-
- if (file_block < NDADDR) {
- /* Direct block. */
- *disk_block_p = fp->f_di.di_db[file_block];
- return (0);
- }
-
- file_block -= NDADDR;
-
- /*
- * nindir[0] = NINDIR
- * nindir[1] = NINDIR**2
- * nindir[2] = NINDIR**3
- * etc
- */
- for (level = 0; level < NIADDR; level++) {
- if (file_block < fp->f_nindir[level])
- break;
- file_block -= fp->f_nindir[level];
- }
- if (level == NIADDR) {
- /* Block number too high */
- return (EFBIG);
- }
-
- ind_block_num = fp->f_di.di_ib[level];
-
- for (; level >= 0; level--) {
- if (ind_block_num == 0) {
- *disk_block_p = 0; /* missing */
- return (0);
- }
-
- if (fp->f_blkno[level] != ind_block_num) {
- if (fp->f_blk[level] == (char *)0)
- fp->f_blk[level] =
- alloc(fs->fs_bsize);
- twiddle();
- rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
- fsbtodb(fp->f_fs, ind_block_num),
- fs->fs_bsize,
- fp->f_blk[level],
- &fp->f_blksize[level]);
- if (rc)
- return (rc);
- if (fp->f_blksize[level] != fs->fs_bsize)
- return (EIO);
- fp->f_blkno[level] = ind_block_num;
- }
-
- ind_p = (daddr_t *)fp->f_blk[level];
-
- if (level > 0) {
- idx = file_block / fp->f_nindir[level - 1];
- file_block %= fp->f_nindir[level - 1];
- } else
- idx = file_block;
-
- ind_block_num = ind_p[idx];
- }
-
- *disk_block_p = ind_block_num;
-
- return (0);
-}
-
-/*
- * Read a portion of a file into an internal buffer. Return
- * the location in the buffer and the amount in the buffer.
- */
-static int
-buf_read_file(f, buf_p, size_p)
- struct open_file *f;
- char **buf_p; /* out */
- size_t *size_p; /* out */
-{
- register struct file *fp = (struct file *)f->f_fsdata;
- register struct fs *fs = fp->f_fs;
- long off;
- register daddr_t file_block;
- daddr_t disk_block;
- size_t block_size;
- int rc;
-
- off = blkoff(fs, fp->f_seekp);
- file_block = lblkno(fs, fp->f_seekp);
- block_size = dblksize(fs, &fp->f_di, file_block);
-
- if (file_block != fp->f_buf_blkno) {
- rc = block_map(f, file_block, &disk_block);
- if (rc)
- return (rc);
-
- if (fp->f_buf == (char *)0)
- fp->f_buf = alloc(fs->fs_bsize);
-
- if (disk_block == 0) {
- bzero(fp->f_buf, block_size);
- fp->f_buf_size = block_size;
- } else {
- twiddle();
- rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
- fsbtodb(fs, disk_block),
- block_size, fp->f_buf, &fp->f_buf_size);
- if (rc)
- return (rc);
- }
-
- fp->f_buf_blkno = file_block;
- }
-
- /*
- * Return address of byte in buffer corresponding to
- * offset, and size of remainder of buffer after that
- * byte.
- */
- *buf_p = fp->f_buf + off;
- *size_p = block_size - off;
-
- /*
- * But truncate buffer at end of file.
- */
- if (*size_p > fp->f_di.di_size - fp->f_seekp)
- *size_p = fp->f_di.di_size - fp->f_seekp;
-
- return (0);
-}
-
-/*
- * Search a directory for a name and return its
- * i_number.
- */
-static int
-search_directory(name, f, inumber_p)
- char *name;
- struct open_file *f;
- ino_t *inumber_p; /* out */
-{
- register struct file *fp = (struct file *)f->f_fsdata;
- register struct direct *dp;
- struct direct *edp;
- char *buf;
- size_t buf_size;
- int namlen, length;
- int rc;
-
- length = strlen(name);
-
- fp->f_seekp = 0;
- while (fp->f_seekp < fp->f_di.di_size) {
- rc = buf_read_file(f, &buf, &buf_size);
- if (rc)
- return (rc);
-
- dp = (struct direct *)buf;
- edp = (struct direct *)(buf + buf_size);
- while (dp < edp) {
- if (dp->d_ino == (ino_t)0)
- goto next;
-#if BYTE_ORDER == LITTLE_ENDIAN
- if (fp->f_fs->fs_maxsymlinklen <= 0)
- namlen = dp->d_type;
- else
-#endif
- namlen = dp->d_namlen;
- if (namlen == length &&
- !strcmp(name, dp->d_name)) {
- /* found entry */
- *inumber_p = dp->d_ino;
- return (0);
- }
- next:
- dp = (struct direct *)((char *)dp + dp->d_reclen);
- }
- fp->f_seekp += buf_size;
- }
- return (ENOENT);
-}
-
-/*
- * Open a file.
- */
-int
-ufs_open(path, f)
- char *path;
- struct open_file *f;
-{
- register char *cp, *ncp;
- register int c;
- ino_t inumber, parent_inumber;
- struct file *fp;
- struct fs *fs;
- int rc;
- size_t buf_size;
-#ifndef NO_SYM_LINKS
- int nlinks = 0;
- char namebuf[MAXPATHLEN+1];
-#endif
- char *buf = NULL;
-
- /* allocate file system specific data structure */
- fp = alloc(sizeof(struct file));
- bzero(fp, sizeof(struct file));
- f->f_fsdata = (void *)fp;
-
- /* allocate space and read super block */
- fs = alloc(SBSIZE);
- fp->f_fs = fs;
- twiddle();
- rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
- SBLOCK, SBSIZE, (char *)fs, &buf_size);
- if (rc)
- goto out;
-
- if (buf_size != SBSIZE || fs->fs_magic != FS_MAGIC ||
- fs->fs_bsize > MAXBSIZE || fs->fs_bsize < sizeof(struct fs)) {
- rc = EINVAL;
- goto out;
- }
-#ifdef COMPAT_UFS
- ffs_oldfscompat(fs);
-#endif
-
- /*
- * Calculate indirect block levels.
- */
- {
- register int mult;
- register int level;
-
- mult = 1;
- for (level = 0; level < NIADDR; level++) {
- mult *= NINDIR(fs);
- fp->f_nindir[level] = mult;
- }
- }
-
- inumber = ROOTINO;
- if ((rc = read_inode(inumber, f)) != 0)
- goto out;
-
- cp = path;
- while (*cp) {
-
- /*
- * Remove extra separators
- */
- while (*cp == '/')
- cp++;
- if (*cp == '\0')
- break;
-
- /*
- * Check that current node is a directory.
- */
- if ((fp->f_di.di_mode & IFMT) != IFDIR) {
- rc = ENOTDIR;
- goto out;
- }
-
- /*
- * Get next component of path name.
- */
- {
- register int len = 0;
-
- ncp = cp;
- while ((c = *cp) != '\0' && c != '/') {
- if (++len > MAXNAMLEN) {
- rc = ENOENT;
- goto out;
- }
- cp++;
- }
- *cp = '\0';
- }
-
- /*
- * Look up component in current directory.
- * Save directory inumber in case we find a
- * symbolic link.
- */
- parent_inumber = inumber;
- rc = search_directory(ncp, f, &inumber);
- *cp = c;
- if (rc)
- goto out;
-
- /*
- * Open next component.
- */
- if ((rc = read_inode(inumber, f)) != 0)
- goto out;
-
-#ifndef NO_SYM_LINKS
- /*
- * Check for symbolic link.
- */
- if ((fp->f_di.di_mode & IFMT) == IFLNK) {
- int link_len = fp->f_di.di_size;
- int len;
-
- len = strlen(cp);
-
- if (link_len + len > MAXPATHLEN ||
- ++nlinks > MAXSYMLINKS) {
- rc = ENOENT;
- goto out;
- }
-
- bcopy(cp, &namebuf[link_len], len + 1);
-
- if (link_len < fs->fs_maxsymlinklen) {
- bcopy(fp->f_di.di_shortlink, namebuf,
- (unsigned) link_len);
- } else {
- /*
- * Read file for symbolic link
- */
- size_t buf_size;
- daddr_t disk_block;
- register struct fs *fs = fp->f_fs;
-
- if (!buf)
- buf = alloc(fs->fs_bsize);
- rc = block_map(f, (daddr_t)0, &disk_block);
- if (rc)
- goto out;
-
- twiddle();
- rc = (f->f_dev->dv_strategy)(f->f_devdata,
- F_READ, fsbtodb(fs, disk_block),
- fs->fs_bsize, buf, &buf_size);
- if (rc)
- goto out;
-
- bcopy((char *)buf, namebuf, (unsigned)link_len);
- }
-
- /*
- * If relative pathname, restart at parent directory.
- * If absolute pathname, restart at root.
- */
- cp = namebuf;
- if (*cp != '/')
- inumber = parent_inumber;
- else
- inumber = (ino_t)ROOTINO;
-
- if ((rc = read_inode(inumber, f)) != 0)
- goto out;
- }
-#endif /* NO_SYM_LINKS */
- }
-
- /*
- * Found terminal component.
- */
- rc = 0;
-out:
- if (buf)
- free(buf, fs->fs_bsize);
- if (rc) {
- free(fp->f_fs, SBSIZE);
- free(fp, sizeof(struct file));
- }
- return (rc);
-}
-
-int
-ufs_close(f)
- struct open_file *f;
-{
- register struct file *fp = (struct file *)f->f_fsdata;
- int level;
-
- f->f_fsdata = (void *)0;
- if (fp == (struct file *)0)
- return (0);
-
- for (level = 0; level < NIADDR; level++) {
- if (fp->f_blk[level])
- free(fp->f_blk[level], fp->f_fs->fs_bsize);
- }
- if (fp->f_buf)
- free(fp->f_buf, fp->f_fs->fs_bsize);
- free(fp->f_fs, SBSIZE);
- free(fp, sizeof(struct file));
- return (0);
-}
-
-/*
- * Copy a portion of a file into kernel memory.
- * Cross block boundaries when necessary.
- */
-int
-ufs_read(f, start, size, resid)
- struct open_file *f;
- void *start;
- size_t size;
- size_t *resid; /* out */
-{
- register struct file *fp = (struct file *)f->f_fsdata;
- register size_t csize;
- char *buf;
- size_t buf_size;
- int rc = 0;
- register char *addr = start;
-
- while (size != 0) {
- if (fp->f_seekp >= fp->f_di.di_size)
- break;
-
- rc = buf_read_file(f, &buf, &buf_size);
- if (rc)
- break;
-
- csize = size;
- if (csize > buf_size)
- csize = buf_size;
-
- bcopy(buf, addr, csize);
-
- fp->f_seekp += csize;
- addr += csize;
- size -= csize;
- }
- if (resid)
- *resid = size;
- return (rc);
-}
-
-/*
- * Not implemented.
- */
-int
-ufs_write(f, start, size, resid)
- struct open_file *f;
- void *start;
- size_t size;
- size_t *resid; /* out */
-{
-
- return (EROFS);
-}
-
-off_t
-ufs_seek(f, offset, where)
- struct open_file *f;
- off_t offset;
- int where;
-{
- register struct file *fp = (struct file *)f->f_fsdata;
-
- switch (where) {
- case SEEK_SET:
- fp->f_seekp = offset;
- break;
- case SEEK_CUR:
- fp->f_seekp += offset;
- break;
- case SEEK_END:
- fp->f_seekp = fp->f_di.di_size - offset;
- break;
- default:
- return (-1);
- }
- return (fp->f_seekp);
-}
-
-int
-ufs_stat(f, sb)
- struct open_file *f;
- struct stat *sb;
-{
-#if 0
- register struct file *fp = (struct file *)f->f_fsdata;
-
- /* only important stuff */
- sb->st_mode = fp->f_di.di_mode;
- sb->st_uid = fp->f_di.di_uid;
- sb->st_gid = fp->f_di.di_gid;
- sb->st_size = fp->f_di.di_size;
-#endif
- return (0);
-}
-
-#ifndef NO_READDIR
-int
-ufs_readdir(f, name)
- struct open_file *f;
- char *name;
-{
- register struct file *fp = (struct file *)f->f_fsdata;
- char *buf;
- size_t buf_size;
- register struct direct *dp, *edp;
- int rc, namlen;
-
- if (name == NULL)
- fp->f_seekp = 0;
- else {
- /* end of dir */
- if (fp->f_seekp >= fp->f_di.di_size) {
- *name = '\0';
- return -1;
- }
-
- do {
- if ((rc = buf_read_file(f, &buf, &buf_size)) != 0)
- return rc;
-
- dp = (struct direct *)buf;
- edp = (struct direct *)(buf + buf_size);
- while (dp < edp && dp->d_ino == (ino_t)0)
- dp = (struct direct *)((char *)dp + dp->d_reclen);
- fp->f_seekp += buf_size -
- ((u_int8_t *)edp - (u_int8_t *)dp);
- } while (dp >= edp);
-
-#if BYTE_ORDER == LITTLE_ENDIAN
- if (fp->f_fs->fs_maxsymlinklen <= 0)
- namlen = dp->d_type;
- else
-#endif
- namlen = dp->d_namlen;
- strncpy(name, dp->d_name, namlen + 1);
-
- fp->f_seekp += dp->d_reclen;
- }
-
- return 0;
-}
-#endif
-
-#ifdef COMPAT_UFS
-/*
- * Sanity checks for old file systems.
- *
- * XXX - goes away some day.
- */
-static void
-ffs_oldfscompat(fs)
- struct fs *fs;
-{
- int i;
-
- fs->fs_npsect = max(fs->fs_npsect, fs->fs_nsect); /* XXX */
- fs->fs_interleave = max(fs->fs_interleave, 1); /* XXX */
- if (fs->fs_postblformat == FS_42POSTBLFMT) /* XXX */
- fs->fs_nrpos = 8; /* XXX */
- if (fs->fs_inodefmt < FS_44INODEFMT) { /* XXX */
- quad_t sizepb = fs->fs_bsize; /* XXX */
- /* XXX */
- fs->fs_maxfilesize = fs->fs_bsize * NDADDR - 1; /* XXX */
- for (i = 0; i < NIADDR; i++) { /* XXX */
- sizepb *= NINDIR(fs); /* XXX */
- fs->fs_maxfilesize += sizepb; /* XXX */
- } /* XXX */
- fs->fs_qbmask = ~fs->fs_bmask; /* XXX */
- fs->fs_qfmask = ~fs->fs_fmask; /* XXX */
- } /* XXX */
-}
-#endif
diff --git a/sys/arch/wgrisc/wgrisc/autoconf.c b/sys/arch/wgrisc/wgrisc/autoconf.c
deleted file mode 100644
index b246fbe2fab..00000000000
--- a/sys/arch/wgrisc/wgrisc/autoconf.c
+++ /dev/null
@@ -1,476 +0,0 @@
-/* $OpenBSD: autoconf.c,v 1.3 1997/05/11 16:26:04 pefo Exp $ */
-/*
- * Copyright (c) 1996 Per Fogelstrom
- * Copyright (c) 1995 Theo de Raadt
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: autoconf.c 1.31 91/01/21
- *
- * from: @(#)autoconf.c 8.1 (Berkeley) 6/10/93
- * $Id: autoconf.c,v 1.3 1997/05/11 16:26:04 pefo Exp $
- */
-
-/*
- * Setup the system to run on the current machine.
- *
- * Configure() is called at boot time. Available
- * devices are determined (from possibilities mentioned in ioconf.c),
- * and the drivers are initialized.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/disklabel.h>
-#include <sys/conf.h>
-#include <sys/reboot.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-
-struct device *parsedisk __P((char *, int, int, dev_t *));
-void setroot __P((void));
-void configure __P((void));
-void swapconf __P((void));
-extern void dumpconf __P((void));
-static int findblkmajor __P((struct device *));
-static struct device * getdisk __P((char *, int, int, dev_t *));
-struct device * getdevunit __P((char *, int));
-void makebootdev __P((char *cp));
-int getpno __P((char **));
-
-/*
- * The following several variables are related to
- * the configuration process, and are used in initializing
- * the machine.
- */
-int cold = 1; /* if 1, still working on cold-start */
-int cpuspeed = 25; /* approx # instr per usec. */
-char bootdev[16]; /* to hold boot dev name */
-struct device *bootdv = NULL;
-
-/*
- * Configure all devices found that we know about.
- * This is done at boot time.
- */
-void
-configure()
-{
- (void)splhigh(); /* To be really sure.. */
- if(config_rootfound("mainbus", "mainbus") == 0)
- panic("no mainbus found");
- (void)spl0();
-
- setroot();
- swapconf();
- cold = 0;
-}
-
-/*
- * Configure swap space and related parameters.
- */
-void
-swapconf()
-{
- register struct swdevt *swp;
- register int nblks;
-
- for (swp = swdevt; swp->sw_dev != NODEV; swp++) {
- if (bdevsw[major(swp->sw_dev)].d_psize) {
- nblks =
- (*bdevsw[major(swp->sw_dev)].d_psize)(swp->sw_dev);
- if (nblks != -1 &&
- (swp->sw_nblks == 0 || swp->sw_nblks > nblks))
- swp->sw_nblks = nblks;
- swp->sw_nblks = ctod(dtoc(swp->sw_nblks));
- }
- }
- dumpconf();
-}
-
-/*
- * the rest of this file was influenced/copied from Theo de Raadt's
- * code in the sparc port to nuke the "options GENERIC" stuff.
- */
-
-static struct nam2blk {
- char *name;
- int maj;
-} nam2blk[] = {
- { "sd", 0 }, /* 0 = sd */
- { "fd", 7 }, /* 7 = floppy (probably never...)*/
- { "flash", 10 } /* 10 = Flash memory disk */
-};
-
-static int
-findblkmajor(dv)
- struct device *dv;
-{
- char *name = dv->dv_xname;
- register int i;
-
- for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); ++i)
- if (strncmp(name, nam2blk[i].name, strlen(nam2blk[0].name)) == 0)
- return (nam2blk[i].maj);
- return (-1);
-}
-
-static struct device *
-getdisk(str, len, defpart, devp)
- char *str;
- int len, defpart;
- dev_t *devp;
-{
- register struct device *dv;
-
- if ((dv = parsedisk(str, len, defpart, devp)) == NULL) {
- printf("use one of:");
- for (dv = alldevs.tqh_first; dv != NULL;
- dv = dv->dv_list.tqe_next) {
- if (dv->dv_class == DV_DISK)
- printf(" %s[a-h]", dv->dv_xname);
-#ifdef NFSCLIENT
- if (dv->dv_class == DV_IFNET)
- printf(" %s", dv->dv_xname);
-#endif
- }
- printf("\n");
- }
- return (dv);
-}
-
-struct device *
-parsedisk(str, len, defpart, devp)
- char *str;
- int len, defpart;
- dev_t *devp;
-{
- register struct device *dv;
- register char *cp, c;
- int majdev, part;
-
- if (len == 0)
- return (NULL);
- cp = str + len - 1;
- c = *cp;
- if (c >= 'a' && (c - 'a') < MAXPARTITIONS) {
- part = c - 'a';
- *cp = '\0';
- } else
- part = defpart;
-
- for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
- if (dv->dv_class == DV_DISK &&
- strcmp(str, dv->dv_xname) == 0) {
- majdev = findblkmajor(dv);
- if (majdev < 0)
- panic("parsedisk");
- *devp = MAKEDISKDEV(majdev, dv->dv_unit, part);
- break;
- }
-#ifdef NFSCLIENT
- if (dv->dv_class == DV_IFNET &&
- strcmp(str, dv->dv_xname) == 0) {
- *devp = NODEV;
- break;
- }
-#endif
- }
-
- *cp = c;
- return (dv);
-}
-
-/*
- * Attempt to find the device from which we were booted.
- * If we can do so, and not instructed not to do so,
- * change rootdev to correspond to the load device.
- */
-void
-setroot()
-{
- int majdev, mindev, unit, part, len;
- dev_t temp;
- struct swdevt *swp;
- struct device *dv;
- dev_t nrootdev, nswapdev = NODEV;
- char buf[128];
-
-#if defined(NFSCLIENT)
- extern char *nfsbootdevname;
-#endif
-
- /* Lookup boot device from boot if not set by configuration */
- if(bootdv == NULL) {
- bootdv = parsedisk(bootdev, strlen(bootdev), 0, &temp);
- }
- if(bootdv == NULL) {
- printf("boot device: lookup '%s' failed.\n", bootdev);
- boothowto |= RB_ASKNAME; /* Don't Panic :-) */
- }
- else {
- printf("boot device: %s.\n", bootdv->dv_xname);
- }
-
- if (boothowto & RB_ASKNAME) {
- for (;;) {
- printf("root device ");
- if (bootdv != NULL)
- printf("(default %s%c)",
- bootdv->dv_xname,
- bootdv->dv_class == DV_DISK
- ? 'a' : ' ');
- printf(": ");
- len = getsn(buf, sizeof(buf));
- if (len == 0 && bootdv != NULL) {
- strcpy(buf, bootdv->dv_xname);
- len = strlen(buf);
- }
- if (len > 0 && buf[len - 1] == '*') {
- buf[--len] = '\0';
- dv = getdisk(buf, len, 1, &nrootdev);
- if (dv != NULL) {
- bootdv = dv;
- nswapdev = nrootdev;
- goto gotswap;
- }
- }
- dv = getdisk(buf, len, 0, &nrootdev);
- if (dv != NULL) {
- bootdv = dv;
- break;
- }
- }
- /*
- * because swap must be on same device as root, for
- * network devices this is easy.
- */
- if (bootdv->dv_class == DV_IFNET) {
- goto gotswap;
- }
- for (;;) {
- printf("swap device ");
- if (bootdv != NULL)
- printf("(default %s%c)",
- bootdv->dv_xname,
- bootdv->dv_class == DV_DISK?'b':' ');
- printf(": ");
- len = getsn(buf, sizeof(buf));
- if (len == 0 && bootdv != NULL) {
- switch (bootdv->dv_class) {
- case DV_IFNET:
- nswapdev = NODEV;
- break;
- case DV_DISK:
- nswapdev = MAKEDISKDEV(major(nrootdev),
- DISKUNIT(nrootdev), 1);
- break;
- case DV_TAPE:
- case DV_TTY:
- case DV_DULL:
- case DV_CPU:
- break;
- }
- break;
- }
- dv = getdisk(buf, len, 1, &nswapdev);
- if (dv) {
- if (dv->dv_class == DV_IFNET)
- nswapdev = NODEV;
- break;
- }
- }
-
-gotswap:
- rootdev = nrootdev;
- dumpdev = nswapdev;
- swdevt[0].sw_dev = nswapdev;
- swdevt[1].sw_dev = NODEV;
- }
- else if(mountroot == NULL) {
- /*
- * `swap generic': Use the device the ROM told us to use.
- */
- if (bootdv == NULL)
- panic("boot device not known");
-
- majdev = findblkmajor(bootdv);
-
- if (majdev >= 0) {
- /*
- * Root and Swap are on disk.
- * Boot is always from partition 0.
- */
- rootdev = MAKEDISKDEV(majdev, bootdv->dv_unit, 0);
- nswapdev = MAKEDISKDEV(majdev, bootdv->dv_unit, 1);
- dumpdev = nswapdev;
- }
- else {
- /*
- * Root and Swap are on net.
- */
- nswapdev = dumpdev = NODEV;
- }
- swdevt[0].sw_dev = nswapdev;
- swdevt[1].sw_dev = NODEV;
-
- } else {
-
- /*
- * `root DEV swap DEV': honour rootdev/swdevt.
- * rootdev/swdevt/mountroot already properly set.
- */
- return;
- }
-
- switch (bootdv->dv_class) {
-#if defined(NFSCLIENT)
- case DV_IFNET:
- mountroot = nfs_mountroot;
- nfsbootdevname = bootdv->dv_xname;
- return;
-#endif
- case DV_DISK:
- mountroot = dk_mountroot;
- majdev = major(rootdev);
- mindev = minor(rootdev);
- unit = DISKUNIT(rootdev);
- part = DISKPART(rootdev);
- printf("root on %s%c\n", bootdv->dv_xname, part + 'a');
- break;
- default:
- printf("can't figure root, hope your kernel is right\n");
- return;
- }
-
- /*
- * XXX: What is this doing?
- */
- temp = NODEV;
- for (swp = swdevt; swp->sw_dev != NODEV; swp++) {
- if (majdev == major(swp->sw_dev) &&
- unit == DISKUNIT(swp->sw_dev)) {
- temp = swdevt[0].sw_dev;
- swdevt[0].sw_dev = swp->sw_dev;
- swp->sw_dev = temp;
- break;
- }
- }
- if (swp->sw_dev == NODEV)
- return;
-
- /*
- * If dumpdev was the same as the old primary swap device, move
- * it to the new primary swap device.
- */
- if (temp == dumpdev)
- dumpdev = swdevt[0].sw_dev;
-}
-
-/*
- * find a device matching "name" and unit number
- */
-struct device *
-getdevunit(name, unit)
- char *name;
- int unit;
-{
- struct device *dev = alldevs.tqh_first;
- char num[10], fullname[16];
- int lunit;
-
- /* compute length of name and decimal expansion of unit number */
- sprintf(num, "%d", unit);
- lunit = strlen(num);
- if (strlen(name) + lunit >= sizeof(fullname) - 1)
- panic("config_attach: device name too long");
-
- strcpy(fullname, name);
- strcat(fullname, num);
-
- while (strcmp(dev->dv_xname, fullname) != 0) {
- if ((dev = dev->dv_list.tqe_next) == NULL)
- return NULL;
- }
- return dev;
-}
-
-struct devmap {
- char *attachment;
- char *dev;
-};
-
-/*
- * Look at the string 'cp' and decode the boot device.
- * Boot names look like: sd(0,0,0)/bsd
- */
-void
-makebootdev(cp)
- char *cp;
-{
- int unit = 0, part = 0, ctrl = 0;
-
- bootdev[0] = *cp++;
- bootdev[1] = *cp++;
- if(*cp == '(') {
- ctrl = getpno(&cp);
- if(*cp == ',') {
- unit = getpno(&cp);
- if(*cp == ',') {
- part = getpno(&cp);
- }
- }
- sprintf(&bootdev[2], "%d%c", ctrl*16 + unit, part + 'a');
- }
- else {
- sprintf(bootdev, "unknown");
- }
-}
-getpno(cp)
- char **cp;
-{
- int val = 0;
- char *cx = *cp;
-
- cx++;
- while(*cx && *cx != ')' && *cx != ',') {
- val = val * 10 + *cx - '0';
- cx++;
- }
- *cp = cx;
- return val;
-}
diff --git a/sys/arch/wgrisc/wgrisc/clock.c b/sys/arch/wgrisc/wgrisc/clock.c
deleted file mode 100644
index 0f5d151474e..00000000000
--- a/sys/arch/wgrisc/wgrisc/clock.c
+++ /dev/null
@@ -1,327 +0,0 @@
-/* $OpenBSD: clock.c,v 1.1.1.1 1997/02/06 16:02:45 pefo Exp $ */
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: clock.c 1.18 91/01/21
- *
- * from: @(#)clock.c 8.1 (Berkeley) 6/10/93
- * $Id: clock.c,v 1.1.1.1 1997/02/06 16:02:45 pefo Exp $
- */
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-#include <wgrisc/wgrisc/clockvar.h>
-#include <wgrisc/wgrisc/wgrisctype.h>
-
-#include <dev/isa/isavar.h>
-#include <wgrisc/isa/isa_machdep.h>
-
-extern int cputype; /* What kind of cpu we are running on */
-
-int clock_started = 0;
-
-/* Definition of the driver for autoconfig. */
-static int clockmatch __P((struct device *, void *, void *));
-static void clockattach __P((struct device *, struct device *, void *));
-
-struct cfdriver clock_cd = {
- NULL, "clock", DV_DULL, NULL, 0
-};
-
-struct cfattach clock_ca = {
- sizeof(struct clock_softc), clockmatch, clockattach
-};
-
-void dpclock_attach __P((struct device *, struct device *, void *));
-
-#define SECMIN ((unsigned)60) /* seconds per minute */
-#define SECHOUR ((unsigned)(60*SECMIN)) /* seconds per hour */
-#define SECDAY ((unsigned)(24*SECHOUR)) /* seconds per day */
-#define SECYR ((unsigned)(365*SECDAY)) /* seconds per common year */
-
-#define LEAPYEAR(year) (((year) % 4) == 0)
-
-static int
-clockmatch(parent, cfdata, aux)
- struct device *parent;
- void *cfdata;
- void *aux;
-{
- struct cfdata *cf = cfdata;
- struct confargs *ca = aux;
-
- /* See how many clocks this system has */
- switch (cputype) {
-
- case WGRISC9100:
- /* make sure that we're looking for this type of device. */
- if (!BUS_MATCHNAME(ca, "dp8571rtc"))
- return (0);
-
- break;
-
- default:
- panic("unknown CPU");
- }
-
- if (cf->cf_unit >= 1)
- return (0);
-
- return (1);
-}
-
-int
-clockintr(cf)
- void *cf;
-{
- if(clock_started)
- hardclock((struct clockframe *)cf);
- return(1);
-}
-
-static void
-clockattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct isa_attach_args *ia = aux;
-
- dpclock_attach(parent, self, aux);
-
- switch (cputype) {
-
- case WGRISC9100:
- BUS_INTR_ESTABLISH((struct confargs *)aux,
- (intr_handler_t)hardclock, self);
- break;
-
- default:
- panic("clockattach: it didn't get here. really.");
- }
-
- printf("\n");
-}
-
-/*
- * Wait "n" microseconds. This doesn't belong here. XXX.
- */
-void
-delay(n)
- int n;
-{
- DELAY(n);
-}
-
-/*
- * Machine-dependent clock routines.
- *
- * Startrtclock restarts the real-time clock, which provides
- * hardclock interrupts to kern_clock.c.
- *
- * Inittodr initializes the time of day hardware which provides
- * date functions. Its primary function is to use some file
- * system information in case the hardare clock lost state.
- *
- * Resettodr restores the time of day hardware after a time change.
- */
-
-
-/*
- * Start the real-time and statistics clocks. Leave stathz 0 since there
- * are no other timers available.
- */
-void
-cpu_initclocks()
-{
- extern int tickadj;
- struct clock_softc *csc = (struct clock_softc *)clock_cd.cd_devs[0];
-
- hz = 100; /* 100 Hz */
- tick = 1000000 / hz; /* number of micro-seconds between interrupts */
-
- /*
- * Start the clock.
- */
- (*csc->sc_init)(csc);
- clock_started++;
-}
-
-/*
- * We assume newhz is either stathz or profhz, and that neither will
- * change after being set up above. Could recalculate intervals here
- * but that would be a drag.
- */
-void
-setstatclockrate(newhz)
- int newhz;
-{
-}
-
-/*
- * This code is defunct after 2099.
- * Will Unix still be here then??
- */
-static short dayyr[12] = {
- 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
-};
-
-/*
- * Initialze the time of day register, based on the time base which is, e.g.
- * from a filesystem. Base provides the time to within six months,
- * and the time of year clock (if any) provides the rest.
- */
-void
-inittodr(base)
- time_t base;
-{
- struct tod_time c;
- struct clock_softc *csc = (struct clock_softc *)clock_cd.cd_devs[0];
- register int days, yr;
- long deltat;
- int badbase, s;
-
- if (base < 5*SECYR) {
- printf("WARNING: preposterous time in file system");
- /* read the system clock anyway */
- base = 6*SECYR + 186*SECDAY + SECDAY/2;
- badbase = 1;
- } else
- badbase = 0;
-
- /* Read RTC chip registers */
- (*csc->sc_get)(csc, base, &c);
-
- csc->sc_initted = 1;
-
- /* simple sanity checks */
- c.year = c.year+80; /* must be multiple of 4 because chip knows leap */
- if (c.year < 70 || c.mon < 1 || c.mon > 12 || c.day < 1 ||
- c.day > 31 || c.hour > 23 || c.min > 59 || c.sec > 59) {
- /*
- * Believe the time in the file system for lack of
- * anything better, resetting the TODR.
- */
- time.tv_sec = base;
- if (!badbase) {
- printf("WARNING: preposterous clock chip time\n");
- resettodr();
- }
- goto bad;
- }
- days = 0;
- for (yr = 70; yr < c.year; yr++)
- days += LEAPYEAR(yr) ? 366 : 365;
- days += dayyr[c.mon - 1] + c.day - 1;
- if (LEAPYEAR(yr) && c.mon > 2)
- days++;
- /* now have days since Jan 1, 1970; the rest is easy... */
- time.tv_sec = days * SECDAY + c.hour * 3600 + c.min * 60 + c.sec;
-
- if (!badbase) {
- /*
- * See if we gained/lost two or more days;
- * if so, assume something is amiss.
- */
- deltat = time.tv_sec - base;
- if (deltat < 0)
- deltat = -deltat;
- if (deltat < 2 * SECDAY)
- return;
- printf("WARNING: clock %s %d days",
- time.tv_sec < base ? "lost" : "gained", deltat / SECDAY);
- }
-bad:
- printf(" -- CHECK AND RESET THE DATE!\n");
-}
-
-/*
- * Reset the TODR based on the time value; used when the TODR
- * has a preposterous value and also when the time is reset
- * by the stime system call. Also called when the TODR goes past
- * TODRZERO + 100*(SECYEAR+2*SECDAY) (e.g. on Jan 2 just after midnight)
- * to wrap the TODR around.
- */
-void
-resettodr()
-{
- struct tod_time c;
- struct clock_softc *csc = (struct clock_softc *)clock_cd.cd_devs[0];
- register int t, t2;
- int s;
-
- if(!csc->sc_initted)
- return;
-
- /* compute the day of week. 1 is Sunday*/
- t2 = time.tv_sec / SECDAY;
- c.dow = (t2 + 5) % 7; /* 1/1/1970 was thursday */
-
- /* compute the year */
- t2 = time.tv_sec / SECDAY;
- c.year = 69;
- while (t2 >= 0) { /* whittle off years */
- t = t2;
- c.year++;
- t2 -= LEAPYEAR(c.year) ? 366 : 365;
- }
-
- /* t = month + day; separate */
- t2 = LEAPYEAR(c.year);
- for (c.mon = 1; c.mon < 12; c.mon++)
- if (t < dayyr[c.mon] + (t2 && c.mon > 1))
- break;
-
- c.day = t - dayyr[c.mon - 1] + 1;
- if (t2 && c.mon > 2)
- c.day--;
-
- /* the rest is easy */
- t = time.tv_sec % SECDAY;
- c.hour = t / 3600;
- t %= 3600;
- c.min = t / 60;
- c.sec = t % 60;
- c.year = c.year-80; /* must be multiple of 4 because chip knows leap */
-
- (*csc->sc_set)(csc, &c);
-}
diff --git a/sys/arch/wgrisc/wgrisc/clock_dp.c b/sys/arch/wgrisc/wgrisc/clock_dp.c
deleted file mode 100644
index 1f439476313..00000000000
--- a/sys/arch/wgrisc/wgrisc/clock_dp.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/* $OpenBSD: clock_dp.c,v 1.2 1997/08/24 12:01:14 pefo Exp $ */
-/* $NetBSD: clock_mc.c,v 1.2 1995/06/28 04:30:30 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: clock.c 1.18 91/01/21
- *
- * @(#)clock.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/pio.h>
-
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
-#include <dev/ic/dp857xreg.h>
-
-#include <wgrisc/wgrisc/clockvar.h>
-#include <wgrisc/wgrisc/wgrisctype.h>
-#include <wgrisc/riscbus/riscbus.h>
-#include <wgrisc/isa/isa_machdep.h>
-
-extern u_int cputype;
-extern int cpu_int_mask;
-
-void dpclock_attach __P((struct device *parent,
- struct device *self, void *aux));
-static void dpclock_init_riscbus __P((struct clock_softc *csc));
-static void dpclock_get __P((struct clock_softc *csc, time_t base,
- struct tod_time *ct));
-static void dpclock_set __P((struct clock_softc *csc,
- struct tod_time *ct));
-
-struct dpclockdata {
- void (*dp_write) __P((struct clock_softc *csc, u_int reg,
- u_int datum));
- u_int (*dp_read) __P((struct clock_softc *csc, u_int reg));
- void *dp_addr;
-};
-
-#define dp857x_write(sc, reg, datum) \
- (*((struct dpclockdata *)sc->sc_data)->dp_write)(sc, reg, datum)
-#define dp857x_read(sc, reg) \
- (*((struct dpclockdata *)sc->sc_data)->dp_read)(sc, reg)
-
-/* riscbus clock read code */
-static void dp_write_riscbus __P((struct clock_softc *csc, u_int reg,
- u_int datum));
-static u_int dp_read_riscbus __P((struct clock_softc *csc, u_int reg));
-static struct dpclockdata dpclockdata_riscbus = { dp_write_riscbus, dp_read_riscbus };
-
-void
-dpclock_attach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct clock_softc *csc = (struct clock_softc *)self;
-
- register volatile struct chiptime *c;
- struct confargs *ca = aux;
-
- printf(": dp857[012] or compatible");
-
- csc->sc_get = dpclock_get;
- csc->sc_set = dpclock_set;
-
- switch (cputype) {
-
- case WGRISC9100:
- csc->sc_init = dpclock_init_riscbus;
- csc->sc_data = &dpclockdata_riscbus;
- dpclockdata_riscbus.dp_addr = BUS_CVTADDR(ca);
- break;
-
- default:
- printf("\n");
- panic("don't know how to set up for other system types.");
- }
-
- /* Initialize and turn interrupts off, just in case. */
-
- dp857x_write(csc, MAIN_STATUS, 0x40);
- dp857x_write(csc, INTERRUPT_CTRL0, 0);
- dp857x_write(csc, INTERRUPT_CTRL1, 0);
- dp857x_write(csc, OUTPUT_MODE, 0x08);
- dp857x_write(csc, REAL_TIME_MODE,
- (dp857x_read(csc, REAL_TIME_MODE) & 3) | 0x08);
-
- dp857x_write(csc, MAIN_STATUS, 0x3c); /* clears pending ints */
- dp857x_write(csc, INTERRUPT_ROUT, 0);
- dp857x_write(csc, TIMER0_CTRL, 0);
- dp857x_write(csc, TIMER1_CTRL, 0);
-}
-/*
- * TOD clock also used for periodic interrupts.
- */
-static struct clock_softc *int_csc;
-
-static void
-dpclock_init_riscbus(csc)
- struct clock_softc *csc;
-{
- int_csc = csc;
- dp857x_write(csc, MAIN_STATUS, 0x40);
- dp857x_write(csc, INTERRUPT_CTRL0, 0x10); /* 100 Hz */
- dp857x_write(csc, MAIN_STATUS, 0);
-}
-
-int
-dpclock_interrupt()
-{
- if(dp857x_read(int_csc, MAIN_STATUS) & 0x04) { /* periodic interrupt */
- dp857x_write(int_csc, MAIN_STATUS, 0x04);
- return(1);
- }
- return(0);
-}
-
-/*
- * Get the time of day, based on the clock's value and/or the base value.
- */
-static void
-dpclock_get(csc, base, ct)
- struct clock_softc *csc;
- time_t base;
- struct tod_time *ct;
-{
- dp_todregs regs;
- int s;
-
- s = splclock();
- DP857X_GETTOD(csc, &regs)
- splx(s);
-
- ct->sec = regs[CLK_SECONDS];
- ct->min = regs[CLK_MINUTES];
- ct->hour = regs[CLK_HOURS];
- ct->dow = regs[CLK_WEEKDAY];
- ct->day = regs[CLK_DAY];
- ct->mon = regs[CLK_MONTH];
- ct->year = regs[CLK_YEAR];
-}
-
-/*
- * Reset the TODR based on the time value.
- */
-static void
-dpclock_set(csc, ct)
- struct clock_softc *csc;
- struct tod_time *ct;
-{
- dp_todregs regs;
- int s;
-
- s = splclock();
- DP857X_GETTOD(csc, &regs)
-
- regs[CLK_SECONDS] = ct->sec;
- regs[CLK_MINUTES] = ct->min;
- regs[CLK_HOURS] = ct->hour;
- regs[CLK_WEEKDAY] = ct->dow;
- regs[CLK_DAY] = ct->day;
- regs[CLK_MONTH] = ct->mon;
- regs[CLK_YEAR] = ct->year;
-
- DP857X_PUTTOD(csc, &regs);
- splx(s);
-}
-
-static void
-dp_write_riscbus(csc, reg, datum)
- struct clock_softc *csc;
- u_int reg, datum;
-{
- outb(((struct dpclockdata *)csc->sc_data)->dp_addr + reg, datum);
-}
-
-static u_int
-dp_read_riscbus(csc, reg)
- struct clock_softc *csc;
- u_int reg;
-{
- int i;
- i = inb(((struct dpclockdata *)csc->sc_data)->dp_addr + reg);
- return(i);
-}
-
-#define WWDELAY 50
-#define WDELAY() \
-{\
- register int i; \
- wbflush(); \
- for (i = WWDELAY; i != 0; i--) continue; \
-}
-
-/*----------------------------------------------------------------------
- * Read non-volatile ram part of clock chip.
- * -----------------------------------------
- *
- * First byte is located in page 0, and read first
- * then page 1 is switched in and the rest is read.
- ----------------------------------------------------------------------*/
-unsigned char *ReadNVram(unsigned char *ptr)
-{
- volatile unsigned char *clockram = (volatile unsigned char *)RISC_RTC;
- unsigned char main_stat_save;
- int count;
-
- main_stat_save = inb(clockram + MAIN_STATUS);
- WDELAY();
- outb(clockram + MAIN_STATUS, 0);
- WDELAY();
- *ptr++ = inb(clockram + RAM_1E);
- WDELAY();
- outb(clockram + MAIN_STATUS, 0x80);
- WDELAY();
- for(count=1; count < 32; count++) {
- WDELAY();
- *ptr++ = inb(clockram + count);
- }
- WDELAY();
- outb(clockram + MAIN_STATUS, main_stat_save & 0xc0);
- return(0);
-}
-
-/*----------------------------------------------------------------------*
- * Write non-volatile ram part of clock chip.
- * ------------------------------------------
- *
- * First byte is located in page 0, and written first
- * then page 1 is switched in and the rest is written.
- *----------------------------------------------------------------------*/
-unsigned char *WriteNVram(unsigned char *ptr)
-{
- volatile unsigned char *clockram = (volatile unsigned char *)RISC_RTC;
- unsigned char main_stat_save;
- int count;
-
- main_stat_save = inb(clockram+MAIN_STATUS);
- WDELAY();
- outb(clockram + MAIN_STATUS, 0);
- outb(clockram + RAM_1E, *ptr++);
- outb(clockram + MAIN_STATUS, 0x80);
- for(count=1; count < 32; count++) {
- outb(clockram + count, *ptr++);
- }
- outb(clockram + MAIN_STATUS, main_stat_save & 0xc0);
- return 0;
-}
diff --git a/sys/arch/wgrisc/wgrisc/clockvar.h b/sys/arch/wgrisc/wgrisc/clockvar.h
deleted file mode 100644
index f63b51ac256..00000000000
--- a/sys/arch/wgrisc/wgrisc/clockvar.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* $OpenBSD: clockvar.h,v 1.1.1.1 1997/02/06 16:02:45 pefo Exp $ */
-
-/*
- * Copyright (c) 1996 Per Fogelstrom
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-/*
- * Definitions for "cpu-independent" clock handling for the mips wgrisc arch.
- */
-
-/*
- * clocktime structure:
- *
- * structure passed to TOY clocks when setting them. broken out this
- * way, so that the time_t -> field conversion can be shared.
- */
-struct tod_time {
- int year; /* year - 1900 */
- int mon; /* month (1 - 12) */
- int day; /* day (1 - 31) */
- int hour; /* hour (0 - 23) */
- int min; /* minute (0 - 59) */
- int sec; /* second (0 - 59) */
- int dow; /* day of week (0 - 6; 0 = Sunday) */
-};
-
-/*
- * clockdesc structure:
- *
- * provides clock-specific functions to do necessary operations.
- */
-struct clock_softc {
- struct device sc_dev;
-
- /*
- * The functions that all types of clock provide.
- */
- void (*sc_attach) __P((struct device *parent, struct device *self,
- void *aux));
- void (*sc_init) __P((struct clock_softc *csc));
- void (*sc_get) __P((struct clock_softc *csc, time_t base,
- struct tod_time *ct));
- void (*sc_set) __P((struct clock_softc *csc, struct tod_time *ct));
-
- /*
- * Private storage for particular clock types.
- */
- void *sc_data;
-
- /*
- * Has the time been initialized?
- */
- int sc_initted;
-};
diff --git a/sys/arch/wgrisc/wgrisc/conf.c b/sys/arch/wgrisc/wgrisc/conf.c
deleted file mode 100644
index efcdc5d55d5..00000000000
--- a/sys/arch/wgrisc/wgrisc/conf.c
+++ /dev/null
@@ -1,341 +0,0 @@
-/* $OpenBSD: conf.c,v 1.8 2000/09/26 14:03:55 art Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)conf.c 8.2 (Berkeley) 11/14/93
- * $Id: conf.c,v 1.8 2000/09/26 14:03:55 art Exp $
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/vnode.h>
-#include <sys/tty.h>
-#include <sys/conf.h>
-
-int ttselect __P((dev_t, int, struct proc *));
-
-/*
- * Block devices.
- */
-
-#include "vnd.h"
-bdev_decl(vnd);
-bdev_decl(sw);
-#include "sd.h"
-bdev_decl(sd);
-#include "cd.h"
-bdev_decl(cd);
-#if notyet
-#include "fdc.h"
-bdev_decl(fd);
-#endif
-#include "wdc.h"
-bdev_decl(wd);
-#include "acd.h"
-bdev_decl(acd);
-#include "fl.h"
-bdev_decl(fl);
-
-struct bdevsw bdevsw[] =
-{
- bdev_disk_init(NSD,sd), /* 0: SCSI disk */
- bdev_swap_init(1,sw), /* 1: should be here swap pseudo-dev */
- bdev_disk_init(NVND,vnd), /* 2: vnode disk driver */
- bdev_disk_init(NCD,cd), /* 3: SCSI CD-ROM */
- bdev_disk_init(NWDC,wd), /* 4: ST506/ESDI/IDE disk */
- bdev_disk_init(NACD,cd), /* 5: ATAPI CD-ROM */
- bdev_notdef(), /* 6: */
- bdev_notdef(), /* 7: Floppy disk driver */
- bdev_notdef(), /* 8: */
- bdev_notdef(), /* 9: */
- bdev_disk_init(NFL,fl), /* 10: Flash ram disk driver */
- bdev_notdef(), /* 11: */
- bdev_notdef(), /* 12: */
- bdev_notdef(), /* 13: */
- bdev_notdef(), /* 14: */
- bdev_notdef(), /* 15: */
-};
-
-int nblkdev = sizeof (bdevsw) / sizeof (bdevsw[0]);
-
-/*
- * Character devices.
- */
-
-
-cdev_decl(cn);
-cdev_decl(sw);
-cdev_decl(ctty);
-cdev_decl(random);
-#define mmread mmrw
-#define mmwrite mmrw
-dev_type_read(mmrw);
-cdev_decl(mm);
-#include "pty.h"
-#define ptstty ptytty
-#define ptsioctl ptyioctl
-cdev_decl(pts);
-#define ptctty ptytty
-#define ptcioctl ptyioctl
-cdev_decl(ptc);
-cdev_decl(log);
-cdev_decl(fd);
-#include "st.h"
-cdev_decl(st);
-cdev_decl(vnd);
-#include "bpfilter.h"
-cdev_decl(bpf);
-#include "com.h"
-cdev_decl(com);
-cdev_decl(sd);
-cdev_decl(cd);
-#include "uk.h"
-cdev_decl(uk);
-cdev_decl(wd);
-cdev_decl(acd);
-cdev_decl(fl);
-
-#ifdef XFS
-#include <xfs/nxfs.h>
-cdev_decl(xfs_dev);
-#endif
-
-#ifdef IPFILTER
-#define NIPF 1
-#else
-#define NIPF 0
-#endif
-
-struct cdevsw cdevsw[] =
-{
- cdev_cn_init(1,cn), /* 0: virtual console */
- cdev_swap_init(1,sw), /* 1: /dev/drum (swap pseudo-device) */
- cdev_ctty_init(1,ctty), /* 2: controlling terminal */
- cdev_mm_init(1,mm), /* 3: /dev/{null,mem,kmem,...} */
- cdev_tty_init(NPTY,pts), /* 4: pseudo-tty slave */
- cdev_ptc_init(NPTY,ptc), /* 5: pseudo-tty master */
- cdev_log_init(1,log), /* 6: /dev/klog */
- cdev_fd_init(1,filedesc), /* 7: file descriptor pseudo-dev */
- cdev_disk_init(NCD,cd), /* 8: SCSI CD */
- cdev_disk_init(NSD,sd), /* 9: SCSI disk */
- cdev_tape_init(NST,st), /* 10: SCSI tape */
- cdev_disk_init(NVND,vnd), /* 11: vnode disk */
- cdev_bpftun_init(NBPFILTER,bpf),/* 12: berkeley packet filter */
- cdev_notdef(), /* 13: Floppy disk */
- cdev_notdef(), /* 14: builtin pc style console dev */
- cdev_notdef(), /* 15: builtin PS2 style mouse */
- cdev_notdef(), /* 16: lpt paralell printer interface */
- cdev_tty_init(NCOM,com), /* 17: com 16C450 serial interface */
- cdev_disk_init(NWDC,wd), /* 18: ST506/ESDI/IDE disk */
- cdev_disk_init(NACD,acd), /* 19: ATAPI CD-ROM */
- cdev_tty_init(NPTY,pts), /* 20: pseudo-tty slave */
- cdev_ptc_init(NPTY,ptc), /* 21: pseudo-tty master */
- cdev_disk_init(NFL,fl), /* 22: Flash memory driver */
- cdev_notdef(), /* 23: */
- cdev_notdef(), /* 24: */
- cdev_notdef(), /* 25: */
- cdev_notdef(), /* 26: */
- cdev_notdef(), /* 27: */
- cdev_notdef(), /* 28: */
- cdev_notdef(), /* 29: */
- cdev_notdef(), /* 30: */
- cdev_gen_ipf(NIPF,ipl), /* 31: IP filter log */
- cdev_uk_init(NUK,uk), /* 32: unknown SCSI */
- cdev_random_init(1,random), /* 33: random data source */
- cdev_notdef(), /* 34: */
- cdev_notdef(), /* 35: */
- cdev_notdef(), /* 36: */
- cdev_notdef(), /* 37: */
- cdev_notdef(), /* 38: */
- cdev_notdef(), /* 39: */
- cdev_notdef(), /* 30: */
- cdev_notdef(), /* 41: */
- cdev_notdef(), /* 42: */
- cdev_notdef(), /* 43: */
- cdev_notdef(), /* 44: */
- cdev_notdef(), /* 45: */
- cdev_notdef(), /* 46: */
- cdev_notdef(), /* 47: */
- cdev_notdef(), /* 48: */
- cdev_notdef(), /* 49: */
- cdev_notdef(), /* 50: */
-#ifdef XFS
- cdev_xfs_init(NXFS,xfs_dev), /* 51: xfs communication device */
-#else
- cdev_notdef(), /* 51: */
-#endif
-};
-
-int nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]);
-
-int mem_no = 2; /* major device number of memory special file */
-
-/*
- * Swapdev is a fake device implemented
- * in sw.c used only internally to get to swstrategy.
- * It cannot be provided to the users, because the
- * swstrategy routine munches the b_dev and b_blkno entries
- * before calling the appropriate driver. This would horribly
- * confuse, e.g. the hashing routines. Instead, /dev/drum is
- * provided as a character (raw) device.
- */
-dev_t swapdev = makedev(1, 0);
-
-/*
- * Routine that identifies /dev/mem and /dev/kmem.
- *
- * A minimal stub routine can always return 0.
- */
-iskmemdev(dev)
- dev_t dev;
-{
-
-#ifdef COMPAT_BSD44
- if (major(dev) == 2 && (minor(dev) == 0 || minor(dev) == 1))
-#else
- if (major(dev) == 3 && (minor(dev) == 0 || minor(dev) == 1))
-#endif
- return (1);
- return (0);
-}
-
-/*
- * Returns true if def is /dev/zero
- */
-iszerodev(dev)
- dev_t dev;
-{
-#ifdef COMPAT_BSD44
- return (major(dev) == 2 && minor(dev) == 12);
-#else
- return (major(dev) == 3 && minor(dev) == 12);
-#endif
-}
-
-dev_t
-getnulldev()
-{
- return makedev(3, 2);
-}
-
-
-static int chrtoblktbl[] = {
- /* VCHR */ /* VBLK */
- /* 0 */ NODEV,
- /* 1 */ NODEV,
- /* 2 */ NODEV,
- /* 3 */ NODEV,
- /* 4 */ NODEV,
- /* 5 */ NODEV,
- /* 6 */ NODEV,
- /* 7 */ NODEV,
- /* 8 */ NODEV,
- /* 9 */ 0,
- /* 10 */ NODEV,
- /* 11 */ 2,
- /* 12 */ NODEV,
- /* 13 */ 7,
- /* 14 */ NODEV,
- /* 15 */ NODEV,
- /* 16 */ NODEV,
- /* 17 */ NODEV,
- /* 18 */ 4,
- /* 19 */ 5,
- /* 20 */ NODEV,
- /* 21 */ NODEV,
- /* 22 */ 10,
-};
-
-/*
- * Routine to convert from character to block device number.
- *
- * A minimal stub routine can always return NODEV.
- */
-chrtoblk(dev)
- dev_t dev;
-{
- int blkmaj;
-
- if (major(dev) >= nchrdev ||
- major(dev) > sizeof(chrtoblktbl)/sizeof(chrtoblktbl[0]))
- return (NODEV);
- blkmaj = chrtoblktbl[major(dev)];
- if (blkmaj == NODEV)
- return (NODEV);
- return (makedev(blkmaj, minor(dev)));
-}
-
-/*
- * Convert a character device number to a block device number.
- */
-dev_t
-blktochr(dev)
- dev_t dev;
-{
- int blkmaj = major(dev);
- int i;
-
- if (blkmaj >= nblkdev)
- return (NODEV);
- for (i = 0; i < sizeof(chrtoblktbl)/sizeof(chrtoblktbl[0]); i++)
- if (blkmaj == chrtoblktbl[i])
- return (makedev(i, minor(dev)));
- return (NODEV);
-}
-
-/*
- * This entire table could be autoconfig()ed but that would mean that
- * the kernel's idea of the console would be out of sync with that of
- * the standalone boot. I think it best that they both use the same
- * known algorithm unless we see a pressing need otherwise.
- */
-#include <dev/cons.h>
-
-cons_decl(pc);
-cons_decl(com);
-
-struct consdev constab[] = {
-#if NPC + NVT > 0
- cons_init(pc),
-#endif
-#if NCOM > 0
- cons_init(com),
-#endif
- { 0 },
-};
diff --git a/sys/arch/wgrisc/wgrisc/cpu.c b/sys/arch/wgrisc/wgrisc/cpu.c
deleted file mode 100644
index c7bf7a09d82..00000000000
--- a/sys/arch/wgrisc/wgrisc/cpu.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/* $OpenBSD: cpu.c,v 1.1.1.1 1997/02/06 16:02:45 pefo Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Per Fogelstrom
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <sys/param.h>
-#include <sys/device.h>
-
-#include <machine/cpu.h>
-#include <machine/autoconf.h>
-
-
-/* Definition of the driver for autoconfig. */
-static int cpumatch(struct device *, void *, void *);
-static void cpuattach(struct device *, struct device *, void *);
-
-struct cfattach cpu_ca = {
- sizeof(struct device), cpumatch, cpuattach
-};
-struct cfdriver cpu_cd = {
- NULL, "cpu", DV_DULL, NULL, 0
-};
-
-static int cpuprint __P((void *, char *pnp));
-
-static int
-cpumatch(parent, cfdata, aux)
- struct device *parent;
- void *cfdata;
- void *aux;
-{
- struct cfdata *cf = cfdata;
- struct confargs *ca = aux;
-
- /* make sure that we're looking for a CPU. */
- if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0)
- return (0);
-
- return (1);
-}
-
-static void
-cpuattach(parent, dev, aux)
- struct device *parent;
- struct device *dev;
- void *aux;
-{
- struct pcs *p;
- int needcomma, needrev, i;
-
- printf(": ");
-
- switch(cpu_id.cpu.cp_imp) {
-
- case MIPS_R2000:
- printf("MIPS R2000 CPU");
- break;
- case MIPS_R3000:
- printf("MIPS R3000 CPU");
- break;
- case MIPS_R6000:
- printf("MIPS R6000 CPU");
- break;
- case MIPS_R4000:
- if(CpuPrimaryInstCacheSize == 16384)
- printf("MIPS R4400 CPU");
- else
- printf("MIPS R4000 CPU");
- break;
- case MIPS_R3LSI:
- printf("LSI Logic R3000 derivate");
- break;
- case MIPS_R6000A:
- printf("MIPS R6000A CPU");
- break;
- case MIPS_R3IDT:
- printf("IDT R3000 derivate");
- break;
- case MIPS_R10000:
- printf("MIPS R10000 CPU");
- break;
- case MIPS_R4200:
- printf("MIPS R4200 CPU (ICE)");
- break;
- case MIPS_R8000:
- printf("MIPS R8000 Blackbird/TFP CPU");
- break;
- case MIPS_R4600:
- printf("QED R4600 Orion CPU");
- break;
- case MIPS_R3SONY:
- printf("Sony R3000 based CPU");
- break;
- case MIPS_R3TOSH:
- printf("Toshiba R3000 based CPU");
- break;
- case MIPS_R3NKK:
- printf("NKK R3000 based CPU");
- break;
- case MIPS_UNKC1:
- case MIPS_UNKC2:
- default:
- printf("Unknown CPU type (0x%x)",cpu_id.cpu.cp_imp);
- break;
- }
- printf(" Rev. %d.%d with ", cpu_id.cpu.cp_majrev, cpu_id.cpu.cp_minrev);
-
-
- switch(fpu_id.cpu.cp_imp) {
-
- case MIPS_SOFT:
- printf("Software emulation float");
- break;
- case MIPS_R2360:
- printf("MIPS R2360 FPC");
- break;
- case MIPS_R2010:
- printf("MIPS R2010 FPC");
- break;
- case MIPS_R3010:
- printf("MIPS R3010 FPC");
- break;
- case MIPS_R6010:
- printf("MIPS R6010 FPC");
- break;
- case MIPS_R4010:
- printf("MIPS R4010 FPC");
- break;
- case MIPS_R31LSI:
- printf("FPC");
- break;
- case MIPS_R10010:
- printf("MIPS R10000 FPU");
- break;
- case MIPS_R4210:
- printf("MIPS R4200 FPC (ICE)");
- case MIPS_R8000:
- printf("MIPS R8000 Blackbird/TFP");
- break;
- case MIPS_R4600:
- printf("QED R4600 Orion FPC");
- break;
- case MIPS_R3SONY:
- printf("Sony R3000 based FPC");
- break;
- case MIPS_R3TOSH:
- printf("Toshiba R3000 based FPC");
- break;
- case MIPS_R3NKK:
- printf("NKK R3000 based FPC");
- break;
- case MIPS_UNKF1:
- default:
- printf("Unknown FPU type (0x%x)", fpu_id.cpu.cp_imp);
- break;
- }
- printf(" Rev. %d.%d", fpu_id.cpu.cp_majrev, fpu_id.cpu.cp_minrev);
- printf("\n");
-
- printf("Primary cache size: %dkb Instruction, %dkb Data.",
- CpuPrimaryInstCacheSize / 1024,
- CpuPrimaryDataCacheSize / 1024);
- if(CpuTwoWayCache)
- printf(" Two way set associative.\n");
- else
- printf(" Direct mapped.\n");
-}
-
diff --git a/sys/arch/wgrisc/wgrisc/cpu_exec.c b/sys/arch/wgrisc/wgrisc/cpu_exec.c
deleted file mode 100644
index 4e3e657011a..00000000000
--- a/sys/arch/wgrisc/wgrisc/cpu_exec.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/* $NetBSD: cpu_exec.c,v 1.4 1995/04/25 19:16:46 mellon Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by Ralph
- * Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)machdep.c 8.3 (Berkeley) 1/12/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/malloc.h>
-#include <sys/vnode.h>
-#include <sys/exec.h>
-#include <sys/resourcevar.h>
-#include <vm/vm.h>
-
-#include <sys/exec_ecoff.h>
-#include <machine/reg.h>
-
-/*
- * cpu_exec_aout_makecmds():
- * cpu-dependent a.out format hook for execve().
- *
- * Determine of the given exec package refers to something which we
- * understand and, if so, set up the vmcmds for it.
- *
- */
-int
-cpu_exec_aout_makecmds(p, epp)
- struct proc *p;
- struct exec_package *epp;
-{
- return ENOEXEC;
-}
-
-#ifdef COMPAT_ULTRIX
-extern struct emul emul_ultrix;
-
-void
-cpu_exec_ecoff_setregs(p, pack, stack, retval)
- struct proc *p;
- struct exec_package *pack;
- u_long stack;
- register_t *retval;
-{
- struct ecoff_aouthdr *eap;
-
- setregs(p, pack, stack, retval);
- eap = (struct ecoff_aouthdr *)
- ((caddr_t)pack->ep_hdr + sizeof(struct ecoff_filehdr));
- p->p_md.md_regs[GP] = eap->ea_gp_value;
-}
-
-/*
- * cpu_exec_ecoff_hook():
- * cpu-dependent ECOFF format hook for execve().
- *
- * Do any machine-dependent diddling of the exec package when doing ECOFF.
- *
- */
-int
-cpu_exec_ecoff_hook(p, epp, eap)
- struct proc *p;
- struct exec_package *epp;
- struct ecoff_aouthdr *eap;
-{
-
- epp->ep_emul = &emul_ultrix;
- return 0;
-}
-#endif
diff --git a/sys/arch/wgrisc/wgrisc/disksubr.c b/sys/arch/wgrisc/wgrisc/disksubr.c
deleted file mode 100644
index 2d65670f666..00000000000
--- a/sys/arch/wgrisc/wgrisc/disksubr.c
+++ /dev/null
@@ -1,538 +0,0 @@
-/* $OpenBSD: disksubr.c,v 1.12 2000/10/18 21:00:41 mickey Exp $ */
-/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
-
-/*
- * Copyright (c) 1996 Theo de Raadt
- * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-#include <sys/syslog.h>
-#include <sys/disk.h>
-
-#define b_cylin b_resid
-
-#define BOOT_MAGIC 0xAA55
-#define BOOT_MAGIC_OFF (DOSPARTOFF+NDOSPART*sizeof(struct dos_partition))
-
-void
-dk_establish(dk, dev)
- struct disk *dk;
- struct device *dev;
-{
-}
-
-/*
- * Attempt to read a disk label from a device
- * using the indicated strategy routine.
- * The label must be partly set up before this:
- * secpercyl, secsize and anything required for a block i/o read
- * operation in the driver's strategy/start routines
- * must be filled in before calling us.
- *
- * If dos partition table requested, attempt to load it and
- * find disklabel inside a DOS partition. Also, if bad block
- * table needed, attempt to extract it as well. Return buffer
- * for use in signalling errors if requested.
- *
- * We would like to check if each MBR has a valid BOOT_MAGIC, but
- * we cannot because it doesn't always exist. So.. we assume the
- * MBR is valid.
- *
- * Returns null on success and an error string on failure.
- */
-char *
-readdisklabel(dev, strat, lp, osdep, spoofonly)
- dev_t dev;
- void (*strat) __P((struct buf *));
- register struct disklabel *lp;
- struct cpu_disklabel *osdep;
- int spoofonly;
-{
- struct dos_partition *dp = osdep->dosparts, *dp2;
- struct dkbad *bdp = &DKBAD(osdep);
- struct buf *bp;
- struct disklabel *dlp;
- char *msg = NULL, *cp;
- int dospartoff, cyl, i, ourpart = -1;
-
- /* minimal requirements for archtypal disk label */
- if (lp->d_secsize == 0)
- lp->d_secsize = DEV_BSIZE;
- if (lp->d_secperunit == 0)
- lp->d_secperunit = 0x1fffffff;
- lp->d_npartitions = RAW_PART + 1;
- for (i = 0; i < RAW_PART; i++) {
- lp->d_partitions[i].p_size = 0;
- lp->d_partitions[i].p_offset = 0;
- }
- if (lp->d_partitions[i].p_size == 0)
- lp->d_partitions[i].p_size = 0x1fffffff;
- lp->d_partitions[i].p_offset = 0;
-
- /* get a buffer and initialize it */
- bp = geteblk((int)lp->d_secsize);
- bp->b_dev = dev;
-
- /* do dos partitions in the process of getting disklabel? */
- dospartoff = 0;
- cyl = LABELSECTOR / lp->d_secpercyl;
- if (dp) {
- daddr_t part_blkno = DOSBBSECTOR;
- unsigned long extoff = 0;
- int wander = 1, n = 0, loop = 0;
-
- /*
- * Read dos partition table, follow extended partitions.
- * Map the partitions to disklabel entries i-p
- */
- while (wander && n < 8 && loop < 8) {
- loop++;
- wander = 0;
-
- /* read boot record */
- bp->b_blkno = part_blkno;
- bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
- bp->b_cylin = part_blkno / lp->d_secpercyl;
- (*strat)(bp);
-
- /* if successful, wander through dos partition table */
- if (biowait(bp)) {
- msg = "dos partition I/O error";
- goto done;
- }
- bcopy(bp->b_data + DOSPARTOFF, dp, NDOSPART * sizeof(*dp));
-
- if (ourpart == -1) {
- /* Search for our MBR partition */
- for (dp2=dp, i=0; i < NDOSPART && ourpart == -1;
- i++, dp2++)
- if (dp2->dp_size &&
- dp2->dp_typ == DOSPTYP_OPENBSD)
- ourpart = i;
- for (dp2=dp, i=0; i < NDOSPART && ourpart == -1;
- i++, dp2++)
- if (dp2->dp_size &&
- dp2->dp_typ == DOSPTYP_FREEBSD)
- ourpart = i;
- for (dp2=dp, i=0; i < NDOSPART && ourpart == -1;
- i++, dp2++)
- if (dp2->dp_size &&
- dp2->dp_typ == DOSPTYP_NETBSD)
- ourpart = i;
- if (ourpart == -1)
- goto donot;
- /*
- * This is our MBR partition. need sector address
- * for SCSI/IDE, cylinder for ESDI/ST506/RLL
- */
- dp2 = &dp[ourpart];
- dospartoff = dp2->dp_start + part_blkno;
- cyl = DPCYL(dp2->dp_scyl, dp2->dp_ssect);
-
- /* XXX build a temporary disklabel */
- lp->d_partitions[0].p_size = dp2->dp_size;
- lp->d_partitions[0].p_offset = dp2->dp_start +
- part_blkno;
- if (lp->d_ntracks == 0)
- lp->d_ntracks = dp2->dp_ehd + 1;
- if (lp->d_nsectors == 0)
- lp->d_nsectors = DPSECT(dp2->dp_esect);
- if (lp->d_secpercyl == 0)
- lp->d_secpercyl = lp->d_ntracks *
- lp->d_nsectors;
- }
-donot:
- /*
- * In case the disklabel read below fails, we want to
- * provide a fake label in i-p.
- */
- for (dp2=dp, i=0; i < NDOSPART && n < 8; i++, dp2++) {
- struct partition *pp = &lp->d_partitions[8+n];
-
- if (dp2->dp_size)
- pp->p_size = dp2->dp_size;
- if (dp2->dp_start)
- pp->p_offset =
- dp2->dp_start + part_blkno;
-
- switch (dp2->dp_typ) {
- case DOSPTYP_UNUSED:
- for (cp = (char *)dp2;
- cp < (char *)(dp2 + 1); cp++)
- if (*cp)
- break;
- /*
- * Was it all zeroes? If so, it is
- * an unused entry that we don't
- * want to show.
- */
- if (cp == (char *)(dp2 + 1))
- continue;
- lp->d_partitions[8 + n++].p_fstype =
- FS_UNUSED;
- break;
-
- case DOSPTYP_LINUX:
- pp->p_fstype = FS_EXT2FS;
- n++;
- break;
-
- case DOSPTYP_FAT12:
- case DOSPTYP_FAT16S:
- case DOSPTYP_FAT16B:
- case DOSPTYP_FAT32:
- case DOSPTYP_FAT32L:
- case DOSPTYP_FAT16L:
- pp->p_fstype = FS_MSDOS;
- n++;
- break;
- case DOSPTYP_EXTEND:
- part_blkno = dp2->dp_start + extoff;
- if (!extoff)
- extoff = dp2->dp_start;
- wander = 1;
- break;
- default:
- pp->p_fstype = FS_OTHER;
- n++;
- break;
- }
- }
- }
- lp->d_bbsize = 8192;
- lp->d_sbsize = 64*1024; /* XXX ? */
- lp->d_npartitions = MAXPARTITIONS;
- }
-
- /* don't read the on-disk label if we are in spoofed-only mode */
- if (spoofonly)
- goto done;
-
- /* next, dig out disk label */
- bp->b_blkno = dospartoff + LABELSECTOR;
- bp->b_cylin = cyl;
- bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
- (*strat)(bp);
-
- /* if successful, locate disk label within block and validate */
- if (biowait(bp)) {
- /* XXX we return the faked label built so far */
- msg = "disk label I/O error";
- goto done;
- }
- for (dlp = (struct disklabel *)bp->b_data;
- dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp));
- dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
- if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
- if (msg == NULL)
- msg = "no disk label";
- } else if (dlp->d_npartitions > MAXPARTITIONS ||
- dkcksum(dlp) != 0)
- msg = "disk label corrupted";
- else {
- *lp = *dlp;
- msg = NULL;
- break;
- }
- }
-
- if (msg) {
-#if defined(CD9660)
- if (iso_disklabelspoof(dev, strat, lp) == 0)
- msg = NULL;
-#endif
- goto done;
- }
-
- /* obtain bad sector table if requested and present */
- if (bdp && (lp->d_flags & D_BADSECT)) {
- struct dkbad *db;
-
- i = 0;
- do {
- /* read a bad sector table */
- bp->b_flags = B_BUSY | B_READ;
- bp->b_blkno = lp->d_secperunit - lp->d_nsectors + i;
- if (lp->d_secsize > DEV_BSIZE)
- bp->b_blkno *= lp->d_secsize / DEV_BSIZE;
- else
- bp->b_blkno /= DEV_BSIZE / lp->d_secsize;
- bp->b_bcount = lp->d_secsize;
- bp->b_cylin = lp->d_ncylinders - 1;
- (*strat)(bp);
-
- /* if successful, validate, otherwise try another */
- if (biowait(bp)) {
- msg = "bad sector table I/O error";
- } else {
- db = (struct dkbad *)(bp->b_data);
-#define DKBAD_MAGIC 0x4321
- if (db->bt_mbz == 0
- && db->bt_flag == DKBAD_MAGIC) {
- msg = NULL;
- *bdp = *db;
- break;
- } else
- msg = "bad sector table corrupted";
- }
- } while ((bp->b_flags & B_ERROR) && (i += 2) < 10 &&
- i < lp->d_nsectors);
- }
-
-done:
- bp->b_flags |= B_INVAL;
- brelse(bp);
- return (msg);
-}
-
-/*
- * Check new disk label for sensibility
- * before setting it.
- */
-int
-setdisklabel(olp, nlp, openmask, osdep)
- register struct disklabel *olp, *nlp;
- u_long openmask;
- struct cpu_disklabel *osdep;
-{
- register i;
- register struct partition *opp, *npp;
-
- /* sanity clause */
- if (nlp->d_secpercyl == 0 || nlp->d_secsize == 0 ||
- (nlp->d_secsize % DEV_BSIZE) != 0)
- return(EINVAL);
-
- /* special case to allow disklabel to be invalidated */
- if (nlp->d_magic == 0xffffffff) {
- *olp = *nlp;
- return (0);
- }
-
- if (nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC ||
- dkcksum(nlp) != 0)
- return (EINVAL);
-
- /* XXX missing check if other dos partitions will be overwritten */
-
- while (openmask != 0) {
- i = ffs(openmask) - 1;
- openmask &= ~(1 << i);
- if (nlp->d_npartitions <= i)
- return (EBUSY);
- opp = &olp->d_partitions[i];
- npp = &nlp->d_partitions[i];
- if (npp->p_offset != opp->p_offset || npp->p_size < opp->p_size)
- return (EBUSY);
- /*
- * Copy internally-set partition information
- * if new label doesn't include it. XXX
- */
- if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
- npp->p_fstype = opp->p_fstype;
- npp->p_fsize = opp->p_fsize;
- npp->p_frag = opp->p_frag;
- npp->p_cpg = opp->p_cpg;
- }
- }
- nlp->d_checksum = 0;
- nlp->d_checksum = dkcksum(nlp);
- *olp = *nlp;
- return (0);
-}
-
-
-/*
- * Write disk label back to device after modification.
- * XXX cannot handle OpenBSD partitions in extended partitions!
- */
-int
-writedisklabel(dev, strat, lp, osdep)
- dev_t dev;
- void (*strat) __P((struct buf *));
- register struct disklabel *lp;
- struct cpu_disklabel *osdep;
-{
- struct dos_partition *dp = osdep->dosparts, *dp2;
- struct buf *bp;
- struct disklabel *dlp;
- int error, dospartoff, cyl, i;
- int ourpart = -1;
-
- /* get a buffer and initialize it */
- bp = geteblk((int)lp->d_secsize);
- bp->b_dev = dev;
-
- /* do dos partitions in the process of getting disklabel? */
- dospartoff = 0;
- cyl = LABELSECTOR / lp->d_secpercyl;
- if (dp) {
- /* read master boot record */
- bp->b_blkno = DOSBBSECTOR;
- bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
- bp->b_cylin = DOSBBSECTOR / lp->d_secpercyl;
- (*strat)(bp);
-
- if ((error = biowait(bp)) != 0)
- goto done;
-
- /* XXX how do we check veracity/bounds of this? */
- bcopy(bp->b_data + DOSPARTOFF, dp,
- NDOSPART * sizeof(*dp));
-
- for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; i++, dp2++)
- if (dp2->dp_size && dp2->dp_typ == DOSPTYP_OPENBSD)
- ourpart = i;
- for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; i++, dp2++)
- if (dp2->dp_size && dp2->dp_typ == DOSPTYP_FREEBSD)
- ourpart = i;
- for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; i++, dp2++)
- if (dp2->dp_size && dp2->dp_typ == DOSPTYP_NETBSD)
- ourpart = i;
-
- if (ourpart != -1) {
- dp2 = &dp[ourpart];
-
- /*
- * need sector address for SCSI/IDE,
- * cylinder for ESDI/ST506/RLL
- */
- dospartoff = dp2->dp_start;
- cyl = DPCYL(dp2->dp_scyl, dp2->dp_ssect);
- }
- }
-
- /* next, dig out disk label */
- bp->b_blkno = dospartoff + LABELSECTOR;
- bp->b_cylin = cyl;
- bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
- (*strat)(bp);
-
- /* if successful, locate disk label within block and validate */
- if ((error = biowait(bp)) != 0)
- goto done;
- for (dlp = (struct disklabel *)bp->b_data;
- dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp));
- dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
- if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
- dkcksum(dlp) == 0) {
- *dlp = *lp;
- bp->b_flags = B_BUSY | B_WRITE;
- (*strat)(bp);
- error = biowait(bp);
- goto done;
- }
- }
- /* Write it in the regular place. */
- *(struct disklabel *)bp->b_data = *lp;
- bp->b_flags = B_BUSY | B_WRITE;
- (*strat)(bp);
- error = biowait(bp);
- goto done;
-
-done:
- bp->b_flags |= B_INVAL;
- brelse(bp);
- return (error);
-}
-
-/*
- * Determine the size of the transfer, and make sure it is
- * within the boundaries of the partition. Adjust transfer
- * if needed, and signal errors or early completion.
- */
-int
-bounds_check_with_label(bp, lp, osdep, wlabel)
- struct buf *bp;
- struct disklabel *lp;
- struct cpu_disklabel *osdep;
- int wlabel;
-{
-#define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE))
- struct partition *p = lp->d_partitions + DISKPART(bp->b_dev);
- int labelsector = blockpersec(lp->d_partitions[RAW_PART].p_offset, lp) +
- LABELSECTOR;
- int sz = howmany(bp->b_bcount, DEV_BSIZE);
-
- /* avoid division by zero */
- if (lp->d_secpercyl == 0) {
- bp->b_error = EINVAL;
- goto bad;
- }
-
- if (bp->b_blkno + sz > blockpersec(p->p_size, lp)) {
- sz = blockpersec(p->p_size, lp) - bp->b_blkno;
- if (sz == 0) {
- /* If exactly at end of disk, return EOF. */
- bp->b_resid = bp->b_bcount;
- goto done;
- }
- if (sz < 0) {
- /* If past end of disk, return EINVAL. */
- bp->b_error = EINVAL;
- goto bad;
- }
- /* Otherwise, truncate request. */
- bp->b_bcount = sz << DEV_BSHIFT;
- }
-
- /* Overwriting disk label? */
- if (bp->b_blkno + blockpersec(p->p_offset, lp) <= labelsector &&
-#if LABELSECTOR != 0
- bp->b_blkno + blockpersec(p->p_offset, lp) + sz > labelsector &&
-#endif
- (bp->b_flags & B_READ) == 0 && !wlabel) {
- bp->b_error = EROFS;
- goto bad;
- }
-
- /* calculate cylinder for disksort to order transfers with */
- bp->b_cylin = (bp->b_blkno + blockpersec(p->p_offset, lp)) /
- lp->d_secpercyl;
- return (1);
-
-bad:
- bp->b_flags |= B_ERROR;
-done:
- return (0);
-}
diff --git a/sys/arch/wgrisc/wgrisc/fp.S b/sys/arch/wgrisc/wgrisc/fp.S
deleted file mode 100644
index 325129857e0..00000000000
--- a/sys/arch/wgrisc/wgrisc/fp.S
+++ /dev/null
@@ -1,3611 +0,0 @@
-/* $OpenBSD: fp.S,v 1.1.1.1 1997/02/06 16:02:45 pefo Exp $ */
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)fp.s 8.1 (Berkeley) 6/10/93
- * $Id: fp.S,v 1.1.1.1 1997/02/06 16:02:45 pefo Exp $
- */
-
-/*
- * Standard header stuff.
- */
-
-#include <machine/regdef.h>
-#include <machine/asm.h>
-#include <machine/cpu.h>
-
-#include "assym.h"
-
-#define SEXP_INF 0xff
-#define DEXP_INF 0x7ff
-#define SEXP_BIAS 127
-#define DEXP_BIAS 1023
-#define SEXP_MIN -126
-#define DEXP_MIN -1022
-#define SEXP_MAX 127
-#define DEXP_MAX 1023
-#define WEXP_MAX 30 /* maximum unbiased exponent for int */
-#define WEXP_MIN -1 /* minimum unbiased exponent for int */
-#define SFRAC_BITS 23
-#define DFRAC_BITS 52
-#define SIMPL_ONE 0x00800000
-#define DIMPL_ONE 0x00100000
-#define SLEAD_ZEROS 31 - 23
-#define DLEAD_ZEROS 31 - 20
-#define STICKYBIT 1
-#define GUARDBIT 0x80000000
-#define SSIGNAL_NAN 0x00400000
-#define DSIGNAL_NAN 0x00080000
-#define SQUIET_NAN 0x003fffff
-#define DQUIET_NAN0 0x0007ffff
-#define DQUIET_NAN1 0xffffffff
-#define INT_MIN 0x80000000
-#define INT_MAX 0x7fffffff
-
-#define COND_UNORDERED 0x1
-#define COND_EQUAL 0x2
-#define COND_LESS 0x4
-#define COND_SIGNAL 0x8
-
-/*----------------------------------------------------------------------------
- *
- * CPU_EmulateFP --
- *
- * Emulate unimplemented floating point operations.
- * This routine should only be called by CPU_FPInterrupt().
- *
- * CPU_EmulateFP(instr)
- * unsigned instr;
- *
- * Results:
- * None.
- *
- * Side effects:
- * Floating point registers are modified according to instruction.
- *
- *----------------------------------------------------------------------------
- */
-NON_LEAF(CPU_EmulateFP, STAND_FRAME_SIZE, ra)
- subu sp, sp, STAND_FRAME_SIZE
- sw ra, STAND_RA_OFFSET(sp)
-/*
- * Decode the FMT field (bits 24-21) and FUNCTION field (bits 5-0).
- */
- srl v0, a0, 21 - 2 # get FMT field
- and v0, v0, 0xF << 2 # mask FMT field
- and v1, a0, 0x3F # mask FUNC field
- sll v1, v1, 5 # align for table lookup
- bgt v0, 4 << 2, ill # illegal format
-
- or v1, v1, v0
- cfc1 a1, FPC_CSR # get exception register
- lw a3, func_fmt_tbl(v1) # switch on FUNC & FMT
- and a1, a1, ~FPC_EXCEPTION_UNIMPL # clear exception
- ctc1 a1, FPC_CSR
- j a3
-
- .rdata
-func_fmt_tbl:
- .word add_s # 0
- .word add_d # 0
- .word ill # 0
- .word ill # 0
- .word ill # 0
- .word ill # 0
- .word ill # 0
- .word ill # 0
- .word sub_s # 1
- .word sub_d # 1
- .word ill # 1
- .word ill # 1
- .word ill # 1
- .word ill # 1
- .word ill # 1
- .word ill # 1
- .word mul_s # 2
- .word mul_d # 2
- .word ill # 2
- .word ill # 2
- .word ill # 2
- .word ill # 2
- .word ill # 2
- .word ill # 2
- .word div_s # 3
- .word div_d # 3
- .word ill # 3
- .word ill # 3
- .word ill # 3
- .word ill # 3
- .word ill # 3
- .word ill # 3
- .word ill # 4
- .word ill # 4
- .word ill # 4
- .word ill # 4
- .word ill # 4
- .word ill # 4
- .word ill # 4
- .word ill # 4
- .word abs_s # 5
- .word abs_d # 5
- .word ill # 5
- .word ill # 5
- .word ill # 5
- .word ill # 5
- .word ill # 5
- .word ill # 5
- .word mov_s # 6
- .word mov_d # 6
- .word ill # 6
- .word ill # 6
- .word ill # 6
- .word ill # 6
- .word ill # 6
- .word ill # 6
- .word neg_s # 7
- .word neg_d # 7
- .word ill # 7
- .word ill # 7
- .word ill # 7
- .word ill # 7
- .word ill # 7
- .word ill # 7
- .word ill # 8
- .word ill # 8
- .word ill # 8
- .word ill # 8
- .word ill # 8
- .word ill # 8
- .word ill # 8
- .word ill # 8
- .word ill # 9
- .word ill # 9
- .word ill # 9
- .word ill # 9
- .word ill # 9
- .word ill # 9
- .word ill # 9
- .word ill # 9
- .word ill # 10
- .word ill # 10
- .word ill # 10
- .word ill # 10
- .word ill # 10
- .word ill # 10
- .word ill # 10
- .word ill # 10
- .word ill # 11
- .word ill # 11
- .word ill # 11
- .word ill # 11
- .word ill # 11
- .word ill # 11
- .word ill # 11
- .word ill # 11
- .word ill # 12
- .word ill # 12
- .word ill # 12
- .word ill # 12
- .word ill # 12
- .word ill # 12
- .word ill # 12
- .word ill # 12
- .word ill # 13
- .word ill # 13
- .word ill # 13
- .word ill # 13
- .word ill # 13
- .word ill # 13
- .word ill # 13
- .word ill # 13
- .word ill # 14
- .word ill # 14
- .word ill # 14
- .word ill # 14
- .word ill # 14
- .word ill # 14
- .word ill # 14
- .word ill # 14
- .word ill # 15
- .word ill # 15
- .word ill # 15
- .word ill # 15
- .word ill # 15
- .word ill # 15
- .word ill # 15
- .word ill # 15
- .word ill # 16
- .word ill # 16
- .word ill # 16
- .word ill # 16
- .word ill # 16
- .word ill # 16
- .word ill # 16
- .word ill # 16
- .word ill # 17
- .word ill # 17
- .word ill # 17
- .word ill # 17
- .word ill # 17
- .word ill # 17
- .word ill # 17
- .word ill # 17
- .word ill # 18
- .word ill # 18
- .word ill # 18
- .word ill # 18
- .word ill # 18
- .word ill # 18
- .word ill # 18
- .word ill # 18
- .word ill # 19
- .word ill # 19
- .word ill # 19
- .word ill # 19
- .word ill # 19
- .word ill # 19
- .word ill # 19
- .word ill # 19
- .word ill # 20
- .word ill # 20
- .word ill # 20
- .word ill # 20
- .word ill # 20
- .word ill # 20
- .word ill # 20
- .word ill # 20
- .word ill # 21
- .word ill # 21
- .word ill # 21
- .word ill # 21
- .word ill # 21
- .word ill # 21
- .word ill # 21
- .word ill # 21
- .word ill # 22
- .word ill # 22
- .word ill # 22
- .word ill # 22
- .word ill # 22
- .word ill # 22
- .word ill # 22
- .word ill # 22
- .word ill # 23
- .word ill # 23
- .word ill # 23
- .word ill # 23
- .word ill # 23
- .word ill # 23
- .word ill # 23
- .word ill # 23
- .word ill # 24
- .word ill # 24
- .word ill # 24
- .word ill # 24
- .word ill # 24
- .word ill # 24
- .word ill # 24
- .word ill # 24
- .word ill # 25
- .word ill # 25
- .word ill # 25
- .word ill # 25
- .word ill # 25
- .word ill # 25
- .word ill # 25
- .word ill # 25
- .word ill # 26
- .word ill # 26
- .word ill # 26
- .word ill # 26
- .word ill # 26
- .word ill # 26
- .word ill # 26
- .word ill # 26
- .word ill # 27
- .word ill # 27
- .word ill # 27
- .word ill # 27
- .word ill # 27
- .word ill # 27
- .word ill # 27
- .word ill # 27
- .word ill # 28
- .word ill # 28
- .word ill # 28
- .word ill # 28
- .word ill # 28
- .word ill # 28
- .word ill # 28
- .word ill # 28
- .word ill # 29
- .word ill # 29
- .word ill # 29
- .word ill # 29
- .word ill # 29
- .word ill # 29
- .word ill # 29
- .word ill # 29
- .word ill # 30
- .word ill # 30
- .word ill # 30
- .word ill # 30
- .word ill # 30
- .word ill # 30
- .word ill # 30
- .word ill # 30
- .word ill # 31
- .word ill # 31
- .word ill # 31
- .word ill # 31
- .word ill # 31
- .word ill # 31
- .word ill # 31
- .word ill # 31
- .word ill # 32
- .word cvt_s_d # 32
- .word ill # 32
- .word ill # 32
- .word cvt_s_w # 32
- .word ill # 32
- .word ill # 32
- .word ill # 32
- .word cvt_d_s # 33
- .word ill # 33
- .word ill # 33
- .word ill # 33
- .word cvt_d_w # 33
- .word ill # 33
- .word ill # 33
- .word ill # 33
- .word ill # 34
- .word ill # 34
- .word ill # 34
- .word ill # 34
- .word ill # 34
- .word ill # 34
- .word ill # 34
- .word ill # 34
- .word ill # 35
- .word ill # 35
- .word ill # 35
- .word ill # 35
- .word ill # 35
- .word ill # 35
- .word ill # 35
- .word ill # 35
- .word cvt_w_s # 36
- .word cvt_w_d # 36
- .word ill # 36
- .word ill # 36
- .word ill # 36
- .word ill # 36
- .word ill # 36
- .word ill # 36
- .word ill # 37
- .word ill # 37
- .word ill # 37
- .word ill # 37
- .word ill # 37
- .word ill # 37
- .word ill # 37
- .word ill # 37
- .word ill # 38
- .word ill # 38
- .word ill # 38
- .word ill # 38
- .word ill # 38
- .word ill # 38
- .word ill # 38
- .word ill # 38
- .word ill # 39
- .word ill # 39
- .word ill # 39
- .word ill # 39
- .word ill # 39
- .word ill # 39
- .word ill # 39
- .word ill # 39
- .word ill # 40
- .word ill # 40
- .word ill # 40
- .word ill # 40
- .word ill # 40
- .word ill # 40
- .word ill # 40
- .word ill # 40
- .word ill # 41
- .word ill # 41
- .word ill # 41
- .word ill # 41
- .word ill # 41
- .word ill # 41
- .word ill # 41
- .word ill # 41
- .word ill # 42
- .word ill # 42
- .word ill # 42
- .word ill # 42
- .word ill # 42
- .word ill # 42
- .word ill # 42
- .word ill # 42
- .word ill # 43
- .word ill # 43
- .word ill # 43
- .word ill # 43
- .word ill # 43
- .word ill # 43
- .word ill # 43
- .word ill # 43
- .word ill # 44
- .word ill # 44
- .word ill # 44
- .word ill # 44
- .word ill # 44
- .word ill # 44
- .word ill # 44
- .word ill # 44
- .word ill # 45
- .word ill # 45
- .word ill # 45
- .word ill # 45
- .word ill # 45
- .word ill # 45
- .word ill # 45
- .word ill # 45
- .word ill # 46
- .word ill # 46
- .word ill # 46
- .word ill # 46
- .word ill # 46
- .word ill # 46
- .word ill # 46
- .word ill # 46
- .word ill # 47
- .word ill # 47
- .word ill # 47
- .word ill # 47
- .word ill # 47
- .word ill # 47
- .word ill # 47
- .word ill # 47
- .word cmp_s # 48
- .word cmp_d # 48
- .word ill # 48
- .word ill # 48
- .word ill # 48
- .word ill # 48
- .word ill # 48
- .word ill # 48
- .word cmp_s # 49
- .word cmp_d # 49
- .word ill # 49
- .word ill # 49
- .word ill # 49
- .word ill # 49
- .word ill # 49
- .word ill # 49
- .word cmp_s # 50
- .word cmp_d # 50
- .word ill # 50
- .word ill # 50
- .word ill # 50
- .word ill # 50
- .word ill # 50
- .word ill # 50
- .word cmp_s # 51
- .word cmp_d # 51
- .word ill # 51
- .word ill # 51
- .word ill # 51
- .word ill # 51
- .word ill # 51
- .word ill # 51
- .word cmp_s # 52
- .word cmp_d # 52
- .word ill # 52
- .word ill # 52
- .word ill # 52
- .word ill # 52
- .word ill # 52
- .word ill # 52
- .word cmp_s # 53
- .word cmp_d # 53
- .word ill # 53
- .word ill # 53
- .word ill # 53
- .word ill # 53
- .word ill # 53
- .word ill # 53
- .word cmp_s # 54
- .word cmp_d # 54
- .word ill # 54
- .word ill # 54
- .word ill # 54
- .word ill # 54
- .word ill # 54
- .word ill # 54
- .word cmp_s # 55
- .word cmp_d # 55
- .word ill # 55
- .word ill # 55
- .word ill # 55
- .word ill # 55
- .word ill # 55
- .word ill # 55
- .word cmp_s # 56
- .word cmp_d # 56
- .word ill # 56
- .word ill # 56
- .word ill # 56
- .word ill # 56
- .word ill # 56
- .word ill # 56
- .word cmp_s # 57
- .word cmp_d # 57
- .word ill # 57
- .word ill # 57
- .word ill # 57
- .word ill # 57
- .word ill # 57
- .word ill # 57
- .word cmp_s # 58
- .word cmp_d # 58
- .word ill # 58
- .word ill # 58
- .word ill # 58
- .word ill # 58
- .word ill # 58
- .word ill # 58
- .word cmp_s # 59
- .word cmp_d # 59
- .word ill # 59
- .word ill # 59
- .word ill # 59
- .word ill # 59
- .word ill # 59
- .word ill # 59
- .word cmp_s # 60
- .word cmp_d # 60
- .word ill # 60
- .word ill # 60
- .word ill # 60
- .word ill # 60
- .word ill # 60
- .word ill # 60
- .word cmp_s # 61
- .word cmp_d # 61
- .word ill # 61
- .word ill # 61
- .word ill # 61
- .word ill # 61
- .word ill # 61
- .word ill # 61
- .word cmp_s # 62
- .word cmp_d # 62
- .word ill # 62
- .word ill # 62
- .word ill # 62
- .word ill # 62
- .word ill # 62
- .word ill # 62
- .word cmp_s # 63
- .word cmp_d # 63
- .word ill # 63
- .word ill # 63
- .word ill # 63
- .word ill # 63
- .word ill # 63
- .word ill # 63
- .text
-
-/*
- * Single precision subtract.
- */
-sub_s:
- jal get_ft_fs_s
- xor t4, t4, 1 # negate FT sign bit
- b add_sub_s
-/*
- * Single precision add.
- */
-add_s:
- jal get_ft_fs_s
-add_sub_s:
- bne t1, SEXP_INF, 1f # is FS an infinity?
- bne t5, SEXP_INF, result_fs_s # if FT is not inf, result=FS
- bne t2, zero, result_fs_s # if FS is NAN, result is FS
- bne t6, zero, result_ft_s # if FT is NAN, result is FT
- bne t0, t4, invalid_s # both infinities same sign?
- b result_fs_s # result is in FS
-1:
- beq t5, SEXP_INF, result_ft_s # if FT is inf, result=FT
- bne t1, zero, 4f # is FS a denormalized num?
- beq t2, zero, 3f # is FS zero?
- bne t5, zero, 2f # is FT a denormalized num?
- beq t6, zero, result_fs_s # FT is zero, result=FS
- jal renorm_fs_s
- jal renorm_ft_s
- b 5f
-2:
- jal renorm_fs_s
- subu t5, t5, SEXP_BIAS # unbias FT exponent
- or t6, t6, SIMPL_ONE # set implied one bit
- b 5f
-3:
- bne t5, zero, result_ft_s # if FT != 0, result=FT
- bne t6, zero, result_ft_s
- and v0, a1, FPC_ROUNDING_BITS # get rounding mode
- bne v0, FPC_ROUND_RM, 1f # round to -infinity?
- or t0, t0, t4 # compute result sign
- b result_fs_s
-1:
- and t0, t0, t4 # compute result sign
- b result_fs_s
-4:
- bne t5, zero, 2f # is FT a denormalized num?
- beq t6, zero, result_fs_s # FT is zero, result=FS
- subu t1, t1, SEXP_BIAS # unbias FS exponent
- or t2, t2, SIMPL_ONE # set implied one bit
- jal renorm_ft_s
- b 5f
-2:
- subu t1, t1, SEXP_BIAS # unbias FS exponent
- or t2, t2, SIMPL_ONE # set implied one bit
- subu t5, t5, SEXP_BIAS # unbias FT exponent
- or t6, t6, SIMPL_ONE # set implied one bit
-/*
- * Perform the addition.
- */
-5:
- move t8, zero # no shifted bits (sticky reg)
- beq t1, t5, 4f # no shift needed
- subu v0, t1, t5 # v0 = difference of exponents
- move v1, v0 # v1 = abs(difference)
- bge v0, zero, 1f
- negu v1
-1:
- ble v1, SFRAC_BITS+2, 2f # is difference too great?
- li t8, STICKYBIT # set the sticky bit
- bge v0, zero, 1f # check which exp is larger
- move t1, t5 # result exp is FTs
- move t2, zero # FSs fraction shifted is zero
- b 4f
-1:
- move t6, zero # FTs fraction shifted is zero
- b 4f
-2:
- li t9, 32 # compute 32 - abs(exp diff)
- subu t9, t9, v1
- bgt v0, zero, 3f # if FS > FT, shift FTs frac
- move t1, t5 # FT > FS, result exp is FTs
- sll t8, t2, t9 # save bits shifted out
- srl t2, t2, v1 # shift FSs fraction
- b 4f
-3:
- sll t8, t6, t9 # save bits shifted out
- srl t6, t6, v1 # shift FTs fraction
-4:
- bne t0, t4, 1f # if signs differ, subtract
- addu t2, t2, t6 # add fractions
- b norm_s
-1:
- blt t2, t6, 3f # subtract larger from smaller
- bne t2, t6, 2f # if same, result=0
- move t1, zero # result=0
- move t2, zero
- and v0, a1, FPC_ROUNDING_BITS # get rounding mode
- bne v0, FPC_ROUND_RM, 1f # round to -infinity?
- or t0, t0, t4 # compute result sign
- b result_fs_s
-1:
- and t0, t0, t4 # compute result sign
- b result_fs_s
-2:
- sltu t9, zero, t8 # compute t2:zero - t6:t8
- subu t8, zero, t8
- subu t2, t2, t6 # subtract fractions
- subu t2, t2, t9 # subtract barrow
- b norm_s
-3:
- move t0, t4 # sign of result = FTs
- sltu t9, zero, t8 # compute t6:zero - t2:t8
- subu t8, zero, t8
- subu t2, t6, t2 # subtract fractions
- subu t2, t2, t9 # subtract barrow
- b norm_s
-
-/*
- * Double precision subtract.
- */
-sub_d:
- jal get_ft_fs_d
- xor t4, t4, 1 # negate sign bit
- b add_sub_d
-/*
- * Double precision add.
- */
-add_d:
- jal get_ft_fs_d
-add_sub_d:
- bne t1, DEXP_INF, 1f # is FS an infinity?
- bne t5, DEXP_INF, result_fs_d # if FT is not inf, result=FS
- bne t2, zero, result_fs_d # if FS is NAN, result is FS
- bne t3, zero, result_fs_d
- bne t6, zero, result_ft_d # if FT is NAN, result is FT
- bne t7, zero, result_ft_d
- bne t0, t4, invalid_d # both infinities same sign?
- b result_fs_d # result is in FS
-1:
- beq t5, DEXP_INF, result_ft_d # if FT is inf, result=FT
- bne t1, zero, 4f # is FS a denormalized num?
- bne t2, zero, 1f # is FS zero?
- beq t3, zero, 3f
-1:
- bne t5, zero, 2f # is FT a denormalized num?
- bne t6, zero, 1f
- beq t7, zero, result_fs_d # FT is zero, result=FS
-1:
- jal renorm_fs_d
- jal renorm_ft_d
- b 5f
-2:
- jal renorm_fs_d
- subu t5, t5, DEXP_BIAS # unbias FT exponent
- or t6, t6, DIMPL_ONE # set implied one bit
- b 5f
-3:
- bne t5, zero, result_ft_d # if FT != 0, result=FT
- bne t6, zero, result_ft_d
- bne t7, zero, result_ft_d
- and v0, a1, FPC_ROUNDING_BITS # get rounding mode
- bne v0, FPC_ROUND_RM, 1f # round to -infinity?
- or t0, t0, t4 # compute result sign
- b result_fs_d
-1:
- and t0, t0, t4 # compute result sign
- b result_fs_d
-4:
- bne t5, zero, 2f # is FT a denormalized num?
- bne t6, zero, 1f
- beq t7, zero, result_fs_d # FT is zero, result=FS
-1:
- subu t1, t1, DEXP_BIAS # unbias FS exponent
- or t2, t2, DIMPL_ONE # set implied one bit
- jal renorm_ft_d
- b 5f
-2:
- subu t1, t1, DEXP_BIAS # unbias FS exponent
- or t2, t2, DIMPL_ONE # set implied one bit
- subu t5, t5, DEXP_BIAS # unbias FT exponent
- or t6, t6, DIMPL_ONE # set implied one bit
-/*
- * Perform the addition.
- */
-5:
- move t8, zero # no shifted bits (sticky reg)
- beq t1, t5, 4f # no shift needed
- subu v0, t1, t5 # v0 = difference of exponents
- move v1, v0 # v1 = abs(difference)
- bge v0, zero, 1f
- negu v1
-1:
- ble v1, DFRAC_BITS+2, 2f # is difference too great?
- li t8, STICKYBIT # set the sticky bit
- bge v0, zero, 1f # check which exp is larger
- move t1, t5 # result exp is FTs
- move t2, zero # FSs fraction shifted is zero
- move t3, zero
- b 4f
-1:
- move t6, zero # FTs fraction shifted is zero
- move t7, zero
- b 4f
-2:
- li t9, 32
- bge v0, zero, 3f # if FS > FT, shift FTs frac
- move t1, t5 # FT > FS, result exp is FTs
- blt v1, t9, 1f # shift right by < 32?
- subu v1, v1, t9
- subu t9, t9, v1
- sll t8, t2, t9 # save bits shifted out
- sltu t9, zero, t3 # dont lose any one bits
- or t8, t8, t9 # save sticky bit
- srl t3, t2, v1 # shift FSs fraction
- move t2, zero
- b 4f
-1:
- subu t9, t9, v1
- sll t8, t3, t9 # save bits shifted out
- srl t3, t3, v1 # shift FSs fraction
- sll t9, t2, t9 # save bits shifted out of t2
- or t3, t3, t9 # and put into t3
- srl t2, t2, v1
- b 4f
-3:
- blt v1, t9, 1f # shift right by < 32?
- subu v1, v1, t9
- subu t9, t9, v1
- sll t8, t6, t9 # save bits shifted out
- srl t7, t6, v1 # shift FTs fraction
- move t6, zero
- b 4f
-1:
- subu t9, t9, v1
- sll t8, t7, t9 # save bits shifted out
- srl t7, t7, v1 # shift FTs fraction
- sll t9, t6, t9 # save bits shifted out of t2
- or t7, t7, t9 # and put into t3
- srl t6, t6, v1
-4:
- bne t0, t4, 1f # if signs differ, subtract
- addu t3, t3, t7 # add fractions
- sltu t9, t3, t7 # compute carry
- addu t2, t2, t6 # add fractions
- addu t2, t2, t9 # add carry
- b norm_d
-1:
- blt t2, t6, 3f # subtract larger from smaller
- bne t2, t6, 2f
- bltu t3, t7, 3f
- bne t3, t7, 2f # if same, result=0
- move t1, zero # result=0
- move t2, zero
- move t3, zero
- and v0, a1, FPC_ROUNDING_BITS # get rounding mode
- bne v0, FPC_ROUND_RM, 1f # round to -infinity?
- or t0, t0, t4 # compute result sign
- b result_fs_d
-1:
- and t0, t0, t4 # compute result sign
- b result_fs_d
-2:
- beq t8, zero, 1f # compute t2:t3:zero - t6:t7:t8
- subu t8, zero, t8
- sltu v0, t3, 1 # compute barrow out
- subu t3, t3, 1 # subtract barrow
- subu t2, t2, v0
-1:
- sltu v0, t3, t7
- subu t3, t3, t7 # subtract fractions
- subu t2, t2, t6 # subtract fractions
- subu t2, t2, v0 # subtract barrow
- b norm_d
-3:
- move t0, t4 # sign of result = FTs
- beq t8, zero, 1f # compute t6:t7:zero - t2:t3:t8
- subu t8, zero, t8
- sltu v0, t7, 1 # compute barrow out
- subu t7, t7, 1 # subtract barrow
- subu t6, t6, v0
-1:
- sltu v0, t7, t3
- subu t3, t7, t3 # subtract fractions
- subu t2, t6, t2 # subtract fractions
- subu t2, t2, v0 # subtract barrow
- b norm_d
-
-/*
- * Single precision multiply.
- */
-mul_s:
- jal get_ft_fs_s
- xor t0, t0, t4 # compute sign of result
- move t4, t0
- bne t1, SEXP_INF, 2f # is FS an infinity?
- bne t2, zero, result_fs_s # if FS is a NAN, result=FS
- bne t5, SEXP_INF, 1f # FS is inf, is FT an infinity?
- bne t6, zero, result_ft_s # if FT is a NAN, result=FT
- b result_fs_s # result is infinity
-1:
- bne t5, zero, result_fs_s # inf * zero? if no, result=FS
- bne t6, zero, result_fs_s
- b invalid_s # infinity * zero is invalid
-2:
- bne t5, SEXP_INF, 1f # FS != inf, is FT an infinity?
- bne t1, zero, result_ft_s # zero * inf? if no, result=FT
- bne t2, zero, result_ft_s
- bne t6, zero, result_ft_s # if FT is a NAN, result=FT
- b invalid_s # zero * infinity is invalid
-1:
- bne t1, zero, 1f # is FS zero?
- beq t2, zero, result_fs_s # result is zero
- jal renorm_fs_s
- b 2f
-1:
- subu t1, t1, SEXP_BIAS # unbias FS exponent
- or t2, t2, SIMPL_ONE # set implied one bit
-2:
- bne t5, zero, 1f # is FT zero?
- beq t6, zero, result_ft_s # result is zero
- jal renorm_ft_s
- b 2f
-1:
- subu t5, t5, SEXP_BIAS # unbias FT exponent
- or t6, t6, SIMPL_ONE # set implied one bit
-2:
- addu t1, t1, t5 # compute result exponent
- addu t1, t1, 9 # account for binary point
- multu t2, t6 # multiply fractions
- mflo t8
- mfhi t2
- b norm_s
-
-/*
- * Double precision multiply.
- */
-mul_d:
- jal get_ft_fs_d
- xor t0, t0, t4 # compute sign of result
- move t4, t0
- bne t1, DEXP_INF, 2f # is FS an infinity?
- bne t2, zero, result_fs_d # if FS is a NAN, result=FS
- bne t3, zero, result_fs_d
- bne t5, DEXP_INF, 1f # FS is inf, is FT an infinity?
- bne t6, zero, result_ft_d # if FT is a NAN, result=FT
- bne t7, zero, result_ft_d
- b result_fs_d # result is infinity
-1:
- bne t5, zero, result_fs_d # inf * zero? if no, result=FS
- bne t6, zero, result_fs_d
- bne t7, zero, result_fs_d
- b invalid_d # infinity * zero is invalid
-2:
- bne t5, DEXP_INF, 1f # FS != inf, is FT an infinity?
- bne t1, zero, result_ft_d # zero * inf? if no, result=FT
- bne t2, zero, result_ft_d # if FS is a NAN, result=FS
- bne t3, zero, result_ft_d
- bne t6, zero, result_ft_d # if FT is a NAN, result=FT
- bne t7, zero, result_ft_d
- b invalid_d # zero * infinity is invalid
-1:
- bne t1, zero, 2f # is FS zero?
- bne t2, zero, 1f
- beq t3, zero, result_fs_d # result is zero
-1:
- jal renorm_fs_d
- b 3f
-2:
- subu t1, t1, DEXP_BIAS # unbias FS exponent
- or t2, t2, DIMPL_ONE # set implied one bit
-3:
- bne t5, zero, 2f # is FT zero?
- bne t6, zero, 1f
- beq t7, zero, result_ft_d # result is zero
-1:
- jal renorm_ft_d
- b 3f
-2:
- subu t5, t5, DEXP_BIAS # unbias FT exponent
- or t6, t6, DIMPL_ONE # set implied one bit
-3:
- addu t1, t1, t5 # compute result exponent
- addu t1, t1, 12 # ???
- multu t3, t7 # multiply fractions (low * low)
- move t4, t2 # free up t2,t3 for result
- move t5, t3
- mflo a3 # save low order bits
- mfhi t8
- not v0, t8
- multu t4, t7 # multiply FS(high) * FT(low)
- mflo v1
- mfhi t3 # init low result
- sltu v0, v0, v1 # compute carry
- addu t8, v1
- multu t5, t6 # multiply FS(low) * FT(high)
- addu t3, t3, v0 # add carry
- not v0, t8
- mflo v1
- mfhi t2
- sltu v0, v0, v1
- addu t8, v1
- multu t4, t6 # multiply FS(high) * FT(high)
- addu t3, v0
- not v1, t3
- sltu v1, v1, t2
- addu t3, t2
- not v0, t3
- mfhi t2
- addu t2, v1
- mflo v1
- sltu v0, v0, v1
- addu t2, v0
- addu t3, v1
- sltu a3, zero, a3 # reduce t8,a3 to just t8
- or t8, a3
- b norm_d
-
-/*
- * Single precision divide.
- */
-div_s:
- jal get_ft_fs_s
- xor t0, t0, t4 # compute sign of result
- move t4, t0
- bne t1, SEXP_INF, 1f # is FS an infinity?
- bne t2, zero, result_fs_s # if FS is NAN, result is FS
- bne t5, SEXP_INF, result_fs_s # is FT an infinity?
- bne t6, zero, result_ft_s # if FT is NAN, result is FT
- b invalid_s # infinity/infinity is invalid
-1:
- bne t5, SEXP_INF, 1f # is FT an infinity?
- bne t6, zero, result_ft_s # if FT is NAN, result is FT
- move t1, zero # x / infinity is zero
- move t2, zero
- b result_fs_s
-1:
- bne t1, zero, 2f # is FS zero?
- bne t2, zero, 1f
- bne t5, zero, result_fs_s # FS=zero, is FT zero?
- beq t6, zero, invalid_s # 0 / 0
- b result_fs_s # result = zero
-1:
- jal renorm_fs_s
- b 3f
-2:
- subu t1, t1, SEXP_BIAS # unbias FS exponent
- or t2, t2, SIMPL_ONE # set implied one bit
-3:
- bne t5, zero, 2f # is FT zero?
- bne t6, zero, 1f
- or a1, a1, FPC_EXCEPTION_DIV0 | FPC_STICKY_DIV0
- and v0, a1, FPC_ENABLE_DIV0 # trap enabled?
- bne v0, zero, fpe_trap
- ctc1 a1, FPC_CSR # save exceptions
- li t1, SEXP_INF # result is infinity
- move t2, zero
- b result_fs_s
-1:
- jal renorm_ft_s
- b 3f
-2:
- subu t5, t5, SEXP_BIAS # unbias FT exponent
- or t6, t6, SIMPL_ONE # set implied one bit
-3:
- subu t1, t1, t5 # compute exponent
- subu t1, t1, 3 # compensate for result position
- li v0, SFRAC_BITS+3 # number of bits to divide
- move t8, t2 # init dividend
- move t2, zero # init result
-1:
- bltu t8, t6, 3f # is dividend >= divisor?
-2:
- subu t8, t8, t6 # subtract divisor from dividend
- or t2, t2, 1 # remember that we did
- bne t8, zero, 3f # if not done, continue
- sll t2, t2, v0 # shift result to final position
- b norm_s
-3:
- sll t8, t8, 1 # shift dividend
- sll t2, t2, 1 # shift result
- subu v0, v0, 1 # are we done?
- bne v0, zero, 1b # no, continue
- b norm_s
-
-/*
- * Double precision divide.
- */
-div_d:
- jal get_ft_fs_d
- xor t0, t0, t4 # compute sign of result
- move t4, t0
- bne t1, DEXP_INF, 1f # is FS an infinity?
- bne t2, zero, result_fs_d # if FS is NAN, result is FS
- bne t3, zero, result_fs_d
- bne t5, DEXP_INF, result_fs_d # is FT an infinity?
- bne t6, zero, result_ft_d # if FT is NAN, result is FT
- bne t7, zero, result_ft_d
- b invalid_d # infinity/infinity is invalid
-1:
- bne t5, DEXP_INF, 1f # is FT an infinity?
- bne t6, zero, result_ft_d # if FT is NAN, result is FT
- bne t7, zero, result_ft_d
- move t1, zero # x / infinity is zero
- move t2, zero
- move t3, zero
- b result_fs_d
-1:
- bne t1, zero, 2f # is FS zero?
- bne t2, zero, 1f
- bne t3, zero, 1f
- bne t5, zero, result_fs_d # FS=zero, is FT zero?
- bne t6, zero, result_fs_d
- beq t7, zero, invalid_d # 0 / 0
- b result_fs_d # result = zero
-1:
- jal renorm_fs_d
- b 3f
-2:
- subu t1, t1, DEXP_BIAS # unbias FS exponent
- or t2, t2, DIMPL_ONE # set implied one bit
-3:
- bne t5, zero, 2f # is FT zero?
- bne t6, zero, 1f
- bne t7, zero, 1f
- or a1, a1, FPC_EXCEPTION_DIV0 | FPC_STICKY_DIV0
- and v0, a1, FPC_ENABLE_DIV0 # trap enabled?
- bne v0, zero, fpe_trap
- ctc1 a1, FPC_CSR # Save exceptions
- li t1, DEXP_INF # result is infinity
- move t2, zero
- move t3, zero
- b result_fs_d
-1:
- jal renorm_ft_d
- b 3f
-2:
- subu t5, t5, DEXP_BIAS # unbias FT exponent
- or t6, t6, DIMPL_ONE # set implied one bit
-3:
- subu t1, t1, t5 # compute exponent
- subu t1, t1, 3 # compensate for result position
- li v0, DFRAC_BITS+3 # number of bits to divide
- move t8, t2 # init dividend
- move t9, t3
- move t2, zero # init result
- move t3, zero
-1:
- bltu t8, t6, 3f # is dividend >= divisor?
- bne t8, t6, 2f
- bltu t9, t7, 3f
-2:
- sltu v1, t9, t7 # subtract divisor from dividend
- subu t9, t9, t7
- subu t8, t8, t6
- subu t8, t8, v1
- or t3, t3, 1 # remember that we did
- bne t8, zero, 3f # if not done, continue
- bne t9, zero, 3f
- li v1, 32 # shift result to final position
- blt v0, v1, 2f # shift < 32 bits?
- subu v0, v0, v1 # shift by > 32 bits
- sll t2, t3, v0 # shift upper part
- move t3, zero
- b norm_d
-2:
- subu v1, v1, v0 # shift by < 32 bits
- sll t2, t2, v0 # shift upper part
- srl t9, t3, v1 # save bits shifted out
- or t2, t2, t9 # and put into upper part
- sll t3, t3, v0
- b norm_d
-3:
- sll t8, t8, 1 # shift dividend
- srl v1, t9, 31 # save bit shifted out
- or t8, t8, v1 # and put into upper part
- sll t9, t9, 1
- sll t2, t2, 1 # shift result
- srl v1, t3, 31 # save bit shifted out
- or t2, t2, v1 # and put into upper part
- sll t3, t3, 1
- subu v0, v0, 1 # are we done?
- bne v0, zero, 1b # no, continue
- sltu v0, zero, t9 # be sure to save any one bits
- or t8, t8, v0 # from the lower remainder
- b norm_d
-
-/*
- * Single precision absolute value.
- */
-abs_s:
- jal get_fs_s
- move t0, zero # set sign positive
- b result_fs_s
-
-/*
- * Double precision absolute value.
- */
-abs_d:
- jal get_fs_d
- move t0, zero # set sign positive
- b result_fs_d
-
-/*
- * Single precision move.
- */
-mov_s:
- jal get_fs_s
- b result_fs_s
-
-/*
- * Double precision move.
- */
-mov_d:
- jal get_fs_d
- b result_fs_d
-
-/*
- * Single precision negate.
- */
-neg_s:
- jal get_fs_s
- xor t0, t0, 1 # reverse sign
- b result_fs_s
-
-/*
- * Double precision negate.
- */
-neg_d:
- jal get_fs_d
- xor t0, t0, 1 # reverse sign
- b result_fs_d
-
-/*
- * Convert double to single.
- */
-cvt_s_d:
- jal get_fs_d
- bne t1, DEXP_INF, 1f # is FS an infinity?
- li t1, SEXP_INF # convert to single
- sll t2, t2, 3 # convert D fraction to S
- srl t8, t3, 32 - 3
- or t2, t2, t8
- b result_fs_s
-1:
- bne t1, zero, 2f # is FS zero?
- bne t2, zero, 1f
- beq t3, zero, result_fs_s # result=0
-1:
- jal renorm_fs_d
- subu t1, t1, 3 # correct exp for shift below
- b 3f
-2:
- subu t1, t1, DEXP_BIAS # unbias exponent
- or t2, t2, DIMPL_ONE # add implied one bit
-3:
- sll t2, t2, 3 # convert D fraction to S
- srl t8, t3, 32 - 3
- or t2, t2, t8
- sll t8, t3, 3
- b norm_noshift_s
-
-/*
- * Convert integer to single.
- */
-cvt_s_w:
- jal get_fs_int
- bne t2, zero, 1f # check for zero
- move t1, zero
- b result_fs_s
-/*
- * Find out how many leading zero bits are in t2 and put in t9.
- */
-1:
- move v0, t2
- move t9, zero
- srl v1, v0, 16
- bne v1, zero, 1f
- addu t9, 16
- sll v0, 16
-1:
- srl v1, v0, 24
- bne v1, zero, 1f
- addu t9, 8
- sll v0, 8
-1:
- srl v1, v0, 28
- bne v1, zero, 1f
- addu t9, 4
- sll v0, 4
-1:
- srl v1, v0, 30
- bne v1, zero, 1f
- addu t9, 2
- sll v0, 2
-1:
- srl v1, v0, 31
- bne v1, zero, 1f
- addu t9, 1
-/*
- * Now shift t2 the correct number of bits.
- */
-1:
- subu t9, t9, SLEAD_ZEROS # dont count leading zeros
- li t1, 23 # init exponent
- subu t1, t1, t9 # compute exponent
- beq t9, zero, 1f
- li v0, 32
- blt t9, zero, 2f # if shift < 0, shift right
- subu v0, v0, t9
- sll t2, t2, t9 # shift left
-1:
- add t1, t1, SEXP_BIAS # bias exponent
- and t2, t2, ~SIMPL_ONE # clear implied one bit
- b result_fs_s
-2:
- negu t9 # shift right by t9
- subu v0, v0, t9
- sll t8, t2, v0 # save bits shifted out
- srl t2, t2, t9
- b norm_noshift_s
-
-/*
- * Convert single to double.
- */
-cvt_d_s:
- jal get_fs_s
- move t3, zero
- bne t1, SEXP_INF, 1f # is FS an infinity?
- li t1, DEXP_INF # convert to double
- b result_fs_d
-1:
- bne t1, zero, 2f # is FS denormalized or zero?
- beq t2, zero, result_fs_d # is FS zero?
- jal renorm_fs_s
- move t8, zero
- b norm_d
-2:
- addu t1, t1, DEXP_BIAS - SEXP_BIAS # bias exponent correctly
- sll t3, t2, 32 - 3 # convert S fraction to D
- srl t2, t2, 3
- b result_fs_d
-
-/*
- * Convert integer to double.
- */
-cvt_d_w:
- jal get_fs_int
- bne t2, zero, 1f # check for zero
- move t1, zero # result=0
- move t3, zero
- b result_fs_d
-/*
- * Find out how many leading zero bits are in t2 and put in t9.
- */
-1:
- move v0, t2
- move t9, zero
- srl v1, v0, 16
- bne v1, zero, 1f
- addu t9, 16
- sll v0, 16
-1:
- srl v1, v0, 24
- bne v1, zero, 1f
- addu t9, 8
- sll v0, 8
-1:
- srl v1, v0, 28
- bne v1, zero, 1f
- addu t9, 4
- sll v0, 4
-1:
- srl v1, v0, 30
- bne v1, zero, 1f
- addu t9, 2
- sll v0, 2
-1:
- srl v1, v0, 31
- bne v1, zero, 1f
- addu t9, 1
-/*
- * Now shift t2 the correct number of bits.
- */
-1:
- subu t9, t9, DLEAD_ZEROS # dont count leading zeros
- li t1, DEXP_BIAS + 20 # init exponent
- subu t1, t1, t9 # compute exponent
- beq t9, zero, 1f
- li v0, 32
- blt t9, zero, 2f # if shift < 0, shift right
- subu v0, v0, t9
- sll t2, t2, t9 # shift left
-1:
- and t2, t2, ~DIMPL_ONE # clear implied one bit
- move t3, zero
- b result_fs_d
-2:
- negu t9 # shift right by t9
- subu v0, v0, t9
- sll t3, t2, v0
- srl t2, t2, t9
- and t2, t2, ~DIMPL_ONE # clear implied one bit
- b result_fs_d
-
-/*
- * Convert single to integer.
- */
-cvt_w_s:
- jal get_fs_s
- bne t1, SEXP_INF, 1f # is FS an infinity?
- bne t2, zero, invalid_w # invalid conversion
-1:
- bne t1, zero, 1f # is FS zero?
- beq t2, zero, result_fs_w # result is zero
- move t2, zero # result is an inexact zero
- b inexact_w
-1:
- subu t1, t1, SEXP_BIAS # unbias exponent
- or t2, t2, SIMPL_ONE # add implied one bit
- sll t3, t2, 32 - 3 # convert S fraction to D
- srl t2, t2, 3
- b cvt_w
-
-/*
- * Convert double to integer.
- */
-cvt_w_d:
- jal get_fs_d
- bne t1, DEXP_INF, 1f # is FS an infinity?
- bne t2, zero, invalid_w # invalid conversion
- bne t3, zero, invalid_w # invalid conversion
-1:
- bne t1, zero, 2f # is FS zero?
- bne t2, zero, 1f
- beq t3, zero, result_fs_w # result is zero
-1:
- move t2, zero # result is an inexact zero
- b inexact_w
-2:
- subu t1, t1, DEXP_BIAS # unbias exponent
- or t2, t2, DIMPL_ONE # add implied one bit
-cvt_w:
- blt t1, WEXP_MIN, underflow_w # is exponent too small?
- li v0, WEXP_MAX+1
- bgt t1, v0, overflow_w # is exponent too large?
- bne t1, v0, 1f # special check for INT_MIN
- beq t0, zero, overflow_w # if positive, overflow
- bne t2, DIMPL_ONE, overflow_w
- bne t3, zero, overflow_w
- li t2, INT_MIN # result is INT_MIN
- b result_fs_w
-1:
- subu v0, t1, 20 # compute amount to shift
- beq v0, zero, 2f # is shift needed?
- li v1, 32
- blt v0, zero, 1f # if shift < 0, shift right
- subu v1, v1, v0 # shift left
- sll t2, t2, v0
- srl t9, t3, v1 # save bits shifted out of t3
- or t2, t2, t9 # and put into t2
- sll t3, t3, v0 # shift FSs fraction
- b 2f
-1:
- negu v0 # shift right by v0
- subu v1, v1, v0
- sll t8, t3, v1 # save bits shifted out
- sltu t8, zero, t8 # dont lose any ones
- srl t3, t3, v0 # shift FSs fraction
- or t3, t3, t8
- sll t9, t2, v1 # save bits shifted out of t2
- or t3, t3, t9 # and put into t3
- srl t2, t2, v0
-/*
- * round result (t0 is sign, t2 is integer part, t3 is fractional part).
- */
-2:
- and v0, a1, FPC_ROUNDING_BITS # get rounding mode
- beq v0, FPC_ROUND_RN, 3f # round to nearest
- beq v0, FPC_ROUND_RZ, 5f # round to zero (truncate)
- beq v0, FPC_ROUND_RP, 1f # round to +infinity
- beq t0, zero, 5f # if sign is positive, truncate
- b 2f
-1:
- bne t0, zero, 5f # if sign is negative, truncate
-2:
- beq t3, zero, 5f # if no fraction bits, continue
- addu t2, t2, 1 # add rounding bit
- blt t2, zero, overflow_w # overflow?
- b 5f
-3:
- li v0, GUARDBIT # load guard bit for rounding
- addu v0, v0, t3 # add remainder
- sltu v1, v0, t3 # compute carry out
- beq v1, zero, 4f # if no carry, continue
- addu t2, t2, 1 # add carry to result
- blt t2, zero, overflow_w # overflow?
-4:
- bne v0, zero, 5f # if rounded remainder is zero
- and t2, t2, ~1 # clear LSB (round to nearest)
-5:
- beq t0, zero, 1f # result positive?
- negu t2 # convert to negative integer
-1:
- beq t3, zero, result_fs_w # is result exact?
-/*
- * Handle inexact exception.
- */
-inexact_w:
- or a1, a1, FPC_EXCEPTION_INEXACT | FPC_STICKY_INEXACT
- and v0, a1, FPC_ENABLE_INEXACT
- bne v0, zero, fpe_trap
- ctc1 a1, FPC_CSR # save exceptions
- b result_fs_w
-
-/*
- * Conversions to integer which overflow will trap (if enabled),
- * or generate an inexact trap (if enabled),
- * or generate an invalid exception.
- */
-overflow_w:
- or a1, a1, FPC_EXCEPTION_OVERFLOW | FPC_STICKY_OVERFLOW
- and v0, a1, FPC_ENABLE_OVERFLOW
- bne v0, zero, fpe_trap
- and v0, a1, FPC_ENABLE_INEXACT
- bne v0, zero, inexact_w # inexact traps enabled?
- b invalid_w
-
-/*
- * Conversions to integer which underflow will trap (if enabled),
- * or generate an inexact trap (if enabled),
- * or generate an invalid exception.
- */
-underflow_w:
- or a1, a1, FPC_EXCEPTION_UNDERFLOW | FPC_STICKY_UNDERFLOW
- and v0, a1, FPC_ENABLE_UNDERFLOW
- bne v0, zero, fpe_trap
- and v0, a1, FPC_ENABLE_INEXACT
- bne v0, zero, inexact_w # inexact traps enabled?
- b invalid_w
-
-/*
- * Compare single.
- */
-cmp_s:
- jal get_cmp_s
- bne t1, SEXP_INF, 1f # is FS an infinity?
- bne t2, zero, unordered # FS is a NAN
-1:
- bne t5, SEXP_INF, 2f # is FT an infinity?
- bne t6, zero, unordered # FT is a NAN
-2:
- sll t1, t1, 23 # reassemble exp & frac
- or t1, t1, t2
- sll t5, t5, 23 # reassemble exp & frac
- or t5, t5, t6
- beq t0, zero, 1f # is FS positive?
- negu t1
-1:
- beq t4, zero, 1f # is FT positive?
- negu t5
-1:
- li v0, COND_LESS
- blt t1, t5, test_cond # is FS < FT?
- li v0, COND_EQUAL
- beq t1, t5, test_cond # is FS == FT?
- move v0, zero # FS > FT
- b test_cond
-
-/*
- * Compare double.
- */
-cmp_d:
- jal get_cmp_d
- bne t1, DEXP_INF, 1f # is FS an infinity?
- bne t2, zero, unordered
- bne t3, zero, unordered # FS is a NAN
-1:
- bne t5, DEXP_INF, 2f # is FT an infinity?
- bne t6, zero, unordered
- bne t7, zero, unordered # FT is a NAN
-2:
- sll t1, t1, 20 # reassemble exp & frac
- or t1, t1, t2
- sll t5, t5, 20 # reassemble exp & frac
- or t5, t5, t6
- beq t0, zero, 1f # is FS positive?
- not t3 # negate t1,t3
- not t1
- addu t3, t3, 1
- seq v0, t3, zero # compute carry
- addu t1, t1, v0
-1:
- beq t4, zero, 1f # is FT positive?
- not t7 # negate t5,t7
- not t5
- addu t7, t7, 1
- seq v0, t7, zero # compute carry
- addu t5, t5, v0
-1:
- li v0, COND_LESS
- blt t1, t5, test_cond # is FS(MSW) < FT(MSW)?
- move v0, zero
- bne t1, t5, test_cond # is FS(MSW) > FT(MSW)?
- li v0, COND_LESS
- bltu t3, t7, test_cond # is FS(LSW) < FT(LSW)?
- li v0, COND_EQUAL
- beq t3, t7, test_cond # is FS(LSW) == FT(LSW)?
- move v0, zero # FS > FT
-test_cond:
- and v0, v0, a0 # condition match instruction?
-set_cond:
- bne v0, zero, 1f
- and a1, a1, ~FPC_COND_BIT # clear condition bit
- b 2f
-1:
- or a1, a1, FPC_COND_BIT # set condition bit
-2:
- ctc1 a1, FPC_CSR # save condition bit
- b done
-
-unordered:
- and v0, a0, COND_UNORDERED # this cmp match unordered?
- bne v0, zero, 1f
- and a1, a1, ~FPC_COND_BIT # clear condition bit
- b 2f
-1:
- or a1, a1, FPC_COND_BIT # set condition bit
-2:
- and v0, a0, COND_SIGNAL
- beq v0, zero, 1f # is this a signaling cmp?
- or a1, a1, FPC_EXCEPTION_INVALID | FPC_STICKY_INVALID
- and v0, a1, FPC_ENABLE_INVALID
- bne v0, zero, fpe_trap
-1:
- ctc1 a1, FPC_CSR # save condition bit
- b done
-
-/*
- * Determine the amount to shift the fraction in order to restore the
- * normalized position. After that, round and handle exceptions.
- */
-norm_s:
- move v0, t2
- move t9, zero # t9 = num of leading zeros
- bne t2, zero, 1f
- move v0, t8
- addu t9, 32
-1:
- srl v1, v0, 16
- bne v1, zero, 1f
- addu t9, 16
- sll v0, 16
-1:
- srl v1, v0, 24
- bne v1, zero, 1f
- addu t9, 8
- sll v0, 8
-1:
- srl v1, v0, 28
- bne v1, zero, 1f
- addu t9, 4
- sll v0, 4
-1:
- srl v1, v0, 30
- bne v1, zero, 1f
- addu t9, 2
- sll v0, 2
-1:
- srl v1, v0, 31
- bne v1, zero, 1f
- addu t9, 1
-/*
- * Now shift t2,t8 the correct number of bits.
- */
-1:
- subu t9, t9, SLEAD_ZEROS # dont count leading zeros
- subu t1, t1, t9 # adjust the exponent
- beq t9, zero, norm_noshift_s
- li v1, 32
- blt t9, zero, 1f # if shift < 0, shift right
- subu v1, v1, t9
- sll t2, t2, t9 # shift t2,t8 left
- srl v0, t8, v1 # save bits shifted out
- or t2, t2, v0
- sll t8, t8, t9
- b norm_noshift_s
-1:
- negu t9 # shift t2,t8 right by t9
- subu v1, v1, t9
- sll v0, t8, v1 # save bits shifted out
- sltu v0, zero, v0 # be sure to save any one bits
- srl t8, t8, t9
- or t8, t8, v0
- sll v0, t2, v1 # save bits shifted out
- or t8, t8, v0
- srl t2, t2, t9
-norm_noshift_s:
- move t5, t1 # save unrounded exponent
- move t6, t2 # save unrounded fraction
- and v0, a1, FPC_ROUNDING_BITS # get rounding mode
- beq v0, FPC_ROUND_RN, 3f # round to nearest
- beq v0, FPC_ROUND_RZ, 5f # round to zero (truncate)
- beq v0, FPC_ROUND_RP, 1f # round to +infinity
- beq t0, zero, 5f # if sign is positive, truncate
- b 2f
-1:
- bne t0, zero, 5f # if sign is negative, truncate
-2:
- beq t8, zero, 5f # if exact, continue
- addu t2, t2, 1 # add rounding bit
- bne t2, SIMPL_ONE<<1, 5f # need to adjust exponent?
- addu t1, t1, 1 # adjust exponent
- srl t2, t2, 1 # renormalize fraction
- b 5f
-3:
- li v0, GUARDBIT # load guard bit for rounding
- addu v0, v0, t8 # add remainder
- sltu v1, v0, t8 # compute carry out
- beq v1, zero, 4f # if no carry, continue
- addu t2, t2, 1 # add carry to result
- bne t2, SIMPL_ONE<<1, 4f # need to adjust exponent?
- addu t1, t1, 1 # adjust exponent
- srl t2, t2, 1 # renormalize fraction
-4:
- bne v0, zero, 5f # if rounded remainder is zero
- and t2, t2, ~1 # clear LSB (round to nearest)
-5:
- bgt t1, SEXP_MAX, overflow_s # overflow?
- blt t1, SEXP_MIN, underflow_s # underflow?
- bne t8, zero, inexact_s # is result inexact?
- addu t1, t1, SEXP_BIAS # bias exponent
- and t2, t2, ~SIMPL_ONE # clear implied one bit
- b result_fs_s
-
-/*
- * Handle inexact exception.
- */
-inexact_s:
- addu t1, t1, SEXP_BIAS # bias exponent
- and t2, t2, ~SIMPL_ONE # clear implied one bit
-inexact_nobias_s:
- jal set_fd_s # save result
- or a1, a1, FPC_EXCEPTION_INEXACT | FPC_STICKY_INEXACT
- and v0, a1, FPC_ENABLE_INEXACT
- bne v0, zero, fpe_trap
- ctc1 a1, FPC_CSR # save exceptions
- b done
-
-/*
- * Overflow will trap (if enabled),
- * or generate an inexact trap (if enabled),
- * or generate an infinity.
- */
-overflow_s:
- or a1, a1, FPC_EXCEPTION_OVERFLOW | FPC_STICKY_OVERFLOW
- and v0, a1, FPC_ENABLE_OVERFLOW
- beq v0, zero, 1f
- subu t1, t1, 192 # bias exponent
- and t2, t2, ~SIMPL_ONE # clear implied one bit
- jal set_fd_s # save result
- b fpe_trap
-1:
- and v0, a1, FPC_ROUNDING_BITS # get rounding mode
- beq v0, FPC_ROUND_RN, 3f # round to nearest
- beq v0, FPC_ROUND_RZ, 1f # round to zero (truncate)
- beq v0, FPC_ROUND_RP, 2f # round to +infinity
- bne t0, zero, 3f
-1:
- li t1, SEXP_MAX # result is max finite
- li t2, 0x007fffff
- b inexact_s
-2:
- bne t0, zero, 1b
-3:
- li t1, SEXP_MAX + 1 # result is infinity
- move t2, zero
- b inexact_s
-
-/*
- * In this implementation, "tininess" is detected "after rounding" and
- * "loss of accuracy" is detected as "an inexact result".
- */
-underflow_s:
- and v0, a1, FPC_ENABLE_UNDERFLOW
- beq v0, zero, 1f
-/*
- * Underflow is enabled so compute the result and trap.
- */
- addu t1, t1, 192 # bias exponent
- and t2, t2, ~SIMPL_ONE # clear implied one bit
- jal set_fd_s # save result
- or a1, a1, FPC_EXCEPTION_UNDERFLOW | FPC_STICKY_UNDERFLOW
- b fpe_trap
-/*
- * Underflow is not enabled so compute the result,
- * signal inexact result (if it is) and trap (if enabled).
- */
-1:
- move t1, t5 # get unrounded exponent
- move t2, t6 # get unrounded fraction
- li t9, SEXP_MIN # compute shift amount
- subu t9, t9, t1 # shift t2,t8 right by t9
- blt t9, SFRAC_BITS+2, 3f # shift all the bits out?
- move t1, zero # result is inexact zero
- move t2, zero
- or a1, a1, FPC_EXCEPTION_UNDERFLOW | FPC_STICKY_UNDERFLOW
-/*
- * Now round the zero result.
- * Only need to worry about rounding to +- infinity when the sign matches.
- */
- and v0, a1, FPC_ROUNDING_BITS # get rounding mode
- beq v0, FPC_ROUND_RN, inexact_nobias_s # round to nearest
- beq v0, FPC_ROUND_RZ, inexact_nobias_s # round to zero
- beq v0, FPC_ROUND_RP, 1f # round to +infinity
- beq t0, zero, inexact_nobias_s # if sign is positive, truncate
- b 2f
-1:
- bne t0, zero, inexact_nobias_s # if sign is negative, truncate
-2:
- addu t2, t2, 1 # add rounding bit
- b inexact_nobias_s
-3:
- li v1, 32
- subu v1, v1, t9
- sltu v0, zero, t8 # be sure to save any one bits
- sll t8, t2, v1 # save bits shifted out
- or t8, t8, v0 # include sticky bits
- srl t2, t2, t9
-/*
- * Now round the denormalized result.
- */
- and v0, a1, FPC_ROUNDING_BITS # get rounding mode
- beq v0, FPC_ROUND_RN, 3f # round to nearest
- beq v0, FPC_ROUND_RZ, 5f # round to zero (truncate)
- beq v0, FPC_ROUND_RP, 1f # round to +infinity
- beq t0, zero, 5f # if sign is positive, truncate
- b 2f
-1:
- bne t0, zero, 5f # if sign is negative, truncate
-2:
- beq t8, zero, 5f # if exact, continue
- addu t2, t2, 1 # add rounding bit
- b 5f
-3:
- li v0, GUARDBIT # load guard bit for rounding
- addu v0, v0, t8 # add remainder
- sltu v1, v0, t8 # compute carry out
- beq v1, zero, 4f # if no carry, continue
- addu t2, t2, 1 # add carry to result
-4:
- bne v0, zero, 5f # if rounded remainder is zero
- and t2, t2, ~1 # clear LSB (round to nearest)
-5:
- move t1, zero # denorm or zero exponent
- jal set_fd_s # save result
- beq t8, zero, done # check for exact result
- or a1, a1, FPC_EXCEPTION_UNDERFLOW | FPC_STICKY_UNDERFLOW
- or a1, a1, FPC_EXCEPTION_INEXACT | FPC_STICKY_INEXACT
- and v0, a1, FPC_ENABLE_INEXACT
- bne v0, zero, fpe_trap
- ctc1 a1, FPC_CSR # save exceptions
- b done
-
-/*
- * Determine the amount to shift the fraction in order to restore the
- * normalized position. After that, round and handle exceptions.
- */
-norm_d:
- move v0, t2
- move t9, zero # t9 = num of leading zeros
- bne t2, zero, 1f
- move v0, t3
- addu t9, 32
- bne t3, zero, 1f
- move v0, t8
- addu t9, 32
-1:
- srl v1, v0, 16
- bne v1, zero, 1f
- addu t9, 16
- sll v0, 16
-1:
- srl v1, v0, 24
- bne v1, zero, 1f
- addu t9, 8
- sll v0, 8
-1:
- srl v1, v0, 28
- bne v1, zero, 1f
- addu t9, 4
- sll v0, 4
-1:
- srl v1, v0, 30
- bne v1, zero, 1f
- addu t9, 2
- sll v0, 2
-1:
- srl v1, v0, 31
- bne v1, zero, 1f
- addu t9, 1
-/*
- * Now shift t2,t3,t8 the correct number of bits.
- */
-1:
- subu t9, t9, DLEAD_ZEROS # dont count leading zeros
- subu t1, t1, t9 # adjust the exponent
- beq t9, zero, norm_noshift_d
- li v1, 32
- blt t9, zero, 2f # if shift < 0, shift right
- blt t9, v1, 1f # shift by < 32?
- subu t9, t9, v1 # shift by >= 32
- subu v1, v1, t9
- sll t2, t3, t9 # shift left by t9
- srl v0, t8, v1 # save bits shifted out
- or t2, t2, v0
- sll t3, t8, t9
- move t8, zero
- b norm_noshift_d
-1:
- subu v1, v1, t9
- sll t2, t2, t9 # shift left by t9
- srl v0, t3, v1 # save bits shifted out
- or t2, t2, v0
- sll t3, t3, t9
- srl v0, t8, v1 # save bits shifted out
- or t3, t3, v0
- sll t8, t8, t9
- b norm_noshift_d
-2:
- negu t9 # shift right by t9
- subu v1, v1, t9 # (known to be < 32 bits)
- sll v0, t8, v1 # save bits shifted out
- sltu v0, zero, v0 # be sure to save any one bits
- srl t8, t8, t9
- or t8, t8, v0
- sll v0, t3, v1 # save bits shifted out
- or t8, t8, v0
- srl t3, t3, t9
- sll v0, t2, v1 # save bits shifted out
- or t3, t3, v0
- srl t2, t2, t9
-norm_noshift_d:
- move t5, t1 # save unrounded exponent
- move t6, t2 # save unrounded fraction (MS)
- move t7, t3 # save unrounded fraction (LS)
- and v0, a1, FPC_ROUNDING_BITS # get rounding mode
- beq v0, FPC_ROUND_RN, 3f # round to nearest
- beq v0, FPC_ROUND_RZ, 5f # round to zero (truncate)
- beq v0, FPC_ROUND_RP, 1f # round to +infinity
- beq t0, zero, 5f # if sign is positive, truncate
- b 2f
-1:
- bne t0, zero, 5f # if sign is negative, truncate
-2:
- beq t8, zero, 5f # if exact, continue
- addu t3, t3, 1 # add rounding bit
- bne t3, zero, 5f # branch if no carry
- addu t2, t2, 1 # add carry
- bne t2, DIMPL_ONE<<1, 5f # need to adjust exponent?
- addu t1, t1, 1 # adjust exponent
- srl t2, t2, 1 # renormalize fraction
- b 5f
-3:
- li v0, GUARDBIT # load guard bit for rounding
- addu v0, v0, t8 # add remainder
- sltu v1, v0, t8 # compute carry out
- beq v1, zero, 4f # branch if no carry
- addu t3, t3, 1 # add carry
- bne t3, zero, 4f # branch if no carry
- addu t2, t2, 1 # add carry to result
- bne t2, DIMPL_ONE<<1, 4f # need to adjust exponent?
- addu t1, t1, 1 # adjust exponent
- srl t2, t2, 1 # renormalize fraction
-4:
- bne v0, zero, 5f # if rounded remainder is zero
- and t3, t3, ~1 # clear LSB (round to nearest)
-5:
- bgt t1, DEXP_MAX, overflow_d # overflow?
- blt t1, DEXP_MIN, underflow_d # underflow?
- bne t8, zero, inexact_d # is result inexact?
- addu t1, t1, DEXP_BIAS # bias exponent
- and t2, t2, ~DIMPL_ONE # clear implied one bit
- b result_fs_d
-
-/*
- * Handle inexact exception.
- */
-inexact_d:
- addu t1, t1, DEXP_BIAS # bias exponent
- and t2, t2, ~DIMPL_ONE # clear implied one bit
-inexact_nobias_d:
- jal set_fd_d # save result
- or a1, a1, FPC_EXCEPTION_INEXACT | FPC_STICKY_INEXACT
- and v0, a1, FPC_ENABLE_INEXACT
- bne v0, zero, fpe_trap
- ctc1 a1, FPC_CSR # save exceptions
- b done
-
-/*
- * Overflow will trap (if enabled),
- * or generate an inexact trap (if enabled),
- * or generate an infinity.
- */
-overflow_d:
- or a1, a1, FPC_EXCEPTION_OVERFLOW | FPC_STICKY_OVERFLOW
- and v0, a1, FPC_ENABLE_OVERFLOW
- beq v0, zero, 1f
- subu t1, t1, 1536 # bias exponent
- and t2, t2, ~DIMPL_ONE # clear implied one bit
- jal set_fd_d # save result
- b fpe_trap
-1:
- and v0, a1, FPC_ROUNDING_BITS # get rounding mode
- beq v0, FPC_ROUND_RN, 3f # round to nearest
- beq v0, FPC_ROUND_RZ, 1f # round to zero (truncate)
- beq v0, FPC_ROUND_RP, 2f # round to +infinity
- bne t0, zero, 3f
-1:
- li t1, DEXP_MAX # result is max finite
- li t2, 0x000fffff
- li t3, 0xffffffff
- b inexact_d
-2:
- bne t0, zero, 1b
-3:
- li t1, DEXP_MAX + 1 # result is infinity
- move t2, zero
- move t3, zero
- b inexact_d
-
-/*
- * In this implementation, "tininess" is detected "after rounding" and
- * "loss of accuracy" is detected as "an inexact result".
- */
-underflow_d:
- and v0, a1, FPC_ENABLE_UNDERFLOW
- beq v0, zero, 1f
-/*
- * Underflow is enabled so compute the result and trap.
- */
- addu t1, t1, 1536 # bias exponent
- and t2, t2, ~DIMPL_ONE # clear implied one bit
- jal set_fd_d # save result
- or a1, a1, FPC_EXCEPTION_UNDERFLOW | FPC_STICKY_UNDERFLOW
- b fpe_trap
-/*
- * Underflow is not enabled so compute the result,
- * signal inexact result (if it is) and trap (if enabled).
- */
-1:
- move t1, t5 # get unrounded exponent
- move t2, t6 # get unrounded fraction (MS)
- move t3, t7 # get unrounded fraction (LS)
- li t9, DEXP_MIN # compute shift amount
- subu t9, t9, t1 # shift t2,t8 right by t9
- blt t9, DFRAC_BITS+2, 3f # shift all the bits out?
- move t1, zero # result is inexact zero
- move t2, zero
- move t3, zero
- or a1, a1, FPC_EXCEPTION_UNDERFLOW | FPC_STICKY_UNDERFLOW
-/*
- * Now round the zero result.
- * Only need to worry about rounding to +- infinity when the sign matches.
- */
- and v0, a1, FPC_ROUNDING_BITS # get rounding mode
- beq v0, FPC_ROUND_RN, inexact_nobias_d # round to nearest
- beq v0, FPC_ROUND_RZ, inexact_nobias_d # round to zero
- beq v0, FPC_ROUND_RP, 1f # round to +infinity
- beq t0, zero, inexact_nobias_d # if sign is positive, truncate
- b 2f
-1:
- bne t0, zero, inexact_nobias_d # if sign is negative, truncate
-2:
- addu t3, t3, 1 # add rounding bit
- b inexact_nobias_d
-3:
- li v1, 32
- blt t9, v1, 1f # shift by < 32?
- subu t9, t9, v1 # shift right by >= 32
- subu v1, v1, t9
- sltu v0, zero, t8 # be sure to save any one bits
- sll t8, t2, v1 # save bits shifted out
- or t8, t8, v0 # include sticky bits
- srl t3, t2, t9
- move t2, zero
- b 2f
-1:
- subu v1, v1, t9 # shift right by t9
- sltu v0, zero, t8 # be sure to save any one bits
- sll t8, t3, v1 # save bits shifted out
- or t8, t8, v0 # include sticky bits
- srl t3, t3, t9
- sll v0, t2, v1 # save bits shifted out
- or t3, t3, v0
- srl t2, t2, t9
-/*
- * Now round the denormalized result.
- */
-2:
- and v0, a1, FPC_ROUNDING_BITS # get rounding mode
- beq v0, FPC_ROUND_RN, 3f # round to nearest
- beq v0, FPC_ROUND_RZ, 5f # round to zero (truncate)
- beq v0, FPC_ROUND_RP, 1f # round to +infinity
- beq t0, zero, 5f # if sign is positive, truncate
- b 2f
-1:
- bne t0, zero, 5f # if sign is negative, truncate
-2:
- beq t8, zero, 5f # if exact, continue
- addu t3, t3, 1 # add rounding bit
- bne t3, zero, 5f # if no carry, continue
- addu t2, t2, 1 # add carry
- b 5f
-3:
- li v0, GUARDBIT # load guard bit for rounding
- addu v0, v0, t8 # add remainder
- sltu v1, v0, t8 # compute carry out
- beq v1, zero, 4f # if no carry, continue
- addu t3, t3, 1 # add rounding bit
- bne t3, zero, 4f # if no carry, continue
- addu t2, t2, 1 # add carry
-4:
- bne v0, zero, 5f # if rounded remainder is zero
- and t3, t3, ~1 # clear LSB (round to nearest)
-5:
- move t1, zero # denorm or zero exponent
- jal set_fd_d # save result
- beq t8, zero, done # check for exact result
- or a1, a1, FPC_EXCEPTION_UNDERFLOW | FPC_STICKY_UNDERFLOW
- or a1, a1, FPC_EXCEPTION_INEXACT | FPC_STICKY_INEXACT
- and v0, a1, FPC_ENABLE_INEXACT
- bne v0, zero, fpe_trap
- ctc1 a1, FPC_CSR # save exceptions
- b done
-
-/*
- * Signal an invalid operation if the trap is enabled; otherwise,
- * the result is a quiet NAN.
- */
-invalid_s: # trap invalid operation
- or a1, a1, FPC_EXCEPTION_INVALID | FPC_STICKY_INVALID
- and v0, a1, FPC_ENABLE_INVALID
- bne v0, zero, fpe_trap
- ctc1 a1, FPC_CSR # save exceptions
- move t0, zero # result is a quiet NAN
- li t1, SEXP_INF
- li t2, SQUIET_NAN
- jal set_fd_s # save result (in t0,t1,t2)
- b done
-
-/*
- * Signal an invalid operation if the trap is enabled; otherwise,
- * the result is a quiet NAN.
- */
-invalid_d: # trap invalid operation
- or a1, a1, FPC_EXCEPTION_INVALID | FPC_STICKY_INVALID
- and v0, a1, FPC_ENABLE_INVALID
- bne v0, zero, fpe_trap
- ctc1 a1, FPC_CSR # save exceptions
- move t0, zero # result is a quiet NAN
- li t1, DEXP_INF
- li t2, DQUIET_NAN0
- li t3, DQUIET_NAN1
- jal set_fd_d # save result (in t0,t1,t2,t3)
- b done
-
-/*
- * Signal an invalid operation if the trap is enabled; otherwise,
- * the result is INT_MAX or INT_MIN.
- */
-invalid_w: # trap invalid operation
- or a1, a1, FPC_EXCEPTION_INVALID | FPC_STICKY_INVALID
- and v0, a1, FPC_ENABLE_INVALID
- bne v0, zero, fpe_trap
- ctc1 a1, FPC_CSR # save exceptions
- bne t0, zero, 1f
- li t2, INT_MAX # result is INT_MAX
- b result_fs_w
-1:
- li t2, INT_MIN # result is INT_MIN
- b result_fs_w
-
-/*
- * Trap if the hardware should have handled this case.
- */
-fpe_trap:
- move a2, a1 # code = FP CSR
- ctc1 a1, FPC_CSR # save exceptions
- break 0
-
-/*
- * Send an illegal instruction signal to the current process.
- */
-ill:
- ctc1 a1, FPC_CSR # save exceptions
- move a2, a0 # code = FP instruction
- break 0
-
-result_ft_s:
- move t0, t4 # result is FT
- move t1, t5
- move t2, t6
-result_fs_s: # result is FS
- jal set_fd_s # save result (in t0,t1,t2)
- b done
-
-result_fs_w:
- jal set_fd_word # save result (in t2)
- b done
-
-result_ft_d:
- move t0, t4 # result is FT
- move t1, t5
- move t2, t6
- move t3, t7
-result_fs_d: # result is FS
- jal set_fd_d # save result (in t0,t1,t2,t3)
-
-done:
- lw ra, STAND_RA_OFFSET(sp)
- addu sp, sp, STAND_FRAME_SIZE
- j ra
-END(CPU_EmulateFP)
-
-/*----------------------------------------------------------------------------
- * get_fs_int --
- *
- * Read (integer) the FS register (bits 15-11).
- * This is an internal routine used by CPU_EmulateFP only.
- *
- * Results:
- * t0 contains the sign
- * t2 contains the fraction
- *
- *----------------------------------------------------------------------------
- */
-LEAF(get_fs_int)
- srl a3, a0, 12 - 2 # get FS field (even regs only)
- and a3, a3, 0xF << 2 # mask FS field
- lw a3, get_fs_int_tbl(a3) # switch on register number
- j a3
-
- .rdata
-get_fs_int_tbl:
- .word get_fs_int_f0
- .word get_fs_int_f2
- .word get_fs_int_f4
- .word get_fs_int_f6
- .word get_fs_int_f8
- .word get_fs_int_f10
- .word get_fs_int_f12
- .word get_fs_int_f14
- .word get_fs_int_f16
- .word get_fs_int_f18
- .word get_fs_int_f20
- .word get_fs_int_f22
- .word get_fs_int_f24
- .word get_fs_int_f26
- .word get_fs_int_f28
- .word get_fs_int_f30
- .text
-
-get_fs_int_f0:
- mfc1 t2, $f0
- b get_fs_int_done
-get_fs_int_f2:
- mfc1 t2, $f2
- b get_fs_int_done
-get_fs_int_f4:
- mfc1 t2, $f4
- b get_fs_int_done
-get_fs_int_f6:
- mfc1 t2, $f6
- b get_fs_int_done
-get_fs_int_f8:
- mfc1 t2, $f8
- b get_fs_int_done
-get_fs_int_f10:
- mfc1 t2, $f10
- b get_fs_int_done
-get_fs_int_f12:
- mfc1 t2, $f12
- b get_fs_int_done
-get_fs_int_f14:
- mfc1 t2, $f14
- b get_fs_int_done
-get_fs_int_f16:
- mfc1 t2, $f16
- b get_fs_int_done
-get_fs_int_f18:
- mfc1 t2, $f18
- b get_fs_int_done
-get_fs_int_f20:
- mfc1 t2, $f20
- b get_fs_int_done
-get_fs_int_f22:
- mfc1 t2, $f22
- b get_fs_int_done
-get_fs_int_f24:
- mfc1 t2, $f24
- b get_fs_int_done
-get_fs_int_f26:
- mfc1 t2, $f26
- b get_fs_int_done
-get_fs_int_f28:
- mfc1 t2, $f28
- b get_fs_int_done
-get_fs_int_f30:
- mfc1 t2, $f30
-get_fs_int_done:
- srl t0, t2, 31 # init the sign bit
- bge t2, zero, 1f
- negu t2
-1:
- j ra
-END(get_fs_int)
-
-/*----------------------------------------------------------------------------
- * get_ft_fs_s --
- *
- * Read (single precision) the FT register (bits 20-16) and
- * the FS register (bits 15-11) and break up into fields.
- * This is an internal routine used by CPU_EmulateFP only.
- *
- * Results:
- * t0 contains the FS sign
- * t1 contains the FS (biased) exponent
- * t2 contains the FS fraction
- * t4 contains the FT sign
- * t5 contains the FT (biased) exponent
- * t6 contains the FT fraction
- *
- *----------------------------------------------------------------------------
- */
-LEAF(get_ft_fs_s)
- srl a3, a0, 17 - 2 # get FT field (even regs only)
- and a3, a3, 0xF << 2 # mask FT field
- lw a3, get_ft_s_tbl(a3) # switch on register number
- j a3
-
- .rdata
-get_ft_s_tbl:
- .word get_ft_s_f0
- .word get_ft_s_f2
- .word get_ft_s_f4
- .word get_ft_s_f6
- .word get_ft_s_f8
- .word get_ft_s_f10
- .word get_ft_s_f12
- .word get_ft_s_f14
- .word get_ft_s_f16
- .word get_ft_s_f18
- .word get_ft_s_f20
- .word get_ft_s_f22
- .word get_ft_s_f24
- .word get_ft_s_f26
- .word get_ft_s_f28
- .word get_ft_s_f30
- .text
-
-get_ft_s_f0:
- mfc1 t4, $f0
- b get_ft_s_done
-get_ft_s_f2:
- mfc1 t4, $f2
- b get_ft_s_done
-get_ft_s_f4:
- mfc1 t4, $f4
- b get_ft_s_done
-get_ft_s_f6:
- mfc1 t4, $f6
- b get_ft_s_done
-get_ft_s_f8:
- mfc1 t4, $f8
- b get_ft_s_done
-get_ft_s_f10:
- mfc1 t4, $f10
- b get_ft_s_done
-get_ft_s_f12:
- mfc1 t4, $f12
- b get_ft_s_done
-get_ft_s_f14:
- mfc1 t4, $f14
- b get_ft_s_done
-get_ft_s_f16:
- mfc1 t4, $f16
- b get_ft_s_done
-get_ft_s_f18:
- mfc1 t4, $f18
- b get_ft_s_done
-get_ft_s_f20:
- mfc1 t4, $f20
- b get_ft_s_done
-get_ft_s_f22:
- mfc1 t4, $f22
- b get_ft_s_done
-get_ft_s_f24:
- mfc1 t4, $f24
- b get_ft_s_done
-get_ft_s_f26:
- mfc1 t4, $f26
- b get_ft_s_done
-get_ft_s_f28:
- mfc1 t4, $f28
- b get_ft_s_done
-get_ft_s_f30:
- mfc1 t4, $f30
-get_ft_s_done:
- srl t5, t4, 23 # get exponent
- and t5, t5, 0xFF
- and t6, t4, 0x7FFFFF # get fraction
- srl t4, t4, 31 # get sign
- bne t5, SEXP_INF, 1f # is it a signaling NAN?
- and v0, t6, SSIGNAL_NAN
- bne v0, zero, invalid_s
-1:
- /* fall through to get FS */
-
-/*----------------------------------------------------------------------------
- * get_fs_s --
- *
- * Read (single precision) the FS register (bits 15-11) and
- * break up into fields.
- * This is an internal routine used by CPU_EmulateFP only.
- *
- * Results:
- * t0 contains the sign
- * t1 contains the (biased) exponent
- * t2 contains the fraction
- *
- *----------------------------------------------------------------------------
- */
-ALEAF(get_fs_s)
- srl a3, a0, 12 - 2 # get FS field (even regs only)
- and a3, a3, 0xF << 2 # mask FS field
- lw a3, get_fs_s_tbl(a3) # switch on register number
- j a3
-
- .rdata
-get_fs_s_tbl:
- .word get_fs_s_f0
- .word get_fs_s_f2
- .word get_fs_s_f4
- .word get_fs_s_f6
- .word get_fs_s_f8
- .word get_fs_s_f10
- .word get_fs_s_f12
- .word get_fs_s_f14
- .word get_fs_s_f16
- .word get_fs_s_f18
- .word get_fs_s_f20
- .word get_fs_s_f22
- .word get_fs_s_f24
- .word get_fs_s_f26
- .word get_fs_s_f28
- .word get_fs_s_f30
- .text
-
-get_fs_s_f0:
- mfc1 t0, $f0
- b get_fs_s_done
-get_fs_s_f2:
- mfc1 t0, $f2
- b get_fs_s_done
-get_fs_s_f4:
- mfc1 t0, $f4
- b get_fs_s_done
-get_fs_s_f6:
- mfc1 t0, $f6
- b get_fs_s_done
-get_fs_s_f8:
- mfc1 t0, $f8
- b get_fs_s_done
-get_fs_s_f10:
- mfc1 t0, $f10
- b get_fs_s_done
-get_fs_s_f12:
- mfc1 t0, $f12
- b get_fs_s_done
-get_fs_s_f14:
- mfc1 t0, $f14
- b get_fs_s_done
-get_fs_s_f16:
- mfc1 t0, $f16
- b get_fs_s_done
-get_fs_s_f18:
- mfc1 t0, $f18
- b get_fs_s_done
-get_fs_s_f20:
- mfc1 t0, $f20
- b get_fs_s_done
-get_fs_s_f22:
- mfc1 t0, $f22
- b get_fs_s_done
-get_fs_s_f24:
- mfc1 t0, $f24
- b get_fs_s_done
-get_fs_s_f26:
- mfc1 t0, $f26
- b get_fs_s_done
-get_fs_s_f28:
- mfc1 t0, $f28
- b get_fs_s_done
-get_fs_s_f30:
- mfc1 t0, $f30
-get_fs_s_done:
- srl t1, t0, 23 # get exponent
- and t1, t1, 0xFF
- and t2, t0, 0x7FFFFF # get fraction
- srl t0, t0, 31 # get sign
- bne t1, SEXP_INF, 1f # is it a signaling NAN?
- and v0, t2, SSIGNAL_NAN
- bne v0, zero, invalid_s
-1:
- j ra
-END(get_ft_fs_s)
-
-/*----------------------------------------------------------------------------
- * get_ft_fs_d --
- *
- * Read (double precision) the FT register (bits 20-16) and
- * the FS register (bits 15-11) and break up into fields.
- * This is an internal routine used by CPU_EmulateFP only.
- *
- * Results:
- * t0 contains the FS sign
- * t1 contains the FS (biased) exponent
- * t2 contains the FS fraction
- * t3 contains the FS remaining fraction
- * t4 contains the FT sign
- * t5 contains the FT (biased) exponent
- * t6 contains the FT fraction
- * t7 contains the FT remaining fraction
- *
- *----------------------------------------------------------------------------
- */
-LEAF(get_ft_fs_d)
- srl a3, a0, 17 - 2 # get FT field (even regs only)
- and a3, a3, 0xF << 2 # mask FT field
- lw a3, get_ft_d_tbl(a3) # switch on register number
- j a3
-
- .rdata
-get_ft_d_tbl:
- .word get_ft_d_f0
- .word get_ft_d_f2
- .word get_ft_d_f4
- .word get_ft_d_f6
- .word get_ft_d_f8
- .word get_ft_d_f10
- .word get_ft_d_f12
- .word get_ft_d_f14
- .word get_ft_d_f16
- .word get_ft_d_f18
- .word get_ft_d_f20
- .word get_ft_d_f22
- .word get_ft_d_f24
- .word get_ft_d_f26
- .word get_ft_d_f28
- .word get_ft_d_f30
- .text
-
-get_ft_d_f0:
- mfc1 t7, $f0
- mfc1 t4, $f1
- b get_ft_d_done
-get_ft_d_f2:
- mfc1 t7, $f2
- mfc1 t4, $f3
- b get_ft_d_done
-get_ft_d_f4:
- mfc1 t7, $f4
- mfc1 t4, $f5
- b get_ft_d_done
-get_ft_d_f6:
- mfc1 t7, $f6
- mfc1 t4, $f7
- b get_ft_d_done
-get_ft_d_f8:
- mfc1 t7, $f8
- mfc1 t4, $f9
- b get_ft_d_done
-get_ft_d_f10:
- mfc1 t7, $f10
- mfc1 t4, $f11
- b get_ft_d_done
-get_ft_d_f12:
- mfc1 t7, $f12
- mfc1 t4, $f13
- b get_ft_d_done
-get_ft_d_f14:
- mfc1 t7, $f14
- mfc1 t4, $f15
- b get_ft_d_done
-get_ft_d_f16:
- mfc1 t7, $f16
- mfc1 t4, $f17
- b get_ft_d_done
-get_ft_d_f18:
- mfc1 t7, $f18
- mfc1 t4, $f19
- b get_ft_d_done
-get_ft_d_f20:
- mfc1 t7, $f20
- mfc1 t4, $f21
- b get_ft_d_done
-get_ft_d_f22:
- mfc1 t7, $f22
- mfc1 t4, $f23
- b get_ft_d_done
-get_ft_d_f24:
- mfc1 t7, $f24
- mfc1 t4, $f25
- b get_ft_d_done
-get_ft_d_f26:
- mfc1 t7, $f26
- mfc1 t4, $f27
- b get_ft_d_done
-get_ft_d_f28:
- mfc1 t7, $f28
- mfc1 t4, $f29
- b get_ft_d_done
-get_ft_d_f30:
- mfc1 t7, $f30
- mfc1 t4, $f31
-get_ft_d_done:
- srl t5, t4, 20 # get exponent
- and t5, t5, 0x7FF
- and t6, t4, 0xFFFFF # get fraction
- srl t4, t4, 31 # get sign
- bne t5, DEXP_INF, 1f # is it a signaling NAN?
- and v0, t6, DSIGNAL_NAN
- bne v0, zero, invalid_d
-1:
- /* fall through to get FS */
-
-/*----------------------------------------------------------------------------
- * get_fs_d --
- *
- * Read (double precision) the FS register (bits 15-11) and
- * break up into fields.
- * This is an internal routine used by CPU_EmulateFP only.
- *
- * Results:
- * t0 contains the sign
- * t1 contains the (biased) exponent
- * t2 contains the fraction
- * t3 contains the remaining fraction
- *
- *----------------------------------------------------------------------------
- */
-ALEAF(get_fs_d)
- srl a3, a0, 12 - 2 # get FS field (even regs only)
- and a3, a3, 0xF << 2 # mask FS field
- lw a3, get_fs_d_tbl(a3) # switch on register number
- j a3
-
- .rdata
-get_fs_d_tbl:
- .word get_fs_d_f0
- .word get_fs_d_f2
- .word get_fs_d_f4
- .word get_fs_d_f6
- .word get_fs_d_f8
- .word get_fs_d_f10
- .word get_fs_d_f12
- .word get_fs_d_f14
- .word get_fs_d_f16
- .word get_fs_d_f18
- .word get_fs_d_f20
- .word get_fs_d_f22
- .word get_fs_d_f24
- .word get_fs_d_f26
- .word get_fs_d_f28
- .word get_fs_d_f30
- .text
-
-get_fs_d_f0:
- mfc1 t3, $f0
- mfc1 t0, $f1
- b get_fs_d_done
-get_fs_d_f2:
- mfc1 t3, $f2
- mfc1 t0, $f3
- b get_fs_d_done
-get_fs_d_f4:
- mfc1 t3, $f4
- mfc1 t0, $f5
- b get_fs_d_done
-get_fs_d_f6:
- mfc1 t3, $f6
- mfc1 t0, $f7
- b get_fs_d_done
-get_fs_d_f8:
- mfc1 t3, $f8
- mfc1 t0, $f9
- b get_fs_d_done
-get_fs_d_f10:
- mfc1 t3, $f10
- mfc1 t0, $f11
- b get_fs_d_done
-get_fs_d_f12:
- mfc1 t3, $f12
- mfc1 t0, $f13
- b get_fs_d_done
-get_fs_d_f14:
- mfc1 t3, $f14
- mfc1 t0, $f15
- b get_fs_d_done
-get_fs_d_f16:
- mfc1 t3, $f16
- mfc1 t0, $f17
- b get_fs_d_done
-get_fs_d_f18:
- mfc1 t3, $f18
- mfc1 t0, $f19
- b get_fs_d_done
-get_fs_d_f20:
- mfc1 t3, $f20
- mfc1 t0, $f21
- b get_fs_d_done
-get_fs_d_f22:
- mfc1 t3, $f22
- mfc1 t0, $f23
- b get_fs_d_done
-get_fs_d_f24:
- mfc1 t3, $f24
- mfc1 t0, $f25
- b get_fs_d_done
-get_fs_d_f26:
- mfc1 t3, $f26
- mfc1 t0, $f27
- b get_fs_d_done
-get_fs_d_f28:
- mfc1 t3, $f28
- mfc1 t0, $f29
- b get_fs_d_done
-get_fs_d_f30:
- mfc1 t3, $f30
- mfc1 t0, $f31
-get_fs_d_done:
- srl t1, t0, 20 # get exponent
- and t1, t1, 0x7FF
- and t2, t0, 0xFFFFF # get fraction
- srl t0, t0, 31 # get sign
- bne t1, DEXP_INF, 1f # is it a signaling NAN?
- and v0, t2, DSIGNAL_NAN
- bne v0, zero, invalid_d
-1:
- j ra
-END(get_ft_fs_d)
-
-/*----------------------------------------------------------------------------
- * get_cmp_s --
- *
- * Read (single precision) the FS register (bits 15-11) and
- * the FT register (bits 20-16) and break up into fields.
- * This is an internal routine used by CPU_EmulateFP only.
- *
- * Results:
- * t0 contains the sign
- * t1 contains the (biased) exponent
- * t2 contains the fraction
- * t4 contains the sign
- * t5 contains the (biased) exponent
- * t6 contains the fraction
- *
- *----------------------------------------------------------------------------
- */
-LEAF(get_cmp_s)
- srl a3, a0, 12 - 2 # get FS field (even regs only)
- and a3, a3, 0xF << 2 # mask FS field
- lw a3, cmp_fs_s_tbl(a3) # switch on register number
- j a3
-
- .rdata
-cmp_fs_s_tbl:
- .word cmp_fs_s_f0
- .word cmp_fs_s_f2
- .word cmp_fs_s_f4
- .word cmp_fs_s_f6
- .word cmp_fs_s_f8
- .word cmp_fs_s_f10
- .word cmp_fs_s_f12
- .word cmp_fs_s_f14
- .word cmp_fs_s_f16
- .word cmp_fs_s_f18
- .word cmp_fs_s_f20
- .word cmp_fs_s_f22
- .word cmp_fs_s_f24
- .word cmp_fs_s_f26
- .word cmp_fs_s_f28
- .word cmp_fs_s_f30
- .text
-
-cmp_fs_s_f0:
- mfc1 t0, $f0
- b cmp_fs_s_done
-cmp_fs_s_f2:
- mfc1 t0, $f2
- b cmp_fs_s_done
-cmp_fs_s_f4:
- mfc1 t0, $f4
- b cmp_fs_s_done
-cmp_fs_s_f6:
- mfc1 t0, $f6
- b cmp_fs_s_done
-cmp_fs_s_f8:
- mfc1 t0, $f8
- b cmp_fs_s_done
-cmp_fs_s_f10:
- mfc1 t0, $f10
- b cmp_fs_s_done
-cmp_fs_s_f12:
- mfc1 t0, $f12
- b cmp_fs_s_done
-cmp_fs_s_f14:
- mfc1 t0, $f14
- b cmp_fs_s_done
-cmp_fs_s_f16:
- mfc1 t0, $f16
- b cmp_fs_s_done
-cmp_fs_s_f18:
- mfc1 t0, $f18
- b cmp_fs_s_done
-cmp_fs_s_f20:
- mfc1 t0, $f20
- b cmp_fs_s_done
-cmp_fs_s_f22:
- mfc1 t0, $f22
- b cmp_fs_s_done
-cmp_fs_s_f24:
- mfc1 t0, $f24
- b cmp_fs_s_done
-cmp_fs_s_f26:
- mfc1 t0, $f26
- b cmp_fs_s_done
-cmp_fs_s_f28:
- mfc1 t0, $f28
- b cmp_fs_s_done
-cmp_fs_s_f30:
- mfc1 t0, $f30
-cmp_fs_s_done:
- srl t1, t0, 23 # get exponent
- and t1, t1, 0xFF
- and t2, t0, 0x7FFFFF # get fraction
- srl t0, t0, 31 # get sign
-
- srl a3, a0, 17 - 2 # get FT field (even regs only)
- and a3, a3, 0xF << 2 # mask FT field
- lw a3, cmp_ft_s_tbl(a3) # switch on register number
- j a3
-
- .rdata
-cmp_ft_s_tbl:
- .word cmp_ft_s_f0
- .word cmp_ft_s_f2
- .word cmp_ft_s_f4
- .word cmp_ft_s_f6
- .word cmp_ft_s_f8
- .word cmp_ft_s_f10
- .word cmp_ft_s_f12
- .word cmp_ft_s_f14
- .word cmp_ft_s_f16
- .word cmp_ft_s_f18
- .word cmp_ft_s_f20
- .word cmp_ft_s_f22
- .word cmp_ft_s_f24
- .word cmp_ft_s_f26
- .word cmp_ft_s_f28
- .word cmp_ft_s_f30
- .text
-
-cmp_ft_s_f0:
- mfc1 t4, $f0
- b cmp_ft_s_done
-cmp_ft_s_f2:
- mfc1 t4, $f2
- b cmp_ft_s_done
-cmp_ft_s_f4:
- mfc1 t4, $f4
- b cmp_ft_s_done
-cmp_ft_s_f6:
- mfc1 t4, $f6
- b cmp_ft_s_done
-cmp_ft_s_f8:
- mfc1 t4, $f8
- b cmp_ft_s_done
-cmp_ft_s_f10:
- mfc1 t4, $f10
- b cmp_ft_s_done
-cmp_ft_s_f12:
- mfc1 t4, $f12
- b cmp_ft_s_done
-cmp_ft_s_f14:
- mfc1 t4, $f14
- b cmp_ft_s_done
-cmp_ft_s_f16:
- mfc1 t4, $f16
- b cmp_ft_s_done
-cmp_ft_s_f18:
- mfc1 t4, $f18
- b cmp_ft_s_done
-cmp_ft_s_f20:
- mfc1 t4, $f20
- b cmp_ft_s_done
-cmp_ft_s_f22:
- mfc1 t4, $f22
- b cmp_ft_s_done
-cmp_ft_s_f24:
- mfc1 t4, $f24
- b cmp_ft_s_done
-cmp_ft_s_f26:
- mfc1 t4, $f26
- b cmp_ft_s_done
-cmp_ft_s_f28:
- mfc1 t4, $f28
- b cmp_ft_s_done
-cmp_ft_s_f30:
- mfc1 t4, $f30
-cmp_ft_s_done:
- srl t5, t4, 23 # get exponent
- and t5, t5, 0xFF
- and t6, t4, 0x7FFFFF # get fraction
- srl t4, t4, 31 # get sign
- j ra
-END(get_cmp_s)
-
-/*----------------------------------------------------------------------------
- * get_cmp_d --
- *
- * Read (double precision) the FS register (bits 15-11) and
- * the FT register (bits 20-16) and break up into fields.
- * This is an internal routine used by CPU_EmulateFP only.
- *
- * Results:
- * t0 contains the sign
- * t1 contains the (biased) exponent
- * t2 contains the fraction
- * t3 contains the remaining fraction
- * t4 contains the sign
- * t5 contains the (biased) exponent
- * t6 contains the fraction
- * t7 contains the remaining fraction
- *
- *----------------------------------------------------------------------------
- */
-LEAF(get_cmp_d)
- srl a3, a0, 12 - 2 # get FS field (even regs only)
- and a3, a3, 0xF << 2 # mask FS field
- lw a3, cmp_fs_d_tbl(a3) # switch on register number
- j a3
-
- .rdata
-cmp_fs_d_tbl:
- .word cmp_fs_d_f0
- .word cmp_fs_d_f2
- .word cmp_fs_d_f4
- .word cmp_fs_d_f6
- .word cmp_fs_d_f8
- .word cmp_fs_d_f10
- .word cmp_fs_d_f12
- .word cmp_fs_d_f14
- .word cmp_fs_d_f16
- .word cmp_fs_d_f18
- .word cmp_fs_d_f20
- .word cmp_fs_d_f22
- .word cmp_fs_d_f24
- .word cmp_fs_d_f26
- .word cmp_fs_d_f28
- .word cmp_fs_d_f30
- .text
-
-cmp_fs_d_f0:
- mfc1 t3, $f0
- mfc1 t0, $f1
- b cmp_fs_d_done
-cmp_fs_d_f2:
- mfc1 t3, $f2
- mfc1 t0, $f3
- b cmp_fs_d_done
-cmp_fs_d_f4:
- mfc1 t3, $f4
- mfc1 t0, $f5
- b cmp_fs_d_done
-cmp_fs_d_f6:
- mfc1 t3, $f6
- mfc1 t0, $f7
- b cmp_fs_d_done
-cmp_fs_d_f8:
- mfc1 t3, $f8
- mfc1 t0, $f9
- b cmp_fs_d_done
-cmp_fs_d_f10:
- mfc1 t3, $f10
- mfc1 t0, $f11
- b cmp_fs_d_done
-cmp_fs_d_f12:
- mfc1 t3, $f12
- mfc1 t0, $f13
- b cmp_fs_d_done
-cmp_fs_d_f14:
- mfc1 t3, $f14
- mfc1 t0, $f15
- b cmp_fs_d_done
-cmp_fs_d_f16:
- mfc1 t3, $f16
- mfc1 t0, $f17
- b cmp_fs_d_done
-cmp_fs_d_f18:
- mfc1 t3, $f18
- mfc1 t0, $f19
- b cmp_fs_d_done
-cmp_fs_d_f20:
- mfc1 t3, $f20
- mfc1 t0, $f21
- b cmp_fs_d_done
-cmp_fs_d_f22:
- mfc1 t3, $f22
- mfc1 t0, $f23
- b cmp_fs_d_done
-cmp_fs_d_f24:
- mfc1 t3, $f24
- mfc1 t0, $f25
- b cmp_fs_d_done
-cmp_fs_d_f26:
- mfc1 t3, $f26
- mfc1 t0, $f27
- b cmp_fs_d_done
-cmp_fs_d_f28:
- mfc1 t3, $f28
- mfc1 t0, $f29
- b cmp_fs_d_done
-cmp_fs_d_f30:
- mfc1 t3, $f30
- mfc1 t0, $f31
-cmp_fs_d_done:
- srl t1, t0, 20 # get exponent
- and t1, t1, 0x7FF
- and t2, t0, 0xFFFFF # get fraction
- srl t0, t0, 31 # get sign
-
- srl a3, a0, 17 - 2 # get FT field (even regs only)
- and a3, a3, 0xF << 2 # mask FT field
- lw a3, cmp_ft_d_tbl(a3) # switch on register number
- j a3
-
- .rdata
-cmp_ft_d_tbl:
- .word cmp_ft_d_f0
- .word cmp_ft_d_f2
- .word cmp_ft_d_f4
- .word cmp_ft_d_f6
- .word cmp_ft_d_f8
- .word cmp_ft_d_f10
- .word cmp_ft_d_f12
- .word cmp_ft_d_f14
- .word cmp_ft_d_f16
- .word cmp_ft_d_f18
- .word cmp_ft_d_f20
- .word cmp_ft_d_f22
- .word cmp_ft_d_f24
- .word cmp_ft_d_f26
- .word cmp_ft_d_f28
- .word cmp_ft_d_f30
- .text
-
-cmp_ft_d_f0:
- mfc1 t7, $f0
- mfc1 t4, $f1
- b cmp_ft_d_done
-cmp_ft_d_f2:
- mfc1 t7, $f2
- mfc1 t4, $f3
- b cmp_ft_d_done
-cmp_ft_d_f4:
- mfc1 t7, $f4
- mfc1 t4, $f5
- b cmp_ft_d_done
-cmp_ft_d_f6:
- mfc1 t7, $f6
- mfc1 t4, $f7
- b cmp_ft_d_done
-cmp_ft_d_f8:
- mfc1 t7, $f8
- mfc1 t4, $f9
- b cmp_ft_d_done
-cmp_ft_d_f10:
- mfc1 t7, $f10
- mfc1 t4, $f11
- b cmp_ft_d_done
-cmp_ft_d_f12:
- mfc1 t7, $f12
- mfc1 t4, $f13
- b cmp_ft_d_done
-cmp_ft_d_f14:
- mfc1 t7, $f14
- mfc1 t4, $f15
- b cmp_ft_d_done
-cmp_ft_d_f16:
- mfc1 t7, $f16
- mfc1 t4, $f17
- b cmp_ft_d_done
-cmp_ft_d_f18:
- mfc1 t7, $f18
- mfc1 t4, $f19
- b cmp_ft_d_done
-cmp_ft_d_f20:
- mfc1 t7, $f20
- mfc1 t4, $f21
- b cmp_ft_d_done
-cmp_ft_d_f22:
- mfc1 t7, $f22
- mfc1 t4, $f23
- b cmp_ft_d_done
-cmp_ft_d_f24:
- mfc1 t7, $f24
- mfc1 t4, $f25
- b cmp_ft_d_done
-cmp_ft_d_f26:
- mfc1 t7, $f26
- mfc1 t4, $f27
- b cmp_ft_d_done
-cmp_ft_d_f28:
- mfc1 t7, $f28
- mfc1 t4, $f29
- b cmp_ft_d_done
-cmp_ft_d_f30:
- mfc1 t7, $f30
- mfc1 t4, $f31
-cmp_ft_d_done:
- srl t5, t4, 20 # get exponent
- and t5, t5, 0x7FF
- and t6, t4, 0xFFFFF # get fraction
- srl t4, t4, 31 # get sign
- j ra
-END(get_cmp_d)
-
-/*----------------------------------------------------------------------------
- * set_fd_s --
- *
- * Write (single precision) the FD register (bits 10-6).
- * This is an internal routine used by CPU_EmulateFP only.
- *
- * Arguments:
- * a0 contains the FP instruction
- * t0 contains the sign
- * t1 contains the (biased) exponent
- * t2 contains the fraction
- *
- * set_fd_word --
- *
- * Write (integer) the FD register (bits 10-6).
- * This is an internal routine used by CPU_EmulateFP only.
- *
- * Arguments:
- * a0 contains the FP instruction
- * t2 contains the integer
- *
- *----------------------------------------------------------------------------
- */
-LEAF(set_fd_s)
- sll t0, t0, 31 # position sign
- sll t1, t1, 23 # position exponent
- or t2, t2, t0
- or t2, t2, t1
-ALEAF(set_fd_word)
- srl a3, a0, 7 - 2 # get FD field (even regs only)
- and a3, a3, 0xF << 2 # mask FT field
- lw a3, set_fd_s_tbl(a3) # switch on register number
- j a3
-
- .rdata
-set_fd_s_tbl:
- .word set_fd_s_f0
- .word set_fd_s_f2
- .word set_fd_s_f4
- .word set_fd_s_f6
- .word set_fd_s_f8
- .word set_fd_s_f10
- .word set_fd_s_f12
- .word set_fd_s_f14
- .word set_fd_s_f16
- .word set_fd_s_f18
- .word set_fd_s_f20
- .word set_fd_s_f22
- .word set_fd_s_f24
- .word set_fd_s_f26
- .word set_fd_s_f28
- .word set_fd_s_f30
- .text
-
-set_fd_s_f0:
- mtc1 t2, $f0
- j ra
-set_fd_s_f2:
- mtc1 t2, $f2
- j ra
-set_fd_s_f4:
- mtc1 t2, $f4
- j ra
-set_fd_s_f6:
- mtc1 t2, $f6
- j ra
-set_fd_s_f8:
- mtc1 t2, $f8
- j ra
-set_fd_s_f10:
- mtc1 t2, $f10
- j ra
-set_fd_s_f12:
- mtc1 t2, $f12
- j ra
-set_fd_s_f14:
- mtc1 t2, $f14
- j ra
-set_fd_s_f16:
- mtc1 t2, $f16
- j ra
-set_fd_s_f18:
- mtc1 t2, $f18
- j ra
-set_fd_s_f20:
- mtc1 t2, $f20
- j ra
-set_fd_s_f22:
- mtc1 t2, $f22
- j ra
-set_fd_s_f24:
- mtc1 t2, $f24
- j ra
-set_fd_s_f26:
- mtc1 t2, $f26
- j ra
-set_fd_s_f28:
- mtc1 t2, $f28
- j ra
-set_fd_s_f30:
- mtc1 t2, $f30
- j ra
-END(set_fd_s)
-
-/*----------------------------------------------------------------------------
- * set_fd_d --
- *
- * Write (double precision) the FT register (bits 10-6).
- * This is an internal routine used by CPU_EmulateFP only.
- *
- * Arguments:
- * a0 contains the FP instruction
- * t0 contains the sign
- * t1 contains the (biased) exponent
- * t2 contains the fraction
- * t3 contains the remaining fraction
- *
- *----------------------------------------------------------------------------
- */
-LEAF(set_fd_d)
- sll t0, t0, 31 # set sign
- sll t1, t1, 20 # set exponent
- or t0, t0, t1
- or t0, t0, t2 # set fraction
- srl a3, a0, 7 - 2 # get FD field (even regs only)
- and a3, a3, 0xF << 2 # mask FD field
- lw a3, set_fd_d_tbl(a3) # switch on register number
- j a3
-
- .rdata
-set_fd_d_tbl:
- .word set_fd_d_f0
- .word set_fd_d_f2
- .word set_fd_d_f4
- .word set_fd_d_f6
- .word set_fd_d_f8
- .word set_fd_d_f10
- .word set_fd_d_f12
- .word set_fd_d_f14
- .word set_fd_d_f16
- .word set_fd_d_f18
- .word set_fd_d_f20
- .word set_fd_d_f22
- .word set_fd_d_f24
- .word set_fd_d_f26
- .word set_fd_d_f28
- .word set_fd_d_f30
- .text
-
-set_fd_d_f0:
- mtc1 t3, $f0
- mtc1 t0, $f1
- j ra
-set_fd_d_f2:
- mtc1 t3, $f2
- mtc1 t0, $f3
- j ra
-set_fd_d_f4:
- mtc1 t3, $f4
- mtc1 t0, $f5
- j ra
-set_fd_d_f6:
- mtc1 t3, $f6
- mtc1 t0, $f7
- j ra
-set_fd_d_f8:
- mtc1 t3, $f8
- mtc1 t0, $f9
- j ra
-set_fd_d_f10:
- mtc1 t3, $f10
- mtc1 t0, $f11
- j ra
-set_fd_d_f12:
- mtc1 t3, $f12
- mtc1 t0, $f13
- j ra
-set_fd_d_f14:
- mtc1 t3, $f14
- mtc1 t0, $f15
- j ra
-set_fd_d_f16:
- mtc1 t3, $f16
- mtc1 t0, $f17
- j ra
-set_fd_d_f18:
- mtc1 t3, $f18
- mtc1 t0, $f19
- j ra
-set_fd_d_f20:
- mtc1 t3, $f20
- mtc1 t0, $f21
- j ra
-set_fd_d_f22:
- mtc1 t3, $f22
- mtc1 t0, $f23
- j ra
-set_fd_d_f24:
- mtc1 t3, $f24
- mtc1 t0, $f25
- j ra
-set_fd_d_f26:
- mtc1 t3, $f26
- mtc1 t0, $f27
- j ra
-set_fd_d_f28:
- mtc1 t3, $f28
- mtc1 t0, $f29
- j ra
-set_fd_d_f30:
- mtc1 t3, $f30
- mtc1 t0, $f31
- j ra
-END(set_fd_d)
-
-/*----------------------------------------------------------------------------
- * renorm_fs_s --
- *
- * Results:
- * t1 unbiased exponent
- * t2 normalized fraction
- *
- *----------------------------------------------------------------------------
- */
-LEAF(renorm_fs_s)
-/*
- * Find out how many leading zero bits are in t2 and put in t9.
- */
- move v0, t2
- move t9, zero
- srl v1, v0, 16
- bne v1, zero, 1f
- addu t9, 16
- sll v0, 16
-1:
- srl v1, v0, 24
- bne v1, zero, 1f
- addu t9, 8
- sll v0, 8
-1:
- srl v1, v0, 28
- bne v1, zero, 1f
- addu t9, 4
- sll v0, 4
-1:
- srl v1, v0, 30
- bne v1, zero, 1f
- addu t9, 2
- sll v0, 2
-1:
- srl v1, v0, 31
- bne v1, zero, 1f
- addu t9, 1
-/*
- * Now shift t2 the correct number of bits.
- */
-1:
- subu t9, t9, SLEAD_ZEROS # dont count normal leading zeros
- li t1, SEXP_MIN
- subu t1, t1, t9 # adjust exponent
- sll t2, t2, t9
- j ra
-END(renorm_fs_s)
-
-/*----------------------------------------------------------------------------
- * renorm_fs_d --
- *
- * Results:
- * t1 unbiased exponent
- * t2,t3 normalized fraction
- *
- *----------------------------------------------------------------------------
- */
-LEAF(renorm_fs_d)
-/*
- * Find out how many leading zero bits are in t2,t3 and put in t9.
- */
- move v0, t2
- move t9, zero
- bne t2, zero, 1f
- move v0, t3
- addu t9, 32
-1:
- srl v1, v0, 16
- bne v1, zero, 1f
- addu t9, 16
- sll v0, 16
-1:
- srl v1, v0, 24
- bne v1, zero, 1f
- addu t9, 8
- sll v0, 8
-1:
- srl v1, v0, 28
- bne v1, zero, 1f
- addu t9, 4
- sll v0, 4
-1:
- srl v1, v0, 30
- bne v1, zero, 1f
- addu t9, 2
- sll v0, 2
-1:
- srl v1, v0, 31
- bne v1, zero, 1f
- addu t9, 1
-/*
- * Now shift t2,t3 the correct number of bits.
- */
-1:
- subu t9, t9, DLEAD_ZEROS # dont count normal leading zeros
- li t1, DEXP_MIN
- subu t1, t1, t9 # adjust exponent
- li v0, 32
- blt t9, v0, 1f
- subu t9, t9, v0 # shift fraction left >= 32 bits
- sll t2, t3, t9
- move t3, zero
- j ra
-1:
- subu v0, v0, t9 # shift fraction left < 32 bits
- sll t2, t2, t9
- srl v1, t3, v0
- or t2, t2, v1
- sll t3, t3, t9
- j ra
-END(renorm_fs_d)
-
-/*----------------------------------------------------------------------------
- * renorm_ft_s --
- *
- * Results:
- * t5 unbiased exponent
- * t6 normalized fraction
- *
- *----------------------------------------------------------------------------
- */
-LEAF(renorm_ft_s)
-/*
- * Find out how many leading zero bits are in t6 and put in t9.
- */
- move v0, t6
- move t9, zero
- srl v1, v0, 16
- bne v1, zero, 1f
- addu t9, 16
- sll v0, 16
-1:
- srl v1, v0, 24
- bne v1, zero, 1f
- addu t9, 8
- sll v0, 8
-1:
- srl v1, v0, 28
- bne v1, zero, 1f
- addu t9, 4
- sll v0, 4
-1:
- srl v1, v0, 30
- bne v1, zero, 1f
- addu t9, 2
- sll v0, 2
-1:
- srl v1, v0, 31
- bne v1, zero, 1f
- addu t9, 1
-/*
- * Now shift t6 the correct number of bits.
- */
-1:
- subu t9, t9, SLEAD_ZEROS # dont count normal leading zeros
- li t5, SEXP_MIN
- subu t5, t5, t9 # adjust exponent
- sll t6, t6, t9
- j ra
-END(renorm_ft_s)
-
-/*----------------------------------------------------------------------------
- * renorm_ft_d --
- *
- * Results:
- * t5 unbiased exponent
- * t6,t7 normalized fraction
- *
- *----------------------------------------------------------------------------
- */
-LEAF(renorm_ft_d)
-/*
- * Find out how many leading zero bits are in t6,t7 and put in t9.
- */
- move v0, t6
- move t9, zero
- bne t6, zero, 1f
- move v0, t7
- addu t9, 32
-1:
- srl v1, v0, 16
- bne v1, zero, 1f
- addu t9, 16
- sll v0, 16
-1:
- srl v1, v0, 24
- bne v1, zero, 1f
- addu t9, 8
- sll v0, 8
-1:
- srl v1, v0, 28
- bne v1, zero, 1f
- addu t9, 4
- sll v0, 4
-1:
- srl v1, v0, 30
- bne v1, zero, 1f
- addu t9, 2
- sll v0, 2
-1:
- srl v1, v0, 31
- bne v1, zero, 1f
- addu t9, 1
-/*
- * Now shift t6,t7 the correct number of bits.
- */
-1:
- subu t9, t9, DLEAD_ZEROS # dont count normal leading zeros
- li t5, DEXP_MIN
- subu t5, t5, t9 # adjust exponent
- li v0, 32
- blt t9, v0, 1f
- subu t9, t9, v0 # shift fraction left >= 32 bits
- sll t6, t7, t9
- move t7, zero
- j ra
-1:
- subu v0, v0, t9 # shift fraction left < 32 bits
- sll t6, t6, t9
- srl v1, t7, v0
- or t6, t6, v1
- sll t7, t7, t9
- j ra
-END(renorm_ft_d)
diff --git a/sys/arch/wgrisc/wgrisc/genassym.c b/sys/arch/wgrisc/wgrisc/genassym.c
deleted file mode 100644
index 24550e7fcbe..00000000000
--- a/sys/arch/wgrisc/wgrisc/genassym.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $OpenBSD: genassym.c,v 1.1.1.1 1997/02/06 16:02:45 pefo Exp $ */
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)genassym.c 8.2 (Berkeley) 9/23/93
- * $Id: genassym.c,v 1.1.1.1 1997/02/06 16:02:45 pefo Exp $
- */
-
-
-#include <sys/param.h>
-#include <sys/buf.h>
-#include <sys/map.h>
-#include <sys/proc.h>
-#include <sys/mbuf.h>
-#include <sys/user.h>
-
-#include <machine/reg.h>
-
-main()
-{
- register struct proc *p = (struct proc *)0;
- register struct user *up = (struct user *)0;
- register struct vmmeter *vm = (struct vmmeter *)0;
- register int size, s, n;
-
- printf("#define\tP_FORW %d\n", &p->p_forw);
- printf("#define\tP_BACK %d\n", &p->p_back);
- printf("#define\tP_PRIORITY %d\n", &p->p_priority);
- printf("#define\tP_ADDR %d\n", &p->p_addr);
- printf("#define\tP_UPTE %d\n", p->p_md.md_upte);
- printf("#define\tU_PCB_REGS %d\n", up->u_pcb.pcb_regs);
- printf("#define\tU_PCB_FPREGS %d\n", &up->u_pcb.pcb_regs[F0]);
- printf("#define\tU_PCB_CONTEXT %d\n", &up->u_pcb.pcb_context);
- printf("#define\tU_PCB_ONFAULT %d\n", &up->u_pcb.pcb_onfault);
- printf("#define\tU_PCB_SEGTAB %d\n", &up->u_pcb.pcb_segtab);
- printf("#define\tVM_MIN_ADDRESS 0x%x\n", VM_MIN_ADDRESS);
- printf("#define\tVM_MIN_KERNEL_ADDRESS 0x%x\n", VM_MIN_KERNEL_ADDRESS);
- printf("#define\tV_SWTCH %d\n", &vm->v_swtch);
- printf("#define\tSIGILL %d\n", SIGILL);
- printf("#define\tSIGFPE %d\n", SIGFPE);
- exit(0);
-}
diff --git a/sys/arch/wgrisc/wgrisc/locore.S b/sys/arch/wgrisc/wgrisc/locore.S
deleted file mode 100644
index 27c41952e79..00000000000
--- a/sys/arch/wgrisc/wgrisc/locore.S
+++ /dev/null
@@ -1,4566 +0,0 @@
-/* $OpenBSD: locore.S,v 1.3 1997/07/21 11:23:42 pefo Exp $ */
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Digital Equipment Corporation and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (C) 1989 Digital Equipment Corporation.
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appears in all copies.
- * Digital Equipment Corporation makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/loMem.s,
- * v 1.1 89/07/11 17:55:04 nelson Exp SPRITE (DECWRL)
- * from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/machAsm.s,
- * v 9.2 90/01/29 18:00:39 shirriff Exp SPRITE (DECWRL)
- * from: Header: /sprite/src/kernel/vm/ds3100.md/vmPmaxAsm.s,
- * v 1.1 89/07/10 14:27:41 nelson Exp SPRITE (DECWRL)
- *
- * from: @(#)locore.s 8.5 (Berkeley) 1/4/94
- * $Id: locore.S,v 1.3 1997/07/21 11:23:42 pefo Exp $
- */
-
-/*
- * Contains code that is the first executed at boot time plus
- * assembly language support routines.
- */
-
-#include <sys/errno.h>
-#include <sys/syscall.h>
-
-#include <machine/param.h>
-#include <machine/psl.h>
-#include <machine/asm.h>
-#include <machine/cpu.h>
-#include <machine/regnum.h>
-#include <machine/pte.h>
-#include <wgrisc/riscbus/riscbus.h>
-
-#include "assym.h"
-
- .set noreorder
-
-/*
- * Amount to take off of the stack for the benefit of the debugger.
- */
-#define START_FRAME ((4 * 4) + 4 + 4)
-
- .globl kernel_start
- kernel_start = start
-
- .globl start
-start:
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
- mtc0 zero, COP_0_CAUSE_REG # Clear soft interrupts
-
-#ifndef R4K
- la v0, 1f # it appears that we have to
- or v0, UNCACHED_MEMORY_ADDR # run uncached.
- j v0
- nop
-1:
- mfc0 v0, COP_0_R3K_CONF # reconfigure FP interrupt.
- li v1, 0xe3ffffff
- and v0, v0, v1
- mtc0 v0, COP_0_R3K_CONF
- nop; nop; nop; nop; nop; nop; nop; nop; nop; nop
- la v0, 1f
- j v0
- nop
-1:
-#endif
-
-/*
- * Initialize stack and call machine startup.
- */
- la sp, start - START_FRAME
- la gp, _gp
- sw zero, START_FRAME - 4(sp) # Zero out old ra for debugger
- jal mips_init # mips_init(argc, argv, envp)
- sw zero, START_FRAME - 8(sp) # Zero out old fp for debugger
-
- li t0, SR_COP_1_BIT # Disable interrupts and
- mtc0 t0, COP_0_STATUS_REG # enable the fp coprocessor
- li sp, KERNELSTACK - START_FRAME # switch to standard stack
- mfc0 t0, COP_0_PRID # read processor ID register
- nop
- nop # wait for new status to
- nop # to be effective
- nop
- cfc1 t1, FPC_ID # read FPU ID register
- sw t0, cpu_id # save PRID register
- sw t1, fpu_id # save FPU ID register
- jal main # main(regs)
- move a0, zero
-/*
- * proc[1] == /etc/init now running here.
- * Restore user registers and return.
- */
-#ifdef R4K /* ==================XXXXX============================== */
- .set noat
- li v0, SR_EXL
- mtc0 v0, COP_0_STATUS_REG # set exeption level bit.
-
- lw a0, UADDR+U_PCB_REGS+(SR * 4)
- lw t0, UADDR+U_PCB_REGS+(MULLO * 4)
- lw t1, UADDR+U_PCB_REGS+(MULHI * 4)
- mtlo t0
- mthi t1
- lw a0, UADDR+U_PCB_REGS+(PC * 4)
- lw AT, UADDR+U_PCB_REGS+(AST * 4)
- lw v0, UADDR+U_PCB_REGS+(V0 * 4)
- dmtc0 a0, COP_0_EXC_PC # set return address
- li a0, R4K_PSL_USERSET
- mtc0 a0, COP_0_STATUS_REG # switch to user mode (when eret...)
- lw v1, UADDR+U_PCB_REGS+(V1 * 4)
- lw a0, UADDR+U_PCB_REGS+(A0 * 4)
- lw a1, UADDR+U_PCB_REGS+(A1 * 4)
- lw a2, UADDR+U_PCB_REGS+(A2 * 4)
- lw a3, UADDR+U_PCB_REGS+(A3 * 4)
- lw t0, UADDR+U_PCB_REGS+(T0 * 4)
- lw t1, UADDR+U_PCB_REGS+(T1 * 4)
- lw t2, UADDR+U_PCB_REGS+(T2 * 4)
- lw t3, UADDR+U_PCB_REGS+(T3 * 4)
- lw t4, UADDR+U_PCB_REGS+(T4 * 4)
- lw t5, UADDR+U_PCB_REGS+(T5 * 4)
- lw t6, UADDR+U_PCB_REGS+(T6 * 4)
- lw t7, UADDR+U_PCB_REGS+(T7 * 4)
- lw s0, UADDR+U_PCB_REGS+(S0 * 4)
- lw s1, UADDR+U_PCB_REGS+(S1 * 4)
- lw s2, UADDR+U_PCB_REGS+(S2 * 4)
- lw s3, UADDR+U_PCB_REGS+(S3 * 4)
- lw s4, UADDR+U_PCB_REGS+(S4 * 4)
- lw s5, UADDR+U_PCB_REGS+(S5 * 4)
- lw s6, UADDR+U_PCB_REGS+(S6 * 4)
- lw s7, UADDR+U_PCB_REGS+(S7 * 4)
- lw t8, UADDR+U_PCB_REGS+(T8 * 4)
- lw gp, UADDR+U_PCB_REGS+(GP * 4)
- lw sp, UADDR+U_PCB_REGS+(SP * 4)
- lw s8, UADDR+U_PCB_REGS+(S8 * 4)
- lw ra, UADDR+U_PCB_REGS+(RA * 4)
- lw t9, UADDR+U_PCB_REGS+(T9 * 4)
- eret
- .set at
-#else
- .set noat
- li v0, R3K_PSL_USERSET
- mtc0 v0, COP_0_STATUS_REG # switch to user mode
- lw a0, UADDR+U_PCB_REGS+(SR * 4)
- lw t0, UADDR+U_PCB_REGS+(MULLO * 4)
- lw t1, UADDR+U_PCB_REGS+(MULHI * 4)
- mtlo t0
- mthi t1
- lw k0, UADDR+U_PCB_REGS+(PC * 4)
- lw AT, UADDR+U_PCB_REGS+(AST * 4)
- lw v0, UADDR+U_PCB_REGS+(V0 * 4)
- lw v1, UADDR+U_PCB_REGS+(V1 * 4)
- lw a0, UADDR+U_PCB_REGS+(A0 * 4)
- lw a1, UADDR+U_PCB_REGS+(A1 * 4)
- lw a2, UADDR+U_PCB_REGS+(A2 * 4)
- lw a3, UADDR+U_PCB_REGS+(A3 * 4)
- lw t0, UADDR+U_PCB_REGS+(T0 * 4)
- lw t1, UADDR+U_PCB_REGS+(T1 * 4)
- lw t2, UADDR+U_PCB_REGS+(T2 * 4)
- lw t3, UADDR+U_PCB_REGS+(T3 * 4)
- lw t4, UADDR+U_PCB_REGS+(T4 * 4)
- lw t5, UADDR+U_PCB_REGS+(T5 * 4)
- lw t6, UADDR+U_PCB_REGS+(T6 * 4)
- lw t7, UADDR+U_PCB_REGS+(T7 * 4)
- lw s0, UADDR+U_PCB_REGS+(S0 * 4)
- lw s1, UADDR+U_PCB_REGS+(S1 * 4)
- lw s2, UADDR+U_PCB_REGS+(S2 * 4)
- lw s3, UADDR+U_PCB_REGS+(S3 * 4)
- lw s4, UADDR+U_PCB_REGS+(S4 * 4)
- lw s5, UADDR+U_PCB_REGS+(S5 * 4)
- lw s6, UADDR+U_PCB_REGS+(S6 * 4)
- lw s7, UADDR+U_PCB_REGS+(S7 * 4)
- lw t8, UADDR+U_PCB_REGS+(T8 * 4)
- lw t9, UADDR+U_PCB_REGS+(T9 * 4)
- lw gp, UADDR+U_PCB_REGS+(GP * 4)
- lw sp, UADDR+U_PCB_REGS+(SP * 4)
- lw s8, UADDR+U_PCB_REGS+(S8 * 4)
- lw ra, UADDR+U_PCB_REGS+(RA * 4)
- j k0
- rfe
- .set at
-#endif /* ==================XXXXX============================== */
-
-/*
- * Primitives
- */
-
-/*
- * This table is indexed by u.u_pcb.pcb_onfault in trap().
- * The reason for using this table rather than storing an address in
- * u.u_pcb.pcb_onfault is simply to make the code faster.
- */
- .globl onfault_table
- .data
- .align 3
-onfault_table:
- .word 0 # invalid index number
-#define BADERR 1
- .word baderr
-#define COPYERR 2
- .word copyerr
-#define FSWBERR 3
- .word fswberr
-#define FSWINTRBERR 4
- .word fswintrberr
-#ifdef DEBUG
-#define MDBERR 5
- .word mdberr
-#endif
- .text
-
-/*
- * See if access to addr with a len type instruction causes a machine check.
- * len is length of access (1=byte, 2=short, 4=long)
- *
- * badaddr(addr, len)
- * char *addr;
- * int len;
- */
-LEAF(badaddr)
- li v0, BADERR
- bne a1, 1, 2f
- sw v0, UADDR+U_PCB_ONFAULT
- b 5f
- lbu v0, (a0)
-2:
- bne a1, 2, 4f
- nop
- b 5f
- lhu v0, (a0)
-4:
- lw v0, (a0)
-5:
- sw zero, UADDR+U_PCB_ONFAULT
- j ra
- move v0, zero # made it w/o errors
-baderr:
- j ra
- li v0, 1 # trap sends us here
-END(badaddr)
-
-/*
- * This code is copied the user's stack for returning from signal handlers
- * (see sendsig() and sigreturn()). We have to compute the address
- * of the sigcontext struct for the sigreturn call.
- */
- .globl sigcode
-sigcode:
- addu a0, sp, 16 # address of sigcontext
- li v0, SYS_sigreturn # sigreturn(scp)
- syscall
- break 0 # just in case sigreturn fails
- .globl esigcode
-esigcode:
-
-/*
- * Copy a null terminated string within the kernel address space.
- * Maxlength may be null if count not wanted.
- * copystr(fromaddr, toaddr, maxlength, &lencopied)
- * caddr_t fromaddr;
- * caddr_t toaddr;
- * u_int maxlength;
- * u_int *lencopied;
- */
-LEAF(copystr)
- move t2, a2 # Save the number of bytes
-1:
- lbu t0, 0(a0)
- subu a2, a2, 1
- beq t0, zero, 2f
- sb t0, 0(a1)
- addu a0, a0, 1
- bne a2, zero, 1b
- addu a1, a1, 1
-2:
- beq a3, zero, 3f
- subu a2, t2, a2 # compute length copied
- sw a2, 0(a3)
-3:
- j ra
- move v0, zero
-END(copystr)
-
-/*
- * fillw(pat, addr, count)
- */
-LEAF(fillw)
-1:
- addiu a2, a2, -1
- sh a0, 0(a1)
- bne a2,zero, 1b
- addiu a1, a1, 2
-
- jr ra
- nop
-END(fillw)
-
-/*
- * Block I/O routines mainly used by I/O drivers.
- *
- * Args as: a0 = port
- * a1 = memory address
- * a2 = count
- */
-LEAF(insb)
- beq a2, zero, 2f
- addu a2, a1
-1:
- lbu v0, 0(a0)
- addiu a1, 1
- bne a1, a2, 1b
- sb v0, -1(a1)
-2:
- jr ra
- nop
-END(insb)
-
-LEAF(insw)
- beq a2, zero, 2f
- addu a2, a2
- addu a2, a1
-1:
- lhu v0, 0(a0)
- addiu a1, 2
- bne a1, a2, 1b
- sh v0, -2(a1)
-2:
- jr ra
- nop
-END(insw)
-
-LEAF(insl)
- beq a2, zero, 2f
- sll a2, 2
- addu a2, a1
-1:
- lw v0, 0(a0)
- addiu a1, 4
- bne a1, a2, 1b
- sw v0, -4(a1)
-2:
- jr ra
- nop
-END(insl)
-
-LEAF(outsb)
- beq a2, zero, 2f
- addu a2, a1
-1:
- lbu v0, 0(a1)
- addiu a1, 1
- bne a1, a2, 1b
- sb v0, 0(a0)
-2:
- jr ra
- nop
-END(outsb)
-
-LEAF(outsw)
- beq a2, zero, 2f
- addu a2, a2
- li v0, 1
- and v0, a1
- bne v0, zero, 3f # arghh, unaligned.
- addu a2, a1
-1:
- lhu v0, 0(a1)
- addiu a1, 2
- bne a1, a2, 1b
- sh v0, 0(a0)
-2:
- jr ra
- nop
-3:
- LWHI v0, 0(a1)
- LWLO v0, 3(a1)
- addiu a1, 2
- bne a1, a2, 3b
- sh v0, 0(a0)
-
- jr ra
- nop
-END(outsw)
-
-LEAF(outsl)
- beq a2, zero, 2f
- sll a2, 2
- li v0, 3
- and v0, a1
- bne v0, zero, 3f # arghh, unaligned.
- addu a2, a1
-1:
- lw v0, 0(a1)
- addiu a1, 4
- bne a1, a2, 1b
- sw v0, 0(a0)
-2:
- jr ra
- nop
-3:
- LWHI v0, 0(a1)
- LWLO v0, 3(a1)
- addiu a1, 4
- bne a1, a2, 3b
- sw v0, 0(a0)
-
- jr ra
- nop
-END(outsl)
-
-/*
- * Copy and swap words.
- *
- * copynswap(from, to, size);
- */
-LEAF(copynswap)
- subu a2, a2, 1
- and a2, a2, 0xfffffffc
- lw t3, 0(a0)
- addu a0, a0, 4
- beqz a2, 2f # move below is in delay slot!
-1:
- move t0, t3
- lw t3, 0(a0) # look ahead load...
- addu a0, a0, 4
- srl t1, t0, 24 # d24-d31 -> d0-d7
- sll t2, t0, 24 # d0-d7 -> d24-d31
- or t2, t2, t1 # combine
- srl t1, t0, 8
- and t1, t1, 0xff00 # mask
- or t2, t1, t2 # d16-d23 -> d8-d15
- and t0, t0, 0xff00 # mask
- sll t0, t0, 8
- or t2, t0, t2 # d8-d15 -> d16-d23
- sw t2, 0(a1)
- subu a2, a2, 4
- bnez a2, 1b
- addu a1, a1, 4
-2: # Do last word ----
- srl t1, t3, 24 # d24-d31 -> d0-d7
- sll t2, t3, 24 # d0-d7 -> d24-d31
- or t2, t2, t1 # combine
- srl t1, t3, 8
- and t1, t1, 0xff00 # mask
- or t2, t1, t2 # d16-d23 -> d8-d15
- and t3, t3, 0xff00 # mask
- sll t0, t3, 8
- or t2, t0, t2 # d8-d15 -> d16-d23
- jr ra
- sw t2, 0(a1)
-END(copynswap)
-
-/*
- * Copy a null terminated string from the user address space into
- * the kernel address space.
- *
- * copyinstr(fromaddr, toaddr, maxlength, &lencopied)
- * caddr_t fromaddr;
- * caddr_t toaddr;
- * u_int maxlength;
- * u_int *lencopied;
- */
-NON_LEAF(copyinstr, STAND_FRAME_SIZE, ra)
- subu sp, sp, STAND_FRAME_SIZE
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
- sw ra, STAND_RA_OFFSET(sp)
- blt a0, zero, copyerr # make sure address is in user space
- li v0, COPYERR
- jal copystr
- sw v0, UADDR+U_PCB_ONFAULT
- lw ra, STAND_RA_OFFSET(sp)
- sw zero, UADDR+U_PCB_ONFAULT
- addu sp, sp, STAND_FRAME_SIZE
- j ra
- move v0, zero
-END(copyinstr)
-
-/*
- * Copy a null terminated string from the kernel address space into
- * the user address space.
- *
- * copyoutstr(fromaddr, toaddr, maxlength, &lencopied)
- * caddr_t fromaddr;
- * caddr_t toaddr;
- * u_int maxlength;
- * u_int *lencopied;
- */
-NON_LEAF(copyoutstr, STAND_FRAME_SIZE, ra)
- subu sp, sp, STAND_FRAME_SIZE
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
- sw ra, STAND_RA_OFFSET(sp)
- blt a1, zero, copyerr # make sure address is in user space
- li v0, COPYERR
- jal copystr
- sw v0, UADDR+U_PCB_ONFAULT
- lw ra, STAND_RA_OFFSET(sp)
- sw zero, UADDR+U_PCB_ONFAULT
- addu sp, sp, STAND_FRAME_SIZE
- j ra
- move v0, zero
-END(copyoutstr)
-
-/*
- * Copy specified amount of data from user space into the kernel
- * copyin(from, to, len)
- * caddr_t *from; (user source address)
- * caddr_t *to; (kernel destination address)
- * unsigned len;
- */
-NON_LEAF(copyin, STAND_FRAME_SIZE, ra)
- subu sp, sp, STAND_FRAME_SIZE
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
- sw ra, STAND_RA_OFFSET(sp)
- blt a0, zero, copyerr # make sure address is in user space
- li v0, COPYERR
- jal bcopy
- sw v0, UADDR+U_PCB_ONFAULT
- lw ra, STAND_RA_OFFSET(sp)
- sw zero, UADDR+U_PCB_ONFAULT
- addu sp, sp, STAND_FRAME_SIZE
- j ra
- move v0, zero
-END(copyin)
-
-/*
- * Copy specified amount of data from kernel to the user space
- * copyout(from, to, len)
- * caddr_t *from; (kernel source address)
- * caddr_t *to; (user destination address)
- * unsigned len;
- */
-NON_LEAF(copyout, STAND_FRAME_SIZE, ra)
- subu sp, sp, STAND_FRAME_SIZE
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
- sw ra, STAND_RA_OFFSET(sp)
- blt a1, zero, copyerr # make sure address is in user space
- li v0, COPYERR
- jal bcopy
- sw v0, UADDR+U_PCB_ONFAULT
- lw ra, STAND_RA_OFFSET(sp)
- sw zero, UADDR+U_PCB_ONFAULT
- addu sp, sp, STAND_FRAME_SIZE
- j ra
- move v0, zero
-END(copyout)
-
-LEAF(copyerr)
- lw ra, STAND_RA_OFFSET(sp)
- sw zero, UADDR+U_PCB_ONFAULT
- addu sp, sp, STAND_FRAME_SIZE
- j ra
- li v0, EFAULT # return error
-END(copyerr)
-
-/*
- * Copy the kernel stack to the new process and save the current context so
- * the new process will return nonzero when it is resumed by cpu_switch().
- *
- * copykstack(up)
- * struct user *up;
- */
-LEAF(copykstack)
- subu v0, sp, UADDR # compute offset into stack
- addu v0, v0, a0 # v0 = new stack address
- move v1, sp # v1 = old stack address
- li t1, KERNELSTACK
-1:
- lw t0, 0(v1) # copy stack data
- addu v1, v1, 4
- sw t0, 0(v0)
- bne v1, t1, 1b
- addu v0, v0, 4
- /* FALLTHROUGH */
-/*
- * Save registers and state so we can do a longjmp later.
- * Note: this only works if p != curproc since
- * cpu_switch() will copy over pcb_context.
- *
- * savectx(up)
- * struct user *up;
- */
-ALEAF(savectx)
- sw s0, U_PCB_CONTEXT+0(a0)
- sw s1, U_PCB_CONTEXT+4(a0)
- sw s2, U_PCB_CONTEXT+8(a0)
- sw s3, U_PCB_CONTEXT+12(a0)
- mfc0 v0, COP_0_STATUS_REG
- sw s4, U_PCB_CONTEXT+16(a0)
- sw s5, U_PCB_CONTEXT+20(a0)
- sw s6, U_PCB_CONTEXT+24(a0)
- sw s7, U_PCB_CONTEXT+28(a0)
- sw sp, U_PCB_CONTEXT+32(a0)
- sw s8, U_PCB_CONTEXT+36(a0)
- sw ra, U_PCB_CONTEXT+40(a0)
- sw v0, U_PCB_CONTEXT+44(a0)
- j ra
- move v0, zero
-END(copykstack)
-
-/*
- * The following primitives manipulate the run queues. _whichqs tells which
- * of the 32 queues _qs have processes in them. Setrunqueue puts processes
- * into queues, Remrq removes them from queues. The running process is on
- * no queue, other processes are on a queue related to p->p_priority, divided
- * by 4 actually to shrink the 0-127 range of priorities into the 32 available
- * queues.
- */
-/*
- * setrunqueue(p)
- * proc *p;
- *
- * Call should be made at splclock(), and p->p_stat should be SRUN.
- */
-NON_LEAF(setrunqueue, STAND_FRAME_SIZE, ra)
- subu sp, sp, STAND_FRAME_SIZE
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
- lw t0, P_BACK(a0) ## firewall: p->p_back must be 0
- sw ra, STAND_RA_OFFSET(sp) ##
- beq t0, zero, 1f ##
- lbu t0, P_PRIORITY(a0) # put on p->p_priority / 4 queue
- PANIC("setrunqueue") ##
-1:
- li t1, 1 # compute corresponding bit
- srl t0, t0, 2 # compute index into 'whichqs'
- sll t1, t1, t0
- lw t2, whichqs # set corresponding bit
- nop
- or t2, t2, t1
- sw t2, whichqs
- sll t0, t0, 3 # compute index into 'qs'
- la t1, qs
- addu t0, t0, t1 # t0 = qp = &qs[pri >> 2]
- lw t1, P_BACK(t0) # t1 = qp->ph_rlink
- sw t0, P_FORW(a0) # p->p_forw = qp
- sw t1, P_BACK(a0) # p->p_back = qp->ph_rlink
- sw a0, P_FORW(t1) # p->p_back->p_forw = p;
- sw a0, P_BACK(t0) # qp->ph_rlink = p
- j ra
- addu sp, sp, STAND_FRAME_SIZE
-END(setrunqueue)
-
-/*
- * Remrq(p)
- *
- * Call should be made at splclock().
- */
-NON_LEAF(remrunqueue, STAND_FRAME_SIZE, ra)
- subu sp, sp, STAND_FRAME_SIZE
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
- lbu t0, P_PRIORITY(a0) # get from p->p_priority / 4 queue
- li t1, 1 # compute corresponding bit
- srl t0, t0, 2 # compute index into 'whichqs'
- lw t2, whichqs # check corresponding bit
- sll t1, t1, t0
- and v0, t2, t1
- sw ra, STAND_RA_OFFSET(sp) ##
- bne v0, zero, 1f ##
- lw v0, P_BACK(a0) # v0 = p->p_back
- PANIC("remrq") ## it wasnt recorded to be on its q
-1:
- lw v1, P_FORW(a0) # v1 = p->p_forw
- nop
- sw v1, P_FORW(v0) # p->p_back->p_forw = p->p_forw;
- sw v0, P_BACK(v1) # p->p_forw->p_back = p->r_rlink
- sll t0, t0, 3 # compute index into 'qs'
- la v0, qs
- addu t0, t0, v0 # t0 = qp = &qs[pri >> 2]
- lw v0, P_FORW(t0) # check if queue empty
- nop
- bne v0, t0, 2f # No. qp->ph_link != qp
- nop
- xor t2, t2, t1 # clear corresponding bit in 'whichqs'
- sw t2, whichqs
-2:
- sw zero, P_BACK(a0) ## for firewall checking
- j ra
- addu sp, sp, STAND_FRAME_SIZE
-END(remrunqueue)
-
-/*
- * switch_exit()
- *
- * At exit of a process, do a cpu_switch for the last time.
- * The mapping of the pcb at p->p_addr has already been deleted,
- * and the memory for the pcb+stack has been freed.
- * All interrupts should be blocked at this point.
- */
-LEAF(switch_exit)
- la v1, nullproc # save state into garbage proc
- lw t0, P_UPTE+0(v1) # t0 = first u. pte
- lw t1, P_UPTE+4(v1) # t1 = 2nd u. pte
- li v0, UADDR # v0 = first HI entry
- mtc0 zero, COP_0_TLB_INDEX # set the index register
-#ifdef R4K /* ==================XXXXX============================== */
- dmtc0 v0, COP_0_TLB_HI # init high entry
- dmtc0 t0, COP_0_TLB_LO0 # init low entry0
- dmtc0 t1, COP_0_TLB_LO1 # init low entry1
- nop
- tlbwi # Write the TLB entry.
- nop
- nop
- sw zero, curproc
-#else
- mtc0 v0, COP_0_TLB_HI # init high entry
- mtc0 t0, COP_0_TLB_LO0 # init low entry
- li t0, 1 << R3K_TLB_INDEX_SHIFT
- tlbwi # Write the TLB entry.
- addu v0, v0, NBPG # 2nd HI entry
- mtc0 t0, COP_0_TLB_INDEX # set the index register
- mtc0 v0, COP_0_TLB_HI # init high entry
- mtc0 t1, COP_0_TLB_LO0 # init low entry
- sw zero, curproc
- tlbwi # Write the TLB entry.
-#endif /* ==================XXXXX============================== */
- b cpu_switch
- li sp, KERNELSTACK - START_FRAME # switch to standard stack
-END(switch_exit)
-
-/*
- * When no processes are on the runq, cpu_switch branches to idle
- * to wait for something to come ready.
- * Note: this is really a part of cpu_switch() but defined here for kernel
- * profiling.
- */
-LEAF(idle)
- li t0, (INT_MASK | SR_INT_ENAB) # XXX INT_MASK should be a var..
- mtc0 t0, COP_0_STATUS_REG # enable all interrupts
- sw zero, curproc # set curproc NULL for stats
-1:
- lbu t4, led_sw
- nop
- or t4, 0x40
-#ifdef ROTATING_LED
- sb t4, RISC_LEDS
-#endif
- mfc0 v1, COP_0_PRID
- lw t0, whichqs # look for non-empty queue
- li v1, 0xff00
- bne t0, zero, sw1
- and v0, v1
- li v1, (MIPS_R3000 << 8)
- bne v1, v0, 1b
-#if 0
- mfc0 v1, COP_0_CFG
-#else
- nop
-#endif
- li v0, 0x02000000 # XXX assume halt for now.
- or v1, v0, v1
- b 1b
-#if 0
- mtc0 v1, COP_0_CFG
-#else
- nop
-#endif
-END(idle)
-
-/*
- * cpu_switch()
- * Find the highest priority process and resume it.
- */
-NON_LEAF(cpu_switch, STAND_FRAME_SIZE, ra)
- sw sp, UADDR+U_PCB_CONTEXT+32 # save old sp
- subu sp, sp, STAND_FRAME_SIZE
- sw ra, STAND_RA_OFFSET(sp)
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
- lw t2, cnt+V_SWTCH # for statistics
- lw t1, whichqs # look for non-empty queue
- sw s0, UADDR+U_PCB_CONTEXT+0 # do a 'savectx()'
- sw s1, UADDR+U_PCB_CONTEXT+4
- sw s2, UADDR+U_PCB_CONTEXT+8
- sw s3, UADDR+U_PCB_CONTEXT+12
- mfc0 t0, COP_0_STATUS_REG # t0 = saved status register
- sw s4, UADDR+U_PCB_CONTEXT+16
- sw s5, UADDR+U_PCB_CONTEXT+20
- sw s6, UADDR+U_PCB_CONTEXT+24
- sw s7, UADDR+U_PCB_CONTEXT+28
- sw s8, UADDR+U_PCB_CONTEXT+36
- sw ra, UADDR+U_PCB_CONTEXT+40 # save return address
- sw t0, UADDR+U_PCB_CONTEXT+44 # save status register
- addu t2, t2, 1
- sw t2, cnt+V_SWTCH
- beq t1, zero, idle # if none, idle
-sw1:
- mtc0 zero, COP_0_STATUS_REG # Disable all interrupts
- lbu t4, led_sw
- nop # wait for intrs disabled
- srl t5, t4, 5 # instructions below is part
- sll t4, t4, 1 # if the delay!
- or t4, t5
- and t4, 0x3f
- sb t4, led_sw
-#ifdef ROTATING_LED
- sb t4, RISC_LEDS
-#else
- nop
- nop
- nop
- nop
- nop
-#endif
-
- lw t0, whichqs # look for non-empty queue
- li t2, -1 # t2 = lowest bit set
- beq t0, zero, idle # if none, idle
- move t3, t0 # t3 = saved whichqs
-
-1:
- addu t2, t2, 1
- and t1, t0, 1 # bit set?
- beq t1, zero, 1b
- srl t0, t0, 1 # try next bit
-/*
- * Remove process from queue.
- */
- sll t0, t2, 3
- la t1, qs
- addu t0, t0, t1 # t0 = qp = &qs[highbit]
- lw a0, P_FORW(t0) # a0 = p = highest pri process
- nop
- lw v0, P_FORW(a0) # v0 = p->p_forw
- bne t0, a0, 2f # make sure something in queue
- sw v0, P_FORW(t0) # qp->ph_link = p->p_forw;
- PANIC("cpu_switch") # nothing in queue
-2:
- sw t0, P_BACK(v0) # p->p_forw->p_back = qp
- bne v0, t0, 3f # queue still not empty
- sw zero, P_BACK(a0) ## for firewall checking
- li v1, 1 # compute bit in 'whichqs'
- sll v1, v1, t2
- xor t3, t3, v1 # clear bit in 'whichqs'
- sw t3, whichqs
-3:
-/*
- * Switch to new context.
- * NOTE: This is hard coded to UPAGES == 2.
- * Also, there should be no TLB faults at this point.
- */
- sw zero, want_resched
- jal pmap_alloc_tlbpid # v0 = TLB PID
- move s0, a0 # BDSLOT: save p
- sw s0, curproc # set curproc
- lw t0, P_UPTE+0(s0) # t0 = first u. pte
- lw t1, P_UPTE+4(s0) # t1 = 2nd u. pte
-#ifdef R4K /* ==================XXXXX============================== */
- or v0, v0, UADDR # v0 = first HI entry
- mtc0 zero, COP_0_TLB_INDEX # set the index register
- dmtc0 v0, COP_0_TLB_HI # init high entry
- dmtc0 t0, COP_0_TLB_LO0 # init low entry0
- dmtc0 t1, COP_0_TLB_LO1 # init low entry1
- nop
- tlbwi # Write the TLB entry.
- nop # Delay for effect
- nop # Delay for effect
- nop
- nop
-#else
- sll v0, v0, R3K_PID_SHIFT
- or v0, v0, UADDR
- mtc0 zero, COP_0_TLB_INDEX # set the index register
- mtc0 v0, COP_0_TLB_HI # init high entry
- mtc0 t0, COP_0_TLB_LO0 # init low entry
- li t0, 1 << R3K_TLB_INDEX_SHIFT
- tlbwi # Write the TLB entry.
- addu v0, v0, NBPG # 2nd HI entry
- mtc0 t0, COP_0_TLB_INDEX # set the index register
- mtc0 v0, COP_0_TLB_HI # init high entry
- mtc0 t1, COP_0_TLB_LO0 # init low entry
- nop
- tlbwi # Write the TLB entry.
-#endif /* ==================XXXXX============================== */
-
-/*
- * Now running on new u struct.
- * Restore registers and return.
- */
- lw v0, UADDR+U_PCB_CONTEXT+44 # restore kernel context
- lw ra, UADDR+U_PCB_CONTEXT+40
- lw s0, UADDR+U_PCB_CONTEXT+0
- lw s1, UADDR+U_PCB_CONTEXT+4
- lw s2, UADDR+U_PCB_CONTEXT+8
- lw s3, UADDR+U_PCB_CONTEXT+12
- lw s4, UADDR+U_PCB_CONTEXT+16
- lw s5, UADDR+U_PCB_CONTEXT+20
- lw s6, UADDR+U_PCB_CONTEXT+24
- lw s7, UADDR+U_PCB_CONTEXT+28
- lw sp, UADDR+U_PCB_CONTEXT+32
- lw s8, UADDR+U_PCB_CONTEXT+36
- mtc0 v0, COP_0_STATUS_REG
- j ra
- li v0, 1 # possible return to 'savectx()'
-END(cpu_switch)
-
-/*
- * {fu,su},{ibyte,isword,iword}, fetch or store a byte, short or word to
- * user text space.
- * {fu,su},{byte,sword,word}, fetch or store a byte, short or word to
- * user data space.
- */
-LEAF(fuword)
-ALEAF(fuiword)
- blt a0, zero, fswberr # make sure address is in user space
- li v0, FSWBERR
- sw v0, UADDR+U_PCB_ONFAULT
- lw v0, 0(a0) # fetch word
- j ra
- sw zero, UADDR+U_PCB_ONFAULT
-END(fuword)
-
-LEAF(fusword)
-ALEAF(fuisword)
- blt a0, zero, fswberr # make sure address is in user space
- li v0, FSWBERR
- sw v0, UADDR+U_PCB_ONFAULT
- lhu v0, 0(a0) # fetch short
- j ra
- sw zero, UADDR+U_PCB_ONFAULT
-END(fusword)
-
-LEAF(fubyte)
-ALEAF(fuibyte)
- blt a0, zero, fswberr # make sure address is in user space
- li v0, FSWBERR
- sw v0, UADDR+U_PCB_ONFAULT
- lbu v0, 0(a0) # fetch byte
- j ra
- sw zero, UADDR+U_PCB_ONFAULT
-END(fubyte)
-
-LEAF(suword)
- blt a0, zero, fswberr # make sure address is in user space
- li v0, FSWBERR
- sw v0, UADDR+U_PCB_ONFAULT
- sw a1, 0(a0) # store word
- sw zero, UADDR+U_PCB_ONFAULT
- j ra
- move v0, zero
-END(suword)
-
-/*
- * Have to flush instruction cache afterwards.
- */
-LEAF(suiword)
- blt a0, zero, fswberr # make sure address is in user space
- li v0, FSWBERR
- sw v0, UADDR+U_PCB_ONFAULT
- sw a1, 0(a0) # store word
- sw zero, UADDR+U_PCB_ONFAULT
-#ifdef R4K
- b R4K_FlushICache # FlushICache sets v0 = 0. (Ugly)
-#else
- b R3K_FlushICache # FlushICache sets v0 = 0. (Ugly)
-#endif
- li a1, 4 # size of word
-END(suiword)
-
-/*
- * Will have to flush the instruction cache if byte merging is done in hardware.
- */
-LEAF(susword)
-ALEAF(suisword)
- blt a0, zero, fswberr # make sure address is in user space
- li v0, FSWBERR
- sw v0, UADDR+U_PCB_ONFAULT
- sh a1, 0(a0) # store short
- sw zero, UADDR+U_PCB_ONFAULT
- j ra
- move v0, zero
-END(susword)
-
-LEAF(subyte)
-ALEAF(suibyte)
- blt a0, zero, fswberr # make sure address is in user space
- li v0, FSWBERR
- sw v0, UADDR+U_PCB_ONFAULT
- sb a1, 0(a0) # store byte
- sw zero, UADDR+U_PCB_ONFAULT
- j ra
- move v0, zero
-END(subyte)
-
-LEAF(fswberr)
- j ra
- li v0, -1
-END(fswberr)
-
-/*
- * fuswintr and suswintr are just like fusword and susword except that if
- * the page is not in memory or would cause a trap, then we return an error.
- * The important thing is to prevent sleep() and switch().
- */
-LEAF(fuswintr)
- blt a0, zero, fswintrberr # make sure address is in user space
- li v0, FSWINTRBERR
- sw v0, UADDR+U_PCB_ONFAULT
- lhu v0, 0(a0) # fetch short
- j ra
- sw zero, UADDR+U_PCB_ONFAULT
-END(fuswintr)
-
-LEAF(suswintr)
- blt a0, zero, fswintrberr # make sure address is in user space
- li v0, FSWINTRBERR
- sw v0, UADDR+U_PCB_ONFAULT
- sh a1, 0(a0) # store short
- sw zero, UADDR+U_PCB_ONFAULT
- j ra
- move v0, zero
-END(suswintr)
-
-LEAF(fswintrberr)
- j ra
- li v0, -1
-END(fswintrberr)
-
-/*
- * Insert 'p' after 'q'.
- * _insque(p, q)
- * caddr_t p, q;
- */
-LEAF(_insque)
- lw v0, 0(a1) # v0 = q->next
- sw a1, 4(a0) # p->prev = q
- sw v0, 0(a0) # p->next = q->next
- sw a0, 4(v0) # q->next->prev = p
- j ra
- sw a0, 0(a1) # q->next = p
-END(_insque)
-
-/*
- * Remove item 'p' from queue.
- * _remque(p)
- * caddr_t p;
- */
-LEAF(_remque)
- lw v0, 0(a0) # v0 = p->next
- lw v1, 4(a0) # v1 = p->prev
- nop
- sw v0, 0(v1) # p->prev->next = p->next
- j ra
- sw v1, 4(v0) # p->next->prev = p->prev
-END(_remque)
-
-/*
- * This code is copied to the TLB exception vector address to
- * handle TLB translation misses.
- * NOTE: This code must be relocatable and max 32 instructions!!!
- * Don't check for invalid pte's here. We load them as well and
- * let the processor trap to load the correct value after service.
- */
-#ifdef R4K /* ==================XXXXX============================== */
- .globl R4K_TLBMiss
-R4K_TLBMiss:
- .set noat
- dmfc0 k0, COP_0_BAD_VADDR # get the virtual address
- lw k1, UADDR+U_PCB_SEGTAB # get the current segment table
- bltz k0, 1f # kernel address space ->
- srl k0, k0, SEGSHIFT - 2 # compute segment table index
- andi k0, k0, 0x7fc # PMAP_SEGTABSIZ-1
- addu k1, k1, k0
- dmfc0 k0, COP_0_BAD_VADDR # get the virtual address
- lw k1, 0(k1) # get pointer to segment map
- srl k0, k0, PGSHIFT - 2 # compute segment map index
- andi k0, k0, ((NPTEPG/2) - 1) << 3
- beq k1, zero, 2f # invalid segment map
- addu k1, k1, k0 # index into segment map
- lw k0, 0(k1) # get page PTE
- lw k1, 4(k1)
- dsll k0, k0, 34
- dsrl k0, k0, 34
- dmtc0 k0, COP_0_TLB_LO0
- dsll k1, k1, 34
- dsrl k1, k1, 34
- dmtc0 k1, COP_0_TLB_LO1
- nop
- tlbwr # update TLB
- nop
- nop
- nop
- nop
- nop
- eret
-1:
- j R4K_TLBMissException
- nop
-2:
- j SlowFault
- nop
-
- .globl R4K_TLBMissEnd
-R4K_TLBMissEnd:
- .set at
-
-/*
- * This code is copied to the general exception vector address to
- * handle all execptions except RESET and TLBMiss.
- * NOTE: This code must be relocatable!!!
- */
- .globl R4K_Exception
-R4K_Exception:
-/*
- * Find out what mode we came from and jump to the proper handler.
- */
- .set noat
- mfc0 k0, COP_0_STATUS_REG # Get the status register
- mfc0 k1, COP_0_CAUSE_REG # Get the cause register value.
- and k0, k0, SR_KSU_USER # test for user mode
- # sneaky but the bits are
- # with us........
- sll k0, k0, 3 # shift user bit for cause index
- and k1, k1, CR_EXC_CODE # Mask out the cause bits.
- or k1, k1, k0 # change index to user table
-1:
- la k0, R4K_ExceptionTable # get base of the jump table
- addu k0, k0, k1 # Get the address of the
- # function entry. Note that
- # the cause is already
- # shifted left by 2 bits so
- # we dont have to shift.
- lw k0, 0(k0) # Get the function address
- nop
- j k0 # Jump to the function.
- nop
- .set at
- .globl R4K_ExceptionEnd
-R4K_ExceptionEnd:
-
-/*
- * We couldn't find a TLB entry.
- * Find out what mode we came from and call the appropriate handler.
- */
-SlowFault:
- .set noat
- mfc0 k0, COP_0_STATUS_REG
- nop
- and k0, k0, SR_KSU_USER
- bne k0, zero, R4K_UserGenException
- nop
- .set at
-/*
- * Fall though ...
- */
-
-/*----------------------------------------------------------------------------
- *
- * R4K_KernGenException --
- *
- * Handle an exception from kernel mode.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-
-/*
- * The kernel exception stack contains 18 saved general registers,
- * the status register and the multiply lo and high registers.
- * In addition, we set this up for linkage conventions.
- */
-#define KERN_REG_SIZE (18 * 4)
-#define KERN_REG_OFFSET (STAND_FRAME_SIZE)
-#define KERN_SR_OFFSET (STAND_FRAME_SIZE + KERN_REG_SIZE)
-#define KERN_MULT_LO_OFFSET (STAND_FRAME_SIZE + KERN_REG_SIZE + 4)
-#define KERN_MULT_HI_OFFSET (STAND_FRAME_SIZE + KERN_REG_SIZE + 8)
-#define KERN_EXC_FRAME_SIZE (STAND_FRAME_SIZE + KERN_REG_SIZE + 12)
-
-NNON_LEAF(R4K_KernGenException, KERN_EXC_FRAME_SIZE, ra)
- .set noat
-#ifdef DEBUG
- la k0, mdbpcb # save registers for mdb
- sw s0, (S0 * 4)(k0)
- sw s1, (S1 * 4)(k0)
- sw s2, (S2 * 4)(k0)
- sw s3, (S3 * 4)(k0)
- sw s4, (S4 * 4)(k0)
- sw s5, (S5 * 4)(k0)
- sw s6, (S6 * 4)(k0)
- sw s7, (S7 * 4)(k0)
- sw s8, (S8 * 4)(k0)
- sw gp, (GP * 4)(k0)
- sw sp, (SP * 4)(k0)
-#endif
- subu sp, sp, KERN_EXC_FRAME_SIZE
- .mask 0x80000000, (STAND_RA_OFFSET - KERN_EXC_FRAME_SIZE)
-/*
- * Save the relevant kernel registers onto the stack.
- * We don't need to save s0 - s8, sp and gp because
- * the compiler does it for us.
- */
- sw AT, KERN_REG_OFFSET + 0(sp)
- sw v0, KERN_REG_OFFSET + 4(sp)
- sw v1, KERN_REG_OFFSET + 8(sp)
- sw a0, KERN_REG_OFFSET + 12(sp)
- mflo v0
- mfhi v1
- sw a1, KERN_REG_OFFSET + 16(sp)
- sw a2, KERN_REG_OFFSET + 20(sp)
- sw a3, KERN_REG_OFFSET + 24(sp)
- sw t0, KERN_REG_OFFSET + 28(sp)
- mfc0 a0, COP_0_STATUS_REG # First arg is the status reg.
- sw t1, KERN_REG_OFFSET + 32(sp)
- sw t2, KERN_REG_OFFSET + 36(sp)
- sw t3, KERN_REG_OFFSET + 40(sp)
- sw t4, KERN_REG_OFFSET + 44(sp)
- mfc0 a1, COP_0_CAUSE_REG # Second arg is the cause reg.
- sw t5, KERN_REG_OFFSET + 48(sp)
- sw t6, KERN_REG_OFFSET + 52(sp)
- sw t7, KERN_REG_OFFSET + 56(sp)
- sw t8, KERN_REG_OFFSET + 60(sp)
- mfc0 a2, COP_0_BAD_VADDR # Third arg is the fault addr.
- sw t9, KERN_REG_OFFSET + 64(sp)
- sw ra, KERN_REG_OFFSET + 68(sp)
- sw v0, KERN_MULT_LO_OFFSET(sp)
- sw v1, KERN_MULT_HI_OFFSET(sp)
- mfc0 a3, COP_0_EXC_PC # Fourth arg is the pc.
- sw a0, KERN_SR_OFFSET(sp)
-
- mtc0 zero,COP_0_STATUS_REG # Set kernel no error level
-/*
- * Call the exception handler.
- */
- jal trap
- sw a3, STAND_RA_OFFSET(sp) # for debugging
-/*
- * Restore registers and return from the exception.
- * v0 contains the return address.
- */
- mtc0 zero,COP_0_STATUS_REG # Make shure int disabled
- lw a0, KERN_SR_OFFSET(sp)
- lw t0, KERN_MULT_LO_OFFSET(sp)
- lw t1, KERN_MULT_HI_OFFSET(sp)
- mtc0 a0, COP_0_STATUS_REG # Restore the SR, disable intrs
- mtlo t0
- mthi t1
- dmtc0 v0, COP_0_EXC_PC # set return address
- lw AT, KERN_REG_OFFSET + 0(sp)
- lw v0, KERN_REG_OFFSET + 4(sp)
- lw v1, KERN_REG_OFFSET + 8(sp)
- lw a0, KERN_REG_OFFSET + 12(sp)
- lw a1, KERN_REG_OFFSET + 16(sp)
- lw a2, KERN_REG_OFFSET + 20(sp)
- lw a3, KERN_REG_OFFSET + 24(sp)
- lw t0, KERN_REG_OFFSET + 28(sp)
- lw t1, KERN_REG_OFFSET + 32(sp)
- lw t2, KERN_REG_OFFSET + 36(sp)
- lw t3, KERN_REG_OFFSET + 40(sp)
- lw t4, KERN_REG_OFFSET + 44(sp)
- lw t5, KERN_REG_OFFSET + 48(sp)
- lw t6, KERN_REG_OFFSET + 52(sp)
- lw t7, KERN_REG_OFFSET + 56(sp)
- lw t8, KERN_REG_OFFSET + 60(sp)
- lw t9, KERN_REG_OFFSET + 64(sp)
- lw ra, KERN_REG_OFFSET + 68(sp)
- addu sp, sp, KERN_EXC_FRAME_SIZE
- eret # exception.
- .set at
-END(R4K_KernGenException)
-
-/*----------------------------------------------------------------------------
- *
- * R4K_UserGenException --
- *
- * Handle an exception from user mode.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-NNON_LEAF(R4K_UserGenException, STAND_FRAME_SIZE, ra)
- .set noat
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
-/*
- * Save all of the registers except for the kernel temporaries in u.u_pcb.
- */
- sw AT, UADDR+U_PCB_REGS+(AST * 4)
- sw v0, UADDR+U_PCB_REGS+(V0 * 4)
- sw v1, UADDR+U_PCB_REGS+(V1 * 4)
- sw a0, UADDR+U_PCB_REGS+(A0 * 4)
- mflo v0
- sw a1, UADDR+U_PCB_REGS+(A1 * 4)
- sw a2, UADDR+U_PCB_REGS+(A2 * 4)
- sw a3, UADDR+U_PCB_REGS+(A3 * 4)
- sw t0, UADDR+U_PCB_REGS+(T0 * 4)
- mfhi v1
- sw t1, UADDR+U_PCB_REGS+(T1 * 4)
- sw t2, UADDR+U_PCB_REGS+(T2 * 4)
- sw t3, UADDR+U_PCB_REGS+(T3 * 4)
- sw t4, UADDR+U_PCB_REGS+(T4 * 4)
- mfc0 a0, COP_0_STATUS_REG # First arg is the status reg.
- sw t5, UADDR+U_PCB_REGS+(T5 * 4)
- sw t6, UADDR+U_PCB_REGS+(T6 * 4)
- sw t7, UADDR+U_PCB_REGS+(T7 * 4)
- sw s0, UADDR+U_PCB_REGS+(S0 * 4)
- mfc0 a1, COP_0_CAUSE_REG # Second arg is the cause reg.
- sw s1, UADDR+U_PCB_REGS+(S1 * 4)
- sw s2, UADDR+U_PCB_REGS+(S2 * 4)
- sw s3, UADDR+U_PCB_REGS+(S3 * 4)
- sw s4, UADDR+U_PCB_REGS+(S4 * 4)
- mfc0 a2, COP_0_BAD_VADDR # Third arg is the fault addr
- sw s5, UADDR+U_PCB_REGS+(S5 * 4)
- sw s6, UADDR+U_PCB_REGS+(S6 * 4)
- sw s7, UADDR+U_PCB_REGS+(S7 * 4)
- sw t8, UADDR+U_PCB_REGS+(T8 * 4)
- mfc0 a3, COP_0_EXC_PC # Fourth arg is the pc.
- sw t9, UADDR+U_PCB_REGS+(T9 * 4)
- sw gp, UADDR+U_PCB_REGS+(GP * 4)
- sw sp, UADDR+U_PCB_REGS+(SP * 4)
- sw s8, UADDR+U_PCB_REGS+(S8 * 4)
- li sp, KERNELSTACK - STAND_FRAME_SIZE # switch to kernel SP
- sw ra, UADDR+U_PCB_REGS+(RA * 4)
- sw v0, UADDR+U_PCB_REGS+(MULLO * 4)
- sw v1, UADDR+U_PCB_REGS+(MULHI * 4)
- sw a0, UADDR+U_PCB_REGS+(SR * 4)
- la gp, _gp # switch to kernel GP
- sw a3, UADDR+U_PCB_REGS+(PC * 4)
- sw a3, STAND_RA_OFFSET(sp) # for debugging
- .set at
-# Turn off fpu and enter kernel mode
- and t0, a0, ~(SR_COP_1_BIT | SR_EXL | SR_KSU_MASK | SR_INT_ENAB)
- .set noat
-/*
- * Call the exception handler.
- */
- jal trap
- mtc0 t0, COP_0_STATUS_REG
-/*
- * Restore user registers and return.
- * First disable interrupts and set exeption level.
- */
- mtc0 zero, COP_0_STATUS_REG # disable int
- nop
- nop
- nop
- li v0, SR_EXL
- mtc0 v0, COP_0_STATUS_REG # set exeption level
-
- lw a0, UADDR+U_PCB_REGS+(SR * 4)
- lw t0, UADDR+U_PCB_REGS+(MULLO * 4)
- lw t1, UADDR+U_PCB_REGS+(MULHI * 4)
- mtc0 a0, COP_0_STATUS_REG # still exeption level
- mtlo t0
- mthi t1
- lw a0, UADDR+U_PCB_REGS+(PC * 4)
- lw AT, UADDR+U_PCB_REGS+(AST * 4)
- lw v0, UADDR+U_PCB_REGS+(V0 * 4)
- dmtc0 a0, COP_0_EXC_PC # set return address
- lw v1, UADDR+U_PCB_REGS+(V1 * 4)
- lw a0, UADDR+U_PCB_REGS+(A0 * 4)
- lw a1, UADDR+U_PCB_REGS+(A1 * 4)
- lw a2, UADDR+U_PCB_REGS+(A2 * 4)
- lw a3, UADDR+U_PCB_REGS+(A3 * 4)
- lw t0, UADDR+U_PCB_REGS+(T0 * 4)
- lw t1, UADDR+U_PCB_REGS+(T1 * 4)
- lw t2, UADDR+U_PCB_REGS+(T2 * 4)
- lw t3, UADDR+U_PCB_REGS+(T3 * 4)
- lw t4, UADDR+U_PCB_REGS+(T4 * 4)
- lw t5, UADDR+U_PCB_REGS+(T5 * 4)
- lw t6, UADDR+U_PCB_REGS+(T6 * 4)
- lw t7, UADDR+U_PCB_REGS+(T7 * 4)
- lw s0, UADDR+U_PCB_REGS+(S0 * 4)
- lw s1, UADDR+U_PCB_REGS+(S1 * 4)
- lw s2, UADDR+U_PCB_REGS+(S2 * 4)
- lw s3, UADDR+U_PCB_REGS+(S3 * 4)
- lw s4, UADDR+U_PCB_REGS+(S4 * 4)
- lw s5, UADDR+U_PCB_REGS+(S5 * 4)
- lw s6, UADDR+U_PCB_REGS+(S6 * 4)
- lw s7, UADDR+U_PCB_REGS+(S7 * 4)
- lw t8, UADDR+U_PCB_REGS+(T8 * 4)
- lw t9, UADDR+U_PCB_REGS+(T9 * 4)
- lw gp, UADDR+U_PCB_REGS+(GP * 4)
- lw sp, UADDR+U_PCB_REGS+(SP * 4)
- lw s8, UADDR+U_PCB_REGS+(S8 * 4)
- lw ra, UADDR+U_PCB_REGS+(RA * 4)
- eret
- .set at
-END(R4K_UserGenException)
-
-/*----------------------------------------------------------------------------
- *
- * R4K_KernIntr --
- *
- * Handle an interrupt from kernel mode.
- * Interrupts use the standard kernel stack.
- * switch_exit sets up a kernel stack after exit so interrupts won't fail.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-#define KINTR_REG_OFFSET (STAND_FRAME_SIZE)
-#define KINTR_SR_OFFSET (STAND_FRAME_SIZE + KERN_REG_SIZE)
-#define KINTR_MULT_LO_OFFSET (STAND_FRAME_SIZE + KERN_REG_SIZE + 4)
-#define KINTR_MULT_HI_OFFSET (STAND_FRAME_SIZE + KERN_REG_SIZE + 8)
-#define KINTR_MULT_GP_OFFSET (STAND_FRAME_SIZE + KERN_REG_SIZE + 12)
-#define KINTR_FRAME_SIZE (STAND_FRAME_SIZE + KERN_REG_SIZE + 16)
-
-NNON_LEAF(R4K_KernIntr, KINTR_FRAME_SIZE, ra)
- .set noat
- subu sp, sp, KINTR_FRAME_SIZE # allocate stack frame
- .mask 0x80000000, (STAND_RA_OFFSET - KINTR_FRAME_SIZE)
-/*
- * Save the relevant kernel registers onto the stack.
- * We don't need to save s0 - s8, sp and gp because
- * the compiler does it for us.
- */
- sw AT, KINTR_REG_OFFSET + 0(sp)
- sw v0, KINTR_REG_OFFSET + 4(sp)
- sw v1, KINTR_REG_OFFSET + 8(sp)
- sw a0, KINTR_REG_OFFSET + 12(sp)
- mflo v0
- mfhi v1
- sw a1, KINTR_REG_OFFSET + 16(sp)
- sw a2, KINTR_REG_OFFSET + 20(sp)
- sw a3, KINTR_REG_OFFSET + 24(sp)
- sw t0, KINTR_REG_OFFSET + 28(sp)
- mfc0 a0, COP_0_STATUS_REG # First arg is the status reg.
- sw t1, KINTR_REG_OFFSET + 32(sp)
- sw t2, KINTR_REG_OFFSET + 36(sp)
- sw t3, KINTR_REG_OFFSET + 40(sp)
- sw t4, KINTR_REG_OFFSET + 44(sp)
- mfc0 a1, COP_0_CAUSE_REG # Second arg is the cause reg.
- sw t5, KINTR_REG_OFFSET + 48(sp)
- sw t6, KINTR_REG_OFFSET + 52(sp)
- sw t7, KINTR_REG_OFFSET + 56(sp)
- sw t8, KINTR_REG_OFFSET + 60(sp)
- mfc0 a2, COP_0_EXC_PC # Third arg is the pc.
- sw t9, KINTR_REG_OFFSET + 64(sp)
- sw ra, KINTR_REG_OFFSET + 68(sp)
- sw v0, KINTR_MULT_LO_OFFSET(sp)
- sw v1, KINTR_MULT_HI_OFFSET(sp)
- sw a0, KINTR_SR_OFFSET(sp)
-
- mtc0 zero, COP_0_STATUS_REG # Reset exl, trap possible.
-/*
- * Call the interrupt handler.
- */
- jal interrupt
- sw a2, STAND_RA_OFFSET(sp) # for debugging
-/*
- * Restore registers and return from the interrupt.
- */
- mtc0 zero, COP_0_STATUS_REG # Disable interrupt
- lw a0, KINTR_SR_OFFSET(sp)
- lw t0, KINTR_MULT_LO_OFFSET(sp)
- lw t1, KINTR_MULT_HI_OFFSET(sp)
- mtc0 a0, COP_0_STATUS_REG # Restore the SR, disable intrs
- mtlo t0
- mthi t1
- lw a0, STAND_RA_OFFSET(sp)
- lw AT, KINTR_REG_OFFSET + 0(sp)
- lw v0, KINTR_REG_OFFSET + 4(sp)
- dmtc0 a0, COP_0_EXC_PC # set return address
- lw v1, KINTR_REG_OFFSET + 8(sp)
- lw a0, KINTR_REG_OFFSET + 12(sp)
- lw a1, KINTR_REG_OFFSET + 16(sp)
- lw a2, KINTR_REG_OFFSET + 20(sp)
- lw a3, KINTR_REG_OFFSET + 24(sp)
- lw t0, KINTR_REG_OFFSET + 28(sp)
- lw t1, KINTR_REG_OFFSET + 32(sp)
- lw t2, KINTR_REG_OFFSET + 36(sp)
- lw t3, KINTR_REG_OFFSET + 40(sp)
- lw t4, KINTR_REG_OFFSET + 44(sp)
- lw t5, KINTR_REG_OFFSET + 48(sp)
- lw t6, KINTR_REG_OFFSET + 52(sp)
- lw t7, KINTR_REG_OFFSET + 56(sp)
- lw t8, KINTR_REG_OFFSET + 60(sp)
- lw t9, KINTR_REG_OFFSET + 64(sp)
- lw ra, KINTR_REG_OFFSET + 68(sp)
- addu sp, sp, KINTR_FRAME_SIZE
- eret # interrupt.
- .set at
-END(R4K_KernIntr)
-
-/*----------------------------------------------------------------------------
- *
- * R4K_UserIntr --
- *
- * Handle an interrupt from user mode.
- * Note: we save minimal state in the u.u_pcb struct and use the standard
- * kernel stack since there has to be a u page if we came from user mode.
- * If there is a pending software interrupt, then save the remaining state
- * and call softintr(). This is all because if we call switch() inside
- * interrupt(), not all the user registers have been saved in u.u_pcb.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-NNON_LEAF(R4K_UserIntr, STAND_FRAME_SIZE, ra)
- .set noat
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
-/*
- * Save the relevant user registers into the u.u_pcb struct.
- * We don't need to save s0 - s8 because
- * the compiler does it for us.
- */
- sw AT, UADDR+U_PCB_REGS+(AST * 4)
- sw v0, UADDR+U_PCB_REGS+(V0 * 4)
- sw v1, UADDR+U_PCB_REGS+(V1 * 4)
- sw a0, UADDR+U_PCB_REGS+(A0 * 4)
- mflo v0
- mfhi v1
- sw a1, UADDR+U_PCB_REGS+(A1 * 4)
- sw a2, UADDR+U_PCB_REGS+(A2 * 4)
- sw a3, UADDR+U_PCB_REGS+(A3 * 4)
- sw t0, UADDR+U_PCB_REGS+(T0 * 4)
- mfc0 a0, COP_0_STATUS_REG # First arg is the status reg.
- sw t1, UADDR+U_PCB_REGS+(T1 * 4)
- sw t2, UADDR+U_PCB_REGS+(T2 * 4)
- sw t3, UADDR+U_PCB_REGS+(T3 * 4)
- sw t4, UADDR+U_PCB_REGS+(T4 * 4)
- mfc0 a1, COP_0_CAUSE_REG # Second arg is the cause reg.
- sw t5, UADDR+U_PCB_REGS+(T5 * 4)
- sw t6, UADDR+U_PCB_REGS+(T6 * 4)
- sw t7, UADDR+U_PCB_REGS+(T7 * 4)
- sw t8, UADDR+U_PCB_REGS+(T8 * 4)
- mfc0 a2, COP_0_EXC_PC # Third arg is the pc.
- sw t9, UADDR+U_PCB_REGS+(T9 * 4)
- sw gp, UADDR+U_PCB_REGS+(GP * 4)
- sw sp, UADDR+U_PCB_REGS+(SP * 4)
- sw ra, UADDR+U_PCB_REGS+(RA * 4)
- li sp, KERNELSTACK - STAND_FRAME_SIZE # switch to kernel SP
- sw v0, UADDR+U_PCB_REGS+(MULLO * 4)
- sw v1, UADDR+U_PCB_REGS+(MULHI * 4)
- sw a0, UADDR+U_PCB_REGS+(SR * 4)
- sw a2, UADDR+U_PCB_REGS+(PC * 4)
- la gp, _gp # switch to kernel GP
-# Turn off fpu and enter kernel mode
- .set at
- and t0, a0, ~(SR_COP_1_BIT | SR_EXL | SR_INT_ENAB | SR_KSU_MASK)
- .set noat
- mtc0 t0, COP_0_STATUS_REG
-/*
- * Call the interrupt handler.
- */
- jal interrupt
- sw a2, STAND_RA_OFFSET(sp) # for debugging
-/*
- * Restore registers and return from the interrupt.
- */
- mtc0 zero, COP_0_STATUS_REG
- nop
- nop
- nop
- li v0, SR_EXL
- mtc0 v0, COP_0_STATUS_REG # set exeption level bit.
-
- lw a0, UADDR+U_PCB_REGS+(SR * 4)
- lw v0, astpending # any pending interrupts?
- mtc0 a0, COP_0_STATUS_REG # Restore the SR, disable intrs
- bne v0, zero, 1f # dont restore, call softintr
- lw t0, UADDR+U_PCB_REGS+(MULLO * 4)
- lw t1, UADDR+U_PCB_REGS+(MULHI * 4)
- lw a0, UADDR+U_PCB_REGS+(PC * 4)
- lw AT, UADDR+U_PCB_REGS+(AST * 4)
- lw v0, UADDR+U_PCB_REGS+(V0 * 4)
- dmtc0 a0, COP_0_EXC_PC # set return address
- lw v1, UADDR+U_PCB_REGS+(V1 * 4)
- lw a0, UADDR+U_PCB_REGS+(A0 * 4)
- lw a1, UADDR+U_PCB_REGS+(A1 * 4)
- lw a2, UADDR+U_PCB_REGS+(A2 * 4)
- lw a3, UADDR+U_PCB_REGS+(A3 * 4)
- mtlo t0
- mthi t1
- lw t0, UADDR+U_PCB_REGS+(T0 * 4)
- lw t1, UADDR+U_PCB_REGS+(T1 * 4)
- lw t2, UADDR+U_PCB_REGS+(T2 * 4)
- lw t3, UADDR+U_PCB_REGS+(T3 * 4)
- lw t4, UADDR+U_PCB_REGS+(T4 * 4)
- lw t5, UADDR+U_PCB_REGS+(T5 * 4)
- lw t6, UADDR+U_PCB_REGS+(T6 * 4)
- lw t7, UADDR+U_PCB_REGS+(T7 * 4)
- lw t8, UADDR+U_PCB_REGS+(T8 * 4)
- lw t9, UADDR+U_PCB_REGS+(T9 * 4)
- lw gp, UADDR+U_PCB_REGS+(GP * 4)
- lw sp, UADDR+U_PCB_REGS+(SP * 4)
- lw ra, UADDR+U_PCB_REGS+(RA * 4)
- eret # interrupt.
-
-1:
-/*
- * We have pending software interrupts; save remaining user state in u.u_pcb.
- */
- sw s0, UADDR+U_PCB_REGS+(S0 * 4)
- sw s1, UADDR+U_PCB_REGS+(S1 * 4)
- sw s2, UADDR+U_PCB_REGS+(S2 * 4)
- sw s3, UADDR+U_PCB_REGS+(S3 * 4)
- sw s4, UADDR+U_PCB_REGS+(S4 * 4)
- sw s5, UADDR+U_PCB_REGS+(S5 * 4)
- sw s6, UADDR+U_PCB_REGS+(S6 * 4)
- sw s7, UADDR+U_PCB_REGS+(S7 * 4)
- sw s8, UADDR+U_PCB_REGS+(S8 * 4)
- li t0, HARD_INT_MASK | SR_INT_ENAB
-/*
- * Call the software interrupt handler.
- */
- jal softintr
- mtc0 t0, COP_0_STATUS_REG # enable interrupts (spl0)
-/*
- * Restore user registers and return. NOTE: interrupts are enabled.
- */
- mtc0 zero, COP_0_STATUS_REG
- nop
- nop
- nop
- li v0, SR_EXL
- mtc0 v0, COP_0_STATUS_REG # set exeption level bit.
-
- lw a0, UADDR+U_PCB_REGS+(SR * 4)
- lw t0, UADDR+U_PCB_REGS+(MULLO * 4)
- lw t1, UADDR+U_PCB_REGS+(MULHI * 4)
- mtc0 a0, COP_0_STATUS_REG # this should disable interrupts
- mtlo t0
- mthi t1
- lw a0, UADDR+U_PCB_REGS+(PC * 4)
- lw AT, UADDR+U_PCB_REGS+(AST * 4)
- lw v0, UADDR+U_PCB_REGS+(V0 * 4)
- dmtc0 a0, COP_0_EXC_PC # set return address
- lw v1, UADDR+U_PCB_REGS+(V1 * 4)
- lw a0, UADDR+U_PCB_REGS+(A0 * 4)
- lw a1, UADDR+U_PCB_REGS+(A1 * 4)
- lw a2, UADDR+U_PCB_REGS+(A2 * 4)
- lw a3, UADDR+U_PCB_REGS+(A3 * 4)
- lw t0, UADDR+U_PCB_REGS+(T0 * 4)
- lw t1, UADDR+U_PCB_REGS+(T1 * 4)
- lw t2, UADDR+U_PCB_REGS+(T2 * 4)
- lw t3, UADDR+U_PCB_REGS+(T3 * 4)
- lw t4, UADDR+U_PCB_REGS+(T4 * 4)
- lw t5, UADDR+U_PCB_REGS+(T5 * 4)
- lw t6, UADDR+U_PCB_REGS+(T6 * 4)
- lw t7, UADDR+U_PCB_REGS+(T7 * 4)
- lw s0, UADDR+U_PCB_REGS+(S0 * 4)
- lw s1, UADDR+U_PCB_REGS+(S1 * 4)
- lw s2, UADDR+U_PCB_REGS+(S2 * 4)
- lw s3, UADDR+U_PCB_REGS+(S3 * 4)
- lw s4, UADDR+U_PCB_REGS+(S4 * 4)
- lw s5, UADDR+U_PCB_REGS+(S5 * 4)
- lw s6, UADDR+U_PCB_REGS+(S6 * 4)
- lw s7, UADDR+U_PCB_REGS+(S7 * 4)
- lw t8, UADDR+U_PCB_REGS+(T8 * 4)
- lw t9, UADDR+U_PCB_REGS+(T9 * 4)
- lw gp, UADDR+U_PCB_REGS+(GP * 4)
- lw sp, UADDR+U_PCB_REGS+(SP * 4)
- lw s8, UADDR+U_PCB_REGS+(S8 * 4)
- lw ra, UADDR+U_PCB_REGS+(RA * 4)
- eret
- .set at
-END(R4K_UserIntr)
-
-/*----------------------------------------------------------------------------
- *
- * R4K_TLBInvalidException --
- *
- * Handle a TLB invalid exception from kernel mode in kernel space.
- * The BaddVAddr, Context, and EntryHi registers contain the failed
- * virtual address.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-NLEAF(R4K_TLBInvalidException)
- .set noat
- dmfc0 k0, COP_0_BAD_VADDR # get the fault address
- li k1, VM_MIN_KERNEL_ADDRESS # compute index
- subu k0, k0, k1
- lw k1, Sysmapsize # index within range?
- srl k0, k0, PGSHIFT
- sltu k1, k0, k1
- beq k1, zero, sys_stk_chk # No. check for valid stack
- lw k1, Sysmap
-
- sll k0, k0, 2 # compute offset from index
- tlbp # Probe the invalid entry
- addu k1, k1, k0
- and k0, k0, 4 # check even/odd page
- bne k0, zero, KernTLBIOdd
- nop
-
- mfc0 k0, COP_0_TLB_INDEX
- nop
- bltz k0, sys_stk_chk
- sltiu k0, k0, 8
-
- bne k0, zero, sys_stk_chk
- lw k0, 0(k1) # get PTE entry
-
- dsll k0, k0, 34 # get rid of "wired" bit
- dsrl k0, k0, 34
- dmtc0 k0, COP_0_TLB_LO0 # load PTE entry
- and k0, k0, PG_V # check for valid entry
- beq k0, zero, R4K_KernGenException # PTE invalid
- lw k0, 4(k1) # get odd PTE entry
- dsll k0, k0, 34
- dsrl k0, k0, 34
- dmtc0 k0, COP_0_TLB_LO1 # load PTE entry
- nop
- tlbwi # write TLB
- nop
- nop
- nop
- nop
- nop
- eret
-
-KernTLBIOdd:
- mfc0 k0, COP_0_TLB_INDEX
- nop
- bltz k0, sys_stk_chk
- sltiu k0, k0, 8
-
- bne k0, zero, sys_stk_chk
- lw k0, 0(k1) # get PTE entry
-
- dsll k0, k0, 34 # get rid of wired bit
- dsrl k0, k0, 34
- dmtc0 k0, COP_0_TLB_LO1 # save PTE entry
- and k0, k0, PG_V # check for valid entry
- beq k0, zero, R4K_KernGenException # PTE invalid
- lw k0, -4(k1) # get even PTE entry
- dsll k0, k0, 34
- dsrl k0, k0, 34
- dmtc0 k0, COP_0_TLB_LO0 # save PTE entry
- nop
- tlbwi # update TLB
- nop
- nop
- nop
- nop
- nop
- eret
-END(R4K_TLBInvalidException)
-
-/*----------------------------------------------------------------------------
- *
- * R4K_TLBMissException --
- *
- * Handle a TLB miss exception from kernel mode in kernel space.
- * The BaddVAddr, Context, and EntryHi registers contain the failed
- * virtual address.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-NLEAF(R4K_TLBMissException)
- .set noat
- dmfc0 k0, COP_0_BAD_VADDR # get the fault address
- li k1, VM_MIN_KERNEL_ADDRESS # compute index
- subu k0, k0, k1
- lw k1, Sysmapsize # index within range?
- srl k0, k0, PGSHIFT
- sltu k1, k0, k1
- beq k1, zero, sys_stk_chk # No. check for valid stack
- lw k1, Sysmap
- srl k0, k0, 1
- sll k0, k0, 3 # compute offset from index
- addu k1, k1, k0
- lw k0, 0(k1) # get PTE entry
- lw k1, 4(k1) # get odd PTE entry
- dsll k0, k0, 34 # get rid of "wired" bit
- dsrl k0, k0, 34
- dmtc0 k0, COP_0_TLB_LO0 # load PTE entry
- dsll k1, k1, 34
- dsrl k1, k1, 34
- dmtc0 k1, COP_0_TLB_LO1 # load PTE entry
- nop
- tlbwr # write TLB
- nop
- nop
- nop
- nop
- nop
- eret
-
-sys_stk_chk:
- subu k0, sp, UADDR + 0x200 # check to see if we have a
- sltiu k0, UPAGES*NBPG - 0x200 # valid kernel stack
- bne k0, zero, R4K_KernGenException # Go panic
- nop
-
- la a0, start - START_FRAME - 8 # set sp to a valid place
- sw sp, 24(a0)
- move sp, a0
- la a0, 1f
- mfc0 a2, COP_0_STATUS_REG
- mfc0 a3, COP_0_CAUSE_REG
- dmfc0 a1, COP_0_EXC_PC
- sw a2, 16(sp)
- sw a3, 20(sp)
- move a2, ra
- jal printf
- dmfc0 a3, COP_0_BAD_VADDR
- .data
-1:
- .asciiz "ktlbmiss: PC %x RA %x ADR %x\nSR %x CR %x SP %x\n"
- .text
-
- la sp, start - START_FRAME # set sp to a valid place
- PANIC("kernel stack overflow")
- .set at
-END(R4K_TLBMissException)
-
-/*----------------------------------------------------------------------------
- *
- * wbflush --
- *
- * Return when the write buffer is empty.
- *
- * wbflush()
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-LEAF(wbflush)
- nop
- sync
- j ra
- nop
-END(wbflush)
-
-/*--------------------------------------------------------------------------
- *
- * R4K_TLBWriteIndexed --
- *
- * Write the given entry into the TLB at the given index.
- *
- * R4K_TLBWriteIndexed(index, tlb)
- * unsigned index;
- * tlb *tlb;
- *
- * Results:
- * None.
- *
- * Side effects:
- * TLB entry set.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R4K_TLBWriteIndexed)
- mfc0 v1, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
- nop
- lw a2, 8(a1)
- lw a3, 12(a1)
- dmfc0 t0, COP_0_TLB_HI # Save the current PID.
-
- dmtc0 a2, COP_0_TLB_LO0 # Set up entry low0.
- dmtc0 a3, COP_0_TLB_LO1 # Set up entry low1.
- lw a2, 0(a1)
- lw a3, 4(a1)
- mtc0 a0, COP_0_TLB_INDEX # Set the index.
- dmtc0 a2, COP_0_TLB_PG_MASK # Set up entry mask.
- dmtc0 a3, COP_0_TLB_HI # Set up entry high.
- nop
- tlbwi # Write the TLB
- nop
- nop
- nop # Delay for effect
- nop
-
- dmtc0 t0, COP_0_TLB_HI # Restore the PID.
- nop
- dmtc0 zero, COP_0_TLB_PG_MASK # Default mask value.
- j ra
- mtc0 v1, COP_0_STATUS_REG # Restore the status register
-END(R4K_TLBWriteIndexed)
-
-/*--------------------------------------------------------------------------
- *
- * R4K_SetPID --
- *
- * Write the given pid into the TLB pid reg.
- *
- * R4K_SetPID(pid)
- * int pid;
- *
- * Results:
- * None.
- *
- * Side effects:
- * PID set in the entry hi register.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R4K_SetPID)
- dmtc0 a0, COP_0_TLB_HI # Write the hi reg value
- j ra
- nop
-END(R4K_SetPID)
-
-/*--------------------------------------------------------------------------
- *
- * R4K_SetWIRED --
- *
- * Write the given value into the TLB wired reg.
- *
- * R4K_SetPID(wired)
- * int wired;
- *
- * Results:
- * None.
- *
- * Side effects:
- * WIRED set in the wired register.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R4K_SetWIRED)
- mtc0 a0, COP_0_TLB_WIRED
- j ra
- nop
-END(R4K_SetWIRED)
-
-/*--------------------------------------------------------------------------
- *
- * R4K_GetWIRED --
- *
- * Get the value from the TLB wired reg.
- *
- * R4K_GetWIRED(void)
- *
- * Results:
- * Value of wired reg.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R4K_GetWIRED)
- mfc0 v0, COP_0_TLB_WIRED
- j ra
- nop
-END(R4K_GetWIRED)
-
-/*--------------------------------------------------------------------------
- *
- * R4K_TLBFlush --
- *
- * Flush the "random" entries from the TLB.
- * Uses "wired" register to determine what register to start with.
- *
- * R4K_TLBFlush()
- *
- * Results:
- * None.
- *
- * Side effects:
- * The TLB is flushed.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R4K_TLBFlush)
- mfc0 v1, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
- mfc0 t1, COP_0_TLB_WIRED
- li t2, VMNUM_TLB_ENTRIES
- li v0, CACHED_MEMORY_ADDR # invalid address
- dmfc0 t0, COP_0_TLB_HI # Save the PID
-
- dmtc0 v0, COP_0_TLB_HI # Mark entry high as invalid
- dmtc0 zero, COP_0_TLB_LO0 # Zero out low entry0.
- dmtc0 zero, COP_0_TLB_LO1 # Zero out low entry1.
- mtc0 zero, COP_0_TLB_PG_MASK # Zero out mask entry.
-/*
- * Align the starting value (t1) and the upper bound (t2).
- */
-1:
- mtc0 t1, COP_0_TLB_INDEX # Set the index register.
- addu t1, t1, 1 # Increment index.
- tlbwi # Write the TLB entry.
- nop
- nop
- bne t1, t2, 1b
- nop
-
- dmtc0 t0, COP_0_TLB_HI # Restore the PID
- j ra
- mtc0 v1, COP_0_STATUS_REG # Restore the status register
-END(R4K_TLBFlush)
-
-
-/*--------------------------------------------------------------------------
- *
- * R4K_TLBFlushAddr --
- *
- * Flush any TLB entries for the given address and TLB PID.
- *
- * R4K_TLBFlushAddr(TLBhi)
- * unsigned TLBhi;
- *
- * Results:
- * None.
- *
- * Side effects:
- * The process's page is flushed from the TLB.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R4K_TLBFlushAddr)
- mfc0 v1, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
- nop
- li v0, (PG_HVPN | PG_ASID)
- and a0, a0, v0 # Make shure valid hi value.
- dmfc0 t0, COP_0_TLB_HI # Get current PID
- dmtc0 a0, COP_0_TLB_HI # look for addr & PID
- nop
- nop
- nop
- tlbp # Probe for the entry.
- nop
- nop # Delay for effect
- nop
- mfc0 v0, COP_0_TLB_INDEX # See what we got
- li t1, CACHED_MEMORY_ADDR # Load invalid entry.
- bltz v0, 1f # index < 0 => !found
- nop
- dmtc0 t1, COP_0_TLB_HI # Mark entry high as invalid
-
- dmtc0 zero, COP_0_TLB_LO0 # Zero out low entry.
- dmtc0 zero, COP_0_TLB_LO1 # Zero out low entry.
- nop
- tlbwi
- nop
- nop
- nop
- nop
-1:
- dmtc0 t0, COP_0_TLB_HI # restore PID
- j ra
- mtc0 v1, COP_0_STATUS_REG # Restore the status register
-END(R4K_TLBFlushAddr)
-
-/*--------------------------------------------------------------------------
- *
- * R4K_TLBUpdate --
- *
- * Update the TLB if highreg is found; otherwise, enter the data.
- *
- * R4K_TLBUpdate(virpageadr, lowregx)
- * unsigned virpageadr, lowregx;
- *
- * Results:
- * < 0 if loaded >= 0 if updated.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R4K_TLBUpdate)
- mfc0 v1, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
- and t1, a0, 0x1000 # t1 = Even/Odd flag
- li v0, (PG_HVPN | PG_ASID)
- and a0, a0, v0
- dmfc0 t0, COP_0_TLB_HI # Save current PID
- dmtc0 a0, COP_0_TLB_HI # Init high reg
- and a2, a1, PG_G # Copy global bit
- nop
- nop
- tlbp # Probe for the entry.
- dsll a1, a1, 34
- dsrl a1, a1, 34
- bne t1, zero, 2f # Decide even odd
- mfc0 v0, COP_0_TLB_INDEX # See what we got
-# EVEN
- nop
- bltz v0, 1f # index < 0 => !found
- nop
-
- tlbr # update, read entry first
- nop
- nop
- nop
- dmtc0 a1, COP_0_TLB_LO0 # init low reg0.
- nop
- tlbwi # update slot found
- b 4f
- nop
-1:
- mtc0 zero, COP_0_TLB_PG_MASK # init mask.
- dmtc0 a0, COP_0_TLB_HI # init high reg.
- dmtc0 a1, COP_0_TLB_LO0 # init low reg0.
- dmtc0 a2, COP_0_TLB_LO1 # init low reg1.
- nop
- tlbwr # enter into a random slot
- b 4f
- nop
-# ODD
-2:
- nop
- bltz v0, 3f # index < 0 => !found
- nop
-
- tlbr # read the entry first
- nop
- nop
- nop
- dmtc0 a1, COP_0_TLB_LO1 # init low reg1.
- nop
- tlbwi # update slot found
- b 4f
- nop
-3:
- mtc0 zero, COP_0_TLB_PG_MASK # init mask.
- dmtc0 a0, COP_0_TLB_HI # init high reg.
- dmtc0 a2, COP_0_TLB_LO0 # init low reg0.
- dmtc0 a1, COP_0_TLB_LO1 # init low reg1.
- nop
- tlbwr # enter into a random slot
-
-4: # Make shure pipeline
- nop # advances before we
- nop # uses the tlb.
- nop
- nop
- dmtc0 t0, COP_0_TLB_HI # restore PID
- j ra
- mtc0 v1, COP_0_STATUS_REG # Restore the status register
-END(R4K_TLBUpdate)
-
-/*--------------------------------------------------------------------------
- *
- * R4K_TLBRead --
- *
- * Read the TLB entry.
- *
- * R4K_TLBRead(entry, tlb)
- * unsigned entry;
- * struct tlb *tlb;
- *
- * Results:
- * None.
- *
- * Side effects:
- * tlb will contain the TLB entry found.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R4K_TLBRead)
- mfc0 v1, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
- nop
- nop
- nop
- dmfc0 t0, COP_0_TLB_HI # Get current PID
-
- mtc0 a0, COP_0_TLB_INDEX # Set the index register
- nop
- tlbr # Read from the TLB
- nop
- nop
- nop
- mfc0 t2, COP_0_TLB_PG_MASK # fetch the hi entry
- dmfc0 t3, COP_0_TLB_HI # fetch the hi entry
- dmfc0 t4, COP_0_TLB_LO0 # See what we got
- dmfc0 t5, COP_0_TLB_LO1 # See what we got
- dmtc0 t0, COP_0_TLB_HI # restore PID
- nop
- nop
- nop # wait for PID active
- mtc0 v1, COP_0_STATUS_REG # Restore the status register
- sw t2, 0(a1)
- sw t3, 4(a1)
- sw t4, 8(a1)
- j ra
- sw t5, 12(a1)
-END(R4K_TLBRead)
-
-/*--------------------------------------------------------------------------
- *
- * R4K_TLBGetPID --
- *
- * R4K_TLBGetPID()
- *
- * Results:
- * Returns the current TLB pid reg.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R4K_TLBGetPID)
- dmfc0 v0, COP_0_TLB_HI # get PID
- j ra
- and v0, v0, VMTLB_PID # mask off PID
-END(R4K_TLBGetPID)
-
-/*----------------------------------------------------------------------------
- *
- * R4K_ConfigCache --
- *
- * Size the caches.
- * NOTE: should only be called from mips_init().
- *
- * Results:
- * None.
- *
- * Side effects:
- * The size of the data cache is stored into CpuPrimaryDataCacheSize.
- * The size of instruction cache is stored into CpuPrimaryInstCacheSize.
- * Alignment mask for cache aliasing test is stored in CpuCacheAliasMask.
- *
- *----------------------------------------------------------------------------
- */
-LEAF(R4K_ConfigCache)
- .set noreorder
- mfc0 v0, COP_0_CONFIG # Get configuration register
- mfc0 v1, COP_0_PRID
- srl t1, v0, 9 # Get I cache size.
- and t1, 3
- li t2, 4096
- sllv t2, t2, t1
- sw t2, CpuPrimaryDataCacheSize
- addiu t2, -1
- and t2, ~(NBPG - 1)
- sw t2, CpuCacheAliasMask
-
- and t2, v0, 0x20
- srl t2, t2, 1
- addu t2, t2, 16
- sw t2, CpuPrimaryDataCacheLSize
-
- srl t1, v0, 6 # Get I cache size.
- and t1, 3
- li t2, 4096
- sllv t2, t2, t1
- sw t2, CpuPrimaryInstCacheSize
-
- and t2, v0, 0x10
- addu t2, t2, 16
- sw t2, CpuPrimaryInstCacheLSize
- and v1, 0xff00
- li t1, (MIPS_R4600 << 8)
- li t2, 1
- bnel v1, t1, 1f
- li t2, 0
-1:
- sw t2, CpuTwoWayCache
- j ra
- nop
-END(R4K_ConfigCache)
-
-/*----------------------------------------------------------------------------
- *
- * R4K_FlushCache --
- *
- * Flush the caches. Assumes a line size of 16 bytes for speed.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The contents of the caches is flushed.
- *
- *----------------------------------------------------------------------------
- */
-LEAF(R4K_FlushCache)
- .set noreorder
-/*XXX 4600 Bug */
- mfc0 v1, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
-/*XXX*/
- lw v0, CpuTwoWayCache
- lw t1, CpuPrimaryInstCacheSize
- lw t2, CpuPrimaryDataCacheSize
- # lw t3, CpuPrimaryInstCacheLSize
- # lw t4, CpuPrimaryDataCacheLSize
-/*
- * Flush the instruction cache.
- */
- li t0, CACHED_MEMORY_ADDR
- addu t1, t0, t1 # End address
- subu t1, t1, 128
-1:
- bne v0, zero, 2f
- cache 0, 0(t0)
-
- cache 0, 16(t0)
- cache 0, 48(t0)
- cache 0, 80(t0)
- b 3f
- cache 0, 112(t0)
-
-2:
- cache 0, 8192+0(t0)
- cache 0, 8192+32(t0)
- cache 0, 8192+64(t0)
- cache 0, 8192+96(t0)
-
-3:
- cache 0, 32(t0)
- cache 0, 64(t0)
- cache 0, 96(t0)
- bne t0, t1, 1b
- addu t0, t0, 128
-
-/*
- * Flush the data cache.
- */
- li t0, CACHED_MEMORY_ADDR
- addu t1, t0, t2 # End address
- subu t1, t1, 128
-1:
- bne v0, zero, 2f
- cache 1, 0(t0)
-
- cache 1, 16(t0)
- cache 1, 48(t0)
- cache 1, 80(t0)
- b 3f
- cache 1, 112(t0)
-
-2:
- cache 1, 8192+0(t0)
- cache 1, 8192+32(t0)
- cache 1, 8192+64(t0)
- cache 1, 8192+96(t0)
-
-3:
- cache 1, 32(t0)
- cache 1, 64(t0)
- cache 1, 96(t0)
- bne t0, t1, 1b
- addu t0, t0, 128
-
-/*XXX 4600 Bug */
- mtc0 v1, COP_0_STATUS_REG # Restore the status register.
-/*XXX*/
- j ra
- nop
-END(R4K_FlushCache)
-
-/*----------------------------------------------------------------------------
- *
- * R4K_FlushICache --
- *
- * void R4K_FlushICache(addr, len)
- * vm_offset_t addr, len;
- *
- * Flush instruction cache for range of addr to addr + len - 1.
- * The address can be any valid address so long as no TLB misses occur.
- * Assumes a cache line size of 16 bytes for speed.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The contents of the cache is flushed.
- * Must not touch v0.
- *
- *----------------------------------------------------------------------------
- */
-LEAF(R4K_FlushICache)
-/*XXX 4600 Bug */
- mfc0 v1, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
-/*XXX*/
- lw v0, CpuTwoWayCache
- addu a1, 127 # Align
- srl a1, a1, 7 # Number of unrolled loops
-1:
- bne v0, zero, 2f
- addu a1, -1
-
- cache 0, 16(a0)
- cache 0, 48(a0)
- cache 0, 80(a0)
- b 3f
- cache 0, 112(a0)
-
-2:
- cache 0, 8192+0(a0)
- cache 0, 8192+32(a0)
- cache 0, 8192+64(a0)
- cache 0, 8192+96(a0)
-
-3:
- cache 0, 0(a0)
- cache 0, 32(a0)
- cache 0, 64(a0)
- cache 0, 96(a0)
- bne a1, zero, 1b
- addu a0, 128
-
-/*XXX 4600 Bug */
- mtc0 v1, COP_0_STATUS_REG # Restore the status register.
-/*XXX*/
- j ra
- move v0, zero # suiword depends on this!!
-END(R4K_FlushICache)
-
-/*----------------------------------------------------------------------------
- *
- * R4K_FlushDCache --
- *
- * void R4K_FlushDCache(addr, len)
- * vm_offset_t addr, len;
- *
- * Flush data cache for index range of addr to addr + len - 1.
- * The address is reduced to a kseg0 index.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The contents of the cache is written back to primary memory.
- * The cache line is invalidated.
- *
- *----------------------------------------------------------------------------
- */
-LEAF(R4K_FlushDCache)
-/*XXX 4600 Bug */
- mfc0 v1, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
-/*XXX*/
- lw v0, CpuTwoWayCache
- lw a2, CpuPrimaryDataCacheSize
- addiu a2, -1
- and a0, a0, a2
- addu a1, 127 # Align
- li a2, 0x80000000
- addu a0, a0, a2
- addu a1, a1, a0
- and a0, a0, -128
- subu a1, a1, a0
- srl a1, a1, 7 # Compute number of cache lines
-1:
- bne v0, zero, 2f
- addu a1, -1
-
- cache 1, 16(a0)
- cache 1, 48(a0)
- cache 1, 80(a0)
- b 3f
- cache 1, 112(a0)
-
-2:
- cache 1, 8192+0(a0)
- cache 1, 8192+32(a0)
- cache 1, 8192+64(a0)
- cache 1, 8192+96(a0)
-
-3:
- cache 1, 0(a0)
- cache 1, 32(a0)
- cache 1, 64(a0)
- cache 1, 96(a0)
- bne a1, zero, 1b
- addu a0, 128
-
-/*XXX 4600 Bug */
- mtc0 v1, COP_0_STATUS_REG # Restore the status register.
-/*XXX*/
- j ra
- nop
-END(R4K_FlushDCache)
-
-/*----------------------------------------------------------------------------
- *
- * R4K_HitFlushDCache --
- *
- * void R4K_HitFlushDCache(addr, len)
- * vm_offset_t addr, len;
- *
- * Flush data cache for range of addr to addr + len - 1.
- * The address can be any valid viritual address as long
- * as no TLB invalid traps occur. Only lines with matching
- * addr is flushed.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The contents of the cache is written back to primary memory.
- * The cache line is invalidated.
- *
- *----------------------------------------------------------------------------
- */
-LEAF(R4K_HitFlushDCache)
- lw v0, CpuTwoWayCache
- beq a1, zero, 3f
- addu a1, 127 # Align
- addu a1, a1, a0
- and a0, a0, -128
- subu a1, a1, a0
- srl a1, a1, 7 # Compute number of cache lines
-1:
- bne v0, zero, 2f
- addu a1, -1
-
- cache 0x15, 16(a0)
- cache 0x15, 48(a0)
- cache 0x15, 80(a0)
- cache 0x15, 112(a0)
-
-2:
- cache 0x15, 0(a0)
- cache 0x15, 32(a0)
- cache 0x15, 64(a0)
- cache 0x15, 96(a0)
- bne a1, zero, 1b
- addu a0, 128
-
-3:
- j ra
- nop
-END(R4K_HitFlushDCache)
-/*----------------------------------------------------------------------------
- *
- * R4K_InvalidateDCache --
- *
- * void R4K_FlushDCache(addr, len)
- * vm_offset_t addr, len;
- *
- * Flush data cache for range of addr to addr + len - 1.
- * The address can be any valid address as long as no TLB misses occur.
- * (Be sure to use cached K0SEG kernel addresses or mapped addresses)
- * Results:
- * None.
- *
- * Side effects:
- * The cache line is invalidated.
- *
- *----------------------------------------------------------------------------
- */
-LEAF(R4K_InvalidateDCache)
- addu a1, a1, a0 # compute ending address
-1:
- cache 0x11,8194(a0)
- addu a0, a0, 4
- bne a0, a1, 1b
- cache 0x11,-4(a0)
-
- j ra
- nop
-END(R4K_InvalidateDCache)
-
-#else /* ==================XXXXX============================== */
-
-/*
- *----------------------------------------------------------------------------
- *
- * R3K_UTLBmiss --
- *
- * Vector code for a MIPS-I user-space TLB miss from user-space.
- *
- *
- * This code is copied to the UTLB exception vector address to
- * handle user level TLB translation misses.
- * NOTE: This code must be relocatable!!!
- */
- .globl R3K_UTLBMiss
-R3K_UTLBMiss:
- .set noat
- mfc0 k0, COP_0_BAD_VADDR # get the virtual address
- lw k1, UADDR+U_PCB_SEGTAB # get the current segment table
- bltz k0, 1f # R3000 chip bug
- srl k0, k0, SEGSHIFT # compute segment table index
- sll k0, k0, 2
- addu k1, k1, k0
- mfc0 k0, COP_0_BAD_VADDR # get the virtual address
- lw k1, 0(k1) # get pointer to segment map
- srl k0, k0, PGSHIFT - 2 # compute segment map index
- andi k0, k0, (NPTEPG - 1) << 2
- beq k1, zero, 2f # invalid segment map
- addu k1, k1, k0 # index into segment map
- lw k0, 0(k1) # get page PTE
- nop
- beq k0, zero, 2f # dont load invalid entries
- mtc0 k0, COP_0_TLB_LO0
- mfc0 k1, COP_0_EXC_PC # get return address
- tlbwr # update TLB
- j k1
- rfe
-1:
- mfc0 k1, COP_0_EXC_PC # get return address
- nop
- j k1
- rfe
-2:
- j R3K_SlowFault # handle the rest
- nop
- .set at
- .globl R3K_UTLBMissEnd
-R3K_UTLBMissEnd:
-
-
-/*
- *----------------------------------------------------------------------------
- *
- * R3K_execption --
- *
- * Vector code for the general exception vector 0x80000080
- * on an r2000 or r3000.
- *
- * This code is copied to the general exception vector address to
- * handle all execptions except RESET and UTLBMiss.
- * NOTE: This code must be relocatable!!!
- *
- *----------------------------------------------------------------------------
- */
- .globl R3K_Exception
-R3K_Exception:
- .set noat
- mfc0 k0, COP_0_STATUS_REG # Get the status register
- mfc0 k1, COP_0_CAUSE_REG # Get the cause register value.
- and k0, k0, SR_KU_PREV # test for user mode
- sll k0, k0, 4 # shift user bit for cause index
- and k1, k1, CR_EXC_CODE # Mask out the cause bits.
- or k1, k1, k0 # change index to user table
-1:
- la k0, R3K_ExceptionTable # get base of the jump table
- addu k0, k0, k1 # Get the address of the
- # function entry. Note that
- # the cause is already
- # shifted left by 2 bits so
- # we dont have to shift.
- lw k0, 0(k0) # Get the function address
- nop
- j k0 # Jump to the function.
- nop
- .set at
- .globl R3K_ExceptionEnd
-R3K_ExceptionEnd:
-
-/*----------------------------------------------------------------------------
- *
- * R3K_SlowFault --
- *
- * Alternate entry point into the R3K_UserGenExceptionor or
- * or R3K_user_Kern_exception, when the ULTB miss handler couldn't
- * find a TLB entry.
- *
- * Find out what mode we came from and call the appropriate handler.
- */
-R3K_SlowFault:
- .set noat
- mfc0 k0, COP_0_STATUS_REG
- nop
- and k0, k0, SR_KU_PREV
- bne k0, zero, R3K_UserGenException
- nop
- .set at
-/*
- * Fall though ...
- */
-
-/*----------------------------------------------------------------------------
- *
- * R3K_KernGenException --
- *
- * Handle an exception from kernel mode.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-
-/*
- * The kernel exception stack contains 18 saved general registers,
- * the status register and the multiply lo and high registers.
- * In addition, we set this up for linkage conventions.
- */
-#define KERN_REG_SIZE (18 * 4)
-#define KERN_REG_OFFSET (STAND_FRAME_SIZE)
-#define KERN_SR_OFFSET (STAND_FRAME_SIZE + KERN_REG_SIZE)
-#define KERN_MULT_LO_OFFSET (STAND_FRAME_SIZE + KERN_REG_SIZE + 4)
-#define KERN_MULT_HI_OFFSET (STAND_FRAME_SIZE + KERN_REG_SIZE + 8)
-#define KERN_EXC_FRAME_SIZE (STAND_FRAME_SIZE + KERN_REG_SIZE + 12)
-
-NNON_LEAF(R3K_KernGenException, KERN_EXC_FRAME_SIZE, ra)
- .set noat
-#ifdef DEBUG
- la k0, mdbpcb # save registers for kadb
- sw s0, (S0 * 4)(k0)
- sw s1, (S1 * 4)(k0)
- sw s2, (S2 * 4)(k0)
- sw s3, (S3 * 4)(k0)
- sw s4, (S4 * 4)(k0)
- sw s5, (S5 * 4)(k0)
- sw s6, (S6 * 4)(k0)
- sw s7, (S7 * 4)(k0)
- sw s8, (S8 * 4)(k0)
- sw gp, (GP * 4)(k0)
- sw sp, (SP * 4)(k0)
-#endif
- subu sp, sp, KERN_EXC_FRAME_SIZE
- .mask 0x80000000, (STAND_RA_OFFSET - KERN_EXC_FRAME_SIZE)
-/*
- * Save the relevant kernel registers onto the stack.
- * We don't need to save s0 - s8, sp and gp because
- * the compiler does it for us.
- */
- sw AT, KERN_REG_OFFSET + 0(sp)
- sw v0, KERN_REG_OFFSET + 4(sp)
- sw v1, KERN_REG_OFFSET + 8(sp)
- sw a0, KERN_REG_OFFSET + 12(sp)
- mflo v0
- mfhi v1
- sw a1, KERN_REG_OFFSET + 16(sp)
- sw a2, KERN_REG_OFFSET + 20(sp)
- sw a3, KERN_REG_OFFSET + 24(sp)
- sw t0, KERN_REG_OFFSET + 28(sp)
- mfc0 a0, COP_0_STATUS_REG # First arg is the status reg.
- sw t1, KERN_REG_OFFSET + 32(sp)
- sw t2, KERN_REG_OFFSET + 36(sp)
- sw t3, KERN_REG_OFFSET + 40(sp)
- sw t4, KERN_REG_OFFSET + 44(sp)
- mfc0 a1, COP_0_CAUSE_REG # Second arg is the cause reg.
- sw t5, KERN_REG_OFFSET + 48(sp)
- sw t6, KERN_REG_OFFSET + 52(sp)
- sw t7, KERN_REG_OFFSET + 56(sp)
- sw t8, KERN_REG_OFFSET + 60(sp)
- mfc0 a2, COP_0_BAD_VADDR # Third arg is the fault addr.
- sw t9, KERN_REG_OFFSET + 64(sp)
- sw ra, KERN_REG_OFFSET + 68(sp)
- sw v0, KERN_MULT_LO_OFFSET(sp)
- sw v1, KERN_MULT_HI_OFFSET(sp)
- mfc0 a3, COP_0_EXC_PC # Fourth arg is the pc.
- sw a0, KERN_SR_OFFSET(sp)
-/*
- * Call the exception handler.
- */
- jal trap
- sw a3, STAND_RA_OFFSET(sp) # for debugging
-/*
- * Restore registers and return from the exception.
- * v0 contains the return address.
- */
- lw a0, KERN_SR_OFFSET(sp)
- lw t0, KERN_MULT_LO_OFFSET(sp)
- lw t1, KERN_MULT_HI_OFFSET(sp)
- mtc0 a0, COP_0_STATUS_REG # Restore the SR, disable intrs
- mtlo t0
- mthi t1
- move k0, v0
-
- lw AT, KERN_REG_OFFSET + 0(sp)
- lw v0, KERN_REG_OFFSET + 4(sp)
- lw v1, KERN_REG_OFFSET + 8(sp)
- lw a0, KERN_REG_OFFSET + 12(sp)
- lw a1, KERN_REG_OFFSET + 16(sp)
- lw a2, KERN_REG_OFFSET + 20(sp)
- lw a3, KERN_REG_OFFSET + 24(sp)
- lw t0, KERN_REG_OFFSET + 28(sp)
- lw t1, KERN_REG_OFFSET + 32(sp)
- lw t2, KERN_REG_OFFSET + 36(sp)
- lw t3, KERN_REG_OFFSET + 40(sp)
- lw t4, KERN_REG_OFFSET + 44(sp)
- lw t5, KERN_REG_OFFSET + 48(sp)
- lw t6, KERN_REG_OFFSET + 52(sp)
- lw t7, KERN_REG_OFFSET + 56(sp)
- lw t8, KERN_REG_OFFSET + 60(sp)
- lw t9, KERN_REG_OFFSET + 64(sp)
- lw ra, KERN_REG_OFFSET + 68(sp)
-
- addu sp, sp, KERN_EXC_FRAME_SIZE
- j k0 # Now return from the
- rfe # exception.
- .set at
-END(R3K_KernGenException)
-
-/*----------------------------------------------------------------------------
- *
- * R3K_UserGenException --
- *
- * Handle an exception from user mode.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-NNON_LEAF(R3K_UserGenException, STAND_FRAME_SIZE, ra)
- .set noat
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
-/*
- * Save all of the registers except for the kernel temporaries in u.u_pcb.
- */
- sw AT, UADDR+U_PCB_REGS+(AST * 4)
- sw v0, UADDR+U_PCB_REGS+(V0 * 4)
- sw v1, UADDR+U_PCB_REGS+(V1 * 4)
- sw a0, UADDR+U_PCB_REGS+(A0 * 4)
- mflo v0
- sw a1, UADDR+U_PCB_REGS+(A1 * 4)
- sw a2, UADDR+U_PCB_REGS+(A2 * 4)
- sw a3, UADDR+U_PCB_REGS+(A3 * 4)
- sw t0, UADDR+U_PCB_REGS+(T0 * 4)
- mfhi v1
- sw t1, UADDR+U_PCB_REGS+(T1 * 4)
- sw t2, UADDR+U_PCB_REGS+(T2 * 4)
- sw t3, UADDR+U_PCB_REGS+(T3 * 4)
- sw t4, UADDR+U_PCB_REGS+(T4 * 4)
- mfc0 a0, COP_0_STATUS_REG # First arg is the status reg.
- sw t5, UADDR+U_PCB_REGS+(T5 * 4)
- sw t6, UADDR+U_PCB_REGS+(T6 * 4)
- sw t7, UADDR+U_PCB_REGS+(T7 * 4)
- sw s0, UADDR+U_PCB_REGS+(S0 * 4)
- mfc0 a1, COP_0_CAUSE_REG # Second arg is the cause reg.
- sw s1, UADDR+U_PCB_REGS+(S1 * 4)
- sw s2, UADDR+U_PCB_REGS+(S2 * 4)
- sw s3, UADDR+U_PCB_REGS+(S3 * 4)
- sw s4, UADDR+U_PCB_REGS+(S4 * 4)
- mfc0 a2, COP_0_BAD_VADDR # Third arg is the fault addr
- sw s5, UADDR+U_PCB_REGS+(S5 * 4)
- sw s6, UADDR+U_PCB_REGS+(S6 * 4)
- sw s7, UADDR+U_PCB_REGS+(S7 * 4)
- sw t8, UADDR+U_PCB_REGS+(T8 * 4)
- mfc0 a3, COP_0_EXC_PC # Fourth arg is the pc.
- sw t9, UADDR+U_PCB_REGS+(T9 * 4)
- sw gp, UADDR+U_PCB_REGS+(GP * 4)
- sw sp, UADDR+U_PCB_REGS+(SP * 4)
- sw s8, UADDR+U_PCB_REGS+(S8 * 4)
- li sp, KERNELSTACK - STAND_FRAME_SIZE # switch to kernel SP
- sw ra, UADDR+U_PCB_REGS+(RA * 4)
- sw v0, UADDR+U_PCB_REGS+(MULLO * 4)
- sw v1, UADDR+U_PCB_REGS+(MULHI * 4)
- sw a0, UADDR+U_PCB_REGS+(SR * 4)
- la gp, _gp # switch to kernel GP
- sw a3, UADDR+U_PCB_REGS+(PC * 4)
- sw a3, STAND_RA_OFFSET(sp) # for debugging
- .set at
- and t0, a0, ~SR_COP_1_BIT # Turn off the FPU.
- .set noat
-/*
- * Call the exception handler.
- */
- jal trap
- mtc0 t0, COP_0_STATUS_REG
-/*
- * Restore user registers and return. NOTE: interrupts are enabled.
- */
- lw a0, UADDR+U_PCB_REGS+(SR * 4)
- lw t0, UADDR+U_PCB_REGS+(MULLO * 4)
- lw t1, UADDR+U_PCB_REGS+(MULHI * 4)
- mtc0 a0, COP_0_STATUS_REG # this should disable interrupts
- mtlo t0
- mthi t1
- lw k0, UADDR+U_PCB_REGS+(PC * 4)
- lw AT, UADDR+U_PCB_REGS+(AST * 4)
- lw v0, UADDR+U_PCB_REGS+(V0 * 4)
- lw v1, UADDR+U_PCB_REGS+(V1 * 4)
- lw a0, UADDR+U_PCB_REGS+(A0 * 4)
- lw a1, UADDR+U_PCB_REGS+(A1 * 4)
- lw a2, UADDR+U_PCB_REGS+(A2 * 4)
- lw a3, UADDR+U_PCB_REGS+(A3 * 4)
- lw t0, UADDR+U_PCB_REGS+(T0 * 4)
- lw t1, UADDR+U_PCB_REGS+(T1 * 4)
- lw t2, UADDR+U_PCB_REGS+(T2 * 4)
- lw t3, UADDR+U_PCB_REGS+(T3 * 4)
- lw t4, UADDR+U_PCB_REGS+(T4 * 4)
- lw t5, UADDR+U_PCB_REGS+(T5 * 4)
- lw t6, UADDR+U_PCB_REGS+(T6 * 4)
- lw t7, UADDR+U_PCB_REGS+(T7 * 4)
- lw s0, UADDR+U_PCB_REGS+(S0 * 4)
- lw s1, UADDR+U_PCB_REGS+(S1 * 4)
- lw s2, UADDR+U_PCB_REGS+(S2 * 4)
- lw s3, UADDR+U_PCB_REGS+(S3 * 4)
- lw s4, UADDR+U_PCB_REGS+(S4 * 4)
- lw s5, UADDR+U_PCB_REGS+(S5 * 4)
- lw s6, UADDR+U_PCB_REGS+(S6 * 4)
- lw s7, UADDR+U_PCB_REGS+(S7 * 4)
- lw t8, UADDR+U_PCB_REGS+(T8 * 4)
- lw t9, UADDR+U_PCB_REGS+(T9 * 4)
- lw gp, UADDR+U_PCB_REGS+(GP * 4)
- lw sp, UADDR+U_PCB_REGS+(SP * 4)
- lw s8, UADDR+U_PCB_REGS+(S8 * 4)
- lw ra, UADDR+U_PCB_REGS+(RA * 4)
-
- j k0
- rfe
- .set at
-END(R3K_UserGenException)
-
-/*----------------------------------------------------------------------------
- *
- * R3K_KernIntr --
- *
- * Handle an interrupt from kernel mode.
- * Interrupts use the standard kernel stack.
- * switch_exit sets up a kernel stack after exit so interrupts won't fail.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-#define KINTR_REG_OFFSET (STAND_FRAME_SIZE)
-#define KINTR_SR_OFFSET (STAND_FRAME_SIZE + KERN_REG_SIZE)
-#define KINTR_MULT_LO_OFFSET (STAND_FRAME_SIZE + KERN_REG_SIZE + 4)
-#define KINTR_MULT_HI_OFFSET (STAND_FRAME_SIZE + KERN_REG_SIZE + 8)
-#define KINTR_GP_OFFSET (STAND_FRAME_SIZE + KERN_REG_SIZE + 12)
-#define KINTR_FRAME_SIZE (STAND_FRAME_SIZE + KERN_REG_SIZE + 16)
-
-NNON_LEAF(R3K_KernIntr, KINTR_FRAME_SIZE, ra)
- .set noat
- subu sp, sp, KINTR_FRAME_SIZE # allocate stack frame
- .mask 0x80000000, (STAND_RA_OFFSET - KINTR_FRAME_SIZE)
-/*
- * Save the relevant kernel registers onto the stack.
- * We don't need to save s0 - s8 and sp because
- * the compiler does it for us.
- */
- sw AT, KINTR_REG_OFFSET + 0(sp)
- sw v0, KINTR_REG_OFFSET + 4(sp)
- sw v1, KINTR_REG_OFFSET + 8(sp)
- sw a0, KINTR_REG_OFFSET + 12(sp)
- mflo v0
- mfhi v1
- sw a1, KINTR_REG_OFFSET + 16(sp)
- sw a2, KINTR_REG_OFFSET + 20(sp)
- sw a3, KINTR_REG_OFFSET + 24(sp)
- sw t0, KINTR_REG_OFFSET + 28(sp)
- mfc0 a0, COP_0_STATUS_REG # First arg is the status reg.
- sw t1, KINTR_REG_OFFSET + 32(sp)
- sw t2, KINTR_REG_OFFSET + 36(sp)
- sw t3, KINTR_REG_OFFSET + 40(sp)
- sw t4, KINTR_REG_OFFSET + 44(sp)
- mfc0 a1, COP_0_CAUSE_REG # Second arg is the cause reg.
- sw t5, KINTR_REG_OFFSET + 48(sp)
- sw t6, KINTR_REG_OFFSET + 52(sp)
- sw t7, KINTR_REG_OFFSET + 56(sp)
- sw t8, KINTR_REG_OFFSET + 60(sp)
- mfc0 a2, COP_0_EXC_PC # Third arg is the pc.
- sw t9, KINTR_REG_OFFSET + 64(sp)
- sw ra, KINTR_REG_OFFSET + 68(sp)
- sw v0, KINTR_MULT_LO_OFFSET(sp)
- sw v1, KINTR_MULT_HI_OFFSET(sp)
- sw a0, KINTR_SR_OFFSET(sp)
- sw gp, KINTR_GP_OFFSET(sp)
- la gp, _gp # switch to kernel GP
-/*
- * Call the interrupt handler.
- */
- jal interrupt
- sw a2, STAND_RA_OFFSET(sp) # for debugging
-/*
- * Restore registers and return from the interrupt.
- */
- lw a0, KINTR_SR_OFFSET(sp)
- lw t0, KINTR_MULT_LO_OFFSET(sp)
- lw t1, KINTR_MULT_HI_OFFSET(sp)
- mtc0 a0, COP_0_STATUS_REG # Restore the SR, disable intrs
- mtlo t0
- mthi t1
- lw k0, STAND_RA_OFFSET(sp)
- lw AT, KINTR_REG_OFFSET + 0(sp)
- lw v0, KINTR_REG_OFFSET + 4(sp)
- lw v1, KINTR_REG_OFFSET + 8(sp)
- lw a0, KINTR_REG_OFFSET + 12(sp)
- lw a1, KINTR_REG_OFFSET + 16(sp)
- lw a2, KINTR_REG_OFFSET + 20(sp)
- lw a3, KINTR_REG_OFFSET + 24(sp)
- lw t0, KINTR_REG_OFFSET + 28(sp)
- lw t1, KINTR_REG_OFFSET + 32(sp)
- lw t2, KINTR_REG_OFFSET + 36(sp)
- lw t3, KINTR_REG_OFFSET + 40(sp)
- lw t4, KINTR_REG_OFFSET + 44(sp)
- lw t5, KINTR_REG_OFFSET + 48(sp)
- lw t6, KINTR_REG_OFFSET + 52(sp)
- lw t7, KINTR_REG_OFFSET + 56(sp)
- lw t8, KINTR_REG_OFFSET + 60(sp)
- lw t9, KINTR_REG_OFFSET + 64(sp)
- lw ra, KINTR_REG_OFFSET + 68(sp)
-
- addu sp, sp, KINTR_FRAME_SIZE
- j k0 # Now return from the
- rfe # interrupt.
- .set at
-END(R3K_KernIntr)
-
-/*----------------------------------------------------------------------------
- *
- * R3K_UserIntr --
- *
- * Handle an interrupt from user mode.
- * Note: we save minimal state in the u.u_pcb struct and use the standard
- * kernel stack since there has to be a u page if we came from user mode.
- * If there is a pending software interrupt, then save the remaining state
- * and call softintr(). This is all because if we call switch() inside
- * interrupt(), not all the user registers have been saved in u.u_pcb.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-NNON_LEAF(R3K_UserIntr, STAND_FRAME_SIZE, ra)
- .set noat
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
-/*
- * Save the relevant user registers into the u.u_pcb struct.
- * We don't need to save s0 - s8 because
- * the compiler does it for us.
- */
- sw AT, UADDR+U_PCB_REGS+(AST * 4)
- sw v0, UADDR+U_PCB_REGS+(V0 * 4)
- sw v1, UADDR+U_PCB_REGS+(V1 * 4)
- sw a0, UADDR+U_PCB_REGS+(A0 * 4)
- mflo v0
- mfhi v1
- sw a1, UADDR+U_PCB_REGS+(A1 * 4)
- sw a2, UADDR+U_PCB_REGS+(A2 * 4)
- sw a3, UADDR+U_PCB_REGS+(A3 * 4)
- sw t0, UADDR+U_PCB_REGS+(T0 * 4)
- mfc0 a0, COP_0_STATUS_REG # First arg is the status reg.
- sw t1, UADDR+U_PCB_REGS+(T1 * 4)
- sw t2, UADDR+U_PCB_REGS+(T2 * 4)
- sw t3, UADDR+U_PCB_REGS+(T3 * 4)
- sw t4, UADDR+U_PCB_REGS+(T4 * 4)
- mfc0 a1, COP_0_CAUSE_REG # Second arg is the cause reg.
- sw t5, UADDR+U_PCB_REGS+(T5 * 4)
- sw t6, UADDR+U_PCB_REGS+(T6 * 4)
- sw t7, UADDR+U_PCB_REGS+(T7 * 4)
- sw t8, UADDR+U_PCB_REGS+(T8 * 4)
- mfc0 a2, COP_0_EXC_PC # Third arg is the pc.
- sw t9, UADDR+U_PCB_REGS+(T9 * 4)
- sw gp, UADDR+U_PCB_REGS+(GP * 4)
- sw sp, UADDR+U_PCB_REGS+(SP * 4)
- sw ra, UADDR+U_PCB_REGS+(RA * 4)
- li sp, KERNELSTACK - STAND_FRAME_SIZE # switch to kernel SP
- sw v0, UADDR+U_PCB_REGS+(MULLO * 4)
- sw v1, UADDR+U_PCB_REGS+(MULHI * 4)
- sw a0, UADDR+U_PCB_REGS+(SR * 4)
- sw a2, UADDR+U_PCB_REGS+(PC * 4)
- la gp, _gp # switch to kernel GP
- .set at
- and t0, a0, ~SR_COP_1_BIT # Turn off the FPU.
- .set noat
- mtc0 t0, COP_0_STATUS_REG
-/*
- * Call the interrupt handler.
- */
- jal interrupt
- sw a2, STAND_RA_OFFSET(sp) # for debugging
-/*
- * Restore registers and return from the interrupt.
- */
- lw a0, UADDR+U_PCB_REGS+(SR * 4)
- lw v0, astpending # any pending interrupts?
- mtc0 a0, COP_0_STATUS_REG # Restore the SR, disable intrs
- bne v0, zero, 1f # dont restore, call softintr
- lw t0, UADDR+U_PCB_REGS+(MULLO * 4)
- lw t1, UADDR+U_PCB_REGS+(MULHI * 4)
- lw k0, UADDR+U_PCB_REGS+(PC * 4)
- lw AT, UADDR+U_PCB_REGS+(AST * 4)
- lw v0, UADDR+U_PCB_REGS+(V0 * 4)
- lw v1, UADDR+U_PCB_REGS+(V1 * 4)
- lw a0, UADDR+U_PCB_REGS+(A0 * 4)
- lw a1, UADDR+U_PCB_REGS+(A1 * 4)
- lw a2, UADDR+U_PCB_REGS+(A2 * 4)
- lw a3, UADDR+U_PCB_REGS+(A3 * 4)
- mtlo t0
- mthi t1
- lw t0, UADDR+U_PCB_REGS+(T0 * 4)
- lw t1, UADDR+U_PCB_REGS+(T1 * 4)
- lw t2, UADDR+U_PCB_REGS+(T2 * 4)
- lw t3, UADDR+U_PCB_REGS+(T3 * 4)
- lw t4, UADDR+U_PCB_REGS+(T4 * 4)
- lw t5, UADDR+U_PCB_REGS+(T5 * 4)
- lw t6, UADDR+U_PCB_REGS+(T6 * 4)
- lw t7, UADDR+U_PCB_REGS+(T7 * 4)
- lw t8, UADDR+U_PCB_REGS+(T8 * 4)
- lw t9, UADDR+U_PCB_REGS+(T9 * 4)
- lw gp, UADDR+U_PCB_REGS+(GP * 4)
- lw sp, UADDR+U_PCB_REGS+(SP * 4)
- lw ra, UADDR+U_PCB_REGS+(RA * 4)
- j k0 # Now return from the
- rfe # interrupt.
-
-1:
-/*
- * We have pending software interrupts; save remaining user state in u.u_pcb.
- */
- sw s0, UADDR+U_PCB_REGS+(S0 * 4)
- sw s1, UADDR+U_PCB_REGS+(S1 * 4)
- sw s2, UADDR+U_PCB_REGS+(S2 * 4)
- sw s3, UADDR+U_PCB_REGS+(S3 * 4)
- sw s4, UADDR+U_PCB_REGS+(S4 * 4)
- sw s5, UADDR+U_PCB_REGS+(S5 * 4)
- sw s6, UADDR+U_PCB_REGS+(S6 * 4)
- sw s7, UADDR+U_PCB_REGS+(S7 * 4)
- sw s8, UADDR+U_PCB_REGS+(S8 * 4)
- li t0, HARD_INT_MASK | SR_INT_ENAB
-/*
- * Call the software interrupt handler.
- */
- jal softintr
- mtc0 t0, COP_0_STATUS_REG # enable interrupts (spl0)
-/*
- * Restore user registers and return. NOTE: interrupts are enabled.
- */
- lw a0, UADDR+U_PCB_REGS+(SR * 4)
- lw t0, UADDR+U_PCB_REGS+(MULLO * 4)
- lw t1, UADDR+U_PCB_REGS+(MULHI * 4)
- mtc0 a0, COP_0_STATUS_REG # this should disable interrupts
- mtlo t0
- mthi t1
- lw k0, UADDR+U_PCB_REGS+(PC * 4)
- lw AT, UADDR+U_PCB_REGS+(AST * 4)
- lw v0, UADDR+U_PCB_REGS+(V0 * 4)
- lw v1, UADDR+U_PCB_REGS+(V1 * 4)
- lw a0, UADDR+U_PCB_REGS+(A0 * 4)
- lw a1, UADDR+U_PCB_REGS+(A1 * 4)
- lw a2, UADDR+U_PCB_REGS+(A2 * 4)
- lw a3, UADDR+U_PCB_REGS+(A3 * 4)
- lw t0, UADDR+U_PCB_REGS+(T0 * 4)
- lw t1, UADDR+U_PCB_REGS+(T1 * 4)
- lw t2, UADDR+U_PCB_REGS+(T2 * 4)
- lw t3, UADDR+U_PCB_REGS+(T3 * 4)
- lw t4, UADDR+U_PCB_REGS+(T4 * 4)
- lw t5, UADDR+U_PCB_REGS+(T5 * 4)
- lw t6, UADDR+U_PCB_REGS+(T6 * 4)
- lw t7, UADDR+U_PCB_REGS+(T7 * 4)
- lw s0, UADDR+U_PCB_REGS+(S0 * 4)
- lw s1, UADDR+U_PCB_REGS+(S1 * 4)
- lw s2, UADDR+U_PCB_REGS+(S2 * 4)
- lw s3, UADDR+U_PCB_REGS+(S3 * 4)
- lw s4, UADDR+U_PCB_REGS+(S4 * 4)
- lw s5, UADDR+U_PCB_REGS+(S5 * 4)
- lw s6, UADDR+U_PCB_REGS+(S6 * 4)
- lw s7, UADDR+U_PCB_REGS+(S7 * 4)
- lw t8, UADDR+U_PCB_REGS+(T8 * 4)
- lw t9, UADDR+U_PCB_REGS+(T9 * 4)
- lw gp, UADDR+U_PCB_REGS+(GP * 4)
- lw sp, UADDR+U_PCB_REGS+(SP * 4)
- lw s8, UADDR+U_PCB_REGS+(S8 * 4)
- lw ra, UADDR+U_PCB_REGS+(RA * 4)
-
- j k0
- rfe
- .set at
-END(R3K_UserIntr)
-
-
-
-#if 0
-/*----------------------------------------------------------------------------
- *
- * R3K_TLBModException --
- *
- * Handle a TLB modified exception.
- * The BaddVAddr, Context, and EntryHi registers contain the failed
- * virtual address.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-NLEAF(R3K_TLBModException)
- .set noat
- tlbp # find the TLB entry
- mfc0 k0, COP_0_TLB_LO0 # get the physical address
- mfc0 k1, COP_0_TLB_INDEX # check to be sure its valid
- or k0, k0, VM_TLB_MOD_BIT # update TLB
- blt k1, zero, 4f # not found!!!
- mtc0 k0, COP_0_TLB_LO0
- li k1, CACHED_MEMORY_ADDR
- subu k0, k0, k1
- srl k0, k0, VM_TLB_PHYS_PAGE_SHIFT
- la k1, pmap_attributes
- addu k0, k0, k1
- lbu k1, 0(k0) # fetch old value
- nop
- or k1, k1, 1 # set modified bit
- sb k1, 0(k0) # save new value
- mfc0 k0, COP_0_EXC_PC # get return address
- nop
- j k0
- rfe
-4:
- break 0 # panic
- .set at
-END(R3K_TLBModException)
-#endif
-
-/*----------------------------------------------------------------------------
- *
- * R3K_TLBMissException --
- *
- * Handle a TLB miss exception from kernel mode.
- * The BaddVAddr, Context, and EntryHi registers contain the failed
- * virtual address.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-NLEAF(R3K_TLBMissException)
- .set noat
- mfc0 k0, COP_0_BAD_VADDR # get the fault address
- li k1, VM_MIN_KERNEL_ADDRESS # compute index
- subu k0, k0, k1
- lw k1, Sysmapsize # index within range?
- srl k0, k0, PGSHIFT
- sltu k1, k0, k1
- beq k1, zero, 1f # No. check for valid stack
- nop
- lw k1, Sysmap
- sll k0, k0, 2 # compute offset from index
- addu k1, k1, k0
- lw k0, 0(k1) # get PTE entry
- mfc0 k1, COP_0_EXC_PC # get return address
- mtc0 k0, COP_0_TLB_LO0 # save PTE entry
- and k0, k0, PG_V # check for valid entry
- beq k0, zero, R3K_KernGenException # PTE invalid
- nop
- tlbwr # update TLB
- j k1
- rfe
-
-1:
- subu k0, sp, UADDR + 0x200 # check to see if we have a
- sltiu k0, UPAGES*NBPG - 0x200 # valid kernel stack
- bne k0, zero, R3K_KernGenException # Go panic
- nop
-
- la a0, start - START_FRAME - 8 # set sp to a valid place
- sw sp, 24(a0)
- move sp, a0
- la a0, 1f
- mfc0 a2, COP_0_STATUS_REG
- mfc0 a3, COP_0_CAUSE_REG
- mfc0 a1, COP_0_EXC_PC
- sw a2, 16(sp)
- sw a3, 20(sp)
- move a2, ra
- jal printf
- mfc0 a3, COP_0_BAD_VADDR
- .data
-1:
- .asciiz "ktlbmiss: PC %x RA %x ADR %x\nSR %x CR %x SP %x\n"
- .text
-
- la sp, start - START_FRAME # set sp to a valid place
- PANIC("kernel stack overflow")
- .set at
-END(R3K_TLBMissException)
-
-/*----------------------------------------------------------------------------
- *
- * wbflush --
- *
- * Return when the write buffer is empty.
- *
- * wbflush()
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-LEAF(wbflush)
- lbu v0,0xa0000000
- nop
- j ra
- nop
-END(wbflush)
-
-
-/*--------------------------------------------------------------------------
- *
- * R3K_TLBWriteIndexed --
- *
- * Write the given entry into the TLB at the given index.
- *
- * R3K_TLBWriteIndexed(index, highEntry, lowEntry)
- * int index;
- * int highEntry;
- * int lowEntry;
- *
- * Results:
- * None.
- *
- * Side effects:
- * TLB entry set.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R3K_TLBWriteIndexed)
- mfc0 v1, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
- mfc0 t0, COP_0_TLB_HI # Save the current PID.
-
- sll a0, a0, R3K_TLB_INDEX_SHIFT
- mtc0 a0, COP_0_TLB_INDEX # Set the index.
- mtc0 a1, COP_0_TLB_HI # Set up entry high.
- mtc0 a2, COP_0_TLB_LO0 # Set up entry low.
- nop
- tlbwi # Write the TLB
-
- mtc0 t0, COP_0_TLB_HI # Restore the PID.
- j ra
- mtc0 v1, COP_0_STATUS_REG # Restore the status register
-END(R3K_TLBWriteIndexed)
-
-/*--------------------------------------------------------------------------
- *
- * R3K_SetPID --
- *
- * Write the given pid into the TLB pid reg.
- *
- * R3K_SetPID(pid)
- * int pid;
- *
- * Results:
- * None.
- *
- * Side effects:
- * PID set in the entry hi register.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R3K_SetPID)
- sll a0, a0, R3K_PID_SHIFT # put PID in right spot
- mtc0 a0, COP_0_TLB_HI # Write the hi reg value
- j ra
- nop
-END(R3K_SetPID)
-
-/*--------------------------------------------------------------------------
- *
- * R3K_TLBFlush --
- *
- * Flush the "random" entries from the TLB.
- *
- * R3K_TLBFlush()
- *
- * Results:
- * None.
- *
- * Side effects:
- * The TLB is flushed.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R3K_TLBFlush)
- mfc0 v1, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
- mfc0 t0, COP_0_TLB_HI # Save the PID
- li t1, CACHED_MEMORY_ADDR # invalid address
- mtc0 t1, COP_0_TLB_HI # Mark entry high as invalid
- mtc0 zero, COP_0_TLB_LO0 # Zero out low entry.
-/*
- * Align the starting value (t1) and the upper bound (t2).
- */
- li t1, R3K_NUM_WIRED_ENTRIES << R3K_TLB_INDEX_SHIFT
- li t2, R3K_NUM_TLB_ENTRIES << R3K_TLB_INDEX_SHIFT
-1:
- mtc0 t1, COP_0_TLB_INDEX # Set the index register.
- addu t1, t1, 1 << R3K_TLB_INDEX_SHIFT # Increment index.
- bne t1, t2, 1b
- tlbwi # Write the TLB entry.
-
- mtc0 t0, COP_0_TLB_HI # Restore the PID
- j ra
- mtc0 v1, COP_0_STATUS_REG # Restore the status register
-END(R3K_TLBFlush)
-
-/*--------------------------------------------------------------------------
- *
- * R3K_TLBFlushAddr --
- *
- * Flush any TLB entries for the given address and TLB PID.
- *
- * R3K_TLBFlushAddr(highreg)
- * unsigned highreg;
- *
- * Results:
- * None.
- *
- * Side effects:
- * The process's page is flushed from the TLB.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R3K_TLBFlushAddr)
- mfc0 v1, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
- mfc0 t0, COP_0_TLB_HI # Get current PID
- nop
-
- mtc0 a0, COP_0_TLB_HI # look for addr & PID
- nop
- tlbp # Probe for the entry.
- mfc0 v0, COP_0_TLB_INDEX # See what we got
- li t1, CACHED_MEMORY_ADDR # Load invalid entry.
- bltz v0, 1f # index < 0 => !found
- mtc0 t1, COP_0_TLB_HI # Mark entry high as invalid
- mtc0 zero, COP_0_TLB_LO0 # Zero out low entry.
- nop
- tlbwi
-1:
- mtc0 t0, COP_0_TLB_HI # restore PID
- j ra
- mtc0 v1, COP_0_STATUS_REG # Restore the status register
-END(R3K_TLBFlushAddr)
-
-/*--------------------------------------------------------------------------
- *
- * R3K_TLBUpdate --
- *
- * Update the TLB if highreg is found; otherwise, enter the data.
- *
- * R3K_TLBUpdate(highreg, lowreg)
- * unsigned highreg, lowreg;
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R3K_TLBUpdate)
- mfc0 v1, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
- mfc0 t0, COP_0_TLB_HI # Save current PID
- nop # 2 cycles before intr disabled
- mtc0 a0, COP_0_TLB_HI # init high reg.
- nop
- tlbp # Probe for the entry.
- mfc0 v0, COP_0_TLB_INDEX # See what we got
- mtc0 a1, COP_0_TLB_LO0 # init low reg.
- bltz v0, 1f # index < 0 => !found
- sra v0, v0, R3K_TLB_INDEX_SHIFT # convert index to regular num
- b 2f
- tlbwi # update slot found
-1:
- mtc0 a0, COP_0_TLB_HI # init high reg.
- nop
- tlbwr # enter into a random slot
-2:
- mtc0 t0, COP_0_TLB_HI # restore PID
- j ra
- mtc0 v1, COP_0_STATUS_REG # Restore the status register
-END(R3K_TLBUpdate)
-
-/*--------------------------------------------------------------------------
- *
- * R3K_TLBFind --
- *
- * Search the TLB for the given entry.
- *
- * R3K_TLBFind(hi)
- * unsigned hi;
- *
- * Results:
- * Returns a value >= 0 if the entry was found (the index).
- * Returns a value < 0 if the entry was not found.
- *
- * Side effects:
- * tlbhi and tlblo will contain the TLB entry found.
- *
- *--------------------------------------------------------------------------
- */
- .comm tlbhi, 4
- .comm tlblo, 4
-LEAF(R3K_TLBFind)
- mfc0 v1, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
- mfc0 t0, COP_0_TLB_HI # Get current PID
- nop
- mtc0 a0, COP_0_TLB_HI # Set up entry high.
- nop
- tlbp # Probe for the entry.
- mfc0 v0, COP_0_TLB_INDEX # See what we got
- nop
- bltz v0, 1f # not found
- nop
- tlbr # read TLB
- mfc0 t1, COP_0_TLB_HI # See what we got
- mfc0 t2, COP_0_TLB_LO0 # See what we got
- sw t1, tlbhi
- sw t2, tlblo
- srl v0, v0, R3K_TLB_INDEX_SHIFT # convert index to regular num
-1:
- mtc0 t0, COP_0_TLB_HI # Restore current PID
- j ra
- mtc0 v1, COP_0_STATUS_REG # Restore the status register
-END(R3K_TLBFind)
-
-/*--------------------------------------------------------------------------
- *
- * R3K_TLBRead --
- *
- * Read the TLB entry.
- *
- * R3K_TLBRead(entry)
- * unsigned entry;
- *
- * Results:
- * None.
- *
- * Side effects:
- * tlbhi and tlblo will contain the TLB entry found.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R3K_TLBRead)
- mfc0 v1, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts
- mfc0 t0, COP_0_TLB_HI # Get current PID
-
- sll a0, a0, R3K_TLB_INDEX_SHIFT
- mtc0 a0, COP_0_TLB_INDEX # Set the index register
- nop
- tlbr # Read from the TLB
- mfc0 t3, COP_0_TLB_HI # fetch the hi entry
- mfc0 t4, COP_0_TLB_LO0 # fetch the low entry
- sw t3, tlbhi
- sw t4, tlblo
-
- mtc0 t0, COP_0_TLB_HI # restore PID
- j ra
- mtc0 v1, COP_0_STATUS_REG # Restore the status register
-END(R3K_TLBRead)
-
-/*--------------------------------------------------------------------------
- *
- * R3K_TLBGetPID --
- *
- * R3K_TLBGetPID()
- *
- * Results:
- * Returns the current TLB pid reg.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-LEAF(R3K_TLBGetPID)
- mfc0 v0, COP_0_TLB_HI # get PID
- nop
- and v0, v0, R3K_PID_MASK # mask off PID
- j ra
- srl v0, v0, R3K_PID_SHIFT # put PID in right spot
-END(R3K_TLBGetPID)
-
-/*----------------------------------------------------------------------------
- *
- * R3K_ConfigCache --
- *
- * Size the caches.
- * NOTE: should only be called from mips_init().
- *
- * Results:
- * None.
- *
- * Side effects:
- * The size of the data cache is stored into CpuPrimaryDataCacheSize and
- * the size of instruction cache is stored into CpuPrimaryInstCacheSize.
- *
- *----------------------------------------------------------------------------
- */
-NON_LEAF(R3K_ConfigCache, STAND_FRAME_SIZE, ra)
- subu sp, sp, STAND_FRAME_SIZE
- sw ra, STAND_RA_OFFSET(sp) # Save return address.
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts.
- la v0, 1f
- or v0, UNCACHED_MEMORY_ADDR # Run uncached.
- j v0
- nop
-1:
-/*
- * This works because jal doesn't change pc[31..28] and the
- * linker still thinks SizeCache is in the cached region so it computes
- * the correct address without complaining.
- */
- jal R3K_SizeCache # Get the size of the d-cache.
- nop
- sw v0, CpuPrimaryDataCacheSize
- nop # Make sure sw out of pipe
- nop
- nop
- nop
- li v0, SR_SWAP_CACHES # Swap caches
- mtc0 v0, COP_0_STATUS_REG
- nop # Insure caches stable
- nop
- nop
- nop
- jal R3K_SizeCache # Get the size of the i-cache.
- nop
- mtc0 zero, COP_0_STATUS_REG # Swap back caches and enable.
- nop
- nop
- nop
- nop
- sw v0, CpuPrimaryInstCacheSize
- la t0, 1f
- j t0 # Back to cached mode
- nop
-1:
- lw ra, STAND_RA_OFFSET(sp) # Restore return addr
- addu sp, sp, STAND_FRAME_SIZE # Restore sp.
- j ra
- nop
-END(R3K_ConfigCache)
-
-/*----------------------------------------------------------------------------
- *
- * R3K_SizeCache --
- *
- * Get the size of the cache.
- *
- * Results:
- * The size of the cache.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-LEAF(R3K_SizeCache)
- mfc0 t0, COP_0_STATUS_REG # Save the current status reg.
- nop
- or v0, t0, SR_ISOL_CACHES # Isolate the caches.
- nop # Make sure no stores in pipe
- mtc0 v0, COP_0_STATUS_REG
- nop # Make sure isolated
- nop
- nop
-/*
- * Clear cache size boundaries.
- */
- li v0, MIN_CACHE_SIZE
- li v1, CACHED_MEMORY_ADDR
- li t2, MAX_CACHE_SIZE
-1:
- addu t1, v0, v1 # Compute address to clear
- sw zero, 0(t1) # Clear cache memory
- bne v0, t2, 1b
- sll v0, v0, 1
-
- li v0, -1
- sw v0, 0(v1) # Store marker in cache
- li v0, MIN_CACHE_SIZE
-2:
- addu t1, v0, v1 # Compute address
- lw t3, 0(t1) # Look for marker
- nop
- bne t3, zero, 3f # Found marker.
- nop
- bne v0, t2, 2b # keep looking
- sll v0, v0, 1 # cache size * 2
-
- move v0, zero # must be no cache
-3:
- mtc0 t0, COP_0_STATUS_REG
- nop # Make sure unisolated
- nop
- nop
- nop
- j ra
- nop
-END(R3K_SizeCache)
-
-/*----------------------------------------------------------------------------
- *
- * R3K_FlushCache --
- *
- * Flush the caches.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The contents of the caches is flushed.
- *
- *----------------------------------------------------------------------------
- */
-LEAF(R3K_FlushCache)
- lw t1, CpuPrimaryInstCacheSize # Must load before isolating
- lw t2, CpuPrimaryDataCacheSize # Must load before isolating
- mfc0 t3, COP_0_STATUS_REG # Save the status register.
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts.
- la v0, 1f
- or v0, UNCACHED_MEMORY_ADDR # Run uncached.
- j v0
- nop
-/*
- * Flush the instruction cache.
- */
-1:
- li v0, SR_ISOL_CACHES | SR_SWAP_CACHES
- mtc0 v0, COP_0_STATUS_REG # Isolate and swap caches.
- li t0, UNCACHED_MEMORY_ADDR
- subu t0, t0, t1
- li t1, UNCACHED_MEMORY_ADDR
- la v0, 1f # Run cached
- j v0
- nop
-1:
- addu t0, t0, 4
- bne t0, t1, 1b
- sb zero, -4(t0)
-
- la v0, 1f
- or v0, UNCACHED_MEMORY_ADDR
- j v0 # Run uncached
- nop
-/*
- * Flush the data cache.
- */
-1:
- li v0, SR_ISOL_CACHES
- mtc0 v0, COP_0_STATUS_REG # Isolate and swap back caches
- li t0, UNCACHED_MEMORY_ADDR
- subu t0, t0, t2
- la v0, 1f
- j v0 # Back to cached mode
- nop
-1:
- addu t0, t0, 4
- bne t0, t1, 1b
- sb zero, -4(t0)
-
- nop # Insure isolated stores
- nop # out of pipe.
- nop
- nop
- mtc0 t3, COP_0_STATUS_REG # Restore status reg.
- nop # Insure cache unisolated.
- nop
- nop
- nop
- j ra
- nop
-END(R3K_FlushCache)
-
-/*----------------------------------------------------------------------------
- *
- * R3K_FlushICache --
- *
- * void R3K_FlushICache(addr, len)
- * vm_offset_t addr, len;
- *
- * Flush instruction cache for range of addr to addr + len - 1.
- * The address can be any valid address so long as no TLB misses occur.
- *
- * Results:
- * Returns zero.
- *
- * Side effects:
- * The contents of the cache is flushed.
- *
- *----------------------------------------------------------------------------
- */
-LEAF(R3K_FlushICache)
- mfc0 t0, COP_0_STATUS_REG # Save SR
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts.
-
- la v1, 1f
- or v1, UNCACHED_MEMORY_ADDR # Run uncached.
- j v1
- nop
-
-1:
- lbu v1, 0xa0000000 # make sure stores are complete
-# XXX is executing from uncached sufficient so the above can be skipped?
- li v1, SR_ISOL_CACHES | SR_SWAP_CACHES
- mtc0 v1, COP_0_STATUS_REG
- nop
- addu a1, a1, a0 # compute ending address
-2:
- addu a0, a0, 4
- bne a0, a1, 2b
- sb zero, -4(a0)
-
- mtc0 t0, COP_0_STATUS_REG # enable interrupts
- j ra # return and run cached
- li v0, 0
-END(R3K_FlushICache)
-
-/*----------------------------------------------------------------------------
- *
- * R3K_FlushDCache --
- *
- * void R3K_FlushDCache(addr, len)
- * vm_offset_t addr, len;
- *
- * Flush data cache for range of addr to addr + len - 1.
- * The address can be any valid address so long as no TLB misses occur.
- * (Be sure to use cached K0SEG kernel addresses)
- * Results:
- * None.
- *
- * Side effects:
- * The contents of the cache is flushed.
- *
- *----------------------------------------------------------------------------
- */
-LEAF(R3K_FlushDCache)
-ALEAF(R3K_HitFlushDCache)
- mfc0 t0, COP_0_STATUS_REG # Save SR
- mtc0 zero, COP_0_STATUS_REG # Disable interrupts.
- nop
-
- lbu v1, 0xa0000000 # make sure stores are complete
-
- li v1, SR_ISOL_CACHES
- mtc0 v1, COP_0_STATUS_REG
- nop
- addu t1, a1, a0 # compute ending address
-1:
- sb zero, 0(a0)
- sb zero, 4(a0)
- sb zero, 8(a0)
- sb zero, 12(a0)
- sb zero, 16(a0)
- sb zero, 20(a0)
- sb zero, 24(a0)
- addu a0, 32
- bltu a0, t1, 1b
- sb zero, -4(a0)
-
- nop # drain pipeline
- nop
- mtc0 t0, COP_0_STATUS_REG # enable interrupts
- nop
- j ra # return and run cached
- nop
-END(R3K_FlushDCache)
-
-#endif /* ==================XXXXX============================== */
-
-/*
- * Set/clear software interrupt routines.
- */
-
-LEAF(setsoftclock)
- mfc0 v0, COP_0_CAUSE_REG # read cause register
- nop
- or v0, v0, SOFT_INT_MASK_0 # set soft clock interrupt
- mtc0 v0, COP_0_CAUSE_REG # save it
- j ra
- nop
-END(setsoftclock)
-
-LEAF(clearsoftclock)
- mfc0 v0, COP_0_CAUSE_REG # read cause register
- nop
- and v0, v0, ~SOFT_INT_MASK_0 # clear soft clock interrupt
- mtc0 v0, COP_0_CAUSE_REG # save it
- j ra
- nop
-END(clearsoftclock)
-
-LEAF(setsoftnet)
- mfc0 v0, COP_0_CAUSE_REG # read cause register
- nop
- or v0, v0, SOFT_INT_MASK_1 # set soft net interrupt
- mtc0 v0, COP_0_CAUSE_REG # save it
- j ra
- nop
-END(setsoftnet)
-
-LEAF(clearsoftnet)
- mfc0 v0, COP_0_CAUSE_REG # read cause register
- nop
- and v0, v0, ~SOFT_INT_MASK_1 # clear soft net interrupt
- mtc0 v0, COP_0_CAUSE_REG # save it
- j ra
- nop
-END(clearsoftnet)
-
-/*
- * Set/change interrupt priority routines.
- */
-
-LEAF(CPU_EnableIntr)
- mfc0 v0, COP_0_STATUS_REG # read status register
- nop
- or v0, v0, SR_INT_ENAB
- mtc0 v0, COP_0_STATUS_REG # enable all interrupts
- j ra
- nop
-END(CPU_EnableIntr)
-
-LEAF(spl0)
- mfc0 v0, COP_0_STATUS_REG # read status register
- nop
- or t0, v0, (INT_MASK | SR_INT_ENAB)
- mtc0 t0, COP_0_STATUS_REG # enable all interrupts
- j ra
- and v0, v0, (INT_MASK | SR_INT_ENAB)
-END(spl0)
-
-LEAF(splsoftclock)
- mfc0 v0, COP_0_STATUS_REG # read status register
- li t0, ~SOFT_INT_MASK_0 # disable soft clock
- and t0, t0, v0
- mtc0 t0, COP_0_STATUS_REG # save it
- nop # 3 ins to disable
- j ra
- and v0, v0, (INT_MASK | SR_INT_ENAB)
-END(splsoftclock)
-
-LEAF(splsoftnet)
- mfc0 v0, COP_0_STATUS_REG # read status register
- li t0, ~(SOFT_INT_MASK_1|SOFT_INT_MASK_0)
- and t0, t0, v0
- mtc0 t0, COP_0_STATUS_REG # save it
- j ra
- and v0, v0, (INT_MASK | SR_INT_ENAB)
-END(splsoftnet)
-
-LEAF(CPU__spl0)
- mfc0 v0, COP_0_STATUS_REG # read status register
- li t0, ~(INT_MASK_0|SOFT_INT_MASK_1|SOFT_INT_MASK_0)
- and t0, t0, v0
- mtc0 t0, COP_0_STATUS_REG # save it
- nop # 3 ins to disable
- j ra
- and v0, v0, (INT_MASK | SR_INT_ENAB)
-END(CPU__spl0)
-
-LEAF(CPU__spl1)
- mfc0 v0, COP_0_STATUS_REG # read status register
- li t0, ~(INT_MASK_1|SOFT_INT_MASK_0|SOFT_INT_MASK_1)
- and t0, t0, v0
- mtc0 t0, COP_0_STATUS_REG # save it
- nop # 3 ins to disable
- j ra
- and v0, v0, (INT_MASK | SR_INT_ENAB)
-END(CPU__spl1)
-
-LEAF(CPU__spl2)
- mfc0 v0, COP_0_STATUS_REG # read status register
- li t0, ~(INT_MASK_2|SOFT_INT_MASK_1|SOFT_INT_MASK_0)
- and t0, t0, v0
- mtc0 t0, COP_0_STATUS_REG # save it
- nop # 3 ins to disable
- j ra
- and v0, v0, (INT_MASK | SR_INT_ENAB)
-END(CPU__spl2)
-
-LEAF(CPU__spl3)
- mfc0 v0, COP_0_STATUS_REG # read status register
- li t0, ~(INT_MASK_3|SOFT_INT_MASK_1|SOFT_INT_MASK_0)
- and t0, t0, v0
- mtc0 t0, COP_0_STATUS_REG # save it
- nop # 3 ins to disable
- j ra
- and v0, v0, (INT_MASK | SR_INT_ENAB)
-END(CPU__spl3)
-
-LEAF(CPU__spl4)
- mfc0 v0, COP_0_STATUS_REG # read status register
- li t0, ~(INT_MASK_4|SOFT_INT_MASK_1|SOFT_INT_MASK_0)
- and t0, t0, v0
- mtc0 t0, COP_0_STATUS_REG # save it
- nop # 3 ins to disable
- j ra
- and v0, v0, (INT_MASK | SR_INT_ENAB)
-END(CPU__spl4)
-
-LEAF(CPU__spl5)
- mfc0 v0, COP_0_STATUS_REG # read status register
- li t0, ~(INT_MASK_5|SOFT_INT_MASK_1|SOFT_INT_MASK_0)
- and t0, t0, v0
- mtc0 t0, COP_0_STATUS_REG # save it
- nop # 3 ins to disable
- j ra
- and v0, v0, (INT_MASK | SR_INT_ENAB)
-END(CPU__spl5)
-
-/*
- * We define an alternate entry point after mcount is called so it
- * can be used in mcount without causeing a recursive loop.
- */
-LEAF(splhigh)
-ALEAF(_splhigh)
- mfc0 v0, COP_0_STATUS_REG # read status register
- li t0, ~SR_INT_ENAB # disable all interrupts
- and t0, t0, v0
- mtc0 t0, COP_0_STATUS_REG # save it
- nop # 3 ins to disable
- j ra
- and v0, v0, (INT_MASK | SR_INT_ENAB)
-END(splhigh)
-
-/*
- * Restore saved interrupt mask.
- */
-LEAF(splx)
-ALEAF(_splx)
- mfc0 v0, COP_0_STATUS_REG
- li t0, ~(INT_MASK | SR_INT_ENAB)
- and t0, t0, v0
- or t0, t0, a0
- mtc0 t0, COP_0_STATUS_REG
- nop # 3 ins to disable
- j ra
- nop
-END(splx)
-
-/*----------------------------------------------------------------------------
- *
- * CPU_SwitchFPState --
- *
- * Save the current state into 'from' and restore it from 'to'.
- *
- * CPU_SwitchFPState(from, to)
- * struct proc *from;
- * struct user *to;
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-LEAF(CPU_SwitchFPState)
- mfc0 t1, COP_0_STATUS_REG # Save old SR
- li t0, SR_COP_1_BIT # enable the coprocessor
- mtc0 t0, COP_0_STATUS_REG
-
- beq a0, zero, 1f # skip save if NULL pointer
- nop
-/*
- * First read out the status register to make sure that all FP operations
- * have completed.
- */
- lw a0, P_ADDR(a0) # get pointer to pcb for proc
- cfc1 t0, FPC_CSR # stall til FP done
- cfc1 t0, FPC_CSR # now get status
- li t3, ~SR_COP_1_BIT
- lw t2, U_PCB_REGS+(PS * 4)(a0) # get CPU status register
- sw t0, U_PCB_FPREGS+(32 * 4)(a0) # save FP status
- and t2, t2, t3 # clear COP_1 enable bit
- sw t2, U_PCB_REGS+(PS * 4)(a0) # save new status register
-/*
- * Save the floating point registers.
- */
- swc1 $f0, U_PCB_FPREGS+(0 * 4)(a0)
- swc1 $f1, U_PCB_FPREGS+(1 * 4)(a0)
- swc1 $f2, U_PCB_FPREGS+(2 * 4)(a0)
- swc1 $f3, U_PCB_FPREGS+(3 * 4)(a0)
- swc1 $f4, U_PCB_FPREGS+(4 * 4)(a0)
- swc1 $f5, U_PCB_FPREGS+(5 * 4)(a0)
- swc1 $f6, U_PCB_FPREGS+(6 * 4)(a0)
- swc1 $f7, U_PCB_FPREGS+(7 * 4)(a0)
- swc1 $f8, U_PCB_FPREGS+(8 * 4)(a0)
- swc1 $f9, U_PCB_FPREGS+(9 * 4)(a0)
- swc1 $f10, U_PCB_FPREGS+(10 * 4)(a0)
- swc1 $f11, U_PCB_FPREGS+(11 * 4)(a0)
- swc1 $f12, U_PCB_FPREGS+(12 * 4)(a0)
- swc1 $f13, U_PCB_FPREGS+(13 * 4)(a0)
- swc1 $f14, U_PCB_FPREGS+(14 * 4)(a0)
- swc1 $f15, U_PCB_FPREGS+(15 * 4)(a0)
- swc1 $f16, U_PCB_FPREGS+(16 * 4)(a0)
- swc1 $f17, U_PCB_FPREGS+(17 * 4)(a0)
- swc1 $f18, U_PCB_FPREGS+(18 * 4)(a0)
- swc1 $f19, U_PCB_FPREGS+(19 * 4)(a0)
- swc1 $f20, U_PCB_FPREGS+(20 * 4)(a0)
- swc1 $f21, U_PCB_FPREGS+(21 * 4)(a0)
- swc1 $f22, U_PCB_FPREGS+(22 * 4)(a0)
- swc1 $f23, U_PCB_FPREGS+(23 * 4)(a0)
- swc1 $f24, U_PCB_FPREGS+(24 * 4)(a0)
- swc1 $f25, U_PCB_FPREGS+(25 * 4)(a0)
- swc1 $f26, U_PCB_FPREGS+(26 * 4)(a0)
- swc1 $f27, U_PCB_FPREGS+(27 * 4)(a0)
- swc1 $f28, U_PCB_FPREGS+(28 * 4)(a0)
- swc1 $f29, U_PCB_FPREGS+(29 * 4)(a0)
- swc1 $f30, U_PCB_FPREGS+(30 * 4)(a0)
- swc1 $f31, U_PCB_FPREGS+(31 * 4)(a0)
-
-1:
-/*
- * Restore the floating point registers.
- */
- lw t0, U_PCB_FPREGS+(32 * 4)(a1) # get status register
- lwc1 $f0, U_PCB_FPREGS+(0 * 4)(a1)
- lwc1 $f1, U_PCB_FPREGS+(1 * 4)(a1)
- lwc1 $f2, U_PCB_FPREGS+(2 * 4)(a1)
- lwc1 $f3, U_PCB_FPREGS+(3 * 4)(a1)
- lwc1 $f4, U_PCB_FPREGS+(4 * 4)(a1)
- lwc1 $f5, U_PCB_FPREGS+(5 * 4)(a1)
- lwc1 $f6, U_PCB_FPREGS+(6 * 4)(a1)
- lwc1 $f7, U_PCB_FPREGS+(7 * 4)(a1)
- lwc1 $f8, U_PCB_FPREGS+(8 * 4)(a1)
- lwc1 $f9, U_PCB_FPREGS+(9 * 4)(a1)
- lwc1 $f10, U_PCB_FPREGS+(10 * 4)(a1)
- lwc1 $f11, U_PCB_FPREGS+(11 * 4)(a1)
- lwc1 $f12, U_PCB_FPREGS+(12 * 4)(a1)
- lwc1 $f13, U_PCB_FPREGS+(13 * 4)(a1)
- lwc1 $f14, U_PCB_FPREGS+(14 * 4)(a1)
- lwc1 $f15, U_PCB_FPREGS+(15 * 4)(a1)
- lwc1 $f16, U_PCB_FPREGS+(16 * 4)(a1)
- lwc1 $f17, U_PCB_FPREGS+(17 * 4)(a1)
- lwc1 $f18, U_PCB_FPREGS+(18 * 4)(a1)
- lwc1 $f19, U_PCB_FPREGS+(19 * 4)(a1)
- lwc1 $f20, U_PCB_FPREGS+(20 * 4)(a1)
- lwc1 $f21, U_PCB_FPREGS+(21 * 4)(a1)
- lwc1 $f22, U_PCB_FPREGS+(22 * 4)(a1)
- lwc1 $f23, U_PCB_FPREGS+(23 * 4)(a1)
- lwc1 $f24, U_PCB_FPREGS+(24 * 4)(a1)
- lwc1 $f25, U_PCB_FPREGS+(25 * 4)(a1)
- lwc1 $f26, U_PCB_FPREGS+(26 * 4)(a1)
- lwc1 $f27, U_PCB_FPREGS+(27 * 4)(a1)
- lwc1 $f28, U_PCB_FPREGS+(28 * 4)(a1)
- lwc1 $f29, U_PCB_FPREGS+(29 * 4)(a1)
- lwc1 $f30, U_PCB_FPREGS+(30 * 4)(a1)
- lwc1 $f31, U_PCB_FPREGS+(31 * 4)(a1)
-
- and t0, t0, ~FPC_EXCEPTION_BITS
- ctc1 t0, FPC_CSR
- nop
-
- mtc0 t1, COP_0_STATUS_REG # Restore the status register.
- j ra
- nop
-END(CPU_SwitchFPState)
-
-/*----------------------------------------------------------------------------
- *
- * CPU_SaveCurFPState --
- *
- * Save the current floating point coprocessor state.
- *
- * CPU_SaveCurFPState(p)
- * struct proc *p;
- *
- * Results:
- * None.
- *
- * Side effects:
- * cpuFPCurProcPtr is cleared.
- *
- *----------------------------------------------------------------------------
- */
-LEAF(CPU_SaveCurFPState)
- lw a0, P_ADDR(a0) # get pointer to pcb for proc
- mfc0 t1, COP_0_STATUS_REG # Disable interrupts and
- li t0, SR_COP_1_BIT # enable the coprocessor
- mtc0 t0, COP_0_STATUS_REG
- sw zero, cpuFPCurProcPtr # indicate state has been saved
-/*
- * First read out the status register to make sure that all FP operations
- * have completed.
- */
- lw t2, U_PCB_REGS+(PS * 4)(a0) # get CPU status register
- li t3, ~SR_COP_1_BIT
- and t2, t2, t3 # clear COP_1 enable bit
- cfc1 t0, FPC_CSR # stall til FP done
- cfc1 t0, FPC_CSR # now get status
- sw t2, U_PCB_REGS+(PS * 4)(a0) # save new status register
- sw t0, U_PCB_FPREGS+(32 * 4)(a0) # save FP status
-/*
- * Save the floating point registers.
- */
- swc1 $f0, U_PCB_FPREGS+(0 * 4)(a0)
- swc1 $f1, U_PCB_FPREGS+(1 * 4)(a0)
- swc1 $f2, U_PCB_FPREGS+(2 * 4)(a0)
- swc1 $f3, U_PCB_FPREGS+(3 * 4)(a0)
- swc1 $f4, U_PCB_FPREGS+(4 * 4)(a0)
- swc1 $f5, U_PCB_FPREGS+(5 * 4)(a0)
- swc1 $f6, U_PCB_FPREGS+(6 * 4)(a0)
- swc1 $f7, U_PCB_FPREGS+(7 * 4)(a0)
- swc1 $f8, U_PCB_FPREGS+(8 * 4)(a0)
- swc1 $f9, U_PCB_FPREGS+(9 * 4)(a0)
- swc1 $f10, U_PCB_FPREGS+(10 * 4)(a0)
- swc1 $f11, U_PCB_FPREGS+(11 * 4)(a0)
- swc1 $f12, U_PCB_FPREGS+(12 * 4)(a0)
- swc1 $f13, U_PCB_FPREGS+(13 * 4)(a0)
- swc1 $f14, U_PCB_FPREGS+(14 * 4)(a0)
- swc1 $f15, U_PCB_FPREGS+(15 * 4)(a0)
- swc1 $f16, U_PCB_FPREGS+(16 * 4)(a0)
- swc1 $f17, U_PCB_FPREGS+(17 * 4)(a0)
- swc1 $f18, U_PCB_FPREGS+(18 * 4)(a0)
- swc1 $f19, U_PCB_FPREGS+(19 * 4)(a0)
- swc1 $f20, U_PCB_FPREGS+(20 * 4)(a0)
- swc1 $f21, U_PCB_FPREGS+(21 * 4)(a0)
- swc1 $f22, U_PCB_FPREGS+(22 * 4)(a0)
- swc1 $f23, U_PCB_FPREGS+(23 * 4)(a0)
- swc1 $f24, U_PCB_FPREGS+(24 * 4)(a0)
- swc1 $f25, U_PCB_FPREGS+(25 * 4)(a0)
- swc1 $f26, U_PCB_FPREGS+(26 * 4)(a0)
- swc1 $f27, U_PCB_FPREGS+(27 * 4)(a0)
- swc1 $f28, U_PCB_FPREGS+(28 * 4)(a0)
- swc1 $f29, U_PCB_FPREGS+(29 * 4)(a0)
- swc1 $f30, U_PCB_FPREGS+(30 * 4)(a0)
- swc1 $f31, U_PCB_FPREGS+(31 * 4)(a0)
-
- mtc0 t1, COP_0_STATUS_REG # Restore the status register.
- j ra
- nop
-END(CPU_SaveCurFPState)
-
-/*----------------------------------------------------------------------------
- *
- * CPU_FPTrap --
- *
- * Handle a floating point Trap.
- *
- * CPU_FPTrap(statusReg, causeReg, pc)
- * unsigned statusReg;
- * unsigned causeReg;
- * unsigned pc;
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------------
- */
-NON_LEAF(CPU_FPTrap, STAND_FRAME_SIZE, ra)
- subu sp, sp, STAND_FRAME_SIZE
- mfc0 t0, COP_0_STATUS_REG
- sw ra, STAND_RA_OFFSET(sp)
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
-
- or t1, t0, SR_COP_1_BIT
- mtc0 t1, COP_0_STATUS_REG
- nop
- nop
- nop
- nop
- cfc1 t1, FPC_CSR # stall til FP done
- cfc1 t1, FPC_CSR # now get status
- nop
- sll t2, t1, (31 - 17) # unimplemented operation?
- bgez t2, 3f # no, normal trap
- nop
-/*
- * We got an unimplemented operation trap so
- * fetch the instruction, compute the next PC and emulate the instruction.
- */
- bgez a1, 1f # Check the branch delay bit.
- nop
-/*
- * The instruction is in the branch delay slot so the branch will have to
- * be emulated to get the resulting PC.
- */
- sw a2, STAND_FRAME_SIZE + 8(sp)
- li a0, UADDR+U_PCB_REGS # first arg is ptr to CPU registers
- move a1, a2 # second arg is instruction PC
- move a2, t1 # third arg is floating point CSR
- jal CPU_EmulateBranch # compute PC after branch
- move a3, zero # fourth arg is FALSE
-/*
- * Now load the floating-point instruction in the branch delay slot
- * to be emulated.
- */
- lw a2, STAND_FRAME_SIZE + 8(sp) # restore EXC pc
- b 2f
- lw a0, 4(a2) # a0 = coproc instruction
-/*
- * This is not in the branch delay slot so calculate the resulting
- * PC (epc + 4) into v0 and continue to CPU_EmulateFP().
- */
-1:
- lw a0, 0(a2) # a0 = coproc instruction
- addu v0, a2, 4 # v0 = next pc
-2:
- sw v0, UADDR+U_PCB_REGS+(PC * 4) # save new pc
-/*
- * Check to see if the instruction to be emulated is a floating-point
- * instruction.
- */
- srl a3, a0, OPCODE_SHIFT
- beq a3, OPCODE_C1, 4f # this should never fail
- nop
-/*
- * Send a floating point exception signal to the current process.
- */
-3:
- lw a0, curproc # get current process
- cfc1 a2, FPC_CSR # code = FP execptions
- ctc1 zero, FPC_CSR # Clear exceptions
- jal trapsignal
- li a1, SIGFPE
- b FPReturn
- nop
-
-/*
- * Finally, we can call CPU_EmulateFP() where a0 is the instruction to emulate.
- */
-4:
- jal CPU_EmulateFP
- nop
-
-/*
- * Turn off the floating point coprocessor and return.
- */
-FPReturn:
- mfc0 t0, COP_0_STATUS_REG
- lw ra, STAND_RA_OFFSET(sp)
- and t0, t0, ~SR_COP_1_BIT
- mtc0 t0, COP_0_STATUS_REG
- j ra
- addu sp, sp, STAND_FRAME_SIZE
-END(CPU_FPTrap)
-
-#ifdef DEBUG
-/*
- * Read a long and return it.
- * Note: addresses can be unaligned!
- *
- * long
-L* mdbpeek(addr)
-L* caddt_t addr;
-L* {
-L* return (*(long *)addr);
-L* }
- */
-LEAF(mdbpeek)
- li v0, MDBERR
- sw v0, UADDR+U_PCB_ONFAULT
- and v0, a0, 3 # unaligned address?
- bne v0, zero, 1f
- nop
- b 2f
- lw v0, (a0) # aligned access
-1:
- LWHI v0, 0(a0) # get next 4 bytes (unaligned)
- LWLO v0, 3(a0)
-2:
- j ra # made it w/o errors
- sw zero, UADDR+U_PCB_ONFAULT
-mdberr:
- li v0, 1 # trap sends us here
- sw v0, mdbmkfault
- j ra
- nop
-END(mdbpeek)
-
-/*
- * Write a long to 'addr'.
- * Note: addresses can be unaligned!
- *
-L* void
-L* mdbpoke(addr, value)
-L* caddt_t addr;
-L* long value;
-L* {
-L* *(long *)addr = value;
-L* }
- */
-LEAF(mdbpoke)
- li v0, MDBERR
- sw v0, UADDR+U_PCB_ONFAULT
- and v0, a0, 3 # unaligned address?
- bne v0, zero, 1f
- nop
- b 2f
- sw a1, (a0) # aligned access
-1:
- SWHI a1, 0(a0) # store next 4 bytes (unaligned)
- SWLO a1, 3(a0)
- and a0, a0, ~3 # align address for cache flush
-2:
- sw zero, UADDR+U_PCB_ONFAULT
-#ifdef R4K
- b R4K_FlushICache # flush instruction cache
-#else
- b R3K_FlushICache # flush instruction cache
-#endif
- li a1, 8
-END(mdbpoke)
-
-/*
- * Save registers and state so we can do a 'mdbreset' (like longjmp) later.
- * Always returns zero.
- *
-L* int mdb_savearea[11];
-L*
-L* int
-L* mdbsetexit()
-L* {
-L* mdb_savearea[0] = 0;
-L* return (0);
-L* }
- */
- .comm mdb_savearea, (11 * 4)
-
-LEAF(mdbsetexit)
- la a0, mdb_savearea
- sw s0, 0(a0)
- sw s1, 4(a0)
- sw s2, 8(a0)
- sw s3, 12(a0)
- sw s4, 16(a0)
- sw s5, 20(a0)
- sw s6, 24(a0)
- sw s7, 28(a0)
- sw sp, 32(a0)
- sw s8, 36(a0)
- sw ra, 40(a0)
- j ra
- move v0, zero
-END(mdbsetexit)
-
-/*
- * Restore registers and state (like longjmp) and return x.
- *
-L* int
-L* mdbreset(x)
-L* {
-L* return (x);
-L* }
- */
-LEAF(mdbreset)
- la v0, mdb_savearea
- lw ra, 40(v0)
- lw s0, 0(v0)
- lw s1, 4(v0)
- lw s2, 8(v0)
- lw s3, 12(v0)
- lw s4, 16(v0)
- lw s5, 20(v0)
- lw s6, 24(v0)
- lw s7, 28(v0)
- lw sp, 32(v0)
- lw s8, 36(v0)
- j ra
- move v0, a0
-END(mdbreset)
-
-/*
- * Trap into the debugger.
- */
-LEAF(mdbpanic)
- break BREAK_SOVER_VAL
- j ra
- nop
-END(mdbpanic)
-#endif /* DEBUG */
-
-#ifdef DEBUG
-LEAF(cpu_getregs)
- sw sp, 0(a0)
- sw ra, 4(a0)
- j ra
- sw s8, 8(a0)
-END(cpu_getregs)
-#endif /* DEBUG */
-
-/*
- * Interrupt counters for vmstat.
- */
- .data
- .globl intrcnt
- .globl eintrcnt
- .globl intrnames
- .globl eintrnames
-led_sw:
- .byte 1
-intrnames:
- .asciiz "softclock"
- .asciiz "softnet"
- .asciiz "local_dma"
- .asciiz "local_dev"
- .asciiz "isa_dev"
- .asciiz "isa_nmi"
- .asciiz "clock"
- .asciiz "statclock"
-eintrnames:
- .align 3
-intrcnt:
- .word 0,0,0,0,0,0,0,0
-eintrcnt:
diff --git a/sys/arch/wgrisc/wgrisc/machdep.c b/sys/arch/wgrisc/wgrisc/machdep.c
deleted file mode 100644
index 355f6cb4f25..00000000000
--- a/sys/arch/wgrisc/wgrisc/machdep.c
+++ /dev/null
@@ -1,1092 +0,0 @@
-/* $OpenBSD: machdep.c,v 1.7 2000/04/11 02:44:32 pjanzen Exp $ */
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department, The Mach Operating System project at
- * Carnegie-Mellon University and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)machdep.c 8.3 (Berkeley) 1/12/94
- * $Id: machdep.c,v 1.7 2000/04/11 02:44:32 pjanzen Exp $
- */
-
-/* from: Utah Hdr: machdep.c 1.63 91/04/24 */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/signalvar.h>
-#include <sys/kernel.h>
-#include <sys/map.h>
-#include <sys/proc.h>
-#include <sys/buf.h>
-#include <sys/reboot.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/clist.h>
-#include <sys/timeout.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/msgbuf.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/user.h>
-#include <sys/exec.h>
-#include <sys/sysctl.h>
-#include <sys/mount.h>
-#include <sys/syscallargs.h>
-#ifdef SYSVSHM
-#include <sys/shm.h>
-#endif
-#ifdef SYSVSEM
-#include <sys/sem.h>
-#endif
-#ifdef SYSVMSG
-#include <sys/msg.h>
-#endif
-
-#include <vm/vm_kern.h>
-
-#include <machine/cpu.h>
-#include <machine/reg.h>
-#include <machine/pio.h>
-#include <machine/psl.h>
-#include <machine/pte.h>
-#include <machine/autoconf.h>
-#include <machine/memconf.h>
-
-#include <sys/exec_ecoff.h>
-
-#include <dev/cons.h>
-
-#include <wgrisc/wgrisc/wgrisctype.h>
-#include <wgrisc/riscbus/riscbus.h>
-
-extern struct consdev *cn_tab;
-
-/* the following is used externally (sysctl_hw) */
-char machine[] = "wgrisc"; /* cpu "architecture" */
-char cpu_model[30];
-
-vm_map_t buffer_map;
-
-/*
- * Declare these as initialized data so we can patch them.
- */
-int nswbuf = 0;
-#ifdef NBUF
-int nbuf = NBUF;
-#else
-int nbuf = 0;
-#endif
-#ifdef BUFPAGES
-int bufpages = BUFPAGES;
-#else
-int bufpages = 0;
-#endif
-int msgbufmapped = 0; /* set when safe to use msgbuf */
-int physmem; /* max supported memory, changes to actual */
-int cpucfg; /* Value of processor config register */
-int cputype; /* Mother board type */
-int ncpu = 1; /* At least one cpu in the system */
-int isa_io_base; /* Base address of ISA io port space */
-int isa_mem_base; /* Base address of ISA memory space */
-
-struct mem_descriptor mem_layout[MAXMEMSEGS];
-
-extern int Mach_spl0(), Mach_spl1(), Mach_spl2(), Mach_spl3();
-extern int Mach_spl4(), Mach_spl5(), splhigh();
-int (*Mach_splnet)() = splhigh;
-int (*Mach_splbio)() = splhigh;
-int (*Mach_splimp)() = splhigh;
-int (*Mach_spltty)() = splhigh;
-int (*Mach_splclock)() = splhigh;
-int (*Mach_splstatclock)() = splhigh;
-
-static void tlb_init_pica();
-static void tlb_init_tyne();
-
-
-/*
- * safepri is a safe priority for sleep to set for a spin-wait
- * during autoconfiguration or after a panic.
- */
-int safepri = PSL_LOWIPL;
-
-struct user *proc0paddr;
-struct proc nullproc; /* for use by swtch_exit() */
-
-/*
- * Do all the stuff that locore normally does before calling main().
- * Process arguments passed to us by the BOOT.
- * Reset mapping and set up mapping to hardware and init "wired" reg.
- * Return the first page address following the system.
- */
-mips_init(argc, argv, code)
- int argc;
- char *argv[];
- u_int code;
-{
- register char *cp;
- register int i;
- register unsigned firstaddr;
- register caddr_t sysend;
- caddr_t start;
- struct tlb tlb;
- extern char _ftext[], edata[], end[];
- int realmemsize;
- char nvdata[32];
-
- /* clear the BSS segment in OpenBSD code */
- sysend = (caddr_t)mips_round_page(end);
- bzero(edata, sysend - edata);
-
- /* Extract this from BBRAM environment variable */
- ReadNVram(&nvdata);
- realmemsize = nvdata[2];
- if (realmemsize > 36 || realmemsize < 8) {
- realmemsize = 36;
- }
-
- /* Initialize the CPU type */
- cputype = WGRISC9100;
- mem_layout[0].mem_start = 0;
- mem_layout[0].mem_size = mips_trunc_page(CACHED_TO_PHYS(_ftext));
- mem_layout[1].mem_start = CACHED_TO_PHYS((int)sysend);
- mem_layout[1].mem_size = 0x400000 - (int)(CACHED_TO_PHYS(sysend));
- physmem = 4096 * 1024;
-
- switch (realmemsize) {
- default:
- case 8: /* 8 MB (0 MB simm) */
- mem_layout[2].mem_start = 0x400000;
- mem_layout[2].mem_size = 0x400000;
- physmem += 4096 * 1024;
- break;
- case 12: /* 12 MB (4 MB simm) */
- mem_layout[2].mem_start = 0x400000;
- mem_layout[2].mem_size = 0x800000;
- physmem += 8192 * 1024;
- break;
- case 20: /* 20 MB (16MB SIMM + 0 in onboard Bank2) */
- mem_layout[2].mem_start =0x1000000;
- mem_layout[2].mem_size = 0x1000000;
- physmem += 16 * 1024 * 1024;
- break;
- case 24: /* 24 MB (16MB SIMM + 4 in onboard Bank2) */
- mem_layout[2].mem_start = 0x400000;
- mem_layout[2].mem_size = 0x400000;
- mem_layout[3].mem_start =0x1000000;
- mem_layout[3].mem_size = 0x1000000;
- physmem += 20 * 1024 * 1024;
- break;
- case 36: /* 36 MB (32MB SIMM and ignore bank2 onboard) */
- mem_layout[2].mem_start = 0x400000;
- mem_layout[2].mem_size = 0x2000000;
- physmem += 32768 * 1024;
- break;
- }
-
- switch (cputype) {
- case WGRISC9100:
- strcpy(cpu_model, "Willowglen RISC PC 9100");
- isa_io_base = RISC_ISA_IO_BASE;
- isa_mem_base = RISC_ISA_MEM_BASE;
-
- /*
- * Set up interrupt handling and I/O addresses.
- */
-#if 0 /* XXX FIXME */
- Mach_splnet = Mach_spl1;
- Mach_splbio = Mach_spl0;
- Mach_splimp = Mach_spl1;
- Mach_spltty = Mach_spl2;
- Mach_splstatclock = Mach_spl3;
-#endif
- break;
-
- default:
- boot(RB_HALT | RB_NOSYNC);
- }
- physmem = btoc(physmem);
-
- /* look at argv[0] and compute bootdev for autoconfig setup */
- makebootdev(argv[0]);
-
- /*
- * Look at arguments passed to us and compute boothowto.
- * Default to SINGLE and ASKNAME if no args.
- */
- boothowto = RB_SINGLE | RB_ASKNAME;
-#ifdef KADB
- boothowto |= RB_KDB;
-#endif
- if (argc > 1) {
- for (i = 1; i < argc; i++) {
- if(strncasecmp("osloadoptions=",argv[i],14) == 0) {
- for (cp = argv[i]+14; *cp; cp++) {
- switch (*cp) {
- case 'a': /* autoboot */
- boothowto &= ~RB_SINGLE;
- break;
-
- case 'd': /* use compiled in default root */
- boothowto |= RB_DFLTROOT;
- break;
-
- case 'm': /* mini root present in memory */
- boothowto |= RB_MINIROOT;
- break;
-
- case 'n': /* ask for names */
- boothowto |= RB_ASKNAME;
- break;
-
- case 'N': /* don't ask for names */
- boothowto &= ~RB_ASKNAME;
- break;
- }
-
- }
- }
- }
- }
-
-#ifdef MFS
- /*
- * Check to see if a mini-root was loaded into memory. It resides
- * at the start of the next page just after the end of BSS.
- */
- if (boothowto & RB_MINIROOT) {
- boothowto |= RB_DFLTROOT;
- sysend += mfs_initminiroot(sysend);
- }
-#endif
-
-#ifdef R4K
- R4K_SetWIRED(0);
- R4K_TLBFlush();
- R4K_SetWIRED(R4K_NUM_WIRED_ENTRIES);
-
- switch (cputype) {
- case ACER_PICA_61:
- tlb_init_pica();
- break;
- }
-
-#else
- R3K_TLBFlush();
-#endif
-
- /*
- * Init mapping for u page(s) for proc[0], pm_tlbpid 1.
- */
- sysend = (caddr_t)((int)sysend + 3 & -4);
- start = sysend;
- curproc->p_addr = proc0paddr = (struct user *)sysend;
- curproc->p_md.md_regs = proc0paddr->u_pcb.pcb_regs;
- firstaddr = CACHED_TO_PHYS(sysend);
- for (i = 0; i < UPAGES;) {
-#ifdef R4K
- tlb.tlb_mask = PG_SIZE_4K;
- tlb.tlb_hi = vad_to_vpn((UADDR + (i << PGSHIFT))) | 1;
- tlb.tlb_lo0 = vad_to_pfn(firstaddr) | PG_V | PG_M | PG_CACHED;
- tlb.tlb_lo1 = vad_to_pfn(firstaddr + NBPG) | PG_V | PG_M | PG_CACHED;
- curproc->p_md.md_upte[i] = tlb.tlb_lo0;
- curproc->p_md.md_upte[i+1] = tlb.tlb_lo1;
- R4K_TLBWriteIndexed(i,&tlb);
- firstaddr += NBPG * 2;
- i += 2;
- R4K_SetPID(1);
-#else
- R3K_TLBWriteIndexed(i,
- (UADDR + (i << PGSHIFT)) | (1 << R3K_PID_SHIFT),
- (curproc->p_md.md_upte[i] = firstaddr | PG_V | PG_M));
- firstaddr += NBPG;
- i += 1;
- R3K_SetPID(1);
-#endif
- }
- sysend += UPAGES * NBPG;
- sysend = (caddr_t)((int)sysend+3 & -4);
-
- /*
- * init nullproc for swtch_exit().
- * init mapping for u page(s), pm_tlbpid 0
- * This could be used for an idle process.
- */
- nullproc.p_addr = (struct user *)sysend;
- nullproc.p_md.md_regs = nullproc.p_addr->u_pcb.pcb_regs;
- bcopy("nullproc", nullproc.p_comm, sizeof("nullproc"));
- firstaddr = CACHED_TO_PHYS(sysend);
- for (i = 0; i < UPAGES; i+=2) {
- nullproc.p_md.md_upte[i] = vad_to_pfn(firstaddr) | PG_V | PG_M | PG_CACHED;
- nullproc.p_md.md_upte[i+1] = vad_to_pfn(firstaddr + NBPG) | PG_V | PG_M | PG_CACHED;
- firstaddr += NBPG * 2;
- }
- sysend += UPAGES * NBPG;
-
- /* clear pages for u areas */
- bzero(start, sysend - start);
-
- /*
- * Copy down exception vector code.
- */
- {
-#ifdef R4K
- extern char R4K_TLBMiss[], R4K_TLBMissEnd[];
- extern char R4K_Exception[], R4K_ExceptionEnd[];
-
- if (R4K_TLBMissEnd - R4K_TLBMiss > 0x80)
- panic("startup: TLB code too large");
- bcopy(R4K_TLBMiss, (char *)R4K_TLB_MISS_EXC_VEC,
- R4K_TLBMissEnd - R4K_TLBMiss);
- bcopy(R4K_Exception, (char *)R4K_GEN_EXC_VEC,
- R4K_ExceptionEnd - R4K_Exception);
-
- cpucfg = R4K_ConfigCache();
- R4K_FlushCache();
-#else
- extern char R3K_UTLBMiss[], R3K_UTLBMissEnd[];
- extern char R3K_Exception[], R3K_ExceptionEnd[];
- if (R3K_UTLBMissEnd - R3K_UTLBMiss > 0x80)
- panic("startup: TLB code too large");
- bcopy(R3K_UTLBMiss, (char *)R3K_TLB_MISS_EXC_VEC,
- R3K_UTLBMissEnd - R3K_UTLBMiss);
- bcopy(R3K_Exception, (char *)R3K_GEN_EXC_VEC,
- R3K_ExceptionEnd - R3K_Exception);
-
- cpucfg = R3K_ConfigCache();
- R3K_FlushCache();
-#endif
- }
-
- /*
- * Initialize error message buffer.
- */
- msgbufp = (struct msgbuf *)(sysend);
- sysend = (caddr_t)(sysend + (sizeof(struct msgbuf)));
- msgbufmapped = 1;
-
- /*
- * Allocate space for system data structures.
- * The first available kernel virtual address is in "sysend".
- * As pages of kernel virtual memory are allocated, "sysend"
- * is incremented.
- *
- * These data structures are allocated here instead of cpu_startup()
- * because physical memory is directly addressable. We don't have
- * to map these into virtual address space.
- */
- start = sysend;
-
-#define valloc(name, type, num) \
- (name) = (type *)sysend; sysend = (caddr_t)((name)+(num))
-#define valloclim(name, type, num, lim) \
- (name) = (type *)sysend; sysend = (caddr_t)((lim) = ((name)+(num)))
-#ifdef REAL_CLISTS
- valloc(cfree, struct cblock, nclist);
-#endif
- valloc(timeouts, struct timeout, ntimeout);
-#ifdef SYSVSHM
- valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
-#endif
-#ifdef SYSVSEM
- valloc(sema, struct semid_ds, seminfo.semmni);
- valloc(sem, struct sem, seminfo.semmns);
- /* This is pretty disgusting! */
- valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
-#endif
-#ifdef SYSVMSG
- valloc(msgpool, char, msginfo.msgmax);
- valloc(msgmaps, struct msgmap, msginfo.msgseg);
- valloc(msghdrs, struct msg, msginfo.msgtql);
- valloc(msqids, struct msqid_ds, msginfo.msgmni);
-#endif
-
- /*
- * Determine how many buffers to allocate.
- * We allocate more buffer space than the BSD standard of
- * using 10% of memory for the first 2 Meg, 5% of remaining.
- * We just allocate a flat 10%. Ensure a minimum of 16 buffers.
- * We allocate 1/2 as many swap buffer headers as file i/o buffers.
- */
- if (bufpages == 0)
- bufpages = physmem / 10 / CLSIZE;
- if (nbuf == 0) {
- nbuf = bufpages;
- if (nbuf < 16)
- nbuf = 16;
- }
- if (nswbuf == 0) {
- nswbuf = (nbuf / 2) &~ 1; /* force even */
- if (nswbuf > 256)
- nswbuf = 256; /* sanity */
- }
- valloc(swbuf, struct buf, nswbuf);
- valloc(buf, struct buf, nbuf);
-
- /*
- * Clear allocated memory.
- */
- bzero(start, sysend - start);
-
- /*
- * Initialize the virtual memory system.
- */
- pmap_bootstrap((vm_offset_t)sysend);
-}
-
-#if keep_for_future_r4k_machines
-void
-tlb_init_pica()
-{
- struct tlb tlb;
-
- tlb.tlb_mask = PG_SIZE_256K;
- tlb.tlb_hi = vad_to_vpn(R4030_V_LOCAL_IO_BASE);
- tlb.tlb_lo0 = vad_to_pfn(R4030_P_LOCAL_IO_BASE) | PG_IOPAGE;
- tlb.tlb_lo1 = vad_to_pfn(PICA_P_INT_SOURCE) | PG_IOPAGE;
- R4K_TLBWriteIndexed(1, &tlb);
-}
-#endif
-
-/*
- * Console initialization: called early on from main,
- * before vm init or startup. Do enough configuration
- * to choose and initialize a console.
- */
-void
-consinit()
-{
- static int initted;
-
- if (initted)
- return;
- initted = 1;
- cninit();
-}
-
-/*
- * cpu_startup: allocate memory for variable-sized tables,
- * initialize cpu, and do autoconfiguration.
- */
-void
-cpu_startup()
-{
- register unsigned i;
- register caddr_t v;
- int base, residual;
- vm_offset_t minaddr, maxaddr;
- vm_size_t size;
-#ifdef DEBUG
- extern int pmapdebug;
- int opmapdebug = pmapdebug;
-
- pmapdebug = 0; /* Shut up pmap debug during bootstrap */
-#endif
-
- /*
- * Good {morning,afternoon,evening,night}.
- */
- printf(version);
- printf("real mem = %d\n", ctob(physmem));
-
- /*
- * Allocate virtual address space for file I/O buffers.
- * Note they are different than the array of headers, 'buf',
- * and usually occupy more virtual memory than physical.
- */
- size = MAXBSIZE * nbuf;
- buffer_map = kmem_suballoc(kernel_map, (vm_offset_t *)&buffers,
- &maxaddr, size, TRUE);
- minaddr = (vm_offset_t)buffers;
- if (vm_map_find(buffer_map, vm_object_allocate(size), (vm_offset_t)0,
- &minaddr, size, FALSE) != KERN_SUCCESS)
- panic("startup: cannot allocate buffers");
- base = bufpages / nbuf;
- residual = bufpages % nbuf;
- for (i = 0; i < nbuf; i++) {
- vm_size_t curbufsize;
- vm_offset_t curbuf;
-
- /*
- * First <residual> buffers get (base+1) physical pages
- * allocated for them. The rest get (base) physical pages.
- *
- * The rest of each buffer occupies virtual space,
- * but has no physical memory allocated for it.
- */
- curbuf = (vm_offset_t)buffers + i * MAXBSIZE;
- curbufsize = CLBYTES * (i < residual ? base+1 : base);
- vm_map_pageable(buffer_map, curbuf, curbuf+curbufsize, FALSE);
- vm_map_simplify(buffer_map, curbuf);
- }
- /*
- * Allocate a submap for exec arguments. This map effectively
- * limits the number of processes exec'ing at any time.
- */
- exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
- 16 * NCARGS, TRUE);
- /*
- * Allocate a submap for physio
- */
- phys_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
- VM_PHYS_SIZE, TRUE);
-
- /*
- * Finally, allocate mbuf pool. Since mclrefcnt is an off-size
- * we use the more space efficient malloc in place of kmem_alloc.
- */
- mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES,
- M_MBUF, M_NOWAIT);
- bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES);
- mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
- VM_MBUF_SIZE, FALSE);
-
- timeout_init();
-
-#ifdef DEBUG
- pmapdebug = opmapdebug;
-#endif
- printf("avail mem = %d\n", ptoa(cnt.v_free_count));
- printf("using %d buffers containing %d bytes of memory\n",
- nbuf, bufpages * CLBYTES);
- /*
- * Set up CPU-specific registers, cache, etc.
- */
- initcpu();
-
- /*
- * Set up buffers, so they can be used to read disk labels.
- */
- bufinit();
-
- /*
- * Configure the system.
- */
- if (boothowto & RB_CONFIG) {
-#ifdef BOOT_CONFIG
- user_config();
-#else
- printf("kernel does not support -c; continuing..\n");
-#endif
- }
- configure();
-
- spl0(); /* safe to turn interrupts on now */
-}
-
-/*
- * machine dependent system variables.
- */
-cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
- int *name;
- u_int namelen;
- void *oldp;
- size_t *oldlenp;
- void *newp;
- size_t newlen;
- struct proc *p;
-{
- dev_t consdev;
-
- /* all sysctl names at this level are terminal */
- if (namelen != 1)
- return (ENOTDIR); /* overloaded */
-
- switch (name[0]) {
- case CPU_CONSDEV:
- if (cn_tab != NULL)
- consdev = cn_tab->cn_dev;
- else
- consdev = NODEV;
- return (sysctl_rdstruct(oldp, oldlenp, newp, &consdev,
- sizeof consdev));
- default:
- return (EOPNOTSUPP);
- }
- /* NOTREACHED */
-}
-
-/*
- * Set registers on exec.
- * Clear all registers except sp, pc.
- */
-void
-setregs(p, pack, stack, retval)
- register struct proc *p;
- struct exec_package *pack;
- u_long stack;
- register_t *retval;
-{
- extern struct proc *cpuFPCurProcPtr;
-
- bzero((caddr_t)p->p_md.md_regs, (FSR + 1) * sizeof(int));
- p->p_md.md_regs[SP] = stack;
- p->p_md.md_regs[PC] = pack->ep_entry & ~3;
- p->p_md.md_regs[T9] = pack->ep_entry & ~3; /* abicall req */
-#ifdef R4K
- p->p_md.md_regs[PS] = R4K_PSL_USERSET;
-#else
- p->p_md.md_regs[PS] = R3K_PSL_USERSET;
-#endif
- p->p_md.md_flags & ~MDP_FPUSED;
- if (cpuFPCurProcPtr == p)
- cpuFPCurProcPtr = (struct proc *)0;
- p->p_md.md_ss_addr = 0;
-}
-
-/*
- * WARNING: code in locore.s assumes the layout shown for sf_signum
- * thru sf_handler so... don't screw with them!
- */
-struct sigframe {
- int sf_signum; /* signo for handler */
- siginfo_t *sf_sip; /* pointer to siginfo_t */
- struct sigcontext *sf_scp; /* context ptr for handler */
- sig_t sf_handler; /* handler addr for u_sigc */
- struct sigcontext sf_sc; /* actual context */
- siginfo_t sf_si;
-};
-
-#ifdef DEBUG
-int sigdebug = 0;
-int sigpid = 0;
-#define SDB_FOLLOW 0x01
-#define SDB_KSTACK 0x02
-#define SDB_FPSTATE 0x04
-#endif
-
-/*
- * Send an interrupt to process.
- */
-void
-sendsig(catcher, sig, mask, code, type, val)
- sig_t catcher;
- int sig, mask;
- u_long code;
- int type;
- union sigval val;
-{
- register struct proc *p = curproc;
- register struct sigframe *fp;
- register int *regs;
- register struct sigacts *psp = p->p_sigacts;
- int oonstack, fsize;
- struct sigcontext ksc;
- extern char sigcode[], esigcode[];
-
- regs = p->p_md.md_regs;
- oonstack = psp->ps_sigstk.ss_flags & SA_ONSTACK;
- /*
- * Allocate and validate space for the signal handler
- * context. Note that if the stack is in data space, the
- * call to grow() is a nop, and the copyout()
- * will fail if the process has not already allocated
- * the space with a `brk'.
- */
- fsize = sizeof(struct sigframe);
- if (!(psp->ps_siginfo & sigmask(sig)))
- fsize -= sizeof(siginfo_t);
- if ((psp->ps_flags & SAS_ALTSTACK) &&
- (psp->ps_sigstk.ss_flags & SA_ONSTACK) == 0 &&
- (psp->ps_sigonstack & sigmask(sig))) {
- fp = (struct sigframe *)(psp->ps_sigstk.ss_sp +
- psp->ps_sigstk.ss_size - fsize);
- psp->ps_sigstk.ss_flags |= SA_ONSTACK;
- } else
- fp = (struct sigframe *)(regs[SP] - fsize);
- if ((unsigned)fp <= USRSTACK - ctob(p->p_vmspace->vm_ssize))
- (void)grow(p, (unsigned)fp);
-#ifdef DEBUG
- if ((sigdebug & SDB_FOLLOW) ||
- (sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
- printf("sendsig(%d): sig %d ssp %x usp %x scp %x\n",
- p->p_pid, sig, &oonstack, fp, &fp->sf_sc);
-#endif
- /*
- * Build the signal context to be used by sigreturn.
- */
- ksc.sc_onstack = oonstack;
- ksc.sc_mask = mask;
- ksc.sc_pc = regs[PC];
- ksc.mullo = regs[MULLO];
- ksc.mulhi = regs[MULHI];
- ksc.sc_regs[ZERO] = 0xACEDBADE; /* magic number */
- bcopy((caddr_t)&regs[1], (caddr_t)&ksc.sc_regs[1],
- sizeof(ksc.sc_regs) - sizeof(int));
- ksc.sc_fpused = p->p_md.md_flags & MDP_FPUSED;
- if (ksc.sc_fpused) {
- extern struct proc *cpuFPCurProcPtr;
-
- /* if FPU has current state, save it first */
- if (p == cpuFPCurProcPtr)
- CPU_SaveCurFPState(p);
- bcopy((caddr_t)&p->p_md.md_regs[F0], (caddr_t)ksc.sc_fpregs,
- sizeof(ksc.sc_fpregs));
- }
-
- if (psp->ps_siginfo & sigmask(sig)) {
- siginfo_t si;
-
- initsiginfo(&si, sig, code, type, val);
- if (copyout((caddr_t)&si, (caddr_t)&fp->sf_si, sizeof si))
- goto bail;
- }
-
- if (copyout((caddr_t)&ksc, (caddr_t)&fp->sf_sc, sizeof(ksc))) {
-bail:
- /*
- * Process has trashed its stack; give it an illegal
- * instruction to halt it in its tracks.
- */
- SIGACTION(p, SIGILL) = SIG_DFL;
- sig = sigmask(SIGILL);
- p->p_sigignore &= ~sig;
- p->p_sigcatch &= ~sig;
- p->p_sigmask &= ~sig;
- psignal(p, SIGILL);
- return;
- }
- /*
- * Build the argument list for the signal handler.
- */
- regs[A0] = sig;
- regs[A1] = (psp->ps_siginfo & sigmask(sig)) ? (int)&fp->sf_si : NULL;
- regs[A2] = (int)&fp->sf_sc;
- regs[A3] = (int)catcher;
-
- regs[PC] = (int)catcher;
- regs[T9] = (int)catcher;
- regs[SP] = (int)fp;
- /*
- * Signal trampoline code is at base of user stack.
- */
- regs[RA] = (int)PS_STRINGS - (esigcode - sigcode);
-#ifdef DEBUG
- if ((sigdebug & SDB_FOLLOW) ||
- (sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
- printf("sendsig(%d): sig %d returns\n",
- p->p_pid, sig);
-#endif
-}
-
-/*
- * System call to cleanup state after a signal
- * has been taken. Reset signal mask and
- * stack state from context left by sendsig (above).
- * Return to previous pc and psl as specified by
- * context left by sendsig. Check carefully to
- * make sure that the user has not modified the
- * psl to gain improper priviledges or to cause
- * a machine fault.
- */
-/* ARGSUSED */
-sys_sigreturn(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct sys_sigreturn_args /* {
- syscallarg(struct sigcontext *) sigcntxp;
- } */ *uap = v;
- register struct sigcontext *scp;
- register int *regs;
- struct sigcontext ksc;
- int error;
-
- scp = SCARG(uap, sigcntxp);
-#ifdef DEBUG
- if (sigdebug & SDB_FOLLOW)
- printf("sigreturn: pid %d, scp %x\n", p->p_pid, scp);
-#endif
- regs = p->p_md.md_regs;
- /*
- * Test and fetch the context structure.
- * We grab it all at once for speed.
- */
- error = copyin((caddr_t)scp, (caddr_t)&ksc, sizeof(ksc));
- if (error || ksc.sc_regs[ZERO] != 0xACEDBADE) {
-#ifdef DEBUG
- if (!(sigdebug & SDB_FOLLOW))
- printf("sigreturn: pid %d, scp %x\n", p->p_pid, scp);
- printf(" old sp %x ra %x pc %x\n",
- regs[SP], regs[RA], regs[PC]);
- printf(" new sp %x ra %x pc %x err %d z %x\n",
- ksc.sc_regs[SP], ksc.sc_regs[RA], ksc.sc_regs[PC],
- error, ksc.sc_regs[ZERO]);
-#endif
- return (EINVAL);
- }
- scp = &ksc;
- /*
- * Restore the user supplied information
- */
- if (scp->sc_onstack & 01)
- p->p_sigacts->ps_sigstk.ss_flags |= SA_ONSTACK;
- else
- p->p_sigacts->ps_sigstk.ss_flags &= ~SA_ONSTACK;
- p->p_sigmask = scp->sc_mask &~ sigcantmask;
- regs[PC] = scp->sc_pc;
- regs[MULLO] = scp->mullo;
- regs[MULHI] = scp->mulhi;
- bcopy((caddr_t)&scp->sc_regs[1], (caddr_t)&regs[1],
- sizeof(scp->sc_regs) - sizeof(int));
- if (scp->sc_fpused)
- bcopy((caddr_t)scp->sc_fpregs, (caddr_t)&p->p_md.md_regs[F0],
- sizeof(scp->sc_fpregs));
- return (EJUSTRETURN);
-}
-
-int waittime = -1;
-
-void
-boot(howto)
- register int howto;
-{
-
- /* take a snap shot before clobbering any registers */
- if (curproc)
- savectx(curproc->p_addr, 0);
-
-#ifdef DEBUG
- if (panicstr)
- stacktrace();
-#endif
-
- boothowto = howto;
- if ((howto & RB_NOSYNC) == 0 && waittime < 0) {
- extern struct proc proc0;
- /* fill curproc with live object */
- if (curproc == NULL)
- curproc = &proc0;
- /*
- * Synchronize the disks....
- */
- waittime = 0;
- vfs_shutdown();
-
- /*
- * If we've been adjusting the clock, the todr
- * will be out of synch; adjust it now.
- */
- resettodr();
- }
- (void) splhigh(); /* extreme priority */
- if (howto & RB_HALT) {
- printf("System halted.\n");
- while(1); /* Forever */
- }
- else {
- if (howto & RB_DUMP)
- dumpsys();
- printf("System restart.\n");
- delay(2000000);
- __asm__(" li $2, 0xbfc00000; jr $2; nop\n");
- while(1); /* Forever */
- }
- /*NOTREACHED*/
-}
-
-int dumpmag = (int)0x8fca0101; /* magic number for savecore */
-int dumpsize = 0; /* also for savecore */
-long dumplo = 0;
-
-dumpconf()
-{
- int nblks;
-
- dumpsize = physmem;
- if (dumpdev != NODEV && bdevsw[major(dumpdev)].d_psize) {
- nblks = (*bdevsw[major(dumpdev)].d_psize)(dumpdev);
- if (dumpsize > btoc(dbtob(nblks - dumplo)))
- dumpsize = btoc(dbtob(nblks - dumplo));
- else if (dumplo == 0)
- dumplo = nblks - btodb(ctob(physmem));
- }
- /*
- * Don't dump on the first CLBYTES (why CLBYTES?)
- * in case the dump device includes a disk label.
- */
- if (dumplo < btodb(CLBYTES))
- dumplo = btodb(CLBYTES);
-}
-
-/*
- * Doadump comes here after turning off memory management and
- * getting on the dump stack, either when called above, or by
- * the auto-restart code.
- */
-dumpsys()
-{
- int error;
-
- msgbufmapped = 0;
- if (dumpdev == NODEV)
- return;
- /*
- * For dumps during autoconfiguration,
- * if dump device has already configured...
- */
- if (dumpsize == 0)
- dumpconf();
- if (dumplo < 0)
- return;
- printf("\ndumping to dev %x, offset %d\n", dumpdev, dumplo);
- printf("dump ");
- switch (error = (*bdevsw[major(dumpdev)].d_dump)(dumpdev)) {
-
- case ENXIO:
- printf("device bad\n");
- break;
-
- case EFAULT:
- printf("device not ready\n");
- break;
-
- case EINVAL:
- printf("area improper\n");
- break;
-
- case EIO:
- printf("i/o error\n");
- break;
-
- default:
- printf("error %d\n", error);
- break;
-
- case 0:
- printf("succeeded\n");
- }
-}
-
-/*
- * Return the best possible estimate of the time in the timeval
- * to which tvp points. Unfortunately, we can't read the hardware registers.
- * We guarantee that the time will be greater than the value obtained by a
- * previous call.
- */
-void
-microtime(tvp)
- register struct timeval *tvp;
-{
- int s = splclock();
- static struct timeval lasttime;
-
- *tvp = time;
-#ifdef notdef
- tvp->tv_usec += clkread();
- while (tvp->tv_usec >= 1000000) {
- tvp->tv_sec++;
- tvp->tv_usec -= 1000000;
- }
-#endif
- if (tvp->tv_sec == lasttime.tv_sec &&
- tvp->tv_usec <= lasttime.tv_usec &&
- (tvp->tv_usec = lasttime.tv_usec + 1) >= 1000000) {
- tvp->tv_sec++;
- tvp->tv_usec -= 1000000;
- }
- lasttime = *tvp;
- splx(s);
-}
-
-initcpu()
-{
-
-}
-
-/*
- * Convert an ASCII string into an integer.
- */
-int
-atoi(s)
- char *s;
-{
- int c;
- unsigned base = 10, d;
- int neg = 0, val = 0;
-
- if (s == 0 || (c = *s++) == 0)
- goto out;
-
- /* skip spaces if any */
- while (c == ' ' || c == '\t')
- c = *s++;
-
- /* parse sign, allow more than one (compat) */
- while (c == '-') {
- neg = !neg;
- c = *s++;
- }
-
- /* parse base specification, if any */
- if (c == '0') {
- c = *s++;
- switch (c) {
- case 'X':
- case 'x':
- base = 16;
- c = *s++;
- break;
- case 'B':
- case 'b':
- base = 2;
- c = *s++;
- break;
- default:
- base = 8;
- }
- }
-
- /* parse number proper */
- for (;;) {
- if (c >= '0' && c <= '9')
- d = c - '0';
- else if (c >= 'a' && c <= 'z')
- d = c - 'a' + 10;
- else if (c >= 'A' && c <= 'Z')
- d = c - 'A' + 10;
- else
- break;
- val *= base;
- val += d;
- c = *s++;
- }
- if (neg)
- val = -val;
-out:
- return val;
-}
diff --git a/sys/arch/wgrisc/wgrisc/mainbus.c b/sys/arch/wgrisc/wgrisc/mainbus.c
deleted file mode 100644
index 1c91d8e3a82..00000000000
--- a/sys/arch/wgrisc/wgrisc/mainbus.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/* $OpenBSD: mainbus.c,v 1.1.1.1 1997/02/06 16:02:46 pefo Exp $ */
-
-/*
- * Copyright (c) 1996 Per Fogelstrom
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/reboot.h>
-
-#include <wgrisc/wgrisc/wgrisctype.h>
-#include <machine/autoconf.h>
-
-struct mainbus_softc {
- struct device sc_dv;
- struct abus sc_bus;
-};
-
-/* Definition of the mainbus driver. */
-static int mbmatch __P((struct device *, void *, void *));
-static void mbattach __P((struct device *, struct device *, void *));
-static int mbprint __P((void *, const char *));
-
-struct cfattach mainbus_ca = {
- sizeof(struct device), mbmatch, mbattach
-};
-struct cfdriver mainbus_cd = {
- NULL, "mainbus", DV_DULL, NULL, 0
-};
-
-void mb_intr_establish __P((struct confargs *, int (*)(void *), void *));
-void mb_intr_disestablish __P((struct confargs *));
-caddr_t mb_cvtaddr __P((struct confargs *));
-int mb_matchname __P((struct confargs *, char *));
-
-static int
-mbmatch(parent, cfdata, aux)
- struct device *parent;
- void *cfdata;
- void *aux;
-{
- struct cfdata *cf = cfdata;
-
- if (cf->cf_unit > 0)
- return(0);
- return(1);
-}
-
-static void
-mbattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct mainbus_softc *sc = (struct mainbus_softc *)self;
- struct confargs nca;
- extern int cputype, ncpus;
-
- printf("\n");
-
- sc->sc_bus.ab_dv = (struct device *)sc;
- sc->sc_bus.ab_type = BUS_MAIN;
- sc->sc_bus.ab_intr_establish = mb_intr_establish;
- sc->sc_bus.ab_intr_disestablish = mb_intr_disestablish;
- sc->sc_bus.ab_cvtaddr = mb_cvtaddr;
- sc->sc_bus.ab_matchname = mb_matchname;
-
- nca.ca_name = "cpu";
- nca.ca_slot = 0;
- nca.ca_offset = 0;
- nca.ca_bus = &sc->sc_bus;
- config_found(self, &nca, mbprint);
-
- nca.ca_name = "riscbus";
- nca.ca_slot = 0;
- nca.ca_offset = 0;
- nca.ca_bus = &sc->sc_bus;
- config_found(self, &nca, mbprint);
-
- nca.ca_name = "isabr";
- nca.ca_slot = 0;
- nca.ca_offset = 0;
- nca.ca_bus = &sc->sc_bus;
- config_found(self, &nca, mbprint);
-}
-
-static int
-mbprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
-
- if (pnp)
- return (QUIET);
- return (UNCONF);
-}
-
-void
-mb_intr_establish(ca, handler, val)
- struct confargs *ca;
- int (*handler) __P((void *));
- void *val;
-{
-
- panic("can never mb_intr_establish");
-}
-
-void
-mb_intr_disestablish(ca)
- struct confargs *ca;
-{
-
- panic("can never mb_intr_disestablish");
-}
-
-caddr_t
-mb_cvtaddr(ca)
- struct confargs *ca;
-{
-
- return (NULL);
-}
-
-int
-mb_matchname(ca, name)
- struct confargs *ca;
- char *name;
-{
-
- return (strcmp(name, ca->ca_name) == 0);
-}
diff --git a/sys/arch/wgrisc/wgrisc/mem.c b/sys/arch/wgrisc/wgrisc/mem.c
deleted file mode 100644
index e1da82b1857..00000000000
--- a/sys/arch/wgrisc/wgrisc/mem.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/* $OpenBSD: mem.c,v 1.5 2001/01/31 22:39:44 jason Exp $ */
-/* $NetBSD: mem.c,v 1.6 1995/04/10 11:55:03 mycroft Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)mem.c 8.3 (Berkeley) 1/12/94
- */
-
-/*
- * Memory special file
- */
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/buf.h>
-#include <sys/msgbuf.h>
-#include <sys/systm.h>
-#include <sys/uio.h>
-#include <sys/malloc.h>
-
-#include <machine/cpu.h>
-
-#include <vm/vm.h>
-
-extern vm_offset_t avail_end;
-caddr_t zeropage;
-
-/*ARGSUSED*/
-int
-mmopen(dev, flag, mode)
- dev_t dev;
- int flag, mode;
-{
-
- switch (minor(dev)) {
- case 0:
- case 1:
- case 2:
- case 3:
- case 12:
- return (0);
- default:
- return (ENXIO);
- }
-}
-
-/*ARGSUSED*/
-int
-mmclose(dev, flag, mode)
- dev_t dev;
- int flag, mode;
-{
-
- return (0);
-}
-
-/*ARGSUSED*/
-int
-mmrw(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- register vm_offset_t o, v;
- register int c;
- register struct iovec *iov;
- int error = 0;
-
- while (uio->uio_resid > 0 && error == 0) {
- iov = uio->uio_iov;
- if (iov->iov_len == 0) {
- uio->uio_iov++;
- uio->uio_iovcnt--;
- if (uio->uio_iovcnt < 0)
- panic("mmrw");
- continue;
- }
- switch (minor(dev)) {
-
-/* minor device 0 is physical memory */
- case 0:
- v = uio->uio_offset;
- c = iov->iov_len;
- if (v + c > ctob(physmem))
- return (EFAULT);
- v += CACHED_MEMORY_ADDR;
- error = uiomove((caddr_t)v, c, uio);
- continue;
-
-/* minor device 1 is kernel memory */
- case 1:
- v = uio->uio_offset;
- c = min(iov->iov_len, MAXPHYS);
- if (v < CACHED_MEMORY_ADDR)
- return (EFAULT);
- if (v + c > PHYS_TO_CACHED(avail_end +
- sizeof (struct msgbuf)) &&
- (v < KSEG2_ADDR ||
- !kernacc((caddr_t)v, c,
- uio->uio_rw == UIO_READ ? B_READ : B_WRITE)))
- return (EFAULT);
-
- error = uiomove((caddr_t)v, c, uio);
- continue;
-
-/* minor device 2 is EOF/RATHOLE */
- case 2:
- if (uio->uio_rw == UIO_WRITE)
- uio->uio_resid = 0;
- return (0);
-
- case 3:
- mdbpanic();
- return(0);
-
-/* minor device 12 (/dev/zero) is source of nulls on read, rathole on write */
- case 12:
- if (uio->uio_rw == UIO_WRITE) {
- c = iov->iov_len;
- break;
- }
- if (zeropage == NULL) {
- zeropage = (caddr_t)
- malloc(CLBYTES, M_TEMP, M_WAITOK);
- bzero(zeropage, CLBYTES);
- }
- c = min(iov->iov_len, CLBYTES);
- error = uiomove(zeropage, c, uio);
- continue;
-
- default:
- return (ENXIO);
- }
- if (error)
- break;
- iov->iov_base += c;
- iov->iov_len -= c;
- uio->uio_offset += c;
- uio->uio_resid -= c;
- }
- return (error);
-}
-
-int
-mmmmap(dev, off, prot)
- dev_t dev;
- int off, prot;
-{
- return (-1);
-}
-
-/*ARGSUSED*/
-int
-mmioctl(dev, cmd, data, flags, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flags;
- struct proc *p;
-{
- return (EOPNOTSUPP);
-}
diff --git a/sys/arch/wgrisc/wgrisc/minidebug.c b/sys/arch/wgrisc/wgrisc/minidebug.c
deleted file mode 100644
index 45b14a958f5..00000000000
--- a/sys/arch/wgrisc/wgrisc/minidebug.c
+++ /dev/null
@@ -1,975 +0,0 @@
-/* $OpenBSD: minidebug.c,v 1.1.1.1 1997/02/06 16:02:46 pefo Exp $ */
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)kadb.c 8.1 (Berkeley) 6/10/93
- * $Id: minidebug.c,v 1.1.1.1 1997/02/06 16:02:46 pefo Exp $
- */
-
-/*
- * Define machine dependent primitives for mdb.
- */
-
-#include <sys/types.h>
-#include <machine/pte.h>
-#include <vm/vm_prot.h>
-#undef SP
-#include <machine/cpu.h>
-#include <machine/reg.h>
-#include <machine/pcb.h>
-#include <machine/trap.h>
-#include <machine/mips_opcode.h>
-
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif
-
-#ifdef R4K
-#define FlushDCache(a,s) R4K_FlushDCache(a,s)
-#define FlushICache(a,s) R4K_FlushICache(a,s)
-#define FlushCache() R4K_FlushCache()
-#define TLBFlush() R4K_TLBFlush()
-#else
-#define FlushDCache(a,s) R3K_FlushDCache(a,s)
-#define FlushICache(a,s) R3K_FlushICache(a,s)
-#define FlushCache() R3K_FlushCache()
-#define TLBFlush() R3K_TLBFlush()
-#endif
-
-void mips_dump_tlb(int, int);
-
-static char *op_name[64] = {
-/* 0 */ "spec", "bcond","j", "jal", "beq", "bne", "blez", "bgtz",
-/* 8 */ "addi", "addiu","slti", "sltiu","andi", "ori", "xori", "lui",
-/*16 */ "cop0", "cop1", "cop2", "cop3", "beql", "bnel", "blezl","bgtzl",
-/*24 */ "daddi","daddiu","ldl", "ldr", "op34", "op35", "op36", "op37",
-/*32 */ "lb", "lh", "lwl", "lw", "lbu", "lhu", "lwr", "lwu",
-/*40 */ "sb", "sh", "swl", "sw", "sdl", "sdr", "swr", "cache",
-/*48 */ "ll", "lwc1", "lwc2", "lwc3", "lld", "ldc1", "ldc2", "ld",
-/*56 */ "sc", "swc1", "swc2", "swc3", "scd", "sdc1", "sdc2", "sd"
-};
-
-static char *spec_name[64] = {
-/* 0 */ "sll", "spec01","srl", "sra", "sllv", "spec05","srlv","srav",
-/* 8 */ "jr", "jalr", "spec12","spec13","syscall","break","spec16","sync",
-/*16 */ "mfhi", "mthi", "mflo", "mtlo", "dsllv","spec25","dsrlv","dsrav",
-/*24 */ "mult", "multu","div", "divu", "dmult","dmultu","ddiv","ddivu",
-/*32 */ "add", "addu", "sub", "subu", "and", "or", "xor", "nor",
-/*40 */ "spec50","spec51","slt","sltu", "dadd","daddu","dsub","dsubu",
-/*48 */ "tge","tgeu","tlt","tltu","teq","spec65","tne","spec67",
-/*56 */ "dsll","spec71","dsrl","dsra","dsll32","spec75","dsrl32","dsra32"
-};
-
-static char *bcond_name[32] = {
-/* 0 */ "bltz", "bgez", "bltzl", "bgezl", "?", "?", "?", "?",
-/* 8 */ "tgei", "tgeiu", "tlti", "tltiu", "teqi", "?", "tnei", "?",
-/*16 */ "bltzal", "bgezal", "bltzall", "bgezall", "?", "?", "?", "?",
-/*24 */ "?", "?", "?", "?", "?", "?", "?", "?",
-};
-
-static char *cop1_name[64] = {
-/* 0 */ "fadd", "fsub", "fmpy", "fdiv", "fsqrt","fabs", "fmov", "fneg",
-/* 8 */ "fop08","fop09","fop0a","fop0b","fop0c","fop0d","fop0e","fop0f",
-/*16 */ "fop10","fop11","fop12","fop13","fop14","fop15","fop16","fop17",
-/*24 */ "fop18","fop19","fop1a","fop1b","fop1c","fop1d","fop1e","fop1f",
-/*32 */ "fcvts","fcvtd","fcvte","fop23","fcvtw","fop25","fop26","fop27",
-/*40 */ "fop28","fop29","fop2a","fop2b","fop2c","fop2d","fop2e","fop2f",
-/*48 */ "fcmp.f","fcmp.un","fcmp.eq","fcmp.ueq","fcmp.olt","fcmp.ult",
- "fcmp.ole","fcmp.ule",
-/*56 */ "fcmp.sf","fcmp.ngle","fcmp.seq","fcmp.ngl","fcmp.lt","fcmp.nge",
- "fcmp.le","fcmp.ngt"
-};
-
-static char *fmt_name[16] = {
- "s", "d", "e", "fmt3",
- "w", "fmt5", "fmt6", "fmt7",
- "fmt8", "fmt9", "fmta", "fmtb",
- "fmtc", "fmtd", "fmte", "fmtf"
-};
-
-static char *reg_name[32] = {
- "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
- "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
- "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
- "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra"
-};
-
-static char *c0_opname[64] = {
- "c0op00","tlbr", "tlbwi", "c0op03","c0op04","c0op05","tlbwr", "c0op07",
- "tlbp", "c0op11","c0op12","c0op13","c0op14","c0op15","c0op16","c0op17",
- "rfe", "c0op21","c0op22","c0op23","c0op24","c0op25","c0op26","c0op27",
- "eret","c0op31","c0op32","c0op33","c0op34","c0op35","c0op36","c0op37",
- "c0op40","c0op41","c0op42","c0op43","c0op44","c0op45","c0op46","c0op47",
- "c0op50","c0op51","c0op52","c0op53","c0op54","c0op55","c0op56","c0op57",
- "c0op60","c0op61","c0op62","c0op63","c0op64","c0op65","c0op66","c0op67",
- "c0op70","c0op71","c0op72","c0op73","c0op74","c0op75","c0op77","c0op77",
-};
-
-static char *c0_reg[32] = {
- "index","random","tlblo0","tlblo1","context","tlbmask","wired","c0r7",
- "badvaddr","count","tlbhi","c0r11","sr","cause","epc", "prid",
- "config","lladr","watchlo","watchhi","xcontext","c0r21","c0r22","c0r23",
- "c0r24","c0r25","ecc","cacheerr","taglo","taghi","errepc","c0r31"
-};
-
-extern char *trap_type[];
-
-struct pcb mdbpcb;
-int mdbmkfault;
-
-#define MAXBRK 10
-struct brk {
- int inst;
- int addr;
-} brk_tab[MAXBRK];
-
-/*
- * Mini debugger for kernel.
- */
-int gethex(u_int *val, u_int dotval)
-{
- u_int c;
-
- *val = 0;
- while((c = cngetc()) != '\e' && c != '\n' && c != '\r') {
- if(c >= '0' && c <= '9') {
- *val = (*val << 4) + c - '0';
- cnputc(c);
- }
- else if(c >= 'a' && c <= 'f') {
- *val = (*val << 4) + c - 'a' + 10;
- cnputc(c);
- }
- else if(c == '\b') {
- *val = *val >> 4;
- printf("\b \b");
- }
- else if(c == ',') {
- cnputc(c);
- return(c);
- }
- else if(c == '.') {
- *val = dotval;;
- cnputc(c);
- }
- }
- if(c == '\r')
- c = '\n';
- return(c);
-}
-
-void dump(u_int *addr, u_int size)
-{
- int cnt;
-
- cnt = 0;
-
- size = (size + 3) / 4;
- while(size--) {
- if((cnt++ & 3) == 0)
- printf("\n%08x: ",(int)addr);
- printf("%08x ",*addr++);
- }
-}
-
-void print_regs()
-{
- printf("\n");
- printf("T0-7 %08x %08x %08x %08x %08x %08x %08x %08x\n",
- mdbpcb.pcb_regs[T0],mdbpcb.pcb_regs[T1],
- mdbpcb.pcb_regs[T2],mdbpcb.pcb_regs[T3],
- mdbpcb.pcb_regs[T4],mdbpcb.pcb_regs[T5],
- mdbpcb.pcb_regs[T6],mdbpcb.pcb_regs[T7]);
- printf("T8-9 %08x %08x A0-4 %08x %08x %08x %08x\n",
- mdbpcb.pcb_regs[T8],mdbpcb.pcb_regs[T9],
- mdbpcb.pcb_regs[A0],mdbpcb.pcb_regs[A1],
- mdbpcb.pcb_regs[A2],mdbpcb.pcb_regs[A3]);
- printf("S0-7 %08x %08x %08x %08x %08x %08x %08x %08x\n",
- mdbpcb.pcb_regs[S0],mdbpcb.pcb_regs[S1],
- mdbpcb.pcb_regs[S2],mdbpcb.pcb_regs[S3],
- mdbpcb.pcb_regs[S4],mdbpcb.pcb_regs[S5],
- mdbpcb.pcb_regs[S6],mdbpcb.pcb_regs[S7]);
- printf(" S8 %08x V0-1 %08x %08x GP %08x SP %08x\n",
- mdbpcb.pcb_regs[S8],mdbpcb.pcb_regs[V0],
- mdbpcb.pcb_regs[V1],mdbpcb.pcb_regs[GP],
- mdbpcb.pcb_regs[SP]);
- printf(" AT %08x PC %08x RA %08x SR %08x",
- mdbpcb.pcb_regs[AST],mdbpcb.pcb_regs[PC],
- mdbpcb.pcb_regs[RA],mdbpcb.pcb_regs[SR]);
-}
-
-set_break(va)
-{
- int i;
-
- va = va & ~3;
- for(i = 0; i < MAXBRK; i++) {
- if(brk_tab[i].addr == 0) {
- brk_tab[i].addr = va;
- brk_tab[i].inst = *(u_int *)va;
- return;
- }
- }
- printf(" Break table full!!");
-}
-
-del_break(va)
-{
- int i;
-
- va = va & ~3;
- for(i = 0; i < MAXBRK; i++) {
- if(brk_tab[i].addr == va) {
- brk_tab[i].addr = 0;
- return;
- }
- }
- printf(" Break to remove not found!!");
-}
-
-break_insert()
-{
- int i;
-
- for(i = 0; i < MAXBRK; i++) {
- if(brk_tab[i].addr != 0) {
- brk_tab[i].inst = *(u_int *)brk_tab[i].addr;
- *(u_int *)brk_tab[i].addr = BREAK_BRKPT;
- FlushDCache(brk_tab[i].addr,4);
- FlushICache(brk_tab[i].addr,4);
- }
- }
-}
-
-break_restore()
-{
- int i;
-
- for(i = 0; i < MAXBRK; i++) {
- if(brk_tab[i].addr != 0) {
- *(u_int *)brk_tab[i].addr = brk_tab[i].inst;
- FlushDCache(brk_tab[i].addr,4);
- FlushICache(brk_tab[i].addr,4);
- }
- }
-}
-
-break_find(va)
-{
- int i;
-
- for(i = 0; i < MAXBRK; i++) {
- if(brk_tab[i].addr == va) {
- return(i);
- }
- }
- return(-1);
-}
-
-prt_break()
-{
- int i;
-
- for(i = 0; i < MAXBRK; i++) {
- if(brk_tab[i].addr != 0) {
- printf("\n %08x\t", brk_tab[i].addr);
- mdbprintins(brk_tab[i].inst, brk_tab[i].addr);
- }
- }
-}
-mdb(causeReg, vadr, p, kernelmode)
-{
- int c;
- int newaddr;
- int size;
- int cause;
-static int ssandrun; /* Single step and run flag (when cont at brk) */
-
- splhigh();
- cause = (causeReg & CR_EXC_CODE) >> CR_EXC_CODE_SHIFT;
- newaddr = (int)(mdbpcb.pcb_regs[PC]);
- switch(cause) {
- case T_BREAK:
- if(*(int *)newaddr == BREAK_SOVER) {
- break_restore();
- mdbpcb.pcb_regs[PC] += 4;
- printf("\nStop break (panic)\n# ");
- printf(" %08x\t",newaddr);
- mdbprintins(*(int *)newaddr, newaddr);
- printf("\n# ");
- break;
- }
- if(*(int *)newaddr == BREAK_BRKPT) {
- break_restore();
- printf("\rBRK %08x\t",newaddr);
- if(mdbprintins(*(int *)newaddr, newaddr)) {
- newaddr += 4;
- printf("\n %08x\t",newaddr);
- mdbprintins(*(int *)newaddr, newaddr);
- }
- printf("\n# ");
- break;
- }
- if(mdbclrsstep(causeReg)) {
- if(ssandrun) { /* Step over bp before free run */
- ssandrun = 0;
- break_insert();
- return(TRUE);
- }
- printf("\r %08x\t",newaddr);
- if(mdbprintins(*(int *)newaddr, newaddr)) {
- newaddr += 4;
- printf("\n %08x\t",newaddr);
- mdbprintins(*(int *)newaddr, newaddr);
- }
- printf("\n# ");
- }
- break;
-
- default:
- printf("\n-- %s --\n# ",trap_type[cause]);
- }
- ssandrun = 0;
- break_restore();
-
- while(c = cngetc()) {
- switch(c) {
- case 'T':
- trapDump("Debugger");
- break;
- case 'b':
- printf("break-");
- c = cngetc();
- switch(c) {
- case 's':
- printf("set at ");
- c = gethex(&newaddr, newaddr);
- if(c != '\e') {
- set_break(newaddr);
- }
- break;
-
- case 'd':
- printf("delete at ");
- c = gethex(&newaddr, newaddr);
- if(c != '\e') {
- del_break(newaddr);
- }
- break;
-
- case 'p':
- printf("print");
- prt_break();
- break;
- }
- break;
-
- case 'r':
- print_regs();
- break;
-
- case 'I':
- printf("Instruction at ");
- c = gethex(&newaddr, newaddr);
- while(c != '\e') {
- printf("\n %08x\t",newaddr);
- mdbprintins(*(int *)newaddr, newaddr);
- newaddr += 4;
- c = cngetc();
- }
- break;
-
- case 'c':
- printf("continue");
- if(break_find((int)(mdbpcb.pcb_regs[PC])) >= 0) {
- ssandrun = 1;
- mdbsetsstep();
- }
- else {
- break_insert();
- }
- return(TRUE);
- case 'S':
- printf("Stack traceback:\n");
- stacktrace();
- return(TRUE);
- case 's':
- set_break(mdbpcb.pcb_regs[PC] + 8);
- return(TRUE);
- case ' ':
- mdbsetsstep();
- return(TRUE);
-
- case 'd':
- printf("dump ");
- c = gethex(&newaddr, newaddr);
- if(c == ',') {
- c = gethex(&size,256);
- }
- else {
- size = 16;
- }
- if(c == '\n' && newaddr != 0) {
- dump((u_int *)newaddr, size);
- newaddr += size;
- }
- break;
-
- case 'm':
- printf("mod ");
- c = gethex(&newaddr, newaddr);
- while(c == ',') {
- c = gethex(&size, 0);
- if(c != '\e')
- *((u_int *)newaddr)++ = size;
- }
- break;
-
- case 'i':
- printf("in-");
- c = cngetc();
- switch(c) {
- case 'b':
- printf("byte ");
- c = gethex(&newaddr, newaddr);
- if(c == '\n') {
- printf("= %02x",
- *(u_char *)newaddr);
- }
- break;
- case 'h':
- printf("halfword ");
- c = gethex(&newaddr, newaddr);
- if(c == '\n') {
- printf("= %04x",
- *(u_short *)newaddr);
- }
- break;
- case 'w':
- printf("word ");
- c = gethex(&newaddr, newaddr);
- if(c == '\n') {
- printf("= %08x",
- *(u_int *)newaddr);
- }
- break;
- }
- break;
-
- case 'o':
- printf("out-");
- c = cngetc();
- switch(c) {
- case 'b':
- printf("byte ");
- c = gethex(&newaddr, newaddr);
- if(c == ',') {
- c = gethex(&size, 0);
- if(c == '\n') {
- *(u_char *)newaddr = size;
- }
- }
- break;
- case 'h':
- printf("halfword ");
- c = gethex(&newaddr, newaddr);
- if(c == ',') {
- c = gethex(&size, 0);
- if(c == '\n') {
- *(u_short *)newaddr = size;
- }
- }
- break;
- case 'w':
- printf("word ");
- c = gethex(&newaddr, newaddr);
- if(c == ',') {
- c = gethex(&size, 0);
- if(c == '\n') {
- *(u_int *)newaddr = size;
- }
- }
- break;
- }
- break;
-
- case 't':
- printf("tlb-dump\n");
- mips_dump_tlb(0,23);
- (void)cngetc();
- mips_dump_tlb(24,47);
- break;
-
- case 'f':
- printf("flush-");
- c = cngetc();
- switch(c) {
- case 't':
- printf("tlb");
- TLBFlush();
- break;
-
- case 'c':
- printf("cache");
- FlushCache();
- break;
- }
- break;
-
- default:
- cnputc('\a');
- break;
- }
- printf("\n# ");
- }
-}
-
-u_int mdb_ss_addr;
-u_int mdb_ss_instr;
-
-mdbsetsstep()
-{
- register u_int va;
- register int *locr0 = mdbpcb.pcb_regs;
- int i;
-
- /* compute next address after current location */
- if(mdbpeek(locr0[PC]) != 0) {
- va = CPU_EmulateBranch(locr0, locr0[PC], 0, mdbpeek(locr0[PC]));
- }
- else {
- va = locr0[PC] + 4;
- }
- if (mdb_ss_addr) {
- printf("mdbsetsstep: breakpoint already set at %x (va %x)\n",
- mdb_ss_addr, va);
- return;
- }
- mdb_ss_addr = va;
-
- if ((int)va < 0) {
- /* kernel address */
- mdb_ss_instr = mdbpeek(va);
- mdbpoke((caddr_t)va, BREAK_SSTEP);
- FlushDCache(va,4);
- FlushICache(va,4);
- return;
- }
-}
-
-mdbclrsstep(cr)
- int cr;
-{
- register u_int pc, va;
- u_int instr;
-
- /* fix pc if break instruction is in the delay slot */
- pc = mdbpcb.pcb_regs[PC];
- if (cr < 0)
- pc += 4;
-
- /* check to be sure its the one we are expecting */
- va = mdb_ss_addr;
- if (!va || va != pc)
- return(FALSE);
-
- /* read break instruction */
- instr = mdbpeek(va);
- if (instr != BREAK_SSTEP)
- return(FALSE);
-
- if ((int)va < 0) {
- /* kernel address */
- mdbpoke((caddr_t)va, mdb_ss_instr);
- FlushDCache(va,4);
- FlushICache(va,4);
- mdb_ss_addr = 0;
- return(TRUE);
- }
-
- printf("can't clear break at %x\n", va);
- mdb_ss_addr = 0;
- return(FALSE);
-}
-
-void
-mdbreadc(lp)
- char *lp;
-{
- int c;
-
- c = cngetc();
- if (c == '\r')
- c = '\n';
- *lp = c;
-}
-
-void
-mdbwrite(lp, len)
- char *lp;
- int len;
-{
- while (len-- > 0)
- cnputc(*lp++);
-}
-
-/* ARGSUSED */
-mdbprintins(ins, mdbdot)
-{
- InstFmt i;
- int delay = 0;
-
- i.word = ins;
-
- switch (i.JType.op) {
- case OP_SPECIAL:
- if (i.word == 0) {
- printf("nop");
- break;
- }
- if (i.RType.func == OP_ADDU && i.RType.rt == 0) {
- printf("move\t%s,%s",
- reg_name[i.RType.rd],
- reg_name[i.RType.rs]);
- break;
- }
- printf("%s", spec_name[i.RType.func]);
- switch (i.RType.func) {
- case OP_SLL:
- case OP_SRL:
- case OP_SRA:
- case OP_DSLL:
- case OP_DSRL:
- case OP_DSRA:
- case OP_DSLL32:
- case OP_DSRL32:
- case OP_DSRA32:
- printf("\t%s,%s,%d",
- reg_name[i.RType.rd],
- reg_name[i.RType.rt],
- i.RType.shamt);
- break;
-
- case OP_SLLV:
- case OP_SRLV:
- case OP_SRAV:
- case OP_DSLLV:
- case OP_DSRLV:
- case OP_DSRAV:
- printf("\t%s,%s,%s",
- reg_name[i.RType.rd],
- reg_name[i.RType.rt],
- reg_name[i.RType.rs]);
- break;
-
- case OP_MFHI:
- case OP_MFLO:
- printf("\t%s", reg_name[i.RType.rd]);
- break;
-
- case OP_JR:
- case OP_JALR:
- delay = 1;
- /* FALLTHROUGH */
- case OP_MTLO:
- case OP_MTHI:
- printf("\t%s", reg_name[i.RType.rs]);
- break;
-
- case OP_MULT:
- case OP_MULTU:
- case OP_DMULT:
- case OP_DMULTU:
- case OP_DIV:
- case OP_DIVU:
- case OP_DDIV:
- case OP_DDIVU:
- printf("\t%s,%s",
- reg_name[i.RType.rs],
- reg_name[i.RType.rt]);
- break;
-
- case OP_SYSCALL:
- case OP_SYNC:
- break;
-
- case OP_BREAK:
- printf("\t%d", (i.RType.rs << 5) | i.RType.rt);
- break;
-
- default:
- printf("\t%s,%s,%s",
- reg_name[i.RType.rd],
- reg_name[i.RType.rs],
- reg_name[i.RType.rt]);
- };
- break;
-
- case OP_BCOND:
- printf("%s\t%s,", bcond_name[i.IType.rt],
- reg_name[i.IType.rs]);
- goto pr_displ;
-
- case OP_BLEZ:
- case OP_BLEZL:
- case OP_BGTZ:
- case OP_BGTZL:
- printf("%s\t%s,", op_name[i.IType.op],
- reg_name[i.IType.rs]);
- goto pr_displ;
-
- case OP_BEQ:
- case OP_BEQL:
- if (i.IType.rs == 0 && i.IType.rt == 0) {
- printf("b\t");
- goto pr_displ;
- }
- /* FALLTHROUGH */
- case OP_BNE:
- case OP_BNEL:
- printf("%s\t%s,%s,", op_name[i.IType.op],
- reg_name[i.IType.rs],
- reg_name[i.IType.rt]);
- pr_displ:
- delay = 1;
- printf("0x%08x", mdbdot + 4 + ((short)i.IType.imm << 2));
- break;
-
- case OP_COP0:
- switch (i.RType.rs) {
- case OP_BCx:
- case OP_BCy:
- printf("bc0%c\t",
- "ft"[i.RType.rt & COPz_BC_TF_MASK]);
- goto pr_displ;
-
- case OP_MT:
- printf("mtc0\t%s,%s",
- reg_name[i.RType.rt],
- c0_reg[i.RType.rd]);
- break;
-
- case OP_DMT:
- printf("dmtc0\t%s,%s",
- reg_name[i.RType.rt],
- c0_reg[i.RType.rd]);
- break;
-
- case OP_MF:
- printf("mfc0\t%s,%s",
- reg_name[i.RType.rt],
- c0_reg[i.RType.rd]);
- break;
-
- case OP_DMF:
- printf("dmfc0\t%s,%s",
- reg_name[i.RType.rt],
- c0_reg[i.RType.rd]);
- break;
-
- default:
- printf("%s", c0_opname[i.FRType.func]);
- };
- break;
-
- case OP_COP1:
- switch (i.RType.rs) {
- case OP_BCx:
- case OP_BCy:
- printf("bc1%c\t",
- "ft"[i.RType.rt & COPz_BC_TF_MASK]);
- goto pr_displ;
-
- case OP_MT:
- printf("mtc1\t%s,f%d",
- reg_name[i.RType.rt],
- i.RType.rd);
- break;
-
- case OP_MF:
- printf("mfc1\t%s,f%d",
- reg_name[i.RType.rt],
- i.RType.rd);
- break;
-
- case OP_CT:
- printf("ctc1\t%s,f%d",
- reg_name[i.RType.rt],
- i.RType.rd);
- break;
-
- case OP_CF:
- printf("cfc1\t%s,f%d",
- reg_name[i.RType.rt],
- i.RType.rd);
- break;
-
- default:
- printf("%s.%s\tf%d,f%d,f%d",
- cop1_name[i.FRType.func],
- fmt_name[i.FRType.fmt],
- i.FRType.fd, i.FRType.fs, i.FRType.ft);
- };
- break;
-
- case OP_J:
- case OP_JAL:
- printf("%s\t", op_name[i.JType.op]);
- printf("0x%8x",(mdbdot & 0xF0000000) | (i.JType.target << 2));
- delay = 1;
- break;
-
- case OP_LWC1:
- case OP_SWC1:
- printf("%s\tf%d,", op_name[i.IType.op],
- i.IType.rt);
- goto loadstore;
-
- case OP_LB:
- case OP_LH:
- case OP_LW:
- case OP_LD:
- case OP_LBU:
- case OP_LHU:
- case OP_LWU:
- case OP_SB:
- case OP_SH:
- case OP_SW:
- case OP_SD:
- printf("%s\t%s,", op_name[i.IType.op],
- reg_name[i.IType.rt]);
- loadstore:
- printf("%d(%s)", (short)i.IType.imm,
- reg_name[i.IType.rs]);
- break;
-
- case OP_ORI:
- case OP_XORI:
- if (i.IType.rs == 0) {
- printf("li\t%s,0x%x",
- reg_name[i.IType.rt],
- i.IType.imm);
- break;
- }
- /* FALLTHROUGH */
- case OP_ANDI:
- printf("%s\t%s,%s,0x%x", op_name[i.IType.op],
- reg_name[i.IType.rt],
- reg_name[i.IType.rs],
- i.IType.imm);
- break;
-
- case OP_LUI:
- printf("%s\t%s,0x%x", op_name[i.IType.op],
- reg_name[i.IType.rt],
- i.IType.imm);
- break;
-
- case OP_ADDI:
- case OP_DADDI:
- case OP_ADDIU:
- case OP_DADDIU:
- if (i.IType.rs == 0) {
- printf("li\t%s,%d",
- reg_name[i.IType.rt],
- (short)i.IType.imm);
- break;
- }
- /* FALLTHROUGH */
- default:
- printf("%s\t%s,%s,%d", op_name[i.IType.op],
- reg_name[i.IType.rt],
- reg_name[i.IType.rs],
- (short)i.IType.imm);
- }
- return(delay);
-}
-
-#define MIPS_JR_RA 0x03e00008 /* instruction code for jr ra */
-
-/*
- * Very simple memory allocator for mdb.
- */
-char *
-mdbmalloc(size)
- int size;
-{
- static char buffer[4096];
- static char *bufp = buffer;
- char *p;
-
- /* round size up to sizeof(int) */
- size = (size + sizeof(int) - 1) & ~(sizeof(int) - 1);
- p = bufp;
- bufp = p + size;
- return (p);
-}
-
-/*
- * Dump TLB contents.
- */
-void mips_dump_tlb(int first,int last)
-{
- int tlbno;
- struct tlb tlb;
-
- tlbno = first;
-
-#ifdef R4K
- while(tlbno <= last) {
- R4K_TLBRead(tlbno, &tlb);
- if(tlb.tlb_lo0 & PG_V || tlb.tlb_lo1 & PG_V) {
- printf("TLB %2d vad 0x%08x ", tlbno, tlb.tlb_hi);
- }
- else {
- printf("TLB*%2d vad 0x%08x ", tlbno, tlb.tlb_hi);
- }
- printf("0=0x%08x ", pfn_to_vad(tlb.tlb_lo0));
- printf("%c", tlb.tlb_lo0 & PG_M ? 'M' : ' ');
- printf("%c", tlb.tlb_lo0 & PG_G ? 'G' : ' ');
- printf(" atr %x ", (tlb.tlb_lo0 >> 3) & 7);
- printf("1=0x%08x ", pfn_to_vad(tlb.tlb_lo1));
- printf("%c", tlb.tlb_lo1 & PG_M ? 'M' : ' ');
- printf("%c", tlb.tlb_lo1 & PG_G ? 'G' : ' ');
- printf(" atr %x ", (tlb.tlb_lo1 >> 3) & 7);
- printf(" sz=%x\n", tlb.tlb_mask);
-
- tlbno++;
- }
-#else
- printf("dumptlb not implemented for r3k yet, sorry.\n");
-#endif
-}
diff --git a/sys/arch/wgrisc/wgrisc/pmap.c b/sys/arch/wgrisc/wgrisc/pmap.c
deleted file mode 100644
index 7adde022f35..00000000000
--- a/sys/arch/wgrisc/wgrisc/pmap.c
+++ /dev/null
@@ -1,1825 +0,0 @@
-/* $OpenBSD: pmap.c,v 1.2 1998/03/01 00:37:51 niklas Exp $ */
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)pmap.c 8.4 (Berkeley) 1/26/94
- * $Id: pmap.c,v 1.2 1998/03/01 00:37:51 niklas Exp $
- */
-
-/*
- * Manages physical address maps.
- *
- * In addition to hardware address maps, this
- * module is called upon to provide software-use-only
- * maps which may or may not be stored in the same
- * form as hardware maps. These pseudo-maps are
- * used to store intermediate results from copy
- * operations to and from address spaces.
- *
- * Since the information managed by this module is
- * also stored by the logical address mapping module,
- * this module may throw away valid virtual-to-physical
- * mappings at almost any time. However, invalidations
- * of virtual-to-physical mappings must be done as
- * requested.
- *
- * In order to cope with hardware architectures which
- * make virtual-to-physical map invalidates expensive,
- * this module may delay invalidate or reduced protection
- * operations until such time as they are actually
- * necessary. This module is given full information as
- * to which processors are currently using which maps,
- * and to when physical maps must be made correct.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/malloc.h>
-#include <sys/user.h>
-#include <sys/buf.h>
-#ifdef SYSVSHM
-#include <sys/shm.h>
-#endif
-
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-#include <vm/vm_pageout.h>
-
-#include <machine/cpu.h>
-#include <machine/pte.h>
-#include <machine/memconf.h>
-
-extern vm_page_t vm_page_alloc1 __P((void));
-extern void vm_page_free1 __P((vm_page_t));
-
-/*
- * For each vm_page_t, there is a list of all currently valid virtual
- * mappings of that page. An entry is a pv_entry_t, the list is pv_table.
- * XXX really should do this as a part of the higher level code.
- */
-typedef struct pv_entry {
- struct pv_entry *pv_next; /* next pv_entry */
- struct pmap *pv_pmap; /* pmap where mapping lies */
- vm_offset_t pv_va; /* virtual address for mapping */
- int pv_flags; /* Some flags for the mapping */
-} *pv_entry_t;
-#define PV_UNCACHED 0x0001 /* Page is mapped unchached */
-
-pv_entry_t pv_table; /* array of entries, one per page */
-int pmap_remove_pv();
-
-#ifdef MACHINE_NONCONTIG
-static vm_offset_t avail_next;
-static vm_offset_t avail_remaining;
-
-struct physseg {
- vm_offset_t start;
- vm_offset_t end;
- int first_page;
-} physsegs[MAXMEMSEGS+1];
-
-#define pa_index(pa) pmap_page_index(pa)
-
-#else
-#define pa_index(pa) atop((pa) - first_phys_addr)
-#endif /* MACHINE_NONCONTIG */
-
-#define pa_to_pvh(pa) (&pv_table[pa_index(pa)])
-
-#ifdef DEBUG
-struct {
- int kernel; /* entering kernel mapping */
- int user; /* entering user mapping */
- int ptpneeded; /* needed to allocate a PT page */
- int pwchange; /* no mapping change, just wiring or protection */
- int wchange; /* no mapping change, just wiring */
- int mchange; /* was mapped but mapping to different page */
- int managed; /* a managed page */
- int firstpv; /* first mapping for this PA */
- int secondpv; /* second mapping for this PA */
- int ci; /* cache inhibited */
- int unmanaged; /* not a managed page */
- int flushes; /* cache flushes */
- int cachehit; /* new entry forced valid entry out */
-} enter_stats;
-struct {
- int calls;
- int removes;
- int flushes;
- int pidflushes; /* HW pid stolen */
- int pvfirst;
- int pvsearch;
-} remove_stats;
-
-#define PDB_FOLLOW 0x0001
-#define PDB_INIT 0x0002
-#define PDB_ENTER 0x0004
-#define PDB_REMOVE 0x0008
-#define PDB_CREATE 0x0010
-#define PDB_PTPAGE 0x0020
-#define PDB_PVENTRY 0x0040
-#define PDB_BITS 0x0080
-#define PDB_COLLECT 0x0100
-#define PDB_PROTECT 0x0200
-#define PDB_TLBPID 0x0400
-#define PDB_PARANOIA 0x2000
-#define PDB_WIRING 0x4000
-#define PDB_PVDUMP 0x8000
-
-extern int _ftext[];
-extern int _end[];
-int pmapdebug = 0x0;
-
-#endif /* DEBUG */
-
-struct pmap kernel_pmap_store;
-
-vm_offset_t avail_start; /* PA of first available physical page */
-vm_offset_t avail_end; /* PA of last available physical page */
-vm_size_t mem_size; /* memory size in bytes */
-vm_offset_t virtual_avail; /* VA of first avail page (after kernel bss)*/
-vm_offset_t virtual_end; /* VA of last avail page (end of kernel AS) */
-#ifdef ATTR
-char *pmap_attributes; /* reference and modify bits */
-#endif
-struct segtab *free_segtab; /* free list kept locally */
-u_int tlbpid_gen = 1; /* TLB PID generation count */
-int tlbpid_cnt = 2; /* next available TLB PID */
-pt_entry_t *Sysmap; /* kernel pte table */
-u_int Sysmapsize; /* number of pte's in Sysmap */
-
-/*
- * Bootstrap the system enough to run with virtual memory.
- * firstaddr is the first unused kseg0 address (not page aligned).
- */
-void
-pmap_bootstrap(firstaddr)
- vm_offset_t firstaddr;
-{
- register int i, n, nextpage;
- register pt_entry_t *spte;
- struct physseg *pseg;
- vm_offset_t start = firstaddr;
- extern int physmem;
-
-#define valloc(name, type, num) \
- (name) = (type *)firstaddr; firstaddr = (vm_offset_t)((name)+(num))
- /*
- * Allocate a PTE table for the kernel.
- * The '1024' comes from PAGER_MAP_SIZE in vm_pager_init().
- * This should be kept in sync.
- * We also reserve space for kmem_alloc_pageable() for vm_fork().
- */
- Sysmapsize = (VM_KMEM_SIZE + VM_MBUF_SIZE + VM_PHYS_SIZE +
- nbuf * MAXBSIZE + 16 * NCARGS) / NBPG + 1024 + 256;
- Sysmapsize += maxproc * UPAGES * 2;
-#ifdef SYSVSHM
- Sysmapsize += shminfo.shmall;
-#endif
- valloc(Sysmap, pt_entry_t, Sysmapsize);
-#ifdef ATTR
- valloc(pmap_attributes, char, physmem);
-#endif
- /*
- * Allocate memory for pv_table.
- * This will allocate more entries than we really need.
- * We could do this in pmap_init when we know the actual
- * phys_start and phys_end but its better to use kseg0 addresses
- * rather than kernel virtual addresses mapped through the TLB.
- */
-#ifdef MACHINE_NONCONTIG
- i = 0;
- for( n = 0; n < MAXMEMSEGS; n++) {
- i += mips_btop(mem_layout[n].mem_size);
- }
-#else
- i = physmem - mips_btop(CACHED_TO_PHYS(firstaddr));
-#endif /*MACHINE_NONCONTIG*/
- valloc(pv_table, struct pv_entry, i);
-
- /*
- * Clear allocated memory.
- */
- firstaddr = mips_round_page(firstaddr);
- bzero((caddr_t)start, firstaddr - start);
-
- avail_start = CACHED_TO_PHYS(firstaddr);
- avail_end = mips_ptob(physmem);
-
-#ifdef MACHINE_NONCONTIG
- avail_remaining = 0;
- nextpage = 0;
-
- /*
- * Now set up memory areas. Be careful to remove areas used
- * for the OS and for exception vector stuff.
- */
- pseg = &physsegs[0];
-
- for( i = 0; i < MAXMEMSEGS; i++) {
- /* Adjust for the kernel exeption vectors and sys data area */
- if(mem_layout[i].mem_start < 0x20000) {
- if((mem_layout[i].mem_start + mem_layout[i].mem_size) < 0x8000)
- continue; /* To small skip it */
- mem_layout[i].mem_size -= 0x20000 - mem_layout[i].mem_start;
- mem_layout[i].mem_start = 0x20000; /* Adjust to be above vec's */
- }
- /* Adjust for the kernel expansion area (bufs etc) */
- if((mem_layout[i].mem_start + mem_layout[i].mem_size > CACHED_TO_PHYS(_ftext)) &&
- (mem_layout[i].mem_start < CACHED_TO_PHYS(avail_start))) {
- mem_layout[i].mem_size -= CACHED_TO_PHYS(avail_start) - mem_layout[i].mem_start;
- mem_layout[i].mem_start = CACHED_TO_PHYS(avail_start);
- }
-
- if(mem_layout[i].mem_size == 0)
- continue;
-
- pseg->start = mem_layout[i].mem_start;
- pseg->end = pseg->start + mem_layout[i].mem_size;
- pseg->first_page = nextpage;
- nextpage += (pseg->end - pseg->start) / NBPG;
- avail_remaining += (pseg->end - pseg->start) / NBPG;
- pseg++;
- }
-
- avail_next = physsegs[0].start;
-
-#endif /* MACHINE_NONCONTIG */
-
- virtual_avail = VM_MIN_KERNEL_ADDRESS;
- virtual_end = VM_MIN_KERNEL_ADDRESS + Sysmapsize * NBPG;
- /* XXX need to decide how to set cnt.v_page_size */
-
- simple_lock_init(&pmap_kernel()->pm_lock);
- pmap_kernel()->pm_count = 1;
-
- /*
- * The R4?00 stores only one copy of the Global bit in the
- * translation lookaside buffer for each 2 page entry.
- * Thus invalid entrys must have the Global bit set so
- * when Entry LO and Entry HI G bits are anded together
- * they will produce a global bit to store in the tlb.
- */
- for(i = 0, spte = Sysmap; i < Sysmapsize; i++, spte++)
- spte->pt_entry = PG_G;
-}
-
-/*
- * Bootstrap memory allocator. This function allows for early dynamic
- * memory allocation until the virtual memory system has been bootstrapped.
- * After that point, either kmem_alloc or malloc should be used. This
- * function works by stealing pages from the (to be) managed page pool,
- * stealing virtual address space, then mapping the pages and zeroing them.
- *
- * It should be used from pmap_bootstrap till vm_page_startup, afterwards
- * it cannot be used, and will generate a panic if tried. Note that this
- * memory will never be freed, and in essence it is wired down.
- */
-void *
-pmap_bootstrap_alloc(size)
- int size;
-{
- vm_offset_t val;
- extern boolean_t vm_page_startup_initialized;
-
- if (vm_page_startup_initialized)
- panic("pmap_bootstrap_alloc: called after startup initialized");
-
- val = PHYS_TO_CACHED(avail_start);
- size = round_page(size);
- avail_start += size;
-
- blkclr((caddr_t)val, size);
- return ((void *)val);
-}
-
-/*
- * Initialize the pmap module.
- * Called by vm_init, to initialize any structures that the pmap
- * system needs to map virtual memory.
- */
-void
-#ifdef MACHINE_NONCONTIG
-pmap_init()
-#else
-pmap_init(phys_start, phys_end)
- vm_offset_t phys_start, phys_end;
-#endif
-{
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_INIT))
-#ifdef MACHINE_NONCONTIG
- printf("pmap_init(%lx, %lx)\n", avail_start, avail_end);
-#else
- printf("pmap_init(%lx, %lx)\n", phys_start, phys_end);
-#endif
-#endif /*DEBUG*/
-}
-
-#ifdef MACHINE_NONCONTIG
-inline int
-pmap_page_index(pa)
- vm_offset_t pa;
-{
- struct physseg *ps = &physsegs[0];
- while (ps->start) {
- if(pa >= ps->start && pa < ps->end) {
- return(atop(pa - ps->start) + ps->first_page);
- }
- ps++;
- }
- return -1;
-}
-
-unsigned int
-pmap_free_pages()
-{
- return avail_remaining;
-}
-
-void
-pmap_virtual_space(startp, endp)
- vm_offset_t *startp;
- vm_offset_t *endp;
-{
- *startp = virtual_avail;
- *endp = virtual_end;
-}
-
-int
-pmap_next_page(p_addr)
- vm_offset_t *p_addr;
-{
- static int cur_seg = 0;
-
- if (physsegs[cur_seg].start == 0)
- return FALSE;
- if (avail_next == physsegs[cur_seg].end) {
- avail_next = physsegs[++cur_seg].start;
- }
-
- if (avail_next == 0)
- return FALSE;
- *p_addr = avail_next;
- avail_next += NBPG;
- avail_remaining--;
- return TRUE;
-}
-#endif /*MACHINE_NONCONTIG*/
-
-/*
- * Create and return a physical map.
- *
- * If the size specified for the map
- * is zero, the map is an actual physical
- * map, and may be referenced by the
- * hardware.
- *
- * If the size specified is non-zero,
- * the map will be used in software only, and
- * is bounded by that size.
- */
-pmap_t
-pmap_create(size)
- vm_size_t size;
-{
- register pmap_t pmap;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- printf("pmap_create(%x)\n", size);
-#endif
- /*
- * Software use map does not need a pmap
- */
- if (size)
- return (NULL);
-
- /* XXX: is it ok to wait here? */
- pmap = (pmap_t) malloc(sizeof *pmap, M_VMPMAP, M_WAITOK);
-#ifdef notifwewait
- if (pmap == NULL)
- panic("pmap_create: cannot allocate a pmap");
-#endif
- bzero(pmap, sizeof(*pmap));
- pmap_pinit(pmap);
- return (pmap);
-}
-
-/*
- * Initialize a preallocated and zeroed pmap structure,
- * such as one in a vmspace structure.
- */
-void
-pmap_pinit(pmap)
- register struct pmap *pmap;
-{
- register int i;
- int s;
- extern struct vmspace vmspace0;
- extern struct user *proc0paddr;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- printf("pmap_pinit(%x)\n", pmap);
-#endif
- simple_lock_init(&pmap->pm_lock);
- pmap->pm_count = 1;
- if (free_segtab) {
- s = splimp();
- pmap->pm_segtab = free_segtab;
- free_segtab = *(struct segtab **)free_segtab;
- pmap->pm_segtab->seg_tab[0] = NULL;
- splx(s);
- } else {
- register struct segtab *stp;
- vm_page_t mem;
- void pmap_zero_page();
-
- do {
- mem = vm_page_alloc1();
- if (mem == NULL) {
- /* XXX What else can we do? Deadlocks? */
- vm_wait("ppinit");
- }
- } while (mem == NULL);
-
- pmap_zero_page(VM_PAGE_TO_PHYS(mem));
- pmap->pm_segtab = stp = (struct segtab *)
- PHYS_TO_CACHED(VM_PAGE_TO_PHYS(mem));
- i = NBPG / sizeof(struct segtab);
- s = splimp();
- while (--i != 0) {
- stp++;
- *(struct segtab **)stp = free_segtab;
- free_segtab = stp;
- }
- splx(s);
- }
-#ifdef DIAGNOSTIC
- for (i = 0; i < PMAP_SEGTABSIZE; i++)
- if (pmap->pm_segtab->seg_tab[i] != 0)
- panic("pmap_pinit: pm_segtab != 0");
-#endif
- if (pmap == &vmspace0.vm_pmap) {
- /*
- * The initial process has already been allocated a TLBPID
- * in mach_init().
- */
- pmap->pm_tlbpid = 1;
- pmap->pm_tlbgen = tlbpid_gen;
- proc0paddr->u_pcb.pcb_segtab = (void *)pmap->pm_segtab;
- } else {
- pmap->pm_tlbpid = 0;
- pmap->pm_tlbgen = 0;
- }
-}
-
-/*
- * Retire the given physical map from service.
- * Should only be called if the map contains
- * no valid mappings.
- */
-void
-pmap_destroy(pmap)
- register pmap_t pmap;
-{
- int count;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- printf("pmap_destroy(%x)\n", pmap);
-#endif
- if (pmap == NULL)
- return;
-
- simple_lock(&pmap->pm_lock);
- count = --pmap->pm_count;
- simple_unlock(&pmap->pm_lock);
- if (count == 0) {
- pmap_release(pmap);
- free((caddr_t)pmap, M_VMPMAP);
- }
-}
-
-/*
- * Release any resources held by the given physical map.
- * Called when a pmap initialized by pmap_pinit is being released.
- * Should only be called if the map contains no valid mappings.
- */
-void
-pmap_release(pmap)
- register pmap_t pmap;
-{
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- printf("pmap_release(%x)\n", pmap);
-#endif
-
- if (pmap->pm_segtab) {
- register pt_entry_t *pte;
- register int i;
- int s;
-#ifdef DIAGNOSTIC
- register int j;
-#endif
-
- for (i = 0; i < PMAP_SEGTABSIZE; i++) {
- /* get pointer to segment map */
- pte = pmap->pm_segtab->seg_tab[i];
- if (!pte)
- continue;
-#ifdef DIAGNOSTIC
- for (j = 0; j < NPTEPG; j++) {
- if ((pte+j)->pt_entry)
- panic("pmap_release: segmap not empty");
- }
-#endif
-#ifdef R4K
- R4K_HitFlushDCache(pte, PAGE_SIZE);
-#endif
- vm_page_free1(
- PHYS_TO_VM_PAGE(CACHED_TO_PHYS(pte)));
- pmap->pm_segtab->seg_tab[i] = NULL;
- }
- s = splimp();
- *(struct segtab **)pmap->pm_segtab = free_segtab;
- free_segtab = pmap->pm_segtab;
- splx(s);
- pmap->pm_segtab = NULL;
- }
-}
-
-/*
- * Add a reference to the specified pmap.
- */
-void
-pmap_reference(pmap)
- pmap_t pmap;
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_reference(%x)\n", pmap);
-#endif
- if (pmap != NULL) {
- simple_lock(&pmap->pm_lock);
- pmap->pm_count++;
- simple_unlock(&pmap->pm_lock);
- }
-}
-
-/*
- * Remove the given range of addresses from the specified map.
- *
- * It is assumed that the start and end are properly
- * rounded to the page size.
- */
-void
-pmap_remove(pmap, sva, eva)
- register pmap_t pmap;
- vm_offset_t sva, eva;
-{
- register vm_offset_t nssva;
- register pt_entry_t *pte;
- unsigned entry;
- int flush;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT))
- printf("pmap_remove(%x, %x, %x)\n", pmap, sva, eva);
- remove_stats.calls++;
-#endif
- if (pmap == NULL)
- return;
-
- if (!pmap->pm_segtab) {
- register pt_entry_t *pte;
-
- /* remove entries from kernel pmap */
-#ifdef DIAGNOSTIC
- if (sva < VM_MIN_KERNEL_ADDRESS || eva > virtual_end)
- panic("pmap_remove: kva not in range");
-#endif
- pte = kvtopte(sva);
- for (; sva < eva; sva += NBPG, pte++) {
- entry = pte->pt_entry;
- if (!(entry & PG_V))
- continue;
- if (entry & PG_WIRED)
- pmap->pm_stats.wired_count--;
- pmap->pm_stats.resident_count--;
- if(pmap_remove_pv(pmap, sva, pfn_to_vad(entry))) {
-#ifdef R4K
- R4K_FlushDCache(sva, PAGE_SIZE);
-#endif
- }
-#ifdef ATTR
- pmap_attributes[atop(pfn_to_vad(entry))] = 0;
-#endif
- /*
- * Flush the TLB for the given address.
- */
- pte->pt_entry = PG_NV | PG_G; /* See above about G bit */
-#ifdef R4K
- R4K_TLBFlushAddr(sva);
-#else
- R3K_TLBFlushAddr(sva);
-#endif
-#ifdef DEBUG
- remove_stats.flushes++;
-
-#endif
- }
- return;
- }
-
-#ifdef DIAGNOSTIC
- if (eva > VM_MAXUSER_ADDRESS)
- panic("pmap_remove: uva not in range");
-#endif
- while (sva < eva) {
- nssva = mips_trunc_seg(sva) + NBSEG;
- if (nssva == 0 || nssva > eva)
- nssva = eva;
- /*
- * If VA belongs to an unallocated segment,
- * skip to the next segment boundary.
- */
- if (!(pte = pmap_segmap(pmap, sva))) {
- sva = nssva;
- continue;
- }
- /*
- * Invalidate every valid mapping within this segment.
- */
- pte += uvtopte(sva);
- for (; sva < nssva; sva += NBPG, pte++) {
- entry = pte->pt_entry;
- if (!(entry & PG_V))
- continue;
- if (entry & PG_WIRED)
- pmap->pm_stats.wired_count--;
- pmap->pm_stats.resident_count--;
- if(pmap_remove_pv(pmap, sva, pfn_to_vad(entry))) {
-#ifdef R4K
- R4K_FlushDCache(sva, PAGE_SIZE);
-#endif
- }
-#ifdef ATTR
- pmap_attributes[atop(pfn_to_vad(entry))] = 0;
-#endif
- pte->pt_entry = PG_NV;
- /*
- * Flush the TLB for the given address.
- */
- if (pmap->pm_tlbgen == tlbpid_gen) {
-#ifdef R4K
- R4K_TLBFlushAddr(sva | (pmap->pm_tlbpid <<
- R4K_PID_SHIFT));
-#else
- R3K_TLBFlushAddr(sva | (pmap->pm_tlbpid <<
- R3K_PID_SHIFT));
-#endif
-#ifdef DEBUG
- remove_stats.flushes++;
-#endif
- }
- }
- }
-}
-
-/*
- * pmap_page_protect:
- *
- * Lower the permission for all mappings to a given page.
- */
-void
-pmap_page_protect(pa, prot)
- vm_offset_t pa;
- vm_prot_t prot;
-{
- register pv_entry_t pv;
- register vm_offset_t va;
- int s;
-
-#ifdef DEBUG
- if ((pmapdebug & (PDB_FOLLOW|PDB_PROTECT)) ||
- prot == VM_PROT_NONE && (pmapdebug & PDB_REMOVE))
- printf("pmap_page_protect(%x, %x)\n", pa, prot);
-#endif
- if (!IS_VM_PHYSADDR(pa))
- return;
-
- switch (prot) {
- case VM_PROT_READ|VM_PROT_WRITE:
- case VM_PROT_ALL:
- break;
-
- /* copy_on_write */
- case VM_PROT_READ:
- case VM_PROT_READ|VM_PROT_EXECUTE:
- pv = pa_to_pvh(pa);
- s = splimp();
- /*
- * Loop over all current mappings setting/clearing as appropos.
- */
- if (pv->pv_pmap != NULL) {
- for (; pv; pv = pv->pv_next) {
- extern vm_offset_t pager_sva, pager_eva;
-
- va = pv->pv_va;
-
- /*
- * XXX don't write protect pager mappings
- */
- if (va >= pager_sva && va < pager_eva)
- continue;
- pmap_protect(pv->pv_pmap, va, va + PAGE_SIZE,
- prot);
- }
- }
- splx(s);
- break;
-
- /* remove_all */
- default:
- pv = pa_to_pvh(pa);
- s = splimp();
- while (pv->pv_pmap != NULL) {
- pmap_remove(pv->pv_pmap, pv->pv_va,
- pv->pv_va + PAGE_SIZE);
- }
- splx(s);
- }
-}
-
-/*
- * Set the physical protection on the
- * specified range of this map as requested.
- */
-void
-pmap_protect(pmap, sva, eva, prot)
- register pmap_t pmap;
- vm_offset_t sva, eva;
- vm_prot_t prot;
-{
- register vm_offset_t nssva;
- register pt_entry_t *pte;
- register unsigned entry;
- u_int p;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_PROTECT))
- printf("pmap_protect(%x, %x, %x, %x)\n", pmap, sva, eva, prot);
-#endif
- if (pmap == NULL)
- return;
-
- if ((prot & VM_PROT_READ) == VM_PROT_NONE) {
- pmap_remove(pmap, sva, eva);
- return;
- }
-
- p = (prot & VM_PROT_WRITE) ? PG_M : PG_RO;
-
- if (!pmap->pm_segtab) {
- /*
- * Change entries in kernel pmap.
- * This will trap if the page is writeable (in order to set
- * the dirty bit) even if the dirty bit is already set. The
- * optimization isn't worth the effort since this code isn't
- * executed much. The common case is to make a user page
- * read-only.
- */
-#ifdef DIAGNOSTIC
- if (sva < VM_MIN_KERNEL_ADDRESS || eva > virtual_end)
- panic("pmap_protect: kva not in range");
-#endif
- pte = kvtopte(sva);
- for (; sva < eva; sva += NBPG, pte++) {
- entry = pte->pt_entry;
- if (!(entry & PG_V))
- continue;
- entry = (entry & ~(PG_M | PG_RO)) | p;
- pte->pt_entry = entry;
- /*
- * Update the TLB if the given address is in the cache.
- */
-#ifdef R4K
- R4K_TLBUpdate(sva, entry);
-#else
- R3K_TLBUpdate(sva, entry);
-#endif
- }
- return;
- }
-
-#ifdef DIAGNOSTIC
- if (eva > VM_MAXUSER_ADDRESS)
- panic("pmap_protect: uva not in range");
-#endif
- while (sva < eva) {
- nssva = mips_trunc_seg(sva) + NBSEG;
- if (nssva == 0 || nssva > eva)
- nssva = eva;
- /*
- * If VA belongs to an unallocated segment,
- * skip to the next segment boundary.
- */
- if (!(pte = pmap_segmap(pmap, sva))) {
- sva = nssva;
- continue;
- }
- /*
- * Change protection on every valid mapping within this segment.
- */
- pte += (sva >> PGSHIFT) & (NPTEPG - 1);
- for (; sva < nssva; sva += NBPG, pte++) {
- entry = pte->pt_entry;
- if (!(entry & PG_V))
- continue;
- entry = (entry & ~(PG_M | PG_RO)) | p;
- pte->pt_entry = entry;
- /*
- * Update the TLB if the given address is in the cache.
- */
- if (pmap->pm_tlbgen == tlbpid_gen)
-#ifdef R4K
- R4K_TLBUpdate(sva | (pmap->pm_tlbpid <<
- R4K_PID_SHIFT), entry);
-#else
- R3K_TLBUpdate(sva | (pmap->pm_tlbpid <<
- R3K_PID_SHIFT), entry);
-#endif
- }
- }
-}
-
-/*
- * Return RO protection of page.
- */
-int
-pmap_is_page_ro(pmap, va, entry)
- pmap_t pmap;
- vm_offset_t va;
- int entry;
-{
- return(entry & PG_RO);
-}
-
-/*
- * pmap_page_cache:
- *
- * Change all mappings of a page to cached/uncached.
- */
-void
-pmap_page_cache(pa,mode)
- vm_offset_t pa;
-{
- register pv_entry_t pv;
- register pt_entry_t *pte;
- register vm_offset_t va;
- register unsigned entry;
- register unsigned newmode;
- int s;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_ENTER))
- printf("pmap_page_uncache(%x)\n", pa);
-#endif
- if (!IS_VM_PHYSADDR(pa))
- return;
-
- newmode = mode & PV_UNCACHED ? PG_UNCACHED : PG_CACHED;
- pv = pa_to_pvh(pa);
- s = splimp();
- while (pv) {
- pv->pv_flags = (pv->pv_flags & ~PV_UNCACHED) | mode;
- if (!pv->pv_pmap->pm_segtab) {
- /*
- * Change entries in kernel pmap.
- */
- pte = kvtopte(pv->pv_va);
- entry = pte->pt_entry;
- if (entry & PG_V) {
- entry = (entry & ~PG_CACHEMODE) | newmode;
- pte->pt_entry = entry;
-#ifdef R4K
- R4K_TLBUpdate(pv->pv_va, entry);
-#else
- R3K_TLBUpdate(pv->pv_va, entry);
-#endif
- }
- }
- else {
- if (pte = pmap_segmap(pv->pv_pmap, pv->pv_va)) {
- pte += (pv->pv_va >> PGSHIFT) & (NPTEPG - 1);
- entry = pte->pt_entry;
- if (entry & PG_V) {
- entry = (entry & ~PG_CACHEMODE) | newmode;
- pte->pt_entry = entry;
- if (pv->pv_pmap->pm_tlbgen == tlbpid_gen)
-#ifdef R4K
- R4K_TLBUpdate(pv->pv_va | (pv->pv_pmap->pm_tlbpid <<
- R4K_PID_SHIFT), entry);
-#else
- R3K_TLBUpdate(pv->pv_va | (pv->pv_pmap->pm_tlbpid <<
- R3K_PID_SHIFT), entry);
-#endif
- }
- }
- }
- pv = pv->pv_next;
- }
-
- splx(s);
-}
-
-/*
- * Insert the given physical page (p) at
- * the specified virtual address (v) in the
- * target physical map with the protection requested.
- *
- * If specified, the page will be wired down, meaning
- * that the related pte can not be reclaimed.
- *
- * NB: This is the only routine which MAY NOT lazy-evaluate
- * or lose information. That is, this routine must actually
- * insert this page into the given map NOW.
- */
-void
-pmap_enter(pmap, va, pa, prot, wired)
- register pmap_t pmap;
- vm_offset_t va;
- register vm_offset_t pa;
- vm_prot_t prot;
- boolean_t wired;
-{
- register pt_entry_t *pte;
- register u_int npte;
- register int i, j;
- vm_page_t mem;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_ENTER))
- printf("pmap_enter(%x, %x, %x, %x, %x)\n",
- pmap, va, pa, prot, wired);
-#endif
-#ifdef DIAGNOSTIC
- if (!pmap)
- panic("pmap_enter: pmap");
- if (!pmap->pm_segtab) {
- enter_stats.kernel++;
- if (va < VM_MIN_KERNEL_ADDRESS || va >= virtual_end)
- panic("pmap_enter: kva");
- } else {
- enter_stats.user++;
- if (va >= VM_MAXUSER_ADDRESS)
- panic("pmap_enter: uva");
- }
- if (pa & 0x80000000)
- panic("pmap_enter: pa");
- if (!(prot & VM_PROT_READ))
- panic("pmap_enter: prot");
-#endif
-
- if (IS_VM_PHYSADDR(pa)) {
- register pv_entry_t pv, npv;
- int s;
-
- if (!(prot & VM_PROT_WRITE))
- npte = PG_ROPAGE;
- else {
- register vm_page_t mem;
-
- mem = PHYS_TO_VM_PAGE(pa);
- if ((int)va < 0) {
- /*
- * Don't bother to trap on kernel writes,
- * just record page as dirty.
- */
- npte = PG_RWPAGE;
-#if 0 /*XXX*/
- mem->flags &= ~PG_CLEAN;
-#endif
- } else
-#ifdef ATTR
- if ((pmap_attributes[atop(pa)] &
- PMAP_ATTR_MOD) || !(mem->flags & PG_CLEAN))
-#else
- if (!(mem->flags & PG_CLEAN))
-#endif
- npte = PG_RWPAGE;
- else
- npte = PG_CWPAGE;
- }
-
-#ifdef DEBUG
- enter_stats.managed++;
-#endif
- /*
- * Enter the pmap and virtual address into the
- * physical to virtual map table.
- */
- pv = pa_to_pvh(pa);
- s = splimp();
-#ifdef DEBUG
- if (pmapdebug & PDB_ENTER)
- printf("pmap_enter: pv %x: was %x/%x/%x\n",
- pv, pv->pv_va, pv->pv_pmap, pv->pv_next);
-#endif
- if (pv->pv_pmap == NULL) {
- /*
- * No entries yet, use header as the first entry
- */
-#ifdef DEBUG
- if (pmapdebug & PDB_PVENTRY)
- printf("pmap_enter: first pv: pmap %x va %x\n",
- pmap, va);
- enter_stats.firstpv++;
-#endif
- pv->pv_va = va;
- pv->pv_flags = 0;
- pv->pv_pmap = pmap;
- pv->pv_next = NULL;
- } else {
-#ifdef R4K
- if (!(pv->pv_flags & PV_UNCACHED)) {
- /*
- * There is at least one other VA mapping this page.
- * Check if they are cache index compatible. If not
- * remove all mappings, flush the cache and set page
- * to be mapped uncached. Caching will be restored
- * when pages are mapped compatible again. NOT!
- */
- for (npv = pv; npv; npv = npv->pv_next) {
- /*
- * Check cache aliasing incompatibility
- */
- if((npv->pv_va & CpuCacheAliasMask) != (va & CpuCacheAliasMask)) {
- printf("pmap_enter: creating uncached mapping 0x%x, 0x%x.\n",npv->pv_va, va);
- pmap_page_cache(pa,PV_UNCACHED);
- R4K_FlushDCache(pv->pv_va, PAGE_SIZE);
- npte = (npte & ~PG_CACHEMODE) | PG_UNCACHED;
- break;
- }
- }
- }
- else {
- npte = (npte & ~PG_CACHEMODE) | PG_UNCACHED;
- }
-#endif
- /*
- * There is at least one other VA mapping this page.
- * Place this entry after the header.
- *
- * Note: the entry may already be in the table if
- * we are only changing the protection bits.
- */
- for (npv = pv; npv; npv = npv->pv_next) {
- if (pmap == npv->pv_pmap && va == npv->pv_va) {
-#ifdef DIAGNOSTIC
- unsigned entry;
-
- if (!pmap->pm_segtab)
- entry = kvtopte(va)->pt_entry;
- else {
- pte = pmap_segmap(pmap, va);
- if (pte) {
- pte += (va >> PGSHIFT) &
- (NPTEPG - 1);
- entry = pte->pt_entry;
- } else
- entry = 0;
- }
- if (!(entry & PG_V) ||
- pfn_to_vad(entry) != pa)
- printf(
- "pmap_enter: found va %x pa %x in pv_table but != %x\n",
- va, pa, entry);
-#endif
- goto fnd;
- }
- }
-#ifdef DEBUG
- if (pmapdebug & PDB_PVENTRY)
- printf("pmap_enter: new pv: pmap %x va %x\n",
- pmap, va);
-#endif
- /* can this cause us to recurse forever? */
- npv = (pv_entry_t)
- malloc(sizeof *npv, M_VMPVENT, M_NOWAIT);
- npv->pv_va = va;
- npv->pv_pmap = pmap;
- npv->pv_next = pv->pv_next;
- npv->pv_flags = pv->pv_flags;
- pv->pv_next = npv;
-#ifdef DEBUG
- if (!npv->pv_next)
- enter_stats.secondpv++;
-#endif
- fnd:
- ;
- }
- splx(s);
- } else {
- /*
- * Assumption: if it is not part of our managed memory
- * then it must be device memory which may be volitile.
- */
-#ifdef DEBUG
- enter_stats.unmanaged++;
-#endif
- npte = (prot & VM_PROT_WRITE) ? (PG_IOPAGE & ~PG_G) : (PG_IOPAGE& ~(PG_G | PG_M));
- }
-
- /*
- * The only time we need to flush the cache is if we
- * execute from a physical address and then change the data.
- * This is the best place to do this.
- * pmap_protect() and pmap_remove() are mostly used to switch
- * between R/W and R/O pages.
- * NOTE: we only support cache flush for read only text.
- */
- if (prot == (VM_PROT_READ | VM_PROT_EXECUTE))
-#ifdef R4K
- R4K_FlushICache(PHYS_TO_CACHED(pa), PAGE_SIZE);
-#else
- R3K_FlushICache(PHYS_TO_CACHED(pa), PAGE_SIZE);
-#endif
-
- if (!pmap->pm_segtab) {
- /* enter entries into kernel pmap */
- pte = kvtopte(va);
- npte |= vad_to_pfn(pa) | PG_ROPAGE | PG_G;
- if (wired) {
- pmap->pm_stats.wired_count++;
- npte |= PG_WIRED;
- }
- if (!(pte->pt_entry & PG_V)) {
- pmap->pm_stats.resident_count++;
- } else {
-#ifdef DIAGNOSTIC
- if (pte->pt_entry & PG_WIRED)
- panic("pmap_enter: kernel wired");
-#endif
- }
- /*
- * Update the same virtual address entry.
- */
-#ifdef R4K
- j = R4K_TLBUpdate(va, npte);
-#else
- j = R3K_TLBUpdate(va, npte);
-#endif
- pte->pt_entry = npte;
- return;
- }
-
- if (!(pte = pmap_segmap(pmap, va))) {
- do {
- mem = vm_page_alloc1();
- if (mem == NULL) {
- /* XXX What else can we do? Deadlocks? */
- vm_wait("penter");
- }
- } while (mem == NULL);
-
- pmap_zero_page(VM_PAGE_TO_PHYS(mem));
- pmap_segmap(pmap, va) = pte = (pt_entry_t *)
- PHYS_TO_CACHED(VM_PAGE_TO_PHYS(mem));
-#ifdef DIAGNOSTIC
- for (i = 0; i < NPTEPG; i++) {
- if ((pte+i)->pt_entry)
- panic("pmap_enter: new segmap not empty");
- }
-#endif
- }
- pte += (va >> PGSHIFT) & (NPTEPG - 1);
-
- /*
- * Now validate mapping with desired protection/wiring.
- */
- npte |= vad_to_pfn(pa);
- if (wired) {
- pmap->pm_stats.wired_count++;
- npte |= PG_WIRED;
- }
-#ifdef DEBUG
- if (pmapdebug & PDB_ENTER) {
- printf("pmap_enter: new pte %x", npte);
- if (pmap->pm_tlbgen == tlbpid_gen)
- printf(" tlbpid %d", pmap->pm_tlbpid);
- printf("\n");
- }
-#endif
- if (!(pte->pt_entry & PG_V)) {
- pmap->pm_stats.resident_count++;
- }
- pte->pt_entry = npte;
- if (pmap->pm_tlbgen == tlbpid_gen)
-#ifdef R4K
- j = R4K_TLBUpdate(va | (pmap->pm_tlbpid << R4K_PID_SHIFT), npte);
-#else
- j = R3K_TLBUpdate(va | (pmap->pm_tlbpid << R3K_PID_SHIFT), npte);
-#endif
-}
-
-/*
- * Routine: pmap_change_wiring
- * Function: Change the wiring attribute for a map/virtual-address
- * pair.
- * In/out conditions:
- * The mapping must already exist in the pmap.
- */
-void
-pmap_change_wiring(pmap, va, wired)
- register pmap_t pmap;
- vm_offset_t va;
- boolean_t wired;
-{
- register pt_entry_t *pte;
- u_int p;
- register int i;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_WIRING))
- printf("pmap_change_wiring(%x, %x, %x)\n", pmap, va, wired);
-#endif
- if (pmap == NULL)
- return;
-
- p = wired ? PG_WIRED : 0;
-
- /*
- * Don't need to flush the TLB since PG_WIRED is only in software.
- */
- if (!pmap->pm_segtab) {
- /* change entries in kernel pmap */
-#ifdef DIAGNOSTIC
- if (va < VM_MIN_KERNEL_ADDRESS || va >= virtual_end)
- panic("pmap_change_wiring");
-#endif
- pte = kvtopte(va);
- } else {
- if (!(pte = pmap_segmap(pmap, va)))
- return;
- pte += (va >> PGSHIFT) & (NPTEPG - 1);
- }
-
- if (!(pte->pt_entry & PG_WIRED) && p)
- pmap->pm_stats.wired_count++;
- else if ((pte->pt_entry & PG_WIRED) && !p)
- pmap->pm_stats.wired_count--;
-
- if (pte->pt_entry & PG_V)
- pte->pt_entry = (pte->pt_entry & ~PG_WIRED) | p;
-}
-
-/*
- * Routine: pmap_extract
- * Function:
- * Extract the physical page address associated
- * with the given map/virtual_address pair.
- */
-vm_offset_t
-pmap_extract(pmap, va)
- register pmap_t pmap;
- vm_offset_t va;
-{
- register vm_offset_t pa;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_extract(%x, %x) -> ", pmap, va);
-#endif
-
- if (!pmap->pm_segtab) {
-#ifdef DIAGNOSTIC
- if (va < VM_MIN_KERNEL_ADDRESS || va >= virtual_end)
- panic("pmap_extract");
-#endif
- pa = pfn_to_vad(kvtopte(va)->pt_entry);
- } else {
- register pt_entry_t *pte;
-
- if (!(pte = pmap_segmap(pmap, va)))
- pa = 0;
- else {
- pte += (va >> PGSHIFT) & (NPTEPG - 1);
- pa = pfn_to_vad(pte->pt_entry);
- }
- }
- if (pa)
- pa |= va & PGOFSET;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_extract: pa %x\n", pa);
-#endif
- return (pa);
-}
-
-/*
- * Copy the range specified by src_addr/len
- * from the source map to the range dst_addr/len
- * in the destination map.
- *
- * This routine is only advisory and need not do anything.
- */
-void
-pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr)
- pmap_t dst_pmap;
- pmap_t src_pmap;
- vm_offset_t dst_addr;
- vm_size_t len;
- vm_offset_t src_addr;
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_copy(%x, %x, %x, %x, %x)\n",
- dst_pmap, src_pmap, dst_addr, len, src_addr);
-#endif
-}
-
-/*
- * Require that all active physical maps contain no
- * incorrect entries NOW. [This update includes
- * forcing updates of any address map caching.]
- *
- * Generally used to insure that a thread about
- * to run will see a semantically correct world.
- */
-void
-pmap_update()
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_update()\n");
-#endif
-}
-
-/*
- * Routine: pmap_collect
- * Function:
- * Garbage collects the physical map system for
- * pages which are no longer used.
- * Success need not be guaranteed -- that is, there
- * may well be pages which are not referenced, but
- * others may be collected.
- * Usage:
- * Called by the pageout daemon when pages are scarce.
- */
-void
-pmap_collect(pmap)
- pmap_t pmap;
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_collect(%x)\n", pmap);
-#endif
-}
-
-/*
- * pmap_zero_page zeros the specified (machine independent) page.
- */
-void
-pmap_zero_page(phys)
- vm_offset_t phys;
-{
- register int *p, *end;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_zero_page(%x)\n", phys);
-#endif
-/*XXX FIXME Not very sophisticated */
-#ifdef R4K
- R4K_FlushCache();
-#endif
- p = (int *)PHYS_TO_CACHED(phys);
- end = p + PAGE_SIZE / sizeof(int);
- do {
- p[0] = 0;
- p[1] = 0;
- p[2] = 0;
- p[3] = 0;
- p += 4;
- } while (p != end);
-/*XXX FIXME Not very sophisticated */
-#ifdef R4K
- R4K_FlushCache();
-#endif
-}
-
-/*
- * pmap_copy_page copies the specified (machine independent)
- * page.
- */
-void
-pmap_copy_page(src, dst)
- vm_offset_t src, dst;
-{
- register int *s, *d, *end;
- register int tmp0, tmp1, tmp2, tmp3;
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_copy_page(%x, %x)\n", src, dst);
-#endif
-/*XXX FIXME Not very sophisticated */
-#ifdef R4K
- R4K_FlushCache();
-#endif
- s = (int *)PHYS_TO_CACHED(src);
- d = (int *)PHYS_TO_CACHED(dst);
- end = s + PAGE_SIZE / sizeof(int);
- do {
- tmp0 = s[0];
- tmp1 = s[1];
- tmp2 = s[2];
- tmp3 = s[3];
- d[0] = tmp0;
- d[1] = tmp1;
- d[2] = tmp2;
- d[3] = tmp3;
- s += 4;
- d += 4;
- } while (s != end);
-/*XXX FIXME Not very sophisticated */
-#ifdef R4K
- R4K_FlushCache();
-#endif
-}
-
-/*
- * Routine: pmap_pageable
- * Function:
- * Make the specified pages (by pmap, offset)
- * pageable (or not) as requested.
- *
- * A page which is not pageable may not take
- * a fault; therefore, its page table entry
- * must remain valid for the duration.
- *
- * This routine is merely advisory; pmap_enter
- * will specify that these pages are to be wired
- * down (or not) as appropriate.
- */
-void
-pmap_pageable(pmap, sva, eva, pageable)
- pmap_t pmap;
- vm_offset_t sva, eva;
- boolean_t pageable;
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_pageable(%x, %x, %x, %x)\n",
- pmap, sva, eva, pageable);
-#endif
-}
-
-/*
- * Clear the modify bits on the specified physical page.
- */
-void
-pmap_clear_modify(pa)
- vm_offset_t pa;
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_clear_modify(%x)\n", pa);
-#endif
-#ifdef ATTR
- pmap_attributes[atop(pa)] &= ~PMAP_ATTR_MOD;
-#endif
-}
-
-/*
- * pmap_clear_reference:
- *
- * Clear the reference bit on the specified physical page.
- */
-void
-pmap_clear_reference(pa)
- vm_offset_t pa;
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_clear_reference(%x)\n", pa);
-#endif
-#ifdef ATTR
- pmap_attributes[atop(pa)] &= ~PMAP_ATTR_REF;
-#endif
-}
-
-/*
- * pmap_is_referenced:
- *
- * Return whether or not the specified physical page is referenced
- * by any physical maps.
- */
-boolean_t
-pmap_is_referenced(pa)
- vm_offset_t pa;
-{
-#ifdef ATTR
- return (pmap_attributes[atop(pa)] & PMAP_ATTR_REF);
-#else
- return (FALSE);
-#endif
-}
-
-/*
- * pmap_is_modified:
- *
- * Return whether or not the specified physical page is modified
- * by any physical maps.
- */
-boolean_t
-pmap_is_modified(pa)
- vm_offset_t pa;
-{
-#ifdef ATTR
- return (pmap_attributes[atop(pa)] & PMAP_ATTR_MOD);
-#else
- return (FALSE);
-#endif
-}
-
-vm_offset_t
-pmap_phys_address(ppn)
- int ppn;
-{
-
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_phys_address(%x)\n", ppn);
-#endif
- return (mips_ptob(ppn));
-}
-
-/*
- * Miscellaneous support routines
- */
-
-/*
- * Allocate a hardware PID and return it.
- * It takes almost as much or more time to search the TLB for a
- * specific PID and flush those entries as it does to flush the entire TLB.
- * Therefore, when we allocate a new PID, we just take the next number. When
- * we run out of numbers, we flush the TLB, increment the generation count
- * and start over. PID zero is reserved for kernel use.
- * This is called only by switch().
- */
-int
-pmap_alloc_tlbpid(p)
- register struct proc *p;
-{
- register pmap_t pmap;
- register int id;
-
- pmap = &p->p_vmspace->vm_pmap;
- if (pmap->pm_tlbgen != tlbpid_gen) {
- id = tlbpid_cnt;
-#ifdef R4K
- if (id == R4K_NUM_PIDS) {
- R4K_TLBFlush();
-#else
- if (id == R3K_NUM_PIDS) {
- R3K_TLBFlush();
-#endif
- /* reserve tlbpid_gen == 0 to alway mean invalid */
- if (++tlbpid_gen == 0)
- tlbpid_gen = 1;
- id = 1;
- }
- tlbpid_cnt = id + 1;
- pmap->pm_tlbpid = id;
- pmap->pm_tlbgen = tlbpid_gen;
- } else
- id = pmap->pm_tlbpid;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_TLBPID)) {
- if (curproc)
- printf("pmap_alloc_tlbpid: curproc %d '%s' ",
- curproc->p_pid, curproc->p_comm);
- else
- printf("pmap_alloc_tlbpid: curproc <none> ");
- printf("segtab %x tlbpid %d pid %d '%s'\n",
- pmap->pm_segtab, id, p->p_pid, p->p_comm);
- }
-#endif
- return (id);
-}
-
-/*
- * Remove a physical to virtual address translation.
- * Returns TRUE if it was the last mapping and cached, else FALSE.
- */
-int
-pmap_remove_pv(pmap, va, pa)
- pmap_t pmap;
- vm_offset_t va, pa;
-{
- register pv_entry_t pv, npv;
- int s, last;
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_PVENTRY))
- printf("pmap_remove_pv(%x, %x, %x)\n", pmap, va, pa);
-#endif
- /*
- * Remove page from the PV table (raise IPL since we
- * may be called at interrupt time).
- */
- if (!IS_VM_PHYSADDR(pa))
- return(TRUE);
- pv = pa_to_pvh(pa);
- s = splimp();
- /*
- * If it is the first entry on the list, it is actually
- * in the header and we must copy the following entry up
- * to the header. Otherwise we must search the list for
- * the entry. In either case we free the now unused entry.
- */
- if (pmap == pv->pv_pmap && va == pv->pv_va) {
- last = (pv->pv_flags & PV_UNCACHED) ? FALSE : TRUE;
- npv = pv->pv_next;
- if (npv) {
- *pv = *npv;
- free((caddr_t)npv, M_VMPVENT);
- } else
- pv->pv_pmap = NULL;
-#ifdef DEBUG
- remove_stats.pvfirst++;
-#endif
- } else {
- last = FALSE;
- for (npv = pv->pv_next; npv; pv = npv, npv = npv->pv_next) {
-#ifdef DEBUG
- remove_stats.pvsearch++;
-#endif
- if (pmap == npv->pv_pmap && va == npv->pv_va)
- goto fnd;
- }
-#ifdef DIAGNOSTIC
- printf("pmap_remove_pv(%x, %x, %x) not found\n", pmap, va, pa);
- panic("pmap_remove_pv");
-#endif
- fnd:
- pv->pv_next = npv->pv_next;
- free((caddr_t)npv, M_VMPVENT);
- }
- splx(s);
- return(last);
-}
-
-/*
- * vm_page_alloc1:
- *
- * Allocate and return a memory cell with no associated object.
- */
-vm_page_t
-vm_page_alloc1()
-{
- register vm_page_t mem;
- int spl;
-
- spl = splimp(); /* XXX */
- simple_lock(&vm_page_queue_free_lock);
- if (vm_page_queue_free.tqh_first == NULL) {
- simple_unlock(&vm_page_queue_free_lock);
- splx(spl);
- return (NULL);
- }
-
- mem = vm_page_queue_free.tqh_first;
- TAILQ_REMOVE(&vm_page_queue_free, mem, pageq);
-
- cnt.v_free_count--;
- simple_unlock(&vm_page_queue_free_lock);
- splx(spl);
-
- mem->flags = PG_BUSY | PG_CLEAN | PG_FAKE;
- mem->wire_count = 0;
-
- /*
- * Decide if we should poke the pageout daemon.
- * We do this if the free count is less than the low
- * water mark, or if the free count is less than the high
- * water mark (but above the low water mark) and the inactive
- * count is less than its target.
- *
- * We don't have the counts locked ... if they change a little,
- * it doesn't really matter.
- */
-
- if (cnt.v_free_count < cnt.v_free_min ||
- (cnt.v_free_count < cnt.v_free_target &&
- cnt.v_inactive_count < cnt.v_inactive_target))
- thread_wakeup((void *)&vm_pages_needed);
- return (mem);
-}
-
-/*
- * vm_page_free1:
- *
- * Returns the given page to the free list,
- * disassociating it with any VM object.
- *
- * Object and page must be locked prior to entry.
- */
-void
-vm_page_free1(mem)
- register vm_page_t mem;
-{
-
- if (mem->flags & PG_ACTIVE) {
- TAILQ_REMOVE(&vm_page_queue_active, mem, pageq);
- mem->flags &= ~PG_ACTIVE;
- cnt.v_active_count--;
- }
-
- if (mem->flags & PG_INACTIVE) {
- TAILQ_REMOVE(&vm_page_queue_inactive, mem, pageq);
- mem->flags &= ~PG_INACTIVE;
- cnt.v_inactive_count--;
- }
-
- if (!(mem->flags & PG_FICTITIOUS)) {
- int spl;
-
- spl = splimp();
- simple_lock(&vm_page_queue_free_lock);
- TAILQ_INSERT_TAIL(&vm_page_queue_free, mem, pageq);
-
- cnt.v_free_count++;
- simple_unlock(&vm_page_queue_free_lock);
- splx(spl);
- }
-}
-
-/*
- * Find first virtual address >= *vap that doesn't cause
- * a cache alias conflict.
- */
-void
-pmap_prefer(foff, vap)
- register vm_offset_t foff;
- register vm_offset_t *vap;
-{
- register vm_offset_t va = *vap;
- register long m, d;
-
- m = 0x10000; /* Max aliased cache size */
-
- d = foff - va;
- d &= (m-1);
- *vap = va + d;
-}
-
diff --git a/sys/arch/wgrisc/wgrisc/process_machdep.c b/sys/arch/wgrisc/wgrisc/process_machdep.c
deleted file mode 100644
index e73da3d758f..00000000000
--- a/sys/arch/wgrisc/wgrisc/process_machdep.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/* $OpenBSD: process_machdep.c,v 1.1.1.1 1997/02/06 16:02:46 pefo Exp $ */
-/*
- * Copyright (c) 1994 Adam Glass
- * Copyright (c) 1993 The Regents of the University of California.
- * Copyright (c) 1993 Jan-Simon Pendry
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Jan-Simon Pendry.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * From:
- * Id: procfs_i386.c,v 4.1 1993/12/17 10:47:45 jsp Rel
- *
- * $Id: process_machdep.c,v 1.1.1.1 1997/02/06 16:02:46 pefo Exp $
- */
-
-/*
- * This file may seem a bit stylized, but that so that it's easier to port.
- * Functions to be implemented here are:
- *
- * process_read_regs(proc, regs)
- * Get the current user-visible register set from the process
- * and copy it into the regs structure (<machine/reg.h>).
- * The process is stopped at the time read_regs is called.
- *
- * process_write_regs(proc, regs)
- * Update the current register set from the passed in regs
- * structure. Take care to avoid clobbering special CPU
- * registers or privileged bits in the PSL.
- * The process is stopped at the time write_regs is called.
- *
- * process_sstep(proc)
- * Arrange for the process to trap after executing a single instruction.
- *
- * process_set_pc(proc)
- * Set the process's program counter.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/time.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/vnode.h>
-#include <sys/ptrace.h>
-#include <machine/psl.h>
-#include <machine/reg.h>
-
-int
-process_read_regs(p, regs)
- struct proc *p;
- struct reg *regs;
-{
- bcopy((caddr_t)p->p_md.md_regs, (caddr_t)regs, sizeof(struct reg));
- return (0);
-}
-
-int
-process_write_regs(p, regs)
- struct proc *p;
- struct reg *regs;
-{
- bcopy((caddr_t)regs, (caddr_t)p->p_md.md_regs, sizeof(struct reg));
-/*XXX Clear to user set bits!! */
- return (0);
-}
-
-int
-process_sstep(p, sstep)
- struct proc *p;
-{
- if(sstep)
- cpu_singlestep(p);
- return (0);
-}
-
-int
-process_set_pc(p, addr)
- struct proc *p;
- caddr_t addr;
-{
- p->p_md.md_regs[PC] = (int)addr;
- return (0);
-}
-
diff --git a/sys/arch/wgrisc/wgrisc/swapgeneric.c b/sys/arch/wgrisc/wgrisc/swapgeneric.c
deleted file mode 100644
index 9ac8d37ff50..00000000000
--- a/sys/arch/wgrisc/wgrisc/swapgeneric.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* $OpenBSD: swapgeneric.c,v 1.1.1.1 1997/02/06 16:02:46 pefo Exp $ */
-
-/*-
- * Copyright (c) 1994
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)swapgeneric.c 8.2 (Berkeley) 3/21/94
- */
-
-/*
- * fake swapgeneric.c -- should do this differently.
- */
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <machine/disklabel.h>
-
-int (*mountroot)() = NULL; /* tells autoconf.c that we are "generic" */
-
-dev_t rootdev = NODEV;
-dev_t dumpdev = NODEV;
-
-struct swdevt swdevt[] = {
- { makedev(3, 0*MAXPARTITIONS+1), 0, 0 }, /* sd0b */
- { makedev(3, 1*MAXPARTITIONS+1), 0, 0 }, /* sd1b */
- { makedev(3, 2*MAXPARTITIONS+1), 0, 0 }, /* sd2b */
- { makedev(3, 3*MAXPARTITIONS+1), 0, 0 }, /* sd3b */
- { makedev(3, 4*MAXPARTITIONS+1), 0, 0 }, /* sd4b */
- { makedev(3, 5*MAXPARTITIONS+1), 0, 0 }, /* sd5b */
- { makedev(3, 6*MAXPARTITIONS+1), 0, 0 }, /* sd6b */
- { makedev(3, 7*MAXPARTITIONS+1), 0, 0 }, /* sd7b */
- { NODEV, 0, 0 }
-};
diff --git a/sys/arch/wgrisc/wgrisc/sys_machdep.c b/sys/arch/wgrisc/wgrisc/sys_machdep.c
deleted file mode 100644
index 57375e4c7cb..00000000000
--- a/sys/arch/wgrisc/wgrisc/sys_machdep.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $OpenBSD: sys_machdep.c,v 1.3 2000/06/23 02:14:38 mickey Exp $ */
-/* $NetBSD: sys_machdep.c,v 1.6 1994/10/26 21:10:42 cgd Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)sys_machdep.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/file.h>
-#include <sys/time.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/uio.h>
-#include <sys/kernel.h>
-#include <sys/mtio.h>
-#include <sys/buf.h>
-
-#include <sys/mount.h>
-#include <sys/syscallargs.h>
-
-sys_sysarch(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct sys_sysarch_args /* {
- syscallarg(int) op;
- syscallarg(char *) parms;
- } */ *uap = v;
- int error = 0;
-
- switch(SCARG(uap, op)) {
- default:
- error = EINVAL;
- break;
- }
- return(error);
-}
diff --git a/sys/arch/wgrisc/wgrisc/trap.c b/sys/arch/wgrisc/wgrisc/trap.c
deleted file mode 100644
index c227c68e641..00000000000
--- a/sys/arch/wgrisc/wgrisc/trap.c
+++ /dev/null
@@ -1,1672 +0,0 @@
-/* $OpenBSD: trap.c,v 1.5 2000/11/10 18:15:44 art Exp $ */
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: trap.c 1.32 91/04/06
- *
- * from: @(#)trap.c 8.5 (Berkeley) 1/11/94
- * $Id: trap.c,v 1.5 2000/11/10 18:15:44 art Exp $
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/kernel.h>
-#include <sys/signalvar.h>
-#include <sys/syscall.h>
-#include <sys/user.h>
-#include <sys/buf.h>
-#include <sys/device.h>
-#ifdef KTRACE
-#include <sys/ktrace.h>
-#endif
-#include <net/netisr.h>
-
-#include <machine/trap.h>
-#include <machine/psl.h>
-#include <machine/reg.h>
-#include <machine/cpu.h>
-#include <machine/pio.h>
-#include <machine/autoconf.h>
-#include <machine/pte.h>
-#include <machine/pmap.h>
-#include <machine/mips_opcode.h>
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-
-#include <wgrisc/wgrisc/wgrisctype.h>
-
-#include <sys/cdefs.h>
-#include <sys/syslog.h>
-
-struct proc *cpuFPCurProcPtr; /* pointer to last proc to use FP */
-
-unsigned CPU_EmulateBranch();
-
-#ifdef R4K
-extern void R4K_KernGenException();
-extern void R4K_UserGenException();
-extern void R4K_KernIntr();
-extern void R4K_UserIntr();
-extern void R4K_TLBModException();
-extern void R4K_TLBInvalidException();
-
-void (*R4K_ExceptionTable[])() = {
-/*
- * The kernel exception handlers.
- */
- R4K_KernIntr, /* external interrupt */
- R4K_KernGenException, /* TLB modification */
- R4K_TLBInvalidException, /* TLB miss (load or instr. fetch) */
- R4K_TLBInvalidException, /* TLB miss (store) */
- R4K_KernGenException, /* address error (load or I-fetch) */
- R4K_KernGenException, /* address error (store) */
- R4K_KernGenException, /* bus error (I-fetch) */
- R4K_KernGenException, /* bus error (load or store) */
- R4K_KernGenException, /* system call */
- R4K_KernGenException, /* breakpoint */
- R4K_KernGenException, /* reserved instruction */
- R4K_KernGenException, /* coprocessor unusable */
- R4K_KernGenException, /* arithmetic overflow */
- R4K_KernGenException, /* trap exception */
- R4K_KernGenException, /* viritual coherence exception inst */
- R4K_KernGenException, /* floating point exception */
- R4K_KernGenException, /* reserved */
- R4K_KernGenException, /* reserved */
- R4K_KernGenException, /* reserved */
- R4K_KernGenException, /* reserved */
- R4K_KernGenException, /* reserved */
- R4K_KernGenException, /* reserved */
- R4K_KernGenException, /* reserved */
- R4K_KernGenException, /* watch exception */
- R4K_KernGenException, /* reserved */
- R4K_KernGenException, /* reserved */
- R4K_KernGenException, /* reserved */
- R4K_KernGenException, /* reserved */
- R4K_KernGenException, /* reserved */
- R4K_KernGenException, /* reserved */
- R4K_KernGenException, /* reserved */
- R4K_KernGenException, /* viritual coherence exception data */
-/*
- * The user exception handlers.
- */
- R4K_UserIntr, /* 0 */
- R4K_UserGenException, /* 1 */
- R4K_UserGenException, /* 2 */
- R4K_UserGenException, /* 3 */
- R4K_UserGenException, /* 4 */
- R4K_UserGenException, /* 5 */
- R4K_UserGenException, /* 6 */
- R4K_UserGenException, /* 7 */
- R4K_UserGenException, /* 8 */
- R4K_UserGenException, /* 9 */
- R4K_UserGenException, /* 10 */
- R4K_UserGenException, /* 11 */
- R4K_UserGenException, /* 12 */
- R4K_UserGenException, /* 13 */
- R4K_UserGenException, /* 14 */
- R4K_UserGenException, /* 15 */
- R4K_UserGenException, /* 16 */
- R4K_UserGenException, /* 17 */
- R4K_UserGenException, /* 18 */
- R4K_UserGenException, /* 19 */
- R4K_UserGenException, /* 20 */
- R4K_UserGenException, /* 21 */
- R4K_UserGenException, /* 22 */
- R4K_UserGenException, /* 23 */
- R4K_UserGenException, /* 24 */
- R4K_UserGenException, /* 25 */
- R4K_UserGenException, /* 26 */
- R4K_UserGenException, /* 27 */
- R4K_UserGenException, /* 28 */
- R4K_UserGenException, /* 29 */
- R4K_UserGenException, /* 20 */
- R4K_UserGenException, /* 31 */
-};
-#else
-extern void R3K_KernGenException();
-extern void R3K_UserGenException();
-extern void R3K_KernIntr();
-extern void R3K_UserIntr();
-extern void R3K_TLBModException();
-extern void R3K_TLBMissException();
-
-void (*R3K_ExceptionTable[])() = {
-/*
- * The kernel exception handlers.
- */
- R3K_KernIntr, /* external interrupt */
- R3K_KernGenException, /* TLB modification */
- R3K_TLBMissException, /* TLB miss (load or instr. fetch) */
- R3K_TLBMissException, /* TLB miss (store) */
- R3K_KernGenException, /* address error (load or I-fetch) */
- R3K_KernGenException, /* address error (store) */
- R3K_KernGenException, /* bus error (I-fetch) */
- R3K_KernGenException, /* bus error (load or store) */
- R3K_KernGenException, /* system call */
- R3K_KernGenException, /* breakpoint */
- R3K_KernGenException, /* reserved instruction */
- R3K_KernGenException, /* coprocessor unusable */
- R3K_KernGenException, /* arithmetic overflow */
- R3K_KernGenException, /* Reserved */
- R3K_KernGenException, /* Reserved */
- R3K_KernGenException, /* Reserved */
- R3K_KernGenException, /* Reserved */
- R3K_KernGenException, /* Reserved */
- R3K_KernGenException, /* Reserved */
- R3K_KernGenException, /* Reserved */
- R3K_KernGenException, /* Reserved */
- R3K_KernGenException, /* Reserved */
- R3K_KernGenException, /* Reserved */
- R3K_KernGenException, /* Reserved */
- R3K_KernGenException, /* Reserved */
- R3K_KernGenException, /* Reserved */
- R3K_KernGenException, /* Reserved */
- R3K_KernGenException, /* Reserved */
- R3K_KernGenException, /* Reserved */
- R3K_KernGenException, /* Reserved */
- R3K_KernGenException, /* Reserved */
- R3K_KernGenException, /* Reserved */
-/*
- * The user exception handlers.
- */
- R3K_UserIntr, /* 0 */
- R3K_UserGenException, /* 1 */
- R3K_UserGenException, /* 2 */
- R3K_UserGenException, /* 3 */
- R3K_UserGenException, /* 4 */
- R3K_UserGenException, /* 5 */
- R3K_UserGenException, /* 6 */
- R3K_UserGenException, /* 7 */
- R3K_UserGenException, /* 8 */
- R3K_UserGenException, /* 9 */
- R3K_UserGenException, /* 10 */
- R3K_UserGenException, /* 11 */
- R3K_UserGenException, /* 12 */
- R3K_UserGenException, /* 13 */
- R3K_UserGenException, /* 14 */
- R3K_UserGenException, /* 15 */
- R3K_UserGenException, /* Reserved */
- R3K_UserGenException, /* Reserved */
- R3K_UserGenException, /* Reserved */
- R3K_UserGenException, /* Reserved */
- R3K_UserGenException, /* Reserved */
- R3K_UserGenException, /* Reserved */
- R3K_UserGenException, /* Reserved */
- R3K_UserGenException, /* Reserved */
- R3K_UserGenException, /* Reserved */
- R3K_UserGenException, /* Reserved */
- R3K_UserGenException, /* Reserved */
- R3K_UserGenException, /* Reserved */
- R3K_UserGenException, /* Reserved */
- R3K_UserGenException, /* Reserved */
- R3K_UserGenException, /* Reserved */
- R3K_UserGenException, /* Reserved */
-};
-#endif
-
-char *trap_type[] = {
- "external interrupt",
- "TLB modification",
- "TLB miss (load or instr. fetch)",
- "TLB miss (store)",
- "address error (load or I-fetch)",
- "address error (store)",
- "bus error (I-fetch)",
- "bus error (load or store)",
- "system call",
- "breakpoint",
- "reserved instruction",
- "coprocessor unusable",
- "arithmetic overflow",
- "trap",
- "viritual coherency instruction",
- "floating point",
- "reserved 16",
- "reserved 17",
- "reserved 18",
- "reserved 19",
- "reserved 20",
- "reserved 21",
- "reserved 22",
- "watch",
- "reserved 24",
- "reserved 25",
- "reserved 26",
- "reserved 27",
- "reserved 28",
- "reserved 29",
- "reserved 30",
- "viritual coherency data",
-};
-
-#define NHWI 8
-struct {
- int int_mask;
- int (*int_hand)();
-} cpu_int_tab[NHWI];
-
-#ifdef DEBUG
-#define TRAPSIZE 10
-struct trapdebug { /* trap history buffer for debugging */
- u_int status;
- u_int cause;
- u_int vadr;
- u_int pc;
- u_int ra;
- u_int sp;
- u_int code;
-} trapdebug[TRAPSIZE], *trp = trapdebug;
-#endif /* DEBUG */
-
-#ifdef DEBUG /* stack trace code, also useful for DDB one day */
-extern void stacktrace();
-extern void logstacktrace();
-
-/* extern functions printed by name in stack backtraces */
-extern void idle(), cpu_switch(), splx(), wbflush();
-extern void R4K_TLBMiss();
-extern void R3K_TLBMiss();
-#endif /* DEBUG */
-
-static void mips_errintr();
-extern const struct callback *callv;
-extern volatile struct chiptime *Mach_clock_addr;
-extern u_long intrcnt[];
-extern u_int cputype;
-
-/*
- * Handle an exception.
- * Called from RxK_KernGenException() or RxK_UserGenException()
- * when a processor trap occurs.
- * In the case of a kernel trap, we return the pc where to resume if
- * ((struct pcb *)UADDR)->pcb_onfault is set, otherwise, return old pc.
- */
-unsigned
-trap(statusReg, causeReg, vadr, pc, args)
- unsigned statusReg; /* status register at time of the exception */
- unsigned causeReg; /* cause register at time of exception */
- unsigned vadr; /* address (if any) the fault occured on */
- unsigned pc; /* program counter where to continue */
-{
- register int type, i, usermode;
- unsigned ucode = 0;
- register struct proc *p = curproc;
- u_quad_t sticks;
- vm_prot_t ftype;
- extern unsigned onfault_table[];
- int typ = 0;
-
-#ifdef R4K
- usermode = R4K_USERMODE(statusReg);
-#else
- usermode = R3K_USERMODE(statusReg);
-#endif
-#ifdef DEBUG
- trp->status = statusReg;
- trp->cause = causeReg;
- trp->vadr = vadr;
- trp->pc = pc;
- trp->ra = !usermode ? ((int *)&args)[19] :
- p->p_md.md_regs[RA];
- trp->sp = (int)&args;
- trp->code = 0;
- if (++trp == &trapdebug[TRAPSIZE])
- trp = trapdebug;
-#endif
-
- cnt.v_trap++;
- type = (causeReg & CR_EXC_CODE) >> CR_EXC_CODE_SHIFT;
- if (usermode) {
- type |= T_USER;
- sticks = p->p_sticks;
- }
-
- /*
- * Enable hardware interrupts if they were on before.
- * We only respond to software interrupts when returning to user mode.
- */
- if (statusReg & SR_INT_ENAB)
- splx((statusReg & HARD_INT_MASK) | SR_INT_ENAB);
-
- switch (type) {
- case T_TLB_MOD:
- /* check for kernel address */
- if ((int)vadr < 0) {
- register pt_entry_t *pte;
- register unsigned entry;
- register vm_offset_t pa;
-
- pte = kvtopte(vadr);
- entry = pte->pt_entry;
-#ifdef DIAGNOSTIC
- if (!(entry & PG_V) || (entry & PG_M))
- panic("trap: ktlbmod: invalid pte");
-#endif
- if (pmap_is_page_ro(pmap_kernel(), mips_trunc_page(vadr), entry)) {
- /* write to read only page in the kernel */
- ftype = VM_PROT_WRITE;
- goto kernel_fault;
- }
- entry |= PG_M;
- pte->pt_entry = entry;
- vadr &= ~PGOFSET;
-#ifdef R4K
- R4K_TLBUpdate(vadr, entry);
-#else
- R3K_TLBUpdate(vadr, entry);
-#endif
- pa = pfn_to_vad(entry);
-#ifdef ATTR
- pmap_attributes[atop(pa)] |= PMAP_ATTR_MOD;
-#else
- if (!IS_VM_PHYSADDR(pa))
- panic("trap: ktlbmod: unmanaged page");
- PHYS_TO_VM_PAGE(pa)->flags &= ~PG_CLEAN;
-#endif
- return (pc);
- }
- /* FALLTHROUGH */
-
- case T_TLB_MOD+T_USER:
- {
- register pt_entry_t *pte;
- register unsigned entry;
- register vm_offset_t pa;
- pmap_t pmap = &p->p_vmspace->vm_pmap;
-
- if (!(pte = pmap_segmap(pmap, vadr)))
- panic("trap: utlbmod: invalid segmap");
- pte += (vadr >> PGSHIFT) & (NPTEPG - 1);
- entry = pte->pt_entry;
-#ifdef DIAGNOSTIC
- if (!(entry & PG_V) || (entry & PG_M)) {
- panic("trap: utlbmod: invalid pte");
- }
-#endif
- if (pmap_is_page_ro(pmap, mips_trunc_page(vadr), entry)) {
- /* write to read only page */
- ftype = VM_PROT_WRITE;
- goto dofault;
- }
- entry |= PG_M;
- pte->pt_entry = entry;
-#ifdef R4K
- vadr = (vadr & ~PGOFSET) | (pmap->pm_tlbpid << R4K_PID_SHIFT);
- R4K_TLBUpdate(vadr, entry);
-#else
- vadr = (vadr & ~PGOFSET) | (pmap->pm_tlbpid << R3K_PID_SHIFT);
- R3K_TLBUpdate(vadr, entry);
-#endif
- pa = pfn_to_vad(entry);
-#ifdef ATTR
- pmap_attributes[atop(pa)] |= PMAP_ATTR_MOD;
-#else
- if (!IS_VM_PHYSADDR(pa)) {
- panic("trap: utlbmod: unmanaged page");
- }
- PHYS_TO_VM_PAGE(pa)->flags &= ~PG_CLEAN;
-#endif
- if (!usermode)
- return (pc);
- goto out;
- }
-
- case T_TLB_LD_MISS:
- case T_TLB_ST_MISS:
- ftype = (type == T_TLB_ST_MISS) ? VM_PROT_WRITE : VM_PROT_READ;
- /* check for kernel address */
- if ((int)vadr < 0) {
- register vm_offset_t va;
- int rv;
-
- kernel_fault:
- va = trunc_page((vm_offset_t)vadr);
- rv = vm_fault(kernel_map, va, ftype, FALSE);
- if (rv == KERN_SUCCESS)
- return (pc);
- if (i = ((struct pcb *)UADDR)->pcb_onfault) {
- ((struct pcb *)UADDR)->pcb_onfault = 0;
- return (onfault_table[i]);
- }
- goto err;
- }
- /*
- * It is an error for the kernel to access user space except
- * through the copyin/copyout routines.
- */
- if ((i = ((struct pcb *)UADDR)->pcb_onfault) == 0)
- goto err;
- /* check for fuswintr() or suswintr() getting a page fault */
- if (i == 4)
- return (onfault_table[i]);
- goto dofault;
-
- case T_TLB_LD_MISS+T_USER:
- ftype = VM_PROT_READ;
- goto dofault;
-
- case T_TLB_ST_MISS+T_USER:
- ftype = VM_PROT_WRITE;
- dofault:
- {
- register vm_offset_t va;
- register struct vmspace *vm;
- register vm_map_t map;
- int rv;
-
- vm = p->p_vmspace;
- map = &vm->vm_map;
- va = trunc_page((vm_offset_t)vadr);
- rv = vm_fault(map, va, ftype, FALSE);
-#ifdef VMFAULT_TRACE
- printf("vm_fault(%x (pmap %x), %x (%x), %x, %d) -> %x at pc %x\n",
- map, &vm->vm_pmap, va, vadr, ftype, FALSE, rv, pc);
-#endif
- /*
- * If this was a stack access we keep track of the maximum
- * accessed stack size. Also, if vm_fault gets a protection
- * failure it is due to accessing the stack region outside
- * the current limit and we need to reflect that as an access
- * error.
- */
- if ((caddr_t)va >= vm->vm_maxsaddr) {
- if (rv == KERN_SUCCESS) {
- unsigned nss;
-
- nss = clrnd(btoc(USRSTACK-(unsigned)va));
- if (nss > vm->vm_ssize)
- vm->vm_ssize = nss;
- } else if (rv == KERN_PROTECTION_FAILURE)
- rv = KERN_INVALID_ADDRESS;
- }
- if (rv == KERN_SUCCESS) {
- if (!usermode)
- return (pc);
- goto out;
- }
- if (!usermode) {
- if (i = ((struct pcb *)UADDR)->pcb_onfault) {
- ((struct pcb *)UADDR)->pcb_onfault = 0;
- return (onfault_table[i]);
- }
- goto err;
- }
- ucode = ftype;
- i = SIGSEGV;
- typ = SEGV_MAPERR;
- break;
- }
-
- case T_ADDR_ERR_LD+T_USER: /* misaligned or kseg access */
- case T_ADDR_ERR_ST+T_USER: /* misaligned or kseg access */
- ucode = 0; /* XXX should be VM_PROT_something */
- i = SIGBUS;
- typ = BUS_ADRALN;
- break;
- case T_BUS_ERR_IFETCH+T_USER: /* BERR asserted to cpu */
- case T_BUS_ERR_LD_ST+T_USER: /* BERR asserted to cpu */
- ucode = 0; /* XXX should be VM_PROT_something */
- i = SIGBUS;
- typ = BUS_OBJERR;
- break;
-
- case T_SYSCALL+T_USER:
- {
- register int *locr0 = p->p_md.md_regs;
- register struct sysent *callp;
- unsigned int code;
- int numsys;
- struct args {
- int i[8];
- } args;
- int rval[2];
-
- cnt.v_syscall++;
- /* compute next PC after syscall instruction */
- if ((int)causeReg < 0)
- locr0[PC] = CPU_EmulateBranch(locr0, pc, 0, 0);
- else
- locr0[PC] += 4;
- callp = p->p_emul->e_sysent;
- numsys = p->p_emul->e_nsysent;
- code = locr0[V0];
- switch (code) {
- case SYS_syscall:
- /*
- * Code is first argument, followed by actual args.
- */
- code = locr0[A0];
- if (code >= numsys)
- callp += p->p_emul->e_nosys; /* (illegal) */
- else
- callp += code;
- i = callp->sy_argsize / sizeof(int);
- args.i[0] = locr0[A1];
- args.i[1] = locr0[A2];
- args.i[2] = locr0[A3];
- if (i > 3) {
- i = copyin((caddr_t)(locr0[SP] +
- 4 * sizeof(int)),
- (caddr_t)&args.i[3],
- (u_int)(i - 3) * sizeof(int));
- if (i) {
- locr0[V0] = i;
- locr0[A3] = 1;
-#ifdef SYSCALL_DEBUG
- scdebug_call(p, code, args.i);
-#endif
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSCALL))
- ktrsyscall(p, code,
- callp->sy_argsize,
- args.i);
-#endif
- goto done;
- }
- }
- break;
-
- case SYS___syscall:
- /*
- * Like syscall, but code is a quad, so as to maintain
- * quad alignment for the rest of the arguments.
- */
- code = locr0[A0 + _QUAD_LOWWORD];
- if (code >= numsys)
- callp += p->p_emul->e_nosys; /* (illegal) */
- else
- callp += code;
- i = callp->sy_argsize / sizeof(int);
- args.i[0] = locr0[A2];
- args.i[1] = locr0[A3];
- if (i > 2) {
- i = copyin((caddr_t)(locr0[SP] +
- 4 * sizeof(int)),
- (caddr_t)&args.i[2],
- (u_int)(i - 2) * sizeof(int));
- if (i) {
- locr0[V0] = i;
- locr0[A3] = 1;
-#ifdef SYSCALL_DEBUG
- scdebug_call(p, code, args.i);
-#endif
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSCALL))
- ktrsyscall(p, code,
- callp->sy_argsize,
- args.i);
-#endif
- goto done;
- }
- }
- break;
-
- default:
- if (code >= numsys)
- callp += p->p_emul->e_nosys; /* (illegal) */
- else
- callp += code;
- i = callp->sy_narg;
- args.i[0] = locr0[A0];
- args.i[1] = locr0[A1];
- args.i[2] = locr0[A2];
- args.i[3] = locr0[A3];
- if (i > 4) {
- i = copyin((caddr_t)(locr0[SP] +
- 4 * sizeof(int)),
- (caddr_t)&args.i[4],
- (u_int)(i - 4) * sizeof(int));
- if (i) {
- locr0[V0] = i;
- locr0[A3] = 1;
-#ifdef SYSCALL_DEBUG
- scdebug_call(p, code, args.i);
-#endif
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSCALL))
- ktrsyscall(p, code,
- callp->sy_argsize,
- args.i);
-#endif
- goto done;
- }
- }
- }
-#ifdef SYSCALL_DEBUG
- scdebug_call(p, code, args.i);
-#endif
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSCALL))
- ktrsyscall(p, code, callp->sy_argsize, args.i);
-#endif
- rval[0] = 0;
- rval[1] = locr0[V1];
-#ifdef DEBUG
- if (trp == trapdebug)
- trapdebug[TRAPSIZE - 1].code = code;
- else
- trp[-1].code = code;
-#endif
- i = (*callp->sy_call)(p, &args, rval);
- /*
- * Reinitialize proc pointer `p' as it may be different
- * if this is a child returning from fork syscall.
- */
- p = curproc;
- locr0 = p->p_md.md_regs;
-#ifdef DEBUG
- { int s;
- s = splhigh();
- trp->status = statusReg;
- trp->cause = causeReg;
- trp->vadr = locr0[SP];
- trp->pc = locr0[PC];
- trp->ra = locr0[RA];
- trp->code = -code;
- if (++trp == &trapdebug[TRAPSIZE])
- trp = trapdebug;
- splx(s);
- }
-#endif
- switch (i) {
- case 0:
- locr0[V0] = rval[0];
- locr0[V1] = rval[1];
- locr0[A3] = 0;
- break;
-
- case ERESTART:
- locr0[PC] = pc;
- break;
-
- case EJUSTRETURN:
- break; /* nothing to do */
-
- default:
- locr0[V0] = i;
- locr0[A3] = 1;
- }
- if(code == SYS_ptrace)
-#ifdef R4K
- R4K_FlushCache();
-#else
- R3K_FlushCache();
-#endif
- done:
-#ifdef SYSCALL_DEBUG
- scdebug_ret(p, code, i, rval);
-#endif
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSRET))
- ktrsysret(p, code, i, rval[0]);
-#endif
- goto out;
- }
-
- case T_BREAK+T_USER:
- {
- register unsigned va, instr;
- struct uio uio;
- struct iovec iov;
-
- /* compute address of break instruction */
- va = pc;
- if ((int)causeReg < 0)
- va += 4;
-
- /* read break instruction */
- instr = fuiword((caddr_t)va);
-#if 0
- printf("trap: %s (%d) breakpoint %x at %x: (adr %x ins %x)\n",
- p->p_comm, p->p_pid, instr, pc,
- p->p_md.md_ss_addr, p->p_md.md_ss_instr); /* XXX */
-#endif
- if (p->p_md.md_ss_addr != va || instr != BREAK_SSTEP) {
- i = SIGTRAP;
- typ = TRAP_TRACE;
- break;
- }
-
- /*
- * Restore original instruction and clear BP
- */
- iov.iov_base = (caddr_t)&p->p_md.md_ss_instr;
- iov.iov_len = sizeof(int);
- uio.uio_iov = &iov;
- uio.uio_iovcnt = 1;
- uio.uio_offset = (off_t)va;
- uio.uio_resid = sizeof(int);
- uio.uio_segflg = UIO_SYSSPACE;
- uio.uio_rw = UIO_WRITE;
- uio.uio_procp = curproc;
- i = procfs_domem(p, p, NULL, &uio);
-#ifdef R4K
- R4K_FlushCache();
-#else
- R3K_FlushCache();
-#endif
-
- if (i < 0)
- printf("Warning: can't restore instruction at %x: %x\n",
- p->p_md.md_ss_addr, p->p_md.md_ss_instr);
-
- p->p_md.md_ss_addr = 0;
- i = SIGTRAP;
- typ = TRAP_TRACE;
- break;
- }
-
- case T_RES_INST+T_USER:
- i = SIGILL;
- typ = ILL_ILLOPC;
- break;
-
- case T_COP_UNUSABLE+T_USER:
- if ((causeReg & CR_COP_ERR) != 0x10000000) {
- i = SIGILL; /* only FPU instructions allowed */
- typ = ILL_ILLOPC;
- break;
- }
- CPU_SwitchFPState(cpuFPCurProcPtr, p->p_md.md_regs);
- cpuFPCurProcPtr = p;
- p->p_md.md_regs[PS] |= SR_COP_1_BIT;
- p->p_md.md_flags |= MDP_FPUSED;
- goto out;
-
- case T_FPE:
-#ifdef DEBUG
- trapDump("fpintr");
-#else
- printf("FPU Trap: PC %x CR %x SR %x\n",
- pc, causeReg, statusReg);
- goto err;
-#endif
-
- case T_FPE+T_USER:
- CPU_FPTrap(statusReg, causeReg, pc);
- goto out;
-
- case T_OVFLOW+T_USER:
- i = SIGFPE;
- typ = FPE_FLTOVF;
- break;
-
- case T_ADDR_ERR_LD: /* misaligned access */
- case T_ADDR_ERR_ST: /* misaligned access */
- case T_BUS_ERR_LD_ST: /* BERR asserted to cpu */
- if (i = ((struct pcb *)UADDR)->pcb_onfault) {
- ((struct pcb *)UADDR)->pcb_onfault = 0;
- return (onfault_table[i]);
- }
- /* FALLTHROUGH */
-
- default:
- err:
-#ifdef DEBUG
- {
- extern struct pcb mdbpcb;
-
- if (usermode)
- mdbpcb = p->p_addr->u_pcb;
- else {
- mdbpcb.pcb_regs[ZERO] = 0;
- mdbpcb.pcb_regs[AST] = ((int *)&args)[2];
- mdbpcb.pcb_regs[V0] = ((int *)&args)[3];
- mdbpcb.pcb_regs[V1] = ((int *)&args)[4];
- mdbpcb.pcb_regs[A0] = ((int *)&args)[5];
- mdbpcb.pcb_regs[A1] = ((int *)&args)[6];
- mdbpcb.pcb_regs[A2] = ((int *)&args)[7];
- mdbpcb.pcb_regs[A3] = ((int *)&args)[8];
- mdbpcb.pcb_regs[T0] = ((int *)&args)[9];
- mdbpcb.pcb_regs[T1] = ((int *)&args)[10];
- mdbpcb.pcb_regs[T2] = ((int *)&args)[11];
- mdbpcb.pcb_regs[T3] = ((int *)&args)[12];
- mdbpcb.pcb_regs[T4] = ((int *)&args)[13];
- mdbpcb.pcb_regs[T5] = ((int *)&args)[14];
- mdbpcb.pcb_regs[T6] = ((int *)&args)[15];
- mdbpcb.pcb_regs[T7] = ((int *)&args)[16];
- mdbpcb.pcb_regs[T8] = ((int *)&args)[17];
- mdbpcb.pcb_regs[T9] = ((int *)&args)[18];
- mdbpcb.pcb_regs[RA] = ((int *)&args)[19];
- mdbpcb.pcb_regs[MULLO] = ((int *)&args)[21];
- mdbpcb.pcb_regs[MULHI] = ((int *)&args)[22];
- mdbpcb.pcb_regs[PC] = pc;
- mdbpcb.pcb_regs[SR] = statusReg;
- bzero((caddr_t)&mdbpcb.pcb_regs[F0], 33 * sizeof(int));
- }
- if (mdb(causeReg, vadr, p, !usermode))
- return (mdbpcb.pcb_regs[PC]);
- }
-#else
-#ifdef DEBUG
- stacktrace();
- trapDump("trap");
-#endif
-#endif
- panic("trap");
- }
- p->p_md.md_regs[PC] = pc;
- p->p_md.md_regs[CAUSE] = causeReg;
- p->p_md.md_regs[BADVADDR] = vadr;
- trapsignal(p, i, ucode, typ, (caddr_t)vadr);
-out:
- /*
- * Note: we should only get here if returning to user mode.
- */
- /* take pending signals */
- while ((i = CURSIG(p)) != 0)
- postsig(i);
- p->p_priority = p->p_usrpri;
- astpending = 0;
- if (want_resched) {
- int s;
-
- /*
- * Since we are curproc, clock will normally just change
- * our priority without moving us from one queue to another
- * (since the running process is not on a queue.)
- * If that happened after we put ourselves on the run queue
- * but before we switched, we might not be on the queue
- * indicated by our priority.
- */
- s = splstatclock();
- setrunqueue(p);
- p->p_stats->p_ru.ru_nivcsw++;
- mi_switch();
- splx(s);
- while ((i = CURSIG(p)) != 0)
- postsig(i);
- }
-
- /*
- * If profiling, charge system time to the trapped pc.
- */
- if (p->p_flag & P_PROFIL) {
- extern int psratio;
-
- addupc_task(p, pc, (int)(p->p_sticks - sticks) * psratio);
- }
-
- curpriority = p->p_priority;
- return (pc);
-}
-
-/*
- * Handle an interrupt.
- * Called from RxK_KernIntr() or RxK_UserIntr()
- * Note: curproc might be NULL.
- */
-interrupt(statusReg, causeReg, pc, what, args)
- unsigned statusReg; /* status register at time of the exception */
- unsigned causeReg; /* cause register at time of exception */
- unsigned pc; /* program counter where to continue */
-{
- register unsigned mask, causemask;
- register int i;
- struct clockframe cf;
-
-#ifdef DEBUG
- trp->status = statusReg;
- trp->cause = causeReg;
- trp->vadr = 0;
- trp->pc = pc;
- trp->ra = 0;
- trp->sp = (int)&args;
- trp->code = 0;
- if (++trp == &trapdebug[TRAPSIZE])
- trp = trapdebug;
-#endif
-
- cnt.v_intr++;
- mask = causeReg & statusReg; /* pending interrupts & enable mask */
- cf.pc = pc;
- cf.sr = statusReg;
- cf.cr = causeReg;
-
-#ifndef R4K
- if(mask & INT_MASK_0) {
- if(R3K_USERMODE(statusReg))
- CPU_FPTrap(statusReg, causeReg, pc);
- else
- printf("FPU Int @ 0x%x\n", pc);
- }
-#endif
-
- /*
- * Check off all enabled interrupts. Called interrupt routine
- * returns mask of interrupts to reenable.
- */
- causemask = 0;
- for(i = 0; i < NHWI; i++) {
- if(cpu_int_tab[i].int_mask & mask) {
- causemask |= cpu_int_tab[i].int_mask;
- causeReg &= (*cpu_int_tab[i].int_hand)(mask, &cf);
- }
- }
- causeReg |= causemask;
- /*
- * Reenable all non served hardware levels.
- */
- splx((statusReg & ~causeReg & HARD_INT_MASK) | SR_INT_ENAB);
-
-
- if (mask & SOFT_INT_MASK_0) {
- clearsoftclock();
- cnt.v_soft++;
- softclock();
- }
- /*
- * Process network interrupt if we trapped or will very soon
- */
- if ((mask & SOFT_INT_MASK_1) ||
- netisr && (statusReg & SOFT_INT_MASK_1)) {
- clearsoftnet();
- cnt.v_soft++;
- intrcnt[1]++;
-#ifdef INET
- if (netisr & (1 << NETISR_ARP)) {
- netisr &= ~(1 << NETISR_ARP);
- arpintr();
- }
- if (netisr & (1 << NETISR_IP)) {
- netisr &= ~(1 << NETISR_IP);
- ipintr();
- }
-#endif
-#ifdef INET6
- if (netisr & (1 << NETISR_IPV6)) {
- netisr &= ~(1 << NETISR_IPV6);
- ipv6intr();
- }
-#endif
-#ifdef NETATALK
- if (netisr & (1 << NETISR_ATALK)) {
- netisr &= ~(1 << NETISR_ATALK);
- atintr();
- }
-#endif
-#ifdef NS
- if (netisr & (1 << NETISR_NS)) {
- netisr &= ~(1 << NETISR_NS);
- nsintr();
- }
-#endif
-#ifdef ISO
- if (netisr & (1 << NETISR_ISO)) {
- netisr &= ~(1 << NETISR_ISO);
- clnlintr();
- }
-#endif
-#include "ppp.h"
-#if NPPP > 0
- if(netisr & (1 << NETISR_PPP)) {
- netisr &= ~(1 << NETISR_PPP);
- pppintr();
- }
-#endif
-#include "bridge.h"
-#if NBRIDGE > 0
- if(netisr & (1 << NETISR_BRIDGE)) {
- netisr &= ~(1 << NETISR_BRIDGE);
- bridgeintr();
- }
-#endif
- }
- if (mask & SOFT_INT_MASK_0) {
- clearsoftclock();
- intrcnt[0]++;
- cnt.v_soft++;
- softclock();
- }
-}
-
-/*
- * Set up handler for external interrupt events.
- * Events are checked in priority order.
- */
-void
-set_intr(mask, int_hand, prio)
- int mask;
- int (*int_hand)();
- int prio;
-{
- if(prio > NHWI)
- panic("set_intr: to high priority");
-
- if(cpu_int_tab[prio].int_mask != 0)
- panic("set_intr: int already set");
-
- cpu_int_tab[prio].int_hand = int_hand;
- cpu_int_tab[prio].int_mask = mask;
-}
-
-/*
- * This is called from RxK_UserIntr() if astpending is set.
- * This is very similar to the tail of trap().
- */
-softintr(statusReg, pc)
- unsigned statusReg; /* status register at time of the exception */
- unsigned pc; /* program counter where to continue */
-{
- register struct proc *p = curproc;
- int sig;
-
- cnt.v_soft++;
- /* take pending signals */
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
- p->p_priority = p->p_usrpri;
- astpending = 0;
- if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
- ADDUPROF(p);
- }
- if (want_resched) {
- int s;
-
- /*
- * Since we are curproc, clock will normally just change
- * our priority without moving us from one queue to another
- * (since the running process is not on a queue.)
- * If that happened after we put ourselves on the run queue
- * but before we switched, we might not be on the queue
- * indicated by our priority.
- */
- s = splstatclock();
- setrunqueue(p);
- p->p_stats->p_ru.ru_nivcsw++;
- mi_switch();
- splx(s);
- while ((sig = CURSIG(p)) != 0)
- postsig(sig);
- }
- curpriority = p->p_priority;
-}
-
-#ifdef DEBUG
-trapDump(msg)
- char *msg;
-{
- register int i;
- int s;
-
- s = splhigh();
- printf("trapDump(%s)\n", msg);
- for (i = 0; i < TRAPSIZE; i++) {
- if (trp == trapdebug)
- trp = &trapdebug[TRAPSIZE - 1];
- else
- trp--;
- if (trp->cause == 0)
- break;
- printf("%s: ADR %x PC %x CR %x SR %x\n",
- trap_type[(trp->cause & CR_EXC_CODE) >>
- CR_EXC_CODE_SHIFT],
- trp->vadr, trp->pc, trp->cause, trp->status);
- printf(" RA %x SP %x code %d\n", trp->ra, trp->sp, trp->code);
- }
- splx(s);
-}
-#endif
-
-/*
- *----------------------------------------------------------------------
- *
- * MemErrorInterrupts --
- *
- * Handler an interrupt for the control register.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-static void
-mips_errintr()
-{
-#if 0
- volatile u_short *sysCSRPtr =
- (u_short *)PHYS_TO_UNCACHED(KN01_SYS_CSR);
- u_short csr;
-
- csr = *sysCSRPtr;
-
- if (csr & KN01_CSR_MERR) {
- printf("Memory error at 0x%x\n",
- *(unsigned *)PHYS_TO_UNCACHED(KN01_SYS_ERRADR));
- panic("Mem error interrupt");
- }
- *sysCSRPtr = (csr & ~KN01_CSR_MBZ) | 0xff;
-#endif
-}
-
-
-/*
- * Return the resulting PC as if the branch was executed.
- */
-unsigned
-CPU_EmulateBranch(regsPtr, instPC, fpcCSR, allowNonBranch)
- unsigned *regsPtr;
- unsigned instPC;
- unsigned fpcCSR;
- int allowNonBranch;
-{
- InstFmt inst;
- unsigned retAddr;
- int condition;
-
-#define GetBranchDest(InstPtr, inst) \
- ((unsigned)InstPtr + 4 + ((short)inst.IType.imm << 2))
-
-
- if(allowNonBranch == 0) {
- inst = *(InstFmt *)instPC;
- }
- else {
- inst = *(InstFmt *)&allowNonBranch;
- }
-#if 0
- printf("regsPtr=%x PC=%x Inst=%x fpcCsr=%x\n", regsPtr, instPC,
- inst.word, fpcCSR); /* XXX */
-#endif
- switch ((int)inst.JType.op) {
- case OP_SPECIAL:
- switch ((int)inst.RType.func) {
- case OP_JR:
- case OP_JALR:
- retAddr = regsPtr[inst.RType.rs];
- break;
-
- default:
- if (!allowNonBranch)
- panic("CPU_EmulateBranch: Non-branch");
- retAddr = instPC + 4;
- break;
- }
- break;
-
- case OP_BCOND:
- switch ((int)inst.IType.rt) {
- case OP_BLTZ:
- case OP_BLTZL:
- case OP_BLTZAL:
- case OP_BLTZALL:
- if ((int)(regsPtr[inst.RType.rs]) < 0)
- retAddr = GetBranchDest(instPC, inst);
- else
- retAddr = instPC + 8;
- break;
-
- case OP_BGEZ:
- case OP_BGEZL:
- case OP_BGEZAL:
- case OP_BGEZALL:
- if ((int)(regsPtr[inst.RType.rs]) >= 0)
- retAddr = GetBranchDest(instPC, inst);
- else
- retAddr = instPC + 8;
- break;
-
- default:
- panic("CPU_EmulateBranch: Bad branch cond");
- }
- break;
-
- case OP_J:
- case OP_JAL:
- retAddr = (inst.JType.target << 2) |
- ((unsigned)instPC & 0xF0000000);
- break;
-
- case OP_BEQ:
- case OP_BEQL:
- if (regsPtr[inst.RType.rs] == regsPtr[inst.RType.rt])
- retAddr = GetBranchDest(instPC, inst);
- else
- retAddr = instPC + 8;
- break;
-
- case OP_BNE:
- case OP_BNEL:
- if (regsPtr[inst.RType.rs] != regsPtr[inst.RType.rt])
- retAddr = GetBranchDest(instPC, inst);
- else
- retAddr = instPC + 8;
- break;
-
- case OP_BLEZ:
- case OP_BLEZL:
- if ((int)(regsPtr[inst.RType.rs]) <= 0)
- retAddr = GetBranchDest(instPC, inst);
- else
- retAddr = instPC + 8;
- break;
-
- case OP_BGTZ:
- case OP_BGTZL:
- if ((int)(regsPtr[inst.RType.rs]) > 0)
- retAddr = GetBranchDest(instPC, inst);
- else
- retAddr = instPC + 8;
- break;
-
- case OP_COP1:
- switch (inst.RType.rs) {
- case OP_BCx:
- case OP_BCy:
- if ((inst.RType.rt & COPz_BC_TF_MASK) == COPz_BC_TRUE)
- condition = fpcCSR & FPC_COND_BIT;
- else
- condition = !(fpcCSR & FPC_COND_BIT);
- if (condition)
- retAddr = GetBranchDest(instPC, inst);
- else
- retAddr = instPC + 8;
- break;
-
- default:
- if (!allowNonBranch)
- panic("CPU_EmulateBranch: Bad coproc branch instruction");
- retAddr = instPC + 4;
- }
- break;
-
- default:
- if (!allowNonBranch)
- panic("CPU_EmulateBranch: Non-branch instruction");
- retAddr = instPC + 4;
- }
-#if 0
- printf("Target addr=%x\n", retAddr); /* XXX */
-#endif
- return (retAddr);
-}
-
-/*
- * This routine is called by procxmt() to single step one instruction.
- * We do this by storing a break instruction after the current instruction,
- * resuming execution, and then restoring the old instruction.
- */
-cpu_singlestep(p)
- register struct proc *p;
-{
- register unsigned va;
- register int *locr0 = p->p_md.md_regs;
- int i;
- int bpinstr = BREAK_SSTEP;
- int curinstr;
- struct uio uio;
- struct iovec iov;
-
- /*
- * Fetch what's at the current location.
- */
- iov.iov_base = (caddr_t)&curinstr;
- iov.iov_len = sizeof(int);
- uio.uio_iov = &iov;
- uio.uio_iovcnt = 1;
- uio.uio_offset = (off_t)locr0[PC];
- uio.uio_resid = sizeof(int);
- uio.uio_segflg = UIO_SYSSPACE;
- uio.uio_rw = UIO_READ;
- uio.uio_procp = curproc;
- procfs_domem(curproc, p, NULL, &uio);
-
- /* compute next address after current location */
- if(curinstr != 0) {
- va = CPU_EmulateBranch(locr0, locr0[PC], locr0[FSR], curinstr);
- }
- else {
- va = locr0[PC] + 4;
- }
- if (p->p_md.md_ss_addr) {
- printf("SS %s (%d): breakpoint already set at %x (va %x)\n",
- p->p_comm, p->p_pid, p->p_md.md_ss_addr, va); /* XXX */
- return (EFAULT);
- }
- p->p_md.md_ss_addr = va;
- /*
- * Fetch what's at the current location.
- */
- iov.iov_base = (caddr_t)&p->p_md.md_ss_instr;
- iov.iov_len = sizeof(int);
- uio.uio_iov = &iov;
- uio.uio_iovcnt = 1;
- uio.uio_offset = (off_t)va;
- uio.uio_resid = sizeof(int);
- uio.uio_segflg = UIO_SYSSPACE;
- uio.uio_rw = UIO_READ;
- uio.uio_procp = curproc;
- procfs_domem(curproc, p, NULL, &uio);
-
- /*
- * Store breakpoint instruction at the "next" location now.
- */
- iov.iov_base = (caddr_t)&bpinstr;
- iov.iov_len = sizeof(int);
- uio.uio_iov = &iov;
- uio.uio_iovcnt = 1;
- uio.uio_offset = (off_t)va;
- uio.uio_resid = sizeof(int);
- uio.uio_segflg = UIO_SYSSPACE;
- uio.uio_rw = UIO_WRITE;
- uio.uio_procp = curproc;
- i = procfs_domem(curproc, p, NULL, &uio);
-#ifdef R4K
- R4K_FlushCache();
-#else
- R3K_FlushCache();
-#endif
-
- if (i < 0)
- return (EFAULT);
-#if 0
- printf("SS %s (%d): breakpoint set at %x: %x (pc %x) br %x\n",
- p->p_comm, p->p_pid, p->p_md.md_ss_addr,
- p->p_md.md_ss_instr, locr0[PC], curinstr); /* XXX */
-#endif
- return (0);
-}
-
-#ifdef DEBUG
-kdbpeek(addr)
-{
- if (addr & 3) {
- printf("kdbpeek: unaligned address %x\n", addr);
- return (-1);
- }
- return (*(int *)addr);
-}
-#endif
-
-#ifdef DEBUG
-#define MIPS_JR_RA 0x03e00008 /* instruction code for jr ra */
-
-/* forward */
-char *fn_name(unsigned addr);
-void stacktrace_subr __P((int, int, int, int, int (*)(const char*, ...)));
-
-/*
- * Print a stack backtrace.
- */
-void
-stacktrace(a0, a1, a2, a3)
- int a0, a1, a2, a3;
-{
- stacktrace_subr(a0, a1, a2, a3, printf);
-}
-
-void
-logstacktrace(a0, a1, a2, a3)
- int a0, a1, a2, a3;
-{
- stacktrace_subr(a0, a1, a2, a3, addlog);
-}
-
-void
-stacktrace_subr(a0, a1, a2, a3, printfn)
- int a0, a1, a2, a3;
- int (*printfn) __P((const char*, ...));
-{
- unsigned pc, sp, fp, ra, va, subr;
- unsigned instr, mask;
- InstFmt i;
- int more, stksize;
- int regs[3];
- extern setsoftclock();
- extern char start[], edata[];
- unsigned int frames = 0;
-
- cpu_getregs(regs);
-
- /* get initial values from the exception frame */
- sp = regs[0];
- pc = regs[1];
- ra = 0;
- fp = regs[2];
-
-/* Jump here when done with a frame, to start a new one */
-loop:
- ra = 0;
-
-/* Jump here after a nonstandard (interrupt handler) frame */
-specialframe:
- stksize = 0;
- subr = 0;
- if (frames++ > 100) {
- (*printfn)("\nstackframe count exceeded\n");
- /* return breaks stackframe-size heuristics with gcc -O2 */
- goto finish; /*XXX*/
- }
-
- /* check for bad SP: could foul up next frame */
- if (sp & 3 || sp < 0x80000000) {
- (*printfn)("SP 0x%x: not in kernel\n", sp);
- ra = 0;
- subr = 0;
- goto done;
- }
-
- /* check for bad PC */
- if (pc & 3 || pc < 0x80000000 || pc >= (unsigned)edata) {
- (*printfn)("PC 0x%x: not in kernel\n", pc);
- ra = 0;
- goto done;
- }
-
- /*
- * Find the beginning of the current subroutine by scanning backwards
- * from the current PC for the end of the previous subroutine.
- */
- if (!subr) {
- va = pc - sizeof(int);
- while ((instr = kdbpeek(va)) != MIPS_JR_RA)
- va -= sizeof(int);
- va += 2 * sizeof(int); /* skip back over branch & delay slot */
- /* skip over nulls which might separate .o files */
- while ((instr = kdbpeek(va)) == 0)
- va += sizeof(int);
- subr = va;
- }
-
- /*
- * Jump here for locore entry pointsn for which the preceding
- * function doesn't end in "j ra"
- */
-stackscan:
- /* scan forwards to find stack size and any saved registers */
- stksize = 0;
- more = 3;
- mask = 0;
- for (va = subr; more; va += sizeof(int),
- more = (more == 3) ? 3 : more - 1) {
- /* stop if hit our current position */
- if (va >= pc)
- break;
- instr = kdbpeek(va);
- i.word = instr;
- switch (i.JType.op) {
- case OP_SPECIAL:
- switch (i.RType.func) {
- case OP_JR:
- case OP_JALR:
- more = 2; /* stop after next instruction */
- break;
-
- case OP_SYSCALL:
- case OP_BREAK:
- more = 1; /* stop now */
- };
- break;
-
- case OP_BCOND:
- case OP_J:
- case OP_JAL:
- case OP_BEQ:
- case OP_BNE:
- case OP_BLEZ:
- case OP_BGTZ:
- more = 2; /* stop after next instruction */
- break;
-
- case OP_COP0:
- case OP_COP1:
- case OP_COP2:
- case OP_COP3:
- switch (i.RType.rs) {
- case OP_BCx:
- case OP_BCy:
- more = 2; /* stop after next instruction */
- };
- break;
-
- case OP_SW:
- /* look for saved registers on the stack */
- if (i.IType.rs != 29)
- break;
- /* only restore the first one */
- if (mask & (1 << i.IType.rt))
- break;
- mask |= (1 << i.IType.rt);
- switch (i.IType.rt) {
- case 4: /* a0 */
- a0 = kdbpeek(sp + (short)i.IType.imm);
- break;
-
- case 5: /* a1 */
- a1 = kdbpeek(sp + (short)i.IType.imm);
- break;
-
- case 6: /* a2 */
- a2 = kdbpeek(sp + (short)i.IType.imm);
- break;
-
- case 7: /* a3 */
- a3 = kdbpeek(sp + (short)i.IType.imm);
- break;
-
- case 30: /* fp */
- fp = kdbpeek(sp + (short)i.IType.imm);
- break;
-
- case 31: /* ra */
- ra = kdbpeek(sp + (short)i.IType.imm);
- }
- break;
-
- case OP_ADDI:
- case OP_ADDIU:
- /* look for stack pointer adjustment */
- if (i.IType.rs != 29 || i.IType.rt != 29)
- break;
- stksize = - ((short)i.IType.imm);
- }
- }
-
-done:
- (*printfn)("%s+%x (%x,%x,%x,%x) ra %x sz %d\n",
- fn_name(subr), pc - subr, a0, a1, a2, a3, ra, stksize);
-
- if (ra) {
- if (pc == ra && stksize == 0)
- (*printfn)("stacktrace: loop!\n");
- else {
- pc = ra;
- sp += stksize;
- ra = 0;
- goto loop;
- }
- } else {
-finish:
- if (curproc)
- (*printfn)("User-level: pid %d\n", curproc->p_pid);
- else
- (*printfn)("User-level: curproc NULL\n");
- }
-}
-
-/*
- * Functions ``special'' enough to print by name
- */
-#ifdef __STDC__
-#define Name(_fn) { (void*)_fn, # _fn }
-#else
-#define Name(_fn) { _fn, "_fn"}
-#endif
-static struct { void *addr; char *name;} names[] = {
- Name(interrupt),
- Name(trap),
-#ifdef R4K
- Name(R4K_KernGenException),
- Name(R4K_UserGenException),
- Name(R4K_KernIntr),
- Name(R4K_UserIntr),
-#else
- Name(R3K_KernGenException),
- Name(R3K_UserGenException),
- Name(R3K_KernIntr),
- Name(R3K_UserIntr),
-#endif
- Name(splx),
- Name(idle),
- Name(cpu_switch),
- {0, 0}
-};
-
-/*
- * Map a function address to a string name, if known; or a hex string.
- */
-char *
-fn_name(unsigned addr)
-{
- static char buf[17];
- int i = 0;
-
- for (i = 0; names[i].name; i++)
- if (names[i].addr == (void*)addr)
- return (names[i].name);
- sprintf(buf, "%x", addr);
- return (buf);
-}
-
-#endif /* DEBUG */
diff --git a/sys/arch/wgrisc/wgrisc/vm_machdep.c b/sys/arch/wgrisc/wgrisc/vm_machdep.c
deleted file mode 100644
index 66b01694e4c..00000000000
--- a/sys/arch/wgrisc/wgrisc/vm_machdep.c
+++ /dev/null
@@ -1,505 +0,0 @@
-/* $OpenBSD: vm_machdep.c,v 1.4 2000/06/08 22:25:23 niklas Exp $ */
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Ralph Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: vm_machdep.c 1.21 91/04/06
- *
- * from: @(#)vm_machdep.c 8.3 (Berkeley) 1/4/94
- * $Id: vm_machdep.c,v 1.4 2000/06/08 22:25:23 niklas Exp $
- */
-
-
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/malloc.h>
-#include <sys/buf.h>
-#include <sys/vnode.h>
-#include <sys/user.h>
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_page.h>
-#if 0
-#include <vm/vm_object.h>
-#endif
-
-#include <machine/pte.h>
-#include <machine/cpu.h>
-
-vm_offset_t kmem_alloc_wait_align();
-
-/*
- * Finish a fork operation, with process p2 nearly set up.
- * Copy and update the kernel stack and pcb, making the child
- * ready to run, and marking it so that it can return differently
- * than the parent. Returns 1 in the child process, 0 in the parent.
- * We currently double-map the user area so that the stack is at the same
- * address in each process; in the future we will probably relocate
- * the frame pointers on the stack after copying.
- */
-cpu_fork(p1, p2, stack, stacksize)
- register struct proc *p1, *p2;
- void *stack;
- size_t stacksize;
-{
- register struct user *up = p2->p_addr;
- register pt_entry_t *pte;
- register int i;
- extern struct proc *cpuFPCurProcPtr;
- struct frame *f;
-
- p2->p_md.md_regs = up->u_pcb.pcb_regs;
- p2->p_md.md_flags = p1->p_md.md_flags & MDP_FPUSED;
-
- /*
- * Cache the PTEs for the user area in the machine dependent
- * part of the proc struct so cpu_switch() can quickly map in
- * the user struct and kernel stack. Note: if the virtual address
- * translation changes (e.g. swapout) we have to update this.
- */
- pte = kvtopte(up);
- for (i = 0; i < UPAGES; i++) {
- p2->p_md.md_upte[i] = pte->pt_entry & ~(PG_G | PG_RO | PG_WIRED);
- pte++;
- }
-
- /*
- * Copy floating point state from the FP chip if this process
- * has state stored there.
- */
- if (p1 == cpuFPCurProcPtr)
- CPU_SaveCurFPState(p1);
-
- /*
- * Copy pcb and stack from proc p1 to p2.
- * We do this as cheaply as possible, copying only the active
- * part of the stack. The stack and pcb need to agree;
- */
- p2->p_addr->u_pcb = p1->p_addr->u_pcb;
- /* cache segtab for ULTBMiss() */
- p2->p_addr->u_pcb.pcb_segtab = (void *)p2->p_vmspace->vm_pmap.pm_segtab;
-
-#ifdef notyet
- /*
- * If specified, give the child a different stack.
- */
- if (stack != NULL)
- /* XXX How??? */;
-#endif
-
- /*
- * Arrange for a non-local goto when the new process
- * is started, to resume here, returning nonzero from setjmp.
- */
-#ifdef DIAGNOSTIC
- if (p1 != curproc)
- panic("cpu_fork: curproc");
-#endif
- if (copykstack(up)) {
- /*
- * Return 1 in child.
- */
- return (1);
- }
- return (0);
-}
-
-/*
- * Finish a swapin operation.
- * We neded to update the cached PTEs for the user area in the
- * machine dependent part of the proc structure.
- */
-void
-cpu_swapin(p)
- register struct proc *p;
-{
- register struct user *up = p->p_addr;
- register pt_entry_t *pte;
- register int i;
-
- /*
- * Cache the PTEs for the user area in the machine dependent
- * part of the proc struct so cpu_switch() can quickly map in
- * the user struct and kernel stack.
- */
- pte = kvtopte(up);
- for (i = 0; i < UPAGES; i++) {
- p->p_md.md_upte[i] = pte->pt_entry & ~(PG_G | PG_RO | PG_WIRED);
- pte++;
- }
-}
-
-/*
- * cpu_exit is called as the last action during exit.
- * We release the address space and machine-dependent resources,
- * including the memory for the user structure and kernel stack.
- * Once finished, we call switch_exit, which switches to a temporary
- * pcb and stack and never returns. We block memory allocation
- * until switch_exit has made things safe again.
- */
-void cpu_exit(p)
- struct proc *p;
-{
- extern struct proc *cpuFPCurProcPtr;
-
- if (cpuFPCurProcPtr == p)
- cpuFPCurProcPtr = (struct proc *)0;
-
- vmspace_free(p->p_vmspace);
-
- (void) splhigh();
- kmem_free(kernel_map, (vm_offset_t)p->p_addr, ctob(UPAGES));
- switch_exit();
- /* NOTREACHED */
-}
-
-/*
- * Dump the machine specific header information at the start of a core dump.
- */
-cpu_coredump(p, vp, cred, core)
- struct proc *p;
- struct vnode *vp;
- struct ucred *cred;
- struct core *core;
-{
- extern struct proc *cpuFPCurProcPtr;
-
- /*
- * Copy floating point state from the FP chip if this process
- * has state stored there.
- */
- if (p == cpuFPCurProcPtr)
- CPU_SaveCurFPState(p);
-
- return (vn_rdwr(UIO_WRITE, vp, (caddr_t)p->p_addr, ctob(UPAGES),
- (off_t)0, UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT, cred, NULL, p));
-}
-
-/*
- * Move pages from one kernel virtual address to another.
- * Both addresses are assumed to reside in the Sysmap,
- * and size must be a multiple of CLSIZE.
- */
-void
-pagemove(from, to, size)
- register caddr_t from, to;
- size_t size;
-{
- register pt_entry_t *fpte, *tpte;
-
- if (size % CLBYTES)
- panic("pagemove");
- fpte = kvtopte(from);
- tpte = kvtopte(to);
-#ifdef R4K
- if(((int)from & CpuCacheAliasMask) != ((int)to & CpuCacheAliasMask)) {
- R4K_HitFlushDCache(from, size);
- }
-#endif
- while (size > 0) {
-#ifdef R4K
- R4K_TLBFlushAddr(from);
- R4K_TLBUpdate(to, *fpte);
-#else
- R3K_TLBFlushAddr(from);
- R3K_TLBUpdate(to, *fpte);
-#endif
- *tpte++ = *fpte;
- fpte->pt_entry = PG_NV | PG_G;
- fpte++;
- size -= NBPG;
- from += NBPG;
- to += NBPG;
- }
-}
-
-extern vm_map_t phys_map;
-
-/*
- * Map an IO request into kernel virtual address space. Requests fall into
- * one of five catagories:
- *
- * B_PHYS|B_UAREA: User u-area swap.
- * Address is relative to start of u-area (p_addr).
- * B_PHYS|B_PAGET: User page table swap.
- * Address is a kernel VA in usrpt (Usrptmap).
- * B_PHYS|B_DIRTY: Dirty page push.
- * Address is a VA in proc2's address space.
- * B_PHYS|B_PGIN: Kernel pagein of user pages.
- * Address is VA in user's address space.
- * B_PHYS: User "raw" IO request.
- * Address is VA in user's address space.
- *
- * All requests are (re)mapped into kernel VA space via the phys_map
- */
-void
-vmapbuf(bp, len)
- struct buf *bp;
- vm_size_t len;
-{
- register caddr_t addr;
- register vm_size_t sz;
- struct proc *p;
- int off;
- vm_offset_t kva;
- register vm_offset_t pa;
-
- if ((bp->b_flags & B_PHYS) == 0)
- panic("vmapbuf");
- addr = bp->b_saveaddr = bp->b_un.b_addr;
- off = (int)addr & PGOFSET;
- p = bp->b_proc;
- sz = round_page(off + len);
- kva = kmem_alloc_wait_align(phys_map, sz, (vm_size_t)addr & CpuCacheAliasMask);
- bp->b_un.b_addr = (caddr_t) (kva + off);
- sz = atop(sz);
- while (sz--) {
- pa = pmap_extract(vm_map_pmap(&p->p_vmspace->vm_map),
- (vm_offset_t)addr);
- if (pa == 0)
- panic("vmapbuf: null page frame");
- pmap_enter(vm_map_pmap(phys_map), kva, trunc_page(pa),
- VM_PROT_READ|VM_PROT_WRITE, TRUE);
- addr += PAGE_SIZE;
- kva += PAGE_SIZE;
- }
-}
-
-/*
- * Free the io map PTEs associated with this IO operation.
- * We also invalidate the TLB entries and restore the original b_addr.
- */
-void
-vunmapbuf(bp, len)
- struct buf *bp;
- vm_size_t len;
-{
- register caddr_t addr = bp->b_un.b_addr;
- register vm_size_t sz;
- vm_offset_t kva;
-
- if ((bp->b_flags & B_PHYS) == 0)
- panic("vunmapbuf");
- sz = round_page(len + ((int)addr & PGOFSET));
- kva = (vm_offset_t)((int)addr & ~PGOFSET);
- kmem_free_wakeup(phys_map, kva, sz);
- bp->b_un.b_addr = bp->b_saveaddr;
- bp->b_saveaddr = NULL;
-}
-
-
-/*
- * SAVE_HINT:
- *
- * Saves the specified entry as the hint for
- * future lookups. Performs necessary interlocks.
- */
-#define SAVE_HINT(map,value) \
- simple_lock(&(map)->hint_lock); \
- (map)->hint = (value); \
- simple_unlock(&(map)->hint_lock);
-
-
-/*
- * kmem_alloc_upage:
- *
- * Allocate pageable memory to the kernel's address map.
- * map must be "kernel_map" below.
- * (Currently only used when allocating U pages).
- */
-vm_offset_t
-kmem_alloc_upage(map, size)
- vm_map_t map;
- register vm_size_t size;
-{
- vm_offset_t addr;
- register int result;
-
-
- size = round_page(size);
-
- addr = vm_map_min(map);
- result = vm_map_find_U(map, NULL, (vm_offset_t) 0,
- &addr, size, TRUE);
- if (result != KERN_SUCCESS) {
- return(0);
- }
-
- return(addr);
-}
-
-/*
- * vm_map_find finds an unallocated region in the target address
- * map with the given length aligned on U viritual address.
- * The search is defined to be first-fit from the specified address;
- * the region found is returned in the same parameter.
- *
- */
-int
-vm_map_find_U(map, object, offset, addr, length, find_space)
- vm_map_t map;
- vm_object_t object;
- vm_offset_t offset;
- vm_offset_t *addr; /* IN/OUT */
- vm_size_t length;
- boolean_t find_space;
-{
- register vm_offset_t start;
- int result;
-
- start = *addr;
- vm_map_lock(map);
- if (find_space) {
- if (vm_map_findspace_align(map, start, length, addr, 0)) {
- vm_map_unlock(map);
- return (KERN_NO_SPACE);
- }
- start = *addr;
- }
- result = vm_map_insert(map, object, offset, start, start + length);
- vm_map_unlock(map);
- return (result);
-}
-
-/*
- * Find sufficient space for `length' bytes in the given map, starting at
- * `start'. The map must be locked. Returns 0 on success, 1 on no space.
- */
-int
-vm_map_findspace_align(map, start, length, addr, align)
- register vm_map_t map;
- register vm_offset_t start;
- vm_size_t length;
- vm_offset_t *addr;
- vm_size_t align;
-{
- register vm_map_entry_t entry, next;
- register vm_offset_t end;
-
- if (start < map->min_offset)
- start = map->min_offset;
- if (start > map->max_offset)
- return (1);
-
- /*
- * Look for the first possible address; if there's already
- * something at this address, we have to start after it.
- */
- if (start == map->min_offset) {
- if ((entry = map->first_free) != &map->header)
- start = entry->end;
- } else {
- vm_map_entry_t tmp;
- if (vm_map_lookup_entry(map, start, &tmp))
- start = tmp->end;
- entry = tmp;
- }
-
- /*
- * Look through the rest of the map, trying to fit a new region in
- * the gap between existing regions, or after the very last region.
- */
- for (;; start = (entry = next)->end) {
- /*
- * Find the end of the proposed new region. Be sure we didn't
- * go beyond the end of the map, or wrap around the address;
- * if so, we lose. Otherwise, if this is the last entry, or
- * if the proposed new region fits before the next entry, we
- * win.
- */
- start = ((start + NBPG -1) & ~(NBPG - 1)); /* Paranoia */
- if((start & CpuCacheAliasMask) <= align) {
- start += align - (start & CpuCacheAliasMask);
- }
- else {
- start = ((start + CpuCacheAliasMask) & ~CpuCacheAliasMask);
- start += align;
- }
-
- end = start + length;
- if (end > map->max_offset || end < start)
- return (1);
- next = entry->next;
- if (next == &map->header || next->start >= end)
- break;
- }
- SAVE_HINT(map, entry);
- *addr = start;
- return (0);
-}
-
-/*
- * kmem_alloc_wait_align
- *
- * Allocates pageable memory from a sub-map of the kernel. If the submap
- * has no room, the caller sleeps waiting for more memory in the submap.
- *
- */
-vm_offset_t
-kmem_alloc_wait_align(map, size, align)
- vm_map_t map;
- vm_size_t size;
- vm_size_t align;
-{
- vm_offset_t addr;
-
- size = round_page(size);
-
- for (;;) {
- /*
- * To make this work for more than one map,
- * use the map's lock to lock out sleepers/wakers.
- */
- vm_map_lock(map);
- if (vm_map_findspace_align(map, 0, size, &addr, align) == 0)
- break;
- /* no space now; see if we can ever get space */
- if (vm_map_max(map) - vm_map_min(map) < size) {
- vm_map_unlock(map);
- return (0);
- }
- assert_wait(map, TRUE);
- vm_map_unlock(map);
- thread_block();
- }
- vm_map_insert(map, NULL, (vm_offset_t)0, addr, addr + size);
- vm_map_unlock(map);
- return (addr);
-}
diff --git a/sys/arch/wgrisc/wgrisc/wgrisctype.h b/sys/arch/wgrisc/wgrisc/wgrisctype.h
deleted file mode 100644
index 77819647fa3..00000000000
--- a/sys/arch/wgrisc/wgrisc/wgrisctype.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* $OpenBSD: wgrisctype.h,v 1.1.1.1 1997/02/06 16:02:47 pefo Exp $ */
-
-/*
- * Copyright (c) 1996 Per Fogelstrom
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed under OpenBSD by
- * Per Fogelstrom.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-/*
- * Mother board type byte of "systype" environment variable.
- */
-#define WGRISC9100 0x1 /* WGRISC 9100 R3081 board */